Bladeren bron

Amélioration affichage notifications + améliorations divers niveau affichage + ajout options pour auto-marquage des articles comme lus (à l'ouverture de l'article / du site / de la page)

Marien Fressinaud 13 jaren geleden
bovenliggende
commit
fb32aa4ef1

+ 9 - 0
app/controllers/configureController.php

@@ -112,6 +112,9 @@ class configureController extends ActionController {
 			$sort = Request::param ('sort_order', 'low_to_high');
 			$old = Request::param ('old_entries', 3);
 			$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');
 
 			$this->view->conf->_postsPerPage (intval ($nb));
 			$this->view->conf->_defaultView ($view);
@@ -119,6 +122,11 @@ class configureController extends ActionController {
 			$this->view->conf->_sortOrder ($sort);
 			$this->view->conf->_oldEntries ($old);
 			$this->view->conf->_mailLogin ($mail);
+			$this->view->conf->_markWhen (array (
+				'article' => $openArticle,
+				'site' => $openSite,
+				'page' => $openPage,
+			));
 
 			$values = array (
 				'posts_per_page' => $this->view->conf->postsPerPage (),
@@ -127,6 +135,7 @@ class configureController extends ActionController {
 				'sort_order' => $this->view->conf->sortOrder (),
 				'old_entries' => $this->view->conf->oldEntries (),
 				'mail_login' => $this->view->conf->mailLogin (),
+				'mark_when' => $this->view->conf->markWhen (),
 			);
 
 			$confDAO = new RSSConfigurationDAO ();

+ 1 - 4
app/layout/aside_configure.phtml

@@ -2,7 +2,7 @@
 	<li class="nav-header">Configuration</li>
 
 	<li class="item<?php echo Request::actionName () == 'display' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>">Général et affichage</a>
+		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>">Général et lecture</a>
 	</li>
 	<li class="item<?php echo Request::actionName () == 'categorize' ? ' active' : ''; ?>">
 		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'categorize')); ?>">Catégories</a>
@@ -10,7 +10,4 @@
 	<li class="item<?php echo Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
 		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'shortcut')); ?>">Raccourcis</a>
 	</li>
-	<li class="item<?php echo Request::actionName () == 'importExport' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'importExport')); ?>">Import / Export OPML</a>
-	</li>
 </div>

+ 2 - 0
app/layout/aside_flux.phtml

@@ -51,7 +51,9 @@
 							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
 							<li class="item"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>">Filtrer</a></li>
 							<li class="separator"></li>
+							<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
 							<li class="item"><a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>">Gestion</a></li>
+							<?php } ?>
 							<li class="item"><a href="<?php echo $feed->website (); ?>">Voir le site</a></li>
 						</ul>
 					</div>

+ 2 - 2
app/layout/header.phtml

@@ -32,11 +32,11 @@
 			<ul class="dropdown-menu">
 				<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
 				<li class="dropdown-header">Configuration</li>
-				<li class="item"><a href="<?php echo _url ('configure', 'display'); ?>">Général et affichage</a></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'display'); ?>">Général et lecture</a></li>
 				<li class="item"><a href="<?php echo _url ('configure', 'categorize'); ?>">Catégories</a></li>
 				<li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>">Raccourcis</a></li>
-				<li class="item"><a href="<?php echo _url ('configure', 'importExport'); ?>">Import / Export OPML</a></li>
 				<li class="separator"></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'importExport'); ?>">Import / Export OPML</a></li>
 				<li class="item"><a href="<?php echo _url ('index', 'about'); ?>">À propos</a></li>
 			</ul>
 		</div>

+ 27 - 0
app/models/RSSConfiguration.php

@@ -8,6 +8,7 @@ class RSSConfiguration extends Model {
 	private $old_entries;
 	private $shortcuts = array ();
 	private $mail_login = '';
+	private $mark_when = array ();
 	
 	public function __construct () {
 		$confDAO = new RSSConfigurationDAO ();
@@ -18,6 +19,7 @@ class RSSConfiguration extends Model {
 		$this->_oldEntries ($confDAO->old_entries);
 		$this->_shortcuts ($confDAO->shortcuts);
 		$this->_mailLogin ($confDAO->mail_login);
+		$this->_markWhen ($confDAO->mark_when);
 	}
 	
 	public function postsPerPage () {
@@ -41,6 +43,18 @@ class RSSConfiguration extends Model {
 	public function mailLogin () {
 		return $this->mail_login;
 	}
+	public function markWhen () {
+		return $this->mark_when;
+	}
+	public function markWhenArticle () {
+		return $this->mark_when['article'];
+	}
+	public function markWhenSite () {
+		return $this->mark_when['site'];
+	}
+	public function markWhenPage () {
+		return $this->mark_when['page'];
+	}
 	
 	public function _postsPerPage ($value) {
 		if (is_int (intval ($value))) {
@@ -89,6 +103,11 @@ class RSSConfiguration extends Model {
 			$this->mail_login = false;
 		}
 	}
+	public function _markWhen ($values) {
+		$this->mark_when['article'] = $values['article'];
+		$this->mark_when['site'] = $values['site'];
+		$this->mark_when['page'] = $values['page'];
+	}
 }
 
 class RSSConfigurationDAO extends Model_array {
@@ -107,6 +126,11 @@ class RSSConfigurationDAO extends Model_array {
 		'prev_page' => 'left',
 	);
 	public $mail_login = '';
+	public $mark_when = array (
+		'article' => 'yes',
+		'site' => 'yes',
+		'page' => 'no'
+	);
 
 	public function __construct () {
 		parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php');
@@ -132,6 +156,9 @@ class RSSConfigurationDAO extends Model_array {
 		if (isset ($this->array['mail_login'])) {
 			$this->mail_login = $this->array['mail_login'];
 		}
+		if (isset ($this->array['mark_when'])) {
+			$this->mark_when = $this->array['mark_when'];
+		}
 	}
 	
 	public function update ($values) {

+ 19 - 1
app/views/configure/display.phtml

@@ -20,7 +20,7 @@
 			</div>
 		</div>
 	
-		<legend>Configuration de l'affichage</legend>
+		<legend>Configuration de lecture</legend>
 
 		<div class="form-group">
 			<label class="group-name" for="posts_per_page">Nombre d'articles par page</label>
@@ -67,6 +67,24 @@
 			</div>
 		</div>
 
+		<div class="form-group">
+			<label class="group-name">Article automatiquement marqué comme lu lorsque</label>
+			<div class="group-controls">
+				<label class="checkbox" for="check_open_article">
+					<input type="checkbox" name="mark_open_article" id="check_open_article" value="yes"<?php echo $this->conf->markWhenArticle () == 'yes' ? ' checked="checked"' : ''; ?> />
+					l'article est sélectionné
+				</label>
+				<label class="checkbox" for="check_open_site">
+					<input type="checkbox" name="mark_open_site" id="check_open_site" value="yes"<?php echo $this->conf->markWhenSite () == 'yes' ? ' checked="checked"' : ''; ?> />
+					l'article est ouvert sur le site d'origine
+				</label>
+				<label class="checkbox" for="check_open_page">
+					<input type="checkbox" name="mark_open_page" id="check_open_page" value="yes"<?php echo $this->conf->markWhenPage () == 'yes' ? ' checked="checked"' : ''; ?> />
+					la page est chargée
+				</label>
+			</div>
+		</div>
+
 		<div class="form-group form-actions">
 			<div class="group-controls">
 				<button type="submit" class="btn btn-important">Valider</button>

+ 1 - 3
app/views/configure/importExport.phtml

@@ -11,9 +11,7 @@
 	</body>
 </opml>
 <?php } else { ?>
-<?php $this->partial ('aside_configure'); ?>
-
-<div class="post">
+<div class="post ">
 	<form method="post" action="<?php echo Url::display (array ('c' => 'configure', 'a' => 'importExport', 'params' => array ('q' => 'import'))); ?>" enctype="multipart/form-data">
 		<legend>Import / export au format OPML</legend>
 		<div class="form-group">

+ 6 - 0
app/views/index/about.phtml

@@ -10,7 +10,13 @@
 
 		<dt>Pour les rapports de bugs</dt>
 		<dd><a href="https://github.com/marienfressinaud/FreshRSS/issues">sur Github</a> ou <a href="mailto:dev@marienfressinaud.fr">par mail</a></dd>
+
+		<dt>Licence</dt>
+		<dd><a href="https://www.gnu.org/licenses/agpl-3.0.html">AGPL 3</a></dd>
 	</dl>
 
 	<p>FreshRSS est un agrégateur de flux RSS à auto-héberger à l'image de <a href="http://rsslounge.aditu.de/">RSSLounge</a>, <a href="http://tt-rss.org/redmine/projects/tt-rss/wiki">TinyTinyRSS</a> ou <a href="http://projet.idleman.fr/leed/">Leed</a>. Il se veut léger et facile à prendre en main tout en étant un outil puissant et paramétrable. L'objectif étant d'offrir une alternative sérieuse au futur feu-Google Reader.</p>
+
+	<h1>Crédits</h1>
+	Les <a href="https://git.gnome.org/browse/gnome-icon-theme-symbolic">icônes</a> sont issus du <a href="https://www.gnome.org/">projet GNOME</a>. La police <em>Open Sans</em> utilisée a été créée par <a href="https://www.google.com/webfonts/specimen/Open+Sans">Steve Matteson</a>. FreshRSS repose sur <a href="https://github.com/marienfressinaud/MINZ">Minz</a>, un framework PHP.
 </div>

+ 39 - 6
app/views/javascript/main.phtml

@@ -4,7 +4,10 @@ var hide_posts = true;
 var hide_posts = false;
 <?php } ?>
 
-<?php $s = $this->conf->shortcuts (); ?>
+<?php
+	$s = $this->conf->shortcuts ();
+	$mark = $this->conf->markWhen ();
+?>
 
 function redirect (url, new_tab) {
 	if (url) {
@@ -32,13 +35,22 @@ function slide (new_active, old_active) {
 			offset: new_active.position ().top
 		});
 	}
+
+	<?php if ($mark['article'] == 'yes') { ?>
+	mark_read(new_active, true);
+	<?php } ?>
 }
 
-function mark_read (active) {
-	if (active[0] === undefined) {
+var load = false;
+function mark_read (active, only_not_read) {
+	if (active[0] === undefined || (
+	    only_not_read === true && !active.hasClass("not_read")) ||
+	    load === true) {
 		return false;
 	}
 
+	load = true;
+
 	url =  active.find ("a.read").attr ("href");
 	if (url === undefined) {
 		return false;
@@ -57,6 +69,8 @@ function mark_read (active) {
 		} else {
 			active.addClass ("not_read");
 		}
+
+		load = false;
 	});
 }
 
@@ -95,6 +109,13 @@ function init_img () {
 }
 
 function init_posts () {
+	<?php if ($mark['page'] == 'yes') { ?>
+	if ($(".flux.not_read")[0] != undefined) {
+		url = $(".nav_menu a.read_all").attr ("href");
+		redirect (url, false);
+	}
+	<?php } ?>
+
 	init_img ();
 
 	if (hide_posts) {
@@ -112,7 +133,7 @@ function init_posts () {
 
 	$(".flux a.read").click (function () {
 		active = $(this).parents (".flux");
-		mark_read (active);
+		mark_read (active, false);
 
 		return false;
 	});
@@ -127,6 +148,12 @@ function init_posts () {
 	$(".flux .content a").click (function () {
 		$(this).attr ('target', '_blank');
 	});
+
+	<?php if ($mark['site'] == 'yes') { ?>
+	$(".flux .link a").click (function () {
+		mark_read($(this).parent().parent().parent(), true);
+	});
+	<?php } ?>
 }
 
 function init_column_categories () {
@@ -152,13 +179,13 @@ $(document).ready (function () {
 	shortcut.add("<?php echo $s['mark_read']; ?>", function () {
 		// on marque comme lu ou non lu
 		active = $(".flux.active");
-		mark_read (active);
+		mark_read (active, false);
 	}, {
 		'disable_in_input':true
 	});
 	shortcut.add("shift+<?php echo $s['mark_read']; ?>", function () {
 		// on marque tout comme lu
-		url = $("#top a.read_all").attr ("href");
+		url = $(".nav_menu a.read_all").attr ("href");
 		redirect (url, false);
 	}, {
 		'disable_in_input':true
@@ -233,6 +260,12 @@ $(document).ready (function () {
 	shortcut.add("<?php echo $s['go_website']; ?>", function () {
 		url = $(".flux.active .link a").attr ("href");
 
+		<?php if ($mark['site'] == 'yes') { ?>
+		$(".flux.active").each (function () {
+			mark_read($(this), true);
+		});
+		<?php } ?>
+
 		redirect (url, true);
 	}, {
 		'disable_in_input':true

+ 5 - 0
public/data/Configuration.array.php

@@ -15,4 +15,9 @@ return array (
 		'next_page' => 'right',
 		'prev_page' => 'left',
 	),
+	'mark_when' => array (
+		'article' => 'yes',
+		'site' => 'yes',
+		'page' => 'no',
+	),
 );

+ 18 - 8
public/theme/base.css

@@ -1,3 +1,10 @@
+/* FONTS */
+@font-face {
+	font-family: 'OpenSans';
+	src: local('fonts/openSans.woff') format('woff');
+}
+
+
 * {
 	margin: 0;
 	padding: 0;
@@ -682,6 +689,7 @@ input {
 	margin: 0 auto;
 	padding: 10px;
 	line-height: 170%;
+	font-family: 'OpenSans';
 }
 	.content h1, .content h2, .content h3 {
 		margin: 20px 0 5px;
@@ -708,12 +716,15 @@ input {
 	}
 	.content q, .content blockquote {
 		display: block;
-		margin: 0;
-		padding: 10px 20px;
+		margin: 5px 0;
+		padding: 5px 20px;
 		font-style: italic;
 		border-left: 4px solid #ccc;
 		color: #666;
 	}
+		.content blockquote p {
+			margin: 0;
+		}
 
 /*** PAGINATION ***/
 .pagination {
@@ -747,11 +758,10 @@ input {
 .notification {
 	position: fixed;
 	bottom: 0;
-	left: 25%;
-	width: 50%;
-	height: 50px;
-	padding: 0 50px;
-	line-height: 50px;
+	left: 5%; right: 5%;
+	min-height: 30px;
+	padding: 10px;
+	line-height: 30px;
 	text-align: center;
 	border-radius: 5px 5px 0 0;
 	box-shadow: 0 0 5px #666;
@@ -770,7 +780,7 @@ input {
 		width: 16px;
 		height: 16px;
 		float: right;
-		margin: -10px -60px 0 0;
+		margin: -20px -20px 0 0;
 		padding: 5px;
 		background: #fff;
 		border-radius: 50px;

BIN
public/theme/fonts/openSans.woff