Parcourir la source

Déplacement de config Shaarli

Page dédiée pour les options de partage
Voir #175
Marien Fressinaud il y a 12 ans
Parent
commit
38b4ba034f

+ 30 - 3
app/controllers/configureController.php

@@ -171,7 +171,6 @@ class configureController extends ActionController {
 			$openArticle = Request::param ('mark_open_article', 'no');
 			$openSite = Request::param ('mark_open_site', 'no');
 			$scroll = Request::param ('mark_scroll', 'no');
-			$urlShaarli = Request::param ('shaarli', '');
 			$theme = Request::param ('theme', 'default');
 			$topline_read = Request::param ('topline_read', 'no');
 			$topline_favorite = Request::param ('topline_favorite', 'no');
@@ -202,7 +201,6 @@ class configureController extends ActionController {
 				'site' => $openSite,
 				'scroll' => $scroll,
 			));
-			$this->view->conf->_urlShaarli ($urlShaarli);
 			$this->view->conf->_theme ($theme);
 			$this->view->conf->_topline_read ($topline_read);
 			$this->view->conf->_topline_favorite ($topline_favorite);
@@ -230,7 +228,6 @@ class configureController extends ActionController {
 				'anon_access' => $this->view->conf->anonAccess (),
 				'token' => $this->view->conf->token (),
 				'mark_when' => $this->view->conf->markWhen (),
-				'url_shaarli' => $this->view->conf->urlShaarli (),
 				'theme' => $this->view->conf->theme (),
 				'topline_read' => $this->view->conf->toplineRead () ? 'yes' : 'no',
 				'topline_favorite' => $this->view->conf->toplineFavorite () ? 'yes' : 'no',
@@ -270,6 +267,36 @@ class configureController extends ActionController {
 		$this->view->nb_total = $entryDAO->count ();
 	}
 
+	public function sharingAction () {
+		if (Request::isPost ()) {
+			$urlShaarli = Request::param ('shaarli', '');
+
+			$this->view->conf->_urlShaarli ($urlShaarli);
+
+			$values = array (
+				'url_shaarli' => $this->view->conf->urlShaarli ()
+			);
+
+			$confDAO = new RSSConfigurationDAO ();
+			$confDAO->update ($values);
+			Session::_param ('conf', $this->view->conf);
+
+			// notif
+			$notif = array (
+				'type' => 'good',
+				'content' => Translate::t ('configuration_updated')
+			);
+			Session::_param ('notification', $notif);
+
+			Request::forward (array ('c' => 'configure', 'a' => 'sharing'), true);
+		}
+
+		View::prependTitle (Translate::t ('sharing_management') . ' - ');
+
+		$entryDAO = new EntryDAO ();
+		$this->view->nb_total = $entryDAO->count ();
+	}
+
 	public function importExportAction () {
 		$catDAO = new CategoryDAO ();
 		$this->view->categories = $catDAO->listCategories ();

+ 5 - 2
app/layout/aside_configure.phtml

@@ -2,9 +2,12 @@
 	<li class="nav-header"><?php echo Translate::t ('configuration'); ?></li>
 
 	<li class="item<?php echo Request::actionName () == 'display' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'display')); ?>"><?php echo Translate::t ('general_and_reading'); ?></a>
+		<a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Translate::t ('general_and_reading'); ?></a>
+	</li>
+	<li class="item<?php echo Request::actionName () == 'sharing' ? ' active' : ''; ?>">
+		<a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Translate::t ('sharing'); ?></a>
 	</li>
 	<li class="item<?php echo Request::actionName () == 'shortcut' ? ' active' : ''; ?>">
-		<a href="<?php echo Url::display (array ('c' => 'configure', 'a' => 'shortcut')); ?>"><?php echo Translate::t ('shortcuts'); ?></a>
+		<a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Translate::t ('shortcuts'); ?></a>
 	</li>
 </div>

+ 1 - 0
app/layout/header.phtml

@@ -58,6 +58,7 @@
 				<li class="dropdown-close"><a href="#close">❌</a></li>
 				<li class="dropdown-header"><?php echo Translate::t ('configuration'); ?></li>
 				<li class="item"><a href="<?php echo _url ('configure', 'display'); ?>"><?php echo Translate::t ('general_and_reading'); ?></a></li>
+				<li class="item"><a href="<?php echo _url ('configure', 'sharing'); ?>"><?php echo Translate::t ('sharing'); ?></a></li>
 				<li class="item"><a href="<?php echo _url ('configure', 'shortcut'); ?>"><?php echo Translate::t ('shortcuts'); ?></a></li>
 				<li class="separator"></li>
 				<li class="item"><a href="<?php echo _url ('index', 'about'); ?>"><?php echo Translate::t ('about'); ?></a></li>

+ 0 - 8
app/views/configure/display.phtml

@@ -192,14 +192,6 @@
 			</table>
 		</div>
 
-		<legend><?php echo Translate::t ('sharing'); ?></legend>
-		<div class="form-group">
-			<label class="group-name" for="shaarli"><?php echo Translate::t ('your_shaarli'); ?></label>
-			<div class="group-controls">
-				<input type="url" id="shaarli" name="shaarli" value="<?php echo $this->conf->urlShaarli (); ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>" size="64" />
-			</div>
-		</div>
-
 		<legend><?php echo Translate::t ('advanced'); ?></legend>
 		<div class="form-group">
 			<label class="group-name"></label>

+ 22 - 0
app/views/configure/sharing.phtml

@@ -0,0 +1,22 @@
+<?php $this->partial ('aside_configure'); ?>
+
+<div class="post">
+	<a href="<?php echo _url ('index', 'index'); ?>"><?php echo Translate::t ('back_to_rss_feeds'); ?></a>
+
+	<form method="post" action="<?php echo _url ('configure', 'sharing'); ?>">
+		<legend><?php echo Translate::t ('sharing'); ?></legend>
+		<div class="form-group">
+			<label class="group-name" for="shaarli"><?php echo Translate::t ('your_shaarli'); ?></label>
+			<div class="group-controls">
+				<input type="url" id="shaarli" name="shaarli" value="<?php echo $this->conf->urlShaarli (); ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>" size="64" />
+			</div>
+		</div>
+
+		<div class="form-group form-actions">
+			<div class="group-controls">
+				<button type="submit" class="btn btn-important"><?php echo Translate::t ('save'); ?></button>
+				<button type="reset" class="btn"><?php echo Translate::t ('cancel'); ?></button>
+			</div>
+		</div>
+	</form>
+</div>