add ability to select CSS files in themes/

This commit is contained in:
Andrew Dolgov 2013-03-28 21:04:29 +04:00
parent 56b61583a2
commit 5d40efc9b0
9 changed files with 47 additions and 10 deletions

View 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);

View 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);

View File

@ -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">

View File

@ -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"/>

View 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',

View 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',

View File

@ -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;

View File

@ -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;

View File

@ -73,6 +73,7 @@ div.error {
div.warning img, div.notice img, div.error img {
margin-right : 4px;
float : left;
vertical-align : middle;
}