From 2d87b71e85cc38fec045155e8b0173db1b5ff9af Mon Sep 17 00:00:00 2001 From: arnaud Date: Wed, 6 Apr 2011 23:11:30 +0200 Subject: [PATCH] custom tabs --- main/inc/banner.inc.php | 8 ++++++++ main/inc/lib/banner.lib.php | 6 ++++++ main/install/db_main.sql | 19 ++++++++++++++----- main/install/migrate-db-1.8.6.2-1.8.7-pre.sql | 10 ++++++++++ main/lang/english/admin.inc.php | 15 +++++++++++++++ main/lang/french/admin.inc.php | 16 +++++++++++++++- 6 files changed, 68 insertions(+), 6 deletions(-) diff --git a/main/inc/banner.inc.php b/main/inc/banner.inc.php index fc679f11ac..e8b975ee3f 100644 --- a/main/inc/banner.inc.php +++ b/main/inc/banner.inc.php @@ -272,6 +272,14 @@ if ($_user['user_id'] && !api_is_anonymous()) { $menu_navigation['reports'] = $possible_tabs['reports']; } + // Custom tabs + for ($i=1;$i<=3;$i++) + if (api_get_setting('show_tabs', 'custom_tab_'.$i) == 'true') { + $navigation['custom_tab_'.$i] = $possible_tabs['custom_tab_'.$i]; + } else{ + $menu_navigation['custom_tab_'.$i] = $possible_tabs['custom_tab_'.$i]; + } + // Administration if (api_is_platform_admin(true)) { if (api_get_setting('show_tabs', 'platform_administration') == 'true') { diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php index 019d568621..483109750d 100644 --- a/main/inc/lib/banner.lib.php +++ b/main/inc/lib/banner.lib.php @@ -81,6 +81,12 @@ function get_tabs() { $navigation['reports']['title'] = get_lang('Reports'); } + // Custom tabs + for ($i = 1; $i<=3; $i++) + if (api_get_setting('custom_tab_'.$i.'_name') && api_get_setting('custom_tab_'.$i.'_url')) { + $navigation['custom_tab_'.$i]['url'] = api_get_setting('custom_tab_'.$i.'_url'); + $navigation['custom_tab_'.$i]['title'] = api_get_setting('custom_tab_'.$i.'_name'); + } // Platform administration if (api_is_platform_admin(true)) { diff --git a/main/install/db_main.sql b/main/install/db_main.sql index b6dfe98366..107b42f528 100644 --- a/main/install/db_main.sql +++ b/main/install/db_main.sql @@ -777,11 +777,20 @@ VALUES ('student_page_after_login', NULL, 'textfield', 'Platform', '', 'StudentPageAfterLoginTitle', 'StudentPageAfterLoginComment', NULL, NULL, 0), ('teacher_page_after_login', NULL, 'textfield', 'Platform', '', 'TeacherPageAfterLoginTitle', 'TeacherPageAfterLoginComment', NULL, NULL, 0), ('DRH_page_after_login', NULL, 'textfield', 'Platform', '', 'DRHPageAfterLoginTitle', 'DRHPageAfterLoginComment', NULL, NULL, 0), -('sessionadmin_page_after_login', NULL, 'textfield', 'Platform', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0); -('student_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0); -('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'TeacherAutosubscribeTitle', 'TeacherAutosubscribeComment', NULL, NULL, 0); -('DRH_autosubscribe', NULL, 'textfield', 'Platform', '', 'DRHAutosubscribeTitle', 'DRHAutosubscribeComment', NULL, NULL, 0); -('sessionadmin_autosubscribe', NULL, 'textfield', 'Platform', '', 'SessionadminAutosubscribeTitle', 'SessionadminAutosubscribeComment', NULL, NULL, 0); +('sessionadmin_page_after_login', NULL, 'textfield', 'Platform', '', 'SessionAdminPageAfterLoginTitle', 'SessionAdminPageAfterLoginComment', NULL, NULL, 0), +('student_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0), +('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'TeacherAutosubscribeTitle', 'TeacherAutosubscribeComment', NULL, NULL, 0), +('DRH_autosubscribe', NULL, 'textfield', 'Platform', '', 'DRHAutosubscribeTitle', 'DRHAutosubscribeComment', NULL, NULL, 0), +('sessionadmin_autosubscribe', NULL, 'textfield', 'Platform', '', 'SessionadminAutosubscribeTitle', 'SessionadminAutosubscribeComment', NULL, NULL, 0), +('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1), +('show_tabs', 'custom_tab_2', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom2', 1), +('show_tabs', 'custom_tab_3', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom3', 1), +('custom_tab_1_name', NULL, 'textfield', 'Platform', '', 'CustomTab1NameTitle', 'CustomTab1NameComment', NULL, NULL, 0), +('custom_tab_1_url', NULL, 'textfield', 'Platform', '', 'CustomTab1URLTitle', 'CustomTab1URLComment', NULL, NULL, 0), +('custom_tab_2_name', NULL, 'textfield', 'Platform', '', 'CustomTab2NameTitle', 'CustomTab2NameComment', NULL, NULL, 0), +('custom_tab_2_url', NULL, 'textfield', 'Platform', '', 'CustomTab2URLTitle', 'CustomTab2URLComment', NULL, NULL, 0), +('custom_tab_3_name', NULL, 'textfield', 'Platform', '', 'CustomTab3NameTitle', 'CustomTab3NameComment', NULL, NULL, 0), +('custom_tab_3_url', NULL, 'textfield', 'Platform', '', 'CustomTab3URLTitle', 'CustomTab3URLComment', NULL, NULL, 0); UNLOCK TABLES; diff --git a/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql b/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql index 5edd870d06..4a9ca2f06b 100644 --- a/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql +++ b/main/install/migrate-db-1.8.6.2-1.8.7-pre.sql @@ -119,6 +119,16 @@ INSERT INTO settings_current (variable, subkey, type, category, selected_value, INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('teacher_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0); INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('DRH_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0); INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('sessionadmin_autosubscribe', NULL, 'textfield', 'Platform', '', 'StudentAutosubscribeTitle', 'StudentAutosubscribeComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_1', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom1', 1); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_2', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom2', 1); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('show_tabs', 'custom_tab_3', 'checkbox', 'Platform', 'false', 'ShowTabsTitle', 'ShowTabsComment', NULL, 'TabsCustom3', 1); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_1_name', NULL, 'textfield', 'Platform', '', 'CustomTab1NameTitle', 'CustomTab1NameComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_1_url', NULL, 'textfield', 'Platform', '', 'CustomTab1URLTitle', 'CustomTab1URLComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_2_name', NULL, 'textfield', 'Platform', '', 'CustomTab2NameTitle', 'CustomTab2NameComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_2_url', NULL, 'textfield', 'Platform', '', 'CustomTab2URLTitle', 'CustomTab2URLComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_3_name', NULL, 'textfield', 'Platform', '', 'CustomTab3NameTitle', 'CustomTab3NameComment', NULL, NULL, 0); +INSERT INTO settings_current (variable, subkey, type, category, selected_value, title, comment, scope, subkeytext, access_url_changeable) VALUES('custom_tab_3_url', NULL, 'textfield', 'Platform', '', 'CustomTab3URLTitle', 'CustomTab3URLComment', NULL, NULL, 0); + CREATE TABLE `event_type` (`id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL, `name_lang_var` varchar(40) NOT NULL, `desc_lang_var` varchar(50) NOT NULL, PRIMARY KEY (`id`)); CREATE TABLE `event_type_message` (`id` int(11) NOT NULL AUTO_INCREMENT, `event_type_id` int(11) NOT NULL,`language_id` int(11) NOT NULL, `message` varchar(200) NOT NULL, `subject` varchar(60) NOT NULL, PRIMARY KEY (`id`)); CREATE TABLE `user_rel_event_type` (`id` int(11) NOT NULL AUTO_INCREMENT, `user_id` int(11) NOT NULL, `event_type_id` int(11) NOT NULL, PRIMARY KEY (`id`)); diff --git a/main/lang/english/admin.inc.php b/main/lang/english/admin.inc.php index d0e4073d30..d971fadf48 100644 --- a/main/lang/english/admin.inc.php +++ b/main/lang/english/admin.inc.php @@ -1311,6 +1311,21 @@ $DRHAutosubscribeTitle = "Auto subscribe DRH to following courses"; $DRHAutosubscribeComment = "Course code separated by '|'"; $SessionadminAutosubscribeTitle = "Auto subscribe sessionadmin to following courses"; $SessionadminAutosubscribeComment = "Course code separated by '|'"; +$TabsCustom1 = "Custom tab 1"; +$TabsCustom2 = "Custom tab 2"; +$TabsCustom3 = "Custom tab 3"; +$CustomTab1NameTitle = "Custom tab 1 Name"; +$CustomTab2NameTitle = "Custom tab 2 Name"; +$CustomTab3NameTitle = "Custom tab 3 Name"; +$CustomTab1URLTitle = "Custom tab 1 URL"; +$CustomTab2URLTitle = "Custom tab 2 URL"; +$CustomTab3URLTitle = "Custom tab 3 URL"; +$CustomTab1NameComment = ""; +$CustomTab2NameComment = ""; +$CustomTab3NameComment = ""; +$CustomTab1URLComment = ""; +$CustomTab2URLComment = ""; +$CustomTab3URLComment = ""; $event_title = 'Events notifications manager'; $GroupParentship = 'Parent group'; $NoParentship = 'No parent group'; diff --git a/main/lang/french/admin.inc.php b/main/lang/french/admin.inc.php index a724ae7d12..ecc408781a 100644 --- a/main/lang/french/admin.inc.php +++ b/main/lang/french/admin.inc.php @@ -1288,7 +1288,21 @@ $DRHAutosubscribeTitle = "Inscrire automatiquement les DRH aux cours suivants"; $DRHAutosubscribeComment = "Codes de cours séparé par '|'"; $SessionadminAutosubscribeTitle = "Inscrire automatiquement les administrateurs de session aux cours suivants"; $SessionadminAutosubscribeComment = "Codes de cours séparé par '|'"; - +$TabsCustom1 = "Onglet personalisé 1"; +$TabsCustom2 = "Onglet personalisé 2"; +$TabsCustom3 = "Onglet personalisé 3"; +$CustomTab1NameTitle = "Nom de l'onglet personalisé 1"; +$CustomTab2NameTitle = "Nom de l'onglet personalisé 2"; +$CustomTab3NameTitle = "Nom de l'onglet personalisé 3"; +$CustomTab1URLTitle = "URL de l'onglet personalisé 1"; +$CustomTab2URLTitle = "URL de l'onglet personalisé 2"; +$CustomTab3URLTitle = "URL de l'onglet personalisé 3"; +$CustomTab1NameComment = ""; +$CustomTab2NameComment = ""; +$CustomTab3NameComment = ""; +$CustomTab1URLComment = ""; +$CustomTab2URLComment = ""; +$CustomTab3URLComment = ""; $events_title = 'Gestion des évenements'; $GroupParentship = 'Groupe parent'; $NoParentship = 'Aucun groupe parent';