Author: ralfbecker
Date: Mon Apr 25 17:57:38 2016
New Revision: 55832
URL: http://svn.stylite.de/viewvc/egroupware?rev=55832&view=rev
Log:
use new et2 site config
Added:
trunk/addressbook/templates/default/config.xet (with props)
Removed:
trunk/addressbook/inc/hook_config.inc.php
trunk/addressbook/templates/default/config.tpl
Modified:
trunk/addressbook/inc/class.addressbook_hooks.inc.php
trunk/addressbook/setup/setup.inc.php
trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js
Modified: trunk/addressbook/inc/class.addressbook_hooks.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/inc/class.addressbook_hooks.inc.php?rev=55832&r1=55831&r2=55832&view=diff
==============================================================================
--- trunk/addressbook/inc/class.addressbook_hooks.inc.php (original)
+++ trunk/addressbook/inc/class.addressbook_hooks.inc.php Mon Apr 25 17:57:38 2016
@@ -9,6 +9,8 @@
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
+
+use EGroupware\Api;
/**
* Class containing admin, preferences and sidebox-menus and other hooks
@@ -452,15 +454,80 @@
}
/**
- * Hook returning options for deny_acl groups
+ * Called before displaying site configuration
*
* @param array $config
- */
- public static function allow_account_edit($config)
- {
- $accountsel = new uiaccountsel();
-
- return '<input type="hidden" value="" name="newsettings[allow_account_edit]" />'.
- $accountsel->selection('newsettings[allow_account_edit]', 'allow_account_edit', $config['allow_account_edit'], 'groups', 4);
+ * @return array with additional config to merge and "sel_options" values
+ */
+ public static function config(array $config)
+ {
+ $bocontacts = new Api\Contacts();
+
+ // get the list of account fields
+ $own_account_acl = array();
+ foreach($bocontacts->contact_fields as $field => $label)
+ {
+ // some fields the user should never be allowed to edit or are covert by an other attribute (n_fn for all n_*)
+ if (!in_array($field,array('id','tid','owner','created','creator','modified','modifier','private','n_prefix','n_given','n_middle','n_family','n_suffix')))
+ {
+ $own_account_acl[$field] = $label;
+ }
+ }
+ $own_account_acl['link_to'] = 'Links';
+ if ($config['account_repository'] != 'ldap') // no custom-fields in ldap
+ {
+ foreach(Api\Storage\Customfields::get('addressbook') as $name => $data)
+ {
+ $own_account_acl['#'.$name] = $data['label'];
+ }
+ }
+
+ $org_fields = $own_account_acl;
+ unset($org_fields['n_fn'], $org_fields['account_id']);
+ // Remove country codes as an option, it will be added by BO constructor
+ unset($org_fields['adr_one_countrycode'], $org_fields['adr_two_countrycode']);
+
+ $supported_fields = $bocontacts->get_fields('supported',null,0); // fields supported by the backend (ldap schemas!)
+ // get the list of account fields
+ $copy_fields = array();
+ foreach($bocontacts->contact_fields as $field => $label)
+ {
+ // some fields the user should never be allowed to copy or are coverted by an other attribute (n_fn for all n_*)
+ if (!in_array($field,array('id','tid','created','creator','modified','modifier','account_id','uid','etag','n_fn')))
+ {
+ $copy_fields[$field] = $label;
+ }
+ }
+ if ($config['contact_repository'] != 'ldap') // no custom-fields in ldap
+ {
+ foreach(Api\Storage\Customfields::get('addressbook') as $name => $data)
+ {
+ $copy_fields['#'.$name] = $data['label'];
+ }
+ }
+ // Remove country codes as an option, it will be added by UI constructor
+ if(in_array('adr_one_countrycode', $supported_fields))
+ {
+ unset($copy_fields['adr_one_countrycode'], $copy_fields['adr_two_countrycode']);
+ }
+
+ $repositories = array('sql' => 'SQL');
+ // check account-repository, contact-repository LDAP is only availible for account-repository == ldap
+ if ($config['account_repository'] == 'ldap' || !$config['account_repository'] && $config['auth_type'] == 'ldap')
+ {
+ $repositories['ldap'] = 'LDAP';
+ $repositories['sql-ldap'] = 'SQL --> LDAP ('.lang('read only').')';
+ }
+
+ $ret = array(
+ 'sel_options' => array(
+ 'own_account_acl' => $own_account_acl,
+ 'org_fileds_to_update' => $org_fields, // typo has to stay, as it was there allways and we would loose existing config :(
+ 'copy_fields' => $copy_fields,
+ 'fileas' => $bocontacts->fileas_options(),
+ 'contact_repository' => $repositories,
+ ),
+ );
+ return $ret;
}
}
Modified: trunk/addressbook/setup/setup.inc.php
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/setup/setup.inc.php?rev=55832&r1=55831&r2=55832&view=diff
==============================================================================
--- trunk/addressbook/setup/setup.inc.php (original)
+++ trunk/addressbook/setup/setup.inc.php Mon Apr 25 17:57:38 2016
@@ -41,7 +41,7 @@
$setup_info['addressbook']['hooks']['delete_category'] = 'addressbook.addressbook_bo.delete_category';
$setup_info['addressbook']['hooks']['search_link'] = 'addressbook_hooks::search_link';
$setup_info['addressbook']['hooks']['calendar_resources'] = 'addressbook_hooks::calendar_resources';
-$setup_info['addressbook']['hooks'][] = 'config';
+$setup_info['addressbook']['hooks']['config'] = 'addressbook_hooks::config';
$setup_info['addressbook']['hooks']['group_acl'] = 'addressbook_hooks::group_acl';
$setup_info['addressbook']['hooks']['not_enum_group_acls'] = 'addressbook_hooks::not_enum_group_acls';
$setup_info['addressbook']['hooks']['export_limit'] = 'addressbook_hooks::getAppExportLimit';
Added: trunk/addressbook/templates/default/config.xet
URL: http://svn.stylite.de/viewvc/egroupware/trunk/addressbook/templates/default/config.xet?rev=55832&view=auto
==============================================================================
--- trunk/addressbook/templates/default/config.xet (added)
+++ trunk/addressbook/templates/default/config.xet Mon Apr 25 17:57:38 2016
@@ -1,0 +1,149 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE overlay PUBLIC "-//Stylite AG//eTemplate 2//EN" "http://www.egroupware.org/etemplate2.dtd">
+<!-- $Id$ -->
+<overlay>
+ <template id="addressbook.config" template="" lang="" group="0" version="16.1">
+ <grid width="100%" class="admin-config egwGridView_grid">
+ <columns>
+ <column width="60%"/>
+ <column/>
+ </columns>
+ <rows>
+ <row>
+ <description value="Telephony integration" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="URL to link telephone numbers to (use %1 = number to call, %u = account name, %t = account phone)" label="%s:"/>
+ <textbox id="newsettings[call_link]" size="40"/>
+ </row>
+ <row>
+ <description value="Size of popup (WxH, eg.400x300, if a popup should be used)" label="%s:"/>
+ <textbox id="newsettings[call_popup]" size="10"/>
+ </row>
+ <row>
+ <description value="Allow users to maintain their own account-data" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="Fields the user is allowed to edit himself"/>
+ <select id="newsettings[own_account_acl]" multiple="true" tags="true"/>
+ </row>
+ <row>
+ <description value="General" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="Use a category tree?"/>
+ <select id="newsettings[cat_tab]">
+ <option value="True">No</option>
+ <option value="Tree">Yes</option>
+ </select>
+ </row>
+ <row>
+ <description value="Update Fields by edited organisations?"/>
+ <hbox>
+ <select id="newsettings[org_fileds_to_update]" multiple="true" rows="4"/>
+ <button onclick="widget.getParent().getWidgetById('newsettings[org_fileds_to_update]').select_all_toggle();" label="Select all" image="check"/>
+ </hbox>
+ </row>
+ <row>
+ <description value="Fields to copy when copying an address?"/>
+ <hbox>
+ <select id="newsettings[copy_fields]" multiple="true" rows="4"/>
+ <button onclick="widget.getParent().getWidgetById('newsettings[copy_fields]').select_all_toggle();" label="Select all" image="check"/>
+ </hbox>
+ </row>
+ <row>
+ <description value="Use an extra tab for private custom fields?"/>
+ <select id="newsettings[private_cf_tab]">
+ <option value="">No</option>
+ <option value="True">Yes</option>
+ </select>
+ </row>
+ <row>
+ <description value="Security" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <vbox>
+ <description value="How many contacts should non-admins be able to export"/>
+ <description value="(empty = use global limit, no = no export at all)"/>
+ </vbox>
+ <textbox id="newsettings[contact_export_limit]" size="5"/>
+ </row>
+ <row>
+ <description value="Allow members of following groups to edit contact-data of accounts" label="%s:"/>
+ <select-account id="newsettings[allow_account_edit]" account_type="groups" multiple="true" tags="true" width="100%"/>
+ </row>
+ <row>
+ <description value="History logging" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="Prevent deleting of contacts"/>
+ <select id="newsettings[history]">
+ <option value="">No</option>
+ <option value="history">Yes, only admins can purge deleted items</option>
+ <option value="userpurge">Yes, users can purge their deleted items</option>
+ </select>
+ </row>
+ <row>
+ <description value="Contact maintenance" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="Set full name and file as field in contacts of all users (either all or only empty values)" label="%s:"/>
+ <hbox>
+ <select id="fileas" empty_label="Set only full name" width="70%"/>
+ <button onclick="document.location.href='index.php?menuaction=addressbook.addressbook_ui.admin_set_fileas&all=1&type='+this.form.fileas.value;" label="All"/>
+ <button onclick="document.location.href='index.php?menuaction=addressbook.addressbook_ui.admin_set_fileas&type='+this.form.fileas.value;" label="Empty"/>
+ </hbox>
+ </row>
+ <row>
+ <description value="Cleanup addressbook fields (apply if synchronization creates duplicates)" label="%s:"/>
+ <button onclick="document.location.href='index.php?menuaction=addressbook.addressbook_ui.admin_set_all_cleanup'" label="Start"/>
+ </row>
+ <row>
+ <description value="Contact repository" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="Select where you want to store / retrieve contacts" label="%s:"/>
+ <select id="newsettings[contact_repository]"/>
+ </row>
+ <row>
+ <description value="You can only use LDAP as contact repository if the accounts are stored in LDAP too!" span="all"/>
+ </row>
+ <row>
+ <description value="Account repository" label="%s:"/>
+ <hbox>
+ <description id="newsettings[account_repository]" class="subHeader"/>
+ <description value="Can be changed via Setup >> Configuration"/>
+ </hbox>
+ </row>
+ <row>
+ <description value="LDAP settings for contacts" span="all" class="subHeader"/>
+ </row>
+ <row>
+ <description value="LDAP host for contacts" label="%s:"/>
+ <textbox id="newsettings[ldap_contact_host]"/>
+ </row>
+ <row>
+ <description value="LDAP context for contacts" label="%s:"/>
+ <textbox id="newsettings[ldap_contact_context]" size="40"/>
+ </row>
+ <row>
+ <description value="Additional information about using LDAP as contact repository" class="subHeader"/>
+ <description value="README" href="/doc/ldap/README.contacts" extra_link_target="_blank"/>
+ </row>
+ <row>
+ <description value="Migration to LDAP"/>
+ <hbox>
+ <select id="migrate">
+ <option value="">Select migration type</option>
+ <option value="contacts" title="if accounts are already in LDAP">contacts to LDAP</option>
+ <option value="contacts,accounts" title="use setup for a full account-migration">contacts and account contact-data to LDAP</option>
+ <option value="contacts,accounts-back" title="for read only LDAP">contacts to LDAP, account contact-data to SQL</option>
+ <option value="sql" title="for read only LDAP">contacts and account contact-data to SQL</option>
+ </select>
+ <button onclick="if (this.form.migrate.value) document.location.href='index.php?menuaction=addressbook.addressbook_ui.migrate2ldap&type='+this.form.migrate.value;" label="Start"/>
+ </hbox>
+ </row>
+ </rows>
+ </grid>
+ </template>
+</overlay>
Propchange: trunk/addressbook/templates/default/config.xet
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/addressbook/templates/default/config.xet
------------------------------------------------------------------------------
svn:keywords = Author Date Id Rev URL
Propchange: trunk/addressbook/templates/default/config.xet
------------------------------------------------------------------------------
svn:mime-type = text/xml
Modified: trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js
URL: http://svn.stylite.de/viewvc/egroupware/trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js?rev=55832&r1=55831&r2=55832&view=diff
==============================================================================
--- trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js (original)
+++ trunk/egroupware/api/js/etemplate/et2_widget_selectbox.js Mon Apr 25 17:57:38 2016
@@ -610,6 +610,17 @@
},
/**
+ * Method to check all options of a multi-select, if not all are selected, or none if all where selected
+ *
+ * @todo: add an attribute to automatic add a button calling this method
+ */
+ select_all_toggle: function()
+ {
+ var all = jQuery("input",this.multiOptions);
+ all.prop("checked", jQuery("input:checked",this.multiOptions).length == all.length ? false : true);
+ },
+
+ /**
* Add a button to toggle between single select and multi select.
*
* @param {number} _rows How many rows for multi-select
------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.