aboutsummaryrefslogtreecommitdiff
path: root/views/default
diff options
context:
space:
mode:
Diffstat (limited to 'views/default')
-rw-r--r--views/default/forms/profile/edit.php13
-rw-r--r--views/default/js/walled_garden.php28
-rw-r--r--views/default/page/walled_garden.php15
3 files changed, 46 insertions, 10 deletions
diff --git a/views/default/forms/profile/edit.php b/views/default/forms/profile/edit.php
index 9538b779e..cb0a37ca4 100644
--- a/views/default/forms/profile/edit.php
+++ b/views/default/forms/profile/edit.php
@@ -13,6 +13,8 @@
</div>
<?php
+$sticky_values = elgg_get_sticky_values('profile:edit');
+
$profile_fields = elgg_get_config('profile_fields');
if (is_array($profile_fields) && count($profile_fields) > 0) {
foreach ($profile_fields as $shortname => $valtype) {
@@ -40,6 +42,14 @@ if (is_array($profile_fields) && count($profile_fields) > 0) {
$access_id = ACCESS_DEFAULT;
}
+ // sticky form values take precedence over saved ones
+ if (isset($sticky_values[$shortname])) {
+ $value = $sticky_values[$shortname];
+ }
+ if (isset($sticky_values['accesslevel'][$shortname])) {
+ $access_id = $sticky_values['accesslevel'][$shortname];
+ }
+
?>
<div>
<label><?php echo elgg_echo("profile:{$shortname}") ?></label>
@@ -59,6 +69,9 @@ if (is_array($profile_fields) && count($profile_fields) > 0) {
<?php
}
}
+
+elgg_clear_sticky_form('profile:edit');
+
?>
<div class="elgg-foot">
<?php
diff --git a/views/default/js/walled_garden.php b/views/default/js/walled_garden.php
index 7a482fe23..e228df507 100644
--- a/views/default/js/walled_garden.php
+++ b/views/default/js/walled_garden.php
@@ -5,12 +5,11 @@
* @since 1.8
*/
-// note that this assumes the button view is not using single quotes
$cancel_button = elgg_view('input/button', array(
'value' => elgg_echo('cancel'),
'class' => 'elgg-button-cancel mlm',
));
-$cancel_button = trim($cancel_button);
+$cancel_button = json_encode($cancel_button);
if (0) { ?><script><?php }
?>
@@ -23,10 +22,11 @@ elgg.walled_garden.init = function () {
$('.registration_link').click(elgg.walled_garden.load('register'));
$('input.elgg-button-cancel').live('click', function(event) {
- if ($('.elgg-walledgarden-single').is(':visible')) {
+ var $wgs = $('.elgg-walledgarden-single');
+ if ($wgs.is(':visible')) {
$('.elgg-walledgarden-double').fadeToggle();
- $('.elgg-walledgarden-single').fadeToggle();
- $('.elgg-walledgarden-single').remove();
+ $wgs.fadeToggle();
+ $wgs.remove();
}
event.preventDefault();
});
@@ -42,12 +42,22 @@ elgg.walled_garden.load = function(view) {
return function(event) {
var id = '#elgg-walledgarden-' + view;
id = id.replace('_', '-');
+ //@todo display some visual element that indicates that loading of content is running
elgg.get('walled_garden/' + view, {
'success' : function(data) {
- $('.elgg-body-walledgarden').append(data);
- $(id).find('input.elgg-button-submit').after('<?php echo $cancel_button; ?>');
- $('#elgg-walledgarden-login').fadeToggle();
- $(id).fadeToggle();
+ var $wg = $('.elgg-body-walledgarden');
+ $wg.append(data);
+ $(id).find('input.elgg-button-submit').after(<?php echo $cancel_button; ?>);
+
+ if (view == 'register' && $wg.hasClass('hidden')) {
+ // this was a failed register, display the register form ASAP
+ $('#elgg-walledgarden-login').toggle(false);
+ $(id).toggle();
+ $wg.removeClass('hidden');
+ } else {
+ $('#elgg-walledgarden-login').fadeToggle();
+ $(id).fadeToggle();
+ }
}
});
event.preventDefault();
diff --git a/views/default/page/walled_garden.php b/views/default/page/walled_garden.php
index ff8e317c7..b280cf6b2 100644
--- a/views/default/page/walled_garden.php
+++ b/views/default/page/walled_garden.php
@@ -5,6 +5,12 @@
* Used for the walled garden index page
*/
+$is_sticky_register = elgg_is_sticky_form('register');
+$wg_body_class = 'elgg-body-walledgarden';
+if ($is_sticky_register) {
+ $wg_body_class .= ' hidden';
+}
+
// Set the content type
header("Content-type: text/html; charset=UTF-8");
?>
@@ -18,10 +24,17 @@ header("Content-type: text/html; charset=UTF-8");
<div class="elgg-page-messages">
<?php echo elgg_view('page/elements/messages', array('object' => $vars['sysmessages'])); ?>
</div>
- <div class="elgg-body-walledgarden">
+ <div class="<?php echo $wg_body_class; ?>">
<?php echo $vars['body']; ?>
</div>
</div>
+<?php if ($is_sticky_register): ?>
+<script type="text/javascript">
+elgg.register_hook_handler('init', 'system', function() {
+ $('.registration_link').trigger('click');
+});
+</script>
+<?php endif; ?>
<?php echo elgg_view('page/elements/foot'); ?>
</body>
</html> \ No newline at end of file