2001-07-12 01:17:32 +02:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare - InfoLog *
|
|
|
|
* http://www.phpgroupware.org *
|
|
|
|
* 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$ */
|
|
|
|
|
|
|
|
class uiinfolog // UI - User Interface - HTML
|
|
|
|
{
|
|
|
|
var $public_functions = array
|
|
|
|
(
|
2001-10-04 02:46:06 +02:00
|
|
|
'get_list' => True,
|
|
|
|
'view' => True,
|
|
|
|
'add' => True,
|
|
|
|
'edit' => True,
|
|
|
|
'delete' => True,
|
|
|
|
'get_file' => True,
|
|
|
|
'add_file' => True,
|
2001-10-07 22:11:32 +02:00
|
|
|
'admin' => True,
|
2001-07-14 17:49:04 +02:00
|
|
|
'preferences' => True
|
2001-07-12 01:17:32 +02:00
|
|
|
);
|
|
|
|
var $icons;
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function uiinfolog( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->bo = CreateObject('infolog.boinfolog');
|
|
|
|
|
|
|
|
$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(
|
|
|
|
'none' => lang('no Filter'),
|
|
|
|
'done' => lang('done'),
|
|
|
|
'own' => lang('own'),
|
2001-09-26 22:52:57 +02:00
|
|
|
'own-open-today' => lang('own open'),
|
|
|
|
'own-open-overdue'=> lang('own overdue'),
|
|
|
|
'own-upcoming' => lang('own upcoming'),
|
|
|
|
'open-today' => lang('open'),
|
|
|
|
'open-overdue' => lang('overdue'),
|
2001-09-26 19:10:03 +02:00
|
|
|
'upcoming' => lang('upcoming')
|
2001-07-15 23:42:17 +02:00
|
|
|
);
|
|
|
|
|
2002-09-29 10:43:37 +02:00
|
|
|
$this->html = CreateObject('etemplate.html');
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->categories = CreateObject('phpgwapi.categories');
|
|
|
|
$this->nextmatchs = CreateObject('phpgwapi.nextmatchs');
|
2002-09-02 23:50:29 +02:00
|
|
|
$this->link = CreateObject('infolog.uilink');
|
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
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
if ($icon && !is_readable($GLOBALS['phpgw']->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-07-14 23:44:01 +02:00
|
|
|
function setStyleSheet( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
return array (
|
|
|
|
'info_css' => '<link rel="stylesheet" type="text/css" href="'.
|
2001-07-14 23:44:01 +02:00
|
|
|
str_replace( '/images','',
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->get_image_path()).'/info.css">'
|
2001-07-14 23:44:01 +02:00
|
|
|
);
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
/*
|
|
|
|
* $info: info_id or array with one row form info-db
|
2002-05-12 09:14:01 +02:00
|
|
|
* no Proj.Info if action='proj' proj_id == action_id / no Addr.Info if addr_id == a_id
|
2001-07-12 01:17:32 +02:00
|
|
|
*/
|
2002-05-12 09:14:01 +02:00
|
|
|
function formatInfo($info=0,$action='',$action_id=0)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!is_array($info) && (!$info ||
|
|
|
|
!is_array($info=$this->bo->read($info))))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-09-26 19:10:03 +02:00
|
|
|
$info = $this->bo->so->data;
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$done = $info['info_status'] == 'done' ||
|
2001-10-03 23:29:32 +02:00
|
|
|
$info['info_status'] == 'billed';
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
$css_class = $info['info_pri'].($done ? '_done' : '');
|
|
|
|
$subject = "<span class=$css_class>";
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-05-12 09:14:01 +02:00
|
|
|
if (($action_id != ($proj_id = $info['info_proj_id']) || $action != 'proj') &&
|
2001-07-12 01:17:32 +02:00
|
|
|
$proj = $this->bo->readProj($proj_id))
|
|
|
|
{
|
2002-09-01 20:11:57 +02:00
|
|
|
$subject .= $this->html->bold($this->html->a_href($proj['title'],'/index.php',
|
|
|
|
file_exists(PHPGW_SERVER_ROOT.'/projects') &&
|
|
|
|
$GLOBALS['phpgw_info']['user']['apps']['projects']['enabled'] ?
|
|
|
|
array(
|
|
|
|
'menuaction' => 'projects.uiprojects.view_project',
|
|
|
|
'action' => 'mains',
|
2002-09-01 20:57:24 +02:00
|
|
|
'project_id' => $proj_id
|
2002-09-01 20:11:57 +02:00
|
|
|
) : $this->menuaction() + array(
|
|
|
|
'filter' => $filter,
|
|
|
|
'action' => 'proj',
|
|
|
|
'action_id' => $proj_id
|
|
|
|
)
|
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-05-12 09:14:01 +02:00
|
|
|
if (($action_id != ($addr_id = $info['info_addr_id']) || $action != 'addr') &&
|
2001-07-12 01:17:32 +02:00
|
|
|
$addr = $this->bo->readAddr($addr_id))
|
|
|
|
{
|
|
|
|
if ($proj) $subject .= '<br>';
|
|
|
|
$addr = $this->bo->addr2name( $addr );
|
2001-09-26 18:08:08 +02:00
|
|
|
$subject .= $this->html->bold($this->html->a_href($addr,'/index.php',
|
2002-05-12 09:14:01 +02:00
|
|
|
file_exists(PHPGW_SERVER_ROOT.'/addressbook') &&
|
|
|
|
$GLOBALS['phpgw_info']['user']['apps']['addressbook']['enabled'] ?
|
|
|
|
array(
|
|
|
|
'menuaction' => 'addressbook.uiaddressbook.view',
|
|
|
|
'ab_id' => $addr_id
|
|
|
|
) : $this->menuaction() + array(
|
|
|
|
'filter' => $filter,
|
|
|
|
'action' => 'addr',
|
|
|
|
'action_id' => $addr_id
|
|
|
|
)
|
|
|
|
));
|
|
|
|
}
|
|
|
|
if (($action_id != ($event_id = $info['info_event_id']) || $action != 'event') &&
|
|
|
|
$event = $this->bo->readEvent($event_id))
|
|
|
|
{
|
|
|
|
if ($proj || $addr) $subject .= '<br>';
|
|
|
|
$event = $this->bo->event2name( $event );
|
|
|
|
$subject .= $this->html->bold($this->html->a_href($event,'/index.php',
|
|
|
|
file_exists(PHPGW_SERVER_ROOT.'/calendar') &&
|
|
|
|
$GLOBALS['phpgw_info']['user']['apps']['calendar']['enabled'] ?
|
|
|
|
array(
|
|
|
|
'menuaction' => 'calendar.uicalendar.view',
|
|
|
|
'cal_id' => $event_id
|
|
|
|
) : $this->menuaction() + array(
|
|
|
|
'filter' => $filter,
|
|
|
|
'action' => 'event',
|
|
|
|
'action_id' => $event_id
|
|
|
|
)
|
2001-09-26 18:08:08 +02:00
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if (($from = $info['info_from']) && (!$addr || !strstr($addr,$from)))
|
|
|
|
{
|
2002-05-12 09:14:01 +02:00
|
|
|
if ($addr || $event) $subject .= '<br>';
|
2001-07-12 01:17:32 +02:00
|
|
|
$subject .= '<b>'.$from.'</b>';
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($info['info_addr'])
|
|
|
|
{
|
2002-05-12 09:14:01 +02:00
|
|
|
if ($addr || $from || $event) $subject .= ': ';
|
2001-07-12 01:17:32 +02:00
|
|
|
$subject .= $info['info_addr'];
|
|
|
|
}
|
2002-05-12 09:14:01 +02:00
|
|
|
if ($proj || $addr || $from || $info['info_addr'] || $event)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$subject .= '<br>';
|
|
|
|
}
|
|
|
|
$subject .= '<b>';
|
|
|
|
$subject .= $info['info_subject'] ? $info['info_subject'] :
|
|
|
|
substr($info['info_des'],0,60).' ...';
|
|
|
|
$subject .= '</b></span>';
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$info['info_enddate'])
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = ' ';
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$enddate = $GLOBALS['phpgw']->common->show_date($info['info_enddate'],
|
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
|
|
|
|
|
|
|
|
if (!$done && $info['info_enddate'] < time()+(60*60)*$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'])
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = "<span class=overdue>$enddate</span>";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
if (!($responsible = $info['info_responsible']) &&
|
|
|
|
$info['info_status'] == 'offer')
|
|
|
|
{
|
|
|
|
$responsible = $this->icon('status','offer');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$responsible = $this->bo->accountInfo($responsible);
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
$owner = $this->bo->accountInfo($info['info_owner']);
|
|
|
|
if ($info['info_access'] == 'private')
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$owner = "<span class=private>$owner</span>";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-10-04 02:46:06 +02:00
|
|
|
|
|
|
|
// add the links to the files which corrospond to this entry
|
2001-10-07 22:11:32 +02:00
|
|
|
$attachments = $this->bo->list_attached($info['info_id']);
|
|
|
|
while (list($name,$comment) = @each($attachments))
|
2001-10-04 02:46:06 +02:00
|
|
|
{
|
|
|
|
$links .= isset($links) ? ', ' : '<br>';
|
2001-10-07 22:11:32 +02:00
|
|
|
$links .= $this->html->a_href($name,'/index.php',
|
2001-10-04 02:46:06 +02:00
|
|
|
$this->menuaction('get_file') + array(
|
|
|
|
'info_id' => $info['info_id'],
|
2001-10-07 22:11:32 +02:00
|
|
|
'filename' => $name
|
|
|
|
),'target=_blank');
|
|
|
|
if ($comment) $links .= ' (' . $comment . ')';
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
return array(
|
|
|
|
'type' => $this->icon('type',$info['info_type']),
|
|
|
|
'status' => $this->icon('status',$info['info_status']),
|
|
|
|
'pri' => lang($info['info_pri']),
|
|
|
|
'subject' => $subject,
|
2001-07-19 03:03:36 +02:00
|
|
|
'des' => nl2br($info['info_des']),
|
2001-10-03 23:29:32 +02:00
|
|
|
'startdate' => $GLOBALS['phpgw']->common->show_date($info['info_startdate'],
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
|
2001-07-12 01:17:32 +02:00
|
|
|
'enddate' => $enddate,
|
|
|
|
'owner' => $owner,
|
2002-05-12 09:14:01 +02:00
|
|
|
'datemodified' => $GLOBALS['phpgw']->common->show_date($info['info_datemodified'],
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
|
|
|
|
'responsible' => $responsible,
|
|
|
|
'filelinks' => $links
|
2001-10-03 23:29:32 +02:00
|
|
|
);
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-09-26 22:52:57 +02:00
|
|
|
function infoHeaders( $do_sort_header=0,$sort=0,$order=0,$cat_id=0)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$headers['th_bg'] = $GLOBALS['phpgw_info']['theme']['th_bg'];
|
2002-06-01 12:10:14 +02:00
|
|
|
$headers['row_off'] = $GLOBALS['phpgw_info']['theme']['row_off'];
|
|
|
|
$headers['row_on'] = $GLOBALS['phpgw_info']['theme']['row_on'];
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2001-07-15 00:16:16 +02:00
|
|
|
$fields = array(
|
|
|
|
'type' => 'Type',
|
|
|
|
'status' => 'Status',
|
|
|
|
'urgency' => 'Urgency',
|
|
|
|
'subject' => 'Subject',
|
|
|
|
'startdate' => 'Startdate',
|
|
|
|
'enddate' => 'Enddate',
|
|
|
|
'owner' => 'Owner',
|
2002-05-12 09:14:01 +02:00
|
|
|
'datemodified' => 'last changed',
|
2001-07-15 00:16:16 +02:00
|
|
|
'responsible' => 'Responsible'
|
|
|
|
);
|
|
|
|
while (list($f,$lang) = each($fields))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-15 00:16:16 +02:00
|
|
|
$lang = lang($lang);
|
2001-09-26 22:52:57 +02:00
|
|
|
$headers['lang_'.$f] = $do_sort_header ? $this->nextmatchs->show_sort_order($sort,'info_'.$f,$order,'/index.php',$lang,"&cat_id=$cat_id") : $lang;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
return $headers;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-01-20 22:41:38 +01:00
|
|
|
function get_referer($vars='')
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-11-12 15:26:16 +01:00
|
|
|
if(!$vars)
|
|
|
|
{
|
|
|
|
$vars=array('sort','order','query','start','filter','cat_id');
|
|
|
|
}
|
2002-04-30 19:26:40 +02:00
|
|
|
global $referer;
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
if (!$referer)
|
2001-11-12 15:26:16 +01:00
|
|
|
{
|
2002-04-30 19:26:40 +02:00
|
|
|
$referer = get_var('HTTP_REFERER',Array('GLOBAL'));
|
2001-11-12 15:26:16 +01:00
|
|
|
}
|
2001-07-13 13:10:19 +02:00
|
|
|
|
2001-10-04 19:43:43 +02:00
|
|
|
$url = parse_url(str_replace($GLOBALS['phpgw_info']['server']['webserver_url'],'',$referer));
|
2001-07-14 11:14:28 +02:00
|
|
|
|
2001-10-04 19:43:43 +02:00
|
|
|
if (!strstr($url['query'],'menuaction=infolog') || !is_array($vars))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-10-04 19:43:43 +02:00
|
|
|
return $url['path'].($url['query'] ? '?'.$url['query'] : '');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-10-04 19:43:43 +02:00
|
|
|
$args = explode('&',$url['query']);
|
|
|
|
if (!is_array($args))
|
|
|
|
{
|
|
|
|
$args = array();
|
|
|
|
if ($url['query'])
|
2001-11-12 15:26:16 +01:00
|
|
|
{
|
2001-10-04 19:43:43 +02:00
|
|
|
$args[] = $url['query'];
|
2001-11-12 15:26:16 +01:00
|
|
|
}
|
2001-10-04 19:43:43 +02:00
|
|
|
}
|
|
|
|
$query_arr = array( );
|
|
|
|
while (list($null,$arg) = each($args))
|
|
|
|
{
|
|
|
|
list($var,$val) = explode('=',$arg,2);
|
|
|
|
$query_arr[$var] = $val;
|
|
|
|
}
|
|
|
|
reset ($vars);
|
|
|
|
while (list($null,$var) = each($vars))
|
|
|
|
{
|
|
|
|
global $$var; // merge in HTTP_{POST|GET}_VARS
|
|
|
|
if (isset($$var))
|
2001-11-12 15:26:16 +01:00
|
|
|
{
|
2001-10-04 19:43:43 +02:00
|
|
|
$query_arr[$var] = $$var;
|
2001-11-12 15:26:16 +01:00
|
|
|
}
|
2001-10-04 19:43:43 +02:00
|
|
|
}
|
|
|
|
$qstr = '';
|
|
|
|
reset ($query_arr);
|
|
|
|
while (list($var,$val) = each($query_arr))
|
|
|
|
{
|
|
|
|
if ($val && !($val == 'none' && $var == 'filter'))
|
2001-11-12 15:26:16 +01:00
|
|
|
{
|
2001-10-04 19:43:43 +02:00
|
|
|
$qstr .= ($qstr ? '&' : '?')."$var=$val";
|
2001-11-12 15:26:16 +01:00
|
|
|
}
|
2001-10-04 19:43:43 +02:00
|
|
|
}
|
|
|
|
//echo "<p>qstr='$qstr'</p>\n";
|
|
|
|
return $url['path'] . $qstr;
|
2001-07-13 13:10:19 +02:00
|
|
|
}
|
|
|
|
|
2002-05-01 19:16:27 +02:00
|
|
|
function get_list($for_include=0,$action='',$action_id=0)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $cat_filter,$cat_id,$sort,$order,$query,$start,$filter;
|
|
|
|
|
2001-10-04 02:46:06 +02:00
|
|
|
if (!$for_include)
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-07-12 01:46:17 +02:00
|
|
|
}
|
2002-05-01 19:16:27 +02:00
|
|
|
if ($action == '')
|
|
|
|
{
|
|
|
|
$action = get_var('action',array('GET','POST'));
|
|
|
|
$action_id = get_var('action_id',array('GET','POST'));
|
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_root($GLOBALS['phpgw']->common->get_tpl_dir('infolog')); // necessary for hooks
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array( 'info_list_t' => 'list.tpl' ));
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_list_t','projdetails','projdetailshandle');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_list_t','info_headers');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_list_t','info_list','list');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_list_t','get_list');
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
if ($cat_filter) $cat_id = $cat_filter;
|
|
|
|
|
2001-07-15 23:42:17 +02:00
|
|
|
if (!$filter)
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$filter = $GLOBALS['phpgw_info']['user']['preferences']['infolog']['defaultFilter'];
|
2001-07-15 23:42:17 +02:00
|
|
|
}
|
|
|
|
|
2001-07-12 01:17:32 +02:00
|
|
|
$hidden_vars = array(
|
|
|
|
'sort' => $sort,'order' => $order,'query' => $query,
|
|
|
|
'start' => $start,'filter' => $filter,'cat_id' => $cat_id
|
|
|
|
);
|
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
global $PHP_SELF,$QUERY_STRING; // set referer for form
|
|
|
|
$referer = $PHP_SELF.($QUERY_STRING ? '?'.$QUERY_STRING : '');
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 00:23:33 +02:00
|
|
|
$action_vars = array( 'action' => 'new' );
|
2001-07-14 23:44:01 +02:00
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp': // Sub-List
|
2002-05-01 19:16:27 +02:00
|
|
|
$action_vars = array('action'=>'sp','info_id'=>$action_id);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(lang_info_action,lang('InfoLog - Subprojects from'));
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'proj':
|
2002-05-01 19:16:27 +02:00
|
|
|
$action_vars += array( 'id_project' => $action_id,
|
|
|
|
'proj_id' => $action_id);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(lang_info_action,lang('InfoLog').' - '.
|
2002-05-12 09:14:01 +02:00
|
|
|
$this->bo->proj2name($action_id));
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'addr':
|
2002-05-01 19:16:27 +02:00
|
|
|
$action_vars += array( 'id_addr' => $action_id,
|
|
|
|
'addr_id' => $action_id );
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(lang_info_action,lang('InfoLog').' - '.
|
2002-05-12 09:14:01 +02:00
|
|
|
$this->bo->addr2name($action_id));
|
|
|
|
break;
|
|
|
|
case 'event':
|
|
|
|
$action_vars += array( 'id_event' => $action_id,'event_id' => $action_id);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(lang_info_action,lang('InfoLog').' - '.
|
2002-05-12 09:14:01 +02:00
|
|
|
$this->bo->event2name($action_id));
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
default:
|
2001-07-15 23:42:17 +02:00
|
|
|
if ($filter && $filter != 'none')
|
|
|
|
{
|
|
|
|
$filter_name = ': '.$this->filters[ $filter ];
|
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(lang_info_action,lang('InfoLog').$filter_name);
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
2001-07-15 23:42:17 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($this->setStyleSheet( ));
|
2001-07-14 00:23:33 +02:00
|
|
|
|
|
|
|
if (!$for_include)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('add_button',$this->html->form_1button('add_button','Add',
|
2001-07-14 00:23:33 +02:00
|
|
|
$hidden_vars+$action_vars+array('referer'=>$referer),
|
|
|
|
'/index.php',$this->menuaction('edit')));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-14 00:23:33 +02:00
|
|
|
$add_icons = lang('Add').':';
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
$icons = array( 'task' => True,
|
|
|
|
'phone' => True,
|
|
|
|
'note' => True
|
|
|
|
);
|
|
|
|
|
|
|
|
while (list($type,$nul) = each($icons))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$add_icons .= $this->html->a_href($this->icon('type',$type),'/index.php',
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->menuaction('edit')+$action_vars+array('type'=>$type));
|
2001-07-14 00:23:33 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('add_icons',$add_icons);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// ===========================================
|
|
|
|
// list header variable template-declarations
|
|
|
|
// ===========================================
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->infoHeaders( !$for_include,$sort,$order,$cat_id ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var(h_lang_sub,lang('Sub'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var(h_lang_action,lang('Action'));
|
|
|
|
$GLOBALS['phpgw']->template->parse('info_headers','info_headers');
|
2001-07-12 01:17:32 +02:00
|
|
|
// -------------- end header declaration -----------------
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$ids = $this->bo->readIdArray($order,$sort,$filter,$cat_id,$query,
|
2002-05-01 19:16:27 +02:00
|
|
|
$action,$action_id,$ordermethod,$start,$total);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-10-03 23:29:32 +02:00
|
|
|
$maxmatchs = $GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($total > $maxmatchs)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$to = $start + $maxmatchs;
|
|
|
|
if ($to > $total) $to = $total;
|
|
|
|
$total_matchs = lang('showing x - x of x',($start + 1),$to,$total);
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$total_matchs = lang('showing x',$total);
|
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('total_matchs',$total_matchs);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// ==========================================
|
|
|
|
// project description if subprojectlist
|
|
|
|
// ==========================================
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp': // details of parent
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->infoHeaders( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $action_id ));
|
|
|
|
$GLOBALS['phpgw']->template->parse('projdetails','projdetailshandle');
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
case 'addr':
|
|
|
|
case 'proj':
|
2002-05-12 09:14:01 +02:00
|
|
|
case 'event':
|
2002-05-01 19:16:27 +02:00
|
|
|
$nm_extra = "&action_id=$action_id";
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!$for_include || $total > $maxmatchs ||
|
2001-07-15 23:42:17 +02:00
|
|
|
$query || $cat_id)
|
2001-07-14 02:24:02 +02:00
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
// ===========================================
|
|
|
|
// nextmatch variable template-declarations
|
|
|
|
// ===========================================
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!($q_string = strstr($QUERY_STRING,'menuaction')))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-14 02:24:02 +02:00
|
|
|
$q_string = "menuaction=infolog.uiinfolog.get_list";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-14 02:24:02 +02:00
|
|
|
if (!strstr($q_string,'cat_id'))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-07-14 02:24:02 +02:00
|
|
|
$q_string .= "&cat_id=$cat_id";
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-15 23:42:17 +02:00
|
|
|
while (list($f,$lang) = each ($this->filters))
|
|
|
|
{
|
|
|
|
$filters[] = array( $f,$lang );
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
$next_matchs = $this->nextmatchs->show_tpl('/index.php',$start,
|
2001-10-03 23:29:32 +02:00
|
|
|
$total,'&'.$q_string,'95%',$GLOBALS['phpgw_info']['theme']['th_bg'],
|
2001-09-26 15:08:11 +02:00
|
|
|
0,$filters,1,0,$cat_id,'cat_id');
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('next_matchs',$next_matchs);
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2001-07-13 01:39:02 +02:00
|
|
|
if ($total > $maxmatchs)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('next_matchs_end',$next_matchs);
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-07-13 01:39:02 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// ---------- end nextmatch template --------------------
|
|
|
|
|
2002-05-14 15:19:53 +02:00
|
|
|
if (intval($for_include) == 2)
|
2002-05-14 14:04:15 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('info_headers','');
|
2002-05-14 14:04:15 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
while (list($id,$parent) = each($ids))
|
|
|
|
{
|
|
|
|
$subproact = $this->bo->anzSubs($id);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$this->nextmatchs->template_alternate_row_color($GLOBALS['phpgw']->template);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $id,$action,$action_id ));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('edit',$this->html->a_href(
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->icon('action','edit'),'/index.php',
|
2001-10-04 19:43:43 +02:00
|
|
|
$this->menuaction('edit')+$hidden_vars+array('info_id' => $id)));
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('addfiles',$this->html->a_href(
|
2001-10-04 02:46:06 +02:00
|
|
|
$this->icon('action','addfile'),'/index.php',
|
2001-10-04 19:43:43 +02:00
|
|
|
$this->menuaction('add_file')+$hidden_vars+array('info_id' => $id)));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('edit','');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('delete',$this->html->a_href(
|
2001-07-14 23:44:01 +02:00
|
|
|
$this->icon('action','delete'),'/index.php',
|
2001-10-04 19:43:43 +02:00
|
|
|
$this->menuaction('delete')+$hidden_vars+array('info_id' => $id)));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('delete','');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('subadd', ''); // defaults no icons
|
|
|
|
$GLOBALS['phpgw']->template->set_var('viewsub', '');
|
|
|
|
$GLOBALS['phpgw']->template->set_var('viewparent', '');
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($subproact > 0) // if subprojects exist, display VIEW SUB icon
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('viewsub', $this->html->a_href(
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->icon('action','view'),'/index.php',
|
2002-05-01 19:16:27 +02:00
|
|
|
$this->menuaction()+array( 'action_id' => $id,
|
2001-07-12 01:17:32 +02:00
|
|
|
'filter' => $filter, 'action' => 'sp')));
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else // else display ADD SUB-Icon
|
|
|
|
{
|
|
|
|
if ($this->bo->check_access($id,PHPGW_ACL_ADD))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('subadd',$this->html->a_href(
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->icon('action','new'),'/index.php',
|
|
|
|
$this->menuaction('edit')+
|
2001-07-14 23:44:01 +02:00
|
|
|
array('info_id' => $id,'filter' => $filter,
|
2001-07-12 01:17:32 +02:00
|
|
|
'action' => 'sp')));
|
2001-10-03 23:29:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
} // if parent --> display VIEW SUBS of Parent
|
|
|
|
if ($parent && $action != 'sp')
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('viewparent',$this->html->a_href(
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->icon('action','parent'),'/index.php',
|
|
|
|
$this->menuaction()+
|
2002-05-01 19:16:27 +02:00
|
|
|
array('action_id' => $parent,
|
2001-07-12 01:17:32 +02:00
|
|
|
'filter' => $filter,'action' => 'sp')));
|
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->parse('info_list','list',True);
|
2001-07-12 01:17:32 +02:00
|
|
|
// -------------- end record declaration ------------------------
|
|
|
|
}
|
|
|
|
|
|
|
|
// =========================================================
|
|
|
|
// back2project list href declaration for subproject list
|
|
|
|
// =========================================================
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($action && !$for_include)
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('back2projects',
|
|
|
|
$this->html->form_1button('back','Back to Projectlist','',
|
2001-07-14 23:44:01 +02:00
|
|
|
'/index.php',$this->menuaction()+array('filter'=>$filter)));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2002-05-14 15:19:53 +02:00
|
|
|
if (intval($for_include) == 2)
|
2002-05-14 14:04:15 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
return $GLOBALS['phpgw']->template->fp('phpgw_body','get_list',true);
|
2002-05-14 14:04:15 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','get_list',true);
|
|
|
|
$GLOBALS['phpgw']->template->reset_root();
|
2002-05-14 14:04:15 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-10-04 02:46:06 +02:00
|
|
|
/*
|
|
|
|
** Send a requested file to the user.
|
|
|
|
** ACL check is done by the VFS
|
|
|
|
*/
|
|
|
|
function get_file( )
|
|
|
|
{
|
2002-04-30 19:26:40 +02:00
|
|
|
$info_id = get_var('info_id',Array('GET'));
|
|
|
|
$filename = get_var('filename',Array('GET'));
|
2001-10-07 22:11:32 +02:00
|
|
|
//echo "<p>get_file: info_id='$info_id', filename='$filename'</p>\n";
|
2001-10-04 02:46:06 +02:00
|
|
|
|
|
|
|
$browser = CreateObject('phpgwapi.browser');
|
|
|
|
|
|
|
|
$referer = $this->get_referer();
|
|
|
|
|
|
|
|
if (!$info_id || !$filename || !$this->bo->check_access($info_id,PHPGW_ACL_READ))
|
|
|
|
{
|
2001-10-07 22:11:32 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer));
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
|
|
|
}
|
2002-04-30 19:26:40 +02:00
|
|
|
$local = $this->bo->attached_local($info_id,$filename,get_var('REMOTE_ADDR',Array('SERVER')),$browser->is_windows());
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
if ($local)
|
2001-10-04 02:46:06 +02:00
|
|
|
{
|
2001-10-07 22:11:32 +02:00
|
|
|
//echo "<p>local: '$local'</p>\n";
|
|
|
|
Header('Location: ' . $local );
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
2001-10-07 22:11:32 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
//echo "<p>not local: ".$this->bo->vfs_path($info_id,$filename)."</p>\n";
|
|
|
|
$info = $this->bo->info_attached($info_id,$filename);
|
|
|
|
$browser->content_header($filename,$info['mime_type']);
|
|
|
|
echo $this->bo->read_attached($info_id,$filename);
|
|
|
|
}
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
** Display dialog to add one file to an info_log entry
|
|
|
|
*/
|
|
|
|
function add_file( )
|
|
|
|
{
|
|
|
|
global $upload,$info_id;
|
|
|
|
global $attachfile,$attachfile_name,$attachfile_size,$attachfile_type;
|
2001-10-07 22:11:32 +02:00
|
|
|
global $filecomment,$full_fname;
|
2001-10-04 19:43:43 +02:00
|
|
|
global $sort,$order,$query,$start,$filter,$cat_id;
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2001-10-04 19:43:43 +02:00
|
|
|
$referer = $this->get_referer();
|
2001-10-04 02:46:06 +02:00
|
|
|
|
|
|
|
if (!isset($info_id) || !$info_id || !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
|
|
|
|
{
|
|
|
|
$error[]=lang('Access denied');
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer,array('cd'=>15)));
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
|
|
|
}
|
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
if ($upload && $attachfile && $attachfile != "none")
|
|
|
|
{
|
2001-10-08 13:39:20 +02:00
|
|
|
$fileerror = $this->bo->attach_file($info_id,$attachfile,$attachfile_name,$attachfile_size,
|
2002-04-30 19:26:40 +02:00
|
|
|
$attachfile_type,$filecomment,$full_fname,get_var('REMOTE_ADDR',Array('SERVER')));
|
2001-10-07 22:11:32 +02:00
|
|
|
if ($fileerror) $error[]=$fileerror;
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array('info_add_file' => 'add_file.tpl'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->setStyleSheet( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->infoHeaders( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $info_id ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( 'hidden_vars',$this->html->input_hidden(array(
|
2001-10-07 22:11:32 +02:00
|
|
|
'info_id' => $info_id, 'referer' => $referer, 'full_fname' => '.' // must not be empty
|
2001-10-04 19:43:43 +02:00
|
|
|
)));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
|
|
|
if (is_array($error))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('error_list',$GLOBALS['phpgw']->common->error_list($error));
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_info_action',lang('InfoLog').' - '.lang('attach file'));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('actionurl',$this->html->link('/index.php',array('menuaction' => 'infolog.uiinfolog.add_file')));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_file',lang('attach file').':');
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_comment',lang('comment').':');
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('submit_button',$this->html->submit_button('upload','attach file','this.form.full_fname.value=this.form.attachfile.value'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('cancel_button',$this->html->form_1button('cancel_button','Done','',$referer));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','info_add_file');
|
2001-10-04 02:46:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function edit( )
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
global $action,$info_id,$save,$add,$query_addr,$query_project;
|
|
|
|
// formular fields
|
|
|
|
global $selfortoday,$sday,$smonth,$syear;
|
|
|
|
global $dur_days,$eday,$emonth,$eyear;
|
|
|
|
global $type,$from,$addr,$id_addr,$id_project,$subject,$des,$access;
|
|
|
|
global $pri,$status,$confirm,$info_cat,$id_parent,$responsible;
|
2001-10-04 02:46:06 +02:00
|
|
|
global $attachfile,$attachfile_name,$attachfile_size,$attachfile_type;
|
2001-10-07 22:11:32 +02:00
|
|
|
global $filecomment,$full_fname;
|
2002-05-12 09:14:01 +02:00
|
|
|
global $id_event,$query_event;
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
$referer = $this->get_referer();
|
|
|
|
|
2002-04-30 19:26:40 +02:00
|
|
|
if((!isset($info_id) || !$info_id) && !$action || get_var('cancel',Array('POST')))
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer) );
|
2002-08-06 09:42:57 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-04-30 19:26:40 +02:00
|
|
|
if(get_var('delete',Array('POST')))
|
2001-10-09 12:46:16 +02:00
|
|
|
{
|
2002-08-06 09:42:57 +02:00
|
|
|
$this->delete($info_id);
|
|
|
|
return;
|
2001-10-09 12:46:16 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-09-04 01:09:21 +02:00
|
|
|
$app2var = array('addressbook' => 'id_addr','projects' => 'id_project','calendar' => 'id_event' );
|
2002-09-02 23:50:29 +02:00
|
|
|
$linkto = get_var('linkto',Array('POST'));
|
2002-09-04 01:09:21 +02:00
|
|
|
if (is_array($linkto) && $linkto['create'] && ($var = $app2var[$linkto['app']]))
|
2002-09-02 23:50:29 +02:00
|
|
|
{
|
2002-09-04 01:09:21 +02:00
|
|
|
$$var = $linkto['id'];
|
2002-09-02 23:50:29 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
// check wether to write dates or not
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($selfortoday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$startdate = time(); // startdate is today (checkbox is clicked)
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($sday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($sday && !$smonth) $smonth = date('m',time());
|
|
|
|
if ($sday && !$syear) $syear = date('Y',time());
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if (! checkdate($smonth,$sday,$syear))
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('You have entered an invalid starting date');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$startdate = mktime(12,0,0,$smonth, $sday, $syear);
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isset($sday)) $startdate = 0;
|
2001-10-03 23:29:32 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check ending date
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($dur_days > 0)
|
|
|
|
{
|
|
|
|
$enddate = mktime(12,0,0,date('m',$startdate),
|
|
|
|
date('d',$startdate)+$dur_days, date('Y',$startdate));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($eday)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
if ($eday && !$emonth) $emonth = date('m',time());
|
|
|
|
if ($eday && !$eyear) $eyear = date('Y',time());
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if (!checkdate($emonth,$eday,$eyear))
|
|
|
|
{
|
2001-07-16 20:11:27 +02:00
|
|
|
$error[] = lang('You have entered an invalid enddate');
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$enddate = mktime(12,0,0,$emonth,$eday,$eyear);
|
|
|
|
}
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
if (isset($eday)) $enddate = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($save || $add) // form submited
|
|
|
|
{
|
|
|
|
if (strlen($des) >= 8000)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('Description can not exceed 8000 characters in length');
|
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$subject && !$des)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
$error[] = lang('You must enter a subject or a description');
|
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($enddate < $startdate && $enddate && $startdate)
|
|
|
|
{
|
2001-07-16 20:11:27 +02:00
|
|
|
$error[] = lang('Enddate can not be before startdate');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
$access = $access ? 'private' : 'public';
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (! is_array($error))
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
/*
|
|
|
|
** if an info_id exists, check if this user hast the rights to edit
|
|
|
|
** this entry (should prevent faking the info_id in a post request)
|
|
|
|
** or if is a new sub check if he has rights to add a sub
|
|
|
|
*/
|
|
|
|
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT) ||
|
|
|
|
!$info_id && $id_parent && !$this->bo->check_access($id_parent,PHPGW_ACL_ADD))
|
|
|
|
{
|
|
|
|
$error[]=lang('Access denied');
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->bo->write(array(
|
|
|
|
'type' => $type,
|
|
|
|
'from' => $from,
|
|
|
|
'addr' => $addr,
|
|
|
|
'addr_id' => $id_addr,
|
|
|
|
'proj_id' => $id_project,
|
|
|
|
'subject' => $subject,
|
|
|
|
'des' => $des,
|
|
|
|
'pri' => $pri,
|
|
|
|
'status' => $status,
|
|
|
|
'confirm' => $confirm,
|
|
|
|
'access' => $access,
|
|
|
|
'cat' => $info_cat,
|
|
|
|
'startdate' => $startdate,
|
|
|
|
'enddate' => $enddate,
|
|
|
|
'info_id' => $info_id,
|
|
|
|
'id_parent' => $id_parent,
|
2002-05-12 09:14:01 +02:00
|
|
|
'responsible' => $responsible,
|
|
|
|
'event_id' => $id_event
|
2001-10-03 23:29:32 +02:00
|
|
|
));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
if ($attachfile && $attachfile != "none") // save the attached file
|
|
|
|
{
|
2001-10-08 13:39:20 +02:00
|
|
|
$fileerror = $this->bo->attach_file($this->bo->so->data['info_id'],$attachfile,
|
|
|
|
$attachfile_name,$attachfile_size,$attachfile_type,$filecomment,$full_fname,
|
2002-04-30 19:26:40 +02:00
|
|
|
get_var('REMOTE_ADDR',Array('SERVER')));
|
2001-10-07 22:11:32 +02:00
|
|
|
if ($fileerror) $error[]=$fileerror;
|
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
}
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-05-12 09:14:01 +02:00
|
|
|
if (!$query_addr && !$query_project && !$query_event)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer, array('cd'=>15)));
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->bo->read( $info_id );
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
if ($info_id && $action == 'sp') // new SubProject
|
|
|
|
{
|
|
|
|
if (!$this->bo->check_access($info_id,PHPGW_ACL_ADD))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer));
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-09-26 19:10:03 +02:00
|
|
|
$parent = $this->bo->so->data;
|
|
|
|
$this->bo->so->data['info_id'] = $info_id = 0;
|
2001-10-03 23:29:32 +02:00
|
|
|
$this->bo->so->data['info_owner'] = $GLOBALS['phpgw_info']['user']['account_id'];
|
2001-09-26 19:10:03 +02:00
|
|
|
$this->bo->so->data['info_id_parent'] = $parent['info_id'];
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($parent['info_type']=='task' && $parent['info_status']=='offer')
|
|
|
|
{
|
2001-09-26 19:10:03 +02:00
|
|
|
$this->bo->so->data['info_type'] = 'confirm'; // confirmation to parent
|
|
|
|
$this->bo->so->data['info_responsible'] = $parent['info_owner'];
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-09-26 19:10:03 +02:00
|
|
|
$this->bo->so->data['info_status'] = 'ongoing';
|
|
|
|
$this->bo->so->data['info_confirm'] = 'not';
|
|
|
|
$this->bo->so->data['info_subject']=lang('Re:').' '.$parent['info_subject'];
|
|
|
|
$this->bo->so->data['info_des'] = '';
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ($info_id && !$this->bo->check_access($info_id,PHPGW_ACL_EDIT))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer));
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
}
|
2001-07-19 01:09:11 +02:00
|
|
|
if (!$id_parent)
|
2001-09-26 19:10:03 +02:00
|
|
|
$id_parent = $this->bo->so->data['info_id_parent'];
|
2001-07-14 23:44:01 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$common_hidden_vars = $this->html->input_hidden( array(
|
2001-07-13 13:10:19 +02:00
|
|
|
'info_id' => $info_id,
|
|
|
|
'action' => $action,
|
|
|
|
'id_parent' => $id_parent,
|
2001-10-07 22:11:32 +02:00
|
|
|
'referer' => $referer,
|
|
|
|
'full_fname' => '.' // must not be empty
|
2001-07-13 13:10:19 +02:00
|
|
|
));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array('info_edit_t' => 'form.tpl'));
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_edit_t','info_edit');
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-09-04 01:09:21 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('linkto',$this->link->getEntry('linkto','infolog',&$info_id).
|
|
|
|
$this->link->showLinks('links','infolog',$info_id));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (is_array($error))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('error_list',$GLOBALS['phpgw']->common->error_list($error));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2001-07-14 23:44:01 +02:00
|
|
|
|
|
|
|
switch ($action)
|
|
|
|
{
|
2001-07-12 01:17:32 +02:00
|
|
|
case 'sp':
|
2001-07-16 20:11:27 +02:00
|
|
|
$info_action = 'InfoLog - New Subproject';
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_block('info_edit_t', 'subpro');
|
2001-07-14 23:44:01 +02:00
|
|
|
break;
|
2002-05-12 09:14:01 +02:00
|
|
|
case 'new': case 'addr': case 'proj': case 'event':
|
2001-07-16 20:11:27 +02:00
|
|
|
$info_action = 'InfoLog - New';
|
2001-09-26 19:10:03 +02:00
|
|
|
if ($info_type && isset($this->bo->enums['type'][$info_type]))
|
|
|
|
$this->bo->so->data['info_type'] = $info_type;
|
2001-07-12 01:17:32 +02:00
|
|
|
break;
|
|
|
|
default:
|
2002-06-01 12:10:14 +02:00
|
|
|
$info_action = 'InfoLog - Edit';
|
|
|
|
$is_edit = True;
|
|
|
|
break;
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_info_action',lang($info_action) .
|
2001-07-14 23:44:01 +02:00
|
|
|
($query_addr ? ' - '.lang('Search for:')." '$query_addr'" : ''));
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($this->setStyleSheet( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_category',lang('Category'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_none',lang('None'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($info_cat)) $info_cat = $this->bo->so->data['info_cat'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('cat_list',$this->categories->formated_list('select',
|
2001-07-14 23:44:01 +02:00
|
|
|
'all',$info_cat,'True'));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('actionurl',$this->html->link('/index.php',
|
2001-07-12 01:17:32 +02:00
|
|
|
$this->menuaction('edit')));
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('common_hidden_vars',$common_hidden_vars);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
|
|
|
// get an instance of select box class
|
2002-05-12 09:14:01 +02:00
|
|
|
$sb = CreateObject('infolog.sbox2');
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_owner',lang('Owner'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('owner_info',$sb->accountInfo($this->bo->so->data['info_owner']));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_type',lang('Type'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($type)) $type = $this->bo->so->data['info_type'];
|
2001-07-19 03:28:16 +02:00
|
|
|
if (!$type) $type = 'note';
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('type_list',$this->html->sbox_submit($sb->getArrayItem(
|
2001-09-26 19:10:03 +02:00
|
|
|
'type',$type,$this->bo->enums['type']),True));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_prfrom', lang('From'));
|
2001-10-03 23:29:32 +02:00
|
|
|
if (!isset($from)) $from =$GLOBALS['phpgw']->strip_html($this->bo->so->data['info_from']);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('fromval', $from);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_praddr', lang('Phone/Email'));
|
2001-10-03 23:29:32 +02:00
|
|
|
if (!isset($addr)) $addr =$GLOBALS['phpgw']->strip_html($this->bo->so->data['info_addr']);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('addrval', $addr);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($id_project)) $id_project = $this->bo->so->data['info_proj_id'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($sb->getProject('project',$id_project,$query_project));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($id_addr)) $id_addr = $this->bo->so->data['info_addr_id'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($sb->getAddress('addr',$id_addr,$query_addr));
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-05-12 09:14:01 +02:00
|
|
|
if (!isset($id_event)) $id_event = $this->bo->so->data['info_event_id'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($sb->getEvent('event',$id_event,$query_event));
|
2002-05-12 09:14:01 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_prsubject', lang('Subject'));
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!isset($subject)) {
|
2001-10-03 23:29:32 +02:00
|
|
|
$subject = $GLOBALS['phpgw']->strip_html($this->bo->so->data['info_subject']);
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('subjectval', $subject);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_prdesc', lang('Description'));
|
2001-10-03 23:29:32 +02:00
|
|
|
if (!isset($des)) $des = $GLOBALS['phpgw']->strip_html($this->bo->so->data['info_des']);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('descval', $des);
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_start_date',lang('Startdate'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($startdate)) $startdate = $this->bo->so->data['info_startdate'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('start_select_date',
|
2001-07-14 23:44:01 +02:00
|
|
|
$sb->getDate('syear','smonth','sday',$startdate));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_end_date',lang('Enddate'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($enddate)) $enddate = $this->bo->so->data['info_enddate'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('end_select_date',
|
2001-07-14 23:44:01 +02:00
|
|
|
$sb->getDate('eyear','emonth','eday',$enddate));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_selfortoday',lang('Today'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('selfortoday',$this->html->checkbox('selfortoday',0));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_dur_days',lang('Duration'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('days',lang('days'));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_status',lang('Status'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($status)) $status = $this->bo->so->data['info_status'];
|
2001-07-19 03:28:16 +02:00
|
|
|
if (!$status) $status = $this->bo->status['defaults'][$type];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('status_list',$sb->getArrayItem('status',$status,
|
2001-07-19 03:28:16 +02:00
|
|
|
$this->bo->status[$type]));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_priority',lang('Priority'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($pri)) $pri = $this->bo->so->data['info_pri'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('priority_list',$sb->getArrayItem('pri',$pri,
|
2001-09-26 19:10:03 +02:00
|
|
|
$this->bo->enums['priority']));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_confirm',lang('Confirm'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($confirm)) $confirm = $this->bo->so->data['info_confirm'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('confirm_list',$sb->getArrayItem('confirm',$confirm,
|
2001-09-26 19:10:03 +02:00
|
|
|
$this->bo->enums['confirm']));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_responsible',lang('Responsible'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($responsible)) $responsible=$this->bo->so->data['info_responsible'];
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('responsible_list',$sb->getAccount('responsible',
|
2002-05-12 09:14:01 +02:00
|
|
|
$responsible,0,'accounts',-1));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_access_type',lang('Private'));
|
2001-09-26 19:10:03 +02:00
|
|
|
if (!isset($access)) $access = $this->bo->so->data['info_access'] == 'private';
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('access_list',$this->html->checkbox('access',$access));
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(array('lang_file' => lang('attach file').':','file_val' => $full_fname));
|
|
|
|
$GLOBALS['phpgw']->template->set_var(array('lang_comment' => lang('comment').':','comment_val' => $filecomment));
|
2001-10-04 02:46:06 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('edit_button',$this->html->submit_button('save','Save','this.form.full_fname.value=this.form.attachfile.value'));
|
2001-10-03 23:29:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('cancel_button',$this->html->submit_button('cancel','Cancel'));
|
2001-10-04 19:43:43 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if (!$action && $this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('delete_button',$this->html->submit_button('delete','Delete'));
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','info_edit');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
|
2002-08-06 09:42:57 +02:00
|
|
|
function delete( $id=0 )
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-10-05 01:34:30 +02:00
|
|
|
global $info_id,$confirm,$to_del;
|
2002-08-06 09:42:57 +02:00
|
|
|
//echo "<p>delete(id=$id): info_id='$info_id', confirm='$confirm', to_del='$to_del'</p>\n";
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2001-07-13 13:10:19 +02:00
|
|
|
$referer = $this->get_referer();
|
|
|
|
|
2002-08-06 09:42:57 +02:00
|
|
|
if ($id)
|
|
|
|
{
|
|
|
|
$info_id = $id;
|
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
if (!$info_id ||
|
|
|
|
!$this->bo->check_access($info_id,PHPGW_ACL_DELETE))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer));
|
2001-10-04 02:46:06 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
2002-08-06 09:42:57 +02:00
|
|
|
if ($confirm && !$id)
|
2001-07-14 23:44:01 +02:00
|
|
|
{
|
2001-10-05 01:34:30 +02:00
|
|
|
if (!isset($to_del) || $to_del == '.')
|
|
|
|
{
|
|
|
|
$this->bo->delete($info_id);
|
|
|
|
}
|
|
|
|
else
|
2001-10-04 02:46:06 +02:00
|
|
|
{
|
2001-10-07 22:11:32 +02:00
|
|
|
$this->bo->delete_attached($info_id,$to_del);
|
2001-10-05 01:34:30 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
Header('Location: ' . $this->html->link($referer,array( 'cd' => 16 )));
|
2002-08-06 09:42:57 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array( 'info_delete' => 'delete.tpl' ));
|
2001-10-05 01:34:30 +02:00
|
|
|
|
|
|
|
// add the links to the files which corrospond to this entry
|
2001-10-07 22:11:32 +02:00
|
|
|
$attachments = $this->bo->list_attached($info_id);
|
|
|
|
if ($attachments)
|
2001-10-05 01:34:30 +02:00
|
|
|
{
|
|
|
|
$to_del = array('.' => lang('entry and all files'));
|
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
while (list($name,$comment) = each($attachments))
|
2001-10-05 01:34:30 +02:00
|
|
|
{
|
2001-10-07 22:11:32 +02:00
|
|
|
$to_del[$name] = $name . ($comment ? ' ('.$comment.')' : '');
|
2001-10-05 01:34:30 +02:00
|
|
|
}
|
|
|
|
$sbox2 = CreateObject('phpgwapi.sbox2');
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('to_del',$sbox2->getArrayItem('to_del','.',$to_del,True));
|
2001-10-05 01:34:30 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('to_del','');
|
2001-10-05 01:34:30 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->setStyleSheet( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->infoHeaders( ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var( $this->formatInfo( $info_id ));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('lang_info_action',lang('InfoLog - Delete'));
|
2001-07-12 01:17:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('deleteheader',lang('Are you sure you want to delete this entry'));
|
|
|
|
$GLOBALS['phpgw']->template->set_var('no_button',$this->html->form_1button('no_button',
|
2001-07-13 13:10:19 +02:00
|
|
|
'No - Cancel','',$referer));
|
2001-10-05 01:34:30 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('yes_form',$this->html->form('',array('referer' => $referer),'/index.php',
|
2001-10-05 01:34:30 +02:00
|
|
|
$this->menuaction('delete') + array('info_id' => $info_id,'confirm' => 'True')));
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('yes_button',$this->html->submit_button('yes_button','Yes - Delete'));
|
2001-10-05 01:34:30 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','info_delete');
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2001-10-07 22:11:32 +02:00
|
|
|
function admin( )
|
|
|
|
{
|
2002-04-30 19:26:40 +02:00
|
|
|
if(get_var('done',Array('POST')))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
|
|
|
Header('Location: '.$GLOBALS['phpgw']->link('/admin/index.php'));
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
|
|
|
}
|
|
|
|
|
2002-04-30 19:26:40 +02:00
|
|
|
if(get_var('save',Array('POST')))
|
2001-10-07 22:11:32 +02:00
|
|
|
{
|
|
|
|
$this->bo->link_pathes = array(); $this->bo->send_file_ips = array();
|
|
|
|
|
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(
|
2001-10-07 22:11:32 +02:00
|
|
|
'link_pathes' => serialize($this->bo->link_pathes),
|
|
|
|
'send_file_ips' => serialize($this->bo->send_file_ips)
|
|
|
|
);
|
|
|
|
$this->bo->config->save_repository(True);
|
|
|
|
}
|
|
|
|
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array('info_admin_t' => 'admin.tpl'));
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_admin_t', 'admin_line');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_admin_t', 'info_admin');
|
2001-10-07 22:11:32 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(Array(
|
2001-10-07 22:11:32 +02:00
|
|
|
'title' => lang('InfoLog').' - '.lang('configuration'),
|
|
|
|
'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')),
|
|
|
|
'bg_h_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
|
|
|
'save_button' => $this->html->submit_button('save','Save'),
|
|
|
|
'done_button' => $this->html->submit_button('done','Done'),
|
|
|
|
'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\\.')
|
|
|
|
));
|
|
|
|
|
|
|
|
$i = 0; @reset($this->bo->link_pathes);
|
|
|
|
do {
|
|
|
|
list($valid,$trans) = @each($this->bo->link_pathes);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var(array(
|
2001-10-07 22:11:32 +02:00
|
|
|
'bg_nm_color' => $this->nextmatchs->alternate_row_color(),
|
|
|
|
'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])
|
|
|
|
));
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->parse('admin_lines','admin_line',True);
|
2001-10-07 22:11:32 +02:00
|
|
|
++$i;
|
|
|
|
} while ($valid);
|
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','info_admin');
|
2001-10-07 22:11:32 +02:00
|
|
|
}
|
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
function preferences( )
|
|
|
|
{
|
2001-07-14 17:49:04 +02:00
|
|
|
global $save;
|
|
|
|
|
|
|
|
$prefs = array(
|
2001-07-14 23:44:01 +02:00
|
|
|
'homeShowEvents' => 'Show open Events: Tasks/Calls/Notes on main screen',
|
2001-07-15 23:42:17 +02:00
|
|
|
'defaultFilter' => 'Default Filter for InfoLog',
|
2001-07-14 23:44:01 +02:00
|
|
|
'listNoSubs' => 'List no Subs/Childs',
|
|
|
|
'longNames' => 'Show full usernames'
|
2001-07-14 17:49:04 +02:00
|
|
|
);
|
2001-07-15 23:42:17 +02:00
|
|
|
$allowed_values = array (
|
2001-09-26 19:10:03 +02:00
|
|
|
'defaultFilter' => $this->filters
|
2001-07-15 23:42:17 +02:00
|
|
|
);
|
|
|
|
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->preferences->read_repository();
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
if ($save)
|
|
|
|
{
|
|
|
|
while (list($pref,$lang) = each($prefs))
|
|
|
|
{
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->preferences->add('infolog',$pref);
|
2001-07-14 17:49:04 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->preferences->save_repository(True);
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2001-10-03 23:29:32 +02:00
|
|
|
Header('Location: '.$GLOBALS['phpgw']->link('/preferences/index.php'));
|
|
|
|
$GLOBALS['phpgw']->common->phpgw_exit();
|
2001-07-14 23:44:01 +02:00
|
|
|
}
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw']->common->phpgw_header();
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_file(array('info_prefs_t' => 'preferences.tpl'));
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_prefs_t','pref_line');
|
|
|
|
$GLOBALS['phpgw']->template->set_block('info_prefs_t','info_prefs');
|
2001-07-14 17:49:04 +02:00
|
|
|
|
|
|
|
$vars = Array(
|
|
|
|
'title' => lang('InfoLog preferences'),
|
|
|
|
'text' => ' ',
|
2002-06-01 15:19:48 +02:00
|
|
|
'action_url' => $this->html->link('/index.php',$this->menuaction('preferences')),
|
2001-10-03 23:29:32 +02:00
|
|
|
'bg_h_color' => $GLOBALS['phpgw_info']['theme']['th_bg'],
|
2002-06-01 15:19:48 +02:00
|
|
|
'save_button' => $this->html->submit_button('save','Save')
|
2001-07-14 17:49:04 +02:00
|
|
|
);
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var($vars);
|
2001-07-14 17:49:04 +02:00
|
|
|
|
2001-07-14 23:44:01 +02:00
|
|
|
while (list($pref,$lang) = each($prefs))
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('bg_nm_color',$this->nextmatchs->alternate_row_color());
|
|
|
|
$GLOBALS['phpgw']->template->set_var('field',lang($lang));
|
2001-07-15 23:42:17 +02:00
|
|
|
|
|
|
|
if (is_array($allowed_values[$pref]))
|
|
|
|
{
|
|
|
|
if (!is_object($sbox)) $sbox = CreateObject('phpgwapi.sbox2');
|
|
|
|
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('data',$sbox->getArrayItem($pref,
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['infolog'][$pref],
|
2001-07-15 23:42:17 +02:00
|
|
|
$allowed_values[$pref],1));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->set_var('data',$this->html->checkbox($pref,
|
2001-10-03 23:29:32 +02:00
|
|
|
$GLOBALS['phpgw_info']['user']['preferences']['infolog'][$pref]));
|
2001-07-15 23:42:17 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->parse('pref_lines','pref_line',True);
|
2001-07-14 17:49:04 +02:00
|
|
|
}
|
2002-06-01 15:19:48 +02:00
|
|
|
$GLOBALS['phpgw']->template->fp('phpgw_body','info_prefs');
|
2001-07-14 17:49:04 +02:00
|
|
|
}
|
2001-07-12 01:17:32 +02:00
|
|
|
}
|