itempicker update

This commit is contained in:
Christian Binder 2012-09-29 10:23:03 +00:00
parent 2fbf1d36e8
commit ac98f4f06a
2 changed files with 20 additions and 2 deletions

View File

@ -0,0 +1,10 @@
function itempickerDocumentAction(context, data) {
var formid = "itempicker_action_form";
var form = "<form id='" + formid + "' action='index.php?menuaction=" + data.app + "." + data.app + "_merge.download_by_request' method='POST'>"
+ "<input type='hidden' name='data_document_name' value='" + data.value.name + "' />"
+ "<input type='hidden' name='data_document_dir' value='" + data.value.dir + "' />"
+ "<input type='hidden' name='data_checked' value='" + data.checked.join(',') + "' />"
+ "</form>";
$j("body").append(form);
$j("#" + formid).submit().remove();
}

View File

@ -19,6 +19,7 @@
jquery.jquery; jquery.jquery;
et2_core_inputWidget; et2_core_inputWidget;
et2_core_valueWidget; et2_core_valueWidget;
et2_extension_itempicker_actions;
egw_action.egw_action_common; egw_action.egw_action_common;
*/ */
@ -52,6 +53,12 @@ var et2_itempicker = et2_inputWidget.extend({
"default": et2_no_init, "default": et2_no_init,
"description": "This text get displayed if an input-field is empty and does not have the input-focus (blur). It can be used to show a default value or a kind of help-text." "description": "This text get displayed if an input-field is empty and does not have the input-focus (blur). It can be used to show a default value or a kind of help-text."
}, },
"value": {
"name": "value",
"type": "any",
"default": "",
"description": "Optional itempicker value(s) - can be used for e.g. environmental information"
},
"query": { "query": {
"name": "Query callback", "name": "Query callback",
"type": "any", "type": "any",
@ -185,7 +192,8 @@ var et2_itempicker = et2_inputWidget.extend({
{ {
var data = {}; var data = {};
data.app = this.current_app; data.app = this.current_app;
data.items = this.getSelectedItems(); data.value = this.options.value;
data.checked = this.getSelectedItems();
return this.action.exec(this, data); return this.action.exec(this, data);
} }
@ -194,7 +202,7 @@ var et2_itempicker = et2_inputWidget.extend({
getSelectedItems: function() getSelectedItems: function()
{ {
var items = {}; var items = [];
$j(this.itemlist).children("ul").children("li.selected").each(function(index) { $j(this.itemlist).children("ul").children("li.selected").each(function(index) {
items[index] = $j(this).attr("id"); items[index] = $j(this).attr("id");
}); });