diff options
| author | 2013-04-14 20:12:07 +0200 | |
|---|---|---|
| committer | 2013-04-14 20:12:07 +0200 | |
| commit | cd979d30e1b7f60faeb90dfdad58c67b4f3a01f5 (patch) | |
| tree | 847932f4e35651c43f67d58ddaa766e04b889385 /app | |
| parent | 5768d0fc7fe7e29491b788b08096ca1435b82aeb (diff) | |
Ajout partage Shaarli : fix issue #34
Diffstat (limited to 'app')
| -rwxr-xr-x | app/controllers/configureController.php | 3 | ||||
| -rwxr-xr-x | app/models/RSSConfiguration.php | 19 | ||||
| -rw-r--r-- | app/views/configure/display.phtml | 8 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 6 |
4 files changed, 34 insertions, 2 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index 01ed4d414..428768b9b 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -132,6 +132,7 @@ class configureController extends ActionController { $openArticle = Request::param ('mark_open_article', 'no'); $openSite = Request::param ('mark_open_site', 'no'); $openPage = Request::param ('mark_open_page', 'no'); + $urlShaarli = Request::param ('shaarli', ''); $this->view->conf->_postsPerPage (intval ($nb)); $this->view->conf->_defaultView ($view); @@ -144,6 +145,7 @@ class configureController extends ActionController { 'site' => $openSite, 'page' => $openPage, )); + $this->view->conf->_urlShaarli ($urlShaarli); $values = array ( 'posts_per_page' => $this->view->conf->postsPerPage (), @@ -153,6 +155,7 @@ class configureController extends ActionController { 'old_entries' => $this->view->conf->oldEntries (), 'mail_login' => $this->view->conf->mailLogin (), 'mark_when' => $this->view->conf->markWhen (), + 'url_shaarli' => $this->view->conf->urlShaarli (), ); $confDAO = new RSSConfigurationDAO (); diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index 270ec2ce1..ca56ec3a8 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -9,6 +9,7 @@ class RSSConfiguration extends Model { private $shortcuts = array (); private $mail_login = ''; private $mark_when = array (); + private $url_shaarli = ''; public function __construct () { $confDAO = new RSSConfigurationDAO (); @@ -20,6 +21,7 @@ class RSSConfiguration extends Model { $this->_shortcuts ($confDAO->shortcuts); $this->_mailLogin ($confDAO->mail_login); $this->_markWhen ($confDAO->mark_when); + $this->_urlShaarli ($confDAO->url_shaarli); } public function postsPerPage () { @@ -55,6 +57,9 @@ class RSSConfiguration extends Model { public function markWhenPage () { return $this->mark_when['page']; } + public function urlShaarli () { + return $this->url_shaarli; + } public function _postsPerPage ($value) { if (is_int (intval ($value))) { @@ -108,11 +113,17 @@ class RSSConfiguration extends Model { $this->mark_when['site'] = $values['site']; $this->mark_when['page'] = $values['page']; } + public function _urlShaarli ($value) { + $this->url_shaarli = ''; + if (filter_var ($value, FILTER_VALIDATE_URL)) { + $this->url_shaarli = $value; + } + } } class RSSConfigurationDAO extends Model_array { - public $posts_per_page = 10; - public $default_view = 'all'; + public $posts_per_page = 20; + public $default_view = 'not_read'; public $display_posts = 'no'; public $sort_order = 'low_to_high'; public $old_entries = 3; @@ -131,6 +142,7 @@ class RSSConfigurationDAO extends Model_array { 'site' => 'yes', 'page' => 'no' ); + public $url_shaarli = ''; public function __construct () { parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php'); @@ -159,6 +171,9 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['mark_when'])) { $this->mark_when = $this->array['mark_when']; } + if (isset ($this->array['url_shaarli'])) { + $this->url_shaarli = $this->array['url_shaarli']; + } } public function update ($values) { diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 240428493..79fa4b43c 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -87,6 +87,14 @@ </div> </div> + <legend>Partage</legend> + <div class="form-group"> + <label class="group-name" for="shaarli">Votre Shaarli</label> + <div class="group-controls"> + <input type="text" id="shaarli" name="shaarli" value="<?php echo $this->conf->urlShaarli (); ?>" placeholder="Laissez vide pour désactiver"/> + </div> + </div> + <div class="form-group form-actions"> <div class="group-controls"> <button type="submit" class="btn btn-important">Valider</button> diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index cd0ff0504..6889a8b51 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -80,6 +80,12 @@ if (isset ($this->entryPaginator)) { <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 (); ?>&body=J'ai trouvé cet article intéressant, tu peux le lire à cette adresse : <?php echo urlencode($item->link ()); ?>">Par mail</a></li> + <?php + $shaarli = $this->conf->urlShaarli (); + if ($shaarli) { + ?> + <li class="item"><a target="_blank" href="<?php echo $shaarli . '?post=' . urlencode($item->link ()) . '&title=' . urlencode ($item->title ()) . '&source=bookmarklet'; ?>">Shaarli</a></li> + <?php } ?> </ul> </div> </li> |
