diff options
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) |