Fix issue #70 : lorsqu'on rencontre un problème avec un flux, on l'indique à l'utilisateur (couleur rouge)

This commit is contained in:
Marien Fressinaud committed 2013-05-12 19:21:39 +02:00
1 parent bf45520724
commit 9e219cbf50
9 files changed
+49 -4

No files matched your search

+1 -2
View File
@@ -159,8 +159,7 @@ class feedController extends ActionController {
$feedDAO->updateLastUpdate ($feed->id ());
} catch (FeedException $e) {
Log::record ($e->getMessage (), Log::ERROR);
// TODO si on a une erreur ici, il faut mettre
// le flux à jour en BDD (error = 1) (issue #70)
$feedDAO->isInError ($feed->id ());
}
// On arrête à 10 flux pour ne pas surcharger le serveur
+1
View File
@@ -114,6 +114,7 @@ return array (
'or' => 'or',
'informations' => 'Informations',
'feed_in_error' => 'This feed has encountered a problem. Please verify that it is always reachable.',
'website_url' => 'Website URL',
'feed_url' => 'Feed URL',
'number_articles' => 'Number of articles',
+1
View File
@@ -114,6 +114,7 @@ return array (
'or' => 'ou',
'informations' => 'Informations',
'feed_in_error' => 'Ce flux a rencontré un problème. Veuillez vérifier qu\'il est toujours accessible.',
'website_url' => 'URL du site',
'feed_url' => 'URL du flux',
'number_articles' => 'Nombre d\'articles',
+1 -1
View File
@@ -43,7 +43,7 @@
<?php if (!empty ($this->feeds)) { ?>
<?php foreach ($this->feeds as $feed) { ?>
<li class="item<?php echo ($this->flux && $this->flux->id () == $feed->id ()) ? ' active' : ''; ?>">
<li class="item<?php echo ($this->flux && $this->flux->id () == $feed->id ()) ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?>">
<a href="<?php echo _url ('configure', 'feed', 'id', $feed->id ()); ?>">
<img class="favicon" src="<?php echo $feed->favicon (); ?>" alt="" />
<?php echo $feed->name (); ?>
+1 -1
View File
@@ -62,7 +62,7 @@
<ul class="feeds<?php echo $c_active ? ' active' : ''; ?>">
<?php foreach ($feeds as $feed) { ?>
<?php $f_active = false; if ($this->get_f == $feed->id ()) { $f_active = true; } ?>
<li class="item<?php echo $f_active ? ' active' : ''; ?>">
<li class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError () ? ' error' : ''; ?>">
<div class="dropdown">
<div id="dropdown-<?php echo $feed->id(); ?>" class="dropdown-target"></div>
<a class="dropdown-toggle" href="#dropdown-<?php echo $feed->id(); ?>"><i class="icon i_configure"></i></a>
+30
View File
@@ -12,6 +12,7 @@ class Feed extends Model {
private $priority = 10;
private $pathEntries = '';
private $httpAuth = '';
private $error = false;
public function __construct ($url) {
$this->_url ($url);
@@ -69,6 +70,9 @@ class Feed extends Model {
);
}
}
public function inError () {
return $this->error;
}
public function nbEntries () {
$feedDAO = new FeedDAO ();
return $feedDAO->countEntries ($this->id ());
@@ -138,6 +142,14 @@ class Feed extends Model {
public function _httpAuth ($value) {
$this->httpAuth = $value;
}
public function _error ($value) {
if ($value) {
$value = true;
} else {
$value = false;
}
$this->error = $value;
}
public function load () {
if (!is_null ($this->url)) {
@@ -306,6 +318,23 @@ class FeedDAO extends Model_pdo {
}
}
public function isInError ($id) {
$sql = 'UPDATE feed SET error=1 WHERE id=?';
$stm = $this->bd->prepare ($sql);
$values = array (
$id
);
if ($stm && $stm->execute ($values)) {
return true;
} else {
$info = $stm->errorInfo();
Log::record ('SQL error : ' . $info[2], Log::ERROR);
return false;
}
}
public function changeCategory ($idOldCat, $idNewCat) {
$catDAO = new CategoryDAO ();
$newCat = $catDAO->searchById ($idNewCat);
@@ -470,6 +499,7 @@ class HelperFeed {
$list[$key]->_priority ($dao['priority']);
$list[$key]->_pathEntries ($dao['pathEntries']);
$list[$key]->_httpAuth (base64_decode ($dao['httpAuth']));
$list[$key]->_error ($dao['error']);
if (isset ($dao['id'])) {
$list[$key]->_id ($dao['id']);
+4
View File
@@ -7,6 +7,10 @@
<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">
+3
View File
@@ -114,6 +114,9 @@
line-height: 35px;
float: right;
}
.categories .feeds .item.error .feed {
color: #BD362F;
}
.categories .feeds .item .feed {
display: inline-block;
margin: 0;
+7
View File
@@ -261,6 +261,13 @@ input, select, textarea {
.nav.nav-list a:hover {
text-decoration: none;
}
.nav.nav-list .item.error a {
color: #BD362F;
}
.nav.nav-list .item.active.error a {
color: #fff;
background: #BD362F;
}
.nav.nav-list .nav-header {
padding: 0 10px;