From 70f6dbb10b5354500c7979d4f090f9a8ec9d3092 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 20 Mar 2006 11:28:14 +0100 Subject: [PATCH] experimental RTL support features (schema, version bump) --- backend.php | 63 ++++++++++++++++--- prefs.js | 7 ++- .../upgrade-1.1.3-1.1.4-mysql.sql | 0 .../upgrade-1.1.3-1.1.4-pgsql.sql | 0 schema/ttrss_schema_mysql.sql | 3 +- schema/ttrss_schema_pgsql.sql | 5 +- schema/upgrade-1.1.4-1.1.5-mysql.sql | 9 +++ schema/upgrade-1.1.4-1.1.5-pgsql.sql | 12 ++++ version.php | 2 +- 9 files changed, 86 insertions(+), 15 deletions(-) rename schema/{ => obsolete}/upgrade-1.1.3-1.1.4-mysql.sql (100%) rename schema/{ => obsolete}/upgrade-1.1.3-1.1.4-pgsql.sql (100%) create mode 100644 schema/upgrade-1.1.4-1.1.5-mysql.sql create mode 100644 schema/upgrade-1.1.4-1.1.5-pgsql.sql diff --git a/backend.php b/backend.php index 14eccf94..75381cef 100644 --- a/backend.php +++ b/backend.php @@ -45,7 +45,7 @@ exit; } - define('SCHEMA_VERSION', 6); + define('SCHEMA_VERSION', 7); require_once "sanity_check.php"; require_once "config.php"; @@ -909,8 +909,23 @@ if ($op == "view") { - $id = $_GET["id"]; - $feed_id = $_GET["feed"]; + $id = db_escape_string($_GET["id"]); + $feed_id = db_escape_string($_GET["feed"]); + + $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds + WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); + + if (db_num_rows($result) == 1) { + $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); + } else { + $rtl_content = false; + } + + if ($rtl_content) { + $rtl_tag = "dir=\"RTL\""; + } else { + $rtl_tag = ""; + } $result = db_query($link, "UPDATE ttrss_user_entries SET unread = false,last_read = NOW() @@ -944,7 +959,7 @@ print " - "; + "; if ($result) { @@ -1088,6 +1103,21 @@ type=\"text/css\" href=\"tt-rss_compact.css\"/>"; } + $result = db_query($link, "SELECT rtl_content FROM ttrss_feeds + WHERE id = '$feed' AND owner_uid = " . $_SESSION["uid"]); + + if (db_num_rows($result) == 1) { + $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); + } else { + $rtl_content = false; + } + + if ($rtl_content) { + $rtl_tag = "dir=\"RTL\""; + } else { + $rtl_tag = ""; + } + print " @@ -1560,7 +1590,7 @@ if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) { print ""; + cellspacing=\"0\" width=\"100%\" $rtl_tag>"; } $lnum = 0; @@ -1641,8 +1671,7 @@ print "" . $line["title"]; - if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) { - + if (get_pref($link, 'SHOW_CONTENT_PREVIEW') && !$rtl_tag) { if ($content_preview) { print " - $content_preview"; } @@ -2035,8 +2064,20 @@ print ""; print ""; + $checked>"; + + $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content")); + + if ($rtl_content) { + $checked = "checked"; + } else { + $checked = ""; + } + + print "
"; + + print ""; print "
Options: -
"; print ""; @@ -2060,6 +2101,7 @@ $auth_pass = db_escape_string($_POST["pass"]); $parent_feed = db_escape_string($_POST["pfeed"]); $private = db_escape_string($_POST["is_pvt"]); + $rtl_content = db_escape_string($_POST["is_rtl"]); if (strtoupper($upd_intl) == "DEFAULT") $upd_intl = 0; @@ -2093,7 +2135,8 @@ purge_interval = '$purge_intl', auth_login = '$auth_login', auth_pass = '$auth_pass', - private = '$private' + private = '$private', + rtl_content = '$rtl_content' WHERE id = '$feed_id' AND owner_uid = " . $_SESSION["uid"]); } diff --git a/prefs.js b/prefs.js index 4a018345..1d410fd6 100644 --- a/prefs.js +++ b/prefs.js @@ -703,10 +703,15 @@ function feedEditSave() { var fcat = document.getElementById("iedit_fcat"); var is_pvt = document.getElementById("iedit_private"); + var is_rtl = document.getElementById("iedit_rtl"); if (is_pvt) { is_pvt = is_pvt.checked; } + + if (is_rtl) { + is_rtl = is_rtl.checked; + } var fcat_id = 0; @@ -739,7 +744,7 @@ function feedEditSave() { "&ui=" + param_escape(upd_intl) + "&pi=" + param_escape(purge_intl) + "&catid=" + param_escape(fcat_id) + "&login=" + param_escape(auth_login) + "&pfeed=" + param_escape(parent_feed_id) + "&pass=" + param_escape(auth_pass) + - "&is_pvt=" + param_escape(is_pvt); + "&is_pvt=" + param_escape(is_pvt) + "&is_rtl=" + param_escape(is_rtl); xmlhttp.open("POST", "backend.php", true); xmlhttp.onreadystatechange=feedlist_callback; diff --git a/schema/upgrade-1.1.3-1.1.4-mysql.sql b/schema/obsolete/upgrade-1.1.3-1.1.4-mysql.sql similarity index 100% rename from schema/upgrade-1.1.3-1.1.4-mysql.sql rename to schema/obsolete/upgrade-1.1.3-1.1.4-mysql.sql diff --git a/schema/upgrade-1.1.3-1.1.4-pgsql.sql b/schema/obsolete/upgrade-1.1.3-1.1.4-pgsql.sql similarity index 100% rename from schema/upgrade-1.1.3-1.1.4-pgsql.sql rename to schema/obsolete/upgrade-1.1.3-1.1.4-pgsql.sql diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql index f629b757..7f96362b 100644 --- a/schema/ttrss_schema_mysql.sql +++ b/schema/ttrss_schema_mysql.sql @@ -59,6 +59,7 @@ create table ttrss_feeds (id integer not null auto_increment primary key, auth_pass varchar(250) not null default '', parent_feed integer default null, private bool not null default false, + rtl_content bool not null default false, index(owner_uid), foreign key (owner_uid) references ttrss_users(id) ON DELETE CASCADE, index(cat_id), @@ -174,7 +175,7 @@ create table ttrss_tags (id integer primary key auto_increment, create table ttrss_version (schema_version int not null) TYPE=InnoDB; -insert into ttrss_version values (6); +insert into ttrss_version values (7); create table ttrss_prefs_types (id integer not null primary key, type_name varchar(100) not null) TYPE=InnoDB; diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql index 2fd548ef..7013228f 100644 --- a/schema/ttrss_schema_pgsql.sql +++ b/schema/ttrss_schema_pgsql.sql @@ -54,7 +54,8 @@ create table ttrss_feeds (id serial not null primary key, auth_login varchar(250) not null default '', parent_feed integer default null references ttrss_feeds(id) on delete set null, private boolean not null default false, - auth_pass varchar(250) not null default ''); + auth_pass varchar(250) not null default '', + rtl_content boolean not null default false); create index ttrss_feeds_owner_uid_index on ttrss_feeds(owner_uid); @@ -156,7 +157,7 @@ create index ttrss_tags_owner_uid_index on ttrss_tags(owner_uid); create table ttrss_version (schema_version int not null); -insert into ttrss_version values (6); +insert into ttrss_version values (7); create table ttrss_prefs_types (id integer not null primary key, type_name varchar(100) not null); diff --git a/schema/upgrade-1.1.4-1.1.5-mysql.sql b/schema/upgrade-1.1.4-1.1.5-mysql.sql new file mode 100644 index 00000000..2c48e039 --- /dev/null +++ b/schema/upgrade-1.1.4-1.1.5-mysql.sql @@ -0,0 +1,9 @@ +alter table ttrss_feeds add column rtl_content bool; + +update ttrss_feeds set rtl_content = false; + +alter table ttrss_feeds change rtl_content rtl_content bool not null; +alter table ttrss_feeds alter column rtl_content set default false; + +update ttrss_version set schema_version = 7; + diff --git a/schema/upgrade-1.1.4-1.1.5-pgsql.sql b/schema/upgrade-1.1.4-1.1.5-pgsql.sql new file mode 100644 index 00000000..67bb7d86 --- /dev/null +++ b/schema/upgrade-1.1.4-1.1.5-pgsql.sql @@ -0,0 +1,12 @@ +begin; + +alter table ttrss_feeds add column rtl_content boolean; + +update ttrss_feeds set rtl_content = false; + +alter table ttrss_feeds alter column rtl_content set not null; +alter table ttrss_feeds alter column rtl_content set default false; + +update ttrss_version set schema_version = 7; + +commit; diff --git a/version.php b/version.php index 8b8ca8fe..237ed94d 100644 --- a/version.php +++ b/version.php @@ -1,3 +1,3 @@