Get selected IDs if action function did not pass them

This commit is contained in:
Nathan Gray 2013-03-20 22:20:05 +00:00
parent 3332eec106
commit 873c3301d4
3 changed files with 32 additions and 4 deletions

View File

@ -25,6 +25,27 @@ function nm_action(_action, _senders, _target, _ids)
if (typeof _action.data == 'undefined' || !_action.data) _action.data = {};
if (typeof _action.data.nm_action == 'undefined') _action.data.nm_action = 'submit';
if(typeof _ids == 'undefined')
{
// Get IDs from nextmatch - nextmatch is in the top of the action tree
// @see et2_extension_nextmatch_controller._initActions()
var nm = null;
var action = _action
while(nm == null && action != null)
{
if(action.data != null && action.data.nextmatch)
{
nm = action.data.nextmatch;
}
action = action.parent
}
if(nm)
{
_ids = nm.getSelection();
_action.data.nextmatch = nm;
}
}
// ----------------------
// TODO: Parse the _ids.inverted flag!
// ----------------------

View File

@ -49,6 +49,9 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
// Copy the egw reference
this.egw = _egw;
// Keep a reference to the widget
this._widget = _widget;
// Initialize the action and the object manager
if (!_objectManager)
{
@ -64,9 +67,6 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
this._super(_parentController, _grid, this, this._rowCallback,
this._linkCallback, this, this._objectManager);
// Keep a reference to the widget
this._widget = _widget;
// Copy the given parameters
this._actionLinks = _actionLinks
this._execId = _execId;
@ -123,6 +123,13 @@ var et2_nextmatch_controller = et2_dataview_controller.extend(
var gam = egw_getActionManager(this.egw.appName);
this._actionManager = gam.addAction("actionManager", uid);
this._actionManager.updateActions(_actions);
var data = this._actionManager.data;
if (data == 'undefined' || !data)
{
data = {};
}
data.nextmatch = this._widget;
this._actionManager.set_data(data);
// Set the default execute handler
var self = this;

View File

@ -194,7 +194,7 @@ etemplate2.prototype.load = function(_name, _url, _data)
var frag = document.createDocumentFragment();
// Asynchronously load the XET file (code below is executed ahead of the
// code in the callback function)
// code in the loadXMLFromURL function)
et2_loadXMLFromURL(_url, function(_xmldoc) {
// Scan for templates and store them