enable infolog to associate entries to calendar-events

This commit is contained in:
Ralf Becker 2002-05-12 07:14:01 +00:00
parent 8f303f7484
commit 26cc517d8a
13 changed files with 841 additions and 61 deletions

View File

@ -111,6 +111,10 @@
function addr2name( $addr )
{
if (!is_array($addr) && !($addr = $this->readAddr($addr)))
{
return '';
}
$name = $addr['n_family'];
if ($addr['n_given'])
{
@ -130,11 +134,20 @@
return $GLOBALS['phpgw']->strip_html($name);
}
function proj2name( $proj )
{
if (!is_array($proj))
{
$proj = $this->readProj($proj);
}
return is_array($proj) ? $proj['title'] : '';
}
function readProj($proj_id)
{
if ($proj_id)
{
if (!is_object($this->projects))
if (!is_object($this->projects) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->projects = createobject('projects.boprojects');
}
@ -162,6 +175,43 @@
return False;
}
function event2name( $event )
{
if (!is_object($this->bocal) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (is_object($this->bocal) && !is_array($event) && (int) $event > 0)
{
$event = $this->bocal->read_entry($event);
}
if (!is_array($event))
{
return '';
}
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name .= ': ' . $event['title'];
return $GLOBALS['phpgw']->strip_html($name);
}
function readEvent($cal_id)
{
if ($cal_id)
{
if (!is_object($this->bocal) && file_exists(PHPGW_SERVER_ROOT.'/projects'))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (is_object($this->bocal) && $event = $this->bocal->read_entry( $cal_id ))
{
return $event;
}
}
return False;
}
/*
* check's if user has the requiered rights on entry $info_id
*/
@ -209,7 +259,7 @@
{
$values['owner'] = $this->so->user;
}
$values['datecreated'] = time(); // is now MODIFICATION-date
$values['datemodified'] = time();
if (!$values['subject'])
{

View File

@ -0,0 +1,598 @@
<?php
/**************************************************************************\
* phpGroupWare API - Select Box 2 *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* Class for creating select boxes for addresse, projects, array items, ... *
* Copyright (C) 2000, 2001 Dan Kuykendall *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
* http://www.phpgroupware.org/api *
* ------------------------------------------------------------------------ *
* This library is free software; you can redistribute it and/or modify it *
* under the terms of the GNU Lesser General Public License as published by *
* the Free Software Foundation; either version 2.1 of the License, *
* or any later version. *
* This library is distributed in the hope that it will be useful, but *
* WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU Lesser General Public License for more details. *
* You should have received a copy of the GNU Lesser General Public License *
* along with this library; if not, write to the Free Software Foundation, *
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
\**************************************************************************/
/* $Id$ */
if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
{
include(PHPGW_API_INC . '/class.sbox.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['sbox'] = True;
}
class sbox2 extends sbox
{
/*
* Function: search for an id of an db-entry, eg. an address
* Parameter: $name base name for all template-vars and of the submitted vars (not to conflict with other template-var-names !!!)
* $lang_name titel of the field
* $prompt for the JavaScript prompt()
* $id_name id of previosly selected entry
* $content from id (eg. 'company: lastname, givenname' for address $id) if $id != 0, or
* array with searchresult (id's as key), if array is empty if search was unsucsessful
* $multipe present a multiple selectable box instead of one selector-button
* Returns: array with vars to set in temaplate, the vars are:
* {doSearchFkt} Javascript Funktion, place somewhere in Template (before rest of the vars)
* {$name.'_title} button with titel $lang_name (if JS) or just $lang_name
* {$name} content of $id if != 0, or lang('use Button to search for').$lang_name
* {$name.'_nojs} searchfield + button if we have no JavaScript, else empty
*
* To use call $template->set_var(getIdSearch( ... ));
* the template should look like {doSearchFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr> (XXX is content of $name)
* In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
*/
function getId($name,$lang_name,$prompt,$id_name,$content='',$note='',$multiple=False)
{
// echo "<p>getId('$name','$lang_name','$prompt',$id_name,'$content') =";
$ret['doSearchFkt'] =
'<script language="JavaScript">'."\n".
" function doSearch(field,ask) {\n".
" field.value = prompt(ask,'');\n".
" if (field.value != 'null') {\n".
" if (field.value.length == 0)\n".
" field.value = '%';\n".
" field.form.submit();\n".
" } else\n".
" field.value = ''\n".
" }\n".
'</script>';
$ret[$name.'_title'] = is_array($content) && count($content) ? $lang_name :
'<script language="JavaScript">'."\n".
" document.writeln('<input type=\"hidden\" name=\"query_$name\" value=\"\">');\n".
" document.writeln('<input type=\"button\" onClick=\"doSearch(this.form.query_$name,\'$prompt\')\" value=\"$lang_name\">');\n".
"</script>\n".
"<noscript>\n".
" $lang_name\n".
"</noscript>";
if (is_array($content))
{
// result from search
if (!count($content))
{
// search was unsuccsessful
$ret[$name] = lang('no entries found, try again ...');
}
else
{
$ret[$name.'_OK'] = ''; // flag we have something so select
if ($multiple)
{
$ret[$name] = '<select name="id_'.$name.'[]" size=10 multiple>'."\n";
}
else
{
$ret[$name] = '<select name="id_'.$name.'">'."\n";
}
while (list( $id,$text ) = each( $content ))
{
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['phpgw']->strip_html($text) . "\n";
}
$ret[$name] .= '<option value="0">'.lang('none')."\n";
$ret[$name] .= '</select>';
}
}
else
{
if ($id_name)
{
$ret[$name] = $content . "\n<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">";
}
else
{
$ret[$name] = "<span class=note>$note</span>";
}
}
$ret[$name.'_nojs'] =
"<noscript>\n".
" <input name=\"query_$name\" value=\"\" size=10> &nbsp;<input type=\"submit\" value=\"?\">\n".
"</noscript>";
// print_r($ret);
return $ret;
}
function event2name( $event )
{
if (!is_object($this->bocal))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (!is_array($event) && (int) $event > 0)
{
$event = $this->bocal->read_entry($event);
}
if (!is_array($event))
{
return 'not an event !!!';
}
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name .= ': ' . $event['title'];
return $GLOBALS['phpgw']->strip_html($name);
}
/*
* Function Allows you to show and select an event from the calendar (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the address for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* $multipe present a multiple selectable box instead of one selector-button
* On Submit $id_XXX contains the selected event (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getEvent( ... )); (see getId( ))
*
* Note As query's for an event are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getEvent( $name,$id_name,$query_name,$title='',$multiple=False)
{
// echo "<p>getEvent('$name',$id_name,'$query_name','$title')</p>";
// fallback if calendar is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/calendar') || !$GLOBALS['phpgw_info']['user']['apps']['calendar']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
$name.'_no_js' => '',
$name.'_title' => ''
);
}
if ($id_name || $query_name)
{
if (!is_object($this->bocal))
{
$this->bocal = createobject('calendar.bocalendar');
}
if ($query_name)
{
$event_ids = $this->bocal->search_keywords($query_name);
$content = array( );
while ($event_ids && list( $key,$id ) = each( $event_ids ))
{
$content[$id] = $this->event2name( $id );
}
}
else
{
$event = $this->bocal->read_entry( $id_name );
if ($event && is_array($event))
{
$content = $this->event2name( $event );
}
}
}
if (!$title)
{
$title = lang('Calendar');
}
return $this->getId($name,$title,lang('Pattern for Search in Calendar'),$id_name,$content,lang('use Button to search for Calendarevent'),$multiple);
}
function addr2name( $addr )
{
$name = $addr['n_family'];
if ($addr['n_given'])
{
$name .= ', '.$addr['n_given'];
}
else
{
if ($addr['n_prefix'])
{
$name .= ', '.$addr['n_prefix'];
}
}
if ($addr['org_name'])
{
$name = $addr['org_name'].': '.$name;
}
return $GLOBALS['phpgw']->strip_html($name);
}
/*
* Function Allows you to show and select an address from the addressbook (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the address for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* $multipe present a multiple selectable box instead of one selector-button
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getAddress( ... )); (see getId( ))
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getAddress( $name,$id_name,$query_name,$title='',$multiple=False)
{
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
{
$contacts = createobject('phpgwapi.contacts');
if ($query_name)
{
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
while ($addrs && list( $key,$addr ) = each( $addrs ))
{
$content[$addr['id']] = $this->addr2name( $addr );
}
}
else
{
list( $addr ) = $contacts->read_single_entry( $id_name );
if (count($addr))
{
$content = $this->addr2name( $addr );
}
}
}
if (!$title)
{
$title = lang('Addressbook');
}
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content,lang('use Button to search for Address'),$multiple);
}
function addr2email( $addr,$home='' )
{
if (!is_array($addr))
{
$home = substr($addr,-1) == 'h';
$contacts = createobject('phpgwapi.contacts');
list( $addr ) = $contacts->read_single_entry( intval($addr) );
}
if ($home)
{
$home = '_home';
}
if (!count($addr) || !$addr['email'.$home])
{
return False;
}
if ($addr['n_given'])
{
$name = $addr['n_given'];
}
else
{
if ($addr['n_prefix'])
{
$name = $addr['n_prefix'];
}
}
$name .= ($name ? ' ' : '') . $addr['n_family'];
return $name.' <'.$addr['email'.$home].'>';
}
function getEmail( $name,$id_name,$query_name,$title='')
{
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
if ($id_name || $query_name)
{
$contacts = createobject('phpgwapi.contacts');
if ($query_name)
{
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
while ($addrs && list( $key,$addr ) = each( $addrs ))
{
if ($addr['email'])
{
$content[$addr['id']] = $this->addr2email( $addr );
}
if ($addr['email_home'])
{
$content[$addr['id'].'h'] = $this->addr2email( $addr,'_home' );
}
}
}
else
{
$content = $this->addr2email( $id_name );
}
}
if (!$title)
{
$title = lang('Addressbook');
}
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content);
}
/*
* Function Allows you to show and select an project from the projects-app (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the project for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getProject( ... )); (see getId( ))
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getProject( $name,$id_name,$query_name,$title='' )
{
// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
// fallback if projects is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/projects') || !$GLOBALS['phpgw_info']['user']['apps']['projects']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
$name.'_no_js' => '',
$name.'_title' => ''
);
}
if ($id_name || $query_name)
{
$projects = createobject('projects.boprojects');
if (!is_object($projects))
{
return '';
}
if ($query_name)
{
$projs = $projects->list_projects( 0,0,$query_name,'','','','',0,'mains','' );
$content = array();
while ($projs && list( $key,$proj ) = each( $projs ))
{
$content[$proj['id']] = $proj['title'];
}
}
else
{
list( $proj ) = $projects->read_single_project( $id_name );
if (count($proj))
{
$content = $proj['title'];
// $customer_id = $proj['customer'];
}
}
}
if (!$title)
{
$title = lang('Project');
}
return $this->getId($name,$title,lang('Pattern for Search in Projects'),$id_name,$content,lang('use Button to search for Project'));
}
/*
* Function: Allows to show and select one item from an array
* Parameters: $name string with name of the submitted var which holds the key of the selected item form array
* $key key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
* $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
* $no_lang if !$no_lang send items through lang()
* $options additional options (e.g. 'multiple')
* On submit $XXX is the key of the selected item (XXX is the content of $name)
* Returns: string to set for a template or to echo into html page
*/
function getArrayItem($name, $key, $arr=0,$no_lang=0,$options='',$multiple=0)
{
// should be in class common.sbox
if (!is_array($arr))
{
$arr = array('no','yes');
}
if (0+$multiple > 0)
{
$options .= ' MULTIPLE SIZE='.(0+$multiple);
if (substr($name,-2) != '[]')
{
$name .= '[]';
}
}
$out = "<select name=\"$name\" $options>\n";
if (is_array($key))
{
$key = implode(',',$key);
}
while (list($k,$text) = each($arr))
{
$out .= '<option value="'.$k.'"';
if($k == $key || strstr(",$key,",",$k,"))
{
$out .= " SELECTED";
}
$out .= ">" . ($no_lang || $text == '' ? $text : lang($text)) . "</option>\n";
}
$out .= "</select>\n";
return $out;
}
function getPercentage($name, $selected=0,$options='')
{
// reimplemented using getArrayItem
for ($i=0; $i <= 100; $i+=10)
{
$arr[$i] = "$i%";
}
return $this->getArrayItem($name,$selected,$arr,1,$options);
}
function getPriority($name, $selected=2,$options='')
{
// reimplemented using getArrayItem
$arr = array('','low','normal','high');
return $this->getArrayItem($name,$selected,$arr,0,$options);
}
function getAccessList($name,$selected='private',$options='')
{
// reimplemented using getArrayItem
$arr = array(
'private' => 'Private',
'public' => 'Global public',
'group' => 'Group public'
);
if (strstr($selected,','))
{
$selected = "group";
}
return $this->getArrayItem($name,$selected,$arr,0,$options);
}
function getCountry($name='country',$selected=' ',$options='')
{
// reimplemented using getArrayItem
return $this->getArrayItem($name,$selected,$this->country_array,0,$options);
}
function form_select($name='country',$selected=' ',$options='')
{
// reimplemented using getArrayItem (stupid name!!!)
return getCountry($name,$selected,$options);
}
function accountInfo($id,$account_data=0,$longnames=0,$show_type=0)
{
if (!$id)
{
return '&nbsp;';
}
if (!is_array($account_data))
{
$accounts = createobject('phpgwapi.accounts',$id);
$accounts->db = $GLOBALS['phpgw']->db;
$accounts->read_repository();
$account_data = $accounts->data;
}
$info = $show_type ? '('.$account_data['account_type'].') ' : '';
switch ($longnames)
{
case 2: $info .= '&lt;'.$account_data['account_lid'].'&gt; '; // fall-through
case 1: $info .= $account_data['account_firstname'].' '.$account_data['account_lastname']; break;
default: $info .= $account_data['account_lid']; break;
}
return $info;
}
/*
* Function: Allows to select one accountname
* Parameters: $name string with name of the submitted var, which holds the account_id or 0 after submit
* $id account_id of already selected account
* $longnames 0=account_lid 1=firstname lastname
*/
function getAccount($name,$id,$longnames=0,$type='accounts',$multiple=0,$options='')
{
$accounts = createobject('phpgwapi.accounts');
$accounts->db = $GLOBALS['phpgw']->db;
$accs = $accounts->get_list($type);
if ($multiple < 0)
{
$aarr[] = lang('not assigned');
}
while ($a = current($accs))
{
$aarr[$a['account_id']] = $this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
next($accs);
}
return $this->getArrayItem($name,$id,$aarr,1,$options,$multiple);
}
function getDate($n_year,$n_month,$n_day,$date,$options='')
{
if (is_array($date))
{
list($year,$month,$day) = $date;
}
elseif (!$date)
{
$day = $month = $year = 0;
}
else
{
$day = date('d',$date);
$month = date('m',$date);
$year = date('Y',$date);
}
return $GLOBALS['phpgw']->common->dateformatorder(
$this->getYears($n_year,$year),
$this->getMonthText($n_month,$month),
$this->getDays($n_day,$day)
);
}
function getCategory($name,$cat_id='',$notall=False,$jscript=True,$multiple=0,$options='')
{
if (!is_object($this->cat))
{
$this->cat = CreateObject('phpgwapi.categories');
}
if ($jscript)
{
$options .= ' onChange="this.form.submit();"';
}
if (0+$multiple > 0)
{
$options .= ' MULTIPLE SIZE='.(0+$multiple);
if (substr($name,-2) != '[]')
{
$name .= '[]';
}
}
/* Setup all and none first */
$cats_link = "\n<SELECT NAME=\"$name\" $options>\n";
if (!$notall)
{
$cats_link .= '<option value=""';
if ($cat_id=='all')
{
$cats_link .= ' selected';
}
$cats_link .= '>'.lang("all")."</option>\n";
}
/* Get global and app-specific category listings */
$cats_link .= $this->cat->formated_list('select','all',$cat_id,True);
$cats_link .= '</select>'."\n";
return $cats_link;
}
}

View File

@ -241,7 +241,7 @@
}
else
{
$ordermethod = 'order by info_datecreated desc'; // newest first
$ordermethod = 'order by info_datemodified desc'; // newest first
}
$filtermethod = $this->aclFilter($filter);
$filtermethod .= $this->statusFilter($filter);
@ -258,6 +258,8 @@
break;
case 'proj': $filtermethod .= " AND info_proj_id=$action_id ";
break;
case 'event': $filtermethod .= " AND info_event_id=$action_id ";
break;
}
if ($query) // we search in _from, _subject and _des for $query
{

View File

@ -112,9 +112,9 @@
/*
* $info: info_id or array with one row form info-db
* no Proj.Info if proj_id == p_id / no Addr.Info if addr_id == a_id
* no Proj.Info if action='proj' proj_id == action_id / no Addr.Info if addr_id == a_id
*/
function formatInfo($info=0,$p_id=0,$a_id=0)
function formatInfo($info=0,$action='',$action_id=0)
{
if (!is_array($info) && (!$info ||
!is_array($info=$this->bo->read($info))))
@ -127,7 +127,7 @@
$css_class = $info['info_pri'].($done ? '_done' : '');
$subject = "<span class=$css_class>";
if ($p_id != ($proj_id = $info['info_proj_id']) &&
if (($action_id != ($proj_id = $info['info_proj_id']) || $action != 'proj') &&
$proj = $this->bo->readProj($proj_id))
{
$subject .= $this->html->bold($this->html->a_href($proj['title'],
@ -135,29 +135,53 @@
array( 'filter' => $filter,'action' => 'proj',
'action_id' => $proj_id )));
}
if ($a_id != ($addr_id = $info['info_addr_id']) &&
if (($action_id != ($addr_id = $info['info_addr_id']) || $action != 'addr') &&
$addr = $this->bo->readAddr($addr_id))
{
if ($proj) $subject .= '<br>';
$addr = $this->bo->addr2name( $addr );
$subject .= $this->html->bold($this->html->a_href($addr,'/index.php',
array( 'menuaction' => 'addressbook.uiaddressbook.view',
'ab_id' => $addr_id)
/* $this->menuaction() + array( 'filter' => $filter,'action' => 'addr',
'action_id' => $addr_id )*/
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
)
));
}
if (($from = $info['info_from']) && (!$addr || !strstr($addr,$from)))
{
if ($addr) $subject .= '<br>';
if ($addr || $event) $subject .= '<br>';
$subject .= '<b>'.$from.'</b>';
}
if ($info['info_addr'])
{
if ($addr || $from) $subject .= ': ';
if ($addr || $from || $event) $subject .= ': ';
$subject .= $info['info_addr'];
}
if ($proj || $addr || $from || $info['info_addr'])
if ($proj || $addr || $from || $info['info_addr'] || $event)
{
$subject .= '<br>';
}
@ -218,7 +242,7 @@
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
'enddate' => $enddate,
'owner' => $owner,
'datecreated' => $GLOBALS['phpgw']->common->show_date($info['info_datecreated'],
'datemodified' => $GLOBALS['phpgw']->common->show_date($info['info_datemodified'],
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']),
'responsible' => $responsible,
'filelinks' => $links
@ -237,7 +261,7 @@
'startdate' => 'Startdate',
'enddate' => 'Enddate',
'owner' => 'Owner',
'datecreated' => 'last changed', // is MODIFICATION date now
'datemodified' => 'last changed',
'responsible' => 'Responsible'
);
while (list($f,$lang) = each($fields))
@ -348,16 +372,19 @@
case 'proj':
$action_vars += array( 'id_project' => $action_id,
'proj_id' => $action_id);
$proj = $this->bo->readProj($action_id);
$t->set_var(lang_info_action,lang('InfoLog').' - '.
$proj['title']);
$this->bo->proj2name($action_id));
break;
case 'addr':
$action_vars += array( 'id_addr' => $action_id,
'addr_id' => $action_id );
$addr = $this->bo->readAddr($action_id);
$t->set_var(lang_info_action,lang('InfoLog').' - '.
$this->bo->addr2name($addr));
$this->bo->addr2name($action_id));
break;
case 'event':
$action_vars += array( 'id_event' => $action_id,'event_id' => $action_id);
$t->set_var(lang_info_action,lang('InfoLog').' - '.
$this->bo->event2name($action_id));
break;
default:
if ($filter && $filter != 'none')
@ -427,9 +454,8 @@
$t->parse('projdetailshandle','projdetails',True);
break;
case 'addr':
$nm_extra = "&action_id=$action_id";
break;
case 'proj':
case 'event':
$nm_extra = "&action_id=$action_id";
break;
}
@ -472,7 +498,7 @@
$this->nextmatchs->template_alternate_row_color(&$t);
$t->set_var( $this->formatInfo( $id,$proj_id,$addr_id ));
$t->set_var( $this->formatInfo( $id,$action,$action_id ));
if ($this->bo->check_access($id,PHPGW_ACL_EDIT))
{
@ -650,6 +676,7 @@
global $pri,$status,$confirm,$info_cat,$id_parent,$responsible;
global $attachfile,$attachfile_name,$attachfile_size,$attachfile_type;
global $filecomment,$full_fname;
global $id_event,$query_event;
$t = $this->template; $html = $this->html;
@ -768,7 +795,8 @@
'enddate' => $enddate,
'info_id' => $info_id,
'id_parent' => $id_parent,
'responsible' => $responsible
'responsible' => $responsible,
'event_id' => $id_event
));
if ($attachfile && $attachfile != "none") // save the attached file
@ -780,7 +808,7 @@
}
}
if (!$query_addr && !$query_project)
if (!$query_addr && !$query_project && !$query_event)
{
Header('Location: ' . $html->link($referer, array('cd'=>15)));
$GLOBALS['phpgw']->common->phpgw_exit();
@ -852,7 +880,7 @@
case 'sp':
$info_action = 'InfoLog - New Subproject';
break;
case 'new': case 'addr': case 'proj':
case 'new': case 'addr': case 'proj': case 'event':
$info_action = 'InfoLog - New';
if ($info_type && isset($this->bo->enums['type'][$info_type]))
$this->bo->so->data['info_type'] = $info_type;
@ -874,7 +902,7 @@
$t->set_var('common_hidden_vars',$common_hidden_vars);
// get an instance of select box class
$sb = CreateObject('phpgwapi.sbox2');
$sb = CreateObject('infolog.sbox2');
$t->set_var('lang_owner',lang('Owner'));
$t->set_var('owner_info',$sb->accountInfo($this->bo->so->data['info_owner']));
@ -899,6 +927,9 @@
if (!isset($id_addr)) $id_addr = $this->bo->so->data['info_addr_id'];
$t->set_var($sb->getAddress('addr',$id_addr,$query_addr));
if (!isset($id_event)) $id_event = $this->bo->so->data['info_event_id'];
$t->set_var($sb->getEvent('event',$id_event,$query_event));
$t->set_var('lang_prsubject', lang('Subject'));
if (!isset($subject)) {
$subject = $GLOBALS['phpgw']->strip_html($this->bo->so->data['info_subject']);
@ -943,7 +974,7 @@
$t->set_var('lang_responsible',lang('Responsible'));
if (!isset($responsible)) $responsible=$this->bo->so->data['info_responsible'];
$t->set_var('responsible_list',$sb->getAccount('responsible',
$responsible));
$responsible,0,'accounts',-1));
$t->set_var('lang_access_type',lang('Private'));
if (!isset($access)) $access = $this->bo->so->data['info_access'] == 'private';

View File

@ -0,0 +1,22 @@
<?php
/**************************************************************************\
* phpGroupWare - Info Log *
* http://www.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$ */
$save_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
$GLOBALS['phpgw_info']['flags']['currentapp'] = 'infolog';
$GLOBALS['phpgw']->translation->add_app('infolog');
$infolog = CreateObject('infolog.uiinfolog');
$infolog->get_list(True,'event',$GLOBALS['cal_id']);
$GLOBALS['phpgw_info']['flags']['currentapp'] = $save_app;

View File

@ -13,7 +13,7 @@
$setup_info['infolog']['name'] = 'infolog';
$setup_info['infolog']['title'] = 'Info Log';
$setup_info['infolog']['version'] = '0.9.11';
$setup_info['infolog']['version'] = '0.9.15.001';
$setup_info['infolog']['app_order'] = 20;
$setup_info['infolog']['tables'] = array('phpgw_infolog');
$setup_info['infolog']['enable'] = 1;
@ -31,6 +31,7 @@
$setup_info['infolog']['hooks'][] = 'about';
$setup_info['infolog']['hooks'][] = 'addressbook_view';
$setup_info['infolog']['hooks'][] = 'projects_view';
$setup_info['infolog']['hooks'][] = 'calendar_view';
/* Dependencies for this app to work */
$setup_info['infolog']['depends'][] = array(

View File

@ -0,0 +1,46 @@
<?php
/**************************************************************************\
* phpGroupWare *
* http://www.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$ */
$phpgw_baseline = array(
'phpgw_infolog' => array(
'fd' => array(
'info_id' => array('type' => 'auto','nullable' => False),
'info_type' => array('type' => 'varchar', 'precision' => 255,'nullable' => False,'default' => 'task'),
'info_addr_id' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_proj_id' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_from' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_addr' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_subject' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_des' => array('type' => 'text','nullable' => True),
'info_owner' => array('type' => 'int', 'precision' => 4,'nullable' => False),
'info_responsible' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_access' => array('type' => 'varchar', 'precision' => 10,'nullable' => True,'default' => 'public'),
'info_cat' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_datecreated' => array('type' => 'int', 'precision' => 4,'nullable' => False),
'info_startdate' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_enddate' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_id_parent' => array('type' => 'int', 'precision' => 4,'nullable' => False,'default' => 0),
'info_pri' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'normal'),
'info_time' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_bill_cat' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_status' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'done'),
'info_confirm' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'not')
),
'pk' => array('info_id'),
'fk' => array(),
'ix' => array(),
'uc' => array()
)
);
?>

View File

@ -15,26 +15,27 @@
'phpgw_infolog' => array(
'fd' => array(
'info_id' => array('type' => 'auto','nullable' => False),
'info_type' => array('type' => 'varchar', 'precision' => 255,'nullable' => False,'default' => 'task'),
'info_addr_id' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_proj_id' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_from' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_addr' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_subject' => array('type' => 'varchar', 'precision' => 64,'nullable' => True),
'info_type' => array('type' => 'varchar','precision' => '255','default' => 'task','nullable' => False),
'info_addr_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_proj_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_from' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_addr' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_subject' => array('type' => 'varchar','precision' => '64','nullable' => True),
'info_des' => array('type' => 'text','nullable' => True),
'info_owner' => array('type' => 'int', 'precision' => 4,'nullable' => False),
'info_responsible' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_access' => array('type' => 'varchar', 'precision' => 10,'nullable' => True,'default' => 'public'),
'info_cat' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_datecreated' => array('type' => 'int', 'precision' => 4,'nullable' => False),
'info_startdate' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_enddate' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_id_parent' => array('type' => 'int', 'precision' => 4,'nullable' => False,'default' => 0),
'info_pri' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'normal'),
'info_time' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_bill_cat' => array('type' => 'int', 'precision' => 4,'nullable' => False, 'default' => 0),
'info_status' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'done'),
'info_confirm' => array('type' => 'varchar', 'precision' => 255,'nullable' => True,'default' => 'not')
'info_owner' => array('type' => 'int','precision' => '4','nullable' => False),
'info_responsible' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_access' => array('type' => 'varchar','precision' => '10','nullable' => True,'default' => 'public'),
'info_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_datemodified' => array('type' => 'int','precision' => '4','nullable' => False),
'info_startdate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_enddate' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_id_parent' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_pri' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'normal'),
'info_time' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_bill_cat' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False),
'info_status' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'done'),
'info_confirm' => array('type' => 'varchar','precision' => '255','nullable' => True,'default' => 'not'),
'info_event_id' => array('type' => 'int','precision' => '4','default' => '0','nullable' => False)
),
'pk' => array('info_id'),
'fk' => array(),
@ -42,5 +43,3 @@
'uc' => array()
)
);
?>

View File

@ -0,0 +1,29 @@
<?php
/**************************************************************************\
* phpGroupWare - Setup *
* http://www.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$ */
$test[] = '0.9.11';
function infolog_upgrade0_9_11()
{
$GLOBALS['phpgw_setup']->oProc->RenameColumn('phpgw_infolog','info_datecreated','info_datemodified');
$GLOBALS['phpgw_setup']->oProc->AddColumn('phpgw_infolog','info_event_id',array(
'type' => 'int',
'precision' => '4',
'default' => '0',
'nullable' => False
));
$GLOBALS['setup_info']['infolog']['currentver'] = '0.9.15.001';
return $GLOBALS['setup_info']['phpgwapi']['currentver'];
}
?>

View File

@ -20,7 +20,7 @@
<td class=list>{subject}<br>{des}{filelinks}</td>
<td class=list>{startdate}</td>
<td class=list>{enddate}</td>
<td class=list>{owner}<br>{datecreated}</td>
<td class=list>{owner}<br>{datemodified}</td>
<td class=list">{responsible}</td>
</tr>
</table><p>

View File

@ -18,7 +18,7 @@
<td class=list>{subject}<br>{des}{filelinks}</td>
<td class=list>{startdate}</td>
<td class=list>{enddate}</td>
<td class=list>{owner}<br>{datecreated}</td>
<td class=list>{owner}<br>{datemodified}</td>
<td class=list">{responsible}</td>
</tr>
</table><p>

View File

@ -21,20 +21,22 @@
<!-- END subpro -->
<tr>
<td>{lang_type}:</td>
<td>{type_list}</td>
<td width="40%">{type_list}</td>
<td>{lang_owner}:</td>
<td>{owner_info}</td>
</tr>
<tr>
<td>{project_title}</td>
<td colspan="2">{project}</td>
<td>{project_nojs}</td>
<td colspan="3">{project} {project_nojs}</td>
</tr>
<tr>
<td>{addr_title}</td>
<td colspan="2">{addr}</td>
<td>{addr_nojs}</td>
<td colspan="3">{addr} {addr_nojs}</td>
</tr>
<tr>
<td>{event_title}</td>
<td colspan="3">{event} {event_nojs}</td>
</tr>
<tr>
<td colspan="4"><hr size="1"></td>

View File

@ -25,7 +25,7 @@
<td class=list>{lang_subject}</td>
<td width="10%" class=list>{lang_startdate}<br> <!-- </td>
<td width="10%" class=list>-->{lang_enddate}</td>
<td width="10%" class=list>{lang_owner}<br>{lang_datecreated}</td>
<td width="10%" class=list>{lang_owner}<br>{lang_datemodified}</td>
<td width="10%" class=list>{lang_responsible}</td>
</tr>
<tr bgcolor="{th_bg}" valign="top">
@ -33,7 +33,7 @@
<td class=list>{status}</td>
<td class=list>{subject}<br>{des}{filelinks}</td>
<td class=list>{startdate}<br>{enddate}</td>
<td class=list>{owner}<br>{datecreated}</td>
<td class=list>{owner}<br>{datemodified}</td>
<td class=list">{responsible}</td>
</tr>
</table><p>
@ -49,7 +49,7 @@
<td width="4%" class=list>{lang_status}</td>
<td class=list>{lang_subject}</td>
<td width="8%" class=list>{lang_startdate}<br>{lang_enddate}</td>
<td width="8%" class=list>{lang_owner}<br>{lang_datecreated}</td>
<td width="8%" class=list>{lang_owner}<br>{lang_datemodified}</td>
<td width="8%" class=list>{lang_responsible}</td>
<td width="3%" class=list>{h_lang_sub}</td>
<td width="3%" class=list>{h_lang_action}</td>
@ -61,7 +61,7 @@
<td class=list>{status}</td>
<td class=list>{subject}<br>{des}{filelinks}</td>
<td class=list>{startdate}<br>{enddate}</td>
<td class=list>{owner}<br>{datecreated}</td>
<td class=list>{owner}<br>{datemodified}</td>
<td class=list>{responsible}</td>
<td class=list>
{subadd}