diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-01-14 22:40:25 +0100 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-01-14 22:40:25 +0100 |
commit | 7b34e204bde7addca80050f2e34eca530c9600f2 (patch) | |
tree | ba8eed1e0098ec266b1a4c6c24ca619e678181f3 | |
parent | 60db6745c0467c1e1023250db9cc8685eede7d4b (diff) | |
download | bugzilla-7b34e204bde7addca80050f2e34eca530c9600f2.tar.gz bugzilla-7b34e204bde7addca80050f2e34eca530c9600f2.tar.xz |
Bug 829709 - Do not load CSS files from all skins by default
-rw-r--r-- | Bugzilla/Template.pm | 49 | ||||
-rw-r--r-- | template/en/default/global/header.html.tmpl | 44 |
2 files changed, 21 insertions, 72 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 5d70cb73f..fae632a73 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -401,13 +401,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) = @_; @@ -424,18 +421,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}); } } @@ -452,27 +441,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")) { diff --git a/template/en/default/global/header.html.tmpl b/template/en/default/global/header.html.tmpl index 7b7739ec5..08533ef95 100644 --- a/template/en/default/global/header.html.tmpl +++ b/template/en/default/global/header.html.tmpl @@ -37,10 +37,6 @@ # atomlink: Atom link URL, May contain HTML #%] -[% IF message %] - [% PROCESS global/messages.html.tmpl %] -[% END %] - [% DEFAULT subheader = "" header_addl_info = "" @@ -111,12 +107,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 %]"> @@ -124,22 +116,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 %] @@ -311,7 +293,8 @@ [% END %] [% IF message %] -<div id="message">[% message %]</div> + [% PROCESS global/messages.html.tmpl %] + <div id="message">[% message %]</div> [% END %] [% BLOCK format_css_link %] @@ -323,26 +306,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') %] |