Ver Fonte

HUE-102. The file browser edit view "Save as" dialog box shows the "upload a file" button

Aaron T. Myers há 15 anos atrás
pai
commit
a93d583b12

+ 1 - 1
apps/filebrowser/src/filebrowser/static/js/Source/FileBrowser/CCS.FileBrowser.js

@@ -465,7 +465,7 @@ ART.Sheet.define('window.filechooser.browser', {
 					resizable: true,
 					fileToMove: toMove
 				});
-				var saver = new CCS.FileSaver("/filebrowser/view" + fsPath, options);
+				var saver = new CCS.FileSaver("/filebrowser/view" + fsPath + "?show_upload=false", options);
 				saver.jframe.addEvent('loadComplete', function() {
 					this.setCaption(saver.getDirPath() + " :: " + caption);
 				}.bind(saver));

+ 4 - 2
apps/filebrowser/src/filebrowser/templates/fb_components.mako

@@ -17,7 +17,7 @@
 import datetime
 from django.template.defaultfilters import urlencode, escape
 %>
-<%def name="header(path, current_request_path=False, toolbar=True, cwd_set=True)">
+<%def name="header(path, current_request_path=False, toolbar=True, cwd_set=True, show_upload=True)">
   <html>
     <head>
       <title>${path}</title>
@@ -34,7 +34,9 @@ from django.template.defaultfilters import urlencode, escape
               <a class="fb-home" data-filters="ArtButton" data-icon-styles="{'width' : 16, 'height': 16}" href="${url('filebrowser.views.view', path=home_directory)}">My Home</a>
             % endif
             % if cwd_set:
-              <a class="fb-upload" data-filters="ArtButton" data-icon-styles="{'width' : 16, 'height': 16}" href="${url('filebrowser.views.upload')}?dest=${path|urlencode}&next=${current_request_path|urlencode}">Upload a File</a>
+              % if show_upload:
+                <a class="fb-upload" data-filters="ArtButton" data-icon-styles="{'width' : 16, 'height': 16}" href="${url('filebrowser.views.upload')}?dest=${path|urlencode}&next=${current_request_path|urlencode}">Upload a File</a>
+              % endif
               <a class="fb-mkdir" data-filters="ArtButton" data-icon-styles="{'width' : 16, 'height': 16}" href="${url('filebrowser.views.mkdir')}?path=${path|urlencode}&next=${current_request_path|urlencode}">New Directory</a>
             % endif
           </div>

+ 1 - 1
apps/filebrowser/src/filebrowser/templates/listdir.mako

@@ -19,7 +19,7 @@ from django.template.defaultfilters import escape, stringformat, date, time
 %>
 <%namespace name="comps" file="fb_components.mako" />
 <%namespace name="dir" file="listdir_components.mako" />
-${comps.header(path, current_request_path, cwd_set=cwd_set)}
+${comps.header(path, current_request_path, cwd_set=cwd_set, show_upload=show_upload)}
 
   <div id="dirlist" class="view">
     <h1 class="ccs-hidden">${path|escape}</h1>

+ 2 - 1
apps/filebrowser/src/filebrowser/views.py

@@ -290,7 +290,8 @@ def listdir(request, path):
     # but manually seems cleaner, since we only need it here.
     'current_request_path': request.path,
     'home_directory': request.fs.isdir(home_dir_path) and home_dir_path or None,
-    'cwd_set': True
+    'cwd_set': True,
+    'show_upload': (request.REQUEST.get('show_upload') == 'false' and (False,) or (True,))[0]
   }
 
   stats = request.fs.listdir_stats(path)