3 # Display a list of services, built from svcs command
5 require './smf-lib.pl';
7 &ui_print_header(undef, $text{'property_group_editor_title'}, "");
10 if (defined($in{'fmri'})) {
13 $fmri =~ /\'([^\']*)\'/;
15 if ($fmri =~ /(svc:\/[^:]*):(.*)/) {
19 &error("Invalid fmri: instance must be specified!");
22 &error("No fmri supplied to property group editor!");
25 # deal with add/deletion of property groups first. this way
26 # pgroup list will show changes...
27 if ((defined($in{'add'})) &&
28 (defined($in{'addname'})) &&
29 (defined($in{'addtype'})) &&
30 (defined($in{'addsinst'}))) {
31 $addname = "$in{'addname'}";
32 $addtype = "$in{'addtype'}";
33 $addsinst = "$in{'addsinst'}";
34 if (($addname =~ /.+/) && ($addtype =~ /.+/) && ($addsinst =~ /.+/)) {
35 &svc_addpg("$svc", "$addsinst", "$addname", "$addtype");
38 if (defined($in{'remove'})) {
40 @remove_pgs = split(/\0/, $in{'applyto'});
41 foreach $rpg (@remove_pgs) {
42 # split into service or instance level/name
43 if ($rpg =~ /([^\/]*)\/(.*)/) {
46 &svc_delpg("$svc", "$pgsinst", "$pgname");
51 @pgroup_listing_svc = &svc_listpg($svc, "service");
52 @pgroup_listing_inst = &svc_listpg($svc, $inst);
53 @pgroup_listing = (@pgroup_listing_svc, @pgroup_listing_inst);
56 &text_and_whats_this("property_group_editor_detail");
57 print " : $fmri </h2>\n";
59 print "<form method=\"POST\" action=\"property_group_editor.cgi?fmri='$fmri'\">\n";
61 # add pg table first...
62 print "<p><h3>$text{'property_group_editor_addpg'}</h3>\n";
64 print "<td><b>$text{'property_group_editor_addsinst'}</b></td>\n";
65 print "<td><b>$text{'property_group_editor_addname'}</b></td>\n";
66 print "<td><b>$text{'property_group_editor_addtype'}</b></td></tr>\n";
68 @sinstarray = ("service", "$inst");
69 &print_selection("addsinst", "service", \@sinstarray);
71 print "<input size=30 name=\"addname\" value=\"\">\n";
73 print "<input size=30 name=\"addtype\" value=\"\">\n";
75 print "<tr><td> </td><td> </td><td>";
76 print "<input type=submit name=\"add\" value=\"$text{'property_group_editor_add'}\">\n";
77 print "</td></tr></table></b>\n";
79 print "<table border width=100%>\n";
80 print "<tr><td><table width=100%>\n";
81 print "<tr $cb><td><b>$text{'property_group_editor_apply'}</b>: ";
82 print "<input type=submit name=\"remove\" onClick=\"return (confirm(\'$text{'property_group_editor_deleteconfirm'}\'))\" value=\"$text{'property_group_editor_delete'}\"> \n";
83 print "</td></tr></table></td></tr>\n";
84 print "<tr><td><table width=100%>\n";
86 print "<td><b>$text{'property_group_editor_select'}</b></td>\n";
87 print "<td><b>$text{'property_group_editor_sinst'}</b></td>\n";
88 print "<td><b>$text{'property_group_editor_pgroup_name'}</b></td>\n";
89 print "<td><b>$text{'property_group_editor_pgroup_type'}</b></td></tr>\n";
91 foreach $pg (@pgroup_listing) {
93 $sinst = $pg->{'sinst'};
94 $name = $pg->{'pgroup_name'};
95 $type = $pg->{'pgroup_type'};
97 print "<input type=checkbox name=\"applyto\" value=\"$sinst/$name\">";
99 print "$sinst</td><td>\n";
100 # dont allow edit of nonpersistent items!
101 if ($type =~ /NONPERSISTENT/) {
104 $entity = ($sinst eq "service") ? "$svc" : "$fmri";
106 "<a href=\"property_editor.cgi?fmri='$fmri'&sinst=$sinst&pgroup=$name\">$name</a>";
108 print "</td><td>$type</td>\n";
111 print "</table></td></tr></table></form>\n";
115 &ui_print_footer("instance_viewer.cgi?fmri='$fmri'",
116 $text{'property_group_editor_back'});