- primary link / contact con now be set direct in the contact line

- checkbox to set a custom contact (additional to the linked contact)
- new select/link entry custom fields (eg. to store a contact)
- uses the stock customfield widget now
- email is now a stock infolog type
This commit is contained in:
Ralf Becker 2006-10-04 17:40:33 +00:00
parent 532264b3fa
commit 4259d8d622
14 changed files with 3242 additions and 3127 deletions

View File

@ -1,32 +1,34 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - InfoLog * * InfoLog - Business object
* http://www.egroupware.org *
* Written and (c) 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$ */
include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.soinfolog.inc.php');
/**
* This class is the BO-layer of InfoLog, it also handles xmlrpc requests
* *
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog * @package infolog
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/ */
class boinfolog
{ include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.soinfolog.inc.php');
/**
* This class is the BO-layer of InfoLog, it also handles xmlrpc requests
*/
class boinfolog
{
var $enums; var $enums;
/**
* Instance of our so class
*
* @var soinfolog
*/
var $so; var $so;
/**
* Instance of the link class
*
* @var bolink
*/
var $link; var $link;
var $vfs; var $vfs;
var $vfs_basedir='/infolog'; var $vfs_basedir='/infolog';
@ -60,27 +62,43 @@
var $tz_offset = 0; var $tz_offset = 0;
/** /**
* @var int $tz_offset_s offset in secconds between user and server-time, * offset in secconds between user and server-time,
* it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time * it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time
*
* @var int
*/ */
var $tz_offset_s = 0; var $tz_offset_s = 0;
var $user_time_now; var $user_time_now;
/** /**
* @var array $timestamps name of timestamps in an InfoLog entry * name of timestamps in an InfoLog entry
*
* @var array
*/ */
var $timestamps = array('info_startdate','info_enddate','info_datemodified','info_datecompleted'); var $timestamps = array('info_startdate','info_enddate','info_datemodified','info_datecompleted');
/** /**
* @var array $config infolog configuration * instance of the config class for infolog
*
* @var config
*/ */
var $config; var $config;
/** /**
* @var array $responsible_edit=array('info_status','info_percent','info_datecompleted') fields the responsible user can change * fields the responsible user can change
*
* @var array
*/ */
var $responsible_edit=array('info_status','info_percent','info_datecompleted'); var $responsible_edit=array('info_status','info_percent','info_datecompleted');
/** /**
* @var string $implicit_rights='read' implicit ACL rights of the responsible user: read or edit * implicit ACL rights of the responsible user: read or edit
*
* @var string
*/ */
var $implicit_rights='read'; var $implicit_rights='read';
/**
* Custom fields read from the infolog config
*
* @var array
*/
var $customfields=array();
/** /**
* Constructor Infolog BO * Constructor Infolog BO
@ -97,21 +115,16 @@
1 => 'normal', 1 => 'normal',
0 => 'low' 0 => 'low'
), ),
/* 'status' => array( 'confirm' => array(
'offer' => 'offer','ongoing' => 'ongoing','call' => 'call',
'will-call' => 'will-call','done' => 'done',
'billed' => 'billed' ),
*/ 'confirm' => array(
'not' => 'not','accept' => 'accept','finish' => 'finish', 'not' => 'not','accept' => 'accept','finish' => 'finish',
'both' => 'both' ), 'both' => 'both' ),
'type' => array( 'type' => array(
'task' => 'task','phone' => 'phone','note' => 'note' 'task' => 'task','phone' => 'phone','note' => 'note','email' => 'email'
/* ,'confirm' => 'confirm','reject' => 'reject','email' => 'email', /* ,'confirm' => 'confirm','reject' => 'reject','fax' => 'fax' not implemented so far */ )
'fax' => 'fax' not implemented so far */ )
); );
$this->status = $this->stock_status = array( $this->status = $this->stock_status = array(
'defaults' => array( 'defaults' => array(
'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done'), 'task' => 'not-started', 'phone' => 'not-started', 'note' => 'done','email' => 'done'),
'task' => array( 'task' => array(
'offer' => 'offer', // --> NEEDS-ACTION 'offer' => 'offer', // --> NEEDS-ACTION
'not-started' => 'not-started', // iCal NEEDS-ACTION 'not-started' => 'not-started', // iCal NEEDS-ACTION
@ -125,6 +138,9 @@
'done' => 'done', // iCal COMPLETED 'done' => 'done', // iCal COMPLETED
'billed' => 'billed' ), // --> DONE 'billed' => 'billed' ), // --> DONE
'note' => array( 'note' => array(
'ongoing' => 'ongoing', // iCal has no status on notes
'done' => 'done'),
'email' => array(
'ongoing' => 'ongoing', // iCal has no status on notes 'ongoing' => 'ongoing', // iCal has no status on notes
'done' => 'done' 'done' => 'done'
)); ));
@ -140,7 +156,6 @@
$this->config =& CreateObject('phpgwapi.config','infolog'); $this->config =& CreateObject('phpgwapi.config','infolog');
$this->config->read_repository(); $this->config->read_repository();
$this->customfields = array();
if ($this->config->config_data) if ($this->config->config_data)
{ {
$this->link_pathes = $this->config->config_data['link_pathes']; $this->link_pathes = $this->config->config_data['link_pathes'];
@ -166,7 +181,23 @@
} }
if (isset($this->config->config_data['customfields']) && is_array($this->config->config_data['customfields'])) if (isset($this->config->config_data['customfields']) && is_array($this->config->config_data['customfields']))
{ {
$this->customfields = $this->config->config_data['customfields']; if (!($this->customfields = $this->config->config_data['customfields'])) $this->customfields = array();
foreach($this->customfields as $name => $field)
{
// old infolog customefield record
if(empty($field['type']))
{
if (count($field['values'])) $field['type'] = 'select'; // selectbox
elseif ($field['rows'] > 1) $field['type'] = 'textarea'; // textarea
elseif (intval($field['len']) > 0) $field['type'] = 'text'; // regular input field
else $field['type'] = 'label'; // header-row
$field['type2'] = $field['typ'];
unset($field['typ']);
$this->customfields[$name] = $this->config->config_data['customfields'][$name] = $field;
$save_config = true;
}
}
if ($save_config) $this->config->save_repository();
} }
if (count(explode(',',$this->config->config_data['responsible_edit']))) if (count(explode(',',$this->config->config_data['responsible_edit'])))
{ {
@ -178,10 +209,7 @@
} }
} }
$this->user = $GLOBALS['egw_info']['user']['account_id']; $this->user = $GLOBALS['egw_info']['user']['account_id'];
/**
* @var int $tz_offset_s offset in secconds between user and server-time,
* it need to be add to a server-time to get the user-time or substracted from a user-time to get the server-time
*/
$this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset']; $this->tz_offset = $GLOBALS['egw_info']['user']['preferences']['common']['tz_offset'];
$this->tz_offset_s = 60*60*$this->tz_offset; $this->tz_offset_s = 60*60*$this->tz_offset;
$this->user_time_now = time() + $this->tz_offset_s; $this->user_time_now = time() + $this->tz_offset_s;
@ -202,14 +230,18 @@
/** /**
* checks if there are customfields for typ $typ * checks if there are customfields for typ $typ
* *
* @param string $typ * @param string $type
* @param boolean $links=false if true check only customfields containing links, default false = all custom fields
* @return boolean True if there are customfields for $typ, else False * @return boolean True if there are customfields for $typ, else False
*/ */
function has_customfields($typ) function has_customfields($type,$links=false)
{ {
if ($links) $link_types = $this->get_customfield_link_types();
foreach($this->customfields as $name => $field) foreach($this->customfields as $name => $field)
{ {
if (empty($field['typ']) || $field['typ'] == $typ) if ((!$type || empty($field['type2']) || $field['type2'] == $type) &&
(!$links || in_array($field['type'],$link_types)))
{ {
return True; return True;
} }
@ -217,6 +249,23 @@
return False; return False;
} }
/**
* Get the customfield types containing links
*
* @return array with customefield types as values
*/
function get_customfield_link_types()
{
static $link_types;
if (is_null($link_types))
{
$link_types = array_keys($this->link->app_list());
$link_types[] = 'link-entry';
}
return $link_types;
}
/** /**
* check's if user has the requiered rights on entry $info_id * check's if user has the requiered rights on entry $info_id
* *
@ -262,9 +311,14 @@
$nr = $link['link_app1'] == 'infolog' && $link['link_id1'] == $info['info_id'] ? '2' : '1'; $nr = $link['link_app1'] == 'infolog' && $link['link_id1'] == $info['info_id'] ? '2' : '1';
$title = $this->link->title($link['link_app'.$nr],$link['link_id'.$nr]); $title = $this->link->title($link['link_app'.$nr],$link['link_id'.$nr]);
if ($title == $info['info_from'] || @htmlentities($title) == $info['info_from']) if ((string)$info['info_custom_from'] === '') // old entry
{
$info['info_custom_from'] = (int) ($title != $info['info_from'] && @htmlentities($title) != $info['info_from']);
}
if (!$info['info_custom_from'])
{ {
$info['info_from'] = ''; $info['info_from'] = '';
$info['info_custom_from'] = 0;
} }
if ($link['link_app'.$nr] == $not_app && $link['link_id'.$nr] == $not_id) if ($link['link_app'.$nr] == $not_app && $link['link_id'.$nr] == $not_id)
{ {
@ -275,6 +329,7 @@
'id' => $link['link_id'.$nr], 'id' => $link['link_id'.$nr],
'title' => (!empty($info['info_from']) ? $info['info_from'] : $title), 'title' => (!empty($info['info_from']) ? $info['info_from'] : $title),
); );
$info['info_contact'] = $link['link_app'.$nr].':'.$link['link_id'.$nr];
//echo " title='$title'</p>\n"; //echo " title='$title'</p>\n";
return $info['blur_title'] = $title; return $info['blur_title'] = $title;
@ -283,6 +338,7 @@
{ {
$info['info_link'] = array('title' => $info['info_from']); $info['info_link'] = array('title' => $info['info_from']);
$info['info_link_id'] = 0; // link might have been deleted $info['info_link_id'] = 0; // link might have been deleted
$info['info_custom_from'] = (int)!!$info['info_from'];
} }
return False; return False;
} }
@ -512,6 +568,11 @@
{ {
if ($to_write[$time]) $to_write[$time] -= $this->tz_offset_s; if ($to_write[$time]) $to_write[$time] -= $this->tz_offset_s;
} }
// if we have links in customfields, we need to get the old values, to be able to remove changed links
if ($this->has_customfields($values['info_type'],true) && $values['info_id'])
{
$old = $this->read($values['info_id']);
}
if(($info_id = $this->so->write($to_write,$check_modified))) if(($info_id = $this->so->write($to_write,$check_modified)))
{ {
if (!isset($values['info_type']) || $status_only) if (!isset($values['info_type']) || $status_only)
@ -536,6 +597,9 @@
} }
$values['info_id'] = $info_id; $values['info_id'] = $info_id;
// create (and remove) links in custom fields
$this->update_customfield_links($values,$old);
// notify the link-class about the update, as other apps may be subscribt to it // notify the link-class about the update, as other apps may be subscribt to it
$this->link->notify_update('infolog',$info_id,$values); $this->link->notify_update('infolog',$info_id,$values);
} }
@ -544,6 +608,50 @@
return $info_id; return $info_id;
} }
/**
* Check if there are links in the custom fields and update them
*
* @param array $values new values including the custom fields
* @param array $old=null old values before the update, if existing
*/
function update_customfield_links($values,$old=null)
{
$link_types = $this->get_customfield_link_types();
foreach($this->customfields as $name => $data)
{
if (!in_array($data['type'],$link_types)) continue;
// do we have a different old value --> delete that link
if ($old && $old['#'.$name] && $old['#'.$name] != $values['#'.$name])
{
if ($data['type'] == 'link-entry')
{
list($app,$id) = explode(':',$old['#'.$name]);
}
else
{
$app = $data['type'];
$id = $old['#'.$name];
}
$this->link->unlink(false,'infolog',$values['info_id'],'',$app,$id);
}
if ($data['type'] == 'link-entry')
{
list($app,$id) = explode(':',$values['#'.$name]);
}
else
{
$app = $data['type'];
$id = $values['#'.$name];
}
if ($id) // create new link, does nothing for already existing links
{
$this->link->link('infolog',$values['info_id'],$app,$id);
}
}
}
/** /**
* Query the number of children / subs * Query the number of children / subs
* *
@ -641,7 +749,7 @@
); );
// find the addressbookentry to link with // find the addressbookentry to link with
$addressbook = CreateObject('addressbook.bocontacts'); $addressbook =& CreateObject('addressbook.bocontacts');
$contacts = array(); $contacts = array();
foreach ($email as $mailadr) foreach ($email as $mailadr)
{ {
@ -998,4 +1106,4 @@
} }
return $icons; return $icons;
} }
} }

View File

@ -1,21 +1,18 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - InfoLog * * InfoLog - Storage object
* http://www.eGroupWare.org * *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> * * @link http://www.egroupware.org
* originaly based on todo written by Joseph Engo <jengo@phpgroupware.org> * * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* -------------------------------------------- * * @package infolog
* This program is free software; you can redistribute it and/or modify it * * @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* under the terms of the GNU General Public License as published by the * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\**************************************************************************/
/* $Id$ */ include_once(EGW_API_INC.'/class.solink.inc.php');
include_once(EGW_API_INC.'/class.solink.inc.php'); /**
/**
* storage object / db-layer for InfoLog * storage object / db-layer for InfoLog
* *
* all values passed to this class are run either through intval or addslashes to prevent query-insertion * all values passed to this class are run either through intval or addslashes to prevent query-insertion
@ -26,8 +23,8 @@
* @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de> * @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
*/ */
class soinfolog // DB-Layer class soinfolog // DB-Layer
{ {
var $db; var $db;
var $grants; var $grants;
var $data = array( ); var $data = array( );
@ -611,4 +608,4 @@
} }
return $ids; return $ids;
} }
} }

View File

@ -1,31 +1,54 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - InfoLog: Administration of custom fields, type and status * * InfoLog - Custome fields
* http://www.egroupware.org *
* Written and (c) by Ralf Becker <RalfBecker@outdoor-training.de> *
* -------------------------------------------- *
* 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$ */
/**
* Administration of custom fields, type and status
* *
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog * @package infolog
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/ */
class uicustomfields
{ /**
var $public_functions = array * Administration of custom fields, type and status
( */
class uicustomfields
{
var $public_functions = array(
'edit' => True 'edit' => True
); );
/**
* Customfield types, without the link app-names
*
* @var array
*/
var $cf_types = array(
'text' => 'Text',
'label' => 'Label',
'select' => 'Selectbox',
'radio' => 'Radiobutton',
'checkbox' => 'Checkbox',
'link-entry' => 'Select an entry',
);
/**
* Instance of the infolog BO class
*
* @var boinfolog
*/
var $bo;
/**
* Instance of the etemplate class
*
* @var etemplate
*/
var $tmpl;
/**
* instance of the config class for infolog
*
* @var config
*/
var $config;
function uicustomfields( ) function uicustomfields( )
{ {
@ -35,6 +58,12 @@
$this->status = &$this->bo->status; $this->status = &$this->bo->status;
$this->config = &$this->bo->config; $this->config = &$this->bo->config;
$this->fields = &$this->bo->customfields; $this->fields = &$this->bo->customfields;
$GLOBALS['egw']->translation->add_app('etemplate');
foreach($this->cf_types as $name => $label) $this->cf_types[$name] = lang($label);
$link_types = $this->bo->link->app_list();
ksort($link_types);
foreach($link_types as $name => $label) $this->cf_types[$name] = '- '.$label;
} }
/** /**
@ -79,17 +108,17 @@
{ {
list($typ) = each($this->types); list($typ) = each($this->types);
$content = array( $content = array(
'typ' => $typ, 'type2' => $typ,
); );
} }
$readonlys = array(); $readonlys = array();
$readonlys['button[delete]'] = isset($this->bo->stock_enums['type'][$content['typ']]); $readonlys['button[delete]'] = isset($this->bo->stock_enums['type'][$content['type2']]);
$content['status'] = array( $content['status'] = array(
'default' => $this->status['defaults'][$content['typ']] 'default' => $this->status['defaults'][$content['type2']]
); );
$n = 0; $n = 0;
foreach($this->status[$content['typ']] as $name => $label) foreach($this->status[$content['type2']] as $name => $label)
{ {
$content['status'][++$n] = array( $content['status'][++$n] = array(
'name' => $name, 'name' => $name,
@ -97,7 +126,7 @@
'disabled' => False 'disabled' => False
); );
$preserv_status[$n]['old_name'] = $name; $preserv_status[$n]['old_name'] = $name;
if (isset($this->bo->stock_status[$content['typ']][$name])) if (isset($this->bo->stock_status[$content['type2']][$name]))
{ {
$readonlys['status']["delete[$name]"] = $readonlys['status']["delete[$name]"] =
$readonlys['status'][$n.'[name]'] = True; $readonlys['status'][$n.'[name]'] = True;
@ -110,40 +139,41 @@
//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n"; //echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
$content['fields'] = array(); $content['fields'] = array();
$n = 0; $n = 0;
foreach($this->fields as $name => $data) foreach($this->fields as $name => $field)
{ {
if (is_array($data['values'])) if (is_array($field['values']))
{ {
$values = ''; $values = '';
foreach($data['values'] as $var => $value) foreach($field['values'] as $var => $value)
{ {
$values .= (!empty($values) ? "\n" : '').$var.'='.$value; $values .= (!empty($values) ? "\n" : '').$var.'='.$value;
} }
$data['values'] = $values; $field['values'] = $values;
} }
$content['fields'][++$n] = $data + array( $content['fields'][++$n] = $field + array(
'name' => $name 'name' => $name
); );
$preserv_fields[$n]['old_name'] = $name; $preserv_fields[$n]['old_name'] = $name;
$readonlys['fields']["create$name"] = True; $readonlys['fields']["create$name"] = True;
} }
$content['fields'][++$n] = array('typ'=>'','order' => 10 * $n); // new line for create $content['fields'][++$n] = array('type2'=>'','order' => 10 * $n); // new line for create
$readonlys['fields']["delete[]"] = True; $readonlys['fields']["delete[]"] = True;
//echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n"; //echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n"; //echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
$this->tmpl->read('infolog.customfields'); $this->tmpl->read('infolog.customfields');
$this->tmpl->exec('infolog.uicustomfields.edit',$content,array( $this->tmpl->exec('infolog.uicustomfields.edit',$content,array(
'typ' => $this->types, 'type2' => $this->types,
'type' => $this->cf_types,
),$readonlys,array( ),$readonlys,array(
'status' => $preserv_status, 'status' => $preserv_status,
'fields' => $preserv_fields 'fields' => $preserv_fields,
)); ));
} }
function update_fields(&$content) function update_fields(&$content)
{ {
$typ = $content['typ']; $typ = $content['type2'];
$fields = &$content['fields']; $fields = &$content['fields'];
$create = $fields['create']; $create = $fields['create'];
@ -195,13 +225,14 @@
} }
} }
$this->fields[$name] = array( $this->fields[$name] = array(
'typ' => $field['typ'], 'type2' => $field['type2'],
'type' => $field['type'],
'label' => empty($field['label']) ? $name : $field['label'], 'label' => empty($field['label']) ? $name : $field['label'],
'help' => $field['help'], 'help' => $field['help'],
'values'=> $values, 'values'=> $values,
'len' => $field['len'], 'len' => $field['len'],
'rows' => intval($field['rows']), 'rows' => (int)$field['rows'],
'order' => intval($field['order']) 'order' => (int)$field['order'],
); );
} }
if (!function_exists('sort_by_order')) if (!function_exists('sort_by_order'))
@ -222,7 +253,7 @@
function update_status(&$content) function update_status(&$content)
{ {
$typ = $content['typ']; $typ = $content['type2'];
$status = &$content['status']; $status = &$content['status'];
$default = $status['default']; $default = $status['default'];
@ -291,15 +322,15 @@
function delete(&$content) function delete(&$content)
{ {
if (isset($this->bo->stock_enums['type'][$content['typ']])) if (isset($this->bo->stock_enums['type'][$content['type2']]))
{ {
$content['error_msg'] .= lang("You can't delete one of the stock types !!!"); $content['error_msg'] .= lang("You can't delete one of the stock types !!!");
return; return;
} }
unset($this->types[$content['typ']]); unset($this->types[$content['type2']]);
unset($this->status[$content['typ']]); unset($this->status[$content['type2']]);
unset($this->status['defaults'][$content['typ']]); unset($this->status['defaults'][$content['type2']]);
$content['typ'] = ''; list($content['type2']) = each($this->types);
// save changes to repository // save changes to repository
$this->save_repository(); $this->save_repository();
@ -327,7 +358,7 @@
// save changes to repository // save changes to repository
$this->save_repository(); $this->save_repository();
$content['typ'] = $new_name; // show the new entry $content['type2'] = $new_name; // show the new entry
} }
} }
@ -342,4 +373,4 @@
$this->config->save_repository(); $this->config->save_repository();
} }
} }

View File

@ -1,30 +1,22 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - InfoLog * * InfoLog - User interface
* http://www.egroupware.org *
* Written and copyright 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$ */
include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.boinfolog.inc.php');
/**
* This class is the UI-layer (user interface) of InfoLog
* *
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package infolog * @package infolog
* @author Ralf Becker <RalfBecker@outdoor-training.de> * @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) by Ralf Becker <RalfBecker@outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/ */
class uiinfolog
{ include_once(EGW_INCLUDE_ROOT.'/infolog/inc/class.boinfolog.inc.php');
/**
* This class is the UI-layer (user interface) of InfoLog
*/
class uiinfolog
{
var $public_functions = array var $public_functions = array
( (
'index' => True, 'index' => True,
@ -589,15 +581,20 @@
$no_popup = $content['no_popup']; $no_popup = $content['no_popup'];
$caller = $content['caller']; $caller = $content['caller'];
if (isset($content['link_to']['primary'])) /* if (isset($content['link_to']['primary']))
{ {
$content['info_link_id'] = $content['link_to']['primary']; $content['info_link_id'] = $content['link_to']['primary'];
} }*/
list($button) = @each($content['button']); list($button) = @each($content['button']);
unset($content['button']); unset($content['button']);
if ($button) if ($button)
{ {
//echo "<p>uiinfolog::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content); //echo "<p>uiinfolog::edit(info_id=$info_id) '$button' button pressed, content="; _debug_array($content);
if (($button == 'save' || $button == 'apply') && empty($content['info_subject']))
{
$this->tmpl->set_validation_error('info_subject',lang('Field must not be empty !!!'));
$button = ''; // stop save or apply
}
if (($button == 'save' || $button == 'apply') && $info_id) if (($button == 'save' || $button == 'apply') && $info_id)
{ {
if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT))) if (!($edit_acl = $this->bo->check_access($info_id,EGW_ACL_EDIT)))
@ -608,14 +605,17 @@
} }
if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only)) if (($button == 'save' || $button == 'apply') && (!$info_id || $edit_acl || $status_only))
{ {
if ($content['info_contact'])
{
$old_link_id = (int)$content['info_link_id'];
list($app,$id) = explode(':',$content['info_contact']);
$content['info_link_id'] = (int)($info_link_id = $this->link->link('infolog',$content['link_to']['to_id'],$app,$id));
if ($old_link_id && $old_link_id != $content['info_link_id']) $this->link->unlink($old_link_id);
}
if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id'])) if (is_array($content['link_to']['to_id']) && count($content['link_to']['to_id']))
{ {
if (strstr($content['info_link_id'],':') !== False)
{
$info_link_id = $content['info_link_id'];
$content['info_link_id'] = 0; // as field has to be int $content['info_link_id'] = 0; // as field has to be int
} }
}
$active_tab = $content[$tabs]; $active_tab = $content[$tabs];
if (!($info_id = $this->bo->write($content))) if (!($info_id = $this->bo->write($content)))
{ {
@ -747,11 +747,11 @@
case 'datetime': $set_startdate = $this->bo->user_time_now; break; case 'datetime': $set_startdate = $this->bo->user_time_now; break;
case 'empty': $set_startdate = 0; break; case 'empty': $set_startdate = 0; break;
} }
if (intval($content['info_link_id']) > 0 && !$this->link->get_link($content['info_link_id'])) if ((int)$content['info_link_id'] > 0 && !$this->link->get_link($content['info_link_id']))
{ {
$content['info_link_id'] = 0; // link has been deleted $content['info_link_id'] = 0; // link has been deleted
if (!$content['info_custom_link']) $content['info_from'] = '';
} }
if (!$info_id && $action_id && $action == 'sp') // new SubProject if (!$info_id && $action_id && $action == 'sp') // new SubProject
{ {
if (!$this->bo->check_access($action_id,EGW_ACL_ADD)) if (!$this->bo->check_access($action_id,EGW_ACL_ADD))
@ -871,7 +871,8 @@
} }
} }
// we allways need to set a non-empty/-zero primary, to make the radiobutton appear // we allways need to set a non-empty/-zero primary, to make the radiobutton appear
$content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : '#'; // $content['link_to']['primary'] = $content['info_link_id'] ? $content['info_link_id'] : '#';
$content['hide_from_css'] = $content['info_custom_from'] ? '' : 'hideFrom';
if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE))) if (!($readonlys['button[delete]'] = !$info_id || !$this->bo->check_access($info_id,EGW_ACL_DELETE)))
{ {
@ -886,8 +887,7 @@
} }
if ($this->bo->has_customfields($content['info_type'])) if ($this->bo->has_customfields($content['info_type']))
{ {
$content['customfields'] = $this->bo->customfields; $content['customfields'] = $content['info_type'];
$content['customfields']['###typ###'] = $content['info_type'];
} }
else else
{ {
@ -1249,4 +1249,4 @@
),True); ),True);
unset($GLOBALS['egw_info']['etemplate']['hooked']); unset($GLOBALS['egw_info']['etemplate']['hooked']);
} }
} }

View File

@ -1,22 +1,21 @@
<?php <?php
/**************************************************************************\ /**
* eGroupWare - Info Log * * InfoLog
* http://www.egroupware.org * *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> * * @link http://www.egroupware.org
* originaly based on todo written by Joseph Engo <jengo@phpgroupware.org> * * @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* -------------------------------------------- * * @package infolog
* This program is free software; you can redistribute it and/or modify it * * @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* under the terms of the GNU General Public License as published by the * * @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* Free Software Foundation; either version 2 of the License, or (at your * * @version $Id$
* option) any later version. * */
\**************************************************************************/
/* $Id$ */ $GLOBALS['egw_info'] = array(
'flags' => array(
$GLOBALS['egw_info']['flags'] = array(
'currentapp' => 'infolog', 'currentapp' => 'infolog',
'noheader' => True, 'noheader' => True,
'nonavbar' => True 'nonavbar' => True,
)
); );
include('../header.inc.php'); include('../header.inc.php');
@ -35,4 +34,3 @@ unset($setup_info);
ExecMethod('infolog.uiinfolog.index','reset_action_view'); ExecMethod('infolog.uiinfolog.index','reset_action_view');
$GLOBALS['egw']->common->egw_exit(); $GLOBALS['egw']->common->egw_exit();
?>

File diff suppressed because one or more lines are too long

View File

@ -48,6 +48,7 @@ category infolog de Kategorie
change the status of an entry, eg. close it infolog de Status eines Eintrags ändern, zB. ihn als erledigt markieren change the status of an entry, eg. close it infolog de Status eines Eintrags ändern, zB. ihn als erledigt markieren
charset of file infolog de Zeichensatz der Datei charset of file infolog de Zeichensatz der Datei
check to set startday infolog de ankreutzen um Startdatum zu setzen check to set startday infolog de ankreutzen um Startdatum zu setzen
check to specify custom contact infolog de Ankreutzen um einen eigenen Kontakt anzugeben
click here to create the link infolog de hier klicken um die Verknüpfung zu erzeugen click here to create the link infolog de hier klicken um die Verknüpfung zu erzeugen
click here to start the search infolog de hier klicken um die Suche zu starten click here to start the search infolog de hier klicken um die Suche zu starten
close infolog de Schließen close infolog de Schließen
@ -280,6 +281,7 @@ typ infolog de Typ
typ '%1' already exists !!! infolog de Typ '%1' existiert bereits !!! typ '%1' already exists !!! infolog de Typ '%1' existiert bereits !!!
type infolog de Typ type infolog de Typ
type ... infolog de Typ ... type ... infolog de Typ ...
type of customfield infolog de Typ des benutzerdefinierten Feldes
type of the log-entry: note, phonecall or todo infolog de Typ des Eintrags: Notiz, Anruf oder Auftrag type of the log-entry: note, phonecall or todo infolog de Typ des Eintrags: Notiz, Anruf oder Auftrag
unlink infolog de Verküpfung lösen unlink infolog de Verküpfung lösen
upcoming infolog de zukünftig upcoming infolog de zukünftig

View File

@ -48,6 +48,7 @@ category infolog en Category
change the status of an entry, eg. close it infolog en Change the status of an entry, eg. close it change the status of an entry, eg. close it infolog en Change the status of an entry, eg. close it
charset of file infolog en Charset of file charset of file infolog en Charset of file
check to set startday infolog en check to set startday check to set startday infolog en check to set startday
check to specify custom contact infolog en Check to specify custom contact
click here to create the link infolog en click here to create the Link click here to create the link infolog en click here to create the Link
click here to start the search infolog en click here to start the search click here to start the search infolog en click here to start the search
close infolog en Close close infolog en Close
@ -279,6 +280,7 @@ typ infolog en Type
typ '%1' already exists !!! infolog en Type '%1' already exists !!! typ '%1' already exists !!! infolog en Type '%1' already exists !!!
type infolog en Type type infolog en Type
type ... infolog en Type ... type ... infolog en Type ...
type of customfield infolog en Type of customfield
type of the log-entry: note, phonecall or todo infolog en Type of the log-entry: Note, Phone call or ToDo type of the log-entry: note, phonecall or todo infolog en Type of the log-entry: Note, Phone call or ToDo
unlink infolog en Unlink unlink infolog en Unlink
upcoming infolog en upcoming upcoming infolog en upcoming

View File

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

View File

@ -39,7 +39,8 @@
'info_price' => array('type' => 'float','precision' => '8'), 'info_price' => array('type' => 'float','precision' => '8'),
'info_percent' => array('type' => 'int','precision' => '2','default' => '0'), 'info_percent' => array('type' => 'int','precision' => '2','default' => '0'),
'info_datecompleted' => array('type' => 'int','precision' => '8'), 'info_datecompleted' => array('type' => 'int','precision' => '8'),
'info_location' => array('type' => 'varchar','precision' => '255') 'info_location' => array('type' => 'varchar','precision' => '255'),
'info_custom_from' => array('type' => 'int','precision' => '1')
), ),
'pk' => array('info_id'), 'pk' => array('info_id'),
'fk' => array(), 'fk' => array(),

View File

@ -556,3 +556,15 @@
return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.004'; return $GLOBALS['setup_info']['infolog']['currentver'] = '1.2.004';
} }
$test[] = '1.2.004';
function infolog_upgrade1_2_004()
{
// column to save if from contains a custom text
$GLOBALS['egw_setup']->oProc->AddColumn('egw_infolog','info_custom_from',array(
'type' => 'int',
'precision' => '1',
));
return $GLOBALS['setup_info']['infolog']['currentver'] = '1.3.001';
}

View File

@ -15,3 +15,4 @@
.fullWidth table { width: 100%; } .fullWidth table { width: 100%; }
.infoId:before { content:"#" } .infoId:before { content:"#" }
.fixedHeight { line-height: 12px; } .fixedHeight { line-height: 12px; }
.noWrap { white-space: nowrap; }

View File

@ -34,7 +34,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="infolog.customfields.fields" template="" lang="" group="0" version="1.2.001"> <template id="infolog.customfields.fields" template="" lang="" group="0" version="1.3.001">
<grid> <grid>
<columns> <columns>
<column/> <column/>
@ -44,12 +44,14 @@
<column/> <column/>
<column/> <column/>
<column/> <column/>
<column/>
</columns> </columns>
<rows> <rows>
<row class="th"> <row class="th">
<description value="Typ"/> <description value="Typ"/>
<description value="Name"/> <description value="Name"/>
<description value="Label"/> <description value="Label"/>
<description value="Type"/>
<description value="Values for selectbox"/> <description value="Values for selectbox"/>
<description value="Length&lt;br&gt;Rows"/> <description value="Length&lt;br&gt;Rows"/>
<description value="Order"/> <description value="Order"/>
@ -57,15 +59,18 @@
</row> </row>
<row class="row" valign="top"> <row class="row" valign="top">
<menulist> <menulist>
<menupopup options="All" id="${row}[typ]" statustext="for which types should this field be used"/> <menupopup options="All" id="${row}[type2]" statustext="for which types should this field be used"/>
</menulist> </menulist>
<textbox size="20" maxlength="32" id="${row}[name]" statustext="the name used internaly (&lt;= 20 chars), changeing it makes existing data unavailible"/> <textbox size="20" maxlength="32" id="${row}[name]" statustext="the name used internaly (&lt;= 20 chars), changeing it makes existing data unavailible"/>
<vbox> <vbox options="0,0">
<textbox maxlength="255" id="${row}[label]" statustext="the text displayed to the user"/> <textbox maxlength="255" id="${row}[label]" statustext="the text displayed to the user"/>
<description id="${row}[label]"/> <description id="${row}[label]"/>
</vbox> </vbox>
<menulist>
<menupopup id="${row}[type]" statustext="Type of customfield" no_lang="1"/>
</menulist>
<textbox multiline="true" rows="2" cols="30" id="${row}[values]" statustext="each value is a line like &lt;id&gt;[=&lt;label&gt;]"/> <textbox multiline="true" rows="2" cols="30" id="${row}[values]" statustext="each value is a line like &lt;id&gt;[=&lt;label&gt;]"/>
<vbox> <vbox options="0,0">
<textbox size="5" id="${row}[len]" statustext="max length of the input [, length of the inputfield (optional)]"/> <textbox size="5" id="${row}[len]" statustext="max length of the input [, length of the inputfield (optional)]"/>
<int options="0,10,2" id="${row}[rows]" statustext="number of row for a multiline inputfield or line of a multi-select-box" blur="1"/> <int options="0,10,2" id="${row}[rows]" statustext="number of row for a multiline inputfield or line of a multi-select-box" blur="1"/>
</vbox> </vbox>
@ -78,7 +83,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="infolog.customfields" template="" lang="" group="0" version="1.2.001"> <template id="infolog.customfields" template="" lang="" group="0" version="1.3.001">
<grid> <grid>
<columns> <columns>
<column/> <column/>
@ -92,7 +97,7 @@
<row> <row>
<description value="Typ"/> <description value="Typ"/>
<menulist> <menulist>
<menupopup id="typ" onchange="1" statustext="select a typ to edit it's status-values or delete it"/> <menupopup id="type2" onchange="1" statustext="select a typ to edit it's status-values or delete it"/>
</menulist> </menulist>
<button label="Delete" id="button[delete]" statustext="deletes the selected typ"/> <button label="Delete" id="button[delete]" statustext="deletes the selected typ"/>
<textbox size="10" maxlength="40" id="new_name" statustext="name of new type to create" blur="new name"/> <textbox size="10" maxlength="40" id="new_name" statustext="name of new type to create" blur="new name"/>

View File

@ -123,7 +123,7 @@
</rows> </rows>
</grid> </grid>
</template> </template>
<template id="infolog.edit" template="" lang="" group="0" version="1.2.002"> <template id="infolog.edit" template="" lang="" group="0" version="1.3.001">
<grid width="100%"> <grid width="100%">
<columns> <columns>
<column width="103"/> <column width="103"/>
@ -152,13 +152,19 @@
</row> </row>
<row class="row"> <row class="row">
<description value="Contact" options=",,,info_from"/> <description value="Contact" options=",,,info_from"/>
<textbox size="36" maxlength="255" id="info_from" statustext="Custom contact-information, leave emtpy to use information from most recent link" blur="@blur_title"/> <vbox options="0,0">
<hbox options="0,0">
<link-entry id="info_contact" class="noWrap"/>
<checkbox id="info_custom_from" onchange="document.getElementById(form::name('info_from')).style.display=this.checked?'block':'none';" statustext="Check to specify custom contact"/>
</hbox>
<textbox size="36" maxlength="255" id="info_from" statustext="Custom contact-information, leave emtpy to use information from most recent link" blur="@blur_title" class="$cont[hide_from_css]"/>
</vbox>
<description value="Phone/Email" options=",,,_info_addr"/> <description value="Phone/Email" options=",,,_info_addr"/>
<textbox size="30" maxlength="255" id="info_addr" statustext="Custom contact-address, leave empty to use information from most recent link"/> <textbox size="30" maxlength="255" id="info_addr" statustext="Custom contact-address, leave empty to use information from most recent link"/>
</row> </row>
<row class="row"> <row class="row">
<description value="Subject" options=",,,info_subject"/> <description value="Subject" options=",,,info_subject"/>
<textbox size="80" maxlength="255" span="all" id="info_subject" needed="1" statustext="a short subject for the entry"/> <textbox size="80" maxlength="255" span="all" id="info_subject" statustext="a short subject for the entry"/>
</row> </row>
<row valign="top" height="250"> <row valign="top" height="250">
<tabbox span="all"> <tabbox span="all">
@ -209,7 +215,7 @@
<menupopup type="select-account" id="info_owner" readonly="true"/> <menupopup type="select-account" id="info_owner" readonly="true"/>
</menulist> </menulist>
<description value="Last modified"/> <description value="Last modified"/>
<hbox orient="0,0"> <hbox options="0" orient="0">
<menulist> <menulist>
<menupopup type="select-account" id="info_modifier" readonly="true"/> <menupopup type="select-account" id="info_modifier" readonly="true"/>
</menulist> </menulist>
@ -228,5 +234,8 @@
</row> </row>
</rows> </rows>
</grid> </grid>
<styles>
.hideFrom input { display: none; }
</styles>
</template> </template>
</overlay> </overlay>