[Rt-commit] rt branch, 3.9-trunk, updated. rt-3.8.8-731-g5152faf

Chia-liang Kao clkao at bestpractical.com
Wed Sep 8 08:02:34 EDT 2010


The branch, 3.9-trunk has been updated
       via  5152fafa37475e27ae9cfd509c618c226e362e2f (commit)
      from  9f4278755587a2c3bf8ff9fa68997c050d424d00 (commit)

Summary of changes:
 share/html/Admin/Global/Theme.html |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

- Log -----------------------------------------------------------------
commit 5152fafa37475e27ae9cfd509c618c226e362e2f
Author: Chia-liang Kao <clkao at bestpractical.com>
Date:   Wed Sep 8 20:04:22 2010 +0800

    button for logo reset

diff --git a/share/html/Admin/Global/Theme.html b/share/html/Admin/Global/Theme.html
index 7517b56..688d82a 100644
--- a/share/html/Admin/Global/Theme.html
+++ b/share/html/Admin/Global/Theme.html
@@ -66,6 +66,7 @@
   <form method="POST" enctype="multipart/form-data">
     <label for="logo-upload"><&|/l&>Upload a new logo</&>:</label>
     <input type="file" name="logo-upload" id="logo-upload" /><br />
+    <input name="reset_logo" value="Reset to default RT Logo" type="submit" />
     <input type="submit" value="Upload" />
   </form>
 </div>
@@ -176,19 +177,24 @@ my @results;
 my $has_color_analyzer =
 eval { require Imager; require Convert::Color; 1 };
 
-my $img = Imager->new;
+my $img;
 if (my $file_hash = _UploadedFile( 'logo-upload' )) {
     my ($id, $msg) = $RT::System->SetAttribute( Name => "UserLogo",
                                                 Description => "User-provided logo",
                                                 Content => {
                                                     type => $file_hash->{ContentType},
                                                     data => $file_hash->{LargeContent} } );
+    $img = Imager->new;
     $img->read(data => $file_hash->{LargeContent} );
 }
+elsif ($ARGS{'reset_logo'}) {
+    $RT::System->DeleteAttribute('UserLogo');
+}
 else {
     if (my $attr = $RT::System->FirstAttribute('UserLogo')) {
         my $content = $attr->Content;
         if (ref($content) eq 'HASH') {
+            $img = Imager->new;
             $img->read(data => $content->{data}) or die "Cannot read: ", $img->errstr;
         }
         else {

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


More information about the Rt-commit mailing list