summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlibasys <sebastian.doell@libasys.de>2012-10-26 20:34:04 +0200
committerlibasys <sebastian.doell@libasys.de>2012-10-26 20:34:04 +0200
commit0cf1fef3fa49704bef54b606390ca73bbfc9f61f (patch)
tree8e52724c4278e9a2e17addc82606502f0663bf8f
parentad720c4c17867df24de0dc55453efd0eea8b9a17 (diff)
downloadnextcloud-server-0cf1fef3fa49704bef54b606390ca73bbfc9f61f.tar.gz
nextcloud-server-0cf1fef3fa49704bef54b606390ca73bbfc9f61f.zip
Fix for problems using for() function instead of $.each for arrays with IE8
-rw-r--r--core/js/oc-dialogs.js34
1 files 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 = '<table>';
- for (var a in fields) {
- content += '<tr><td>'+fields[a].text+'</td><td>';
+ $.each(fields, function(index, val){
+ content += '<tr><td>'+val.text+'</td><td>';
var type=fields[a].type;
+
if (type == 'text' || type == 'checkbox' || type == 'password') {
- content += '<input type="'+type+'" name="'+fields[a].name+'"';
+ content += '<input type="'+type+'" name="'+val.name+'"';
if (type == 'checkbox') {
- if (fields[a].value != undefined && fields[a].value == true) {
+ if (val.value != undefined && val.value == true) {
content += ' checked="checked">';
} else {
content += '>';
}
- } else if (type == 'text' || type == 'password' && fields[a].value) {
- content += ' value="'+fields[a].value+'">';
+ } else if (type == 'text' || type == 'password' && val.value) {
+ content += ' value="'+val.value+'">';
}
} else if (type == 'select') {
- content += '<select name="'+fields[a].name+'"';
+ content += '<select name="'+val.name+'"';
if (fields[a].value != undefined) {
- content += ' value="'+fields[a].value+'"';
+ content += ' value="'+val.value+'"';
}
content += '>';
- for (var o in fields[a].options) {
- content += '<option value="'+fields[a].options[o].value+'">'+fields[a].options[o].text+'</option>';
- }
+ $.each(val.options, function(index, valo){
+ //for (var o in val.options) {
+ content += '<option value="'+val.valo.value+'">'+val.valo.text+'</option>';
+ });
content += '</select>';
}
content += '</td></tr>';
- }
+
+ });
content += '</table>';
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 = '<div onclick="javascript:OC.dialogs.handlePickerClick(this, \'*ENTRYNAME*\',\''+dialog_content_id+'\')" data="*ENTRYTYPE*"><img src="*MIMETYPEICON*" style="margin-right:1em;"><span id="filename">*NAME*</span><div style="float:right;margin-right:1em;">*LASTMODDATE*</div></div>';
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');
},