]> git.wh0rd.org - tt-rss.git/commitdiff
add ability to select CSS files in themes/
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 17:04:29 +0000 (21:04 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Thu, 28 Mar 2013 17:04:29 +0000 (21:04 +0400)
classes/pref/prefs.php
include/functions.php
index.php
prefs.php
schema/ttrss_schema_mysql.sql
schema/ttrss_schema_pgsql.sql
schema/versions/mysql/110.sql [new file with mode: 0644]
schema/versions/pgsql/110.sql [new file with mode: 0644]
utility.css

index ad5dff4add1e70c1b41cf2697d0a65b28763ec49..2190dc0e7b50486f2dc2a10cb3bcfabb5f599a66 100644 (file)
@@ -113,8 +113,6 @@ class Pref_Prefs extends Handler_Protected {
                        WHERE $profile_qpart AND owner_uid = ".$_SESSION["uid"]);
 
                initialize_user_prefs($this->link, $_SESSION["uid"], $_SESSION["profile"]);
-
-               print "PREFS_THEME_CHANGED";
        }
 
        function index() {
@@ -389,11 +387,7 @@ class Pref_Prefs extends Handler_Protected {
                                parameters: dojo.objectToQuery(this.getValues()),
                                onComplete: function(transport) {
                                        var msg = transport.responseText;
-                                       if (msg.match('PREFS_THEME_CHANGED')) {
-                                               window.location.reload();
-                                       } else {
-                                               notify_info(msg);
-                                       }
+                                       notify_info(msg);
                        } });
                }
                </script>";
@@ -496,6 +490,14 @@ class Pref_Prefs extends Handler_Protected {
                                print "<button dojoType=\"dijit.form.Button\"
                                        onclick=\"customizeCSS()\">" . __('Customize') . "</button>";
 
+                       } else if ($pref_name == "USER_CSS_THEME") {
+
+                               $themes = array_map("basename", glob("themes/*.css"));
+
+                               print_select($pref_name, $value, $themes,
+                                       'dojoType="dijit.form.Select"');
+
+
                        } else if ($pref_name == "DEFAULT_ARTICLE_LIMIT") {
 
                                $limits = array(15, 30, 45, 60);
index 4f8eb057400dd475a478908ea27aa04ae17bd449..a9f3b31af6833e0669b0f6b9e0414b0302fdbe18 100644 (file)
@@ -1,6 +1,6 @@
 <?php
        define('EXPECTED_CONFIG_VERSION', 26);
-       define('SCHEMA_VERSION', 109);
+       define('SCHEMA_VERSION', 110);
 
        define('LABEL_BASE_INDEX', -1024);
        define('PLUGIN_FEED_BASE_INDEX', -128);
index 7b4e64136e4987baa4aa36d4138b25cc78a798f5..7c823027351ec0747c73cdfa267233b94a87e0b5 100644 (file)
--- a/index.php
+++ b/index.php
        <?php echo stylesheet_tag("tt-rss.css"); ?>
        <?php echo stylesheet_tag("cdm.css"); ?>
 
+       <?php if ($_SESSION["uid"]) {
+               $theme = get_pref($link, "USER_CSS_THEME", $_SESSION["uid"], false);
+               if ($theme) {
+                       echo stylesheet_tag("themes/$theme");
+               }
+       }
+       ?>
+
        <?php print_user_stylesheet($link) ?>
 
        <style type="text/css">
index 0add206e43c0de29bb54353d3f4aab5ce2f20c0f..4caac2cea24e8a71c117f486f2ecab5329f8a74e 100644 (file)
--- a/prefs.php
+++ b/prefs.php
        <?php echo stylesheet_tag("tt-rss.css"); ?>
        <?php echo stylesheet_tag("prefs.css"); ?>
 
+       <?php if ($_SESSION["uid"]) {
+               $theme = get_pref($link, "USER_CSS_THEME", $_SESSION["uid"], false);
+               if ($theme) {
+                       echo stylesheet_tag("themes/$theme");
+               }
+       }
+       ?>
+
        <?php print_user_stylesheet($link) ?>
 
        <link rel="shortcut icon" type="image/png" href="images/favicon.png"/>
index bbc70a5ead423a443cff285a030c9859212a4114..4b3535861c5d3191f703263776a26dc4e46cc88a 100644 (file)
@@ -291,7 +291,7 @@ create table ttrss_tags (id integer primary key auto_increment,
 
 create table ttrss_version (schema_version int not null) ENGINE=InnoDB DEFAULT CHARSET=UTF8;
 
-insert into ttrss_version values (109);
+insert into ttrss_version values (110);
 
 create table ttrss_enclosures (id integer primary key auto_increment,
        content_url text not null,
@@ -439,6 +439,8 @@ 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('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1);
 
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_CSS_THEME', 2, '', 'Select theme', 2, 'Select one of the available CSS themes');
+
 update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
        'SORT_HEADLINES_BY_FEED_DATE',
        'VFEED_GROUP_BY_FEED',
index 004fd086ace4e15a0a1f5d59810e016745cef509..5117f2e9c0f88d9f21451368f9be14719fd4e4ec 100644 (file)
@@ -249,7 +249,7 @@ create index ttrss_tags_post_int_id_idx on ttrss_tags(post_int_id);
 
 create table ttrss_version (schema_version int not null);
 
-insert into ttrss_version values (109);
+insert into ttrss_version values (110);
 
 create table ttrss_enclosures (id serial not null primary key,
        content_url text not null,
@@ -389,6 +389,8 @@ 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('_MOBILE_REVERSE_HEADLINES', 1, 'false', '', 1);
 
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_CSS_THEME', 2, '', 'Select theme', 2, 'Select one of the available CSS themes');
+
 update ttrss_prefs set access_level = 1 where pref_name in ('ON_CATCHUP_SHOW_NEXT_FEED',
        'SORT_HEADLINES_BY_FEED_DATE',
        'VFEED_GROUP_BY_FEED',
diff --git a/schema/versions/mysql/110.sql b/schema/versions/mysql/110.sql
new file mode 100644 (file)
index 0000000..859f7d6
--- /dev/null
@@ -0,0 +1,7 @@
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_CSS_THEME', 2, '', 'Select theme', 2, 'Select one of the available CSS themes');
+
+update ttrss_version set schema_version = 110;
+
+commit;
diff --git a/schema/versions/pgsql/110.sql b/schema/versions/pgsql/110.sql
new file mode 100644 (file)
index 0000000..859f7d6
--- /dev/null
@@ -0,0 +1,7 @@
+begin;
+
+insert into ttrss_prefs (pref_name,type_id,def_value,short_desc,section_id,help_text) values('USER_CSS_THEME', 2, '', 'Select theme', 2, 'Select one of the available CSS themes');
+
+update ttrss_version set schema_version = 110;
+
+commit;
index d79a9daa6247b2c88426db968eccec1bdae76e06..dd39cb32b7574ebdcbae5fd67a3fd30cf23dc32b 100644 (file)
@@ -73,6 +73,7 @@ div.error {
 
 div.warning img, div.notice img, div.error img {
        margin-right : 4px;
+       float : left;
        vertical-align : middle;
 }