summaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-24 15:17:07 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-10-24 15:17:07 +0200
commit3e2d34c8671acae33568fdeb1398afad8296d9bf (patch)
tree6a8fa1430115d12e78855362e093dae9667008f8 /app/views
parent5d7d01be296a23058026e0dc610b2e2077b3262c (diff)
parent83d95ca4b894a84de467a97c7f413c1d04c43631 (diff)
Merge branch '634-refactor-with-context' into dev
Diffstat (limited to 'app/views')
-rw-r--r--app/views/configure/reading.phtml6
-rwxr-xr-xapp/views/helpers/pagination.phtml30
-rw-r--r--app/views/helpers/view/global_view.phtml53
-rw-r--r--app/views/index/global.phtml53
-rw-r--r--app/views/index/index.phtml2
-rw-r--r--app/views/index/normal.phtml (renamed from app/views/helpers/view/normal_view.phtml)20
-rw-r--r--app/views/index/reader.phtml (renamed from app/views/helpers/view/reader_view.phtml)2
-rwxr-xr-xapp/views/index/rss.phtml (renamed from app/views/helpers/view/rss_view.phtml)0
8 files changed, 85 insertions, 81 deletions
diff --git a/app/views/configure/reading.phtml b/app/views/configure/reading.phtml
index ef775b4b1..b8f673466 100644
--- a/app/views/configure/reading.phtml
+++ b/app/views/configure/reading.phtml
@@ -39,9 +39,9 @@
<label class="group-name" for="view_mode"><?php echo _t('articles_to_display'); ?></label>
<div class="group-controls">
<select name="default_view" id="default_view">
- <option value="<?php echo FreshRSS_Entry::STATE_NOT_READ; ?>"<?php echo FreshRSS_Context::$conf->default_view === FreshRSS_Entry::STATE_NOT_READ ? ' selected="selected"' : ''; ?>><?php echo _t('show_adaptive'); ?></option>
- <option value="<?php echo FreshRSS_Entry::STATE_ALL; ?>"<?php echo FreshRSS_Context::$conf->default_view === FreshRSS_Entry::STATE_ALL ? ' selected="selected"' : ''; ?>><?php echo _t('show_all_articles'); ?></option>
- <option value="<?php echo FreshRSS_Entry::STATE_STRICT + FreshRSS_Entry::STATE_NOT_READ; ?>"<?php echo FreshRSS_Context::$conf->default_view === FreshRSS_Entry::STATE_STRICT + FreshRSS_Entry::STATE_NOT_READ ? ' selected="selected"' : ''; ?>><?php echo _t('show_not_reads'); ?></option>
+ <option value="adaptive"<?php echo FreshRSS_Context::$conf->default_view === 'adaptive' ? ' selected="selected"' : ''; ?>><?php echo _t('show_adaptive'); ?></option>
+ <option value="all"<?php echo FreshRSS_Context::$conf->default_view === 'all' ? ' selected="selected"' : ''; ?>><?php echo _t('show_all_articles'); ?></option>
+ <option value="unread"<?php echo FreshRSS_Context::$conf->default_view === 'unread' ? ' selected="selected"' : ''; ?>><?php echo _t('show_not_reads'); ?></option>
</select>
</div>
</div>
diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml
index d642443a8..3ea6c3582 100755
--- a/app/views/helpers/pagination.phtml
+++ b/app/views/helpers/pagination.phtml
@@ -1,28 +1,32 @@
<?php
- $c = Minz_Request::controllerName();
- $a = Minz_Request::actionName();
- $params = Minz_Request::params();
- $markReadUrl = Minz_Session::param('markReadUrl');
- Minz_Session::_param('markReadUrl', false);
+ $url_next = Minz_Request::currentRequest();
+ $url_next['params']['next'] = FreshRSS_Context::$next_id;
+ $url_next['params']['ajax'] = 1;
+
+ $url_mark_read = array(
+ 'c' => 'entry',
+ 'a' => 'read',
+ 'params' => array(
+ 'get' => FreshRSS_Context::currentGet(),
+ 'nextGet' => FreshRSS_Context::$next_get,
+ 'idMax' => FreshRSS_Context::$id_max,
+ )
+ );
?>
<form id="mark-read-pagination" method="post" style="display: none"></form>
<ul class="pagination">
<li class="item pager-next">
- <?php if (!empty($this->nextId)) { ?>
- <?php
- $params['next'] = $this->nextId;
- $params['ajax'] = 1;
- ?>
- <a id="load_more" href="<?php echo Minz_Url::display(array('c' => $c, 'a' => $a, 'params' => $params)); ?>">
+ <?php if (FreshRSS_Context::$next_id) { ?>
+ <a id="load_more" href="<?php echo Minz_Url::display($url_next); ?>">
<?php echo _t('load_more'); ?>
</a>
- <?php } elseif ($markReadUrl) { ?>
+ <?php } elseif ($url_mark_read) { ?>
<button id="bigMarkAsRead"
class="as-link <?php echo FreshRSS_Context::$conf->reading_confirm ? 'confirm' : ''; ?>"
form="mark-read-pagination"
- formaction="<?php echo $markReadUrl; ?>"
+ formaction="<?php echo Minz_Url::display($url_mark_read); ?>"
type="submit">
<?php echo _t('nothing_to_load'); ?><br />
<span class="bigTick">✓</span><br />
diff --git a/app/views/helpers/view/global_view.phtml b/app/views/helpers/view/global_view.phtml
deleted file mode 100644
index ae8af820d..000000000
--- a/app/views/helpers/view/global_view.phtml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?php $this->partial('nav_menu'); ?>
-
-<?php if (!empty($this->entries)) { ?>
-<div id="stream" class="global categories">
-<?php
- $arUrl = array('c' => 'index', 'a' => 'index', 'params' => array());
- if (FreshRSS_Context::$conf->view_mode !== 'normal') {
- $arUrl['params']['output'] = 'normal';
- }
- $p = Minz_Request::param('state', '');
- if (($p != '') && (FreshRSS_Context::$conf->default_view !== $p)) {
- $arUrl['params']['state'] = $p;
- }
-
- foreach ($this->cat_aside as $cat) {
- $feeds = $cat->feeds();
- if (!empty($feeds)) {
-?>
- <div class="box-category">
- <div class="category">
- <a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id(); echo Minz_Url::display($arUrl); ?>">
- <?php echo $cat->name(); ?>
- </a>
- </div>
- <ul class="feeds">
- <?php foreach ($feeds as $feed) { ?>
- <?php $not_read = $feed->nbNotRead(); ?>
- <li id="f_<?php echo $feed->id(); ?>" class="item<?php echo $feed->inError() ? ' error' : ''; ?><?php echo $feed->nbEntries() == 0 ? ' empty' : ''; ?>">
- <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" />
- <a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority(); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed->id(); echo Minz_Url::display($arUrl); ?>">
- <?php echo $feed->name(); ?>
- </a>
- </li>
- <?php } ?>
- </ul>
- </div>
-<?php
- }
- }
-?>
-</div>
-
-<div id="overlay"></div>
-<div id="panel"<?php echo FreshRSS_Context::$conf->display_posts ? '' : ' class="hide_posts"'; ?>>
- <a class="close" href="#"><?php echo _i('close'); ?></a>
-</div>
-
-<?php } else { ?>
-<div id="stream" class="prompt alert alert-warn global">
- <h2><?php echo _t('no_feed_to_display'); ?></h2>
- <a href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('think_to_add'); ?></a><br /><br />
-</div>
-<?php } ?>
diff --git a/app/views/index/global.phtml b/app/views/index/global.phtml
new file mode 100644
index 000000000..0975a5a00
--- /dev/null
+++ b/app/views/index/global.phtml
@@ -0,0 +1,53 @@
+<?php
+ $this->partial('nav_menu');
+
+ $class = '';
+ if (FreshRSS_Context::$conf->hide_read_feeds &&
+ FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_NOT_READ) &&
+ !FreshRSS_Context::isStateEnabled(FreshRSS_Entry::STATE_READ)) {
+ $class = ' state_unread';
+ }
+?>
+
+<div id="stream" class="global<?php echo $class; ?>">
+<?php
+ $url_base = array(
+ 'c' => 'index',
+ 'a' => 'index',
+ 'params' => Minz_Request::params()
+ );
+
+ foreach ($this->categories as $cat) {
+ $feeds = $cat->feeds();
+ $url_base['params']['get'] = 'c_' . $cat->id();
+
+ if (!empty($feeds)) {
+?>
+ <div class="box category" data-unread="<?php echo $cat->nbNotRead(); ?>">
+ <div class="box-title"><a class="title" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $cat->name(); ?></a></div>
+
+ <ul class="box-content">
+ <?php
+ foreach ($feeds as $feed) {
+ $nb_not_read = $feed->nbNotRead();
+ $error = $feed->inError() ? ' error' : '';
+ $empty = $feed->nbEntries() === 0 ? ' empty' : '';
+ $url_base['params']['get'] = 'f_' . $feed->id();
+ ?>
+ <li id="f_<?php echo $feed->id(); ?>" class="item feed<?php echo $error, $empty; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>" data-priority="<?php echo $feed->priority(); ?>">
+ <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" />
+ <a class="item-title" data-unread="<?php echo format_number($feed->nbNotRead()); ?>" href="<?php echo Minz_Url::display($url_base); ?>"><?php echo $feed->name(); ?></a>
+ </li>
+ <?php } ?>
+ </ul>
+ </div>
+<?php
+ }
+ }
+?>
+</div>
+
+<div id="overlay"></div>
+<div id="panel"<?php echo FreshRSS_Context::$conf->display_posts ? '' : ' class="hide_posts"'; ?>>
+ <a class="close" href="#"><?php echo _i('close'); ?></a>
+</div>
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index a59063557..8b93461dd 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -7,8 +7,6 @@ if (FreshRSS_Auth::hasAccess() || Minz_Configuration::allowAnonymous()) {
$this->renderHelper('view/normal_view');
} elseif ($output === 'reader') {
$this->renderHelper('view/reader_view');
- } elseif ($output === 'global') {
- $this->renderHelper('view/global_view');
} elseif ($output === 'rss') {
$this->renderHelper('view/rss_view');
} else {
diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/index/normal.phtml
index afe8ed872..02d621bd0 100644
--- a/app/views/helpers/view/normal_view.phtml
+++ b/app/views/index/normal.phtml
@@ -1,6 +1,6 @@
<?php
-$this->partial('aside_flux');
+$this->partial('aside_feed');
$this->partial('nav_menu');
if (!empty($this->entries)) {
@@ -26,33 +26,35 @@ if (!empty($this->entries)) {
$bottomline_link = FreshRSS_Context::$conf->bottomline_link;
$content_width = FreshRSS_Context::$conf->content_width;
+
+ $today = @strtotime('today');
?>
<div id="stream" class="normal<?php echo $hidePosts ? ' hide_posts' : ''; ?>"><?php
?><div id="new-article">
- <a href="<?php echo Minz_Url::display($this->url); ?>"><?php echo _t('new_article'); ?></a>
+ <a href="<?php echo Minz_Url::display(Minz_Request::currentRequest()); ?>"><?php echo _t('new_article'); ?></a>
</div><?php
foreach ($this->entries as $item) {
- if ($display_today && $item->isDay(FreshRSS_Days::TODAY, $this->today)) {
+ if ($display_today && $item->isDay(FreshRSS_Days::TODAY, $today)) {
?><div class="day" id="day_today"><?php
echo _t('today');
?><span class="date"> — <?php echo timestamptodate(time(), false); ?></span><?php
- ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
?></div><?php
$display_today = false;
}
- if ($display_yesterday && $item->isDay(FreshRSS_Days::YESTERDAY, $this->today)) {
+ if ($display_yesterday && $item->isDay(FreshRSS_Days::YESTERDAY, $today)) {
?><div class="day" id="day_yesterday"><?php
echo _t('yesterday');
?><span class="date"> — <?php echo timestamptodate(time() - 86400, false); ?></span><?php
- ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
?></div><?php
$display_yesterday = false;
}
- if ($display_others && $item->isDay(FreshRSS_Days::BEFORE_YESTERDAY, $this->today)) {
+ if ($display_others && $item->isDay(FreshRSS_Days::BEFORE_YESTERDAY, $today)) {
?><div class="day" id="day_before_yesterday"><?php
echo _t('before_yesterday');
- ?><span class="name"><?php echo $this->currentName; ?></span><?php
+ ?><span class="name"><?php echo FreshRSS_Context::$name; ?></span><?php
?></div><?php
$display_others = false;
}
@@ -80,7 +82,7 @@ if (!empty($this->entries)) {
?></li><?php
}
}
- $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed()); //We most likely already have the feed object in cache
+ $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache
if ($feed == null) {
$feed = $item->feed(true);
if ($feed == null) {
diff --git a/app/views/helpers/view/reader_view.phtml b/app/views/index/reader.phtml
index 821a50f7f..f07868488 100644
--- a/app/views/helpers/view/reader_view.phtml
+++ b/app/views/index/reader.phtml
@@ -13,7 +13,7 @@ if (!empty($this->entries)) {
<div class="flux_content">
<div class="content <?php echo $content_width; ?>">
<?php
- $feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed()); //We most likely already have the feed object in cache
+ $feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache
if (empty($feed)) $feed = $item->feed(true);
?>
<a href="<?php echo $item->link(); ?>">
diff --git a/app/views/helpers/view/rss_view.phtml b/app/views/index/rss.phtml
index e34b15ab1..e34b15ab1 100755
--- a/app/views/helpers/view/rss_view.phtml
+++ b/app/views/index/rss.phtml