aboutsummaryrefslogtreecommitdiff
path: root/app/views
diff options
context:
space:
mode:
Diffstat (limited to 'app/views')
-rw-r--r--app/views/api/getNbNotRead.phtml3
-rw-r--r--app/views/api/getPublicFeed.phtml3
-rw-r--r--app/views/configure/display.phtml36
-rw-r--r--app/views/configure/feed.phtml18
-rw-r--r--app/views/entry/note.phtml65
-rw-r--r--app/views/helpers/global_view.phtml37
-rwxr-xr-xapp/views/helpers/logs_pagination.phtml47
-rw-r--r--app/views/helpers/normal_view.phtml131
-rwxr-xr-xapp/views/helpers/pagination.phtml2
-rw-r--r--app/views/helpers/reader_view.phtml45
-rwxr-xr-xapp/views/helpers/rss_view.phtml (renamed from app/views/helpers/rss.phtml)0
-rw-r--r--app/views/index/index.phtml123
-rw-r--r--app/views/index/logs.phtml21
-rw-r--r--app/views/javascript/main.phtml157
14 files changed, 445 insertions, 243 deletions
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 @@
-<?php
-echo json_encode($this->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 @@
-<?php
-echo json_encode ($this->entries);
-?>
diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml
index be67896dc..7da5b2947 100644
--- a/app/views/configure/display.phtml
+++ b/app/views/configure/display.phtml
@@ -46,6 +46,11 @@
<div class="form-group">
<label class="group-name"><?php echo Translate::t ('default_view'); ?></label>
<div class="group-controls">
+ <select name="view_mode" id="view_mode">
+ <option value="normal"<?php echo $this->conf->viewMode () == 'normal' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('normal_view'); ?></option>
+ <option value="reader"<?php echo $this->conf->viewMode () == 'reader' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('reader_view'); ?></option>
+ <option value="global"<?php echo $this->conf->viewMode () == 'global' ? ' selected="selected"' : ''; ?>><?php echo Translate::t ('global_view'); ?></option>
+ </select>
<label class="radio" for="radio_all">
<input type="radio" name="default_view" id="radio_all" value="all"<?php echo $this->conf->defaultView () == 'all' ? ' checked="checked"' : ''; ?> />
<?php echo Translate::t ('show_all_articles'); ?>
@@ -68,6 +73,20 @@
</div>
<div class="form-group">
+ <label class="group-name"><?php echo Translate::t ('img_with_lazyload'); ?></label>
+ <div class="group-controls">
+ <label class="radio" for="lazyload_yes">
+ <input type="radio" name="lazyload" id="lazyload_yes" value="yes"<?php echo $this->conf->lazyload () == 'yes' ? ' checked="checked"' : ''; ?> />
+ <?php echo Translate::t ('yes'); ?><noscript> - <b><?php echo Translate::t ('javascript_should_be_activated'); ?></b></noscript>
+ </label>
+ <label class="radio" for="lazyload_no">
+ <input type="radio" name="lazyload" id="lazyload_no" value="no"<?php echo $this->conf->lazyload () == 'no' ? ' checked="checked"' : ''; ?> />
+ <?php echo Translate::t ('no'); ?>
+ </label>
+ </div>
+ </div>
+
+ <div class="form-group">
<label class="group-name"><?php echo Translate::t ('display_articles_unfolded'); ?></label>
<div class="group-controls">
<label class="radio" for="radio_yes">
@@ -92,9 +111,9 @@
<input type="checkbox" name="mark_open_site" id="check_open_site" value="yes"<?php echo $this->conf->markWhenSite () == 'yes' ? ' checked="checked"' : ''; ?> />
<?php echo Translate::t ('article_open_on_website'); ?>
</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"' : ''; ?> />
- <?php echo Translate::t ('page_loaded'); ?>
+ <label class="checkbox" for="check_scroll">
+ <input type="checkbox" name="mark_scroll" id="check_scroll" value="yes"<?php echo $this->conf->markWhenScroll () == 'yes' ? ' checked="checked"' : ''; ?> />
+ <?php echo Translate::t ('scroll'); ?>
</label>
</div>
</div>
@@ -107,6 +126,17 @@
</div>
</div>
+ <legend><?php echo Translate::t ('advanced'); ?></legend>
+ <div class="form-group">
+ <label class="group-name"></label>
+ <div class="group-controls">
+ <a class="btn" href="<?php echo _url('entry', 'optimize'); ?>">
+ <?php echo Translate::t('optimize_bdd'); ?>
+ </a>
+ <i class="icon i_help"></i> <?php echo Translate::t('optimize_todo_sometimes'); ?>
+ </div>
+ </div>
+
<div class="form-group form-actions">
<div class="group-controls">
<button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml
index 33483f72d..ec2ff3bdb 100644
--- a/app/views/configure/feed.phtml
+++ b/app/views/configure/feed.phtml
@@ -7,9 +7,19 @@
<h1><?php echo $this->flux->name (); ?></h1>
<?php echo $this->flux->description (); ?>
+ <?php if ($this->flux->inError ()) { ?>
+ <p class="alert alert-error"><span class="alert-head"><?php echo Translate::t ('damn'); ?></span> <?php echo Translate::t ('feed_in_error'); ?></p>
+ <?php } ?>
+
<form method="post" action="<?php echo _url ('configure', 'feed', 'id', $this->flux->id ()); ?>">
<legend><?php echo Translate::t ('informations'); ?></legend>
<div class="form-group">
+ <label class="group-name" for="name"><?php echo Translate::t ('title'); ?></label>
+ <div class="group-controls">
+ <input type="text" name="name" id="name" value="<?php echo $this->flux->name () ; ?>" />
+ </div>
+ </div>
+ <div class="form-group">
<label class="group-name"><?php echo Translate::t ('website_url'); ?></label>
<div class="group-controls">
<span class="control"><a target="_blank" href="<?php echo $this->flux->website (); ?>"><?php echo $this->flux->website (); ?></a></span>
@@ -22,6 +32,14 @@
</div>
</div>
<div class="form-group">
+ <label class="group-name"></label>
+ <div class="group-controls">
+ <a class="btn" href="<?php echo _url ('feed', 'actualize', 'id', $this->flux->id ()); ?>">
+ <i class="icon i_refresh"></i> <?php echo Translate::t('actualize'); ?>
+ </a>
+ </div>
+ </div>
+ <div class="form-group">
<label class="group-name"><?php echo Translate::t ('number_articles'); ?></label>
<div class="group-controls">
<span class="control"><?php echo $this->flux->nbEntries (); ?></span>
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 @@
-<?php $this->partial ('aside_flux'); ?>
-
-<div class="post">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
-
- <form method="post" action="<?php echo _url ('entry', 'note', 'id', $this->entry->id ()); ?>">
- <legend><?php echo Translate::t ('note'); ?></legend>
-
- <div class="form-group">
- <label class="group-name" for="note"><?php echo Translate::t ('add_note'); ?></label>
- <div class="group-controls">
- <textarea rows="5" cols="80" name="note" id="note"><?php echo $this->entry->notes (); ?></textarea>
- </div>
- </div>
- <div class="form-group">
- <label class="group-name" for="public_note"><?php echo Translate::t ('ask_public_article'); ?></label>
- <div class="group-controls">
- <label class="checkbox" for="public">
- <input type="checkbox" name="public" id="public" value="yes"<?php echo $this->entry->isPublic () ? ' checked="checked"' : ''; ?> /> <?php echo Translate::t ('yes'); ?>
- </label>
- </div>
- </div>
-
- <div class="form-group form-actions">
- <div class="group-controls">
- <button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
- <button type="reset" class="btn"><?php echo Translate::t ('cancel'); ?></button>
- </div>
- </div>
-
- <legend><?php echo Translate::t ('article'); ?></legend>
-
- <div class="form-group">
- <label class="group-name"><?php echo Translate::t ('title'); ?></label>
- <div class="group-controls">
- <span class="control"><a href="<?php echo $this->entry->link (); ?>"><?php echo $this->entry->title (); ?></a></span>
- </div>
- </div>
-
- <?php
- $author = $this->entry->author ();
- if ($author) { ?>
- <div class="form-group">
- <label class="group-name"><?php echo Translate::t ('author'); ?></label>
- <div class="group-controls">
- <span class="control"><?php echo $author; ?></span>
- </div>
- </div>
- <?php } ?>
-
- <div class="form-group">
- <label class="group-name"><?php echo Translate::t ('publication_date'); ?></label>
- <div class="group-controls">
- <span class="control"><?php echo $this->entry->date (); ?></span>
- </div>
- </div>
-
- <div class="form-group">
- <label class="group-name"><?php echo Translate::t ('article'); ?></label>
- <div class="group-controls">
- <span class="control"><?php echo $this->entry->content (); ?></span>
- </div>
- </div>
- </form>
-</div>
diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/global_view.phtml
new file mode 100644
index 000000000..fff391cba
--- /dev/null
+++ b/app/views/helpers/global_view.phtml
@@ -0,0 +1,37 @@
+<?php $this->partial ('nav_menu'); ?>
+
+<div id="stream" class="global">
+<?php
+ foreach ($this->cat_aside as $cat) {
+ $feeds = $cat->feeds ();
+ $catNotRead = $cat->nbNotRead ();
+ if (!empty ($feeds)) {
+?>
+ <div class="category">
+ <div class="cat_header">
+ <a href="<?php echo _url ('index', 'index', 'get', 'c_' . $cat->id ()); ?>">
+ <?php echo $cat->name(); ?><?php echo $catNotRead > 0 ? ' (' . $catNotRead . ')' : ''; ?>
+ </a>
+ </div>
+
+ <ul class="feeds">
+ <?php foreach ($feeds as $feed) { ?>
+ <?php $not_read = $feed->nbNotRead (); ?>
+ <li class="item">
+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" />
+
+ <a href="<?php echo _url ('index', 'index', 'get', 'f_' . $feed->id ()); ?>">
+ <?php echo $not_read > 0 ? '<b>' : ''; ?>
+ <?php echo $feed->name(); ?>
+ <?php echo $not_read > 0 ? ' (' . $not_read . ')' : ''; ?>
+ <?php echo $not_read > 0 ? '</b>' : ''; ?>
+ </a>
+ </li>
+ <?php } ?>
+ </ul>
+ </div>
+<?php
+ }
+ }
+?>
+</div> \ 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 @@
+<?php
+ $c = Request::controllerName ();
+ $a = Request::actionName ();
+ $params = Request::params ();
+?>
+
+<?php if ($this->nbPage > 1) { ?>
+<ul class="pagination">
+ <?php $params[$getteur] = 1; ?>
+ <li class="item pager-first">
+ <?php if ($this->currentPage > 1) { ?>
+ <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« Début</a>
+ <?php } ?>
+ </li>
+
+ <?php $params[$getteur] = $this->currentPage - 1; ?>
+ <li class="item pager-previous">
+ <?php if ($this->currentPage > 1) { ?>
+ <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ Précédent</a>
+ <?php } ?>
+ </li>
+
+ <?php for ($i = $this->currentPage - 2; $i <= $this->currentPage + 2; $i++) { ?>
+ <?php if($i > 0 && $i <= $this->nbPage) { ?>
+ <?php if ($i != $this->currentPage) { ?>
+ <?php $params[$getteur] = $i; ?>
+ <li class="item pager-item"><a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo $i; ?></a></li>
+ <?php } else { ?>
+ <li class="item pager-current"><?php echo $i; ?></li>
+ <?php } ?>
+ <?php } ?>
+ <?php } ?>
+
+ <?php $params[$getteur] = $this->currentPage + 1; ?>
+ <li class="item pager-next">
+ <?php if ($this->currentPage < $this->nbPage) { ?>
+ <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Suivant ›</a>
+ <?php } ?>
+ </li>
+ <?php $params[$getteur] = $this->nbPage; ?>
+ <li class="item pager-last">
+ <?php if ($this->currentPage < $this->nbPage) { ?>
+ <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Fin »</a>
+ <?php } ?>
+ </li>
+</ul>
+<?php } ?>
diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/normal_view.phtml
new file mode 100644
index 000000000..126fa5a78
--- /dev/null
+++ b/app/views/helpers/normal_view.phtml
@@ -0,0 +1,131 @@
+<?php
+
+$this->partial ('aside_flux');
+$this->partial ('nav_menu');
+
+if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
+ $items = $this->entryPaginator->items ();
+?>
+
+<div id="stream" class="normal">
+ <?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">
+ <?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 } ?>
+ <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 $this->partial ('nav_entries'); ?>
+
+<?php } else { ?>
+<div class="alert alert-warn">
+ <span class="alert-head"><?php echo Translate::t ('no_feed_to_display'); ?></span>
+</div>
+<?php } ?> \ No newline at end of file
diff --git a/app/views/helpers/pagination.phtml b/app/views/helpers/pagination.phtml
index f029f281a..80c0976ad 100755
--- a/app/views/helpers/pagination.phtml
+++ b/app/views/helpers/pagination.phtml
@@ -8,7 +8,7 @@
<li class="item pager-next">
<?php if ($this->next != '') { ?>
<?php $params[$getteur] = $this->next; ?>
- <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t ('load_more'); ?></a>
+ <a id="load_more" href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t ('load_more'); ?></a>
<?php } else { ?>
<?php echo Translate::t ('nothing_to_load'); ?>
<?php } ?>
diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/reader_view.phtml
new file mode 100644
index 000000000..cdca393b9
--- /dev/null
+++ b/app/views/helpers/reader_view.phtml
@@ -0,0 +1,45 @@
+<?php
+$this->partial ('nav_menu');
+
+if (isset ($this->entryPaginator) && !$this->entryPaginator->isEmpty ()) {
+ $items = $this->entryPaginator->items ();
+?>
+
+<div id="stream" class="reader">
+ <?php foreach ($items as $item) { ?>
+
+ <div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>">
+ <div class="flux_content">
+ <div class="content">
+ <?php $feed = $item->feed (true); ?>
+ <a href="<?php echo $item->link (); ?>">
+ <img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" /> <span><?php echo $feed->name (); ?></span>
+ </a>
+ <h1 class="title"><?php echo $item->title (); ?></h1>
+
+ <div class="author">
+ <?php $author = $item->author (); ?>
+ <?php echo $author != '' ? Translate::t ('by_author', $author) . ' - ' : ''; ?>
+ <?php echo $item->date (); ?>
+ </div>
+
+ <?php
+ if($this->conf->lazyload() == 'yes') {
+ echo lazyimg($item->content ());
+ } else {
+ echo $item->content();
+ }
+ ?>
+ </div>
+ </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 } ?> \ No newline at end of file
diff --git a/app/views/helpers/rss.phtml b/app/views/helpers/rss_view.phtml
index 83de6de2e..83de6de2e 100755
--- a/app/views/helpers/rss.phtml
+++ b/app/views/helpers/rss_view.phtml
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index 0e09f84df..46ff33b3a 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -1,120 +1,13 @@
<?php
+
$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 echo $item->content (); ?>
- </div>
-
- <ul class="horizontal-list bottom">
- <li class="item">
- <?php if ($item->notes () != '') { ?>
- <i class="icon i_note"></i> <a class="note" href="<?php echo _url ('entry', 'note', 'id', $item->id ()); ?>"><?php echo Translate::t ('update_note'); ?></a>
- <?php } else { ?>
- <i class="icon i_note_empty"></i> <a class="note" href="<?php echo _url ('entry', 'note', 'id', $item->id ()); ?>"><?php echo Translate::t ('add_note'); ?></a>
- <?php } ?>
- </li>
- <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"><span><?php echo $tag; ?></span></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');
+} \ No newline at end of file
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 @@
+<div class="post content">
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+
+ <h1><?php echo Translate::t ('logs'); ?></h1>
+
+ <?php $items = $this->logsPaginator->items (); ?>
+
+ <?php if (!empty ($items)) { ?>
+ <div class="logs">
+ <?php $this->logsPaginator->render ('logs_pagination.phtml', 'page'); ?>
+
+ <?php foreach ($items as $log) { ?>
+ <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo date ('d/m/Y - H:i:s', strtotime ($log->date ())); ?></span><?php echo $log->info (); ?></div>
+ <?php } ?>
+
+ <?php $this->logsPaginator->render ('logs_pagination.phtml','page'); ?>
+ </div>
+ <?php } else { ?>
+ <p class="alert alert-warn"><?php echo Translate::t ('logs_empty'); ?></p>
+ <?php } ?>
+</div> \ No newline at end of file
diff --git a/app/views/javascript/main.phtml b/app/views/javascript/main.phtml
index e6c882333..9226efe63 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) {
@@ -42,19 +52,20 @@ function toggleContent (new_active, old_active) {
<?php } ?>
}
-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;
+ if (active.hasClass ("not_read")) {
+ active.removeClass ("not_read");
+ } else {
+ active.addClass ("not_read");
+ }
url = active.find ("a.read").attr ("href");
if (url === undefined) {
- load = false;
return false;
}
@@ -66,27 +77,16 @@ function mark_read (active, only_not_read) {
res = jQuery.parseJSON(data);
active.find ("a.read").attr ("href", res.url);
- if (active.hasClass ("not_read")) {
- active.removeClass ("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,34 +103,69 @@ function mark_favorite (active) {
} else {
active.addClass ("favorite");
}
-
- load = false;
});
}
+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 img").each (function () {
- if ($(this).width () > ($("#stream .content").width()) / 2) {
+ $(".flux_content .content img").each (function () {
+ if ($(this).width () > ($(".flux_content .content").width()) / 2) {
$(this).addClass("big");
}
});
}
-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 } ?>
+function inMarkViewport(flux) {
+ var top = flux.position().top;
+ var height = flux.height();
+ var begin = top + 3 * height / 4;
+ var bot = top + height;
+ var windowTop = $(window).scrollTop();
+ var windowBot = windowTop + $(window).height();
+
+ return (windowBot >= begin && windowBot <= bot);
+}
+
+var lastScroll = 0;
+function init_posts () {
init_img ();
+ <?php if($this->conf->lazyload() == 'yes') { ?>
+ $(".flux .content img").lazyload();
+ <?php } ?>
if (hide_posts) {
$(".flux:not(.active) .flux_content").hide ();
}
- $(".flux_header .item.title, .flux_header .item.date").click (function () {
+ var flux_header_toggle = $(".flux_header .item.title, .flux_header .item.date");
+ flux_header_toggle.unbind('click'); // évite d'associer 2 fois le toggle
+ flux_header_toggle.click (function () {
old_active = $(".flux.active");
new_active = $(this).parent ().parent ();
@@ -160,9 +195,32 @@ function init_posts () {
mark_read($(this).parent().parent().parent(), true);
});
<?php } ?>
+
+ <?php if ($mark['scroll'] == 'yes') { ?>
+ var flux = $('.flux');
+ $(window).scroll(function() {
+ var windowTop = $(this).scrollTop();
+ if(Math.abs(windowTop - lastScroll) <= 50) {
+ return;
+ }
+ lastScroll = windowTop;
+
+ flux.each(function() {
+ if($(this).hasClass('not_read') &&
+ $(this).children(".flux_content").is(':visible') &&
+ inMarkViewport($(this))) {
+ mark_read($(this), true);
+ }
+ });
+ });
+ <?php } ?>
}
function init_column_categories () {
+ if(!is_normal_mode()) {
+ return;
+ }
+
$(".category").addClass ("stick");
$(".categories .category .btn:first-child").width ("160px");
$(".category").append ("<a class=\"btn dropdown-toggle\" href=\"#\"><i class=\"icon i_down\"></i></a>");
@@ -202,18 +260,7 @@ function init_shortcuts () {
});
// Touches de navigation
- shortcut.add("<?php echo $s['prev_entry']; ?>", 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("<?php echo $s['prev_entry']; ?>", prev_entry, {
'disable_in_input':true
});
shortcut.add("shift+<?php echo $s['prev_entry']; ?>", function () {
@@ -226,18 +273,7 @@ function init_shortcuts () {
}, {
'disable_in_input':true
});
- shortcut.add("<?php echo $s['next_entry']; ?>", 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("<?php echo $s['next_entry']; ?>", next_entry, {
'disable_in_input':true
});
shortcut.add("shift+<?php echo $s['next_entry']; ?>", function () {
@@ -277,8 +313,23 @@ 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;
+ }
init_posts ();
init_column_categories ();
init_shortcuts ();
+ init_nav_entries();
});