'.
'Actions | | Name | Size | Last Modified | Current Access Status |
');
}
- if (defined($group)) {
- $r->print("\n".$groupitem."\n");
- }
+ $r->print("\n".&group_form_data()."\n");
+
my $href_location="/uploaded/$udom/$uname/$port_path".$current_path;
my $href_edit_location="/editupload/$udom/$uname/$port_path".$current_path;
my @dir_lines;
@@ -265,7 +262,7 @@ sub display_directory {
}
$r->print(' | ');
$r->print('Go to ... | ');
- $r->print(''.$version_flag{$filename}.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'},$group,$refarg).'/ | ');
+ $r->print(''.$version_flag{$filename}.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'}).'/ | ');
$r->print('
');
} else {
my $css_class = 'LC_browser_file';
@@ -280,7 +277,7 @@ sub display_directory {
$line.=' />';
} else {
if (exists $locked_files{$fullpath}) {
- $line.='Locked | ';
+ $line.='Locked | ';
$css_class= 'LC_browser_file_locked';
} else {
if (!$can_modify) {
@@ -294,7 +291,7 @@ sub display_directory {
if ($can_modify) {
my $cat='';
- $line .= 'Rename';
+ $line .= 'Rename';
$line .= ''.$version_flag{$filename}.''.$cat.'';
}
$line .= ' | ';
@@ -334,7 +331,7 @@ sub display_directory {
}
}
&display_directory_line($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class, $line, \%access_controls, $curr_access,
- $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text);
+ $now, \%version_flag, $href_location, $url, $current_path, $access_admin_text);
# $r->print('');
# $r->print($line);
# $r->print(' | ');
@@ -346,13 +343,13 @@ sub display_directory {
# $r->print(''.
# &mt($curr_access).' ');
# $r->print(''.$access_admin_text.' | ');
# }
# $r->print('
'.$/);
if ($show_versions) {
&display_directory_line($r,$select_mode,$fullpath, $css_class, $line, \%access_controls,
- $now, \%version_flag, $href_location, $url, $current_path, $groupecho, $access_admin_text);
+ $now, \%version_flag, $href_location, $url, $current_path, $access_admin_text);
}
}
@@ -396,35 +393,20 @@ sub open_form {
}
sub close_form {
- my ($r,$url,$group,$button_text)=@_;
+ my ($r,$url,$button_text)=@_;
if (!defined($button_text)) {
$button_text = {
'continue' => &mt('Continue'),
'cancel' => &mt('Cancel'),
};
}
- $r->print('');
- if (defined($group)) {
- $r->print("\n".'');
- if (exists($env{'form.ref'})) {
- $r->print("\n".'');
- }
- }
- $r->print('
');
+ $r->print('')
+ $r->print(&group_form_data().'
');
$r->print('');
}
@@ -451,26 +433,21 @@ sub display_file {
}
sub done {
- my ($message,$url,$group,$refarg)=@_;
+ my ($message,$url)=@_;
unless (defined $message) {
$message='Done';
}
my $result = '';
return $result;
}
sub delete {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my @check;
my $file_name = $env{'form.currentpath'}.$env{'form.selectfile'};
$file_name = &prepend_group($file_name,$group);
@@ -478,21 +455,21 @@ sub delete {
my ($uname,$udom) = &get_name_dom($group);
if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {
$r->print ("The file is locked and cannot be deleted.
");
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
} else {
if (scalar(@files)) {
&open_form($r,$url);
$r->print(''.&mt('Delete').' '.&display_file(undef,\@files).'?
');
- &close_form($r,$url,$group);
+ &close_form($r,$url);
} else {
$r->print("No file was checked to delete.
");
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
}
}
sub delete_confirmed {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my @files=&Apache::loncommon::get_env_multiple('form.selectfile');
my $result;
my ($uname,$udom) = &get_name_dom($group);
@@ -506,18 +483,18 @@ sub delete_confirmed {
') while trying to delete '.&display_file(undef, $delete_file).'
');
}
}
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
sub delete_dir {
- my ($r,$url,$group)=@_;
+ my ($r,$url)=@_;
&open_form($r,$url);
$r->print(''.&mt('Delete').' '.&display_file().'?
');
- &close_form($r,$url,$group);
+ &close_form($r,$url);
}
sub delete_dir_confirmed {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my $directory_name = $env{'form.currentpath'};
$directory_name =~ s|/$||; # remove any trailing slash
my ($uname,$udom) = &get_name_dom($group);
@@ -542,27 +519,27 @@ sub delete_dir_confirmed {
}
$env{'form.currentpath'} = $directory_name;
}
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
sub rename {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my $file_name = $env{'form.currentpath'}.$env{'form.rename'};
my ($uname,$udom) = &get_name_dom($group);
$file_name = &prepend_group($file_name,$group);
if (&Apache::lonnet::is_locked($file_name,$udom,$uname) eq 'true') {
$r->print ("The file is locked and cannot be renamed.
");
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
} else {
&open_form($r,$url);
$r->print(''.&mt('Rename').' '.&display_file().' to
?
');
- &close_form($r,$url,$group);
+ &close_form($r,$url);
}
}
sub rename_confirmed {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my $filenewname=&Apache::lonnet::clean_filename($env{'form.filenewname'});
my ($uname,$udom) = &get_name_dom($group);
my $port_path = &get_port_path($group);
@@ -570,7 +547,7 @@ sub rename_confirmed {
$r->print(''.
&mt("Error: no valid filename was provided to rename to.").
'
');
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
return;
}
my $result=
@@ -588,11 +565,11 @@ sub rename_confirmed {
''.&display_file('',$env{'form.filenewname'}).'',
''.&display_file('',$filenewname).''));
}
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
sub display_access {
- my ($r,$url,$group,$can_setacl,$port_path,$refarg) = @_;
+ my ($r,$url,$group,$can_setacl,$port_path) = @_;
my ($uname,$udom) = &get_name_dom($group);
my $file_name = $env{'form.currentpath'}.$env{'form.access'};
$file_name = &prepend_group($file_name,$group);
@@ -610,19 +587,18 @@ sub display_access {
'continue' => &mt('Proceed'),
'cancel' => &mt('Back to directory listing'),
};
- &close_form($r,$url,$group,$button_text);
+ &close_form($r,$url,$button_text);
} else {
$r->print($header);
if ($aclcount) {
$r->print($info);
}
- &view_access_settings($r,$url,$group,$access_controls{$file_name},
- $aclcount,$refarg);
+ &view_access_settings($r,$url,$access_controls{$file_name},$aclcount);
}
}
sub view_access_settings {
- my ($r,$url,$group,$access_controls,$aclcount,$refarg) = @_;
+ my ($r,$url,$access_controls,$aclcount) = @_;
my ($showstart,$showend);
my %todisplay;
foreach my $key (sort(keys(%{$access_controls}))) {
@@ -643,15 +619,8 @@ sub view_access_settings {
} else {
$r->print(&mt('No access control settings currently exist for this file.
' ));
}
- my $group_arg;
- if ($group) {
- $group_arg = '&group='.$group;
- if ($refarg ne '') {
- $group_arg .= '&'.$refarg;
- }
- }
$r->print('
'.&mt('Return to directory listing').'');
+ &group_args().'">'.&mt('Return to directory listing').'');
return;
}
@@ -759,7 +728,7 @@ sub build_access_summary {
sub update_access {
- my ($r,$url,$group,$port_path,$refarg) = @_;
+ my ($r,$url,$group,$port_path) = @_;
my $totalprocessed = 0;
my %processing;
my %title = (
@@ -873,21 +842,14 @@ sub update_access {
$access_controls{$file_name},$now,$then);
}
}
- &close_form($r,$url,$group);
+ &close_form($r,$url);
} else {
- my $group_arg;
- if ($group) {
- $group_arg = '&group='.$group;
- if ($refarg) {
- $group_arg .= '&'.$refarg;
- }
- }
$r->print('
'.
&mt('Display all access settings for this file').''.
' '.
''.&mt('Return to directory listing').'');
+ &group_args().'">'.&mt('Return to directory listing').'');
}
return;
}
@@ -1500,7 +1462,7 @@ ENDSMP
}
}
sub upload {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my $fname=$env{'form.uploaddoc.filename'};
my $filesize = (length($env{'form.uploaddoc'})) / 1000; #express in k (1024?)
my $disk_quota = 20000; # expressed in k
@@ -1539,17 +1501,17 @@ sub upload {
if (($current_disk_usage + $filesize) > $disk_quota){
$r->print('Unable to upload '.$fname.' (size = '.$filesize.' kilobytes). Disk quota will be exceeded.'.
'
Disk quota is '.$disk_quota.' kilobytes. Your current disk usage is '.$current_disk_usage.' kilobytes.');
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
}
elsif ($found_file){
if ($locked_file){
$r->print(''.'Unable to upload '.$fname.', a locked file by that name was found in '.$port_path.$env{'form.currentpath'}.''.
'
You will be able to rename or delete existing '.$fname.' after a grade has been assigned.');
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
} else {
$r->print(''.'Unable to upload '.$fname.', a file by that name was found in '.$port_path.$env{'form.currentpath'}.''.
'
To upload, rename or delete existing '.$fname.' in '.$port_path.$env{'form.currentpath'});
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
}
} else {
my $result=&Apache::lonnet::userfileupload('uploaddoc','',
@@ -1557,15 +1519,15 @@ sub upload {
if ($result !~ m|^/uploaded/|) {
$r->print(''.'An errror occured ('.$result.
') while trying to upload '.&display_file().'
');
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
} else {
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
}
}
sub lock_info {
- my ($r,$url,$group,$refarg) = @_;
+ my ($r,$url,$group) = @_;
my ($uname,$udom) = &get_name_dom($group);
my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom,
$uname);
@@ -1593,11 +1555,11 @@ sub lock_info {
}
}
}
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
return 'ok';
}
sub createdir {
- my ($r,$url,$group,$refarg)=@_;
+ my ($r,$url,$group)=@_;
my $newdir=&Apache::lonnet::clean_filename($env{'form.newdir'});
if ($newdir eq '') {
$r->print(''.
@@ -1631,13 +1593,13 @@ sub createdir {
if ($newdir ne $env{'form.newdir'}) {
$r->print("The new directory name was changed from:
".$env{'form.newdir'}." to $newdir ");
}
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
}
sub get_portfolio_root {
my ($group) = @_;
- my ($portfolio_root,$udom,$uname,$path);
- ($uname,$udom) = &get_name_dom($group);
+ my ($uname,$udom) = &get_name_dom($group);
+ my $path;
if (defined($group)) {
$path = '/userfiles/groups/'.$group.'/portfolio';
} else {
@@ -1713,7 +1675,7 @@ sub get_port_path {
}
sub missing_priv {
- my ($r,$url,$priv,$group,$refarg) = @_;
+ my ($r,$url,$priv,$group) = @_;
my $longtext = {
upload => 'upload files',
delete => 'delete files',
@@ -1733,10 +1695,7 @@ sub missing_priv {
$longtext->{$priv}));
if ($group) {
$r->print(&mt("in the group's file repository."));
- $rtnlink .= '&group='.$group;
- if ($refarg ne '') {
- $rtnlink .= '&'.$refarg;
- }
+ $rtnlink .= &group_args()
} else {
$r->print(&mt('in this portfolio.'));
}
@@ -1747,21 +1706,21 @@ sub missing_priv {
}
sub coursegrp_portfolio_header {
- my ($cdom,$cnum,$group,$grp_desc,$refarg)=@_;
+ my ($cdom,$cnum,$grp_desc)=@_;
my $gpterm = &Apache::loncommon::group_term();
my $ucgpterm = $gpterm;
$ucgpterm =~ s/^(\w)/uc($1)/e;
- if ($refarg) {
+ if ($env{'form.ref'}) {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/coursegroups",
text=>"Groups",
title=>"Course Groups"});
}
&Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/$cdom/$cnum/$group/smppg?$refarg",
+ ({href=>"/adm/$cdom/$cnum/$group/smppg?ref=$env{'form.ref'}",
text=>"$ucgpterm: $grp_desc",
title=>"Go to group's home page"},
- {href=>"/adm/coursegrp_portfolio?group=$group&$refarg",
+ {href=>"/adm/coursegrp_portfolio?".&group_args(),
text=>"Group Portfolio",
title=>"Display group portfolio"});
my $output = &Apache::lonhtmlcommon::breadcrumbs(
@@ -1782,7 +1741,7 @@ sub handler {
$url = $1.$2;
$caller = $2;
}
- my ($can_modify,$can_delete,$can_upload,$can_setacl,$refarg);
+ my ($can_modify,$can_delete,$can_upload,$can_setacl);
if ($caller eq 'coursegrp_portfolio') {
# Needs to be in a course
if (! ($env{'request.course.fn'})) {
@@ -1794,12 +1753,9 @@ sub handler {
my $earlyout = 0;
my $view_permission =
&Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
- $group = $env{'form.group'};
- $group =~ s/\W//g;
+ $env{'form.group'} =~ s/\W//g;
+ my $group = $env{'form.group'};
if ($group) {
- if (exists($env{'form.ref'})) {
- $refarg = 'ref='.$env{'form.ref'};
- }
($uname,$udom) = &get_name_dom($group);
my %curr_groups = &Apache::longroup::coursegroups($udom,$uname,
$group);
@@ -1879,79 +1835,79 @@ sub handler {
&open_form($r,$url);
# $r->print(&edit_meta_data($r, $env{'form.currentpath'}.$env{'form.selectfile'}));
$r->print('Edit the meta data
');
- &close_form($r,$url,$group);
+ &close_form($r,$url);
}
if ($env{'form.store'}) {
}
if ($env{'form.uploaddoc.filename'}) {
if ($can_upload) {
- &upload($r,$url,$group,$refarg);
+ &upload($r,$url,$group);
} else {
&missing_priv($r,$url,'upload',$group,$refarg),
}
} elsif ($env{'form.action'} eq 'delete' && $env{'form.confirmed'}) {
if ($can_delete) {
- &delete_confirmed($r,$url,$group,$refarg);
+ &delete_confirmed($r,$url,$group);
} else {
- &missing_priv($r,$url,'delete',$group,$refarg);
+ &missing_priv($r,$url,'delete',$group);
}
} elsif ($env{'form.action'} eq 'delete') {
if ($can_delete) {
&delete($r,$url,$group,$refarg);
} else {
- &missing_priv($r,$url,'delete',$group,$refarg);
+ &missing_priv($r,$url,'delete',$group);
}
} elsif ($env{'form.action'} eq 'deletedir' && $env{'form.confirmed'}) {
if ($can_delete) {
- &delete_dir_confirmed($r,$url,$group,$refarg);
+ &delete_dir_confirmed($r,$url,$group);
} else {
- &missing_priv($r,$url,'delete',$group,$refarg);
+ &missing_priv($r,$url,'delete',$group);
}
} elsif ($env{'form.action'} eq 'deletedir') {
if ($can_delete) {
- &delete_dir($r,$url,$group);
+ &delete_dir($r,$url);
} else {
- &missing_priv($r,$url,'delete',$group,$refarg);
+ &missing_priv($r,$url,'delete',$group);
}
} elsif ($env{'form.action'} eq 'rename' && $env{'form.confirmed'}) {
if ($can_modify) {
- &rename_confirmed($r,$url,$group,$refarg);
+ &rename_confirmed($r,$url,$group);
} else {
- &missing_priv($r,$url,'rename',$group,$refarg);
+ &missing_priv($r,$url,'rename',$group);
}
} elsif ($env{'form.rename'}) {
$env{'form.selectfile'} = $env{'form.rename'};
$env{'form.action'} = 'rename';
if ($can_modify) {
- &rename($r,$url,$group,$refarg);
+ &rename($r,$url,$group);
} else {
- &missing_priv($r,$url,'rename',$group,$refarg);
+ &missing_priv($r,$url,'rename',$group);
}
} elsif ($env{'form.access'}) {
$env{'form.selectfile'} = $env{'form.access'};
$env{'form.action'} = 'chgaccess';
- &display_access($r,$url,$group,$can_setacl,$port_path,$refarg);
+ &display_access($r,$url,$group,$can_setacl,$port_path);
} elsif ($env{'form.action'} eq 'chgaccess') {
if ($can_setacl) {
- &update_access($r,$url,$group,$port_path,$refarg);
+ &update_access($r,$url,$group,$port_path);
} else {
- &missing_priv($r,$url,'setacl',$group,$refarg);
+ &missing_priv($r,$url,'setacl',$group);
}
} elsif ($env{'form.action'} eq 'rolepicker') {
if ($can_setacl) {
&role_options_window($r);
} else {
- &missing_priv($r,$url,'setacl',$group,$refarg);
+ &missing_priv($r,$url,'setacl',$group);
}
} elsif ($env{'form.createdir'}) {
if ($can_upload) {
- &createdir($r,$url,$group,$refarg);
+ &createdir($r,$url,$group);
} else {
- &missing_priv($r,$url,'upload',$group,$refarg);
+ &missing_priv($r,$url,'upload',$group);
}
} elsif ($env{'form.lockinfo'}) {
- &lock_info($r,$url,$group,$refarg);
+ &lock_info($r,$url,$group);
} else {
my $current_path='/';
if ($env{'form.currentpath'}) {
@@ -1959,8 +1915,7 @@ sub handler {
}
if ($caller eq 'coursegrp_portfolio') {
&Apache::lonhtmlcommon::clear_breadcrumbs();
- $r->print(&coursegrp_portfolio_header($udom,$uname,$group,$grp_desc,
- $refarg));
+ $r->print(&coursegrp_portfolio_header($udom,$uname,$grp_desc));
}
my @dir_list=&get_dir_list($portfolio_root,$group);
if ($dir_list[0] eq 'no_such_dir'){
@@ -1983,11 +1938,10 @@ sub handler {
}
# need to know if directory is empty so it can be removed if desired
my $is_empty=(@dir_list == 2);
- &display_common($r,$url,$current_path,$is_empty,\@dir_list,$group,
- $can_upload,$refarg);
- &display_directory($r,$url,$current_path,$is_empty,\@dir_list,$group,
- $can_upload,$can_modify,$can_delete,$can_setacl,
- $refarg);
+ &display_common($r,$url,$current_path,$is_empty,\@dir_list,
+ $can_upload);
+ &display_directory($r,$url,$current_path,$is_empty,\@dir_list,
+ $can_upload,$can_modify,$can_delete,$can_setacl);
$r->print(&Apache::loncommon::end_page());
}
return OK;