-
- $text{'upload_label'}
- |
- $groupitem
+ my $escuri = &HTML::Entities::encode($r->uri,'&<>"');
+ $r->print(<<"TABLE");
+
+
+
+ $text{'upload_label'}
+ |
+
+ |
-
-
-
+
+
+
TABLE
+ }
my @tree = split (/\//,$current_path);
- $r->print(''.&make_anchor($url,$port_path,'/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"},$group).'/');
+ $r->print(''.&make_anchor($url,$port_path,'/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"},$group).'/');
if (@tree > 1){
my $newCurrentPath = '';
for (my $i = 1; $i< @tree; $i++){
@@ -106,11 +116,11 @@ TABLE
$r->print(&make_anchor($url,$tree[$i],'/'.$newCurrentPath, $env{"form.mode"},$env{"form.fieldname"}, $env{"form.continue"},$group).'/');
}
}
- $r->print('');
+ $r->print('');
&Apache::lonhtmlcommon::store_recent($namespace,$current_path,$current_path);
- $r->print(' ");
}
sub display_directory {
- my ($r,$url,$current_path,$is_empty,$dir_list,$group)=@_;
+ my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,
+ $can_modify,$can_delete,$can_setacl)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
my ($groupitem,$groupecho);
my $display_out;
@@ -126,10 +137,15 @@ sub display_directory {
my $checked_files;
my $port_path = &get_port_path($group);
my ($uname,$udom) = &get_name_dom($group);
- if (defined($group)) {
+ my $access_admin_text = &mt('View Status');
+ if ($can_setacl) {
+ $access_admin_text = &mt('View/Change Status');
+ }
+ if ((defined($group)) && (defined($env{'request.course.id'}))) {
$groupitem = '';
$groupecho = '&group='.$group;
}
+
my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom,
$uname);
my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash(
@@ -141,7 +157,7 @@ sub display_directory {
$checked_files =&Apache::lonnet::files_in_path($uname,$env{'form.currentpath'});
$select_mode = 'true';
}
- if ($is_empty && ($current_path ne '/')) {
+ if ($is_empty && ($current_path ne '/') && $can_delete) {
$display_out = ' | ');
+ $r->print(&Apache::loncommon::end_data_table_row());
+ $count ++;
+ }
+ }
+}
+
+
sub update_access {
my ($r,$url,$group) = @_;
- my $function = &Apache::loncommon::get_users_function();
- my $tablecolor = &Apache::loncommon::designparm($function.'.tabbg');
my $totalprocessed = 0;
my %processing;
my %title = (
@@ -547,16 +735,18 @@ sub update_access {
my $updated_controls = $access_controls{$file_name};
my ($showstart,$showend);
$r->print(&Apache::loncommon::start_data_table());
- $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print(&Apache::loncommon::start_data_table_header_row());
$r->print(''.&mt('Type of change').' | '.
&mt('Access control').' | '.&mt('Dates available').
' | '.&mt('Additional information').' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
+ $r->print(&Apache::loncommon::end_data_table_header_row());
foreach my $chg (sort(keys(%processing))) {
if (@{$processing{$chg}} > 0) {
if ($chg eq 'delete') {
if (!($deloutcome eq 'ok')) {
- $errors .= &mt('A problem occurred deleting access controls: [_1]',$deloutcome);
+ $errors .=''.
+ &mt('A problem occurred deleting access controls: [_1]',$deloutcome).
+ '';
next;
}
}
@@ -565,100 +755,24 @@ sub update_access {
$r->print(''.&mt($title{$chg}).
'. | ');
my $count = 0;
+ my %todisplay;
foreach my $key (sort(keys(%{$$changes{$chg}}))) {
- if ($count) {
- $r->print(&Apache::loncommon::start_data_table_row());
- }
- my ($num,$scope,$end,$start) = &unpack_acc_key($key);
+ my ($num,$scope,$end,$start) = &unpack_acc_key($key);
my $newkey = $key;
if ($chg eq 'activate') {
$newkey =~ s/^(\d+)/$$translation{$1}/;
}
- my $content = $$updated_controls{$newkey};
- if ($chg eq 'delete') {
- $showstart = &mt('Deleted');
- $showend = $showstart;
- } else {
- $showstart = localtime($start);
- if ($end == 0) {
- $showend = &mt('No end date');
- } else {
- $showend = localtime($end);
- }
- }
- $r->print(''.&mt($scope));
- if (($scope eq 'course') || ($scope eq 'group')) {
- if ($chg ne 'delete') {
- my $cid = $content->{'domain'}.'_'.$content->{'number'};
- my %course_description = &Apache::lonnet::coursedescription($cid);
- $r->print(' ('.$course_description{'description'}.')');
- }
- }
- $r->print(' | '.&mt('Start: ').$showstart.
- ' '.&mt('End: ').$showend.' | ');
- if ($chg ne 'delete') {
- if ($scope eq 'guest') {
- $r->print(&mt('Password').': '.$content->{'password'});
- } elsif ($scope eq 'course' || $scope eq 'group') {
- $r->print('');
- $r->print(''.&mt('Roles').' | '.
- &mt('Access').' | '.
- &mt('Sections').' | ');
- if ($scope eq 'course') {
- $r->print(''.&mt('Groups').' | ');
- } else {
- $r->print(''.&mt('Teams').' | ');
- }
- $r->print(' ');
- foreach my $id (sort(keys(%{$content->{'roles'}}))) {
- $r->print('');
- foreach my $item ('role','access','section','group') {
- $r->print('');
- if ($item eq 'role') {
- my $ucscope = $scope;
- $ucscope =~ s/^(\w)/uc($1)/;
- my $role_output;
- foreach my $role (@{$content->{'roles'}{$id}{$item}}) {
- if ($role eq 'all') {
- $role_output .= $role.',';
- } elsif ($role =~ /^cr/) {
- $role_output .= (split('/',$role))[3].',';
- } else {
- $role_output .= &Apache::lonnet::plaintext($role,$ucscope).',';
- }
- }
- $role_output =~ s/,$//;
- $r->print($role_output);
- } else {
- $r->print(join(',',@{$content->{'roles'}{$id}{$item}}));
- }
- $r->print(' | ');
- }
- }
- $r->print(&Apache::loncommon::end_data_table_row());
- $r->print(&Apache::loncommon::end_data_table());
- } elsif ($scope eq 'domains') {
- $r->print(&mt('Domains: ').join(',',@{$content->{'dom'}}));
- } elsif ($scope eq 'users') {
- my $curr_user_list = &sort_users($content->{'users'});
- $r->print(&mt('Users: ').$curr_user_list);
- } else {
- $r->print(' ');
- }
- } else {
- $r->print(' ');
- }
- $r->print('');
- $r->print(&Apache::loncommon::end_data_table_row());
- $count ++;
+ $todisplay{$scope}{$newkey} = $$updated_controls{$newkey};
}
+ &build_access_summary($r,$count,$chg,%todisplay);
}
}
$r->print(&Apache::loncommon::end_data_table());
} else {
if ((@{$processing{'activate'}} > 0) || (@{$processing{'update'}} > 0)) {
- $errors .= &mt('A problem occurred storing access control settings: [_1]',$outcome);
+ $errors .= ''.
+ &mt('A problem occurred storing access control settings: [_1]',$outcome).
+ '';
}
}
if ($errors) {
@@ -692,8 +806,12 @@ sub update_access {
}
&close_form($r,$url,$group);
} else {
+ my $group_arg;
+ if ($group) {
+ $group_arg = '&group='.$group;
+ }
$r->print(' '.
+ '¤tpath='.$env{'form.currentpath'}.$group_arg.'">'.
&mt('Display all access settings for this file').'');
}
return;
@@ -830,9 +948,9 @@ sub access_setting_table {
$r->print('');
$r->print(''.&mt('Public access:').' '.$publictext.'');
$r->print(&Apache::loncommon::start_data_table());
- $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print(&Apache::loncommon::start_data_table_header_row());
$r->print(' | '.&mt('Action').' | '.&mt('Dates available').' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
+ $r->print(&Apache::loncommon::end_data_table_header_row());
$r->print(&Apache::loncommon::start_data_table_row());
if ($public) {
$r->print(''.&actionbox('old',$publicnum,'public').' | '.
@@ -844,12 +962,12 @@ sub access_setting_table {
$r->print(&Apache::loncommon::end_data_table_row());
$r->print(&Apache::loncommon::end_data_table());
$r->print(' | | ');
- $r->print(''.&mt('Password-protected access:').' '.$guesttext.'');
+ $r->print(''.&mt('Passphrase-protected access:').' '.$guesttext.'');
$r->print(&Apache::loncommon::start_data_table());
- $r->print(&Apache::loncommon::start_data_table_row());
+ $r->print(&Apache::loncommon::start_data_table_header_row());
$r->print(' | '.&mt('Action').' | '.&mt('Dates available').
- ' | '. &mt('Password').' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
+ ''. &mt('Passphrase').' | ');
+ $r->print(&Apache::loncommon::end_data_table_header_row());
$r->print(&Apache::loncommon::start_data_table_row());
my $passwd;
if ($guest) {
@@ -921,40 +1039,38 @@ sub display_access_row {
my ($r,$status,$type,$items,$access_controls,$now,$then) = @_;
if (@{$items} > 0) {
my @all_doms;
- my $tablecolor;
my $colspan = 3;
my $uctype = $type;
$uctype =~ s/^(\w)/uc($1)/e;
$r->print(&Apache::loncommon::start_data_table());
- $r->print(&Apache::loncommon::start_data_table_row());
- $r->print(''.&mt('Action?').' | '.&mt($uctype).' | '.
+ $r->print(&Apache::loncommon::start_data_table_header_row());
+ $r->print(' | '.&mt('Action?').' | '.&mt($uctype).' | '.
&mt('Dates available').' | ');
if (($type eq 'course') || ($type eq 'group')) {
$r->print(''.&mt('Allowed [_1] member affiliations',$type).
' | ');
$colspan ++;
- my $function = &Apache::loncommon::get_users_function();
- $tablecolor=&Apache::loncommon::designparm($function.'.tabbg');
} elsif ($type eq 'domains') {
@all_doms = &Apache::loncommon::get_domains();
}
- $r->print(&Apache::loncommon::end_data_table_row());
+ $r->print(&Apache::loncommon::end_data_table_header_row());
foreach my $key (@{$items}) {
+ $r->print(&Apache::loncommon::start_data_table_row());
if (($type eq 'course') || ($type eq 'group')) {
- &course_row($r,$status,$type,$key,$access_controls,
- $tablecolor,$now,$then);
+ &course_row($r,$status,$type,$key,$access_controls,$now,$then);
} elsif ($type eq 'domains') {
&domains_row($r,$status,$key,\@all_doms,$access_controls,$now,
$then);
} elsif ($type eq 'users') {
&users_row($r,$status,$key,$access_controls,$now,$then);
}
+ $r->print(&Apache::loncommon::end_data_table_row());
}
- $r->print(&Apache::loncommon::end_data_table_row());
- $r->print(&Apache::loncommon::start_data_table_row());
if ($status eq 'old') {
+ $r->print(&Apache::loncommon::start_data_table_row());
$r->print(''.&additional_item($type).
' | ');
+ $r->print(&Apache::loncommon::end_data_table_row());
}
$r->print(&Apache::loncommon::end_data_table());
} else {
@@ -964,15 +1080,8 @@ sub display_access_row {
return;
}
-sub course_row {
- my ($r,$status,$type,$item,$access_controls,$tablecolor,$now,$then) = @_;
- my %content;
- my $defdom = $env{'user.domain'};
- if ($status eq 'old') {
- $defdom = $$access_controls{$item}{'domain'};
- }
- $r->print(&Apache::loncommon::coursebrowser_javascript($defdom));
- $r->print(qq|
+sub course_js {
+ return qq|
-|);
- $r->print(&Apache::loncommon::start_data_table_row());
+|;
+}
+
+sub course_row {
+ my ($r,$status,$type,$item,$access_controls,$now,$then) = @_;
+ my $content;
+ my $defdom = $env{'user.domain'};
+ if ($status eq 'old') {
+ $content = $$access_controls{$item};
+ $defdom = $content->{'domain'};
+ }
+ my $js = &Apache::loncommon::coursebrowser_javascript($defdom)
+ .&course_js();
my $crsgrptext = 'Groups';
if ($type eq 'group') {
$crsgrptext = 'Teams';
}
+ my $uctype = $type;
+ $uctype =~ s/^(\w)/uc($1)/e;
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
$type);
- $r->print(''.&actionbox($status,$num,$scope).' | ');
+ $r->print(''.$js.&actionbox($status,$num,$scope).' | ');
if ($status eq 'old') {
- my $cid = $content{'domain'}.'_'.$content{'number'};
+ my $cid = $content->{'domain'}.'_'.$content->{'number'};
my %course_description = &Apache::lonnet::coursedescription($cid);
- $r->print(''.$course_description{'description'}.' | ');
+ $r->print(''.$course_description{'description'}.' | ');
} elsif ($status eq 'new') {
- my $uctype = $type;
- $uctype =~ s/^(\w)/uc($1)/e;
$r->print(''.&Apache::loncommon::selectcourse_link('portform','crsnum_'.$num,'crsdom_'.$num,'description_'.$num,undef,undef,$uctype).' | ');
}
$r->print(''.&dateboxes($num,$start,$end).' | ');
- $r->print('');
+ $r->print('');
$r->print(''.&mt('Action').' | '.&mt('Roles').' | '.
&mt('Access').' | '.&mt('Sections').' | '.
&mt($crsgrptext).' | ');
if ($status eq 'old') {
my $max_id = 0;
- foreach my $role_id (sort(keys(%{$content{'roles'}}))) {
+ foreach my $role_id (sort(keys(%{$content->{'roles'}}))) {
if ($role_id > $max_id) {
$max_id = $role_id;
}
$max_id ++;
- my $role_selects = &role_selectors($num,$role_id,$status,$type,\%content,'display');
- $r->print('
| '.$role_selects.' ');
+ my $role_selects = &role_selectors($num,$role_id,$status,$type,$content,'display');
+ $r->print('
| '.$role_selects.' ');
}
- $r->print('
'.&mt('Add a roles-based condition').' | ');
+ $r->print('
'.&mt('Add a roles-based condition').' {'domain'}','$content->{'number'}','$uctype'".')" value="'.$max_id.'" /> | ');
} elsif ($status eq 'new') {
my $role_id = 1;
my $role_selects = &role_selectors($num,$role_id,$status,$type,undef,'display');
$r->print('
---|
'.&mt('Add').' | '.$role_selects);
$r->print(' ');
}
- $r->print(&Apache::loncommon::end_data_table_row());
return;
}
sub domains_row {
my ($r,$status,$item,$all_doms,$access_controls,$now,$then) = @_;
- $r->print(&Apache::loncommon::start_data_table_row());
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
'domains');
- my $dom_select = ''.
+ my $dom_select = '';
$r->print(''.&actionbox($status,$num,$scope).' | '.$dom_select.
' | '.&dateboxes($num,$start,$end).' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
- $r->print(&Apache::loncommon::start_data_table_row());
}
sub users_row {
my ($r,$status,$item,$access_controls,$now,$then) = @_;
- $r->print(&Apache::loncommon::start_data_table_row());
my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
'users');
my $curr_user_list;
@@ -1096,7 +1211,6 @@ sub users_row {
$curr_user_list = &sort_users($content->{'users'});
}
$r->print(''.&actionbox($status,$num,$scope).' | '.&mt("Format for users' username:domain information:").' sparty:msu,illini:uiuc ... etc.
| '.&dateboxes($num,$start,$end).' | ');
- $r->print(&Apache::loncommon::end_data_table_row());
}
sub additional_item {
@@ -1107,17 +1221,17 @@ sub additional_item {
sub actionbox {
my ($status,$num,$scope) = @_;
- my $output = ' '.
''.&mt('Update');
}
- $output .= '';
+ $output .= '';
return $output;
}
@@ -1132,10 +1246,10 @@ sub dateboxes {
undef,undef,1);
my $enddate = &Apache::lonhtmlcommon::date_setter('portform',
'enddate_'.$num,$end,undef,undef,undef,1,undef,
- undef,undef,1). ' '.
+ undef,undef,1). ' '.
''.&mt('No end date').
- '';
+ '';
my $output = &mt('Start: ').$startdate.' '.&mt('End: ').$enddate;
return $output;
@@ -1176,8 +1290,10 @@ sub role_selectors {
$cdom = $env{'form.cdom'};
$cnum = $env{'form.cnum'};
}
+ my $uctype = $type;
+ $uctype =~ s/^(\w)/uc($1)/e;
my ($sections,$groups,$allroles,$rolehash,$accesshash) =
- &Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$type);
+ &Apache::loncommon::get_secgrprole_info($cdom,$cnum,1,$uctype);
if (!@{$sections}) {
@{$sections} = ('none');
} else {
@@ -1235,6 +1351,10 @@ sub role_options_window {
my $cnum = $env{'form.cnum'};
my $type = $env{'form.type'};
my $addindex = $env{'form.setroles'};
+ my $grouptitle = 'Groups';
+ if ($type eq 'Group') {
+ $grouptitle = 'Teams';
+ }
my $role_selects = &role_selectors(1,1,'new',$type,undef,'rolepicker');
$r->print(<<"END_SCRIPT");
END_SCRIPT
$r->print(&mt('Select roles, course status, section(s) and group(s) for users who will be able to access the portfolio file.'));
- $r->print(''.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt('Groups').' |
---|
'.$role_selects.'
');
+ $r->print(''.&mt('Roles').' | '.&mt('[_1] status',$type).' | '.&mt('Sections').' | '.&mt($grouptitle).' |
---|
'.$role_selects.'
');
return;
}
@@ -1278,7 +1398,7 @@ sub select_files {
$java_files.=',';
}
my $javascript =(<
+
|