mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-08 00:54:50 +01:00
enable via a class and no more need to set enabled='javascript:nm...' for enableClass or disableClass
This commit is contained in:
parent
653d4991d7
commit
60edb83929
@ -486,8 +486,10 @@ class nextmatch_widget
|
||||
$name = is_object($extension_data['template']) ? $extension_data['template']->name : $extension_data['template'];
|
||||
list($app) = explode('.',$name);
|
||||
$definition = $GLOBALS['egw_info']['user']['preferences'][$app]['nextmatch-export-definition'];
|
||||
if(!$value['no_csv_export'] && ($definition || !is_array($value['csv_fields']))) {
|
||||
if($GLOBALS['egw_info']['user']['apps']['importexport'] && ($definition || $value['csv_fields'])) {
|
||||
if(!$value['no_csv_export'] && ($definition || !is_array($value['csv_fields'])))
|
||||
{
|
||||
if($GLOBALS['egw_info']['user']['apps']['importexport'] && ($definition || $value['csv_fields']) && is_object($nextmatch))
|
||||
{
|
||||
$nextmatch->set_cell_attribute('export', 'onclick',
|
||||
"egw_openWindowCentered2('". egw::link('/index.php', array(
|
||||
'menuaction' => 'importexport.importexport_export_ui.export_dialog',
|
||||
@ -512,7 +514,6 @@ class nextmatch_widget
|
||||
$value['rows']['_actions'] =& $value['actions'];
|
||||
$value['rows']['_action_links'] =& $value['action_links'];
|
||||
$value['rows']['_row_id'] =& $value['row_id'];
|
||||
$value['action'] = $value['selected'] = $value['select_all'] = null; // nothing yet
|
||||
|
||||
return False; // NO extra Label
|
||||
}
|
||||
@ -591,6 +592,18 @@ class nextmatch_widget
|
||||
if (!is_array($action)) $action = array('caption' => $action);
|
||||
$action['id'] = $prefix.$id;
|
||||
|
||||
// set some default onExecute
|
||||
foreach(array(
|
||||
'enableClass' => 'javaScript:nm_enableClass',
|
||||
'disableClass' => 'javaScript:nm_not_disableClass',
|
||||
) as $attr => $check)
|
||||
{
|
||||
if (isset($action[$attr]) && !isset($action['enabled']))
|
||||
{
|
||||
$action['enabled'] = $check;
|
||||
}
|
||||
}
|
||||
|
||||
// add all first level actions plus ones with enabled = 'javaScript:...' to action_links
|
||||
if ($first_level || substr($action['enabled'],0,11) == 'javaScript:')
|
||||
{
|
||||
|
@ -183,6 +183,19 @@ function nm_not_disableClass(_action, _senders, _target)
|
||||
return !$(_target.iface.getDOMNode()).hasClass(_action.data.disableClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to check if all of _senders rows have enableClass set
|
||||
*
|
||||
* @param _action egwAction object, we use _action.data.enableClass to check
|
||||
* @param _senders array of egwActionObject objects
|
||||
* @param _target egwActionObject object, get's called for every object in _senders
|
||||
* @returns boolean true if none has disableClass, false otherwise
|
||||
*/
|
||||
function nm_enableClass(_action, _senders, _target)
|
||||
{
|
||||
return $(_target.iface.getDOMNode()).hasClass(_action.data.enableClass);
|
||||
}
|
||||
|
||||
/**
|
||||
* Callback to check if a certain field (_action.data.fieldId) is (not) equal to given value (_action.data.fieldValue)
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user