diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-02 04:23:04 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-02 04:23:04 +0000 |
commit | f7ae28ea45656d2821262998e9a71c351dcced8c (patch) | |
tree | c0bed93d6a879ca0ee3c2c35a58c8290c10afbe0 /views | |
parent | af335c48fc3f4a741e7b5650db46aac48183c244 (diff) | |
download | elgg-f7ae28ea45656d2821262998e9a71c351dcced8c.tar.gz elgg-f7ae28ea45656d2821262998e9a71c351dcced8c.tar.bz2 |
Refs #2538: Added Elggy event system. Javascript boot sequence mimics PHP.
git-svn-id: http://code.elgg.org/elgg/trunk@7186 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views')
-rw-r--r-- | views/default/js/initialise_elgg.php | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/views/default/js/initialise_elgg.php b/views/default/js/initialise_elgg.php index b6c3f7ecd..98dfc28a7 100644 --- a/views/default/js/initialise_elgg.php +++ b/views/default/js/initialise_elgg.php @@ -4,12 +4,23 @@ */ global $CONFIG; -//Include library files -$lib_files = array( - //core - 'elgglib', +include("{$CONFIG->path}engine/js/lib/elgglib.js"); +//No such thing as autoloading classes in javascript +$model_files = array( + 'ElggEntity', + 'ElggUser', + 'ElggPriorityList', +); + +foreach($model_files as $file) { + include("{$CONFIG->path}engine/js/classes/$file.js"); +} + +//Include library files +$libs = array( //libraries + 'events', 'security', 'languages', 'ajax', @@ -20,23 +31,12 @@ $lib_files = array( 'ui.widgets', ); -foreach($lib_files as $file) { +foreach($libs as $file) { include("{$CONFIG->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 + * Set some values that are cacheable */ ?> @@ -45,6 +45,16 @@ elgg.release = '<?php echo get_version(true); ?>'; elgg.config.wwwroot = '<?php echo elgg_get_site_url(); ?>'; elgg.security.interval = 5 * 60 * 1000; <?php //TODO make this configurable ?> +//Mimic PHP engine boot process + +//Before the DOM is ready -- note that plugins aren't loaded yet +elgg.trigger_event('boot', 'system'); + +//After the DOM is ready +$(function() { + elgg.trigger_event('init', 'system'); +}); + $(document).ready(function () { // COLLAPSABLE WIDGETS (on Dashboard? & Profile pages) |