diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-11-03 18:27:17 -0700 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-11-03 18:27:17 -0700 |
commit | 67d692b76b079a75a0ad7ca1fb73ce6333a61789 (patch) | |
tree | 13937d1d76788be7b397ebbe92ba89e2e6c89525 /views | |
parent | 9c0c10ee6d9261d3d1d502e5ca1f86555a96105a (diff) | |
parent | 7250d1904f87af146223cd7be57660791cbb6ef8 (diff) | |
download | elgg-67d692b76b079a75a0ad7ca1fb73ce6333a61789.tar.gz elgg-67d692b76b079a75a0ad7ca1fb73ce6333a61789.tar.bz2 |
Merge pull request #90 from cash/walled_garden
Fixes #3756 creates a more flexible walled garden login area
Diffstat (limited to 'views')
-rw-r--r-- | views/default/core/account/login_box.php | 6 | ||||
-rw-r--r-- | views/default/core/account/login_walled_garden.php | 100 | ||||
-rw-r--r-- | views/default/core/walled_garden/body.php | 11 | ||||
-rw-r--r-- | views/default/core/walled_garden/login.php | 33 | ||||
-rw-r--r-- | views/default/core/walled_garden/lost_password.php | 17 | ||||
-rw-r--r-- | views/default/core/walled_garden/register.php | 21 | ||||
-rw-r--r-- | views/default/css/ie7.php | 9 | ||||
-rw-r--r-- | views/default/css/walled_garden.php | 95 | ||||
-rw-r--r-- | views/default/forms/login.php | 2 | ||||
-rw-r--r-- | views/default/js/walled_garden.php | 40 | ||||
-rw-r--r-- | views/default/page/walled_garden.php | 31 |
11 files changed, 191 insertions, 174 deletions
diff --git a/views/default/core/account/login_box.php b/views/default/core/account/login_box.php index 8c586d425..f39113653 100644 --- a/views/default/core/account/login_box.php +++ b/views/default/core/account/login_box.php @@ -4,8 +4,12 @@ * * @package Elgg * @subpackage Core + * + * @uses $vars['module'] The module name. Default: aside */ +$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); @@ -14,4 +18,4 @@ if (elgg_get_config('https_login')) { $title = elgg_echo('login'); $body = elgg_view_form('login', array('action' => "{$login_url}action/login")); -echo elgg_view_module('aside', $title, $body); +echo elgg_view_module($module, $title, $body); diff --git a/views/default/core/account/login_walled_garden.php b/views/default/core/account/login_walled_garden.php deleted file mode 100644 index 1606b9592..000000000 --- a/views/default/core/account/login_walled_garden.php +++ /dev/null @@ -1,100 +0,0 @@ -<?php -/** - * Walled Garden Login Form - * - * @todo still requires clean up - */ - -$reg_url = elgg_normalize_url('register'); -$forgot_url = elgg_normalize_url('forgotpassword'); -$cancel_button = elgg_view('input/button', array( - 'value' => elgg_echo('cancel'), - 'class' => 'elgg-button-cancel mlm', -)); - -$form_body = elgg_view('forms/login'); -$form_body .= elgg_view('input/hidden', array( - 'name' => 'returntoreferer', - 'value' => 'true', -)); - -$login_url = elgg_get_site_url(); -if (elgg_get_config('https_login')) { - $login_url = str_replace("http:", "https:", elgg_get_site_url()); -} - -?> -<h2><?php echo elgg_echo('login'); ?></h2> -<?php -//@todo Forms 1.8: Convert to use elgg_view_form() -echo elgg_view('input/form', array( - 'body' => $form_body, - 'action' => "{$login_url}action/login", -)); - -if (elgg_get_config('allow_registration')) { - $title = elgg_echo('register'); - $body = elgg_view_form('register', array(), array( - 'friend_guid' => (int) get_input('friend_guid', 0), - 'invitecode' => get_input('invitecode'), - )); - - echo <<<__HTML -<div id="elgg-walledgarden-registration" class="hidden clearfix"> - <div class="elgg-hiddenform-body" class="clearfix"> - <h2>$title</h2> - $body - </div> - <div class="elgg-hiddenform-bottom"></div> -</div> -__HTML; -} - -$title = elgg_echo('user:password:lost'); -$body = elgg_view_form('user/requestnewpassword'); -echo <<<__HTML -<div id="elgg-walledgarden-lostpassword" class="hidden clearfix"> - <div class="elgg-hiddenform-body" class="clearfix"> - <h2>$title</h2> - $body - </div> - <div class="elgg-hiddenform-bottom"></div> -</div> -__HTML; - -//@todo JS 1.8: no -?> -<script type="text/javascript"> -$(document).ready(function() { - $('input.username').focus(); - - // add cancel button to inline forms - $('#elgg-walledgarden-registration').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); - $('#elgg-walledgarden-lostpassword').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); - - function elgg_slide_hiddenform(activateLink, parentElement, toggleElement) { - $(activateLink).closest(parentElement).find(toggleElement).fadeToggle('medium'); - } - - $('a[href="<?php echo $reg_url; ?>"]').click(function(e) { - e.preventDefault(); - elgg_slide_hiddenform(this, '#elgg-walledgarden-login', '#elgg-walledgarden-registration'); - $('input.name').focus(); - }); - - $('a[href="<?php echo $forgot_url; ?>"]').click(function(e) { - e.preventDefault(); - elgg_slide_hiddenform(this, '#elgg-walledgarden-login', '#elgg-walledgarden-lostpassword'); - $('input.lostusername').focus(); - }); - - $('input.elgg-button-cancel').click(function() { - if ($('#elgg-walledgarden-lostpassword').is(':visible')) { - $('a[href="<?php echo $forgot_url; ?>"]').click(); - } else if ($('#elgg-walledgarden-registration').is(':visible')) { - $('a[href="<?php echo $reg_url; ?>"]').click(); - } - return false; - }); -}); -</script> diff --git a/views/default/core/walled_garden/body.php b/views/default/core/walled_garden/body.php new file mode 100644 index 000000000..67d8e0c37 --- /dev/null +++ b/views/default/core/walled_garden/body.php @@ -0,0 +1,11 @@ +<?php +/** + * Walled garden body + */ + +echo elgg_view('core/walled_garden/login'); +echo elgg_view('core/walled_garden/lost_password'); + +if (elgg_get_config('allow_registration')) { + echo elgg_view('core/walled_garden/register'); +} diff --git a/views/default/core/walled_garden/login.php b/views/default/core/walled_garden/login.php new file mode 100644 index 000000000..069422bfa --- /dev/null +++ b/views/default/core/walled_garden/login.php @@ -0,0 +1,33 @@ +<?php +/** + * Walled garden login + */ + +$title = elgg_get_site_entity()->name; +$welcome = elgg_echo('walled_garden:welcome'); +$welcome .= ': <br/>' . $title; + +$menu = elgg_view_menu('walled_garden', array( + 'sort_by' => 'priority', + 'class' => 'elgg-menu-general elgg-menu-hz', +)); + +$login_box = elgg_view('core/account/login_box', array('module' => 'walledgarden-login')); + +$content = <<<HTML +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + <h1 class="elgg-heading-walledgarden"> + $welcome + </h1> + $menu + </div> +</div> +<div class="elgg-col elgg-col-1of2"> + <div class="elgg-inner"> + $login_box + </div> +</div> +HTML; + +echo elgg_view_module('walledgarden', '', $content, array('class' => 'elgg-walledgarden-double')); diff --git a/views/default/core/walled_garden/lost_password.php b/views/default/core/walled_garden/lost_password.php new file mode 100644 index 000000000..60356aaf0 --- /dev/null +++ b/views/default/core/walled_garden/lost_password.php @@ -0,0 +1,17 @@ +<?php +/** + * Walled garden lost password + */ + +$title = elgg_echo('user:password:lost'); +$body = elgg_view_form('user/requestnewpassword'); +$lost = <<<HTML +<div class="elgg-inner"> + <h3>$title</h3> + $body +</div> +HTML; + +echo elgg_view_module('walledgarden', '', $lost, array( + 'class' => 'elgg-walledgarden-single elgg-walledgarden-password hidden', +)); diff --git a/views/default/core/walled_garden/register.php b/views/default/core/walled_garden/register.php new file mode 100644 index 000000000..951bd7295 --- /dev/null +++ b/views/default/core/walled_garden/register.php @@ -0,0 +1,21 @@ +<?php +/** + * Walled garden registration + */ + +$title = elgg_echo('register'); +$body = elgg_view_form('register', array(), array( + 'friend_guid' => (int) get_input('friend_guid', 0), + 'invitecode' => get_input('invitecode'), +)); + +$content = <<<__HTML +<div class="elgg-inner"> + <h2>$title</h2> + $body +</div> +__HTML; + +echo elgg_view_module('walledgarden', '', $content, array( + 'class' => 'elgg-walledgarden-single elgg-walledgarden-register hidden', +));
\ No newline at end of file diff --git a/views/default/css/ie7.php b/views/default/css/ie7.php index 754ed3664..db0125b4b 100644 --- a/views/default/css/ie7.php +++ b/views/default/css/ie7.php @@ -53,4 +53,13 @@ .elgg-avatar { display: inline; +} + +.elgg-body-walledgarden .elgg-col-1of2 { + width: 255px; +} + +.elgg-module-walledgarden > .elgg-head, +.elgg-module-walledgarden > .elgg-foot { + width: 530px; }
\ No newline at end of file diff --git a/views/default/css/walled_garden.php b/views/default/css/walled_garden.php index 47850425b..ea2543587 100644 --- a/views/default/css/walled_garden.php +++ b/views/default/css/walled_garden.php @@ -6,36 +6,65 @@ $url = elgg_get_site_url(); ?> -#elgg-walledgarden { +.elgg-body-walledgarden { margin: 100px auto 0 auto; - width: 563px; - min-height: 230px; - background: url(<?php echo $url; ?>_graphics/walled_garden_background_top.gif) no-repeat left top; - padding: 0; position: relative; + width: 530px; } - -#elgg-walledgarden-bottom { - margin:0 auto; - background: url(<?php echo $url; ?>_graphics/walled_garden_background_bottom.gif) no-repeat left bottom; - width:563px; - height:54px; +.elgg-module-walledgarden { + position: absolute; + top: 0; + left: 0; +} +.elgg-module-walledgarden > .elgg-head { + height: 17px; +} +.elgg-module-walledgarden > .elgg-body { + padding: 0 10px; +} +.elgg-module-walledgarden > .elgg-foot { + height: 17px; +} +.elgg-walledgarden-double > .elgg-head { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_top.png) no-repeat left top; +} +.elgg-walledgarden-double > .elgg-body { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_middle.png) repeat-y left top; +} +.elgg-walledgarden-double > .elgg-foot { + background: url(<?php echo $url; ?>_graphics/walled_garden/two_column_bottom.png) no-repeat left top; +} +.elgg-walledgarden-single > .elgg-head { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_top.png) no-repeat left top; +} +.elgg-walledgarden-single > .elgg-body { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_middle.png) repeat-y left top; +} +.elgg-walledgarden-single > .elgg-foot { + background: url(<?php echo $url; ?>_graphics/walled_garden/one_column_bottom.png) no-repeat left top; } -#elgg-walledgarden-intro { - width: 230px; - float: left; - margin: 35px 15px 15px 35px; +.elgg-col > .elgg-inner { + margin: 0 0 0 5px; +} +.elgg-col:first-child > .elgg-inner { + margin: 0 5px 0 0; +} +.elgg-col > .elgg-inner { + padding: 0 8px; } -#elgg-walledgarden-intro ul { - float: left; +.elgg-walledgarden-single > .elgg-body > .elgg-inner { + padding: 0 8px; } -#elgg-walledgarden-login { - width: 230px; - float: left; - margin: 30px 15px 45px 19px; +.elgg-module-walledgarden-login { + margin: 0; +} +.elgg-body-walledgarden h3 { + font-size: 1.5em; + line-height: 1.1em; + padding-bottom: 5px; } .elgg-heading-walledgarden { @@ -43,27 +72,3 @@ $url = elgg_get_site_url(); margin-top: 60px; line-height: 1.1em; } - -#elgg-walledgarden-lostpassword, -#elgg-walledgarden-registration { - position: absolute; - right: 0; - top: 0; - width: 563px; - background-color: white; - padding: 0; - background: url(<?php echo $url; ?>_graphics/walled_garden_backgroundfull_top.gif) no-repeat left top; - height: auto; -} - -.elgg-hiddenform-body { - padding: 30px 40px 0 40px; - height: auto; -} -.elgg-hiddenform-bottom { - margin: 0 auto; - background: url(<?php echo $url; ?>_graphics/walled_garden_backgroundfull_bottom.gif) no-repeat left bottom; - width: 563px; - height: 54px; - position: relative; -} diff --git a/views/default/forms/login.php b/views/default/forms/login.php index 7669e4f8f..9536bb439 100644 --- a/views/default/forms/login.php +++ b/views/default/forms/login.php @@ -42,7 +42,7 @@ echo '<li><a class="registration_link" href="' . elgg_get_site_url() . 'register">' . elgg_echo('register') . '</a></li>'; } ?> - <li><a href="<?php echo elgg_get_site_url(); ?>forgotpassword"> + <li><a class="forgot_link" href="<?php echo elgg_get_site_url(); ?>forgotpassword"> <?php echo elgg_echo('user:password:lost'); ?> </a></li> </ul> diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php new file mode 100644 index 000000000..46c2934ff --- /dev/null +++ b/views/default/js/walled_garden.php @@ -0,0 +1,40 @@ +<?php +/** + * Walled garden JavaScript + * + * @todo update for new JS lib + */ + +$cancel_button = elgg_view('input/button', array( + 'value' => elgg_echo('cancel'), + 'class' => 'elgg-button-cancel mlm', +)); +$cancel_button = trim($cancel_button); + +?> + +$(document).ready(function() { + + // add cancel button to inline forms + $(".elgg-walledgarden-password").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); + $('.elgg-walledgarden-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>'); + + $(".forgot_link").click(function(event) { + event.preventDefault(); + $(".elgg-walledgarden-password").fadeToggle(); + }); + + $(".registration_link").click(function(event) { + event.preventDefault(); + $(".elgg-walledgarden-register").fadeToggle(); + }); + + $('input.elgg-button-cancel').click(function(event) { + if ($(".elgg-walledgarden-password").is(':visible')) { + $(".forgot_link").click(); + } else if ($('.elgg-walledgarden-register').is(':visible')) { + $(".registration_link").click(); + } + event.preventDefault(); + }); +});
\ No newline at end of file diff --git a/views/default/page/walled_garden.php b/views/default/page/walled_garden.php index 625c63ddb..ff8e317c7 100644 --- a/views/default/page/walled_garden.php +++ b/views/default/page/walled_garden.php @@ -7,12 +7,9 @@ // Set the content type header("Content-type: text/html; charset=UTF-8"); - -$site = elgg_get_site_entity(); -$title = $site->name; - ?> -<html> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <?php echo elgg_view('page/elements/head', $vars); ?> </head> @@ -21,28 +18,8 @@ $title = $site->name; <div class="elgg-page-messages"> <?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?> </div> - <div class="elgg-page-body"> - <div id="elgg-walledgarden"> - <div id="elgg-walledgarden-intro"> - <h1 class="elgg-heading-walledgarden"> - <?php - echo elgg_echo('walled_garden:welcome'); - echo ': <br/>'; - echo $title; - ?> - </h1> - <?php - echo elgg_view_menu('walled_garden', array( - 'sort_by' => 'priority', - 'class' => 'elgg-menu-general elgg-menu-hz', - )); - ?> - </div> - <div id="elgg-walledgarden-login"> - <?php echo $vars['body']; ?> - </div> - </div> - <div id="elgg-walledgarden-bottom"></div> + <div class="elgg-body-walledgarden"> + <?php echo $vars['body']; ?> </div> </div> <?php echo elgg_view('page/elements/foot'); ?> |