Elgg  Version 4.x
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);
}
$new_user language
Definition: useradd.php:58
elgg require
Throw an error if the required package isn't present.
Definition: deprecated.js:176

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.