forked from extern/egroupware
- Abstract multiple actions code to remove multiple if / switches
- Add multiple entry action to change entry delegation
This commit is contained in:
parent
a3d2d724ee
commit
acf078a1c0
@ -511,19 +511,20 @@ class infolog_ui
|
||||
else
|
||||
{
|
||||
// Some processing to add values in for links and cats
|
||||
if($values['multi_action'] == 'link')
|
||||
$multi_action = $values['multi_action'];
|
||||
// Action has an additional action - add / delete, etc. Buttons named <multi-action>_action[action_name]
|
||||
if(in_array($multi_action, array('link', 'responsible')))
|
||||
{
|
||||
$values['multi_action'] = 'link_' . key($values['link_action']) . '_'.$values['action_link'];
|
||||
unset($values['action_link']);
|
||||
unset($values['link_action']);
|
||||
$values['multi_action'] .= '_' . key($values[$multi_action . '_action']);
|
||||
}
|
||||
elseif ($values['multi_action'] == 'cat')
|
||||
// Action has a parameter - cat_id, percent, etc
|
||||
if (in_array($multi_action, array('link', 'cat', 'completion', 'responsible')))
|
||||
{
|
||||
$values['multi_action'] = 'cat_' . $values['cat'];
|
||||
}
|
||||
elseif ($values['multi_action'] == 'completion')
|
||||
{
|
||||
$values['multi_action'] = 'completion_' . $values['completion'];
|
||||
if(is_array($values[$multi_action]))
|
||||
{
|
||||
$values[$multi_action] = implode(',',$values[$multi_action]);
|
||||
}
|
||||
$values['multi_action'] .= '_' . $values[$multi_action];
|
||||
}
|
||||
if ($this->action($values['multi_action'],$values['nm']['rows']['checked'],$values['use_all'],
|
||||
$success,$failed,$action_msg,false,$msg))
|
||||
@ -741,6 +742,7 @@ class infolog_ui
|
||||
'cat' => lang('Change category'),
|
||||
'link' => lang('Add or delete links'),
|
||||
'completion' => lang('Change completion'),
|
||||
'responsible' => lang('Change responsible'),
|
||||
)
|
||||
);
|
||||
|
||||
@ -949,6 +951,26 @@ class infolog_ui
|
||||
$failed++;
|
||||
}
|
||||
break;
|
||||
case 'responsible':
|
||||
list($add_remove, $users) = explode('_', $settings, 2);
|
||||
$action_msg = lang('changed responsible') . ' - ' . ($add_remove == 'add' ? lang('added') : lang('removed')) . ' ';
|
||||
$users = explode(',', $users);
|
||||
$names = array();
|
||||
foreach($users as $account_id) {
|
||||
$names[] = common::display_fullname($GLOBALS['egw']->accounts->id2name($account_id));
|
||||
}
|
||||
$action_msg .= implode(', ', $names);
|
||||
$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';
|
||||
$entry['info_responsible'] = array_unique($function($entry['info_responsible'], $users));
|
||||
if($this->bo->write($entry))
|
||||
{
|
||||
$success++;
|
||||
}
|
||||
else
|
||||
{
|
||||
$failed++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ($failed == 0);
|
||||
|
@ -9,25 +9,10 @@
|
||||
function do_infolog_action(selbox) {
|
||||
if(selbox.value == "") return;
|
||||
var prefix = selbox.id.substring(0,selbox.id.indexOf('['));
|
||||
switch(selbox.value) {
|
||||
case "link":
|
||||
var popup = document.getElementById(prefix+'[link_popup]');
|
||||
if(popup) {
|
||||
popup.style.display = 'block';
|
||||
}
|
||||
return;
|
||||
case "cat":
|
||||
var popup = document.getElementById(prefix+'[cat_popup]');
|
||||
if(popup) {
|
||||
popup.style.display = 'block';
|
||||
}
|
||||
return;
|
||||
case "completion":
|
||||
var popup = document.getElementById(prefix+'[completion_popup]');
|
||||
if(popup) {
|
||||
popup.style.display = 'block';
|
||||
}
|
||||
return;
|
||||
var popup = document.getElementById(prefix + '[' + selbox.value + '_popup]');
|
||||
if(popup) {
|
||||
popup.style.display = 'block';
|
||||
return;
|
||||
}
|
||||
selbox.form.submit();
|
||||
selbox.value = "";
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user