]> git.wh0rd.org Git - tt-rss.git/commitdiff
experimental RTL support features (schema, version bump)
authorAndrew Dolgov <fox@madoka.spb.ru>
Mon, 20 Mar 2006 10:28:14 +0000 (11:28 +0100)
committerAndrew Dolgov <fox@madoka.spb.ru>
Mon, 20 Mar 2006 10:28:14 +0000 (11:28 +0100)
backend.php
prefs.js
schema/obsolete/upgrade-1.1.3-1.1.4-mysql.sql [new file with mode: 0644]
schema/obsolete/upgrade-1.1.3-1.1.4-pgsql.sql [new file with mode: 0644]
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/upgrade-1.1.3-1.1.4-mysql.sql [deleted file]
schema/upgrade-1.1.3-1.1.4-pgsql.sql [deleted file]
schema/upgrade-1.1.4-1.1.5-mysql.sql [new file with mode: 0644]
schema/upgrade-1.1.4-1.1.5-pgsql.sql [new file with mode: 0644]
version.php

index 14eccf944bbe4cbcc7923c0988c61fbd305d99c4..75381cef96f8a0acb8c9082fe2179505b0d9fb8c 100644 (file)
@@ -45,7 +45,7 @@
                exit;
        }
 
-       define('SCHEMA_VERSION', 6);
+       define('SCHEMA_VERSION', 7);
 
        require_once "sanity_check.php";
        require_once "config.php";
 
        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() 
 
                print "<script type=\"text/javascript\" src=\"functions.js\"></script>
                        <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">
-                       </head><body>";
+                       </head><body $rtl_tag>";
 
                if ($result) {
 
                                        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 "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">  
                        <script type=\"text/javascript\" src=\"functions.js\"></script>
                        <script type=\"text/javascript\" src=\"viewfeed.js\"></script>
 
                        if (!get_pref($link, 'COMBINED_DISPLAY_MODE')) {
                                print "<table class=\"headlinesList\" id=\"headlinesList\" 
-                                       cellspacing=\"0\" width=\"100%\">";
+                                       cellspacing=\"0\" width=\"100%\" $rtl_tag>";
                        }
 
                        $lnum = 0;
                                                print "<a href=\"javascript:view($id,$feed_id);\">" .
                                                        $line["title"];
                
-                                               if (get_pref($link, 'SHOW_CONTENT_PREVIEW')) {
-                                                               
+                                               if (get_pref($link, 'SHOW_CONTENT_PREVIEW') && !$rtl_tag) {
                                                        if ($content_preview) {
                                                                print "<span class=\"contentPreview\"> - $content_preview</span>";
                                                        }
 
                        print "<tr class='$row_class'><td>Options:</td>";
                        print "<td><input type=\"checkbox\" id=\"iedit_private\" 
-                               $checked><label for=\"iedit_private\">Hide from feed browser</label>
-                               </td></tr>";
+                               $checked><label for=\"iedit_private\">Hide from feed browser</label>";
+
+                       $rtl_content = sql_bool_to_bool(db_fetch_result($result, 0, "rtl_content"));
+
+                       if ($rtl_content) {
+                               $checked = "checked";
+                       } else {
+                               $checked = "";
+                       }
+
+                       print "<br><input type=\"checkbox\" id=\"iedit_rtl\" 
+                               $checked><label for=\"iedit_rtl\">Right-to-left content</label>";
+                       
+                       print "</td></tr>";
 
                        print "</table>";
                        print "</div>";
                        $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;
                                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"]);                    
                }
 
index 4a018345f9ae84d1f8d829f7ec9b1b4859e69c2c..1d410fd60f1b1137b38c691c9908534ee1715ba3 100644 (file)
--- 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/obsolete/upgrade-1.1.3-1.1.4-mysql.sql b/schema/obsolete/upgrade-1.1.3-1.1.4-mysql.sql
new file mode 100644 (file)
index 0000000..1018bcf
--- /dev/null
@@ -0,0 +1,20 @@
+alter table ttrss_entries add column author varchar(250);
+
+update ttrss_entries set author = '';
+
+alter table ttrss_entries change author author varchar(250) not null;
+alter table ttrss_entries alter column author set default '';
+
+create table ttrss_sessions (id varchar(250) not null primary key,
+       data text,
+       expire integer not null,
+       ip_address varchar(15) not null default '',
+       index (id),
+       index (expire)) TYPE=InnoDB;
+
+delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
+update ttrss_version set schema_version = 6;
+
diff --git a/schema/obsolete/upgrade-1.1.3-1.1.4-pgsql.sql b/schema/obsolete/upgrade-1.1.3-1.1.4-pgsql.sql
new file mode 100644 (file)
index 0000000..6c40649
--- /dev/null
@@ -0,0 +1,24 @@
+begin;
+
+alter table ttrss_entries add column author varchar(250);
+
+update ttrss_entries set author = '';
+
+alter table ttrss_entries alter column author set not null;
+alter table ttrss_entries alter column author set default '';
+
+create table ttrss_sessions (id varchar(250) unique not null primary key,
+       data text,
+       expire integer not null,
+       ip_address varchar(15) not null default '');
+
+create index ttrss_sessions_id_index on ttrss_sessions(id);
+create index ttrss_sessions_expire_index on ttrss_sessions(expire);
+
+delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
+
+update ttrss_version set schema_version = 6;
+
+commit;
index f629b75707cb3d1e2c27e28d4b6641798ae08a3f..7f96362b803406b53ff9278194c508a47acb8374 100644 (file)
@@ -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;
index 2fd548efedce5e2c50d795cf02166b91e045ca1b..7013228fb6339a7421cbacb102f7f22fe8a5baf6 100644 (file)
@@ -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.3-1.1.4-mysql.sql b/schema/upgrade-1.1.3-1.1.4-mysql.sql
deleted file mode 100644 (file)
index 1018bcf..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-alter table ttrss_entries add column author varchar(250);
-
-update ttrss_entries set author = '';
-
-alter table ttrss_entries change author author varchar(250) not null;
-alter table ttrss_entries alter column author set default '';
-
-create table ttrss_sessions (id varchar(250) not null primary key,
-       data text,
-       expire integer not null,
-       ip_address varchar(15) not null default '',
-       index (id),
-       index (expire)) TYPE=InnoDB;
-
-delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
-
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
-
-update ttrss_version set schema_version = 6;
-
diff --git a/schema/upgrade-1.1.3-1.1.4-pgsql.sql b/schema/upgrade-1.1.3-1.1.4-pgsql.sql
deleted file mode 100644 (file)
index 6c40649..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-begin;
-
-alter table ttrss_entries add column author varchar(250);
-
-update ttrss_entries set author = '';
-
-alter table ttrss_entries alter column author set not null;
-alter table ttrss_entries alter column author set default '';
-
-create table ttrss_sessions (id varchar(250) unique not null primary key,
-       data text,
-       expire integer not null,
-       ip_address varchar(15) not null default '');
-
-create index ttrss_sessions_id_index on ttrss_sessions(id);
-create index ttrss_sessions_expire_index on ttrss_sessions(expire);
-
-delete from ttrss_prefs where pref_name = 'ENABLE_SPLASH';
-
-insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id) values('OPEN_LINKS_IN_NEW_WINDOW', 1, 'true', 'Open article links in new browser window',2);
-
-update ttrss_version set schema_version = 6;
-
-commit;
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 (file)
index 0000000..2c48e03
--- /dev/null
@@ -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 (file)
index 0000000..67bb7d8
--- /dev/null
@@ -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;
index 8b8ca8fe807e6090742a8d44643cbd27fb7eda7b..237ed94d03c2c370b2ab8101f00d14bccba3bb9a 100644 (file)
@@ -1,3 +1,3 @@
 <?
-       define(VERSION, "1.1.4");
+       define(VERSION, "1.1.4.99");
 ?>