* Add additional json hooks to retrieve lists of products, platforms, etc...

* (bug 334871) Search test lists by product/testgroup/subgroup
* Allow printing of all testcases matching a query
* Improve wording and organization of links in options sidebar
This commit is contained in:
zach%zachlipton.com 2006-07-28 22:26:43 +00:00
Родитель 1c5aaa5fbc
Коммит 60c91fce02
8 изменённых файлов: 219 добавлений и 10 удалений

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

@ -0,0 +1,12 @@
body {
background: white;
}
a:link:after, a:visited:after {
content: " (" attr(href) ") ";
font-size: 90%;
}
div.testcase {
page-break-inside: avoid;
}

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

@ -76,6 +76,13 @@ if ($c->param("testcase_id")) {
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($testgroup);
print $js;
} elsif ($c->param("validate_login")) {
my $uname = $c->param("username");
my $passwd = $c->param("password");
my $login = Litmus::Auth::validate_login($uname, $passwd);
if (!$login) { $login = 0 }
else { $login = 1 }
print $login;
} elsif ($c->param("product_id")) {
my $product_id = $c->param("product_id");
my $product = Litmus::DB::Product->retrieve($product_id);
@ -102,7 +109,26 @@ if ($c->param("testcase_id")) {
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($branch);
print $js;
}
} elsif ($c->param("products")) {
my @products = Litmus::DB::Product->retrieve_all();
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson(\@products);
print $js;
} elsif ($c->param("platforms")) {
my @platforms = Litmus::DB::Platform->retrieve_all();
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson(\@platforms);
print $js;
} elsif ($c->param("opsyses")) {
my @opsyses = Litmus::DB::Opsys->retrieve_all();
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson(\@opsyses);
print $js;
} elsif ($c->param("branches")) {
my @branches = Litmus::DB::Branch->retrieve_all();
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson(\@branches);
print $js;
}

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

@ -185,7 +185,37 @@ if ($c->param("text_snippet")) {
}
$vars->{'testcases'} = \@testcases;
$vars->{'search_string_for_display'} = $search_string_for_display;
}
} elsif ($c->param('type') eq 'by_category') {
my $product_id = $c->param("product");
my $testgroup_id = $c->param("testgroup");
my $subgroup_id = $c->param("subgroup");
my ($product, $testgroup, $subgroup);
my @testcases;
if ($subgroup_id && $subgroup_id ne '-Subgroup-' && $subgroup_id ne '---') {
@testcases = Litmus::DB::Testcase->search_BySubgroup($subgroup_id);
$subgroup = Litmus::DB::Subgroup->retrieve($subgroup_id);
$testgroup = Litmus::DB::Testgroup->retrieve($testgroup_id);
$product = Litmus::DB::Product->retrieve($product_id);
} elsif ($testgroup_id && $testgroup_id ne '-Testgroup-' && $testgroup_id ne '---') {
@testcases = Litmus::DB::Testcase->search_ByTestgroup($testgroup_id);
$testgroup = Litmus::DB::Testgroup->retrieve($testgroup_id);
$product = Litmus::DB::Product->retrieve($product_id);
} elsif ($product_id && $product_id ne '-Product-' && $product_id ne '---') {
@testcases = Litmus::DB::Testcase->search(product => $product_id);
$product = Litmus::DB::Product->retrieve($product_id);
}
$vars->{'testcases'} = \@testcases;
$vars->{'search_string_for_display'} =
($product ? "product: ".$product->name() : '').
($testgroup ? " | testgroup: ".$testgroup->name() : '').
($subgroup ? " | subgroup: ".$subgroup->name() : '');
}
Litmus->template()->process("show/search_for_testcases.tmpl", $vars) ||
internalError(Litmus->template()->error());
if ($c->param('print')) {
Litmus->template()->process("show/print_testcases.tmpl", $vars) ||
internalError(Litmus->template()->error());
} else {
Litmus->template()->process("show/search_for_testcases.tmpl", $vars) ||
internalError(Litmus->template()->error());
}

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

@ -34,6 +34,7 @@
<link rel="shortcut icon" href="favicon.ico" />
<link rel="stylesheet" type="text/css" media="all" href="css/litmus.css" />
<link rel="stylesheet" type="text/css" media="print" href="css/litmus_print.css" />
<title>Litmus - [% title | html %]</title>

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

@ -0,0 +1,93 @@
[%# ***** 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 *****
#%]
[%# INTERFACE:
# $search_string_for_display (optional) - query string to display back to the user
# @testcases - test objects to display
#%]
[% title="View Testcase" %]
[% INCLUDE global/html_header.tmpl %]
[% INCLUDE global/litmus_header.tmpl %]
[% IF testcases %]
<h1 class="firstHeading">Print Matching Testcases[% IF search_string_for_display %] - [% search_string_for_display | html %][% END %]</h1>
[% FOREACH test=testcases %]
<div class="testcase">
<div class="testcase-head">
[% test.test_id | html %]: [% test.summary | html %]
</div>
<div class="testcase-content">
[% INCLUDE test/test.html.tmpl testcase=test show_config=0 show_edit=0 print=1 %]
</div>
<table class="radio-testresults">
<tr width="33%">
<td class="pass">
<table>
<tr>
<td><input type="radio" name="testresult_[% testcase_id | html %]"
id="testresult_[% testcase_id | html %]_1" value="1" />
</td><td><label for="testresult_[% testcase_id | html %]_1">Pass</label>
</td>
</tr>
</table>
</td>
<td class="fail">
<table>
<tr width="33%">
<td><input type="radio" name="testresult_[% testcase_id | html %]"
id="testresult_[% testcase_id | html %]_2" value="2"/>
</td><td><labelfor="testresult_[% testcase_id | html %]_2">Fail</label>
</td>
</tr>
</table>
</td>
<td class="unclear">
<table>
<tr width="33%">
<td><input type="radio" name="testresult_[% testcase_id | html %]"
id="testresult_[% testcase_id | html %]_3" value="3" />
</td><td><label for="testresult_[% testcase_id | html %]_3">
Test unclear/broken</label>
</td>
</tr>
</table>
</td>
</table>
</div>
[% END %]
[% END %]
[% INCLUDE global/html_footer.tmpl %]

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

@ -32,12 +32,17 @@
[% title="View Testcase" %]
[% INCLUDE global/html_header.tmpl js_files=['js/Help.js'] %]
[% PROCESS global/selects.none.tmpl %]
[% includeselects=1 %]
[% INCLUDE global/html_header.tmpl js_files=['js/Help.js','js/SelectBoxes.js'] %]
[% INCLUDE global/litmus_header.tmpl %]
<script type="text/javascript">
function init()
{
FormInit(document.forms['testcase_search_by_category'], document.location.search);
FormInit(document.forms['testcase_search_by_id'], document.location.search);
FormInit(document.forms['testcase_fulltext_search'], document.location.search);
FormInit(document.forms['testcase_search_recent'], document.location.search);
@ -58,6 +63,39 @@ var relevanceHelpText = '<p>Relevance values are non-negative floating-point num
<div class="section-full">
<table class="testcase-search">
<tr>
<th>By category</th>
</tr>
<tr>
<td valign="top" width="100%">
<div class="testcase-search">
<form action="show_test.cgi" method="get" name="testcase_search_by_category"
id="testcase_search_by_category">
<input type="hidden" name="type" value="by_category"/>
<table border="0">
<tr>
<td>Product:</td>
<td>Testgroup:</td>
<td>Subgroup:</td>
</tr>
<tr>
<td>
[% INCLUDE productbox onchange="changeProduct();" %]
</td>
<td>
[% INCLUDE testgroupbox onchange="changeTestgroup();" %]
</td>
<td>
[% INCLUDE subgroupbox onchange="" %]
</td>
</tr>
</table>
<input class="button" type="submit" value="Search By Category">
</form></div></td>
</tr>
</table>
<table class="testcase-search">
<tr>
<th>By Testcase ID#</th>
@ -77,9 +115,17 @@ var relevanceHelpText = '<p>Relevance values are non-negative floating-point num
[% IF testcases %]
<h1 class="firstHeading">Matching Testcases[% IF search_string_for_display %] - [% search_string_for_display | html %][% END %]</h1>
<div class="section-full">
<b><a id="printlink" href="">print all testcases</a></b>
<script type="text/javascript">
document.getElementById('printlink').href=document.location+"&print=1";
</script>
</div>
<div class="section-full">
<div class="section-content">
[% INCLUDE show/testcase_list.tmpl %]
</div>

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

@ -3,10 +3,10 @@
<h3>Options</h3>
<ul>
<li><a href="run_tests.cgi">Run Tests</a></li>
<li><a href="show_test.cgi">View Testcase</a></li>
<li><a href="search_results.cgi">Search Results</a></li>
<li><a href="show_test.cgi">View Tests</a></li>
<li><a href="search_results.cgi">Search Results</a></li>
<li><a href="advanced_search.cgi">Advanced Search</a></li>
<li><a href="stats.cgi">Statistics</a></li>
<li><a href="stats.cgi">Statistics</a></li>
</ul>
</div>
</div>

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

@ -78,7 +78,7 @@
</td>
</tr>
[% IF defaultemail AND ! show_edit %]
[% IF (defaultemail AND ! show_edit) and ! print %]
<!-- Only allow the user to submit a single result if they are already
logged in. -->
<tr>
@ -105,6 +105,7 @@
<div class="dv"><input type="text" name="bugs_[% testcase.testcase_id | html %]"
class="result_bug" /> (bug #,bug #,...)</div>
</td>
</tr>
</table>