From d5e39013c690f371fd338794289a473134e67910 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Wed, 2 Mar 2011 09:13:16 +0000 Subject: [PATCH] * preference for open application tabs of Stylite template set, allowing to set a default or even force them --- jdots/hook_settings.inc.php | 29 ++++++++++++++++++++ jdots/inc/class.jdots_framework.inc.php | 35 +++++++++++++++++++------ 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/jdots/hook_settings.inc.php b/jdots/hook_settings.inc.php index d30ca2b39a..80197c0bd3 100644 --- a/jdots/hook_settings.inc.php +++ b/jdots/hook_settings.inc.php @@ -10,6 +10,24 @@ * @version $Id$ */ +$apps = $no_navbar_apps = array(); +if (!$hook_data['setup']) // does not work on setup time +{ + foreach(ExecMethod('jdots.jdots_framework.navbar_apps') as $app => $data) + { + if (!$data['noNavbar']) + { + $apps[$app] = $data['title']; + } + else + { + $no_navbar_apps[$app] = $data['title']; + } + } + $apps += $no_navbar_apps; + unset($app); unset($data); +} + /** * Stylite jdots template */ @@ -39,5 +57,16 @@ $GLOBALS['settings'] = array( 'admin' => false, 'default'=> '0', ), + 'open_tabs' => array( + 'type' => 'multiselect', + 'label' => 'Open application tabs', + 'name' => 'open_tabs', + 'values' => $apps, + 'help' => 'Allows to set a default or force the open application tabs.', + 'xmlrpc' => True, + 'admin' => False, + 'default' => 'addressbook,calendar', + ), 'navbar_format' => false, // not used in JDots (defined in common prefs) ); +unset($apps); diff --git a/jdots/inc/class.jdots_framework.inc.php b/jdots/inc/class.jdots_framework.inc.php index 90d0054a74..975953c178 100755 --- a/jdots/inc/class.jdots_framework.inc.php +++ b/jdots/inc/class.jdots_framework.inc.php @@ -768,10 +768,6 @@ class jdots_framework extends egw_framework /** * Prepare an array with apps used to render the navbar * - * @param string $url contains the current url on the client side. It is used to - * determine whether the default app/home should be opened on the client - * or whether a specific application-url has been given. - * * @return array of array( * 'name' => app / directory name * 'title' => translated application title @@ -780,12 +776,9 @@ class jdots_framework extends egw_framework * 'icon_app' => application of icon * 'icon_hover' => hover-icon, if used by template * 'target'=> ' target="..."' attribute fragment to open url in target, popup or '' - * 'opened' => unset or false if the tab should not be opened, otherwise the numeric position in the tab list - * 'active' => true if this tab should be the active one when it is restored, otherwise unset or false - * 'openOnce' => unset or the url which will be opened when the tab is restored * ) */ - public function ajax_navbar_apps($url) + public function navbar_apps() { $apps = parent::_get_navbar_apps(); @@ -806,6 +799,32 @@ class jdots_framework extends egw_framework { unset($apps['sitemgr-link']); } + return $apps; + } + + /** + * Prepare an array with apps used to render the navbar + * + * @param string $url contains the current url on the client side. It is used to + * determine whether the default app/home should be opened on the client + * or whether a specific application-url has been given. + * + * @return array of array( + * 'name' => app / directory name + * 'title' => translated application title + * 'url' => url to call for index + * 'icon' => icon name + * 'icon_app' => application of icon + * 'icon_hover' => hover-icon, if used by template + * 'target'=> ' target="..."' attribute fragment to open url in target, popup or '' + * 'opened' => unset or false if the tab should not be opened, otherwise the numeric position in the tab list + * 'active' => true if this tab should be the active one when it is restored, otherwise unset or false + * 'openOnce' => unset or the url which will be opened when the tab is restored + * ) + */ + public function ajax_navbar_apps($url) + { + $apps = $this->navbar_apps(); // open tab for default app, if no other tab is set if (!($default_app = $GLOBALS['egw_info']['user']['preferences']['common']['default_app']))