From e9f46a745224a8ac551a1303462769c052f6d7b5 Mon Sep 17 00:00:00 2001 From: Thomas Tanghus Date: Mon, 4 Mar 2013 16:36:49 +0100 Subject: [PATCH] Remove inline js from OC.Dialogs.FilePicker. --- core/js/oc-dialogs.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 28dec97fd3..cfbca2833c 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -129,13 +129,13 @@ var OCdialogs = { var p; if ($(c_id).data('multiselect') == true) { p = []; - $(c_id+' .filepicker_element_selected #filename').each(function(i, elem) { + $(c_id+' .filepicker_element_selected .filename').each(function(i, elem) { p.push(($(c_id).data('path')?$(c_id).data('path'):'')+'/'+$(elem).text()); }); } else { var p = $(c_id).data('path'); if (p == undefined) p = ''; - p = p+'/'+$(c_id+' .filepicker_element_selected #filename').text() + p = p+'/'+$(c_id+' .filepicker_element_selected .filename').text() } callback(p); $(c_id).dialog('close'); @@ -216,13 +216,15 @@ var OCdialogs = { } }, fillFilePicker:function(r, dialog_content_id) { - var entry_template = '
*NAME*
*LASTMODDATE*
'; + var entry_template = '
*NAME*
*LASTMODDATE*
'; var names = ''; $.each(r.data, function(index, a) { names += entry_template.replace('*LASTMODDATE*', OC.mtime2date(a.mtime)).replace('*NAME*', a.name).replace('*MIMETYPEICON*', a.mimetype_icon).replace('*ENTRYNAME*', a.name).replace('*ENTRYTYPE*', a.type); }); - $(dialog_content_id + ' #filelist').html(names); + $(dialog_content_id + ' #filelist').html(names).on('click', '[data="file"]', function() { + OC.dialogs.handlePickerClick(this, $(this).data('entryname'), $(this).data('dcid')); + }); $(dialog_content_id + ' .filepicker_loader').css('visibility', 'hidden'); }, handleTreeListSelect:function(event) {