From 1863153b966af00078869b6634df1daa22cdcbfe Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 15:55:44 +0200 Subject: Fix issue #71 : remise en place du mode endless + correction bug à l'importation OPML MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/indexController.php | 1 + 1 file changed, 1 insertion(+) (limited to 'app/controllers/indexController.php') diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index f4f0b98b3..5403b82ed 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -12,6 +12,7 @@ class indexController extends ActionController { 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')); } $entryDAO = new EntryDAO (); -- cgit v1.2.3 From fafddf2a20748cdbda1f974338528c8e488f4b11 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 16:42:50 +0200 Subject: Fix issue #73 : ajout d'une page pour visualiser les logs --- app/App_FrontController.php | 1 + app/controllers/indexController.php | 26 ++++++++++++++++++ app/i18n/en.php | 3 +++ app/i18n/fr.php | 3 +++ app/layout/header.phtml | 1 + app/models/Log.php | 47 +++++++++++++++++++++++++++++++++ app/views/helpers/logs_pagination.phtml | 47 +++++++++++++++++++++++++++++++++ app/views/index/logs.phtml | 21 +++++++++++++++ lib/minz/View.php | 2 +- lib/minz/dao/Model_txt.php | 2 +- public/theme/freshrss.css | 44 +++++++++++++++++++++++++++++- 11 files changed, 194 insertions(+), 3 deletions(-) create mode 100644 app/models/Log.php create mode 100755 app/views/helpers/logs_pagination.phtml create mode 100644 app/views/index/logs.phtml (limited to 'app/controllers/indexController.php') diff --git a/app/App_FrontController.php b/app/App_FrontController.php index 5729a115d..637d61206 100644 --- a/app/App_FrontController.php +++ b/app/App_FrontController.php @@ -36,6 +36,7 @@ class App_FrontController extends FrontController { include (APP_PATH . '/models/Entry.php'); include (APP_PATH . '/models/EntriesGetter.php'); include (APP_PATH . '/models/RSSPaginator.php'); + include (APP_PATH . '/models/Log.php'); } private function loadParamsView () { diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 5403b82ed..3f10720c2 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -139,6 +139,32 @@ class indexController extends ActionController { View::prependTitle (Translate::t ('about') . ' - '); } + public function logsAction () { + if (login_is_conf ($this->view->conf) && !is_logged ()) { + Error::error ( + 403, + array ('error' => array (Translate::t ('access_denied'))) + ); + } + + View::prependTitle (Translate::t ('see_logs') . ' - '); + + $logs = array(); + try { + $logDAO = new LogDAO (); + $logs = $logDAO->lister (); + $logs = array_reverse ($logs); + } catch(FileNotExistException $e) { + + } + + //gestion pagination + $page = Request::param ('page', 1); + $this->view->logsPaginator = new Paginator ($logs); + $this->view->logsPaginator->_nbItemsPerPage (50); + $this->view->logsPaginator->_currentPage ($page); + } + public function loginAction () { $this->view->_useLayout (false); diff --git a/app/i18n/en.php b/app/i18n/en.php index 0d0ab5269..dbb6b1bfe 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -186,6 +186,9 @@ return array ( 'credits' => 'Credits', 'credits_content' => 'Some design elements come from Bootstrap although FreshRSS doesn\'t use this framework. Icons come from GNOME project. Open Sans font police used has been created by Steve Matteson. Favicons are collected with getFavicon API. FreshRSS is based on Minz, a PHP framework.', + 'logs' => 'Logs', + 'logs_empty' => 'Log file is empty', + // DATE 'january' => 'january', 'february' => 'february', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 97e36f923..75a76cc7a 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -186,6 +186,9 @@ return array ( 'credits' => 'Crédits', 'credits_content' => 'Des éléments de design sont issus du projet Bootstrap bien que FreshRSS n\'utilise pas ce framework. Les icônes sont issues du projet GNOME. La police Open Sans utilisée a été créée par Steve Matteson. Les favicons sont récupérés grâce au site getFavicon. FreshRSS repose sur Minz, un framework PHP.', + 'logs' => 'Logs', + 'logs_empty' => 'Les logs sont vides', + // DATE 'january' => 'janvier', 'february' => 'février', diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 2e84f7f4d..4131f8687 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -54,6 +54,7 @@
  • +
  • diff --git a/app/models/Log.php b/app/models/Log.php new file mode 100644 index 000000000..5c280fa7a --- /dev/null +++ b/app/models/Log.php @@ -0,0 +1,47 @@ +date; + } + public function level () { + return $this->level; + } + public function info () { + return $this->information; + } + public function _date ($date) { + $this->date = $date; + } + public function _level ($level) { + $this->level = $level; + } + public function _info ($information) { + $this->information = $information; + } +} + +class LogDAO extends Model_txt { + public function __construct () { + parent::__construct (LOG_PATH . '/application.log', 'r+'); + } + + public function lister () { + $logs = array (); + + $i = 0; + while (($line = $this->readLine ()) !== false) { + $logs[$i] = new Log_Model (); + $logs[$i]->_date (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\1", $line)); + $logs[$i]->_level (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\2", $line)); + $logs[$i]->_info (preg_replace ("'\[(.*?)\] \[(.*?)\] --- (.*?)'U", "\\3", $line)); + $i++; + } + + return $logs; + } +} \ No newline at end of file diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml new file mode 100755 index 000000000..0088dabc6 --- /dev/null +++ b/app/views/helpers/logs_pagination.phtml @@ -0,0 +1,47 @@ + + +nbPage > 1) { ?> + + diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml new file mode 100644 index 000000000..c72a84c86 --- /dev/null +++ b/app/views/index/logs.phtml @@ -0,0 +1,21 @@ +
    + + +

    + + logsPaginator->items (); ?> + + +
    + logsPaginator->render ('logs_pagination.phtml', 'page'); ?> + + +
    date ())); ?>info (); ?>
    + + + logsPaginator->render ('logs_pagination.phtml','page'); ?> +
    + +

    + +
    \ No newline at end of file diff --git a/lib/minz/View.php b/lib/minz/View.php index 5c329c159..2bb747aa9 100755 --- a/lib/minz/View.php +++ b/lib/minz/View.php @@ -71,7 +71,7 @@ class View { } else { Log::record ('File doesn\'t exist : `' . $this->view_filename . '`', - Log::WARNING); + Log::NOTICE); } } diff --git a/lib/minz/dao/Model_txt.php b/lib/minz/dao/Model_txt.php index ad15c8b36..c9d5cfe77 100755 --- a/lib/minz/dao/Model_txt.php +++ b/lib/minz/dao/Model_txt.php @@ -27,7 +27,7 @@ class Model_txt { */ public function __construct ($nameFile, $mode = 'a+') { $this->filename = $nameFile; - $this->file = fopen ($this->filename, $mode); + $this->file = @fopen ($this->filename, $mode); if (!$this->file) { throw new FileNotExistException ( diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index f5d4f6a83..4919639af 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -349,14 +349,29 @@ } .pagination .item { display: table-cell; - border-top: 1px solid #aaa; line-height: 40px; } + .pagination .item.pager-current { + font-weight: bold; + font-size: 140%; + } + .pagination .item.pager-first, + .pagination .item.pager-previous, + .pagination .item.pager-next, + .pagination .item.pager-last { + width: 100px; + } .pagination .item a { display: block; color: #333; font-style: italic; } + .pagination:first-child .item { + border-bottom: 1px solid #aaa; + } + .pagination:last-child .item { + border-top: 1px solid #aaa; + } .loading { background: url("loader.gif") center center no-repeat; font-size: 0; @@ -421,6 +436,33 @@ vertical-align: middle; } +.logs { + border: 1px solid #aaa; +} + .logs .log { + padding: 5px 2%; + overflow: auto; + background: #fafafa; + border-bottom: 1px solid #999; + color: #333; + font-size: 90%; + } + .logs .log .date { + display: block; + } + .logs .log.error { + background: #fdd; + color: #844; + } + .logs .log.warning { + background: #ffe; + color: #c95; + } + .logs .log.notice { + background: #f4f4f4; + color: #aaa; + } + @media(max-width: 840px) { .header, .aside .btn-important, -- 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/indexController.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 ()) { ?> +   + +   + +
    • +