<%perl> # Make sure we've got an ID. redirect('/admin/manager/pref') unless defined $id; # Instantiate an object. my $pref = $class->lookup({ id => $id}); # Check authorization. chk_authz($pref, $id ? READ : CREATE); my $no_edit = !chk_authz($pref, EDIT, 1); # Output the header and other necessities. $m->comp('/widgets/wrappers/sharky/header.mc', title => "$disp Profile", context => "Admin | Profile | $disp | "" . $pref->get_name . """ ); $m->out(qq{
\n}); # Output a hidden field with the ID. $m->comp('/widgets/profile/hidden.mc', value => $id, name => 'pref_id'); # Grab the name and output the hidden field. my $name = $pref->get_name; # Set up the select list data. my $vals = $pref->get_opts_href; my $c = scalar keys %$vals; my $opt_type = $pref->get_opt_type; my ($size, $cols, $rows, $props); if ($opt_type eq 'text' || $opt_type eq 'password') { $size = 128; } elsif ($opt_type eq 'radio' || $opt_type eq 'select') { $size = ($c > 15) ? 10 : 1; } $props = { type => $opt_type, vals => $vals, }; $props->{size} = $size if defined $size; # (these are in case textarea is implemented) $props->{cols} = $cols if defined $cols; $props->{rows} = $rows if defined $rows; $m->comp("/widgets/wrappers/sharky/table_top.mc", number => 1, caption => $name); $m->comp('/widgets/profile/displayFormElement.mc', key => 'value', readOnly => $no_edit, vals => { props => $props, disp => 'Value', value => $pref->get_value } ); $m->comp('/widgets/profile/displayFormElement.mc', key => 'can_be_overridden', readOnly => $no_edit, vals => { props => { type => 'checkbox', chk => $pref->get_can_be_overridden }, disp => 'Can be Overridden', value => 1 } ); $m->comp("/widgets/wrappers/sharky/table_bottom.mc"); # Output group membership. $m->out("
\n"); $m->comp("/widgets/grp_membership/grp_membership.mc", grp_class => 'Bric::Util::Grp::Pref', obj => $pref, formName => 'pref_profile', no_edit => $no_edit, widget => $widget, num => 2, ); # Output the form buttons. $m->out("
\n"); $m->comp("/widgets/profile/formButtons.mc", type => $type, section => $widget, no_del => 1, no_save => $no_edit, widget => $type );
<& '/widgets/wrappers/sharky/footer.mc', param => \%ARGS &> <%once>; my $class = 'Bric::Util::Pref'; my $widget = 'profile'; my $type = 'pref'; my $disp = get_disp_name($type); <%args> $id => undef <%doc> ############################################################################### =head1 NAME /admin/profile/preferences/dhandler - Manages application global preferences. =head1 VERSION $LastChangedRevision$ =head1 DATE $LastChangedDate$ =head1 DESCRIPTION Simple interface for managing global preferences.