add (disabled) per-feed view_settings handling placeholder
This commit is contained in:
parent
b4f83063cc
commit
a2a3d5a3aa
|
@ -835,8 +835,20 @@ class Feeds extends Handler_Protected {
|
||||||
ccache_update($this->link, $feed, $_SESSION["uid"], $cat_view);
|
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_MODE", $view_mode);
|
||||||
set_pref($this->link, "_DEFAULT_VIEW_LIMIT", $limit);
|
|
||||||
set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
|
set_pref($this->link, "_DEFAULT_VIEW_ORDER_BY", $order_by);
|
||||||
|
|
||||||
/* bump login timestamp if needed */
|
/* bump login timestamp if needed */
|
||||||
|
|
|
@ -1138,7 +1138,7 @@
|
||||||
|
|
||||||
array_push($ret_arr, $cv);
|
array_push($ret_arr, $cv);
|
||||||
|
|
||||||
$result = db_query($link, "SELECT id AS cat_id, value AS unread,
|
$result = db_query($link, "SELECT id AS cat_id, view_settings, value AS unread,
|
||||||
(SELECT COUNT(id) FROM ttrss_feed_categories AS c2
|
(SELECT COUNT(id) FROM ttrss_feed_categories AS c2
|
||||||
WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children
|
WHERE c2.parent_cat = ttrss_feed_categories.id) AS num_children
|
||||||
FROM ttrss_feed_categories, ttrss_cat_counters_cache
|
FROM ttrss_feed_categories, ttrss_cat_counters_cache
|
||||||
|
@ -1149,6 +1149,13 @@
|
||||||
while ($line = db_fetch_assoc($result)) {
|
while ($line = db_fetch_assoc($result)) {
|
||||||
$line["cat_id"] = (int) $line["cat_id"];
|
$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) {
|
if ($line["num_children"] > 0) {
|
||||||
$child_counter = getCategoryChildrenUnread($link, $line["cat_id"], $_SESSION["uid"]);
|
$child_counter = getCategoryChildrenUnread($link, $line["cat_id"], $_SESSION["uid"]);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1156,6 +1163,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$cv = array("id" => $line["cat_id"], "kind" => "cat",
|
$cv = array("id" => $line["cat_id"], "kind" => "cat",
|
||||||
|
"vs" => $view_settings,
|
||||||
"counter" => $line["unread"] + $child_counter);
|
"counter" => $line["unread"] + $child_counter);
|
||||||
|
|
||||||
array_push($ret_arr, $cv);
|
array_push($ret_arr, $cv);
|
||||||
|
@ -1465,7 +1473,7 @@
|
||||||
|
|
||||||
$ret_arr = array();
|
$ret_arr = array();
|
||||||
|
|
||||||
$query = "SELECT ttrss_feeds.id,
|
$query = "SELECT ttrss_feeds.id, view_settings,
|
||||||
ttrss_feeds.title,
|
ttrss_feeds.title,
|
||||||
".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated,
|
".SUBSTRING_FOR_DATE."(ttrss_feeds.last_updated,1,19) AS last_updated,
|
||||||
last_error, value AS count
|
last_error, value AS count
|
||||||
|
@ -1490,8 +1498,16 @@
|
||||||
if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2)
|
if (date('Y') - date('Y', strtotime($line['last_updated'])) > 2)
|
||||||
$last_updated = '';
|
$last_updated = '';
|
||||||
|
|
||||||
|
/* if ($line["view_settings"])
|
||||||
|
$view_settings = @json_decode($line["view_settings"]);
|
||||||
|
else
|
||||||
|
$view_settings = null; */
|
||||||
|
|
||||||
|
$view_settings = null;
|
||||||
|
|
||||||
$cv = array("id" => $id,
|
$cv = array("id" => $id,
|
||||||
"updated" => $last_updated,
|
"updated" => $last_updated,
|
||||||
|
"vs" => $view_settings,
|
||||||
"counter" => (int) $count,
|
"counter" => (int) $count,
|
||||||
"has_img" => (int) $has_img);
|
"has_img" => (int) $has_img);
|
||||||
|
|
||||||
|
|
15
index.php
15
index.php
|
@ -169,7 +169,7 @@
|
||||||
<<</button>
|
<<</button>
|
||||||
|
|
||||||
<select name="view_mode" title="<?php echo __('Show articles') ?>"
|
<select name="view_mode" title="<?php echo __('Show articles') ?>"
|
||||||
onchange="viewModeChanged()"
|
onchange="viewModeChanged(event)"
|
||||||
dojoType="dijit.form.Select">
|
dojoType="dijit.form.Select">
|
||||||
<option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
|
<option selected="selected" value="adaptive"><?php echo __('Adaptive') ?></option>
|
||||||
<option value="all_articles"><?php echo __('All Articles') ?></option>
|
<option value="all_articles"><?php echo __('All Articles') ?></option>
|
||||||
|
@ -182,20 +182,15 @@
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select title="<?php echo __('Sort articles') ?>"
|
<select title="<?php echo __('Sort articles') ?>"
|
||||||
onchange="viewModeChanged()"
|
onchange="viewModeChanged(event)"
|
||||||
dojoType="dijit.form.Select" name="order_by">
|
dojoType="dijit.form.Select" name="order_by">
|
||||||
<option selected="selected" value="default"><?php echo __('Default') ?></option>
|
<option selected="selected" value="default"><?php echo __('Default') ?></option>
|
||||||
<option value="feed_dates"><?php echo __('Newest first') ?></option>
|
<option value="feed_dates"><?php echo __('Newest first') ?></option>
|
||||||
<option value="date_reverse"><?php echo __('Oldest first') ?></option>
|
<option value="date_reverse"><?php echo __('Oldest first') ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- deprecated -->
|
|
||||||
<button dojoType="dijit.form.Button" name="update" style="display : none"
|
|
||||||
onclick="viewCurrentFeed()">
|
|
||||||
<?php echo __('Update') ?></button>
|
|
||||||
|
|
||||||
<select title="<?php echo __('Mark feed as read') ?>"
|
<select title="<?php echo __('Mark feed as read') ?>"
|
||||||
onchange="catchupCurrentFeed(this)"
|
onchange="catchupCurrentFeed(event)"
|
||||||
dojoType="dijit.form.Select" name="catchup_feed">
|
dojoType="dijit.form.Select" name="catchup_feed">
|
||||||
<option selected="selected" value="default"><?php echo __('Mark as read') ?></option>
|
<option selected="selected" value="default"><?php echo __('Mark as read') ?></option>
|
||||||
<option value="all"><?php echo __('All articles') ?></option>
|
<option value="all"><?php echo __('All articles') ?></option>
|
||||||
|
@ -204,6 +199,10 @@
|
||||||
<option value="2weeks"><?php echo __('Older than two weeks') ?></option>
|
<option value="2weeks"><?php echo __('Older than two weeks') ?></option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<button dojoType="dijit.form.Button"
|
||||||
|
onclick="viewCurrentFeed()">
|
||||||
|
<?php echo __('Refresh') ?></button>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div class="actionChooser">
|
<div class="actionChooser">
|
||||||
|
|
|
@ -2,6 +2,7 @@ var _infscroll_disable = 0;
|
||||||
var _infscroll_request_sent = 0;
|
var _infscroll_request_sent = 0;
|
||||||
var _search_query = false;
|
var _search_query = false;
|
||||||
var _viewfeed_last = 0;
|
var _viewfeed_last = 0;
|
||||||
|
var view_settings = [];
|
||||||
|
|
||||||
var counters_last_request = 0;
|
var counters_last_request = 0;
|
||||||
|
|
||||||
|
@ -92,6 +93,37 @@ function viewfeed(feed, method, is_cat, offset, background, infscroll_req) {
|
||||||
|
|
||||||
Form.enable("main_toolbar_form");
|
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 toolbar_query = Form.serialize("main_toolbar_form");
|
||||||
|
|
||||||
var query = "?op=feeds&method=view&feed=" + feed + "&" +
|
var query = "?op=feeds&method=view&feed=" + feed + "&" +
|
||||||
|
@ -214,6 +246,12 @@ function parse_counters(elems, scheduled_call) {
|
||||||
var error = elems[l].error;
|
var error = elems[l].error;
|
||||||
var has_img = elems[l].has_img;
|
var has_img = elems[l].has_img;
|
||||||
var updated = elems[l].updated;
|
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") {
|
if (id == "global-unread") {
|
||||||
global_unread = ctr;
|
global_unread = ctr;
|
||||||
|
|
|
@ -752,10 +752,6 @@ function viewModeChanged() {
|
||||||
return viewCurrentFeed('');
|
return viewCurrentFeed('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function viewLimitChanged() {
|
|
||||||
return viewCurrentFeed('');
|
|
||||||
}
|
|
||||||
|
|
||||||
function rescoreCurrentFeed() {
|
function rescoreCurrentFeed() {
|
||||||
|
|
||||||
var actid = getActiveFeedId();
|
var actid = getActiveFeedId();
|
||||||
|
|
|
@ -52,9 +52,9 @@ function headlines_callback2(transport, offset, background, infscroll_req) {
|
||||||
|
|
||||||
setActiveFeedId(feed_id, is_cat);
|
setActiveFeedId(feed_id, is_cat);
|
||||||
|
|
||||||
dijit.getEnclosingWidget(
|
/* dijit.getEnclosingWidget(
|
||||||
document.forms["main_toolbar_form"].update).attr('disabled',
|
document.forms["main_toolbar_form"].update).attr('disabled',
|
||||||
is_cat || feed_id <= 0);
|
is_cat || feed_id <= 0); */
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (infscroll_req == false) {
|
if (infscroll_req == false) {
|
||||||
|
|
Loading…
Reference in New Issue