[Rt-commit] rt branch, 4.0/sanity-check-stylesheets, created. rt-4.0.2-58-g04378a4
Jason May
jasonmay at bestpractical.com
Thu Sep 8 12:50:00 EDT 2011
The branch, 4.0/sanity-check-stylesheets has been created
at 04378a44db8be6cdd421a6b5dfc835b6ca93ec4c (commit)
- Log -----------------------------------------------------------------
commit 04378a44db8be6cdd421a6b5dfc835b6ca93ec4c
Author: Jason May <jasonmay at bestpractical.com>
Date: Thu Sep 8 11:27:38 2011 -0400
Sanity-check stylesheets in the header template (#18271)
diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index ec9dfc9..830f4ee 100755
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -120,8 +120,32 @@ $id =~ s|index$||g
if $id ne 'index';
$id =~ s|-$||g;
+sub style_exists {
+ my $style = shift;
+
+ my @css_paths = (
+ $RT::MasonComponentRoot . '/NoAuth/css',
+ $RT::MasonLocalComponentRoot . '/NoAuth/css',
+ );
+
+ for my $css_path (@css_paths) {
+ if (-d "$css_path/$style") {
+ return 1;
+ }
+ }
+
+ return 0;
+}
+
my $style = RT->Config->Get( 'WebDefaultStylesheet', $session{'CurrentUser'} );
+unless (style_exists($style)) {
+ my $system_style = RT->Config->Get('WebDefaultStylesheet');
+ if (style_exists($system_style)) {
+ $style = $system_style;
+ }
+}
+
my @css_files;
if ( RT->Config->Get('DevelMode') ) {
@css_files = ( "$style/main.css", RT->Config->Get('CSSFiles' ) );
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list