[Pkg-owncloud-commits] [owncloud] 26/394: Backport pull request #112.
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:19 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 51968cfd539a21e82e74f23a10a194e778c6bd71
Author: Thomas Tanghus <thomas at tanghus.net>
Date: Thu Nov 1 00:30:33 2012 +0100
Backport pull request #112.
---
core/js/oc-dialogs.js | 54 ++++++++++++++++++++++++++-----------------------
1 file changed, 29 insertions(+), 25 deletions(-)
diff --git a/core/js/oc-dialogs.js b/core/js/oc-dialogs.js
index 2467af6..22667dc 100644
--- a/core/js/oc-dialogs.js
+++ b/core/js/oc-dialogs.js
@@ -66,51 +66,54 @@ 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'},...]
- * @param fields to display
+ * 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'},...])
*/
form:function(fields, title, callback, modal) {
var content = '<table>';
- for (var a in fields) {
- content += '<tr><td>'+fields[a].text+'</td><td>';
- var type=fields[a].type;
+ $.each(fields, function(index, val){
+ content += '<tr><td>'+val.text+'</td><td>';
+ var type=val.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+'"';
- if (fields[a].value != undefined) {
- content += ' value="'+fields[a].value+'"';
+ content += '<select name="'+val.name+'"';
+ if (val.value != undefined) {
+ 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){
+ content += '<option value="'+valo.value+'">'+valo.text+'</option>';
+ });
content += '</select>';
}
content += '</td></tr>';
- }
+
+ });
content += '</table>';
OCdialogs.message(content, title, OCdialogs.FORM_DIALOG, OCdialogs.OK_CANCEL_BUTTONS, callback, modal);
},
filepicker:function(title, callback, multiselect, mimetype_filter, modal) {
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>';
+ 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('core','img','loading.gif')+'"></div></div>';
if (!modal) modal = false; // Huh..
if (!multiselect) multiselect = false;
$('body').append(d);
$(c_id + ' #dirtree').focus(function() {
- var t = $(this);
+ var t = $(this);
t.data('oldval', t.val())
}).change({dcid: c_id}, OC.dialogs.handleTreeListSelect);
$(c_id).ready(function(){
@@ -120,7 +123,7 @@ var OCdialogs = {
}).data('multiselect', multiselect).data('mimetype',mimetype_filter);
// build buttons
var b = [{
- text: t('core', 'Choose'),
+ text: t('core', 'Choose'),
click: function(){
if (callback != undefined) {
var p;
@@ -140,7 +143,7 @@ var OCdialogs = {
}
},
{
- text: t('core', 'Cancel'),
+ text: t('core', 'Cancel'),
click: function(){$(c_id).dialog('close'); }}
];
$(c_id).dialog({width: ((4*$('body').width())/9), height: 400, modal: modal, buttons: b});
@@ -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');
},
@@ -231,10 +235,10 @@ var OCdialogs = {
}
var skip_first = true;
var path = '';
- $(this).children().each(function(i, element) {
+ $(this).children().each(function(i, element) {
if (skip_first) {
- skip_first = false;
- return;
+ skip_first = false;
+ return;
}
path += '/'+$(element).text();
});
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list