forked from extern/egroupware
- fixed not readonly custom fields, give all tabs equal height and adjusted height of phone numbers
- removed custom field specific history log code, as it's handled now by historylog-widget and bo_tracking
This commit is contained in:
parent
7705b25ece
commit
9859a038af
@ -47,13 +47,6 @@ class addressbook_tracking extends bo_tracking
|
||||
var $field2history = array(
|
||||
);
|
||||
|
||||
/**
|
||||
* Translate field name to label
|
||||
*/
|
||||
public $field2label = array(
|
||||
// Custom fields added in constructor
|
||||
);
|
||||
|
||||
/**
|
||||
* Should the user (passed to the track method or current user if not passed) be used as sender or get_config('sender')
|
||||
*
|
||||
@ -64,37 +57,34 @@ class addressbook_tracking extends bo_tracking
|
||||
* Instance of the bocontacts class calling us
|
||||
*
|
||||
* @access private
|
||||
* @var bocontacts
|
||||
* @var addressbook_bo
|
||||
*/
|
||||
var $contacts;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param bocontacts &$bocontacts
|
||||
* @param addressbook_bo $bocontacts
|
||||
* @return tracker_tracking
|
||||
*/
|
||||
function __construct(&$bocontacts)
|
||||
function __construct(addressbook_bo $bocontacts)
|
||||
{
|
||||
parent::__construct(); // calling the constructor of the extended class
|
||||
|
||||
$this->contacts =& $bocontacts;
|
||||
$this->contacts = $bocontacts;
|
||||
|
||||
if (is_object($bocontacts->somain) && is_array($bocontacts->somain->db_cols))
|
||||
{
|
||||
$this->field2history = array_combine($bocontacts->somain->db_cols, $bocontacts->somain->db_cols);
|
||||
|
||||
// no need to store these
|
||||
unset($this->field2history['modified']);
|
||||
unset($this->field2history['modifier']);
|
||||
unset($this->field2history['etag']);
|
||||
|
||||
// we currently can only track text
|
||||
unset($this->field2history['jpegphoto']);
|
||||
}
|
||||
$custom = config::get_customfields('addressbook', true);
|
||||
if(is_array($custom)) {
|
||||
foreach($custom as $name => $settings) {
|
||||
$this->field2history['#'.$name] = '#'.$name;
|
||||
$this->field2label['#'.$name] = $settings['label'];
|
||||
}
|
||||
}
|
||||
// custom fields are now handled by parent::__construct('addressbook')
|
||||
parent::__construct('addressbook');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -148,15 +138,17 @@ class addressbook_tracking extends bo_tracking
|
||||
*/
|
||||
protected function save_history(array $data,array $old=null,$deleted=null,array $changed_fields=null)
|
||||
{
|
||||
if (is_null($changed_fields))
|
||||
{
|
||||
$changed_fields = self::changed_fields($data,$old);
|
||||
}
|
||||
if (!$changed_fields) return 0;
|
||||
if (is_null($changed_fields))
|
||||
{
|
||||
$changed_fields = self::changed_fields($data,$old);
|
||||
}
|
||||
if (!$changed_fields) return 0;
|
||||
|
||||
foreach(array('adr_one_countryname' => 'adr_one_countrycode', 'adr_two_countryname' => 'adr_two_countrycode') as $name => $code)
|
||||
{
|
||||
// Only codes involved, but old text name is automatically added when loaded
|
||||
if($old[$code] && $data[$code]) {
|
||||
if($old[$code] && $data[$code])
|
||||
{
|
||||
unset($changed_fields[array_search($name, $changed_fields)]);
|
||||
continue;
|
||||
}
|
||||
@ -164,7 +156,8 @@ class addressbook_tracking extends bo_tracking
|
||||
// Code and a text name
|
||||
if(in_array($name, $changed_fields) && in_array($code, $changed_fields))
|
||||
{
|
||||
if($data[$code]) {
|
||||
if($data[$code])
|
||||
{
|
||||
$data[$name] = $GLOBALS['egw']->country->get_full_name($data[$code], true);
|
||||
}
|
||||
unset($changed_fields[array_search($code, $changed_fields)]);
|
||||
|
@ -1869,12 +1869,16 @@ class addressbook_ui extends addressbook_bo
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
// make everything not explicit mentioned readonly
|
||||
$readonlys['__ALL__'] = true;
|
||||
$readonlys['photo'] = $readonlys['button[cancel]'] = $readonlys['button[copy]'] =
|
||||
$readonlys['button[ok]'] = $readonlys['button[more]'] = false;
|
||||
|
||||
foreach(array_keys($this->contact_fields) as $key)
|
||||
{
|
||||
$readonlys[$key] = true;
|
||||
if (in_array($key,array('tel_home','tel_work','tel_cell','tel_fax')))
|
||||
{
|
||||
$readonlys[$key.'2'] = true;
|
||||
$content[$key.'2'] = $content[$key];
|
||||
}
|
||||
}
|
||||
@ -1895,13 +1899,9 @@ class addressbook_ui extends addressbook_bo
|
||||
{
|
||||
$content['link_to']['show_deleted'] = true;
|
||||
}
|
||||
$readonlys['link_to'] = $readonlys['customfields'] = $readonlys['fileas_type'] = true;
|
||||
$readonlys['button[save]'] = $readonlys['button[apply]'] = $readonlys['change_photo'] = true;
|
||||
$readonlys['button[delete]'] = !$content['owner'] || !$this->check_perms(EGW_ACL_DELETE,$content);
|
||||
$readonlys['button[edit]'] = !$this->check_perms(EGW_ACL_EDIT,$content);
|
||||
$content['disable_change_org'] = true;
|
||||
// ToDo: fix vCard export
|
||||
$readonlys['button[vcard]'] = true;
|
||||
|
||||
// how to display addresses
|
||||
$content['addr_format'] = $this->addr_format_by_country($content['adr_one_countryname']);
|
||||
@ -2478,30 +2478,7 @@ class addressbook_ui extends addressbook_bo
|
||||
$content['history']['status-widgets']['tid'][$id] = $settings['name'];
|
||||
}
|
||||
$sel_options['status'] = $this->contact_fields;
|
||||
foreach($this->tracking->field2label as $field => $label)
|
||||
{
|
||||
$sel_options['status'][$field] = lang($label);
|
||||
}
|
||||
|
||||
// Get custom field options
|
||||
$custom = config::get_customfields('addressbook', true);
|
||||
if(is_array($custom))
|
||||
{
|
||||
foreach($custom as $name => $settings)
|
||||
{
|
||||
if(!is_array($settings['values']))
|
||||
{
|
||||
$content['history']['status-widgets']['#'.$name] = $settings['type'];
|
||||
}
|
||||
elseif($settings['values']['@'])
|
||||
{
|
||||
$content['history']['status-widgets']['#'.$name] = customfields_widget::_get_options_from_file($settings['values']['@']);
|
||||
}
|
||||
elseif(count($settings['values']))
|
||||
{
|
||||
$content['history']['status-widgets']['#'.$name] = $settings['values'];
|
||||
}
|
||||
}
|
||||
}
|
||||
// custom fields no longer need to be added, historylog-widget "knows" about them
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -51,7 +51,7 @@
|
||||
border-bottom: #9c9c9c 1px solid;
|
||||
}
|
||||
fieldset.phoneGroup {
|
||||
margin-top: 14px;
|
||||
margin-top: 12px;
|
||||
font-size: 110%;
|
||||
height: 140px;
|
||||
border: solid black 2px;
|
||||
@ -61,7 +61,7 @@ fieldset.phoneGroup {
|
||||
height: 122px;
|
||||
}
|
||||
fieldset.emailGroup {
|
||||
margin-top: 4px;
|
||||
margin-top: 10px;
|
||||
font-size: 110%;
|
||||
height: 112px;
|
||||
border: solid black 2px;
|
||||
|
@ -53,7 +53,7 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.general" template="" lang="" group="0" version="1.5.002">
|
||||
<template id="addressbook.edit.general" template="" lang="" group="0" version="1.9.002">
|
||||
<grid height="286">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -72,6 +72,7 @@
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row>
|
||||
@ -82,15 +83,18 @@
|
||||
<description/>
|
||||
<template id="addressbook.edit.name"/>
|
||||
<description/>
|
||||
<description/>
|
||||
</row>
|
||||
<row>
|
||||
<description options=",,,title" value="Title"/>
|
||||
<textbox size="36" maxlength="64" id="title" span="2"/>
|
||||
<description/>
|
||||
</row>
|
||||
<row>
|
||||
<description options=",,,role" value="Role"/>
|
||||
<textbox size="20" maxlength="64" id="role"/>
|
||||
<textbox size="5" label="Room" id="room"/>
|
||||
<description/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
@ -128,8 +132,9 @@
|
||||
<description value="country" options=",,,adr_one_countryname"/>
|
||||
<hbox options="0,0">
|
||||
<menulist class="countrySelect">
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_one_countryname"/>
|
||||
<menupopup type="select-country" options="Select one,0,1" id="adr_one_countrycode" onchange="show_custom_country(this);"/>
|
||||
</menulist>
|
||||
<textbox id="adr_one_countryname" class="custom_country"/>
|
||||
<textbox class="leftPad5" size="19" maxlength="64" id="adr_one_region" statustext="State"/>
|
||||
</hbox>
|
||||
</row>
|
||||
@ -145,9 +150,12 @@
|
||||
<row disabled="!@addr_format=city_state_postcode">
|
||||
<description/>
|
||||
<description value="country" options=",,,adr_one_countryname"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_one_countryname"/>
|
||||
</menulist>
|
||||
<hbox options="0,0">
|
||||
<menulist class="countrySelect">
|
||||
<menupopup type="select-country" options="Select one,0,1" id="adr_one_countrycode" onchange="show_custom_country(this);"/>
|
||||
</menulist>
|
||||
<textbox id="adr_one_countryname" class="custom_country"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row valign="bottom" height="25">
|
||||
<image src="private.png"/>
|
||||
@ -159,8 +167,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.cats" template="" lang="" group="0" version="1.4.001">
|
||||
<grid width="100%" height="258" overflow="auto">
|
||||
<template id="addressbook.edit.cats" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
@ -177,8 +185,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.home" template="" lang="" group="0" version="1.3.003">
|
||||
<grid height="258">
|
||||
<template id="addressbook.edit.home" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
@ -208,8 +216,9 @@
|
||||
<description value="country" options=",,,adr_two_countryname"/>
|
||||
<hbox options="0,0">
|
||||
<menulist class="countrySelect">
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_two_countryname"/>
|
||||
<menupopup type="select-country" options="Select one,0,1" id="adr_two_countrycode" onchange="show_custom_country(this);"/>
|
||||
</menulist>
|
||||
<textbox id="adr_two_countryname" class="custom_country"/>
|
||||
<textbox class="leftPad5" size="19" maxlength="64" id="adr_two_region" statustext="State"/>
|
||||
</hbox>
|
||||
</row>
|
||||
@ -225,9 +234,12 @@
|
||||
<row disabled="!@addr_format2=city_state_postcode">
|
||||
<description/>
|
||||
<description value="Country"/>
|
||||
<menulist>
|
||||
<menupopup type="select-country" options="Select one,1" id="adr_two_countryname"/>
|
||||
</menulist>
|
||||
<hbox options="0,0">
|
||||
<menulist class="countrySelect">
|
||||
<menupopup type="select-country" options="Select one,0,1" id="adr_two_countrycode" onchange="show_custom_country(this);"/>
|
||||
</menulist>
|
||||
<textbox id="adr_two_countryname" class="custom_country"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row height="30">
|
||||
<image src="gear"/>
|
||||
@ -247,8 +259,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.details" template="" lang="" group="0" version="1.5.001">
|
||||
<grid width="100%" height="258" overflow="auto">
|
||||
<template id="addressbook.edit.details" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
<column/>
|
||||
@ -305,8 +317,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.links" template="" lang="" group="0" version="1.3.001">
|
||||
<grid width="100%" height="258" overflow="auto">
|
||||
<template id="addressbook.edit.links" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
@ -326,8 +338,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.distribution_list" template="" lang="" group="0" version="1.5.001">
|
||||
<grid width="100%" height="258" overflow="auto">
|
||||
<template id="addressbook.edit.distribution_list" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
@ -350,8 +362,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.custom" template="" lang="" group="0" version="1.5.002">
|
||||
<grid width="100%" height="258" class="row_on" spacing="0" padding="0" overflow="auto">
|
||||
<template id="addressbook.edit.custom" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" class="row_on" spacing="0" padding="0" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
@ -365,8 +377,8 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.custom_private" template="" lang="" group="0" version="1.5.002">
|
||||
<grid width="100%" height="258" class="row_on" spacing="0" padding="0" overflow="auto">
|
||||
<template id="addressbook.edit.custom_private" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286" class="row_on" spacing="0" padding="0" overflow="auto">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
@ -380,6 +392,18 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.edit.history" template="" lang="" group="0" version="1.9.001">
|
||||
<grid width="100%" height="286">
|
||||
<columns>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row valign="top">
|
||||
<historylog id="history"/>
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="addressbook.editphones" template="" lang="" group="0" version="1.5.001">
|
||||
<grid class="editphones">
|
||||
<columns>
|
||||
@ -508,6 +532,7 @@
|
||||
<tab label="Distribution lists" statustext="Distribution lists, ..."/>
|
||||
<tab label="Extra" statustext="Custom fields"/>
|
||||
<tab label="Extra private" statustext="Private custom fields"/>
|
||||
<tab label="History" statustext=""/>
|
||||
</tabs>
|
||||
<tabpanels>
|
||||
<template id="addressbook.edit.general"/>
|
||||
@ -518,6 +543,7 @@
|
||||
<template id="addressbook.edit.distribution_list"/>
|
||||
<template id="addressbook.edit.custom"/>
|
||||
<template id="addressbook.edit.custom_private"/>
|
||||
<template id="addressbook.edit.history"/>
|
||||
</tabpanels>
|
||||
</tabbox>
|
||||
<vbox>
|
||||
|
Loading…
Reference in New Issue
Block a user