[LON-CAPA-cvs] cvs: loncom /publisher lonrights.pm
www
lon-capa-cvs@mail.lon-capa.org
Thu, 20 Mar 2003 21:47:57 -0000
www Thu Mar 20 16:47:57 2003 EDT
Modified files:
/loncom/publisher lonrights.pm
Log:
Editing commands - need more testing
Index: loncom/publisher/lonrights.pm
diff -u loncom/publisher/lonrights.pm:1.5 loncom/publisher/lonrights.pm:1.6
--- loncom/publisher/lonrights.pm:1.5 Thu Mar 20 15:58:40 2003
+++ loncom/publisher/lonrights.pm Thu Mar 20 16:47:57 2003
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Handler to show and edit custom distribution rights
#
-# $Id: lonrights.pm,v 1.5 2003/03/20 20:58:40 www Exp $
+# $Id: lonrights.pm,v 1.6 2003/03/20 21:47:57 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -99,6 +99,34 @@
}
}
# edit actions?
+ foreach (keys %ENV) {
+ if ($_=~/^form\.action\_(\d+)$/) {
+ my $number=$1;
+ if ($ENV{$_} eq 'delete') { $newrules[$number]=''; }
+ if (($ENV{$_} eq 'moveup') && ($number>2)) {
+ my $buffer=$newrules[$number];
+ $newrules[$number]=$newrules[$number-1];
+ $newrules[$number-1]=$buffer;
+ }
+ if (($ENV{$_} eq 'movedown') && ($number<$#newrules)) {
+ my $buffer=$newrules[$number];
+ $newrules[$number]=$newrules[$number+1];
+ $newrules[$number+1]=$buffer;
+ }
+ if ($ENV{$_} eq 'insertabove') {
+ for (my $i=$#newrules;$i>=$number;$i--) {
+ $newrules[$i+1]=$newrules[$i];
+ }
+ $newrules[$number]='deny';
+ }
+ if ($ENV{$_} eq 'insertbelow') {
+ for (my $i=$#newrules;$i>$number;$i--) {
+ $newrules[$i+1]=$newrules[$i];
+ }
+ $newrules[$number+1]='deny';
+ }
+ }
+ }
# store file
my $fh=Apache::File->new('>'.$fn);
@@ -144,7 +172,16 @@
$token=$parser->get_token;
while ($token->[1] ne 'accessrule') { $token=$parser->get_token; }
# print default
- $r->print('<tr><td> </td><td>');
+ $r->print('<tr><td>');
+ if ($constructmode) {
+ $r->print(&Apache::loncommon::select_form('','action_0',
+ ('' => '',
+ 'insertbelow' => 'Insert rule below')));
+
+ } else {
+ $r->print(' ');
+ }
+ $r->print('</td><td>');
if ($constructmode) {
$r->print(&Apache::loncommon::select_form
($token->[2]->{'effect'},'effect_0',