Dialogs: Clean indentation. Add some missing brackets.

This commit is contained in:
Thomas Tanghus 2012-05-05 13:48:12 +02:00
parent eda42cece9
commit 2580d8540d
1 changed files with 239 additions and 220 deletions

View File

@ -20,7 +20,7 @@
*/
/**
* this class ease usage of jquery dialogs
* this class to ease the usage of jquery dialogs
*/
OCdialogs = {
/**
@ -80,16 +80,21 @@ OCdialogs = {
if (type == 'checkbox') {
if (fields[a].value != undefined && fields[a].value == true) {
content += ' checked="checked">';
} else content += '>';
} else if (type == 'text' || type == 'password' && fields[a].value)
} else {
content += '>';
}
} else if (type == 'text' || type == 'password' && fields[a].value) {
content += ' value="'+fields[a].value+'">';
}
} else if (type == 'select') {
content += '<select name="'+fields[a].name+'"';
if (fields[a].value != undefined)
if (fields[a].value != undefined) {
content += ' value="'+fields[a].value+'"';
}
content += '>';
for (var o in fields[a].options)
for (var o in fields[a].options) {
content += '<option value="'+fields[a].options[o].value+'">'+fields[a].options[o].text+'</option>';
}
content += '</select>';
}
content += '</td></tr>';
@ -101,17 +106,22 @@ OCdialogs = {
var c_name = 'oc-dialog-'+OCdialogs.dialogs_counter+'-content';
var c_id = '#'+c_name;
var d = '<div id="'+c_name+'" title="'+title+'"><select id="dirtree"><option value="0">'+OC.currentUser+'</option></select><div id="filelist"></div><div class="filepicker_loader"><img src="'+OC.filePath('gallery','img','loading.gif')+'"></div></div>';
if (!modal) modal = false;
if (!modal) modal = false; // Huh..?
if (!multiselect) multiselect = false;
$('body').append(d);
$(c_id + ' #dirtree').focus(function() { var t = $(this); t.data('oldval', t.val())})
.change({dcid: c_id}, OC.dialogs.handleTreeListSelect);
$(c_id + ' #dirtree').focus(function() {
var t = $(this);
t.data('oldval', t.val())
}).change({dcid: c_id}, OC.dialogs.handleTreeListSelect);
$(c_id).ready(function(){
$.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), {mimetype: mimetype_filter} ,function(r){OC.dialogs.fillFilePicker(r, c_id, callback)});
$.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), {mimetype: mimetype_filter} ,function(r) {
OC.dialogs.fillFilePicker(r, c_id, callback)
});
}).data('multiselect', multiselect).data('mimetype',mimetype_filter);
// build buttons
var b = [
{text: t('dialogs', 'Choose'), click: function(){
var b = [{
text: t('dialogs', 'Choose'),
click: function(){
if (callback != undefined) {
var p;
if ($(c_id).data('multiselect') == true) {
@ -129,7 +139,9 @@ OCdialogs = {
}
}
},
{text: t('dialogs', 'Cancel'), click: function(){$(c_id).dialog('close'); }}
{
text: t('dialogs', 'Cancel'),
click: function(){$(c_id).dialog('close'); }}
];
$(c_id).dialog({width: ((4*$('body').width())/9), height: 400, modal: modal, buttons: b});
OCdialogs.dialogs_counter++;
@ -219,7 +231,13 @@ OCdialogs = {
}
var skip_first = true;
var path = '';
$(this).children().each(function(i, element) { if (skip_first) {skip_first = false; return; }path += '/'+$(element).text(); });
$(this).children().each(function(i, element) {
if (skip_first) {
skip_first = false;
return;
}
path += '/'+$(element).text();
});
$(event.data.dcid).data('path', path);
$(event.data.dcid + ' .filepicker_loader').css('visibility', 'visible');
$.getJSON(OC.filePath('files', 'ajax', 'rawlist.php'), {dir: path, mimetype: $(event.data.dcid).data('mimetype')}, function(r){OC.dialogs.fillFilePicker(r, event.data.dcid)});
@ -230,8 +248,9 @@ OCdialogs = {
if (p == undefined) p = '';
p = p+'/'+name;
if ($(element).attr('data') == 'file'){
if ($(dcid).data('multiselect') != true)
if ($(dcid).data('multiselect') != true) {
$(dcid+' .filepicker_element_selected').removeClass('filepicker_element_selected');
}
$(element).toggleClass('filepicker_element_selected');
return;
}