From c96225df6d6ba3aca0c6786c7f091f02c11d6e8d Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 12 May 2013 16:51:45 +0200 Subject: Fix issue #84 : affichage erreur si fichier OPML invalide --- app/controllers/configureController.php | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 2f56da177..8500a4a04 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -218,14 +218,31 @@ class configureController extends ActionController { } elseif ($this->view->req == 'import' && Request::isPost ()) { if ($_FILES['file']['error'] == 0) { // on parse le fichier OPML pour récupérer les catégories et les flux associés - list ($categories, $feeds) = opml_import (file_get_contents ($_FILES['file']['tmp_name'])); - - // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD - // les flux sont mis au préalable dans des variables de Request - Request::_param ('q', 'null'); - Request::_param ('categories', $categories); - Request::_param ('feeds', $feeds); - Request::forward (array ('c' => 'feed', 'a' => 'massiveImport')); + try { + list ($categories, $feeds) = opml_import ( + file_get_contents ($_FILES['file']['tmp_name']) + ); + + // On redirige vers le controller feed qui va se charger d'insérer les flux en BDD + // les flux sont mis au préalable dans des variables de Request + Request::_param ('q', 'null'); + Request::_param ('categories', $categories); + Request::_param ('feeds', $feeds); + Request::forward (array ('c' => 'feed', 'a' => 'massiveImport')); + } catch (OpmlException $e) { + Log::record ($e->getMessage (), Log::ERROR); + + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('bad_opml_file') + ); + Session::_param ('notification', $notif); + + Request::forward (array ( + 'c' => 'configure', + 'a' => 'importExport' + ), true); + } } } -- cgit v1.2.3 From bf4552072418268470f81ba3883009da675800e4 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 12 May 2013 17:40:09 +0200 Subject: Fix issue #81 : Possibilité d'ajouter un flux dans une catégorie sur la page d'import / export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 8500a4a04..3b332de75 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -196,6 +196,9 @@ class configureController extends ActionController { } public function importExportAction () { + $catDAO = new CategoryDAO (); + $this->view->categories = $catDAO->listCategories (); + $this->view->req = Request::param ('q'); if ($this->view->req == 'export') { -- cgit v1.2.3 From 746ae4b33a2e7a83d2623291c02d7b4292247103 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Fri, 14 Jun 2013 20:09:47 +0200 Subject: Fix issue #79 : possibilité de changer le nom d'un flux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 2 ++ app/models/Entry.php | 2 +- app/views/configure/feed.phtml | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 3b332de75..0d385daf9 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -91,6 +91,7 @@ class configureController extends ActionController { $this->view->categories = $catDAO->listCategories (); if (Request::isPost () && $this->view->flux) { + $name = Request::param ('name', ''); $cat = Request::param ('category', 0); $path = Request::param ('path_entries', ''); $priority = Request::param ('priority', 0); @@ -103,6 +104,7 @@ class configureController extends ActionController { } $values = array ( + 'name' => $name, 'category' => $cat, 'pathEntries' => $path, 'priority' => $priority, diff --git a/app/models/Entry.php b/app/models/Entry.php index f49e74239..1d944b184 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -239,7 +239,7 @@ class EntryDAO extends Model_pdo { return true; } else { $info = $stm->errorInfo(); - Log::record ('SQL error : ' . $info[2], Log::ERROR); + Log::record ('SQL error : ' . $info[2], Log::NOTICE); return false; } } diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index ad9c86d9e..650da5641 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -13,6 +13,12 @@
+
+ +
+ +
+
-- cgit v1.2.3 From 0ff751b443604ccb8cd0eb69050f59298c98a492 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 11:02:58 +0200 Subject: Lazyload facultatif (issue #75 ok) --- app/controllers/configureController.php | 3 +++ app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/models/RSSConfiguration.php | 16 ++++++++++++++++ app/views/configure/display.phtml | 14 ++++++++++++++ app/views/index/index.phtml | 8 +++++++- app/views/javascript/main.phtml | 3 ++- 7 files changed, 44 insertions(+), 2 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 0d385daf9..4cfc1c085 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -142,6 +142,7 @@ class configureController extends ActionController { $nb = Request::param ('posts_per_page', 10); $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); + $lazyload = Request::param ('lazyload', 'yes'); $sort = Request::param ('sort_order', 'low_to_high'); $old = Request::param ('old_entries', 3); $mail = Request::param ('mail_login', false); @@ -154,6 +155,7 @@ class configureController extends ActionController { $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); + $this->view->conf->_lazyload ($lazyload); $this->view->conf->_sortOrder ($sort); $this->view->conf->_oldEntries ($old); $this->view->conf->_mailLogin ($mail); @@ -169,6 +171,7 @@ class configureController extends ActionController { 'posts_per_page' => $this->view->conf->postsPerPage (), 'default_view' => $this->view->conf->defaultView (), 'display_posts' => $this->view->conf->displayPosts (), + 'lazyload' => $this->view->conf->lazyload (), 'sort_order' => $this->view->conf->sortOrder (), 'old_entries' => $this->view->conf->oldEntries (), 'mail_login' => $this->view->conf->mailLogin (), diff --git a/app/i18n/en.php b/app/i18n/en.php index 3c3a1fbcc..30bed791f 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -144,6 +144,7 @@ return array ( 'default_view' => 'Default view', 'sort_order' => 'Sort order', 'display_articles_unfolded' => 'Show articles unfolded by default', + 'img_with_lazyload' => 'Use "lazy load" mode to load pictures', 'auto_read_when' => 'Mark automatically as read when', 'article_selected' => 'Article is selected', 'article_open_on_website' => 'Article is opened on its original website', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index d270c9b96..87b87945f 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -144,6 +144,7 @@ return array ( 'default_view' => 'Vue par défaut', 'sort_order' => 'Ordre de tri', 'display_articles_unfolded' => 'Afficher les articles dépliés par défaut', + 'img_with_lazyload' => 'Utiliser le mode "lazy load" pour charger les images', 'auto_read_when' => 'Marquer automatiquement comme lu lorsque', 'article_selected' => 'L\'article est sélectionné', 'article_open_on_website' => 'L\'article est ouvert sur le site d\'origine', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 00fe3fe52..50dbd2555 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -9,6 +9,7 @@ class RSSConfiguration extends Model { private $posts_per_page; private $default_view; private $display_posts; + private $lazyload; private $sort_order; private $old_entries; private $shortcuts = array (); @@ -22,6 +23,7 @@ class RSSConfiguration extends Model { $this->_postsPerPage ($confDAO->posts_per_page); $this->_defaultView ($confDAO->default_view); $this->_displayPosts ($confDAO->display_posts); + $this->_lazyload ($confDAO->lazyload); $this->_sortOrder ($confDAO->sort_order); $this->_oldEntries ($confDAO->old_entries); $this->_shortcuts ($confDAO->shortcuts); @@ -45,6 +47,9 @@ class RSSConfiguration extends Model { public function displayPosts () { return $this->display_posts; } + public function lazyload () { + return $this->lazyload; + } public function sortOrder () { return $this->sort_order; } @@ -100,6 +105,13 @@ class RSSConfiguration extends Model { $this->display_posts = 'no'; } } + public function _lazyload ($value) { + if ($value == 'no') { + $this->lazyload = 'no'; + } else { + $this->lazyload = 'yes'; + } + } public function _sortOrder ($value) { if ($value == 'high_to_low') { $this->sort_order = 'high_to_low'; @@ -144,6 +156,7 @@ class RSSConfigurationDAO extends Model_array { public $posts_per_page = 20; public $default_view = 'not_read'; public $display_posts = 'no'; + public $lazyload = 'yes'; public $sort_order = 'low_to_high'; public $old_entries = 3; public $shortcuts = array ( @@ -178,6 +191,9 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['display_posts'])) { $this->display_posts = $this->array['display_posts']; } + if (isset ($this->array['lazyload'])) { + $this->lazyload = $this->array['lazyload']; + } if (isset ($this->array['sort_order'])) { $this->sort_order = $this->array['sort_order']; } diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index be67896dc..ea4fecd34 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -67,6 +67,20 @@
+
+ +
+ + +
+
+
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 7037b2405..1a07cdb46 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -66,7 +66,13 @@ if ($output == 'rss') {

title (); ?>

author (); ?> ' . Translate::t ('by_author', $author) . '
' : ''; ?> - content ()); ?> + conf->lazyload() == 'yes') { + echo lazyimg($item->content ()); + } else { + echo $item->content(); + } + ?>
    diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 443f62c31..9596b1647 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -125,8 +125,9 @@ function init_posts () { init_img (); - // TODO rendre optionnel + conf->lazyload() == 'yes') { ?> $(".flux .content img").lazyload(); + if (hide_posts) { $(".flux:not(.active) .flux_content").hide (); -- cgit v1.2.3 From 48cfe1571ececb9fae0c361d9147690b04d310e0 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 16 Jun 2013 20:48:56 +0200 Subject: Fix issue #67 : différentes vues implémentées + possibilité de choisir la vue par défaut MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/configureController.php | 3 +++ app/controllers/indexController.php | 8 +++++++- app/models/RSSConfiguration.php | 16 ++++++++++++++++ app/views/configure/display.phtml | 5 +++++ app/views/helpers/global_view.phtml | 6 +++++- 5 files changed, 36 insertions(+), 2 deletions(-) (limited to 'app/controllers/configureController.php') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 4cfc1c085..9ed0ad1eb 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -140,6 +140,7 @@ class configureController extends ActionController { if (Request::isPost ()) { $language = Request::param ('language', 'en'); $nb = Request::param ('posts_per_page', 10); + $mode = Request::param ('view_mode', 'normal'); $view = Request::param ('default_view', 'all'); $display = Request::param ('display_posts', 'no'); $lazyload = Request::param ('lazyload', 'yes'); @@ -153,6 +154,7 @@ class configureController extends ActionController { $this->view->conf->_language ($language); $this->view->conf->_postsPerPage (intval ($nb)); + $this->view->conf->_viewMode ($mode); $this->view->conf->_defaultView ($view); $this->view->conf->_displayPosts ($display); $this->view->conf->_lazyload ($lazyload); @@ -169,6 +171,7 @@ class configureController extends ActionController { $values = array ( 'language' => $this->view->conf->language (), 'posts_per_page' => $this->view->conf->postsPerPage (), + 'view_mode' => $this->view->conf->viewMode (), 'default_view' => $this->view->conf->defaultView (), 'display_posts' => $this->view->conf->displayPosts (), 'lazyload' => $this->view->conf->lazyload (), diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 3f10720c2..a5a5501e7 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -6,13 +6,19 @@ class indexController extends ActionController { private $mode = 'all'; public function indexAction () { - if (Request::param ('output') == 'rss') { + $output = Request::param ('output'); + + if ($output == 'rss') { $this->view->_useLayout (false); } else { View::appendScript (Url::display ('/scripts/shortcut.js')); View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main'))); View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'actualize'))); View::appendScript (Url::display ('/scripts/endless_mode.js')); + + if(!$output) { + Request::_param ('output', $this->view->conf->viewMode()); + } } $entryDAO = new EntryDAO (); diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 6ebc30e8e..b188c0e65 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -7,6 +7,7 @@ class RSSConfiguration extends Model { ); private $language; private $posts_per_page; + private $view_mode; private $default_view; private $display_posts; private $lazyload; @@ -21,6 +22,7 @@ class RSSConfiguration extends Model { $confDAO = new RSSConfigurationDAO (); $this->_language ($confDAO->language); $this->_postsPerPage ($confDAO->posts_per_page); + $this->_viewMode ($confDAO->view_mode); $this->_defaultView ($confDAO->default_view); $this->_displayPosts ($confDAO->display_posts); $this->_lazyload ($confDAO->lazyload); @@ -41,6 +43,9 @@ class RSSConfiguration extends Model { public function postsPerPage () { return $this->posts_per_page; } + public function viewMode () { + return $this->view_mode; + } public function defaultView () { return $this->default_view; } @@ -91,6 +96,13 @@ class RSSConfiguration extends Model { $this->posts_per_page = 10; } } + public function _viewMode ($value) { + if ($value == 'global' || $value == 'reader') { + $this->view_mode = $value; + } else { + $this->view_mode = 'normal'; + } + } public function _defaultView ($value) { if ($value == 'not_read') { $this->default_view = 'not_read'; @@ -154,6 +166,7 @@ class RSSConfiguration extends Model { class RSSConfigurationDAO extends Model_array { public $language = 'en'; public $posts_per_page = 20; + public $view_mode = 'normal'; public $default_view = 'not_read'; public $display_posts = 'no'; public $lazyload = 'yes'; @@ -185,6 +198,9 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['posts_per_page'])) { $this->posts_per_page = $this->array['posts_per_page']; } + if (isset ($this->array['view_mode'])) { + $this->view_mode = $this->array['view_mode']; + } if (isset ($this->array['default_view'])) { $this->default_view = $this->array['default_view']; } diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index c46a02143..8484a7116 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -46,6 +46,11 @@
    +
    diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml index eaf1e4276..126fa5a78 100644 --- a/app/views/helpers/normal_view.phtml +++ b/app/views/helpers/normal_view.phtml @@ -64,6 +64,21 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
      + conf) || is_logged ()) { ?> +
    • + isRead ()) { ?> +   + +   + + + isFavorite ()) { ?> +   + +   + +
    • +