');
+ $r->print(&Apache::loncommon::start_data_table_row().' ');
if ($constructmode) {
$r->print(&Apache::loncommon::select_form('','action_0',
('' => '',
- 'insertbelow' => 'Insert rule below ')));
+ 'insertbelow' => &mt('Insert rule below'))));
} else {
$r->print(' ');
@@ -201,51 +220,75 @@ ENDSTARTTABLE
if ($constructmode) {
$r->print(&Apache::loncommon::select_form
($token->[2]->{'effect'},'effect_0',
+ &Apache::lonlocal::texthash
('allow' => 'allow',
'deny' => 'deny')));
} else {
$r->print($token->[2]->{'effect'});
}
- $r->print(' Default');
+ $r->print(' '.&mt('Default'));
if (($token->[2]->{'realm'}) || ($token->[2]->{'role'})) {
- $r->print(' - '.&mt('Error! No default set.').
- ' ');
+ $r->print(' - '.&mt('Error! No default set.').
+ ' ');
}
- $r->print(' ');
+ $r->print(''.&Apache::loncommon::end_data_table_row());
# Additional roles
while ($token=$parser->get_token) {
if (($token->[0] eq 'S') && ($token->[1] eq 'accessrule')) {
$rulecounter++;
- $r->print('');
+ $r->print(&Apache::loncommon::start_data_table_row().
+ ' ');
# insert, delete, etc
- $r->print($rulecounter.'. ');
+ $r->print(''.$rulecounter.'. ');
if ($constructmode) {
$r->print(&Apache::loncommon::select_form(
'','action_'.$rulecounter,
+ &Apache::lonlocal::texthash
('' => '',
'delete' => 'Delete this rule',
'insertabove' => 'Insert rule above',
- 'insertbelow' => 'Insert rule below ',
+ 'insertbelow' => 'Insert rule below',
'moveup' => 'Move rule up',
'movedown' => 'Move rule down')));
}
- $r->print(' ');
+ $r->print(' '.
+ '');
# effect
if ($constructmode) {
$r->print(&Apache::loncommon::select_form
($token->[2]->{'effect'},
'effect_'.$rulecounter,
+ &Apache::lonlocal::texthash
('allow' => 'allow',
'deny' => 'deny')));
} else {
$r->print($token->[2]->{'effect'});
}
- $r->print(' ');
+
+# type
+ $r->print(' ');
+ my $type = ($token->[2]{'type'} || 'course');
+ if ($constructmode) {
+ $r->print(&Apache::loncommon::select_form($type,
+ 'type_'.$rulecounter,
+ &Apache::lonlocal::texthash
+ ('course' => 'Course',
+ 'user' => 'User')));
+ } else {
+ $r->print($type);
+ }
+
# ---- realm
my $realm=$token->[2]->{'realm'};
- my ($rdom,$rcourse,$rsec)=split(/[\/\_]/,$realm);
- $rdom = &LONCAPA::clean_domain($rdom);
- $rcourse = &LONCAPA::clean_courseid($rcourse);
+ my ($rdom,$rcourse,$rsec);
+ if ($type eq 'course') {
+ ($rdom,$rcourse,$rsec) = split(m{[/_]},$realm,3);
+ $rcourse = &LONCAPA::clean_courseid($rcourse);
+ } else {
+ ($rdom,$rcourse,$rsec) = split(m{/},$realm,3);
+ $rcourse = &LONCAPA::clean_username($rcourse);
+ }
+ $r->print(' ');
# realm domain
if ($constructmode) {
unless ($rdom) { $rdom=$env{'user.domain'}; }
@@ -257,52 +300,69 @@ ENDSTARTTABLE
$r->print(' ');
# realm course
if ($constructmode) {
- $r->print(' ');
} else {
$r->print($rcourse);
}
- $r->print(' ');
+ $r->print(' ');
# realm section
- if ($constructmode) {
- $r->print(' ');
- } else {
- $r->print($rsec);
- }
+ if ($type eq 'course') {
+ 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(&Apache::lonnet::plaintext($token->[2]->{'role'}));
- }
+ if ($type eq 'course') {
+ 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(&Apache::lonnet::plaintext($token->[2]->{'role'}));
+ }
+ }
# course selection link
- $r->print(' ');
- if ($rcourse) {
- my %descript=
- &Apache::lonnet::coursedescription($rdom.'_'.$rcourse,
- {'one_time' => 1});
- $r->print($descript{'description'}.' ');
- }
- if ($constructmode) {
- $r->print(&Apache::loncommon::selectcourse_link('rules',
- 'course_'.$rulecounter,'domain_'.$rulecounter));
+ $r->print(' '.
+ &Apache::loncommon::end_data_table_row().
+ &Apache::loncommon::continue_data_table_row().
+ '');
+ if ($type eq 'course') {
+ if ($rcourse) {
+ my %descript=
+ &Apache::lonnet::coursedescription($rdom.'_'.$rcourse,
+ {'one_time' => 1});
+ $r->print($descript{'description'}.' ');
+ }
+ if ($constructmode) {
+ $r->print(&Apache::loncommon::selectcourse_link('rules',
+ 'course_'.$rulecounter,'domain_'.$rulecounter));
+ }
+ } else {
+ if ($rcourse) {
+ my $name = &Apache::loncommon::plainname($rcourse,$rdom);
+ $r->print($name.' ');
+ }
+ if ($constructmode) {
+ $r->print(&Apache::loncommon::selectstudent_link('rules','course_'.$rulecounter,'domain_'.$rulecounter));
+ }
}
# close row
- $r->print(' ');
+ $r->print(''.&Apache::loncommon::end_data_table_row());
}
}
- $r->print('');
+ $r->print(&Apache::loncommon::end_data_table());
# ------------------------------------------------------------ End table output
if ($constructmode) {
$r->print('