Work on context actions:

- Implement view of multiple selected parent / subs
- Implement link + delegation popups
- Fix filemanager action
- Change action selectbox to button, as in timesheet
This commit is contained in:
Nathan Gray 2011-05-03 00:14:44 +00:00
parent 1ef6edd5e8
commit e92173afdd
5 changed files with 139 additions and 65 deletions

View File

@ -833,7 +833,7 @@ class infolog_so
// mssql and others cant use DISTICT if text columns (info_des) are involved
$distinct = $this->db->capabilities['distinct_on_text'] ? 'DISTINCT' : '';
}
$pid = 'AND info_id_parent='.($action == 'sp' ? $query['action_id'] : 0);
$pid = 'AND ' . $this->db->expression($this->info_table,array('info_id_parent' => ($action == 'sp' ?$query['action_id'] : 0)));
if (!$GLOBALS['egw_info']['user']['preferences']['infolog']['listNoSubs'] &&
$action != 'sp' || isset($query['subs']) && $query['subs'])

View File

@ -371,17 +371,32 @@ class infolog_ui
unset($info['info_des']);
}
}
if ($query['action'] == 'sp')
{
if ($query['action_id'] &&
(is_array($query['action_id']) && in_array($info['info_id_parent'], $query['action_id'])) ||
((!is_array($query['action_id']) && $query['action_id'] === $info['info_id_parent']))
)
{
if( $main = $this->bo->read($info['info_id_parent']))
{
$main = $this->get_info($main, $readonlys);
$main['class'] .= 'th ';
array_splice($rows, $id, 0, array($main));
$parent_index = array_search($info['info_id_parent'], $query['action_id']);
if($parent_index !== false)
{
unset($query['action_id'][$parent_index]);
unset($parent_index);
}
}
}
}
$rows[] = $info;
}
unset($links);
if ($query['action'] == 'sp' && ($main = $this->bo->read($query['action_id'])))
{
$main = $this->get_info($main, $readonlys);
$main['class'] .= 'th ';
array_unshift($rows, $main);
}
if ($query['cat_id']) $rows['no_cat_id'] = true;
if ($query['no_actions']) $rows['no_actions'] = true;
$rows['no_timesheet'] = !isset($GLOBALS['egw_info']['user']['apps']['timesheet']);
@ -476,6 +491,12 @@ class infolog_ui
$values['nm']['action'] = 'document';
$values['nm']['selected'] = array($id);
}
elseif (is_array($values) && isset($values['nm']['rows']['view'])) // Handle view parent / sub buttons like an action
{
list($id) = @each($values['nm']['rows']['view']);
$values['nm']['action'] = 'view';
$values['nm']['selected'] = array($id);
}
if (is_array($values) && !empty($values['nm']['action']))
{
if (!count($values['nm']['selected']) && !$values['nm']['select_all'])
@ -500,6 +521,10 @@ class infolog_ui
}
$values['nm']['action'] .= '_' . $values[$multi_action];
}
// Action changes views (sub / parent)
if (in_array($multi_action, array('sp'))) {
$values['nm']['action'] = 'view';
}
if ($this->action($values['nm']['action'], $values['nm']['selected'], $values['nm']['select_all'],
$success, $failed, $action_msg, $values['nm'], $msg, $values['nm']['checkboxes']['no_notifications']))
{
@ -619,7 +644,7 @@ class infolog_ui
switch ($action)
{
case 'sp':
if (!$this->bo->read($action_id))
if ((is_array($action_id) && !$this->bo->read(current($action_id))) || !$this->bo->read($action_id))
{
$action = '';
$action_id = 0;
@ -894,7 +919,7 @@ class infolog_ui
$actions['filemanager'] = array(
'icon' => 'filemanager/navbar',
'caption' => 'Filemanager',
'url' => 'menuaction=filemanager.filemanager_ui.index&path=/apps/addressbook/$id',
'url' => 'menuaction=filemanager.filemanager_ui.index&path=/apps/infolog/$id',
'allowOnMultiple' => false,
'group' => $group,
);
@ -1011,9 +1036,23 @@ class infolog_ui
$failed = count($checked);
return false;
case 'parent':
$parent_query = array('col_filter' => array('info_id' => $checked));
$result = $this->bo->search($parent_query);
$parents = array();
foreach($result as $key => $info)
{
if(is_numeric($key))
{
$parents[] = $info['info_id_parent'];
}
}
$checked = array_unique($parents);
// Fall through
case 'view':
// todo: implement or better move code from index to here
return false;
return $this->index(array(),'sp',$checked,0);
}
// Actions that need to loop

View File

@ -20,16 +20,34 @@ function do_infolog_action(selbox) {
function open_popup(_action, _senders)
{
alert('Show popup: '+_action.id);
var prefix = 'exec';
var popup = document.getElementById(prefix + '[' + _action.id + '_popup]');
if(popup) {
popup.style.display = 'block';
return;
}
}
/**
* Hide popup and clear values
*/
function hide_popup(element, div_id) {
function hide_popup(element, div_id, submit) {
var prefix = element.id.substring(0,element.id.indexOf('['));
var popup = document.getElementById(prefix+'['+div_id+']');
// Get action command
var action = div_id.substring(0,div_id.length-6);
var action_input = document.getElementById('exec[nm][action]');
// Hide popup
if(popup) {
popup.style.display = 'none';
}
// Submit form
if(submit && action && action_input) {
// Set action so it comes back
action_input.value = action;
element.form.submit();
}
}

File diff suppressed because one or more lines are too long

View File

@ -16,6 +16,7 @@
</entry>
<entry type="array" name="plugin_options">
<entry type="array" name="mapping">
<entry type="string" name="info_id">Infolog ID</entry>
<entry type="string" name="info_type">Type</entry>
<entry type="string" name="info_from">Contact</entry>
<entry type="string" name="info_subject">Subject</entry>
@ -34,6 +35,7 @@
<entry type="string" name="info_startdate">Startdate</entry>
<entry type="string" name="info_enddate">Enddate</entry>
<entry type="string" name="info_responsible">Responsible</entry>
<entry type="string" name="info_cc">Cc</entry>
<entry type="string" name="info_planned_time">planned time</entry>
<entry type="string" name="info_used_time">used time</entry>
<entry type="string" name="pl_id">pricelist</entry>
@ -45,7 +47,7 @@
<entry type="string" name="begin_with_fieldnames">label</entry>
<entry type="string" name="convert">1</entry>
</entry>
<entry type="string" name="modified">2011-03-02 09:58:16</entry>
<entry type="string" name="modified">2011-04-05 17:41:46</entry>
</entry>
<entry type="array" name="import-infolog">
<entry type="string" name="name">import-infolog</entry>
@ -60,59 +62,76 @@
<entry type="string" name="charset">utf-8</entry>
<entry type="string" name="num_header_lines">1</entry>
<entry type="array" name="csv_fields">
<entry type="string" name="0">info_from</entry>
<entry type="string" name="1">info_subject</entry>
<entry type="string" name="2">info_des</entry>
<entry type="string" name="3">info_addr</entry>
<entry type="string" name="4">info_link_id</entry>
<entry type="string" name="5">info_cat</entry>
<entry type="string" name="6">info_priority</entry>
<entry type="string" name="7">info_owner</entry>
<entry type="string" name="8">info_access</entry>
<entry type="string" name="9">info_status</entry>
<entry type="string" name="10">info_percent</entry>
<entry type="string" name="11">info_datecompleted</entry>
<entry type="string" name="12">info_datemodified</entry>
<entry type="string" name="13">info_location</entry>
<entry type="string" name="14">info_startdate</entry>
<entry type="string" name="15">info_enddate</entry>
<entry type="string" name="16">info_responsible</entry>
<entry type="string" name="17">info_planned_time</entry>
<entry type="string" name="18">info_used_time</entry>
<entry type="string" name="19">pl_id</entry>
<entry type="string" name="20">info_price</entry>
<entry type="string" name="21">no_csv_1</entry>
<entry type="string" name="22">no_csv_2</entry>
<entry type="string" name="23">no_csv_3</entry>
<entry type="string" name="0">Infolog ID</entry>
<entry type="string" name="1">Type</entry>
<entry type="string" name="2">Contact</entry>
<entry type="string" name="3">Subject</entry>
<entry type="string" name="4">Description</entry>
<entry type="string" name="5">Phone/Email</entry>
<entry type="string" name="6">primary link</entry>
<entry type="string" name="7">Category</entry>
<entry type="string" name="8">Priority</entry>
<entry type="string" name="9">Owner</entry>
<entry type="string" name="10">Access</entry>
<entry type="string" name="11">Status</entry>
<entry type="string" name="12">Completed</entry>
<entry type="string" name="13">Date completed</entry>
<entry type="string" name="14">Last changed</entry>
<entry type="string" name="15">Location</entry>
<entry type="string" name="16">Start Date</entry>
<entry type="string" name="17">Due date</entry>
<entry type="string" name="18">responsible</entry>
<entry type="string" name="19">Cc</entry>
<entry type="string" name="20">planned time</entry>
<entry type="string" name="21">used time</entry>
<entry type="string" name="22">Pricelist</entry>
<entry type="string" name="23">Price</entry>
<entry type="string" name="24">Search test</entry>
<entry type="string" name="25">Options from file</entry>
<entry type="string" name="26">Supplier from ajax select</entry>
<entry type="string" name="27">Number</entry>
</entry>
<entry type="array" name="field_mapping">
<entry type="string" name="0">info_type</entry>
<entry type="string" name="1">info_from</entry>
<entry type="string" name="2">info_subject</entry>
<entry type="string" name="3">info_des</entry>
<entry type="string" name="4">info_addr</entry>
<entry type="string" name="5">info_link_id</entry>
<entry type="string" name="6">info_cat</entry>
<entry type="string" name="7">info_priority</entry>
<entry type="string" name="8">info_owner</entry>
<entry type="string" name="9">info_access</entry>
<entry type="string" name="10">info_status</entry>
<entry type="string" name="11">info_percent</entry>
<entry type="string" name="12">info_datecompleted</entry>
<entry type="string" name="13">info_datemodified</entry>
<entry type="string" name="14">info_location</entry>
<entry type="string" name="15">info_startdate</entry>
<entry type="string" name="0">info_id</entry>
<entry type="string" name="1">info_type</entry>
<entry type="string" name="2">info_from</entry>
<entry type="string" name="3">info_subject</entry>
<entry type="string" name="4">info_des</entry>
<entry type="string" name="5">info_addr</entry>
<entry type="string" name="6">info_link_id</entry>
<entry type="string" name="7">info_cat</entry>
<entry type="string" name="8">info_priority</entry>
<entry type="string" name="9">info_owner</entry>
<entry type="string" name="10">info_access</entry>
<entry type="string" name="11">info_status</entry>
<entry type="string" name="12">info_percent</entry>
<entry type="string" name="13">info_datecompleted</entry>
<entry type="string" name="14">info_datemodified</entry>
<entry type="string" name="15">info_location</entry>
<entry type="string" name="16">info_enddate</entry>
<entry type="string" name="17">info_responsible</entry>
<entry type="string" name="18">info_planned_time</entry>
<entry type="string" name="19">info_used_time</entry>
<entry type="string" name="20">pl_id</entry>
<entry type="string" name="21">info_price</entry>
<entry type="string" name="18">info_responsible</entry>
<entry type="string" name="19">info_cc</entry>
<entry type="string" name="20">info_planned_time</entry>
<entry type="string" name="21">info_used_time</entry>
<entry type="string" name="22">pl_id</entry>
<entry type="string" name="23">info_price</entry>
</entry>
<entry type="string" name="field_conversion"/>
<entry type="string" name="conditions"/>
<entry type="array" name="conditions">
<entry type="array" name="0">
<entry type="string" name="string">info_id</entry>
<entry type="string" name="type">exists</entry>
<entry type="array" name="true">
<entry type="string" name="action">update</entry>
</entry>
<entry type="array" name="false">
<entry type="string" name="action">insert</entry>
</entry>
</entry>
</entry>
</entry>
<entry type="string" name="modified">2011-03-01 18:06:41</entry>
<entry type="string" name="modified">2011-04-05 17:43:06</entry>
</entry>
</entry>
</entry>