From 0cf1fef3fa49704bef54b606390ca73bbfc9f61f Mon Sep 17 00:00:00 2001 From: libasys Date: Fri, 26 Oct 2012 20:34:04 +0200 Subject: [PATCH 1/2] Fix for problems using for() function instead of $.each for arrays with IE8 --- core/js/oc-dialogs.js | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 2467af61121..949d8cf846e 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -72,33 +72,36 @@ var OCdialogs = { */ form:function(fields, title, callback, modal) { var content = ''; - for (var a in fields) { - content += ''; - } + + }); content += '
'+fields[a].text+''; + $.each(fields, function(index, val){ + content += '
'+val.text+''; var type=fields[a].type; + if (type == 'text' || type == 'checkbox' || type == 'password') { - content += ''; + } else if (type == 'text' || type == 'password' && val.value) { + content += ' value="'+val.value+'">'; } } else if (type == 'select') { - content += ''; } content += '
'; OCdialogs.message(content, title, OCdialogs.FORM_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback, modal); }, @@ -215,9 +218,10 @@ var OCdialogs = { fillFilePicker:function(r, dialog_content_id) { var entry_template = '
*NAME*
*LASTMODDATE*
'; var names = ''; - for (var a in r.data) { - names += entry_template.replace('*LASTMODDATE*', OC.mtime2date(r.data[a].mtime)).replace('*NAME*', r.data[a].name).replace('*MIMETYPEICON*', r.data[a].mimetype_icon).replace('*ENTRYNAME*', r.data[a].name).replace('*ENTRYTYPE*', r.data[a].type); - } + $.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 + ' .filepicker_loader').css('visibility', 'hidden'); }, From b095e3222790c1ce0421214722b737f1da94af93 Mon Sep 17 00:00:00 2001 From: libasys Date: Wed, 31 Oct 2012 09:42:26 +0100 Subject: [PATCH 2/2] UPDATE oc-dialogs.js and Fix some small Bugs Added in the description of form a select ecample --- core/js/oc-dialogs.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js index 949d8cf846e..28dec97fd30 100644 --- a/core/js/oc-dialogs.js +++ b/core/js/oc-dialogs.js @@ -66,6 +66,7 @@ var OCdialogs = { /** * prompt user for input with custom form * fields should be passed in following format: [{text:'prompt text', name:'return name', type:'input type', value: 'dafault value'},...] + * select example var fields=[{text:'Test', name:'test', type:'select', options:[{text:'hallo',value:1},{text:'hallo1',value:2}] }]; * @param fields to display * @param title dialog title * @param callback which will be triggered when user press OK (user answers will be passed to callback in following format: [{name:'return name', value: 'user value'},...]) @@ -74,7 +75,7 @@ var OCdialogs = { var content = ''; $.each(fields, function(index, val){ content += '
'+val.text+''; - var type=fields[a].type; + var type=val.type; if (type == 'text' || type == 'checkbox' || type == 'password') { content += ''+val.valo.text+''; + content += ''; }); content += ''; }