#!/usr/local/bin/perl # index.cgi # Display a list of services, built from svcs command require './smf-lib.pl'; &ReadParse(); &ui_print_header(undef, $text{'property_group_editor_title'}, ""); # get instance fmri if (defined($in{'fmri'})) { $fmri = $in{'fmri'}; # remove quotes... $fmri =~ /\'([^\']*)\'/; $fmri = $1; if ($fmri =~ /(svc:\/[^:]*):(.*)/) { $svc = $1; $inst = $2; } else { &error("Invalid fmri: instance must be specified!"); } } else { &error("No fmri supplied to property group editor!"); } # deal with add/deletion of property groups first. this way # pgroup list will show changes... if ((defined($in{'add'})) && (defined($in{'addname'})) && (defined($in{'addtype'})) && (defined($in{'addsinst'}))) { $addname = "$in{'addname'}"; $addtype = "$in{'addtype'}"; $addsinst = "$in{'addsinst'}"; if (($addname =~ /.+/) && ($addtype =~ /.+/) && ($addsinst =~ /.+/)) { &svc_addpg("$svc", "$addsinst", "$addname", "$addtype"); } } if (defined($in{'remove'})) { # get remove pg list @remove_pgs = split(/\0/, $in{'applyto'}); foreach $rpg (@remove_pgs) { # split into service or instance level/name if ($rpg =~ /([^\/]*)\/(.*)/) { $pgsinst = $1; $pgname = $2; &svc_delpg("$svc", "$pgsinst", "$pgname"); } } } @pgroup_listing_svc = &svc_listpg($svc, "service"); @pgroup_listing_inst = &svc_listpg($svc, $inst); @pgroup_listing = (@pgroup_listing_svc, @pgroup_listing_inst); print "

"; &text_and_whats_this("property_group_editor_detail"); print " : $fmri

\n"; print "
\n"; # add pg table first... print "

$text{'property_group_editor_addpg'}

\n"; print ""; print "\n"; print "\n"; print "\n"; print "\n"; print "
$text{'property_group_editor_addsinst'}$text{'property_group_editor_addname'}$text{'property_group_editor_addtype'}
\n"; @sinstarray = ("service", "$inst"); &print_selection("addsinst", "service", \@sinstarray); print "\n"; print "\n"; print "\n"; print "\n"; print "
  "; print "\n"; print "
\n"; print "\n"; print "\n"; print "
\n"; print "
$text{'property_group_editor_apply'}: "; print " \n"; print "
\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; foreach $pg (@pgroup_listing) { print ""; $sinst = $pg->{'sinst'}; $name = $pg->{'pgroup_name'}; $type = $pg->{'pgroup_type'}; print "\n"; print "\n"; } print "
$text{'property_group_editor_select'}$text{'property_group_editor_sinst'}$text{'property_group_editor_pgroup_name'}$text{'property_group_editor_pgroup_type'}
\n"; print ""; print "\n"; print "$sinst\n"; # don't allow edit of nonpersistent items! if ($type =~ /NONPERSISTENT/) { print "$name"; } else { $entity = ($sinst eq "service") ? "$svc" : "$fmri"; print "$name"; } print "$type
\n"; &print_cmds_run(); &ui_print_footer("instance_viewer.cgi?fmri='$fmri'", $text{'property_group_editor_back'});