Commit ce0bbc11 authored by Frédéric Buclin's avatar Frédéric Buclin

Bug 829709: Do not load CSS files from all skins by default

r=dkl a=LpSolit
parent e0d91b4a
......@@ -419,13 +419,10 @@ sub mtime_filter {
#
# 1. YUI CSS
# 2. Standard Bugzilla stylesheet set (persistent)
# 3. Standard Bugzilla stylesheet set (selectable)
# 4. All third-party "skin" stylesheet sets (selectable)
# 5. Page-specific styles
# 6. Custom Bugzilla stylesheet set (persistent)
#
# "Selectable" skin file sets may be either preferred or alternate.
# Exactly one is preferred, determined by the "skin" user preference.
# 3. Third-party "skin" stylesheet set, per user prefs (persistent)
# 4. Page-specific styles
# 5. Custom Bugzilla stylesheet set (persistent)
sub css_files {
my ($style_urls, $yui, $yui_css) = @_;
......@@ -442,18 +439,10 @@ sub css_files {
my @css_sets = map { _css_link_set($_) } @requested_css;
my %by_type = (standard => [], alternate => {}, skin => [], custom => []);
my %by_type = (standard => [], skin => [], custom => []);
foreach my $set (@css_sets) {
foreach my $key (keys %$set) {
if ($key eq 'alternate') {
foreach my $alternate_skin (keys %{ $set->{alternate} }) {
my $files = $by_type{alternate}->{$alternate_skin} ||= [];
push(@$files, $set->{alternate}->{$alternate_skin});
}
}
else {
push(@{ $by_type{$key} }, $set->{$key});
}
push(@{ $by_type{$key} }, $set->{$key});
}
}
......@@ -470,27 +459,15 @@ sub _css_link_set {
if ($file_name !~ m{(^|/)skins/standard/}) {
return \%set;
}
my $skin_user_prefs = Bugzilla->user->settings->{skin};
my $skin = Bugzilla->user->settings->{skin}->{value};
my $cgi_path = bz_locations()->{'cgi_path'};
# If the DB is not accessible, user settings are not available.
my $all_skins = $skin_user_prefs ? $skin_user_prefs->legal_values : [];
my %skin_urls;
foreach my $option (@$all_skins) {
next if $option eq 'standard';
my $skin_file_name = $file_name;
$skin_file_name =~ s{(^|/)skins/standard/}{skins/contrib/$option/};
if (my $mtime = _mtime("$cgi_path/$skin_file_name")) {
$skin_urls{$option} = mtime_filter($skin_file_name, $mtime);
}
}
$set{alternate} = \%skin_urls;
my $skin = $skin_user_prefs->{'value'};
if ($skin ne 'standard' and defined $set{alternate}->{$skin}) {
$set{skin} = delete $set{alternate}->{$skin};
my $skin_file_name = $file_name;
$skin_file_name =~ s{(^|/)skins/standard/}{skins/contrib/$skin/};
if (my $mtime = _mtime("$cgi_path/$skin_file_name")) {
$set{skin} = mtime_filter($skin_file_name, $mtime);
}
my $custom_file_name = $file_name;
$custom_file_name =~ s{(^|/)skins/standard/}{skins/custom/};
if (my $custom_mtime = _mtime("$cgi_path/$custom_file_name")) {
......
......@@ -22,10 +22,6 @@
# atomlink: Atom link URL, May contain HTML
#%]
[% IF message %]
[% PROCESS global/messages.html.tmpl %]
[% END %]
[% DEFAULT
subheader = ""
header_addl_info = ""
......@@ -95,12 +91,8 @@
[% SET yui = yui_resolve_deps(yui, yui_deps) %]
[% SET css_sets = css_files(style_urls, yui, yui_css) %]
[%# CSS cascade, part 1: Standard Bugzilla stylesheet set (persistent).
# Always present.
#%]
[%# This allows people to switch back to the "Classic" skin if they
# are in another skin.
#%]
[%# CSS cascade, parts 1 & 2: YUI & Standard Bugzilla stylesheet set (persistent).
# Always present. %]
<link href="[% 'skins/standard/global.css' FILTER mtime FILTER html %]"
rel="alternate stylesheet"
title="[% setting_descs.standard FILTER html %]">
......@@ -108,22 +100,12 @@
[% PROCESS format_css_link css_set_name = 'standard' %]
[% END %]
[%# CSS cascade, part 2 & 3: Third-party stylesheet set (selected and
# selectable). All third-party skins are present as alternate
# stylesheets, even if they are not currently in use.
#%]
[%# CSS cascade, part 3: Third-party stylesheet set, per user prefs. %]
[% FOREACH style_url = css_sets.skin %]
[% PROCESS format_css_link css_set_name = user.settings.skin.value %]
[% END %]
[% FOREACH alternate_skin = css_sets.alternate.keys %]
[% FOREACH style_url = css_sets.alternate.$alternate_skin %]
[% PROCESS format_css_link css_set_name = alternate_skin %]
[% END %]
[% END %]
[%# CSS cascade, part 4: page-specific styles.
#%]
[%# CSS cascade, part 4: page-specific styles. %]
[% IF style %]
<style type="text/css">
[% style %]
......@@ -296,7 +278,8 @@
[% END %]
[% IF message %]
<div id="message">[% message %]</div>
[% PROCESS global/messages.html.tmpl %]
<div id="message">[% message %]</div>
[% END %]
[% BLOCK format_css_link %]
......@@ -308,26 +291,15 @@
#%]
[% END %]
[% IF css_set_name == 'standard'
OR css_set_name == user.settings.skin.value
%]
[% SET css_rel = 'stylesheet' %]
[% SET css_set_display_name = setting_descs.${user.settings.skin.value}
|| user.settings.skin.value %]
[% ELSE %]
[% SET css_rel = 'alternate stylesheet' %]
[% SET css_set_display_name = setting_descs.$css_set_name || css_set_name %]
[% END %]
[% IF css_set_name == 'standard' %]
[% SET css_title_link = '' %]
[% ELSE %]
[% css_title_link = BLOCK ~%]
title="[% css_set_display_name FILTER html %]"
title="[% setting_descs.${user.settings.skin.value} || user.settings.skin.value FILTER html %]"
[% END %]
[% END %]
<link href="[% style_url FILTER html %]" rel="[% css_rel FILTER none %]"
<link href="[% style_url FILTER html %]" rel="stylesheet"
type="text/css" [% css_title_link FILTER none %]>
[% '<![endif]-->' IF style_url.match('/IE-fixes\.css') %]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment