* Infolog - Add context menu actions to set start & end date

This commit is contained in:
nathangray 2017-11-03 15:47:27 -06:00
parent 5da12be8e8
commit 2b73ea453b
2 changed files with 48 additions and 1 deletions

View File

@ -768,7 +768,7 @@ class infolog_ui
// Some processing to add values in for links and cats
$multi_action = $values['nm']['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')))
if(in_array($multi_action, array('link', 'responsible', 'startdate', 'enddate')))
{
// eTemplate ignores the _popup namespace, but et2 doesn't
if($values[$multi_action.'_popup'])
@ -1181,6 +1181,16 @@ class infolog_ui
'cat' => Etemplate\Widget\Nextmatch::category_action(
'infolog',$group,'Change category','cat_'
),
'startdate' => array(
'caption' => 'Start date',
'group' => $group,
'nm_action' => 'open_popup',
),
'enddate' => array(
'caption' => 'End date',
'group' => $group,
'nm_action' => 'open_popup',
),
'responsible' => array(
'caption' => 'Delegation',
'group' => $group,
@ -1567,6 +1577,21 @@ class infolog_ui
$failed++;
}
break;
case 'startdate':
case 'enddate':
$field = $action == 'startdate' ? 'info_startdate' : 'info_enddate';
list($ok, $date) = explode('_', $settings, 2);
$entry[$field] = $date ? Api\DateTime::to($date, 'ts') : null;
$action_msg = lang('changed');
if($this->bo->write($entry, true,true,true,$skip_notifications))
{
$success++;
}
else
{
$failed++;
}
break;
}
}
return $failed == 0;

View File

@ -194,6 +194,28 @@
</hbox>
</vbox>
</box>
<box id="startdate_popup" class="action_popup prompt">
<vbox>
<description value="Start date" class="promptheader"/>
<description id="startdate_action[title]"/>
<date-time id="startdate" class="action_popup-content"/>
<hbox>
<button label="Ok" id="startdate_action[ok]" onclick="nm_submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="nm_hide_popup(this,'link_popup');"/>
</hbox>
</vbox>
</box>
<box id="enddate_popup" class="action_popup prompt">
<vbox>
<description value="End date" class="promptheader"/>
<description id="enddate_action[title]"/>
<date-time id="enddate" class="action_popup-content"/>
<hbox>
<button label="Ok" id="enddate_action[ok]" onclick="nm_submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="nm_hide_popup(this,'link_popup');"/>
</hbox>
</vbox>
</box>
</hbox>
<description/>
</row>