From 1a01f33308bd49005e5c579c22d83ec5cd1b43f4 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Sat, 3 May 2003 22:23:50 +0000 Subject: [PATCH] account-display is now configurable via the prefs: - Firstname Lastname (default) - Lastname, Firstname - username - Lastname, Firstname --- phpgwapi/inc/class.common.inc.php | 39 ++++++++++++++------------- preferences/inc/hook_settings.inc.php | 9 +++++++ preferences/setup/phpgw_de.lang | 2 ++ preferences/setup/phpgw_en.lang | 2 ++ 4 files changed, 33 insertions(+), 19 deletions(-) diff --git a/phpgwapi/inc/class.common.inc.php b/phpgwapi/inc/class.common.inc.php index b91ccfd34b..5c2ff63d73 100644 --- a/phpgwapi/inc/class.common.inc.php +++ b/phpgwapi/inc/class.common.inc.php @@ -410,35 +410,36 @@ $lastname = $GLOBALS['phpgw_info']['user']['lastname']; } - if ($firstname) - { - $a[] = $firstname; - } + $display = $GLOBALS['phpgw_info']['user']['preferences']['common']['account_display']; + if (!$firstname && !$lastname || $display == 'username') + { + return $lid; + } if ($lastname) { $a[] = $lastname; } - if(isset($a)) + if ($firstname) { - switch(count($a)) - { - case 0: - return $lid; - break; - case 1: - return $a[0] . ' <' . $lid . '>'; - break; - case 2: - return $a[0] . ' ' . $a[1] .' <' . $lid . '>'; //implode(', ',$a); - break; - } + $a[] = $firstname; } - else + + switch($display) { - return $lid; + case 'all': + $name = "<$lid> "; + // fall-through + case 'lastname': + $name .= implode(', ',$a); + break; + case 'firstname': + default: + $name = $firstname . ' ' . $lastname; + break; } + return $name; } /*! diff --git a/preferences/inc/hook_settings.inc.php b/preferences/inc/hook_settings.inc.php index c63e575939..3956973e69 100755 --- a/preferences/inc/hook_settings.inc.php +++ b/preferences/inc/hook_settings.inc.php @@ -124,5 +124,14 @@ create_select_box('How do you like to select accounts','account_selection',$account_sels, 'The selectbox shows all available users (can be very slow on big installs with many users). The popup can search users by name or group.'); + $account_display = array( + 'firstname' => lang('Firstname'). ' '.lang('Lastname'), + 'lastname' => lang('Lastname').', '.lang('Firstname'), + 'username' => lang('username'), + 'all' => '<'.lang('username').'> '.lang('Lastname').', '.lang('Firstname') + ); + create_select_box('How do you like to display accounts','account_display',$account_display, + 'Set this to your convenience. For security reasons, you might not want to show your Loginname in public.'); + create_check_box('Show helpmessages by default','show_help', 'Should this help messages shown up always, when you enter the preferences or only on request.'); diff --git a/preferences/setup/phpgw_de.lang b/preferences/setup/phpgw_de.lang index 4a647eeb57..5158a65c97 100644 --- a/preferences/setup/phpgw_de.lang +++ b/preferences/setup/phpgw_de.lang @@ -24,6 +24,7 @@ error: there was a problem finding the preference file for %1 in %2 preferences forced preferences preferences de Erzwungene Einstellungen help off preferences de Keine Hilfe hours preferences de Stunden +how do you like to display accounts preferences de Wie sollen Benutzer angezeigt werden how do you like to select accounts preferences de Wie sollen Benutzer ausgewählt werden how many hours are you in front or after the timezone of the server.
if you are in the same time zone as the server select 0 hours, else select your locale date and time. preferences de Wieviele Stunden sind sie vor der Zeitzone des Servers.
Wenn sie in der gleichen Zeitzone wie der Server sind, wählen sie 0 Stunden, ansonsten wählen sie ihr lokales Datum und die Uhrzeit. how should phpgroupware display dates for you. preferences de Wie soll phpGroupWare das Datum für sie anzeigen? @@ -43,6 +44,7 @@ select different theme preferences de anderes Schema w select one preferences de Bitte wählen select the language of texts and messages within phpgroupware.
some languages may not contain all messages, in that case you will see an english message. preferences de Wählen sie die Sprache der Texte und Mitteilungen innerhalb der phpGroupWare.
Machne Sprachen enthalten evtl. nicht alle Texte, in diesem Fall wird der Englische Text angezeigt. selectbox preferences de Auswahlfeld +set this to your convenience. for security reasons, you might not want to show your loginname in public. preferences de Stellen sie das nach ihren Vorlieben ein. Aus Sicherheitsgründen sollte der Benutzername nicht in der Öffentlichkeit gezeigt werden. should the number of active sessions be displayed for you all the time. preferences de Soll die Anzahl aktiver Sitzungen permanent für sie angezeigt werden. should this help messages shown up always, when you enter the preferences or only on request. preferences de Sollen die Hilfetexte immer angezeigt werden, wenn sie die Einstellungen aufrufen oder nur auf Anforderung. show helpmessages by default preferences de Hilfetexte standardmässig anzeigen diff --git a/preferences/setup/phpgw_en.lang b/preferences/setup/phpgw_en.lang index 3710593233..aa443d2a84 100644 --- a/preferences/setup/phpgw_en.lang +++ b/preferences/setup/phpgw_en.lang @@ -24,6 +24,7 @@ error: there was a problem finding the preference file for %1 in %2 preferences forced preferences preferences en Forced Preferences help off preferences en Help off hours preferences en hours +how do you like to display accounts preferences en How do you like to display accounts how do you like to select accounts preferences en How do you like to select accounts how many hours are you in front or after the timezone of the server.
if you are in the same time zone as the server select 0 hours, else select your locale date and time. preferences en How many hours are you in front or after the timezone of the server.
If you are in the same time zone as the server select 0 hours, else select your locale date and time. how should phpgroupware display dates for you. preferences en How should phpGroupWare display dates for you. @@ -42,6 +43,7 @@ select different theme preferences en Select different Theme select one preferences en Select one select the language of texts and messages within phpgroupware.
some languages may not contain all messages, in that case you will see an english message. preferences en Select the language of texts and messages within phpGroupWare.
Some languages may not contain all messages, in that case you will see an english message. selectbox preferences en Selectbox +set this to your convenience. for security reasons, you might not want to show your loginname in public. preferences en Set this to your convenience. For security reasons, you might not want to show your Loginname in public. should the number of active sessions be displayed for you all the time. preferences en Should the number of active sessions be displayed for you all the time. should this help messages shown up always, when you enter the preferences or only on request. preferences en Should this help messages shown up always, when you enter the preferences or only on request. show helpmessages by default preferences en Show helpmessages by default