Elgg  Version 2.3
walled_garden.js
Go to the documentation of this file.
1 
4 define(function (require) {
5 
6  var elgg = require('elgg');
7  var $ = require('jquery');
8  var Ajax = require('elgg/Ajax');
9  var ajax = new Ajax();
10 
11  var walled_garden = {
16  init: function () {
17 
18  // Remove lightbox/popup bindings, if any
19  $('.forgot_link,.registration_link').removeClass('elgg-lightbox');
20  $('.forgot_link[rel="popup"],.registration_link[rel="popup"]').prop('rel', false);
21 
22  $(document).on('click', '.forgot_link', walled_garden.load('lost_password'));
23  $(document).on('click', '.registration_link', 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  // only run this function once
36  walled_garden.init = elgg.nullFunction;
37  },
44  load: function (view) {
45  return function (event) {
46  var id = '#elgg-walledgarden-' + view;
47  id = id.replace('_', '-');
48 
49  ajax.path('walled_garden/' + view).done(function (data, statusText, jqXHR) {
50  if (jqXHR.AjaxData.status === -1) {
51  return;
52  }
53 
54  var $wg = $('.elgg-body-walledgarden');
55  $wg.append(data);
56 
57  $(id).find('input.elgg-button-submit').after($('#elgg-walled-garden-cancel').html());
58 
59  if (view === 'register' && $wg.hasClass('hidden')) {
60  // this was a failed registration, display the register form ASAP
61  $('#elgg-walledgarden-login').toggle(false);
62  $(id).toggle();
63  $wg.removeClass('hidden');
64  } else {
65  $('#elgg-walledgarden-login').fadeToggle();
66  $(id).fadeToggle();
67  }
68  });
69 
70  event.preventDefault();
71  };
72  }
73  }
74 
75  require(['elgg/ready'], function () {
76  elgg.register_hook_handler('init', 'system', walled_garden.init);
77  });
78 
79  // BC implementation
80  // @todo: remove in 3.0
81  elgg.provide('elgg.walled_garden');
82  elgg.walled_garden.init = function () {
83  elgg.deprecated_notice('elgg.walled_garden.init has been deprecated. Use elgg/walled_garden#init AMD method instead', '2.3');
84  return walled_garden.init.apply(this, arguments);
85  };
86  elgg.walled_garden.load = function () {
87  elgg.deprecated_notice('elgg.walled_garden.load has been deprecated. Use elgg/walled_garden#load AMD method instead', '2.3');
88  return walled_garden.init.apply(this, arguments);
89  };
90 
91  return walled_garden;
92 });
elgg
Definition: install.js:23
elgg comments init
Initialize comment inline editing.
Definition: comments.js:122
$CONFIG view
The current view type.
Definition: config.php:149
$CONFIG walled_garden
Is current site in walled garden mode?
Definition: config.php:170
html
Definition: admin.css.php:36
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 ajax
Wrapper function for jQuery.ajax which ensures that the url being called is relative to the elgg site...
Definition: ajax.js:19
elgg require
Throw an error if the required package isn't present.
Definition: elgglib.js:164
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
define(function(require){var elgg=require('elgg');var $=require('jquery');var Ajax=require('elgg/Ajax');var ajax=new Ajax();var walled_garden={init:function(){$('.forgot_link,.registration_link').removeClass('elgg-lightbox');$('.forgot_link[rel="popup"],.registration_link[rel="popup"]').prop('rel', false);$(document).on('click', '.forgot_link', walled_garden.load('lost_password'));$(document).on('click', '.registration_link', walled_garden.load('register'));$(document).on('click', 'input.elgg-button-cancel', function(event){var $wgs=$('.elgg-walledgarden-single');if($wgs.is(':visible')){$('.elgg-walledgarden-double').fadeToggle();$wgs.fadeToggle();$wgs.remove();}event.preventDefault();});walled_garden.init=elgg.nullFunction;}, load:function(view){return function(event){var id= '#elgg-walledgarden-'+view;id=id.replace('_', '-');ajax.path('walled_garden/'+view).done(function(data, statusText, jqXHR){if(jqXHR.AjaxData.status===-1){return;}var $wg=$('.elgg-body-walledgarden');$wg.append(data);$(id).find('input.elgg-button-submit').after($('#elgg-walled-garden-cancel').html());if(view=== 'register'&&$wg.hasClass('hidden')){$('#elgg-walledgarden-login').toggle(false);$(id).toggle();$wg.removeClass('hidden');}else{$('#elgg-walledgarden-login').fadeToggle();$(id).fadeToggle();}});event.preventDefault();};}}require(['elgg/ready'], function(){elgg.register_hook_handler('init', 'system', walled_garden.init);});elgg.provide('elgg.walled_garden');elgg.walled_garden.init=function(){elgg.deprecated_notice('elgg.walled_garden.init has been deprecated.Use elgg/walled_garden#init AMD method instead', '2.3');return walled_garden.init.apply(this, arguments);};elgg.walled_garden.load=function(){elgg.deprecated_notice('elgg.walled_garden.load has been deprecated.Use elgg/walled_garden#load AMD method instead', '2.3');return walled_garden.init.apply(this, arguments);};return walled_garden;})
elgg/walled_garden