summaryrefslogtreecommitdiff
path: root/app/views/index
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-01-29 21:26:19 +0100
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-01-29 21:26:19 +0100
commit165eb57459a152b3cc6aa3fd15ca990c3d908829 (patch)
tree640ddacbc6eabc985646dd65b0578f369ea92321 /app/views/index
parent75096e6a39fe5d34d3951991f296f616e62a9fd8 (diff)
parentc053825ff8f9792e692c101585481129b006937b (diff)
Sortie de la version 0.70.7.0
Diffstat (limited to 'app/views/index')
-rw-r--r--app/views/index/about.phtml29
-rw-r--r--app/views/index/formLogin.phtml34
-rw-r--r--app/views/index/index.phtml39
-rw-r--r--app/views/index/logs.phtml16
-rw-r--r--app/views/index/stats.phtml125
5 files changed, 205 insertions, 38 deletions
diff --git a/app/views/index/about.phtml b/app/views/index/about.phtml
index ca1254053..76ff804d8 100644
--- a/app/views/index/about.phtml
+++ b/app/views/index/about.phtml
@@ -1,24 +1,27 @@
<div class="post content">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
- <h1><?php echo Translate::t ('about_freshrss'); ?></h1>
+ <h1><?php echo Minz_Translate::t ('about_freshrss'); ?></h1>
<dl class="infos">
- <dt><?php echo Translate::t ('project_website'); ?></dt>
- <dd><a href="http://marienfressinaud.github.io/FreshRSS/">http://marienfressinaud.github.io/FreshRSS/</a></dd>
+ <dt><?php echo Minz_Translate::t ('project_website'); ?></dt>
+ <dd><a href="<?php echo FRESHRSS_WEBSITE; ?>"><?php echo FRESHRSS_WEBSITE; ?></a></dd>
- <dt><?php echo Translate::t ('lead_developer'); ?></dt>
- <dd><a href="mailto:contact@marienfressinaud.fr">Marien Fressinaud</a> - <a href="http://marienfressinaud.fr"><?php echo Translate::t ('website'); ?></a></dd>
+ <dt><?php echo Minz_Translate::t ('lead_developer'); ?></dt>
+ <dd><a href="mailto:contact@marienfressinaud.fr">Marien Fressinaud</a> — <a href="http://marienfressinaud.fr"><?php echo Minz_Translate::t ('website'); ?></a></dd>
- <dt><?php echo Translate::t ('bugs_reports'); ?></dt>
- <dd><?php echo Translate::t ('github_or_email'); ?></dd>
+ <dt><?php echo Minz_Translate::t ('bugs_reports'); ?></dt>
+ <dd><?php echo Minz_Translate::t ('github_or_email'); ?></dd>
- <dt><?php echo Translate::t ('license'); ?></dt>
- <dd><?php echo Translate::t ('agpl3'); ?></dd>
+ <dt><?php echo Minz_Translate::t ('license'); ?></dt>
+ <dd><?php echo Minz_Translate::t ('agpl3'); ?></dd>
+
+ <dt><?php echo Minz_Translate::t ('version'); ?></dt>
+ <dd><?php echo FRESHRSS_VERSION; ?></dd>
</dl>
- <p><?php echo Translate::t ('freshrss_description'); ?></p>
+ <p><?php echo Minz_Translate::t ('freshrss_description'); ?></p>
- <h1><?php echo Translate::t ('credits'); ?></h1>
- <p><?php echo Translate::t ('credits_content'); ?></p>
+ <h1><?php echo Minz_Translate::t ('credits'); ?></h1>
+ <p><?php echo Minz_Translate::t ('credits_content'); ?></p>
</div>
diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml
new file mode 100644
index 000000000..e4560c1a0
--- /dev/null
+++ b/app/views/index/formLogin.phtml
@@ -0,0 +1,34 @@
+<div class="prompt">
+<?php
+if (Minz_Configuration::canLogIn()) {
+ ?><h1><?php echo Minz_Translate::t('login'); ?></h1><?php
+ switch (Minz_Configuration::authType()) {
+
+ case 'form':
+ ?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>">
+ <p>
+ <label for="username"><?php echo Minz_Translate::t('username'); ?></label>
+ <input type="text" id="username" name="username" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" autofocus="autofocus" />
+ </p><p>
+ <label for="passwordPlain"><?php echo Minz_Translate::t('password'); ?></label>
+ <input type="password" id="passwordPlain" required="required" />
+ <input type="hidden" id="challenge" name="challenge" /><br />
+ <noscript><strong><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></strong></noscript>
+ </p><p>
+ <button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button>
+ </p>
+ </form><?php
+ break;
+
+ case 'persona':
+ ?><p><?php echo FreshRSS_Themes::icon('login'); ?> <a class="signin" href="#"><?php echo Minz_Translate::t('login'); ?></a></p><?php
+ break;
+ }
+} else {
+ ?><h1>FreshRSS</h1>
+ <p><?php echo Minz_Translate::t('forbidden_access', Minz_Configuration::authType()); ?></p><?php
+}
+?>
+
+<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p>
+</div>
diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml
index bd18d2d77..4545a33e4 100644
--- a/app/views/index/index.phtml
+++ b/app/views/index/index.phtml
@@ -1,29 +1,30 @@
<?php
-$output = Request::param ('output', 'normal');
-$token = $this->conf->token();
-$token_param = Request::param ('token', '');
-$token_is_ok = ($token != '' && $token == $token_param);
+$output = Minz_Request::param ('output', 'normal');
-if(!login_is_conf ($this->conf) ||
- is_logged() ||
- $this->conf->anonAccess() == 'yes' ||
- ($output == 'rss' && $token_is_ok)) {
- if($output == 'rss') {
+if ($this->loginOk || Minz_Configuration::allowAnonymous()) {
+ if ($output === 'normal') {
+ $this->renderHelper ('view/normal_view');
+ } elseif ($output === 'rss') {
$this->renderHelper ('view/rss_view');
- } elseif($output == 'reader') {
+ } elseif ($output === 'reader') {
$this->renderHelper ('view/reader_view');
- } elseif($output == 'global') {
+ } elseif ($output === 'global') {
$this->renderHelper ('view/global_view');
} else {
+ Minz_Request::_param ('output', 'normal');
+ $output = 'normal';
$this->renderHelper ('view/normal_view');
}
+} elseif ($output === 'rss') {
+ $token = $this->conf->token;
+ $token_param = Minz_Request::param ('token', '');
+ $token_is_ok = ($token != '' && $token == $token_param);
+ if ($token_is_ok) {
+ $this->renderHelper ('view/rss_view');
+ } else {
+ Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'), true);
+ }
} else {
-?>
-<div class="post content">
- <h1><?php echo Translate::t ('forbidden_access'); ?></h1>
- <p><?php echo Translate::t ('forbidden_access_description'); ?></p>
- <p><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about_freshrss'); ?></a></p>
-</div>
-<?php
-} \ No newline at end of file
+ Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'), true);
+}
diff --git a/app/views/index/logs.phtml b/app/views/index/logs.phtml
index 09f0c4ecd..1b77b39af 100644
--- a/app/views/index/logs.phtml
+++ b/app/views/index/logs.phtml
@@ -1,21 +1,25 @@
<div class="post content">
- <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
- <h1><?php echo Translate::t ('logs'); ?></h1>
+ <h1><?php echo Minz_Translate::t ('logs'); ?></h1>
+ <form method="post" action="<?php echo _url ('index', 'logs'); ?>"><p>
+ <input type="hidden" name="clearLogs" />
+ <button type="submit" class="btn"><?php echo Minz_Translate::t ('clear_logs'); ?></button>
+ </p></form>
<?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 htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></div>
+ <div class="log <?php echo $log->level (); ?>"><span class="date"><?php echo @date ('Y-m-d H:i:s', @strtotime ($log->date ())); ?></span><?php echo htmlspecialchars ($log->info (), ENT_NOQUOTES, 'UTF-8'); ?></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>
+ <p class="alert alert-warn"><?php echo Minz_Translate::t ('logs_empty'); ?></p>
<?php } ?>
</div>
diff --git a/app/views/index/stats.phtml b/app/views/index/stats.phtml
new file mode 100644
index 000000000..b5c18813d
--- /dev/null
+++ b/app/views/index/stats.phtml
@@ -0,0 +1,125 @@
+<div class="post content">
+ <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a>
+
+ <h1><?php echo Minz_Translate::t ('stats'); ?></h1>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_repartition'); ?></h2>
+ <table>
+ <thead>
+ <tr>
+ <th> </th>
+ <th><?php echo Minz_Translate::t ('main_stream'); ?></th>
+ <th><?php echo Minz_Translate::t ('all_feeds'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_total'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['total']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['total']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_read'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['read']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['read']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_unread'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['unread']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['unread']); ?></td>
+ </tr>
+ <tr>
+ <th><?php echo Minz_Translate::t ('status_favorites'); ?></th>
+ <td class="numeric"><?php echo formatNumber($this->repartition['main_stream']['favorite']); ?></td>
+ <td class="numeric"><?php echo formatNumber($this->repartition['all_feeds']['favorite']); ?></td>
+ </tr>
+ </tbody>
+ </table>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_per_day'); ?></h2>
+ <div id="statsEntryPerDay" style="height: 300px"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_feed_per_category'); ?></h2>
+ <div id="statsFeedPerCategory" style="height: 300px"></div>
+ <div id="statsFeedPerCategoryLegend"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_entry_per_category'); ?></h2>
+ <div id="statsEntryPerCategory" style="height: 300px"></div>
+ <div id="statsEntryPerCategoryLegend"></div>
+ </div>
+
+ <div class="stat">
+ <h2><?php echo Minz_Translate::t ('stats_top_feed'); ?></h2>
+ <table>
+ <thead>
+ <tr>
+ <th><?php echo Minz_Translate::t ('feed'); ?></th>
+ <th><?php echo Minz_Translate::t ('category'); ?></th>
+ <th><?php echo Minz_Translate::t ('stats_entry_count'); ?></th>
+ </tr>
+ </thead>
+ <tbody>
+ <?php foreach ($this->topFeed as $feed): ?>
+ <tr>
+ <td><?php echo $feed['name']; ?></td>
+ <td><?php echo $feed['category']; ?></td>
+ <td class="numeric"><?php echo formatNumber($feed['count']); ?></td>
+ </tr>
+ <?php endforeach;?>
+ </tbody>
+ </table>
+ </div>
+</div>
+
+<script>
+"use strict";
+function initStats() {
+ if (!window.Flotr) {
+ if (window.console) {
+ console.log('FreshRSS waiting for Flotr…');
+ }
+ window.setTimeout(initStats, 50);
+ return;
+ }
+ // Entry per day
+ Flotr.draw(document.getElementById('statsEntryPerDay'),
+ [<?php echo $this->count ?>],
+ {
+ grid: {verticalLines: false},
+ bars: {horizontal: false, show: true},
+ xaxis: {noTicks: 6, showLabels: false, tickDecimals: 0},
+ yaxis: {min: 0},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return numberFormat(obj.y);}}
+ });
+ // Feed per category
+ Flotr.draw(document.getElementById('statsFeedPerCategory'),
+ <?php echo $this->feedByCategory ?>,
+ {
+ grid: {verticalLines: false, horizontalLines: false},
+ pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
+ xaxis: {showLabels: false},
+ yaxis: {showLabels: false},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
+ legend: {container: document.getElementById('statsFeedPerCategoryLegend'), noColumns: 3}
+ });
+ // Entry per category
+ Flotr.draw(document.getElementById('statsEntryPerCategory'),
+ <?php echo $this->entryByCategory ?>,
+ {
+ grid: {verticalLines: false, horizontalLines: false},
+ pie: {explode: 10, show: true, labelFormatter: function(){return '';}},
+ xaxis: {showLabels: false},
+ yaxis: {showLabels: false},
+ mouse: {relative: true, track: true, trackDecimals: 0, trackFormatter: function(obj) {return obj.series.label + ' - '+ numberFormat(obj.y) + ' ('+ (obj.fraction * 100).toFixed(1) + '%)';}},
+ legend: {container: document.getElementById('statsEntryPerCategoryLegend'), noColumns: 3}
+ });
+}
+initStats();
+</script>