--- loncom/publisher/lonrights.pm 2003/03/20 16:17:37 1.3 +++ loncom/publisher/lonrights.pm 2003/03/20 19:20:31 1.4 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to show and edit custom distribution rights # -# $Id: lonrights.pm,v 1.3 2003/03/20 16:17:37 www Exp $ +# $Id: lonrights.pm,v 1.4 2003/03/20 19:20:31 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -68,8 +68,13 @@ sub handler { my $parser=HTML::LCParser->new(\$contents); my $token; my $rulecounter=0; + my $colzero=($constructmode?'Edit action':'Rule'); # ---------------------------------------------------------- Start table output - $r->print('
$colzero | Effect | Domain | Course | +Section | Role | Default'); + $r->print(' | Default'); if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) { $r->print(' - Error! No default set.'); } @@ -94,7 +99,18 @@ sub handler { if (($token->[0] eq 'S') && ($token->[1] eq 'accessrule')) { $rulecounter++; $r->print(' |
---|---|---|---|---|---|
'); -# inset, delete, etc +# insert, delete, etc + $r->print($rulecounter.'. '); + if ($constructmode) { + $r->print(&Apache::loncommon::select_form( + '','action_'.$rulecounter, + ('' => '', + 'delete' => 'Delete this rule', + 'insertabove' => 'Insert rule above', + 'insertbelow' => 'Insert rule below', + 'moveup' => 'Move rule up', + 'movedown' => 'Move rule down'))); + } $r->print(' | '); # effect if ($constructmode) { @@ -107,21 +123,48 @@ sub handler { $r->print($token->[2]->{'effect'}); } $r->print(' | '); -# realm +# ---- realm my $realm=$token->[2]->{'realm'}; $realm=~s/^\W//; - my ($rdom,$rcourse,$rsec)=split(/(\/|\_)/,$realm); + my ($rdom,$rcourse,$rsec)=split(/[\/\_]/,$realm); +# realm role if ($constructmode) { $r->print(&Apache::loncommon::select_dom_form($rdom, 'domain_'.$rulecounter)); } else { - $r->print($token->[2]->{'realm'}); + $r->print($rdom); + } + $r->print(' | '); +# realm course + if ($constructmode) { + $r->print(''); + } else { + $r->print($rcourse); } + + $r->print(' | '); +# realm section + if ($constructmode) { + $r->print(''); + } else { + $r->print($rsec); + } + $r->print(' | '); # role if ($constructmode) { + my %hash=('' => ''); + foreach ('au','cc','in','ta','st') { + $hash{$_}=&Apache::lonnet::plaintext($_); + } + my $role=$token->[2]->{'role'}; + unless ($role) { $role=''; } + $r->print(&Apache::loncommon::select_form( + $role,'role_'.$rulecounter,%hash)); } else { - $r->print($token->[2]->{'role'}); + $r->print(&Apache::lonnet::plaintext($token->[2]->{'role'})); } # close row $r->print(' |