*/
elgg.reload_all_translations = function(language) {
var lang = language || elgg.get_language();
- // This...................vvvvv is a double encoded question mark (? -> %2f -> %252f)
- elgg.getJSON('js/languages%252f' + lang + '.js', {
- data: {
- 'viewtype': 'default',
- 'lastcache': elgg.config.lastcache
- },
+
+ elgg.getJSON('ajax/view/js/languages/' + lang, {
success: function(json) {
elgg.add_translation(lang, json);
}
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');
<?php
/**
- *
+ * Initialize Elgg's js lib with the uncacheable data
*/
?>
* 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) {
$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();
$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