This commit is contained in:
ghendricks%novell.com 2007-02-26 19:06:35 +00:00
Родитель 9d29460385
Коммит 0659c8b1f5
52 изменённых файлов: 650 добавлений и 805 удалений

Просмотреть файл

@ -425,7 +425,13 @@ Returns true if the logged in user has rights to view this attachment
sub canview {
my $self = shift;
# TODO: Check for private attachments
return 1 if Bugzilla->user->in_group('Testers');
foreach my $i (@{$self->cases}){
return 0 unless $i->canview;
}
foreach my $i (@{$self->plans}){
return 0 unless $i->canview;
}
return 1;
}
@ -437,15 +443,14 @@ Returns true if the logged in user has rights to edit this attachment
sub canedit {
my $self = shift;
my $obj;
if ($self->plan_id){
$obj = Bugzilla::Testopia::TestPlan->new($self->plan_id);
return 1 if Bugzilla->user->in_group('Testers');
foreach my $i (@{$self->cases}){
return 0 unless $i->canedit;
}
else {
$obj = Bugzilla::Testopia::TestCase->new($self->case_id);
foreach my $i (@{$self->plans}){
return 0 unless $i->canedit;
}
return $obj->canedit && $self->canview; $obj->canedit;
return 1;
}
=head2 candelete
@ -459,7 +464,13 @@ sub candelete {
return 1 if Bugzilla->user->in_group("admin");
return 0 unless $self->canedit && Param("allow-test-deletion");
return 1 if Bugzilla->user->id == $self->submitter->id;
return 0;
foreach my $i (@{$self->cases}){
return 0 unless $i->canedit;
}
foreach my $i (@{$self->plans}){
return 0 unless $i->canedit;
}
return 1;
}
###############################
@ -467,8 +478,6 @@ sub candelete {
###############################
sub id { return $_[0]->{'attachment_id'}; }
sub plan_id { return $_[0]->{'plan_id'}; }
sub case_id { return $_[0]->{'case_id'}; }
sub submitter { return Bugzilla::User->new($_[0]->{'submitter_id'}); }
sub description { return $_[0]->{'description'}; }
sub filename { return $_[0]->{'filename'}; }
@ -512,6 +521,54 @@ sub datasize {
return $self->{'datasize'};
}
=head2 cases
Returns a reference to a list of Testopia::TestCase objects linked
to this attachment
=cut
sub cases {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
return $self->{'cases'} if exists $self->{'cases'};
my $caseids = $dbh->selectcol_arrayref(
"SELECT case_id FROM test_case_attachments
WHERE attachment_id = ?",
undef, $self->id);
my @cases;
foreach my $id (@{$caseids}){
push @cases, Bugzilla::Testopia::TestCase->new($id);
}
$self->{'cases'} = \@cases;
return $self->{'cases'};
}
=head2 plans
Returns a reference to a list of Testopia::TestCase objects linked
to this plan
=cut
sub plans {
my ($self) = @_;
my $dbh = Bugzilla->dbh;
return $self->{'plans'} if exists $self->{'plans'};
my $planids = $dbh->selectcol_arrayref(
"SELECT plan_id FROM test_plan_attachments
WHERE attachment_id = ?",
undef, $self->id);
my @plans;
foreach my $id (@{$planids}){
push @plans, Bugzilla::Testopia::TestPlan->new($id);
}
$self->{'plans'} = \@plans;
return $self->{'plans'};
}
=head1 SEE ALSO
Bugzilla::Attachment

Просмотреть файл

@ -10,11 +10,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Maciej Maczynski are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -39,12 +39,9 @@ package Bugzilla::Testopia::Build;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestCase;
use base qw(Exporter);
###############################
#### Initialization ####
###############################
@ -139,24 +136,6 @@ sub store {
return $key;
}
=head2 remove
Removes this build from the specified product
=cut
sub remove {
my $self = shift;
my ($plan) = @_;
ThrowUserError("testopia-incorrect-plan") if ($self->{'product_id'} != $plan->product_id);
ThrowUserError("testopia-non-zero-case-run-count") if ($self->{'case_run_count'});
ThrowUserError("testopia-non-zero-run-count", {'object' => 'Build'}) if ($self->{'run_count'});
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_builds
WHERE build_id = ?", undef,
$self->{'build_id'});
}
=head2 check_name
Returns true if a build of the specified name exists in the database
@ -210,6 +189,20 @@ sub update {
($name, $desc, $milestone, $isactive, $self->{'build_id'}));
}
=head2 toggle_hidden
Toggles the archive bit on the build.
=cut
sub toggle_hidden {
my $self = shift;
my $dbh = Bugzilla->dbh;
$dbh->do("UPDATE test_builds SET isactive = ?
WHERE build_id = ?", undef, $self->isactive ? 0 : 1, $self->id);
}
###############################
#### Accessors ####
###############################

Просмотреть файл

@ -10,11 +10,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Maciej Maczynski are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -39,12 +39,9 @@ package Bugzilla::Testopia::Category;
use strict;
use Bugzilla::Util;
use Bugzilla::Error;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestCase;
use base qw(Exporter);
###############################
#### Initialization ####
###############################
@ -59,15 +56,14 @@ use base qw(Exporter);
=cut
use constant DB_COLUMNS => qw(
test_case_categories.category_id
test_case_categories.product_id
test_case_categories.name
test_case_categories.description
category_id
product_id
name
description
);
our $columns = join(", ", DB_COLUMNS);
###############################
#### Methods ####
###############################
@ -149,9 +145,6 @@ Removes this category from the specified product
sub remove {
my $self = shift;
my ($plan) = @_;
ThrowUserError("testopia-incorrect-plan") if ($self->{'product_id'} != $plan->product_id);
ThrowUserError("testopia-non-zero-case-count") if ($self->{'case_count'});
my $dbh = Bugzilla->dbh;
$dbh->do("DELETE FROM test_case_categories
WHERE category_id = ?", undef,
@ -194,6 +187,12 @@ sub update {
($name, $desc, $self->{'category_id'}));
}
sub candelete {
my $self = shift;
return 0 unless Bugzilla->user->in_group('Testers');
return 0 if ($self->case_count);
return 1;
}
###############################
#### Accessors ####
@ -217,9 +216,9 @@ Returns the description of this object
=cut
sub id { return $_[0]->{'category_id'}; }
sub product_id { return $_[0]->{'product_id'}; }
sub name { return $_[0]->{'name'}; }
sub id { return $_[0]->{'category_id'}; }
sub product_id { return $_[0]->{'product_id'}; }
sub name { return $_[0]->{'name'}; }
sub description { return $_[0]->{'description'}; }
=head2 case_count

Просмотреть файл

@ -133,7 +133,7 @@ sub check_property{
my ($name, $element_id) = @_;
my $dbh = Bugzilla->dbh;
if ($name eq undef || $name eq '' || $element_id eq undef) {
unless ($name && $element_id) {
return "check_product must be passed a valid name and product_id";
}
@ -285,7 +285,7 @@ sub valid_exp_to_json {
my ($disable_move, $env_id) = @_;
my $env = Bugzilla::Testopia::Environment->new($env_id) if $env_id;
$disable_move = ',"addChild","move","remove"' if $disable_move;
$disable_move = $disable_move ? ',"addChild","move","remove"' : '';
my $validexp = $self->get_validexp;
my @validexpressions = split(/\|/, @$validexp[0]);

Просмотреть файл

@ -55,6 +55,7 @@ package Bugzilla::Testopia::Search;
use strict;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Testopia::Util;
@ -1020,7 +1021,7 @@ sub init {
foreach my $name (split(',', $cgi->param($profile))) {
$name = trim($name);
if ($name) {
&::DBNameToIdAndCheck($name);
login_to_id($name);
}
}
}

Просмотреть файл

@ -372,7 +372,7 @@ sub page_size {
my $self = shift;
my $cgi = $self->{'cgi'};
return $cgi->param('pagesize') if $cgi->param('pagesize');
return 25; #TODO: make this a user setting
return 25;
}
=head2 get_order_url

Просмотреть файл

@ -448,7 +448,12 @@ sub add_component {
my $self = shift;
my ($comp_id) = @_;
my $dbh = Bugzilla->dbh;
#TODO: Check for existing component
my ($is) = $dbh->selectrow_array(
"SELECT case_id FROM test_case_components
WHERE case_id = ? AND component_id = ?",
undef, ($self->id, $comp_id));
return 0 if $is;
$dbh->do("INSERT INTO test_case_components (case_id, component_id)
VALUES (?,?)",undef, $self->{'case_id'}, $comp_id);
delete $self->{'components'};
@ -1482,7 +1487,6 @@ sub components {
my $self = shift;
my $dbh = Bugzilla->dbh;
return $self->{'components'} if exists $self->{'components'};
#TODO: 2.22 use Bugzilla::Component
my $comps = $dbh->selectcol_arrayref(
"SELECT comp.id
FROM components AS comp

Просмотреть файл

@ -738,6 +738,8 @@ sub set_tester_regexp {
$self->derive_regexp_testers($regexp);
}
#TODO: Check on what I was thinking here
sub derive_regexp_testers {
my $self = shift;
my $regexp = shift;
@ -747,11 +749,7 @@ sub derive_regexp_testers {
"SELECT permissions
FROM test_plan_permissions_regexp
WHERE plan_id = ?", undef, $self->id);
# If something has changed, it is easier to delete everyone and add tham back in
$dbh->do("DELETE FROM test_plan_permissions
WHERE plan_id = ? AND grant_type = ?",
undef, ($self->id, GRANT_REGEXP));
my $sth = $dbh->prepare("SELECT profiles.userid, profiles.login_name, plan_id
FROM profiles
LEFT JOIN test_plan_permissions
@ -768,7 +766,10 @@ sub derive_regexp_testers {
while (my ($userid, $login, $present) = $sth->fetchrow_array()) {
if (($regexp =~ /\S+/) && ($login =~ m/$regexp/i)){
$plan_add->execute($userid, $self->id, $permissions, GRANT_REGEXP) unless $present;
}
}
else {
$plan_del->execute($userid, $self->id, $permissions, GRANT_REGEXP) if $present;
}
}
}

Просмотреть файл

@ -691,7 +691,7 @@ sub get_distinct_builds {
$query .= "AND group_id NOT IN(" .
join(',', values(%{Bugzilla->user->groups})) . ") ";
}
$query .= "WHERE group_id IS NULL AND test_builds.isactive = 1 ORDER BY build.name";
$query .= "WHERE group_id IS NULL AND build.isactive = 1 ORDER BY build.name";
my $ref = $dbh->selectall_arrayref($query, {'Slice'=>{}});

Просмотреть файл

@ -38,7 +38,7 @@ use strict;
use base qw(Exporter);
@Bugzilla::Testopia::Util::EXPORT = qw(get_field_id get_time_stamp
validate_test_id validate_selection
validate_version support_server_push
support_server_push
percentage);
use Bugzilla;
@ -156,31 +156,6 @@ sub validate_selection {
return $res;
}
sub validate_version {
my $dbh = Bugzilla->dbh;
my ($version, $product) = @_;
# First check that the object exists.
# Taint check should have been done before calling this function.
my ($res) = $dbh->selectrow_array(
"SELECT 1
FROM versions
WHERE product_id = ?",
undef, $product);
# If the version does not match the product return the first one
# that does
unless ($res){
($res) = $dbh->selectrow_array(
"SELECT value
FROM versions
WHERE product_id = ?",
undef, $product);
}
return $res;
}
sub support_server_push {
my ($cgi) = @_;
my $serverpush =

Просмотреть файл

@ -49,9 +49,6 @@
[% title = "Build Has Case Runs" %]
You have attempted to delete a build that still has test case runs
associated with it. This is historical data and should not be removed.
[% ELSIF error == "testopia-incorrect-plan" %]
[% title = "Plan mismatch" %]
You have attempted to modify a category that does not belong to this plan.
[% ELSIF error == "testopia-missing-attachment-key" %]
[% title = "Missing Key" %]
You have requested to save an attachment, but I didn't see which test plan
@ -91,7 +88,8 @@
You can create environments <a href="tr_new_environment.cgi">here</a>.
[% ELSIF error == "testopia-missing-required-field" %]
[% title = "Missing Required Field" %]
It seems there was no value entered for [% field FILTER none %].
It seems there was either no value entered for [% field FILTER none %], or the value entered
did not match any known values.
[% ELSIF error == "testopia-missing-plans-list" %]
[% title = "Plan list missing" %]
Somehow the list of plans associated with the test case to be cloned is missing.

Просмотреть файл

@ -30,9 +30,6 @@
<p>
You may find an attachment by entering its id here:
<input name="attach_id" size="6" />
<br>
Plan:<input name="plan_id" size="6" /> or
Case:<input name="case_id" size="6" />
<input type="hidden" name="action" value="edit" />
<input type="submit" value="Show Me This Attachment" />
</p>

Просмотреть файл

@ -36,16 +36,28 @@
[% title = "Attachment Deleted" %]
[% PROCESS global/header.html.tmpl %]
[% PROCESS testopia/messages.html.tmpl %]
[% ELSE %]
[% title = "Delete Attachment '$attachment.description' from $obj.type $obj.id" %]
[% ELSIF removed %]
[% title = "Attachment Removed from $obj.type $obj.id" %]
[% PROCESS global/header.html.tmpl %]
[% PROCESS testopia/messages.html.tmpl %]
[% ELSE %]
[% title = "Delete Attachment '$attachment.description'" %]
[% PROCESS global/header.html.tmpl %]
You are about to permanantly delete this attachment.
[% IF action == 'do_delete' %]
You are about to permanantly delete this attachment.
<p>This attachment is found in [% attachment.cases.size FILTER none %] cases and [% attachment.plans.size FILTER none %] plans.</p>
[% ELSE %]
You are about to remove this attachment from this [% obj.type %]
[% END %]
<p><span style="font-size:12pt; font-weight:bold; color:#cc0000;">Warning: This action cannot be undone</span></p>
<form method="POST" action="tr_attachment.cgi">
<input type="hidden" name="action" value="do_delete" />
<input type="hidden" name="action" value="[% action %]" />
<input type="hidden" name="attach_id" value="[% attachment.id FILTER none %]" />
<input type="hidden" name="[% obj.type FILTER none %]_id" value="[% obj.id FILTER none %]" />
<input type="submit" value="Continue" />
</form>
[% END %]
<a href="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]">view attachment</a>
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -36,7 +36,23 @@
[% PROCESS global/header.html.tmpl %]
[% PROCESS testopia/messages.html.tmpl %]
<p><a href="[% attachment.plan_id ? "tr_show_plan.cgi?plan_id=$attachment.plan_id" : "tr_show_case.cgi?case_id=$attachment.case_id" %]">Back</a> to [% attachment.plan_id ? "test plan" : "test case" %]</p>
[% IF attachment.cases.size > 0 %]
Cases:
[% FOREACH c = attachment.cases %]
<a href="tr_show_case.cgi?case_id=[% c.id FILTER none %]">[% c.id FILTER none %]</a>
[% END %]
<br>
[% END %]
[% IF attachment.plans.size > 0 %]
Plans:
[% FOREACH p = attachment.plans %]
<a href="tr_show_plan.cgi?plan_id=[% p.id FILTER none %]">[% p.id FILTER none %]</a>
[% END %]
<br>
[% END %]
<form method="POST" action="tr_attachment.cgi">
<input type="hidden" name="action" value="do_edit" />
<input type="hidden" name="attach_id" value="[% attachment.id FILTER none %]" />
@ -46,7 +62,7 @@
<th class="bz_row_header" align="right">Description:</th>
<td colspan="3"><input name="description" value="[% attachment.description FILTER html %]" size="30" /></td>
</tr>
<tr>
<tr class="bz_row_header">
<th class="bz_row_header" align="right">Filename:</th>
<td><input name="filename" value="[% attachment.filename FILTER html %]" size="30" /></td>
<th class="bz_row_header" align="right">Mime Type:</th>
@ -91,9 +107,8 @@
</table>
<input type="submit" value="Submit">
</form>
[% IF Param("allow-test-deletion") %]
[% IF attachment.candelete %]
<p><a href="tr_attachment.cgi?attach_id=[% attachment.id FILTER none %]&action=delete&[% obj.type FILTER none %]_id=[% obj.id FILTER none %]">Delete Attachment</a></p>
<p><a href="[% attachment.plan_id ? "tr_show_plan.cgi?plan_id=$attachment.plan_id" : "tr_show_case.cgi?case_id=$attachment.case_id" %]">Back</a> to [% attachment.plan_id ? "test plan" : "test case" %]</p>
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -39,7 +39,7 @@
<td>[% a.creation_ts FILTER time %]</td>
<td>[% a.datasize FILTER unitconvert %]</td>
<td><a href="tr_attachment.cgi?attach_id=[% a.id FILTER none %]&action=edit&[% item.type FILTER none %]_id=[% item.id FILTER none %]">Edit</a>
[% IF Param("allow-test-deletion") %]<a href="tr_attachment.cgi?attach_id=[% a.id FILTER none %]&action=delete&[% item.type FILTER none %]_id=[% item.id FILTER none %]">Delete</a>[% END %]</td>
[% IF Param("allow-test-deletion") %]<a href="tr_attachment.cgi?attach_id=[% a.id FILTER none %]&action=remove&[% item.type FILTER none %]_id=[% item.id FILTER none %]">Remove</a>[% END %]</td>
</tr>
[% END %]

Просмотреть файл

@ -1,54 +0,0 @@
[%# 1.0@bugzilla.org %]
[%# 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 Test Runner System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS global/header.html.tmpl
title = "Delete Category $build.name From Plan $plan.name"
%]
<form method="POST" action="tr_builds.cgi">
<input type="HIDDEN" name="action" value="do_delete">
<input type="HIDDEN" name="build_id" value="[% build.id FILTER none %]">
<input type="hidden" name="plan_id" value="[% plan.id FILTER none %]">
[% IF build.case_run_count %]
<table style="border-collapse:collapse;" border="1" bordercolor="red" width="100%" cellspacing="0" cellpadding="6"><tr><td>
<font color="red">
This build is used by [% build.case_run_count FILTER html %] test case runs.<br>.
It cannot be deleted.<br>
<p>Please press your browsers back button to return to your test plan.</p>
[% tr_error %]</font>
</td></tr></table>
[% ELSE %]
You are about to delete build '[% build.name FILTER html %]' from test plan
[% plan.name FILTER html %]. <br>
<p>
<b>Are you sure?</b>
</p>
<input type="SUBMIT" value="Delete"/>
[% END %]
</form>
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan or
<a href="tr_builds.cgi?plan_id=[% plan.id FILTER none %]">edit</a> builds
</p>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -9,21 +9,28 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[% IF action == 'do_add' %]
[% title = "Create a New Build for $product.name" %]
[% ELSE %]
[% title = "Edit Build $build.name for $product.name" %]
[% END %]
[% PROCESS global/header.html.tmpl %]
[% PROCESS testopia/blocks.html.tmpl %]
<form method="POST" action="tr_builds.cgi" name="form">
<input type="HIDDEN" name="action" value="[% action FILTER none %]"/>
<input type="HIDDEN" name="plan_id" value="[% plan.id FILTER none %]"/>
<input type="hidden" name="action" value="[% action FILTER none %]"/>
<input type="hidden" name="product_id" value="[% product.id FILTER none %]"/>
<input type="hidden" name="plan_id" value="[% plan_id FILTER url_quote %]"/>
<input type="hidden" name="build_id" value="[% build.id FILTER none %]"/>
<table border="0" cellpadding="2" cellspacing="0">
<tr>
@ -34,7 +41,7 @@
<th align="right" valign="top">Milestone: </th>
<td>[% PROCESS select sel = { name => 'milestone',
accesskey => 'm',
list => plan.product.milestones
list => product.milestones
default => build.milestone } %]</td>
<th align="right">Active:</th>
<td width="20"><input type="checkbox" name="isactive" value="1" [% 'checked="checked"' IF build.isactive OR action == 'do_add'%]</td>
@ -47,8 +54,10 @@
<input type="submit" value="Submit">
</form>
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan or
<a href="tr_builds.cgi?plan_id=[% plan.id FILTER none %]">edit</a> builds
[% IF plan_id %]
<a href="tr_show_plan.cgi?plan_id=[% plan_id FILTER url_quote %]">Back</a> to test plan or
[% END %]
<a href="tr_builds.cgi?product_id=[% product.id FILTER none %]&plan_id=[% plan_id FILTER url_quote %]">edit</a> builds
</p>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -11,46 +11,46 @@
#
# The Original Code is the Bugzilla Test Runner System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS global/header.html.tmpl
title = "Product Builds for $plan.product.name"
title = "Product Builds for $product.name"
%]
<table>
<tr>
<th class="bz_row_header" align="right">Name</th>
<th class="bz_row_header" align="right">Milestone</th>
<th class="bz_row_header" align="right">Description</th>
<th class="bz_row_header" align="right">Actions</th>
<tr class="bz_row_header">
<th>Name</th>
<th>Milestone</th>
<th>Description</th>
<th>Visible</th>
<th>Actions</th>
</tr>
[% FOREACH cat = plan.product.builds %]
[% FOREACH b = product.builds %]
<tr>
<td valign="top">[% cat.name FILTER html %]</td>
<td valign="top">[% cat.milestone FILTER html %]</td>
<td valign="top">[% cat.description FILTER html %]</td>
<td valign="top">[% b.name FILTER html %]</td>
<td valign="top">[% b.milestone FILTER html %]</td>
<td valign="top">[% b.description FILTER html %]</td>
<td valign="top">[% b.isactive ? "Yes" : "No" %]</td>
<td valign="top">
<a href="tr_builds.cgi?action=edit&amp;build_id=[% cat.id FILTER none %]&amp;plan_id=[% plan.id FILTER none %]">Edit</a>
[% IF plan.candelete %]
&nbsp;|&nbsp;
<a href="tr_builds.cgi?action=delete&amp;build_id=[% cat.id FILTER none %]&amp;plan_id=[% plan.id FILTER none %]">Delete</a>
[% END %]
<a href="tr_builds.cgi?action=edit&amp;build_id=[% b.id FILTER none %]&amp;product_id=[% product.id FILTER none %]&plan_id=[% plan_id FILTER url_quote %]">Edit</a>
<a href="tr_builds.cgi?action=hide&amp;build_id=[% b.id FILTER none %]&amp;product_id=[% product.id FILTER none %]&plan_id=[% plan_id FILTER url_quote %]">[% b.isactive ? "Hide" : "Unhide" %]</a>
</td>
</tr>
[% END %]
</table>
<br>
[% IF plan.canedit %]
<a href="tr_builds.cgi?action=add&amp;plan_id=[% plan.id FILTER none %]">Add new</a>
[% IF user.in_group('Testers') %]
<a href="tr_builds.cgi?action=add&amp;product_id=[% product_id FILTER html %]&plan_id=[% plan_id FILTER url_quote %]">Add new</a>
[% END %]
[% IF plan_id %]
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan
<a href="tr_show_plan.cgi?plan_id=[% plan_id FILTER html %]">Back</a> to test plan
</p>
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -9,45 +9,35 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS global/header.html.tmpl
title = "Delete Category $category.name From Product $plan.product.name"
title = "Delete Category $category.name From Product $product.name"
%]
<form method="POST" action="tr_categories.cgi">
<input type="HIDDEN" name="action" value="do_delete">
<input type="HIDDEN" name="category_id" value="[% category.id FILTER none %]">
<input type="hidden" name="action" value="do_delete">
<input type="hidden" name="category_id" value="[% category.id FILTER none %]">
<input type="hidden" name="plan_id" value="[% plan.id FILTER none %]">
[% IF category.case_count %]
<table style="border-collapse:collapse;" border="1" bordercolor="red" width="100%" cellspacing="0" cellpadding="6"><tr><td>
<font color="red">
<input type="hidden" name="product_id" value="[% product.id FILTER none %]"/>
This category is used by [% category.casecount FILTER html %] test cases.<br>
Please move all test cases to other categories first.
[% tr_error %]</font>
</td></tr></table>
[% ELSE %]
You are about to delete category '[% category.name FILTER html %]' from test plan
[% plan.name FILTER html %]. <br>
<p>
<b>Are you sure?</b>
</p>
You are about to delete category '[% category.name FILTER html %]' from product
[% product.name FILTER html %]. <br>
<p><b>Are you sure?</b></p>
<input type="SUBMIT" value="Delete"/>
[% END %]
</form>
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan or
<a href="tr_categories.cgi?plan_id=[% plan.id FILTER none %]">edit</a> categories
[% IF plan_id %]
<a href="tr_show_plan.cgi?plan_id=[% plan_id FILTER none %]">Back</a> to test plan or
[% END %]
<a href="tr_categories.cgi?plan_id=[% plan_id FILTER none %]&amp;product_id=[% product.id FILTER none %]">edit</a> categories
</p>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -9,20 +9,27 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[% IF action == 'do_add' %]
[% title = "Create a New Category for $product.name" %]
[% ELSE %]
[% title = "Edit Category $category.name for $product.name" %]
[% END %]
[% PROCESS global/header.html.tmpl %]
<form method="POST" action="tr_categories.cgi" name="form">
<input type="HIDDEN" name="action" value="[% action FILTER none %]"/>
<input type="HIDDEN" name="plan_id" value="[% plan.id FILTER none %]"/>
<input type="hidden" name="action" value="[% action FILTER none %]"/>
<input type="hidden" name="plan_id" value="[% plan_id FILTER none %]"/>
<input type="hidden" name="product_id" value="[% product.id FILTER none %]"/>
<input type="hidden" name="category_id" value="[% category.id FILTER none %]"/>
<table border="0" cellpadding="2" cellspacing="0">
<tr>
@ -37,8 +44,10 @@
<input type="submit" value="Submit">
</form>
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan or
<a href="tr_categories.cgi?plan_id=[% plan.id FILTER none %]">edit</a> categories
[% IF plan_id %]
<a href="tr_show_plan.cgi?plan_id=[% plan_id FILTER url_quote %]">Back</a> to test plan or
[% END %]
<a href="tr_categories.cgi?plan_id=[% plan_id FILTER none %]&product_id=[% product.id FILTER none %]">edit</a> categories
</p>
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -9,44 +9,45 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
#%]
[% PROCESS global/header.html.tmpl
title = "Test Categories for $plan.product.name"
title = "Test Categories for $product.name"
%]
<table>
<tr>
<th class="bz_row_header" align="right">Name</th>
<th class="bz_row_header" align="right">Description</th>
<th class="bz_row_header" align="right">Actions</th>
<tr class="bz_row_header">
<th>Name</th>
<th>Description</th>
<th>Actions</th>
</tr>
[% FOREACH cat = plan.product.categories %]
[% FOREACH cat = product.categories %]
<tr>
<td valign="top">[% cat.name FILTER html %]</td>
<td valign="top">[% cat.description FILTER html %]</td>
<td valign="top">
<a href="tr_categories.cgi?action=edit&amp;category_id=[% cat.id FILTER none %]&amp;plan_id=[% plan.id FILTER none %]">Edit</a>
[% IF plan.candelete %]
<a href="tr_categories.cgi?action=edit&amp;category_id=[% cat.id FILTER none %]&amp;plan_id=[% plan_id FILTER none %]&amp;product_id=[% product.id FILTER none %]">Edit</a>
[% IF cat.candelete %]
&nbsp;|&nbsp;
<a href="tr_categories.cgi?action=delete&amp;category_id=[% cat.id FILTER none %]&amp;plan_id=[% plan.id FILTER none %]">Delete</a>
<a href="tr_categories.cgi?action=delete&amp;category_id=[% cat.id FILTER none %]&amp;plan_id=[% plan_id FILTER none %]&amp;product_id=[% product.id FILTER none %]">Delete</a>
[% END %]
</td>
</tr>
[% END %]
</table>
<br>
[% IF plan.canedit %]
<a href="tr_categories.cgi?action=add&amp;plan_id=[% plan.id FILTER none %]">Add new</a>
[% IF user.in_group('Testers') %]
<a href="tr_categories.cgi?action=add&amp;plan_id=[% plan_id FILTER none %]&amp;product_id=[% product.id FILTER none %]">Add new</a>
[% END %]
[% IF plan_id %]
<p>
<a href="tr_show_plan.cgi?plan_id=[% plan.id FILTER none %]">Back</a> to test plan
<a href="tr_show_plan.cgi?plan_id=[% plan_id FILTER none %]">Back</a> to test plan
</p>
[% END %]
[% PROCESS global/footer.html.tmpl %]

Просмотреть файл

@ -81,24 +81,6 @@
document.getElementById("remCat").disabled = false;
}
function removeCatBuild(id,item){
if (id == 0)
return;
var choice = confirm("You are about to delete this " + item + ". Continue?");
if (choice == 0)
return;
var myURL = (item == 'category' ? 'tr_categories.cgi' : 'tr_builds.cgi');
document.getElementById("remBuild").disabled = true;
document.getElementById("remCat").disabled = true;
dojo.io.bind({
url: myURL,
content: { category_id: id, build_id: id, plan_id: [% plan.id FILTER none %], action: 'do_delete', ajax: 1 },
load: function(type, data, evt){ fillSelects(data, item);},
error: function(type, error){ alert("ERROR Removing Category or Build " + String(error));},
mimetype: "text/xml"
});
}
function updateCaseList(order, direction){
dojo.io.bind({
url: 'tr_show_plan.cgi',
@ -162,7 +144,9 @@
<input type="submit" name="action" value="Commit" style="visibility:hidden;">
<input type="submit" name="action" value="[% plan.isactive ? "Archive" : "Unarchive" %]">
<input type="submit" name="action" value="History">
[% IF user.in_group('Testers'); %]
<input type="submit" name="action" value="Clone">
[% END %]
<input type="submit" name="action" value="Print">
[% IF plan.candelete %]
<input type="submit" name="action" value="Delete">
@ -178,9 +162,9 @@
<div id="plan_categories">
<table width="100%" border="0">
<tr class="bz_row_header">
<th><a href="tr_categories.cgi?plan_id=[% plan.id FILTER none %]" target="_blank">Categories</a></th>
<th><a href="tr_categories.cgi?plan_id=[% plan.id FILTER none %]&product_id=[% plan.product.id FILTER none %]">Categories</a></th>
<th><a href="tr_tags.cgi?plan_id=[% plan.id FILTER none %]">Tags</a></th>
<th><a href="tr_builds.cgi?plan_id=[% plan.id FILTER none %]" target="_blank">Builds</a></th>
<th><a href="tr_builds.cgi?product_id=[% plan.product.id FILTER none %]&plan_id=[% plan.id FILTER none %]">Builds</a></th>
</tr>
<tr>
<td align="left">
@ -189,9 +173,6 @@
accesskey => 'c'
elements => 7 } %]
<br>
[% IF plan.candelete %]
<input type="button" value="Remove" id="remCat" onClick='removeCatBuild(document.getElementById("category").value, "category")'>
[% END %]
</td>
<td valign="top" align="center" rowspan="2">
@ -208,15 +189,12 @@
accesskey => 'b'
elements => 7 } %]
<br>
[% IF plan.candelete %]
<input type="button" value="Remove" id="remBuild" onClick='removeCatBuild(document.getElementById("build").value, "build")'>
[% END %]
</td>
</tr>
<tr>
<td align="left"><a href="tr_categories.cgi?plan_id=[% plan.id FILTER none %]&action=add" target="_blank">Add</a></p></td>
<td align="right"><a href="tr_builds.cgi?plan_id=[% plan.id FILTER none %]&action=add" target="_blank">Add</a></p></td>
<td align="left"><a href="tr_categories.cgi?product_id=[% plan.product.id FILTER none %]&plan_id=[% plan.id FILTER none %]&action=add">Add</a></p></td>
<td align="right"><a href="tr_builds.cgi?product_id=[% plan.product.id FILTER none %]&plan_id=[% plan.id FILTER none %]&action=add">Add</a></p></td>
</tr>
</table>
</div>

Просмотреть файл

@ -14,17 +14,14 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
use strict;
use lib ".";
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
@ -32,18 +29,18 @@ use Bugzilla::Util;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::Util;
use vars qw($vars);
my $template = Bugzilla->template;
Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
ThrowUserError("testopia-read-only", {'object' => 'plan type'}) unless Bugzilla->user->in_group('admin');
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $plan = Bugzilla::Testopia::TestPlan->new({'plan_id' => 0});
use vars qw($vars);
Bugzilla->login(LOGIN_REQUIRED);
print $cgi->header;
ThrowUserError("testopia-read-only", {'object' => 'admin pages'}) unless Bugzilla->user->in_group('admin');
my $plan = Bugzilla::Testopia::TestPlan->new({});
my $action = $cgi->param('action') || '';
my $item = $cgi->param('item') || '';

Просмотреть файл

@ -14,8 +14,8 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Michael Hight <mjhight@gmail.com>
@ -44,13 +44,12 @@ use JSON;
use Data::Dumper;
Bugzilla->login(LOGIN_REQUIRED);
Bugzilla->batch(1);
my $cgi = Bugzilla->cgi;
use vars qw($vars $template);
my $template = Bugzilla->template;
use vars qw($vars);
print $cgi->header;
my $action = $cgi->param('action') || '';
@ -334,7 +333,7 @@ sub do_edit_category{
trick_taint($name);
detaint_natural($product_id);
bugzilla->batch(1);
eval{
validate_selection($product_id, 'id', 'products');
};
@ -409,7 +408,7 @@ sub do_edit_property{
trick_taint($name);
detaint_natural($element_id);
bugzilla->batch(1);
eval{
validate_selection($element_id, 'element_id', 'test_environment_element');
};

Просмотреть файл

@ -11,16 +11,15 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
use Bugzilla;
@ -32,67 +31,64 @@ use Bugzilla::Testopia::Attachment;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
require "globals.pl";
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
Bugzilla->login();
use vars qw($vars $template);
my $template = Bugzilla->template;
Bugzilla->login(LOGIN_REQUIRED);
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $action = $cgi->param('action') || '';
my $attach_id = $cgi->param('attach_id');
my $plan_id = $cgi->param('plan_id');
my $case_id = $cgi->param('case_id');
my $action = $cgi->param('action') || '';
my $attach_id = $cgi->param('attach_id');
my $plan_id = $cgi->param('plan_id');
my $case_id = $cgi->param('case_id');
my $caserun_id = $cgi->param('caserun_id');
detaint_natural($attach_id);
detaint_natural($plan_id);
detaint_natural($case_id);
detaint_natural($caserun_id);
detaint_natural($attach_id) if $attach_id;
unless ($attach_id && ($plan_id || $case_id || $caserun_id)){
unless ($attach_id){
print $cgi->header();
$template->process("testopia/attachment/choose.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
}
validate_test_id($attach_id,'attachment');
my $attachment = Bugzilla::Testopia::Attachment->new($attach_id);
my $obj;
if ($plan_id){
detaint_natural($plan_id);
$obj = Bugzilla::Testopia::TestPlan->new($plan_id);
}
elsif ($case_id){
detaint_natural($case_id);
$obj = Bugzilla::Testopia::TestCase->new($case_id);
}
elsif ($caserun_id){
detaint_natural($caserun_id);
$obj = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
}
unless ($obj->canview){
print $cgi->header;
ThrowUserError('testopia-permission-denied', {'object' => 'Attachment'});
exit;
}
##################
### Edit ###
##################
if ($action eq 'edit'){
Bugzilla->login(LOGIN_REQUIRED);
my $attachment = validate();
$vars->{'attachment'} = validate();
print $cgi->header;
ThrowUserError('testopia-permission-denied', {'object' => 'Attachment'}) unless $attachment->canedit;
$vars->{'attachment'} = $attachment;
$vars->{'isviewable'} = $attachment->isViewable($cgi);
$vars->{'obj'} = $obj;
print $cgi->header();
$template->process("testopia/attachment/show.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_edit') {
Bugzilla->login(LOGIN_REQUIRED);
my $attachment = validate();
print $cgi->header;
ThrowUserError('testopia-permission-denied', {'object' => 'Attachment'}) unless $attachment->canedit;
my %newvalues = (
'description' => $cgi->param('description') || '',
'filename' => $cgi->param('filename'),
@ -100,7 +96,6 @@ elsif ($action eq 'do_edit') {
);
$attachment->update(\%newvalues);
print $cgi->header();
$vars->{'attachment'} = $attachment;
$vars->{'tr_message'} = "Attachment updated";
$vars->{'backlink'} = $obj;
@ -110,25 +105,28 @@ elsif ($action eq 'do_edit') {
|| ThrowTemplateError($template->error());
}
####################
### Delete ###
### Unlink ###
####################
elsif ($action eq 'delete') {
Bugzilla->login(LOGIN_REQUIRED);
my $attachment = validate();
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
$vars->{'attachment'} = validate();
elsif ($action eq 'remove') {
print $cgi->header;
ThrowUserError('testopia-missing-parameter', {'param' => 'case_id or plan_id'}) unless $obj;
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $obj->canedit;
$vars->{'attachment'} = $attachment;
$vars->{'action'} = 'do_remove';
$vars->{'obj'} = $obj;
print $cgi->header();
$template->process("testopia/attachment/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete') {
Bugzilla->login(LOGIN_REQUIRED);
my $attachment = validate();
elsif ($action eq 'do_remove') {
print $cgi->header;
$vars->{'tr_message'} = "Attachment ". $attachment->description ." deleted";
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
ThrowUserError('testopia-missing-parameter', {'param' => 'case_id or plan_id'}) unless $obj;
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $obj->canedit;
if ($plan_id){
$attachment->unlink_plan($plan_id);
}
@ -136,21 +134,45 @@ elsif ($action eq 'do_delete') {
$attachment->unlink_plan($case_id);
}
print $cgi->header();
$vars->{'tr_message'} = "Attachment deleted";
$vars->{'tr_message'} = "Attachment removed";
$vars->{'backlink'} = $obj;
$vars->{'deleted'} = 1;
$template->process("testopia/attachment/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
####################
### Delete ###
####################
elsif ($action eq 'delete') {
print $cgi->header;
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
$vars->{'attachment'} = $attachment;
$vars->{'action'} = 'do_delete';
$template->process("testopia/attachment/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete') {
print $cgi->header;
$vars->{'tr_message'} = "Attachment ". $attachment->description ." deleted";
ThrowUserError('testopia-no-delete', {'object' => 'Attachment'}) unless $attachment->candelete;
$attachment->obliterate;
$vars->{'tr_message'} = "Attachment deleted";
$vars->{'deleted'} = 1;
$template->process("testopia/attachment/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
################
### View ###
################
else {
Bugzilla->login();
validate_test_id($attach_id,'attachment');
my $attachment = Bugzilla::Testopia::Attachment->new($attach_id);
my $filename = $attachment->filename;
$filename =~ s/\\/\\\\/g; # escape backslashes
$filename =~ s/"/\\"/g; # escape quotes
@ -161,13 +183,3 @@ else {
print $attachment->contents;
}
#######################
### Helper Subs ###
#######################
sub validate {
validate_test_id($attach_id,'attachment');
my $attachment = Bugzilla::Testopia::Attachment->new($attach_id);
ThrowUserError('testopia-read-only', {'object' => 'Case'}) unless $obj->canedit;
return $attachment;
}

Просмотреть файл

@ -11,11 +11,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -35,32 +35,30 @@ use Bugzilla::Testopia::Util;
Bugzilla->login(LOGIN_REQUIRED);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
print $cgi->header;
use vars qw($vars $template);
my $template = Bugzilla->template;
ThrowUserError('testopia-read-only', {'object' => 'Build'}) unless Bugzilla->user->in_group("Testers");
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $action = $cgi->param('action');
my $plan_id = $cgi->param('plan_id');
my $action = $cgi->param('action') || '';
my $product_id = $cgi->param('product_id');
ThrowUserError("testopia-missing-parameter", {param => "plan_id"}) unless $plan_id;
detaint_natural($plan_id);
validate_test_id($plan_id, 'plan');
ThrowUserError("testopia-missing-parameter", {param => "product_id"}) unless $product_id;
my $product = Bugzilla::Testopia::Product->new($product_id);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError('testopia-read-only', {'object' => 'Plan'}) unless $plan->canedit;
$vars->{'plan_id'} = $cgi->param('plan_id');
$vars->{'product'} = $product;
######################
### Create a Build ###
######################
if ($action eq 'add'){
$vars->{'plan'} = $plan;
$vars->{'action'} = 'do_add';
$vars->{'title'} = "Create a New Build for ". $plan->name;
$template->process("testopia/build/form.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
@ -70,26 +68,24 @@ elsif ($action eq 'do_add'){
my $desc = $cgi->param('desc');
my $tm = $cgi->param('milestone');
# Since these are passed to the database using placeholders,
# we are safe using trick_taint
trick_taint($cname);
trick_taint($desc);
trick_taint($tm);
my $build = Bugzilla::Testopia::Build->new({
product_id => $plan->product_id,
name => $cname,
description => $desc,
milestone => $tm,
isactive => $cgi->param('isactive') ? 1 : 0,
});
product_id => $product->id,
name => $cname,
description => $desc,
milestone => $tm,
isactive => $cgi->param('isactive') ? 1 : 0,
});
ThrowUserError('testopia-name-not-unique',
{'object' => 'Build',
'name' => $cname}) if $build->check_name($cname);
$build->store;
$vars->{'tr_message'} = "Build successfully added";
display($plan);
display();
}
@ -98,26 +94,20 @@ elsif ($action eq 'do_add'){
####################
elsif ($action eq 'edit'){
my $build = Bugzilla::Testopia::Build->new($cgi->param('build_id'));
$vars->{'plan'} = $plan;
$vars->{'build'} = $build;
$vars->{'action'} = 'do_edit';
$vars->{'title'} = "Edit Build ". $build->name ." for ". $plan->name;
$template->process("testopia/build/form.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_edit'){
my $dbh = Bugzilla->dbh;
my $cname = $cgi->param('name');
my $desc = $cgi->param('desc');
my $milestone = $cgi->param('milestone');
my $bid = $cgi->param('build_id');
my $build = Bugzilla::Testopia::Build->new($bid);
detaint_natural($bid);
# Since these are passed to the database using placeholders,
# we are safe using trick_taint
trick_taint($cname);
trick_taint($desc);
trick_taint($milestone);
@ -130,74 +120,29 @@ elsif ($action eq 'do_edit'){
'name' => $cname}) if ($orig_id && $orig_id != $bid);
$build->update($cname, $desc, $milestone, $cgi->param('isactive') ? 1 : 0);
# Search.pm thinks we are searching for a build_id
$cgi->delete('build_id');
$vars->{'tr_message'} = "Build successfully updated";
display($plan);
display();
}
######################
### Delete a Build ###
######################
elsif ($action eq 'delete'){
my $build = Bugzilla::Testopia::Build->new($cgi->param('build_id'));
$vars->{'plan'} = $plan;
$vars->{'build'} = $build;
$template->process("testopia/build/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
elsif ($action eq 'hide' || $action eq 'unhide'){
my $bid = $cgi->param('build_id');
my $build = Bugzilla::Testopia::Build->new($bid);
$build->toggle_hidden;
display();
}
elsif ($action eq 'do_delete'){
my $build = Bugzilla::Testopia::Build->new($cgi->param('build_id'));
if ($build->case_run_count){
if ($cgi->param('ajax')){
print "<return><error><text>This Build has test runs associated with it.";
print "It can not be removed</text></error></return>";
exit;
} else {
ThrowUserError("testopia-non-zero-run-count", {'object' => 'Build'});
}
}
$build->remove($plan);
# If this is from tr_show_plan.cgi we just need the values
if ($cgi->param('ajax')){
my $xml = get_builds_xml($plan);
print $xml;
exit;
}
$vars->{'tr_message'} = "Build successfully removed";
display($plan);
}
########################
### View plan Builds ###
########################
else {
display($plan);
display();
}
###################
### Helper Subs ###
###################
sub get_builds_xml {
my ($plan) = @_;
my $ret = "<items>";
foreach my $c (@{$plan->product->builds}){
$ret .= "<build>";
$ret .= "<id>". $c->id ."</id>";
$ret .= "<name>". $c->name ."</name>";
$ret .= "</build>";
}
$ret .= "</items>";
return $ret;
}
sub display{
my $plan = shift;
$vars->{'plan'} = $plan;
$template->process("testopia/build/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}

Просмотреть файл

@ -11,15 +11,15 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Maciej Maczynski are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Maciej Maczynski <macmac@xdsnet.pl>
# Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Portions taken from Bugzilla reports by Gervase Markham <gerv@gerv.net>
use strict;
use lib ".";
@ -32,11 +32,11 @@ use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Report;
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $type = $cgi->param('type') || '';
@ -53,6 +53,7 @@ if ($type eq 'status-breakdown'){
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $case = Bugzilla::Testopia::TestCase->new($case_id);
exit unless $case->canview;
my @data;
my $caserun = Bugzilla::Testopia::TestCaseRun->new({});

Просмотреть файл

@ -11,15 +11,15 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Maciej Maczynski <macmac@xdsnet.pl>
# Ed Fuentetaja <efuentetaja@acm.org>
# Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Portions taken from Bugzilla reports by Gervase Markham <gerv@gerv.net>
use strict;
use lib ".";
@ -32,11 +32,11 @@ use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Report;
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $type = $cgi->param('type') || '';

Просмотреть файл

@ -11,11 +11,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -35,30 +35,30 @@ use Bugzilla::Testopia::Util;
Bugzilla->login(LOGIN_REQUIRED);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
print $cgi->header;
use vars qw($vars $template);
my $template = Bugzilla->template;
ThrowUserError('testopia-read-only', {'object' => 'Build'}) unless Bugzilla->user->in_group("Testers");
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $action = $cgi->param('action') || '';
my $plan_id = $cgi->param('plan_id');
ThrowUserError("testopia-missing-parameter", {param => "plan_id"}) unless $plan_id;
detaint_natural($plan_id);
validate_test_id($plan_id, 'plan');
my $product_id = $cgi->param('product_id');
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'Plan'}) unless $plan->canedit;
ThrowUserError("testopia-missing-parameter", {param => "product_id"}) unless $product_id;
my $product = Bugzilla::Testopia::Product->new($product_id);
$vars->{'plan_id'} = $cgi->param('plan_id');
$vars->{'product'} = $product;
#########################
### Create a Category ###
#########################
if ($action eq 'add'){
$vars->{'plan'} = $plan;
$vars->{'action'} = 'do_add';
$vars->{'title'} = "Create a New Category for ". $plan->product->name;
$template->process("testopia/category/form.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
@ -67,13 +67,11 @@ elsif ($action eq 'do_add'){
my $cname = $cgi->param('name');
my $desc = $cgi->param('desc');
# Since these are passed to the database using placeholders,
# we are safe using trick_taint
trick_taint($cname);
trick_taint($desc);
my $category = Bugzilla::Testopia::Category->new({
product_id => $plan->product_id,
product_id => $product->id,
name => $cname,
description => $desc
});
@ -83,9 +81,7 @@ elsif ($action eq 'do_add'){
$category->store;
$vars->{'tr_message'} = "Category successfully added";
display($plan);
display();
}
#######################
@ -93,24 +89,18 @@ elsif ($action eq 'do_add'){
#######################
elsif ($action eq 'edit'){
my $category = Bugzilla::Testopia::Category->new($cgi->param('category_id'));
$vars->{'plan'} = $plan;
$vars->{'category'} = $category;
$vars->{'action'} = 'do_edit';
$vars->{'title'} = "Edit Category ". $category->name ." for ". $plan->name;
$template->process("testopia/category/form.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_edit'){
my $dbh = Bugzilla->dbh;
my $cname = $cgi->param('name');
my $desc = $cgi->param('desc');
my $cid = $cgi->param('category_id');
detaint_natural($cid);
my $category = Bugzilla::Testopia::Category->new($cid);
# Since these are passed to the database using placeholders,
# we are safe using trick_taint
trick_taint($cname);
trick_taint($desc);
@ -122,7 +112,7 @@ elsif ($action eq 'do_edit'){
$category->update($cname, $desc);
$vars->{'tr_message'} = "Category successfully updated";
display($plan);
display();
}
@ -131,58 +121,31 @@ elsif ($action eq 'do_edit'){
#########################
elsif ($action eq 'delete'){
my $category = Bugzilla::Testopia::Category->new($cgi->param('category_id'));
$vars->{'plan'} = $plan;
ThrowUserError("testopia-non-zero-case-count") unless $category->candelete;
$vars->{'category'} = $category;
$template->process("testopia/category/delete.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
my $category = Bugzilla::Testopia::Category->new($cgi->param('category_id'));
if ($category->case_count){
if ($cgi->param('ajax')){
print "<return><error><text>This category has test cases associated with it. ";
print "Please move them to another category before deleting this one.</text></error></return>";
exit;
} else {
ThrowUserError("testopia-non-zero-case-count");
}
}
$category->remove($plan);
# If this is from tr_show_plan.cgi we just need the values
if ($cgi->param('ajax')){
my $xml = get_categories_xml($plan);
print $xml;
exit;
}
ThrowUserError("testopia-non-zero-case-count") unless $category->candelete;
$category->remove;
$vars->{'tr_message'} = "Category successfully removed";
display($plan);
display();
}
############################
### View plan Categories ###
############################
else {
display($plan);
display();
}
sub get_categories_xml {
my ($plan) = @_;
my $ret = "<items>";
foreach my $c (@{$plan->product->categories}){
$ret .= "<category>";
$ret .= "<id>". $c->id ."</id>";
$ret .= "<name>". $c->name ."</name>";
$ret .= "</category>";
}
$ret .= "</items>";
return $ret;
}
sub display{
my $plan = shift;
$vars->{'plan'} = $plan;
$template->process("testopia/category/list.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}

Просмотреть файл

@ -11,11 +11,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -23,15 +23,6 @@ use strict;
use lib ".";
use Bugzilla;
use Bugzilla::Util;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Config;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::Build;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use Bugzilla::Testopia::Util;
Bugzilla->login(LOGIN_REQUIRED);
use vars qw($vars);
@ -39,6 +30,7 @@ use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
print $cgi->header;
$vars->{'txt'} = $cgi->param('text');
$template->process("testopia/text.png.tmpl", $vars)
|| ThrowTemplateError($template->error());
$template->process("testopia/text.png.tmpl", $vars)
|| ThrowTemplateError($template->error());

Просмотреть файл

@ -11,12 +11,11 @@
# 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 Original Code is the Bugzilla Testopia 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.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Garrett Braden <garrett@tnbd.org>

Просмотреть файл

@ -11,12 +11,11 @@
# 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 Original Code is the Bugzilla Testopia 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.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Garrett Braden <garrett@tnbd.org>

Просмотреть файл

@ -11,13 +11,13 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
@ -25,6 +25,7 @@ use lib ".";
use Bugzilla;
use Bugzilla::Bug;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Testopia::Search;
@ -33,10 +34,9 @@ use Bugzilla::Testopia::TestCaseRun;
use Bugzilla::Testopia::Table;
use Bugzilla::Testopia::Constants;
use vars qw($vars $template);
use vars qw($vars);
require 'globals.pl';
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $query_limit = 15000;
@ -46,7 +46,8 @@ push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
$cgi->send_cookie(-name => "TEST_LAST_ORDER",
-value => $cgi->param('order'),
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
$vars->{'fullwidth'} = 1;
@ -68,7 +69,6 @@ $::SIG{PIPE} = 'DEFAULT';
my $action = $cgi->param('action') || '';
if ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
# Get the list of checked items. This way we don't have to cycle through
# every test case, only the ones that are checked.
my $reg = qr/r_([\d]+)/;
@ -87,7 +87,8 @@ if ($action eq 'Commit'){
my $progress_interval = 250;
my $i = 0;
my $total = scalar @params;
my @uneditable;
foreach my $p ($cgi->param()){
my $caserun = Bugzilla::Testopia::TestCaseRun->new($1) if $p =~ $reg;
next unless $caserun;
@ -115,8 +116,8 @@ if ($action eq 'Commit'){
trick_taint($notes);
unless ($caserun->canedit){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-read-only", {'object' => 'Case Run', 'id' => $caserun->id});
push @uneditable, $caserun;
next;
}
# Switch to the record representing this build and environment combo.
@ -124,8 +125,11 @@ if ($action eq 'Commit'){
$caserun = $caserun->switch($build,$env);
my $status = $cgi->param('status') == -1 ? $caserun->status_id : $cgi->param('status');
my $assignee = $cgi->param('assignee') eq '--Do Not Change--' ? $caserun->assignee->id : DBNameToIdAndCheck(trim($cgi->param('assignee')));
my $assignee = $cgi->param('assignee') eq '--Do Not Change--' ? $caserun->assignee->id : login_to_id(trim($cgi->param('assignee')));
unless ($assignee){
print $cgi->multipart_end if $serverpush;
ThrowUserError("invalid_username", { name => $cgi->param('assignee') });
}
detaint_natural($status);
$caserun->set_status($status) if ($caserun->status_id != $status);
@ -184,7 +188,6 @@ if ($action eq 'Commit'){
exit;
}
elsif ($action eq 'Delete Selected'){
Bugzilla->login(LOGIN_REQUIRED);
my $reg = qr/r_([\d]+)/;
my @caseruns;
foreach my $p ($cgi->param()){
@ -214,12 +217,11 @@ elsif ($action eq 'Delete Selected'){
exit;
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my @caseruns;
foreach my $id ($cgi->param('caserun_id')){
my $caserun = Bugzilla::Testopia::TestCaseRun->new($id);
push @caseruns, $caserun;
if (!$caserun->candelete){
unless ($caserun->candelete){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-read-only", {'object' => 'case run'});
}
@ -288,7 +290,7 @@ if ($cgi->param('run_id')){
my $case = Bugzilla::Testopia::TestCase->new({'case_id' => 0});
$vars->{'expand_report'} = $cgi->param('expand_report') || 0;
$vars->{'expand_filter'} = $cgi->param('expand_filter') || 0;
$vars->{'dotweak'} = UserInGroup('Testers');
$vars->{'dotweak'} = Bugzilla->user->in_group('Testers');
$vars->{'table'} = $table;
$vars->{'action'} = 'tr_list_caserun.cgi';
$vars->{'caserun'} = Bugzilla::Testopia::TestCaseRun->new({});

Просмотреть файл

@ -11,19 +11,20 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
use Bugzilla;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Testopia::Search;
@ -34,10 +35,10 @@ use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestTag;
use Bugzilla::Testopia::Table;
use vars qw($vars $template);
use vars qw($vars);
require "globals.pl";
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $query_limit = 10000;
@ -47,7 +48,8 @@ push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
$cgi->send_cookie(-name => "TEST_LAST_ORDER",
-value => $cgi->param('order'),
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
# Determine the format in which the user would like to receive the output.
# Uses the default format if the user did not specify an output format;
@ -73,7 +75,6 @@ $::SIG{PIPE} = 'DEFAULT';
### Actions ###
###############
if ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
# Match the list of checked items.
my $reg = qr/c_([\d]+)/;
@ -88,14 +89,15 @@ if ($action eq 'Commit'){
my $progress_interval = 250;
my $i = 0;
my $total = scalar @params;
my @uneditable;
foreach my $p ($cgi->param()){
my $case = Bugzilla::Testopia::TestCase->new($1) if $p =~ $reg;
next unless $case;
unless ($case->canedit){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-read-only", {'object' => 'case', 'id' => $case->id});
push @uneditable, $case;
next;
}
$i++;
@ -118,7 +120,8 @@ if ($action eq 'Commit'){
my @comps = $cgi->param("components");
my $tester = $cgi->param('tester') || '';
if ($tester && $tester ne '--Do Not Change--'){
$tester = DBNameToIdAndCheck(trim($cgi->param('tester')));
$tester = login_to_id(trim($cgi->param('tester')))
|| ThrowUserError("invalid_username", { name => $cgi->param('tester') });
}
else {
$tester = $case->default_tester->id;
@ -230,7 +233,7 @@ if ($action eq 'Commit'){
|| ThrowTemplateError($template->error());
exit;
}
my $case = Bugzilla::Testopia::TestCase->new({ 'case_id' => 0 });
my $case = Bugzilla::Testopia::TestCase->new({});
$vars->{'case'} = $case;
$vars->{'title'} = "Update Successful";
$vars->{'tr_message'} = "$i Test Cases Updated";
@ -243,8 +246,6 @@ if ($action eq 'Commit'){
}
elsif ($action eq 'Delete Selected'){
Bugzilla->login(LOGIN_REQUIRED);
# Match the list of checked items.
my $reg = qr/c_([\d]+)/;
my $params = join(" ", $cgi->param());
@ -254,6 +255,10 @@ elsif ($action eq 'Delete Selected'){
print $cgi->multipart_end if $serverpush;
ThrowUserError('testopia-none-selected', {'object' => 'case'});
}
# You must have rights to delete from all the plans this case
# is linked to in order to delete.
# We separate them here so that users can still remove the ones
# they have rights to.
my @deletable;
my @undeletable;
foreach my $p ($cgi->param()){
@ -278,7 +283,6 @@ elsif ($action eq 'Delete Selected'){
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my @case_ids = split(",", $cgi->param('case_list'));
my $progress_interval = 250;
my $i = 0;
@ -358,7 +362,7 @@ if ($table->list_count > 0 && !$cgi->param('addrun')){
}
}
# create an empty case to use for getting status and priority lists
my $c = Bugzilla::Testopia::TestCase->new({'case_id' => 0 });
my $c = Bugzilla::Testopia::TestCase->new({});
my $status_list = $c->get_status_list;
my $priority_list = $c->get_priority_list;
@ -380,7 +384,7 @@ $vars->{'fullwidth'} = 1; #novellonly
$vars->{'case'} = $c;
$vars->{'status_list'} = $status_list;
$vars->{'priority_list'} = $priority_list;
$vars->{'dotweak'} = UserInGroup('Testers');
$vars->{'dotweak'} = Bugzilla->user->in_group('Testers');
$vars->{'table'} = $table;
$vars->{'urlquerypart'} = $cgi->canonicalise_query('cmdtype');

Просмотреть файл

@ -11,11 +11,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -35,12 +35,12 @@ use Bugzilla::Testopia::Environment::Element;
use Bugzilla::Testopia::Environment::Category;
use Bugzilla::Testopia::Environment::Property;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
print $cgi->header;

Просмотреть файл

@ -11,13 +11,13 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
@ -31,15 +31,13 @@ use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use vars qw($vars $template);
use vars qw($vars);
require "globals.pl";
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $query_limit = 5000;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $serverpush = support_server_push($cgi);
if ($serverpush) {
print $cgi->multipart_init;
@ -57,7 +55,6 @@ $::SIG{PIPE} = 'DEFAULT';
my $action = $cgi->param('action') || '';
if ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
# Get the list of checked items. This way we don't have to cycle through
# every test case, only the ones that are checked.
my $reg = qr/p_([\d]+)/;
@ -71,7 +68,7 @@ if ($action eq 'Commit'){
my $progress_interval = 250;
my $i = 0;
my $total = scalar @params;
my @uneditable;
foreach my $p ($cgi->param()){
my $plan = Bugzilla::Testopia::TestPlan->new($1) if $p =~ $reg;
next unless $plan;
@ -87,8 +84,8 @@ if ($action eq 'Commit'){
}
unless ($plan->canedit){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-read-only", {'object' => 'plan', 'id' => $plan->id});
push @uneditable, $p;
next;
}
my $plan_type = $cgi->param('plan_type') == -1 ? $plan->type_id : $cgi->param('plan_type');
my $product = $cgi->param('product_id') == -1 ? $plan->product_id : $cgi->param('product_id');
@ -154,7 +151,7 @@ else {
$vars->{'type_list'} = $type_list;
$vars->{'fullwidth'} = 1; #novellonly
$vars->{'dotweak'} = UserInGroup('Testers');
$vars->{'dotweak'} = Bugzilla->user->in_group('Testers');
$vars->{'table'} = $table;
if ($serverpush && !$cgi->param('debug')) {
print $cgi->multipart_end;

Просмотреть файл

@ -11,13 +11,13 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
use strict;
use lib ".";
@ -27,20 +27,19 @@ use Bugzilla::Config;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use Bugzilla::Testopia::TestRun;
use vars qw($vars $template);
use vars qw($vars);
require "globals.pl";
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $query_limit = 5000;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $serverpush = support_server_push($cgi);
if ($serverpush) {
print $cgi->multipart_init;
@ -58,7 +57,6 @@ $::SIG{PIPE} = 'DEFAULT';
my $action = $cgi->param('action') || '';
if ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
# Get the list of checked items. This way we don't have to cycle through
# every test case, only the ones that are checked.
my $reg = qr/r_([\d]+)/;
@ -76,7 +74,8 @@ if ($action eq 'Commit'){
my $progress_interval = 250;
my $i = 0;
my $total = scalar @params;
my @uneditable;
foreach my $p ($cgi->param()){
my $run = Bugzilla::Testopia::TestRun->new($1) if $p =~ $reg;
next unless $run;
@ -91,10 +90,14 @@ if ($action eq 'Commit'){
|| ThrowTemplateError($template->error());
}
unless ($run->canedit){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-read-only", {'object' => 'run', 'id' => $run->id});
push @uneditable, $run;
next;
}
my $manager = login_to_id(trim($cgi->param('manager')));
unless ($manager){
print $cgi->multipart_end;
ThrowUserError("invalid_username", { name => $cgi->param('manager') }) if $cgi->param('manager');
}
my $manager = DBNameToIdAndCheck(trim($cgi->param('manager'))) if $cgi->param('manager');
my $status;
if ($cgi->param('run_status')){
if ($cgi->param('run_status') == -1){
@ -178,7 +181,7 @@ else {
$vars->{'status_list'} = $status_list;
$vars->{'fullwidth'} = 1; #novellonly
$vars->{'dotweak'} = UserInGroup('Testers');
$vars->{'dotweak'} = Bugzilla->user->in_group('Testers');
$vars->{'table'} = $table;
if ($serverpush && !$cgi->param('debug')) {
print $cgi->multipart_end;

Просмотреть файл

@ -26,22 +26,21 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestCase;
use JSON;
use vars qw($vars);
require "globals.pl";
use vars qw($template $vars);
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
print $cgi->header;
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
@ -96,7 +95,8 @@ if ($action eq 'Add'){
my $est_time = $cgi->param("estimated_time") || '';
my @comps = $cgi->param("components");
if ($tester){
$tester = DBNameToIdAndCheck($cgi->param('tester'));
$tester = login_to_id(trim($cgi->param('tester')))
|| ThrowUserError("invalid_username", { name => $cgi->param('tester') });
}
ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if $summary eq '';

Просмотреть файл

@ -14,8 +14,8 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Michael Hight <mjhight@gmail.com>

Просмотреть файл

@ -32,33 +32,29 @@ use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::Product;
require "globals.pl";
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
Bugzilla->login(LOGIN_REQUIRED);
ThrowUserError("testopia-create-denied", {'object' => 'Test Plan'}) unless UserInGroup('Testers');
print Bugzilla->cgi->header();
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
print $cgi->header;
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $action = $cgi->param('action');
my $product = $cgi->param('product_id');
my $action = $cgi->param('action') || '';
detaint_natural($product);
if ($action eq 'Add'){
my $product_id = $cgi->param('product_id');
my $product = Bugzilla::Testopia::Product->new($product_id);
ThrowUserError("testopia-create-denied", {'object' => 'Test Plan'}) unless Bugzilla->user->in_group('Testers');
my $name = $cgi->param('plan_name');
my $prodver = $cgi->param('prod_version');
my $type = $cgi->param('type');
my $text = $cgi->param("plandoc");
validate_selection($product, 'id', 'products');
ThrowUserError('testopia-missing-required-field', {'field' => 'name'}) if $name eq '';
# All inserts are done with placeholders so this is OK
@ -68,13 +64,12 @@ if ($action eq 'Add'){
detaint_natural($type);
validate_selection($type, 'type_id', 'test_plan_types');
#TODO: 2.22 use Bugzilla::Product
validate_selection($prodver, 'value', 'versions');
my $version = Bugzilla::Version::check_version($product, $prodver);
my $plan = Bugzilla::Testopia::TestPlan->new({
'name' => $name || '',
'product_id' => $product,
'default_product_version' => $prodver,
'product_id' => $product->id,
'default_product_version' => $version->name,
'type_id' => $type,
'text' => $text,
'author_id' => Bugzilla->user->id,
@ -122,7 +117,6 @@ elsif ($action eq 'getversions'){
}
# For use in new_case and show_case since new_plan does not require an id
elsif ($action eq 'getcomps'){
Bugzilla->login;
my $plan = Bugzilla::Testopia::TestPlan->new({});
my $product_id = $cgi->param('product_id');
@ -143,12 +137,11 @@ elsif ($action eq 'getcomps'){
exit;
}
elsif ($action eq 'getenvs'){
Bugzilla->login;
my $product_id = $cgi->param('product_id');
detaint_natural($product_id);
my $product = Bugzilla::Testopia::Product->new($product_id);
exit unless Bugzilla->user->can_see_product($product->name);
my @envs;
foreach my $e (@{$product->environments}){
push @envs, {'id' => $e->id, 'name' => $e->name};
@ -161,11 +154,12 @@ elsif ($action eq 'getenvs'){
### Display Form ###
####################
else {
ThrowUserError("testopia-create-denied", {'object' => 'Test Plan'}) unless Bugzilla->user->in_group('Testers');
$vars->{'action'} = "Add";
$vars->{'form_action'} = "tr_new_plan.cgi";
$vars->{'plan'} = Bugzilla::Testopia::TestPlan->new(
{'plan_id' => 0,
'product_id' => $product});
'product_id' => $cgi->param('product_id')});
$template->process("testopia/plan/add.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}

Просмотреть файл

@ -26,26 +26,27 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
require "globals.pl";
require 'globals.pl';
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $query_limit = 10000;
Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
my $action = $cgi->param('action') || '';
my $plan_id = $cgi->param('plan_id');
unless ($plan_id){
$vars->{'form_action'} = 'tr_new_run.cgi';
print $cgi->header;
@ -64,7 +65,7 @@ unless ($plan->canedit){
ThrowUserError("testopia-create-denied", {'object' => 'Test Run'});
}
unless (scalar @{$plan->product->builds(1)} >0){
unless (scalar @{$plan->product->builds(1)} > 0){
print $cgi->header;
ThrowUserError('testopia-create-build', {'plan' => $plan});
}
@ -79,7 +80,7 @@ if ($action eq 'Add'){
|| ThrowTemplateError($template->error());
}
my $manager = DBNameToIdAndCheck($cgi->param('manager'));
my $manager = login_to_id(trim($cgi->param('manager')));
my $status = $cgi->param('status');
my $prodver = $cgi->param('product_version');
my $pversion = $cgi->param('plan_version');
@ -95,6 +96,10 @@ if ($action eq 'Add'){
print $cgi->multipart_end if $serverpush;
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'});
}
unless ($manager){
print $cgi->multipart_end if $serverpush;
ThrowUserError("invalid_username", { name => $cgi->param('assignee') });
}
validate_test_id($env, 'environment');
@ -179,7 +184,7 @@ if ($action eq 'Add'){
$vars->{'table'} = $table;
$vars->{'action'} = 'Commit';
$vars->{'form_action'} = 'tr_show_run.cgi';
$vars->{'tr_message'} = "Test Case: \"". $run->summary ."\" created successfully.";
$vars->{'tr_message'} = "Test Run: \"". $run->summary ."\" created successfully.";
$vars->{'backlink'} = $run;
$template->process("testopia/run/show.html.tmpl", $vars) ||
ThrowTemplateError($template->error());

Просмотреть файл

@ -14,7 +14,7 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2007
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -63,18 +63,16 @@ if ($action eq 'Apply Changes'){
elsif ($action eq 'Add User'){
do_update();
my $userid = DBNameToIdAndCheck(trim($cgi->param('adduser')));
my $userid = Bugzilla->user->login_to_id(trim($cgi->param('adduser'))) || ThrowUserError("invalid_username", { name => $cgi->param('adduser')});
ThrowUserError('testopia-tester-already-on-list', {'login' => $cgi->param('adduser')})
if ($plan->check_tester($userid));
my $perms = 0;
# The order we check these is important since each permission
# implies the prior ones.
$perms |= TR_READ if $cgi->param("nr");
$perms |= TR_WRITE if $cgi->param("nw");
$perms |= TR_DELETE if $cgi->param("nd");
$perms |= TR_ADMIN if $cgi->param("na");
$perms |= TR_READ | TR_WRITE if $cgi->param("nw");
$perms |= TR_READ | TR_WRITE | TR_DELETE if $cgi->param("nd");
$perms |= TR_READ | TR_WRITE | TR_DELETE | TR_ADMIN if $cgi->param("na");
detaint_natural($perms);
$plan->add_tester($userid, $perms);
@ -104,12 +102,11 @@ sub do_update {
my $regexp_perms = 0;
# The order we check these is important since each permission
# implies the prior ones.
# Each permission implies the prior ones.
$regexp_perms |= TR_READ if $cgi->param('pr');
$regexp_perms |= TR_WRITE if $cgi->param('pw');
$regexp_perms |= TR_DELETE if $cgi->param('pd');
$regexp_perms |= TR_ADMIN if $cgi->param('pa');
$regexp_perms |= TR_READ | TR_WRITE if $cgi->param('pw');
$regexp_perms |= TR_READ | TR_WRITE | TR_DELETE if $cgi->param('pd');
$regexp_perms |= TR_READ | TR_WRITE | TR_DELETE | TR_ADMIN if $cgi->param('pa');
detaint_natural($regexp_perms);
$plan->set_tester_regexp($tester_regexp, $regexp_perms);
@ -117,12 +114,10 @@ sub do_update {
foreach my $row (@{$plan->access_list}){
my $perms = 0;
# The order we check these is important since each permission
# implies the prior ones.
$perms |= TR_READ if $cgi->param('r'.$row->{'user'}->id);
$perms |= TR_WRITE if $cgi->param('w'.$row->{'user'}->id);
$perms |= TR_DELETE if $cgi->param('d'.$row->{'user'}->id);
$perms |= TR_ADMIN if $cgi->param('a'.$row->{'user'}->id);
$perms |= TR_READ | TR_WRITE if $cgi->param('w'.$row->{'user'}->id);
$perms |= TR_READ | TR_WRITE | TR_DELETE if $cgi->param('d'.$row->{'user'}->id);
$perms |= TR_READ | TR_WRITE | TR_DELETE | TR_ADMIN if $cgi->param('a'.$row->{'user'}->id);
detaint_natural($perms);
$plan->update_tester($row->{'user'}->id, $perms);

Просмотреть файл

@ -14,8 +14,8 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -29,13 +29,11 @@ use Bugzilla::Util;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Report;
require "globals.pl";
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $type = $cgi->param('type') || '';

Просмотреть файл

@ -37,14 +37,14 @@ use Bugzilla::Testopia::Environment::Property;
use JSON;
use vars qw($vars $template);
require "globals.pl";
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
sub get_searchable_objects{
my $object = shift;
@ -239,7 +239,7 @@ elsif ($action eq 'get_valid_exp'){
print $ret;
}
elsif ($action eq 'save_query'){
Bugzilla->login(LOGIN_REQUIRED);
;
my $query = $cgi->param('query_part');
my $qname = $cgi->param('query_name');

Просмотреть файл

@ -35,7 +35,7 @@ use JSON;
use vars qw($vars);
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;

Просмотреть файл

@ -14,8 +14,8 @@
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2001
# Greg Hendricks. All Rights Reserved.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -30,11 +30,11 @@ use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Report;
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $type = $cgi->param('type') || '';

Просмотреть файл

@ -26,6 +26,7 @@ use lib ".";
use Bugzilla;
use Bugzilla::Bug;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Error;
use Bugzilla::Constants;
use Bugzilla::Testopia::Util;
@ -37,12 +38,14 @@ use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use JSON;
use vars qw($template $vars);
require 'globals.pl';
use vars qw($vars);
my $template = Bugzilla->template;
my $query_limit = 15000;
require "globals.pl";
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@ -80,9 +83,8 @@ $vars->{'action'} = "Commit";
$vars->{'form_action'} = "tr_show_case.cgi";
if ($action eq 'Clone'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-create-denied", {'object' => 'Test Case'}) unless $case->canedit;
ThrowUserError("testopia-create-denied", {'object' => 'Test Case'}) unless $case->canview;
do_update($case);
$vars->{'case'} = $case;
$template->process("testopia/case/clone.html.tmpl", $vars) ||
@ -91,9 +93,7 @@ if ($action eq 'Clone'){
}
elsif ($action eq 'do_clone'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-create-denied", {'object' => 'Test Case'}) unless $case->canedit;
my $count = 0;
my $method;
if ($cgi->param('copymethod') eq 'copy'){
@ -114,6 +114,8 @@ elsif ($action eq 'do_clone'){
my $newcase;
foreach my $pid (@planids){
$count++;
my $plan = Bugzilla::Testopia::TestPlan->new($pid);
next unless $plan->canedit;
my $newcaseid = $case->copy($pid, $author, $cgi->param('copy_doc'));
$case->link_plan($pid, $newcaseid);
$newcase = Bugzilla::Testopia::TestCase->new($newcaseid);
@ -154,6 +156,8 @@ elsif ($action eq 'do_clone'){
}
foreach my $p (keys %seen){
$count++;
my $plan = Bugzilla::Testopia::TestPlan->new($p);
next unless $plan->canedit;
$case->link_plan($p);
}
delete $case->{'plans'};
@ -166,7 +170,6 @@ elsif ($action eq 'do_clone'){
}
elsif ($action eq 'Attach'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
@ -202,7 +205,6 @@ elsif ($action eq 'Attach'){
}
elsif ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
do_update($case);
@ -224,7 +226,6 @@ elsif ($action eq 'History'){
}
elsif ($action eq 'unlink'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan_id = $cgi->param('plan_id');
validate_test_id($plan_id, 'plan');
my $case = Bugzilla::Testopia::TestCase->new($case_id);
@ -248,7 +249,6 @@ elsif ($action eq 'unlink'){
}
elsif ($action eq 'do_unlink'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan_id = $cgi->param('plan_id');
validate_test_id($plan_id, 'plan');
my $case = Bugzilla::Testopia::TestCase->new($case_id);
@ -264,7 +264,6 @@ elsif ($action eq 'do_unlink'){
}
elsif ($action eq 'detach_bug'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
my @buglist;
@ -278,7 +277,6 @@ elsif ($action eq 'detach_bug'){
display(Bugzilla::Testopia::TestCase->new($case_id));
}
elsif ($action eq 'Delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->candelete;
$vars->{'case'} = $case;
@ -290,7 +288,6 @@ elsif ($action eq 'Delete'){
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->candelete;
$case->obliterate;
@ -302,7 +299,6 @@ elsif ($action eq 'do_delete'){
### Ajax Actions ###
####################
elsif ($action eq 'addcomponent' || $action eq 'removecomponent'){
Bugzilla->login(LOGIN_REQUIRED);
my $case = Bugzilla::Testopia::TestCase->new($case_id);
ThrowUserError("testopia-read-only", {'object' => 'case'}) unless $case->canedit;
my $comp = $cgi->param('component_id');
@ -360,7 +356,7 @@ sub do_update{
my $tester = $cgi->param("tester") || '';
my $est_time = $cgi->param("estimated_time") || '';
if ($tester){
$tester = DBNameToIdAndCheck($cgi->param('tester'));
$tester = login_to_id(trim($cgi->param('tester'))) || ThrowUserError("invalid_username", { name => $cgi->param('tester') });
}
ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if $summary eq '';

Просмотреть файл

@ -27,6 +27,7 @@ use Bugzilla::Bug;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::User;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
@ -34,13 +35,13 @@ use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestCase;
use Bugzilla::Testopia::TestCaseRun;
use vars qw($template $vars);
require 'globals.pl';
use vars qw($vars);
my $template = Bugzilla->template;
my $query_limit = 15000;
# These are going away after 2.22
require "globals.pl";
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@ -58,12 +59,11 @@ my $action = $cgi->param('action') || '';
# For use on the classic form
if ($action eq 'Commit'){
Bugzilla->login(LOGIN_REQUIRED);
;
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
display(do_update($caserun));
}
elsif ($action eq 'Attach'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = do_update(Bugzilla::Testopia::TestCaseRun->new($caserun_id));
defined $cgi->upload('data')
@ -98,7 +98,6 @@ elsif ($action eq 'Attach'){
}
elsif ($action eq 'delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
$vars->{'title'} = 'Remove Test Case '. $caserun->case->id .' from Run: ' . $caserun->run->summary;
@ -109,7 +108,6 @@ elsif ($action eq 'delete'){
ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
$caserun->obliterate;
@ -152,7 +150,6 @@ elsif ($action eq 'do_delete'){
### Ajax Actions ###
####################
elsif ($action eq 'update_build'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit) {
print "Error - You don't have permission";
@ -178,7 +175,6 @@ elsif ($action eq 'update_build'){
print $head_data . "|~+" . $body_data;
}
elsif ($action eq 'update_environment'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit) {
print "Error - You don't have permission";
@ -201,7 +197,6 @@ elsif ($action eq 'update_environment'){
print $head_data . "|~+" . $body_data;
}
elsif ($action eq 'update_status'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -218,7 +213,6 @@ elsif ($action eq 'update_status'){
}
}
elsif ($action eq 'update_note'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -229,7 +223,6 @@ elsif ($action eq 'update_note'){
$caserun->append_note($note);
}
elsif ($action eq 'update_assignee'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -243,7 +236,6 @@ elsif ($action eq 'update_assignee'){
$caserun->set_assignee($assignee_id);
}
elsif ($action eq 'update_sortkey'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -257,7 +249,6 @@ elsif ($action eq 'update_sortkey'){
$caserun->set_sortkey($sortkey);
}
elsif ($action eq 'get_notes'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -266,7 +257,6 @@ elsif ($action eq 'get_notes'){
print '<pre>' . $caserun->notes . '</pre>';
}
elsif ($action eq 'attach_bug'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -291,7 +281,6 @@ elsif ($action eq 'attach_bug'){
}
}
elsif ($action eq 'detach_bug'){
Bugzilla->login(LOGIN_REQUIRED);
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
if (!$caserun->canedit){
print "Error - You don't have permission";
@ -320,7 +309,11 @@ sub do_update {
my $notes = $cgi->param('notes');
my $build = $cgi->param('caserun_build');
my $env = $cgi->param('caserun_env');
my $assignee = DBNameToIdAndCheck(trim($cgi->param('assignee'))) if $cgi->param('assignee');
my $assignee = login_to_id(trim($cgi->param('assignee'))) || ThrowUserError("invalid_username", { name => $cgi->param('assignee') }) if $cgi->param('assignee');
ThrowUserError('testopia-missing-required-field', {field => 'Status'}) unless defined $status;
ThrowUserError('testopia-missing-required-field', {field => 'build'}) unless defined $build;
ThrowUserError('testopia-missing-required-field', {field => 'environment'}) unless defined $env;
validate_test_id($build, 'build');
validate_test_id($env, 'environment');
@ -360,6 +353,7 @@ sub display {
$vars->{'table'} = $table;
$vars->{'caserun'} = $caserun;
$vars->{'action'} = 'tr_show_caserun.cgi';
$vars->{'run'} = $caserun->run;
$template->process("testopia/caserun/show.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}

Просмотреть файл

@ -11,13 +11,16 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
# Brian Kramer <bkramer@novell.com>
# Michael Hight <mjhight@gmail.com>
# Garrett Braden <gbraden@novell.com>
use strict;
use lib ".";
@ -40,11 +43,13 @@ use Bugzilla::Testopia::Environment::Property;
use Data::Dumper;
use JSON;
require 'globals.pl';
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
use vars qw($vars $template);
use vars qw($vars);
my $template = Bugzilla->template;
print $cgi->header;
@ -270,8 +275,10 @@ sub get_products{
sub get_categories{
my ($product_id) = (@_);
my $product = Bugzilla::Testopia::Product->new($product_id);
return unless Bugzilla->user->can_see_product($product->name);
if ($product_id){
my $product = Bugzilla::Testopia::Product->new($product_id);
return unless Bugzilla->user->can_see_product($product->name);
}
my $category = Bugzilla::Testopia::Environment::Category->new({});
print $category->product_categories_to_json($product_id,1);
}

Просмотреть файл

@ -29,6 +29,7 @@ use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::Constants;
use Bugzilla::Testopia::Table;
use Bugzilla::Testopia::TestPlan;
use Bugzilla::Testopia::TestTag;
@ -38,14 +39,14 @@ use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use JSON;
require "globals.pl";
require 'globals.pl';
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $run_query_limit = 5000;
my $case_query_limit = 10000;
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@ -75,7 +76,6 @@ $vars->{'form_action'} = "tr_show_plan.cgi";
### Archive or Unarchive ###
if ($action eq 'Archive' || $action eq 'Unarchive'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
do_update($plan);
@ -92,9 +92,8 @@ if ($action eq 'Archive' || $action eq 'Unarchive'){
#############
elsif ($action eq 'Clone'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless Bugzilla->user->in_group('Testers');
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless ($plan->canedit);
do_update($plan);
$vars->{'plan'} = $plan;
$template->process("testopia/plan/clone.html.tmpl", $vars)
@ -102,8 +101,11 @@ elsif ($action eq 'Clone'){
}
elsif ($action eq 'do_clone'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
unless (Bugzilla->user->in_group('Testers')){
print $cgi->header;
ThrowUserError("testopia-permission-denied", {'object' => 'plan'});
}
if ($serverpush) {
print $cgi->multipart_init();
print $cgi->multipart_start();
@ -112,10 +114,8 @@ elsif ($action eq 'do_clone'){
|| ThrowTemplateError($template->error());
}
unless ($plan->canview){
print $cgi->multipart_end if $serverpush;
ThrowUserError("testopia-permission-denied", {'object' => 'plan'});
}
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
my $plan_name = $cgi->param('plan_name');
# All DB actions use place holders so we are OK doing this
@ -149,7 +149,7 @@ elsif ($action eq 'do_clone'){
}
else {
# Give the author admin rights
$newplan->add_tester($author, 15);
$newplan->add_tester($author, TR_READ | TR_WRITE | TR_DELETE | TR_ADMIN );
$newplan->set_tester_regexp( Param('testopia-default-plan-testers-regexp'), 3)
if Param('testopia-default-plan-testers-regexp');
$newplan->derive_regexp_testers(Param('testopia-default-plan-testers-regexp'))
@ -222,7 +222,6 @@ elsif ($action eq 'do_clone'){
### Changes to Plan Attributes or Doc ###
elsif ($action eq 'Commit'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
do_update($plan);
@ -259,7 +258,6 @@ elsif ($action eq 'History'){
#######################
elsif ($action eq 'Attach'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
defined $cgi->upload('data')
@ -292,27 +290,21 @@ elsif ($action eq 'Attach'){
$vars->{'backlink'} = $plan;
do_update($plan);
display(Bugzilla::Testopia::TestPlan->new($plan_id));
}
#TODO: Import plans
elsif ($action eq 'import'){
}
elsif ($action eq 'Delete'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->candelete;
ThrowUserError("testopia-no-delete", {'object' => 'plan'}) unless $plan->candelete;
$vars->{'plan'} = $plan;
$template->process("testopia/plan/delete.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
unless ($plan->candelete){
print $cgi->header;
ThrowUserError("testopia-read-only", {'object' => 'plan'});
ThrowUserError("testopia-no-delete", {'object' => 'plan'});
}
if ($serverpush) {
print $cgi->multipart_init();
@ -341,20 +333,6 @@ elsif ($action eq 'do_delete'){
print $cgi->multipart_final if $serverpush;
}
####################
### Ajax Actions ###
####################
elsif ($action eq 'caselist'){
print $cgi->header;
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
my $table = Bugzilla::Testopia::Table->new('case', 'tr_list_cases.cgi', $cgi, $plan->test_cases);
$table->{'ajax'} = 1;
$vars->{'table'} = $table;
$template->process("testopia/case/table.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
####################
### Just show it ###
####################
else{
@ -370,41 +348,34 @@ sub do_update {
my $newdoc = $cgi->param("plandoc");
my $plan_name = trim($cgi->param('plan_name')) || '';
my $product = $cgi->param('product_id') || '';
my $product = Bugzilla::Testopia::Product->new($cgi->param('product_id'));
my $prodver = $cgi->param('prod_version') || '';
my $type = $cgi->param('type');
ThrowUserError('testopia-missing-required-field',
{'field' => 'name'}) if ($plan_name eq '');
{'field' => 'product'}) unless $product;
ThrowUserError('testopia-missing-required-field',
{'field' => 'product'}) if ($product eq '');
{'field' => 'name'}) if ($plan_name eq '');
ThrowUserError('testopia-missing-required-field',
{'field' => 'product version'}) if ($prodver eq '');
trick_taint($plan_name);
trick_taint($prodver);
detaint_natural($product);
detaint_natural($type);
validate_selection($type, 'type_id', 'test_plan_types');
#TODO: 2.22 use Bugzilla::Product
validate_selection($product, 'id', 'products');
my $check = validate_version($prodver, $plan->product_id);
if ($check ne '1'){
$vars->{'tr_error'} = "Version mismatch. Please update the product version";
$prodver = $check;
}
my $version = Bugzilla::Version::check_version($prodver, $product->id);
if($plan->diff_plan_doc($newdoc) ne ''){
$plan->store_text($plan->id, Bugzilla->user->id, $newdoc);
}
my %newvalues = (
'name' => $plan_name,
'product_id' => $product,
'default_product_version' => $prodver,
'product_id' => $product->id,
'default_product_version' => $version->name,
'type_id' => $type
);
@ -507,5 +478,3 @@ sub display {
ThrowTemplateError($template->error());
}

Просмотреть файл

@ -26,6 +26,7 @@ use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::Util;
use Bubzilla::User;
use Bugzilla::Testopia::Util;
use Bugzilla::Testopia::TestRun;
use Bugzilla::Testopia::TestCaseRun;
@ -35,13 +36,11 @@ use Bugzilla::Testopia::Search;
use Bugzilla::Testopia::Table;
use Bugzilla::Testopia::Product;
use vars qw($template $vars);
use vars qw($vars);
my $template = Bugzilla->template;
my $query_limit = 15000;
require "globals.pl";
Bugzilla->login();
Bugzilla->login(LOGIN_REQUIRED);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
@ -66,7 +65,6 @@ my $action = $cgi->param('action') || '';
####################
if ($action eq 'Commit'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
do_update($run);
@ -89,7 +87,6 @@ elsif ($action eq 'History'){
#############
elsif ($action =~ /^Clone/){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
my $case_list = $cgi->param('case_list');
@ -118,7 +115,6 @@ elsif ($action =~ /^Clone/){
}
elsif ($action eq 'do_clone'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
if ($serverpush) {
print $cgi->multipart_init();
@ -267,13 +263,12 @@ elsif ($action eq 'clear_filter'){
### Ajax Actions ###
####################
elsif ($action eq 'addcc'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->canedit;
my @cclist = split(/[\s,]+/, $cgi->param('cc'));
my %ccids;
foreach my $email (@cclist){
my $ccid = DBNameToIdAndCheck($email);
my $ccid = login_to_id($email) || ThrowUserError("invalid_username", { name => $email });
if ($ccid && !$ccids{$ccid}) {
$ccids{$ccid} = 1;
}
@ -285,7 +280,6 @@ elsif ($action eq 'addcc'){
print $cc;
}
elsif ($action eq 'removecc'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError('insufficient-case-perms') unless $run->canedit;
foreach my $ccid (split(",", $cgi->param('cc'))){
@ -297,7 +291,6 @@ elsif ($action eq 'removecc'){
}
elsif ($action eq 'Delete'){
print $cgi->header;
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->candelete;
$vars->{'run'} = $run;
@ -307,7 +300,6 @@ elsif ($action eq 'Delete'){
}
elsif ($action eq 'do_delete'){
Bugzilla->login(LOGIN_REQUIRED);
my $run = Bugzilla::Testopia::TestRun->new($run_id);
unless ($run->candelete){
print $cgi->header;
@ -349,6 +341,7 @@ else {
###################
### Helper Subs ###
###################
#TODO: Replace this with json
sub get_cc_xml {
my ($run) = @_;
my $ret = "<cclist>";
@ -371,11 +364,11 @@ sub do_update {
$timestamp = get_time_stamp() if !$cgi->param('status') && !$run->stop_date;
my $summary = $cgi->param('summary') || '';
my $prodver = $cgi->param('product_version');
my $prodver = Bugzilla::Version::check_version($cgi->param('product_version'), $run->plan->product_id);
my $planver = $cgi->param('plan_version');
my $build = $cgi->param('build');
my $env = $cgi->param('environment');
my $manager = DBNameToIdAndCheck(trim($cgi->param('manager')));
my $manager = login_to_id(trim($cgi->param('manager'))) ||ThrowUserError("invalid_username", { name => $cgi->param('manager') });
my $notes = trim($cgi->param('notes'));
ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if ($cgi->param('summary') eq '');
@ -392,17 +385,12 @@ sub do_update {
validate_test_id($build, 'build');
validate_test_id($env, 'environment');
my $check = validate_version($prodver, $run->plan->product_id);
if ($check ne '1'){
$vars->{'tr_error'} = "Version mismatch. Please update the product version";
$prodver = $check;
}
#TODO: Are notes something we want in the history?
#$run->update_notes($notes);
my %newvalues = (
'summary' => $summary,
'product_version' => $prodver,
'product_version' => $prodver->name,
'plan_text_version' => $planver,
'build_id' => $build,
'environment_id' => $env,

Просмотреть файл

@ -11,11 +11,11 @@
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Test Runner System.
# The Original Code is the Bugzilla Testopia System.
#
# The Initial Developer of the Original Code is Maciej Maczynski.
# Portions created by Maciej Maczynski are Copyright (C) 2001
# Maciej Maczynski. All Rights Reserved.
# The Initial Developer of the Original Code is Greg Hendricks.
# Portions created by Greg Hendricks are Copyright (C) 2006
# Novell. All Rights Reserved.
#
# Contributor(s): Greg Hendricks <ghendricks@novell.com>
@ -36,7 +36,6 @@ use Bugzilla::Testopia::TestCase;
Bugzilla->login(LOGIN_REQUIRED);
require "globals.pl";
my $cgi = Bugzilla->cgi;
use vars qw($vars $template);
@ -146,6 +145,8 @@ else {
sub display {
my $dbh = Bugzilla->dbh;
my @tags;
my $user = login_to_id($cgi->param('user')) if $cgi->param('user');
if ($cgi->param('action') eq 'show_all' && Bugzilla->user->in_group('admin')){
my $tags = $dbh->selectcol_arrayref(
"SELECT tag_id FROM test_tags
@ -156,8 +157,8 @@ sub display {
$vars->{'viewall'} = 1;
}
else {
my $userid = $cgi->param('user') ? DBNameToIdAndCheck($cgi->param('user')) : Bugzilla->user->id;
my $userid = $user ? $user : Bugzilla->user->id;
ThrowUserError("invalid_username", { name => $cgi->param('user') }) unless $userid;
my $user_tags = $dbh->selectcol_arrayref(
"(SELECT test_tags.tag_id, test_tags.tag_name AS name FROM test_case_tags
INNER JOIN test_tags ON test_case_tags.tag_id = test_tags.tag_id