From 417591034a3e02d160abd226033b0781749f285b Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <fox@madoka.volgo-balt.ru>
Date: Mon, 1 Apr 2013 13:02:25 +0400
Subject: [PATCH] remove experimental view_settings stuff from master

---
 classes/feeds.php     | 13 -------------
 include/functions.php | 20 ++------------------
 index.php             |  4 ++--
 js/feedlist.js        | 38 --------------------------------------
 4 files changed, 4 insertions(+), 71 deletions(-)

diff --git a/classes/feeds.php b/classes/feeds.php
index d2df94108..ff6b864e5 100644
--- a/classes/feeds.php
+++ b/classes/feeds.php
@@ -835,19 +835,6 @@ class Feeds extends Handler_Protected {
 			ccache_update($this->link, $feed, $_SESSION["uid"], $cat_view);
 		}
 
-/*		if (is_numeric($feed) && $feed > 0) {
-			$view_settings = db_escape_string($this->link, json_encode(array(
-				"view_mode" => $view_mode, "order_by" => $order_by)));
-
-			$table = $cat_view ? "ttrss_feed_categories" : "ttrss_feeds";
-
-			db_query($this->link, "UPDATE $table SET view_settings = '$view_settings'
-				WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]);
-		} else {
-			set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
-			set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
-		} */
-
 		set_pref($this->link, "_DEFAULT_VIEW_MODE", $view_mode);
 		set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
 
diff --git a/include/functions.php b/include/functions.php
index 1c1b73a37..3bb158c05 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -1138,7 +1138,7 @@
 
 		array_push($ret_arr, $cv);
 
-		$result = db_query($link, "SELECT id AS cat_id, view_settings, value AS unread,
+		$result = db_query($link, "SELECT id AS cat_id, value AS unread,
 			(SELECT COUNT(id) FROM ttrss_feed_categories AS c2
 				WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children
 			FROM ttrss_feed_categories, ttrss_cat_counters_cache
@@ -1149,13 +1149,6 @@
 		while ($line = db_fetch_assoc($result)) {
 			$line["cat_id"] = (int) $line["cat_id"];
 
-			/* if ($line["view_settings"])
-				$view_settings = @json_decode($line["view_settings"]);
-			else
-				$view_settings = null; */
-
-			$view_settings = null;
-
 			if ($line["num_children"] > 0) {
 				$child_counter = getCategoryChildrenUnread($link, $line["cat_id"], $_SESSION["uid"]);
 			} else {
@@ -1163,7 +1156,6 @@
 			}
 
 			$cv = array("id" => $line["cat_id"], "kind" => "cat",
-				"vs" => $view_settings,
 				"counter" => $line["unread"] + $child_counter);
 
 			array_push($ret_arr, $cv);
@@ -1473,7 +1465,7 @@
 
 		$ret_arr = array();
 
-		$query = "SELECT ttrss_feeds.id, view_settings,
+		$query = "SELECT ttrss_feeds.id,
 				ttrss_feeds.title,
 				".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated,
 				last_error, value AS count
@@ -1498,16 +1490,8 @@
 			if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2)
 				$last_updated = '';
 
-			/* if ($line["view_settings"])
-				$view_settings = @json_decode($line["view_settings"]);
-			else
-				$view_settings = null; */
-
-			$view_settings = null;
-
 			$cv = array("id" => $id,
 				"updated" => $last_updated,
-				"vs" => $view_settings,
 				"counter" => (int) $count,
 				"has_img" => (int) $has_img);
 
diff --git a/index.php b/index.php
index 6753ed59d..0b8a957bb 100644
--- a/index.php
+++ b/index.php
@@ -169,7 +169,7 @@
 			&lt;&lt;</button>
 
 		<select name="view_mode" title="<?php echo __('Show articles') ?>"
-			onchange="viewModeChanged(event)"
+			onchange="viewModeChanged()"
 			dojoType="dijit.form.Select">
 			<option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
 			<option value="all_articles"><?php echo __('All Articles') ?></option>
@@ -182,7 +182,7 @@
 		</select>
 
 		<select title="<?php echo __('Sort articles') ?>"
-			onchange="viewModeChanged(event)"
+			onchange="viewModeChanged()"
 			dojoType="dijit.form.Select" name="order_by">
 			<option selected="selected" value="default"><?php echo __('Default') ?></option>
 			<option value="feed_dates"><?php echo __('Newest first') ?></option>
diff --git a/js/feedlist.js b/js/feedlist.js
index bde96c4db..9d643142b 100644
--- a/js/feedlist.js
+++ b/js/feedlist.js
@@ -2,7 +2,6 @@ var _infscroll_disable = 0;
 var _infscroll_request_sent = 0;
 var _search_query = false;
 var _viewfeed_last = 0;
-var view_settings = [];
 
 var counters_last_request = 0;
 
@@ -93,37 +92,6 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
 
 		Form.enable("main_toolbar_form");
 
-		/* var toolbar = document.forms["main_toolbar_form"];
-		var ft = is_cat ? 'C' : 'F';
-
-		_viewmode_disabled = Math.round(new Date().getTime());
-
-		if (feed != getActiveFeedId() || is_cat != activeFeedIsCat()) {
-			var vs = view_settings[ft + ':' + feed];
-			if (vs) {
-				dijit.getEnclosingWidget(toolbar.view_mode).attr('value',
-					vs.view_mode);
-
-				dijit.getEnclosingWidget(toolbar.order_by).attr('value',
-					vs.order_by);
-			} else {
-				dijit.getEnclosingWidget(toolbar.view_mode).attr('value',
-					getInitParam("default_view_mode"));
-
-				dijit.getEnclosingWidget(toolbar.order_by).attr('value',
-					getInitParam("default_view_order_by"));
-			}
-
-		} else if (parseInt(feed) > 0) {
-			var ft = is_cat ? 'C' : 'F';
-
-			var view_mode = dijit.getEnclosingWidget(toolbar.view_mode).attr('value');
-			var order_by = dijit.getEnclosingWidget(toolbar.order_by).attr('value');
-
-			view_settings[ft + ':' + feed] = {'view_mode': view_mode,
-				'order_by': order_by};
-		} */
-
 		var toolbar_query = Form.serialize("main_toolbar_form");
 
 		var query = "?op=feeds&method=view&feed=" + feed + "&" +
@@ -246,12 +214,6 @@ function parse_counters(elems, scheduled_call) {
 			var error = elems[l].error;
 			var has_img = elems[l].has_img;
 			var updated = elems[l].updated;
-			var vs = elems[l].vs;
-
-			if (vs) {
-				var ft = (kind == "cat") ? "C" : "F";
-				view_settings[ft + ":" + id] = vs;
-			}
 
 			if (id == "global-unread") {
 				global_unread = ctr;
-- 
GitLab