From 58300c36ad77e8d788e99825d509fe8657a36854 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 26 Dec 2013 01:56:58 +0100 Subject: Cookie : sous-répertoire pour index (changements de répertoires !) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/333 /public/ est renommé /p/ /public/index.php est déplacé dans /p/i/index.php Le cookie de session est limité à /p/i/ --- p/scripts/global_view.js | 71 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 p/scripts/global_view.js (limited to 'p/scripts/global_view.js') diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js new file mode 100644 index 000000000..0cdcdd3fa --- /dev/null +++ b/p/scripts/global_view.js @@ -0,0 +1,71 @@ +"use strict"; +var panel_loading = false; + +function load_panel(link) { + if (panel_loading) { + return; + } + + panel_loading = true; + + $.get(link, function (data) { + $("#panel").append($(".nav_menu, #stream .day, #stream .flux, #stream .pagination", data)); + + $("#panel .nav_menu").children().not("#nav_menu_read_all").remove(); + + init_load_more($("#panel")); + init_posts(); + + $("#overlay").fadeIn(); + $("#panel").slideToggle(); + + // force le démarrage du scroll en haut. + // Sans ça, si l'on scroll en lisant une catégorie par exemple, + // en en ouvrant une autre ensuite, on se retrouve au même point de scroll + $("#panel").scrollTop(0); + + panel_loading = false; + }); +} + +function init_close_panel() { + $("#panel .close").click(function () { + $("#panel").html('' + window.iconClose + ''); + init_close_panel(); + $("#panel").slideToggle(); + $("#overlay").fadeOut(); + + return false; + }); +} + +function init_global_view() { + $("#stream .box-category a").click(function () { + var link = $(this).attr("href"); + + load_panel(link); + + return false; + }); + + $(".nav_menu #nav_menu_read_all, .nav_menu .toggle_aside").remove(); + + init_stream_delegates($("#panel")); +} + +function init_all_global_view() { + if (!(window.$ && window.init_stream_delegates)) { + window.setTimeout(init_all_global_view, 50); //Wait for all js to be loaded + return; + } + init_global_view(); + init_close_panel(); +} + +if (document.readyState && document.readyState !== 'loading') { + init_all_global_view(); +} else if (document.addEventListener) { + document.addEventListener('DOMContentLoaded', function () { + init_all_global_view(); + }, false); +} -- cgit v1.2.3 From 69f7bce75b6f45b7f8be376a5d9c14d5da62c91d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 18 Jan 2014 16:41:10 +0100 Subject: Changements de vues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correction d'un bug JavaScript récent dans la vue globale. Corrections de nombreux bugs lors des changements de vue https://github.com/marienfressinaud/FreshRSS/issues/346 et amélioration des performances pour la génération des URL en évitant beaucoup d'appels de fonctions https://github.com/marienfressinaud/FreshRSS/pull/362 De plus, dans les URL, is_favorite et is_read ont maintenant une valeur par défaut de 1, ce qui évite de les écrire dans beaucoup de cas. Suppression des espaces blancs de la sortie HTML au niveau de quelques boucles critiques. --- app/Controllers/entryController.php | 13 ++-- app/i18n/en.php | 2 +- app/i18n/fr.php | 2 +- app/layout/aside_flux.phtml | 73 +++++++++--------- app/layout/nav_menu.phtml | 8 +- app/views/entry/bookmark.phtml | 2 +- app/views/entry/read.phtml | 2 +- app/views/helpers/view/normal_view.phtml | 122 +++++++++++++++++-------------- p/scripts/global_view.js | 7 +- 9 files changed, 131 insertions(+), 100 deletions(-) (limited to 'p/scripts/global_view.js') diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index a24dfe6d6..ded7598d9 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -10,6 +10,11 @@ class FreshRSS_entry_Controller extends Minz_ActionController { } $this->params = array (); + $output = Minz_Request::param('output', ''); + if (($output != '') && ($this->conf->view_mode !== $output)) { + $this->params['output'] = $output; + } + $this->redirect = false; $ajax = Minz_Request::param ('ajax'); if ($ajax) { @@ -34,13 +39,10 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $this->redirect = true; $id = Minz_Request::param ('id'); - $is_read = Minz_Request::param ('is_read'); $get = Minz_Request::param ('get'); $nextGet = Minz_Request::param ('nextGet', $get); $idMax = Minz_Request::param ('idMax', 0); - $is_read = (bool)$is_read; - $entryDAO = new FreshRSS_EntryDAO (); if ($id == false) { if (!$get) { @@ -63,7 +65,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { break; } if ($nextGet !== 'a') { - $this->params = array ('get' => $nextGet); + $this->params['get'] = $nextGet; } } @@ -73,6 +75,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { ); Minz_Session::_param ('notification', $notif); } else { + $is_read = (bool)(Minz_Request::param ('is_read', true)); $entryDAO->markRead ($id, $is_read); } } @@ -83,7 +86,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $id = Minz_Request::param ('id'); if ($id) { $entryDAO = new FreshRSS_EntryDAO (); - $entryDAO->markFavorite ($id, Minz_Request::param ('is_favorite')); + $entryDAO->markFavorite ($id, (bool)(Minz_Request::param ('is_favorite', true))); } } diff --git a/app/i18n/en.php b/app/i18n/en.php index 1b76dfc52..01d86e5da 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -161,7 +161,7 @@ return array ( 'current_user' => 'Current user', 'default_user' => 'Username of the default user (maximum 16 alphanumeric characters)', - 'password_form' =>'Password
(for the Web-form login method)', + '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)', 'auth_token' => 'Authentication token', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 5d54dc2dd..2c44aa8d0 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -160,7 +160,7 @@ return array ( 'think_to_add' => 'Pensez à en ajouter !', 'current_user' => 'Utilisateur actuel', - 'password_form' =>'Mot de passe
(pour connexion par formulaire)', + 'password_form' => 'Mot de passe
(pour connexion par formulaire)', '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)', diff --git a/app/layout/aside_flux.phtml b/app/layout/aside_flux.phtml index f2f85df30..f7d8b12b9 100644 --- a/app/layout/aside_flux.phtml +++ b/app/layout/aside_flux.phtml @@ -13,15 +13,15 @@
  • - 'index', 'a' => 'index', 'params' => array()); if ($this->conf->view_mode !== Minz_Request::param('output', 'normal')) { - $output = array('output', 'normal'); + $arUrl['params']['output'] = 'normal'; } ?>
  • - + @@ -30,43 +30,46 @@
  • - cat_aside as $cat) { ?> - feeds (); ?> - -
  • - get_c == $cat->id ()) { $c_active = true; } ?> -
    - name (); ?> - -
    - -
      - id (); $nbEntries = $feed->nbEntries (); - $f_active = ($this->get_f == $feed_id); - ?> -
    • - - ✇ - name(); ?> -
    • - -
    -
  • - + cat_aside as $cat) { + $feeds = $cat->feeds (); + if (!empty ($feeds)) { + ?>
  • get_c == $cat->id ()) { + $c_active = true; + } + ?>
      id (); + $nbEntries = $feed->nbEntries (); + $f_active = ($this->get_f == $feed_id); + ?>
    • ✇ name(); ?>
  • - @@ -79,7 +82,7 @@
  • -
  • +
  • diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 705ed3314..b9ce33295 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -56,7 +56,13 @@ } $p = isset($this->entries[0]) ? $this->entries[0] : null; $idMax = $p === null ? '0' : $p->id(); - $markReadUrl = _url ('entry', 'read', 'is_read', 1, 'get', $get, 'nextGet', $nextGet, 'idMax', $idMax); + + $arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax)); + $output = Minz_Request::param('output', ''); + if (($output != '') && ($this->conf->view_mode !== $output)) { + $arUrl['params']['output'] = $output; + } + $markReadUrl = Minz_Url::display($arUrl); Minz_Session::_param ('markReadUrl', $markReadUrl); ?> diff --git a/app/views/entry/bookmark.phtml b/app/views/entry/bookmark.phtml index 55b2d3d3d..c1fc32b7f 100755 --- a/app/views/entry/bookmark.phtml +++ b/app/views/entry/bookmark.phtml @@ -1,7 +1,7 @@ entries)) { $bottomline_link = $this->conf->bottomline_link; ?> -
    - entries as $item) { ?> +
    entries as $item) { + if ($display_today && $item->isDay (FreshRSS_Days::TODAY, $this->today)) { + ?>
    currentName; ?>
    isDay (FreshRSS_Days::YESTERDAY, $this->today)) { + ?>
    currentName; ?>
    isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) { + ?>
    currentName; ?>
    isDay (FreshRSS_Days::TODAY, $this->today)) { ?> -
    - - - currentName; ?> -
    - - isDay (FreshRSS_Days::YESTERDAY, $this->today)) { ?> -
    - - - currentName; ?> -
    - - isDay (FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) { ?> -
    - - currentName; ?> -
    - - -
    diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 0cdcdd3fa..c34fbf1a7 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -50,11 +50,14 @@ function init_global_view() { $(".nav_menu #nav_menu_read_all, .nav_menu .toggle_aside").remove(); - init_stream_delegates($("#panel")); + init_stream($("#panel")); } function init_all_global_view() { - if (!(window.$ && window.init_stream_delegates)) { + if (!(window.$ && window.init_stream)) { + if (window.console) { + console.log('FreshRSS Global view waiting for JS…'); + } window.setTimeout(init_all_global_view, 50); //Wait for all js to be loaded return; } -- cgit v1.2.3 From fdd179d344dbe8734480b83bb7a0fba189275d5a Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 18 Jan 2014 19:29:44 +0100 Subject: Corrections vue globale MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Contribue à https://github.com/marienfressinaud/FreshRSS/issues/353 --- app/Controllers/entryController.php | 2 +- app/Controllers/indexController.php | 6 ++---- app/views/helpers/view/global_view.phtml | 16 ++++++++++------ lib/Minz/View.php | 6 +++--- p/scripts/global_view.js | 10 ++++++++++ p/scripts/main.js | 8 +++++--- 6 files changed, 31 insertions(+), 17 deletions(-) (limited to 'p/scripts/global_view.js') diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index ded7598d9..1756c91e5 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -11,7 +11,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $this->params = array (); $output = Minz_Request::param('output', ''); - if (($output != '') && ($this->conf->view_mode !== $output)) { + if (($output != '') && ($this->view->conf->view_mode !== $output)) { $this->params['output'] = $output; } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index d05a106bb..45ded6fd4 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -46,10 +46,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { // no layout for RSS output $this->view->_useLayout (false); header('Content-Type: application/rss+xml; charset=utf-8'); - } else { - if ($output === 'global') { - Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); - } + } elseif ($output === 'global') { + Minz_View::appendScript (Minz_Url::display ('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js'))); } $this->view->cat_aside = $this->catDAO->listCategories (); diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml index ca7b66e0c..4fb807649 100644 --- a/app/views/helpers/view/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml @@ -2,18 +2,22 @@
    'index', 'a' => 'index', 'params' => array()); + if ($this->conf->view_mode !== 'normal') { + $arUrl['params']['output'] = 'normal'; } + $p = Minz_Request::param('state', ''); + if (($p != '') && ($this->conf->default_view !== $p)) { + $arUrl['params']['state'] = $p; + } + foreach ($this->cat_aside as $cat) { $feeds = $cat->feeds (); if (!empty ($feeds)) { ?>
    @@ -22,7 +26,7 @@ nbNotRead (); ?>
  • ✇ - + name(); ?>
  • diff --git a/lib/Minz/View.php b/lib/Minz/View.php index ba9555cd7..e170bd406 100644 --- a/lib/Minz/View.php +++ b/lib/Minz/View.php @@ -63,7 +63,7 @@ class Minz_View { * Affiche la Vue en elle-même */ public function render () { - if ((@include($this->view_filename)) === false) { + if ((include($this->view_filename)) === false) { Minz_Log::record ('File not found: `' . $this->view_filename . '`', Minz_Log::NOTICE); @@ -79,7 +79,7 @@ class Minz_View { . self::LAYOUT_PATH_NAME . '/' . $part . '.phtml'; - if ((@include($fic_partial)) === false) { + if ((include($fic_partial)) === false) { Minz_Log::record ('File not found: `' . $fic_partial . '`', Minz_Log::WARNING); @@ -95,7 +95,7 @@ class Minz_View { . '/views/helpers/' . $helper . '.phtml'; - if ((@include($fic_helper)) === false) {; + if ((include($fic_helper)) === false) {; Minz_Log::record ('File not found: `' . $fic_helper . '`', Minz_Log::WARNING); diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index c34fbf1a7..3973cb2ec 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -24,6 +24,16 @@ function load_panel(link) { // en en ouvrant une autre ensuite, on se retrouve au même point de scroll $("#panel").scrollTop(0); + $('#nav_menu_read_all a, #bigMarkAsRead').click(function () { + $.ajax({ + url: $(this).attr("href"), + async: false + }); + //$("#panel .close").first().click(); + window.location.reload(false); + return false; + }); + panel_loading = false; }); } diff --git a/p/scripts/main.js b/p/scripts/main.js index 5bdc316db..3f6352baf 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -137,7 +137,9 @@ function mark_favorite(active) { if (active.closest('div').hasClass('not_read')) { var elem = $('#aside_flux .favorites').children(':first').get(0), feed_unreads = elem ? (parseInt(elem.getAttribute('data-unread'), 10) || 0) : 0; - elem.setAttribute('data-unread', Math.max(0, feed_unreads + inc)); + if (elem) { + elem.setAttribute('data-unread', Math.max(0, feed_unreads + inc)); + } } }); } @@ -559,6 +561,8 @@ function load_more_posts() { } function init_load_more(box) { + box_load_more = box; + var $next_link = $("#load_more"); if (!$next_link.length) { // no more article to load @@ -566,8 +570,6 @@ function init_load_more(box) { return; } - box_load_more = box; - url_load_more = $next_link.attr("href"); var $prefetch = $('#prefetch'); if ($prefetch.attr('href') !== url_load_more) { -- cgit v1.2.3 From 79d4893fc792119c390d2f744246df210b74f637 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sun, 19 Jan 2014 20:57:24 +0100 Subject: Bug Global View liens JS --- p/scripts/global_view.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'p/scripts/global_view.js') diff --git a/p/scripts/global_view.js b/p/scripts/global_view.js index 3973cb2ec..7105520a6 100644 --- a/p/scripts/global_view.js +++ b/p/scripts/global_view.js @@ -24,7 +24,7 @@ function load_panel(link) { // en en ouvrant une autre ensuite, on se retrouve au même point de scroll $("#panel").scrollTop(0); - $('#nav_menu_read_all a, #bigMarkAsRead').click(function () { + $('#panel').on('click', '#nav_menu_read_all > a, #nav_menu_read_all .item > a, #bigMarkAsRead', function () { $.ajax({ url: $(this).attr("href"), async: false -- cgit v1.2.3