- got delegation and link via context working

- fixed sometimes not working context, because row id was not set
- disabling close and close all if not applicable
This commit is contained in:
Ralf Becker 2011-05-03 07:26:32 +00:00
parent 30b922f30e
commit 19cb4ca8d4
4 changed files with 68 additions and 64 deletions

View File

@ -166,12 +166,19 @@ class infolog_ui
{
$info['class'] .= 'rowNoEdit ';
}
$readonlys["close[$id]"] = $done || ($readonlys["edit_status[$id]"] =
!($editrights || $isresposible));
$readonlys["close_all[$id]"] = ($done) || !$info['info_anz_subs'] || ($readonlys["edit_status[$id]"] =
!($editrights || $isresposible)); // this one is supressed, when you are not allowed to edit, or not responsible, or the entry is closed
// and has no children. If you want that this one is shown if there are children regardless of the status of the current or its childs,
// then modify ($done) to ($done && !$info['info_anz_subs'])
if (($readonlys["close[$id]"] = $done || ($readonlys["edit_status[$id]"] =
!($editrights || $isresposible))))
{
$info['class'] .= 'rowNoClose ';
}
// this one is supressed, when you are not allowed to edit, or not responsible, or the entry is closed
// and has no children. If you want that this one is shown if there are children regardless of the status of the current or its childs,
// then modify ($done) to ($done && !$info['info_anz_subs'])
if (($readonlys["close_all[$id]"] = ($done) || !$info['info_anz_subs'] || ($readonlys["edit_status[$id]"] =
!($editrights || $isresposible))))
{
$info['class'] .= 'rowNoCloseAll ';
}
$readonlys["edit_status[$id]"] = $readonlys["edit_percent[$id]"] =
!$editrights && !$isresposible &&
!$this->bo->check_access($info,EGW_ACL_UNDELETE); // undelete is handled like status edit
@ -261,6 +268,7 @@ class infolog_ui
unset($query['no_actions']);
egw_cache::setSession('infolog', $query['session_for'].'session_data', $query);
$query['actions'] = $this->get_actions($query);
$query['row_id'] = 'info_id';
}
$orginal_colfilter = $query['col_filter'];
if ($query['filter'] == 'bydate')
@ -512,20 +520,13 @@ class infolog_ui
if(in_array($multi_action, array('link', 'responsible')))
{
$values['nm']['action'] .= '_' . key($values[$multi_action . '_action']);
}
// Action has a parameter - cat_id, percent, etc
if (in_array($multi_action, array('link', 'cat', 'completion', 'responsible')))
{
if(is_array($values[$multi_action]))
{
$values[$multi_action] = implode(',',$values[$multi_action]);
}
$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']))
{
@ -567,7 +568,6 @@ class infolog_ui
{
$values['nm']['order'] = 'info_datemodified';
$values['nm']['sort'] = 'DESC';
$values['nm']['row_id'] = 'info_id';
}
if (!$values['nm']['session_for'] && $this->called_by) $values['nm']['session_for'] = $this->called_by;
@ -803,7 +803,7 @@ class infolog_ui
'popup' => egw_link::get_registry('infolog', 'add_popup'),
'group' => $group=1,
),
'sp' => array(
'view' => array(
'caption' => 'View subs',
'icon' => 'view',
'group' => $group,
@ -905,6 +905,7 @@ class infolog_ui
'caption' => 'Close',
'icon' => 'done',
'group' => $group,
'disableClass' => 'rowNoClose',
),
'close_all' => array(
'caption' => 'Close all',
@ -912,6 +913,7 @@ class infolog_ui
'group' => $group,
'hint' => 'Sets the status of this entry and its subs to done',
'allowOnMultiple' => false,
'disableClass' => 'rowNoCloseAll',
),
);
++$group; // integration with other apps
@ -971,7 +973,7 @@ class infolog_ui
function action($action, $checked, $use_all, &$success, &$failed, &$action_msg,
array $query, &$msg, $skip_notifications = false)
{
//echo "<p>infolog_ui::action('$action',".print_r($checked,true).','.(int)$use_all.",...)</p>\n";
//echo '<p>'.__METHOD__."('$action',".array2string($checked).','.(int)$use_all.",...)</p>\n";
$success = $failed = 0;
if ($use_all)
{
@ -1052,7 +1054,6 @@ class infolog_ui
// Fall through
case 'view':
// todo: implement or better move code from index to here
return $this->index(array(),'sp',$checked,0);
}
@ -1116,7 +1117,8 @@ class infolog_ui
break;
case 'status':
if(in_array($settings, $this->bo->status[$entry['info_type']])) {
if(in_array($settings, $this->bo->status[$entry['info_type']]))
{
$action_msg = lang('changed status to %1', lang($this->bo->status[$entry['info_type']][$settings]));
if($settings != 'done' && $entry['info_status'] == 'done' && $entry['info_percent'] == 100)
{
@ -1152,11 +1154,11 @@ class infolog_ui
case 'responsible':
list($add_remove, $users) = explode('_', $settings, 2);
$action_msg = lang('changed responsible') . ' - ' . ($add_remove == 'add' ? lang('added') : lang('removed')) . ' ';
$users = explode(',', $users);
$action_msg = $add_remove == 'add' ? lang('added') : lang('removed') . ' ';
$names = array();
foreach($users as $account_id) {
$names[] = common::display_fullname($GLOBALS['egw']->accounts->id2name($account_id));
foreach(explode(',', $users) as $account_id)
{
$names[] = common::grab_owner_name($account_id);
}
$action_msg .= implode(', ', $names);
$function = $add_remove == 'add' ? 'array_merge' : 'array_diff';

View File

@ -1,53 +1,53 @@
/**
* Javascript used on the infolog index page
* EGroupware infolog javascript code used on index page
*
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @package infolog
* @link http://www.egroupware.org
* @version $Id$
*/
var infolog_popup_action, infolog_popup_senders;
/**
* Javascript handling for multiple entry actions
* Open popup for a certain action requiring further input
*
* @param _action
* @param _senders
*/
function do_infolog_action(selbox) {
if(selbox.value == "") return;
var prefix = selbox.id.substring(0,selbox.id.indexOf('['));
var popup = document.getElementById(prefix + '[' + selbox.value + '_popup]');
if(popup) {
popup.style.display = 'block';
return;
}
selbox.form.submit();
selbox.value = "";
}
function open_popup(_action, _senders)
{
var prefix = 'exec';
var popup = document.getElementById(prefix + '[' + _action.id + '_popup]');
if(popup) {
if (popup) {
infolog_popup_action = _action;
infolog_popup_senders = _senders;
popup.style.display = 'block';
return;
}
}
/**
* Hide popup and clear values
* Submit a popup action
*/
function hide_popup(element, div_id, submit) {
function submit_popup(button)
{
button.form.submit_button.value = button.name; // set name of button (sub-action)
// call regular nm_action to transmitt action and senders correct
nm_action(infolog_popup_action, infolog_popup_senders);
}
/**
* Hide popup
*/
function hide_popup(element, div_id)
{
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

@ -2,15 +2,15 @@
<!-- $Id$ -->
<overlay>
<template id="infolog.index.header_left" template="" lang="" group="0" version="1.0.1.001">
<description value="InfoLog" class="headertext bold"/>
<description class="headertext bold" value="InfoLog"/>
<styles>.bold { font-weight: bold; }</styles>
</template>
<template id="infolog.index.header_right" template="" lang="" group="0" version="1.7.001">
<hbox>
<description value="Add:" class="headertext"/>
<button label="ToDo" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=task&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;" id="add[task]" image="task" statustext="Add a new ToDo"/>
<button label="Phonecall" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=phone&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;" id="add[phone]" image="phone" statustext="Add a new Phonecall"/>
<button label="Note" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=note&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;" id="add[note]" image="note" statustext="Add a new Note"/>
<description class="headertext" value="Add:"/>
<button image="task" label="ToDo" id="add[task]" statustext="Add a new ToDo" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=task&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;"/>
<button image="phone" label="Phonecall" id="add[phone]" statustext="Add a new Phonecall" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=phone&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;"/>
<button image="note" label="Note" id="add[note]" statustext="Add a new Note" onclick="window.open(egw::link('/index.php','menuaction=infolog.infolog_ui.edit&amp;type=note&amp;action=$cont[action]&amp;action_id=$cont[action_id]&amp;cat_id=$cont[cat_id]'),'_blank','dependent=yes,width=750,height=600,scrollbars=yes,status=yes'); return false;"/>
</hbox>
</template>
<template id="infolog.index.rows" template="" lang="" group="0" version="1.9.002">
@ -206,8 +206,8 @@
<description value="Select users or groups"/>
<listbox type="select-account" class="action_popup-content" id="responsible" rows="5" options="both"/>
<hbox>
<button label="Add" id="responsible_action[add]"/>
<button id="responsible_action[delete]" label="Delete"/>
<button label="Add" id="responsible_action[add]" onclick="submit_popup(this); return false;"/>
<button id="responsible_action[delete]" label="Delete" onclick="submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="hide_popup(this,'responsible_popup');"/>
</hbox>
</vbox>
@ -217,8 +217,8 @@
<description class="promptheader" value="Add / Remove link"/>
<link-entry id="link" class="action_popup-content"/>
<hbox>
<button label="Add" id="link_action[add]"/>
<button id="link_action[delete]" label="Delete"/>
<button label="Add" id="link_action[add]" onclick="submit_popup(this); return false;"/>
<button id="link_action[delete]" label="Delete" onclick="submit_popup(this); return false;"/>
<buttononly label="Cancel" onclick="hide_popup(this,'link_popup');"/>
</hbox>
</vbox>