aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engine/classes/ElggSite.php1
-rw-r--r--engine/lib/elgglib.php26
-rw-r--r--views/default/core/walled_garden/body.php11
-rw-r--r--views/default/core/walled_garden/login.php8
-rw-r--r--views/default/core/walled_garden/lost_password.php8
-rw-r--r--views/default/core/walled_garden/register.php8
-rw-r--r--views/default/js/walled_garden.php32
-rw-r--r--views/default/page/layouts/walled_garden.php14
8 files changed, 62 insertions, 46 deletions
diff --git a/engine/classes/ElggSite.php b/engine/classes/ElggSite.php
index 49616f1be..bf3234a18 100644
--- a/engine/classes/ElggSite.php
+++ b/engine/classes/ElggSite.php
@@ -422,6 +422,7 @@ class ElggSite extends ElggEntity {
// default public pages
$defaults = array(
+ 'walled_garden/.*',
'action/login',
'register',
'action/register',
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 11bdc7285..5c444c2f5 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -2021,8 +2021,13 @@ function elgg_walled_garden_index() {
elgg_load_css('elgg.walled_garden');
elgg_load_js('elgg.walled_garden');
- $body = elgg_view('core/walled_garden/body');
+ $content = elgg_view('core/walled_garden/login');
+ $params = array(
+ 'content' => $content,
+ 'class' => 'elgg-walledgarden-double',
+ );
+ $body = elgg_view_layout('walled_garden', $params);
echo elgg_view_page('', $body, 'walled_garden');
// return true to prevent other plugins from adding a front page
@@ -2030,6 +2035,23 @@ function elgg_walled_garden_index() {
}
/**
+ * Serve walled garden sections
+ *
+ * @param array $page Array of URL segments
+ * @return string
+ * @access private
+ */
+function _elgg_walled_garden_ajax_handler($page) {
+ $view = $page[0];
+ $params = array(
+ 'content' => elgg_view("core/walled_garden/$view"),
+ 'class' => 'elgg-walledgarden-single hidden',
+ );
+ echo elgg_view_layout('walled_garden', $params);
+ return true;
+}
+
+/**
* Checks the status of the Walled Garden and forwards to a login page
* if required.
*
@@ -2049,6 +2071,8 @@ function elgg_walled_garden() {
elgg_register_css('elgg.walled_garden', '/css/walled_garden.css');
elgg_register_js('elgg.walled_garden', '/js/walled_garden.js');
+ elgg_register_page_handler('walled_garden', '_elgg_walled_garden_ajax_handler');
+
// check for external page view
if (isset($CONFIG->site) && $CONFIG->site instanceof ElggSite) {
$CONFIG->site->checkWalledGarden();
diff --git a/views/default/core/walled_garden/body.php b/views/default/core/walled_garden/body.php
deleted file mode 100644
index 67d8e0c37..000000000
--- a/views/default/core/walled_garden/body.php
+++ /dev/null
@@ -1,11 +0,0 @@
-<?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
index 0a8b4a908..42b79607d 100644
--- a/views/default/core/walled_garden/login.php
+++ b/views/default/core/walled_garden/login.php
@@ -14,7 +14,7 @@ $menu = elgg_view_menu('walled_garden', array(
$login_box = elgg_view('core/account/login_box', array('module' => 'walledgarden-login'));
-$content = <<<HTML
+echo <<<HTML
<div class="elgg-col elgg-col-1of2">
<div class="elgg-inner">
<h1 class="elgg-heading-walledgarden">
@@ -29,9 +29,3 @@ $content = <<<HTML
</div>
</div>
HTML;
-
-echo elgg_view_module('walledgarden', '', $content, array(
- 'class' => 'elgg-walledgarden-double',
- 'header' => ' ',
- 'footer' => ' ',
-));
diff --git a/views/default/core/walled_garden/lost_password.php b/views/default/core/walled_garden/lost_password.php
index ce75b558b..82f8caf50 100644
--- a/views/default/core/walled_garden/lost_password.php
+++ b/views/default/core/walled_garden/lost_password.php
@@ -5,15 +5,9 @@
$title = elgg_echo('user:password:lost');
$body = elgg_view_form('user/requestnewpassword');
-$lost = <<<HTML
+echo <<<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',
- 'header' => ' ',
- 'footer' => ' ',
-));
diff --git a/views/default/core/walled_garden/register.php b/views/default/core/walled_garden/register.php
index 7f6aac99b..1ce2f8716 100644
--- a/views/default/core/walled_garden/register.php
+++ b/views/default/core/walled_garden/register.php
@@ -9,15 +9,9 @@ $body = elgg_view_form('register', array(), array(
'invitecode' => get_input('invitecode'),
));
-$content = <<<__HTML
+echo <<<__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',
- 'header' => ' ',
- 'footer' => ' ',
-)); \ No newline at end of file
diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php
index 46c2934ff..e761e5869 100644
--- a/views/default/js/walled_garden.php
+++ b/views/default/js/walled_garden.php
@@ -15,25 +15,31 @@ $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) {
+ $('.forgot_link').click(function(event) {
+ $.get('walled_garden/lost_password', function(data) {
+ $('.elgg-walledgarden-double').fadeToggle();
+ $('.elgg-body-walledgarden').append(data);
+ $(".elgg-form-user-requestnewpassword").find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+ $('.elgg-walledgarden-single').fadeToggle();
+ });
event.preventDefault();
- $(".elgg-walledgarden-password").fadeToggle();
});
- $(".registration_link").click(function(event) {
+ $('.registration_link').click(function(event) {
+ $.get('walled_garden/register', function(data) {
+ $('.elgg-walledgarden-double').fadeToggle();
+ $('.elgg-body-walledgarden').append(data);
+ $('.elgg-form-register').find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
+ $('.elgg-walledgarden-single').fadeToggle();
+ });
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();
+ $('input.elgg-button-cancel').live('click', function(event) {
+ if ($('.elgg-walledgarden-single').is(':visible')) {
+ $('.elgg-walledgarden-double').fadeToggle();
+ $('.elgg-walledgarden-single').fadeToggle();
+ $('.elgg-walledgarden-single').remove();
}
event.preventDefault();
});
diff --git a/views/default/page/layouts/walled_garden.php b/views/default/page/layouts/walled_garden.php
new file mode 100644
index 000000000..5cddcbb77
--- /dev/null
+++ b/views/default/page/layouts/walled_garden.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * Walled Garden layout
+ *
+ * @uses $vars['content'] Main content
+ * @uses $vars['class'] CSS classes
+ */
+
+$class = elgg_extract('class', $vars, 'elgg-walledgarden-single');
+echo elgg_view_module('walledgarden', '', $vars['content'], array(
+ 'class' => $class,
+ 'header' => ' ',
+ 'footer' => ' ',
+));