Quellcode durchsuchen

Mise en place de la structure pour les différentes vues

Marien Fressinaud vor 12 Jahren
Ursprung
Commit
d3078fb726

+ 3 - 0
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',

+ 3 - 0
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',

+ 48 - 19
app/layout/nav_menu.phtml

@@ -59,43 +59,72 @@
 		<ul class="dropdown-menu">
 			<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
 
+			<?php
+				$url_output = $url;
+				$actual_view = Request::param('output', 'nomal');
+			?>
+			<?php if($actual_view != 'normal') { ?>
+			<li class="item">
+				<?php $url_output['params']['output'] = 'normal'; ?>
+				<a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
+					<?php echo Translate::t ('normal_view'); ?>
+				</a>
+			</li>
+			<?php } if($actual_view != 'reader') { ?>
+			<li class="item">
+				<?php $url_output['params']['output'] = 'reader'; ?>
+				<a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
+					<?php echo Translate::t ('reader_view'); ?>
+				</a>
+			</li>
+			<?php } if($actual_view != 'global') { ?>
+			<li class="item">
+				<?php $url_output['params']['output'] = 'global'; ?>
+				<a class="view_normal" href="<?php echo Url::display ($url_output); ?>">
+					<?php echo Translate::t ('global_view'); ?>
+				</a>
+			</li>
+			<?php } ?>
+
+			<li class="separator"></li>
+
 			<li class="item">
 				<?php
+					$url_state = $url;
 					if ($this->state == 'not_read') {
-						$url['params']['state'] = 'all';
+						$url_state['params']['state'] = 'all';
 				?>
-				<a class="print_all" href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('show_all_articles'); ?></a>
+				<a class="print_all" href="<?php echo Url::display ($url_state); ?>">
+					<?php echo Translate::t ('show_all_articles'); ?>
+				</a>
 				<?php
 					} else {
-						$url['params']['state'] = 'not_read';
+						$url_state['params']['state'] = 'not_read';
 				?>
-				<a class="print_non_read" href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('show_not_reads'); ?></a>
+				<a class="print_non_read" href="<?php echo Url::display ($url_state); ?>">
+					<?php echo Translate::t ('show_not_reads'); ?>
+				</a>
 				<?php } ?>
 			</li>
+
 			<li class="separator"></li>
 
-			<?php
-				$params = Request::params ();
-				if (isset ($params['search'])) {
-					$params['search'] = urlencode ($params['search']);
-				}
-				$url = array (
-					'c' => 'index',
-					'a' => 'index',
-					'params' => $params
-				);
-			?>
 			<li class="item">
 				<?php
+					$url_order = $url;
 					if ($this->order == 'low_to_high') {
-						$url['params']['order'] = 'high_to_low';
+						$url_order['params']['order'] = 'high_to_low';
 				?>
-				<a href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('older_first'); ?></a>
+				<a href="<?php echo Url::display ($url_order); ?>">
+					<?php echo Translate::t ('older_first'); ?>
+				</a>
 				<?php
 					} else {
-						$url['params']['order'] = 'low_to_high';
+						$url_order['params']['order'] = 'low_to_high';
 				?>
-				<a href="<?php echo Url::display ($url); ?>"><?php echo Translate::t ('newer_first'); ?></a>
+				<a href="<?php echo Url::display ($url_order); ?>">
+					<?php echo Translate::t ('newer_first'); ?>
+				</a>
 				<?php } ?>
 			</li>
 		</ul>

+ 5 - 0
app/views/helpers/global_view.phtml

@@ -0,0 +1,5 @@
+<?php
+$this->partial ('nav_menu');
+?>
+
+Non implémenté

+ 114 - 0
app/views/helpers/normal_view.phtml

@@ -0,0 +1,114 @@
+<?php
+
+$this->partial ('aside_flux');
+$this->partial ('nav_menu');
+
+if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
+	$items = $this->entryPaginator->items ();
+?>
+
+<div id="stream">
+	<?php
+		$display_today = true;
+		$display_yesterday = true;
+		$display_others = true;
+	?>
+	<?php foreach ($items as $item) { ?>
+
+	<?php if ($display_today && $item->isDay (Days::TODAY)) { ?>
+	<div class="day"><?php echo Translate::t ('today'); ?> - <?php echo timestamptodate (time (), false); ?></div>
+	<?php $display_today = false; } ?>
+	<?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?>
+	<div class="day"><?php echo Translate::t ('yesterday'); ?> - <?php echo timestamptodate (time () - 86400, false); ?></div>
+	<?php $display_yesterday = false; } ?>
+	<?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?>
+	<div class="day"><?php echo Translate::t ('before_yesterday'); ?></div>
+	<?php $display_others = false; } ?>
+
+	<div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
+		<ul class="horizontal-list flux_header">
+			<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
+			<li class="item manage">
+				<?php if (!$item->isRead ()) { ?>
+				<a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 1); ?>">&nbsp;</a>
+				<?php } else { ?>
+				<a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 0); ?>">&nbsp;</a>
+				<?php } ?>
+
+				<?php if (!$item->isFavorite ()) { ?>
+				<a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 1); ?>">&nbsp;</a>
+				<?php } else { ?>
+				<a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 0); ?>">&nbsp;</a>
+				<?php } ?>
+			</li>
+			<?php } ?>
+			<?php $feed = $item->feed (true); ?>
+			<li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li>
+			<li class="item title"><?php echo $item->title (); ?></li>
+			<li class="item date"><?php echo $item->date (); ?></li>
+			<li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>">&nbsp;</a></li>
+		</ul>
+
+		<div class="flux_content">
+			<div class="content">
+				<h1 class="title"><?php echo $item->title (); ?></h1>
+				<?php $author = $item->author (); ?>
+				<?php echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : ''; ?>
+				<?php
+					if($this->conf->lazyload() == 'yes') {
+						echo lazyimg($item->content ());
+					} else {
+						echo $item->content();
+					}
+				?>
+			</div>
+
+			<ul class="horizontal-list bottom">
+				<li class="item">
+					<div class="dropdown">
+						<div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
+						<i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a>
+
+						<ul class="dropdown-menu">
+							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
+
+							<li class="item"><a href="mailto:?subject=<?php echo $item->title (); ?>&amp;body=J'ai trouvé cet article intéressant, tu peux le lire à cette adresse : <?php echo urlencode($item->link ()); ?>"><?php echo Translate::t ('by_email'); ?></a></li>
+							<?php
+							$shaarli = $this->conf->urlShaarli ();
+							if ($shaarli) {
+							?>
+							<li class="item"><a target="_blank" href="<?php echo $shaarli . '?post=' . urlencode($item->link ()) . '&amp;title=' . urlencode ($item->title ()) . '&amp;source=bookmarklet'; ?>"><?php echo Translate::t ('on_shaarli'); ?></a></li>
+							<?php } ?>
+						</ul>
+					</div>
+				</li>
+				<?php $tags = $item->tags(); ?>
+				<?php if(!empty($tags)) { ?>
+				<li class="item">
+					<div class="dropdown">
+						<div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
+						<i class="icon i_tag"></i> <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php echo Translate::t ('related_tags'); ?></a>
+
+						<ul class="dropdown-menu">
+							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
+
+							<?php foreach($tags as $tag) { ?>
+							<li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li>
+							<?php } ?>
+						</ul>
+					</div>
+				</li>
+				<?php } ?>
+			</ul>
+		</div>
+	</div>
+	<?php } ?>
+	
+	<?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?>
+</div>
+
+<?php } else { ?>
+<div class="alert alert-warn">
+	<span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span>
+</div>
+<?php } ?>

+ 5 - 0
app/views/helpers/reader_view.phtml

@@ -0,0 +1,5 @@
+<?php
+$this->partial ('nav_menu');
+?>
+
+Non implémenté

+ 0 - 0
app/views/helpers/rss.phtml → app/views/helpers/rss_view.phtml


+ 7 - 121
app/views/index/index.phtml

@@ -1,127 +1,13 @@
 <?php
-function lazyimg($content) {
-	return preg_replace(
-		'/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i',
-		'<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>',
-		$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 ();
-?>
-
-<div id="stream">
-	<?php
-		$display_today = true;
-		$display_yesterday = true;
-		$display_others = true;
-	?>
-	<?php foreach ($items as $item) { ?>
-
-	<?php if ($display_today && $item->isDay (Days::TODAY)) { ?>
-	<div class="day"><?php echo Translate::t ('today'); ?> - <?php echo timestamptodate (time (), false); ?></div>
-	<?php $display_today = false; } ?>
-	<?php if ($display_yesterday && $item->isDay (Days::YESTERDAY)) { ?>
-	<div class="day"><?php echo Translate::t ('yesterday'); ?> - <?php echo timestamptodate (time () - 86400, false); ?></div>
-	<?php $display_yesterday = false; } ?>
-	<?php if ($display_others && $item->isDay (Days::BEFORE_YESTERDAY)) { ?>
-	<div class="day"><?php echo Translate::t ('before_yesterday'); ?></div>
-	<?php $display_others = false; } ?>
-
-	<div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
-		<ul class="horizontal-list flux_header">
-			<?php if (!login_is_conf ($this->conf) || is_logged ()) { ?>
-			<li class="item manage">
-				<?php if (!$item->isRead ()) { ?>
-				<a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 1); ?>">&nbsp;</a>
-				<?php } else { ?>
-				<a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 0); ?>">&nbsp;</a>
-				<?php } ?>
-
-				<?php if (!$item->isFavorite ()) { ?>
-				<a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 1); ?>">&nbsp;</a>
-				<?php } else { ?>
-				<a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 0); ?>">&nbsp;</a>
-				<?php } ?>
-			</li>
-			<?php } ?>
-			<?php $feed = $item->feed (true); ?>
-			<li class="item website"><a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>"><img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span></a></li>
-			<li class="item title"><?php echo $item->title (); ?></li>
-			<li class="item date"><?php echo $item->date (); ?></li>
-			<li class="item link"><a target="_blank" href="<?php echo $item->link (); ?>">&nbsp;</a></li>
-		</ul>
-
-		<div class="flux_content">
-			<div class="content">
-				<h1 class="title"><?php echo $item->title (); ?></h1>
-				<?php $author = $item->author (); ?>
-				<?php echo $author != '' ? '<div class="author">' . Translate::t ('by_author', $author) . '</div>' : ''; ?>
-				<?php
-					if($this->conf->lazyload() == 'yes') {
-						echo lazyimg($item->content ());
-					} else {
-						echo $item->content();
-					}
-				?>
-			</div>
-
-			<ul class="horizontal-list bottom">
-				<li class="item">
-					<div class="dropdown">
-						<div id="dropdown-share-<?php echo $item->id ();?>" class="dropdown-target"></div>
-						<i class="icon i_share"></i> <a class="dropdown-toggle" href="#dropdown-share-<?php echo $item->id ();?>"><?php echo Translate::t ('share'); ?></a>
-
-						<ul class="dropdown-menu">
-							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
-
-							<li class="item"><a href="mailto:?subject=<?php echo $item->title (); ?>&amp;body=J'ai trouvé cet article intéressant, tu peux le lire à cette adresse : <?php echo urlencode($item->link ()); ?>"><?php echo Translate::t ('by_email'); ?></a></li>
-							<?php
-							$shaarli = $this->conf->urlShaarli ();
-							if ($shaarli) {
-							?>
-							<li class="item"><a target="_blank" href="<?php echo $shaarli . '?post=' . urlencode($item->link ()) . '&amp;title=' . urlencode ($item->title ()) . '&amp;source=bookmarklet'; ?>"><?php echo Translate::t ('on_shaarli'); ?></a></li>
-							<?php } ?>
-						</ul>
-					</div>
-				</li>
-				<?php $tags = $item->tags(); ?>
-				<?php if(!empty($tags)) { ?>
-				<li class="item">
-					<div class="dropdown">
-						<div id="dropdown-tags-<?php echo $item->id ();?>" class="dropdown-target"></div>
-						<i class="icon i_tag"></i> <a class="dropdown-toggle" href="#dropdown-tags-<?php echo $item->id ();?>"><?php echo Translate::t ('related_tags'); ?></a>
-
-						<ul class="dropdown-menu">
-							<li class="dropdown-close"><a href="#close"><i class="icon i_close"></i></a></li>
-
-							<?php foreach($tags as $tag) { ?>
-							<li class="item"><a href="<?php echo _url ('index', 'index', 'search', urlencode ('#' . $tag)); ?>"><?php echo $tag; ?></a></li>
-							<?php } ?>
-						</ul>
-					</div>
-				</li>
-				<?php } ?>
-			</ul>
-		</div>
-	</div>
-	<?php } ?>
-	
-	<?php $this->entryPaginator->render ('pagination.phtml', 'next'); ?>
-</div>
-
-	<?php } else { ?>
-<div class="alert alert-warn">
-	<span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span>
-</div>
-	<?php } ?>
-<?php } ?>
+	$this->renderHelper ('normal_view');
+}

+ 8 - 0
lib/lib_text.php

@@ -86,3 +86,11 @@ function parse_tags ($desc) {
 
 	return $desc_parse;
 }
+
+function lazyimg($content) {
+	return preg_replace(
+		'/<img([^<]+)src=([\'"])([^"\']*)([\'"])([^<]*)>/i',
+		'<img$1src="' . Url::display('/data/grey.gif') . '" data-original="$3"$5>',
+		$content
+	);
+}

+ 5 - 2
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%;