[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm
albertel
lon-capa-cvs@mail.lon-capa.org
Wed, 19 Jul 2006 14:57:18 -0000
This is a MIME encoded message
--albertel1153321038
Content-Type: text/plain
albertel Wed Jul 19 10:57:18 2006 EDT
Modified files:
/loncom/interface portfolio.pm
Log:
- eliminate the refarg passing
--albertel1153321038
Content-Type: text/plain
Content-Disposition: attachment; filename="albertel-20060719105718.txt"
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.136 loncom/interface/portfolio.pm:1.137
--- loncom/interface/portfolio.pm:1.136 Wed Jul 19 07:43:47 2006
+++ loncom/interface/portfolio.pm Wed Jul 19 10:57:18 2006
@@ -1,7 +1,7 @@
# The LearningOnline Network
# portfolio browser
#
-# $Id: portfolio.pm,v 1.136 2006/07/19 11:43:47 raeburn Exp $
+# $Id: portfolio.pm,v 1.137 2006/07/19 14:57:18 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -40,36 +40,47 @@
use HTML::Entities;
use LONCAPA;
+sub group_args {
+ my $output;
+ if (defined($env{'form.group'})) {
+ $ouput .= '&group='.$env{'form.group'};
+ if (defined($env{'form.ref'})) {
+ $output .= '&ref='.$env{'form.ref'};
+ }
+ }
+ return $output;
+}
+
+sub group_form_data {
+ my $output;
+ if (defined($env{'form.group'})) {
+ $ouput = '<input type="hidden" name="group" value="'.$env{'form.group'}.'" />';
+ if (exists($env{'form.ref'})) {
+ $output .= '<input type="hidden" name="ref" value="'.
+ $env{'form.ref'}.'" />';
+ }
+ }
+}
+
# receives a file name and path stub from username/userfiles/portfolio/
# returns an anchor tag consisting encoding filename and currentpath
sub make_anchor {
my ($url, $filename, $current_path, $current_mode, $field_name,
- $continue_select,$group,$refarg) = @_;
+ $continue_select) = @_;
if ($continue_select ne 'true') {$continue_select = 'false'};
my $anchor = '<a href="'.$url.'?selectfile='.$filename.'&currentpath='.$current_path.'&mode='.$current_mode.'&continue='.$continue_select.'&fieldname='.$field_name;
- if (defined($group)) {
- $anchor .= '&group='.$group;
- if ($refarg ne '') {
- $anchor .= '&'.$refarg;
- }
- }
+ $anchor .= &group_args()
$anchor .= '">'.$filename.'</a>';
return $anchor;
}
my $dirptr=16384;
sub display_common {
- my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,$refarg)=@_;
+ my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload)=@_;
my $namespace = &get_namespace($group);
my $port_path = &get_port_path($group);
if ($can_upload) {
- my $groupitem;
- if (defined($group)) {
- $groupitem = '<input type="hidden" name="group" value="'.$group.'" />';
- if (exists($env{'form.ref'})) {
- $groupitem .= '<input type="hidden" name="ref" value="'.
- $env{'form.ref'}.'" />';
- }
- }
+ my $groupitem = &group_form_data();
+
my $iconpath= $r->dir_config('lonIconsURL') . "/";
my %text=&Apache::lonlocal::texthash(
'upload' => 'Upload',
@@ -116,53 +127,49 @@
TABLE
}
my @tree = split (/\//,$current_path);
- $r->print('<span class="LC_current_location">'.&make_anchor($url,$port_path,'/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"},$group,$refarg).'/');
+ $r->print('<span class="LC_current_location">'.&make_anchor($url,$port_path,'/',$env{"form.mode"},$env{"form.fieldname"},$env{"form.continue"}).'/');
if (@tree > 1){
my $newCurrentPath = '';
for (my $i = 1; $i< @tree; $i++){
$newCurrentPath .= $tree[$i].'/';
- $r->print(&make_anchor($url,$tree[$i],'/'.$newCurrentPath, $env{"form.mode"},$env{"form.fieldname"}, $env{"form.continue"},$group,$refarg).'/');
+ $r->print(&make_anchor($url,$tree[$i],'/'.$newCurrentPath, $env{"form.mode"},$env{"form.fieldname"}, $env{"form.continue"}).'/');
}
}
$r->print('</span>');
&Apache::lonhtmlcommon::store_recent($namespace,$current_path,$current_path);
- $r->print('<br /><form method="post" action="'.$url.'?mode='.$env{"form.mode"}.'&fieldname='.$env{"form.fieldname"});
- if (defined($group)) {
- $r->print('&group='.$group);
- if ($refarg ne '') {
- $r->print('&'.$refarg);
- }
- }
+ $r->print('<br /><form method="post" action="'.$url.'?mode='.$env{"form.mode"}.'&fieldname='.$env{"form.fieldname"}.&group_args());
$r->print('">'.
&Apache::lonhtmlcommon::select_recent($namespace,'currentpath',
'this.form.submit();'));
$r->print("</form>");
}
+
sub display_directory_line {
- my ($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)=@_;
+ my ($r,$select_mode,$fullpath, $filename, $mtime, $size, $css_class,
+ $line, $access_controls, $curr_access, $now, $version_flag,
+ $href_location, $url, $current_path, $access_admin_text)=@_;
# my ($filename,$dom,undef,$testdir,undef,undef,undef,undef,$size,undef,$mtime,undef,undef,undef,$obs,undef)=split(/\&/,$line,16);
- $r->print('<tr class="'.$css_class.'">');
- $r->print($line);
- $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
- $r->print('<td>'.$$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.
- $filename.'</a></td>');
- $r->print('<td>'.$size.'</td>');
- $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
- if ($select_mode ne 'true') {
- $r->print('<td><span style="white-space: nowrap">'.
- &mt($curr_access).' ');
- $r->print('<a href="'.$url.'?access='.$filename.
- '&currentpath='.$current_path.$groupecho.
- '">'.$access_admin_text.'</a></span></td>');
- }
- $r->print('</tr>'.$/);
+ $r->print('<tr class="'.$css_class.'">');
+ $r->print($line);
+ $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
+ $r->print('<td>'.$$version_flag{$filename}.'<a href="'.$href_location.$filename.'">'.
+ $filename.'</a></td>');
+ $r->print('<td>'.$size.'</td>');
+ $r->print('<td>'.&Apache::lonlocal::locallocaltime($mtime).'</td>');
+ if ($select_mode ne 'true') {
+ $r->print('<td><span style="white-space: nowrap">'.
+ &mt($curr_access).' ');
+ $r->print('<a href="'.$url.'?access='.$filename.
+ '&currentpath='.$current_path.&group_args().
+ '">'.$access_admin_text.'</a></span></td>');
+ }
+ $r->print('</tr>'.$/);
}
+
sub display_directory {
- my ($r,$url,$current_path,$is_empty,$dir_list,$group,$can_upload,
- $can_modify,$can_delete,$can_setacl,$refarg)=@_;
+ my ($r,$url,$current_path,$is_empty,$dir_list,$can_upload,
+ $can_modify,$can_delete,$can_setacl)=@_;
my $iconpath= $r->dir_config('lonIconsURL') . "/";
- my ($groupitem,$groupecho);
my $display_out;
my $select_mode;
my $checked_files;
@@ -172,16 +179,6 @@
if ($can_setacl) {
$access_admin_text = &mt('View/Change Status');
}
- if ((defined($group)) && (defined($env{'request.course.id'}))) {
- $groupitem = '<input type="hidden" name="group" value="'.$group.'" />';
- $groupecho = '&group='.$group;
- if ($refarg ne '') {
- $groupecho .= '&'.$refarg;
- }
- if (exists($env{'form.ref'})) {
- $groupitem .= '<input type="hidden" name="ref" value="'.$env{'form.ref'}.'" />';
- }
- }
my $current_permissions = &Apache::lonnet::get_portfile_permissions($udom,
$uname);
@@ -195,7 +192,8 @@
$select_mode = 'true';
}
if ($is_empty && ($current_path ne '/') && $can_delete) {
- $display_out = '<form method="post" action="'.$url.'">'.$groupitem.
+ $display_out = '<form method="post" action="'.$url.'">'.
+ &group_form_data().
'<input type="hidden" name="action" value="deletedir" />'.
'<input type="submit" name="deletedir" value="'.&mt("Delete Directory").'" />'.
'<input type="hidden" name="selectfile" value="" />'.
@@ -214,9 +212,8 @@
$r->print('<table id="LC_browser">'.
'<tr><th colspan="2">Actions</th><th> </th><th>Name</th><th>Size</th><th>Last Modified</th><th>Current Access Status</th></tr>');
}
- 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 @@
}
$r->print('<tr class="LC_browser_folder"><td '.$colspan.'><img alt="'.&mt('closed folder').'" src="'.$iconpath.'folder_closed.gif" /></td>');
$r->print('<td>Go to ...</td>');
- $r->print('<td>'.$version_flag{$filename}.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'},$group,$refarg).'/</td>');
+ $r->print('<td>'.$version_flag{$filename}.&make_anchor($url,$filename.'/',$current_path.$filename.'/',$env{'form.mode'},$env{"form.fieldname"},$env{'form.continue'}).'/</td>');
$r->print('</tr>');
} else {
my $css_class = 'LC_browser_file';
@@ -280,7 +277,7 @@
$line.=' /></td>';
} else {
if (exists $locked_files{$fullpath}) {
- $line.='<td colspan="2"><a href="'.$url.'?lockinfo='.$current_path.$filename.$groupecho.'">Locked</a></td>';
+ $line.='<td colspan="2"><a href="'.$url.'?lockinfo='.$current_path.$filename.&group_args().'">Locked</a></td>';
$css_class= 'LC_browser_file_locked';
} else {
if (!$can_modify) {
@@ -294,7 +291,7 @@
if ($can_modify) {
my $cat='<img alt="'.&mt('Catalog Information').
'" src="'.&Apache::loncommon::lonhttpdurl('/res/adm/pages/catalog.gif').'" />';
- $line .= '<a href="'.$url.'?rename='.$filename.'&currentpath='.$current_path.$groupecho.'">Rename</a>';
+ $line .= '<a href="'.$url.'?rename='.$filename.'&currentpath='.$current_path.&group_args().'">Rename</a>';
$line .= '</td><td>'.$version_flag{$filename}.'<a href="'.$href_edit_location.$filename.'.meta">'.$cat.'</a>';
}
$line .= '</td>';
@@ -334,7 +331,7 @@
}
}
&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('<tr class="'.$css_class.'">');
# $r->print($line);
# $r->print('<td><img alt="" src="'.&Apache::loncommon::icon($filename).'" /></td>');
@@ -346,13 +343,13 @@
# $r->print('<td><span style="white-space: nowrap">'.
# &mt($curr_access).' ');
# $r->print('<a href="'.$url.'?access='.$filename.
-# '&currentpath='.$current_path.$groupecho.
+# '&currentpath='.$current_path.&group_args().
# '">'.$access_admin_text.'</a></span></td>');
# }
# $r->print('</tr>'.$/);
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 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('<p><input type="submit" value="'.$button_text->{'continue'}.'" />');
- if (defined($group)) {
- $r->print("\n".'<input type="hidden" name="group" value="'.
- $group.'" />');
- if (exists($env{'form.ref'})) {
- $r->print("\n".'<input type="hidden" name="ref" value="'.
- $env{'form.ref'}.'" />');
- }
- }
- $r->print('</p></form>');
+ $r->print('<p><input type="submit" value="'.$button_text->{'continue'}.'" />')
+ $r->print(&group_form_data().'</p></form>');
$r->print('<form action="'.$url.'" method="post">
<p>
<input type="hidden" name="currentpath" value="'.
- $env{'form.currentpath'}.'" />');
- if (defined($group)) {
- $r->print("\n".'<input type="hidden" name="group" value="'.
- $group.'" />');
- if (exists($env{'form.ref'})) {
- $r->print("\n".'<input type="hidden" name="ref" value="'.
- $env{'form.ref'}.'" />');
- }
- }
+ $env{'form.currentpath'}.'" />'.
+ &group_form_data());
$r->print("\n".' <input type="submit" value="'.$button_text->{'cancel'}.'" />
</p></form>');
}
@@ -451,26 +433,21 @@
}
sub done {
- my ($message,$url,$group,$refarg)=@_;
+ my ($message,$url)=@_;
unless (defined $message) {
$message='Done';
}
my $result = '<h3><a href="'.$url.'?currentpath='.
$env{'form.currentpath'}.
'&fieldname='.$env{'form.fieldname'}.
- '&mode='.$env{'form.mode'};
- if (defined($group)) {
- $result .= '&group='.$group;
- if ($refarg ne '') {
- $result .= '&'.$refarg;
- }
- }
+ '&mode='.$env{'form.mode'}.
+ &group_args();
$result .= '">'.&mt($message).'</a></h3>';
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 @@
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.<br />");
- $r->print(&done('Back',$url,$group,$refarg));
+ $r->print(&done('Back',$url));
} else {
if (scalar(@files)) {
&open_form($r,$url);
$r->print('<p>'.&mt('Delete').' '.&display_file(undef,\@files).'?</p>');
- &close_form($r,$url,$group);
+ &close_form($r,$url);
} else {
$r->print("No file was checked to delete.<br />");
- $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 @@
') while trying to delete '.&display_file(undef, $delete_file).'</span><br />');
}
}
- $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('<p>'.&mt('Delete').' '.&display_file().'?</p>');
- &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 @@
}
$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.<br />");
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
} else {
&open_form($r,$url);
$r->print('<p>'.&mt('Rename').' '.&display_file().' to
<input name="filenewname" type="input" size="50" />?</p>');
- &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 @@
$r->print('<span class="LC_error">'.
&mt("Error: no valid filename was provided to rename to.").
'</span><br />');
- $r->print(&done(undef,$url,$group,$refarg));
+ $r->print(&done(undef,$url));
return;
}
my $result=
@@ -588,11 +565,11 @@
'<strong>'.&display_file('',$env{'form.filenewname'}).'</strong>',
'<strong>'.&display_file('',$filenewname).'</strong>'));
}
- $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 @@
'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 @@
} else {
$r->print(&mt('No access control settings currently exist for this file.<br />' ));
}
- my $group_arg;
- if ($group) {
- $group_arg = '&group='.$group;
- if ($refarg ne '') {
- $group_arg .= '&'.$refarg;
- }
- }
$r->print('<br /><a href="'.$url.'?currentpath='.$env{'form.currentpath'}.
- $group_arg.'">'.&mt('Return to directory listing').'</a>');
+ &group_args().'">'.&mt('Return to directory listing').'</a>');
return;
}
@@ -759,7 +728,7 @@
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 @@
$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('<br /><a href="'.$url.'?access='.$env{'form.selectfile'}.
'&currentpath='.$env{'form.currentpath'}.$group_arg.'">'.
&mt('Display all access settings for this file').'</a>'.
' '.
'<a href="'.$url.'?currentpath='.$env{'form.currentpath'}.
- $group_arg.'">'.&mt('Return to directory listing').'</a>');
+ &group_args().'">'.&mt('Return to directory listing').'</a>');
}
return;
}
@@ -1500,7 +1462,7 @@
}
}
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 @@
if (($current_disk_usage + $filesize) > $disk_quota){
$r->print('<span class="LC_error">Unable to upload <strong>'.$fname.' (size = '.$filesize.' kilobytes)</strong>. Disk quota will be exceeded.</span>'.
'<br />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('<span class="LC_error">'.'Unable to upload <strong>'.$fname.'</strong>, a <strong>locked</strong> file by that name was found in <strong>'.$port_path.$env{'form.currentpath'}.'</strong></span>'.
'<br />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('<span class="LC_error">'.'Unable to upload <strong>'.$fname.'</strong>, a file by that name was found in <strong>'.$port_path.$env{'form.currentpath'}.'</strong></span>'.
'<br />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 @@
if ($result !~ m|^/uploaded/|) {
$r->print('<span class="LC_error">'.'An errror occured ('.$result.
') while trying to upload '.&display_file().'</span><br />');
- $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 @@
}
}
}
- $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('<span class="LC_error">'.
@@ -1631,13 +1593,13 @@
if ($newdir ne $env{'form.newdir'}) {
$r->print("The new directory name was changed from:<br /><strong>".$env{'form.newdir'}."</strong> to <strong>$newdir </strong>");
}
- $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 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 @@
$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 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 @@
$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 @@
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 @@
&open_form($r,$url);
# $r->print(&edit_meta_data($r, $env{'form.currentpath'}.$env{'form.selectfile'}));
$r->print('Edit the meta data<br />');
- &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 @@
}
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 @@
}
# 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;
--albertel1153321038--