Elgg  Version 2.2
walled_garden.js.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  // make sure it is loaded before using it in the click events
21  require(['elgg/spinner']);
22  $('.forgot_link').click(elgg.walled_garden.load('lost_password'));
23  $('.registration_link').click(elgg.walled_garden.load('register'));
24 
25  $(document).on('click', 'input.elgg-button-cancel', function(event) {
26  var $wgs = $('.elgg-walledgarden-single');
27  if ($wgs.is(':visible')) {
28  $('.elgg-walledgarden-double').fadeToggle();
29  $wgs.fadeToggle();
30  $wgs.remove();
31  }
32  event.preventDefault();
33  });
34 };
35 
42 elgg.walled_garden.load = function(view) {
43  return function(event) {
44  require(['elgg/spinner'], function(spinner) {
45  var id = '#elgg-walledgarden-' + view;
46  id = id.replace('_', '-');
47  // @todo display some visual element that indicates that loading of content is running
48  elgg.get('walled_garden/' + view, {
49  beforeSend: spinner.start,
50  complete: spinner.stop,
51  success: function(data) {
52  var $wg = $('.elgg-body-walledgarden');
53  $wg.append(data);
54  $(id).find('input.elgg-button-submit').after(<?php echo $cancel_button; ?>);
55 
56  if (view == 'register' && $wg.hasClass('hidden')) {
57  // this was a failed registration, display the register form ASAP
58  $('#elgg-walledgarden-login').toggle(false);
59  $(id).toggle();
60  $wg.removeClass('hidden');
61  } else {
62  $('#elgg-walledgarden-login').fadeToggle();
63  $(id).fadeToggle();
64  }
65  }
66  });
67 
68  });
69 
70  event.preventDefault();
71  };
72 };
73 
74 elgg.register_hook_handler('init', 'system', elgg.walled_garden.init);
elgg
Definition: install.js:23
$CONFIG view
The current view type.
Definition: config.php:149
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$cancel_button
Walled garden JavaScript.
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed on
Definition: GPL-LICENSE.txt:43
elgg echo
Translates a string.
Definition: languages.js:48
elgg require
Throw an error if the required package isn&#39;t present.
Definition: elgglib.js:164
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:342
function elgg combo checkbox click(function(){if($(this).is(':checked')){$(this).prev().attr('disabled', true);$(this).prev().val('');}else{$(this).prev().attr('disabled', false);}})
GNU GENERAL PUBLIC LICENSE June Free Software Inc Franklin Fifth MA USA Everyone is permitted to copy and distribute verbatim copies of this license document
Definition: GPL-LICENSE.txt:4
elgg message elgg state success
Definition: admin.css.php:252