aboutsummaryrefslogtreecommitdiff
path: root/app/views/helpers/javascript_vars.phtml
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-31 14:45:37 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2015-01-31 14:45:37 +0100
commita97bbd9bd54c5fa56d54b3c214cf4e8af96af8b2 (patch)
tree6e83890bc1b3814a12c3b7bedc0d5944f30f507b /app/views/helpers/javascript_vars.phtml
parent42fd539a1b14f883077048a35864b4294b6efe94 (diff)
parente91b72b63cd11ae3c4f59e48439e93955242c673 (diff)
Merge branch 'dev'
Conflicts: CHANGELOG README.fr.md README.md app/Controllers/feedController.php app/Controllers/indexController.php app/i18n/en.php app/i18n/fr.php app/views/helpers/view/normal_view.phtml app/views/stats/index.phtml app/views/stats/repartition.phtml constants.php p/scripts/main.js
Diffstat (limited to 'app/views/helpers/javascript_vars.phtml')
-rw-r--r--app/views/helpers/javascript_vars.phtml114
1 files changed, 62 insertions, 52 deletions
diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml
index 1139eb446..adf0783f3 100644
--- a/app/views/helpers/javascript_vars.phtml
+++ b/app/views/helpers/javascript_vars.phtml
@@ -1,61 +1,71 @@
+"use strict";
<?php
-echo '"use strict";', "\n";
+$mark = FreshRSS_Context::$user_conf->mark_when;
+$mail = Minz_Session::param('mail', false);
+$auto_actualize = Minz_Session::param('actualize_feeds', false);
+$hide_posts = (FreshRSS_Context::$user_conf->display_posts ||
+ Minz_Request::param('output') === 'reader');
+$s = FreshRSS_Context::$user_conf->shortcuts;
-$mark = $this->conf->mark_when;
-echo 'var ',
- 'help_url="', FRESHRSS_WIKI, '"',
- ',hide_posts=', ($this->conf->display_posts || Minz_Request::param('output') === 'reader') ? 'false' : 'true',
- ',display_order="', Minz_Request::param('order', $this->conf->sort_order), '"',
- ',auto_mark_article=', $mark['article'] ? 'true' : 'false',
- ',auto_mark_site=', $mark['site'] ? 'true' : 'false',
- ',auto_mark_scroll=', $mark['scroll'] ? 'true' : 'false',
- ',auto_load_more=', $this->conf->auto_load_more ? 'true' : 'false',
- ',does_lazyload=', $this->conf->lazyload ? 'true' : 'false',
- ',sticky_post=', $this->conf->sticky_post ? 'true' : 'false';
+$url_login = Minz_Url::display(array(
+ 'c' => 'auth',
+ 'a' => 'login'
+), 'php');
+$url_logout = Minz_Url::display(array(
+ 'c' => 'auth',
+ 'a' => 'logout'
+), 'php');
-$s = $this->conf->shortcuts;
-echo ',shortcuts={',
- 'mark_read:"', $s['mark_read'], '",',
- 'mark_favorite:"', $s['mark_favorite'], '",',
- 'go_website:"', $s['go_website'], '",',
- 'prev_entry:"', $s['prev_entry'], '",',
- 'next_entry:"', $s['next_entry'], '",',
- 'first_entry:"', $s['first_entry'], '",',
- 'last_entry:"', $s['last_entry'], '",',
- 'collapse_entry:"', $s['collapse_entry'], '",',
- 'load_more:"', $s['load_more'], '",',
- 'auto_share:"', $s['auto_share'], '",',
- 'focus_search:"', $s['focus_search'], '",',
- 'user_filter:"', $s['user_filter'], '",',
- 'help:"', $s['help'], '"',
+echo 'var context={',
+ 'auto_remove_article:', FreshRSS_Context::isAutoRemoveAvailable() ? 'true' : 'false', ',',
+ 'hide_posts:', $hide_posts ? 'false' : 'true', ',',
+ 'display_order:"', Minz_Request::param('order', FreshRSS_Context::$user_conf->sort_order), '",',
+ 'auto_mark_article:', $mark['article'] ? 'true' : 'false', ',',
+ 'auto_mark_site:', $mark['site'] ? 'true' : 'false', ',',
+ 'auto_mark_scroll:', $mark['scroll'] ? 'true' : 'false', ',',
+ 'auto_load_more:', FreshRSS_Context::$user_conf->auto_load_more ? 'true' : 'false', ',',
+ 'auto_actualize_feeds:', $auto_actualize ? 'true' : 'false', ',',
+ 'does_lazyload:', FreshRSS_Context::$user_conf->lazyload ? 'true' : 'false', ',',
+ 'sticky_post:', FreshRSS_Context::isStickyPostEnabled() ? 'true' : 'false', ',',
+ 'html5_notif_timeout:', FreshRSS_Context::$user_conf->html5_notif_timeout, ',',
+ 'auth_type:"', FreshRSS_Context::$system_conf->auth_type, '",',
+ 'current_user_mail:', $mail ? ('"' . $mail . '"') : 'null', ',',
+ 'current_view:"', Minz_Request::param('output', 'normal'), '"',
"},\n";
-if (Minz_Request::param ('output') === 'global') {
- echo "iconClose='", FreshRSS_Themes::icon('close'), "',\n";
-}
-
-$authType = Minz_Configuration::authType();
-if ($authType === 'persona') {
- // If user is disconnected, current_user_mail MUST be null
- $mail = Minz_Session::param ('mail', false);
- if ($mail) {
- echo 'current_user_mail="' . $mail . '",';
- } else {
- echo 'current_user_mail=null,';
- }
-}
-
-echo 'authType="', $authType, '",',
- 'url_freshrss="', _url ('index', 'index'), '",',
- 'url_login="', _url ('index', 'login'), '",',
- 'url_logout="', _url ('index', 'logout'), '",';
+echo 'shortcuts={',
+ 'mark_read:"', @$s['mark_read'], '",',
+ 'mark_favorite:"', @$s['mark_favorite'], '",',
+ 'go_website:"', @$s['go_website'], '",',
+ 'prev_entry:"', @$s['prev_entry'], '",',
+ 'next_entry:"', @$s['next_entry'], '",',
+ 'first_entry:"', @$s['first_entry'], '",',
+ 'last_entry:"', @$s['last_entry'], '",',
+ 'collapse_entry:"', @$s['collapse_entry'], '",',
+ 'load_more:"', @$s['load_more'], '",',
+ 'auto_share:"', @$s['auto_share'], '",',
+ 'focus_search:"', @$s['focus_search'], '",',
+ 'user_filter:"', @$s['user_filter'], '",',
+ 'help:"', @$s['help'], '",',
+ 'close_dropdown:"', @$s['close_dropdown'], '"',
+"},\n";
-echo 'str_confirmation_default="', Minz_Translate::t('confirm_action'), '"', ",\n";
-echo 'str_notif_title_articles="', Minz_Translate::t('notif_title_new_articles'), '"', ",\n";
-echo 'str_notif_body_articles="', Minz_Translate::t('notif_body_new_articles'), '"', ",\n";
-echo 'html5_notif_timeout=', $this->conf->html5_notif_timeout,",\n";
+echo 'url={',
+ 'index:"', _url('index', 'index'), '",',
+ 'login:"', $url_login, '",',
+ 'logout:"', $url_logout, '",',
+ 'help:"', FRESHRSS_WIKI, '"',
+"},\n";
+echo 'i18n={',
+ 'confirmation_default:"', _t('gen.js.confirm_action'), '",',
+ 'notif_title_articles:"', _t('gen.js.feedback.title_new_articles'), '",',
+ 'notif_body_articles:"', _t('gen.js.feedback.body_new_articles'), '",',
+ 'notif_request_failed:"', _t('gen.js.feedback.request_failed'), '",',
+ 'category_empty:"', _t('gen.js.category_empty'), '"',
+"},\n";
-$autoActualise = Minz_Session::param('actualize_feeds', false);
-echo 'auto_actualize_feeds=', $autoActualise ? 'true' : 'false', ";\n";
+echo 'icons={',
+ 'close:\'', _i('close'), '\'',
+"}\n"; \ No newline at end of file