reworked patch from Vincent Cuirassier from Mandriva

- multiple responsibles
- closing action
This commit is contained in:
Ralf Becker 2005-10-05 07:50:47 +00:00
parent 9532fc7af8
commit 84b969586e
11 changed files with 283 additions and 54 deletions

View File

@ -140,6 +140,7 @@
{
$this->customfields = $this->config->config_data['customfields'];
}
$this->user = $GLOBALS['egw_info']['user']['account_id'];
}
/**
* @var int $tz_offset_s offset in secconds between user and server-time,
@ -189,7 +190,13 @@
*/
function check_access( $info_id,$required_rights )
{
return $this->so->check_access( $info_id,$required_rights );
static $cache = array();
if (isset($cache[$info_id][$required_rights]))
{
return $cache[$info_id][$required_rights];
}
return $cache[$info_id][$required_rights] = $this->so->check_access( $info_id,$required_rights );
}
/**
@ -352,6 +359,7 @@
*/
function write($values,$check_defaults=True,$touch_modified=True)
{
//echo "boinfolog::write()values="; _debug_array($values);
// allow to (un)set check_defaults and touch_modified via values, eg. via xmlrpc
foreach(array('check_defaults','touch_modified') as $var)
{
@ -369,9 +377,19 @@
unset($values[$key]);
}
}
$status_only = $values['info_id'] && $values['info_responsible'] == $this->user &&
!$this->check_access($values['info_id'],EGW_ACL_EDIT); // responsible has implicit right to change status
if ($status_only = $values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT))
{
if (!isset($values['info_responsible']))
{
if (!($values_read = $this->read($values['info_id']))) return false;
$responsible =& $values_read['info_responsible'];
}
else
{
$responsible =& $values['info_responsible'];
}
$status_only = in_array($this->user, $responsible); // responsible has implicit right to change status
}
if ($values['info_id'] && !$this->check_access($values['info_id'],EGW_ACL_EDIT) && !$status_only ||
!$values['info_id'] && $values['info_id_parent'] && !$this->check_access($values['info_id_parent'],EGW_ACL_ADD))
{
@ -407,7 +425,7 @@
{
$values['info_enddate'] = $this->user_time_now; // set enddate to today if status == done
}
if ($values['info_responsible'] && $values['info_status'] == 'offer')
if (count($values['info_responsible']) && $values['info_status'] == 'offer')
{
$values['info_status'] = 'ongoing'; // have to match if not finished
}

View File

@ -81,7 +81,8 @@
// ACL only on public entrys || $owner granted _PRIVATE
(!!($this->grants[$owner] & $required_rights) ||
// implicite read-rights for responsible user !!!
$info['info_responsible'] == $this->user && $required_rights == EGW_ACL_READ) &&
in_array($this->user, $info['info_responsible']) && $required_rights == EGW_ACL_READ) &&
//$info['info_responsible'] == $this->user && $required_rights == EGW_ACL_READ) &&
($info['info_access'] == 'public' ||
!!($this->grants[$owner] & EGW_ACL_PRIVATE));
@ -129,15 +130,15 @@
if ($filter == 'my')
{
$filtermethod .= ' AND info_responsible=0';
$filtermethod .= " AND info_responsible='0'";
}
// implicit read-rights for responsible user
$filtermethod .= " OR (info_responsible=$this->user AND info_access='public')";
$filtermethod .= " OR (".$this->db->concat("','",'info_responsible',"'%'")." LIKE '%,$this->user,%' AND info_access='public')";
// private: own entries plus the one user is responsible for
if ($filter == 'private' || $filter == 'own')
{
$filtermethod .= " OR (info_responsible=$this->user".
$filtermethod .= " OR (".$this->db->concat("','",'info_responsible',"'%'")." LIKE '%,$this->user,%'".
($filter == 'own' && count($public_user_list) ? // offer's should show up in own, eg. startpage, but need read-access
" OR info_status = 'offer' AND info_owner IN(" . implode(',',$public_user_list) . ')' : '').")".
" AND (info_access='public'".($has_private_access?" OR $has_private_access":'').')';
@ -157,9 +158,10 @@
if ($filter == 'user' && $f_user > 0)
{
$filtermethod = " ((info_owner=$f_user AND info_responsible=0 OR info_responsible=$f_user) AND $filtermethod)";
$filtermethod = " ((info_owner=$f_user AND info_responsible=0 OR ".$this->db->concat("','",'info_responsible',"'%'")." LIKE '%,$f_user,%') AND $filtermethod)";
}
//echo "<p>aclFilter(filter='$filter_was',user='$user') = '$filtermethod', privat_user_list=".print_r($privat_user_list,True).", public_user_list=".print_r($public_user_list,True)."</p>\n";
return $this->acl_filter[$filter.$f_user] = $filtermethod; // cache the filter
}
@ -237,6 +239,7 @@
$this->data = array(
'info_owner' => $this->user,
'info_priority' => 1,
'info_responsible' => array(),
);
}
@ -259,6 +262,10 @@
$this->init( );
return False;
}
if (!is_array($this->data['info_responsible']))
{
$this->data['info_responsible'] = $this->data['info_responsible'] ? explode(',',$this->data['info_responsible']) : array();
}
if ($info_id != $this->data['info_id']) // data yet read in
{
$this->db->select($this->extra_table,'info_extra_name,info_extra_value',array('info_id'=>$info_id),__LINE__,__FILE__);
@ -341,8 +348,13 @@
*/
function write($values) // did _not_ ensure ACL
{
//echo "soinfolog::write()values="; _debug_array($values);
$info_id = (int) $values['info_id'];
if (isset($values['info_responsible']))
{
$values['info_responsible'] = count($values['info_responsible']) ? implode(',',$values['info_responsible']) : '0';
}
$table_def = $this->db->get_table_definitions('infolog',$this->info_table);
$to_write = array();
foreach($values as $key => $val)
@ -352,14 +364,14 @@
$to_write[$key] = $this->data[$key] = $val; // update internal data
}
}
if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0; // must not be null
if (($this->data['info_id'] = $info_id))
{
$this->db->update($this->info_table,$to_write,array('info_id'=>$info_id),__LINE__,__FILE__);
}
else
{
if (!isset($to_write['info_id_parent'])) $to_write['info_id_parent'] = 0; // must not be null
$this->db->insert($this->info_table,$to_write,false,__LINE__,__FILE__);
$this->data['info_id']=$this->db->get_last_insert_id($this->info_table,'info_id');
}
@ -466,15 +478,22 @@
if (is_array($query['col_filter']))
{
if (!$this->table_defs) $this->table_defs = $this->db->get_table_definitions('infolog',$this->info_table);
foreach($query['col_filter'] as $col => $data)
{
if (substr($col,0,5) != 'info_') $col = 'info_'.$col;
$data = $this->db->quote($data,$this->table_defs['fd'][$col]['type']);
if (!empty($data) && eregi('^[a-z_0-9]+$',$col))
{
$filtermethod .= $col != 'info_responsible' ? " AND $col=$data" :
" AND (info_responsible=$data OR info_responsible=0 AND info_owner=$data)";
if ($col == 'info_responsible')
{
$data = (int) $data;
if (!$data) continue;
$filtermethod .= " AND (".$this->db->concat("','",'info_responsible',"','")." LIKE '%,$data,%' OR info_responsible='0' AND info_owner=$data)";
}
else
{
if (!$this->table_defs) $this->table_defs = $this->db->get_table_definitions('infolog',$this->info_table);
$filtermethod .= ' AND '.$col.'='.$this->db->quote($data,$this->table_defs['fd'][$col]['type']);
}
}
}
}
@ -542,6 +561,8 @@
//echo "<p>sql='$sql'</p>\n";
while (($info =& $this->db->row(true)))
{
$info['info_responsible'] = $info['info_responsible'] ? explode(',',$info['info_responsible']) : array();
$ids[$info['info_id']] =& $info;
}
}

View File

@ -29,6 +29,7 @@
'index' => True,
'edit' => True,
'delete' => True,
'close' => True,
'admin' => True,
'hook_view' => True,
'writeLangFile' => True
@ -53,7 +54,8 @@
'parent' => 'parent.gif', 'parent_alt' => 'View other Subs',
'edit' => 'edit.gif', 'edit_alt' => 'Edit',
'addfile' => 'addfile.gif', 'addfile_alt' => 'Add a file',
'delete' => 'delete.gif', 'delete_alt' => 'Delete' ),
'delete' => 'delete.gif', 'delete_alt' => 'Delete',
'close' => 'done.gif', 'close_alt' => 'Close' ),
'status' => array(
'billed' => 'billed.gif', 'billed_alt' => 'billed',
'done' => 'done.gif', 'done_alt' => 'done',
@ -113,7 +115,8 @@
$this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id
$readonlys["edit[$id]"] = !$this->bo->check_access($id,EGW_ACL_EDIT);
$readonlys["edit_status[$id]"] = !($this->bo->check_access($id,EGW_ACL_EDIT) || $info['info_responsible'] == $this->user);
$readonlys["close[$id]"] = $done || ($readonlys["edit_status[$id]"] = !($this->bo->check_access($id,EGW_ACL_EDIT) ||
in_array($this->user, $info['info_responsible'])));
$readonlys["delete[$id]"] = !$this->bo->check_access($id,EGW_ACL_DELETE);
$readonlys["sp[$id]"] = !$this->bo->check_access($id,EGW_ACL_ADD);
$readonlys["view[$id]"] = $info['info_anz_subs'] < 1;
@ -253,6 +256,8 @@
return $this->edit($do_id,$action,$action_id,'',$referer);
case 'delete':
return $this->delete($do_id,$referer);
case 'close':
return $this->close($do_id,$referer);
case 'sp':
return $this->edit(0,'sp',$do_id,'',$referer);
case 'view':
@ -314,9 +319,24 @@
),$readonlys,$persist,$return_html ? -1 : 0);
}
function close($values=0,$referer='')
{
$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
$referer = is_array($values) ? $values['referer'] : $referer;
if ($info_id)
{
$this->bo->write(array(
'info_id' => $info_id,
'info_status' => 'done',
));
}
return $referer ? $this->tmpl->location($referer) : $this->index();
}
function delete($values=0,$referer='')
{
$info_id = is_array($values) ? $values['info_id'] : $values;
$info_id = (int) (is_array($values) ? $values['info_id'] : ($values ? $values : $_GET['info_id']));
$referer = is_array($values) ? $values['referer'] : $referer;
if (is_array($values) || $info_id <= 0)
@ -374,7 +394,7 @@
if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT)))
{
$old = $this->bo->read($info_id);
$status_only = $old['info_responsible'] == $this->user;
$status_only = in_array($this->user, $old['info_responsible']);
}
}
if ($content['save'] && (!$info_id || $edit_acl || $status_only))
@ -479,7 +499,7 @@
{
if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT))
{
if ($content['info_responsible'] == $this->user)
if (in_array($this->user, $content['info_responsible']))
{
$content['status_only'] = True;
foreach($content as $name => $value)
@ -530,7 +550,7 @@
break; // normal edit
}
case 'new': // new entry
$content['info_startdate'] = $today;
$content['info_startdate'] = (int) $_GET['startdate'] ? (int) $_GET['startdate'] : $today;
$content['info_priority'] = 1; // normal
if ($type != '')
{

File diff suppressed because one or more lines are too long

View File

@ -189,7 +189,6 @@ project infolog de Projekt
re: infolog de Re:
read one record by passing its id. infolog de Einen Datensatz spezifiziert durch seine id lesen.
reg. expr. for local ip's<br>eg. ^192\.168\.1\. infolog de reg. Ausdr. für lokale IP's<br>^192\.168\.1\.
reject infolog de Absage
remark infolog de Bemerkung
remove this link (not the entry itself) infolog de Diese Verknüpfung lösen (nicht den Eintrag selbst)
responsible infolog de Verantwortlich
@ -209,6 +208,7 @@ select an app to search in infolog de eine Anwendung zum Durchsuchen ausw
select an entry to link with infolog de einen Eintrag zum Verküpfen auswählen
select to filter by owner infolog de Besiter zum Filtern auswählen
select to filter by responsible infolog de Verantwortlichen zum Filtern auswählen
sets the status of this entry to done infolog de Setzt den Status dieses Eintrags auf erledigt
should infolog display your open entries - not finised tasks, phonecalls or notes - on the main screen. works only if you dont selected an application for the main screen (in your preferences). infolog de Soll InfoLog die offenen Einträge - nicht beendete Aufgaben, Anrufe oder Notizen - auf der Startsteite anzeigen. Funktioniert nur, wenn Sie keine (einzelne) Anwendung für die Startseite ausgewählt haben (in Ihren Einstellungen).
should infolog display your open entries - not finished tasks, phonecalls or notes - on the main screen. works only if you dont selected an application for the main screen (in your preferences). infolog de Soll InfoLog die offenen Einträge - nicht beendete Aufgaben, Anrufe oder Notizen - auf der Startsteite anzeigen. Funktioniert nur, wenn Sie keine (einzelne) Anwendung für die Startseite ausgewählt haben (in Ihren Einstellungen).
should infolog show subtasks, -calls or -notes in the normal view or not. you can always view the subs via there parent. infolog de Soll InfoLog Untereinträge in der normalen Ansicht anzeigen oder nicht. Sie können die Untereinträge immer über deren Haupteintrag anzeigen.

View File

@ -208,6 +208,7 @@ select an app to search in infolog en Select an App to search in
select an entry to link with infolog en Select an entry to link with
select to filter by owner infolog en select to filter by owner
select to filter by responsible infolog en select to filter by responsible
sets the status of this entry to done infolog en Sets the status of this entry to done
should infolog display your open entries - not finised tasks, phonecalls or notes - on the main screen. works only if you dont selected an application for the main screen (in your preferences). infolog en Should InfoLog display your open entries - not finised tasks, phonecalls or notes - on the main screen. Works only if you dont selected an application for the main screen (in your preferences).
should infolog display your open entries - not finished tasks, phonecalls or notes - on the main screen. works only if you dont selected an application for the main screen (in your preferences). infolog en Should InfoLog display your open entries - not finised tasks, phone calls or notes - on the main screen. Works only if you dont selected an application for the main screen (in your preferences).
should infolog show subtasks, -calls or -notes in the normal view or not. you can always view the subs via there parent. infolog en Should InfoLog show Subtasks, -calls or -notes in the normal view or not. You can always view the subs via their parent.

View File

@ -12,7 +12,7 @@
/* $Id$ */
$setup_info['infolog']['name'] = 'infolog';
$setup_info['infolog']['version'] = '1.0.1.001';
$setup_info['infolog']['version'] = '1.0.1.002';
$setup_info['infolog']['app_order'] = 5;
$setup_info['infolog']['tables'] = array('egw_infolog','egw_infolog_extra');
$setup_info['infolog']['enable'] = 1;
@ -75,3 +75,4 @@

View File

@ -21,7 +21,7 @@
'info_subject' => array('type' => 'varchar','precision' => '255'),
'info_des' => array('type' => 'text'),
'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
'info_responsible' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_responsible' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '0'),
'info_access' => array('type' => 'varchar','precision' => '10','default' => 'public'),
'info_cat' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'info_datemodified' => array('type' => 'int','precision' => '8','nullable' => False),

View File

@ -444,4 +444,19 @@
$GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.001';
return $GLOBALS['setup_info']['infolog']['currentver'];
}
$test[] = '1.0.1.001';
function infolog_upgrade1_0_1_001()
{
$GLOBALS['phpgw_setup']->oProc->AlterColumn('egw_infolog','info_responsible',array(
'type' => 'varchar',
'precision' => '255',
'nullable' => False,
'default' => '0'
));
$GLOBALS['setup_info']['infolog']['currentver'] = '1.0.1.002';
return $GLOBALS['setup_info']['infolog']['currentver'];
}
?>

View File

@ -2,7 +2,7 @@
<!-- $Id$ -->
<overlay>
<template id="infolog.edit.description" template="" lang="" group="0" version="1.0.1.001">
<grid width="100%" border="0">
<grid width="100%" height="260" border="0">
<columns>
<column width="100"/>
<column/>
@ -18,8 +18,8 @@
</rows>
</grid>
</template>
<template id="infolog.edit.links" template="" lang="" group="0" version="0.9.15.003">
<grid width="100%">
<template id="infolog.edit.links" template="" lang="" group="0" version="1.0.1.001">
<grid width="100%" height="260" overflow="auto">
<columns>
<column width="100"/>
<column/>
@ -40,8 +40,8 @@
</rows>
</grid>
</template>
<template id="infolog.edit.delegation" template="" lang="" group="0" version="1.0.0.001">
<grid width="100%">
<template id="infolog.edit.delegation" template="" lang="" group="0" version="1.0.1.001">
<grid width="100%" height="260">
<columns>
<column width="100"/>
<column/>
@ -59,11 +59,9 @@
<row class="th">
<description span="all" value="Delegation"/>
</row>
<row class="row">
<row class="row" valign="top">
<description value="Responsible" options=",,,info_responsible"/>
<menulist>
<menupopup type="select-account" options="Owner" id="info_responsible" statustext="select a responsible user: a person you want to delegate this task"/>
</menulist>
<listbox type="select-account" rows="5" id="info_responsible" statustext="select a responsible user: a person you want to delegate this task"/>
</row>
<row class="row" disabled="1">
<description value="Confirm" options=",,,info_confirm"/>
@ -78,15 +76,15 @@
<description options=",,,info_planned_time" value="planned time"/>
<date-duration id="info_planned_time"/>
</row>
<row class="row" valign="top" height="120">
<row class="row" valign="top" height="50">
<description options=",,,info_used_time" value="used time"/>
<date-duration id="info_used_time"/>
</row>
</rows>
</grid>
</template>
<template id="infolog.edit.customfields" template="" lang="" group="0" version="1.0.0.001">
<grid width="100%" height="100%" spacing="0" padding="0">
<template id="infolog.edit.customfields" template="" lang="" group="0" version="1.0.1.001">
<grid width="100%" height="260" spacing="0" padding="0" overflow="auto">
<columns>
<column/>
</columns>
@ -97,7 +95,7 @@
</rows>
</grid>
</template>
<template id="infolog.edit" template="" lang="" group="0" version="1.0.1.001">
<template id="infolog.edit" template="" lang="" group="0" version="1.0.1.002">
<grid width="100%">
<columns>
<column width="103"/>
@ -120,7 +118,7 @@
</row>
<row class="row">
<description value="Contact" options=",,,info_from"/>
<textbox size="40" maxlength="64" id="info_from" statustext="Custom contact-information, leave emtpy to use information from most recent link"/>
<textbox size="40" maxlength="64" id="info_from" statustext="Custom contact-information, leave emtpy to use information from most recent link" blur="@blur_title"/>
<description value="Phone/Email" options=",,,info_addr"/>
<textbox size="40" maxlength="64" id="info_addr" statustext="Custom contact-address, leave empty to use information from most recent link"/>
</row>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!-- $Id$ -->
<overlay>
<template id="infolog.index.rows-noheader" template="" lang="" group="0" version="0.9.15.003">
<template id="infolog.index.rows-noheader" template="" lang="" group="0" version="1.0.1.001">
<grid>
<columns>
<column width="5%"/>
@ -53,9 +53,7 @@
<menulist>
<menupopup type="select-account" id="${row}[info_owner]" readonly="true"/>
</menulist>
<menulist>
<menupopup type="select-account" id="${row}[info_responsible]" readonly="true"/>
</menulist>
<listbox type="select-account" id="${row}[info_responsible]" readonly="true" rows="5"/>
</vbox>
<vbox orient="0,0">
<date-time id="${row}[info_datemodified]" readonly="true"/>
@ -71,7 +69,7 @@
<hbox>
<button image="edit.gif" label="Edit" id="edit[$row_cont[info_id]]" statustext="Edit this entry"/>
<button image="delete.gif" label="Delete" id="delete[$row_cont[info_id]]" statustext="Delete this entry"/>
<button image="addfile.gif" label="Add file" id="file[$row_cont[info_id]]" disabled="true" statustext="Attach a file"/>
<button image="done.gif" label="Close" id="close[$row_cont[info_id]]" statustext="Sets the status of this entry to done"/>
</hbox>
</row>
</rows>
@ -89,7 +87,7 @@
</styles>
</template>
<template id="infolog.index.rows" template="" lang="" group="0" version="1.0.1.001">
<template id="infolog.index.rows" template="" lang="" group="0" version="1.0.1.002">
<grid>
<columns>
<column width="2%"/>
@ -153,9 +151,7 @@
<menulist>
<menupopup type="select-account" id="${row}[info_owner]" readonly="true"/>
</menulist>
<menulist>
<menupopup type="select-account" id="${row}[info_responsible]" readonly="true"/>
</menulist>
<listbox type="select-account" id="${row}[info_responsible]" readonly="true" rows="5"/>
</vbox>
<vbox orient="0,0">
<date-time id="${row}[info_datemodified]" readonly="true"/>
@ -171,7 +167,7 @@
<hbox>
<button image="edit.gif" label="Edit" id="edit[$row_cont[info_id]]" statustext="Edit this entry"/>
<button image="delete.gif" label="Delete" id="delete[$row_cont[info_id]]" statustext="Delete this entry"/>
<button image="addfile.gif" label="Add file" id="file[$row_cont[info_id]]" disabled="true" statustext="Attach a file"/>
<button image="done.gif" label="Close" id="close[$row_cont[info_id]]" statustext="Sets the status of this entry to done"/>
</hbox>
</row>
</rows>