--- loncom/publisher/lonpubdir.pm 2011/10/22 12:34:01 1.130 +++ loncom/publisher/lonpubdir.pm 2011/10/26 17:31:40 1.133 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Construction Space Directory Lister # -# $Id: lonpubdir.pm,v 1.130 2011/10/22 12:34:01 www Exp $ +# $Id: lonpubdir.pm,v 1.133 2011/10/26 17:31:40 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,7 +138,7 @@ sub startpage { &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; - my $formaction='/priv/'.$uname.$thisdisfn.'/'; + my $formaction='/priv'.$thisdisfn.'/'; $formaction=~s|/+|/|g; &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction); @@ -150,7 +150,7 @@ sub startpage { # breadcrumbs (and tools) will be created # in start_page->bodytag->innerregister - $env{'request.noversionuri'}='/priv/'.$udom.'/'.$uname.$thisdisfn.'/'; + $env{'request.noversionuri'}=$formaction; $r->print(&Apache::loncommon::start_page('Construction Space',undef)); $r->print(&Apache::loncommon::head_subbox( @@ -164,7 +164,7 @@ sub startpage { top.document.title = '$esc_thisdisfn/ - $doctitle'; // Store directory location for menu bar to find -parent.lastknownpriv='/priv/$udom/$uname$esc_thisdisfn/'; +parent.lastknownpriv='/priv$esc_thisdisfn/'; // Confirmation dialogues @@ -319,7 +319,7 @@ sub dircontrols { <option value="printdir">$lt{'prnt'}</option> <option value="delete">$lt{'dedr'}</option> </select> - <input type="hidden" name="filename" value="/priv/$udom/$uname$thisdisfn/" /> + <input type="hidden" name="filename" value="/priv$thisdisfn/" /> </fieldset> </form> <form name="publishdir" method="post" action="/adm/publish" target="_parent"> @@ -335,7 +335,7 @@ sub dircontrols { <form name="upublisher" enctype="multipart/form-data" method="post" action="/adm/upload" target="_parent"> <fieldset> <legend>$lt{'updc'}</legend> - <input type="hidden" name="filename" value="/priv/$udom/$uname$thisdisfn/" /> + <input type="hidden" name="filename" value="/priv$thisdisfn/" /> <input type="file" name="upfile" size="20" /> <input type="button" value="$lt{'uplo'}" onclick="checkUpload(this.form)" /> </fieldset> @@ -347,7 +347,7 @@ sub dircontrols { <fieldset> <legend>$lt{'crea'}</legend> <span class="LC_nobreak"> - <input type="hidden" name="filename" value="/priv/$udom/$uname$thisdisfn/" /> + <input type="hidden" name="filename" value="/priv$thisdisfn/" /> <script type="text/javascript"> function validate_go() { var selected = document.fileaction.action.selectedIndex; @@ -448,13 +448,12 @@ sub putdirectory { my ($r, $reqfile, $here, $dirname, $modtime, $resdir, $bombs, $numdir) = @_; # construct the display filename: the directory name unless ..: - + + my $actionitem; + my $disfilename = $dirname; - if ($dirname eq '..') { - $disfilename = '<i>'.&mt('Parent Directory').'</i>'; - } # Don't display directory itself, and there is no way up from root directory - unless ( (($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) { + unless ((($dirname eq '..') && ($reqfile=~/^\/[^\/]+\/[^\/]+$/)) || ($dirname eq '.')) { my $kaputt=0; foreach (keys %{$bombs}) { if ($_=~m:^\Q$resdir\E/\Q$disfilename\E/:) { $kaputt=1; last; } @@ -467,10 +466,9 @@ sub putdirectory { &Apache::lonpublisher::metaeval( &Apache::lonnet::getfile($r->dir_config('lonDocRoot').$here.'/'.$dirname.'/default.meta') ); -# - my $actionitem = ''; - if ($here eq '..') { + if ($dirname eq '..') { $actionitem = &mt('Go to ...'); + $disfilename = '<i>'.&mt('Parent Directory').'</i>'; } else { $actionitem = '<form name="dirselect_'.$$numdir. @@ -521,7 +519,7 @@ sub putresource { my $title=' '; my $publish_button=&mt('Publish'); my $cstr_dir = $r->dir_config('lonDocRoot').'/priv/'.$udom.'/'.$uname.'/'.$thisdisfn.'/'; - my $linkfilename='/priv'.$thisdisfn.'/'.$filename; + my $linkfilename=&HTML::Entities::encode('/priv'.$thisdisfn.'/'.$filename,'<>&"'); if (-e $resdir.'/'.$filename) { my $same=0; @@ -657,8 +655,8 @@ sub create_pubselect { '<option value="cleanup">'.&mt('Clean up').'</option>'. '<option value="print">'.&mt('Print').'</option>'. '</select> -<input type="hidden" name="filename" value="/~'. - &HTML::Entities::encode($uname.$thisdisfn.'/'.$filename,'<>&"').'" /> +<input type="hidden" name="filename" value="/priv'. + &HTML::Entities::encode($thisdisfn.'/'.$filename,'<>&"').'" /> <input type="hidden" name="dispfilename" value="'. &HTML::Entities::encode($filename).'" /></form>'; $$numres ++;