mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 10:25:01 +00:00
Some error messages were being displayed before the headers were printed.
This commit is contained in:
parent
54e120f954
commit
c37b9b474a
@ -75,7 +75,7 @@
|
||||
document.getElementById("addComp").disabled = false;
|
||||
document.getElementById("deleteComp").disabled = false;
|
||||
},
|
||||
error: function(type, error){ alert("ERROR");},
|
||||
error: function(type, error){ alert(error.message);},
|
||||
mimetype: "text/json"
|
||||
});
|
||||
}
|
||||
|
@ -71,8 +71,10 @@ if ($action eq 'Commit'){
|
||||
my $params = join(" ", $cgi->param());
|
||||
my @params = $cgi->param();
|
||||
my @buglist;
|
||||
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case-run'}) unless $params =~ $reg;
|
||||
unless ($params =~ $reg){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case-run'});
|
||||
}
|
||||
foreach my $bug (split(/[\s,]+/, $cgi->param('bugs'))){
|
||||
ValidateBugID($bug);
|
||||
push @buglist, $bug;
|
||||
@ -95,8 +97,10 @@ if ($action eq 'Commit'){
|
||||
$template->process("testopia/progress.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'Case Run', 'id' => $caserun->id}) unless $caserun->canedit;
|
||||
unless ($caserun->canedit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'Case Run', 'id' => $caserun->id});
|
||||
}
|
||||
my $status = $cgi->param('status') == -1 ? $caserun->status_id : $cgi->param('status');
|
||||
my $build = $cgi->param('caserun_build') == -1 ? $caserun->build->id : $cgi->param('caserun_build');
|
||||
my $assignee = $cgi->param('assignee') eq '--Do Not Change--' ? $caserun->assignee->id : DBNameToIdAndCheck(trim($cgi->param('assignee')));
|
||||
@ -172,14 +176,20 @@ elsif ($action eq 'Delete Selected'){
|
||||
my @caseruns;
|
||||
foreach my $p ($cgi->param()){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($1) if $p =~ $reg;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if ($caserun && !$caserun->candelete);
|
||||
if (($caserun && !$caserun->candelete)){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'});
|
||||
}
|
||||
push @caseruns, $caserun if $caserun;
|
||||
}
|
||||
if ($serverpush) {
|
||||
print $cgi->multipart_end;
|
||||
print $cgi->multipart_start;
|
||||
}
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case-run'}) if (scalar @caseruns < 1);
|
||||
if ((scalar @caseruns < 1)){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case-run'});
|
||||
}
|
||||
$vars->{'caseruns'} = \@caseruns;
|
||||
$vars->{'caseruncount'} = scalar @caseruns;
|
||||
$vars->{'title'} = "Remove Test Cases from Run";
|
||||
@ -196,7 +206,10 @@ elsif ($action eq 'do_delete'){
|
||||
foreach my $id ($cgi->param('caserun_id')){
|
||||
my $caserun = Bugzilla::Testopia::TestCaseRun->new($id);
|
||||
push @caseruns, $caserun;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
|
||||
if (!$caserun->candelete){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case run'});
|
||||
}
|
||||
}
|
||||
my $progress_interval = 250;
|
||||
my $i = 0;
|
||||
@ -229,7 +242,10 @@ elsif ($action eq 'do_delete'){
|
||||
$cgi->param('current_tab', 'case_run');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('case_run', 'tr_list_caseruns.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
if ($table->view_count > $query_limit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
|
||||
if ($table->list_count > 0){
|
||||
my $prod_id = $table->list->[0]->run->plan->product_id;
|
||||
|
@ -79,8 +79,11 @@ if ($action eq 'Commit'){
|
||||
my $reg = qr/c_([\d]+)/;
|
||||
my $params = join(" ", $cgi->param());
|
||||
my @params = $cgi->param();
|
||||
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case'}) unless $params =~ $reg;
|
||||
|
||||
unless ($params =~ $reg){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'case'});
|
||||
}
|
||||
|
||||
my $progress_interval = 250;
|
||||
my $i = 0;
|
||||
@ -90,7 +93,10 @@ if ($action eq 'Commit'){
|
||||
my $case = Bugzilla::Testopia::TestCase->new($1) if $p =~ $reg;
|
||||
next unless $case;
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case', 'id' => $case->id}) unless $case->canedit;
|
||||
unless ($case->canedit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'case', 'id' => $case->id});
|
||||
}
|
||||
|
||||
$i++;
|
||||
if ($i % $progress_interval == 0 && $serverpush){
|
||||
@ -212,8 +218,10 @@ if ($action eq 'Commit'){
|
||||
$cgi->param('current_tab', 'case');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('case', 'tr_list_cases.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
|
||||
if ($table->view_count > $query_limit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
# Check that all of the test cases returned only belong to one product.
|
||||
if ($table->list_count > 0){
|
||||
my %case_prods;
|
||||
@ -296,8 +304,6 @@ else {
|
||||
}
|
||||
|
||||
# Suggest a name for the bug list if the user wants to save it as a file.
|
||||
# If we are doing server push, then we did this already in the HTTP headers
|
||||
# that started the server push, so we don't have to do it again here.
|
||||
print $cgi->header(-type => $contenttype,
|
||||
-content_disposition => "$disp; filename=$filename");
|
||||
}
|
||||
|
@ -63,8 +63,10 @@ if ($action eq 'Commit'){
|
||||
my $reg = qr/p_([\d]+)/;
|
||||
my $params = join(" ", $cgi->param());
|
||||
my @params = $cgi->param();
|
||||
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'plan'}) unless $params =~ $reg;
|
||||
unless ($params =~ $reg){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'plan'});
|
||||
}
|
||||
|
||||
my $progress_interval = 250;
|
||||
my $i = 0;
|
||||
@ -84,7 +86,10 @@ if ($action eq 'Commit'){
|
||||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan', 'id' => $plan->id}) unless $plan->canedit;
|
||||
unless ($plan->canedit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan', 'id' => $plan->id});
|
||||
}
|
||||
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');
|
||||
my $prodver = $cgi->param('prod_version') == -1 ? $plan->product_version : $cgi->param('prod_version');
|
||||
@ -130,7 +135,10 @@ else {
|
||||
$cgi->param('current_tab', 'plan');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('plan', 'tr_list_plans.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
if ($table->view_count > $query_limit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
|
||||
my $p = Bugzilla::Testopia::TestPlan->new({'plan_id' => 0 });
|
||||
my $product_list = $p->get_available_products;
|
||||
|
@ -64,9 +64,14 @@ if ($action eq 'Commit'){
|
||||
my $reg = qr/r_([\d]+)/;
|
||||
my $params = join(" ", $cgi->param());
|
||||
my @params = $cgi->param();
|
||||
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'run'}) unless $params =~ $reg;
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) if ($cgi->param('environment') eq '');
|
||||
unless ($params =~ $reg){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-none-selected', {'object' => 'run'});
|
||||
}
|
||||
if ($cgi->param('environment') eq ''){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'});
|
||||
}
|
||||
|
||||
my $progress_interval = 250;
|
||||
my $i = 0;
|
||||
@ -85,8 +90,10 @@ if ($action eq 'Commit'){
|
||||
$template->process("testopia/progress.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run', 'id' => $run->id}) unless $run->canedit;
|
||||
unless ($run->canedit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run', 'id' => $run->id});
|
||||
}
|
||||
my $manager = DBNameToIdAndCheck(trim($cgi->param('manager'))) if $cgi->param('manager');
|
||||
my $status;
|
||||
if ($cgi->param('run_status')){
|
||||
@ -140,7 +147,10 @@ else {
|
||||
$cgi->param('current_tab', 'run');
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('run', 'tr_list_runs.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
if ($table->view_count > $query_limit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
|
||||
if ($table->list_count > 0){
|
||||
my $plan_id = $table->list->[0]->plan->product_id;
|
||||
|
@ -86,9 +86,14 @@ if ($action eq 'Add'){
|
||||
my $summary = $cgi->param('summary');
|
||||
my $notes = $cgi->param('notes');
|
||||
my $env = $cgi->param('environment') ? $cgi->param('environment') : $cgi->param('env_pick');
|
||||
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'summary'}) if $summary eq '';
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'}) if $env eq '';
|
||||
if ($summary eq ''){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'summary'});
|
||||
}
|
||||
if ($env eq ''){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-missing-required-field', {'field' => 'environment'});
|
||||
}
|
||||
|
||||
validate_test_id($env, 'environment');
|
||||
|
||||
@ -163,7 +168,10 @@ if ($action eq 'Add'){
|
||||
$cgi->param('run_id', $run_id);
|
||||
my $search = Bugzilla::Testopia::Search->new($cgi);
|
||||
my $table = Bugzilla::Testopia::Table->new('case_run', 'tr_show_run.cgi', $cgi, undef, $search->query);
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit}) if $table->view_count > $query_limit;
|
||||
if ($table->view_count > $query_limit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-query-too-large', {'limit' => $query_limit});
|
||||
}
|
||||
|
||||
$vars->{'run'} = $run;
|
||||
$vars->{'table'} = $table;
|
||||
@ -195,8 +203,8 @@ else {
|
||||
{'run_id' => 0,
|
||||
'plan' => $plan,
|
||||
'plan_text_version' => $plan->version } );
|
||||
ThrowUserError('testopia-create-environment') unless (scalar @{$run->environments} > 0);
|
||||
print $cgi->header;
|
||||
ThrowUserError('testopia-create-environment') unless (scalar @{$run->environments} > 0);
|
||||
$vars->{'run'} = $run;
|
||||
$template->process("testopia/run/add.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
|
@ -408,7 +408,10 @@ sub display {
|
||||
sub export {
|
||||
my ($case_id) = @_;
|
||||
my $case = Bugzilla::Testopia::TestCase->new($case_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'case'}) unless $case->canview;
|
||||
unless ($case->canview){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'case'});
|
||||
}
|
||||
$cgi->param('case_id', $case->id);
|
||||
$cgi->param('isactive', 1);
|
||||
$cgi->param('current_tab', 'case_run');
|
||||
@ -428,8 +431,6 @@ sub export {
|
||||
}
|
||||
|
||||
# Suggest a name for the bug list if the user wants to save it as a file.
|
||||
# If we are doing server push, then we did this already in the HTTP headers
|
||||
# that started the server push, so we don't have to do it again here.
|
||||
my @time = localtime(time());
|
||||
my $date = sprintf "%04d-%02d-%02d", 1900+$time[5],$time[4]+1,$time[3];
|
||||
my $filename = "testcase-$case_id-$date.$format->{extension}";
|
||||
|
@ -73,6 +73,7 @@ $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;
|
||||
@ -82,7 +83,6 @@ if ($action eq 'Archive' || $action eq 'Unarchive'){
|
||||
$vars->{'tr_message'} =
|
||||
$plan->isactive == 0 ? "Plan archived":"Plan Unarchived";
|
||||
$vars->{'backlink'} = $plan;
|
||||
print $cgi->header;
|
||||
display($plan);
|
||||
|
||||
}
|
||||
@ -90,12 +90,12 @@ if ($action eq 'Archive' || $action eq 'Unarchive'){
|
||||
### Clone ###
|
||||
#############
|
||||
elsif ($action eq 'Clone'){
|
||||
print $cgi->header;
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless ($plan->canedit);
|
||||
do_update($plan);
|
||||
$vars->{'plan'} = $plan;
|
||||
print $cgi->header;
|
||||
$template->process("testopia/plan/clone.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
@ -103,8 +103,6 @@ elsif ($action eq 'Clone'){
|
||||
elsif ($action eq 'do_clone'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->canedit;
|
||||
my $plan_name = $cgi->param('plan_name');
|
||||
if ($serverpush) {
|
||||
print $cgi->multipart_init();
|
||||
print $cgi->multipart_start();
|
||||
@ -113,6 +111,11 @@ elsif ($action eq 'do_clone'){
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
}
|
||||
unless ($plan->canedit){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'});
|
||||
}
|
||||
my $plan_name = $cgi->param('plan_name');
|
||||
|
||||
# All DB actions use place holders so we are OK doing this
|
||||
trick_taint($plan_name);
|
||||
@ -176,33 +179,33 @@ 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);
|
||||
$vars->{'tr_message'} = "Test plan updated";
|
||||
$vars->{'backlink'} = $plan;
|
||||
print $cgi->header;
|
||||
display($plan);
|
||||
}
|
||||
|
||||
elsif ($action eq 'Print'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
$vars->{'plan'} = $plan;
|
||||
print $cgi->header;
|
||||
$vars->{'plan'} = $plan;
|
||||
$template->process("testopia/plan/show-document.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
}
|
||||
|
||||
elsif ($action eq 'History'){
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
$vars->{'plan'} = $plan;
|
||||
$vars->{'diff'} = $plan->diff_plan_doc($cgi->param('new'),$cgi->param('old'));
|
||||
$vars->{'new'} = $cgi->param('new');
|
||||
$vars->{'old'} = $cgi->param('old');
|
||||
print $cgi->header;
|
||||
$template->process("testopia/plan/history.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
@ -211,6 +214,7 @@ elsif ($action eq 'History'){
|
||||
### Add attachments ###
|
||||
#######################
|
||||
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;
|
||||
@ -243,7 +247,6 @@ elsif ($action eq 'Attach'){
|
||||
$vars->{'tr_message'} = "Attachment added successfully";
|
||||
$vars->{'backlink'} = $plan;
|
||||
do_update($plan);
|
||||
print $cgi->header;
|
||||
display(Bugzilla::Testopia::TestPlan->new($plan_id));
|
||||
}
|
||||
#TODO: Import plans
|
||||
@ -251,11 +254,11 @@ 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;
|
||||
$vars->{'plan'} = $plan;
|
||||
print $cgi->header;
|
||||
$template->process("testopia/plan/delete.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
|
||||
@ -263,7 +266,10 @@ elsif ($action eq 'Delete'){
|
||||
elsif ($action eq 'do_delete'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'}) unless $plan->candelete;
|
||||
unless ($plan->candelete){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'plan'});
|
||||
}
|
||||
if ($serverpush) {
|
||||
print $cgi->multipart_init();
|
||||
print $cgi->multipart_start();
|
||||
@ -294,12 +300,12 @@ elsif ($action eq 'do_delete'){
|
||||
### 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;
|
||||
print $cgi->header;
|
||||
$template->process("testopia/case/table.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
@ -308,9 +314,9 @@ elsif ($action eq 'caselist'){
|
||||
### Just show it ###
|
||||
####################
|
||||
else{
|
||||
print $cgi->header;
|
||||
my $plan = Bugzilla::Testopia::TestPlan->new($plan_id);
|
||||
ThrowUserError("testopia-permission-denied", {'object' => 'plan'}) unless $plan->canview;
|
||||
print $cgi->header;
|
||||
display($plan);
|
||||
}
|
||||
###################
|
||||
|
@ -64,20 +64,20 @@ my $action = $cgi->param('action') || '';
|
||||
### Edit Actions ###
|
||||
####################
|
||||
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);
|
||||
$vars->{'tr_message'} = "Test run updated";
|
||||
$vars->{'backlink'} = $run;
|
||||
print $cgi->header;
|
||||
display($run);
|
||||
}
|
||||
|
||||
elsif ($action eq 'History'){
|
||||
print $cgi->header;
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
$vars->{'run'} = $run;
|
||||
print $cgi->header;
|
||||
$template->process("testopia/run/history.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
@ -87,6 +87,7 @@ elsif ($action eq 'History'){
|
||||
### Clone ###
|
||||
#############
|
||||
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;
|
||||
@ -110,7 +111,6 @@ elsif ($action =~ /^Clone/){
|
||||
$vars->{'run'} = $run;
|
||||
$vars->{'case_list'} = join(",", @$ref) if ($action =~/These Cases/ && $ref);
|
||||
$vars->{'caserun'} = Bugzilla::Testopia::TestCaseRun->new({'case_run_id' => 0});
|
||||
print $cgi->header;
|
||||
$template->process("testopia/run/clone.html.tmpl", $vars)
|
||||
|| ThrowTemplateError($template->error());
|
||||
|
||||
@ -153,8 +153,10 @@ elsif ($action eq 'do_clone'){
|
||||
|
||||
detaint_natural($id);
|
||||
my $case = Bugzilla::Testopia::TestCase->new($id);
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'Test Case'})
|
||||
unless $case->canview;
|
||||
unless ($case->canview){
|
||||
print $cgi->multipart_end if $serverpush;
|
||||
ThrowUserError('testopia-permission-denied', {'object' => 'Test Case'});
|
||||
}
|
||||
push @case_ids, $id
|
||||
}
|
||||
|
||||
@ -271,11 +273,11 @@ elsif ($action eq 'removecc'){
|
||||
print $cc;
|
||||
}
|
||||
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;
|
||||
print $cgi->header;
|
||||
|
||||
$template->process("testopia/run/delete.html.tmpl", $vars) ||
|
||||
ThrowTemplateError($template->error());
|
||||
@ -284,7 +286,10 @@ elsif ($action eq 'Delete'){
|
||||
elsif ($action eq 'do_delete'){
|
||||
Bugzilla->login(LOGIN_REQUIRED);
|
||||
my $run = Bugzilla::Testopia::TestRun->new($run_id);
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'}) unless $run->candelete;
|
||||
unless ($run->candelete){
|
||||
print $cgi->header;
|
||||
ThrowUserError("testopia-read-only", {'object' => 'run'});
|
||||
}
|
||||
if ($serverpush) {
|
||||
print $cgi->multipart_init();
|
||||
print $cgi->multipart_start();
|
||||
|
Loading…
Reference in New Issue
Block a user