[LON-CAPA-cvs] cvs: loncom /publisher lonupload.pm

raeburn raeburn at source.lon-capa.org
Fri Sep 11 16:12:30 EDT 2015


raeburn		Fri Sep 11 20:12:30 2015 EDT

  Modified files:              
    /loncom/publisher	lonupload.pm 
  Log:
  - Add trailing slash to URL linked to via 'Back to Directory' when upload of
    file was followed by upload of dependencies (e.g., image files in a web page)
    to avoid spurious warning message: 
    "You do not have authoring privileges for this resource".
  
  
Index: loncom/publisher/lonupload.pm
diff -u loncom/publisher/lonupload.pm:1.66 loncom/publisher/lonupload.pm:1.67
--- loncom/publisher/lonupload.pm:1.66	Wed Dec  4 17:29:44 2013
+++ loncom/publisher/lonupload.pm	Fri Sep 11 20:12:30 2015
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Handler to upload files into construction space
 #
-# $Id: lonupload.pm,v 1.66 2013/12/04 17:29:44 bisitz Exp $
+# $Id: lonupload.pm,v 1.67 2015/09/11 20:12:30 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -427,6 +427,8 @@
     my $dir_root = $r->dir_config('lonDocRoot').$url_root;
     my $path = &File::Basename::dirname($fn);
     $path =~ s{^\Q$url_root\E}{};
+    my $dirpath = $url_root.$path.'/';
+    $dirpath=~s{/+}{/}g;
     my $filename = &HTML::Entities::encode($env{'form.filename'},'<>&"');
     my $state = &embedded_form_elems('modify_orightml',$filename,$mode).
                 '<input type="hidden" name="phase" value="four" />';
@@ -437,7 +439,7 @@
     if ($mode ne 'imsimport' && $mode ne 'testbank') {
         $result .= '<br /><h3><a href="'.$fn.'">'.
                   &mt('View main file').'</a></h3>'.
-                  '<h3><a href="'.$url_root.$path.'">'.
+                  '<h3><a href="'.$dirpath.'">'.
                   &mt('Back to Directory').'</a></h3><br />';
     }
     return ($result,$returnflag);
@@ -466,13 +468,15 @@
     my $dir_root = $r->dir_config('lonDocRoot').$url_root;
     my $path = &File::Basename::dirname($fn);
     $path =~ s{^\Q$url_root\E}{};
+    my $dirpath = $url_root.$path.'/';
+    $dirpath=~s{/+}{/}g;
     my $outcome = 
         &Apache::loncommon::modify_html_refs($mode,$path,$uname,$udom,$dir_root);
     $result .= $outcome;
     if ($mode ne 'imsimport' && $mode ne 'testbank') {
         $result .= '<br /><h3><a href="'.$fn.'">'.
                   &mt('View main file').'</a></h3>'.
-                  '<h3><a href="'.$url_root.$path.'">'.
+                  '<h3><a href="'.$dirpath.'">'.
                   &mt('Back to Directory').'</a></h3><br />';
     }
     return $result;




More information about the LON-CAPA-cvs mailing list