Add plugin : loggin button for Shibboleth authentification.

skala
Hubert Borderiou 13 years ago
parent d667c55921
commit 3f4d0a0b08
  1. 12
      plugin/add_shibboleth_login_button/css.css
  2. 21
      plugin/add_shibboleth_login_button/index.php
  3. 43
      plugin/add_shibboleth_login_button/plugin.php
  4. 6
      plugin/add_shibboleth_login_button/readme.txt
  5. 15
      plugin/add_shibboleth_login_button/template.tpl

@ -0,0 +1,12 @@
.shibboleth_plugin_image {
float:left;
height:50px;
margin: 0px 5px 5px 0px;
}
.shibboleth_plugin_comm {
font-style:italic;
}
.shibboleth_plugin_clear {
clear:both;
height:1px;
}

@ -0,0 +1,21 @@
<?php
// Show the Shibboleth button to login using SHIBBOLETH
$_template['show_message'] = false;
if (api_is_anonymous()) {
$_template['show_message'] = true;
// the default title
$button_label = "Connexion via Shibboleth";
if (!empty($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label'])) {
$button_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_label']);
}
// the comm
$comm_label = api_htmlentities($plugin_info['settings']['add_shibboleth_login_button_shibboleth_button_comment']);;
// URL of the image
$url_label = $plugin_info['settings']['add_shibboleth_login_button_shibboleth_image_url'];
$_template['button_label'] = $button_label;
$_template['comm_label'] = $comm_label;
$_template['url_label'] = $url_label;
}

@ -0,0 +1,43 @@
<?php
/**
* This script is a configuration file for the date plugin. You can use it as a master for other platform plugins (course plugins are slightly different).
* These settings will be used in the administration interface for plugins (Chamilo configuration settings->Plugins)
* @package chamilo.plugin
* @author Julio Montoya <gugli100@gmail.com>
*/
/**
* Plugin details (must be present)
*/
//the plugin title
$plugin_info['title'] = 'Add a button to login using Shibboleth';
//the comments that go with the plugin
$plugin_info['comment'] = "If Shibboleth is configured, this plugin add a text and a button on the login page to login with Shibboleth. Configure plugin to add title, comment and logo.";
//the plugin version
$plugin_info['version'] = '1.0';
//the plugin author
$plugin_info['author'] = 'Hubert Borderiou';
//the plugin configuration
$form = new FormValidator('add_shibboleth_button_form');
$form->addElement('text', 'shibboleth_button_label', 'shibboleth connexion title', '');
$form->addElement('text', 'shibboleth_button_comment', 'shibboleth connexion description', '');
$form->addElement('text', 'shibboleth_image_url', 'Logo URL if any (image, 50px height)');
$form->addElement('style_submit_button', 'submit_button', get_lang('Save'));
//get default value for form
$tab_default_add_shibboleth_login_button_shibboleth_button_label = api_get_setting('add_shibboleth_login_button_shibboleth_button_label');
$tab_default_add_shibboleth_login_button_shibboleth_button_comment = api_get_setting('add_shibboleth_login_button_shibboleth_button_comment');
$tab_default_add_shibboleth_login_button_shibboleth_image_url = api_get_setting('add_shibboleth_login_button_shibboleth_image_url');
$defaults = array();
$defaults['shibboleth_button_label'] = $tab_default_add_shibboleth_login_button_shibboleth_button_label['add_shibboleth_login_button'];
$defaults['shibboleth_button_comment'] = $tab_default_add_shibboleth_login_button_shibboleth_button_comment['add_shibboleth_login_button'];
$defaults['shibboleth_image_url'] = $tab_default_add_shibboleth_login_button_shibboleth_image_url['add_shibboleth_login_button'];
$form->setDefaults($defaults);
//display form
$plugin_info['settings_form'] = $form;
//set the templates that are going to be used
$plugin_info['templates'] = array('template.tpl');

@ -0,0 +1,6 @@
README
<br/><br/>
This plugin add a button to allow user to login to Chamilo with Shibboleth authentification.<br/><br/>
You have to configure your Shibboleth connexion before use this plugin.<br/>
To activate and configure Shibboleth, for your Chamilo platform, go to Administration > Configuration settings > Shibboleth<br/>
This plugin has been done to be added in the login_top region, but you can put it where you want.<br/>

@ -0,0 +1,15 @@
{% if add_shibboleth_login_button.show_message %}
<link href="{$_p.web_plugin}/add_shibboleth_login_button/css.css" rel="stylesheet" type="text/css">
<div class="well">
{% if add_shibboleth_login_button.url_label %}
<img src="{{add_shibboleth_login_button.url_label}}" class='shibboleth_plugin_image'/>
{% endif %}
<h4>{{add_shibboleth_login_button.button_label}}</h4>
{% if add_shibboleth_login_button.url_label %}
<div class='shibboleth_plugin_clear'>&nbsp;</div>
{% endif %}
<div class='shibboleth_plugin_comm'>{{add_shibboleth_login_button.comm_label}}</div>
<button class="btn" onclick="javascript:self.location.href='main/auth/shibboleth/login.php'">{{"LoginEnter"|get_lang}}</button>
</div>
{% endif %}
Loading…
Cancel
Save