2005-10-11 22:44:16 +04:00
|
|
|
#!/usr/bin/perl -w
|
|
|
|
# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*-
|
|
|
|
|
|
|
|
# ***** BEGIN LICENSE BLOCK *****
|
|
|
|
# Version: MPL 1.1
|
|
|
|
#
|
|
|
|
# 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 Litmus.
|
|
|
|
#
|
|
|
|
# The Initial Developer of the Original Code is
|
|
|
|
# the Mozilla Corporation.
|
2006-01-25 20:03:40 +03:00
|
|
|
# Portions created by the Initial Developer are Copyright (C) 2006
|
2005-10-11 22:44:16 +04:00
|
|
|
# the Initial Developer. All Rights Reserved.
|
|
|
|
#
|
|
|
|
# Contributor(s):
|
|
|
|
# Chris Cooper <ccooper@deadsquid.com>
|
|
|
|
# Zach Lipton <zach@zachlipton.com>
|
|
|
|
#
|
|
|
|
# ***** END LICENSE BLOCK *****
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
use Litmus;
|
|
|
|
use Litmus::Auth;
|
|
|
|
use Litmus::Error;
|
|
|
|
use Litmus::DB::Testresult;
|
|
|
|
use Litmus::DB::Resultbug;
|
2005-10-15 05:09:42 +04:00
|
|
|
|
2005-10-11 22:44:16 +04:00
|
|
|
use CGI;
|
2005-10-15 05:09:42 +04:00
|
|
|
use Date::Manip;
|
2005-10-11 22:44:16 +04:00
|
|
|
|
2006-08-02 00:50:15 +04:00
|
|
|
Litmus->init();
|
2006-01-08 06:56:10 +03:00
|
|
|
my $c = Litmus->cgi();
|
2005-10-11 22:44:16 +04:00
|
|
|
print $c->header();
|
|
|
|
|
|
|
|
if ($c->param && $c->param('id')) {
|
|
|
|
|
2006-09-06 21:34:39 +04:00
|
|
|
my $title = 'Test Result #' . $c->param('id') . ' - Details';
|
|
|
|
my $vars = {
|
|
|
|
title => $title,
|
|
|
|
};
|
|
|
|
|
2005-10-15 05:09:42 +04:00
|
|
|
my $result = Litmus::DB::Testresult->retrieve($c->param('id'));
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2005-10-15 07:37:06 +04:00
|
|
|
if (!$result) {
|
|
|
|
internalError("There is no test result corresponding to id#: " . $c->param('id') . ".");
|
|
|
|
exit 1;
|
|
|
|
}
|
2007-05-14 23:17:08 +04:00
|
|
|
|
|
|
|
if ($result->is_automated_result) {
|
|
|
|
$vars->{'title'} = "Automated " . $title;
|
|
|
|
}
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2005-10-15 05:09:42 +04:00
|
|
|
my $time = &Date::Manip::UnixDate("now","%q");
|
2005-10-13 19:49:28 +04:00
|
|
|
my $cookie = Litmus::Auth::getCookie();
|
|
|
|
my $user;
|
|
|
|
if ($cookie) {
|
2006-06-05 08:07:29 +04:00
|
|
|
$user = $cookie->user_id();
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2005-10-13 19:49:28 +04:00
|
|
|
if ($user and
|
|
|
|
$c->param('new_bugs') and
|
|
|
|
$c->param('new_bugs') ne '') {
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2005-12-14 01:12:22 +03:00
|
|
|
my $new_bug_string = $c->param('new_bugs');
|
|
|
|
$new_bug_string =~ s/[^0-9,]//g;
|
|
|
|
my @new_bugs = split(/,/,$new_bug_string);
|
2005-10-13 19:49:28 +04:00
|
|
|
foreach my $new_bug (@new_bugs) {
|
2005-12-14 01:12:22 +03:00
|
|
|
next if ($new_bug eq '0');
|
2005-10-13 19:49:28 +04:00
|
|
|
if (!Litmus::DB::Resultbug->search(test_result_id =>$c->param('id'),
|
|
|
|
bug_id => $new_bug)) {
|
|
|
|
my $bug = Litmus::DB::Resultbug->create({
|
2006-06-05 08:07:29 +04:00
|
|
|
test_result => $result,
|
2005-10-13 19:49:28 +04:00
|
|
|
last_updated => $time,
|
|
|
|
submission_time => $time,
|
|
|
|
user => $user,
|
|
|
|
bug_id => $new_bug,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2005-10-13 19:49:28 +04:00
|
|
|
if ($user and
|
|
|
|
$c->param('new_comment') and
|
|
|
|
$c->param('new_comment') ne '') {
|
|
|
|
my $comment = Litmus::DB::Comment->create({
|
2006-06-05 08:07:29 +04:00
|
|
|
test_result => $result,
|
2005-10-11 22:44:16 +04:00
|
|
|
last_updated => $time,
|
|
|
|
submission_time => $time,
|
|
|
|
user => $user,
|
2005-10-13 19:49:28 +04:00
|
|
|
comment => $c->param('new_comment'),
|
|
|
|
});
|
2005-10-11 22:44:16 +04:00
|
|
|
}
|
2006-09-06 21:34:39 +04:00
|
|
|
|
2006-08-29 23:06:55 +04:00
|
|
|
if (Litmus::Auth::istrusted($cookie) and
|
|
|
|
$c->param('vet_result')) {
|
|
|
|
if ($c->param('valid')) {
|
|
|
|
$result->valid(1);
|
|
|
|
} else {
|
|
|
|
$result->valid(0);
|
|
|
|
}
|
|
|
|
$result->vetted(1);
|
|
|
|
$result->vetted_by_user($user);
|
|
|
|
$result->validated_by_user($user);
|
|
|
|
$result->vetted_timestamp($time);
|
|
|
|
$result->validated_timestamp($time);
|
|
|
|
$result->last_updated($time);
|
|
|
|
$result->update;
|
|
|
|
}
|
2006-09-06 21:34:39 +04:00
|
|
|
if ((Litmus::Auth::istrusted($cookie) or
|
|
|
|
$cookie == $result->user_id) and
|
|
|
|
$c->param('change_result_status') and
|
|
|
|
$c->param('result_status')) {
|
|
|
|
# Ignore submission if it doesn't actually change the status.
|
2007-01-09 01:12:08 +03:00
|
|
|
if ($c->param('result_status') ne $result->result_status_id->class_name){
|
2006-09-06 21:34:39 +04:00
|
|
|
my ($new_status) = Litmus::DB::ResultStatus->search(class_name => $c->param('result_status'));
|
|
|
|
if ($new_status) {
|
|
|
|
$result->result_status($new_status);
|
|
|
|
$result->last_updated($time);
|
|
|
|
$result->update;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-10-11 22:44:16 +04:00
|
|
|
}
|
2006-06-05 08:07:29 +04:00
|
|
|
|
2006-09-06 21:34:39 +04:00
|
|
|
$vars->{"result"} = $result;
|
2005-10-11 22:44:16 +04:00
|
|
|
|
2006-02-07 21:20:53 +03:00
|
|
|
if ($cookie) {
|
|
|
|
$vars->{"defaultemail"} = $cookie;
|
|
|
|
$vars->{"show_admin"} = $cookie->is_admin();
|
|
|
|
}
|
2005-10-11 22:44:16 +04:00
|
|
|
|
|
|
|
Litmus->template()->process("reporting/single_result.tmpl", $vars) ||
|
2005-10-15 07:37:06 +04:00
|
|
|
internalError("Error loading template.");
|
2005-10-11 22:44:16 +04:00
|
|
|
|
|
|
|
} else {
|
2005-10-15 07:37:06 +04:00
|
|
|
internalError("You must provide a test result id#.");
|
2005-10-11 22:44:16 +04:00
|
|
|
exit 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
exit 0;
|