mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-10-06 10:12:46 +02:00
using static methods for the hooks (you need to update addressbook or call Admin >> Register hooks!)
This commit is contained in:
parent
4ecce4f5ae
commit
684d6551f2
@ -1,41 +1,26 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* Addressbook - admin, preferences and sidebox-menus
|
* Addressbook - admin, preferences and sidebox-menus and other hooks
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
||||||
* @copyright (c) 2006 by Ralf Becker <RalfBecker@outdoor-training.de>
|
* @copyright (c) 2006-8 by Ralf Becker <RalfBecker@outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class containing admin, preferences and sidebox-menus (used as hooks)
|
* Class containing admin, preferences and sidebox-menus and other hooks
|
||||||
*
|
|
||||||
* @package addressbook
|
|
||||||
* @author Ralf Becker <RalfBecker@outdoor-training.de>
|
|
||||||
* @copyright (c) 2006 by Ralf Becker <RalfBecker@outdoor-training.de>
|
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
|
||||||
*/
|
*/
|
||||||
class contacts_admin_prefs
|
class addressbook_hooks
|
||||||
{
|
{
|
||||||
var $contact_repository = 'sql';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* constructor
|
|
||||||
*/
|
|
||||||
function contacts_admin_prefs()
|
|
||||||
{
|
|
||||||
if($GLOBALS['egw_info']['server']['contact_repository'] == 'ldap') $this->contact_repository = 'ldap';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
|
* hooks to build projectmanager's sidebox-menu plus the admin and preferences sections
|
||||||
*
|
*
|
||||||
* @param string/array $args hook args
|
* @param string/array $args hook args
|
||||||
*/
|
*/
|
||||||
function all_hooks($args)
|
static function all_hooks($args)
|
||||||
{
|
{
|
||||||
$appname = 'addressbook';
|
$appname = 'addressbook';
|
||||||
$location = is_array($args) ? $args['location'] : $args;
|
$location = is_array($args) ? $args['location'] : $args;
|
||||||
@ -46,7 +31,7 @@ class contacts_admin_prefs
|
|||||||
$file = array(
|
$file = array(
|
||||||
array(
|
array(
|
||||||
'text' => '<a class="textSidebox" href="'.$GLOBALS['egw']->link('/index.php',array('menuaction' => 'addressbook.uicontacts.edit')).
|
'text' => '<a class="textSidebox" href="'.$GLOBALS['egw']->link('/index.php',array('menuaction' => 'addressbook.uicontacts.edit')).
|
||||||
'" onclick="window.open(this.href,\'_blank\',\'dependent=yes,width=850,height=440,scrollbars=yes,status=yes\');
|
'" onclick="window.open(this.href,\'_blank\',\'dependent=yes,width=850,height=440,scrollbars=yes,status=yes\');
|
||||||
return false;">'.lang('Add').'</a>',
|
return false;">'.lang('Add').'</a>',
|
||||||
'no_lang' => true,
|
'no_lang' => true,
|
||||||
'link' => false
|
'link' => false
|
||||||
@ -54,7 +39,7 @@ class contacts_admin_prefs
|
|||||||
array(
|
array(
|
||||||
'text' => '<a class="textSidebox" href="'.$GLOBALS['egw']->link('/index.php',array(
|
'text' => '<a class="textSidebox" href="'.$GLOBALS['egw']->link('/index.php',array(
|
||||||
'menuaction' => 'addressbook.uicontacts.search',)).
|
'menuaction' => 'addressbook.uicontacts.search',)).
|
||||||
'" onclick="window.open(this.href,\'advanced_search\',\'dependent=yes,width=850,height=480,scrollbars=yes,status=yes\');
|
'" onclick="window.open(this.href,\'advanced_search\',\'dependent=yes,width=850,height=480,scrollbars=yes,status=yes\');
|
||||||
return false;">'.lang('Advanced search').'</a>',
|
return false;">'.lang('Advanced search').'</a>',
|
||||||
'no_lang' => true,
|
'no_lang' => true,
|
||||||
'link' => false
|
'link' => false
|
||||||
@ -71,7 +56,7 @@ class contacts_admin_prefs
|
|||||||
'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
|
'Grant Access' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uiaclprefs.index&acl_app='.$appname),
|
||||||
'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
|
'Edit Categories' => $GLOBALS['egw']->link('/index.php','menuaction=preferences.uicategories.index&cats_app=' . $appname . '&cats_level=True&global_cats=True')
|
||||||
);
|
);
|
||||||
if ($this->contact_repository == 'ldap' || $GLOBALS['egw_info']['server']['deny_user_grants_access'])
|
if ($GLOBALS['egw_info']['server']['contact_repository'] == 'ldap' || $GLOBALS['egw_info']['server']['deny_user_grants_access'])
|
||||||
{
|
{
|
||||||
unset($file['Grant Access']);
|
unset($file['Grant Access']);
|
||||||
}
|
}
|
||||||
@ -117,11 +102,11 @@ class contacts_admin_prefs
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* populates $GLOBALS['settings'] for the preferences
|
* populates $GLOBALS['settings'] for the preferences
|
||||||
*/
|
*/
|
||||||
function settings()
|
static function settings()
|
||||||
{
|
{
|
||||||
$GLOBALS['settings']['add_default'] = array(
|
$GLOBALS['settings']['add_default'] = array(
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
@ -164,7 +149,7 @@ class contacts_admin_prefs
|
|||||||
'all' => lang('All'),
|
'all' => lang('All'),
|
||||||
'business' => lang('Business address'),
|
'business' => lang('Business address'),
|
||||||
'home' => lang('Home address'),
|
'home' => lang('Home address'),
|
||||||
),
|
),
|
||||||
'help' => 'Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.',
|
'help' => 'Which fields should be exported. All means every field stored in the addressbook incl. the custom fields. The business or home address only contains name, company and the selected address.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -173,13 +158,13 @@ class contacts_admin_prefs
|
|||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'label' => 'Charset for the CSV export',
|
'label' => 'Charset for the CSV export',
|
||||||
'name' => 'csv_charset',
|
'name' => 'csv_charset',
|
||||||
'values' => $GLOBALS['egw']->translation->get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'),
|
'values' => $GLOBALS['egw']->translation->get_installed_charsets()+array('utf-8' => 'utf-8 (Unicode)'),
|
||||||
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
|
'help' => 'Which charset should be used for the CSV export. The system default is the charset of this eGroupWare installation.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
);
|
);
|
||||||
|
|
||||||
if ($this->contact_repository == 'sql')
|
if ($GLOBALS['egw_info']['server']['contact_repository'] != 'ldap')
|
||||||
{
|
{
|
||||||
$GLOBALS['settings']['private_addressbook'] = array(
|
$GLOBALS['settings']['private_addressbook'] = array(
|
||||||
'type' => 'check',
|
'type' => 'check',
|
||||||
@ -200,7 +185,7 @@ class contacts_admin_prefs
|
|||||||
'org_name, org_unit: n_family, n_given' => lang('Company').', '.lang('Department').': '.lang('lastname').', '.lang('firstname'),
|
'org_name, org_unit: n_family, n_given' => lang('Company').', '.lang('Department').': '.lang('lastname').', '.lang('firstname'),
|
||||||
'org_name, adr_one_locality: n_family, n_given' => lang('Company').', '.lang('City').': '.lang('lastname').', '.lang('firstname'),
|
'org_name, adr_one_locality: n_family, n_given' => lang('Company').', '.lang('City').': '.lang('lastname').', '.lang('firstname'),
|
||||||
'org_name, org_unit, adr_one_locality: n_family, n_given' => lang('Company').', '.lang('Department').', '.lang('City').': '.lang('lastname').', '.lang('firstname'),
|
'org_name, org_unit, adr_one_locality: n_family, n_given' => lang('Company').', '.lang('Department').', '.lang('City').': '.lang('lastname').', '.lang('firstname'),
|
||||||
),
|
),
|
||||||
'help' => 'What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!',
|
'help' => 'What should links to the addressbook display in other applications. Empty values will be left out. You need to log in anew, if you change this setting!',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -212,7 +197,7 @@ class contacts_admin_prefs
|
|||||||
'values' => array(
|
'values' => array(
|
||||||
'postcode_city' => lang('zip code').' '.lang('City'),
|
'postcode_city' => lang('zip code').' '.lang('City'),
|
||||||
'city_state_postcode' => lang('City').' '.lang('State').' '.lang('zip code'),
|
'city_state_postcode' => lang('City').' '.lang('State').' '.lang('zip code'),
|
||||||
),
|
),
|
||||||
'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.',
|
'help' => 'Which address format should the addressbook use for countries it does not know the address format. If the address format of a country is known, it uses it independent of this setting.',
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => false,
|
'admin' => false,
|
||||||
@ -248,7 +233,7 @@ class contacts_admin_prefs
|
|||||||
'name' => 'default_document',
|
'name' => 'default_document',
|
||||||
'help' => lang('If you specify a document (full vfs path) here, addressbook displays an extra document icon for each address. That icon allows to download the specified document with the contact data inserted.').' '.
|
'help' => lang('If you specify a document (full vfs path) here, addressbook displays an extra document icon for each address. That icon allows to download the specified document with the contact data inserted.').' '.
|
||||||
lang('The document can contain placeholder like $$n_fn$$, to be replaced with the contact data (%1full list of placeholder names%2).','<a href="'.$link.'" target="_blank">','</a>').' '.
|
lang('The document can contain placeholder like $$n_fn$$, to be replaced with the contact data (%1full list of placeholder names%2).','<a href="'.$link.'" target="_blank">','</a>').' '.
|
||||||
lang('At the moment the following document-types are supported:').'*.rtf, *.txt',
|
lang('At the moment the following document-types are supported:').'*.rtf, *.txt',
|
||||||
'run_lang' => false,
|
'run_lang' => false,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
@ -260,11 +245,11 @@ class contacts_admin_prefs
|
|||||||
'name' => 'document_dir',
|
'name' => 'document_dir',
|
||||||
'help' => lang('If you specify a directory (full vfs path) here, addressbook displays an action for each document. That action allows to download the specified document with the contact data inserted.').' '.
|
'help' => lang('If you specify a directory (full vfs path) here, addressbook displays an action for each document. That action allows to download the specified document with the contact data inserted.').' '.
|
||||||
lang('The document can contain placeholder like $$n_fn$$, to be replaced with the contact data (%1full list of placeholder names%2).','<a href="'.$link.'" target="_blank">','</a>').' '.
|
lang('The document can contain placeholder like $$n_fn$$, to be replaced with the contact data (%1full list of placeholder names%2).','<a href="'.$link.'" target="_blank">','</a>').' '.
|
||||||
lang('At the moment the following document-types are supported:').'*.rtf, *.txt',
|
lang('At the moment the following document-types are supported:').'*.rtf, *.txt',
|
||||||
'run_lang' => false,
|
'run_lang' => false,
|
||||||
'xmlrpc' => True,
|
'xmlrpc' => True,
|
||||||
'admin' => False,
|
'admin' => False,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return true; // otherwise prefs say it cant find the file ;-)
|
return true; // otherwise prefs say it cant find the file ;-)
|
||||||
}
|
}
|
||||||
@ -272,7 +257,7 @@ class contacts_admin_prefs
|
|||||||
/**
|
/**
|
||||||
* add an Addressbook tab to Admin >> Edit user
|
* add an Addressbook tab to Admin >> Edit user
|
||||||
*/
|
*/
|
||||||
function edit_user()
|
static function edit_user()
|
||||||
{
|
{
|
||||||
global $menuData;
|
global $menuData;
|
||||||
|
|
||||||
@ -284,4 +269,43 @@ class contacts_admin_prefs
|
|||||||
' title="'.htmlspecialchars(lang('Edit extra account-data in the addressbook')).'"',
|
' title="'.htmlspecialchars(lang('Edit extra account-data in the addressbook')).'"',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Hook called by link-class to include calendar in the appregistry of the linkage
|
||||||
|
*
|
||||||
|
* @param array/string $location location and other parameters (not used)
|
||||||
|
* @return array with method-names
|
||||||
|
*/
|
||||||
|
static function search_link($location)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'query' => 'addressbook.bocontacts.link_query',
|
||||||
|
'title' => 'addressbook.bocontacts.link_title',
|
||||||
|
'titles' => 'addressbook.bocontacts.link_titles',
|
||||||
|
'view' => array(
|
||||||
|
'menuaction' => 'addressbook.uicontacts.view'
|
||||||
|
),
|
||||||
|
'view_id' => 'contact_id',
|
||||||
|
'add' => array(
|
||||||
|
'menuaction' => 'addressbook.uicontacts.edit'
|
||||||
|
),
|
||||||
|
'add_app' => 'link_app',
|
||||||
|
'add_id' => 'link_id',
|
||||||
|
'add_popup' => '850x440',
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register contacts as calendar resources (items which can be sheduled by the calendar)
|
||||||
|
*
|
||||||
|
* @param array $args hook-params (not used)
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
static function calendar_resources($args)
|
||||||
|
{
|
||||||
|
return array(
|
||||||
|
'type' => 'c',// one char type-identifiy for this resources
|
||||||
|
'info' => 'addressbook.bocontacts.calendar_info',// info method, returns array with id, type & name for a given id
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
@ -10,7 +10,7 @@
|
|||||||
/* Basic information about this app */
|
/* Basic information about this app */
|
||||||
$setup_info['addressbook']['name'] = 'addressbook';
|
$setup_info['addressbook']['name'] = 'addressbook';
|
||||||
$setup_info['addressbook']['title'] = 'Addressbook';
|
$setup_info['addressbook']['title'] = 'Addressbook';
|
||||||
$setup_info['addressbook']['version'] = '1.5';
|
$setup_info['addressbook']['version'] = '1.5.001';
|
||||||
$setup_info['addressbook']['app_order'] = 4;
|
$setup_info['addressbook']['app_order'] = 4;
|
||||||
$setup_info['addressbook']['enable'] = 1;
|
$setup_info['addressbook']['enable'] = 1;
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ $setup_info['addressbook']['description'] =
|
|||||||
'Contact manager with Vcard support.<br />
|
'Contact manager with Vcard support.<br />
|
||||||
Always have your address book available for updates or look ups from anywhere. <br />
|
Always have your address book available for updates or look ups from anywhere. <br />
|
||||||
Share address book contact information with others. <br />
|
Share address book contact information with others. <br />
|
||||||
Link contacts to calendar events or InfoLog entires like phonecalls.<br />
|
Link contacts to calendar events or InfoLog entires like phonecalls.<br />
|
||||||
Addressbook is the eGroupWare default contact application. <br />
|
Addressbook is the eGroupWare default contact application. <br />
|
||||||
It stores contact information via SQL or LDAP and provides contact services via the eGroupWare API.';
|
It stores contact information via SQL or LDAP and provides contact services via the eGroupWare API.';
|
||||||
|
|
||||||
@ -30,15 +30,15 @@ $setup_info['addressbook']['maintainer_email'] = 'egroupware-developers@lists.so
|
|||||||
$setup_info['addressbook']['tables'] = array(); // addressbook tables are in the API!
|
$setup_info['addressbook']['tables'] = array(); // addressbook tables are in the API!
|
||||||
|
|
||||||
/* The hooks this app includes, needed for hooks registration */
|
/* The hooks this app includes, needed for hooks registration */
|
||||||
$setup_info['addressbook']['hooks']['admin'] = 'addressbook.contacts_admin_prefs.all_hooks';
|
$setup_info['addressbook']['hooks']['admin'] = 'addressbook_hooks::all_hooks';
|
||||||
$setup_info['addressbook']['hooks']['preferences'] = 'addressbook.contacts_admin_prefs.all_hooks';
|
$setup_info['addressbook']['hooks']['preferences'] = 'addressbook_hooks::all_hooks';
|
||||||
$setup_info['addressbook']['hooks']['sidebox_menu'] = 'addressbook.contacts_admin_prefs.all_hooks';
|
$setup_info['addressbook']['hooks']['sidebox_menu'] = 'addressbook_hooks::all_hooks';
|
||||||
$setup_info['addressbook']['hooks']['settings'] = 'addressbook.contacts_admin_prefs.settings';
|
$setup_info['addressbook']['hooks']['settings'] = 'addressbook_hooks::settings';
|
||||||
$setup_info['addressbook']['hooks'][] = 'home';
|
$setup_info['addressbook']['hooks'][] = 'home';
|
||||||
$setup_info['addressbook']['hooks']['deleteaccount'] = 'addressbook.bocontacts.deleteaccount';
|
$setup_info['addressbook']['hooks']['deleteaccount'] = 'addressbook.bocontacts.deleteaccount';
|
||||||
$setup_info['addressbook']['hooks']['search_link'] = 'addressbook.bocontacts.search_link';
|
$setup_info['addressbook']['hooks']['search_link'] = 'addressbook_hooks::search_link';
|
||||||
$setup_info['addressbook']['hooks']['calendar_resources'] = 'addressbook.bocontacts.calendar_resources';
|
$setup_info['addressbook']['hooks']['calendar_resources'] = 'addressbook_hooks::calendar_resources';
|
||||||
$setup_info['addressbook']['hooks']['edit_user'] = 'addressbook.contacts_admin_prefs.edit_user';
|
$setup_info['addressbook']['hooks']['edit_user'] = 'addressbook_hooks::edit_user';
|
||||||
$setup_info['addressbook']['hooks'][] = 'config';
|
$setup_info['addressbook']['hooks'][] = 'config';
|
||||||
|
|
||||||
/* Dependencies for this app to work */
|
/* Dependencies for this app to work */
|
||||||
|
Loading…
Reference in New Issue
Block a user