-
- $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++){
@@ -104,11 +111,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;
@@ -124,18 +132,27 @@ sub display_directory {
my $checked_files;
my $port_path = &get_port_path($group);
my ($uname,$udom) = &get_name_dom($group);
- my $namespace = &get_namespace($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 %locked_files = &Apache::lonnet::get_marked_as_readonly_hash ($namespace,$udom,$uname);
+
+ my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom,
+ $uname);
+ my %locked_files = &Apache::lonnet::get_marked_as_readonly_hash(
+ $current_permissions,$group);
+ my %access_controls = &Apache::lonnet::get_access_controls($current_permissions,$group);
+ my $now = time;
if ($env{"form.mode"} eq 'selectfile'){
&select_files($r);
$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 = ' | ');
+ }
+ return;
+}
+
+sub domains_row {
+ my ($r,$status,$item,$all_doms,$access_controls,$now,$then) = @_;
+ my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
+ 'domains');
+ my $dom_select = '';
+ $r->print(''.&actionbox($status,$num,$scope).' | '.$dom_select.
+ ' | '.&dateboxes($num,$start,$end).' | ');
+}
+
+sub users_row {
+ my ($r,$status,$item,$access_controls,$now,$then) = @_;
+ my ($num,$scope,$end,$start) = &set_identifiers($status,$item,$now,$then,
+ 'users');
+ my $curr_user_list;
+ if ($status eq 'old') {
+ my $content = $$access_controls{$item};
+ $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).' | ');
+}
+
+sub additional_item {
+ my ($type) = @_;
+ my $output = &mt('Add new [_1] condition(s)?',$type).' '.&mt('Number to add: ').'';
+ return $output;
+}
+
+sub actionbox {
+ my ($status,$num,$scope) = @_;
+ my $output = '
'.
+ '';
+ return $output;
+}
+
+sub dateboxes {
+ my ($num,$start,$end) = @_;
+ my $noend;
+ if ($end == 0) {
+ $noend = 'checked="checked"';
+ }
+ my $startdate = &Apache::lonhtmlcommon::date_setter('portform',
+ 'startdate_'.$num,$start,undef,undef,undef,1,undef,
+ undef,undef,1);
+ my $enddate = &Apache::lonhtmlcommon::date_setter('portform',
+ 'enddate_'.$num,$end,undef,undef,undef,1,undef,
+ undef,undef,1). ' ';
+
+ my $output = &mt('Start: ').$startdate.'
'.&mt('End: ').$enddate;
+ return $output;
+}
+
+sub unpack_acc_key {
+ my ($acc_key) = @_;
+ my ($num,$scope,$end,$start) = ($acc_key =~ /^([^:]+):([a-z]+)_(\d*)_?(\d*)$/);
+ return ($num,$scope,$end,$start);
+}
+
+sub set_identifiers {
+ my ($status,$item,$now,$then,$scope) = @_;
+ if ($status eq 'old') {
+ return(&unpack_acc_key($item));
+ } else {
+ return($item,$scope,$then,$now);
+ }
+}
+
+sub role_selectors {
+ my ($num,$role_id,$status,$type,$content,$caller) = @_;
+ my ($output,$cdom,$cnum,$longid);
+ if ($caller eq 'display') {
+ $longid = '_'.$num.'_'.$role_id;
+ if ($status eq 'new') {
+ foreach my $item ('role','access','section','group') {
+ $output .= ' | ';
+ }
+ return $output;
+ } else {
+ $cdom = $$content{'domain'};
+ $cnum = $$content{'number'};
+ }
+ } elsif ($caller eq 'rolepicker') {
+ $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,$uctype);
+ if (!@{$sections}) {
+ @{$sections} = ('none');
+ } else {
+ unshift(@{$sections},('all','none'));
+ }
+ if (!@{$groups}) {
+ @{$groups} = ('none');
+ } else {
+ unshift(@{$groups},('all','none'));
+ }
+ my @allacesses = sort(keys(%{$accesshash}));
+ my (%sectionhash,%grouphash);
+ foreach my $sec (@{$sections}) {
+ $sectionhash{$sec} = $sec;
+ }
+ foreach my $grp (@{$groups}) {
+ $grouphash{$grp} = $grp;
+ }
+ my %lookup = (
+ 'role' => $rolehash,
+ 'access' => $accesshash,
+ 'section' => \%sectionhash,
+ 'group' => \%grouphash,
+ );
+ my @allaccesses = sort(keys(%{$accesshash}));
+ my %allitems = (
+ 'role' => $allroles,
+ 'access' => \@allaccesses,
+ 'section' => $sections,
+ 'group' => $groups,
+ );
+ foreach my $item ('role','access','section','group') {
+ $output .= '';
+ }
+ $output .= ' | ';
+ return $output;
+}
+
+sub role_options_window {
+ my ($r) = @_;
+ my $cdom = $env{'form.cdom'};
+ 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($grouptitle).' |
---|
'.$role_selects.'
');
+ return;
+}
+
sub select_files {
- my ($r,$group)=@_;
+ my ($r,$group) = @_;
if ($env{'form.continue'} eq 'true') {
# here we update the selections for the currentpath
# eventually, have to handle removing those not checked, but . . .
@@ -430,7 +1389,7 @@ sub select_files {
$java_files.=',';
}
my $javascript =(<
+