diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-14 23:09:41 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-14 23:09:41 +0000 |
commit | cbc74d984665a8bc0de18e0fa7c2fe270e9b7476 (patch) | |
tree | 9480e8183649e485493eb497e862be787498d810 /views/default/core | |
parent | b5aed25425ff58d544726f97d3cca0ef142f8c94 (diff) | |
download | elgg-cbc74d984665a8bc0de18e0fa7c2fe270e9b7476.tar.gz elgg-cbc74d984665a8bc0de18e0fa7c2fe270e9b7476.tar.bz2 |
moved account views into core views - account forms are next
git-svn-id: http://code.elgg.org/elgg/trunk@7622 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/core')
-rw-r--r-- | views/default/core/account/login_box.php | 25 | ||||
-rw-r--r-- | views/default/core/account/login_dropdown.php | 52 | ||||
-rw-r--r-- | views/default/core/account/login_walled_garden.php | 114 |
3 files changed, 191 insertions, 0 deletions
diff --git a/views/default/core/account/login_box.php b/views/default/core/account/login_box.php new file mode 100644 index 000000000..eb37d7554 --- /dev/null +++ b/views/default/core/account/login_box.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg login box + * + * @package Elgg + * @subpackage Core + */ + +$form_body = elgg_view('account/forms/login'); + +$login_url = elgg_get_site_url(); +if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) { + $login_url = str_replace("http:", "https:", $login_url); +} +?> + +<div id="login"> +<h2><?php echo elgg_echo('login'); ?></h2> + <?php + echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login")); + ?> +</div> +<script type="text/javascript"> + $(document).ready(function() { $('input[name=username]').focus(); }); +</script> diff --git a/views/default/core/account/login_dropdown.php b/views/default/core/account/login_dropdown.php new file mode 100644 index 000000000..dc124f4e8 --- /dev/null +++ b/views/default/core/account/login_dropdown.php @@ -0,0 +1,52 @@ +<?php +/** + * Elgg drop-down login form + * + */ + +if (isloggedin()) { + return true; +} + +$form_body = elgg_view('account/forms/login'); +$form_body .= "<input type='hidden' name='returntoreferer' value='true' />"; + +$login_url = elgg_get_site_url(); +if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) { + $login_url = str_replace("http", "https", elgg_get_site_url()); +} + +?> + +<div id="login-dropdown"> + <div id="signin-button" class="signin-button"> + <a href="<?php echo $CONFIG->url; ?>pg/login" class="signin"><span><?php echo elgg_echo('login') ?></span></a> + </div> + <fieldset id="signin-menu"> + <?php echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login")); ?> + </fieldset> +</div> + +<script type="text/javascript"> +$(document).ready(function() { + + $(".signin").click(function(e) { + e.preventDefault(); + $("fieldset#signin-menu").toggle(); + $(".signin").toggleClass("menu-open"); + $('.login-textarea.name').focus(); + }); + + $("fieldset#signin-menu").mouseup(function() { + return false + }); + + $(document).mouseup(function(e) { + if($(e.target).parent("a.signin").length==0) { + $(".signin").removeClass("menu-open"); + $("fieldset#signin-menu").hide(); + } + }); + +}); +</script>
\ No newline at end of file diff --git a/views/default/core/account/login_walled_garden.php b/views/default/core/account/login_walled_garden.php new file mode 100644 index 000000000..9f407bdff --- /dev/null +++ b/views/default/core/account/login_walled_garden.php @@ -0,0 +1,114 @@ +<?php +/** +* Walled Garden Login Form +*/ + +global $CONFIG; + +/* +$form_body = "<label>" . elgg_echo('username') . "<br />" . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea username')) . "</label>"; +$form_body .= "<br />"; +$form_body .= "<label>" . elgg_echo('password') . "<br />" . elgg_view('input/password', array('internalname' => 'password', 'class' => 'login-textarea')) . "</label><br />"; + +$form_body .= elgg_view('input/submit', array('value' => elgg_echo('login'))); +$form_body .= "<div class='remember_me'><label><input type='checkbox' name='persistent' checked value='true' />".elgg_echo('user:persistent')."</label></div>"; + +$register = elgg_echo('register'); +$lost_password = elgg_echo('user:password:lost'); +$form_body .= '<p class="lost_password">'; +$form_body .= $CONFIG->allow_registration ? "<a class=\"registration_link\" href=\"".elgg_get_site_url()."pg/register/\">$register</a> | " : ''; +$form_body .= "<a class='forgotten_password_link' href=\"{$login_url}pages/account/forgotten_password.php\">$lost_password</a>"; +$form_body .= '</p>'; +*/ + +$form_body = elgg_view('account/forms/login'); +$form_body .= elgg_view('input/hidden', array('internalname' => 'returntoreferer', 'value' => 'true')); + +$login_url = elgg_get_site_url(); +if ((isset($CONFIG->https_login)) && ($CONFIG->https_login)) { + $login_url = str_replace("http", "https", elgg_get_site_url()); +} +?> +<h2><?php echo elgg_echo('login'); ?></h2> +<?php + echo elgg_view('input/form', array('body' => $form_body, 'action' => "{$login_url}action/login")); + echo elgg_view('login/extend'); // view for plugins to extend +?> + +<?php +if ($CONFIG->allow_registration) { + $title = elgg_echo('register'); + $body = elgg_view("account/forms/register", array( + 'friend_guid' => (int) get_input('friend_guid', 0), + 'invitecode' => get_input('invitecode'), + )); + + echo <<<__HTML +<div id="registration_form" class="hidden clearfix"> +<div id="hiddenform_body" class="clearfix"> + <h2>$title</h2> + $body +</div><div id="hiddenform_bottom"></div></div> +__HTML; +} +?> + <?php + $lostpassword_form_body = "<p>" . elgg_echo('user:password:text') . "</p>"; + $lostpassword_form_body .= "<p class='margin-none'><label>". elgg_echo('username') . " " + . elgg_view('input/text', array('internalname' => 'username', 'class' => 'login-textarea lostusername')) . "</label></p>"; + $lostpassword_form_body .= elgg_view('input/captcha'); + $lostpassword_form_body .= "<p>" . elgg_view('input/submit', array('value' => elgg_echo('request'))) . "<input class='action-button disabled cancel_request' type='reset' value='Cancel'></p>"; + + ?> +<div id="lostpassword_form" class="hidden clearfix"> + <div id="hiddenform_body" class="clearfix"> + <h2><?php echo elgg_echo('user:password:lost'); ?></h2> + <?php + echo elgg_view('input/form', array( + 'action' => "action/user/requestnewpassword", + 'body' => $lostpassword_form_body + )); + ?> +</div><div id="hiddenform_bottom"></div></div> + +<script type="text/javascript"> +$(document).ready(function() { + $('input.username').focus(); + + // add cancel button to inline register form + $('#registration_form').find('input.submit-button').after("<input class='action-button disabled cancel_request' type='reset' value='Cancel'>"); + + function elgg_slide_hiddenform(activateLink, parentElement, toggleElement) { + $(activateLink).closest(parentElement).find(toggleElement).animate({"width": "563px", duration: 400}); + $(activateLink).closest(parentElement).animate({"height": "256px", duration: 400}, function() { + // ewwww dirty. Webkit has problems when showing images that were hidden. + // forcing a reload of all the images. + $('.visual_captcha img').each(function() { $(this).attr('src', $(this).attr('src')); }); + }); + return false; + } + + $('a.registration_link').click(function(e) { + e.preventDefault(); + elgg_slide_hiddenform(this, '.walledgardenlogin', '#registration_form'); + $('input.name').focus(); + }); + + $('a.forgotten_password_link').click(function(e) { + e.preventDefault(); + elgg_slide_hiddenform(this, '.walledgardenlogin', '#lostpassword_form'); + $('input.lostusername').focus(); + }); + + $('input.cancel_request').click(function() { + if ($('#lostpassword_form').is(':visible')) { + $('#lostpassword_form').fadeOut(400); + location.reload(); + } else if ($('#registration_form').is(':visible')) { + $('#registration_form').fadeOut(400); + location.reload(); + } + return false; + }); +}); +</script> |