forked from extern/egroupware
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:
parent
f47e0bd59c
commit
f2906a1052
@ -717,8 +717,10 @@ var et2_grid = et2_DOMWidget.extend([et2_IDetachedDOM, et2_IAligned],
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override parent to apply actions on each row
|
* 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
|
// Get the top level element for the tree
|
||||||
var objectManager = egw_getAppObjectManager(true);
|
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
|
// Go over the widget & add links - this is where we decide which actions are
|
||||||
// 'allowed' for this widget at this time
|
// 'allowed' for this widget at this time
|
||||||
var action_links = [];
|
var action_links = this._link_actions(actions);
|
||||||
for(var i = 0; i < parsed_actions.length; i++)
|
|
||||||
{
|
|
||||||
action_links.push(parsed_actions[i].id);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deal with each row
|
// Deal with each row
|
||||||
for(var i = 0; i < this.rowData.length; i++)
|
for(var i = 0; i < this.rowData.length; i++)
|
||||||
|
@ -77,7 +77,7 @@ var et2_portlet = et2_valueWidget.extend(
|
|||||||
edit_settings: {
|
edit_settings: {
|
||||||
icon: "edit",
|
icon: "edit",
|
||||||
caption: "Configure",
|
caption: "Configure",
|
||||||
default: true,
|
"default": true,
|
||||||
hideOnDisabled: true,
|
hideOnDisabled: true,
|
||||||
group: "portlet"
|
group: "portlet"
|
||||||
},
|
},
|
||||||
@ -174,8 +174,10 @@ var et2_portlet = et2_valueWidget.extend(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Override _link_actions to remove edit action, if there is no settings
|
* 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
|
// Get the top level element
|
||||||
var objectManager = egw_getAppObjectManager(true);
|
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
|
// Go over the widget & add links - this is where we decide which actions are
|
||||||
// 'allowed' for this widget at this time
|
// 'allowed' for this widget at this time
|
||||||
var action_links = [];
|
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 = {
|
var action = {
|
||||||
actionId: parsed_actions[i].id,
|
actionId: id,
|
||||||
enabled: true
|
enabled: true
|
||||||
};
|
};
|
||||||
|
|
||||||
// If there are no settings, there can be no customization, so remove the edit action
|
// 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);
|
this.egw().debug("log", "No settings for portlet %o, edit_settings action removed", this);
|
||||||
action.enabled = false;
|
action.enabled = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user