From 27b8cd01b92254aaa09a6db378b301c008b9745b Mon Sep 17 00:00:00 2001 From: Hubert Borderiou Date: Fri, 9 Nov 2012 09:39:14 +0100 Subject: [PATCH] Add a plugin to enable/disable and change behaviour of logout button, if you use external authentication --- .../index.php | 39 +++++++++++++++ .../plugin.php | 48 +++++++++++++++++++ .../readme.txt | 15 ++++++ .../template.tpl | 12 +++++ 4 files changed, 114 insertions(+) create mode 100755 plugin/ext_auth_chamilo_logout_button_behaviour/index.php create mode 100755 plugin/ext_auth_chamilo_logout_button_behaviour/plugin.php create mode 100755 plugin/ext_auth_chamilo_logout_button_behaviour/readme.txt create mode 100755 plugin/ext_auth_chamilo_logout_button_behaviour/template.tpl diff --git a/plugin/ext_auth_chamilo_logout_button_behaviour/index.php b/plugin/ext_auth_chamilo_logout_button_behaviour/index.php new file mode 100755 index 0000000000..5da0e9b154 --- /dev/null +++ b/plugin/ext_auth_chamilo_logout_button_behaviour/index.php @@ -0,0 +1,39 @@ +Plugins) + * @package chamilo.plugin + * @author Julio Montoya + */ +/** + * Plugin details (must be present) + */ + + +//the plugin title +$plugin_info['title'] = 'Enable or disable logout button'; + +//the comments that go with the plugin +$plugin_info['comment'] = "If you use some other authentication than local Chamilo authentication, you may have to disable the Chamilo logout button and give users information about your SSO logout."; +//the plugin version +$plugin_info['version'] = '1.0'; +//the plugin author +$plugin_info['author'] = 'Hubert Borderiou'; +//the plugin configuration +$form = new FormValidator('eaclbb_form'); +$form->addElement("html", "
Fill the text boxes below to overwrite the default values used in this plugin
"); +$form->addElement('text', 'eaclbb_form_link_url', 'Page to load when clicking on the logout button'); +$form->addElement('text', 'eaclbb_form_link_infobulle', 'Tooltip text for the logout button (displayed on mouseover)'); +$form->addElement('checkbox', 'eaclbb_form_link_image', "Display the logout button disabled (black and white)", "", array('checked' => true)); +$form->addElement('checkbox', 'eaclbb_form_alert_onoff', "Display an alert when clicking on the logout button", "", array('checked' => true)); +$form->addElement('text', 'eaclbb_form_alert_text', "Text displayed in the alert box when clickng on the logout button (if checkbox above has been checked)."); + +$form->addElement('style_submit_button', 'submit_button', get_lang('Save')); +//get default value for form +$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url'); +$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle'); +$Tab_Default_Ext_Auth_Chamilo_Logout_Button_Behaviour_Eaclbb_Form_Link_Image = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image'); +$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff'); +$tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text = api_get_setting('ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text'); +$defaults['eaclbb_form_link_url'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_url['eaclbb_form_link_url']; +$defaults['eaclbb_form_link_infobulle'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_infobulle['eaclbb_form_link_infobulle']; +$defaults['eaclbb_form_link_image'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_link_image['eaclbb_form_link_image']; +$defaults['eaclbb_form_alert_onoff'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_onoff['eaclbb_form_alert_onoff']; +$defaults['eaclbb_form_alert_text'] = $tab_default_ext_auth_chamilo_logout_button_behaviour_eaclbb_form_alert_text['eaclbb_form_alert_text']; +$form->setDefaults($defaults); +//display form +$plugin_info['settings_form'] = $form; + +//set the smarty templates that are going to be used +$plugin_info['templates'] = array('template.tpl'); diff --git a/plugin/ext_auth_chamilo_logout_button_behaviour/readme.txt b/plugin/ext_auth_chamilo_logout_button_behaviour/readme.txt new file mode 100755 index 0000000000..d5a5b13eeb --- /dev/null +++ b/plugin/ext_auth_chamilo_logout_button_behaviour/readme.txt @@ -0,0 +1,15 @@ +README +

+If you use some other authentication than local Chamilo authentication, you may want to disable the Chamilo logout button and display information about your SSO logout.
+With this plugin, you can
+- change the logout URL of the button
+- disable the logout button
+- display it in grey style
+- change the button tooltip on mouseover
+- add an alert message if user click on the button
+
+Related plugins
+Add a button to login using CAS
+Add a button to logout from CAS
+Add a button to login using FACEBOOK account
+Add a button to login using Shibboleth
diff --git a/plugin/ext_auth_chamilo_logout_button_behaviour/template.tpl b/plugin/ext_auth_chamilo_logout_button_behaviour/template.tpl new file mode 100755 index 0000000000..c9352e9f4a --- /dev/null +++ b/plugin/ext_auth_chamilo_logout_button_behaviour/template.tpl @@ -0,0 +1,12 @@ +{% if ext_auth_chamilo_logout_button_behaviour.show_message %} + +{% endif %}