A free, self-hostable news aggregator…
Début fix bug #22 : possibilité d'ajouter des notes à des articles et les mettre ou non en public
Marien Fressinaudcaf8d18c1d88
diff --git a/app/controllers/entryController.php b/app/controllers/entryController.phpindex b772e1703..f5277fa6d 100755--- a/app/controllers/entryController.php+++ b/app/controllers/entryController.php@@ -8,7 +8,8 @@ class entryController extends ActionController {array ('error' => array ('Vous n\'avez pas le droit d\'accéder à cette page')));}-++ $this->redirect = false;$ajax = Request::param ('ajax');if ($ajax) {$this->view->_useLayout (false);@@ -16,7 +17,7 @@ class entryController extends ActionController {}public function lastAction () {$ajax = Request::param ('ajax');- if (!$ajax) {+ if (!$ajax && $this->redirect) {Request::forward (array ('c' => 'index','a' => 'index',@@ -28,17 +29,19 @@ class entryController extends ActionController {}public function readAction () {+ $this->redirect = true;+$id = Request::param ('id');$is_read = Request::param ('is_read');$get = Request::param ('get');$dateMax = Request::param ('dateMax', time ());-+if ($is_read) {$is_read = true;} else {$is_read = false;}-+$entryDAO = new EntryDAO ();if ($id == false) {if (!$get) {@@ -55,7 +58,7 @@ class entryController extends ActionController {$this->params = array ('get' => 'f_' . $get);}}-+// notif$notif = array ('type' => 'good',@@ -66,28 +69,98 @@ class entryController extends ActionController {$entryDAO->updateEntry ($id, array ('is_read' => $is_read));}}-+public function bookmarkAction () {+ $this->redirect = true;+$id = Request::param ('id');$is_fav = Request::param ('is_favorite');-+if ($is_fav) {$is_fav = true;} else {$is_fav = false;}-+$entryDAO = new EntryDAO ();if ($id != false) {$entry = $entryDAO->searchById ($id);-+if ($entry != false) {$values = array ('is_favorite' => $is_fav,);-+$entryDAO->updateEntry ($entry->id (), $values);}}}++ public function noteAction () {+ $not_found = false;+ $entryDAO = new EntryDAO ();+ $catDAO = new CategoryDAO ();++ $id = Request::param ('id');+ if ($id) {+ $entry = $entryDAO->searchById ($id);++ if ($entry) {+ $feed = $entry->feed (true);++ if (Request::isPost ()) {+ $note = htmlspecialchars (Request::param ('note', ''));+ $public = Request::param ('public', 'no');+ if ($public == 'yes') {+ $public = true;+ } else {+ $public = false;+ }++ $values = array (+ 'annotation' => $note,+ 'is_public' => $public+ );++ if ($entryDAO->updateEntry ($id, $values)) {+ $notif = array (+ 'type' => 'good',+ 'content' => 'Modifications enregistrées'+ );+ } else {+ $notif = array (+ 'type' => 'bad',+ 'content' => 'Une erreur est survenue'+ );+ }+ Session::_param ('notification', $notif);+ Request::forward (array (+ 'c' => 'entry',+ 'a' => 'note',+ 'params' => array (+ 'id' => $id+ )+ ), true);+ }+ } else {+ $not_found = true;+ }+ } else {+ $not_found = true;+ }++ if ($not_found) {+ Error::error (+ 404,+ array ('error' => array ('La page que vous cherchez n\'existe pas'))+ );+ } else {+ $this->view->entry = $entry;+ $this->view->cat_aside = $catDAO->listCategories ();+ $this->view->nb_favorites = $entryDAO->countFavorites ();+ $this->view->nb_total = $entryDAO->count ();+ $this->view->get_c = $feed->category ();+ $this->view->get_f = $feed->id ();+ }+ }}diff --git a/app/views/entry/note.phtml b/app/views/entry/note.phtmlnew file mode 100644index 000000000..fe330f9b4--- /dev/null+++ b/app/views/entry/note.phtml@@ -0,0 +1,63 @@+<?php $this->partial ('aside_flux'); ?>++<div class="post">+ <form method="post" action="<?php echo _url ('entry', 'note', 'id', $this->entry->id ()); ?>">+ <legend>Note</legend>++ <div class="form-group">+ <label class="group-name" for="note">Ajouter une 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">Article public ?</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"' : ''; ?> /> Oui+ </label>+ </div>+ </div>++ <div class="form-group form-actions">+ <div class="group-controls">+ <button type="submit" class="btn btn-important">Sauvegarder</button>+ <button type="reset" class="btn">Annuler</button>+ </div>+ </div>++ <legend>Article</legend>++ <div class="form-group">+ <label class="group-name">Titre</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">Auteur</label>+ <div class="group-controls">+ <span class="control"><?php echo $author; ?></span>+ </div>+ </div>+ <?php } ?>++ <div class="form-group">+ <label class="group-name">Date de publication</label>+ <div class="group-controls">+ <span class="control"><?php echo $this->entry->date (); ?></span>+ </div>+ </div>++ <div class="form-group">+ <label class="group-name">Article</label>+ <div class="group-controls">+ <span class="control"><?php echo $this->entry->content (); ?></span>+ </div>+ </div>+ </form>+</div>diff --git a/app/views/index/index.phtml b/app/views/index/index.phtmlindex 0db9dac5b..a7ed174c2 100644--- a/app/views/index/index.phtml+++ b/app/views/index/index.phtml@@ -26,21 +26,29 @@ if (isset ($this->entryPaginator)) {<div class="flux<?php echo !$item->isRead () ? ' not_read' : ''; ?><?php echo $item->isFavorite () ? ' favorite' : ''; ?>" id="flux_<?php echo $item->id (); ?>"><ul class="flux_header">+ <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?><li class="item manage">- <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?><?php if (!$item->isRead ()) { ?>- <a class="read" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'read', 'params' => array ('id' => $item->id (), 'is_read' => 1))); ?>"> </a><!--+ <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 1); ?>"> </a><?php } else { ?>- <a class="read" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'read', 'params' => array ('id' => $item->id (), 'is_read' => 0))); ?>"> </a><!--+ <a class="read" href="<?php echo _url ('entry', 'read', 'id', $item->id (), 'is_read', 0); ?>"> </a><?php } ?><?php if (!$item->isFavorite ()) { ?>- --><a class="bookmark" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'bookmark', 'params' => array ('id' => $item->id (), 'is_favorite' => 1))); ?>"> </a>+ <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 1); ?>"> </a><?php } else { ?>- --><a class="bookmark" href="<?php echo Url::display (array ('c' => 'entry', 'a' => 'bookmark', 'params' => array ('id' => $item->id (), 'is_favorite' => 0))); ?>"> </a>- <?php } ?>+ <a class="bookmark" href="<?php echo _url ('entry', 'bookmark', 'id', $item->id (), 'is_favorite', 0); ?>"> </a><?php } ?>++ <a class="note" href="<?php echo _url ('entry', 'note', 'id', $item->id ()); ?>">+ <?php if ($item->notes () != '') { ?>+ <i class="icon i_note"></i>+ <?php } else { ?>+ <i class="icon i_note_empty"></i>+ <?php } ?>+ </a></li>+ <?php } ?><?php $feed = $item->feed (true); ?><li class="item website"><a target="_blank" href="<?php echo $feed->website (); ?>"><img src="http://www.google.com/s2/favicons?domain=<?php echo get_domain ($feed->website ()); ?>" alt="" /><span> <?php echo $feed->name (); ?></span></a></li><li class="item title"><h1><?php echo $item->title (); ?></h1></li>@@ -62,7 +70,7 @@ if (isset ($this->entryPaginator)) {<div class="alert"><span class="alert-head">Il n'y a aucun flux à afficher.</span><?php if (Session::param ('mode', 'all') == 'not_read') { ?>- <a class="print_all" href="<?php echo Url::display (array ('a' => 'changeMode', 'params' => array ('mode' => 'all'))); ?>">Afficher tous les articles ?</a>+ <a class="print_all" href="<?php echo _url ('index', 'changeMode', 'mode', 'all'); ?>">Afficher tous les articles ?</a><?php } ?></div><?php } ?>diff --git a/public/theme/base.css b/public/theme/base.cssindex 6f9ebfb06..c59ce1187 100644--- a/public/theme/base.css+++ b/public/theme/base.css@@ -66,7 +66,7 @@ label {font-size: 14px;line-height: 25px;}-input, select {+input, select, textarea {display: inline-block;min-height: 25px;padding: 5px;@@ -83,7 +83,7 @@ input, select {width: 15px;min-height: 15px;}- input:focus {+ input:focus, select:focus, textarea:focus {color: #0062BE;border-color: #33BBFF;box-shadow: 0 2px 2px #DDDDFF inset;@@ -391,10 +391,10 @@ input, select {/* ICONES */.icon {display: inline-block;- width: 14px;- height: 14px;+ width: 16px;+ height: 16px;vertical-align: middle;- line-height: 14px;+ line-height: 16px;background: center center no-repeat;}.icon.i_refresh {@@ -403,6 +403,15 @@ input, select {.icon.i_bookmark {background-image: url("icons/starred.svg");}+ .icon.i_not_bookmark {+ background-image: url("icons/unstarred.svg");+ }+ .icon.i_read {+ background-image: url("icons/read.svg");+ }+ .icon.i_unread {+ background-image: url("icons/unread.svg");+ }.icon.i_all {background-image: url("icons/all.svg");}@@ -436,6 +445,12 @@ input, select {.icon.i_help {background-image: url("icons/help.svg");}+ .icon.i_note {+ background-image: url("icons/note.svg");+ }+ .icon.i_note_empty {+ background-image: url("icons/note_empty.svg");+ }/* STRUCTURE */.header {@@ -541,7 +556,7 @@ input, select {.categories .feeds .item .feed {display: inline-block;margin: 0;- width: 170px;+ width: 165px;line-height: 35px;font-size: 90%;vertical-align: middle;@@ -630,7 +645,11 @@ input, select {vertical-align: middle;}.flux_header .item.manage {- width: 50px;+ width: 75px;+ white-space: nowrap;+ font-size: 0px;+ vertical-align: middle;+ text-align: center;}.flux_header .item.manage .read {display: inline-block;@@ -658,6 +677,12 @@ input, select {.flux.favorite .flux_header .item.manage .bookmark {background: url("icons/starred.svg") center center no-repeat;}+ .flux_header .item.manage .note {+ display: inline-block;+ width: 25px;+ height: 25px;+ vertical-align: middle;+ }.flux_header .item.website {width: 200px;overflow: hidden;diff --git a/public/theme/icons/note.svg b/public/theme/icons/note.svgnew file mode 100644index 000000000..117b999f7--- /dev/null+++ b/public/theme/icons/note.svg@@ -0,0 +1,30 @@+<?xml version='1.0' encoding='UTF-8'?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:svg='http://www.w3.org/2000/svg' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' id='svg7384' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' version='1.1' inkscape:version='0.47 r22583' height='16' sodipodi:docname='user-available-symbolic.svg' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16'>+ <metadata id='metadata90'>+ <rdf:RDF>+ <cc:Work rdf:about=''>+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>+ <dc:title>Gnome Symbolic Icon Theme</dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <sodipodi:namedview inkscape:cy='-71.46449' inkscape:current-layer='layer9' inkscape:window-width='1310' pagecolor='#555753' showborder='false' showguides='true' inkscape:snap-nodes='false' objecttolerance='10' showgrid='false' inkscape:object-nodes='true' inkscape:pageshadow='2' inkscape:guide-bbox='true' inkscape:window-x='54' inkscape:snap-bbox='true' bordercolor='#666666' id='namedview88' inkscape:window-maximized='0' inkscape:snap-global='true' inkscape:window-y='26' gridtolerance='10' inkscape:zoom='1' inkscape:window-height='690' borderopacity='1' guidetolerance='10' inkscape:cx='83.606112' inkscape:bbox-paths='false' inkscape:snap-grids='true' inkscape:pageopacity='1' inkscape:snap-to-guides='true'>+ <inkscape:grid visible='true' spacingx='1px' type='xygrid' spacingy='1px' id='grid4866' empspacing='2' enabled='true' snapvisiblegridlinesonly='true'/>+ </sodipodi:namedview>+ <title id='title9167'>Gnome Symbolic Icon Theme</title>+ <defs id='defs7386'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline'>++ <path inkscape:connector-curvature='0' d='m 44.6875,358.0625 c -1.5235,0 -2.75,1.2265 -2.75,2.75 l 0,4.4375 c 0,1.5235 1.2265,2.75 2.75,2.75 l 6.305187,0 3.053347,3.98495 -0.07728,-4.0787 c 1.204532,-0.29284 2.09375,-1.35911 2.09375,-2.65625 l 0,-4.4375 c 0,-1.5235 -1.2265,-2.75 -2.75,-2.75 z' id='rect11261' sodipodi:nodetypes='sssscccssss' style='color:#bebebe;fill:#bebebe;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:2.4000001;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate'/>+ </g>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer10' inkscape:label='devices'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer11' inkscape:label='apps'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer12' inkscape:label='actions'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer13' inkscape:label='places'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline'/>+ <g transform='translate(-41.000198,-357)' inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline'/>+</svg>diff --git a/public/theme/icons/note_empty.svg b/public/theme/icons/note_empty.svgnew file mode 100644index 000000000..93092f4a4--- /dev/null+++ b/public/theme/icons/note_empty.svg@@ -0,0 +1,30 @@+<?xml version='1.0' encoding='UTF-8'?>+<!-- Created with Inkscape (http://www.inkscape.org/) -->++<svg xmlns:cc='http://creativecommons.org/ns#' xmlns:svg='http://www.w3.org/2000/svg' xmlns:inkscape='http://www.inkscape.org/namespaces/inkscape' id='svg7384' xmlns:sodipodi='http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd' version='1.1' inkscape:version='0.47 r22583' height='16' sodipodi:docname='user-invisible-symbolic.svg' xmlns:dc='http://purl.org/dc/elements/1.1/' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#' xmlns='http://www.w3.org/2000/svg' width='16.000198'>+ <metadata id='metadata90'>+ <rdf:RDF>+ <cc:Work rdf:about=''>+ <dc:format>image/svg+xml</dc:format>+ <dc:type rdf:resource='http://purl.org/dc/dcmitype/StillImage'/>+ <dc:title>Gnome Symbolic Icon Theme</dc:title>+ </cc:Work>+ </rdf:RDF>+ </metadata>+ <sodipodi:namedview inkscape:object-paths='true' inkscape:cy='6.91348' inkscape:current-layer='layer9' inkscape:window-width='1920' pagecolor='#555753' showborder='false' showguides='true' inkscape:snap-nodes='false' objecttolerance='10' showgrid='true' inkscape:object-nodes='true' inkscape:pageshadow='2' inkscape:guide-bbox='true' inkscape:window-x='0' inkscape:snap-bbox='true' bordercolor='#666666' id='namedview88' inkscape:window-maximized='1' inkscape:snap-global='true' inkscape:window-y='26' gridtolerance='10' inkscape:zoom='32' inkscape:window-height='1021' borderopacity='1' guidetolerance='10' inkscape:snap-bbox-midpoints='false' inkscape:cx='11.38402' inkscape:bbox-paths='false' inkscape:snap-grids='true' inkscape:pageopacity='1' inkscape:snap-to-guides='true'>+ <inkscape:grid visible='true' spacingx='1px' type='xygrid' spacingy='1px' id='grid4866' empspacing='2' enabled='true' snapvisiblegridlinesonly='true'/>+ </sodipodi:namedview>+ <title id='title9167'>Gnome Symbolic Icon Theme</title>+ <defs id='defs7386'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer9' inkscape:label='status' style='display:inline'>++ <path d='m 104.75,357.0625 c -2.0602,0 -3.75,1.6898 -3.75,3.75 l 0,4.4375 c 0,2.0602 1.6898,3.75 3.75,3.75 l 4.9375,0 3.75,2.65625 1.59375,1.125 0,-1.96875 -0.0313,-2.5 c 1.11055,-0.59715 1.96875,-1.65265 1.96875,-3.0625 l 0,-4.4375 c 0,-2.0602 -1.6898,-3.75 -3.75,-3.75 l -8.46875,0 z m 0,2 8.46875,0 c 0.9868,0 1.75,0.7632 1.75,1.75 l 0,4.4375 c 0,0.86273 -0.63508,1.54099 -1.125,1.625 L 113,367 l 0,0.84375 0,1.03125 -2.40625,-1.6875 -0.25,-0.1875 -0.3125,0 -5.28125,0 c -0.9868,0 -1.75,-0.7632 -1.75,-1.75 l 0,-4.4375 c 0,-0.9868 0.7632,-1.75 1.75,-1.75 z' id='path12148' style='font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;text-indent:0;text-align:start;text-decoration:none;line-height:normal;letter-spacing:normal;word-spacing:normal;text-transform:none;direction:ltr;block-progression:tb;writing-mode:lr-tb;text-anchor:start;color:#bebebe;fill:#bebebe;fill-opacity:1;stroke:none;stroke-width:2;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans'/>+ </g>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer10' inkscape:label='devices'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer11' inkscape:label='apps'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer12' inkscape:label='actions'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer13' inkscape:label='places'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer14' inkscape:label='mimetypes'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='layer15' inkscape:label='emblems' style='display:inline'/>+ <g transform='translate(-101,-357)' inkscape:groupmode='layer' id='g4953' inkscape:label='categories' style='display:inline'/>+</svg>