[Rt-commit] rt branch, custom-css, created. rt-3.8.8-675-gffad400

Chia-liang Kao clkao at bestpractical.com
Fri Sep 3 11:54:26 EDT 2010


The branch, custom-css has been created
        at  ffad400f9efb30f91085c6cbd3a3cef810a523f2 (commit)

- Log -----------------------------------------------------------------
commit fac7bab8953faaf718df860dc0f72961cea13f3b
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Tue Aug 17 20:10:55 2010 +0800

    basic dynamic css apply test.

diff --git a/share/html/Admin/Elements/SystemTabs b/share/html/Admin/Elements/SystemTabs
index cb51fb6..bbf4271 100755
--- a/share/html/Admin/Elements/SystemTabs
+++ b/share/html/Admin/Elements/SystemTabs
@@ -73,6 +73,9 @@
                 I => { title => loc('RT at a glance'),
                                 path => 'Admin/Global/MyRT.html',
                       },
+                J => { title => loc('Theme'),
+                                path => 'Admin/Global/Theme.html',
+                      },
 
 };
 
diff --git a/share/html/Admin/Elements/SystemTabs b/share/html/Admin/Global/Theme.html
old mode 100755
new mode 100644
similarity index 58%
copy from share/html/Admin/Elements/SystemTabs
copy to share/html/Admin/Global/Theme.html
index cb51fb6..7ec00aa
--- a/share/html/Admin/Elements/SystemTabs
+++ b/share/html/Admin/Global/Theme.html
@@ -45,55 +45,41 @@
 %# those contributions and any derivatives thereof.
 %# 
 %# END BPS TAGGED BLOCK }}}
-<& /Admin/Elements/Tabs, subtabs => $tabs, 
-    current_tab => 'Admin/Global/', 
-    current_subtab => $current_tab, 
-    Title => $Title &>
+<& /Admin/Elements/Header, Title => loc("Theme") &>
+<& /Admin/Elements/SystemTabs, 
+    current_tab => 'Admin/Global/Theme.html', 
+    Title => loc("Theme") &>
+<& /Elements/ListActions, actions => \@results &>
 
-<%INIT>
-  my $tabs = {
-                
-               A => { title => loc('Scrips'),
-                           path => 'Admin/Global/Scrips.html',
-                         },
-               B => { title => loc('Templates'),
-                        path => 'Admin/Global/Templates.html',
-                      },
-              
-                F => { title => loc('Custom Fields'),
-                        path => 'Admin/Global/CustomFields/index.html',
-                        },
+<style type="text/css" media="screen" id="test">
+</style>
 
-                G => { title => loc('Group Rights'),
-                                path => 'Admin/Global/GroupRights.html',
-                      },
-                H => { title => loc('User Rights'),
-                                path => 'Admin/Global/UserRights.html',
-                      },
-                I => { title => loc('RT at a glance'),
-                                path => 'Admin/Global/MyRT.html',
-                      },
 
-};
+Csutom CSS:
+<textarea rows=30 cols=60 id="user_css">
+body {background: orange}
 
-  # Now let callbacks add their extra tabs
-  $m->callback( %ARGS, tabs => $tabs );
+div#header h1 { color:black }
 
-  if ($current_tab) {
-    foreach my $tab (sort keys %{$tabs}) {
-      if ($tabs->{$tab}->{'path'} eq $current_tab) {
-        $tabs->{$tab}->{"subtabs"} = $subtabs || {};
-        $tabs->{$tab}->{"current_subtab"} = $current_subtab;
-      }
-    }
-  }
-</%INIT>
+input[type="reset"], input[type="submit"], input[class="button"] {background: green}
+
+</textarea>
+
+<input id="try" type="button" value="Try">
+
+<script type="text/javascript">
+jQuery(function($) {
+  $('#try').click(function() {
+    $("style#test").text($('#user_css').val());
+  })
 
-  
+});
+</script>
+
+<%INIT>
+my @results;
+
+</%INIT>
 <%ARGS>
-$id => undef
-$current_tab => undef
-$subtabs => undef
-$current_subtab => undef
-$Title => undef
+
 </%ARGS>

commit ba000a2946974cce957498aab0129b97bc99131f
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 18 23:51:23 2010 +0800

    primary color analyzer.

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 7ec00aa..de5604c 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -54,6 +54,21 @@
 <style type="text/css" media="screen" id="test">
 </style>
 
+Upload Logo:
+<form method="POST" enctype="multipart/form-data">
+<input type="file" name="logo-upload" />
+<input type="submit">
+</form>
+
+% if ($colors) {
+Primary colors:
+%   for (@$colors) {
+%     my $fg = $_->{l} >= 0.6 ? 'black' : 'white';
+<span style="background-color: rgb(<% $_->{c} %>); color: <% $fg %>; width: 5em">test l=<% $_->{l}%>></span>
+%   }
+% }
+
+<div class="clear">
 
 Csutom CSS:
 <textarea rows=30 cols=60 id="user_css">
@@ -79,6 +94,51 @@ jQuery(function($) {
 <%INIT>
 my @results;
 
+use Imager;
+use Graphics::Color::RGB;
+
+my $img = Imager->new;
+if (my $file_hash = _UploadedFile( 'logo-upload' )) {
+    my ($id, $msg) = $RT::System->SetAttribute( Name => "UserLogo", Description => "User-provided logo", Content => \$file_hash->{LargeContent} );
+    $img->read(data => $file_hash->{LargeContent} );
+}
+else {
+    my $attr = $RT::System->FirstAttribute('UserLogo');
+    my $content = $attr->Content;
+    $img->read(data => $$content) or die "Cannot read: ", $img->errstr;
+}
+
+my $colors = $img ? analyze_img($img) : undef;
+use List::MoreUtils qw(uniq);
+
+sub analyze_img {
+    my $img = shift;
+    my $color;
+
+    for my $i (0..$img->getwidth-1) {
+        for my $j (0..$img->getheight-1) {
+            my @color = $img->getpixel(x=>$i, y=>$j)->rgba;
+            my $hsl = Graphics::Color::RGB->new( red => $color[0] / 255, green => $color[2] / 255, blue => $color[2] / 255, alpha => $color[3] / 255 )->to_hsl;
+            my ($h,$s,$l) = $hsl->as_array;
+            pop @color;
+            my $c = join(',', at color);
+            next if $l < 0.1;
+            $color->{$c} ||= { h => $h, s => $s, l => $l, cnt => 0, c => $c};
+            $color->{$c}->{cnt}++;
+        }
+    }
+
+    for (values %$color) {
+        $_->{rank} = $_->{s} * $_->{cnt};
+    }
+    my @top5 = (sort { $b->{rank} <=> $a->{rank} } values %$color)[0..4];
+    if ((scalar uniq map {$_->{rank}} @top5) == 1) {
+        warn "bad";
+    }
+    return \@top5;
+}
+
+
 </%INIT>
 <%ARGS>
 

commit 8298628a4d8e9f0860ee99a93ee3d7b08167b78d
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 00:23:54 2010 +0800

    store content-type and helper to show user logo.

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index de5604c..05b5852 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -55,6 +55,9 @@
 </style>
 
 Upload Logo:
+% if ($img) {
+<img src="/Helpers/UserLogo?<% time() %>" />
+% }
 <form method="POST" enctype="multipart/form-data">
 <input type="file" name="logo-upload" />
 <input type="submit">
@@ -99,13 +102,22 @@ use Graphics::Color::RGB;
 
 my $img = Imager->new;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
-    my ($id, $msg) = $RT::System->SetAttribute( Name => "UserLogo", Description => "User-provided logo", Content => \$file_hash->{LargeContent} );
+    my ($id, $msg) = $RT::System->SetAttribute( Name => "UserLogo",
+                                                Description => "User-provided logo",
+                                                Content => {
+                                                    type => $file_hash->{ContentType},
+                                                    data => $file_hash->{LargeContent} } );
     $img->read(data => $file_hash->{LargeContent} );
 }
 else {
     my $attr = $RT::System->FirstAttribute('UserLogo');
     my $content = $attr->Content;
-    $img->read(data => $$content) or die "Cannot read: ", $img->errstr;
+    if (ref($content) eq 'HASH') {
+        $img->read(data => $content->{data}) or die "Cannot read: ", $img->errstr;
+    }
+    else {
+        $RT::System->DeleteAttribute('UserLogo');
+    }
 }
 
 my $colors = $img ? analyze_img($img) : undef;
diff --git a/share/html/Helpers/UserLogo b/share/html/Helpers/UserLogo
new file mode 100644
index 0000000..6cf1735
--- /dev/null
+++ b/share/html/Helpers/UserLogo
@@ -0,0 +1,11 @@
+<%INIT>
+RT::Interface::Web::StaticFileHeaders();
+if ( my $attr = $RT::System->FirstAttribute('UserLogo') ) {
+    my $content = $attr->Content;
+    $r->content_type($content->{type}) ;
+    $m->out( $content->{data} );
+    $m->abort;
+}
+
+
+</%INIT>

commit 5913433a78d2159b3c012da29a5d8994f35f3850
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:07:30 2010 +0800

    more style application and save

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 05b5852..ad4a4c6 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -67,29 +67,61 @@ Upload Logo:
 Primary colors:
 %   for (@$colors) {
 %     my $fg = $_->{l} >= 0.6 ? 'black' : 'white';
-<span style="background-color: rgb(<% $_->{c} %>); color: <% $fg %>; width: 5em">test l=<% $_->{l}%>></span>
+<span class="color-template" style="background-color: rgb(<% $_->{c} %>); color: <% $fg %>; width: 5em">test l=<% $_->{l}%>></span>
 %   }
 % }
-
+<div class="clear">
+<span class="color-template" style="background-color: white; color: black; width: 5em">test</span>
+<span class="color-template" style="background-color: white; color: gray; width: 5em">test</span>
+<span class="color-template" style="background-color: red; color: white; width: 5em">test</span>
+</div>
 <div class="clear">
 
-Csutom CSS:
-<textarea rows=30 cols=60 id="user_css">
-body {background: orange}
-
-div#header h1 { color:black }
+Csutom CSS (Advanced):<br />
 
-input[type="reset"], input[type="submit"], input[class="button"] {background: green}
+<form method="POST">
 
-</textarea>
+<textarea rows=30 cols=60 id="user_css" name="user_css"><% $user_css %></textarea>
 
 <input id="try" type="button" value="Try">
+<input name="reset_css" value="Reset CSS" type="submit">
+<input value="Save" type="submit">
+</form>
 
 <script type="text/javascript">
+
+var section = 'main';
+
+var section_css_mapping = {
+    main: ['body',
+           'div#body',
+           'div#quickbar',
+           'input[type="reset"], input[type="submit"], input[class="button"]']
+};
+
 jQuery(function($) {
-  $('#try').click(function() {
     $("style#test").text($('#user_css').val());
-  })
+    $('#try').click(function() {
+        $("style#test").text($('#user_css').val());
+    });
+
+
+    $('span.color-template').click(function() {
+      var bg = $(this).css('background-color');
+      var fg = $(this).css('color');
+      var applying = section_css_mapping[section];
+      var css = $('#user_css').val();
+      if (applying) {
+          for (var name in applying) {
+              var rule = new RegExp('\\b'+applying[name]+'\\s*{.*?}');
+              css = css.replace(rule, applying[name]+' { background: '+bg+'; color: '+fg+ '} ');
+          }
+      }
+      $('#user_css').val(css);
+      $("style#test").text(css);
+
+  });
+
 
 });
 </script>
@@ -120,6 +152,33 @@ else {
     }
 }
 
+if ($user_css) {
+    if ($ARGS{'reset_css'}) {
+        $RT::System->DeleteAttribute('UserCSS');
+        undef $user_css;
+    }
+    else {
+        my ($id, $msg) = $RT::System->SetAttribute( Name => "UserCSS",
+                                                    Description => "User-provided css",
+                                                    Content => $user_css );
+    }
+}
+
+if (!$user_css) {
+    my $attr = $RT::System->FirstAttribute('UserCSS');
+    $user_css = $attr ? $attr->Content : 'body {}
+
+div#body {}
+
+div#header h1 { }
+
+div#quickbar {}
+
+input[type="reset"], input[type="submit"], input[class="button"] {}
+';
+
+}
+
 my $colors = $img ? analyze_img($img) : undef;
 use List::MoreUtils qw(uniq);
 
@@ -153,5 +212,5 @@ sub analyze_img {
 
 </%INIT>
 <%ARGS>
-
+$user_css => ''
 </%ARGS>
diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index 9a9f132..ed1b95f 100755
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -75,6 +75,12 @@
 % if ($m->comp_exists($stylesheet_plugin) ) {
 <& $stylesheet_plugin &>
 % }
+% if (my $attr = $RT::System->FirstAttribute('UserCSS')) {
+<style type="text/css" media="screen">
+<% $attr->Content %>
+</style>
+% }
+
 % $m->callback( %ARGS, CallbackName => 'Head' );
 
 </head>

commit 78850128f7b26807b41efdab8972304e7e8587dd
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:14:06 2010 +0800

    sections

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index ad4a4c6..42cf870 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -63,6 +63,12 @@ Upload Logo:
 <input type="submit">
 </form>
 
+<div class="pick-section">
+<select id="section">
+</select>
+</div>
+
+<div class="pick-color">
 % if ($colors) {
 Primary colors:
 %   for (@$colors) {
@@ -75,6 +81,8 @@ Primary colors:
 <span class="color-template" style="background-color: white; color: gray; width: 5em">test</span>
 <span class="color-template" style="background-color: red; color: white; width: 5em">test</span>
 </div>
+</div>
+
 <div class="clear">
 
 Csutom CSS (Advanced):<br />
@@ -90,16 +98,19 @@ Csutom CSS (Advanced):<br />
 
 <script type="text/javascript">
 
-var section = 'main';
-
 var section_css_mapping = {
-    main: ['body',
-           'div#body',
-           'div#quickbar',
-           'input[type="reset"], input[type="submit"], input[class="button"]']
+    default: ['body',
+              'input[type="reset"], input[type="submit"], input[class="button"]'],
+    quickbar: ['div#quickbar'],
+    mainbody: ['div#body']
 };
 
 jQuery(function($) {
+
+    for (var section in section_css_mapping) {
+        $('select#section').append($("<option/>").attr('value', section).text(section));
+    }
+
     $("style#test").text($('#user_css').val());
     $('#try').click(function() {
         $("style#test").text($('#user_css').val());
@@ -109,6 +120,8 @@ jQuery(function($) {
     $('span.color-template').click(function() {
       var bg = $(this).css('background-color');
       var fg = $(this).css('color');
+      var section = $('select#section').val();
+
       var applying = section_css_mapping[section];
       var css = $('#user_css').val();
       if (applying) {

commit 89880ec13d14bd44d6b5528ced3f529accbd2a8b
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:21:52 2010 +0800

    some usage description

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 42cf870..0263dc5 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -64,11 +64,14 @@ Upload Logo:
 </form>
 
 <div class="pick-section">
+<span class="description">Pick a section first</span>
 <select id="section">
 </select>
 </div>
 
 <div class="pick-color">
+<span class="description">Then click on the following color to apply</span>
+<div class="clear">
 % if ($colors) {
 Primary colors:
 %   for (@$colors) {
@@ -77,6 +80,7 @@ Primary colors:
 %   }
 % }
 <div class="clear">
+Pre-defined colors:
 <span class="color-template" style="background-color: white; color: black; width: 5em">test</span>
 <span class="color-template" style="background-color: white; color: gray; width: 5em">test</span>
 <span class="color-template" style="background-color: red; color: white; width: 5em">test</span>

commit 86f07f92b765c56d67fda8463e5cd1fbbba5a363
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:21:56 2010 +0800

    don't escape css.

diff --git a/share/html/Elements/Header b/share/html/Elements/Header
index ed1b95f..02a8023 100755
--- a/share/html/Elements/Header
+++ b/share/html/Elements/Header
@@ -77,7 +77,7 @@
 % }
 % if (my $attr = $RT::System->FirstAttribute('UserCSS')) {
 <style type="text/css" media="screen">
-<% $attr->Content %>
+<% $attr->Content |n%>
 </style>
 % }
 

commit 8431e768526b040650278121a6849480836403a3
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:38:30 2010 +0800

    check userlogo attr first.

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 0263dc5..ed3165a 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -159,13 +159,14 @@ if (my $file_hash = _UploadedFile( 'logo-upload' )) {
     $img->read(data => $file_hash->{LargeContent} );
 }
 else {
-    my $attr = $RT::System->FirstAttribute('UserLogo');
-    my $content = $attr->Content;
-    if (ref($content) eq 'HASH') {
-        $img->read(data => $content->{data}) or die "Cannot read: ", $img->errstr;
-    }
-    else {
-        $RT::System->DeleteAttribute('UserLogo');
+    if (my $attr = $RT::System->FirstAttribute('UserLogo')) {
+        my $content = $attr->Content;
+        if (ref($content) eq 'HASH') {
+            $img->read(data => $content->{data}) or die "Cannot read: ", $img->errstr;
+        }
+        else {
+            $RT::System->DeleteAttribute('UserLogo');
+        }
     }
 }
 

commit fdf7f302b1360176ee1eb252630a338176197bfa
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 01:56:19 2010 +0800

    use Convert::Color instead

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index ed3165a..42b7cd5 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -147,7 +147,7 @@ jQuery(function($) {
 my @results;
 
 use Imager;
-use Graphics::Color::RGB;
+use Convert::Color;
 
 my $img = Imager->new;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
@@ -207,12 +207,11 @@ sub analyze_img {
     for my $i (0..$img->getwidth-1) {
         for my $j (0..$img->getheight-1) {
             my @color = $img->getpixel(x=>$i, y=>$j)->rgba;
-            my $hsl = Graphics::Color::RGB->new( red => $color[0] / 255, green => $color[2] / 255, blue => $color[2] / 255, alpha => $color[3] / 255 )->to_hsl;
-            my ($h,$s,$l) = $hsl->as_array;
             pop @color;
+            my $hsl = Convert::Color->new('rgb:'.join(',',map { $_ / 255 } @color))->convert_to('hsl');
             my $c = join(',', at color);
-            next if $l < 0.1;
-            $color->{$c} ||= { h => $h, s => $s, l => $l, cnt => 0, c => $c};
+            next if $hsl->lightness < 0.1;
+            $color->{$c} ||= { h => $hsl->hue, s => $hsl->saturation, l => $hsl->lightness, cnt => 0, c => $c};
             $color->{$c}->{cnt}++;
         }
     }

commit 43d81fea685c8624622a0bb495f9a0e27f590519
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 02:00:05 2010 +0800

    pesky browsers

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 42b7cd5..86a0ff3 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -103,10 +103,10 @@ Csutom CSS (Advanced):<br />
 <script type="text/javascript">
 
 var section_css_mapping = {
-    default: ['body',
+    'default': ['body',
               'input[type="reset"], input[type="submit"], input[class="button"]'],
-    quickbar: ['div#quickbar'],
-    mainbody: ['div#body']
+    'quickbar': ['div#quickbar'],
+    'mainbody': ['div#body']
 };
 
 jQuery(function($) {

commit 297201687128ab82e84bf33f5b3dee3dadc722c8
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Aug 25 02:04:24 2010 +0800

    more sections

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 86a0ff3..cf47411 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -106,7 +106,9 @@ var section_css_mapping = {
     'default': ['body',
               'input[type="reset"], input[type="submit"], input[class="button"]'],
     'quickbar': ['div#quickbar'],
-    'mainbody': ['div#body']
+    'mainbody': ['div#body'],
+    'navigation': ['div#nav'],
+    'page-menu': ['div#page-navigation ul#page-menu'],
 };
 
 jQuery(function($) {
@@ -192,6 +194,10 @@ div#header h1 { }
 
 div#quickbar {}
 
+div#nav {}
+
+div#page-navigation ul#page-menu {}
+
 input[type="reset"], input[type="submit"], input[class="button"] {}
 ';
 

commit e7dd37fd1cbfd866f88e631570e687fbd1f25e81
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Fri Sep 3 23:40:09 2010 +0800

    actually use user uploaded logo.

diff --git a/share/html/Elements/Logo b/share/html/Elements/Logo
index bf142fd..24fc8b8 100644
--- a/share/html/Elements/Logo
+++ b/share/html/Elements/Logo
@@ -46,11 +46,17 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <div id="logo">
+% if ($use_user_logo) {
+<a href="<%$ARGS{'LogoLinkURL'}||RT->Config->Get('LogoLinkURL')%>"><img
+    src="/Helpers/UserLogo"
+    alt="<%loc($ARGS{'LogoAltText'}||RT->Config->Get('LogoAltText'))%>" /></a>
+% } else {
 <a href="<%$ARGS{'LogoLinkURL'}||RT->Config->Get('LogoLinkURL')%>"><img
     src="<%$ARGS{'LogoURL'}||RT->Config->Get('LogoURL')%>"
     alt="<%loc($ARGS{'LogoAltText'}||RT->Config->Get('LogoAltText'))%>"
     width="<%$ARGS{'LogoImageWidth'}||RT->Config->Get('LogoImageWidth')%>"
     height="<%$ARGS{'LogoImageHeight'}||RT->Config->Get('LogoImageHeight')%>" /></a>
+% }
 % if ( $ShowName ) {
     <span class="rtname"><% $Name || loc("RT for [_1]", RT->Config->Get('rtname')) %></span>
 % }
@@ -60,6 +66,9 @@ if ( exists $ARGS{'show_name'} ) {
     $RT::Logger->warning('show_name argument was renamed, use ShowName');
     $ShowName = delete $ARGS{'show_name'};
 }
+
+my $use_user_logo = $RT::System->FirstAttribute('UserLogo');
+
 </%INIT>
 <%ARGS>
 $ShowName => 1
diff --git a/share/html/Helpers/UserLogo b/share/html/Helpers/UserLogo
index 6cf1735..f15a165 100644
--- a/share/html/Helpers/UserLogo
+++ b/share/html/Helpers/UserLogo
@@ -6,6 +6,6 @@ if ( my $attr = $RT::System->FirstAttribute('UserLogo') ) {
     $m->out( $content->{data} );
     $m->abort;
 }
-
+# XXX: 404
 
 </%INIT>

commit c340a8629b3775fb91c7502ec15523a8eb576a91
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Fri Sep 3 23:47:09 2010 +0800

    entry for theme from global admin menu.

diff --git a/share/html/Admin/Global/index.html b/share/html/Admin/Global/index.html
index 1b1f9b0..eca1e61 100755
--- a/share/html/Admin/Global/index.html
+++ b/share/html/Admin/Global/index.html
@@ -79,7 +79,9 @@
                                 text => loc('Modify the default "RT at a glance" view'),
                                 path => '/Admin/Global/MyRT.html',
                       },
-
+                J => { title => loc('Theme'),
+                                path => '/Admin/Global/Theme.html',
+                      },
 
 
 };

commit ffad400f9efb30f91085c6cbd3a3cef810a523f2
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Fri Sep 3 23:50:35 2010 +0800

    make logo analyzer optional.

diff --git a/sbin/rt-test-dependencies.in b/sbin/rt-test-dependencies.in
index 8ee51bd..2deda57 100755
--- a/sbin/rt-test-dependencies.in
+++ b/sbin/rt-test-dependencies.in
@@ -71,6 +71,7 @@ GetOptions(
     'with-GRAPHVIZ',
     'with-GD',
     'with-DASHBOARDS',
+    'with-USERLOGO',
 
     'download=s',
     'repository=s',
@@ -97,7 +98,8 @@ my %default = (
     'with-SMTP' => 1,
     'with-GRAPHVIZ' => @RT_GRAPHVIZ@,
     'with-GD' => @RT_GD@,
-    'with-DASHBOARDS' => 1
+    'with-DASHBOARDS' => 1,
+    'with-USERLOGO' => 1,
 );
 $args{$_} = $default{$_} foreach grep !exists $args{$_}, keys %default;
 
@@ -349,6 +351,11 @@ GD::Graph
 GD::Text
 .
 
+$deps{'USERLOGO'} = [ text_to_hash( << '.') ];
+Imager
+Convert::Color
+.
+
 my %AVOID = (
     'DBD::Oracle' => [qw(1.23)],
 );
diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index cf47411..5ffbb24 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -148,8 +148,8 @@ jQuery(function($) {
 <%INIT>
 my @results;
 
-use Imager;
-use Convert::Color;
+my $has_color_analyzer =
+eval { require Imger; require Convert::Color; 1 };
 
 my $img = Imager->new;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
@@ -203,7 +203,9 @@ input[type="reset"], input[type="submit"], input[class="button"] {}
 
 }
 
-my $colors = $img ? analyze_img($img) : undef;
+# XXX: move this to some other modules
+
+my $colors = $img && $has_color_analyzer? analyze_img($img) : undef;
 use List::MoreUtils qw(uniq);
 
 sub analyze_img {

-----------------------------------------------------------------------


More information about the Rt-commit mailing list