- added table related_testcases to track cloned testcase relations

- update/replace enter_test.cgi with complete management interface for testcases
- make all fields Essential in Litmus::DB::Testcase
- added new methods to Litmus::DB::Testcase: clone, delete_from_subgroups, delete_from_related, delete_with_refs, update_subgroups
- added ByTestgroup and ByTestcase sql lookups to Litmus::DB::Subgroup
- added order_by directives to has_many fields in Litmus::DB::Product
- added new Litmus::FormWidget functions getTestcases and getAuthors
- don't try to .select() select fields (FormValidation.js)
- add verifySelected function to FormValidation.ja
- update interface to use manage_testcase.cgi for editing testcases
- remove editing flags/interface from test.html.tmpl


git-svn-id: svn://10.0.0.236/trunk@200452 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
ccooper%deadsquid.com
2006-06-20 19:34:53 +00:00
parent e63f8cc662
commit 331acd520a
22 changed files with 5402 additions and 137 deletions

View File

@@ -93,6 +93,7 @@ sub rebuildCache {
my $grouparray = \@{$prodrow->{"testgroups"}};
my $groupcount = 0;
foreach my $curgroup ($curproduct->testgroups()) {
next if (!$curgroup->enabled);
my $grouprow = \%{$grouparray->[$groupcount]};
$grouprow->{"name"} = $curgroup->name();
$grouprow->{"id"} = $curgroup->testgroup_id();
@@ -101,6 +102,7 @@ sub rebuildCache {
my $subgrouparray = \@{$grouprow->{"subgroups"}};
my $subgroupcount = 0;
foreach my $cursubgroup (Litmus::DB::Subgroup->search_EnabledByTestgroup($curgroup->testgroup_id())) {
next if (!$cursubgroup->enabled);
my $subgrouprow = \%{$subgrouparray->[$subgroupcount]};
$subgrouprow->{"name"} = $cursubgroup->name();
$subgrouprow->{"id"} = $cursubgroup->subgroup_id();

View File

@@ -41,9 +41,13 @@ Litmus::DB::Product->columns(All => qw/product_id name iconpath enabled/);
Litmus::DB::Product->column_alias("product_id", "productid");
Litmus::DB::Product->has_many(testcases => "Litmus::DB::Testcase");
Litmus::DB::Product->has_many(subgroups => "Litmus::DB::Subgroup");
Litmus::DB::Product->has_many(testgroups => "Litmus::DB::Testgroup");
Litmus::DB::Product->has_many(branches => "Litmus::DB::Branch");
Litmus::DB::Product->has_many(testcases => "Litmus::DB::Testcase",
{ order_by => 'testcase_id' });
Litmus::DB::Product->has_many(subgroups => "Litmus::DB::Subgroup",
{ order_by => 'name' });
Litmus::DB::Product->has_many(testgroups => "Litmus::DB::Testgroup",
{ order_by => 'name' });
Litmus::DB::Product->has_many(branches => "Litmus::DB::Branch",
{ order_by => 'name' });
1;

View File

@@ -53,6 +53,13 @@ __PACKAGE__->set_sql(EnabledByTestgroup => qq{
ORDER BY sgtg.sort_order ASC
});
__PACKAGE__->set_sql(ByTestgroup => qq{
SELECT sg.*
FROM subgroups sg, subgroup_testgroups sgtg
WHERE sgtg.testgroup_id=? AND sgtg.subgroup_id=sg.subgroup_id
ORDER BY sgtg.sort_order ASC
});
__PACKAGE__->set_sql(NumEnabledTestcases => qq{
SELECT count(tc.testcase_id) as num_testcases
FROM testcases tc, testcase_subgroups tcsg
@@ -66,6 +73,13 @@ __PACKAGE__->set_sql(EnabledByTestcase => qq{
ORDER by sg.name ASC
});
__PACKAGE__->set_sql(ByTestcase => qq{
SELECT sg.*
FROM subgroups sg, testcase_subgroups tcsg
WHERE tcsg.testcase_id=? AND tcsg.subgroup_id=sg.subgroup_id
ORDER by sg.name ASC
});
#########################################################################
sub coverage() {
my $self = shift;

View File

@@ -37,6 +37,7 @@ package Litmus::DB::Testcase;
use strict;
use base 'Litmus::DBI';
use Date::Manip;
use Litmus::DB::Testresult;
use Memoize;
use Litmus::Error;
@@ -47,8 +48,7 @@ our $default_match_limit = 25;
Litmus::DB::Testcase->table('testcases');
Litmus::DB::Testcase->columns(Primary => qw/testcase_id/);
Litmus::DB::Testcase->columns(Essential => qw/summary details enabled community_enabled format_id regression_bug_id product_id/);
Litmus::DB::Testcase->columns(All => qw/steps expected_results author_id creation_date last_updated version testrunner_case_id testrunner_case_version/);
Litmus::DB::Testcase->columns(Essential => qw/summary details enabled community_enabled format_id regression_bug_id product_id steps expected_results author_id creation_date last_updated version testrunner_case_id testrunner_case_version/);
Litmus::DB::Testcase->column_alias("testcase_id", "testid");
Litmus::DB::Testcase->column_alias("testcase_id", "test_id");
@@ -152,6 +152,102 @@ sub getDefaultRelevanceThreshold() {
return $default_relevance_threshold;
}
#########################################################################
sub clone() {
my $self = shift;
my $new_testcase = $self->copy;
if (!$new_testcase) {
return undef;
}
# Update dates to now.
my $now = &UnixDate("today","%q");
$new_testcase->creation_date($now);
$new_testcase->last_updated($now);
$new_testcase->update();
# Propagate subgroup membership;
my $dbh = __PACKAGE__->db_Main();
my $sql = "INSERT INTO testcase_subgroups (testcase_id,subgroup_id,sort_order) SELECT ?,subgroup_id,sort_order FROM testcase_subgroups WHERE testcase_id=?";
my $rows = $dbh->do($sql,
undef,
$new_testcase->testcase_id,
$self->testcase_id
);
if (! $rows) {
# XXX: Do we need to throw a warning here?
# What happens when we clone a testcase that doesn't clong to
# any subgroups?
}
$sql = "INSERT INTO related_testcases (testcase_id, related_testcase_id) VALUES (?,?)";
$rows = $dbh->do($sql,
undef,
$self->testcase_id,
$new_testcase->testcase_id
);
if (! $rows) {
# XXX: Do we need to throw a warning here?
}
return $new_testcase;
}
#########################################################################
sub delete_from_subgroups() {
my $self = shift;
my $dbh = __PACKAGE__->db_Main();
my $sql = "DELETE from testcase_subgroups WHERE testcase_id=?";
my $rows = $dbh->do($sql,
undef,
$self->testcase_id
);
}
#########################################################################
sub delete_from_related() {
my $self = shift;
my $dbh = __PACKAGE__->db_Main();
my $sql = "DELETE from related_testcases WHERE testcase_id=? OR related_testcase_id=?";
my $rows = $dbh->do($sql,
undef,
$self->testcase_id,
$self->testcase_id
);
}
#########################################################################
sub delete_with_refs() {
my $self = shift;
$self->delete_from_subgroups();
$self->delete_from_related();
return $self->delete;
}
#########################################################################
sub update_subgroups() {
my $self = shift;
my $new_subgroup_ids = shift;
if (scalar @$new_subgroup_ids) {
# Failing to delete subgroups is _not_ fatal when adding a new testcase.
my $rv = $self->delete_from_subgroups();
my $dbh = __PACKAGE__->db_Main();
my $sql = "INSERT INTO testcase_subgroups (testcase_id,subgroup_id,sort_order) VALUES (?,?,1)";
foreach my $new_subgroup_id (@$new_subgroup_ids) {
my $rows = $dbh->do($sql,
undef,
$self->testcase_id,
$new_subgroup_id
);
}
}
}
1;

View File

@@ -115,14 +115,14 @@ See Also :
#########################################################################
sub getProducts()
{
my $sql = "SELECT DISTINCT(name) FROM products ORDER BY name";
my $sql = "SELECT name, product_id FROM products ORDER BY name";
return _getValues($sql);
}
#########################################################################
sub getUniquePlatforms()
{
my $sql = "SELECT DISTINCT(name) FROM platforms ORDER BY name";
my $sql = "SELECT DISTINCT(name), platform_id FROM platforms ORDER BY name";
return _getValues($sql);
}
@@ -183,6 +183,13 @@ sub getTestcaseIDs()
return _getValues($sql);
}
#########################################################################
sub getTestcases()
{
my $sql = "SELECT testcase_id, summary FROM testcases ORDER BY testcase_id";
return _getValues($sql);
}
#########################################################################
sub getLocales()
{
@@ -197,6 +204,15 @@ sub getUsers()
return \@users;
}
#########################################################################
sub getAuthors()
{
my $sql = "SELECT user_id, email FROM users WHERE is_admin=1 ORDER BY email";
return _getValues($sql);
}
#########################################################################
sub getFields()
{

View File

@@ -456,6 +456,11 @@ td.header, td.headerleft, th {
td.headerleft {
text-align: left;
color: #000000;
}
.edit-testcase td.headerleft {
border: 0;
}
.run-tests td.header {
@@ -561,7 +566,7 @@ table.radio-testresults tr {
width: 100%;
}
.advanced-search td.heading {
.advanced-search td.heading, .test-config td.header {
font-weight: bold;
}
@@ -570,10 +575,6 @@ table.radio-testresults tr {
padding: 0px 5px 10px 5px;
}
.test-config td.header {
font-weight: bold;
}
/* 11 Run Test ****************************************************************************** */
div.title_sub {
@@ -910,6 +911,23 @@ div.closeLink a:hover {
text-decoration: none;
}
/* 16 Admin ********************************************************** */
input.manage {
width: 15em;
font-size: 1em;
}
table.edit-testcase {
border: 0;
padding: 5px;
margin: 0;
}
table.edit-testcase td {
padding-bottom: 5px;
}
/* Misc ************************************************************** */
fieldset {

View File

@@ -61,10 +61,12 @@ function warnEmpty (theField, s)
// Put select theField, put focus in it, and return false.
function warnInvalid (theField, s)
{
theField.focus();
theField.focus();
if (!/select/.test(theField.type)) {
theField.select();
toggleMessage('failure',s);
return false;
}
toggleMessage('failure',s);
return false;
}
// isEmail (STRING s [, BOOLEAN emptyOK])
@@ -343,6 +345,16 @@ function isPositiveInteger (s)
&& ( (isEmpty(s) && secondArg) || (parseInt (s) > 0) ) );
}
function verifySelected(theField, fieldName) {
if (theField.selectedIndex >= 0 &&
theField.options[theField.selectedIndex].value != '' &&
theField.options[theField.selectedIndex].value != '---') {
return true;
} else {
return warnInvalid (theField, 'You must select an option for ' + fieldName + '. Please make a selection now.');
}
}
function toggleMessage(msgType,msg) {
var em = document.getElementById("message");
if (toggleMessage.arguments.length < 1) {

4802
mozilla/webtools/litmus/js/MochiKit/MochiKit.js vendored Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
dojo.hostenv.conditionalLoadModule({"common": ["MochiKit.MochiKit"]});
dojo.hostenv.moduleLoaded("MochiKit.*");

View File

@@ -0,0 +1,120 @@
/*
json.js
2006-04-28
This file adds these methods to JavaScript:
object.toJSONString()
This method produces a JSON text from an object. The
object must not contain any cyclical references.
array.toJSONString()
This method produces a JSON text from an array. The
array must not contain any cyclical references.
string.parseJSON()
This method parses a JSON text to produce an object or
array. It will return false if there is an error.
*/
(function () {
var m = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"' : '\\"',
'\\': '\\\\'
},
s = {
array: function (x) {
var a = ['['], b, f, i, l = x.length, v;
for (i = 0; i < l; i += 1) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a[a.length] = v;
b = true;
}
}
}
a[a.length] = ']';
return a.join('');
},
'boolean': function (x) {
return String(x);
},
'null': function (x) {
return "null";
},
number: function (x) {
return isFinite(x) ? String(x) : 'null';
},
object: function (x) {
if (x) {
if (x instanceof Array) {
return s.array(x);
}
var a = ['{'], b, f, i, v;
for (i in x) {
v = x[i];
f = s[typeof v];
if (f) {
v = f(v);
if (typeof v == 'string') {
if (b) {
a[a.length] = ',';
}
a.push(s.string(i), ':', v);
b = true;
}
}
}
a[a.length] = '}';
return a.join('');
}
return 'null';
},
string: function (x) {
if (/["\\\x00-\x1f]/.test(x)) {
x = x.replace(/([\x00-\x1f\\"])/g, function(a, b) {
var c = m[b];
if (c) {
return c;
}
c = b.charCodeAt();
return '\\u00' +
Math.floor(c / 16).toString(16) +
(c % 16).toString(16);
});
}
return '"' + x + '"';
}
};
Object.prototype.toJSONString = function () {
return s.object(this);
};
Array.prototype.toJSONString = function () {
return s.array(this);
};
})();
String.prototype.parseJSON = function () {
try {
return !(/[^,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]/.test(
this.replace(/"(\\.|[^"\\])*"/g, ''))) &&
eval('(' + this + ')');
} catch (e) {
return false;
}
};

View File

@@ -0,0 +1,53 @@
#!/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.
# Portions created by the Initial Developer are Copyright (C) 2006
# 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 JSON;
use CGI;
use Date::Manip;
my $c = Litmus->cgi();
print $c->header('text/plain');
if ($c->param("testcase_id")) {
my $testcase_id = $c->param("testcase_id");
my $testcase = Litmus::DB::Testcase->retrieve($testcase_id);
my @testgroups = Litmus::DB::Testgroup->search_EnabledByTestcase($testcase_id);
my @subgroups = Litmus::DB::Subgroup->search_EnabledByTestcase($testcase_id);
$testcase->{'testgroups'} = \@testgroups;
$testcase->{'subgroups'} = \@subgroups;
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($testcase);
print $js;
}

View File

@@ -0,0 +1,175 @@
#!/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.
# Portions created by the Initial Developer are Copyright (C) 2006
# the Initial Developer. All Rights Reserved.
#
# Contributor(s):
# Chris Cooper <ccooper@deadsquid.com>
# Zach Lipton <zach@zachlipton.com>
#
# ***** END LICENSE BLOCK *****
use strict;
# Litmus homepage
use Litmus;
use Litmus::Auth;
use Litmus::Error;
use Litmus::FormWidget;
use Litmus::Utils;
use CGI;
use Date::Manip;
my $c = Litmus->cgi();
# for the moment, you must be an admin to enter tests:
Litmus::Auth::requireAdmin('manage_testcases.cgi');
my $vars;
my $testcase_id;
my $message;
my $status;
my $rv;
if ($c->param("testcase_id")) {
$testcase_id = $c->param("testcase_id");
}
if ($c->param("delete_testcase_button")) {
my $testcase = Litmus::DB::Testcase->retrieve($testcase_id);
if ($testcase) {
$rv = $testcase->delete_with_refs();
if ($rv) {
$status = "success";
$message = "Testcase ID# $testcase_id deleted successfully.";
} else {
$status = "failure";
$message = "Failed to delete Testcase ID# $testcase_id.";
}
} else {
$status = "failure";
$message = "Testcase ID# $testcase_id does not exist. (Already deleted?)";
}
} elsif ($c->param("clone_testcase_button")) {
my $testcase = Litmus::DB::Testcase->retrieve($testcase_id);
my $new_testcase = $testcase->clone;
if ($new_testcase) {
$status = "success";
$message = "Testcase cloned successfully. New testcase ID# is " . $new_testcase->testcase_id;
} else {
$status = "failure";
$message = "Failed to clone Testcase ID# $testcase_id.";
}
} elsif ($c->param("editform_mode")) {
requireField('summary', $c->param('editform_summary'));
requireField('product', $c->param('product'));
requireField('product', $c->param('subgroup'));
requireField('author', $c->param('editform_author_id'));
my $enabled = $c->param('editform_enabled') ? 1 : 0;
my $community_enabled = $c->param('editform_communityenabled') ? 1 : 0;
my $now = &UnixDate("today","%q");
if ($c->param("editform_mode") eq "add") {
my %hash = (
summary => $c->param('editform_summary'),
steps => $c->param('editform_steps') ? $c->param('editform_steps') : '',
expected_results => $c->param('editform_results') ? $c->param('editform_results') : '',
product_id => $c->param('product'),
enabled => $enabled,
community_enabled => $community_enabled,
regression_bug_id => $c->param('editform_regression_bug_id') ? $c->param('editform_regression_bug_id') : '',
author_id => $c->param('editform_author_id'),
creation_date => $now,
last_updated => $now,
);
my $new_testcase =
Litmus::DB::Testcase->create(\%hash);
if ($new_testcase) {
my @selected_subgroups = $c->param("subgroup");
$new_testcase->update_subgroups(\@selected_subgroups);
$status = "success";
$message = "Testcase added successfully. New testcase ID# is " . $new_testcase->testcase_id;
} else {
$status = "failure";
$message = "Failed to add testcase.";
}
} elsif ($c->param("editform_mode") eq "edit") {
requireField('testcase_id', $c->param("editform_testcase_id"));
$testcase_id = $c->param("editform_testcase_id");
my $testcase = Litmus::DB::Testcase->retrieve($testcase_id);
if ($testcase) {
$testcase->summary($c->param('editform_summary'));
$testcase->steps($c->param('editform_steps') ? $c->param('editform_steps') : '');
$testcase->expected_results($c->param('editform_results') ? $c->param('editform_results') : '');
$testcase->product_id($c->param('product'));
$testcase->enabled($enabled);
$testcase->community_enabled($community_enabled);
$testcase->regression_bug_id($c->param('editform_regression_bug_id') ? $c->param('editform_regression_bug_id') : '');
$testcase->author_id($c->param('editform_author_id'));
$testcase->last_updated($now);
$testcase->version($testcase->version + 1);
$rv = $testcase->update();
if ($rv) {
my @selected_subgroups = $c->param("subgroup");
$testcase->update_subgroups(\@selected_subgroups);
$status = "success";
$message = "Testcase ID# $testcase_id updated successfully.";
} else {
$status = "failure";
$message = "Failed to update testcase ID# $testcase_id.";
}
} else {
$status = "failure";
$message = "Testcase ID# $testcase_id not found.";
}
}
} else {
my $defaults;
$defaults->{'testcase_id'} = $c->param("testcase_id");
$vars->{'defaults'} = $defaults;
}
if ($status and $message) {
$vars->{'onload'} = "toggleMessage('$status','$message');";
}
my $testcases = Litmus::FormWidget->getTestcases;
my $products = Litmus::FormWidget->getProducts();
my $authors = Litmus::FormWidget->getAuthors();
$vars->{'title'} = "Manage Testcases";
$vars->{'testcases'} = $testcases;
$vars->{'products'} = $products;
$vars->{'authors'} = $authors;
$vars->{'user'} = Litmus::Auth::getCurrentUser();
my $cookie = Litmus::Auth::getCookie();
$vars->{"defaultemail"} = $cookie;
$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie);
print $c->header();
Litmus->template()->process("admin/manage_testcases.tmpl", $vars) ||
internalError("Error loading template.");

View File

@@ -0,0 +1,55 @@
#!/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.
# Portions created by the Initial Developer are Copyright (C) 2006
# 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 CGI;
use Date::Manip;
my $c = Litmus->cgi();
print $c->header;
my $vars = {
title => 'Preview',
};
if ($c->param("preview")) {
$vars->{'text_to_preview'} = $c->param("preview");
}
my $cookie = Litmus::Auth::getCookie();
$vars->{"defaultemail"} = $cookie;
$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie);
Litmus->template()->process("admin/preview.tmpl", $vars) ||
internalError(Litmus->template()->error());

View File

@@ -100,6 +100,12 @@ $table{products} =
index(iconpath),
index(enabled)';
$table{related_testcases} =
'testcase_id int(11) not null,
related_testcase_id int(11) not null,
primary key (testcase_id, related_testcase_id)';
$table{sessions} =
'session_id int(11) not null primary key auto_increment,
user_id int(11) not null,

View File

@@ -75,14 +75,8 @@ if ($c->param("id")) {
$edittest->summary($c->param("summary_edit_$editid"));
my $product = Litmus::DB::Product->retrieve($c->param("product_$editid"));
# my $group = Litmus::DB::Testgroup->retrieve($c->param("testgroup_$editid"));
# my $subgroup = Litmus::DB::Subgroup->retrieve($c->param("subgroup_$editid"));
requireField("product", $product);
# requireField("group", $group);
# requireField("subgroup", $subgroup);
$edittest->product($product);
# $edittest->testgroup($group);
# $edittest->subgroup($subgroup);
$edittest->steps($c->param("steps_edit_$editid"));
$edittest->expected_results($c->param("results_edit_$editid"));

View File

@@ -1,4 +1,4 @@
<select name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %]>
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %]>
[% IF placeholder %]<option value="">-Test Group-</option>[% END %]
[% IF test_groups %]
[% FOREACH test_group=test_groups %]

View File

@@ -1,10 +1,10 @@
<select name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %]>
[% IF placeholder %]<option value="">-Testcase ID#-</option>[% END %]
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF onchange %] onChange="[% onchange %]"[% END %][% IF disabled %] disabled[% END %]>
[% IF placeholder %]<option value="">-Testcase ID#[% IF show_summary %]: Summary[% END %]-</option>[% END %]
[% IF testcases %]
[% FOREACH testcase=testcases %]
<option[% IF defaults.testcase_id==testcase.testcase_id %] selected[% END %]
value="[% testcase.testcase_id | html %]">
[% testcase.testcase_id | html%]</option>
[% testcase.testcase_id | html%][% IF show_summary %]: [% testcase.summary %][% END %]</option>
[% END %]
[% END %]
</select>

View File

@@ -178,6 +178,6 @@
[% END %]
<select name="product[%testidflag FILTER html%]" id="product[%testidflag FILTER html%]"
onchange="changeProduct([%testcase.testcase_id FILTER js%])"
class="select_product">
class="select_product"[% IF disabled %] disabled[% END %]>
</select>
[% END %]

View File

@@ -94,7 +94,7 @@
<tr>
<td class="l"><a name="test_[% i %]" onclick="allStretch.toggle(document.getElementById('t[% i %]-content'), 'height');">[% loop.count %]: [% curtest.summary | html %]&nbsp;&raquo;</a></td>
<td class="r">[% IF results %]<a title="You have already submitted a result for this testcase." target="test_results" href="single_result.cgi?id=[% results.0.testresult_id %]"><img align="absmiddle" src="images/confirm.png" border="0" /></a>&nbsp;[% END %]
<a title="Testcase ID#: [% curtest.testcase_id | html %]" href="show_test.cgi?id=[% curtest.testcase_id | uri | html %]">View&nbsp;/&nbsp;Edit</a></td>
<a title="View Testcase ID#: [% curtest.testcase_id | html %]" href="show_test.cgi?id=[% curtest.testcase_id | uri | html %]">View</a>[% IF show_admin %]&nbsp;/&nbsp;<a title="Edit Testcase ID#: [% curtest.testcase_id | html %]" href="manage_testcases.cgi?testcase_id=[% curtest.testcase_id | uri | html %]">Edit</a>[% END %]</td>
</tr>
</table>
</div> <!--END testcase-head-->

View File

@@ -43,7 +43,7 @@
[% includeselects=1 %]
[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/EditTests.js', 'js/SelectBoxes.js', 'js/FormValidation.js'] %]
[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/EditTests.js','js/FormValidation.js','js/SelectBoxes.js'] %]
[% INCLUDE global/litmus_header.tmpl %]
<div id="page">
@@ -67,12 +67,11 @@
<form action="process_test.cgi" method="post" name="form" id="show_test_form">
<input name="isTestResult" type="hidden" value="true">
<input name="editingTestcases" id="editingTestcases" type="hidden" value="">
<input name="return" type="hidden" value="show_test.cgi?id=[% testcase.testcase_id | html %]">
<input name="id" type="hidden" value="[% testcase.testcase_id | html %]">
<div class="testcase-content">
[% INCLUDE test/test.html.tmpl testcase=testcase results=results showedit=show_admin show_config=1 sysconfig=sysconfig %]
[% INCLUDE test/test.html.tmpl testcase=testcase results=results show_config=1 sysconfig=sysconfig %]
</div>
</div>
</div>

View File

@@ -5,8 +5,7 @@
<ul>
<li>Manange Test Runs</li>
<hr/>
<li><a href="enter_test.cgi">Add New Testcase</a></li>
<li>Manage Testcases</li>
<li><a href="manage_testcases.cgi">Manage Testcases</a></li>
<li>Manage Subgroups</li>
<li>Manage Testgroups</li>
<hr/>

View File

@@ -27,35 +27,21 @@
[%# INTERFACE:
# $testcase - the testcase object to show
#
# $showedit (optional) - include UI to edit the testcase?
# for this to work, you must include the
# required scripts in the head
# $show_config - display the config options (testgroup, subgroup, etc.)
# for a given testcase
#%]
[% PROCESS global/selects.none.tmpl %]
[% IF showedit %]
<script language="JavaScript" type="text/Javascript" src="js/Help.js"></script>
[% INCLUDE test/formattingHelp.js.tmpl %]
[% END %]
[% IF show_config %]
<table cellspacing="0" cellpadding="0" class="tcm">
<tr>
<td width="20%"><b>Product:</b></td>
<td>
[% IF showedit %]<div id="product_edit_[% testcase.testcase_id | html %]" style="display: none;">[% INCLUDE productbox testcase=testcase selected=testcase.product %]<input type="hidden" name="product_initial_[% testcase.testcase_id | html %]" value="[% testcase.product.product_id | html %]"></div>[% END %]
<div id="product_text_[% testcase.testcase_id | html %]">[% testcase.product.name | html %]</div>
</td>
[% IF showedit %]
<td align="right" valign="top" colspan="5">
<a id="editlink_[%testcase.testcase_id | html %]" href="#editing" onclick="showEdit('[% testcase.testcase_id | js %]')"> Edit Testcase</a>
<a id="canceleditlink_[%testcase.testcase_id | html%]" style="display: none;" href="#editing" onclick="cancelEdit('[% testcase.testcase_id | js %]')"> Cancel Edit</a>
<td align="right" valign="top" colspan="5"><a href="manage_testcases.cgi?testcase_id=[%testcase.testcase_id | html%]"> Edit Testcase</a>
</td>
[% END %]
</tr>
<tr>
<td><b>Test Group(s):</b></td>
@@ -75,12 +61,7 @@
</tr>
<tr>
<td><b>Summary:</b></td>
<td><div id="summary_edit_[%testcase.testcase_id | html%]" style="display: none;"><input name="summary_edit_[%testcase.testcase_id | html%]"
id="summary_edit_[%testcase.testcase_id | html%]"
value="[% testcase.summary | html %]"
size="35"/></div>
<div id="summary_text_[%testcase.testcase_id | html%]">[% testcase.summary | html %]</div>
</td>
<td><div id="summary_text_[%testcase.testcase_id | html%]">[% testcase.summary | html %]</div></td>
</tr>
</table>
@@ -91,31 +72,11 @@
<tr>
<td width="50%" class="content"><div class="dh">Steps to Perform:</div>
<div class="dv" id="steps_text_[%testcase.testcase_id | html%]">[% testcase.steps | markdown | testdata %]</div>
[% IF showedit %]
<div class="dv" id="steps_edit_[%testcase.testcase_id | html%]" style="display: none;">
<textarea name="steps_edit_[%testcase.testcase_id | html%]"
id="steps_edit_[%testcase.testcase_id | html%]"
rows="15" cols="40">[% testcase.steps | testdata %]</textarea></div>
[% END %]
</td>
<td width="50%" class="content"><div class="dh">Expected Results:</div>
<div class="dv" id="results_text_[%testcase.testcase_id | html%]">[% testcase.expected_results | markdown | testdata %]</div>
[% IF showedit %]
<div class="dv" id="results_edit_[%testcase.testcase_id | html%]" style="display: none;">
<textarea name="results_edit_[%testcase.testcase_id | html%]"
id="results_edit_[%testcase.testcase_id | html%]"
rows="15" cols="40">[% testcase.expected_results | testdata %]</textarea></div>
[% END %]
</td>
</tr>
[% IF showedit %]
<tr><td class="content" colspan="2"><div id="formatting_edit_[% testcase.testcase_id | html %]"
class="dv" style="display: none;">
<u><a name="showFormattingHelp"
onclick="toggleHelp(formattingHelpTitle,formattingHelpText);">
Formatting Help</a></u>
</div></td></tr>
[% END %]
[% IF defaultemail OR sysconfig %]
<!-- Only allow the user to submit a single result if they are already
@@ -150,69 +111,6 @@
</div>
[% IF showedit %]
<div id="admin_edit_[%testcase.testcase_id | html%]" style="display: none;">
<table cellspacing="0" cellpadding="0" border="0">
<tr>
<td><b>Enabled?</b></td>
<td>[% IF testcase.enabled %][% checked = "checked" %][% END %]
<input name="enabled_[%testcase.testcase_id | html%]"
type="checkbox"
id="enabled_[%testcase.testcase_id | html%]"
value="1" [% checked %]>
</td>
<td>Uncheck this to completely disable this testcase.</td>
</tr>
<tr>
<td><b>Community Enabled?</b></td>
<td>[% IF testcase.communityenabled %][% checked = "checked" %][% END %]
<input name="communityenabled_[%testcase.testcase_id | html%]"
type="checkbox"
id="communityenabled_[%testcase.testcase_id | html%]"
value="1" [% checked %]>
</td>
<td>Uncheck this to disable this testcase for the community-at-large.<br/>Note: trusted testers will stlil be able to see and run this testcase.</td>
</tr>
<tr>
<td><b>Regression Bug ID#</b>:</td>
<td><input name="regression_bug_id_[%testcase.testcase_id | html%]"
type="text"
id="regression_bug_id_[%testcase.testcase_id | html%]"
value="[%testcase.regression_bug_id | html%]">
</td>
</tr>
<tr>
<td><b>Author</b>:</td>
<td>[% testcase.author.getDisplayName %]</td>
</tr>
<tr>
<td><b>Creation Date</b>:</td>
<td>[% testcase.creation_date %]</td>
</tr>
<tr>
<td><b>Last Updated</b>:</td>
<td>[% testcase.last_updated %]</td>
</tr>
<tr>
<td><b>Litmus Version</b>:</td>
<td>[% testcase.version %]</td>
</tr>
<tr>
<td><b>Testrunner Case ID#</b>:</td>
<td>[% testcase.testrunner_case_id %]</td>
</tr>
<tr>
<td><b>Testrunner Case Version</b>:</td>
<td>[% testcase.testrunner_case_version %]</td>
</tr>
<tr>
<td colspan="2"><input class="button" type="submit" id="submit_edit_testcase" name="submit_edit_testcase" onClick="findEdited()" value="Submit These Edits"/></div>
</td>
</tr>
</table>
</div>
[% END %]
</td>
</tr>
[% END %]