version 1.25.2.1, 2010/01/27 16:18:17
|
version 1.34, 2012/11/09 15:29:19
|
Line 55 sub handler {
|
Line 55 sub handler {
|
&Apache::loncommon::content_type($r,'text/html'); |
&Apache::loncommon::content_type($r,'text/html'); |
$r->send_http_header; |
$r->send_http_header; |
|
|
|
# Breadcrumbs |
|
&Apache::lonhtmlcommon::clear_breadcrumbs(); |
|
&Apache::lonhtmlcommon::add_breadcrumb({ |
|
'text' => 'Construction Space', |
|
'href' => &Apache::loncommon::authorspace($r->uri), |
|
}); |
|
&Apache::lonhtmlcommon::add_breadcrumb({ |
|
'text' => 'Custom Rights Editor', |
|
'title' => 'Custom Distribution Rights Editor', |
|
'href' => '',}); |
|
|
my $js = &Apache::loncommon::coursebrowser_javascript(). |
my $js = &Apache::loncommon::coursebrowser_javascript(). |
&Apache::loncommon::studentbrowser_javascript(); |
&Apache::loncommon::studentbrowser_javascript(); |
$r->print(&Apache::loncommon::start_page('Custom Distribution Rights',$js)); |
# Breadcrumbs are included by &start_page |
|
$r->print(&Apache::loncommon::start_page('Custom Distribution Rights',$js) |
|
.&Apache::loncommon::head_subbox( |
|
&Apache::loncommon::CSTR_pageheader()) |
|
); |
$r->rflush(); |
$r->rflush(); |
|
|
my $uri=$r->uri; |
my $uri=$r->uri; |
my $fn=&Apache::lonnet::filelocation('',$uri); |
my $fn=&Apache::lonnet::filelocation('',$uri); |
my $contents=''; |
my $contents=''; |
my $constructmode=($uri=~/^\/\~/); |
my $constructmode=($uri=~ m{^/priv/}); |
|
|
# ============================================================ Modify and store |
# ============================================================ Modify and store |
if ($constructmode && $env{'form.store'}) { |
if ($constructmode && $env{'form.store'}) { |
Line 165 sub handler {
|
Line 180 sub handler {
|
$contents=join('',<$fh>); |
$contents=join('',<$fh>); |
$fh->close(); |
$fh->close(); |
} |
} |
$r->print('<form name="rules" method="post">'); |
$r->print('<form name="rules" method="post" action="">'); |
} |
} |
unless ($contents=~/\<accessrule/s) { |
unless ($contents=~/\<accessrule/s) { |
$contents='<accessrule effect="deny" />'; |
$contents='<accessrule effect="deny" />'; |
Line 181 sub handler {
|
Line 196 sub handler {
|
'co' => 'Course / User', |
'co' => 'Course / User', |
'se' => 'Section', |
'se' => 'Section', |
'ro' => 'Role'); |
'ro' => 'Role'); |
|
my %iconimg = ('allow' => '<img src="/adm/lonIcons/navmap.correct.gif"' |
|
.' alt="'.&mt('allow').'" title="'.&mt('allow').'" />', |
|
'deny' => '<img src="/adm/lonIcons/navmap.wrong.gif"' |
|
.' alt="'.&mt('deny').'" title="'.&mt('deny').'" />'); |
# ---------------------------------------------------------- Start table output |
# ---------------------------------------------------------- Start table output |
$r->print(&Apache::loncommon::start_data_table(). |
$r->print(&Apache::loncommon::start_data_table(). |
&Apache::loncommon::start_data_table_header_row(). |
&Apache::loncommon::start_data_table_header_row(). |
Line 195 sub handler {
|
Line 214 sub handler {
|
$r->print(&Apache::loncommon::start_data_table_row().'<td align="right">'); |
$r->print(&Apache::loncommon::start_data_table_row().'<td align="right">'); |
if ($constructmode) { |
if ($constructmode) { |
$r->print(&Apache::loncommon::select_form('','action_0', |
$r->print(&Apache::loncommon::select_form('','action_0', |
('' => '', |
{'' => '', |
'insertbelow' => &mt('Insert rule below')))); |
'insertbelow' => &mt('Insert rule below')})); |
|
|
} else { |
} else { |
$r->print(' '); |
$r->print(' '); |
} |
} |
$r->print('</td><td>'); |
$r->print('</td><td>'); |
|
$r->print($iconimg{$token->[2]->{'effect'}}); |
if ($constructmode) { |
if ($constructmode) { |
$r->print(&Apache::loncommon::select_form |
my %lt = &Apache::lonlocal::texthash |
($token->[2]->{'effect'},'effect_0', |
|
&Apache::lonlocal::texthash |
|
('allow' => 'allow', |
('allow' => 'allow', |
'deny' => 'deny'))); |
'deny' => 'deny'); |
} else { |
$r->print(&Apache::loncommon::select_form |
$r->print($token->[2]->{'effect'}); |
($token->[2]->{'effect'},'effect_0',\%lt)); |
} |
} |
$r->print('</td><td colspan="5">'.&mt('Default')); |
$r->print('</td><td colspan="5">'.&mt('Default')); |
if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) { |
if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) { |
Line 226 sub handler {
|
Line 244 sub handler {
|
# insert, delete, etc |
# insert, delete, etc |
$r->print('<span class="LC_nobreak">'.$rulecounter.'. '); |
$r->print('<span class="LC_nobreak">'.$rulecounter.'. '); |
if ($constructmode) { |
if ($constructmode) { |
|
my %lt = &Apache::lonlocal::texthash |
|
('' => '', |
|
'delete' => 'Delete this rule', |
|
'insertabove' => 'Insert rule above', |
|
'insertbelow' => 'Insert rule below', |
|
'moveup' => 'Move rule up', |
|
'movedown' => 'Move rule down' |
|
); |
|
|
$r->print(&Apache::loncommon::select_form( |
$r->print(&Apache::loncommon::select_form( |
'','action_'.$rulecounter, |
'','action_'.$rulecounter,\%lt)); |
&Apache::lonlocal::texthash |
|
('' => '', |
|
'delete' => 'Delete this rule', |
|
'insertabove' => 'Insert rule above', |
|
'insertbelow' => 'Insert rule below', |
|
'moveup' => 'Move rule up', |
|
'movedown' => 'Move rule down'))); |
|
} |
} |
$r->print('</span></td>'. |
$r->print('</span></td>'. |
'<td rowspan="2">'); |
'<td rowspan="2">'); |
# effect |
# effect |
|
$r->print($iconimg{$token->[2]->{'effect'}}); |
if ($constructmode) { |
if ($constructmode) { |
|
my %lt = &Apache::lonlocal::texthash |
|
('allow' => 'allow', |
|
'deny' => 'deny'); |
$r->print(&Apache::loncommon::select_form |
$r->print(&Apache::loncommon::select_form |
($token->[2]->{'effect'}, |
($token->[2]->{'effect'}, |
'effect_'.$rulecounter, |
'effect_'.$rulecounter,\%lt)); |
&Apache::lonlocal::texthash |
|
('allow' => 'allow', |
|
'deny' => 'deny'))); |
|
} else { |
|
$r->print($token->[2]->{'effect'}); |
|
} |
} |
|
|
# type |
# type |
$r->print('</td><td rowspan="2">'); |
$r->print('</td><td rowspan="2">'); |
my $type = ($token->[2]{'type'} || 'course'); |
my $type = ($token->[2]{'type'} || 'course'); |
if ($constructmode) { |
if ($constructmode) { |
|
my %lt = &Apache::lonlocal::texthash |
|
('course' => 'Course', |
|
'user' => 'User'); |
$r->print(&Apache::loncommon::select_form($type, |
$r->print(&Apache::loncommon::select_form($type, |
'type_'.$rulecounter, |
'type_'.$rulecounter,\%lt)); |
&Apache::lonlocal::texthash |
|
('course' => 'Course', |
|
'user' => 'User'))); |
|
} else { |
} else { |
$r->print($type); |
$r->print(&mt($type)); |
} |
} |
|
|
# ---- realm |
# ---- realm |
Line 313 sub handler {
|
Line 332 sub handler {
|
my $role=$token->[2]->{'role'}; |
my $role=$token->[2]->{'role'}; |
unless ($role) { $role=''; } |
unless ($role) { $role=''; } |
$r->print(&Apache::loncommon::select_form( |
$r->print(&Apache::loncommon::select_form( |
$role,'role_'.$rulecounter,%hash)); |
$role,'role_'.$rulecounter,\%hash)); |
} else { |
} else { |
$r->print(&Apache::lonnet::plaintext($token->[2]->{'role'})); |
$r->print(&Apache::lonnet::plaintext($token->[2]->{'role'})); |
} |
} |