forked from extern/egroupware
addressbook extension:
Admin can now define multiple addressbooks each with an own edit / view template and an own icon. Atm. all Addressbooks are stored in one backend, but this will change soon^tm
This commit is contained in:
parent
4cfc20459e
commit
300b9b1070
@ -30,9 +30,9 @@
|
||||
var $appname;
|
||||
|
||||
/**
|
||||
* @var array $types array with allowd types of customfields
|
||||
* @var array $cf_types array with allowd types of customfields
|
||||
*/
|
||||
var $types = array(
|
||||
var $cf_types = array(
|
||||
'text' => 'Text',
|
||||
'label' => 'Label',
|
||||
'select' => 'Selectbox',
|
||||
@ -52,10 +52,9 @@
|
||||
|
||||
function customfields($appname='')
|
||||
{
|
||||
$this->appname = $appname ? $appname : $_GET['appname'];
|
||||
$this->tmpl =& CreateObject('etemplate.etemplate');
|
||||
// $this->tmpl =& CreateObject('etemplate.etemplate');
|
||||
$this->config =& CreateObject('phpgwapi.config',$this->appname);
|
||||
|
||||
// if($this->tmpl->read($this->appname.'.admin.types')) {$this->manage_content_types = true; echo 'tt';}
|
||||
$GLOBALS['egw']->translation->add_app('infolog'); // til we move the translations
|
||||
}
|
||||
|
||||
@ -67,24 +66,38 @@
|
||||
*/
|
||||
function edit($content = null)
|
||||
{
|
||||
// determine appname
|
||||
$this->appname = $_GET['appname'] ? $_GET['appname'] : ($content['appname'] ? $content['appname'] : false);
|
||||
if(!$this->appname) die(lang('Error! No appname found'));
|
||||
|
||||
$GLOBALS['egw']->translation->add_app('infolog'); // til we move the translations
|
||||
$this->tmpl =& CreateObject('etemplate.etemplate');
|
||||
$this->config =& CreateObject('phpgwapi.config',$this->appname);
|
||||
// do we manage content-types?
|
||||
if($this->tmpl->read($this->appname.'.admin.types')) $this->manage_content_types = true;
|
||||
|
||||
$this->fields = $this->get_customfields();
|
||||
$this->tmpl->read('admin.customfields');
|
||||
|
||||
if($this->manage_content_types) $this->content_types = $this->get_content_types();
|
||||
else
|
||||
{
|
||||
$this->tmpl->children[0]['data'][2]['A']['disabled'] = true;
|
||||
$this->tmpl->children[0]['data'][3]['A']['disabled'] = true;
|
||||
}
|
||||
|
||||
if (is_array($content))
|
||||
{
|
||||
// setting our app again
|
||||
$this->config->config($this->appname = $content['appname']);
|
||||
$this->fields = $this->get_customfields();
|
||||
|
||||
//echo '<pre style="text-align: left;">'; print_r($content); echo "</pre>\n";
|
||||
if($content['fields']['delete'] || $content['fields']['create'])
|
||||
if($this->manage_content_types)
|
||||
{
|
||||
if($content['fields']['delete'])
|
||||
{
|
||||
$this->delete($content);
|
||||
}
|
||||
elseif($content['fields']['create'])
|
||||
{
|
||||
$this->create($content);
|
||||
}
|
||||
$this->content_type = $content['content_types']['types'];
|
||||
}
|
||||
|
||||
if($content['content_types']['delete']) $this->delete_content_type($content);
|
||||
elseif($content['content_types']['create']) $this->create_content_type($content);
|
||||
elseif($content['fields']['delete']) $this->delete_field($content);
|
||||
elseif($content['fields']['create']) $this->create_field($content);
|
||||
else
|
||||
{
|
||||
list($action) = @each($content['button']);
|
||||
@ -111,18 +124,35 @@
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->fields = $this->get_customfields();
|
||||
if($this->manage_content_types)
|
||||
{
|
||||
$content_types = array_keys($this->content_types);
|
||||
$this->content_type = $content_types[0];
|
||||
}
|
||||
|
||||
list($type) = each($this->types);
|
||||
$content = array(
|
||||
'type' => $type,
|
||||
);
|
||||
$referer = $GLOBALS['egw']->common->get_referer();
|
||||
}
|
||||
$GLOBALS['egw_info']['flags']['app_header'] = $GLOBALS['egw_info']['apps'][$this->appname]['title'].' - '.lang('Custom fields');
|
||||
|
||||
$readonlys = array();
|
||||
|
||||
|
||||
if($this->manage_content_types)
|
||||
{
|
||||
$content['content_types']['app-name'] = $this->appname;
|
||||
foreach($this->content_types as $type => $entry)
|
||||
{
|
||||
$this->types2[$type] = $entry['name'];
|
||||
}
|
||||
$content['content_types']['options-types'] = $this->types2;
|
||||
$this->tmpl->children[0]['data'][3]['A']['name'] = $this->appname.'.admin.types';
|
||||
$this->tmpl->children[0]['data'][3]['A']['size'] = 'content_type_options';
|
||||
$content['content_type_options'] = $this->content_types[$this->content_type]['options'];
|
||||
$content['content_type_options']['type'] = $this->content_types[$this->content_type]['name'];
|
||||
if ($this->content_types[$this->content_type]['non_deletable'])
|
||||
{
|
||||
$content['content_types']['non_deletable'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
//echo 'customfields=<pre style="text-align: left;">'; print_r($this->fields); echo "</pre>\n";
|
||||
$content['fields'] = array();
|
||||
$n = 0;
|
||||
@ -150,13 +180,13 @@
|
||||
$readonlys['fields']["create$name"] = True;
|
||||
}
|
||||
$content['fields'][++$n] = array('name'=>'','order' => 10 * $n); // new line for create
|
||||
if($this->manage_content_types) $content['fields']['type2'] = 'enable';
|
||||
$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('admin.customfields');
|
||||
$this->tmpl->exec('admin.customfields.edit',$content,array(
|
||||
'type' => $this->types,
|
||||
'type2' => $this->types2,
|
||||
'type' => $this->cf_types,
|
||||
'type2' => $this->types2 + array('tmpl' => 'template'),
|
||||
),$readonlys,array(
|
||||
'fields' => $preserv_fields,
|
||||
'appname' => $this->appname,
|
||||
@ -212,6 +242,10 @@
|
||||
'rows' => intval($field['rows']),
|
||||
'order' => intval($field['order'])
|
||||
);
|
||||
if(!$this->fields[$name]['type2'] && $this->manage_content_types)
|
||||
{
|
||||
$this->fields[$name]['type2'] = (string)0;
|
||||
}
|
||||
}
|
||||
if (!function_exists('sort_by_order'))
|
||||
{
|
||||
@ -233,6 +267,7 @@
|
||||
function update(&$content)
|
||||
{
|
||||
$this->update_fields($content);
|
||||
$this->content_types[$this->content_type]['options'] = $content['content_type_options'];
|
||||
// save changes to repository
|
||||
$this->save_repository();
|
||||
}
|
||||
@ -240,18 +275,24 @@
|
||||
/**
|
||||
* deletes custom field from customfield definitions
|
||||
*/
|
||||
function delete(&$content)
|
||||
function delete_field(&$content)
|
||||
{
|
||||
unset($this->fields[key($content['fields']['delete'])]);
|
||||
|
||||
// save changes to repository
|
||||
$this->save_repository();
|
||||
}
|
||||
|
||||
|
||||
function delete_content_type(&$content)
|
||||
{
|
||||
unset($this->content_types[$content['content_types']['types']]);
|
||||
// save changes to repository
|
||||
$this->save_repository();
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new custom field
|
||||
*/
|
||||
function create(&$content)
|
||||
function create_field(&$content)
|
||||
{
|
||||
$new_name = trim($content['fields'][count($content['fields'])-1]['name']);
|
||||
if (empty($new_name) || isset($this->fields[$new_name]))
|
||||
@ -267,6 +308,31 @@
|
||||
$this->save_repository();
|
||||
}
|
||||
}
|
||||
|
||||
function create_content_type(&$content)
|
||||
{
|
||||
$new_name = trim($content['content_types']['name']);
|
||||
if (empty($new_name) || isset($this->fields[$new_name]))
|
||||
{
|
||||
$content['error_msg'] .= empty($new_name) ?
|
||||
lang('You have to enter a name, to create a new type!!!') :
|
||||
lang("type '%1' already exists !!!",$new_name);
|
||||
}
|
||||
else
|
||||
{
|
||||
// search free type character
|
||||
for($i=97;$i<=122;$i++)
|
||||
{
|
||||
if(!$this->content_types[chr($i)])
|
||||
{
|
||||
$new_type = chr($i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->content_types[$new_type] = array('name' => $new_name);
|
||||
$this->save_repository();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* save changes to repository
|
||||
@ -275,7 +341,7 @@
|
||||
{
|
||||
//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->value('types',$this->content_types);
|
||||
$this->config->save_repository();
|
||||
}
|
||||
|
||||
@ -293,4 +359,18 @@
|
||||
|
||||
return is_array($config[$config_name]) ? $config[$config_name] : array();
|
||||
}
|
||||
|
||||
/**
|
||||
* get_content_types of using application
|
||||
*
|
||||
* @author Cornelius Weiss
|
||||
* @return array with content-types
|
||||
*/
|
||||
function get_content_types()
|
||||
{
|
||||
$config = $this->config->read_repository();
|
||||
|
||||
return is_array($config['types']) ? $config['types'] : array();
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,11 +1,18 @@
|
||||
<?php
|
||||
// eTemplates for Application 'admin', generated by soetemplate::dump4setup() 2005-11-08 14:00
|
||||
// eTemplates for Application 'admin', generated by soetemplate::dump4setup() 2006-03-02 08:38
|
||||
|
||||
/* $Id$ */
|
||||
|
||||
$templ_version=1;
|
||||
|
||||
$templ_data[] = array('name' => 'admin.customfields','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:4:{i:0;a:1:{s:1:"F";s:3:"80%";}i:1;a:6:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:9:"error_msg";s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";}}i:2;a:6:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:6:"fields";s:4:"span";s:3:"all";s:4:"name";s:25:"admin.customfields.fields";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:3;a:6:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"help";s:33:"saves the changes made and leaves";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"help";s:19:"applies the changes";}i:3;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"help";s:22:"leaves without saveing";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:3;s:4:"cols";i:6;}}','size' => '','style' => '.redItalic { color: red; font-style: italics; }','modified' => '1131453292',);
|
||||
$templ_data[] = array('name' => 'admin.customfields','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:2:{s:1:"F";s:3:"80%";s:2:"c2";s:6:"header";}i:1;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:9:"error_msg";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";}}i:2;a:6:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"span";s:3:"all";s:5:"label";s:13:"Custom fields";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:3;a:6:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:6:"fields";s:4:"span";s:3:"all";s:4:"name";s:25:"admin.customfields.fields";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:4;a:6:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"help";s:33:"saves the changes made and leaves";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"help";s:19:"applies the changes";}i:3;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"help";s:22:"leaves without saveing";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:4;s:4:"cols";i:6;}}','size' => '','style' => '.header { font-weight: bold; font-size: 120%; }
|
||||
.error_msg { color: red; font-style: italics; }','modified' => '1130271259',);
|
||||
|
||||
$templ_data[] = array('name' => 'admin.customfields.fields','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"C";s:8:",!@type2";}i:1;a:8:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Label";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Subtype";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";}s:1:"E";a:3:{s:4:"type";s:5:"label";s:5:"label";s:7:"Options";s:4:"help";s:40:"each value is a line like <id>[=<label>]";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Length<br>Rows";}s:1:"G";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Order";}s:1:"H";a:4:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";s:5:"align";s:6:"center";s:4:"help";s:18:"deletes this field";}}i:2;a:8:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"size";s:5:"20,32";s:4:"name";s:12:"${row}[name]";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:",255";s:4:"name";s:13:"${row}[label]";s:4:"help";s:30:"the text displayed to the user";}i:2;a:2:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[label]";}}s:1:"C";a:3:{s:4:"type";s:6:"select";s:4:"size";s:3:"All";s:4:"name";s:13:"${row}[type2]";}s:1:"D";a:3:{s:4:"type";s:6:"select";s:4:"name";s:12:"{$row}[type]";s:4:"help";s:19:"Type of customfield";}s:1:"E";a:4:{s:4:"type";s:8:"textarea";s:4:"size";s:4:"2,30";s:4:"name";s:14:"${row}[values]";s:4:"help";s:36:"each value is a line like id[=label]";}s:1:"F";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:1:"5";s:4:"name";s:11:"${row}[len]";s:4:"help";s:63:"max length of the input [, length of the inputfield (optional)]";}i:2;a:5:{s:4:"type";s:3:"int";s:4:"size";s:6:"0,10,2";s:4:"name";s:12:"${row}[rows]";s:4:"help";s:70:"number of row for a multiline inputfield or line of a multi-select-box";s:4:"blur";s:1:"1";}}s:1:"G";a:4:{s:4:"type";s:3:"int";s:4:"size";s:4:"1,,3";s:4:"name";s:13:"${row}[order]";s:4:"help";s:45:"determines the order the fields are displayed";}s:1:"H";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:23:"delete[$row_cont[name]]";s:4:"help";s:18:"deletes this field";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Create";s:4:"name";s:21:"create$row_cont[name]";s:4:"help";s:19:"creates a new field";}}}}s:4:"rows";i:2;s:4:"cols";i:8;s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1131454776',);
|
||||
$templ_data[] = array('name' => 'admin.customfields','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:6:{i:0;a:1:{s:1:"G";s:3:"80%";}i:1;a:7:{s:1:"A";a:5:{s:4:"type";s:5:"label";s:4:"span";s:13:"all,redItalic";s:4:"name";s:9:"error_msg";s:5:"align";s:6:"center";s:7:"no_lang";s:1:"1";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}s:1:"G";a:2:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";}}i:2;a:7:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:13:"content_types";s:4:"span";s:3:"all";s:4:"name";s:24:"admin.customfields.types";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}s:1:"G";a:1:{s:4:"type";s:5:"label";}}i:3;a:7:{s:1:"A";a:2:{s:4:"type";s:8:"template";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}s:1:"G";a:1:{s:4:"type";s:5:"label";}}i:4;a:7:{s:1:"A";a:4:{s:4:"type";s:8:"template";s:4:"size";s:6:"fields";s:4:"span";s:3:"all";s:4:"name";s:25:"admin.customfields.fields";}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}s:1:"G";a:1:{s:4:"type";s:5:"label";}}i:5;a:7:{s:1:"A";a:6:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"3";s:4:"span";s:3:"all";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:4:"Save";s:4:"name";s:12:"button[save]";s:4:"help";s:33:"saves the changes made and leaves";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:5:"Apply";s:4:"name";s:13:"button[apply]";s:4:"help";s:19:"applies the changes";}i:3;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Cancel";s:4:"name";s:14:"button[cancel]";s:4:"help";s:22:"leaves without saveing";}}s:1:"B";a:1:{s:4:"type";s:5:"label";}s:1:"C";a:1:{s:4:"type";s:5:"label";}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:1:{s:4:"type";s:5:"label";}s:1:"F";a:1:{s:4:"type";s:5:"label";}s:1:"G";a:1:{s:4:"type";s:5:"label";}}}s:4:"rows";i:5;s:4:"cols";i:7;}}','size' => '','style' => '.redItalic { color: red; font-style: italics; }','modified' => '1131453292',);
|
||||
|
||||
$templ_data[] = array('name' => 'admin.customfields.fields','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"C";s:8:",!@type2";}i:1;a:8:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Label";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:3:"Typ";}s:1:"D";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";s:4:"help";s:19:"Type of customfield";}s:1:"E";a:3:{s:4:"type";s:5:"label";s:5:"label";s:7:"Options";s:4:"help";s:40:"each value is a line like <id>[=<label>]";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Length<br>Rows";}s:1:"G";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Order";}s:1:"H";a:4:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";s:5:"align";s:6:"center";s:4:"help";s:18:"deletes this field";}}i:2;a:8:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"size";s:5:"20,32";s:4:"name";s:12:"${row}[name]";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:",255";s:4:"name";s:13:"${row}[label]";s:4:"help";s:30:"the text displayed to the user";}i:2;a:2:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[label]";}}s:1:"C";a:3:{s:4:"type";s:6:"select";s:4:"size";s:3:"All";s:4:"name";s:13:"${row}[type2]";}s:1:"D";a:3:{s:4:"type";s:6:"select";s:4:"name";s:12:"{$row}[type]";s:7:"no_lang";s:1:"1";}s:1:"E";a:4:{s:4:"type";s:8:"textarea";s:4:"size";s:4:"2,30";s:4:"name";s:14:"${row}[values]";s:4:"help";s:40:"each value is a line like <id>[=<label>]";}s:1:"F";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:1:"5";s:4:"name";s:11:"${row}[len]";s:4:"help";s:63:"max length of the input [, length of the inputfield (optional)]";}i:2;a:5:{s:4:"type";s:3:"int";s:4:"size";s:6:"0,10,2";s:4:"name";s:12:"${row}[rows]";s:4:"help";s:70:"number of row for a multiline inputfield or line of a multi-select-box";s:4:"blur";s:1:"1";}}s:1:"G";a:4:{s:4:"type";s:3:"int";s:4:"size";s:4:"1,,3";s:4:"name";s:13:"${row}[order]";s:4:"help";s:45:"determines the order the fields are displayed";}s:1:"H";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:23:"delete[$row_cont[name]]";s:4:"help";s:18:"deletes this field";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Create";s:4:"name";s:21:"create$row_cont[name]";s:4:"help";s:19:"creates a new field";}}}}s:4:"rows";i:2;s:4:"cols";i:8;s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1130250309',);
|
||||
|
||||
$templ_data[] = array('name' => 'admin.customfields.fields','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:3:{s:2:"c1";s:2:"th";s:2:"c2";s:7:"row,top";s:1:"C";s:8:",!@type2";}i:1;a:8:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Name";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Label";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Subtype";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:4:"Type";}s:1:"E";a:3:{s:4:"type";s:5:"label";s:5:"label";s:7:"Options";s:4:"help";s:40:"each value is a line like <id>[=<label>]";}s:1:"F";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Length<br>Rows";}s:1:"G";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Order";}s:1:"H";a:4:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";s:5:"align";s:6:"center";s:4:"help";s:18:"deletes this field";}}i:2;a:8:{s:1:"A";a:4:{s:4:"type";s:4:"text";s:4:"size";s:5:"20,32";s:4:"name";s:12:"${row}[name]";s:4:"help";s:83:"the name used internaly (<= 20 chars), changeing it makes existing data unavailible";}s:1:"B";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:4:",255";s:4:"name";s:13:"${row}[label]";s:4:"help";s:30:"the text displayed to the user";}i:2;a:2:{s:4:"type";s:5:"label";s:4:"name";s:13:"${row}[label]";}}s:1:"C";a:4:{s:4:"type";s:6:"select";s:4:"size";s:3:"All";s:4:"name";s:13:"${row}[type2]";s:7:"no_lang";s:1:"1";}s:1:"D";a:3:{s:4:"type";s:6:"select";s:4:"name";s:12:"{$row}[type]";s:4:"help";s:19:"Type of customfield";}s:1:"E";a:4:{s:4:"type";s:8:"textarea";s:4:"size";s:4:"2,30";s:4:"name";s:14:"${row}[values]";s:4:"help";s:36:"each value is a line like id[=label]";}s:1:"F";a:4:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:4:"text";s:4:"size";s:1:"5";s:4:"name";s:11:"${row}[len]";s:4:"help";s:63:"max length of the input [, length of the inputfield (optional)]";}i:2;a:5:{s:4:"type";s:3:"int";s:4:"size";s:6:"0,10,2";s:4:"name";s:12:"${row}[rows]";s:4:"help";s:70:"number of row for a multiline inputfield or line of a multi-select-box";s:4:"blur";s:1:"1";}}s:1:"G";a:4:{s:4:"type";s:3:"int";s:4:"size";s:4:"1,,3";s:4:"name";s:13:"${row}[order]";s:4:"help";s:45:"determines the order the fields are displayed";}s:1:"H";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:1:"2";i:1;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:23:"delete[$row_cont[name]]";s:4:"help";s:18:"deletes this field";}i:2;a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Create";s:4:"name";s:21:"create$row_cont[name]";s:4:"help";s:19:"creates a new field";}}}}s:4:"rows";i:2;s:4:"cols";i:8;s:7:"options";a:0:{}}}','size' => '','style' => '','modified' => '1131454776',);
|
||||
|
||||
$templ_data[] = array('name' => 'admin.customfields.types','template' => '','lang' => '','group' => '0','version' => '1.2','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:2:{i:0;a:1:{s:1:"D";s:15:",@non_deletable";}i:1;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:4:"name";s:8:"app-name";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"- type";}s:1:"C";a:4:{s:4:"type";s:6:"select";s:4:"name";s:5:"types";s:8:"onchange";s:1:"1";s:7:"no_lang";s:1:"1";}s:1:"D";a:4:{s:4:"type";s:6:"button";s:5:"label";s:6:"Delete";s:4:"name";s:6:"delete";s:7:"onclick";s:110:"return confirm(\'WARNING: You are about to delete this type. Entries of this type won\\\'t be accessable then.\');";}s:1:"E";a:3:{s:4:"type";s:4:"text";s:4:"name";s:4:"name";s:4:"blur";s:8:"new name";}s:1:"F";a:3:{s:4:"type";s:6:"button";s:5:"label";s:6:"Create";s:4:"name";s:6:"create";}}}s:4:"rows";i:1;s:4:"cols";i:6;}}','size' => '','style' => '','modified' => '1139823458',);
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
/* $Id$ */
|
||||
|
||||
/**
|
||||
* This widget generates a template for customfields based on definitions in epgw_config table
|
||||
* This widget generates a template for customfields based on definitions in egw_config table
|
||||
*
|
||||
* @package etemplate
|
||||
* @subpackage extensions
|
||||
@ -43,6 +43,7 @@
|
||||
//merge old config_name in egw_config table
|
||||
$config_name = isset($config['customfields']) ? 'customfields' : 'custom_fields';
|
||||
$this->customfields = $config[$config_name];
|
||||
$this->types = $config['types'];
|
||||
$this->advanced_search = $GLOBALS['egw_info']['etemplate']['advanced_search'];
|
||||
|
||||
}
|
||||
@ -54,7 +55,7 @@
|
||||
// infolog compability
|
||||
if ($this->appname == 'infolog')
|
||||
{
|
||||
$typ = $value['###typ###'];
|
||||
$type2 = $value['###typ###'];
|
||||
unset($value['###typ###']);
|
||||
$this->customfields = $value;
|
||||
}
|
||||
@ -71,9 +72,9 @@
|
||||
//echo '<pre style="text-align: left;">'; print_r($value); echo "</pre>\n";
|
||||
foreach($this->customfields as $name => $field)
|
||||
{
|
||||
if (!empty($field['typ']) && $field['typ'] != $typ)
|
||||
if (!empty($field['type2']) && $field['type2'] != $type2)
|
||||
{
|
||||
continue; // not for our typ
|
||||
continue; // not for our content type
|
||||
}
|
||||
if(empty($field['type']))
|
||||
{
|
||||
|
@ -559,7 +559,7 @@
|
||||
}
|
||||
else // 1 row with 1 column/child
|
||||
{
|
||||
soetemplate::add_child($widget,soetemplate::empty_cell());
|
||||
soetemplate::add_child($widget,$cell=soetemplate::empty_cell());
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -246,13 +246,19 @@
|
||||
$cell['no_lang'] = True;
|
||||
break;
|
||||
|
||||
case 'select-account': // options: #rows,{accounts(default)|both|groups},{0(=lid)|1(default=name)|2(=lid+name))}
|
||||
case 'select-account': // options: #rows,{accounts(default)|both|groups|owngroups},{0(=lid)|1(default=name)|2(=lid+name))}
|
||||
//echo "<p>select-account widget: name=$cell[name], type='$type', rows=$rows, readonly=".(int)($cell['readonly'] || $readonlys)."</p>\n";
|
||||
if($type == 'owngroups')
|
||||
{
|
||||
$type = 'groups';
|
||||
$owngroups = true;
|
||||
foreach($GLOBALS['egw']->accounts->membership() as $group) $mygroups[] = $group['account_id'];
|
||||
}
|
||||
// in case of readonly, we read/create only the needed entries, as reading accounts is expensive
|
||||
if ($cell['readonly'] || $readonlys)
|
||||
{
|
||||
$cell['no_lang'] = True;
|
||||
foreach(is_array($value) ? $value : array($value) as $id)
|
||||
foreach(is_array($value) ? $value : (strpos($value,',') !== false ? explode(',',$value) : array($value)) as $id)
|
||||
{
|
||||
$cell['sel_options'][$id] = $this->accountInfo($id,$acc,$type2,$type=='both');
|
||||
}
|
||||
@ -287,7 +293,7 @@
|
||||
}
|
||||
foreach($accs as $acc)
|
||||
{
|
||||
if ($acc['account_type'] == 'g')
|
||||
if ($acc['account_type'] == 'g' && (!$owngroups || ($owngroups && in_array($acc['account_id'],(array)$mygroups))))
|
||||
{
|
||||
$cell['sel_options'][$acc['account_id']] = $this->accountInfo($acc['account_id'],$acc,$type2,$type=='both');
|
||||
}
|
||||
|
@ -1196,6 +1196,14 @@
|
||||
{
|
||||
$sels += $content["options-$name"];
|
||||
}
|
||||
if (empty($sels) && $cell['name']{0} = '#')
|
||||
{
|
||||
if(!is_array($this->customfields))
|
||||
{
|
||||
$this->customfields =& ExecMethod2('admin.customfields.get_customfields', $GLOBALS['egw_info']['flags']['currentapp']);
|
||||
}
|
||||
$sels = (array)$this->customfields[substr($cell['name'],1)]['values'];
|
||||
}
|
||||
if ($multiple && !is_array($value)) $value = explode(',',$value);
|
||||
if ($readonly)
|
||||
{
|
||||
@ -1425,7 +1433,7 @@
|
||||
}
|
||||
if ($extra_label && ($label != '' || $html == ''))
|
||||
{
|
||||
if (strlen($label) > 1 && !($cell['no_lang'] && $cell['label'] != $label || (int)$cell['no_lang'] == 2))
|
||||
if (strlen($label) > 1 && !$cell['no_lang'] && !($cell['label'] != $label || (int)$cell['no_lang'] == 2))
|
||||
{
|
||||
$label = lang($label);
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@
|
||||
{
|
||||
$this->contacts = createobject('phpgwapi.contacts');
|
||||
}
|
||||
$addrs = $this->contacts->read( 0,0,'',$pattern,'','DESC','org_name,n_family,n_given' );
|
||||
$addrs = $this->contacts->read( 0,0,'',$pattern,'tid=!','DESC','org_name,n_family,n_given' );
|
||||
$content = array( );
|
||||
while ($addrs && list( $key,$addr ) = each( $addrs ))
|
||||
{
|
||||
|
@ -269,7 +269,7 @@
|
||||
{
|
||||
if(!$start) { $start = 0; }
|
||||
if(!$limit) { $limit = 0; }
|
||||
if(!$filter) { $filter = 'tid=n'; }
|
||||
if(!$filter) { $filter = 'tid=n'; }
|
||||
|
||||
if (!$fields || empty($fields)) { $fields = $this->stock_contact_fields; }
|
||||
$DEBUG = 0;
|
||||
@ -329,9 +329,9 @@
|
||||
{
|
||||
$filterlist[] = $name . '=' . $value;
|
||||
}
|
||||
elseif ($value == "!''") // check for not empty
|
||||
elseif ($value == "!") // check for not empty
|
||||
{
|
||||
$filterlist[] = $name . "!=''";
|
||||
$filterlist[] = $name . " IS NOT NULL";
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -379,7 +379,6 @@
|
||||
$fand .= $filtermethod;
|
||||
}
|
||||
}
|
||||
|
||||
if(@is_array($this->grants))
|
||||
{
|
||||
$grants = $this->grants;
|
||||
@ -394,7 +393,18 @@
|
||||
{
|
||||
$fwhere .= ') '; $fand .= ') ';
|
||||
}
|
||||
|
||||
// acl enhancement
|
||||
/* $this->accounts =& CreateObject('phpgwapi.accounts');
|
||||
$groups = $this->accounts->membership();
|
||||
$gwhere = " AND (published_groups IS NULL OR CONCAT(',',published_groups,',') LIKE '%,". $groups[0]['account_id']. ",%' ";
|
||||
unset($groups[0]);
|
||||
foreach((array)$groups as $group)
|
||||
{
|
||||
$gwhere .= " OR CONCAT(',',published_groups,',') LIKE '%,". $group['account_id']. ",%'";
|
||||
}
|
||||
$gwhere .= " ) ";
|
||||
$fwhere .= $gwhere;
|
||||
$fand .= $gwhere;*/
|
||||
if ($DEBUG && $filtermethod)
|
||||
{
|
||||
echo '<br>DEBUG - Filtering with: #' . $filtermethod . '#';
|
||||
|
Loading…
Reference in New Issue
Block a user