add ttrss_feeds.mark_unread_on_update, bump schema, cleanup ttrss_prefs

This commit is contained in:
Andrew Dolgov 2011-03-29 11:54:44 +04:00
parent 46a8bd444d
commit 9382ca847f
8 changed files with 79 additions and 21 deletions

View File

@ -517,7 +517,7 @@
$result = db_query($link, "SELECT id,update_interval,auth_login, $result = db_query($link, "SELECT id,update_interval,auth_login,
feed_url,auth_pass,cache_images,update_method,last_updated, feed_url,auth_pass,cache_images,update_method,last_updated,
owner_uid mark_unread_on_update, owner_uid
FROM ttrss_feeds WHERE id = '$feed'"); FROM ttrss_feeds WHERE id = '$feed'");
} }
@ -532,6 +532,7 @@
$update_method = db_fetch_result($result, 0, "update_method"); $update_method = db_fetch_result($result, 0, "update_method");
$last_updated = db_fetch_result($result, 0, "last_updated"); $last_updated = db_fetch_result($result, 0, "last_updated");
$owner_uid = db_fetch_result($result, 0, "owner_uid"); $owner_uid = db_fetch_result($result, 0, "owner_uid");
$mark_unread_on_update = db_fetch_result($result, 0, "mark_unread_on_update");
db_query($link, "UPDATE ttrss_feeds SET last_update_started = NOW() db_query($link, "UPDATE ttrss_feeds SET last_update_started = NOW()
WHERE id = '$feed'"); WHERE id = '$feed'");
@ -1237,7 +1238,7 @@
num_comments = '$num_comments' num_comments = '$num_comments'
WHERE id = '$ref_id'"); WHERE id = '$ref_id'");
if (get_pref($link, "MARK_UNREAD_ON_UPDATE", $owner_uid, false)) { if ($mark_unread_on_update) {
db_query($link, "UPDATE ttrss_user_entries db_query($link, "UPDATE ttrss_user_entries
SET last_read = null, unread = true WHERE ref_id = '$ref_id'"); SET last_read = null, unread = true WHERE ref_id = '$ref_id'");
} else { } else {

View File

@ -450,6 +450,18 @@
__('Cache images locally (SimplePie only)')."</label>"; __('Cache images locally (SimplePie only)')."</label>";
} }
$mark_unread_on_update = sql_bool_to_bool(db_fetch_result($result, 0, "mark_unread_on_update"));
if ($mark_unread_on_update) {
$checked = "checked";
} else {
$checked = "";
}
print "<hr/><input dojoType=\"dijit.form.CheckBox\" type=\"checkbox\" id=\"mark_unread_on_update\"
name=\"mark_unread_on_update\"
$checked>&nbsp;<label for=\"mark_unread_on_update\">".__('Mark updated articles as unread')."</label>";
# print "</div>"; # print "</div>";
print "</div>"; print "</div>";
@ -621,6 +633,13 @@
print "&nbsp;"; batch_edit_cbox("cache_images", "cache_images_l"); print "&nbsp;"; batch_edit_cbox("cache_images", "cache_images_l");
} }
print "<br/><input disabled=\"1\" type=\"checkbox\" id=\"mark_unread_on_update\"
name=\"mark_unread_on_update\"
dojoType=\"dijit.form.CheckBox\">&nbsp;<label id=\"mark_unread_on_update_l\" class='insensitive' for=\"mark_unread_on_update\">".__('Mark updated articles as unread')."</label>";
print "&nbsp;"; batch_edit_cbox("mark_unread_on_update", "mark_unread_on_update_l");
print "</div>"; print "</div>";
print "<div class='dlgButtons'> print "<div class='dlgButtons'>
@ -657,6 +676,9 @@
$always_display_enclosures = checkbox_to_sql_bool( $always_display_enclosures = checkbox_to_sql_bool(
db_escape_string($_POST["always_display_enclosures"])); db_escape_string($_POST["always_display_enclosures"]));
$mark_unread_on_update = checkbox_to_sql_bool(
db_escape_string($_POST["mark_unread_on_update"]));
if (get_pref($link, 'ENABLE_FEED_CATS')) { if (get_pref($link, 'ENABLE_FEED_CATS')) {
if ($cat_id && $cat_id != 0) { if ($cat_id && $cat_id != 0) {
$category_qpart = "cat_id = '$cat_id',"; $category_qpart = "cat_id = '$cat_id',";
@ -690,6 +712,7 @@
$cache_images_qpart $cache_images_qpart
include_in_digest = $include_in_digest, include_in_digest = $include_in_digest,
always_display_enclosures = $always_display_enclosures, always_display_enclosures = $always_display_enclosures,
mark_unread_on_update = $mark_unread_on_update,
update_method = '$update_method' update_method = '$update_method'
WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]);
@ -745,6 +768,10 @@
$qpart = "always_display_enclosures = '$always_display_enclosures'"; $qpart = "always_display_enclosures = '$always_display_enclosures'";
break; break;
case "mark_unread_on_update":
$qpart = "mark_unread_on_update = '$mark_unread_on_update'";
break;
case "cache_images": case "cache_images":
$qpart = "cache_images = '$cache_images'"; $qpart = "cache_images = '$cache_images'";
break; break;

View File

@ -5,17 +5,13 @@
$subop = $_REQUEST["subop"]; $subop = $_REQUEST["subop"];
$prefs_blacklist = array("HIDE_FEEDLIST", "SYNC_COUNTERS", "ENABLE_LABELS", $prefs_blacklist = array("HIDE_READ_FEEDS", "FEEDS_SORT_BY_UNREAD",
"ENABLE_SEARCH_TOOLBAR", "HIDE_READ_FEEDS", "ENABLE_FEED_ICONS", "USER_STYLESHEET_URL");
"ENABLE_OFFLINE_READING", "EXTENDED_FEEDLIST", "FEEDS_SORT_BY_UNREAD",
"OPEN_LINKS_IN_NEW_WINDOW", "USER_STYLESHEET_URL", "ENABLE_FLASH_PLAYER",
"HEADLINES_SMART_DATE");
$profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS", $profile_blacklist = array("ALLOW_DUPLICATE_POSTS", "PURGE_OLD_DAYS",
"PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP", "PURGE_UNREAD_ARTICLES", "DIGEST_ENABLE", "DIGEST_CATCHUP",
"BLACKLISTED_TAGS", "ENABLE_FEED_ICONS", "ENABLE_API_ACCESS", "BLACKLISTED_TAGS", "ENABLE_API_ACCESS", "UPDATE_POST_ON_CHECKSUM_CHANGE",
"UPDATE_POST_ON_CHECKSUM_CHANGE", "DEFAULT_UPDATE_INTERVAL", "DEFAULT_UPDATE_INTERVAL", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE",
"MARK_UNREAD_ON_UPDATE", "USER_TIMEZONE", "SORT_HEADLINES_BY_FEED_DATE",
"SSL_CERT_SERIAL"); "SSL_CERT_SERIAL");
if (FORCE_ARTICLE_PURGE != 0) { if (FORCE_ARTICLE_PURGE != 0) {

View File

@ -2,7 +2,7 @@
require_once "functions.php"; require_once "functions.php";
define('EXPECTED_CONFIG_VERSION', 21); define('EXPECTED_CONFIG_VERSION', 21);
define('SCHEMA_VERSION', 82); define('SCHEMA_VERSION', 83);
if (!file_exists("config.php")) { if (!file_exists("config.php")) {
print "<b>Fatal Error</b>: You forgot to copy print "<b>Fatal Error</b>: You forgot to copy

View File

@ -122,6 +122,8 @@ create table ttrss_feeds (id integer not null auto_increment primary key,
always_display_enclosures boolean not null default false, always_display_enclosures boolean not null default false,
update_method integer not null default 0, update_method integer not null default 0,
order_id integer not null default 0, order_id integer not null default 0,
mark_unread_on_update boolean not null default false,
strip_images boolean not null default false,
index(owner_uid), index(owner_uid),
foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE,
index(cat_id), index(cat_id),
@ -258,7 +260,7 @@ create table ttrss_tags (id integer primary key auto_increment,
create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8; create table ttrss_version (schema_version int not null) TYPE=InnoDB DEFAULT CHARSET=UTF8;
insert into ttrss_version values (82); insert into ttrss_version values (83);
create table ttrss_enclosures (id integer primary key auto_increment, create table ttrss_enclosures (id integer primary key auto_increment,
content_url text not null, content_url text not null,
@ -317,8 +319,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 'Short date format',3); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('SHORT_DATE_FORMAT', 2, 'M d, G:i', 'Short date format',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2, 'Display expanded list of feed articles, instead of separate displays for headlines and article content'); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2, 'Display expanded list of feed articles, instead of separate displays for headlines and article content');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
@ -327,8 +327,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('MARK_UNREAD_ON_UPDATE', 1, 'false', 'Set articles as unread on update',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1, 'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address'); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1, 'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');

View File

@ -85,6 +85,8 @@ create table ttrss_feeds (id serial not null primary key,
update_method integer not null default 0, update_method integer not null default 0,
always_display_enclosures boolean not null default false, always_display_enclosures boolean not null default false,
order_id integer not null default 0, order_id integer not null default 0,
mark_unread_on_update boolean not null default false,
strip_images boolean not null default false,
auth_pass_encrypted boolean not null default false); auth_pass_encrypted boolean not null default false);
create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid); create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid);
@ -229,7 +231,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
create table ttrss_version (schema_version int not null); create table ttrss_version (schema_version int not null);
insert into ttrss_version values (82); insert into ttrss_version values (83);
create table ttrss_enclosures (id serial not null primary key, create table ttrss_enclosures (id serial not null primary key,
content_url text not null, content_url text not null,
@ -281,8 +283,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) valu
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('LONG_DATE_FORMAT', 2, 'D, M d Y - G:i', 'Long date format',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HEADLINES_SMART_DATE', 1, 'true', 'Use more accessible date/time format for headlines',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2, 'Display expanded list of feed articles, instead of separate displays for headlines and article content'); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('COMBINED_DISPLAY_MODE', 1, 'false', 'Combined feed display',2, 'Display expanded list of feed articles, instead of separate displays for headlines and article content');
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('HIDE_READ_FEEDS', 1, 'false', 'Hide feeds with no unread messages',2);
@ -291,8 +291,6 @@ insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('FEEDS_SORT_BY_UNREAD', 1, 'false', 'Sort feeds by unread articles count',2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('MARK_UNREAD_ON_UPDATE', 1, 'false', 'Set articles as unread on update',3);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('REVERSE_HEADLINES', 1, 'false', 'Reverse headline order (oldest first)',2);
insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1, 'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address'); insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('DIGEST_ENABLE', 1, 'false', 'Enable e-mail digest',1, 'This option enables sending daily digest of new (and unread) headlines on your configured e-mail address');

View File

@ -0,0 +1,19 @@
begin;
alter table ttrss_feeds add column mark_unread_on_update boolean;
update ttrss_feeds set mark_unread_on_update = false;
alter table ttrss_feeds change mark_unread_on_update mark_unread_on_update boolean not null;
alter table ttrss_feeds alter column mark_unread_on_update set default false;
alter table ttrss_feeds add column strip_images boolean;
update ttrss_feeds set strip_images = false;
alter table ttrss_feeds change strip_images strip_images boolean not null;
alter table ttrss_feeds alter column strip_images set default false;
DELETE FROM ttrss_user_prefs WHERE pref_name IN ('HIDE_FEEDLIST', 'SYNC_COUNTERS', 'ENABLE_LABELS', 'ENABLE_SEARCH_TOOLBAR', 'ENABLE_FEED_ICONS', 'ENABLE_OFFLINE_READING', 'EXTENDED_FEEDLIST', 'OPEN_LINKS_IN_NEW_WINDOW', 'ENABLE_FLASH_PLAYER', 'HEADLINES_SMART_DATE', 'MARK_UNREAD_ON_UPDATE');
DELETE FROM ttrss_prefs WHERE pref_name IN ('HIDE_FEEDLIST', 'SYNC_COUNTERS', 'ENABLE_LABELS', 'ENABLE_SEARCH_TOOLBAR', 'ENABLE_FEED_ICONS', 'ENABLE_OFFLINE_READING', 'EXTENDED_FEEDLIST', 'OPEN_LINKS_IN_NEW_WINDOW', 'ENABLE_FLASH_PLAYER', 'HEADLINES_SMART_DATE', 'MARK_UNREAD_ON_UPDATE');
update ttrss_version set schema_version = 83;
commit;

View File

@ -0,0 +1,19 @@
begin;
alter table ttrss_feeds add column mark_unread_on_update boolean;
update ttrss_feeds set mark_unread_on_update = false;
alter table ttrss_feeds alter column mark_unread_on_update set not null;
alter table ttrss_feeds alter column mark_unread_on_update set default false;
alter table ttrss_feeds add column strip_images boolean;
update ttrss_feeds set strip_images = false;
alter table ttrss_feeds alter column strip_images set not null;
alter table ttrss_feeds alter column strip_images set default false;
DELETE FROM ttrss_user_prefs WHERE pref_name IN ('HIDE_FEEDLIST', 'SYNC_COUNTERS', 'ENABLE_LABELS', 'ENABLE_SEARCH_TOOLBAR', 'ENABLE_FEED_ICONS', 'ENABLE_OFFLINE_READING', 'EXTENDED_FEEDLIST', 'OPEN_LINKS_IN_NEW_WINDOW', 'ENABLE_FLASH_PLAYER', 'HEADLINES_SMART_DATE', 'MARK_UNREAD_ON_UPDATE');
DELETE FROM ttrss_prefs WHERE pref_name IN ('HIDE_FEEDLIST', 'SYNC_COUNTERS', 'ENABLE_LABELS', 'ENABLE_SEARCH_TOOLBAR', 'ENABLE_FEED_ICONS', 'ENABLE_OFFLINE_READING', 'EXTENDED_FEEDLIST', 'OPEN_LINKS_IN_NEW_WINDOW', 'ENABLE_FLASH_PLAYER', 'HEADLINES_SMART_DATE', 'MARK_UNREAD_ON_UPDATE');
update ttrss_version set schema_version = 83;
commit;