moved most action "comfort" functions (with exception of nm_action and pagination) from server-side nextmatch class to client-side egwActions.updateActions() method, so they are available for all widgets

This commit is contained in:
Ralf Becker 2013-07-20 16:47:33 +00:00
parent f47e0bd59c
commit f2906a1052
2 changed files with 12 additions and 11 deletions

View File

@ -717,8 +717,10 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
/**
* Override parent to apply actions on each row
*
* @param Object[ {ID: attributes..}+] as for set_actions
*/
_link_actions: function(parsed_actions)
_link_actions: function(actions)
{
// Get the top level element for the tree
var objectManager = egw_getAppObjectManager(true);
@ -737,11 +739,7 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
// Go over the widget & add links - this is where we decide which actions are
// 'allowed' for this widget at this time
var action_links = [];
for(var i = 0; i < parsed_actions.length; i++)
{
action_links.push(parsed_actions[i].id);
}
var action_links = this._link_actions(actions);
// Deal with each row
for(var i = 0; i < this.rowData.length; i++)

View File

@ -77,7 +77,7 @@ var et2_portlet = et2_valueWidget.extend(
edit_settings: {
icon: "edit",
caption: "Configure",
default: true,
"default": true,
hideOnDisabled: true,
group: "portlet"
},
@ -174,8 +174,10 @@ var et2_portlet = et2_valueWidget.extend(
/**
* Override _link_actions to remove edit action, if there is no settings
*
* @param Object[ {ID: attributes..}+] as for set_actions
*/
_link_actions: function(parsed_actions)
_link_actions: function(actions)
{
// Get the top level element
var objectManager = egw_getAppObjectManager(true);
@ -195,15 +197,16 @@ var et2_portlet = et2_valueWidget.extend(
// Go over the widget & add links - this is where we decide which actions are
// 'allowed' for this widget at this time
var action_links = [];
for(var i = 0; i < parsed_actions.length; i++)
for(var i in actions)
{
var id = typeof actions[i].id != 'undefined' ? actions[i].id : i;
var action = {
actionId: parsed_actions[i].id,
actionId: id,
enabled: true
};
// If there are no settings, there can be no customization, so remove the edit action
if(parsed_actions[i].id == 'edit_settings' && (!this.options.settings || jQuery.isEmptyObject(this.options.settings)))
if(id == 'edit_settings' && (!this.options.settings || jQuery.isEmptyObject(this.options.settings)))
{
this.egw().debug("log", "No settings for portlet %o, edit_settings action removed", this);
action.enabled = false;