--- loncom/publisher/lonrights.pm 2003/03/27 20:56:30 1.8 +++ loncom/publisher/lonrights.pm 2005/02/18 23:15:54 1.16 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to show and edit custom distribution rights # -# $Id: lonrights.pm,v 1.8 2003/03/27 20:56:30 www Exp $ +# $Id: lonrights.pm,v 1.16 2005/02/18 23:15:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,11 +36,23 @@ use Apache::lonnet(); use Apache::loncommon(); use HTML::LCParser; use Apache::File; +use Apache::lonlocal; sub handler { my $r=shift; - $r->content_type('text/html'); + my $target = $ENV{'form.grade_target'}; + if ($target eq 'meta') { + &Apache::loncommon::content_type($r,'text/html'); + $r->send_http_header; + $ENV{'request.uri'}=$r->uri; + my $file = &Apache::lonnet::filelocation("",$r->uri); + my $content=&Apache::lonnet::getfile($file); + my $result=&Apache::lonxml::xmlparse(undef,'meta',$content); + $r->print($result); + return OK; + } + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; $r->print( @@ -104,7 +116,7 @@ sub handler { if ($_=~/^form\.action\_(\d+)$/) { my $number=$1; if ($ENV{$_} eq 'delete') { $newrules[$number]=''; } - if (($ENV{$_} eq 'moveup') && ($number>2)) { + if (($ENV{$_} eq 'moveup') && ($number>1)) { my $buffer=$newrules[$number]; $newrules[$number]=$newrules[$number-1]; $newrules[$number-1]=$buffer; @@ -161,12 +173,17 @@ sub handler { my $parser=HTML::LCParser->new(\$contents); my $token; my $rulecounter=0; - my $colzero=($constructmode?'Edit action':'Rule'); + my $colzero=&mt($constructmode?'Edit action':'Rule'); + my %lt=&Apache::lonlocal::texthash('ef' => 'Effect', + 'do' => 'Domain', + 'co' => 'Course', + 'se' => 'Section/Group', + 'ro' => 'Role'); # ---------------------------------------------------------- Start table output $r->print(< - $colzeroEffectDomainCourse -SectionRole + $colzero$lt{'ef'}$lt{'do'}$lt{'co'} +$lt{'se'}$lt{'ro'} ENDSTARTTABLE # --------------------------------------------------------------------- Default # Fast forward to first rule @@ -193,7 +210,8 @@ ENDSTARTTABLE } $r->print('Default'); if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) { - $r->print(' - Error! No default set.'); + $r->print(' - '.&mt('Error! No default set.'). + ''); } $r->print(''); # Additional roles @@ -246,7 +264,7 @@ ENDSTARTTABLE $r->print($rcourse); } - $r->print(''); + $r->print(''); # realm section if ($constructmode) { $r->print(''); + $r->print(''); if ($rcourse) { my %descript= &Apache::lonnet::coursedescription($rdom.'_'.$rcourse); $r->print($descript{'description'}.'   '); } - $r->print(&Apache::loncommon::selectcourse_link('rules', - 'course_'.$rulecounter,'domain_'.$rulecounter)); + if ($constructmode) { + $r->print(&Apache::loncommon::selectcourse_link('rules', + 'course_'.$rulecounter,'domain_'.$rulecounter)); + } # close row $r->print(''); } @@ -285,7 +305,7 @@ ENDSTARTTABLE $r->print(''); # ------------------------------------------------------------ End table output if ($constructmode) { - $r->print(''); + $r->print(''); } $r->print(''); return OK;