Browse Source

Fix issue #71 : remise en place du mode endless + correction bug à l'importation OPML

Marien Fressinaud 13 years ago
parent
commit
1863153b96

+ 2 - 2
app/controllers/feedController.php

@@ -219,8 +219,8 @@ class feedController extends ActionController {
 		$entryDAO = new EntryDAO ();
 		$feedDAO = new FeedDAO ();
 
-		$categories = Request::param ('categories', array ());
-		$feeds = Request::param ('feeds', array ());
+		$categories = Request::param ('categories', array (), true);
+		$feeds = Request::param ('feeds', array (), true);
 
 		// on ajoute les catégories en masse dans une fonction à part
 		$this->addCategories ($categories);

+ 1 - 0
app/controllers/indexController.php

@@ -12,6 +12,7 @@ class indexController extends ActionController {
 			View::appendScript (Url::display ('/scripts/shortcut.js'));
 			View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'main')));
 			View::appendScript (Url::display (array ('c' => 'javascript', 'a' => 'actualize')));
+			View::appendScript (Url::display ('/scripts/endless_mode.js'));
 		}
 
 		$entryDAO = new EntryDAO ();

+ 1 - 1
app/views/helpers/pagination.phtml

@@ -8,7 +8,7 @@
 	<li class="item pager-next">
 	<?php if ($this->next != '') { ?>
 	<?php $params[$getteur] = $this->next; ?>
-	<a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t ('load_more'); ?></a>
+	<a id="load_more" href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t ('load_more'); ?></a>
 	<?php } else { ?>
 	<?php echo Translate::t ('nothing_to_load'); ?>
 	<?php } ?>

+ 5 - 3
lib/minz/Request.php

@@ -29,11 +29,13 @@ class Request {
 	public static function params () {
 		return self::$params;
 	}
-	public static function param ($key, $default = false) {
+	public static function param ($key, $default = false, $specialchars = false) {
 		if (isset (self::$params[$key])) {
 			$p = self::$params[$key];
-			if(is_array($p)) {
-				return array_map(htmlspecialchars, $p);
+			if(is_object($p) || $specialchars) {
+				return $p;
+			} elseif(is_array($p)) {
+				return array_map('htmlspecialchars', $p);
 			} else {
 				return htmlspecialchars($p);
 			}

+ 31 - 0
public/scripts/endless_mode.js

@@ -0,0 +1,31 @@
+var url_load_more = "";
+var load = false;
+
+function init_load_more() {
+	url_load_more = $("a#load_more").attr("href");
+	
+	$("#load_more").click (function () {
+		load_more_posts ();
+		
+		return false;
+	});
+}
+
+function load_more_posts () {
+	load = true;
+	$("#load_more").addClass("loading");
+	$.get (url_load_more, function (data) {
+		$("#stream .flux:last").after($("#stream .flux", data));
+		$(".pagination").html($(".pagination", data).html());
+		
+		init_load_more();
+		init_posts();
+		
+		$("#load_more").removeClass("loading");
+		load = false;
+	});
+}
+
+$(document).ready (function () {
+	init_load_more();
+});

+ 4 - 0
public/theme/freshrss.css

@@ -357,6 +357,10 @@
 			color: #333;
 			font-style: italic;
 		}
+.loading {
+	background: url("loader.gif") center center no-repeat;
+	font-size: 0;
+}
 
 /*** NOTIFICATION ***/
 .notification {

BIN
public/theme/loader.gif