aboutsummaryrefslogtreecommitdiff
path: root/views/default/js/initialize_elgg.php
diff options
context:
space:
mode:
authorBrett Profitt <brett.profitt@gmail.com>2011-04-16 11:52:37 -0400
committerBrett Profitt <brett.profitt@gmail.com>2011-04-16 11:52:37 -0400
commit309dff2bf948ab191ccb1e8d4a777e49ad498820 (patch)
tree813350181be64e239287c0bb587a3a49320a49b7 /views/default/js/initialize_elgg.php
parent119ec1f1425ab77ed29c696d99c0c80df3886791 (diff)
parent2b2afd98c05139c1a5c25f1752e2bb412e26e335 (diff)
downloadelgg-309dff2bf948ab191ccb1e8d4a777e49ad498820.tar.gz
elgg-309dff2bf948ab191ccb1e8d4a777e49ad498820.tar.bz2
Merge branch 'master' of github.com:Elgg/Elgg
Diffstat (limited to 'views/default/js/initialize_elgg.php')
-rw-r--r--views/default/js/initialize_elgg.php13
1 files changed, 10 insertions, 3 deletions
diff --git a/views/default/js/initialize_elgg.php b/views/default/js/initialize_elgg.php
index 9032d8a63..09e0b27bc 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 (int)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