aboutsummaryrefslogtreecommitdiff
path: root/views/default/js
diff options
context:
space:
mode:
authorewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-10 03:11:52 +0000
committerewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-10 03:11:52 +0000
commitace72189a7f56fbba898ee1ccb52fd7eba80ae2e (patch)
tree91f27fc2b6aa412590adbc7b6b3201b08aaf391b /views/default/js
parent05dafefe7accb7225e071c303e7ac5e778151f51 (diff)
downloadelgg-ace72189a7f56fbba898ee1ccb52fd7eba80ae2e.tar.gz
elgg-ace72189a7f56fbba898ee1ccb52fd7eba80ae2e.tar.bz2
Refs #3182: Feeding language loading through /ajax/view to keep thing simpler for now. Reorganized boot process so that we can ajax load the languages asap
git-svn-id: http://code.elgg.org/elgg/trunk@8976 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/js')
-rw-r--r--views/default/js/elgg.php5
-rw-r--r--views/default/js/initialize_elgg.php13
2 files changed, 10 insertions, 8 deletions
diff --git a/views/default/js/elgg.php b/views/default/js/elgg.php
index a434afc7d..76388f80c 100644
--- a/views/default/js/elgg.php
+++ b/views/default/js/elgg.php
@@ -57,11 +57,6 @@ 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_hook('boot', 'system');
-
//After the DOM is ready
$(function() {
elgg.trigger_hook('init', 'system');
diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php
index 9032d8a63..cdadd4d32 100644
--- a/views/default/js/initialize_elgg.php
+++ b/views/default/js/initialize_elgg.php
@@ -1,6 +1,6 @@
<?php
/**
- *
+ * Initialize Elgg's js lib with the uncacheable data
*/
?>
@@ -8,11 +8,15 @@
* Don't want to cache these -- they could change for every request
*/
elgg.config.lastcache = <?php echo (int)elgg_get_config('lastcache'); ?>;
+elgg.config.viewtype = '<?php echo elgg_get_viewtype(); ?>';
+elgg.config.simplecache_enabled = <?php echo elgg_is_simplecache_enabled(); ?>;
elgg.security.token.__elgg_ts = <?php echo $ts = time(); ?>;
elgg.security.token.__elgg_token = '<?php echo generate_action_token($ts); ?>';
<?php
+// @todo json export should be smoother than this...
+// @todo Might also be nice to make url exportable. $entity->url? yes please!
$page_owner = elgg_get_page_owner_entity();
if ($page_owner instanceof ElggEntity) {
@@ -24,7 +28,7 @@ if ($page_owner instanceof ElggEntity) {
$page_owner_json['subtype'] = $page_owner->getSubtype();
$page_owner_json['url'] = $page_owner->getURL();
- echo 'elgg.page_owner = '.json_encode($page_owner_json).';';
+ echo 'elgg.page_owner = ' . json_encode($page_owner_json) . ';';
}
$user = elgg_get_logged_in_user_entity();
@@ -38,6 +42,9 @@ if ($user instanceof ElggUser) {
$user_json['subtype'] = $user->getSubtype();
$user_json['url'] = $user->getURL();
- echo 'elgg.session.user = new elgg.ElggUser('.json_encode($user_json).');';
+ echo 'elgg.session.user = new elgg.ElggUser(' . json_encode($user_json) . ');';
}
?>
+
+//Before the DOM is ready, but elgg's js framework is fully initalized
+elgg.trigger_hook('boot', 'system'); \ No newline at end of file