From 4a2721032e5adb4ad2460befd9af77be4996d2a0 Mon Sep 17 00:00:00 2001 From: ewinslow Date: Mon, 1 Nov 2010 22:11:20 +0000 Subject: Refs #2538: Added some models, inheritance, more bootstrapping code git-svn-id: http://code.elgg.org/elgg/trunk@7183 36083f99-b078-4883-b0ff-0f9b5a30f544 --- views/default/js/initialise_elgg.php | 93 +++++++++++++++++++----------------- views/default/js/languages.php | 9 ++++ views/default/js/languages/en.php | 2 + 3 files changed, 60 insertions(+), 44 deletions(-) create mode 100644 views/default/js/languages.php create mode 100644 views/default/js/languages/en.php (limited to 'views/default/js') diff --git a/views/default/js/initialise_elgg.php b/views/default/js/initialise_elgg.php index 6b7a318e7..b6c3f7ecd 100644 --- a/views/default/js/initialise_elgg.php +++ b/views/default/js/initialise_elgg.php @@ -1,3 +1,50 @@ +path}engine/js/lib/$file.js"); +} + +//Include classes +$model_files = array( + 'ElggEntity', + + 'ElggUser', +); + +foreach($model_files as $file) { + include("{$CONFIG->path}engine/js/classes/$file.js"); +} + +/** + * Finally, set some values that are cacheable + */ +?> + +elgg.version = ''; +elgg.release = ''; +elgg.config.wwwroot = ''; +elgg.security.interval = 5 * 60 * 1000; + $(document).ready(function () { // COLLAPSABLE WIDGETS (on Dashboard? & Profile pages) @@ -79,6 +126,8 @@ $(document).ready(function () { $(this).next(".likes_list").animate({opacity: "toggle", top: topPosition}, 500); } }); + + elgg_system_message(); }); /* end document ready function */ @@ -196,50 +245,6 @@ function widget_moreinfo() { }); }; -// COOKIES -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason. - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; - // ELGG DROP DOWN MENU $.fn.elgg_dropdownmenu = function(options) { diff --git a/views/default/js/languages.php b/views/default/js/languages.php new file mode 100644 index 000000000..34367aaf1 --- /dev/null +++ b/views/default/js/languages.php @@ -0,0 +1,9 @@ +translations[$language]); \ No newline at end of file diff --git a/views/default/js/languages/en.php b/views/default/js/languages/en.php new file mode 100644 index 000000000..afcf4bb7f --- /dev/null +++ b/views/default/js/languages/en.php @@ -0,0 +1,2 @@ + 'en')); \ No newline at end of file -- cgit v1.2.3