2006-04-23 16:40:31 +02:00
< ? php
2006-06-13 23:53:00 +02:00
/**
* Addressbook - admin , preferences and sidebox - menus
*
* @ link http :// www . egroupware . org
* @ 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
* @ version $Id $
*/
2006-04-23 16:40:31 +02:00
/**
* Class containing admin , preferences and sidebox - menus ( used as 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
{
2006-06-13 23:53:00 +02:00
var $contact_repository = 'sql' ;
2006-04-23 16:40:31 +02:00
/**
* constructor
*/
function contacts_admin_prefs ()
{
2006-06-13 23:53:00 +02:00
if ( $GLOBALS [ 'egw_info' ][ 'server' ][ 'contact_repository' ] == 'ldap' ) $this -> contact_repository = 'ldap' ;
2006-04-23 16:40:31 +02:00
}
/**
* hooks to build projectmanager ' s sidebox - menu plus the admin and preferences sections
*
* @ param string / array $args hook args
*/
function all_hooks ( $args )
{
$appname = 'addressbook' ;
$location = is_array ( $args ) ? $args [ 'location' ] : $args ;
//echo "<p>contacts_admin_prefs::all_hooks(".print_r($args,True).") appname='$appname', location='$location'</p>\n";
if ( $location == 'sidebox_menu' )
{
$file = array (
array (
'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\ ' );
return false ; " >'.lang('Add').'</a>',
'no_lang' => true ,
'link' => false
),
2006-10-24 21:20:37 +02:00
array (
2006-10-21 22:17:49 +02:00
'text' => '<a class="textSidebox" href="' . $GLOBALS [ 'egw' ] -> link ( '/index.php' , array (
2006-10-24 21:20:37 +02:00
'menuaction' => 'addressbook.uicontacts.search' ,)) .
2006-10-31 08:56:34 +01:00
' " onclick= " window . open ( this . href , \ ' advanced_search\ ' , \ ' dependent = yes , width = 850 , height = 480 , scrollbars = yes , status = yes\ ' );
2006-10-21 22:17:49 +02:00
return false ; " >'.lang('Advanced search').'</a>',
'no_lang' => true ,
'link' => false
2006-10-24 21:20:37 +02:00
),
2006-04-23 16:40:31 +02:00
// Disabled til they are working again
// 'import contacts' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.import'),
2006-04-30 11:34:24 +02:00
// 'export contacts' => $GLOBALS['egw']->link('/index.php','menuaction=addressbook.uiXport.export'),
2006-04-26 23:23:38 +02:00
'CSV-Import' => $GLOBALS [ 'egw' ] -> link ( '/addressbook/csv_import.php' )
2006-04-23 16:40:31 +02:00
);
display_sidebox ( $appname , lang ( 'Addressbook menu' ), $file );
}
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'preferences' ] && $location != 'admin' )
{
$file = array (
'Preferences' => $GLOBALS [ 'egw' ] -> link ( '/index.php' , 'menuaction=preferences.uisettings.index&appname=' . $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' )
);
2006-06-13 23:53:00 +02:00
if ( $this -> contact_repository == 'ldap' || $GLOBALS [ 'egw_info' ][ 'server' ][ 'deny_user_grants_access' ])
2006-04-23 16:40:31 +02:00
{
unset ( $file [ 'Grant Access' ]);
}
if ( $location == 'preferences' )
{
display_section ( $appname , $file );
}
else
{
display_sidebox ( $appname , lang ( 'Preferences' ), $file );
}
}
if ( $GLOBALS [ 'egw_info' ][ 'user' ][ 'apps' ][ 'admin' ] && $location != 'preferences' )
{
$file = Array (
'Site configuration' => $GLOBALS [ 'egw' ] -> link ( '/index.php' , array (
'menuaction' => 'admin.uiconfig.index' ,
'appname' => $appname ,
)),
'Global Categories' => $GLOBALS [ 'egw' ] -> link ( '/index.php' , array (
'menuaction' => 'admin.uicategories.index' ,
'appname' => $appname ,
2006-06-17 20:50:07 +02:00
'global_cats' => True ,
2006-04-23 16:40:31 +02:00
)),
);
2006-06-17 20:50:07 +02:00
// custom fields are not availible in LDAP
if ( $GLOBALS [ 'egw_info' ][ 'server' ][ 'contact_repository' ] != 'ldap' )
{
$file [ 'Custom fields' ] = $GLOBALS [ 'egw' ] -> link ( '/index.php' , array (
'menuaction' => 'admin.customfields.edit' ,
'appname' => $appname ,
));
}
2006-04-23 16:40:31 +02:00
if ( $location == 'admin' )
{
display_section ( $appname , $file );
}
else
{
display_sidebox ( $appname , lang ( 'Admin' ), $file );
}
}
}
/**
* populates $GLOBALS [ 'settings' ] for the preferences
*/
function settings ()
{
2006-10-07 11:17:30 +02:00
$GLOBALS [ 'settings' ][ 'add_default' ] = array (
'type' => 'select' ,
'label' => 'Default addressbook for adding contacts' ,
'name' => 'add_default' ,
'help' => 'Which addressbook should be selected when adding a contact AND you have no add rights to the current addressbook.' ,
'values' => ExecMethod ( 'addressbook.uicontacts.get_addressbooks' , EGW_ACL_ADD ),
'xmlrpc' => True ,
'admin' => False ,
);
2006-04-23 16:40:31 +02:00
$GLOBALS [ 'settings' ][ 'mainscreen_showbirthdays' ] = array (
2006-06-11 19:26:54 +02:00
'type' => 'select' ,
2006-04-23 16:40:31 +02:00
'label' => 'Show birthday reminders on main screen' ,
'name' => 'mainscreen_showbirthdays' ,
2006-06-11 19:26:54 +02:00
'help' => 'Displays a remider for birthdays on the startpage (page you get when you enter eGroupWare or click on the homepage icon).' ,
'values' => array (
0 => lang ( 'No' ),
1 => lang ( 'Yes, for today and tomorrow' ),
3 => lang ( 'Yes, for the next three days' ),
7 => lang ( 'Yes, for the next week' ),
14 => lang ( 'Yes, for the next two weeks' ),
),
2006-04-23 16:40:31 +02:00
'xmlrpc' => True ,
'admin' => False ,
);
2007-03-07 13:31:48 +01:00
$GLOBALS [ 'settings' ][ 'no_auto_hide' ] = array (
'type' => 'check' ,
'label' => 'Don\'t hide empty columns' ,
'name' => 'no_auto_hide' ,
'help' => 'Should the columns photo and home address always be displayed, even if they are empty.' ,
'xmlrpc' => True ,
'admin' => false ,
2006-04-23 16:40:31 +02:00
);
2006-04-26 23:23:38 +02:00
// CSV Export
$GLOBALS [ 'settings' ][ 'csv_fields' ] = array (
'type' => 'select' ,
'label' => 'Fields for the CSV export' ,
'name' => 'csv_fields' ,
'values' => array (
'' => lang ( 'All' ),
'business' => lang ( 'Business 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.' ,
'xmlrpc' => True ,
'admin' => false ,
);
$GLOBALS [ 'settings' ][ 'csv_charset' ] = array (
'type' => 'select' ,
'label' => 'Charset for the CSV export' ,
'name' => 'csv_charset' ,
'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.' ,
'xmlrpc' => True ,
'admin' => false ,
);
2006-06-13 23:53:00 +02:00
if ( $this -> contact_repository == 'sql' )
2006-04-23 16:40:31 +02:00
{
$GLOBALS [ 'settings' ][ 'private_addressbook' ] = array (
'type' => 'check' ,
'label' => 'Enable an extra private addressbook' ,
'name' => 'private_addressbook' ,
'help' => 'Do you want a private addressbook, which can not be viewed by users, you grant access to your personal addressbook?' ,
'xmlrpc' => True ,
'admin' => False ,
);
}
2006-10-19 10:50:25 +02:00
$GLOBALS [ 'settings' ][ 'link_title' ] = array (
'type' => 'select' ,
'label' => 'Link title for contacts show' ,
'name' => 'link_title' ,
'values' => array (
'n_fileas' => lang ( 'own sorting' ) . ' (' . lang ( 'default' ) . ': ' . lang ( 'Company' ) . ': ' . lang ( 'lastname' ) . ', ' . lang ( 'firstname' ) . ')' ,
'org_name: n_family, n_given' => lang ( 'Company' ) . ': ' . 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, 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!' ,
'xmlrpc' => True ,
'admin' => false ,
);
2007-04-15 15:06:21 +02:00
//show accounts in listing
$GLOBALS [ 'settings' ][ 'hide_accounts' ] = array (
'type' => 'check' ,
'label' => 'Hide accounts from addressbook' ,
'name' => 'hide_accounts' ,
2007-04-30 17:18:29 +02:00
'help' => 'Hides accounts completly from the adressbook.' ,
2007-04-15 15:06:21 +02:00
'xmlrpc' => True ,
'admin' => false ,
);
2006-04-23 16:40:31 +02:00
return true ; // otherwise prefs say it cant find the file ;-)
}
/**
* add an Addressbook tab to Admin >> Edit user
*/
function edit_user ()
{
global $menuData ;
$menuData [] = array (
'description' => 'Addressbook' ,
'url' => '/index.php' ,
'extradata' => 'menuaction=addressbook.uicontacts.edit' ,
'options' => " onclick= \" window.open(this,'_blank','dependent=yes,width=850,height=440,scrollbars=yes,status=yes'); return false; \" " .
' title="' . htmlspecialchars ( lang ( 'Edit extra account-data in the addressbook' )) . '"' ,
);
}
}