- change Litmus::FormWidget funciton name to getTestgroups
- add Essential column designations to Litmus::DB::Testgroup
- add functions to Litmus::DB::Testgroup: clone, delete_from_subgroups, delete_from_test_runs (stub), delete_with_refs, update_subgroups
- add testgroup display to mimic display for testcase

Manage subgroups
- display loading message for subgroups
- fix nesting of default option selection
- add subgroup display to mimic display for testcase
This commit is contained in:
ccooper%deadsquid.com 2006-06-27 15:51:58 +00:00
Родитель 2a064b22ba
Коммит 34500452dd
15 изменённых файлов: 757 добавлений и 28 удалений

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

@ -38,6 +38,7 @@ use base 'Litmus::DBI';
Litmus::DB::Testgroup->table('testgroups');
Litmus::DB::Testgroup->columns(All => qw/testgroup_id product_id name enabled testrunner_plan_id/);
Litmus::DB::Testgroup->columns(Essential => qw/testgroup_id product_id name enabled testrunner_plan_id/);
Litmus::DB::Testgroup->column_alias("product_id", "product");
@ -49,18 +50,36 @@ __PACKAGE__->set_sql(EnabledByBranch => qq{
WHERE tgb.branch_id=? AND tgb.testgroup_id=tg.testgroup_id AND tg.enabled=1 ORDER by tg.name ASC
});
__PACKAGE__->set_sql(ByBranch => qq{
SELECT tg.*
FROM testgroups tg, testgroup_branches tgb
WHERE tgb.branch_id=? AND tgb.testgroup_id=tg.testgroup_id ORDER by tg.name ASC
});
__PACKAGE__->set_sql(EnabledBySubgroup => qq{
SELECT tg.*
FROM testgroups tg, subgroup_testgroups sgtg
WHERE sgtg.subgroup_id=? AND sgtg.testgroup_id=tg.testgroup_id AND tg.enabled=1 ORDER by tg.name ASC
});
__PACKAGE__->set_sql(BySubgroup => qq{
SELECT tg.*
FROM testgroups tg, subgroup_testgroups sgtg
WHERE sgtg.subgroup_id=? AND sgtg.testgroup_id=tg.testgroup_id ORDER by tg.name ASC
});
__PACKAGE__->set_sql(EnabledByTestcase => qq{
SELECT tg.*
FROM testgroups tg, subgroup_testgroups sgtg, testcase_subgroups tcsg
WHERE tcsg.testcase_id=? AND tcsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=tg.testgroup_id AND tg.enabled=1 ORDER by tg.name ASC
});
__PACKAGE__->set_sql(ByTestcase => qq{
SELECT tg.*
FROM testgroups tg, subgroup_testgroups sgtg, testcase_subgroups tcsg
WHERE tcsg.testcase_id=? AND tcsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=tg.testgroup_id ORDER by tg.name ASC
});
#########################################################################
sub coverage {
my $self = shift;
@ -98,6 +117,92 @@ sub coverage {
return sprintf("%d",$total_percentage);
}
#########################################################################
sub clone() {
my $self = shift;
my $new_testgroup = $self->copy;
if (!$new_testgroup) {
return undef;
}
# Propagate testgroup membership;
my $dbh = __PACKAGE__->db_Main();
my $sql = "INSERT INTO subgroup_testgroups (subgroup_id,testgroup_id,sort_order) SELECT subgroup_id,?,sort_order FROM subgroup_testgroups WHERE testgroup_id=?";
my $rows = $dbh->do($sql,
undef,
$new_testgroup->testgroup_id,
$self->testgroup_id
);
if (! $rows) {
# XXX: Do we need to throw a warning here?
}
return $new_testgroup;
}
#########################################################################
sub delete_from_subgroups() {
my $self = shift;
my $dbh = __PACKAGE__->db_Main();
my $sql = "DELETE from subgroup_testgroups WHERE testgroup_id=?";
my $rows = $dbh->do($sql,
undef,
$self->testgroup_id
);
}
#########################################################################
sub delete_from_test_runs() {
my $self = shift;
# XXX: Placeholder for test runs.
return;
}
#########################################################################
sub delete_with_refs() {
my $self = shift;
$self->delete_from_subgroups();
$self->delete_from_test_runs();
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 testgroup.
my $rv = $self->delete_from_subgroups();
my $dbh = __PACKAGE__->db_Main();
my $sql = "INSERT INTO subgroup_testgroups (subgroup_id,testgroup_id,sort_order) VALUES (?,?,?)";
my $sort_order = 1;
foreach my $new_subgroup_id (@$new_subgroup_ids) {
next if (!$new_subgroup_id);
# Log any failures/duplicate keys to STDERR.
eval {
my $rows = $dbh->do($sql,
undef,
$new_subgroup_id,
$self->testgroup_id,
$sort_order
);
};
if ($@) {
print STDERR $@;
}
$sort_order++;
}
}
}
1;
1;

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

@ -169,13 +169,6 @@ sub getResultStatuses()
return _getValues($sql);
}
#########################################################################
sub getTestGroups()
{
my $sql = "SELECT DISTINCT(name) FROM testgroups ORDER BY name";
return _getValues($sql);
}
#########################################################################
sub getTestcaseIDs()
{
@ -193,10 +186,18 @@ sub getTestcases()
#########################################################################
sub getSubgroups()
{
my $sql = "SELECT subgroup_id, name FROM subgroups ORDER BY name, subgroup_id";
my $sql = "SELECT subgroup_id, name, product_id FROM subgroups ORDER BY name, subgroup_id";
return _getValues($sql);
}
#########################################################################
sub getTestgroups()
{
my $sql = "SELECT testgroup_id, name, product_id FROM testgroups ORDER BY name, testgroup_id";
return _getValues($sql);
}
#########################################################################
sub getLocales()
{

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

@ -202,7 +202,7 @@ if ($c->param) {
# Set a default value as appropriate.
my $products = Litmus::FormWidget->getProducts;
my $platforms = Litmus::FormWidget->getUniquePlatforms;
my $test_groups = Litmus::FormWidget->getTestGroups;
my $test_groups = Litmus::FormWidget->getTestgroups;
my $testcases = Litmus::FormWidget->getTestcaseIDs;
my $result_statuses = Litmus::FormWidget->getResultStatuses;
my $branches = Litmus::FormWidget->getBranches;

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

@ -939,11 +939,11 @@ table.manage input.button {
margin: 5px;
}
select.testcase-subgroups {
select.testcase-subgroups, select.subgroup-testgroups {
width: 300px;
}
select.testcase, select.subgroup {
select.testcase_id, select.subgroup_id, select.testgroup_id {
width: 700px;
}
@ -1130,7 +1130,7 @@ div.section-content {
padding-right: 10px;
}
div.testcase-content {
div.testcase-content, div.subgroup-content, div.testgroup-content {
padding: 0px;
margin: 5px 10px 0px 10px;
width: auto;
@ -1213,3 +1213,28 @@ div.or {
padding: 1em 0 1em 0;
font-weight: bold;
}
table.testcase-search, table.test-runs {
border: 0;
margin: 0;
padding: 0;
background: inherit;
width: 100%
}
table.testcase-search th, table.test-runs th {
vertical-align: middle;
font-weight: bold;
text-transform: lowercase;
text-align: left;
color: #666666;
padding: 0px 5px 0px 5px;
border: 0;
}
div.testcase-search {
margin: 5px;
background-color: #efefef;
padding: 10px;
border: solid #bbbbbb 1px;
}

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

@ -48,7 +48,7 @@ my ($criteria,$results) = Litmus::DB::Testresult->getDefaultTestResults;
my $products = Litmus::FormWidget->getProducts();
my $platforms = Litmus::FormWidget->getUniquePlatforms();
my $test_groups = Litmus::FormWidget->getTestGroups();
my $test_groups = Litmus::FormWidget->getTestgroups();
my $result_statuses = Litmus::FormWidget->getResultStatuses;
my $branches = Litmus::FormWidget->getBranches();

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

@ -60,4 +60,16 @@ if ($c->param("testcase_id")) {
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($subgroup);
print $js;
} elsif ($c->param("testgroup_id")) {
my $testgroup_id = $c->param("testgroup_id");
my $testgroup = Litmus::DB::Testgroup->retrieve($testgroup_id);
my @subgroups = Litmus::DB::Subgroup->search_EnabledByTestgroup($testgroup_id);
$testgroup->{'subgroups'} = \@subgroups;
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($testgroup);
print $js;
}

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

@ -153,7 +153,7 @@ if ($c->param) {
# Set a default value as appropriate.
my $products = Litmus::FormWidget->getProducts;
my $platforms = Litmus::FormWidget->getUniquePlatforms;
my $test_groups = Litmus::FormWidget->getTestGroups;
my $test_groups = Litmus::FormWidget->getTestgroups;
my $result_statuses = Litmus::FormWidget->getResultStatuses;
my $branches = Litmus::FormWidget->getBranches;
my $locales = Litmus::FormWidget->getLocales;

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

@ -0,0 +1,136 @@
[%# ***** 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:
# $testgroup - the testgroup object to show
#%]
<script type="text/javascript">
function checkFormContents(f) {
return (
checkString(f.editform_name, 'Name') &&
verifySelected(f.product, 'Product')
);
}
function previewSubgroup(selectID) {
var selectBox = document.getElementById(selectID);
if (selectBox) {
if (selectBox.selectedIndex >= 0) {
if (selectBox.options[selectBox.selectedIndex].value != '') {
window.open('manage_subgroups.cgi?subgroup_id=' + selectBox.options[selectBox.selectedIndex].value,
'subgroup_preview');
}
} else {
toggleMessage('failure','No testgroup selected!');
}
}
}
var manageTestgroupsHelpTitle="Help with Managing Testgroups";
var manageTestgroupsHelpText="<p>The select box on the left contains all the subgroups for the chosen product, <strong><em>INCLUDING</em></strong> any subgroups already contained in the testgroup. You can use the <input type='button' value='&rArr;' disabled> button to add subgroups to the testgroup, and the <input type='button' value='&lArr;' disabled> button to remove subgroups from the testgroup. <strong>NOTE</strong>: neither of the actions will alter the list of subgroups on the left.</p><p>You can preview any subgroup from the left-hand select box by selecting the subgroup, and then clicking on the 'Preview Subgroup' link below the select box. If more than one subgroup is selected, only the first subgroup will be previewed.</p><p>You can change the display order of subgroups within the testgroup using the <input type='button' value='&uArr;' disabled> and <input type='button' value='&dArr;' disabled> buttons to the right of the right-hand select box. Subgroups can be re-ordered singly or in groups by selecting multiple subgroups in the right-hand select box.</p>";
</script>
<form id="edit_testgroup_form" name="edit_testgroup_form" method="post" action="manage_testgroups.cgi" onSubmit="selectNone('editform_subgroups_for_product');selectAll('editform_testgroup_subgroups');return checkFormContents(this);">
<input id="editform_mode" name="editform_mode" type="hidden" value="edit">
<input id="editform_testgroup_id" name="editform_testgroup_id" type="hidden" value="">
<table class="manage">
<tr>
<td class="headerleft">Testgroup ID#:</td>
<td name="editform_testgroup_id_display" id="editform_testgroup_id_display"></td>
</tr>
<tr>
<td class="headerleft">Name:</td>
<td><input name="editform_name"
id="editform_name"
value=""
size="35"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Product:</td>
<td>[% INCLUDE productbox onchange="changeProduct();populateAllSubgroups();" %]</td>
</tr>
<!-- XXX: Placeholder for test runs. -->
<tr>
<td class="headerleft">Enabled?</td>
<td>
<input name="editform_enabled"
type="checkbox"
id="editform_enabled"
value="1" disabled
onChange="if (this.checked == false) {document.getElementById('editform_communityenabled').checked =false;}">
</td>
<td>&lArr;&nbsp;Uncheck this to completely disable this testgroup.</td>
</tr>
<tr>
<td class="headerleft">Testrunner Plan ID#:</td>
<td name="editform_testrunner_plan_id" id="editform_testrunner_plan_id"></td>
</tr>
<tr>
<td colspan="3"><hr/></td>
</tr>
<tr>
<td class="headerleft" colspan="3">Manage Subgroups for this Testgroup</td>
</tr>
<tr>
<td colspan="3">
<div class="manage">
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td id="editform_subgroups_for_product_header" name="editform_subgroups_for_product_header" class="headerleft">All Subgroups For Product</td>
<td></td>
<td class="headerleft">Subgroups in Testgroup</td>
</tr>
<tr>
<td><select multiple class="subgroup-testgroups" id="editform_subgroups_for_product" name="editform_subgroups_for_product" size="15">
<option value="">--No product selected--</option>
</select></td>
<td align="center" valign="middle"><input id="add_subgroup_button" name="add_subgroup_button" type="button" value="&rArr;" onClick="copyToList('editform_subgroups_for_product','editform_testgroup_subgroups');"><br/><br/><input id="remove_subgroup_button" name="remove_subgroup_button" type="button" value="&lArr;" onClick="removeSelectedFromList('editform_testgroup_subgroups',true);"></td>
<td><select multiple class="subgroup-testgroups" id="editform_testgroup_subgroups" name="editform_testgroup_subgroups" size="15">
<option value="">--No testgroup selected--</option>
</select></td>
<td align="center" valign="middle"><input id="move_subgroup_up_button" name="move_subgroup_up_button" type="button" value="&uArr;" onClick="up('editform_testgroup_subgroups');"><br/><br/><input id="move_subgroup_down_button" name="move_subgroup_down_button" type="button" value="&dArr;" onClick="down('editform_testgroup_subgroups');"></td>
</tr>
<tr>
<td align="right">&uArr;&nbsp;<a name="previewSubgroup" onclick="previewSubgroup('editform_subgroups_for_product');">Preview Subgroup</a></td>
<td></td>
<td align="right">&uArr;&nbsp;<a name="showManageSubgroupsHelp" onclick="toggleHelp(manageSubgroupsHelpTitle,manageSubgroupsHelpText);">Help with Managing Subgroups</a></td>
<td></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="3" align="right"><input id="editform_reset" class="button" type="button" value="Reset" disabled />&nbsp;<input class="button" type="submit" id="editform_submit" name="editform_submit" value="Submit Edits" disabled /></div>
</td>
</tr>
</table>
</form>

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

@ -54,6 +54,8 @@ function loadSubgroup() {
if (! subgroup_select ||
subgroup_select.options[subgroup_select.selectedIndex].value=="") {
disableModeButtons();
document.getElementById('subgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'none';
disableForm('edit_subgroup_form');
blankForm('edit_subgroup_form');
return false;
@ -63,9 +65,11 @@ function loadSubgroup() {
disableForm('edit_subgroup_form');
var url = 'json.cgi?subgroup_id=' + subgroup_id;
toggleMessage('loading','Loading Subgroup ID# ' + subgroup_id + '...');
var d = loadJSONDoc(url);
d.addBoth(function (res) {
d.deferred = null;
toggleMessage('none');
return res;
});
d.addCallback(populateSubgroup);
@ -85,12 +89,16 @@ function populateSubgroup(data) {
document.getElementById('editform_subgroup_id').value = subgroup.subgroup_id;
document.getElementById('editform_subgroup_id_display').innerHTML = subgroup.subgroup_id;
document.getElementById('editform_name').value = subgroup.name;
document.getElementById('name_text').innerHTML = subgroup.name;
document.getElementById('subgroup_id_display').innerHTML = subgroup.subgroup_id;
var productBox = document.getElementById('product');
var options = productBox.getElementsByTagName('option');
var found_product = 0;
for (var i=0; i<options.length; i++) {
if (options[i].value == subgroup.product_id.product_id) {
options[i].selected = true;
document.getElementById('product_text').innerHTML = options[i].text;
found_product=1;
} else {
options[i].selected = false;
@ -114,9 +122,24 @@ function populateSubgroup(data) {
}
}
if (found_testgroup == 0) {
options[0].selected = true;
if (options[0]) {
options[0].selected = true;
}
}
var testgroups_text = "";
for (var i in subgroup.testgroups) {
if (subgroup.testgroups[i].name != '') {
testgroups_text = testgroups_text + subgroup.testgroups[i].name + ', ';
}
}
if (testgroups_text != '') {
testgroups_text = testgroups_text.replace(/, $/g,'');
document.getElementById('testgroups_display').innerHTML = testgroups_text;
} else {
document.getElementById('testgroups_display').innerHTML = '<span class="errorHeading">This subgroup does not belong to any testgroups that are currently enabled.</span>';
}
changeTestgroup();
var enabled_em = document.getElementById('editform_enabled')
if (subgroup.enabled == 1) {
enabled_em.checked = true;
@ -135,6 +158,8 @@ function populateSubgroup(data) {
subgroup.testcases[i].testcase_id);
}
document.getElementById('editform_div').style.display = 'none';
document.getElementById('subgroup_display_div').style.display = 'block';
enableModeButtons();
}
@ -142,6 +167,7 @@ function blankForm(formid) {
var f = document.getElementById(formid);
var ems = f.getElementsByTagName('input');
for (var i in ems) {
ems[i].checked=false;
if (ems[i].type == 'submit' ||
ems[i].value == 'Reset' ||
ems[i].type == 'radio' ||
@ -150,7 +176,6 @@ function blankForm(formid) {
continue;
}
ems[i].value='';
ems[i].checked=false;
}
ems = f.getElementsByTagName('select');
for (var i in ems) {
@ -171,6 +196,9 @@ function blankForm(formid) {
selectBoxSubgroup.options[selectBoxSubgroup.length] = new Option("--No subgroup selected--",
"");
selectBoxSubgroup.selectedIndex=-1
document.getElementById('editform_testrunner_group_id').innerHTML = '';
changeProduct();
changeTestgroup();
}
@ -181,12 +209,16 @@ function switchToAdd() {
document.getElementById('editform_submit').value = 'Add Subgroup';
document.getElementById('editform_mode').value = 'add';
enableForm('edit_subgroup_form');
document.getElementById('subgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'block';
}
function switchToEdit() {
document.getElementById('editform_submit').value = 'Submit Edits';
document.getElementById('editform_mode').value = 'edit';
enableForm('edit_subgroup_form');
document.getElementById('subgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'block';
}
function populateAllTestcases() {
@ -237,8 +269,18 @@ function populateAllTestcases() {
</div> <!--end section-content-->
</div> <!--end section-full-->
<div class="section-full">
<div id="subgroup-title" class="section-header">Subgroup info</div>
<div style="display: none;" id="subgroup_display_div" class="section-full">
<div id="subgroup-title" class="section-header">Subgroup Info</div>
<div class="section-content">
<div class="subgroup-content">
[% INCLUDE subgroup/subgroup.tmpl subgroup=subgroup show_config=1 show_edit=1 %]
</div>
</div>
</div>
<div style="display: none;" id="editform_div" class="section-full">
<div id="subgroup-title" class="section-header">Subgroup Info</div>
<div class="section-content">

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

@ -110,9 +110,9 @@ function populateTestcase(data) {
} else {
options[i].selected = false;
}
}
if (found_product == 0) {
options[0].selected = true;
if (found_product == 0) {
options[0].selected = true;
}
}
changeProduct();
var found_testgroup = 0;
@ -127,9 +127,9 @@ function populateTestcase(data) {
options[i].selected = false;
}
}
}
if (found_testgroup == 0) {
options[0].selected = true;
if (found_testgroup == 0) {
options[0].selected = true;
}
}
var testgroups_text = "";
@ -158,9 +158,9 @@ function populateTestcase(data) {
options[i].selected = false;
}
}
}
if (found_subgroup == 0) {
options[0].selected = true;
if (found_subgroup == 0) {
options[0].selected = true;
}
}
var subgroups_text = "";

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

@ -0,0 +1,278 @@
[%# ***** 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 *****
#%]
[% PROCESS global/selects.none.tmpl %]
[% includeselects=1 %]
[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/FormValidation.js','js/MochiKit/MochiKit.js','js/json.js','js/Help.js','js/SelectBoxes.js','js/SelectSort.js'] %]
[% INCLUDE global/litmus_header.tmpl %]
<script type="text/javascript">
var d;
var testgroup;
var subgroups=[% IF all_subgroups %][% all_subgroups %][% ELSE %]{}[% END %];
function enableModeButtons() {
document.getElementById("edit_testgroup_button").disabled=false;
document.getElementById("clone_testgroup_button").disabled=false;
document.getElementById("delete_testgroup_button").disabled=false;
}
function disableModeButtons() {
document.getElementById("edit_testgroup_button").disabled=true;
document.getElementById("clone_testgroup_button").disabled=true;
document.getElementById("delete_testgroup_button").disabled=true;
}
function loadTestgroup() {
var testgroup_select = document.getElementById("testgroup_id");
if (! testgroup_select ||
testgroup_select.options[testgroup_select.selectedIndex].value=="") {
disableModeButtons();
document.getElementById('testgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'none';
disableForm('edit_testgroup_form');
blankForm('edit_testgroup_form');
return false;
}
var testgroup_id = testgroup_select.options[testgroup_select.selectedIndex].value;
disableForm('edit_testgroup_form');
toggleMessage('loading','Loading Testgroup ID# ' + testgroup_id + '...');
var url = 'json.cgi?testgroup_id=' + testgroup_id;
var d = loadJSONDoc(url);
d.addBoth(function (res) {
d.deferred = null;
toggleMessage('none');
return res;
});
d.addCallback(populateTestgroup);
// if anything goes wrong, except for a simple cancellation,
// then log the error and show the logger
d.addErrback(function (err) {
if (err instanceof CancelledError) {
return;
}
logError(err);
logger.debuggingBookmarklet();
});
}
function populateTestgroup(data) {
testgroup=data;
document.getElementById('editform_testgroup_id').value = testgroup.testgroup_id;
document.getElementById('editform_testgroup_id_display').innerHTML = testgroup.testgroup_id;
document.getElementById('editform_name').value = testgroup.name;
document.getElementById('name_text').innerHTML = testgroup.name;
document.getElementById('testgroup_id_display').innerHTML = testgroup.testgroup_id;
var productBox = document.getElementById('product');
var options = productBox.getElementsByTagName('option');
var found_product = 0;
for (var i=0; i<options.length; i++) {
if (options[i].value == testgroup.product_id.product_id) {
options[i].selected = true;
document.getElementById('product_text').innerHTML = options[i].text;
found_product=1;
} else {
options[i].selected = false;
}
if (found_product == 0) {
options[0].selected = true;
}
}
changeProduct();
var enabled_em = document.getElementById('editform_enabled')
if (testgroup.enabled == 1) {
enabled_em.checked = true;
} else {
enabled_em.checked = false;
}
document.getElementById('editform_testrunner_plan_id').innerHTML = testgroup.testrunner_plan_id;
populateAllSubgroups();
var selectBoxTestgroup = document.getElementById('editform_testgroup_subgroups');
selectBoxTestgroup.options.length = 0;
for (var i=0; i<testgroup.subgroups.length; i++) {
var optionText = testgroup.subgroups[i].name + ' (' + testgroup.subgroups[i].subgroup_id + ')';
selectBoxTestgroup.options[selectBoxTestgroup.length] = new Option(optionText,
testgroup.subgroups[i].subgroup_id);
}
document.getElementById('editform_div').style.display = 'none';
document.getElementById('testgroup_display_div').style.display = 'block';
enableModeButtons();
}
function blankForm(formid) {
var f = document.getElementById(formid);
var ems = f.getElementsByTagName('input');
for (var i in ems) {
ems[i].checked=false;
if (ems[i].type == 'submit' ||
ems[i].value == 'Reset' ||
ems[i].type == 'radio' ||
ems[i].type == 'checkbox' ||
ems[i].type == 'button') {
continue;
}
ems[i].value='';
}
ems = f.getElementsByTagName('select');
for (var i in ems) {
ems[i].selectedIndex=0;
}
ems = f.getElementsByTagName('textarea');
for (var i in ems) {
ems[i].value='';
}
document.getElementById('editform_testgroup_id_display').innerHTML = '';
var selectBoxAll = document.getElementById('editform_subgroups_for_product');
selectBoxAll.options.length = 0;
selectBoxAll.options[selectBoxAll.length] = new Option("--No product selected--",
"");
selectBoxAll.selectedIndex=-1
var selectBoxTestgroup = document.getElementById('editform_testgroup_subgroups');
selectBoxTestgroup.options.length = 0;
selectBoxTestgroup.options[selectBoxTestgroup.length] = new Option("--No testgroup selected--",
"");
selectBoxTestgroup.selectedIndex=-1
document.getElementById('editform_testrunner_plan_id').innerHTML = '';
changeProduct();
}
function switchToAdd() {
disableModeButtons();
blankForm('edit_testgroup_form');
document.getElementById('editform_submit').value = 'Add Testgroup';
document.getElementById('editform_mode').value = 'add';
enableForm('edit_testgroup_form');
document.getElementById('testgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'block';
}
function switchToEdit() {
document.getElementById('editform_submit').value = 'Submit Edits';
document.getElementById('editform_mode').value = 'edit';
enableForm('edit_testgroup_form');
document.getElementById('testgroup_display_div').style.display = 'none';
document.getElementById('editform_div').style.display = 'block';
}
function populateAllSubgroups() {
var productBox = document.getElementById('product');
var selectBoxAll = document.getElementById('editform_subgroups_for_product');
selectBoxAll.options.length = 0;
for (var i in subgroups) {
if (subgroups[i].product_id == productBox.options[productBox.selectedIndex].value) {
var optionText = subgroups[i].name + ' (' + subgroups[i].subgroup_id + ')';
selectBoxAll.options[selectBoxAll.length] = new Option(optionText,
subgroups[i].subgroup_id);
}
}
}
</script>
<div id="page">
[% INCLUDE sidebar/sidebar.tmpl %]
<div id="content">
<h1 class="firstHeading">[% title %]</h1>
<div class="section-full">
<div class="section-header">Existing Testgroups</div>
<div class="section-content">
<form id="select_testgroup_and_mode_form" name="select_testgroup_and_mode_form" method="post" action="manage_testgroups.cgi">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
[% INCLUDE form_widgets/select_testgroup_id.tmpl name="testgroup_id" placeholder=1 size=10 onchange="loadTestgroup();" %]
</td>
</tr>
<tr>
<td>
<input id="add_testgroup_button" name="add_testgroup_button" class="manage" type="button" onClick="switchToAdd();" value="Add testgroup">&nbsp;
<input id="edit_testgroup_button" name="edit_testgroup_button" class="manage" type="button" onClick="switchToEdit();" value="Edit testgroup" disabled>&nbsp;
<input id="clone_testgroup_button" name="clone_testgroup_button" class="manage" type="submit" onClick="confirm('Really clone this testgroup?');" value="Clone testgroup" disabled>&nbsp;
<input id="delete_testgroup_button" name="delete_testgroup_button" class="manage" type="submit" onClick="confirm('Really delete this testgroup?');" value="Delete testgroup" disabled>
</td>
</tr>
</table>
</form>
</div> <!--end section-content-->
</div> <!--end section-full-->
<div style="display: none;" id="testgroup_display_div" class="section-full">
<div id="testgroup-title" class="section-header">Testgroup Info</div>
<div class="section-content">
<div class="testgroup-content">
[% INCLUDE testgroup/testgroup.tmpl testgroup=testgroup show_config=1 show_edit=1 %]
</div>
</div>
</div>
<div style="display: none;" id="editform_div" class="section-full">
<div id="testgroup-title" class="section-header">Testgroup Info</div>
<div class="section-content">
[% INCLUDE admin/edit_testgroup.tmpl %]
</div> <!--end section-content-->
</div> <!--end section-full-->
</div> <!--END content-->
</div> <!--END page-->
<script type="text/javascript">
var em = document.getElementById('testgroup_id');
if (em.selectedIndex >= 0) {
loadTestgroup();
enableForm('edit_testgroup_form');
} else {
disableForm('edit_testgroup_form');
}
</script>
[% INCLUDE global/litmus_footer.tmpl %]
[% INCLUDE global/html_footer.tmpl %]

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

@ -0,0 +1,9 @@
<select class="testgroup" id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF onchange %] onChange="[% onchange %]"[% END %][% IF disabled %] disabled[% END %]>
[% IF placeholder %]<option value="">-Testgroup Name (Testgroup ID#)-</option>[% END %]
[% IF testgroups %]
[% FOREACH testgroup=testgroups %]
<option[% IF defaults.testgroup_id==testgroup.testgroup_id %] selected[% END %]
value="[% testgroup.testgroup_id | html %]">[% testgroup.name %] ([% testgroup.testgroup_id | html%])</option>
[% END %]
[% END %]
</select>

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

@ -7,7 +7,7 @@
<hr/>
<li><a href="manage_testcases.cgi">Manage Testcases</a></li>
<li><a href="manage_subgroups.cgi">Manage Subgroups</a></li>
<li>Manage Testgroups</li>
<li><a href="manage_testgroups.cgi">Manage Testgroups</a></li>
<hr/>
<li>Manage Categories</li>
<li><a href="edit_users.cgi">Manage Users</a></li>

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

@ -0,0 +1,63 @@
[%# ***** 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:
# $subgroup - the subgroup object to show
# $show_config - display the config options (testgroup, etc.)
# for a given subgroup
# $show_edit (optional) - display subgroup for editing
#%]
[% PROCESS global/selects.none.tmpl %]
[% IF show_config %]
<table cellspacing="0" cellpadding="0" class="tcm">
<tr>
<td width="20%"><b>Product:</b></td>
<td>
<div id="product_text[% IF ! show_edit %]_[% subgroup.subgroup_id | html %][% END %]">[% subgroup.product.name | html %]</div>
</td>
[% IF ! show_edit %]<td align="right" valign="top" colspan="5"><a href="manage_subgroups.cgi?subgroup_id=[%subgroup.subgroup_id | html%]"> Edit Subgroup</a></td>[% END %]
</tr>
<tr>
<td><b>Test Group(s):</b></td>
<td>
<div id="testgroups_display[% IF ! show_edit %]_[% subgroup.subgroup_id | html %][% END %]">[% IF testgroups.size==0 %]<span class="errorHeading">This subgroup does not belong to any testgroups that are currently enabled.</span>[% ELSE %][% FOREACH testgroup=testgroups %][% testgroup.name | html %][% UNLESS loop.last %], [% END %][% END %][% END %]</div>
</td>
</tr>
<tr>
<td><b>Subgroup ID #:</b></td>
<td id="subgroup_id_display[% IF ! show_edit %]_[% subgroup.subgroup_id | html %][% END %]">[% subgroup.subgroup_id | html %]</td>
</tr>
<tr>
<td><b>Name:</b></td>
<td><div id="name_text[% IF ! show_edit %]_[% subgroup.subgroup_id | html%][% END %]">[% subgroup.name | html %]</div></td>
</tr>
</table>
<br clear="all" />
[% END %]

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

@ -0,0 +1,58 @@
[%# ***** 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:
# $testgroup - the testgroup object to show
# $show_config - display the config options (product, etc.)
# for a given testgroup
# $show_edit (optional) - display testgroup for editing
#%]
[% PROCESS global/selects.none.tmpl %]
[% IF show_config %]
<table cellspacing="0" cellpadding="0" class="tcm">
<tr>
<td width="20%"><b>Product:</b></td>
<td>
<div id="product_text[% IF ! show_edit %]_[% testgroup.testgroup_id | html %][% END %]">[% testgroup.product.name | html %]</div>
</td>
[% IF ! show_edit %]<td align="right" valign="top" colspan="5"><a href="manage_testgroups.cgi?testgroup_id=[%testgroup.testgroup_id | html%]"> Edit Testgroup</a></td>[% END %]
</tr>
<!-- XXX: Placeholder for test runs -->
<tr>
<td><b>Testgroup ID #:</b></td>
<td id="testgroup_id_display[% IF ! show_edit %]_[% testgroup.testgroup_id | html %][% END %]">[% testgroup.testgroup_id | html %]</td>
</tr>
<tr>
<td><b>Name:</b></td>
<td><div id="name_text[% IF ! show_edit %]_[% testgroup.testgroup_id | html%][% END %]">[% testgroup.name | html %]</div></td>
</tr>
</table>
<br clear="all" />
[% END %]