--- loncom/publisher/lonrights.pm 2003/03/21 14:13:30 1.7 +++ loncom/publisher/lonrights.pm 2004/05/18 13:44:56 1.14 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to show and edit custom distribution rights # -# $Id: lonrights.pm,v 1.7 2003/03/21 14:13:30 www Exp $ +# $Id: lonrights.pm,v 1.14 2004/05/18 13:44:56 taceyjo1 Exp $ # # Copyright Michigan State University Board of Trustees # @@ -36,15 +36,28 @@ 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( - 'LON-CAPA Custom Distribution Rights'); + 'LON-CAPA Custom Distribution Rights'. + &Apache::loncommon::coursebrowser_javascript().''); $r->print(&Apache::loncommon::bodytag('Custom Distribution Rights')); $r->rflush(); @@ -152,7 +165,7 @@ sub handler { $contents=join('',<$fh>); $fh->close(); } - $r->print('
'); + $r->print(''); } unless ($contents=~/\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', + 'ua' => 'Use Access', + 'sa' => 'Source Access'); # ---------------------------------------------------------- Start table output $r->print(< - $colzeroEffectDomainCourse -SectionRole + $colzero$lt{'ef'}$lt{'do'}$lt{'co'} +$lt{'se'}$lt{'ro'}$lt{'ua'}$lt{'sa'} ENDSTARTTABLE # --------------------------------------------------------------------- Default # Fast forward to first rule @@ -190,16 +210,17 @@ ENDSTARTTABLE } else { $r->print($token->[2]->{'effect'}); } - $r->print('Default'); + $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 while ($token=$parser->get_token) { if (($token->[0] eq 'S') && ($token->[1] eq 'accessrule')) { $rulecounter++; - $r->print(''); + $r->print(''); # insert, delete, etc $r->print($rulecounter.'. '); if ($constructmode) { @@ -212,7 +233,7 @@ ENDSTARTTABLE 'moveup' => 'Move rule up', 'movedown' => 'Move rule down'))); } - $r->print(''); + $r->print(''); # effect if ($constructmode) { $r->print(&Apache::loncommon::select_form @@ -254,7 +275,7 @@ ENDSTARTTABLE $r->print($rsec); } - $r->print(''); + $r->print(''); # role if ($constructmode) { my %hash=('' => ''); @@ -268,6 +289,23 @@ ENDSTARTTABLE } else { $r->print(&Apache::lonnet::plaintext($token->[2]->{'role'})); } +# use access + # if ($constructmode) { + # + # } else { + # $r->print(&Apache::lonnet::plaintext($token->[2]->{'role'})); + # } +# course selection link + $r->print(''); + if ($rcourse) { + my %descript= + &Apache::lonnet::coursedescription($rdom.'_'.$rcourse); + $r->print($descript{'description'}.'   '); + } + if ($constructmode) { + $r->print(&Apache::loncommon::selectcourse_link('rules', + 'course_'.$rulecounter,'domain_'.$rulecounter)); + } # close row $r->print(''); } @@ -275,7 +313,7 @@ ENDSTARTTABLE $r->print(''); # ------------------------------------------------------------ End table output if ($constructmode) { - $r->print(''); + $r->print(''); } $r->print(''); return OK;