forked from extern/egroupware
- 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:
parent
532264b3fa
commit
4259d8d622
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,345 +1,376 @@
|
|||||||
<?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> *
|
* @link http://www.egroupware.org
|
||||||
* -------------------------------------------- *
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* This program is free software; you can redistribute it and/or modify it *
|
* @package infolog
|
||||||
* under the terms of the GNU General Public License as published by the *
|
* @copyright (c) 2003-6 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* Free Software Foundation; either version 2 of the License, or (at your *
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* option) any later version. *
|
* @version $Id$
|
||||||
\**************************************************************************/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/**
|
||||||
|
* Administration of custom fields, type and status
|
||||||
|
*/
|
||||||
|
class uicustomfields
|
||||||
|
{
|
||||||
|
var $public_functions = array(
|
||||||
|
'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( )
|
||||||
|
{
|
||||||
|
$this->bo =& CreateObject('infolog.boinfolog');
|
||||||
|
$this->tmpl =& CreateObject('etemplate.etemplate');
|
||||||
|
$this->types = &$this->bo->enums['type'];
|
||||||
|
$this->status = &$this->bo->status;
|
||||||
|
$this->config = &$this->bo->config;
|
||||||
|
$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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Administration of custom fields, type and status
|
* Edit/Create an InfoLog Custom fields, typ and status
|
||||||
*
|
*
|
||||||
* @package infolog
|
* @param array $content Content from the eTemplate Exec
|
||||||
* @author 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
|
|
||||||
*/
|
*/
|
||||||
class uicustomfields
|
function edit($content=null)
|
||||||
{
|
{
|
||||||
var $public_functions = array
|
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status');
|
||||||
(
|
if (is_array($content))
|
||||||
'edit' => True
|
|
||||||
);
|
|
||||||
|
|
||||||
function uicustomfields( )
|
|
||||||
{
|
{
|
||||||
$this->bo =& CreateObject('infolog.boinfolog');
|
//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
||||||
$this->tmpl =& CreateObject('etemplate.etemplate');
|
list($action) = @each($content['button']);
|
||||||
$this->types = &$this->bo->enums['type'];
|
switch($action)
|
||||||
$this->status = &$this->bo->status;
|
|
||||||
$this->config = &$this->bo->config;
|
|
||||||
$this->fields = &$this->bo->customfields;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Edit/Create an InfoLog Custom fields, typ and status
|
|
||||||
*
|
|
||||||
* @param array $content Content from the eTemplate Exec
|
|
||||||
*/
|
|
||||||
function edit($content=null)
|
|
||||||
{
|
|
||||||
$GLOBALS['egw_info']['flags']['app_header'] = lang('InfoLog').' - '.lang('Custom fields, typ and status');
|
|
||||||
if (is_array($content))
|
|
||||||
{
|
{
|
||||||
//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
case 'create':
|
||||||
list($action) = @each($content['button']);
|
$this->create($content);
|
||||||
switch($action)
|
break;
|
||||||
{
|
case 'delete':
|
||||||
case 'create':
|
$this->delete($content);
|
||||||
$this->create($content);
|
break;
|
||||||
break;
|
default:
|
||||||
case 'delete':
|
if (!$content['status']['create'] && !$content['status']['delete'] &&
|
||||||
$this->delete($content);
|
!$content['fields']['create'] && !$content['fields']['delete'])
|
||||||
break;
|
|
||||||
default:
|
|
||||||
if (!$content['status']['create'] && !$content['status']['delete'] &&
|
|
||||||
!$content['fields']['create'] && !$content['fields']['delete'])
|
|
||||||
{
|
|
||||||
break; // typ change
|
|
||||||
}
|
|
||||||
case 'save':
|
|
||||||
case 'apply':
|
|
||||||
$this->update($content);
|
|
||||||
if ($action != 'save')
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case 'cancel':
|
|
||||||
$GLOBALS['egw']->redirect_link('/admin/');
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
list($typ) = each($this->types);
|
|
||||||
$content = array(
|
|
||||||
'typ' => $typ,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$readonlys = array();
|
|
||||||
$readonlys['button[delete]'] = isset($this->bo->stock_enums['type'][$content['typ']]);
|
|
||||||
|
|
||||||
$content['status'] = array(
|
|
||||||
'default' => $this->status['defaults'][$content['typ']]
|
|
||||||
);
|
|
||||||
$n = 0;
|
|
||||||
foreach($this->status[$content['typ']] as $name => $label)
|
|
||||||
{
|
|
||||||
$content['status'][++$n] = array(
|
|
||||||
'name' => $name,
|
|
||||||
'label' => $label,
|
|
||||||
'disabled' => False
|
|
||||||
);
|
|
||||||
$preserv_status[$n]['old_name'] = $name;
|
|
||||||
if (isset($this->bo->stock_status[$content['typ']][$name]))
|
|
||||||
{
|
|
||||||
$readonlys['status']["delete[$name]"] =
|
|
||||||
$readonlys['status'][$n.'[name]'] = True;
|
|
||||||
}
|
|
||||||
$readonlys['status']["create$name"] = True;
|
|
||||||
}
|
|
||||||
$content['status'][++$n] = array('name'=>''); // new line for create
|
|
||||||
$readonlys['status']["delete[]"] = True;
|
|
||||||
|
|
||||||
//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
|
|
||||||
$content['fields'] = array();
|
|
||||||
$n = 0;
|
|
||||||
foreach($this->fields as $name => $data)
|
|
||||||
{
|
|
||||||
if (is_array($data['values']))
|
|
||||||
{
|
|
||||||
$values = '';
|
|
||||||
foreach($data['values'] as $var => $value)
|
|
||||||
{
|
{
|
||||||
$values .= (!empty($values) ? "\n" : '').$var.'='.$value;
|
break; // typ change
|
||||||
}
|
}
|
||||||
$data['values'] = $values;
|
case 'save':
|
||||||
}
|
case 'apply':
|
||||||
$content['fields'][++$n] = $data + array(
|
$this->update($content);
|
||||||
'name' => $name
|
if ($action != 'save')
|
||||||
);
|
{
|
||||||
$preserv_fields[$n]['old_name'] = $name;
|
break;
|
||||||
$readonlys['fields']["create$name"] = True;
|
}
|
||||||
|
case 'cancel':
|
||||||
|
$GLOBALS['egw']->redirect_link('/admin/');
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
$content['fields'][++$n] = array('typ'=>'','order' => 10 * $n); // new line for create
|
}
|
||||||
$readonlys['fields']["delete[]"] = True;
|
else
|
||||||
|
{
|
||||||
|
list($typ) = each($this->types);
|
||||||
|
$content = array(
|
||||||
|
'type2' => $typ,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
$readonlys = array();
|
||||||
|
$readonlys['button[delete]'] = isset($this->bo->stock_enums['type'][$content['type2']]);
|
||||||
|
|
||||||
//echo '<p>uicustomfields.edit(content = <pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
$content['status'] = array(
|
||||||
//echo 'readonlys = <pre style="text-align: left;">'; print_r($readonlys); echo "</pre>\n";
|
'default' => $this->status['defaults'][$content['type2']]
|
||||||
$this->tmpl->read('infolog.customfields');
|
);
|
||||||
$this->tmpl->exec('infolog.uicustomfields.edit',$content,array(
|
$n = 0;
|
||||||
'typ' => $this->types,
|
foreach($this->status[$content['type2']] as $name => $label)
|
||||||
),$readonlys,array(
|
{
|
||||||
'status' => $preserv_status,
|
$content['status'][++$n] = array(
|
||||||
'fields' => $preserv_fields
|
'name' => $name,
|
||||||
));
|
'label' => $label,
|
||||||
|
'disabled' => False
|
||||||
|
);
|
||||||
|
$preserv_status[$n]['old_name'] = $name;
|
||||||
|
if (isset($this->bo->stock_status[$content['type2']][$name]))
|
||||||
|
{
|
||||||
|
$readonlys['status']["delete[$name]"] =
|
||||||
|
$readonlys['status'][$n.'[name]'] = True;
|
||||||
|
}
|
||||||
|
$readonlys['status']["create$name"] = True;
|
||||||
|
}
|
||||||
|
$content['status'][++$n] = array('name'=>''); // new line for create
|
||||||
|
$readonlys['status']["delete[]"] = True;
|
||||||
|
|
||||||
|
//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
|
||||||
|
$content['fields'] = array();
|
||||||
|
$n = 0;
|
||||||
|
foreach($this->fields as $name => $field)
|
||||||
|
{
|
||||||
|
if (is_array($field['values']))
|
||||||
|
{
|
||||||
|
$values = '';
|
||||||
|
foreach($field['values'] as $var => $value)
|
||||||
|
{
|
||||||
|
$values .= (!empty($values) ? "\n" : '').$var.'='.$value;
|
||||||
|
}
|
||||||
|
$field['values'] = $values;
|
||||||
|
}
|
||||||
|
$content['fields'][++$n] = $field + array(
|
||||||
|
'name' => $name
|
||||||
|
);
|
||||||
|
$preserv_fields[$n]['old_name'] = $name;
|
||||||
|
$readonlys['fields']["create$name"] = True;
|
||||||
|
}
|
||||||
|
$content['fields'][++$n] = array('type2'=>'','order' => 10 * $n); // new line for create
|
||||||
|
$readonlys['fields']["delete[]"] = True;
|
||||||
|
|
||||||
|
//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";
|
||||||
|
$this->tmpl->read('infolog.customfields');
|
||||||
|
$this->tmpl->exec('infolog.uicustomfields.edit',$content,array(
|
||||||
|
'type2' => $this->types,
|
||||||
|
'type' => $this->cf_types,
|
||||||
|
),$readonlys,array(
|
||||||
|
'status' => $preserv_status,
|
||||||
|
'fields' => $preserv_fields,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function update_fields(&$content)
|
||||||
|
{
|
||||||
|
$typ = $content['type2'];
|
||||||
|
$fields = &$content['fields'];
|
||||||
|
|
||||||
|
$create = $fields['create'];
|
||||||
|
unset($fields['create']);
|
||||||
|
|
||||||
|
if ($fields['delete'])
|
||||||
|
{
|
||||||
|
list($delete) = each($fields['delete']);
|
||||||
|
unset($fields['delete']);
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_fields(&$content)
|
foreach($fields as $field)
|
||||||
{
|
{
|
||||||
$typ = $content['typ'];
|
$name = trim($field['name']);
|
||||||
$fields = &$content['fields'];
|
$old_name = $field['old_name'];
|
||||||
|
|
||||||
$create = $fields['create'];
|
if (!empty($delete) && $delete == $old_name)
|
||||||
unset($fields['create']);
|
|
||||||
|
|
||||||
if ($fields['delete'])
|
|
||||||
{
|
{
|
||||||
list($delete) = each($fields['delete']);
|
unset($this->fields[$old_name]);
|
||||||
unset($fields['delete']);
|
continue;
|
||||||
}
|
}
|
||||||
|
if (isset($field['name']) && empty($name) && ($create || !empty($old_name))) // empty name not allowed
|
||||||
foreach($fields as $field)
|
|
||||||
{
|
{
|
||||||
$name = trim($field['name']);
|
$content['error_msg'] = lang('Name must not be empty !!!');
|
||||||
$old_name = $field['old_name'];
|
}
|
||||||
|
if (isset($field['old_name']))
|
||||||
if (!empty($delete) && $delete == $old_name)
|
{
|
||||||
|
if (!empty($name) && $old_name != $name) // renamed
|
||||||
{
|
{
|
||||||
unset($this->fields[$old_name]);
|
unset($this->fields[$old_name]);
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
if (isset($field['name']) && empty($name) && ($create || !empty($old_name))) // empty name not allowed
|
elseif (empty($name))
|
||||||
{
|
{
|
||||||
$content['error_msg'] = lang('Name must not be empty !!!');
|
$name = $old_name;
|
||||||
}
|
|
||||||
if (isset($field['old_name']))
|
|
||||||
{
|
|
||||||
if (!empty($name) && $old_name != $name) // renamed
|
|
||||||
{
|
|
||||||
unset($this->fields[$old_name]);
|
|
||||||
}
|
|
||||||
elseif (empty($name))
|
|
||||||
{
|
|
||||||
$name = $old_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (empty($name)) // new item and empty ==> ignore it
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$values = array();
|
|
||||||
if (!empty($field['values']))
|
|
||||||
{
|
|
||||||
foreach(explode("\n",$field['values']) as $line)
|
|
||||||
{
|
|
||||||
list($var,$value) = split('=',trim($line),2);
|
|
||||||
$var = trim($var);
|
|
||||||
$values[$var] = empty($value) ? $var : $value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$this->fields[$name] = array(
|
|
||||||
'typ' => $field['typ'],
|
|
||||||
'label' => empty($field['label']) ? $name : $field['label'],
|
|
||||||
'help' => $field['help'],
|
|
||||||
'values'=> $values,
|
|
||||||
'len' => $field['len'],
|
|
||||||
'rows' => intval($field['rows']),
|
|
||||||
'order' => intval($field['order'])
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (!function_exists('sort_by_order'))
|
|
||||||
{
|
|
||||||
function sort_by_order($arr1,$arr2)
|
|
||||||
{
|
|
||||||
return $arr1['order'] - $arr2['order'];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
uasort($this->fields,sort_by_order);
|
elseif (empty($name)) // new item and empty ==> ignore it
|
||||||
|
|
||||||
$n = 0;
|
|
||||||
foreach($this->fields as $name => $data)
|
|
||||||
{
|
{
|
||||||
$this->fields[$name]['order'] = ($n += 10);
|
continue;
|
||||||
|
}
|
||||||
|
$values = array();
|
||||||
|
if (!empty($field['values']))
|
||||||
|
{
|
||||||
|
foreach(explode("\n",$field['values']) as $line)
|
||||||
|
{
|
||||||
|
list($var,$value) = split('=',trim($line),2);
|
||||||
|
$var = trim($var);
|
||||||
|
$values[$var] = empty($value) ? $var : $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$this->fields[$name] = array(
|
||||||
|
'type2' => $field['type2'],
|
||||||
|
'type' => $field['type'],
|
||||||
|
'label' => empty($field['label']) ? $name : $field['label'],
|
||||||
|
'help' => $field['help'],
|
||||||
|
'values'=> $values,
|
||||||
|
'len' => $field['len'],
|
||||||
|
'rows' => (int)$field['rows'],
|
||||||
|
'order' => (int)$field['order'],
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (!function_exists('sort_by_order'))
|
||||||
|
{
|
||||||
|
function sort_by_order($arr1,$arr2)
|
||||||
|
{
|
||||||
|
return $arr1['order'] - $arr2['order'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
uasort($this->fields,sort_by_order);
|
||||||
|
|
||||||
function update_status(&$content)
|
$n = 0;
|
||||||
|
foreach($this->fields as $name => $data)
|
||||||
{
|
{
|
||||||
$typ = $content['typ'];
|
$this->fields[$name]['order'] = ($n += 10);
|
||||||
$status = &$content['status'];
|
|
||||||
|
|
||||||
$default = $status['default'];
|
|
||||||
unset($status['default']);
|
|
||||||
|
|
||||||
$create = $status['create'];
|
|
||||||
unset($status['create']);
|
|
||||||
|
|
||||||
if ($status['delete'])
|
|
||||||
{
|
|
||||||
list($delete) = each($status['delete']);
|
|
||||||
unset($status['delete']);
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach($status as $stat)
|
|
||||||
{
|
|
||||||
$name = trim($stat['name']);
|
|
||||||
$old_name = $stat['old_name'];
|
|
||||||
|
|
||||||
if (!empty($delete) && $delete == $old_name)
|
|
||||||
{
|
|
||||||
unset($this->status[$typ][$old_name]);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (isset($stat['name']) && empty($name) && ($create || !empty($old_name))) // empty name not allowed
|
|
||||||
{
|
|
||||||
$content['error_msg'] = lang('Name must not be empty !!!');
|
|
||||||
}
|
|
||||||
if (isset($stat['old_name']))
|
|
||||||
{
|
|
||||||
if (!empty($name) && $old_name != $name) // renamed
|
|
||||||
{
|
|
||||||
unset($this->status[$typ][$old_name]);
|
|
||||||
|
|
||||||
if ($default == $old_name)
|
|
||||||
{
|
|
||||||
$default = $name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (empty($name))
|
|
||||||
{
|
|
||||||
$name = $old_name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
elseif (empty($name)) // new item and empty ==> ignore it
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
$this->status[$typ][$name] = empty($stat['label']) ? $name : $stat['label'];
|
|
||||||
}
|
|
||||||
$this->status['defaults'][$typ] = empty($default) ? $name : $default;
|
|
||||||
if (!isset($this->status[$typ][$this->status['defaults'][$typ]]))
|
|
||||||
{
|
|
||||||
list($this->status['defaults'][$typ]) = @each($this->status[$typ]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function update(&$content)
|
|
||||||
{
|
|
||||||
$this->update_status($content);
|
|
||||||
$this->update_fields($content);
|
|
||||||
|
|
||||||
// save changes to repository
|
|
||||||
$this->save_repository();
|
|
||||||
}
|
|
||||||
|
|
||||||
function delete(&$content)
|
|
||||||
{
|
|
||||||
if (isset($this->bo->stock_enums['type'][$content['typ']]))
|
|
||||||
{
|
|
||||||
$content['error_msg'] .= lang("You can't delete one of the stock types !!!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
unset($this->types[$content['typ']]);
|
|
||||||
unset($this->status[$content['typ']]);
|
|
||||||
unset($this->status['defaults'][$content['typ']]);
|
|
||||||
$content['typ'] = '';
|
|
||||||
|
|
||||||
// save changes to repository
|
|
||||||
$this->save_repository();
|
|
||||||
}
|
|
||||||
|
|
||||||
function create(&$content)
|
|
||||||
{
|
|
||||||
$new_name = trim($content['new_name']);
|
|
||||||
unset($content['new_name']);
|
|
||||||
if (empty($new_name) || isset($this->types[$new_name]))
|
|
||||||
{
|
|
||||||
$content['error_msg'] .= empty($new_name) ?
|
|
||||||
lang('You have to enter a name, to create a new typ!!!') :
|
|
||||||
lang("Typ '%1' already exists !!!",$new_name);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->types[$new_name] = $new_name;
|
|
||||||
$this->status[$new_name] = array(
|
|
||||||
'ongoing' => 'ongoing',
|
|
||||||
'done' => 'done'
|
|
||||||
);
|
|
||||||
$this->status['defaults'][$new_name] = 'ongoing';
|
|
||||||
|
|
||||||
// save changes to repository
|
|
||||||
$this->save_repository();
|
|
||||||
|
|
||||||
$content['typ'] = $new_name; // show the new entry
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function save_repository()
|
|
||||||
{
|
|
||||||
// save changes to repository
|
|
||||||
$this->config->value('types',$this->types);
|
|
||||||
//echo '<p>uicustomfields::save_repository() \$this->status=<pre style="text-aling: left;">'; print_r($this->status); echo "</pre>\n";
|
|
||||||
$this->config->value('status',$this->status);
|
|
||||||
//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
|
|
||||||
$this->config->value('customfields',$this->fields);
|
|
||||||
|
|
||||||
$this->config->save_repository();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_status(&$content)
|
||||||
|
{
|
||||||
|
$typ = $content['type2'];
|
||||||
|
$status = &$content['status'];
|
||||||
|
|
||||||
|
$default = $status['default'];
|
||||||
|
unset($status['default']);
|
||||||
|
|
||||||
|
$create = $status['create'];
|
||||||
|
unset($status['create']);
|
||||||
|
|
||||||
|
if ($status['delete'])
|
||||||
|
{
|
||||||
|
list($delete) = each($status['delete']);
|
||||||
|
unset($status['delete']);
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($status as $stat)
|
||||||
|
{
|
||||||
|
$name = trim($stat['name']);
|
||||||
|
$old_name = $stat['old_name'];
|
||||||
|
|
||||||
|
if (!empty($delete) && $delete == $old_name)
|
||||||
|
{
|
||||||
|
unset($this->status[$typ][$old_name]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (isset($stat['name']) && empty($name) && ($create || !empty($old_name))) // empty name not allowed
|
||||||
|
{
|
||||||
|
$content['error_msg'] = lang('Name must not be empty !!!');
|
||||||
|
}
|
||||||
|
if (isset($stat['old_name']))
|
||||||
|
{
|
||||||
|
if (!empty($name) && $old_name != $name) // renamed
|
||||||
|
{
|
||||||
|
unset($this->status[$typ][$old_name]);
|
||||||
|
|
||||||
|
if ($default == $old_name)
|
||||||
|
{
|
||||||
|
$default = $name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (empty($name))
|
||||||
|
{
|
||||||
|
$name = $old_name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
elseif (empty($name)) // new item and empty ==> ignore it
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$this->status[$typ][$name] = empty($stat['label']) ? $name : $stat['label'];
|
||||||
|
}
|
||||||
|
$this->status['defaults'][$typ] = empty($default) ? $name : $default;
|
||||||
|
if (!isset($this->status[$typ][$this->status['defaults'][$typ]]))
|
||||||
|
{
|
||||||
|
list($this->status['defaults'][$typ]) = @each($this->status[$typ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function update(&$content)
|
||||||
|
{
|
||||||
|
$this->update_status($content);
|
||||||
|
$this->update_fields($content);
|
||||||
|
|
||||||
|
// save changes to repository
|
||||||
|
$this->save_repository();
|
||||||
|
}
|
||||||
|
|
||||||
|
function delete(&$content)
|
||||||
|
{
|
||||||
|
if (isset($this->bo->stock_enums['type'][$content['type2']]))
|
||||||
|
{
|
||||||
|
$content['error_msg'] .= lang("You can't delete one of the stock types !!!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unset($this->types[$content['type2']]);
|
||||||
|
unset($this->status[$content['type2']]);
|
||||||
|
unset($this->status['defaults'][$content['type2']]);
|
||||||
|
list($content['type2']) = each($this->types);
|
||||||
|
|
||||||
|
// save changes to repository
|
||||||
|
$this->save_repository();
|
||||||
|
}
|
||||||
|
|
||||||
|
function create(&$content)
|
||||||
|
{
|
||||||
|
$new_name = trim($content['new_name']);
|
||||||
|
unset($content['new_name']);
|
||||||
|
if (empty($new_name) || isset($this->types[$new_name]))
|
||||||
|
{
|
||||||
|
$content['error_msg'] .= empty($new_name) ?
|
||||||
|
lang('You have to enter a name, to create a new typ!!!') :
|
||||||
|
lang("Typ '%1' already exists !!!",$new_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->types[$new_name] = $new_name;
|
||||||
|
$this->status[$new_name] = array(
|
||||||
|
'ongoing' => 'ongoing',
|
||||||
|
'done' => 'done'
|
||||||
|
);
|
||||||
|
$this->status['defaults'][$new_name] = 'ongoing';
|
||||||
|
|
||||||
|
// save changes to repository
|
||||||
|
$this->save_repository();
|
||||||
|
|
||||||
|
$content['type2'] = $new_name; // show the new entry
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save_repository()
|
||||||
|
{
|
||||||
|
// save changes to repository
|
||||||
|
$this->config->value('types',$this->types);
|
||||||
|
//echo '<p>uicustomfields::save_repository() \$this->status=<pre style="text-aling: left;">'; print_r($this->status); echo "</pre>\n";
|
||||||
|
$this->config->value('status',$this->status);
|
||||||
|
//echo '<p>uicustomfields::save_repository() \$this->fields=<pre style="text-aling: left;">'; print_r($this->fields); echo "</pre>\n";
|
||||||
|
$this->config->value('customfields',$this->fields);
|
||||||
|
|
||||||
|
$this->config->save_repository();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -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
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -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(),
|
||||||
|
@ -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';
|
||||||
|
}
|
||||||
|
@ -14,4 +14,5 @@
|
|||||||
.planned { font-style:italic; }
|
.planned { font-style:italic; }
|
||||||
.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; }
|
@ -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<br>Rows"/>
|
<description value="Length<br>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 (<= 20 chars), changeing it makes existing data unavailible"/>
|
<textbox size="20" maxlength="32" id="${row}[name]" statustext="the name used internaly (<= 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 <id>[=<label>]"/>
|
<textbox multiline="true" rows="2" cols="30" id="${row}[values]" statustext="each value is a line like <id>[=<label>]"/>
|
||||||
<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"/>
|
||||||
|
@ -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>
|
Loading…
Reference in New Issue
Block a user