Procházet zdrojové kódy

[fb] Support viewing files with tabs

We should also display tabs in the file names
Romain Rigaux před 10 roky
rodič
revize
9ab5054

+ 0 - 1
apps/filebrowser/src/filebrowser/templates/display.mako

@@ -22,7 +22,6 @@
   from django.utils.translation import ugettext as _
   from django.utils.translation import ugettext as _
 %>
 %>
 <%
 <%
-  path_enc = urlencode(path)
   path_enc = path
   path_enc = path
   dirname_enc = urlencode(view['dirname'])
   dirname_enc = urlencode(view['dirname'])
   base_url = url('filebrowser.views.view', path=path_enc)
   base_url = url('filebrowser.views.view', path=path_enc)

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

@@ -994,7 +994,7 @@ from django.utils.translation import ugettext as _
           self.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + "." + stripHashes(file.path));
           self.targetPath("${url('filebrowser.views.view', path=urlencode('/'))}" + "." + stripHashes(file.path));
           location.hash = stripHashes(file.path);
           location.hash = stripHashes(file.path);
         } else {
         } else {
-          location.href = "${url('filebrowser.views.view', path=urlencode('/'))}" + stripHashes(file.path);
+          location.href = file.url;
         }
         }
       };
       };
 
 

+ 0 - 3
apps/filebrowser/src/filebrowser/views.py

@@ -63,7 +63,6 @@ from filebrowser.lib import xxd
 from filebrowser.forms import RenameForm, UploadFileForm, UploadArchiveForm, MkDirForm, EditorForm, TouchForm,\
 from filebrowser.forms import RenameForm, UploadFileForm, UploadArchiveForm, MkDirForm, EditorForm, TouchForm,\
                               RenameFormSet, RmTreeFormSet, ChmodFormSet, ChownFormSet, CopyFormSet, RestoreFormSet,\
                               RenameFormSet, RmTreeFormSet, ChmodFormSet, ChownFormSet, CopyFormSet, RestoreFormSet,\
                               TrashPurgeForm
                               TrashPurgeForm
-import urllib
 
 
 
 
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
 DEFAULT_CHUNK_SIZE_BYTES = 1024 * 4 # 4KB
@@ -280,7 +279,6 @@ def parse_breadcrumbs(path):
     while (i < len(breadcrumbs_parts)):
     while (i < len(breadcrumbs_parts)):
         breadcrumb_url = breadcrumbs[i - 1]['url'] + '/' + breadcrumbs_parts[i]
         breadcrumb_url = breadcrumbs[i - 1]['url'] + '/' + breadcrumbs_parts[i]
         if breadcrumb_url != '/':
         if breadcrumb_url != '/':
-            #breadcrumbs.append({'url': breadcrumb_url, 'label': urllib.unquote(breadcrumbs_parts[i])})
             breadcrumbs.append({'url': breadcrumb_url, 'label': breadcrumbs_parts[i]})
             breadcrumbs.append({'url': breadcrumb_url, 'label': breadcrumbs_parts[i]})
         i = i + 1
         i = i + 1
     return breadcrumbs
     return breadcrumbs
@@ -426,7 +424,6 @@ def listdir_paged(request, path):
 
 
     page.object_list = [ _massage_stats(request, s) for s in shown_stats ]
     page.object_list = [ _massage_stats(request, s) for s in shown_stats ]
 
 
-
     data = {
     data = {
         'path': path,
         'path': path,
         'breadcrumbs': breadcrumbs,
         'breadcrumbs': breadcrumbs,

+ 1 - 1
apps/filebrowser/src/filebrowser/views_test.py

@@ -983,7 +983,7 @@ def edit_helper(cluster, encoding, contents_pass_1, contents_pass_2):
   c = make_logged_in_client(cluster.superuser)
   c = make_logged_in_client(cluster.superuser)
 
 
   # This path is non-normalized to test normalization too
   # This path is non-normalized to test normalization too
-  filename = u'//test-filebrowser//./test-edit-carácter-internacional with space and ()'
+  filename = u'//test-filebrowser//./test-edit-carácter-internacional with space and () en-hello pt-Olá ch-你好 ko-안녕 ru-Здравствуйте'
 
 
   # File doesn't exist - should be empty
   # File doesn't exist - should be empty
   edit_url = '/filebrowser/edit' + filename
   edit_url = '/filebrowser/edit' + filename