From 60edaa4375e804b7f572b2b4c9f89a4cc52562c6 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 12 May 2013 17:20:26 +0200 Subject: Fix issue #74 : les tags associés sont désormais cliquables MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/index/index.phtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'app/views') diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 0e09f84df..9974a9b0b 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -98,7 +98,7 @@ if ($output == 'rss') { -
  • +
  • -- cgit v1.2.3 From 9e219cbf5014c8f4f52f3ca6722f7a20cdcc13dd Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 12 May 2013 19:21:39 +0200 Subject: Fix issue #70 : lorsqu'on rencontre un problème avec un flux, on l'indique à l'utilisateur (couleur rouge) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/feedController.php | 3 +-- app/i18n/en.php | 1 + app/i18n/fr.php | 1 + app/layout/aside_feed.phtml | 2 +- app/layout/aside_flux.phtml | 2 +- app/models/Feed.php | 30 ++++++++++++++++++++++++++++++ app/views/configure/feed.phtml | 4 ++++ public/theme/freshrss.css | 3 +++ public/theme/global.css | 7 +++++++ 9 files changed, 49 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index 77f1787d0..a41d7a33f 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -159,8 +159,7 @@ class feedController extends ActionController { $feedDAO->updateLastUpdate ($feed->id ()); } catch (FeedException $e) { Log::record ($e->getMessage (), Log::ERROR); - // TODO si on a une erreur ici, il faut mettre - // le flux à jour en BDD (error = 1) (issue #70) + $feedDAO->isInError ($feed->id ()); } // On arrête à 10 flux pour ne pas surcharger le serveur diff --git a/app/i18n/en.php b/app/i18n/en.php index c832a519f..3c3a1fbcc 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -114,6 +114,7 @@ return array ( 'or' => 'or', 'informations' => 'Informations', + 'feed_in_error' => 'This feed has encountered a problem. Please verify that it is always reachable.', 'website_url' => 'Website URL', 'feed_url' => 'Feed URL', 'number_articles' => 'Number of articles', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 165b183eb..d270c9b96 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -114,6 +114,7 @@ return array ( 'or' => 'ou', 'informations' => 'Informations', + 'feed_in_error' => 'Ce flux a rencontré un problème. Veuillez vérifier qu\'il est toujours accessible.', 'website_url' => 'URL du site', 'feed_url' => 'URL du flux', 'number_articles' => 'Nombre d\'articles', diff --git a/app/layout/aside_feed.phtml b/app/layout/aside_feed.phtml index 158f012d0..4c56d12fc 100644 --- a/app/layout/aside_feed.phtml +++ b/app/layout/aside_feed.phtml @@ -43,7 +43,7 @@ feeds)) { ?> feeds as $feed) { ?> -
  • +
  • name (); ?> diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index d1fe6b759..449ffaff4 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -62,7 +62,7 @@
      get_f == $feed->id ()) { $f_active = true; } ?> -
    • +
    • +
      + +
      + + +
      +
      +
      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 215b0a564e00874367a2730f204f967a1c336ebc Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 13:13:20 +0200 Subject: Suppression du contrôleur API qui ne servait à rien MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/apiController.php | 46 --------------------------------------- app/views/api/getNbNotRead.phtml | 3 --- app/views/api/getPublicFeed.phtml | 3 --- 3 files changed, 52 deletions(-) delete mode 100755 app/controllers/apiController.php delete mode 100644 app/views/api/getNbNotRead.phtml delete mode 100644 app/views/api/getPublicFeed.phtml (limited to 'app/views') diff --git a/app/controllers/apiController.php b/app/controllers/apiController.php deleted file mode 100755 index 025908f3e..000000000 --- a/app/controllers/apiController.php +++ /dev/null @@ -1,46 +0,0 @@ -view->_useLayout (false); - } - - public function getPublicFeedAction () { - $entryDAO = new EntryDAO (); - $entryDAO->_nbItemsPerPage (-1); - - $entries_tmp = $entryDAO->listPublic ('low_to_high'); - - $entries = array (); - foreach ($entries_tmp as $e) { - $author = $e->author (); - - $notes = $e->notes (); - if ($notes == '') { - $feed = $e->feed (true); - if($author != '') { - $notes = Translate::t ('article_published_on_author', $feed->website (), $feed->name (), $author); - } else { - $notes = Translate::t ('article_published_on', $feed->website (), $feed->name ()); - } - } - - $id = $e->id (); - $entries[$id] = array (); - $entries[$id]['title'] = $e->title (); - $entries[$id]['content'] = $notes; - $entries[$id]['date'] = $e->date (true); - $entries[$id]['lastUpdate'] = $e->lastUpdate (true); - $entries[$id]['tags'] = $e->tags (); - $entries[$id]['url'] = $e->link (); - $entries[$id]['type'] = 'url'; - } - - $this->view->entries = $entries; - } - - public function getNbNotReadAction() { - } -} diff --git a/app/views/api/getNbNotRead.phtml b/app/views/api/getNbNotRead.phtml deleted file mode 100644 index 31c58f6ca..000000000 --- a/app/views/api/getNbNotRead.phtml +++ /dev/null @@ -1,3 +0,0 @@ -nb_not_read); - diff --git a/app/views/api/getPublicFeed.phtml b/app/views/api/getPublicFeed.phtml deleted file mode 100644 index 8eb0774f2..000000000 --- a/app/views/api/getPublicFeed.phtml +++ /dev/null @@ -1,3 +0,0 @@ -entries); -?> -- cgit v1.2.3 From 3ba63a170ec385910f2e743c648dd977c5eee135 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 13:25:48 +0200 Subject: Suppression des 'notes' sur les articles, pas utile --- app/controllers/entryController.php | 71 ------------------------------------- app/i18n/en.php | 4 --- app/i18n/fr.php | 4 --- app/views/entry/note.phtml | 65 --------------------------------- app/views/index/index.phtml | 7 ---- 5 files changed, 151 deletions(-) delete mode 100644 app/views/entry/note.phtml (limited to 'app/views') diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index 35f3150ea..9d6d9a944 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -97,75 +97,4 @@ class entryController extends ActionController { } } } - - public function noteAction () { - View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main'))); - - $not_found = false; - $entryDAO = new EntryDAO (); - $catDAO = new CategoryDAO (); - - $id = Request::param ('id'); - if ($id) { - $entry = $entryDAO->searchById ($id); - - if ($entry) { - $feed = $entry->feed (true); - - if (Request::isPost ()) { - $note = htmlspecialchars (Request::param ('note', '')); - $public = Request::param ('public', 'no'); - if ($public == 'yes') { - $public = true; - } else { - $public = false; - } - - $values = array ( - 'annotation' => $note, - 'is_public' => $public, - 'lastUpdate' => time () - ); - - if ($entryDAO->updateEntry ($id, $values)) { - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('updated') - ); - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('error_occured') - ); - } - Session::_param ('notification', $notif); - Request::forward (array ( - 'c' => 'entry', - 'a' => 'note', - 'params' => array ( - 'id' => $id - ) - ), true); - } - } else { - $not_found = true; - } - } else { - $not_found = true; - } - - if ($not_found) { - Error::error ( - 404, - array ('error' => array (Translate::t ('page_not_found'))) - ); - } else { - $this->view->entry = $entry; - $this->view->cat_aside = $catDAO->listCategories (); - $this->view->nb_favorites = $entryDAO->countFavorites (); - $this->view->nb_total = $entryDAO->count (); - $this->view->get_c = $feed->category (); - $this->view->get_f = $feed->id (); - } - } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 30bed791f..0d0ab5269 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -155,10 +155,6 @@ return array ( 'by_email' => 'By mail', 'on_shaarli' => 'On your Shaarli', - 'note' => 'Note', - 'add_note' => 'Add a note', - 'update_note' => 'Update your note', - 'ask_public_article' => 'Public article?', 'article' => 'Article', 'title' => 'Title', 'author' => 'Author', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 87b87945f..97e36f923 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -155,10 +155,6 @@ return array ( 'by_email' => 'Par mail', 'on_shaarli' => 'Sur votre Shaarli', - 'note' => 'Note', - 'add_note' => 'Ajouter une note', - 'update_note' => 'Modifier votre note', - 'ask_public_article' => 'Article public ?', 'article' => 'Article', 'title' => 'Titre', 'author' => 'Auteur', diff --git a/app/views/entry/note.phtml b/app/views/entry/note.phtml deleted file mode 100644 index 061060106..000000000 --- a/app/views/entry/note.phtml +++ /dev/null @@ -1,65 +0,0 @@ -partial ('aside_flux'); ?> - -
        - - - - - -
        - -
        - -
        -
        -
        - -
        - -
        -
        - -
        -
        - - -
        -
        - - - - - - entry->author (); - if ($author) { ?> -
        - -
        - -
        -
        - - -
        - -
        - entry->date (); ?> -
        -
        - -
        - -
        - entry->content (); ?> -
        -
        - -
        diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 1a07cdb46..30df591eb 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -76,13 +76,6 @@ if ($output == 'rss') {
          -
        • - notes () != '') { ?> - - - - -
        • next != '') { ?> next; ?> - + diff --git a/lib/minz/Request.php b/lib/minz/Request.php index 3463686bc..bd5fcb95e 100644 --- a/lib/minz/Request.php +++ b/lib/minz/Request.php @@ -29,11 +29,13 @@ class Request { public static function params () { return self::$params; } - public static function param ($key, $default = false) { + public static function param ($key, $default = false, $specialchars = false) { if (isset (self::$params[$key])) { $p = self::$params[$key]; - if(is_array($p)) { - return array_map(htmlspecialchars, $p); + if(is_object($p) || $specialchars) { + return $p; + } elseif(is_array($p)) { + return array_map('htmlspecialchars', $p); } else { return htmlspecialchars($p); } diff --git a/public/scripts/endless_mode.js b/public/scripts/endless_mode.js new file mode 100644 index 000000000..489b69f30 --- /dev/null +++ b/public/scripts/endless_mode.js @@ -0,0 +1,31 @@ +var url_load_more = ""; +var load = false; + +function init_load_more() { + url_load_more = $("a#load_more").attr("href"); + + $("#load_more").click (function () { + load_more_posts (); + + return false; + }); +} + +function load_more_posts () { + load = true; + $("#load_more").addClass("loading"); + $.get (url_load_more, function (data) { + $("#stream .flux:last").after($("#stream .flux", data)); + $(".pagination").html($(".pagination", data).html()); + + init_load_more(); + init_posts(); + + $("#load_more").removeClass("loading"); + load = false; + }); +} + +$(document).ready (function () { + init_load_more(); +}); \ No newline at end of file diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 2a8f24ea7..f5d4f6a83 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -357,6 +357,10 @@ color: #333; font-style: italic; } +.loading { + background: url("loader.gif") center center no-repeat; + font-size: 0; +} /*** NOTIFICATION ***/ .notification { diff --git a/public/theme/loader.gif b/public/theme/loader.gif new file mode 100644 index 000000000..5ff26f0e3 Binary files /dev/null and b/public/theme/loader.gif differ -- 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/views') 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) { ?> +
          + +
        • + currentPage > 1) { ?> + « Début + +
        • + + currentPage - 1; ?> +
        • + currentPage > 1) { ?> + ‹ Précédent + +
        • + + currentPage - 2; $i <= $this->currentPage + 2; $i++) { ?> + 0 && $i <= $this->nbPage) { ?> + currentPage) { ?> + +
        • + +
        • + + + + + currentPage + 1; ?> +
        • + currentPage < $this->nbPage) { ?> + Suivant › + +
        • + nbPage; ?> +
        • + currentPage < $this->nbPage) { ?> + Fin » + +
        • +
        + 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 8cf9ee76504d2eabd969aff1760b4edb59dfb358 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 17:36:42 +0200 Subject: Fix issue #69 : ajout d'une option pour optimiser la BDD + correction bug script actualisation lorsque connexion paramétrée MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- actualize_script.php | 1 + app/controllers/entryController.php | 19 +++++++++++++++++++ app/i18n/en.php | 4 ++++ app/i18n/fr.php | 4 ++++ app/models/Entry.php | 6 ++++++ app/views/configure/display.phtml | 11 +++++++++++ 6 files changed, 45 insertions(+) (limited to 'app/views') diff --git a/actualize_script.php b/actualize_script.php index 76bbe2e4f..7f72e419e 100755 --- a/actualize_script.php +++ b/actualize_script.php @@ -24,4 +24,5 @@ require (APP_PATH . '/App_FrontController.php'); $front_controller = new App_FrontController (); $front_controller->init (); +Session::_param('mail', true); // permet de se passer de la phase de connexion $front_controller->run (); diff --git a/app/controllers/entryController.php b/app/controllers/entryController.php index 9d6d9a944..c7e13f471 100755 --- a/app/controllers/entryController.php +++ b/app/controllers/entryController.php @@ -97,4 +97,23 @@ class entryController extends ActionController { } } } + + public function optimizeAction() { + // La table des entrées a tendance à grossir énormément + // Cette action permet d'optimiser cette table permettant de grapiller un peu de place + // Cette fonctionnalité n'est à appeler qu'occasionnellement + $entryDAO = new EntryDAO(); + $entryDAO->optimizeTable(); + + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('optimization_complete') + ); + Session::_param ('notification', $notif); + + Request::forward(array( + 'c' => 'configure', + 'a' => 'display' + ), true); + } } diff --git a/app/i18n/en.php b/app/i18n/en.php index dbb6b1bfe..e40be045a 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -78,6 +78,8 @@ return array ( 'category_emptied' => 'Category has been emptied', 'feed_deleted' => 'Feed has been deleted', + 'optimization_complete' => 'Optimization complete', + 'your_rss_feeds' => 'Your RSS feeds', 'your_favorites' => 'Your favorites', 'public' => 'Public', @@ -154,6 +156,8 @@ return array ( 'share' => 'Share', 'by_email' => 'By mail', 'on_shaarli' => 'On your Shaarli', + 'optimize_bdd' => 'Optimize database', + 'optimize_todo_sometimes' => 'To do occasionally to reduce size of database', 'article' => 'Article', 'title' => 'Title', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 75a76cc7a..69c7a8ffe 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -78,6 +78,8 @@ return array ( 'category_emptied' => 'La catégorie a été vidée', 'feed_deleted' => 'Le flux a été supprimé', + 'optimization_complete' => 'Optimisation terminée', + 'your_rss_feeds' => 'Vos flux RSS', 'your_favorites' => 'Vos favoris', 'public' => 'Public', @@ -154,6 +156,8 @@ return array ( 'share' => 'Partager', 'by_email' => 'Par mail', 'on_shaarli' => 'Sur votre Shaarli', + 'optimize_bdd' => 'Optimiser la base de données', + 'optimize_todo_sometimes' => 'À faire de temps en temps pour réduire la taille de la BDD', 'article' => 'Article', 'title' => 'Titre', diff --git a/app/models/Entry.php b/app/models/Entry.php index 050407390..6af3178ee 100755 --- a/app/models/Entry.php +++ b/app/models/Entry.php @@ -509,6 +509,12 @@ class EntryDAO extends Model_pdo { return $res[0]['count']; } + + public function optimizeTable() { + $sql = 'OPTIMIZE TABLE entry'; + $stm = $this->bd->prepare ($sql); + $stm->execute (); + } } class HelperEntry { diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index ea4fecd34..c46a02143 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -121,6 +121,17 @@ + +
        + +
        + + + + +
        +
        +
        -- cgit v1.2.3 From 4bda1d75aec180ee3845f74991f99a99ef2ae062 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 17:54:24 +0200 Subject: Possibilité de marquer un article lu / favori même si une autre action de ce type est en attente (http) + ajustement css MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/javascript/main.phtml | 17 ++--------------- public/theme/freshrss.css | 13 +++++++++++-- 2 files changed, 13 insertions(+), 17 deletions(-) (limited to 'app/views') diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 9596b1647..28bb0dfd9 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -42,19 +42,14 @@ function toggleContent (new_active, old_active) { } -var load = false; function mark_read (active, only_not_read) { if (active[0] === undefined || ( - only_not_read === true && !active.hasClass("not_read")) || - load === true) { + only_not_read === true && !active.hasClass("not_read"))) { return false; } - load = true; - url = active.find ("a.read").attr ("href"); if (url === undefined) { - load = false; return false; } @@ -71,22 +66,16 @@ function mark_read (active, only_not_read) { } else { active.addClass ("not_read"); } - - load = false; }); } function mark_favorite (active) { - if (active[0] === undefined || - load === true) { + if (active[0] === undefined) { return false; } - load = true; - url = active.find ("a.bookmark").attr ("href"); if (url === undefined) { - load = false; return false; } @@ -103,8 +92,6 @@ function mark_favorite (active) { } else { active.addClass ("favorite"); } - - load = false; }); } diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 4919639af..636f9e09d 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -77,6 +77,7 @@ } .favicon { + height: 16px; width: 16px; } @@ -243,9 +244,12 @@ text-overflow: ellipsis; line-height: 40px; } + .flux_header .item.website .favicon { + padding: 12px; + } .flux_header .item.website a { display: block; - padding: 0 5px; + padding: 0; height: 40px; } .flux_header .item.title { @@ -473,9 +477,14 @@ display: none; } .flux_header .item.website { - width: 30px; + width: 40px; text-align: center; } + + .content { + font-size: 120%; + } + .pagination .pager-previous, .pagination .pager-next { width: 100px; } -- cgit v1.2.3 From d3078fb726639eed478a2a449b0a9043af04a756 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 19:42:02 +0200 Subject: Mise en place de la structure pour les différentes vues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/i18n/en.php | 3 + app/i18n/fr.php | 3 + app/layout/nav_menu.phtml | 67 +++++++++++++------ app/views/helpers/global_view.phtml | 5 ++ app/views/helpers/normal_view.phtml | 114 ++++++++++++++++++++++++++++++++ app/views/helpers/reader_view.phtml | 5 ++ app/views/helpers/rss.phtml | 30 --------- app/views/helpers/rss_view.phtml | 30 +++++++++ app/views/index/index.phtml | 128 ++---------------------------------- lib/lib_text.php | 8 +++ public/theme/freshrss.css | 7 +- 11 files changed, 228 insertions(+), 172 deletions(-) create mode 100644 app/views/helpers/global_view.phtml create mode 100644 app/views/helpers/normal_view.phtml create mode 100644 app/views/helpers/reader_view.phtml delete mode 100755 app/views/helpers/rss.phtml create mode 100755 app/views/helpers/rss_view.phtml (limited to 'app/views') diff --git a/app/i18n/en.php b/app/i18n/en.php index e40be045a..4dbfde715 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -37,6 +37,9 @@ return array ( 'before_one_day' => 'Before one day', 'before_one_week' => 'Before one week', 'display' => 'Display', + 'normal_view' => 'Normal view', + 'reader_view' => 'Reading view', + 'global_view' => 'Global view', 'show_all_articles' => 'Show all articles', 'show_not_reads' => 'Show only unread', 'older_first' => 'Oldest first', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 69c7a8ffe..7a58b984c 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -37,6 +37,9 @@ return array ( 'before_one_day' => 'Antérieurs à 1 jour', 'before_one_week' => 'Antérieurs à 1 semaine', 'display' => 'Affichage', + 'normal_view' => 'Vue normale', + 'reader_view' => 'Vue lecture', + 'global_view' => 'Vue globale', 'show_all_articles' => 'Afficher tous les articles', 'show_not_reads' => 'Afficher les non lus', 'older_first' => 'Plus anciens en premier', diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 3411f344b..dbe597985 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -59,43 +59,72 @@ diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/global_view.phtml new file mode 100644 index 000000000..b666fe620 --- /dev/null +++ b/app/views/helpers/global_view.phtml @@ -0,0 +1,5 @@ +partial ('nav_menu'); +?> + +Non implémenté \ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml new file mode 100644 index 000000000..515084047 --- /dev/null +++ b/app/views/helpers/normal_view.phtml @@ -0,0 +1,114 @@ +partial ('aside_flux'); +$this->partial ('nav_menu'); + +if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { + $items = $this->entryPaginator->items (); +?> + +
        + + + + isDay (Days::TODAY)) { ?> +
        -
        + + isDay (Days::YESTERDAY)) { ?> +
        -
        + + isDay (Days::BEFORE_YESTERDAY)) { ?> +
        + + +
        +
          + conf) || is_logged ()) { ?> +
        • + isRead ()) { ?> +   + +   + + + isFavorite ()) { ?> +   + +   + +
        • + + feed (true); ?> +
        • name (); ?>
        • +
        • title (); ?>
        • +
        • date (); ?>
        • + +
        + +
        +
        +

        title (); ?>

        + author (); ?> + ' . Translate::t ('by_author', $author) . '
        ' : ''; ?> + conf->lazyload() == 'yes') { + echo lazyimg($item->content ()); + } else { + echo $item->content(); + } + ?> +
        + +
          +
        • + +
        • + tags(); ?> + +
        • + +
        • + +
        +
        +
        + + + entryPaginator->render ('pagination.phtml', 'next'); ?> +
        + + +
        + +
        + \ No newline at end of file diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/reader_view.phtml new file mode 100644 index 000000000..b666fe620 --- /dev/null +++ b/app/views/helpers/reader_view.phtml @@ -0,0 +1,5 @@ +partial ('nav_menu'); +?> + +Non implémenté \ No newline at end of file diff --git a/app/views/helpers/rss.phtml b/app/views/helpers/rss.phtml deleted file mode 100755 index 83de6de2e..000000000 --- a/app/views/helpers/rss.phtml +++ /dev/null @@ -1,30 +0,0 @@ -'; ?> - - - <?php echo View::title(); ?> - - - - GMT - -entryPaginator->items (); -foreach ($items as $item) { -?> - - <?php echo htmlspecialchars(html_entity_decode($item->title ())); ?> - link (); ?> - author (); ?> - - - - content (); -?>]]> - date (true)); ?> - id (); ?> - - - - - diff --git a/app/views/helpers/rss_view.phtml b/app/views/helpers/rss_view.phtml new file mode 100755 index 000000000..83de6de2e --- /dev/null +++ b/app/views/helpers/rss_view.phtml @@ -0,0 +1,30 @@ +'; ?> + + + <?php echo View::title(); ?> + + + + GMT + +entryPaginator->items (); +foreach ($items as $item) { +?> + + <?php echo htmlspecialchars(html_entity_decode($item->title ())); ?> + link (); ?> + author (); ?> + + + + content (); +?>]]> + date (true)); ?> + id (); ?> + + + + + diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 30df591eb..46ff33b3a 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -1,127 +1,13 @@ /i', - '', - $content - ); -} $output = Request::param ('output', 'normal'); if ($output == 'rss') { - $this->renderHelper ('rss'); + $this->renderHelper ('rss_view'); +} elseif($output == 'reader') { + $this->renderHelper ('reader_view'); +} elseif($output == 'global') { + $this->renderHelper ('global_view'); } else { - $this->partial ('aside_flux'); - $this->partial ('nav_menu'); - - if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { - $items = $this->entryPaginator->items (); -?> - -
        - - - - isDay (Days::TODAY)) { ?> -
        -
        - - isDay (Days::YESTERDAY)) { ?> -
        -
        - - isDay (Days::BEFORE_YESTERDAY)) { ?> -
        - - -
        -
          - conf) || is_logged ()) { ?> -
        • - isRead ()) { ?> -   - -   - - - isFavorite ()) { ?> -   - -   - -
        • - - feed (true); ?> -
        • name (); ?>
        • -
        • title (); ?>
        • -
        • date (); ?>
        • - -
        - -
        -
        -

        title (); ?>

        - author (); ?> - ' . Translate::t ('by_author', $author) . '
        ' : ''; ?> - conf->lazyload() == 'yes') { - echo lazyimg($item->content ()); - } else { - echo $item->content(); - } - ?> -
        - -
          -
        • - -
        • - tags(); ?> - -
        • - -
        • - -
        -
        -
        - - - entryPaginator->render ('pagination.phtml', 'next'); ?> -
        - - -
        - -
        - - + $this->renderHelper ('normal_view'); +} \ No newline at end of file diff --git a/lib/lib_text.php b/lib/lib_text.php index 6e8f7b2bf..9792e191e 100644 --- a/lib/lib_text.php +++ b/lib/lib_text.php @@ -86,3 +86,11 @@ function parse_tags ($desc) { return $desc_parse; } + +function lazyimg($content) { + return preg_replace( + '//i', + '', + $content + ); +} \ No newline at end of file diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 636f9e09d..26bb21d8f 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -245,11 +245,10 @@ line-height: 40px; } .flux_header .item.website .favicon { - padding: 12px; + padding: 5px; } .flux_header .item.website a { display: block; - padding: 0; height: 40px; } .flux_header .item.title { @@ -293,6 +292,7 @@ padding: 20px 10px; line-height: 170%; font-family: 'OpenSans'; + word-wrap: break-word; } .content .title { margin: 0 0 5px; @@ -480,6 +480,9 @@ width: 40px; text-align: center; } + .flux_header .item.website .favicon { + padding: 12px; + } .content { font-size: 120%; -- cgit v1.2.3 From e3b3fa39d8b51bb571d2d15dafcfc94d4ab28787 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sat, 15 Jun 2013 20:14:13 +0200 Subject: Première version de la vue lecture (issue #67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/layout/nav_menu.phtml | 2 +- app/views/helpers/reader_view.phtml | 43 +++++++++++++++++++++++++++++++++++-- app/views/javascript/main.phtml | 2 +- public/theme/freshrss.css | 12 +++++++++++ 4 files changed, 55 insertions(+), 4 deletions(-) (limited to 'app/views') diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index dbe597985..d36814bee 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -61,7 +61,7 @@
      • diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/reader_view.phtml index b666fe620..f702a4b91 100644 --- a/app/views/helpers/reader_view.phtml +++ b/app/views/helpers/reader_view.phtml @@ -1,5 +1,44 @@ partial ('nav_menu'); + +if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { + $items = $this->entryPaginator->items (); ?> -Non implémenté \ No newline at end of file +
        + + +
        +
        +
        + feed (true); ?> + + name (); ?> + +

        title (); ?>

        + +
        + author (); ?> + + date (); ?> +
        + + conf->lazyload() == 'yes') { + echo lazyimg($item->content ()); + } else { + echo $item->content(); + } + ?> +
        +
        +
        + + + entryPaginator->render ('pagination.phtml', 'next'); ?> +
        + + +
        + +
        + \ No newline at end of file diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 28bb0dfd9..5b325ac8d 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -117,7 +117,7 @@ function init_posts () { if (hide_posts) { - $(".flux:not(.active) .flux_content").hide (); + $("#stream:not(.reader) .flux:not(.active) .flux_content").hide (); } $(".flux_header .item.title, .flux_header .item.date").click (function () { diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 26bb21d8f..60498ad5b 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -286,6 +286,18 @@ text-decoration: none; } +#stream.reader .flux { + padding: 0 0 30px; + border: none; + background: #f0f0f0; + color: #333; +} + #stream.reader .flux .author { + margin: 0 0 10px; + font-size: 90%; + color: #666; + } + .content { max-width: 550px; margin: 0 auto; -- cgit v1.2.3 From 36316a6d7e81c3e73cad1362194e73a9006b0c72 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 16 Jun 2013 20:28:57 +0200 Subject: Implémentation des vues lecture et globale (issue #67) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/Category.php | 6 +++--- app/views/helpers/global_view.phtml | 32 +++++++++++++++++++++++++++++-- app/views/helpers/normal_view.phtml | 2 +- app/views/helpers/reader_view.phtml | 1 + app/views/javascript/main.phtml | 19 ++++++++++++++++++- public/theme/freshrss.css | 38 +++++++++++++++++++++++++++++++++++++ 6 files changed, 91 insertions(+), 7 deletions(-) (limited to 'app/views') diff --git a/app/models/Category.php b/app/models/Category.php index 273559b1e..0c991588d 100755 --- a/app/models/Category.php +++ b/app/models/Category.php @@ -35,10 +35,10 @@ class Category extends Model { public function feeds () { if (is_null ($this->feeds)) { $feedDAO = new FeedDAO (); - return $feedDAO->listByCategory ($this->id ()); - } else { - return $this->feeds; + $this->feeds = $feedDAO->listByCategory ($this->id ()); } + + return $this->feeds; } public function _id ($value) { diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/global_view.phtml index b666fe620..8e5e363f8 100644 --- a/app/views/helpers/global_view.phtml +++ b/app/views/helpers/global_view.phtml @@ -1,5 +1,33 @@ +partial ('nav_menu'); ?> + +
        partial ('nav_menu'); + foreach ($this->cat_aside as $cat) { + $feeds = $cat->feeds (); + $catNotRead = $cat->nbNotRead (); + if (!empty ($feeds)) { ?> + + +
        \ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml index 515084047..2ca365552 100644 --- a/app/views/helpers/normal_view.phtml +++ b/app/views/helpers/normal_view.phtml @@ -7,7 +7,7 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { $items = $this->entryPaginator->items (); ?> -
        +
        partial ('nav_menu'); if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { $items = $this->entryPaginator->items (); diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index 5b325ac8d..e290e02d3 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -9,6 +9,16 @@ var hide_posts = false; $mark = $this->conf->markWhen (); ?> +function is_reader_mode() { + var stream = $("#stream.reader"); + return stream.html() != null; +} + +function is_normal_mode() { + var stream = $("#stream.normal"); + return stream.html() != null; +} + function redirect (url, new_tab) { if (url) { if (new_tab) { @@ -117,7 +127,7 @@ function init_posts () { if (hide_posts) { - $("#stream:not(.reader) .flux:not(.active) .flux_content").hide (); + $(".flux:not(.active) .flux_content").hide (); } $(".flux_header .item.title, .flux_header .item.date").click (function () { @@ -153,6 +163,10 @@ function init_posts () { } function init_column_categories () { + if(!is_normal_mode()) { + return; + } + $(".category").addClass ("stick"); $(".categories .category .btn:first-child").width ("160px"); $(".category").append (""); @@ -268,6 +282,9 @@ function init_shortcuts () { } $(document).ready (function () { + if(is_reader_mode()) { + hide_posts = false; + } init_posts (); init_column_categories (); init_shortcuts (); diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 60498ad5b..345bd5252 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -298,6 +298,44 @@ color: #666; } +#stream.global { + text-align: center; +} + #stream.global .category { + display: inline-block; + width: 280px; + margin: 20px 10px; + vertical-align: top; + background: #fff; + border: 1px solid #aaa; + border-radius: 5px; + text-align: left; + box-shadow: 0 0 5px #bbb; + } + #stream.global .cat_header { + height: 35px; + padding: 0 10px; + background: #eee; + border-bottom: 1px solid #aaa; + border-radius: 5px 5px 0 0; + line-height: 35px; + font-size: 120%; + } + #stream.global .cat_header a { + color: #333; + text-shadow: 0 -1px 0px #aaa; + } + #stream.global .category .feeds { + max-height: 250px; + margin: 0; + list-style: none; + overflow: auto; + } + #stream.global .category .feeds .item { + padding: 0 10px; + font-size: 90%; + } + .content { max-width: 550px; margin: 0 auto; -- 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/views') 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 @@
        +
        +
        + +
        + + + +
        +
        -- cgit v1.2.3 From dff85f9a304a6ff2ede764a8f62024e7b4ff074e Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 23 Jun 2013 15:05:39 +0200 Subject: Ajout d'une barre de navigation en version mobile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix issue #57 : pas d'effet de slide (effet trop bling-bling) mais ajout d'une barre de navigation permettant d'aller à l'article suivant / précédent ou de remonter en haut de la page --- app/layout/nav_entries.phtml | 5 +++ app/views/helpers/normal_view.phtml | 2 ++ app/views/javascript/main.phtml | 64 ++++++++++++++++++++++-------------- public/theme/freshrss.css | 33 +++++++++++++++++++ public/theme/global.css | 8 +++++ public/theme/icons/next.png | Bin 0 -> 373 bytes public/theme/icons/next.svg | 31 +++++++++++++++++ public/theme/icons/previous.png | Bin 0 -> 395 bytes public/theme/icons/previous.svg | 31 +++++++++++++++++ 9 files changed, 150 insertions(+), 24 deletions(-) create mode 100644 app/layout/nav_entries.phtml create mode 100644 public/theme/icons/next.png create mode 100644 public/theme/icons/next.svg create mode 100644 public/theme/icons/previous.png create mode 100644 public/theme/icons/previous.svg (limited to 'app/views') diff --git a/app/layout/nav_entries.phtml b/app/layout/nav_entries.phtml new file mode 100644 index 000000000..101e7443e --- /dev/null +++ b/app/layout/nav_entries.phtml @@ -0,0 +1,5 @@ + \ No newline at end of file diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml index 2ca365552..eaf1e4276 100644 --- a/app/views/helpers/normal_view.phtml +++ b/app/views/helpers/normal_view.phtml @@ -107,6 +107,8 @@ if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) { entryPaginator->render ('pagination.phtml', 'next'); ?>
        +partial ('nav_entries'); ?> +
        diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml index e290e02d3..e51cf978e 100644 --- a/app/views/javascript/main.phtml +++ b/app/views/javascript/main.phtml @@ -105,6 +105,32 @@ function mark_favorite (active) { }); } +function prev_entry() { + old_active = $(".flux.active"); + last_active = $(".flux:last"); + new_active = old_active.prevAll (".flux:first"); + + if (new_active.hasClass("flux")) { + toggleContent (new_active, old_active); + } else if (old_active[0] === undefined && + new_active[0] === undefined) { + toggleContent (last_active, old_active); + } +} + +function next_entry() { + old_active = $(".flux.active"); + first_active = $(".flux:first"); + new_active = old_active.nextAll (".flux:first"); + + if (new_active.hasClass("flux")) { + toggleContent (new_active, old_active); + } else if (old_active[0] === undefined && + new_active[0] === undefined) { + toggleContent (first_active, old_active); + } +} + function init_img () { $(".flux_content .content img").each (function () { if ($(this).width () > ($(".flux_content .content").width()) / 2) { @@ -206,18 +232,7 @@ function init_shortcuts () { }); // Touches de navigation - shortcut.add("", function () { - old_active = $(".flux.active"); - last_active = $(".flux:last"); - new_active = old_active.prevAll (".flux:first"); - - if (new_active.hasClass("flux")) { - toggleContent (new_active, old_active); - } else if (old_active[0] === undefined && - new_active[0] === undefined) { - toggleContent (last_active, old_active); - } - }, { + shortcut.add("", prev_entry, { 'disable_in_input':true }); shortcut.add("shift+", function () { @@ -230,18 +245,7 @@ function init_shortcuts () { }, { 'disable_in_input':true }); - shortcut.add("", function () { - old_active = $(".flux.active"); - first_active = $(".flux:first"); - new_active = old_active.nextAll (".flux:first"); - - if (new_active.hasClass("flux")) { - toggleContent (new_active, old_active); - } else if (old_active[0] === undefined && - new_active[0] === undefined) { - toggleContent (first_active, old_active); - } - }, { + shortcut.add("", next_entry, { 'disable_in_input':true }); shortcut.add("shift+", function () { @@ -281,6 +285,17 @@ function init_shortcuts () { }); } +function init_nav_entries() { + $('.nav_entries a.previous_entry').click(function() { + prev_entry(); + return false; + }); + $('.nav_entries a.next_entry').click(function() { + next_entry(); + return false; + }); +} + $(document).ready (function () { if(is_reader_mode()) { hide_posts = false; @@ -288,4 +303,5 @@ $(document).ready (function () { init_posts (); init_column_categories (); init_shortcuts (); + init_nav_entries(); }); diff --git a/public/theme/freshrss.css b/public/theme/freshrss.css index 613a6f037..178472ac9 100644 --- a/public/theme/freshrss.css +++ b/public/theme/freshrss.css @@ -426,6 +426,11 @@ .pagination:last-child .item { border-top: 1px solid #aaa; } + +.nav_entries { + display: none; +} + .loading { background: url("loader.gif") center center no-repeat; font-size: 0; @@ -538,6 +543,9 @@ font-size: 120%; } + .pagination { + margin: 0 0 40px; + } .pagination .pager-previous, .pagination .pager-next { width: 100px; } @@ -574,4 +582,29 @@ .aside .categories { margin: 30px 0; } + + .nav_entries { + display: table; + width: 100%; + height: 40px; + position: fixed; + bottom: 0; + margin: 0; + background: #fff; + border-top: 1px solid #ddd; + text-align: center; + line-height: 40px; + table-layout: fixed; + } + .nav_entries .item { + display: table-cell; + width: 30%; + } + .nav_entries .item a { + display: block; + } + .nav_entries .item .icon.i_up { + margin: 5px 0 0; + vertical-align: top; + } } diff --git a/public/theme/global.css b/public/theme/global.css index 4c504db63..b1fd01436 100644 --- a/public/theme/global.css +++ b/public/theme/global.css @@ -517,6 +517,14 @@ input, select, textarea { background-image: url("icons/up.png"); background-image: url("icons/up.svg"); } + .icon.i_next { + background-image: url("icons/next.png"); + background-image: url("icons/next.svg"); + } + .icon.i_prev { + background-image: url("icons/previous.png"); + background-image: url("icons/previous.svg"); + } .icon.i_help { background-image: url("icons/help.png"); background-image: url("icons/help.svg"); diff --git a/public/theme/icons/next.png b/public/theme/icons/next.png new file mode 100644 index 000000000..ab3490c3b Binary files /dev/null and b/public/theme/icons/next.png differ diff --git a/public/theme/icons/next.svg b/public/theme/icons/next.svg new file mode 100644 index 000000000..72637b4e6 --- /dev/null +++ b/public/theme/icons/next.svg @@ -0,0 +1,31 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + diff --git a/public/theme/icons/previous.png b/public/theme/icons/previous.png new file mode 100644 index 000000000..10e40669e Binary files /dev/null and b/public/theme/icons/previous.png differ diff --git a/public/theme/icons/previous.svg b/public/theme/icons/previous.svg new file mode 100644 index 000000000..67685c50c --- /dev/null +++ b/public/theme/icons/previous.svg @@ -0,0 +1,31 @@ + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + -- cgit v1.2.3 From 7396b3d89724a6280684f0d2099fe17834a0f923 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 23 Jun 2013 17:40:05 +0200 Subject: Fix #77 : articles marqués comme lus au défilement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Possibilité de marquer les articles automatiquement comme lus lors du défilement de la page. Le marquage survient aux 3/4 de l'article visible. Ajout d'une option pour activer / désactiver (défaut) la fonctionnalité et disparition de l'option de marquage au chargement de la page. Ajout de 2 boutons pour marquer comme lu et en favori en bas des articles --- app/controllers/configureController.php | 4 ++-- app/controllers/indexController.php | 2 +- app/i18n/en.php | 2 +- app/i18n/fr.php | 2 +- app/models/RSSConfiguration.php | 18 +++++++++++---- app/views/configure/display.phtml | 6 ++--- app/views/helpers/normal_view.phtml | 15 ++++++++++++ app/views/javascript/main.phtml | 41 +++++++++++++++++++++++---------- public/theme/freshrss.css | 14 +++++------ 9 files changed, 73 insertions(+), 31 deletions(-) (limited to 'app/views') diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 9ed0ad1eb..ce53e1040 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -149,7 +149,7 @@ class configureController extends ActionController { $mail = Request::param ('mail_login', false); $openArticle = Request::param ('mark_open_article', 'no'); $openSite = Request::param ('mark_open_site', 'no'); - $openPage = Request::param ('mark_open_page', 'no'); + $scroll = Request::param ('mark_scroll', 'no'); $urlShaarli = Request::param ('shaarli', ''); $this->view->conf->_language ($language); @@ -164,7 +164,7 @@ class configureController extends ActionController { $this->view->conf->_markWhen (array ( 'article' => $openArticle, 'site' => $openSite, - 'page' => $openPage, + 'scroll' => $scroll, )); $this->view->conf->_urlShaarli ($urlShaarli); diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index a5a5501e7..594d379fb 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -153,7 +153,7 @@ class indexController extends ActionController { ); } - View::prependTitle (Translate::t ('see_logs') . ' - '); + View::prependTitle (Translate::t ('logs') . ' - '); $logs = array(); try { diff --git a/app/i18n/en.php b/app/i18n/en.php index 209bbcd87..648d70caf 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -153,7 +153,7 @@ return array ( 'auto_read_when' => 'Mark automatically as read when', 'article_selected' => 'Article is selected', 'article_open_on_website' => 'Article is opened on its original website', - 'page_loaded' => 'Page is loaded', + 'scroll' => 'Page scrolls', 'your_shaarli' => 'Your Shaarli', 'sharing' => 'Sharing', 'share' => 'Share', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 172f06953..714443f38 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -153,7 +153,7 @@ return array ( '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', - 'page_loaded' => 'La page est chargée', + 'scroll' => 'Au défilement de la page', 'your_shaarli' => 'Votre Shaarli', 'sharing' => 'Partage', 'share' => 'Partager', diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index b188c0e65..dde120e4a 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -76,8 +76,8 @@ class RSSConfiguration extends Model { public function markWhenSite () { return $this->mark_when['site']; } - public function markWhenPage () { - return $this->mark_when['page']; + public function markWhenScroll () { + return $this->mark_when['scroll']; } public function urlShaarli () { return $this->url_shaarli; @@ -151,9 +151,19 @@ class RSSConfiguration extends Model { } } public function _markWhen ($values) { + if(!isset($values['article'])) { + $values['article'] = 'yes'; + } + if(!isset($values['site'])) { + $values['site'] = 'yes'; + } + if(!isset($values['scroll'])) { + $values['scroll'] = 'yes'; + } + $this->mark_when['article'] = $values['article']; $this->mark_when['site'] = $values['site']; - $this->mark_when['page'] = $values['page']; + $this->mark_when['scroll'] = $values['scroll']; } public function _urlShaarli ($value) { $this->url_shaarli = ''; @@ -185,7 +195,7 @@ class RSSConfigurationDAO extends Model_array { public $mark_when = array ( 'article' => 'yes', 'site' => 'yes', - 'page' => 'no' + 'scroll' => 'no' ); public $url_shaarli = ''; diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 8484a7116..7da5b2947 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -111,9 +111,9 @@ conf->markWhenSite () == 'yes' ? ' checked="checked"' : ''; ?> /> -
        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 ()) { ?> +   + +   + +
        • +