summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2013-03-28 21:04:29 +0400
committerAndrew Dolgov <[email protected]>2013-03-28 21:04:29 +0400
commit5d40efc9b00fae24ab71d38c9508285a61743a8f (patch)
tree62fd761a97dda8fbf384c5a488346fddc6966cab
parent56b61583a2eb657964b136af14389c4e3cfad110 (diff)
add ability to select CSS files in themes/
-rw-r--r--classes/pref/prefs.php16
-rw-r--r--include/functions.php2
-rw-r--r--index.php8
-rw-r--r--prefs.php8
-rw-r--r--schema/ttrss_schema_mysql.sql4
-rw-r--r--schema/ttrss_schema_pgsql.sql4
-rw-r--r--schema/versions/mysql/110.sql7
-rw-r--r--schema/versions/pgsql/110.sql7
-rw-r--r--utility.css1
9 files changed, 47 insertions, 10 deletions
diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php
index ad5dff4ad..2190dc0e7 100644
--- a/classes/pref/prefs.php
+++ b/classes/pref/prefs.php
@@ -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);
diff --git a/include/functions.php b/include/functions.php
index 4f8eb0574..a9f3b31af 100644
--- a/include/functions.php
+++ b/include/functions.php
@@ -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);
diff --git a/index.php b/index.php
index 7b4e64136..7c8230273 100644
--- a/index.php
+++ b/index.php
@@ -65,6 +65,14 @@
<?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">
diff --git a/prefs.php b/prefs.php
index 0add206e4..4caac2cea 100644
--- a/prefs.php
+++ b/prefs.php
@@ -39,6 +39,14 @@
<?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"/>
diff --git a/schema/ttrss_schema_mysql.sql b/schema/ttrss_schema_mysql.sql
index bbc70a5ea..4b3535861 100644
--- a/schema/ttrss_schema_mysql.sql
+++ b/schema/ttrss_schema_mysql.sql
@@ -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',
diff --git a/schema/ttrss_schema_pgsql.sql b/schema/ttrss_schema_pgsql.sql
index 004fd086a..5117f2e9c 100644
--- a/schema/ttrss_schema_pgsql.sql
+++ b/schema/ttrss_schema_pgsql.sql
@@ -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
index 000000000..859f7d6dc
--- /dev/null
+++ b/schema/versions/mysql/110.sql
@@ -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
index 000000000..859f7d6dc
--- /dev/null
+++ b/schema/versions/pgsql/110.sql
@@ -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/utility.css b/utility.css
index d79a9daa6..dd39cb32b 100644
--- a/utility.css
+++ b/utility.css
@@ -73,6 +73,7 @@ div.error {
div.warning img, div.notice img, div.error img {
margin-right : 4px;
+ float : left;
vertical-align : middle;
}