Bug 147728 - fix "Browse" styles which were VERY UGLY
git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@1945 6955db30-a419-402b-8a0d-67ecbb4d7f56master
parent
b0d0f633c9
commit
e3375c4e0a
|
@ -562,6 +562,28 @@ sub cookie
|
|||
return new CGI::Cookie(@param);
|
||||
}
|
||||
|
||||
# Request variables in PHP-like format:
|
||||
# - parameters without [] are always treated as scalars
|
||||
# - parameters with [] are always treated as arrays
|
||||
sub VarHash
|
||||
{
|
||||
my $self = shift;
|
||||
my $args = { %{ $self->Vars } };
|
||||
my $filtered = {};
|
||||
for my $key (keys %$args)
|
||||
{
|
||||
if ($key =~ /\[\]$/so)
|
||||
{
|
||||
$filtered->{substr $key, 0, -2} = ref $args->{$key} ? $args->{$key} : [ $args->{$key} ];
|
||||
}
|
||||
else
|
||||
{
|
||||
$filtered->{$key} = ref $args->{$key} ? $args->{$key}->[-1] : $args->{$key};
|
||||
}
|
||||
}
|
||||
return $filtered;
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
|
|
@ -110,7 +110,7 @@ sub body
|
|||
my $line_length = Bugzilla->params->{comment_line_length} - 1;
|
||||
my $result = $self->{'thetext'};
|
||||
$result =~ s/(>[^\n]*?\n)+/>...\n/g;
|
||||
$result =~ s/^((?>[^\n]{0,$line_length}.){0,$max_lines}(?>[^\n]{0,$line_length}\s)).*$/\1.../s if !$self->check_length($result);
|
||||
$result =~ s/^((?>[^\n]{0,$line_length}.){0,$max_lines}(?>[^\n]{0,$line_length}\s)).*$/$1.../s if !$self->check_length($result);
|
||||
return $result;
|
||||
}
|
||||
return $_[0]->{'thetext'};
|
||||
|
|
|
@ -48,8 +48,7 @@ use Safe;
|
|||
# Historical, needed for SCHEMA_VERSION = '1.00'
|
||||
use Storable qw(dclone freeze thaw);
|
||||
|
||||
# New SCHEMA_VERSION (2.00) use this
|
||||
use Data::Dumper;
|
||||
# New SCHEMA_VERSION (2.00) uses Dumper
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
|
@ -771,7 +771,7 @@ sub get_selectable_products {
|
|||
" AND g.entry != 0 AND g.group_id NOT IN (".$self->groups_as_string.")" .
|
||||
" WHERE g.group_id IS NULL)" .
|
||||
" ORDER BY pname";
|
||||
$prod_ids = Bugzilla->dbh->selectcol_arrayref($query, undef, $self->id);
|
||||
$prod_ids = Bugzilla->dbh->selectcol_arrayref($query);
|
||||
}
|
||||
$self->{selectable_products} = Bugzilla::Product->new_from_list($prod_ids);
|
||||
}
|
||||
|
@ -1759,7 +1759,7 @@ sub read_new_functionality {
|
|||
my $time = $cgi->cookie('read_new_functionality');
|
||||
$time = 0 unless $time;
|
||||
my @lu = map { $_ - 0} Bugzilla->params->{new_functionality_tsp} =~ m/(\d+)/g;
|
||||
my $last_updated = POSIX::mktime(@lu[5], @lu[4], @lu[3], @lu[2], @lu[1] - 1, @lu[0] - 1900);
|
||||
my $last_updated = POSIX::mktime($lu[5], $lu[4], $lu[3], $lu[2], $lu[1] - 1, $lu[0] - 1900);
|
||||
return $last_updated >= $time;
|
||||
}
|
||||
|
||||
|
|
|
@ -64,8 +64,9 @@ use Text::Wrap;
|
|||
use Text::TabularDisplay::Utf8;
|
||||
use JSON;
|
||||
|
||||
use Data::Dumper;
|
||||
use Data::Dumper qw(Dumper);
|
||||
$Data::Dumper::Useperl = 1;
|
||||
no warnings 'redefine';
|
||||
*Data::Dumper::qquote = sub { my $s = $_[0]; s/\"/\\"/gs; return '"'.$s.'"' };
|
||||
|
||||
eval { require 'Lingua/Stem/Snowball.pm' };
|
||||
|
@ -357,7 +358,7 @@ sub correct_urlbase {
|
|||
|
||||
sub remote_ip {
|
||||
my $ip = $ENV{'REMOTE_ADDR'} || '127.0.0.1';
|
||||
my @proxies = '127.0.0.1', split(/[\s,]+/, Bugzilla->params->{'inbound_proxies'});
|
||||
my @proxies = ('127.0.0.1', split /[\s,]+/, Bugzilla->params->{'inbound_proxies'});
|
||||
if (grep { $_ eq $ip } @proxies) {
|
||||
$ip = $ENV{'HTTP_X_FORWARDED_FOR'} if $ENV{'HTTP_X_FORWARDED_FOR'};
|
||||
}
|
||||
|
@ -985,11 +986,6 @@ sub xml_simple_char
|
|||
$frame->{char} .= $text;
|
||||
}
|
||||
|
||||
sub Dumper
|
||||
{
|
||||
return Data::Dumper::Dumper(@_);
|
||||
}
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
|
|
@ -1,26 +1,6 @@
|
|||
#!/usr/bin/perl -wT
|
||||
# -*- 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.
|
||||
#
|
||||
# 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): Terry Weissman <terry@mozilla.org>
|
||||
# Bradley Baetz <bbaetz@student.usyd.edu.au>
|
||||
# Frédéric Buclin <LpSolit@gmail.com>
|
||||
# License: Dual-license GPL 3.0+ or MPL 1.1+
|
||||
# Author: Vitaliy Filippov <vitalif@mail.ru> (the file is rewritten)
|
||||
|
||||
use strict;
|
||||
use lib qw(. lib);
|
||||
|
@ -31,56 +11,54 @@ use Bugzilla::Util;
|
|||
use Bugzilla::Error;
|
||||
use Bugzilla::Product;
|
||||
|
||||
my $user = Bugzilla->login();
|
||||
my $cgi = Bugzilla->cgi;
|
||||
my $user = Bugzilla->login;
|
||||
my $template = Bugzilla->template;
|
||||
my $vars = {};
|
||||
my $ARGS = Bugzilla->cgi->VarHash;
|
||||
|
||||
# This script does nothing but displaying mostly static data.
|
||||
Bugzilla->switch_to_shadow_db;
|
||||
|
||||
my $product_name = trim($cgi->param('product') || '');
|
||||
my $product = new Bugzilla::Product({'name' => $product_name});
|
||||
|
||||
unless ($product && $user->can_access_product($product->name)) {
|
||||
my $product = new Bugzilla::Product({ name => trim($ARGS->{product} || '') });
|
||||
unless ($product && $user->can_access_product($product->name))
|
||||
{
|
||||
# Products which the user is allowed to see.
|
||||
my @products = @{$user->get_enterable_products};
|
||||
|
||||
if (scalar(@products) == 0) {
|
||||
ThrowUserError("no_products");
|
||||
my $products = $user->get_accessible_products;
|
||||
if (!@$products)
|
||||
{
|
||||
ThrowUserError('no_products');
|
||||
}
|
||||
# If there is only one product available but the user entered
|
||||
# another product name, we display a list with this single
|
||||
# product only, to not confuse the user with components of a
|
||||
# product he didn't request.
|
||||
elsif (scalar(@products) > 1 || $product_name) {
|
||||
$vars->{'classifications'} = [{object => undef, products => \@products}];
|
||||
$vars->{'target'} = "describecomponents.cgi";
|
||||
# If an invalid product name is given, or the user is not
|
||||
# allowed to access that product, a message is displayed
|
||||
# with a list of the products the user can choose from.
|
||||
if ($product_name) {
|
||||
$vars->{'message'} = "product_invalid";
|
||||
# Do not use $product->name here, else you could use
|
||||
# this way to determine whether the product exists or not.
|
||||
$vars->{'product'} = $product_name;
|
||||
if (Bugzilla->params->{useclassification})
|
||||
{
|
||||
my $cl = Bugzilla::Classification->new({ name => trim($ARGS->{classification} || '') });
|
||||
if (!$cl)
|
||||
{
|
||||
my $acc = [ keys %{ { map { $_->classification_id => 1 } @$products } } ];
|
||||
$vars->{classifications} = Bugzilla::Classification->new_from_list($acc);
|
||||
$vars->{target} = 'describecomponents.cgi';
|
||||
$template->process('global/choose-classification.html.tmpl', $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
|
||||
$template->process("global/choose-product.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
$vars->{classifications} = [ {
|
||||
object => $cl,
|
||||
products => [ grep { $_->classification_id == $cl->id } @$products ],
|
||||
} ];
|
||||
}
|
||||
|
||||
# If there is only one product available and the user didn't specify
|
||||
# any product name, we show this product.
|
||||
$product = $products[0];
|
||||
else
|
||||
{
|
||||
$vars->{classifications} = [ {
|
||||
object => undef,
|
||||
products => $products
|
||||
} ];
|
||||
}
|
||||
$vars->{target} = 'describecomponents.cgi';
|
||||
$template->process('global/choose-product.html.tmpl', $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
}
|
||||
|
||||
######################################################################
|
||||
# End Data/Security Validation
|
||||
######################################################################
|
||||
|
||||
$vars->{'product'} = $product;
|
||||
$vars->{product} = $product;
|
||||
|
||||
$template->process("reports/components.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|| ThrowTemplateError($template->error());
|
||||
exit;
|
||||
|
|
|
@ -24,54 +24,34 @@
|
|||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.product_container {
|
||||
width: 65%;
|
||||
}
|
||||
|
||||
.product_name {
|
||||
margin: 0;
|
||||
font-size: 200%;
|
||||
}
|
||||
|
||||
.product_desc {
|
||||
/* This is padding instead of margin because it looks better
|
||||
* with the scrollbar. */
|
||||
padding: 0 2em;
|
||||
margin: 0 32px;
|
||||
font-style: italic;
|
||||
max-height: 5em;
|
||||
font-size: 130%;
|
||||
overflow: auto;
|
||||
}
|
||||
|
||||
.instructions {
|
||||
font-weight: bold;
|
||||
font-size: 105%;
|
||||
padding-right: 1em;
|
||||
}
|
||||
|
||||
.components_header {
|
||||
margin: 0;
|
||||
font-size: 140%;
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.component_table {
|
||||
margin-top: -1em;
|
||||
margin-left: 2em;
|
||||
margin-top: 1em;
|
||||
margin-left: 32px;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.component_table thead th {
|
||||
padding-right: 1em;
|
||||
vertical-align: bottom;
|
||||
.component_table td, .component_table th {
|
||||
padding: .3em;
|
||||
vertical-align: middle;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.component_table td {
|
||||
border-bottom: 1px dotted gray;
|
||||
}
|
||||
|
||||
.component_table td.component_assignee,
|
||||
.component_table td.component_qa_contact
|
||||
{
|
||||
border: none;
|
||||
padding-top: .5em;
|
||||
border: 1px dotted gray;
|
||||
}
|
||||
|
||||
.component_name {
|
||||
|
@ -81,9 +61,3 @@
|
|||
vertical-align: middle;
|
||||
min-width: 8em;
|
||||
}
|
||||
|
||||
.component_description {
|
||||
padding-bottom: .5em;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,26 +39,20 @@
|
|||
[% numcols = 2 %]
|
||||
[% END %]
|
||||
|
||||
<table cellpadding="0" cellspacing="0" id="components_header_table">
|
||||
<tr>
|
||||
<td class="instructions">
|
||||
Select a component to see open [% terms.bugs %] in that component:
|
||||
</td>
|
||||
<td class="product_container">
|
||||
<h2 class="product_name">[% product.name FILTER html %]</h2>
|
||||
<div class="product_desc">
|
||||
[% product.description FILTER html_light %]
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h2 class="product_name">[% product.name FILTER html %]</h2>
|
||||
<div class="product_desc">
|
||||
[% product.description FILTER html_light %]
|
||||
</div>
|
||||
|
||||
<h3 class="components_header">Components</h3>
|
||||
|
||||
<p>Select a component to see open [% terms.bugs %] in that component:</p>
|
||||
|
||||
<table class="component_table" cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<tr>
|
||||
<th> </th>
|
||||
<th>Description</th>
|
||||
<th>Default Assignee</th>
|
||||
[% IF Param("useqacontact") %]
|
||||
<th>Default QA Contact</th>
|
||||
|
@ -81,13 +75,16 @@
|
|||
|
||||
[% BLOCK describe_comp %]
|
||||
<tr>
|
||||
<td rowspan="2" class="component_name">
|
||||
<td class="component_name">
|
||||
<a name="[% comp.name FILTER html %]"
|
||||
href="buglist.cgi?product=
|
||||
[%- product.name FILTER url_quote %]&component=
|
||||
[%- comp.name FILTER url_quote %]&resolution=---">
|
||||
[% comp.name FILTER html %]</a>
|
||||
</td>
|
||||
<td class="component_description">
|
||||
[% comp.description FILTER html_light %]
|
||||
</td>
|
||||
<td class="component_assignee">
|
||||
[% INCLUDE global/user.html.tmpl who = comp.default_assignee %]
|
||||
</td>
|
||||
|
@ -97,9 +94,4 @@
|
|||
</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="[% numcols - 1 %]" class="component_description">
|
||||
[% comp.description FILTER html_light %]
|
||||
</td>
|
||||
</tr>
|
||||
[% END %]
|
||||
|
|
Loading…
Reference in New Issue