From cd979d30e1b7f60faeb90dfdad58c67b4f3a01f5 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Sun, 14 Apr 2013 20:12:07 +0200 Subject: Ajout partage Shaarli : fix issue #34 --- app/controllers/configureController.php | 3 +++ app/models/RSSConfiguration.php | 19 +++++++++++++++++-- app/views/configure/display.phtml | 8 ++++++++ app/views/index/index.phtml | 6 ++++++ 4 files changed, 34 insertions(+), 2 deletions(-) (limited to 'app') 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 @@ + Partage +
+ +
+ +
+
+
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)) {
  • Par mail
  • + conf->urlShaarli (); + if ($shaarli) { + ?> +
  • Shaarli
  • +
    -- cgit v1.2.3