[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /publisher loncfile.pm lonpubdir.pm

albertel lon-capa-cvs-allow@mail.lon-capa.org
Thu, 18 Oct 2007 21:58:22 -0000


albertel		Thu Oct 18 17:58:22 2007 EDT

  Modified files:              
    /loncom/interface	loncommon.pm 
    /loncom/publisher	lonpubdir.pm loncfile.pm 
  Log:
  - BUG#5488,
     - strip leading trailing blanks from filenames,
     - switch to displaying file names with pre to preserve the multiple
       blank spaces in a row if they exists
  
  
  
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.592 loncom/interface/loncommon.pm:1.593
--- loncom/interface/loncommon.pm:1.592	Thu Oct 11 19:50:55 2007
+++ loncom/interface/loncommon.pm	Thu Oct 18 17:57:59 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.592 2007/10/11 23:50:55 albertel Exp $
+# $Id: loncommon.pm,v 1.593 2007/10/18 21:57:59 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -4129,7 +4129,7 @@
 
 form, .inline { display: inline; }
 .center { text-align: center; }
-.LC_filename {font-family: $mono;}
+.LC_filename {font-family: $mono; white-space:pre;}
 .LC_error {
   color: red;
   font-size: larger;
Index: loncom/publisher/lonpubdir.pm
diff -u loncom/publisher/lonpubdir.pm:1.103 loncom/publisher/lonpubdir.pm:1.104
--- loncom/publisher/lonpubdir.pm:1.103	Wed Jul 25 15:56:57 2007
+++ loncom/publisher/lonpubdir.pm	Thu Oct 18 17:58:21 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Construction Space Directory Lister
 #
-# $Id: lonpubdir.pm,v 1.103 2007/07/25 19:56:57 albertel Exp $
+# $Id: lonpubdir.pm,v 1.104 2007/10/18 21:58:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -678,7 +678,7 @@
 	      '<td>'.($filename=~/[\#\~]$/?'&nbsp;':
 		      '<img src="'.&Apache::loncommon::icon($filename).'" alt="" />').'</td>'.
               '<td>'.$pub_select.'</td>'.
-	      '<td><span class="LC_filename"> '.
+	      '<td><span class="LC_filename">'.
 	      '<a href="'.$linkdir.'/'.$filename.'" target="_parent">'.
                $filename.'</a></span>'.$editlink2.$editlink.
 	      '</td>'.
Index: loncom/publisher/loncfile.pm
diff -u loncom/publisher/loncfile.pm:1.86 loncom/publisher/loncfile.pm:1.87
--- loncom/publisher/loncfile.pm:1.86	Wed Jul 25 15:56:57 2007
+++ loncom/publisher/loncfile.pm	Thu Oct 18 17:58:21 2007
@@ -9,7 +9,7 @@
 #  and displays a page showing the results of the action.
 #
 #
-# $Id: loncfile.pm,v 1.86 2007/07/25 19:56:57 albertel Exp $
+# $Id: loncfile.pm,v 1.87 2007/10/18 21:58:21 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -165,7 +165,7 @@
 sub display {
     my $fn=shift;
     $fn=~s-^/home/($match_username)/public_html-/priv/$1-;
-    return '<tt>'.$fn.'</tt>';
+    return '<span class="LC_filename">'.$fn.'</span>';
 }
 
 
@@ -341,6 +341,7 @@
 	$foundbad=1;
 	$dest=~s/\.//g;
     }
+    $dest =~ s/(\s+$|^\s+)//g;
     if  ($dest=~/[\#\?&%\":]/) {
 	$foundbad=1;
 	$dest=~s/[\#\?&%\":]//g;
@@ -349,13 +350,13 @@
 	my ($newpath)=($dest=~m|(.*)/|);
 	$newpath=&relativeDest($fn,$newpath,$uname);
 	if (! -d "$newpath") {
-	    $request->print("<p><span class=\"LC_error\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"<tt>'.$newpath.'</tt>"')."</span></p>");
+	    $request->print("<p><span class=\"LC_error\">".&mt('You have requested to create file in directory [_1] which doesn\'t exist. The requested directory path has been removed from the requested file name.','"'.&display($newpath).'"')."</span></p>");
 	    $dest=~s|.*/||;
 	}
     }
     if ($dest =~ /\.(\d+)\.(\w+)$/){
 	$request->print('<span class="LC_error">'
-			.&mt('Bad filename [_1].<br /> <tt>(name).(number).(extension)</tt> not allowed. <br /> Removing the <tt>.number.</tt> from requested filename.',$dest)
+			.&mt('Bad filename [_1].<br /> <tt>(name).(number).(extension)</tt> not allowed. <br /> Removing the <tt>.number.</tt> from requested filename.',&display($dest))
 			.'</span>');
 	$dest =~ s/\.(\d+)(\.\w+)$/$2/;
     }
@@ -527,7 +528,7 @@
 	    $request->print('<input type="hidden" name="newfilename" value="'.
 			    $newfilename.
 			    '" /><p>'.$action.' '.&display($fn).
-			    '</tt><br />to '.&display($newfilename).'?</p>');
+			    '</p><br />to '.&display($newfilename).'?</p>');
 	    &CloseForm1($request, $fn);
 	} else {
 	    $request->print('<p>'.&mt('No new filename specified.').'</p></form>');