aboutsummaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
committerSem <sembrestels@riseup.net>2013-03-13 02:13:17 +0100
commitd730a0c5861c2e79faa3e58dd2b171ca4d197c6f (patch)
treecb4658e1c60a60c5f663845d49b108dd4608a89a /js
parent0fb3e5396d10d21323eb3bbc04727fd4a5a6d06d (diff)
parent34b14b305f5a106316fdc403c4ce80b25e89b51d (diff)
downloadelgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.gz
elgg-d730a0c5861c2e79faa3e58dd2b171ca4d197c6f.tar.bz2
Merge tag '1.8.14' of git://github.com/Elgg/Elgg into foxglove-3
Elgg 1.8.14 Conflicts: mod/tinymce/vendor/tinymce/jscripts/tiny_mce/langs/en.js mod/tinymce/vendor/tinymce/jscripts/tiny_mce/themes/advanced/langs/en_dlg.js
Diffstat (limited to 'js')
-rw-r--r--js/lib/languages.js9
-rw-r--r--js/lib/security.js33
-rw-r--r--js/lib/ui.river.js26
3 files changed, 25 insertions, 43 deletions
diff --git a/js/lib/languages.js b/js/lib/languages.js
index 99a1ba0ee..44ea56d2b 100644
--- a/js/lib/languages.js
+++ b/js/lib/languages.js
@@ -28,13 +28,8 @@ elgg.reload_all_translations = function(language) {
var lang = language || elgg.get_language();
var url, options;
- if (elgg.config.simplecache_enabled) {
- url = 'cache/js/default/languages/' + lang + '.' + elgg.config.lastcache + '.js';
- options = {};
- } else {
- url = 'ajax/view/js/languages';
- options = {data: {language: lang}};
- }
+ url = 'ajax/view/js/languages';
+ options = {data: {language: lang}};
options['success'] = function(json) {
elgg.add_translation(lang, json);
diff --git a/js/lib/security.js b/js/lib/security.js
index 61aa1cfcd..9c12f8586 100644
--- a/js/lib/security.js
+++ b/js/lib/security.js
@@ -7,6 +7,8 @@ elgg.security.token = {};
elgg.security.tokenRefreshFailed = false;
+elgg.security.tokenRefreshTimer = null;
+
/**
* Sets the currently active security token and updates all forms and links on the current page.
*
@@ -30,31 +32,17 @@ elgg.security.setToken = function(json) {
};
/**
- * Security tokens time out, so lets refresh those every so often.
+ * Security tokens time out so we refresh those every so often.
*
- * @todo handle error and bad return data
+ * @private
*/
elgg.security.refreshToken = function() {
elgg.action('security/refreshtoken', function(data) {
-
- // @todo might want to move this to setToken() once http://trac.elgg.org/ticket/3127
- // is implemented. It's here right now to avoid soggy code.
- if (!data || !(data.output.__elgg_ts && data.output.__elgg_token)) {
- elgg.register_error(elgg.echo('js:security:token_refresh_failed', [elgg.get_site_url()]));
- elgg.security.tokenRefreshFailed = true;
-
- // don't setToken because we refresh every 5 minutes and tokens are good for 1
- // hour by default
- return;
- }
-
- // if had problems last time, let them know it's working now
- if (elgg.security.tokenRefreshFailed) {
- elgg.system_message(elgg.echo('js:security:token_refreshed', [elgg.get_site_url()]));
- elgg.security.tokenRefreshFailed = false;
+ if (data && data.output.__elgg_ts && data.output.__elgg_token) {
+ elgg.security.setToken(data.output);
+ } else {
+ clearInterval(elgg.security.tokenRefreshTimer);
}
-
- elgg.security.setToken(data.output);
});
};
@@ -112,9 +100,8 @@ elgg.security.addToken = function(data) {
};
elgg.security.init = function() {
- //refresh security token every 5 minutes
- //this is set in the js/elgg PHP view.
- setInterval(elgg.security.refreshToken, elgg.security.interval);
+ // elgg.security.interval is set in the js/elgg PHP view.
+ elgg.security.tokenRefreshTimer = setInterval(elgg.security.refreshToken, elgg.security.interval);
};
elgg.register_hook_handler('boot', 'system', elgg.security.init); \ No newline at end of file
diff --git a/js/lib/ui.river.js b/js/lib/ui.river.js
index a56a664a4..c103fabb3 100644
--- a/js/lib/ui.river.js
+++ b/js/lib/ui.river.js
@@ -1,14 +1,14 @@
-elgg.provide('elgg.ui.river');
-
-elgg.ui.river.init = function() {
- $('#elgg-river-selector').change(function() {
- var url = window.location.href;
- if (window.location.search.length) {
- url = url.substring(0, url.indexOf('?'));
- }
- url += '?' + $(this).val();
- elgg.forward(url);
- });
-};
-
+elgg.provide('elgg.ui.river');
+
+elgg.ui.river.init = function() {
+ $('#elgg-river-selector').change(function() {
+ var url = window.location.href;
+ if (window.location.search.length) {
+ url = url.substring(0, url.indexOf('?'));
+ }
+ url += '?' + $(this).val();
+ elgg.forward(url);
+ });
+};
+
elgg.register_hook_handler('init', 'system', elgg.ui.river.init); \ No newline at end of file