aboutsummaryrefslogtreecommitdiff
path: root/mod/openid_client/views/default
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-11-09 16:25:34 +0100
committerSem <sembrestels@riseup.net>2013-11-09 16:25:34 +0100
commit2161e2335c9c650b8e44a56f6c9b0bd37546ae1f (patch)
tree91bef55b773a7a80b5f6a065411574bdbe9fe522 /mod/openid_client/views/default
parenta9ac4c861335e60373c1e99b61372e6e0d6ac9f4 (diff)
parent11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc (diff)
downloadelgg-2161e2335c9c650b8e44a56f6c9b0bd37546ae1f.tar.gz
elgg-2161e2335c9c650b8e44a56f6c9b0bd37546ae1f.tar.bz2
Add 'mod/openid_client/' from commit '11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc'
git-subtree-dir: mod/openid_client git-subtree-mainline: a9ac4c861335e60373c1e99b61372e6e0d6ac9f4 git-subtree-split: 11ea6ae4734a0e722c6ecaaee90e9ab772e8d2cc
Diffstat (limited to 'mod/openid_client/views/default')
-rw-r--r--mod/openid_client/views/default/core/account/login_box.php24
-rw-r--r--mod/openid_client/views/default/core/account/login_dropdown.php31
-rw-r--r--mod/openid_client/views/default/forms/openid_client/login.php43
-rw-r--r--mod/openid_client/views/default/forms/openid_client/register.php71
-rw-r--r--mod/openid_client/views/default/openid_client/css.php13
-rw-r--r--mod/openid_client/views/default/openid_client/icon.php8
-rw-r--r--mod/openid_client/views/default/openid_client/js.php26
-rw-r--r--mod/openid_client/views/default/openid_client/register.php11
8 files changed, 227 insertions, 0 deletions
diff --git a/mod/openid_client/views/default/core/account/login_box.php b/mod/openid_client/views/default/core/account/login_box.php
new file mode 100644
index 000000000..51b13398b
--- /dev/null
+++ b/mod/openid_client/views/default/core/account/login_box.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg login box
+ *
+ * @package Elgg
+ * @subpackage Core
+ *
+ * @uses $vars['module'] The module name. Default: aside
+ * @override views/default/core/account/login_box.php
+ */
+
+$module = elgg_extract('module', $vars, 'aside');
+
+$login_url = elgg_get_site_url();
+if (elgg_get_config('https_login')) {
+ $login_url = str_replace("http:", "https:", $login_url);
+}
+
+$title = elgg_echo('login');
+$body = elgg_view_form('login', array('action' => "{$login_url}action/login"));
+$body .= elgg_view_form('openid_client/login', array('class' => 'elgg-form-login hidden'), array());
+$body .= elgg_view('openid_client/icon');
+
+echo elgg_view_module($module, $title, $body);
diff --git a/mod/openid_client/views/default/core/account/login_dropdown.php b/mod/openid_client/views/default/core/account/login_dropdown.php
new file mode 100644
index 000000000..c3add2924
--- /dev/null
+++ b/mod/openid_client/views/default/core/account/login_dropdown.php
@@ -0,0 +1,31 @@
+<?php
+/**
+ * Elgg drop-down login form
+ *
+ * @override views/default/core/account/login_dropdown.php
+ */
+
+if (elgg_is_logged_in()) {
+ return true;
+}
+
+$login_url = elgg_get_site_url();
+if (elgg_get_config('https_login')) {
+ $login_url = str_replace("http:", "https:", elgg_get_site_url());
+}
+
+$body = elgg_view_form('login', array('action' => "{$login_url}action/login"), array('returntoreferer' => TRUE));
+$body .= elgg_view_form('openid_client/login', array('class' => 'elgg-form-login hidden'), array());
+$body .= elgg_view('openid_client/icon');
+?>
+<div id="login-dropdown">
+ <?php
+ echo elgg_view('output/url', array(
+ 'href' => 'login#login-dropdown-box',
+ 'rel' => 'popup',
+ 'class' => 'elgg-button elgg-button-dropdown',
+ 'text' => elgg_echo('login'),
+ ));
+ echo elgg_view_module('dropdown', '', $body, array('id' => 'login-dropdown-box'));
+ ?>
+</div>
diff --git a/mod/openid_client/views/default/forms/openid_client/login.php b/mod/openid_client/views/default/forms/openid_client/login.php
new file mode 100644
index 000000000..1f440dc49
--- /dev/null
+++ b/mod/openid_client/views/default/forms/openid_client/login.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * OpenID login if username or full url required
+ */
+
+$options_values = array_flip(elgg_get_config('openid_providers'));
+$options_values['others'] = elgg_echo('openid_client:others');
+
+?>
+<div>
+<label><?php echo elgg_echo('openid_client:login:header'); ?></label>
+<br />
+<?php
+echo elgg_view('input/dropdown', array(
+ 'name' => 'openid_provider',
+ 'options_values' => $options_values,
+));
+?>
+</div>
+
+<div class="openid-client-url hidden">
+<label><?php echo elgg_echo('openid_client:url'); ?> </label>
+
+<?php
+echo elgg_view('input/text', array('name' => 'openid_url', 'class' => 'mbs'));
+?>
+
+</div>
+
+<div class="elgg-foot">
+ <label class="mtm float-alt">
+ <input type="checkbox" name="persistent" value="true" />
+ <?php echo elgg_echo('user:persistent'); ?>
+ </label>
+
+ <?php echo elgg_view('input/submit', array('value' => elgg_echo('login'))); ?>
+
+ <?php
+ if (isset($vars['returntoreferer'])) {
+ echo elgg_view('input/hidden', array('name' => 'returntoreferer', 'value' => 'true'));
+ }
+ ?>
+</div> \ No newline at end of file
diff --git a/mod/openid_client/views/default/forms/openid_client/register.php b/mod/openid_client/views/default/forms/openid_client/register.php
new file mode 100644
index 000000000..6044f0f0b
--- /dev/null
+++ b/mod/openid_client/views/default/forms/openid_client/register.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * OpenID register form body
+ *
+ * @uses $vars['openid_identifier']
+ * @uses $vars['username']
+ * @uses $vars['is_username_available']
+ * @uses $vars['is_username_valid']
+ * @uses $vars['email']
+ * @uses $vars['is_email_available']
+ * @uses $vars['name']
+ */
+
+$username_label = elgg_echo('username');
+$username_warning = '';
+if (!elgg_extract('is_username_available', $vars, true)) {
+ $username_warning = elgg_echo('openid_client:warning:username_not_available', array($vars['username']));
+ $username_warning = "($username_warning)";
+} else if (!elgg_extract('is_username_valid', $vars, true)) {
+ $username_warning = elgg_echo('openid_client:warning:username_valid', array($vars['username']));
+ $username_warning = "($username_warning)";
+}
+$username_input = elgg_view('input/text', array(
+ 'name' => 'username',
+ 'value' => $vars['username'],
+));
+
+$name_label = elgg_echo('name');
+$name_input = elgg_view('input/text', array(
+ 'name' => 'name',
+ 'value' => $vars['name'],
+));
+
+$email_label = elgg_echo('email');
+$email_available = elgg_extract('is_email_available', $vars, true);
+$email_warning = '';
+if (!$email_available) {
+ $email_warning = elgg_echo('openid_client:warning:email_not_available', array($vars['email']));
+ $email_warning = "($email_warning)";
+}
+$email_input = elgg_view('input/email', array(
+ 'name' => 'email',
+ 'value' => $vars['email'],
+ 'readonly' => $email_available,
+));
+
+$openid_input = elgg_view('input/hidden', array(
+ 'name' => 'openid_identifier',
+ 'value' => $vars['openid_identifier'],
+));
+$button = elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+echo <<<HTML
+<div>
+ <label>$username_label</label> $username_warning
+ $username_input
+</div>
+<div>
+ <label>$name_label</label>
+ $name_input
+</div>
+<div>
+ <label>$email_label</label> $email_warning
+ $email_input
+</div>
+<div class="elgg-foot">
+ $openid_input
+ $button
+</div>
+
+HTML;
diff --git a/mod/openid_client/views/default/openid_client/css.php b/mod/openid_client/views/default/openid_client/css.php
new file mode 100644
index 000000000..d01fc6b5a
--- /dev/null
+++ b/mod/openid_client/views/default/openid_client/css.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * OpenID client CSS
+ */
+?>
+
+.elgg-icon-openid {
+ background-image: url(<?php echo elgg_get_site_url(); ?>mod/openid_client/graphics/openid_icon.png);
+}
+
+.elgg-form-login {
+ margin-bottom: 10px;
+} \ No newline at end of file
diff --git a/mod/openid_client/views/default/openid_client/icon.php b/mod/openid_client/views/default/openid_client/icon.php
new file mode 100644
index 000000000..3a9a9d981
--- /dev/null
+++ b/mod/openid_client/views/default/openid_client/icon.php
@@ -0,0 +1,8 @@
+<?php
+
+echo elgg_view('output/url', array(
+ 'text' => elgg_view_icon('openid') . elgg_echo('openid_client:login'),
+ 'href' => '',
+ 'title' => elgg_echo('openid_client'),
+ 'class' => "openid-login-icon",
+)); \ No newline at end of file
diff --git a/mod/openid_client/views/default/openid_client/js.php b/mod/openid_client/views/default/openid_client/js.php
new file mode 100644
index 000000000..171215593
--- /dev/null
+++ b/mod/openid_client/views/default/openid_client/js.php
@@ -0,0 +1,26 @@
+<?php
+/**
+ * OpenID JavaScript
+ */
+
+?>
+
+// OpenID toggle
+elgg.register_hook_handler('init', 'system', function() {
+ $('.openid-login-icon').click(function(e) {
+ var openid_box = $(this).prev('.elgg-form-openid-client-login');
+ var shown = openid_box.is(':visible') ? openid_box : openid_box.prev();
+ var hidden = !openid_box.is(':visible') ? openid_box : openid_box.prev();
+ shown.fadeOut(function() {
+ hidden.fadeIn();
+ });
+ e.preventDefault();
+ });
+ $(".elgg-form-openid-client-login [name='openid_provider']").change(function(event) {
+ if (this.value == 'others') {
+ $(".openid-client-url").slideDown().find('input').focus();
+ } else {
+ $(".openid-client-url").slideUp();
+ }
+ });
+});
diff --git a/mod/openid_client/views/default/openid_client/register.php b/mod/openid_client/views/default/openid_client/register.php
new file mode 100644
index 000000000..be448ef54
--- /dev/null
+++ b/mod/openid_client/views/default/openid_client/register.php
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Registration content view for OpenID client
+ *
+ */
+
+echo '<p>';
+echo elgg_echo('openid_client:create:instructs');
+echo '<p>';
+
+echo elgg_view_form('openid_client/register', array(), $vars);