From 178af19fb0e7c13015e991593feea6a5f4aafcc0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 13 Feb 2014 21:01:12 +0100 Subject: Add possibility to open notification in JavaScript + new message Notifications can be opened directly in JavaScript Class .notification is now id #notification New message when there is no feed to refresh See 06abbd02c2d10934155b2464f73d8ecdb2a68de1 (comments) --- app/layout/layout.phtml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'app/layout') diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index d6a1737ee..1501df3c3 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -36,13 +36,18 @@ notification)) { + $msg = $this->notification['content']; + $status = $this->notification['type']; + invalidateHttpCache(); + } ?> -
- notification['content']; ?> +
+
- -- cgit v1.2.3 From 4dd673157b05fea5fe3643f16e22d01bbf005fe9 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Thu, 13 Feb 2014 21:45:25 +0100 Subject: Add possibility to anonymous to refresh feeds Obviously, it's optional! (and deactivate by default) Need some more tests? See #351 --- app/Controllers/feedController.php | 4 +++- app/Controllers/usersController.php | 7 ++++++- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/layout/nav_menu.phtml | 4 +++- app/views/configure/users.phtml | 10 ++++++++++ lib/Minz/Configuration.php | 19 ++++++++++++++++++- 7 files changed, 42 insertions(+), 4 deletions(-) (limited to 'app/layout') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 264607216..7114fc196 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -7,7 +7,9 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $token_param = Minz_Request::param ('token', ''); $token_is_ok = ($token != '' && $token == $token_param); $action = Minz_Request::actionName (); - if (!($token_is_ok && $action === 'actualize')) { + if (!(($token_is_ok || Minz_Configuration::allowAnonymousRefresh()) && + $action === 'actualize') + ) { Minz_Error::error ( 403, array ('error' => array (Minz_Translate::t ('access_denied'))) diff --git a/app/Controllers/usersController.php b/app/Controllers/usersController.php index 8314b75fc..bb4f34c5e 100644 --- a/app/Controllers/usersController.php +++ b/app/Controllers/usersController.php @@ -54,11 +54,16 @@ class FreshRSS_users_Controller extends Minz_ActionController { $anon = Minz_Request::param('anon_access', false); $anon = ((bool)$anon) && ($anon !== 'no'); + $anon_refresh = Minz_Request::param('anon_refresh', false); + $anon_refresh = ((bool)$anon_refresh) && ($anon_refresh !== 'no'); $auth_type = Minz_Request::param('auth_type', 'none'); if ($anon != Minz_Configuration::allowAnonymous() || - $auth_type != Minz_Configuration::authType()) { + $auth_type != Minz_Configuration::authType() || + $anon_refresh != Minz_Configuration::allowAnonymousRefresh()) { + Minz_Configuration::_authType($auth_type); Minz_Configuration::_allowAnonymous($anon); + Minz_Configuration::_allowAnonymousRefresh($anon_refresh); $ok &= Minz_Configuration::writeFile(); } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 369853610..fd51eb1ca 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -175,6 +175,7 @@ return array ( 'password_form' => 'Password
(for the Web-form login method)', 'persona_connection_email' => 'Login mail address
(for Mozilla Persona)', 'allow_anonymous' => 'Allow anonymous reading of the articles of the default user (%s)', + 'allow_anonymous_refresh' => 'Allow anonymous refresh of the articles', 'auth_token' => 'Authentication token', 'explain_token' => 'Allows to access RSS output of the default user without authentication.
%s?output=rss&token=%s', 'login_configuration' => 'Login', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 275c3b1d8..17e26f493 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -175,6 +175,7 @@ return array ( 'default_user' => 'Nom de l’utilisateur par défaut (16 caractères alphanumériques maximum)', 'persona_connection_email' => 'Adresse courriel de connexion
(pour Mozilla Persona)', 'allow_anonymous' => 'Autoriser la lecture anonyme des articles de l’utilisateur par défaut (%s)', + 'allow_anonymous_refresh' => 'Autoriser le rafraîchissement anonyme des flux', 'auth_token' => 'Jeton d’identification', 'explain_token' => 'Permet d’accéder à la sortie RSS de l’utilisateur par défaut sans besoin de s’authentifier.
%s?output=rss&token=%s', 'login_configuration' => 'Identification', diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index c807e6dd5..98064a6f7 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -6,9 +6,11 @@ - loginOk) { ?> + loginOk || Minz_Configuration::allowAnonymousRefresh()) { ?> + + loginOk) { ?>
+
+
+ +
+
+
diff --git a/lib/Minz/Configuration.php b/lib/Minz/Configuration.php index 572b9984d..b3de9e39e 100644 --- a/lib/Minz/Configuration.php +++ b/lib/Minz/Configuration.php @@ -52,6 +52,7 @@ class Minz_Configuration { private static $delay_cache = 3600; private static $default_user = ''; private static $allow_anonymous = false; + private static $allow_anonymous_refresh = false; private static $auth_type = 'none'; private static $db = array ( @@ -118,6 +119,9 @@ class Minz_Configuration { public static function allowAnonymous() { return self::$allow_anonymous; } + public static function allowAnonymousRefresh() { + return self::$allow_anonymous_refresh; + } public static function authType() { return self::$auth_type; } @@ -131,6 +135,9 @@ class Minz_Configuration { public static function _allowAnonymous($allow = false) { self::$allow_anonymous = ((bool)$allow) && self::canLogIn(); } + public static function _allowAnonymousRefresh($allow = false) { + self::$allow_anonymous_refresh = ((bool)$allow) && self::allowAnonymous(); + } public static function _authType($value) { $value = strtolower($value); switch ($value) { @@ -170,6 +177,7 @@ class Minz_Configuration { 'title' => self::$title, 'default_user' => self::$default_user, 'allow_anonymous' => self::$allow_anonymous, + 'allow_anonymous_refresh' => self::$allow_anonymous_refresh, 'auth_type' => self::$auth_type, ), 'db' => self::$db, @@ -276,7 +284,16 @@ class Minz_Configuration { self::_authType($general['auth_type']); } if (isset ($general['allow_anonymous'])) { - self::$allow_anonymous = ((bool)($general['allow_anonymous'])) && ($general['allow_anonymous'] !== 'no'); + self::$allow_anonymous = ( + ((bool)($general['allow_anonymous'])) && + ($general['allow_anonymous'] !== 'no') + ); + } + if (isset ($general['allow_anonymous_refresh'])) { + self::$allow_anonymous_refresh = ( + ((bool)($general['allow_anonymous_refresh'])) && + ($general['allow_anonymous_refresh'] !== 'no') + ); } // Base de données -- cgit v1.2.3 From 9e23ced0bf50c8af96d39dd68068e0564d593a92 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Feb 2014 20:24:07 +0100 Subject: Improve behaviour category / feed shortcuts - code improved - possibility to move directly from "all" category - when there is no selected feed and we want the "next one", first feed is selected (last before). Same for categories See #256 --- app/layout/aside_flux.phtml | 4 +-- p/scripts/main.js | 69 +++++++++++++++++++++++++++++---------------- 2 files changed, 46 insertions(+), 27 deletions(-) (limited to 'app/layout') diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index 8454b4459..817dae676 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -20,7 +20,7 @@ } ?>
  • -
  • -
    +
    nb_favorites['all'])); ?> diff --git a/p/scripts/main.js b/p/scripts/main.js index 92f98ab28..130407f2c 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -284,64 +284,83 @@ function next_entry() { } function prev_feed() { - if ($('li.active').length > 0) { - var pf = $('li.active').prev().find('a.feed'); - if (pf.length > 0) { - pf[0].click(); + var active_feed = $("#aside_flux .feeds li.active"); + if (active_feed.length > 0) { + var prev_feed = active_feed.prev().find('a.feed'); + if (prev_feed.length > 0) { + prev_feed[0].click(); } } else { - first_feed(); + last_feed(); } } function next_feed() { - if ($('li.active').length > 0) { - var nf = $('li.active').next().find('a.feed'); - if (nf.length > 0) { - nf[0].click(); + var active_feed = $("#aside_flux .feeds li.active"); + if (active_feed.length > 0) { + var next_feed = active_feed.next().find('a.feed'); + if (next_feed.length > 0) { + next_feed[0].click(); } } else { - last_feed(); + first_feed(); } } function first_feed() { - $('.feeds.active li').first().find('a')[1].click(); + var feed = $("#aside_flux .feeds.active li:first"); + if (feed.length > 0) { + feed.find('a')[1].click(); + } } function last_feed() { - $('.feeds.active li').last().find('a')[1].click(); + var feed = $("#aside_flux .feeds.active li:last"); + if (feed.length > 0) { + feed.find('a')[1].click(); + } } function prev_category() { - if ($('div.active').length > 0) { - var pc = $('div.active').parent('li').prev().find('div.stick a.btn'); - if (pc.length > 0) { - pc[0].click(); - return; + var active_cat = $("#aside_flux .category.active"); + + if (active_cat.length > 0) { + var prev_cat = active_cat.parent('li').prev().find('.category a.btn'); + if (prev_cat.length > 0) { + prev_cat[0].click(); } } else { - first_category(); + last_category(); } + return; } function next_category() { - if ($('div.active').length > 0) { - var nc = $('div.active').parent('li').next().find('div.stick a.btn'); - if (nc.length > 0) { - nc[0].click(); + var active_cat = $("#aside_flux .category.active"); + + if (active_cat.length > 0) { + var next_cat = active_cat.parent('li').next().find('.category a.btn'); + if (next_cat.length > 0) { + next_cat[0].click(); } } else { - last_category(); + first_category(); } + return; } function first_category() { - $('div.category.stick').first().find('a.btn')[0].click(); + var cat = $("#aside_flux .category:first"); + if (cat.length > 0) { + cat.find('a.btn')[0].click(); + } } function last_category() { - $('div.category.stick').last().find('a.btn')[0].click(); + var cat = $("#aside_flux .category:last"); + if (cat.length > 0) { + cat.find('a.btn')[0].click(); + } } function collapse_entry() { -- cgit v1.2.3 From 65f50db38ac2b0680da24efdf8901442d2a73795 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Feb 2014 20:40:25 +0100 Subject: Invert "about" and "logs" --- app/layout/header.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/layout') diff --git a/app/layout/header.phtml b/app/layout/header.phtml index eef53a3fd..d20f7487f 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -75,8 +75,8 @@ if (Minz_Configuration::canLogIn()) {
  • -
  • +