diff options
| author | 2014-02-19 20:19:11 +0100 | |
|---|---|---|
| committer | 2014-02-19 20:19:11 +0100 | |
| commit | 3aeea28ac7a1aa0bd07f23b1639c14985ff241ad (patch) | |
| tree | 48e391d1aee6db4797cc46bd23ffb4dce311f46b /app/views | |
| parent | 165eb57459a152b3cc6aa3fd15ca990c3d908829 (diff) | |
| parent | 04da549e2e52980ccc72689c32793222be76279d (diff) | |
Merge branch 'dev'
Diffstat (limited to 'app/views')
| -rw-r--r-- | app/views/configure/feed.phtml | 6 | ||||
| -rw-r--r-- | app/views/configure/shortcut.phtml | 55 | ||||
| -rw-r--r-- | app/views/configure/users.phtml | 20 | ||||
| -rw-r--r-- | app/views/error/index.phtml | 10 | ||||
| -rw-r--r-- | app/views/helpers/javascript_vars.phtml | 10 | ||||
| -rw-r--r-- | app/views/helpers/view/normal_view.phtml | 16 | ||||
| -rw-r--r-- | app/views/index/formLogin.phtml | 56 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 17 | ||||
| -rw-r--r-- | app/views/javascript/actualize.phtml | 53 |
9 files changed, 150 insertions, 93 deletions
diff --git a/app/views/configure/feed.phtml b/app/views/configure/feed.phtml index 138808a9f..2da04ac2d 100644 --- a/app/views/configure/feed.phtml +++ b/app/views/configure/feed.phtml @@ -7,8 +7,12 @@ <h1><?php echo $this->flux->name (); ?></h1> <?php echo $this->flux->description (); ?> + <?php $nbEntries = $this->flux->nbEntries (); ?> + <?php if ($this->flux->inError ()) { ?> <p class="alert alert-error"><span class="alert-head"><?php echo Minz_Translate::t ('damn'); ?></span> <?php echo Minz_Translate::t ('feed_in_error'); ?></p> + <?php } elseif ($nbEntries === 0) { ?> + <p class="alert alert-warn"><?php echo Minz_Translate::t ('feed_empty'); ?></p> <?php } ?> <form method="post" action="<?php echo _url ('configure', 'feed', 'id', $this->flux->id ()); ?>" autocomplete="off"> @@ -81,7 +85,7 @@ <div class="form-group"> <label class="group-name"><?php echo Minz_Translate::t ('number_articles'); ?></label> <div class="group-controls"> - <span class="control"><?php echo $this->flux->nbEntries (); ?></span> + <span class="control"><?php echo $nbEntries; ?></span> </div> </div> <div class="form-group"> diff --git a/app/views/configure/shortcut.phtml b/app/views/configure/shortcut.phtml index b0867f711..748a65d17 100644 --- a/app/views/configure/shortcut.phtml +++ b/app/views/configure/shortcut.phtml @@ -16,55 +16,59 @@ <noscript><p class="alert alert-error"><?php echo Minz_Translate::t ('javascript_for_shortcuts'); ?></p></noscript> + <legend><?php echo Minz_Translate::t ('shortcuts_navigation'); ?></legend> + <div class="form-group"> - <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label> + <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label> <div class="group-controls"> - <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" /> - <?php echo Minz_Translate::t ('shift_for_all_read'); ?> + <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" /> </div> </div> <div class="form-group"> - <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label> + <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label> <div class="group-controls"> - <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" /> + <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" /> </div> </div> <div class="form-group"> - <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label> + <label class="group-name" for="first_entry"><?php echo Minz_Translate::t ('first_article'); ?></label> <div class="group-controls"> - <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" /> + <input type="text" id="first_entry" name="shortcuts[first_entry]" list="keys" value="<?php echo $s['first_entry']; ?>" /> </div> </div> <div class="form-group"> - <label class="group-name" for="next_entry"><?php echo Minz_Translate::t ('next_article'); ?></label> + <label class="group-name" for="last_entry"><?php echo Minz_Translate::t ('last_article'); ?></label> <div class="group-controls"> - <input type="text" id="next_entry" name="shortcuts[next_entry]" list="keys" value="<?php echo $s['next_entry']; ?>" /> - <?php echo Minz_Translate::t ('shift_for_last'); ?> + <input type="text" id="last_entry" name="shortcuts[last_entry]" list="keys" value="<?php echo $s['last_entry']; ?>" /> </div> </div> + <div><?php echo Minz_Translate::t ('shortcuts_navigation_help');?></div> + + <legend><?php echo Minz_Translate::t ('shortcuts_article_action');?></legend> + <div class="form-group"> - <label class="group-name" for="prev_entry"><?php echo Minz_Translate::t ('previous_article'); ?></label> + <label class="group-name" for="mark_read"><?php echo Minz_Translate::t ('mark_read'); ?></label> <div class="group-controls"> - <input type="text" id="prev_entry" name="shortcuts[prev_entry]" list="keys" value="<?php echo $s['prev_entry']; ?>" /> - <?php echo Minz_Translate::t ('shift_for_first'); ?> + <input type="text" id="mark_read" name="shortcuts[mark_read]" list="keys" value="<?php echo $s['mark_read']; ?>" /> + <?php echo Minz_Translate::t ('shift_for_all_read'); ?> </div> </div> <div class="form-group"> - <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label> + <label class="group-name" for="mark_favorite"><?php echo Minz_Translate::t ('mark_favorite'); ?></label> <div class="group-controls"> - <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" /> + <input type="text" id="mark_favorite" name="shortcuts[mark_favorite]" list="keys" value="<?php echo $s['mark_favorite']; ?>" /> </div> </div> <div class="form-group"> - <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label> + <label class="group-name" for="go_website"><?php echo Minz_Translate::t ('see_on_website'); ?></label> <div class="group-controls"> - <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" /> + <input type="text" id="go_website" name="shortcuts[go_website]" list="keys" value="<?php echo $s['go_website']; ?>" /> </div> </div> @@ -72,6 +76,23 @@ <label class="group-name" for="auto_share_shortcut"><?php echo Minz_Translate::t ('auto_share'); ?></label> <div class="group-controls"> <input type="text" id="auto_share_shortcut" name="shortcuts[auto_share]" list="keys" value="<?php echo $s['auto_share']; ?>" /> + <?php echo Minz_Translate::t ('auto_share_help'); ?> + </div> + </div> + + <div class="form-group"> + <label class="group-name" for="collapse_entry"><?php echo Minz_Translate::t ('collapse_article'); ?></label> + <div class="group-controls"> + <input type="text" id="collapse_entry" name="shortcuts[collapse_entry]" list="keys" value="<?php echo $s['collapse_entry']; ?>" /> + </div> + </div> + + <legend><?php echo Minz_Translate::t ('shortcuts_other_action');?></legend> + + <div class="form-group"> + <label class="group-name" for="load_more_shortcut"><?php echo Minz_Translate::t ('load_more'); ?></label> + <div class="group-controls"> + <input type="text" id="load_more_shortcut" name="shortcuts[load_more]" list="keys" value="<?php echo $s['load_more']; ?>" /> </div> </div> diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 8ab4c04ba..1305feac9 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -20,7 +20,7 @@ <div class="form-group"> <label class="group-name" for="passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label> <div class="group-controls"> - <input type="password" id="passwordPlain" name="passwordPlain" pattern=".{7,}" /> + <input type="password" id="passwordPlain" name="passwordPlain" autocomplete="off" pattern=".{7,}" /> <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> </div> </div> @@ -29,7 +29,7 @@ <label class="group-name" for="mail_login"><?php echo Minz_Translate::t('persona_connection_email'); ?></label> <?php $mail = $this->conf->mail_login; ?> <div class="group-controls"> - <input type="email" id="mail_login" name="mail_login" class="extend" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" /> + <input type="email" id="mail_login" name="mail_login" class="extend" autocomplete="off" value="<?php echo $mail; ?>" <?php echo Minz_Configuration::isAdmin(Minz_Session::param('currentUser', '_')) ? '' : 'disabled="disabled"'; ?> placeholder="alice@example.net" /> <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> </div> </div> @@ -70,6 +70,16 @@ </div> </div> + <div class="form-group"> + <div class="group-controls"> + <label class="checkbox" for="anon_refresh"> + <input type="checkbox" name="anon_refresh" id="anon_refresh" value="1"<?php echo Minz_Configuration::allowAnonymousRefresh() ? ' checked="checked"' : '', + Minz_Configuration::canLogIn() ? '' : ' disabled="disabled"'; ?> /> + <?php echo Minz_Translate::t('allow_anonymous_refresh'); ?> + </label> + </div> + </div> + <?php if (Minz_Configuration::canLogIn()) { ?> <div class="form-group"> <label class="group-name" for="token"><?php echo Minz_Translate::t('auth_token'); ?></label> @@ -129,14 +139,14 @@ <div class="form-group"> <label class="group-name" for="new_user_name"><?php echo Minz_Translate::t('username'); ?></label> <div class="group-controls"> - <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" /> + <input id="new_user_name" name="new_user_name" type="text" size="16" required="required" maxlength="16" autocomplete="off" pattern="[0-9a-zA-Z]{1,16}" placeholder="demo" /> </div> </div> <div class="form-group"> <label class="group-name" for="new_user_passwordPlain"><?php echo Minz_Translate::t('password_form'); ?></label> <div class="group-controls"> - <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" pattern=".{7,}" /> + <input type="password" id="new_user_passwordPlain" name="new_user_passwordPlain" autocomplete="off" pattern=".{7,}" /> <noscript><b><?php echo Minz_Translate::t('javascript_should_be_activated'); ?></b></noscript> </div> </div> @@ -145,7 +155,7 @@ <label class="group-name" for="new_user_email"><?php echo Minz_Translate::t('persona_connection_email'); ?></label> <?php $mail = $this->conf->mail_login; ?> <div class="group-controls"> - <input type="email" id="new_user_email" name="new_user_email" class="extend" placeholder="alice@example.net" /> + <input type="email" id="new_user_email" name="new_user_email" class="extend" autocomplete="off" placeholder="alice@example.net" /> </div> </div> diff --git a/app/views/error/index.phtml b/app/views/error/index.phtml index 36fcb56f9..6a09c3aa2 100644 --- a/app/views/error/index.phtml +++ b/app/views/error/index.phtml @@ -3,7 +3,15 @@ <h1 class="alert-head"><?php echo $this->code; ?></h1> <p> - <?php echo Minz_Translate::t ('page_not_found'); ?><br /> + <?php + switch(Minz_Request::param ('code')) { + case 403: + echo Minz_Translate::t ('forbidden_access'); + break; + case 404: + default: + echo Minz_Translate::t ('page_not_found'); + } ?><br /> <a href="<?php echo _url ('index', 'index'); ?>"><?php echo Minz_Translate::t ('back_to_rss_feeds'); ?></a> </p> </div> diff --git a/app/views/helpers/javascript_vars.phtml b/app/views/helpers/javascript_vars.phtml index 0ecdc1bca..3d7c8a98f 100644 --- a/app/views/helpers/javascript_vars.phtml +++ b/app/views/helpers/javascript_vars.phtml @@ -19,6 +19,8 @@ echo ',shortcuts={', 'go_website:"', $s['go_website'], '",', 'prev_entry:"', $s['prev_entry'], '",', 'next_entry:"', $s['next_entry'], '",', + 'first_entry:"', $s['first_entry'], '",', + 'last_entry:"', $s['last_entry'], '",', 'collapse_entry:"', $s['collapse_entry'], '",', 'load_more:"', $s['load_more'], '",', 'auto_share:"', $s['auto_share'], '"', @@ -30,7 +32,13 @@ if (Minz_Request::param ('output') === 'global') { $authType = Minz_Configuration::authType(); if ($authType === 'persona') { - echo 'current_user_mail="' . Minz_Session::param ('mail', '') . '",'; + // If user is disconnected, current_user_mail MUST be null + $mail = Minz_Session::param ('mail', false); + if ($mail) { + echo 'current_user_mail="' . $mail . '",'; + } else { + echo 'current_user_mail=null,'; + } } echo 'authType="', $authType, '",', diff --git a/app/views/helpers/view/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 7b7faccee..ae93b627c 100644 --- a/app/views/helpers/view/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml @@ -147,49 +147,49 @@ if (!empty($this->entries)) { <ul class="dropdown-menu"> <li class="dropdown-close"><a href="#close">❌</a></li> <?php if ($shaarli) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="<?php echo $shaarli . '?post=' . $link . '&title=' . $title . '&source=FreshRSS'; ?>"> <?php echo Minz_Translate::t ('shaarli'); ?> </a> </li> <?php } if ($wallabag) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="<?php echo $wallabag . '?action=add&url=' . base64_encode (urldecode($link)); ?>"> <?php echo Minz_Translate::t ('wallabag'); ?> </a> </li> <?php } if ($diaspora) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="<?php echo $diaspora . '/bookmarklet?url=' . $link . '&title=' . $title; ?>"> <?php echo Minz_Translate::t ('diaspora'); ?> </a> </li> <?php } if ($twitter) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="https://twitter.com/share?url=<?php echo $link; ?>&text=<?php echo $title; ?>"> <?php echo Minz_Translate::t ('twitter'); ?> </a> </li> <?php } if ($google_plus) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="https://plus.google.com/share?url=<?php echo $link; ?>"> <?php echo Minz_Translate::t ('g+'); ?> </a> </li> <?php } if ($facebook) { ?> - <li class="item"> + <li class="item share"> <a target="_blank" href="https://www.facebook.com/sharer.php?u=<?php echo $link; ?>&t=<?php echo $title; ?>"> <?php echo Minz_Translate::t ('facebook'); ?> </a> </li> <?php } if ($email) { ?> - <li class="item"> + <li class="item share"> <a href="mailto:?subject=<?php echo urldecode($title); ?>&body=<?php echo $link; ?>"> <?php echo Minz_Translate::t ('by_email'); ?> </a> </li> <?php } if ($print) { ?> - <li class="item"> + <li class="item share"> <a href="#" class="print-article"> <?php echo Minz_Translate::t ('print'); ?> </a> diff --git a/app/views/index/formLogin.phtml b/app/views/index/formLogin.phtml index e4560c1a0..cc925ea59 100644 --- a/app/views/index/formLogin.phtml +++ b/app/views/index/formLogin.phtml @@ -1,34 +1,32 @@ <div class="prompt"> -<?php -if (Minz_Configuration::canLogIn()) { - ?><h1><?php echo Minz_Translate::t('login'); ?></h1><?php - switch (Minz_Configuration::authType()) { + <h1><?php echo Minz_Translate::t('login'); ?></h1><?php - 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; + switch (Minz_Configuration::authType()) { + case 'form': + ?><form id="loginForm" method="post" action="<?php echo _url('index', 'formLogin'); ?>"> + <div> + <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" /> + </div> + <div> + <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> + </div> + <div> + <button id="loginButton" type="submit" class="btn btn-important"><?php echo Minz_Translate::t('login'); ?></button> + </div> + </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 -} -?> + case 'persona': + ?><p> + <?php echo FreshRSS_Themes::icon('login'); ?> + <a class="signin" href="#"><?php echo Minz_Translate::t('login_with_persona'); ?></a> + </p><?php + break; + } ?> -<p><a href="<?php echo _url('index', 'about'); ?>"><?php echo Minz_Translate::t('about_freshrss'); ?></a></p> + <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 4545a33e4..1ff36ca8e 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -5,26 +5,21 @@ $output = Minz_Request::param ('output', 'normal'); 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') { $this->renderHelper ('view/reader_view'); } elseif ($output === 'global') { $this->renderHelper ('view/global_view'); + } elseif ($output === 'rss') { + $this->renderHelper ('view/rss_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); - } + // token has already been checked in the controller so we can show the view + $this->renderHelper ('view/rss_view'); } else { - Minz_Request::forward(array('c' => 'index', 'a' => 'formLogin'), true); + // Normally, it should not happen, but log it anyway + Minz_Log::record ('Something is wrong in ' . __FILE__ . ' line ' . __LINE__, Minz_Log::ERROR); } diff --git a/app/views/javascript/actualize.phtml b/app/views/javascript/actualize.phtml index 1f6072c29..3b12ad774 100644 --- a/app/views/javascript/actualize.phtml +++ b/app/views/javascript/actualize.phtml @@ -1,14 +1,17 @@ "use strict"; -var feeds = []; -<?php foreach ($this->feeds as $feed) { ?> -feeds.push("<?php echo Minz_Url::display (array ('c' => 'feed', 'a' => 'actualize', 'params' => array ('id' => $feed->id (), 'ajax' => '1')), 'php'); ?>"); -<?php } ?> +var feeds = [<?php + foreach ($this->feeds as $feed) { + echo "'", Minz_Url::display(array('c' => 'feed', 'a' => 'actualize', 'params' => array('id' => $feed->id(), 'ajax' => '1')), 'php'), "',\n"; + } + ?>], + feed_processed = 0, + feed_count = feeds.length; function initProgressBar(init) { if (init) { $("body").after("\<div id=\"actualizeProgress\" class=\"actualizeProgress\">\ - <?php echo Minz_Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feeds.length + "</span><br />\ - <progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feeds.length + "\"></progress>\ + <?php echo Minz_Translate::t ('refresh'); ?> <span class=\"progress\">0 / " + feed_count + "</span><br />\ + <progress id=\"actualizeProgressBar\" value=\"0\" max=\"" + feed_count + "\"></progress>\ </div>"); } else { window.location.reload(); @@ -16,27 +19,37 @@ function initProgressBar(init) { } function updateProgressBar(i) { $("#actualizeProgressBar").val(i); - $("#actualizeProgress .progress").html(i + " / " + feeds.length); + $("#actualizeProgress .progress").html(i + " / " + feed_count); } function updateFeeds() { - if (feeds.length === 0) { + if (feed_count === 0) { + openNotification("<?php echo Minz_Translate::t ('no_feed_to_refresh'); ?>", "good"); return; } initProgressBar(true); - var i = 0; - for (var f in feeds) { - $.ajax({ - type: 'POST', - url: feeds[f], - }).done(function (data) { - i++; - updateProgressBar(i); + for (var i = 0; i < 10; i++) { + updateFeed(); + } +} - if (i === feeds.length) { - initProgressBar(false); - } - }); +function updateFeed() { + var feed = feeds.pop(); + if (feed == undefined) { + return; } + $.ajax({ + type: 'POST', + url: feed, + }).complete(function (data) { + feed_processed++; + updateProgressBar(feed_processed); + + if (feed_processed === feed_count) { + initProgressBar(false); + } else { + updateFeed(); + } + }); } |
