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()) {
  • -
  • +
  • Date: Fri, 21 Feb 2014 10:02:43 +0100 Subject: Bug "mark all as read" when using DESC order Solves https://github.com/marienfressinaud/FreshRSS/issues/431 --- app/layout/nav_menu.phtml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/layout') diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 98064a6f7..24c0e38e9 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -61,7 +61,12 @@ break; } } - $p = isset($this->entries[0]) ? $this->entries[0] : null; + if ($this->order === 'ASC') { + $nb = count($this->entries) - 1; + $p = ($nb >= 0 && isset($this->entries[$nb])) ? $this->entries[$nb] : null; + } else { + $p = isset($this->entries[0]) ? $this->entries[0] : null; + } $idMax = $p === null ? '0' : $p->id(); $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); -- cgit v1.2.3 From 7313f9f3a306d16fac78ab587e3055482398ceac Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Fri, 21 Feb 2014 22:32:29 +0100 Subject: Bug "mark all as read" when using DESC and pagination and no scroll https://github.com/marienfressinaud/FreshRSS/issues/431#issuecomment-35774488 --- app/Models/EntryDAO.php | 6 +++--- app/layout/nav_menu.phtml | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'app/layout') diff --git a/app/Models/EntryDAO.php b/app/Models/EntryDAO.php index aaf4dcf6a..f41d6c560 100644 --- a/app/Models/EntryDAO.php +++ b/app/Models/EntryDAO.php @@ -65,7 +65,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } public function markReadEntries ($idMax = 0, $favorites = false) { - if ($idMax === 0) { + if ($idMax == 0) { $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' . 'WHERE e.is_read = 0 AND '; @@ -127,7 +127,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } public function markReadCat ($id, $idMax = 0) { - if ($idMax === 0) { + if ($idMax == 0) { $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' . 'WHERE f.category = ? AND e.is_read = 0'; @@ -182,7 +182,7 @@ class FreshRSS_EntryDAO extends Minz_ModelPdo { } } public function markReadFeed ($id, $idMax = 0) { - if ($idMax === 0) { + if ($idMax == 0) { $sql = 'UPDATE `' . $this->prefix . 'entry` e INNER JOIN `' . $this->prefix . 'feed` f ON e.id_feed = f.id ' . 'SET e.is_read = 1, f.cache_nbUnreads=0 ' . 'WHERE f.id=? AND e.is_read = 0'; diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 24c0e38e9..097809e08 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -62,12 +62,11 @@ } } if ($this->order === 'ASC') { - $nb = count($this->entries) - 1; - $p = ($nb >= 0 && isset($this->entries[$nb])) ? $this->entries[$nb] : null; + $idMax = 0; } else { $p = isset($this->entries[0]) ? $this->entries[0] : null; + $idMax = $p === null ? '0' : $p->id(); } - $idMax = $p === null ? '0' : $p->id(); $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); $output = Minz_Request::param('output', ''); -- cgit v1.2.3 From 3083af6288f23ba6986232798fde67b91517f287 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Sun, 9 Mar 2014 21:45:25 -0400 Subject: Enhance feed adding popup I added a new option in the category select. It allows the user to add dynamically a new category and add the feed to the newly created category. See #356 --- app/Controllers/feedController.php | 8 ++++++++ app/layout/aside_feed.phtml | 5 +++++ p/scripts/main.js | 13 +++++++++++++ 3 files changed, 26 insertions(+) (limited to 'app/layout') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index c718fcd5c..9996725e4 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -30,6 +30,14 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $url = Minz_Request::param ('url_rss'); $cat = Minz_Request::param ('category', false); + if ($cat === 'nc') { + $new_cat = Minz_Request::param ('new_category'); + if (empty($new_cat['name'])) { + $cat = false; + } else { + $cat = $this->catDAO->addCategory($new_cat); + } + } if ($cat === false) { $def_cat = $this->catDAO->getDefault (); $cat = $def_cat->id (); diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index e324b15bd..6f3cdafb2 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -20,9 +20,14 @@ name (); ?> + + +
  • diff --git a/p/scripts/main.js b/p/scripts/main.js index b69ac0a2a..3a4d4e4fb 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -986,6 +986,18 @@ function init_share_observers() { }); }; +function init_feed_observers() { + $('select[id="category"]').on('change', function(){ + var detail = $(this).parent('li').next('li'); + if ($(this).val() === 'nc') { + detail.show(); + detail.find('input').focus(); + } else { + detail.hide(); + } + }); +}; + function init_all() { if (!(window.$ && window.url_freshrss && ((!full_lazyload) || $.fn.lazyload))) { if (window.console) { @@ -1017,6 +1029,7 @@ function init_all() { window.setInterval(refreshUnreads, 120000); } else { init_share_observers(); + init_feed_observers(); } if (window.console) { -- cgit v1.2.3 From f31747ee7bdaebf02e7e58d51c27102e0c7c9ef1 Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Fri, 14 Mar 2014 06:15:52 -0400 Subject: Refresh page after getting new articles. Change the URL to the refresh link. Before it was redirecting to the home page. Now it is redirecting to the same page, which make more sense. See #457 --- app/Controllers/indexController.php | 4 +--- app/layout/nav_menu.phtml | 20 +++++--------------- app/views/helpers/view/normal_view.phtml | 2 +- 3 files changed, 7 insertions(+), 19 deletions(-) (limited to 'app/layout') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 73f454715..9da1e5022 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -25,16 +25,14 @@ class FreshRSS_index_Controller extends Minz_ActionController { } } - // construction of RSS url of this feed $params = Minz_Request::params (); - $params['output'] = 'rss'; if (isset ($params['search'])) { $params['search'] = urlencode ($params['search']); } if (!Minz_Configuration::allowAnonymous()) { $params['token'] = $token; } - $this->view->rss_url = array ( + $this->view->url = array ( 'c' => 'index', 'a' => 'index', 'params' => $params diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 097809e08..ffdc95b24 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -99,17 +99,6 @@
    - 'index', - 'a' => 'index', - 'params' => $params - ); - ?> diff --git a/lib/Minz/View.php b/lib/Minz/View.php index 00d9a1a6d..f034ab10b 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -108,7 +108,7 @@ class Minz_View { */ public function helperToString($helper) { ob_start(); - renderHelper($helper); + $this->renderHelper($helper); return ob_get_clean(); } -- cgit v1.2.3 From 34b17b748efb996f0202815dcf095a45d28e38da Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 30 Mar 2014 14:55:29 +0200 Subject: Fix coding style --- app/Controllers/importExportController.php | 49 ++++++++++++++++++------------ app/layout/aside_feed.phtml | 2 +- 2 files changed, 31 insertions(+), 20 deletions(-) (limited to 'app/layout') diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 3b6bf2c5c..02d62c890 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -20,9 +20,6 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $this->view->categories = $this->catDAO->listCategories(); $this->view->feeds = $this->feedDAO->listFeeds(); - // au niveau de la vue, permet de ne pas voir un flux sélectionné dans la liste - $this->view->flux = false; - Minz_View::prependTitle(Minz_Translate::t('import_export') . ' · '); } @@ -46,7 +43,9 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $zip = zip_open($file['tmp_name']); while (($zipfile = zip_read($zip)) !== false) { - $type_zipfile = $this->guessFileType(zip_entry_name($zipfile)); + $type_zipfile = $this->guessFileType( + zip_entry_name($zipfile) + ); if ($type_file !== 'unknown') { $list_files[$type_zipfile][] = zip_entry_read( @@ -58,7 +57,9 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { zip_close($zip); } elseif ($type_file !== 'unknown') { - $list_files[$type_file][] = file_get_contents($file['tmp_name']); + $list_files[$type_file][] = file_get_contents( + $file['tmp_name'] + ); } // Import different files. @@ -79,18 +80,19 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { // And finally, we get import status and redirect to the home page $notif = null; if ($error === true) { - $notif = array( - 'type' => 'good', - 'content' => Minz_Translate::t('feeds_imported_with_errors') + $content_notif = Minz_Translate::t( + 'feeds_imported_with_errors' ); } else { - $notif = array( - 'type' => 'good', - 'content' => Minz_Translate::t('feeds_imported') + $content_notif = Minz_Translate::t( + 'feeds_imported' ); } - Minz_Session::_param('notification', $notif); + Minz_Session::_param('notification', array( + 'type' => 'good', + 'content' => $content_notif + )); Minz_Session::_param('actualize_feeds', true); Minz_Request::forward(array( @@ -235,7 +237,9 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $is_read = $this->view->conf->mark_when['reception'] ? 1 : 0; - $google_compliant = (strpos($article_object['id'], 'com.google') !== false); + $google_compliant = ( + strpos($article_object['id'], 'com.google') !== false + ); $error = false; foreach ($article_object['items'] as $item) { @@ -246,7 +250,8 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { } $author = isset($item['author']) ? $item['author'] : ''; - $key_content = $google_compliant && !isset($item['content']) ? 'summary' : 'content'; + $key_content = ($google_compliant && !isset($item['content'])) ? + 'summary' : 'content'; $tags = $item['categories']; if ($google_compliant) { $tags = array_filter($tags, function($var) { @@ -312,17 +317,21 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $export_starred = Minz_Request::param('export_starred', false); $export_feeds = Minz_Request::param('export_feeds', false); - // code from https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly + // From https://stackoverflow.com/questions/1061710/php-zip-files-on-the-fly $file = tempnam('tmp', 'zip'); $zip = new ZipArchive(); $zip->open($file, ZipArchive::OVERWRITE); // Stuff with content if ($export_opml) { - $zip->addFromString('feeds.opml', $this->generateOpml()); + $zip->addFromString( + 'feeds.opml', $this->generateOpml() + ); } if ($export_starred) { - $zip->addFromString('starred.json', $this->generateArticles('starred')); + $zip->addFromString( + 'starred.json', $this->generateArticles('starred') + ); } foreach ($export_feeds as $feed_id) { $feed = $this->feedDAO->searchById($feed_id); @@ -357,14 +366,16 @@ class FreshRSS_importExport_Controller extends Minz_ActionController { $this->view->categories = $this->catDAO->listCategories(); if ($type == 'starred') { - $this->view->list_title = Minz_Translate::t("starred_list"); + $this->view->list_title = Minz_Translate::t('starred_list'); $this->view->type = 'starred'; $this->view->entries = $this->entryDAO->listWhere( 's', '', 'all', 'ASC', $this->entryDAO->countUnreadReadFavorites()['all'] ); } elseif ($type == 'feed' && !is_null($feed)) { - $this->view->list_title = Minz_Translate::t("feed_list", $feed->name()); + $this->view->list_title = Minz_Translate::t( + 'feed_list', $feed->name() + ); $this->view->type = 'feed/' . $feed->id(); $this->view->entries = $this->entryDAO->listWhere( 'f', $feed->id(), 'all', 'ASC', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index ae16efd96..1fad60af5 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -56,7 +56,7 @@ feeds)) { ?> feeds as $feed) { ?> nbEntries (); ?> -
  • +
  • ✇ name (); ?> -- cgit v1.2.3 From 19517baf13dba7ebd7d41dbbacceaea3ed75af8e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 30 Mar 2014 17:49:39 +0200 Subject: Add a bookmark to easily subscribe to websites - FeedController->addAction (GET) shows a confirmation page - If already subscribe, redirect to Configure->feedAction - Add a bookmark in aside_feed See #425 #426 and #464 --- app/Controllers/feedController.php | 53 +++++++++++++++++++--- app/i18n/en.php | 1 + app/i18n/fr.php | 3 +- app/layout/aside_feed.phtml | 6 +++ app/views/feed/add.phtml | 91 ++++++++++++++++++++++++++++++++++++++ p/scripts/main.js | 2 +- 6 files changed, 148 insertions(+), 8 deletions(-) create mode 100644 app/views/feed/add.phtml (limited to 'app/layout') diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index 16516ad39..503295587 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -22,13 +22,23 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } public function addAction () { - @set_time_limit(300); + $url = Minz_Request::param('url_rss', false); + + if ($url === false) { + Minz_Request::forward(array( + 'c' => 'configure', + 'a' => 'feed' + ), true); + } + + $feedDAO = new FreshRSS_FeedDAO (); + $this->catDAO = new FreshRSS_CategoryDAO (); + $this->catDAO->checkDefault (); + + if (Minz_Request::isPost()) { + @set_time_limit(300); - if (Minz_Request::isPost ()) { - $this->catDAO = new FreshRSS_CategoryDAO (); - $this->catDAO->checkDefault (); - $url = Minz_Request::param ('url_rss'); $cat = Minz_Request::param ('category', false); if ($cat === 'nc') { $new_cat = Minz_Request::param ('new_category'); @@ -60,7 +70,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { $feed->load(true); - $feedDAO = new FreshRSS_FeedDAO (); $values = array ( 'url' => $feed->url (), 'category' => $feed->category (), @@ -154,6 +163,38 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => $params), true); } + + // GET request so we must ask confirmation to user + Minz_View::prependTitle(Minz_Translate::t('add_rss_feed') . ' · '); + $this->view->categories = $this->catDAO->listCategories(); + $this->view->feed = new FreshRSS_Feed($url); + try { + // We try to get some more information about the feed + $this->view->feed->load(true); + $this->view->load_ok = true; + } catch (Exception $e) { + $this->view->load_ok = false; + } + + $feed = $feedDAO->searchByUrl($this->view->feed->url()); + if ($feed) { + // Already subscribe so we redirect to the feed configuration page + $notif = array( + 'type' => 'bad', + 'content' => Minz_Translate::t( + 'already_subscribed', $feed->name() + ) + ); + Minz_Session::_param('notification', $notif); + + Minz_Request::forward(array( + 'c' => 'configure', + 'a' => 'feed', + 'params' => array( + 'id' => $feed->id() + ) + ), true); + } } public function truncateAction () { diff --git a/app/i18n/en.php b/app/i18n/en.php index e9bed39a7..3d516bbb4 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -22,6 +22,7 @@ return array ( 'add_rss_feed' => 'Add a RSS feed', 'no_rss_feed' => 'No RSS feed', 'import_export' => 'Import / export', + 'bookmark' => 'Subscribe (FreshRSS bookmark)', 'subscription_management' => 'Subscriptions management', 'main_stream' => 'Main stream', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 24f3741c8..9d745fc9a 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -22,6 +22,7 @@ return array ( 'add_rss_feed' => 'Ajouter un flux RSS', 'no_rss_feed' => 'Aucun flux RSS', 'import_export' => 'Importer / exporter', + 'bookmark' => 'S’abonner (bookmark FreshRSS)', 'subscription_management' => 'Gestion des abonnements', 'main_stream' => 'Flux principal', @@ -89,7 +90,7 @@ return array ( 'already_subscribed' => 'Vous êtes déjà abonné à %s', 'feed_added' => 'Le flux %s a bien été ajouté', 'feed_not_added' => '%s n’a pas pu être ajouté', - 'internal_problem_feed' => 'Le flux n’a pas pu être ajouté. Consulter les logs de FreshRSS pour plus de détails.', + 'internal_problem_feed' => 'Le flux ne peux pas être ajouté. Consulter les logs de FreshRSS pour plus de détails.', 'invalid_url' => 'L’url %s est invalide', 'feed_actualized' => '%s a été mis à jour', 'n_feeds_actualized' => '%d flux ont été mis à jour', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 899cafe02..7a5b2ce5e 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -43,6 +43,12 @@
  • +
  • + + + +
  • +
  • diff --git a/app/views/feed/add.phtml b/app/views/feed/add.phtml new file mode 100644 index 000000000..56ac5f8dd --- /dev/null +++ b/app/views/feed/add.phtml @@ -0,0 +1,91 @@ +feed) { ?> +
    +

    + + load_ok) { ?> +

    + + +
    + + load_ok) { ?> +
    + +
    + +
    +
    + + feed->description(); if ($desc != '') { ?> +
    + +
    + +
    +
    + + +
    + +
    + +
    +
    + + +
    + +
    + + +   +
    +
    +
    + +
    + + + + + +
    +
    + + + feed->httpAuth(false); ?> +
    + +
    + +
    + + +
    + +
    + +
    + +
    +
    + +
    +
    + + +
    +
    +
    +
    + diff --git a/p/scripts/main.js b/p/scripts/main.js index a03be85eb..818d459b3 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -988,7 +988,7 @@ function init_share_observers() { function init_feed_observers() { $('select[id="category"]').on('change', function() { - var detail = $(this).parent('li').next('li'); + var detail = $('#new_category_name').parent(); if ($(this).val() === 'nc') { detail.show(); detail.find('input').focus(); -- cgit v1.2.3 From e80c482e53bf8715c5db7b3af07b4e9dbf133076 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 30 Mar 2014 19:23:28 +0200 Subject: Prevent click on bookmarklet https://github.com/marienfressinaud/FreshRSS/issues/464 --- app/layout/aside_feed.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/layout') diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index aac15d741..5ffb1c791 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -44,7 +44,7 @@
  • - +
  • -- cgit v1.2.3 From b55571de8f19fab15202826950184cfcb90d364c Mon Sep 17 00:00:00 2001 From: Alexis Degrugillier Date: Tue, 8 Apr 2014 23:26:41 -0400 Subject: Split reading configuration page I splitted the reading configuration page in 2 pages. The display configuration page to prepare for #265 and the reading configuration page. It is just a test, feel free to discard that. I also change some wording to be consistent through out the application. --- app/Controllers/configureController.php | 50 +++++++++---- app/i18n/en.php | 4 +- app/i18n/fr.php | 4 +- app/layout/aside_configure.phtml | 5 +- app/layout/header.phtml | 3 +- app/views/configure/display.phtml | 128 +------------------------------- app/views/configure/reading.phtml | 125 +++++++++++++++++++++++++++++++ app/views/configure/shortcut.phtml | 2 +- 8 files changed, 173 insertions(+), 148 deletions(-) create mode 100644 app/views/configure/reading.phtml (limited to 'app/layout') diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index b4de19e11..df5212041 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -140,21 +140,6 @@ class FreshRSS_configure_Controller extends Minz_ActionController { public function displayAction () { if (Minz_Request::isPost()) { $this->view->conf->_language(Minz_Request::param('language', 'en')); - $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); - $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); - $this->view->conf->_default_view (Minz_Request::param('default_view', 'a')); - $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); - $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); - $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); - $this->view->conf->_lazyload (Minz_Request::param('lazyload', false)); - $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false)); - $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); - $this->view->conf->_mark_when (array( - 'article' => Minz_Request::param('mark_open_article', false), - 'site' => Minz_Request::param('mark_open_site', false), - 'scroll' => Minz_Request::param('mark_scroll', false), - 'reception' => Minz_Request::param('mark_upon_reception', false), - )); $themeId = Minz_Request::param('theme', ''); if ($themeId == '') { $themeId = FreshRSS_Themes::defaultTheme; @@ -187,6 +172,41 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $this->view->themes = FreshRSS_Themes::get(); + Minz_View::prependTitle (Minz_Translate::t ('display_configuration') . ' · '); + } + + public function readingAction () { + if (Minz_Request::isPost()) { + $this->view->conf->_posts_per_page(Minz_Request::param('posts_per_page', 10)); + $this->view->conf->_view_mode(Minz_Request::param('view_mode', 'normal')); + $this->view->conf->_default_view (Minz_Request::param('default_view', 'a')); + $this->view->conf->_auto_load_more(Minz_Request::param('auto_load_more', false)); + $this->view->conf->_display_posts(Minz_Request::param('display_posts', false)); + $this->view->conf->_onread_jump_next(Minz_Request::param('onread_jump_next', false)); + $this->view->conf->_lazyload (Minz_Request::param('lazyload', false)); + $this->view->conf->_sticky_post (Minz_Request::param('sticky_post', false)); + $this->view->conf->_sort_order(Minz_Request::param('sort_order', 'DESC')); + $this->view->conf->_mark_when (array( + 'article' => Minz_Request::param('mark_open_article', false), + 'site' => Minz_Request::param('mark_open_site', false), + 'scroll' => Minz_Request::param('mark_scroll', false), + 'reception' => Minz_Request::param('mark_upon_reception', false), + )); + $this->view->conf->save(); + + Minz_Session::_param ('language', $this->view->conf->language); + Minz_Translate::reset (); + invalidateHttpCache(); + + $notif = array ( + 'type' => 'good', + 'content' => Minz_Translate::t ('configuration_updated') + ); + Minz_Session::_param ('notification', $notif); + + Minz_Request::forward (array ('c' => 'configure', 'a' => 'reading'), true); + } + Minz_View::prependTitle (Minz_Translate::t ('reading_configuration') . ' · '); } diff --git a/app/i18n/en.php b/app/i18n/en.php index 91bb9adce..d6096bbe8 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -79,7 +79,6 @@ return array ( 'sharing_management' => 'Sharing options management', 'bad_opml_file' => 'Your OPML file is invalid', 'shortcuts_updated' => 'Shortcuts have been updated', - 'shortcuts_management' => 'Shortcuts management', 'shortcuts_navigation' => 'Navigation', 'shortcuts_navigation_help' => 'With the "Shift" modifier, navigation shortcuts apply on feeds.
    With the "Alt" modifier, navigation shortcuts apply on categories.', 'shortcuts_article_action' => 'Article actions', @@ -212,6 +211,7 @@ return array ( 'purge_completed' => 'Purge completed (%d articles deleted)', 'archiving_configuration_help' => 'More options are available in the individual stream settings', 'reading_configuration' => 'Reading', + 'display_configuration' => 'Display', 'articles_per_page' => 'Number of articles per page', 'default_view' => 'Default view', 'sort_order' => 'Sort order', @@ -219,7 +219,7 @@ return array ( 'display_articles_unfolded' => 'Show articles unfolded by default', 'after_onread' => 'After “mark all as read”,', 'jump_next' => 'jump to next unread sibling (feed or category)', - 'reading_icons' => 'Reading icons', + 'article_icons' => 'Article icons', 'top_line' => 'Top line', 'bottom_line' => 'Bottom line', 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 0897db93d..d89cbb098 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -79,7 +79,6 @@ return array ( 'sharing_management' => 'Gestion des options de partage', 'bad_opml_file' => 'Votre fichier OPML n’est pas valide', 'shortcuts_updated' => 'Les raccourcis ont été mis à jour', - 'shortcuts_management' => 'Gestion des raccourcis', 'shortcuts_navigation' => 'Navigation', 'shortcuts_navigation_help' => 'Avec le modificateur "Shift", les raccourcis de navigation s’appliquent aux flux.
    Avec le modificateur "Alt", les raccourcis de navigation s’appliquent aux catégories.', 'shortcuts_article_action' => 'Actions associées à l’article courant', @@ -212,6 +211,7 @@ return array ( 'purge_completed' => 'Purge effectuée (%d articles supprimés)', 'archiving_configuration_help' => 'D’autres options sont disponibles dans la configuration individuelle des flux', 'reading_configuration' => 'Lecture', + 'display_configuration' => 'Affichage', 'articles_per_page' => 'Nombre d’articles par page', 'default_view' => 'Vue par défaut', 'sort_order' => 'Ordre de tri', @@ -219,7 +219,7 @@ return array ( 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', 'after_onread' => 'Après “marquer tout comme lu”,', 'jump_next' => 'sauter au prochain voisin non lu (flux ou catégorie)', - 'reading_icons' => 'Icônes de lecture', + 'article_icons' => 'Icônes d’article', 'top_line' => 'Ligne du haut', 'bottom_line' => 'Ligne du bas', 'img_with_lazyload' => 'Utiliser le mode “chargement différé” pour les images', diff --git a/app/layout/aside_configure.phtml b/app/layout/aside_configure.phtml index 27f11ab6d..43adeb3c6 100644 --- a/app/layout/aside_configure.phtml +++ b/app/layout/aside_configure.phtml @@ -1,7 +1,10 @@