Elgg  Version 4.3
Functions | Variables
deprecated.js File Reference

Go to the source code of this file.

Functions

elgg provide ('elgg.config')
 
elgg inherit (elgg.ElggUser, elgg.ElggEntity)
 
 if (elgg.session.user)
 

Variables

elgg global = this
 Pointer to the global context. More...
 
elgg ACCESS_PRIVATE = 0
 Duplicate of the server side ACCESS_PRIVATE access level. More...
 
elgg nullFunction = function() {}
 Convenience reference to an empty function. More...
 
elgg abstractMethod
 
elgg extend = jQuery.extend
 Merges two or more objects together and returns the result. More...
 
elgg isArray = jQuery.isArray
 Check if the value is an array. More...
 
elgg isFunction = jQuery.isFunction
 Check if the value is a function. More...
 
elgg isPlainObject = jQuery.isPlainObject
 Check if the value is a "plain" object (i.e., created by {} or new Object()) More...
 
elgg isString
 Check if the value is a string. More...
 
elgg isNumber
 Check if the value is a number. More...
 
elgg isObject
 Check if the value is an object. More...
 
elgg isUndefined
 Check if the value is undefined. More...
 
elgg isNull
 Check if the value is null. More...
 
elgg isNullOrUndefined
 Check if the value is either null or undefined. More...
 
elgg require
 Throw an error if the required package isn't present. More...
 
elgg provide
 
elgg session cookie
 Helper function for setting cookies. More...
 
elgg clear_system_messages
 Helper function to remove all current system messages. More...
 
elgg system_message
 Wrapper function for system_messages. More...
 
elgg register_error
 Wrapper function for system_messages. More...
 
elgg security addToken
 Add elgg action tokens to an object, URL, or query string (with a ?). More...
 
elgg inherit
 
elgg ElggEntity
 
elgg ElggUser
 
elgg ElggUser prototype isAdmin
 Is this user an admin? More...
 
elgg get_logged_in_user_entity
 Returns the object of the user logged in. More...
 
elgg get_page_owner_guid
 
elgg add_translation
 Analagous to the php version. More...
 
elgg get_language
 Get the current language. More...
 
elgg echo
 Translates a string. More...
 
elgg ui registerTogglableMenuItems
 This function registers two menu items that are actions that are the opposite of each other and ajaxifies them. More...
 

Function Documentation

if ( elgg.session.  user)

Definition at line 474 of file deprecated.js.

elgg inherit ( elgg.  ElggUser,
elgg.  ElggEntity 
)
elgg provide ( 'elgg.config'  )

Variable Documentation

elgg abstractMethod
Initial value:
= function() {
throw new Error("Oops... you forgot to implement an abstract method!");
}

Definition at line 38 of file deprecated.js.

elgg ACCESS_PRIVATE = 0

Duplicate of the server side ACCESS_PRIVATE access level.

This is a temporary hack to prevent having to mix up js and PHP in js views.

Definition at line 18 of file deprecated.js.

elgg add_translation
Initial value:
= function(lang, translations) {
var i18n = require('elgg/i18n');
i18n.addTranslation(lang, translations);
}
elgg require
Throw an error if the required package isn't present.
Definition: deprecated.js:176

Analagous to the php version.

Merges translations for a given language into the current translations map.

Definition at line 501 of file deprecated.js.

elgg security addToken
Initial value:
= function (data) {
var security = require('elgg/security');
return security.addToken(data);
}
elgg require
Throw an error if the required package isn't present.
Definition: deprecated.js:176

Add elgg action tokens to an object, URL, or query string (with a ?).

Parameters
{FormData|Object|string}data
Returns
{FormData|Object|string} The new data object including action tokens

Definition at line 389 of file deprecated.js.

elgg clear_system_messages
Initial value:
= function() {
require(['elgg/system_messages'], function(messages) {
messages.clear();
});
}
elgg require
Throw an error if the required package isn't present.
Definition: deprecated.js:176

Helper function to remove all current system messages.

Definition at line 352 of file deprecated.js.

read string $name Name of the cookie

Helper function for setting cookies.

A simple object model for an HTTP cookie.

Parameters
{string}name
{string}value
{Object}options

{number|Date} options[expires] {string} options[path] {string} options[domain] {boolean} options[secure]

Returns
{string|undefined} The value of the cookie, if only name is specified. Undefined if no value set
See also
elgg_set_cookie()
http://php.net/manual/en/function.setcookie.php
http://php.net/manual/en/function.session-set-cookie-params.php
Since
1.9.0
Examples:
/root/Elgg/views/default/core/js/deprecated.js.

Definition at line 270 of file deprecated.js.

elgg echo
Initial value:
= function(key, argv, language) {
var i18n = require('elgg/i18n');
return i18n.echo(key, argv, language);
}
elgg require
Throw an error if the required package isn't present.
Definition: deprecated.js:176
Bundled plugins(the contents of the"/mod"directory) are available only under the GPLv2 license.The remainder of the project is available under either MIT or GPLv2.Both licenses can be found below.More info 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 we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term"modification".) Each licensee is addressed as"you".Activities other than copying

Translates a string.

Note
The current system only loads a single language module per page, and it comes pre-merged with English translations. Hence, elgg.echo() can only return translations in the language returned by elgg.get_language(). Requests for other languages will fail unless a 3rd party plugin has manually used elgg.add_translation() to merge the language module ahead of time.
Parameters
{String}key Message key
{Array}argv vsprintf() arguments
{String}language Requested language. Not recommended (see above).
Returns
{String} The translation or the given key if no translation available

Definition at line 530 of file deprecated.js.

Initial value:
= function(o) {
$.extend(this, o);
}

Definition at line 437 of file deprecated.js.

Initial value:
= function(o) {
elgg.ElggEntity.call(this, o);
}
var elgg
Definition: elgglib.js:4

Definition at line 453 of file deprecated.js.

elgg extend = jQuery.extend

Merges two or more objects together and returns the result.

Definition at line 47 of file deprecated.js.

elgg get_language
Initial value:
= function() {
return elgg.config.current_language;
}
var elgg
Definition: elgglib.js:4

Get the current language.

Returns
{String}

Definition at line 511 of file deprecated.js.

elgg get_logged_in_user_entity
Initial value:
= function() {
return elgg.session.user;
}
var elgg
Definition: elgglib.js:4

Returns the object of the user logged in.

Returns
{ElggUser} The logged in user

Definition at line 484 of file deprecated.js.

elgg get_page_owner_guid
Initial value:
= function() {
return elgg.page_owner ? elgg.page_owner.guid : 0;
}
var elgg
Definition: elgglib.js:4
Returns
{number} The GUID of the page owner entity or 0 for no owner

Definition at line 492 of file deprecated.js.

elgg global = this

Pointer to the global context.

See also
elgg.require
elgg.provide

Definition at line 9 of file deprecated.js.

elgg inherit
Initial value:
= function(Child, Parent) {
Child.prototype = new Parent();
Child.prototype.constructor = Child;
}

Definition at line 418 of file deprecated.js.

elgg ElggUser prototype isAdmin
Initial value:
= function() {
return this.admin;
}

Is this user an admin?

Warning
The admin state of the user should be checked on the server for any actions taken that require admin privileges.
Returns
{boolean}

Definition at line 468 of file deprecated.js.

elgg isArray = jQuery.isArray

Check if the value is an array.

No sense in reinventing the wheel!

Parameters
{*}val
Returns
boolean

Definition at line 60 of file deprecated.js.

elgg isFunction = jQuery.isFunction

Check if the value is a function.

No sense in reinventing the wheel!

Parameters
{*}val
Returns
boolean

Definition at line 73 of file deprecated.js.

elgg isNull
Initial value:
= function(val) {
return val === null;
}

Check if the value is null.

Parameters
{*}val
Returns
boolean

Definition at line 152 of file deprecated.js.

elgg isNullOrUndefined
Initial value:
= function(val) {
return val == null;
}

Check if the value is either null or undefined.

Parameters
{*}val
Returns
boolean

Definition at line 165 of file deprecated.js.

elgg isNumber
Initial value:
= function(val) {
return typeof val === 'number';
}

Check if the value is a number.

Parameters
{*}val
Returns
boolean

Definition at line 110 of file deprecated.js.

elgg isObject
Initial value:
= function(val) {
return typeof val === 'object';
}

Check if the value is an object.

Note
This returns true for functions and arrays! If you want to return true only for "plain" objects (created using {} or new Object()) use $.isPlainObject.
Parameters
{*}val
Returns
boolean

Definition at line 126 of file deprecated.js.

elgg isPlainObject = jQuery.isPlainObject

Check if the value is a "plain" object (i.e., created by {} or new Object())

No sense in reinventing the wheel!

Parameters
{*}val
Returns
boolean

Definition at line 86 of file deprecated.js.

elgg isString
Initial value:
= function(val) {
return typeof val === 'string';
}

Check if the value is a string.

Parameters
{*}val
Returns
boolean

Definition at line 97 of file deprecated.js.

elgg isUndefined
Initial value:
= function(val) {
return val === undefined;
}

Check if the value is undefined.

Parameters
{*}val
Returns
boolean

Definition at line 139 of file deprecated.js.

elgg nullFunction = function() {}

Convenience reference to an empty function.

Save memory by not generating multiple empty functions.

Definition at line 27 of file deprecated.js.

elgg provide
Initial value:
= function(pkg, opt_context) {
var parts,
context = opt_context || elgg.global,
part, i;
if (Array.isArray(pkg)) {
parts = pkg;
} else {
elgg.assertTypeOf('string', pkg);
parts = pkg.split('.');
}
for (i = 0; i < parts.length; i += 1) {
part = parts[i];
context[part] = context[part] || {};
context = context[part];
}
}
var elgg
Definition: elgglib.js:4

Definition at line 226 of file deprecated.js.

elgg register_error
Initial value:
= function(errors, delay) {
require(['elgg/system_messages'], function(messages) {
messages.error(errors, delay);
});
}
elgg require
Throw an error if the required package isn&#39;t present.
Definition: deprecated.js:176

Wrapper function for system_messages.

Specifies "errors" as the type of message

Parameters
{String}errors The error message to display
{Number}delay How long to dispaly the error message (milliseconds)

Definition at line 376 of file deprecated.js.

elgg ui registerTogglableMenuItems
Initial value:
= function(menuItemNameA, menuItemNameB) {
require(['navigation/menu/elements/item_toggle'], function() {
menuItemNameA = menuItemNameA.replace('_', '-');
menuItemNameB = menuItemNameB.replace('_', '-');
$('.elgg-menu-item-' + menuItemNameA + ' a').not('[data-toggle]').attr('data-toggle', menuItemNameB);
$('.elgg-menu-item-' + menuItemNameB + ' a').not('[data-toggle]').attr('data-toggle', menuItemNameA);
});
}
elgg require
Throw an error if the required package isn&#39;t present.
Definition: deprecated.js:176

This function registers two menu items that are actions that are the opposite of each other and ajaxifies them.

E.g. like/unlike, friend/unfriend, ban/unban, etc.

You can also add the data parameter 'data-toggle' to menu items to have them automatically registered as toggleable without the need to call this function.

Definition at line 543 of file deprecated.js.

elgg require
Initial value:
= function(pkg) {
elgg.assertTypeOf('string', pkg);
var parts = pkg.split('.'),
cur = elgg.global,
part, i;
for (i = 0; i < parts.length; i += 1) {
part = parts[i];
cur = cur[part];
if (cur === undefined) {
throw new Error("Missing package: " + pkg);
}
}
}
var elgg
Definition: elgglib.js:4

Throw an error if the required package isn't present.

Parameters
{String}pkg The required package (e.g., 'elgg.package')
Examples:
/root/Elgg/views/default/core/js/deprecated.js.

Definition at line 176 of file deprecated.js.

elgg system_message
Initial value:
= function(msgs, delay) {
require(['elgg/system_messages'], function(messages) {
messages.success(msgs, delay);
});
}
elgg require
Throw an error if the required package isn&#39;t present.
Definition: deprecated.js:176

Wrapper function for system_messages.

Specifies "success" as the type of message

Parameters
{String}msgs The message to display
{Number}delay How long to display the message (milliseconds)

Definition at line 364 of file deprecated.js.