]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fix repeating directory names.
authorkondou <kondou@ts.unde.re>
Sat, 6 Apr 2013 14:44:13 +0000 (16:44 +0200)
committerkondou <kondou@ts.unde.re>
Sat, 6 Apr 2013 14:46:40 +0000 (16:46 +0200)
Also fix some CSS for Firefox.

core/css/styles.css
core/js/oc-dialogs.js

index 2c570fd78e697c6037bf86a524aca99c16ad4817..3324cd9be89b4ba143bde2f2c07bc4459b486feb 100644 (file)
@@ -328,7 +328,7 @@ a.bookmarklet { background-color:#ddd; border:1px solid #ccc; padding:5px;paddin
 
 /* ---- DIALOGS ---- */
 #dirup {width:4%;}
-#dirtree {width:93%;}
+#dirtree {width:92%;}
 #filelist {height:270px; overflow-y:auto; background-color:white; width:100%;}
 .filepicker_element_selected { background-color:lightblue;}
 .filepicker_loader {height:170px; width:100%; background-color:#333; -ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=30)"; filter:alpha(opacity=30); opacity:.3; visibility:visible; position:absolute; top:0; left:0; text-align:center; padding-top:150px;}
index cd5412fdeda212cde6dbdb5fd23ba3dfcaafefa8..f929eb87dc57703384ed3543927abe744b5517af 100644 (file)
@@ -151,6 +151,12 @@ var OCdialogs = {
 
                $(dialog_id + ' #dirtree').focus().change( {dcid: dialog_id}, OCdialogs.handleTreeListSelect );
                $(dialog_id + ' #dirup').click( {dcid: dialog_id}, OCdialogs.filepickerDirUp );
+               $(dialog_id + ' #filelist').click('[data="file"]', function() {
+                       OCdialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid'));
+               });
+               $(dialog_id + ' #filelist').on('click', '[data="dir"]', function() {
+                       OCdialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid'));
+               });
 
                $(dialog_id).ready(function(){
                        $.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), { mimetype: mimetype_filter } ,function(request) {
@@ -310,12 +316,7 @@ var OCdialogs = {
                        files += template.replace('*LASTMODDATE*', OC.mtime2date(sorted[i].mtime)).replace('*NAME*', escapeHTML(sorted[i].name)).replace('*MIMETYPEICON*', sorted[i].mimetype_icon).replace('*ENTRYNAME*', escapeHTML(sorted[i].name)).replace('*ENTRYTYPE*', escapeHTML(sorted[i].type));
                }
 
-               $(dialog_content_id + ' #filelist').html(files).on('click', '[data="file"]', function() {
-                       OCdialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid'));
-               });
-               $(dialog_content_id + ' #filelist').html(files).on('click', '[data="dir"]', function() {
-                       OCdialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid'));
-               });
+               $(dialog_content_id + ' #filelist').html(files);
                $(dialog_content_id + ' .filepicker_loader').css('visibility', 'hidden');
        },
        /**
@@ -334,9 +335,10 @@ var OCdialogs = {
 
                $(dialog_id + ' #dirtree').html(paths);
        },
-
+       /**
+        * handle selection made in the tree list
+       */
        handleTreeListSelect:function(event) {
-               // fails at paths with &
                if ($("option:selected", this).html().indexOf('/') !== -1) { // if there's a slash in the selected path, don't append it
                        $(event.data.dcid).data('path', $("option:selected", this).html());
                } else {
@@ -360,7 +362,9 @@ var OCdialogs = {
                        function(request) { OCdialogs.fillTreeList(request, event.data.dcid) }
                );
        },
-       // go one directory up
+       /**
+        * go one directory up
+       */
        filepickerDirUp:function(event) {
                var old_path = $(event.data.dcid).data('path');
                if ( old_path !== "/") {
@@ -388,11 +392,10 @@ var OCdialogs = {
                        );
                }
        },
-       // this function is in early development state, please dont use it unless you know what you are doing
+       /**
+        * handle clicks made in the filepicker
+       */
        handlePickerClick:function(element, name, dialog_content_id) {
-               var datapath = $(dialog_content_id).data('path');
-               if (datapath === undefined) { datapath = '' };
-               datapath += name;
                if ( $(element).attr('data') === 'file' ){
                        if ( $(dialog_content_id).data('multiselect') !== true) {
                                $(dialog_content_id + ' .filepicker_element_selected').removeClass('filepicker_element_selected');
@@ -400,7 +403,7 @@ var OCdialogs = {
                        $(element).toggleClass('filepicker_element_selected');
                        return;
                } else if ( $(element).attr('data') === 'dir' ) {
-                       datapath += '/';
+                       var datapath = escapeHTML( $(dialog_content_id).data('path') + name + '/' );
                        $(dialog_content_id).data('path', datapath);
                        $(dialog_content_id + ' .filepicker_loader').css('visibility', 'visible');
                        $.getJSON(