From 5d19e08d9b694a249011e247df983e7880e5b523 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 1 Oct 2015 12:25:10 +0200 Subject: [PATCH] Search box for folders in kolab_files (T162) --- plugins/kolab_files/kolab_files.js | 39 ++++++++++++------- plugins/kolab_files/localization/en_US.inc | 1 + plugins/kolab_files/skins/larry/style.css | 34 +++++++++++++++- .../skins/larry/templates/compose_plugin.html | 21 +++++++++- .../skins/larry/templates/files.html | 16 +++++++- .../skins/larry/templates/message_plugin.html | 15 +++++-- plugins/kolab_files/skins/larry/ui.js | 2 + 7 files changed, 105 insertions(+), 23 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index f888f460..e39a444f 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -173,7 +173,7 @@ function kolab_directory_selector_dialog(id) if (!filename) { attach = attach.clone(); $('.attachment-size', attach).remove(); - filename = attach.text(); + filename = $.trim(attach.text()); } form.show(); @@ -196,6 +196,9 @@ function kolab_directory_selector_dialog(id) $('#foldercreatelink').attr('tabindex', 0); buttons[rcmail.gettext('kolab_files.save')] = function () { + if (!file_api.env.folder) + return; + var lock = rcmail.set_busy(true, 'saving'), request = { act: 'save-file', @@ -231,7 +234,7 @@ function kolab_directory_selector_dialog(id) button_classes: ['mainaction'], minWidth: 250, minHeight: 300, - height: 350, + height: 400, width: 300 }, fn); @@ -1171,15 +1174,18 @@ function kolab_files_ui() if (!this.response(response)) return; - var first, rows = [], + var first, body, rows = [], elem = $('#files-folder-list'), + searchbox = $('#foldersearch'), list = $(''), collections = !rcmail.env.action.match(/^(preview|show)$/) ? ['audio', 'video', 'image', 'document'] : []; // try parent window if the list element does not exist // i.e. called from dialog in parent window if (!elem.length && window.parent && parent.rcmail) { - elem = $('#files-folder-list', window.parent.document.body); + body = window.parent.document.body; + elem = $('#files-folder-list', body); + searchbox = $('#foldersearch', body); } elem.html('').append(list); @@ -1212,6 +1218,7 @@ function kolab_files_ui() selectable: true, id_prefix: 'rcmli', parent_focus: true, + searchbox: searchbox, id_encode: rcmail.html_identifier_encode, id_decode: rcmail.html_identifier_decode, check_droptarget: function(node) { @@ -1248,20 +1255,22 @@ function kolab_files_ui() if (rcmail.busy) return; - var is_collection = folder.match(/^folder-collection-/); + var is_collection = folder.match(/^folder-collection-(.*)$/), + collection = RegExp.$1 || null; + + if (is_collection) + folder = null; + + // search-reset can re-select the same folder, skip + if (this.env.folder == folder && this.env.collection == collection) + return; + + this.env.folder = folder; + this.env.collection = collection; rcmail.enable_command('files-list', true); rcmail.enable_command('files-folder-delete', 'folder-rename', 'files-upload', !is_collection); - - if (is_collection) { - this.env.folder = null; - rcmail.command('files-list', {collection: folder.replace(/^folder-collection-/, '')}); - } - else { - this.env.folder = folder; - this.env.collection = null; - rcmail.command('files-list', {folder: folder}); - } + rcmail.command('files-list', is_collection ? {collection: collection} : {folder: folder}); this.quota(); }; diff --git a/plugins/kolab_files/localization/en_US.inc b/plugins/kolab_files/localization/en_US.inc index 8d68fc86..50675288 100644 --- a/plugins/kolab_files/localization/en_US.inc +++ b/plugins/kolab_files/localization/en_US.inc @@ -91,6 +91,7 @@ $labels['arialabelquicksearchbox'] = 'Search input'; $labels['arialabellistoptions'] = 'Files list options'; $labels['arialabelfolderoptions'] = 'Folder actions'; $labels['arialabelfileeditform'] = 'File editing form'; +$labels['arialabelfilelist'] = 'List of files'; $labels['arialabelfoldercreateform'] = 'Folder creation form'; $labels['arialabelfoldereditform'] = 'Folder editing form'; $labels['arialabelfoldermountform'] = 'External storage form'; diff --git a/plugins/kolab_files/skins/larry/style.css b/plugins/kolab_files/skins/larry/style.css index d64253c7..a4933f8c 100644 --- a/plugins/kolab_files/skins/larry/style.css +++ b/plugins/kolab_files/skins/larry/style.css @@ -106,6 +106,19 @@ border: 0; } +#folderlistbox .scroller { + top: 34px; +} + +#folderlistbox .boxtitle a.iconbutton.search { + background-position: -2px -317px; + cursor: pointer; + position: absolute; + right: 8px; + top: 8px; + width: 16px; +} + #files-folder-list ul li span.name { background: url(../../../../skins/larry/images/listicons.png) 6px 3px no-repeat; padding: 6px 8px 6px 32px; @@ -327,7 +340,7 @@ } #files-dialog #folderlistbox { - top: 5px; + top: 35px; bottom: 5px; left: 0; right: 0; @@ -335,8 +348,20 @@ box-shadow: none; } +#files-dialog #folderlistbox .scroller { + top: 0; +} + +#files-dialog .listsearchbox { + display: block; + position: absolute; + top: 0; + left: 0; + right: 0; +} + #files-dialog.saveas #folderlistbox { - top: 50px; + bottom: 40px; } #files-compose-dialog #filelistcontainer { @@ -374,6 +399,11 @@ a.filesaveall { #file-save-as { height: 25px; white-space: nowrap; + position: absolute; + bottom: 8px; + left: 5px; + right: 5px; + text-align: center; } #file-save-as input { diff --git a/plugins/kolab_files/skins/larry/templates/compose_plugin.html b/plugins/kolab_files/skins/larry/templates/compose_plugin.html index e4d0a156..4e249edd 100644 --- a/plugins/kolab_files/skins/larry/templates/compose_plugin.html +++ b/plugins/kolab_files/skins/larry/templates/compose_plugin.html @@ -10,11 +10,24 @@
-

+

@@ -30,3 +43,9 @@

+ + diff --git a/plugins/kolab_files/skins/larry/templates/files.html b/plugins/kolab_files/skins/larry/templates/files.html index 2d0b0d1b..5569fee2 100644 --- a/plugins/kolab_files/skins/larry/templates/files.html +++ b/plugins/kolab_files/skins/larry/templates/files.html @@ -33,8 +33,20 @@