[LON-CAPA-cvs] cvs: loncom /interface portfolio.pm
banghart
lon-capa-cvs@mail.lon-capa.org
Mon, 22 Nov 2004 22:59:33 -0000
banghart Mon Nov 22 17:59:33 2004 EDT
Modified files:
/loncom/interface portfolio.pm
Log:
Fix for bug 3621 (plus unmentioned bugs 3621.1, 3621.2, etc.
Fixes lost select mode while uploading files in portfolio space,
as well as creating directories, and navigating directories.
Also, fixes lost destination window (in javascript) so after
navigating, uploading, etc., selected files are returned to
parent window.
Index: loncom/interface/portfolio.pm
diff -u loncom/interface/portfolio.pm:1.56 loncom/interface/portfolio.pm:1.57
--- loncom/interface/portfolio.pm:1.56 Wed Nov 10 00:57:53 2004
+++ loncom/interface/portfolio.pm Mon Nov 22 17:59:32 2004
@@ -33,8 +33,8 @@
# receives a file name and path stub from username/userfiles/portfolio/
# returns an anchor tag consisting encoding filename and currentpath
sub make_anchor {
- my ($filename, $current_path) = @_;
- my $anchor = '<a href="/adm/portfolio?selectfile='.$filename.'¤tpath='.$current_path.'">'.$filename.'</a>';
+ my ($filename, $current_path, $current_mode, $field_name) = @_;
+ my $anchor = '<a href="/adm/portfolio?selectfile='.$filename.'¤tpath='.$current_path.'&mode='.$current_mode.'&fieldname='.$field_name.'">'.$filename.'</a>';
return $anchor;
}
my $dirptr=16384;
@@ -48,6 +48,7 @@
'<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
'<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
'<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
+ '<input type="hidden" name="mode" value="'.$ENV{"form.mode"}.'" />'.
'<input type="submit" name="storeupl" value="Upload" />'.
'</form>';
$r->print($displayOut);
@@ -57,17 +58,18 @@
'<input type="hidden" name="currentpath" value="'.$current_path.'" />'.
'<input type="hidden" name="action" value="'.$ENV{"form.action"}.'" />'.
'<input type="hidden" name="fieldname" value="'.$ENV{"form.fieldname"}.'" />'.
+ '<input type="hidden" name="mode" value="'.$ENV{"form.mode"}.'" />'.
'<input type="submit" name="createdir" value="'.&mt("Create Directory").'" />'.
'</form>';
$r->print($displayOut);
$r->print('</td></tr></table>');
my @tree = split (/\//,$current_path);
- $r->print('<font size="+2">'.&make_anchor('portfolio','/').'/');
+ $r->print('<font size="+2">'.&make_anchor('portfolio','/',$ENV{"form.mode"},$ENV{"form.fieldname"}).'/');
if (@tree > 1){
my $newCurrentPath = '';
for (my $i = 1; $i< @tree; $i++){
$newCurrentPath .= $tree[$i].'/';
- $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath).'/');
+ $r->print(&make_anchor($tree[$i],'/'.$newCurrentPath, $ENV{"form.mode"},$ENV{"form.fieldname"}).'/');
}
}
$r->print('</font>');
@@ -121,7 +123,7 @@
if ($dirptr&$testdir) {
$r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
$r->print('<td>Go to ...</td>');
- $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/').'</td>');
+ $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>');
$r->print('</tr>');
} else {
$r->print('<tr bgcolor="#CCCCFF">');
@@ -186,7 +188,7 @@
if ($dirptr&$testdir) {
$r->print('<tr bgcolor="#FFAA99"><td><img src="'.$iconpath.'folder_closed.gif"></td>');
$r->print('<td>Go to ...</td>');
- $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/').'</td>');
+ $r->print('<td>'.&make_anchor($filename.'/',$current_path.$filename.'/',$ENV{'form.mode'},$ENV{"form.fieldname"}).'</td>');
$r->print('</tr>');
} else {
$r->print('<tr bgcolor="#CCCCFF">');
@@ -244,6 +246,7 @@
return ('<h3><a href="/adm/portfolio?currentpath='.
$ENV{'form.currentpath'}.
'&fieldname='.$ENV{'form.fieldname'}.
+ '&mode='.$ENV{'form.mode'}.
'">'.&mt('Done').'</a></h3>');
}