Bug 48299
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@580 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
fe5f837edd
commit
024a5ddaba
|
@ -0,0 +1,106 @@
|
|||
#!/usr/bin/perl -w
|
||||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# Contributor(s): Vitaliy Filippov <vitalif@mail.ru>
|
||||
|
||||
use utf8;
|
||||
use strict;
|
||||
|
||||
use lib qw(. lib);
|
||||
use GD;
|
||||
use GD::Text;
|
||||
use GD::Text::Align;
|
||||
|
||||
use Bugzilla;
|
||||
use Bugzilla::Bug;
|
||||
use Bugzilla::Status;
|
||||
use Bugzilla::Util;
|
||||
use Bugzilla::Constants;
|
||||
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $id = $cgi->param('id');
|
||||
my $user = Bugzilla->login();
|
||||
my $bug = Bugzilla::Bug->new($id);
|
||||
my $str;
|
||||
my $format = lc $cgi->param('format') || 'short';
|
||||
if (!$user || !$bug->{error} && !$user->can_see_bug($bug->bug_id))
|
||||
{
|
||||
# Access denied
|
||||
$str = "#$id нет доступа";
|
||||
$bug = undef;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Bug description
|
||||
my $as = $bug->assigned_to;
|
||||
$as = $as && $as->login;
|
||||
$as =~ s/\@.*$// if $as;
|
||||
my $st = $bug->bug_status;
|
||||
$st .= '/' . $bug->resolution if $bug->resolution;
|
||||
if ($format eq 'long')
|
||||
{
|
||||
$str = '#' . $bug->bug_id . " [$as] $st " . $bug->bug_severity . ' ' . $bug->product . '/' . $bug->component . " " . $bug->short_desc;
|
||||
}
|
||||
else
|
||||
{
|
||||
$str = '#' . $bug->bug_id . " [$as] " . $st;
|
||||
}
|
||||
$str =~ s/\s{2,}/ /gso;
|
||||
}
|
||||
|
||||
# GD-говнокод
|
||||
my $size = $cgi->param('fontsize');
|
||||
my $qual = 1;
|
||||
$size = Bugzilla->params->{graph_font_size} || 9 if !$size || $size > 25;
|
||||
$size *= 2 if $qual;
|
||||
my $font = Bugzilla->params->{graph_font} || gdSmallFont;
|
||||
my $gdt = GD::Text->new(text => $str, font => $font, ptsize => $size) || die GD::Text::error();
|
||||
my ($w, $h) = $gdt->get('width', 'height');
|
||||
$w++;
|
||||
$h++;
|
||||
my $gdi = GD::Image->new($w, $h);
|
||||
my $white = $gdi->colorAllocate(255,255,255);
|
||||
my $black = $gdi->colorAllocate(0,0,0);
|
||||
my $fore = $black;
|
||||
$fore = $gdi->colorAllocate(255,0,0) if !$bug || $bug->bug_severity eq 'critical' || $bug->bug_severity eq 'blocker';
|
||||
my $border = $fore;
|
||||
$gdi->trueColor(1);
|
||||
$gdi->alphaBlending(1);
|
||||
$gdi->filledRectangle(0,0,$w-1,$h-1,$white);
|
||||
$gdt = GD::Text::Align->new($gdi, valign => 'top', halign => 'left', text => $str, font => $font, ptsize => $size, color => $fore);
|
||||
$gdt->draw(1, 1, 0);
|
||||
if ($bug && $bug->bug_status eq 'VERIFIED')
|
||||
{
|
||||
$border = $gdi->colorAllocate(0x2f/2,0x6f/2,0xab/2);
|
||||
$gdi->setStyle(($border) x (3*($qual+1)), (gdTransparent) x (3*($qual+1)));
|
||||
$gdi->rectangle(0,0,$w-1,$h-1,gdStyled);
|
||||
}
|
||||
elsif ($bug && $bug->bug_status eq 'CLOSED')
|
||||
{
|
||||
$border = $gdi->colorAllocate(0x60,0x60,0x60);
|
||||
$gdi->rectangle(0,0,$w-1,$h-1,$border);
|
||||
}
|
||||
if ($bug && !is_open_state($bug->bug_status))
|
||||
{
|
||||
$gdi->line(0, $h/2, $w-1, $h/2, $border);
|
||||
}
|
||||
if ($qual)
|
||||
{
|
||||
my $i2 = GD::Image->new($w/2, $h/2);
|
||||
$i2->copyResampled($gdi, 0, 0, 0, 0, $w/2, $h/2, $w, $h);
|
||||
$gdi = $i2;
|
||||
}
|
||||
|
||||
$cgi->header('image/png');
|
||||
binmode STDOUT;
|
||||
print $gdi->png;
|
|
@ -1,51 +0,0 @@
|
|||
[%# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
# the License at http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS
|
||||
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
|
||||
# implied. See the License for the specific language governing
|
||||
# rights and limitations under the License.
|
||||
#
|
||||
# The Original Code is the Bugzilla Bug Tracking System.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Netscape Communications
|
||||
# Corporation. Portions created by Netscape are
|
||||
# Copyright (C) 1998 Netscape Communications Corporation. All
|
||||
# Rights Reserved.
|
||||
#
|
||||
# Contributor(s): Gervase Markham <gerv@gerv.net>
|
||||
# Vaskin Kissoyan <vkissoyan@yahoo.com>
|
||||
# Bradley Baetz <bbaetz@student.usyd.edu.au>
|
||||
# Max Kanat-Alexander <mkanat@bugzilla.org>
|
||||
#%]
|
||||
|
||||
[% PROCESS global/variables.none.tmpl %]
|
||||
[%# This script/template only handles one bug #%]
|
||||
[% bug = bugs.0 %]
|
||||
[% IF !bug.error %]
|
||||
[% filtered_desc = bug.short_desc FILTER html %]
|
||||
[% filtered_timestamp = bug.delta_ts FILTER time %]
|
||||
<html style="overflow: hidden; margin: 0">
|
||||
<head><title>[% "$terms.Bug $bug.bug_id – $filtered_desc" %]</title></head>
|
||||
<body style="text-align: center; overflow: hidden; font-size: 13px; margin: -1px 1px 0 1px; background-color: #[% IF bug.bug_status == "NEW" %]FFE040[% ELSIF bug.bug_status == "ASSIGNED" %]FFFFA0[% ELSIF bug.bug_status == "RESOLVED" %]A0FFA0[% ELSIF bug.bug_status == "VERIFIED" %]B79AFF[% ELSIF bug.bug_status == "CLOSED" %]DDDDDD[% ELSIF bug.bug_status == "REOPENED" %]A00000[% END %]">
|
||||
<div id="dat" style="white-space: nowrap; display: inline-block" title="[[% bug.bug_status %]] [% filtered_desc %]">
|
||||
[% IF bug.bug_status == "RESOLVED" OR bug.bug_status == "CLOSED" OR bug.bug_status == "VERIFIED" %]
|
||||
<strike>
|
||||
[% END %]
|
||||
<b><a target="_blank" title="[[% bug.bug_status %]] [% filtered_desc %]" href="/show_bug.cgi?id=[% bug.bug_id %]">[% terms.Bug %] [% bug.bug_id %]</a>
|
||||
[% bug.product %]/[% bug.component %]</b>
|
||||
[% IF bug.assigned_to %][[% bug.assigned_to.login %]][% END %]
|
||||
[% IF bug.bug_status == "RESOLVED" OR bug.bug_status == "CLOSED" OR bug.bug_status == "VERIFIED" %]
|
||||
</strike>
|
||||
[% END %]
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
[% ELSE %]
|
||||
<html>
|
||||
<head><title>Unauthorized</title></head>
|
||||
<body style="text-align: center; overflow: hidden; background-color: #FFF0F0; font-size: 13px; margin: -1px 1px 0 1px">Unauthorized to see <a target="_blank" href="/show_bug.cgi?id=[% bug.bug_id %]">Bug [% bug.bug_id %]</a>.</body>
|
||||
</html>
|
||||
[% END %]
|
Loading…
Reference in New Issue