Elgg  Version 1.9
walled_garden.php
Go to the documentation of this file.
1 <?php
8 $cancel_button = elgg_view('input/button', array(
9  'value' => elgg_echo('cancel'),
10  'class' => 'elgg-button-cancel mlm',
11 ));
12 $cancel_button = json_encode($cancel_button);
13 
14 if (0) { ?><script><?php }
15 ?>
16 
17 elgg.provide('elgg.walled_garden');
18 
19 elgg.walled_garden.init = function () {
20 
21  $('.forgot_link').click(elgg.walled_garden.load('lost_password'));
22  $('.registration_link').click(elgg.walled_garden.load('register'));
23 
24  $('input.elgg-button-cancel').live('click', function(event) {
25  var $wgs = $('.elgg-walledgarden-single');
26  if ($wgs.is(':visible')) {
27  $('.elgg-walledgarden-double').fadeToggle();
28  $wgs.fadeToggle();
29  $wgs.remove();
30  }
31  event.preventDefault();
32  });
33 };
34 
41 elgg.walled_garden.load = function(view) {
42  return function(event) {
43  var id = '#elgg-walledgarden-' + view;
44  id = id.replace('_', '-');
45  // @todo display some visual element that indicates that loading of content is running
46  elgg.get('walled_garden/' + view, {
47  'success' : function(data) {
48  var $wg = $('.elgg-body-walledgarden');
49  $wg.append(data);
50  $(id).find('input.elgg-button-submit').after(<?php echo $cancel_button; ?>);
51 
52  if (view == 'register' && $wg.hasClass('hidden')) {
53  // this was a failed registration, display the register form ASAP
54  $('#elgg-walledgarden-login').toggle(false);
55  $(id).toggle();
56  $wg.removeClass('hidden');
57  } else {
58  $('#elgg-walledgarden-login').fadeToggle();
59  $(id).fadeToggle();
60  }
61  }
62  });
63  event.preventDefault();
64  };
65 };
66 
67 elgg.register_hook_handler('init', 'system', elgg.walled_garden.init);
elgg
Definition: install.js:23
$CONFIG view
The current view type.
Definition: config.php:185
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg echo
Translates a string.
Definition: languages.js:43
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
function elgg combo checkbox click(function(){if($(this).is(':checked')){$(this).prev().attr('disabled', true);$(this).prev().val('');}else{$(this).prev().attr('disabled', false);}})
$cancel_button
Walled garden JavaScript.