aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--graphics/openid_providers.pngbin0 -> 12400 bytes
-rw-r--r--languages/en.php9
-rw-r--r--start.php42
-rw-r--r--views/default/openid_client/css.php50
-rw-r--r--views/default/openid_client/login.php10
5 files changed, 105 insertions, 6 deletions
diff --git a/graphics/openid_providers.png b/graphics/openid_providers.png
new file mode 100644
index 000000000..179e6d191
--- /dev/null
+++ b/graphics/openid_providers.png
Binary files differ
diff --git a/languages/en.php b/languages/en.php
index a5a5589ad..df20c95f9 100644
--- a/languages/en.php
+++ b/languages/en.php
@@ -4,6 +4,15 @@
*/
$english = array(
+
+ 'openid_client:login:header' => 'Log in with',
+ 'openid_client:or:header' => 'or',
+ 'openid_client:login:instructs' => 'Login in with %s',
+ 'openid_client:server:google' => 'Google',
+ 'openid_client:server:yahoo' => 'Yahoo',
+ 'openid_client:server:blogger' => 'Blogger',
+ 'openid_client:server:wordpress' => 'Wordpress',
+
'openid_client:success:register' => 'Your account has been created.',
'openid_client:error:bad_register' => 'Unable to create an account. Please contact a site administrator.',
);
diff --git a/start.php b/start.php
index 34f3e136f..bd80dde48 100644
--- a/start.php
+++ b/start.php
@@ -12,7 +12,10 @@ elgg_register_event_handler('init', 'system', 'openid_client_init');
* OpenID client initialization
*/
function openid_client_init() {
+ elgg_extend_view('css/elgg', 'openid_client/css');
+
elgg_extend_view('core/account/login_box', 'openid_client/login');
+ elgg_register_plugin_hook_handler('register', 'menu:openid_login', 'openid_client_setup_menu');
$base = elgg_get_plugins_path() . 'openid_client/actions/openid_client';
elgg_register_action('openid_client/login', "$base/login.php", 'public');
@@ -23,7 +26,7 @@ function openid_client_init() {
elgg_register_event_handler('create', 'user', 'openid_client_set_subtype', 1);
- elgg_register_page_handler('openid_client', 'openid_client_page_handler');
+ //elgg_register_page_handler('openid_client', 'openid_client_page_handler');
}
/**
@@ -43,6 +46,43 @@ function openid_client_set_subtype($event, $type, $user) {
}
/**
+ * Register login options
+ *
+ * @param string $hook
+ * @param string $type
+ * @param array $menu
+ * @param array $params
+ * @return array
+ */
+function openid_client_setup_menu($hook, $type, $menu, $params) {
+
+ $items = array(
+ 'large' => array('google', 'yahoo'),
+ 'small' => array('blogger', 'wordpress'),
+ );
+ $items = elgg_trigger_plugin_hook('register', 'openid_login', null, $items);
+
+ $priority = 100;
+ foreach ($items as $type => $servers) {
+ foreach ($servers as $server) {
+ $server_name = elgg_echo("openid_client:server:$server");
+ $menu[] = ElggMenuItem::factory(array(
+ 'name' => $server,
+ 'text' => '<span></span>',
+ 'title' => elgg_echo('openid_client:login:instructs', array($server_name)),
+ 'href' => "action/openid_client/login?server=$server",
+ 'is_action' => true,
+ 'section' => $type,
+ 'priority' => $priority,
+ ));
+ $priority += 10;
+ }
+ }
+
+ return $menu;
+}
+
+/**
* OpenID client page handler
*
* @param type $page Array of URL segments
diff --git a/views/default/openid_client/css.php b/views/default/openid_client/css.php
index ff81520da..900de7e6e 100644
--- a/views/default/openid_client/css.php
+++ b/views/default/openid_client/css.php
@@ -2,5 +2,53 @@
/**
* OpenID client CSS
*/
-
+
+$site_url = elgg_get_site_url();
+
?>
+
+.openid-client-login-or {
+ margin-top: 5px;
+ text-align: center;
+ color: #333;
+}
+
+.elgg-menu-openid-login {
+ text-align: center;
+}
+
+.elgg-menu-openid-login > li {
+ margin: 3px;
+}
+
+.elgg-menu-openid-login span {
+ display: block;
+ background: url("<?php echo $site_url; ?>mod/openid_client/graphics/openid_providers.png") no-repeat left;
+ border: 1px solid #ccc;
+}
+
+.elgg-menu-openid-login-large span {
+ height: 32px;
+ width: 92px;
+}
+
+.elgg-menu-openid-login-small span {
+ height: 20px;
+ width: 20px;
+}
+
+.elgg-menu-item-google span {
+ background-position: -5px -14px;
+}
+
+.elgg-menu-openid-login-large > .elgg-menu-item-yahoo span {
+ background-position: -105px -14px;
+}
+
+.elgg-menu-item-blogger span {
+ background-position: -170px -62px;
+}
+
+.elgg-menu-item-wordpress span {
+ background-position: -146px -62px;
+}
diff --git a/views/default/openid_client/login.php b/views/default/openid_client/login.php
index 2b476ec8e..7e71b8bab 100644
--- a/views/default/openid_client/login.php
+++ b/views/default/openid_client/login.php
@@ -3,8 +3,10 @@
* OpenID client login choices
*/
-echo elgg_view('output/url', array(
- 'text' => 'login with Google',
- 'href' => 'action/openid_client/login',
- 'is_action' => true,
+echo '<h3 class="openid-client-login-or">' . elgg_echo('openid_client:or:header') . '</h3>';
+echo '<h3>' . elgg_echo('openid_client:login:header') . '</h3>';
+
+echo elgg_view_menu('openid_login', array(
+ 'class' => 'elgg-menu-hz',
+ 'sort_by' => 'priority',
));