2001-07-12 01:17:32 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2004-08-09 13:43:57 +02:00
|
|
|
* eGroupWare - InfoLog *
|
|
|
|
* http://www.egroupware.org *
|
2001-07-12 01:17:32 +02:00
|
|
|
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
|
|
|
|
* originaly based on todo written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.boinfolog.inc.php');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This class is the UI-layer (user interface) of InfoLog
|
|
|
|
*
|
|
|
|
* @package infolog
|
|
|
|
* @author RalfBecker-At-outdoor-training.de
|
|
|
|
* @copyright GPL - GNU General Public License
|
|
|
|
*/
|
|
|
|
class uiinfolog
|
2001-07-12 01:17:32 +02:00
|
|
|
{
|
|
|
|
var $public_functions = array
|
|
|
|
(
|
2002-10-08 02:10:18 +02:00
|
|
|
'index' => True,
|
2001-10-04 02:46:06 +02:00
|
|
|
'edit' => True,
|
|
|
|
'delete' => True,
|
2001-10-07 22:11:32 +02:00
|
|
|
'admin' => True,
|
2003-04-28 00:35:39 +02:00
|
|
|
'hook_view' => True,
|
2002-10-14 02:39:47 +02:00
|
|
|
'writeLangFile' => True
|
2001-07-12 01:17:32 +02:00
|
|
|
);
|
|
|
|
var $icons;
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function uiinfolog( )
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
$this->bo =& new boinfolog();
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$this->icons = array(
|
|
|
|
'type' => array(
|
2001-10-04 02:46:06 +02:00
|
|
|
'task' => 'task.gif', 'task_alt' => 'Task',
|
|
|
|
'phone' => 'phone.gif', 'phone_alt' => 'Phonecall',
|
|
|
|
'note' => 'note.gif', 'note_alt' => 'Note',
|
|
|
|
'confirm' => 'confirm.gif', 'confirm_alt' => 'Confirmation',
|
|
|
|
'reject' => 'reject.gif', 'reject_alt' => 'Reject',
|
|
|
|
'email' => 'email.gif', 'email_alt' => 'Email' ),
|
2001-07-12 01:17:32 +02:00
|
|
|
'action' => array(
|
2001-10-04 02:46:06 +02:00
|
|
|
'new' => 'new.gif', 'new_alt' => 'Add Sub',
|
|
|
|
'view' => 'view.gif', 'view_alt' => 'View Subs',
|
|
|
|
'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' ),
|
2001-07-12 01:17:32 +02:00
|
|
|
'status' => array(
|
2001-10-04 02:46:06 +02:00
|
|
|
'billed' => 'billed.gif', 'billed_alt' => 'billed',
|
|
|
|
'done' => 'done.gif', 'done_alt' => 'done',
|
2001-07-12 01:17:32 +02:00
|
|
|
'will-call' => 'will-call.gif', 'will-call_alt' => 'will-call',
|
2001-10-04 02:46:06 +02:00
|
|
|
'call' => 'call.gif', 'call_alt' => 'call',
|
|
|
|
'ongoing' => 'ongoing.gif', 'ongoing_alt' => 'ongoing',
|
|
|
|
'offer' => 'offer.gif', 'offer_alt' => 'offer' )
|
2001-07-12 01:17:32 +02:00
|
|
|
);
|
|
|
|
|
2001-07-15 23:42:17 +02:00
|
|
|
$this->filters = array(
|
2003-04-28 00:35:39 +02:00
|
|
|
'none' => 'no Filter',
|
|
|
|
'done' => 'done',
|
|
|
|
'own' => 'own',
|
|
|
|
'own-open-today' => 'own open',
|
|
|
|
'own-open-overdue' => 'own overdue',
|
|
|
|
'own-upcoming' => 'own upcoming',
|
|
|
|
'open-today' => 'open',
|
|
|
|
'open-overdue' => 'overdue',
|
|
|
|
'upcoming' => 'upcoming'
|
2002-10-08 02:10:18 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
$this->messages = array(
|
|
|
|
'edit' => 'InfoLog - Edit',
|
|
|
|
'add' => 'InfoLog - New',
|
2002-10-14 02:39:47 +02:00
|
|
|
'add_sub' => 'InfoLog - New Subproject',
|
|
|
|
'sp' => '- Subprojects from',
|
|
|
|
're' => 'Re:'
|
2001-07-15 23:42:17 +02:00
|
|
|
);
|
2002-10-18 00:02:44 +02:00
|
|
|
$this->link = &$this->bo->link;
|
2002-10-08 02:10:18 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$this->tmpl =& CreateObject('etemplate.etemplate');
|
2002-10-14 02:39:47 +02:00
|
|
|
$this->html = &$this->tmpl->html;
|
2003-09-08 02:40:42 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$this->user = $GLOBALS['egw_info']['user']['account_id'];
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
|
2002-10-16 02:23:39 +02:00
|
|
|
function get_info($info,&$readonlys,$action='',$action_id='')
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
if (!is_array($info))
|
|
|
|
{
|
|
|
|
$info = $this->bo->read($info);
|
|
|
|
}
|
|
|
|
$id = $info['info_id'];
|
2002-10-18 00:02:44 +02:00
|
|
|
$done = $info['info_status'] == 'done' || $info['info_status'] == 'billed';
|
|
|
|
$info['sub_class'] = $info['info_pri'] . ($done ? '_done' : '');
|
2004-08-28 20:02:16 +02:00
|
|
|
if (!$done && $info['info_enddate'] < $this->bo->user_time_now)
|
2002-10-18 00:02:44 +02:00
|
|
|
{
|
|
|
|
$info['end_class'] = 'overdue';
|
|
|
|
}
|
2002-10-16 02:23:39 +02:00
|
|
|
$info['info_anz_subs'] = $this->bo->anzSubs($id);
|
2003-04-02 12:13:19 +02:00
|
|
|
$this->bo->link_id2from($info,$action,$action_id); // unset from for $action:$action_id
|
2002-10-18 00:02:44 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$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["delete[$id]"] = !$this->bo->check_access($id,EGW_ACL_DELETE);
|
|
|
|
$readonlys["sp[$id]"] = !$this->bo->check_access($id,EGW_ACL_ADD);
|
2002-10-16 02:23:39 +02:00
|
|
|
$readonlys["view[$id]"] = $info['info_anz_subs'] < 1;
|
2002-10-14 02:39:47 +02:00
|
|
|
$readonlys['view[0]'] = True; // no parent
|
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$show_links = $GLOBALS['egw_info']['user']['preferences']['infolog']['show_links'];
|
2003-06-29 19:03:47 +02:00
|
|
|
|
|
|
|
if ($show_links != 'none' && ($links = $this->link->get_links('infolog',$info['info_id'])))
|
|
|
|
{
|
|
|
|
foreach ($links as $link)
|
|
|
|
{
|
|
|
|
if ($link['link_id'] != $info['info_link_id'] &&
|
|
|
|
($link['app'] != $action || $link['id'] != $action_id) &&
|
|
|
|
($show_links == 'all' || ($show_links == 'links') === ($link['app'] != $this->link->vfs_appname)))
|
|
|
|
{
|
|
|
|
$info['filelinks'][] = $link;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2003-08-28 16:31:11 +02:00
|
|
|
$info['info_type_label'] = $this->bo->enums['type'][$info['info_type']];
|
|
|
|
$info['info_status_label'] = $this->bo->status[$info['info_type']][$info['info_status']];
|
|
|
|
|
2002-10-14 02:39:47 +02:00
|
|
|
return $info;
|
|
|
|
}
|
|
|
|
|
2003-12-09 01:08:31 +01:00
|
|
|
function save_sessiondata($values)
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2004-02-28 15:58:44 +01:00
|
|
|
$for = @$values['session_for'] ? $values['session_for'] : @$this->called_by;
|
|
|
|
//echo "<p>$for: uiinfolog::save_sessiondata(".print_r($values,True).") called_by='$this->called_by'</p>\n";
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->session->appsession($for.'session_data','infolog',array(
|
2003-12-09 01:08:31 +01:00
|
|
|
'search' => $values['search'],
|
|
|
|
'start' => $values['start'],
|
|
|
|
'filter' => $values['filter'],
|
|
|
|
'cat_id' => $values['cat_id'],
|
|
|
|
'order' => $values['order'],
|
|
|
|
'sort' => $values['sort'],
|
2004-02-28 15:58:44 +01:00
|
|
|
'col_filter' => $values['col_filter'],
|
|
|
|
'session_for' => $for
|
2002-10-16 16:11:36 +02:00
|
|
|
));
|
2003-12-09 01:08:31 +01:00
|
|
|
}
|
|
|
|
|
2004-02-28 15:58:44 +01:00
|
|
|
function read_sessiondata()
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
$values = $GLOBALS['egw']->session->appsession(@$this->called_by.'session_data','infolog');
|
2004-02-28 15:58:44 +01:00
|
|
|
if (!@$values['session_for'] && $this->called_by)
|
|
|
|
{
|
|
|
|
$values['session_for'] = $this->called_by;
|
|
|
|
$this->save_sessiondata($values);
|
|
|
|
}
|
|
|
|
//echo "<p>$this->called_by: uiinfolog::read_sessiondata() = ".print_r($values,True)."</p>\n";
|
|
|
|
return $values;
|
|
|
|
}
|
|
|
|
|
2003-12-09 01:08:31 +01:00
|
|
|
function get_rows($query,&$rows,&$readonlys)
|
|
|
|
{
|
|
|
|
//echo "<p>uiinfolog.get_rows(start=$query[start],search='$query[search]',filter='$query[filter]',cat_id=$query[cat_id],action='$query[action]/$query[action_id]',col_filter=".print_r($query['col_filter'],True).")</p>\n";
|
|
|
|
$this->save_sessiondata($query);
|
|
|
|
|
2004-03-10 01:58:18 +01:00
|
|
|
$ids = $this->bo->search($query);
|
2003-07-06 10:56:21 +02:00
|
|
|
|
2002-10-14 02:39:47 +02:00
|
|
|
if (!is_array($ids))
|
|
|
|
{
|
|
|
|
$ids = array( );
|
|
|
|
}
|
2004-03-10 01:58:18 +01:00
|
|
|
$rows = array( $query['total'] );
|
2002-10-14 02:39:47 +02:00
|
|
|
$readonlys = array();
|
2003-06-30 01:02:34 +02:00
|
|
|
foreach($ids as $id => $info)
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
$rows[] = $this->get_info($info,$readonlys,$query['action'],$query['action_id']);
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
//echo "<p>readonlys = "; _debug_array($readonlys);
|
2004-03-10 01:58:18 +01:00
|
|
|
//echo "rows=<pre>".print_r($rows,True)."</pre>\n";
|
2002-10-14 02:39:47 +02:00
|
|
|
reset($rows);
|
2003-12-09 01:08:31 +01:00
|
|
|
|
2004-03-10 01:58:18 +01:00
|
|
|
return $query['total'];
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
|
2003-07-06 22:12:27 +02:00
|
|
|
function index($values = 0,$action='',$action_id='',$referer=0,$extra_app_header=False,$return_html=False)
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
|
|
|
$referer = is_array($values) ? $values['referer'] : $referer;
|
2003-12-09 01:08:31 +01:00
|
|
|
//echo "<p>uiinfolog::index(action='$action/$action_id',referer='$referer/$values[referer]') values=\n"; _debug_array($values);
|
2002-10-14 02:39:47 +02:00
|
|
|
if (!is_array($values))
|
|
|
|
{
|
2004-02-28 15:58:44 +01:00
|
|
|
$values = array('nm' => $this->read_sessiondata());
|
2003-07-31 11:20:36 +02:00
|
|
|
if (isset($_GET['filter']))
|
|
|
|
{
|
|
|
|
$values['nm']['filter'] = $_GET['filter']; // infolog/index.php sets defaultFilter that way
|
|
|
|
}
|
2003-12-09 01:08:31 +01:00
|
|
|
if (!isset($values['nm']['order']) || !$values['nm']['order'])
|
|
|
|
{
|
|
|
|
$values['nm']['order'] = 'info_datemodified';
|
|
|
|
$values['nm']['sort'] = 'DESC';
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
2002-10-18 00:02:44 +02:00
|
|
|
if ($action == '')
|
|
|
|
{
|
|
|
|
$action = $values['action'] ? $values['action'] : get_var('action',array('POST','GET'));
|
|
|
|
$action_id = $values['action_id'] ? $values['action_id'] : get_var('action_id',array('POST','GET'));
|
|
|
|
}
|
2003-07-06 10:56:21 +02:00
|
|
|
if ($values['nm']['add'])
|
|
|
|
{
|
|
|
|
$values['add'] = $values['nm']['add'];
|
|
|
|
unset($values['nm']['add']);
|
|
|
|
}
|
2002-10-16 02:23:39 +02:00
|
|
|
if ($values['add'] || $values['cancel'] || isset($values['nm']['rows']) || isset($values['main']))
|
|
|
|
{
|
2002-10-14 02:39:47 +02:00
|
|
|
if ($values['add'])
|
|
|
|
{
|
|
|
|
list($type) = each($values['add']);
|
2002-10-16 02:23:39 +02:00
|
|
|
return $this->edit(0,$action,$action_id,$type,$referer);
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
list($do,$do_id) = isset($values['main']) ? each($values['main']) : @each($values['nm']['rows']);
|
|
|
|
list($do_id) = @each($do_id);
|
2003-06-27 13:34:21 +02:00
|
|
|
//echo "<p>infolog::index: do='$do/$do_id', referer="; _debug_array($referer);
|
2002-10-16 02:23:39 +02:00
|
|
|
switch($do)
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
|
|
|
case 'edit':
|
2004-02-05 14:37:29 +01:00
|
|
|
case 'edit_status':
|
2002-10-16 02:23:39 +02:00
|
|
|
return $this->edit($do_id,$action,$action_id,'',$referer);
|
2002-10-14 02:39:47 +02:00
|
|
|
case 'delete':
|
2002-10-16 02:23:39 +02:00
|
|
|
return $this->delete($do_id,$referer);
|
2002-10-14 02:39:47 +02:00
|
|
|
case 'sp':
|
2002-10-16 02:23:39 +02:00
|
|
|
return $this->edit(0,'sp',$do_id,'',$referer);
|
2002-10-14 02:39:47 +02:00
|
|
|
case 'view':
|
|
|
|
$value = array();
|
|
|
|
$action = 'sp';
|
2002-10-16 02:23:39 +02:00
|
|
|
$action_id = $do_id;
|
2002-10-14 02:39:47 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$value = array();
|
|
|
|
$action = '';
|
|
|
|
$action_id = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-02-28 15:58:44 +01:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->save_sessiondata($values['nm']);
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
switch ($action)
|
|
|
|
{
|
|
|
|
case 'sp':
|
|
|
|
if (!$this->bo->read($action_id))
|
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
$action = '';
|
2002-10-14 02:39:47 +02:00
|
|
|
$action_id = 0;
|
|
|
|
break;
|
|
|
|
}
|
2004-03-10 01:58:18 +01:00
|
|
|
$values['main'][1] = $this->get_info($action_id,$readonlys['main']);
|
2002-10-14 02:39:47 +02:00
|
|
|
break;
|
|
|
|
}
|
2003-12-09 01:08:31 +01:00
|
|
|
$readonlys['cancel'] = $action != 'sp';
|
2002-10-14 02:39:47 +02:00
|
|
|
|
|
|
|
$this->tmpl->read('infolog.index');
|
|
|
|
|
|
|
|
$values['nm']['options-filter'] = $this->filters;
|
|
|
|
$values['nm']['get_rows'] = 'infolog.uiinfolog.get_rows';
|
|
|
|
$values['nm']['no_filter2'] = True;
|
2003-06-29 19:03:47 +02:00
|
|
|
$values['nm']['header_right'] = 'infolog.index.header_right';
|
|
|
|
if ($extra_app_header)
|
|
|
|
{
|
|
|
|
$values['nm']['header_left'] = 'infolog.index.header_left';
|
|
|
|
}
|
|
|
|
$values['nm']['bottom_too'] = True;
|
2002-10-16 02:23:39 +02:00
|
|
|
$persist['action'] = $values['nm']['action'] = $action;
|
|
|
|
$persist['action_id'] = $values['nm']['action_id'] = $action_id;
|
2002-10-14 02:39:47 +02:00
|
|
|
$persist['referer'] = $referer;
|
|
|
|
|
2003-12-09 01:08:31 +01:00
|
|
|
$all_stati = array();
|
|
|
|
foreach($this->bo->status as $typ => $stati)
|
|
|
|
{
|
|
|
|
if ($typ != 'defaults') $all_stati += $stati;
|
|
|
|
}
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologIndex');
|
2004-04-13 17:54:16 +02:00
|
|
|
|
2003-12-09 01:08:31 +01:00
|
|
|
return $this->tmpl->exec('infolog.uiinfolog.index',$values,array(
|
|
|
|
'info_type' => $this->bo->enums['type'],
|
|
|
|
'info_status' => $all_stati
|
2005-02-05 11:22:25 +01:00
|
|
|
),$readonlys,$persist,(int) $return_html);
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
|
2002-10-16 02:23:39 +02:00
|
|
|
function delete($values=0,$referer='')
|
|
|
|
{
|
|
|
|
$info_id = is_array($values) ? $values['info_id'] : $values;
|
|
|
|
$referer = is_array($values) ? $values['referer'] : $referer;
|
|
|
|
|
|
|
|
if (is_array($values) || $info_id <= 0)
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
if ($values['delete'] && $info_id > 0 && $this->bo->check_access($info_id,EGW_ACL_DELETE))
|
2002-10-16 02:23:39 +02:00
|
|
|
{
|
2003-12-19 03:26:17 +01:00
|
|
|
$this->bo->delete($info_id,$values['remove_subs'],$values['info_id_parent']);
|
2002-10-16 02:23:39 +02:00
|
|
|
}
|
|
|
|
return $referer ? $this->tmpl->location($referer) : $this->index();
|
|
|
|
}
|
|
|
|
$readonlys = $values = array();
|
2004-03-10 01:58:18 +01:00
|
|
|
$values['main'][1] = $this->get_info($info_id,$readonlys['main']);
|
2002-10-16 02:23:39 +02:00
|
|
|
|
|
|
|
$this->tmpl->read('infolog.delete');
|
|
|
|
|
|
|
|
$values['main']['no_actions'] = True;
|
2003-12-19 03:26:17 +01:00
|
|
|
$values['remove_subs'] = $this->bo->anzSubs($info_id) > 0;
|
2002-10-16 02:23:39 +02:00
|
|
|
$persist['info_id'] = $info_id;
|
|
|
|
$persist['referer'] = $referer;
|
2003-12-19 03:26:17 +01:00
|
|
|
$persist['info_id_parent'] = $values['main'][1]['info_id_parent'];
|
2003-12-09 01:08:31 +01:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Delete');
|
|
|
|
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => 'ManualInfologDelete');
|
2002-10-16 02:23:39 +02:00
|
|
|
|
|
|
|
$this->tmpl->exec('infolog.uiinfolog.delete',$values,'',$readonlys,$persist);
|
|
|
|
}
|
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
/**
|
|
|
|
* Edit/Create an InfoLog Entry
|
|
|
|
*
|
|
|
|
* @param array $content=null Content from the eTemplate Exec call or info_id on inital call
|
|
|
|
* @param string $action='' Name of an app of 'sp' for a infolog-sub
|
|
|
|
* @param int $action_id=0 Id of app-entry to which a link is created
|
|
|
|
* @param string $type='' Type of log-entry: note,todo,task
|
|
|
|
* @param string $referer='' array with param/get-vars of the refering page
|
|
|
|
*/
|
|
|
|
function edit($content = null,$action = '',$action_id=0,$type='',$referer='')
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
|
|
|
if (is_array($content))
|
|
|
|
{
|
2002-10-18 22:20:35 +02:00
|
|
|
//echo "uiinfolog::edit: content="; _debug_array($content);
|
2002-10-14 02:39:47 +02:00
|
|
|
$info_id = $content['info_id'];
|
|
|
|
$action = $content['action'];
|
|
|
|
$action_id = $content['action_id'];
|
2002-10-16 02:23:39 +02:00
|
|
|
$referer = $content['referer'];
|
2002-10-18 00:02:44 +02:00
|
|
|
|
|
|
|
if (isset($content['link_to']['primary']))
|
|
|
|
{
|
|
|
|
$content['info_link_id'] = $content['link_to']['primary'];
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
if ($content['save'] || $content['delete'] || $content['cancel'])
|
|
|
|
{
|
2004-02-05 14:37:29 +01:00
|
|
|
if ($content['save'] && $info_id)
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT)))
|
2004-02-05 14:37:29 +01:00
|
|
|
{
|
|
|
|
$old = $this->bo->read($info_id);
|
|
|
|
$status_only = $old['info_responsible'] == $this->user;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($content['save'] && (!$info_id || $edit_acl || $status_only))
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2003-03-20 18:22:53 +01:00
|
|
|
if (strstr($content['info_link_id'],':') !== False)
|
|
|
|
{
|
|
|
|
$info_link_id = $content['info_link_id'];
|
|
|
|
$content['info_link_id'] = 0; // as field has to be int
|
|
|
|
}
|
2004-02-05 14:37:29 +01:00
|
|
|
if ($status_only)
|
|
|
|
{
|
|
|
|
$content = array(
|
|
|
|
'info_id' => $content['info_id'],
|
|
|
|
'info_status' => $content['info_status']
|
|
|
|
);
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
$this->bo->write($content);
|
|
|
|
|
2002-10-18 00:02:44 +02:00
|
|
|
if (!$info_id && is_array($content['link_to']['to_id'])) // writing link for new entry
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2002-10-18 22:20:35 +02:00
|
|
|
$content['info_id'] = $this->bo->so->data['info_id'];
|
|
|
|
$this->link->link('infolog',$content['info_id'],$content['link_to']['to_id']);
|
2003-03-20 18:22:53 +01:00
|
|
|
if ($info_link_id)
|
2002-10-18 00:02:44 +02:00
|
|
|
{
|
2003-03-20 18:22:53 +01:00
|
|
|
list($app,$id) = explode(':',$info_link_id);
|
2002-10-18 22:20:35 +02:00
|
|
|
$link = $this->link->get_link('infolog',$content['info_id'],$app,$id);
|
|
|
|
$content['info_link_id'] = $link['link_id'];
|
|
|
|
|
2002-10-18 00:02:44 +02:00
|
|
|
$this->bo->write(array(
|
2003-07-06 10:56:21 +02:00
|
|
|
'info_id' => $content['info_id'],
|
2002-10-18 22:20:35 +02:00
|
|
|
'info_link_id' => $content['info_link_id'],
|
2003-07-06 10:56:21 +02:00
|
|
|
'info_from' => $content['info_from']
|
2002-10-18 22:20:35 +02:00
|
|
|
),False);
|
2002-10-18 00:02:44 +02:00
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif ($content['delete'] && $info_id > 0)
|
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
if (!$referer && $action) $referer = array(
|
|
|
|
'menuaction' => 'infolog.uiinfolog.index',
|
|
|
|
'action' => $action,
|
|
|
|
'action_id' => $action_id
|
|
|
|
);
|
2002-10-14 02:39:47 +02:00
|
|
|
return $this->delete($info_id,$referer); // checks ACL first
|
|
|
|
}
|
2002-10-16 02:23:39 +02:00
|
|
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-04-28 09:15:04 +02:00
|
|
|
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
2002-10-14 02:39:47 +02:00
|
|
|
$action = $action ? $action : get_var('action', array('POST','GET'));
|
|
|
|
$action_id = $action_id ? $action_id : get_var('action_id',array('POST','GET'));
|
|
|
|
$info_id = $content ? $content : get_var('info_id', array('POST','GET'));
|
|
|
|
$type = $type ? $type : get_var('type', array('POST','GET'));
|
2003-09-08 02:40:42 +02:00
|
|
|
$referer = $referer !== '' ? $referer :
|
2005-04-06 13:05:57 +02:00
|
|
|
ereg_replace('^.*'.$GLOBALS['egw_info']['server']['webserver_url'],'',
|
2003-04-28 00:35:39 +02:00
|
|
|
get_var('HTTP_REFERER',Array('SERVER')));
|
2003-04-28 09:15:04 +02:00
|
|
|
//echo "<p>uiinfolog::edit: info_id=$info_id, action='$action', action_id='$action_id', type='$type', referer='$referer'</p>\n";
|
2003-09-08 02:40:42 +02:00
|
|
|
|
2004-08-28 20:02:16 +02:00
|
|
|
$content = $this->bo->read( $info_id || $action != 'sp' ? $info_id : $action_id );
|
|
|
|
$today = mktime(-$this->bo->tz_offset,0,0,date('m'),date('d'),date('Y')); // time=00:00
|
2002-10-14 02:39:47 +02:00
|
|
|
|
2003-06-29 19:03:47 +02:00
|
|
|
if (intval($content['info_link_id']) > 0 && !$this->link->get_link($content['info_link_id']))
|
|
|
|
{
|
|
|
|
$content['info_link_id'] = 0; // link has been deleted
|
|
|
|
}
|
|
|
|
|
2002-10-16 02:23:39 +02:00
|
|
|
if (!$info_id && $action_id && $action == 'sp') // new SubProject
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
if (!$this->bo->check_access($action_id,EGW_ACL_ADD))
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2002-10-16 02:23:39 +02:00
|
|
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
$parent = $this->bo->so->data;
|
|
|
|
$content['info_id'] = $info_id = 0;
|
2004-02-05 14:37:29 +01:00
|
|
|
$content['info_owner'] = $this->user;
|
2002-10-14 02:39:47 +02:00
|
|
|
$content['info_id_parent'] = $parent['info_id'];
|
|
|
|
/*
|
|
|
|
if ($parent['info_type']=='task' && $parent['info_status']=='offer')
|
|
|
|
{
|
|
|
|
$content['info_type'] = 'confirm'; // confirmation to parent
|
|
|
|
$content['info_responsible'] = $parent['info_owner'];
|
|
|
|
}
|
|
|
|
*/
|
2005-02-14 11:39:10 +01:00
|
|
|
$content['info_type'] = $parent['info_type'];
|
|
|
|
$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
|
2002-10-14 02:39:47 +02:00
|
|
|
$content['info_confirm'] = 'not';
|
|
|
|
$content['info_subject']=lang($this->messages['re']).' '.$parent['info_subject'];
|
|
|
|
$content['info_des'] = '';
|
|
|
|
$content['info_lastmodified'] = '';
|
2004-08-28 20:02:16 +02:00
|
|
|
if ($content['info_startdate'] < $this->bo->user_time_now) // parent-startdate is in the past => today
|
2003-06-29 19:03:47 +02:00
|
|
|
{
|
2003-09-08 02:40:42 +02:00
|
|
|
$content['info_startdate'] = $today;
|
2003-06-29 19:03:47 +02:00
|
|
|
}
|
2004-08-28 20:02:16 +02:00
|
|
|
if ($content['info_enddate'] < $this->bo->user_time_now) // parent-enddate is in the past => empty
|
2003-08-28 16:31:11 +02:00
|
|
|
{
|
|
|
|
$content['info_enddate'] = '';
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
if ($info_id && !$this->bo->check_access($info_id,EGW_ACL_EDIT))
|
2002-10-14 02:39:47 +02:00
|
|
|
{
|
2004-02-05 14:37:29 +01:00
|
|
|
if ($content['info_responsible'] == $this->user)
|
|
|
|
{
|
|
|
|
$content['status_only'] = True;
|
|
|
|
foreach($content as $name => $value)
|
|
|
|
{
|
|
|
|
$readonlys[$name] = $name != 'info_status';
|
|
|
|
}
|
2005-02-24 15:08:27 +01:00
|
|
|
// need to set all customfields extra, as they are not set if empty
|
|
|
|
foreach($this->bo->customfields as $name => $value)
|
|
|
|
{
|
|
|
|
$readonlys['#'.$name] = true;
|
|
|
|
}
|
2004-02-05 14:37:29 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $referer ? $this->tmpl->location($referer) : $this->index(0,$action,$action_id);
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
$content['links'] = $content['link_to'] = array(
|
|
|
|
'to_id' => $info_id,
|
2002-10-18 00:02:44 +02:00
|
|
|
'to_app' => 'infolog',
|
2002-10-14 02:39:47 +02:00
|
|
|
);
|
|
|
|
switch ($action)
|
|
|
|
{
|
|
|
|
case 'sp':
|
2003-06-27 12:24:34 +02:00
|
|
|
$links = $this->bo->link->get_links('infolog',$parent['info_id'],'!'.$this->bo->link->vfs_appname);
|
|
|
|
foreach($links as $link)
|
|
|
|
{
|
|
|
|
$link_id = $this->link->link('infolog',$content['link_to']['to_id'],$link['app'],$link['id'],$link['remark']);
|
2003-09-08 02:40:42 +02:00
|
|
|
|
2003-06-27 12:24:34 +02:00
|
|
|
if ($parent['info_link_id'] == $link['link_id'])
|
|
|
|
{
|
|
|
|
$content['info_link_id'] = $link_id;
|
|
|
|
}
|
|
|
|
}
|
2002-10-14 02:39:47 +02:00
|
|
|
break;
|
2003-06-29 19:03:47 +02:00
|
|
|
|
2002-10-14 02:39:47 +02:00
|
|
|
case 'addressbook':
|
|
|
|
case 'projects':
|
|
|
|
case 'calendar':
|
2003-04-28 00:35:39 +02:00
|
|
|
default: // to allow other apps to participate
|
2002-10-18 00:02:44 +02:00
|
|
|
$content['info_link_id'] = $this->link->link('infolog',$content['link_to']['to_id'],$action,$action_id);
|
2004-02-28 15:58:44 +01:00
|
|
|
// $content['blur_title'] = $this->link->title($action,$action_id);
|
2003-09-08 02:40:42 +02:00
|
|
|
|
2003-06-29 19:03:47 +02:00
|
|
|
case '':
|
|
|
|
if ($info_id)
|
|
|
|
{
|
|
|
|
break; // normal edit
|
|
|
|
}
|
|
|
|
case 'new': // new entry
|
2003-09-08 02:40:42 +02:00
|
|
|
$content['info_startdate'] = $today;
|
2002-10-18 00:02:44 +02:00
|
|
|
if ($type != '')
|
|
|
|
{
|
|
|
|
$content['info_type'] = $type;
|
|
|
|
}
|
2005-02-14 11:39:10 +01:00
|
|
|
$content['info_status'] = $this->bo->status['defaults'][$content['info_type']];
|
2002-10-14 02:39:47 +02:00
|
|
|
break;
|
|
|
|
}
|
2005-02-05 11:22:25 +01:00
|
|
|
$content['link_to']['primary'] = (int)$content['info_link_id'];
|
2002-10-14 02:39:47 +02:00
|
|
|
if (!isset($this->bo->enums['type'][$content['info_type']]))
|
|
|
|
{
|
|
|
|
$content['info_type'] = 'note';
|
|
|
|
}
|
|
|
|
}
|
2004-02-28 15:58:44 +01:00
|
|
|
if ($action && $action != 'new' && $action != 'sp')
|
|
|
|
{
|
|
|
|
$content['blur_title'] = $this->link->title($action,$action_id);
|
|
|
|
}
|
2005-04-06 13:05:57 +02:00
|
|
|
$readonlys['delete'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE);
|
2003-09-16 11:06:10 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang($this->messages[$info_id ? 'edit' : ($action == 'sp' ? 'add_sub' : 'add')]);
|
2002-10-14 02:39:47 +02:00
|
|
|
|
|
|
|
$this->tmpl->read('infolog.edit');
|
2003-08-28 16:31:11 +02:00
|
|
|
if ($this->bo->has_customfields($content['info_type']))
|
|
|
|
{
|
|
|
|
$content['customfields'] = $this->bo->customfields;
|
|
|
|
$content['customfields']['###typ###'] = $content['info_type'];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->tmpl->set_cell_attribute('description|links|delegation|customfields','name','description|links|delegation');
|
|
|
|
}
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.
|
2004-02-05 14:37:29 +01:00
|
|
|
($content['status_only'] ? lang('Edit Status') : lang('Edit'));
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['params']['manual'] = array('page' => ($info_id ? 'ManualInfologEdit' : 'ManualInfologAdd'));
|
2004-02-05 14:37:29 +01:00
|
|
|
|
2003-09-16 14:52:51 +02:00
|
|
|
//echo "<p>uiinfolog.edit(info_id='$info_id',action='$action',action_id='$action_id') readonlys="; print_r($readonlys); echo ", content = "; _debug_array($content);
|
2002-10-14 02:39:47 +02:00
|
|
|
$this->tmpl->exec('infolog.uiinfolog.edit',$content,array(
|
|
|
|
'info_type' => $this->bo->enums['type'],
|
|
|
|
'info_pri' => $this->bo->enums['priority'],
|
|
|
|
'info_confirm' => $this->bo->enums['confirm'],
|
|
|
|
'info_status' => $this->bo->status[$content['info_type']]
|
|
|
|
),$readonlys,array(
|
|
|
|
'info_id' => $info_id,
|
|
|
|
'info_id_parent' => $content['info_id_parent'],
|
2002-10-18 00:02:44 +02:00
|
|
|
'info_link_id' => $content['info_link_id'],
|
2002-10-14 02:39:47 +02:00
|
|
|
'action' => $action,
|
|
|
|
'action_id' => $action_id,
|
2002-10-16 02:23:39 +02:00
|
|
|
'referer' => $referer,
|
|
|
|
'link_to' => array('to_id' => $content['link_to']['to_id']) // in case tab gets not viewed
|
2002-10-14 02:39:47 +02:00
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2001-09-26 19:10:03 +02:00
|
|
|
function menuaction($action = 'get_list',$app='infolog')
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-09-26 19:10:03 +02:00
|
|
|
return array( 'menuaction' => "$app.ui$app.$action" );
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function icon($cat,$id,$status='')
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
if (!$status || !($icon = $this->icons[$cat][$id.'_'.$status]))
|
|
|
|
{
|
2001-09-26 19:10:03 +02:00
|
|
|
$icon = $this->icons[$cat][$id];
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2005-04-06 13:05:57 +02:00
|
|
|
if ($icon && !is_readable($GLOBALS['egw']->common->get_image_dir() . '/' . $icon))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$icon = False;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!$status || !($alt = $this->icons[$cat][$id.'_'.$status.'_alt']))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!($alt = $this->icons[$cat][$id.'_alt']))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$alt = $id;
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
return $icon ? $this->html->image('infolog',$icon,lang($alt),'border=0') : lang($alt);
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
function admin( )
|
|
|
|
{
|
2003-04-28 00:35:39 +02:00
|
|
|
if(get_var('cancel',Array('POST')))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->redirect_link('/admin/index.php');
|
2001-10-07 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2002-04-30 19:26:40 +02:00
|
|
|
if(get_var('save',Array('POST')))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
2002-10-20 17:06:52 +02:00
|
|
|
$this->bo->link_pathes = $this->bo->send_file_ips = array();
|
2001-10-07 22:11:32 +02:00
|
|
|
|
2002-04-30 19:26:40 +02:00
|
|
|
$valid = get_var('valid',Array('POST'));
|
|
|
|
$trans = get_var('trans',Array('POST'));
|
|
|
|
$ip = get_var('ip',Array('POST'));
|
|
|
|
while(list($key,$val) = each($valid))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
2002-04-30 19:26:40 +02:00
|
|
|
if($val = stripslashes($val))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
2002-04-30 19:26:40 +02:00
|
|
|
$this->bo->link_pathes[$val] = stripslashes($trans[$key]);
|
|
|
|
$this->bo->send_file_ips[$val] = stripslashes($ip[$key]);
|
2001-10-07 22:11:32 +02:00
|
|
|
}
|
|
|
|
}
|
2001-10-07 23:05:12 +02:00
|
|
|
$this->bo->config->config_data = array(
|
2002-11-05 17:00:01 +01:00
|
|
|
'link_pathes' => $this->bo->link_pathes,
|
|
|
|
'send_file_ips' => $this->bo->send_file_ips
|
2001-10-07 22:11:32 +02:00
|
|
|
);
|
|
|
|
$this->bo->config->save_repository(True);
|
|
|
|
}
|
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['css'] = $this->html->theme2css();
|
|
|
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Configuration');
|
|
|
|
$GLOBALS['egw']->common->egw_header();
|
2001-10-07 22:11:32 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->set_file(array('info_admin_t' => 'admin.tpl'));
|
|
|
|
$GLOBALS['egw']->template->set_block('info_admin_t', 'admin_line');
|
|
|
|
$GLOBALS['egw']->template->set_block('info_admin_t', 'info_admin');
|
2001-10-07 22:11:32 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->set_var(Array(
|
2001-10-07 22:11:32 +02:00
|
|
|
'text' => lang('<b>file-attachments via symlinks</b> instead of uploads and retrieval via file:/path for direct lan-clients'),
|
|
|
|
'action_url' => $this->html->link('/index.php',$this->menuaction('admin')),
|
|
|
|
'save_button' => $this->html->submit_button('save','Save'),
|
2003-04-28 00:35:39 +02:00
|
|
|
'done_button' => $this->html->submit_button('cancel','Cancel'),
|
2001-10-07 22:11:32 +02:00
|
|
|
'lang_valid' => lang('valid path on clientside<br>eg. \\\\Server\\Share or e:\\'),
|
|
|
|
'lang_trans' => lang('path on (web-)serverside<br>eg. /var/samba/Share'),
|
|
|
|
'lang_ip' => lang('reg. expr. for local IP\'s<br>eg. ^192\\.168\\.1\\.')
|
|
|
|
));
|
|
|
|
|
2003-04-28 00:35:39 +02:00
|
|
|
if (!is_array($this->bo->send_file_ips))
|
|
|
|
{
|
|
|
|
$this->bo->send_file_ips = $this->bo->link_pathes = array();
|
|
|
|
}
|
2001-10-07 22:11:32 +02:00
|
|
|
$i = 0; @reset($this->bo->link_pathes);
|
|
|
|
do {
|
|
|
|
list($valid,$trans) = @each($this->bo->link_pathes);
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->set_var(array(
|
2003-04-28 00:35:39 +02:00
|
|
|
'tr_color' => $i & 1 ? 'row_off' : 'row_on',
|
2001-10-07 22:11:32 +02:00
|
|
|
'num' => $i+1,
|
|
|
|
'val_valid' => $this->html->input("valid[$i]",$valid),
|
|
|
|
'val_trans' => $this->html->input("trans[$i]",$trans),
|
|
|
|
'val_ip' => $this->html->input("ip[$i]",$this->bo->send_file_ips[$valid])
|
|
|
|
));
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->parse('admin_lines','admin_line',True);
|
2001-10-07 22:11:32 +02:00
|
|
|
++$i;
|
|
|
|
} while ($valid);
|
|
|
|
|
2005-02-05 15:18:18 +01:00
|
|
|
if (!$this->tmpl->xslt)
|
2002-11-23 21:44:05 +01:00
|
|
|
{
|
|
|
|
echo parse_navbar();
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->pfp('phpgw_body','info_admin');
|
2002-11-23 21:44:05 +01:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->template->fp('phpgw_body','info_admin');
|
2002-11-23 21:44:05 +01:00
|
|
|
}
|
2001-10-07 22:11:32 +02:00
|
|
|
}
|
2002-10-08 02:10:18 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
/**
|
|
|
|
* writes langfile with all templates and messages registered here
|
|
|
|
*
|
|
|
|
* called via [write Langfile] in the etemplate-editor or as http://domain/egroupware/index.php?menuaction=infolog.uiinfolog.writeLangFile
|
|
|
|
*/
|
2002-10-08 02:10:18 +02:00
|
|
|
function writeLangFile()
|
|
|
|
{
|
2002-10-18 00:02:44 +02:00
|
|
|
$extra = $this->messages + $this->filters;
|
|
|
|
$enums = $this->bo->enums + $this->bo->status;
|
|
|
|
unset($enums['defaults']);
|
2004-03-10 01:58:18 +01:00
|
|
|
foreach($enums as $key => $msg_arr)
|
2002-10-18 00:02:44 +02:00
|
|
|
{
|
|
|
|
$extra += $msg_arr;
|
|
|
|
}
|
2002-10-19 13:17:24 +02:00
|
|
|
return $this->tmpl->writeLangFile('infolog','en',$extra);
|
2002-10-08 02:10:18 +02:00
|
|
|
}
|
2003-04-28 00:35:39 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
/**
|
|
|
|
* shows infolog in other applications
|
|
|
|
*
|
|
|
|
* @param $args['location'] location des hooks: {addressbook|projects|calendar}_view|infolog
|
|
|
|
* @param $args['view'] menuaction to view, if location == 'infolog'
|
|
|
|
* @param $args['app'] app-name, if location == 'infolog'
|
|
|
|
* @param $args['view_id'] name of the id-var for location == 'infolog'
|
|
|
|
* @param $args[$args['view_id']] id of the entry
|
|
|
|
* this function can be called for any app, which should include infolog: \
|
|
|
|
* $GLOBALS['egw']->hooks->process(array( \
|
|
|
|
* * 'location' => 'infolog', \
|
|
|
|
* * 'app' => <your app>, \
|
|
|
|
* * 'view_id' => <id name>, \
|
|
|
|
* * <id name> => <id value>, \
|
|
|
|
* * 'view' => <menuaction to view an entry in your app> \
|
|
|
|
* ));
|
|
|
|
*/
|
2003-04-28 00:35:39 +02:00
|
|
|
function hook_view($args)
|
|
|
|
{
|
|
|
|
switch ($args['location'])
|
|
|
|
{
|
|
|
|
case 'addressbook_view':
|
|
|
|
$app = 'addressbook';
|
|
|
|
$view_id = 'ab_id';
|
|
|
|
$view = 'addressbook.uiaddressbook.view';
|
|
|
|
break;
|
|
|
|
case 'projects_view':
|
|
|
|
$app = 'projects';
|
|
|
|
$view_id = 'project_id';
|
|
|
|
$view = 'projects.uiprojects.view';
|
|
|
|
break;
|
|
|
|
case 'calendar_view':
|
|
|
|
$app = 'calendar';
|
|
|
|
$view_id = 'cal_id';
|
|
|
|
$view = 'calendar.uicalendar.view';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$app = $args['app'];
|
|
|
|
$view_id = $args['view_id'];
|
|
|
|
$view = $args['view'];
|
|
|
|
}
|
|
|
|
if (!is_array($args) || $args['debug'])
|
|
|
|
{
|
|
|
|
echo "<p>uiinfolog::hook_view("; print_r($args); echo "): app='$app', $view_id='$args[$view_id]', view='$view'</p>\n";
|
|
|
|
}
|
|
|
|
if (!isset($app) || !isset($args[$view_id]))
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
2004-02-28 15:58:44 +01:00
|
|
|
$this->called_by = $app; // for read/save_sessiondata, to have different sessions for the hooks
|
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$save_app = $GLOBALS['egw_info']['flags']['currentapp'];
|
|
|
|
$GLOBALS['egw_info']['flags']['currentapp'] = 'infolog';
|
2003-04-28 00:35:39 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw']->translation->add_app('infolog');
|
2003-04-28 00:35:39 +02:00
|
|
|
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['etemplate']['hooked'] = True;
|
2003-04-28 00:35:39 +02:00
|
|
|
$this->index(0,$app,$args[$view_id],array(
|
|
|
|
'menuaction' => $view,
|
|
|
|
$view_id => $args[$view_id]
|
2003-06-29 19:03:47 +02:00
|
|
|
),True);
|
2005-04-06 13:05:57 +02:00
|
|
|
$GLOBALS['egw_info']['flags']['currentapp'] = $save_app;
|
|
|
|
unset($GLOBALS['egw_info']['etemplate']['hooked']);
|
2003-04-28 00:35:39 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|