- renamed edit_categories.cgi to manage_categories.cgi for consistency's sake

- added json calls to return various categories
- added FormWidget calls branches and opsyses
- removed product references in FormWidget lookup for platforms
- added Essential column designation to Platform, Branch and Opsys
- added delete functions to Platform
- added delete functions to Product
- updated moo.fx js libraries to latest version (1.0->1.2)
- updated js code that relied on out-of-date moo.fx functions. In all cases, this code got simpler cleaner.
- removed moo.fx inclusions where they weren't being used
- updated category management templates to use MochiKit/JSON rather than homegrown AJAX
- added new widget for selecting branch, platform, and opsys by ID
- fixed naming on show all/hide all links on testcase display (run tests)
- jump to testcase when selecting a testcase from the sidebar (run tests)
- enabled "Manage Categories" in the admin sidebar
This commit is contained in:
ccooper%deadsquid.com 2006-07-14 17:47:33 +00:00
Родитель 6e6a887344
Коммит 7ebff01f30
29 изменённых файлов: 1777 добавлений и 957 удалений

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

@ -38,6 +38,7 @@ use base 'Litmus::DBI';
Litmus::DB::Branch->table('branches');
Litmus::DB::Branch->columns(All => qw/branch_id product_id name detect_regexp enabled/);
Litmus::DB::Branch->columns(Essential => qw/branch_id product_id name detect_regexp enabled/);
Litmus::DB::Branch->column_alias("product_id", "product");

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

@ -38,6 +38,7 @@ use base 'Litmus::DBI';
Litmus::DB::Opsys->table('opsyses');
Litmus::DB::Opsys->columns(All => qw/opsys_id platform_id name detect_regexp/);
Litmus::DB::Opsys->columns(Essential => qw/opsys_id platform_id name detect_regexp/);
Litmus::DB::Opsys->column_alias("platform_id", "platform");

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

@ -39,10 +39,10 @@ use CGI;
Litmus::DB::Platform->table('platforms');
Litmus::DB::Platform->columns(All => qw/platform_id name detect_regexp iconpath/);
Litmus::DB::Platform->columns(Essential => qw/platform_id name detect_regexp iconpath/);
Litmus::DB::Platform->column_alias("platform_id", "platformid");
Litmus::DB::Platform->has_many(test_results => "Litmus::DB::Testresult");
Litmus::DB::Platform->has_many(opsyses => "Litmus::DB::Opsys");
Litmus::DB::Platform->set_sql(ByProduct => qq{
@ -58,4 +58,48 @@ Litmus::DB::Platform->set_sql(ByProductAndName => qq{
AND pl.name=?
});
#########################################################################
sub delete_from_products() {
my $self = shift;
my $dbh = __PACKAGE__->db_Main();
my $sql = "DELETE from platform_products WHERE platform_id=?";
my $rows = $dbh->do($sql,
undef,
$self->platform_id
);
}
#########################################################################
sub delete_with_refs() {
my $self = shift;
$self->delete_from_products();
# XXX: How to handle opsyses?
return $self->delete;
}
#########################################################################
sub update_products() {
my $self = shift;
my $new_product_ids = shift;
if (scalar @$new_product_ids) {
# Failing to delete products is _not_ fatal when adding a new subgroup.
my $rv = $self->delete_from_products();
my $dbh = __PACKAGE__->db_Main();
my $sql = "INSERT INTO platform_products (platform_id,product_id) VALUES (?,?)";
foreach my $new_product_id (@$new_product_ids) {
my $rows = $dbh->do($sql,
undef,
$self->platform_id,
$new_product_id
);
}
}
}
1;

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

@ -38,6 +38,7 @@ use base 'Litmus::DBI';
Litmus::DB::Product->table('products');
Litmus::DB::Product->columns(All => qw/product_id name iconpath enabled/);
Litmus::DB::Product->columns(Essential => qw/product_id name iconpath enabled/);
Litmus::DB::Product->column_alias("product_id", "productid");
@ -50,4 +51,58 @@ Litmus::DB::Product->has_many(testgroups => "Litmus::DB::Testgroup",
Litmus::DB::Product->has_many(branches => "Litmus::DB::Branch",
{ order_by => 'name' });
__PACKAGE__->set_sql(ByPlatform => qq{
SELECT pr.*
FROM products pr, platform_products plpr
WHERE plpr.platform_id=? AND plpr.product_id=pr.product_id
ORDER BY pr.name ASC
});
#########################################################################
sub delete_from_platforms() {
my $self = shift;
my $dbh = __PACKAGE__->db_Main();
my $sql = "DELETE from platform_products WHERE product_id=?";
my $rows = $dbh->do($sql,
undef,
$self->product_id
);
}
#########################################################################
sub delete_with_refs() {
my $self = shift;
$self->delete_from_platforms();
my $dbh = __PACKAGE__->db_Main();
my $sql = "UPDATE testgroups SET product_id=0,enabled=0 WHERE product_id=?";
my $rows = $dbh->do($sql,
undef,
$self->product_id
);
# Remove references to product in other entities.
# Disable those entities for good measure.
$sql = "UPDATE subgroups SET product_id=0,enabled=0 WHERE product_id=?";
$rows = $dbh->do($sql,
undef,
$self->product_id
);
$sql = "UPDATE testcases SET product_id=0,enabled=0,community_enabled=0 WHERE product_id=?";
$rows = $dbh->do($sql,
undef,
$self->product_id
);
$sql = "UPDATE branches SET product_id=0,enabled=0 WHERE product_id=?";
$rows = $dbh->do($sql,
undef,
$self->product_id
);
return $self->delete;
}
1;

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

@ -129,21 +129,35 @@ sub getUniquePlatforms()
#########################################################################
sub getPlatforms()
{
my $sql = "SELECT pl.name AS platform_name, pr.name AS product_name, pl.platform_id AS platform_id FROM platforms pl, products pr WHERE pl.product_id=pr.product_id ORDER BY pl.name, pr.name";
my $sql = "SELECT platform_id, name from platforms ORDER BY name ASC";
return _getValues($sql);
}
#########################################################################
sub getBranches()
{
my $sql = "SELECT DISTINCT(name) FROM branches ORDER BY name";
my $sql = "SELECT name, branch_id FROM branches ORDER BY name ASC";
return _getValues($sql);
}
#########################################################################
sub getUniqueBranches()
{
my $sql = "SELECT DISTINCT(name) FROM branches ORDER BY name ASC";
return _getValues($sql);
}
#########################################################################
sub getOpsyses()
{
my $sql = "SELECT DISTINCT(name) FROM opsyses ORDER BY name";
my $sql = "SELECT name, opsys_id FROM opsyses ORDER BY name ASC";
return _getValues($sql);
}
#########################################################################
sub getUniqueOpsyses()
{
my $sql = "SELECT DISTINCT(name) FROM opsyses ORDER BY name ASC";
return _getValues($sql);
}

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

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

@ -1,4 +1,4 @@
function adv_init() {
advSearchFormHeight = new fx.FadeSize('advSearchForm', {duration: 1000});
advSearchFormHeight.toggle('height');
advSearchFormHeight = new fx.Combo('advSearchForm', {opacity: true, height: true, duration: 1000});
advSearchFormHeight.toggle();
}

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

@ -1,29 +1,11 @@
var exists;
var allStretch;
//the main function, call to the effect object
function ec_init(){
var divs = document.getElementsByClassName("collapsable");
allStretch = new fx.MultiFadeSize(divs, {duration: 400});
var myDivs = document.getElementsByClassName("collapsable");
var myLinks = document.getElementsByClassName('collapse-link');
items = document.getElementsByClassName("display");
for (i = 0; i < items.length; i++){
var h3 = items[i];
div = h3.nextSibling;
h3.title = h3.className.replace("display ", "");
if (window.location.href.indexOf(h3.title) < 0) {
allStretch.hide(div, 'height');
if (exists != true) exists = false;
} else
exists = true;
h3.onclick = function() {
allStretch.showThisHideOpen(this.nextSibling, 100, 'height');
}
}
if (exists == false) $('products').childNodes[2].fs.toggle('height');
//then we create the effect.
var myAccordion = new fx.Accordion(myLinks, myDivs, {opacity: true});
myAccordion.fxa[0].toggle();
}

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

@ -1,18 +1,16 @@
function tc_init() {
var divs = document.getElementsByClassName("testcase-content");
allStretch = new fx.MultiFadeSize(divs, {duration: 400});
allStretch = new fx.MultiFadeSize(divs, {height: true, opacity: true, duration: 400});
for (i = 0; i < divs.length; i++) {
allStretch.hide(divs[i], 'height');
}
allStretch.hideAll();
testConfigHeight = new fx.Height('testconfig', {duration: 400});
testConfigHeight.toggle();
divs[0].fs.toggle('height');
allStretch.fxa[0].toggle();
}
function confirmPartialSubmission() {
msg = "Did you intend to only submit a single test result? (Hint: There is a 'Submit All Results' button at the bottom of the page.)";
return confirm(msg);
}

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

@ -2,40 +2,34 @@
moo.fx, simple effects library built with prototype.js (http://prototype.conio.net).
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE.
for more info (http://moofx.mad4milk.net).
10/24/2005
v(1.0.2)
Sunday, March 05, 2006
v 1.2.3
*/
//base
var fx = new Object();
//base
fx.Base = function(){};
fx.Base.prototype = {
setOptions: function(options) {
this.options = {
duration: 500,
onComplete: ''
onComplete: '',
transition: fx.sinoidal
}
Object.extend(this.options, options || {});
},
go: function() {
this.duration = this.options.duration;
this.startTime = (new Date).getTime();
this.timer = setInterval (this.step.bind(this), 13);
},
step: function() {
var time = (new Date).getTime();
var Tpos = (time - this.startTime) / (this.duration);
if (time >= this.duration+this.startTime) {
if (time >= this.options.duration+this.startTime) {
this.now = this.to;
clearInterval (this.timer);
this.timer = null;
if (this.options.onComplete) setTimeout(this.options.onComplete.bind(this), 10);
}
else {
this.now = ((-Math.cos(Tpos*Math.PI)/2) + 0.5) * (this.to-this.from) + this.from;
//this time-position, sinoidal transition thing is from script.aculo.us
var Tpos = (time - this.startTime) / (this.options.duration);
this.now = this.options.transition(Tpos) * (this.to-this.from) + this.from;
}
this.increase();
},
@ -44,7 +38,8 @@ fx.Base.prototype = {
if (this.timer != null) return;
this.from = from;
this.to = to;
this.go();
this.startTime = (new Date).getTime();
this.timer = setInterval (this.step.bind(this), 13);
},
hide: function() {
@ -63,9 +58,9 @@ fx.Layout = Class.create();
fx.Layout.prototype = Object.extend(new fx.Base(), {
initialize: function(el, options) {
this.el = $(el);
this.el.style.overflow = "auto";
this.el.iniWidth = this.el.offsetWidth;
this.el.iniHeight = this.el.offsetHeight;
this.el.style.overflow = "hidden";
this.iniWidth = this.el.offsetWidth;
this.iniHeight = this.el.offsetHeight;
this.setOptions(options);
}
});
@ -90,7 +85,7 @@ Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), {
toggle: function(){
if (this.el.offsetWidth > 0) this.custom(this.el.offsetWidth, 0);
else this.custom(0, this.el.iniWidth);
else this.custom(0, this.iniWidth);
}
});
@ -105,18 +100,15 @@ fx.Opacity.prototype = Object.extend(new fx.Base(), {
},
increase: function() {
// XXX - ZLL: disable opacity effects for now on Mac due to
// gecko bug 328215
if (navigator.platform && navigator.platform == "MacPPC") {
if (this.now == 1) this.now = 1;
} else {
if (this.now == 1) this.now = 0.9999;
}
if (this.now == 1 && (/Firefox/.test(navigator.userAgent))) this.now = 0.9999;
this.setOpacity(this.now);
},
if (this.now > 0 && this.el.style.visibility == "hidden") this.el.style.visibility = "visible";
if (this.now == 0) this.el.style.visibility = "hidden";
if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + this.now*100 + ")";
this.el.style.opacity = this.now;
setOpacity: function(opacity) {
if (opacity == 0 && this.el.style.visibility != "hidden") this.el.style.visibility = "hidden";
else if (this.el.style.visibility != "visible") this.el.style.visibility = "visible";
if (window.ActiveXObject) this.el.style.filter = "alpha(opacity=" + opacity*100 + ")";
this.el.style.opacity = opacity;
},
toggle: function() {
@ -124,3 +116,18 @@ fx.Opacity.prototype = Object.extend(new fx.Base(), {
else this.custom(0, 1);
}
});
//transitions
fx.sinoidal = function(pos){
return ((-Math.cos(pos*Math.PI)/2) + 0.5);
//this transition is from script.aculo.us
}
fx.linear = function(pos){
return pos;
}
fx.cubic = function(pos){
return Math.pow(pos, 3);
}
fx.circ = function(pos){
return Math.sqrt(pos);
}

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

@ -2,10 +2,31 @@
moo.fx pack, effects extensions for moo.fx.
by Valerio Proietti (http://mad4milk.net) MIT-style LICENSE
for more info visit (http://moofx.mad4milk.net).
Wednesday, November 16, 2005
v1.0.4
Friday, April 14, 2006
v 1.2.4
*/
//smooth scroll
fx.Scroll = Class.create();
fx.Scroll.prototype = Object.extend(new fx.Base(), {
initialize: function(options) {
this.setOptions(options);
},
scrollTo: function(el){
var dest = Position.cumulativeOffset($(el))[1];
var client = window.innerHeight || document.documentElement.clientHeight;
var full = document.documentElement.scrollHeight;
var top = window.pageYOffset || document.body.scrollTop || document.documentElement.scrollTop;
if (dest+client > full) this.custom(top, dest - client + (full-dest));
else this.custom(top, dest);
},
increase: function(){
window.scrollTo(0, this.now);
}
});
//text size modify, now works with pixels too.
fx.Text = Class.create();
fx.Text.prototype = Object.extend(new fx.Base(), {
@ -20,130 +41,184 @@ fx.Text.prototype = Object.extend(new fx.Base(), {
}
});
//composition effect, calls Width and Height alltogheter
fx.Resize = Class.create();
fx.Resize.prototype = {
//composition effect: widht/height/opacity
fx.Combo = Class.create();
fx.Combo.prototype = {
setOptions: function(options) {
this.options = {
opacity: true,
height: true,
width: false
}
Object.extend(this.options, options || {});
},
initialize: function(el, options) {
this.h = new fx.Height(el, options);
if (options) options.onComplete = null;
this.w = new fx.Width(el, options);
this.el = $(el);
this.setOptions(options);
if (this.options.opacity) {
this.o = new fx.Opacity(el, options);
options.onComplete = null;
}
if (this.options.height) {
this.h = new fx.Height(el, options);
options.onComplete = null;
}
if (this.options.width) this.w = new fx.Width(el, options);
},
toggle: function(){
this.h.toggle();
this.w.toggle();
toggle: function() { this.checkExec('toggle'); },
hide: function(){ this.checkExec('hide'); },
clearTimer: function(){ this.checkExec('clearTimer'); },
checkExec: function(func){
if (this.o) this.o[func]();
if (this.h) this.h[func]();
if (this.w) this.w[func]();
},
modify: function(hto, wto) {
//only if width+height
resizeTo: function(hto, wto) {
if (this.h && this.w) {
this.h.custom(this.el.offsetHeight, this.el.offsetHeight + hto);
this.w.custom(this.el.offsetWidth, this.el.offsetWidth + wto);
}
},
custom: function(hto, wto) {
customSize: function(hto, wto) {
if (this.h && this.w) {
this.h.custom(this.el.offsetHeight, hto);
this.w.custom(this.el.offsetWidth, wto);
},
hide: function(){
this.h.hide();
this.w.hide();
}
}
//composition effect, calls Opacity and (Width and/or Height) alltogheter
fx.FadeSize = Class.create();
fx.FadeSize.prototype = {
initialize: function(el, options) {
this.el = $(el);
this.el.o = new fx.Opacity(el, options);
if (options) options.onComplete = null;
this.el.h = new fx.Height(el, options);
this.el.w = new fx.Width(el, options);
},
toggle: function() {
this.el.o.toggle();
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] == 'height') this.el.h.toggle();
if (arguments[i] == 'width') this.el.w.toggle();
}
},
hide: function(){
this.el.o.hide();
for (var i = 0; i < arguments.length; i++) {
if (arguments[i] == 'height') this.el.h.hide();
if (arguments[i] == 'width') this.el.w.hide();
}
}
}
//intended to work with arrays.
var Multi = new Object();
Multi = function(){};
Multi.prototype = {
initialize: function(elements, options){
this.options = options;
this.el = this.getElementsFromArray(elements);
for (i=0;i<this.el.length;i++){
this.effect(this.el[i]);
}
},
getElementsFromArray: function(array) {
var elements = new Array();
for (i=0;i<array.length;i++) {
elements.push($(array[i]));
}
return elements;
}
}
//Fadesize with arrays
fx.MultiFadeSize = Class.create();
fx.MultiFadeSize.prototype = Object.extend(new Multi(), {
effect: function(el){
el.fs = new fx.FadeSize(el, this.options);
fx.MultiFadeSize.prototype = {
setOptions: function(options) {
this.options = {
delay: 100,
opacity: false
}
Object.extend(this.options, options || {});
},
showThisHideOpen: function(el, delay, mode){
for (i=0;i<this.el.length;i++){
if (this.el[i].offsetHeight > 0 && this.el[i] != el && this.el[i].h.timer == null && el.h.timer == null){
this.el[i].fs.toggle(mode);
initialize: function(elements, options) {
this.elements = elements;
this.setOptions(options);
var options = options || '';
this.fxa = [];
if (options && options.onComplete) options.onFinish = options.onComplete;
elements.each(function(el, i){
options.onComplete = function(){
if (el.offsetHeight > 0) el.style.height = '1%';
if (options.onFinish) options.onFinish(el);
}
setTimeout(function(){el.fs.toggle(mode);}.bind(el), delay);
this.fxa[i] = new fx.Combo(el, options);
this.fxa[i].hide();
}.bind(this));
}
showAll=0;
},
showAll: function(mode){
for (i=0;i<this.el.length;i++){
if (this.el[i].offsetHeight == 0){
this.el[i].fs.toggle(mode);
showThisHideOpen: function(toShow){
this.elements.each(function(el, j){
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el, j);
if (el == toShow && toShow.offsetHeight == 0) setTimeout(function(){this.clearAndToggle(toShow, j);}.bind(this), this.options.delay);
}.bind(this));
},
clearAndToggle: function(el, i){
this.fxa[i].clearTimer();
this.fxa[i].toggle();
},
showAll: function() {
for (i=0;i<this.elements.length;i++){
if (this.elements[i].offsetHeight == 0) {
this.clearAndToggle(this.elements[i], i)
}
}
showAll=1;
},
hideAll: function(mode){
for (i=0;i<this.el.length;i++){
if (this.el[i].offsetHeight > 0){
this.el[i].fs.toggle(mode);
hideAll: function() {
for (i=0;i<this.elements.length;i++){
if (this.elements[i].offsetHeight > 0) {
this.clearAndToggle(this.elements[i], i)
}
}
showAll=1;
},
toggle: function(el, mode){
el.fs.toggle(mode);
toggle: function(el){
el = $(el);
for (i=0;i<this.elements.length;i++){
if (this.elements[i] == el) {
this.clearAndToggle(this.elements[i], i)
}
}
},
hide: function(el, mode){
el.fs.hide(mode);
hide: function(el){
el = $(el);
for (i=0;i<this.elements.length;i++){
if (this.elements[i] == el) {
this.fxa[i].hide();
}
});
}
}
}
fx.Accordion = Class.create();
fx.Accordion.prototype = {
setOptions: function(options) {
this.options = {
delay: 100,
opacity: false
}
Object.extend(this.options, options || {});
},
initialize: function(togglers, elements, options) {
this.elements = elements;
this.setOptions(options);
var options = options || '';
this.fxa = [];
if (options && options.onComplete) options.onFinish = options.onComplete;
elements.each(function(el, i){
options.onComplete = function(){
if (el.offsetHeight > 0) el.style.height = '1%';
if (options.onFinish) options.onFinish(el);
}
this.fxa[i] = new fx.Combo(el, options);
this.fxa[i].hide();
}.bind(this));
togglers.each(function(tog, i){
if (typeof tog.onclick == 'function') var exClick = tog.onclick;
tog.onclick = function(){
if (exClick) exClick();
this.showThisHideOpen(elements[i]);
}.bind(this);
}.bind(this));
},
showThisHideOpen: function(toShow){
this.elements.each(function(el, j){
if (el.offsetHeight > 0 && el != toShow) this.clearAndToggle(el, j);
if (el == toShow && toShow.offsetHeight == 0) setTimeout(function(){this.clearAndToggle(toShow, j);}.bind(this), this.options.delay);
}.bind(this));
},
clearAndToggle: function(el, i){
this.fxa[i].clearTimer();
this.fxa[i].toggle();
}
}
var Remember = new Object();
Remember = function(){};
@ -171,8 +246,7 @@ Remember.prototype = {
readCookie: function() {
var nameEQ = this.el+this.el.id+this.prefix + "=";
var ca = document.cookie.split(';');
for(var i=0;i < ca.length;i++) {
var c = ca[i];
for(var i=0;c=ca[i];i++) {
while (c.charAt(0)==' ') c = c.substring(1,c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
}
@ -220,45 +294,54 @@ fx.RememberText.prototype = Object.extend(new Remember(), {
}
});
//use to attach effects without using js code, just classnames and rel attributes.
ParseClassNames = Class.create();
ParseClassNames.prototype = {
initialize: function(options){
var babies = document.getElementsByTagName('*') || document.all;
for (var i = 0; i < babies.length; i++) {
var el = babies[i];
//attach the effect, from the classNames;
var effects = this.getEffects(el);
for (var j = 0; j < effects.length; j++) {
if (j == 1 && options) options.onComplete = null;
el[effects[j]+"fx"] = new fx[effects[j]](el, options);
}
//execute methods, from rel
if (el.rel) {
el.crel = el.rel.split(' ');
if (el.crel[0].indexOf("fx_") > -1) {
var event = el.crel[0].replace('fx_', '');
var tocompute = this.getEffects($(el.crel[1]));
el["on"+event] = function(){
for (var f = 0; f < tocompute.length; f++) {
$(this.crel[1])[tocompute[f]+"fx"][this.crel[2] || "toggle"](this.crel[3] || null, this.crel[4] || null);
}
}
}
}
}
},
getEffects: function(el){
var effects = new Array();
var css = el.className.split(' ');
for (var i = 0; i < css.length; i++) {
if (css[i].indexOf('fx_') > -1) {
var effect = css[i].replace('fx_', '');
effects.push(effect);
}
}
return effects;
}
//useful for-replacement
Array.prototype.iterate = function(func){
for(var i=0;i<this.length;i++) func(this[i], i);
}
if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;
//Easing Equations (c) 2003 Robert Penner, all rights reserved.
//This work is subject to the terms in http://www.robertpenner.com/easing_terms_of_use.html.
//expo
fx.expoIn = function(pos){
return Math.pow(2, 10 * (pos - 1));
}
fx.expoOut = function(pos){
return (-Math.pow(2, -10 * pos) + 1);
}
//quad
fx.quadIn = function(pos){
return Math.pow(pos, 2);
}
fx.quadOut = function(pos){
return -(pos)*(pos-2);
}
//circ
fx.circOut = function(pos){
return Math.sqrt(1 - Math.pow(pos-1,2));
}
fx.circIn = function(pos){
return -(Math.sqrt(1 - Math.pow(pos, 2)) - 1);
}
//back
fx.backIn = function(pos){
return (pos)*pos*((2.7)*pos - 1.7);
}
fx.backOut = function(pos){
return ((pos-1)*(pos-1)*((2.7)*(pos-1) + 1.7) + 1);
}
//sine
fx.sineOut = function(pos){
return Math.sin(pos * (Math.PI/2));
}
fx.sineIn = function(pos){
return -Math.cos(pos * (Math.PI/2)) + 1;
}
fx.sineInOut = function(pos){
return -(Math.cos(Math.PI*pos) - 1)/2;
}

143
webtools/litmus/js/prototype.lite.js поставляемый
Просмотреть файл

@ -1,14 +1,10 @@
/* Prototype JavaScript framework
* (c) 2005 Sam Stephenson <sam@conio.net>
*
* Prototype is freely distributable under the terms of an MIT-style license.
*
* For details, see the Prototype web site: http://prototype.conio.net/
*
/*--------------------------------------------------------------------------*/
//note: this is a stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).
//note: modified & stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).
var Class = {
create: function() {
@ -19,9 +15,7 @@ var Class = {
}
Object.extend = function(destination, source) {
for (property in source) {
destination[property] = source[property];
}
for (property in source) destination[property] = source[property];
return destination;
}
@ -32,48 +26,28 @@ Function.prototype.bind = function(object) {
}
}
Function.prototype.bindAsEventListener = function(object) {
var __method = this;
return function(event) {
__method.call(object, event || window.event);
}
}
function $() {
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
if (arguments.length == 1) return get$(arguments[0]);
var elements = [];
$c(arguments).each(function(el){
elements.push(get$(el));
});
return elements;
function get$(el){
if (typeof el == 'string') el = document.getElementById(el);
return el;
}
}
//-------------------------
document.getElementsByClassName = function(className) {
var children = document.getElementsByTagName('*') || document.all;
var elements = new Array();
for (var i = 0; i < children.length; i++) {
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++) {
if (classNames[j] == className) {
elements.push(child);
break;
}
}
}
return elements;
}
//-------------------------
if (!window.Element) {
var Element = new Object();
}
if (!window.Element) var Element = new Object();
Object.extend(Element, {
remove: function(element) {
@ -83,14 +57,12 @@ Object.extend(Element, {
hasClassName: function(element, className) {
element = $(element);
if (!element)
return;
var a = element.className.split(' ');
for (var i = 0; i < a.length; i++) {
if (a[i] == className)
return true;
}
return false;
if (!element) return;
var hasClass = false;
element.className.split(' ').each(function(cn){
if (cn == className) hasClass = true;
});
return hasClass;
},
addClassName: function(element, className) {
@ -101,27 +73,60 @@ Object.extend(Element, {
removeClassName: function(element, className) {
element = $(element);
if (!element)
return;
if (!element) return;
var newClassName = '';
var a = element.className.split(' ');
for (var i = 0; i < a.length; i++) {
if (a[i] != className) {
if (i > 0)
newClassName += ' ';
newClassName += a[i];
}
element.className.split(' ').each(function(cn, i){
if (cn != className){
if (i > 0) newClassName += ' ';
newClassName += cn;
}
});
element.className = newClassName;
},
// removes whitespace-only text node children
cleanWhitespace: function(element) {
element = $(element);
for (var i = 0; i < element.childNodes.length; i++) {
var node = element.childNodes[i];
if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
Element.remove(node);
}
$c(element.childNodes).each(function(node){
if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) Element.remove(node);
});
},
find: function(element, what) {
element = $(element)[what];
while (element.nodeType != 1) element = element[what];
return element;
}
});
var Position = {
cumulativeOffset: function(element) {
var valueT = 0, valueL = 0;
do {
valueT += element.offsetTop || 0;
valueL += element.offsetLeft || 0;
element = element.offsetParent;
} while (element);
return [valueL, valueT];
}
};
document.getElementsByClassName = function(className) {
var children = document.getElementsByTagName('*') || document.all;
var elements = [];
$c(children).each(function(child){
if (Element.hasClassName(child, className)) elements.push(child);
});
return elements;
}
//useful array functions
Array.prototype.iterate = function(func){
for(var i=0;i<this.length;i++) func(this[i], i);
}
if (!Array.prototype.each) Array.prototype.each = Array.prototype.iterate;
function $c(array){
var nArray = [];
for (var i=0;i<array.length;i++) nArray.push(array[i]);
return nArray;
}

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

@ -74,8 +74,33 @@ if ($c->param("testcase_id")) {
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($testgroup);
print $js;
} elsif ($c->param("product_id")) {
my $product_id = $c->param("product_id");
my $product = Litmus::DB::Product->retrieve($product_id);
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($product);
print $js;
} elsif ($c->param("platform_id")) {
my $platform_id = $c->param("platform_id");
my $platform = Litmus::DB::Platform->retrieve($platform_id);
my @products = Litmus::DB::Product->search_ByPlatform($platform_id);
$platform->{'products'} = \@products;
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($platform);
print $js;
} elsif ($c->param("opsys_id")) {
my $opsys_id = $c->param("opsys_id");
my $opsys = Litmus::DB::Opsys->retrieve($opsys_id);
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($opsys);
print $js;
} elsif ($c->param("branch_id")) {
my $branch_id = $c->param("branch_id");
my $branch = Litmus::DB::Branch->retrieve($branch_id);
my $json = JSON->new(skipinvalid => 1, convblessed => 1);
my $js = $json->objToJson($branch);
print $js;
}

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

@ -0,0 +1,351 @@
#!/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 Time::HiRes qw( gettimeofday tv_interval );
#my $t0 = [gettimeofday];
use Litmus;
use Litmus::Auth;
use Litmus::Cache;
use Litmus::Error;
use Litmus::FormWidget;
use CGI;
use Time::Piece::MySQL;
use diagnostics;
Litmus::Auth::requireAdmin("edit_categories.cgi");
my $c = Litmus->cgi();
print $c->header();
my $message;
my $status;
my $rv;
my $rebuild_cache = 0;
my $defaults;
if ($c->param) {
# Process product changes.
if ($c->param("delete_product_button") and
$c->param("product_id")) {
my $product_id = $c->param("product_id");
my $product = Litmus::DB::Product->retrieve($product_id);
if ($product) {
$rv = $product->delete_with_refs();
if ($rv) {
$status = "success";
$message = "Product ID# $product_id deleted successfully.";
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to delete Product ID# $product_id.";
}
} else {
$status = "failure";
$message = "Product ID# $product_id does not exist. (Already deleted?)";
}
} elsif ($c->param("edit_product_form_mode")) {
my $enabled = $c->param('edit_product_form_enabled') ? 1 : 0;
if ($c->param("edit_product_form_mode") eq "add") {
my %hash = (
name => $c->param('edit_product_form_name'),
iconpath => $c->param('edit_product_form_iconpath'),
enabled => $enabled,
);
my $new_product =
Litmus::DB::Product->create(\%hash);
if ($new_product) {
$status = "success";
$message = "Product added successfully. New product ID# is " . $new_product->product_id;
$defaults->{'product_id'} = $new_product->product_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to add product.";
}
} elsif ($c->param("edit_product_form_mode") eq "edit") {
my $product_id = $c->param("edit_product_form_product_id");
my $product = Litmus::DB::Product->retrieve($product_id);
if ($product) {
$product->name($c->param('edit_product_form_name'));
$product->iconpath($c->param('edit_product_form_iconpath') ? $c->param('edit_product_form_iconpath') : '');
$product->enabled($enabled);
$rv = $product->update();
if ($rv) {
$status = "success";
$message = "Product ID# $product_id updated successfully.";
$defaults->{'product_id'} = $product_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to update product ID# $product_id.";
}
} else {
$status = "failure";
$message = "Product ID# $product_id not found.";
}
}
}
# Process platform changes.
if ($c->param("delete_platform_button") and
$c->param("platform_id")) {
my $platform_id = $c->param("platform_id");
my $platform = Litmus::DB::Platform->retrieve($platform_id);
if ($platform) {
$rv = $platform->delete_with_refs();
if ($rv) {
$status = "success";
$message = "Platform ID# $platform_id deleted successfully.";
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to delete Platform ID# $platform_id.";
}
} else {
$status = "failure";
$message = "Platform ID# $platform_id does not exist. (Already deleted?)";
}
} elsif ($c->param("edit_platform_form_mode")) {
if ($c->param("edit_platform_form_mode") eq "add") {
my %hash = (
name => $c->param('edit_platform_form_name'),
iconpath => $c->param('edit_platform_form_iconpath'),
detect_regexp => $c->param('edit_platform_form_detect_regexp'),
);
my $new_platform =
Litmus::DB::Platform->create(\%hash);
if ($new_platform) {
my @selected_products = $c->param("edit_platform_form_platform_products");
$new_platform->update_products(\@selected_products);
$status = "success";
$message = "Platform added successfully. New platform ID# is " . $new_platform->platform_id;
$defaults->{'platform_id'} = $new_platform->platform_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to add platform.";
}
} elsif ($c->param("edit_platform_form_mode") eq "edit") {
my $platform_id = $c->param("edit_platform_form_platform_id");
my $platform = Litmus::DB::Platform->retrieve($platform_id);
if ($platform) {
$platform->name($c->param('edit_platform_form_name'));
$platform->iconpath($c->param('edit_platform_form_iconpath') ? $c->param('edit_platform_form_iconpath') : '');
$platform->detect_regexp($c->param('edit_platform_form_detect_regexp') ? $c->param('edit_platform_form_detect_regexp') : '');
$rv = $platform->update();
if ($rv) {
my @selected_products = $c->param("edit_platform_form_platform_products");
$platform->update_products(\@selected_products);
$status = "success";
$message = "Platform ID# $platform_id updated successfully.";
$defaults->{'platform_id'} = $platform_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to update platform ID# $platform_id.";
}
} else {
$status = "failure";
$message = "Platform ID# $platform_id not found.";
}
}
}
# Process opsys changes.
if ($c->param("delete_opsys_button") and
$c->param("opsys_id")) {
my $opsys_id = $c->param("opsys_id");
my $opsys = Litmus::DB::Opsys->retrieve($opsys_id);
if ($opsys) {
$rv = $opsys->delete;
if ($rv) {
$status = "success";
$message = "Operating system ID# $opsys_id deleted successfully.";
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to delete Operating system ID# $opsys_id.";
}
} else {
$status = "failure";
$message = "Operating system ID# $opsys_id does not exist. (Already deleted?)";
}
} elsif ($c->param("edit_opsys_form_mode")) {
if ($c->param("edit_opsys_form_mode") eq "add") {
my %hash = (
name => $c->param('edit_opsys_form_name'),
platform_id => $c->param('edit_opsys_form_platform_id'),
detect_regexp => $c->param('edit_opsys_form_detect_regexp'),
);
my $new_opsys =
Litmus::DB::Opsys->create(\%hash);
if ($new_opsys) {
$status = "success";
$message = "Operating system added successfully. New operating system ID# is " . $new_opsys->opsys_id;
$defaults->{'opsys_id'} = $new_opsys->opsys_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to add operating system.";
}
} elsif ($c->param("edit_opsys_form_mode") eq "edit") {
my $opsys_id = $c->param("edit_opsys_form_opsys_id");
my $opsys = Litmus::DB::Opsys->retrieve($opsys_id);
if ($opsys) {
$opsys->name($c->param('edit_opsys_form_name'));
$opsys->platform_id($c->param('edit_opsys_form_platform_id'));
$opsys->detect_regexp($c->param('edit_opsys_form_detect_regexp') ? $c->param('edit_opsys_form_detect_regexp') : '');
$rv = $opsys->update();
if ($rv) {
$status = "success";
$message = "Operating system ID# $opsys_id updated successfully.";
$defaults->{'opsys_id'} = $opsys_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to update operating system ID# $opsys_id.";
}
} else {
$status = "failure";
$message = "Operating systen ID# $opsys_id not found.";
}
}
}
# Process branch changes.
if ($c->param("delete_branch_button") and
$c->param("branch_id")) {
my $branch_id = $c->param("branch_id");
my $branch = Litmus::DB::Branch->retrieve($branch_id);
if ($branch) {
$rv = $branch->delete;
if ($rv) {
$status = "success";
$message = "Branch ID# $branch_id deleted successfully.";
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to delete branch ID# $branch_id.";
}
} else {
$status = "failure";
$message = "Branch ID# $branch_id does not exist. (Already deleted?)";
}
} elsif ($c->param("edit_branch_form_mode")) {
my $enabled = $c->param('edit_branch_form_enabled') ? 1 : 0;
if ($c->param("edit_branch_form_mode") eq "add") {
my %hash = (
name => $c->param('edit_branch_form_name'),
product_id => $c->param('edit_branch_form_product_id'),
detect_regexp => $c->param('edit_branch_form_detect_regexp'),
enabled => $enabled,
);
my $new_branch =
Litmus::DB::Branch->create(\%hash);
if ($new_branch) {
$status = "success";
$message = "Branch added successfully. New branch ID# is " . $new_branch->branch_id;
$defaults->{'branch_id'} = $new_branch->branch_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to add branch.";
}
} elsif ($c->param("edit_branch_form_mode") eq "edit") {
my $branch_id = $c->param("edit_branch_form_branch_id");
my $branch = Litmus::DB::Branch->retrieve($branch_id);
if ($branch) {
$branch->name($c->param('edit_branch_form_name'));
$branch->product_id($c->param('edit_branch_form_product_id'));
$branch->detect_regexp($c->param('edit_branch_form_detect_regexp') ? $c->param('edit_branch_form_detect_regexp') : '');
$branch->enabled($enabled);
$rv = $branch->update();
if ($rv) {
$status = "success";
$message = "Branch ID# $branch_id updated successfully.";
$defaults->{'branch_id'} = $branch_id;
$rebuild_cache=1;
} else {
$status = "failure";
$message = "Failed to update branch ID# $branch_id.";
}
} else {
$status = "failure";
$message = "Branch ID# $branch_id not found.";
}
}
}
}
if ($rebuild_cache) {
rebuildCache();
}
my $products = Litmus::FormWidget->getProducts();
my $platforms = Litmus::FormWidget->getPlatforms();
my $branches = Litmus::FormWidget->getBranches();
my $opsyses = Litmus::FormWidget->getOpsyses();
my $vars = {
title => 'Manage Categories',
products => $products,
platforms => $platforms,
branches => $branches,
opsyses => $opsyses,
};
if ($status and $message) {
$vars->{'onload'} = "toggleMessage('$status','$message');";
}
my $cookie = Litmus::Auth::getCookie();
$vars->{"defaultemail"} = $cookie;
$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie);
Litmus->template()->process("admin/edit_categories.tmpl", $vars) ||
internalError(Litmus->template()->error());
#my $elapsed = tv_interval ( $t0 );
#printf "<div id='pageload'>Page took %f seconds to load.</div>", $elapsed;
exit 0;

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

@ -25,22 +25,14 @@
# ***** END LICENSE BLOCK *****
#%]
[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/FormValidation.js','js/EditCategories.js'] %]
[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/FormValidation.js','js/EditCategories.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">
function createRequestObject() {
var ro;
var browser = navigator.appName;
if(browser == "Microsoft Internet Explorer"){
ro = new ActiveXObject("Microsoft.XMLHTTP");
}else{
ro = new XMLHttpRequest();
}
return ro;
}
var http = createRequestObject();
var product;
var platform;
var opsys;
var branch;
</script>
<div id="page">
@ -49,32 +41,18 @@ var http = createRequestObject();
<div id="content">
<h1 class="firstHeading">[% title %]</h1>
<div id="notification" class="category">
<h2>Status</h2>
<div id="notification-content">
</div>
</div>
<div id="categories">
[% INCLUDE admin/form_widgets/update_products.tmpl %]
[% INCLUDE admin/form_widgets/update_platforms.tmpl %]
[% INCLUDE admin/form_widgets/update_opsyses.tmpl %]
[% INCLUDE admin/form_widgets/update_branches.tmpl %]
[% INCLUDE admin/form_widgets/update_log_types.tmpl %]
</div>
</div> <!--END content-->
<script type="text/javascript">
Element.cleanWhitespace('products');
Element.cleanWhitespace('platforms');
Element.cleanWhitespace('opsyses');
Element.cleanWhitespace('branches');
Element.cleanWhitespace('log_types');
Element.cleanWhitespace('manage_products_div');
Element.cleanWhitespace('manage_platforms_div');
Element.cleanWhitespace('manage_opsyses_div');
Element.cleanWhitespace('manage_branches_div');
ec_init();
</script>

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

@ -1,112 +1,181 @@
<script type="text/javascript">
function checkAddBranchForm(f) {
function enableBranchModeButtons() {
document.getElementById("edit_branch_button").disabled=false;
document.getElementById("delete_branch_button").disabled=false;
}
function disableBranchModeButtons() {
document.getElementById("edit_branch_button").disabled=true;
document.getElementById("delete_branch_button").disabled=true;
}
function loadBranch() {
var branch_select = document.getElementById("branch_id");
if (! branch_select ||
branch_select.options[branch_select.selectedIndex].value=="") {
disableBranchModeButtons();
document.getElementById('edit_branch_form_div').style.display = 'none';
disableForm('edit_branch_form');
blankBranchForm('edit_branch_form');
return false;
}
var branch_id = branch_select.options[branch_select.selectedIndex].value;
disableForm('edit_branch_form');
toggleMessage('loading','Loading Branch ID# ' + branch_id + '...');
var url = 'json.cgi?branch_id=' + branch_id;
fetchJSON(url,populateBranch);
}
function populateBranch(data) {
branch=data;
document.getElementById('edit_branch_form_branch_id').value = branch.branch_id;
document.getElementById('edit_branch_form_branch_id_display').innerHTML = branch.branch_id;
document.getElementById('edit_branch_form_name').value = branch.name;
document.getElementById('edit_branch_form_detect_regexp').value = branch.detect_regexp;
var product_box = document.getElementById('edit_branch_form_product_id');
var options = product_box.getElementsByTagName('option');
var found_product = 0;
for (var i=0; i<options.length; i++) {
if (options[i].value == branch.product_id.product_id) {
options[i].selected = true;
found_product=1;
} else {
options[i].selected = false;
}
if (found_product == 0) {
options[0].selected = true;
}
}
var enabled_em = document.getElementById('edit_branch_form_enabled')
if (branch.enabled == 1) {
enabled_em.checked = true;
} else {
enabled_em.checked = false;
}
document.getElementById('edit_branch_form_div').style.display = 'block';
enableBranchModeButtons();
}
function blankBranchForm(formid) {
blankForm(formid);
document.getElementById('edit_branch_form_branch_id_display').innerHTML = '';
}
function switchBranchFormToAdd() {
disableBranchModeButtons();
blankBranchForm('edit_branch_form');
document.getElementById('edit_branch_form_submit').value = 'Add Branch';
document.getElementById('edit_branch_form_mode').value = 'add';
enableForm('edit_branch_form');
document.getElementById('edit_branch_form_div').style.display = 'block';
}
function switchBranchFormToEdit() {
document.getElementById('edit_branch_form_submit').value = 'Submit Edits';
document.getElementById('edit_branch_form_mode').value = 'edit';
enableForm('edit_branch_form');
document.getElementById('edit_branch_form_div').style.display = 'block';
}
function checkBranchForm(f) {
return (
checkString(f.new_branch_name,"branch name",false) &&
checkProduct(f.branch_add_product) &&
checkString(f.new_branch_detect_regexp,"detect regexp",false)
checkString(f.edit_branch_form_name,"Branch Name",false) &&
checkString(f.edit_branch_form_detect_regexp,"Branch Detect Regexp",true) &&
verifySelected(f.edit_branch_form_product_id, "Product")
);
}
function getBarnchByName(branchName) {
http.open('get', 'rpc.cgi?action=getBranchByName&branchName='+branchName);
http.onreadystatechange = updateBranchForm;
http.send(null);
}
function updateBranchForm() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
var em = document.getElementById("notification-content")
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("modify_branch_id").value = update[0];
document.getElementById("modify_branch_name").disabled = false;
document.getElementById("modify_branch_name").value = update[1];
// lookup product
document.getElementById("modify_branch_detect_regexp").disabled = false;
document.getElementById("modify_branch_detect_regexp").value = update[2];
document.getElementById("delete_branch").disabled = false;
document.getElementById("update_branch").disabled = false;
function resetBranch() {
if (document.getElementById('edit_branch_form_branch_id').value != '') {
populateBranch(branch);
switchBranchFormToEdit();
} else {
document.getElementById("notification").style.display = 'block';
em.innerHTML = response;
}
switchBranchFormToAdd();
}
}
</script>
<div id="branches" class="category">
<h1 id="branches_header" class="firstHeading"><a name="manage_branches" class="collapse-link">Manage Branches&nbsp;&raquo;</a></h1>
<h2>Branches</h2>
<div id="manage_branches_div" class="collapsable">
<div class="section-full">
<div class="section-header">Existing Branches</div>
<h3 class="display branch_add"><a name="#branch_add">Add&nbsp;&raquo;</a></h3>
<div id="branch_add" class="collapsable">
<form id="branch_add_form" name="branch_add_form" action="edit_categories.cgi" method="post" onSubmit="checkAddBranchForm(this);">
<table class="category">
<tr>
<td>Name:</td>
<td><input id="new_branch_name" name="new_branch_name" type="text" size="30"></td>
</tr>
<tr>
<td>Product:</td>
<td>
[% INCLUDE form_widgets/select_product.tmpl name="branch_add_product" placeholder=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input id="new_branch_detect_regexp" name="new_branch_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input class="category" name="reset" type="reset" value="Reset">&nbsp;<input class="category" name="add_branch" type="submit" value="Add New Branch">
</td>
</tr>
</table>
</form>
<div class="section-content">
<form id="select_branch_and_mode_form" name="select_branch_and_mode_form" method="post" action="manage_categories.cgi">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
[% INCLUDE form_widgets/select_branch_id.tmpl name="branch_id" placeholder=1 size=5 show_name=1 onChange="loadBranch();" %]
</td>
</tr>
<tr>
<td>
<input id="add_branch_button" name="add_branch_button" class="manage" type="button" onClick="switchBranchFormToAdd();" value="Add new branch">&nbsp;
<input id="edit_branch_button" name="edit_branch_button" class="manage" type="button" onClick="switchBranchFormToEdit();" value="Edit branch" disabled>&nbsp;
<input id="delete_branch_button" name="delete_branch_button" class="manage" type="submit" onClick="return confirm('Really delete this branch?');" value="Delete branch" disabled>&nbsp;
</td>
</tr>
</table>
</form>
</div> <!--end section-content-->
<div style="display: none;" id="edit_branch_form_div">
<hr />
<div id="branch-title" class="section-header">Branch Info</div>
<div class="section-content">
<form id="edit_branch_form" name="edit_branch_form" method="post" action="manage_categories.cgi" onSubmit="return checkBranchForm(this);">
<input id="edit_branch_form_mode" name="edit_branch_form_mode" type="hidden" value="edit">
<input id="edit_branch_form_branch_id" name="edit_branch_form_branch_id" type="hidden" value="">
<table class="manage">
<tr>
<td class="headerleft">Branch ID#:</td>
<td name="edit_branch_form_branch_id_display" id="edit_branch_form_branch_id_display"></td>
</tr>
<tr>
<td class="headerleft">Name:</td>
<td colspan="2"><input name="edit_branch_form_name"
id="edit_branch_form_name"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Product:</td>
<td colspan="2">[% INCLUDE form_widgets/select_product_id.tmpl name="edit_branch_form_product_id" placeholder=1 size=1 show_name=1 %]
</tr>
<tr>
<td class="headerleft">Detect Regexp:</td>
<td colspan="2"><input name="edit_branch_form_detect_regexp"
id="edit_branch_form_detect_regexp"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Enabled?</td>
<td><input name="edit_branch_form_enabled"
id="edit_branch_form_enabled"
type="checkbox"
value="1" disabled>
</td>
<td>&lArr;&nbsp;Uncheck this to completely disable this branch. <b>NOTE</b>: this will have also disable all associated test runs, test groups, subgroups, and testcases.</td>
</tr>
<tr>
<td colspan="3" align="right"><input id="edit_branch_form_reset" class="button" type="button" value="Reset" disabled onClick="resetBranch();" />&nbsp;<input class="button" type="submit" id="edit_branch_form_submit" name="edit_branch_form_submit" value="Submit Edits" disabled /></div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div> <!--end section-full-->
</div>
<h3 class="display branch_modify"><a name="#branch_modify">Modify / Delete&nbsp;&raquo;</a></h3>
<div id="branch_modify" class="collapsable">
<form id="branch_modify_form" name="branch_modify_form" action="edit_categories.cgi" method="post">
<input id="modify_branch_id" name="modify_branch_id" type="hidden" value="">
<table class="category">
<tr>
<td colspan="2" align="left">
Select Existing Branch:<br/>
[% INCLUDE form_widgets/select_branch.tmpl size=5 name="branch_modify_existing" onChange="getBranchByName(this.options[this.selectedIndex].value);" %]
</td>
</tr>
<tr>
<td>Name:</td>
<td><input disabled id="modify_branch_name" name="modify_branch_name" type="text" size="30"></td>
</tr>
<tr>
<td>Product:</td>
<td>
[% INCLUDE form_widgets/select_product.tmpl name="branch_modify_product" placeholder=1 disabled=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input disabled id="modify_branch_detect_regexp" name="modify_branch_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input disabled class="category" name="delete_branch" type="submit" value="Delete Branch">&nbsp;<input disabled class="category" name="update_branch" type="submit" value="Update Branch">
</td>
</tr>
</table>
</form>
</div>
</div>

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

@ -1,113 +1,165 @@
<script type="text/javascript">
function checkAddOpsysForm(f) {
function enableOpsysModeButtons() {
document.getElementById("edit_opsys_button").disabled=false;
document.getElementById("delete_opsys_button").disabled=false;
}
function disableOpsysModeButtons() {
document.getElementById("edit_opsys_button").disabled=true;
document.getElementById("delete_opsys_button").disabled=true;
}
function loadOpsys() {
var opsys_select = document.getElementById("opsys_id");
if (! opsys_select ||
opsys_select.options[opsys_select.selectedIndex].value=="") {
disableOpsysModeButtons();
document.getElementById('edit_opsys_form_div').style.display = 'none';
disableForm('edit_opsys_form');
blankOpsysForm('edit_opsys_form');
return false;
}
var opsys_id = opsys_select.options[opsys_select.selectedIndex].value;
disableForm('edit_opsys_form');
toggleMessage('loading','Loading Opsys ID# ' + opsys_id + '...');
var url = 'json.cgi?opsys_id=' + opsys_id;
fetchJSON(url,populateOpsys);
}
function populateOpsys(data) {
opsys=data;
document.getElementById('edit_opsys_form_opsys_id').value = opsys.opsys_id;
document.getElementById('edit_opsys_form_opsys_id_display').innerHTML = opsys.opsys_id;
document.getElementById('edit_opsys_form_name').value = opsys.name;
document.getElementById('edit_opsys_form_detect_regexp').value = opsys.detect_regexp;
var platform_box = document.getElementById('edit_opsys_form_platform_id');
var options = platform_box.getElementsByTagName('option');
var found_platform = 0;
for (var i=0; i<options.length; i++) {
if (options[i].value == opsys.platform_id.platform_id) {
options[i].selected = true;
found_platform=1;
} else {
options[i].selected = false;
}
if (found_platform == 0) {
options[0].selected = true;
}
}
document.getElementById('edit_opsys_form_div').style.display = 'block';
enableOpsysModeButtons();
}
function blankOpsysForm(formid) {
blankForm(formid);
document.getElementById('edit_opsys_form_opsys_id_display').innerHTML = '';
}
function switchOpsysFormToAdd() {
disableOpsysModeButtons();
blankOpsysForm('edit_opsys_form');
document.getElementById('edit_opsys_form_submit').value = 'Add Opsys';
document.getElementById('edit_opsys_form_mode').value = 'add';
enableForm('edit_opsys_form');
document.getElementById('edit_opsys_form_div').style.display = 'block';
}
function switchOpsysFormToEdit() {
document.getElementById('edit_opsys_form_submit').value = 'Submit Edits';
document.getElementById('edit_opsys_form_mode').value = 'edit';
enableForm('edit_opsys_form');
document.getElementById('edit_opsys_form_div').style.display = 'block';
}
function checkOpsysForm(f) {
return (
checkString(f.new_opsys_name,"operating system name",false) &&
checkPlatform(f.opsys_add_platform) &&
checkString(f.new_opsys_detect_regexp,"detect regexp",false)
checkString(f.edit_opsys_form_name,"Operating System Name",false) &&
checkString(f.edit_opsys_form_detect_regexp,"Operating System Detect Regexp",true) &&
verifySelected(f.edit_opsys_form_platform_id, "Platform")
);
}
function getOpsysByName(opsysName) {
http.open('get', 'rpc.cgi?action=getOpsysByName&opsysName='+opsysName);
http.onreadystatechange = updateOpsysForm;
http.send(null);
}
function updateOpsysForm() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
var em = document.getElementById("notification-content")
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("modify_opsys_id").value = update[0];
document.getElementById("modify_opsys_name").disabled = false;
document.getElementById("modify_opsys_name").value = update[1];
// lookup platform
document.getElementById("modify_opsys_detect_regexp").disabled = false;
document.getElementById("modify_opsys_detect_regexp").value = update[2];
document.getElementById("modify_opsys_icon_path").disabled = false;
document.getElementById("modify_opsys_icon_path").value = update[3];
document.getElementById("delete_opsys").disabled = false;
document.getElementById("update_opsys").disabled = false;
function resetOpsys() {
if (document.getElementById('edit_opsys_form_opsys_id').value != '') {
populateOpsys(opsys);
switchOpsysFormToEdit();
} else {
document.getElementById("notification").style.display = 'block';
em.innerHTML = response;
}
switchOpsysFormToAdd();
}
}
</script>
<div id="opsyses" class="category">
<h1 id="opsyses_header" class="firstHeading"><a name="manage_opsyses" class="collapse-link">Manage Operating Sytems&nbsp;&raquo;</a></h1>
<h2>Operating Systems</h2>
<div id="manage_opsyses_div" class="collapsable">
<div class="section-full">
<div class="section-header">Existing Operating Systems</div>
<h3 class="display opsys_add"><a name="#opsys_add">Add&nbsp;&raquo;</a></h3>
<div id="opsys_add" class="collapsable">
<form name="opsys_add_form" id="opsys_add_form" action="edit_categories.cgi" method="post" onSubmit="return checkAddOpsysForm(this);">
<table class="category">
<tr>
<td>Name:</td>
<td><input d="new_opsys_name" name="new_opsys_name" type="text" size="30"></td>
</tr>
<tr>
<td>Platform:</td>
<td>
[% INCLUDE form_widgets/select_platform.tmpl name="opsys_add_platform" placeholder=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input id="new_opsys_detect_regexp" name="new_opsys_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input class="category" name="reset" type="reset" value="Reset">&nbsp;<input class="category" name="add_opsys" type="submit" value="Add New Operating System">
</td>
</tr>
</table>
</form>
<div class="section-content">
<form id="select_opsys_and_mode_form" name="select_opsys_and_mode_form" method="post" action="manage_categories.cgi">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
[% INCLUDE form_widgets/select_opsys_id.tmpl name="opsys_id" placeholder=1 size=5 show_name=1 onChange="loadOpsys();" %]
</td>
</tr>
<tr>
<td>
<input id="add_opsys_button" name="add_opsys_button" class="manage" type="button" onClick="switchOpsysFormToAdd();" value="Add new operating system">&nbsp;
<input id="edit_opsys_button" name="edit_opsys_button" class="manage" type="button" onClick="switchOpsysFormToEdit();" value="Edit operating system" disabled>&nbsp;
<input id="delete_opsys_button" name="delete_opsys_button" class="manage" type="submit" onClick="return confirm('Really delete this operating system?');" value="Delete operating system" disabled>&nbsp;
</td>
</tr>
</table>
</form>
</div> <!--end section-content-->
<div style="display: none;" id="edit_opsys_form_div">
<hr />
<div id="opsys-title" class="section-header">Operating System Info</div>
<div class="section-content">
<form id="edit_opsys_form" name="edit_opsys_form" method="post" action="manage_categories.cgi" onSubmit="return checkOpsysForm(this);">
<input id="edit_opsys_form_mode" name="edit_opsys_form_mode" type="hidden" value="edit">
<input id="edit_opsys_form_opsys_id" name="edit_opsys_form_opsys_id" type="hidden" value="">
<table class="manage">
<tr>
<td class="headerleft">Operating System ID#:</td>
<td name="edit_opsys_form_opsys_id_display" id="edit_opsys_form_opsys_id_display"></td>
</tr>
<tr>
<td class="headerleft">Name:</td>
<td colspan="2"><input name="edit_opsys_form_name"
id="edit_opsys_form_name"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Platform:</td>
<td colspan="2">[% INCLUDE form_widgets/select_platform_id.tmpl name="edit_opsys_form_platform_id" placeholder=1 size=1 show_name=1 %]
</tr>
<tr>
<td class="headerleft">Detect Regexp:</td>
<td colspan="2"><input name="edit_opsys_form_detect_regexp"
id="edit_opsys_form_detect_regexp"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td colspan="3" align="right"><input id="edit_opsys_form_reset" class="button" type="button" value="Reset" disabled onClick="resetOpsys();" />&nbsp;<input class="button" type="submit" id="edit_opsys_form_submit" name="edit_opsys_form_submit" value="Submit Edits" disabled /></div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div> <!--end section-full-->
</div>
<h3 class="display opsys_modify"><a name="#opsys_modify">Modify / Delete&nbsp;&raquo;</a></h3>
<div id="opsys_modify" class="collapsable">
<form id="opsys_modify_form" name="opsys_modify_form" action="edit_categories.cgi" method="post">
<input id="modify_opsys_id" name="modify_opsys_id" type="hidden" value="">
<table class="category">
<tr>
<td colspan="2" align="left">
Select Existing Operating System:<br/>
[% INCLUDE form_widgets/select_opsys.tmpl size=5 name="opsys_modify_existing" onChange="getOpsysByName(this.options[this.selectedIndex].value);" %]
</td>
</tr>
<tr>
<td>Name:</td>
<td><input disabled id="modify_opsys_name" name="modify_opsys_name" type="text" size="30"></td>
</tr>
<tr>
<td>Platform:</td>
<td>
[% INCLUDE form_widgets/select_platform.tmpl name="opsys_modify_platform" placeholder=1 disabled=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input disabled id="modify_opsys_detect_regexp" name="modify_opsys_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input disabled class="category" name="delete_opsys" type="submit" value="Delete Opsys">&nbsp;<input disabled class="category" name="update_opsys" type="submit" value="Update Operating System">
</td>
</tr>
</table>
</form>
</div>
</div>

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

@ -1,122 +1,195 @@
<script type="text/javascript">
function checkAddPlatformForm(f) {
function enablePlatformModeButtons() {
document.getElementById("edit_platform_button").disabled=false;
document.getElementById("delete_platform_button").disabled=false;
}
function disablePlatformModeButtons() {
document.getElementById("edit_platform_button").disabled=true;
document.getElementById("delete_platform_button").disabled=true;
}
function loadPlatform() {
var platform_select = document.getElementById("platform_id");
if (! platform_select ||
platform_select.options[platform_select.selectedIndex].value=="") {
disablePlatformModeButtons();
document.getElementById('edit_platform_form_div').style.display = 'none';
disableForm('edit_platform_form');
blankPlatformForm('edit_platform_form');
return false;
}
var platform_id = platform_select.options[platform_select.selectedIndex].value;
disableForm('edit_platform_form');
toggleMessage('loading','Loading Platform ID# ' + platform_id + '...');
var url = 'json.cgi?platform_id=' + platform_id;
fetchJSON(url,populatePlatform);
}
function populatePlatform(data) {
platform=data;
document.getElementById('edit_platform_form_platform_id').value = platform.platform_id;
document.getElementById('edit_platform_form_platform_id_display').innerHTML = platform.platform_id;
document.getElementById('edit_platform_form_name').value = platform.name;
document.getElementById('edit_platform_form_detect_regexp').value = platform.detect_regexp;
document.getElementById('edit_platform_form_iconpath').value = platform.iconpath;
var selectBoxProduct = document.getElementById('edit_platform_form_platform_products');
selectBoxProduct.options.length = 0;
for (var i=0; i<platform.products.length; i++) {
var optionText = platform.products[i].name + ' (' + platform.products[i].product_id + ')';
selectBoxProduct.options[selectBoxProduct.length] =
new Option(optionText,
platform.products[i].product_id);
}
document.getElementById('edit_platform_form_div').style.display = 'block';
enablePlatformModeButtons();
}
function blankPlatformForm(formid) {
blankForm(formid);
document.getElementById('edit_platform_form_platform_id_display').innerHTML = '';
var selectBoxProduct = document.getElementById('edit_platform_form_platform_products');
selectBoxProduct.options.length = 0;
selectBoxProduct.options[selectBoxProduct.length] = new Option("--No platform selected--","");
selectBoxProduct.selectedIndex=-1;
}
function switchPlatformFormToAdd() {
disablePlatformModeButtons();
blankPlatformForm('edit_platform_form');
document.getElementById('edit_platform_form_submit').value = 'Add Platform';
document.getElementById('edit_platform_form_mode').value = 'add';
enableForm('edit_platform_form');
document.getElementById('edit_platform_form_div').style.display = 'block';
}
function switchPlatformFormToEdit() {
document.getElementById('edit_platform_form_submit').value = 'Submit Edits';
document.getElementById('edit_platform_form_mode').value = 'edit';
enableForm('edit_platform_form');
document.getElementById('edit_platform_form_div').style.display = 'block';
}
function checkPlatformForm(f) {
return (
checkString(f.new_platform_name,"platform name",false) &&
checkProduct(f.platform_add_product) &&
checkString(f.new_platform_detect_regexp,"detect regexp",false) &&
checkString(f.new_platform_icon_path,"icon path",true)
checkString(f.edit_platform_form_name,"Platform name",false) &&
checkString(f.edit_platform_form_iconpath,"Platform icon path",true &&
checkString(f.edit_platform_form_detect_regexp,"Platform detect regexp",true))
);
}
function getPlatformByName(platformName) {
http.open('get', 'rpc.cgi?action=getPlatformByName&platformName='+platformName);
http.onreadystatechange = updatePlatformForm;
http.send(null);
}
function updatePlatformForm() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
var em = document.getElementById("notification-content")
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("modify_platform_id").value = update[0];
document.getElementById("modify_platform_name").disabled = false;
document.getElementById("modify_platform_name").value = update[1];
// lookup product
document.getElementById("modify_platform_detect_regexp").disabled = false;
document.getElementById("modify_platform_detect_regexp").value = update[2];
document.getElementById("modify_platform_icon_path").disabled = false;
document.getElementById("modify_platform_icon_path").value = update[3];
document.getElementById("delete_platform").disabled = false;
document.getElementById("update_platform").disabled = false;
function resetPlatform() {
if (document.getElementById('edit_platform_form_platform_id').value != '') {
populatePlatform(platform);
switchPlatformFormToEdit();
} else {
document.getElementById("notification").style.display = 'block';
em.innerHTML = response;
}
switchPlatformFormToAdd();
}
}
</script>
<div id="platforms" class="category">
<h1 id="platforms_header" class="firstHeading"><a name="manage_platforms" class="collapse-link">Manage Platforms&nbsp;&raquo;</a></h1>
<h2>Platforms</h2>
<div id="manage_platforms_div" class="collapsable">
<div class="section-full">
<div class="section-header">Existing Platforms</div>
<h3 class="display platform_add"><a name="#platform_add">Add&nbsp;&raquo;</a></h3>
<div id="platform_add" class="collapsable">
<form name="platform_add_form" id="platform_add_form" action="edit_categories.cgi" method="post" onSubmit="return checkAddPlatformForm(this);">
<table class="category">
<tr>
<td>Name:</td>
<td><input name="new_platform_name" type="text" size="30"></td>
</tr>
<tr>
<td>Product:</td>
<td>
[% INCLUDE form_widgets/select_product.tmpl name="platform_add_product" placeholder=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input name="new_platform_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td>Icon Path:</td>
<td><input name="new_platform_icon_path" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input class="category" name="reset" type="reset" value="Reset">&nbsp;<input class="category" name="add_platform" type="submit" value="Add New Platform">
</td>
</tr>
</table>
</form>
<div class="section-content">
<form id="select_platform_and_mode_form" name="select_platform_and_mode_form" method="post" action="manage_categories.cgi">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
[% INCLUDE form_widgets/select_platform_id.tmpl name="platform_id" placeholder=1 size=5 show_name=1 onChange="loadPlatform();" %]
</td>
</tr>
<tr>
<td>
<input id="add_platform_button" name="add_platform_button" class="manage" type="button" onClick="switchPlatformFormToAdd();" value="Add new platform">&nbsp;
<input id="edit_platform_button" name="edit_platform_button" class="manage" type="button" onClick="switchPlatformFormToEdit();" value="Edit platform" disabled>&nbsp;
<input id="delete_platform_button" name="delete_platform_button" class="manage" type="submit" onClick="return confirm('Really delete this platform?')
;" value="Delete platform" disabled>&nbsp;
</td>
</tr>
</table>
</form>
</div> <!--end section-content-->
<div style="display: none;" id="edit_platform_form_div">
<hr />
<div id="platform-title" class="section-header">Platform Info</div>
<div class="section-content">
<form id="edit_platform_form" name="edit_platform_form" method="post" action="manage_categories.cgi" onSubmit="selectNone('edit_platform_form_all_products');selectAll('edit_platform_form_platform_products');return checkPlatformForm(this);">
<input id="edit_platform_form_mode" name="edit_platform_form_mode" type="hidden" value="edit">
<input id="edit_platform_form_platform_id" name="edit_platform_form_platform_id" type="hidden" value="">
<table class="manage">
<tr>
<td class="headerleft">Platform ID#:</td>
<td name="edit_platform_form_platform_id_display" id="edit_platform_form_platform_id_display"></td>
</tr>
<tr>
<td class="headerleft">Name:</td>
<td colspan="2"><input name="edit_platform_form_name"
id="edit_platform_form_name"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Detect Regexp:</td>
<td colspan="2"><input name="edit_platform_form_detect_regexp"
id="edit_platform_form_detect_regexp"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Icon Path:</td>
<td colspan="2"><input name="edit_platform_form_iconpath"
id="edit_platform_form_iconpath"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td colspan="3"><hr/></td>
</tr>
<tr>
<td class="headerleft" colspan="3">Manage Products for this Platform</td>
</tr>
<tr>
<td colspan="3">
<div class="manage">
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td colspan="2" id="edit_platform_form_all_products_header" name="edit_platform_form_all_products_header" class="headerleft">All Products</td>
<td class="headerleft">Products running on this Platform</td>
</tr>
<tr>
<td>[% INCLUDE form_widgets/select_product_id.tmpl name="edit_platform_form_all_products" multiple=1 size=5 placeholder=0 %]</td>
<td align="center" valign="middle"><input id="add_product_button" name="add_product_button" type="button" value="&rArr;" onClick="copyToList('edit_platform_form_all_products','edit_platform_form_platform_products');"><br/><br/><input id="remove_product_button" name="remove_product_button" type="button" value="&lArr;" onClick="removeSelectedFromList('edit_platform_form_platform_products',true);"></td>
<td><select multiple class="platform-products" id="edit_platform_form_platform_products" name="edit_platform_form_platform_products" size="5">
<option value="">--No platform selected--</option>
</select></td>
</tr>
</table>
</div>
</td>
</tr>
<tr>
<td colspan="3" align="right"><input id="edit_platform_form_reset" class="button" type="button" value="Reset" disabled onClick="resetPlatform();" />&nbsp;<input class="button" type="submit" id="edit_platform_form_submit" name="edit_platform_form_submit" value="Submit Edits" disabled /></td>
</tr>
</table>
</form>
</div>
</div>
</div> <!--end section-full-->
</div>
<h3 class="display platform_modify"><a name="#platform_modify">Modify / Delete&nbsp;&raquo;</a></h3>
<div id="platform_modify" class="collapsable">
<form id="platform_modify_form" name="platform_modify_form" action="edit_categories.cgi" method="post">
<input id="modify_platform_id" name="modify_platform_id" type="hidden" value="">
<table class="category">
<tr>
<td colspan="2" align="left">
Select Existing Platform:<br/>
[% INCLUDE form_widgets/select_platform.tmpl size=5 name="platform_modify_existing" onChange="getPlatformByName(this.options[this.selectedIndex].value);" %]
</td>
</tr>
<tr>
<td>Name:</td>
<td><input disabled name="modify_platform_name" type="text" size="30"></td>
</tr>
<tr>
<td>Product:</td>
<td>
[% INCLUDE form_widgets/select_product.tmpl name="platform_modify_product" placeholder=1 disabled=1 %]
</td>
</tr>
<tr>
<td>Detect Regexp:</td>
<td><input disabled name="modify_platform_detect_regexp" type="text" size="30"></td>
</tr>
<tr>
<td>Icon Path:</td>
<td><input disabled name="modify_platform_icon_path" type="text" size="30"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input disabled class="category" name="delete_platform" type="submit" value="Delete Platform">&nbsp;<input disabled class="category" name="update_platform" type="submit" value="Update Platform">
</td>
</tr>
</table>
</form>
</div>
</div>

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

@ -1,107 +1,162 @@
<script type="text/javascript">
function checkAddProductForm(f) {
function enableProductModeButtons() {
document.getElementById("edit_product_button").disabled=false;
document.getElementById("delete_product_button").disabled=false;
}
function disableProductModeButtons() {
document.getElementById("edit_product_button").disabled=true;
document.getElementById("delete_product_button").disabled=true;
}
function loadProduct() {
var product_select = document.getElementById("product_id");
if (! product_select ||
product_select.options[product_select.selectedIndex].value=="") {
disableProductModeButtons();
document.getElementById('edit_product_form_div').style.display = 'none';
disableForm('edit_product_form');
blankProductForm('edit_product_form');
return false;
}
var product_id = product_select.options[product_select.selectedIndex].value;
disableForm('edit_product_form');
toggleMessage('loading','Loading Product ID# ' + product_id + '...');
var url = 'json.cgi?product_id=' + product_id;
fetchJSON(url,populateProduct);
}
function populateProduct(data) {
product=data;
document.getElementById('edit_product_form_product_id').value = product.product_id;
document.getElementById('edit_product_form_product_id_display').innerHTML = product.product_id;
document.getElementById('edit_product_form_name').value = product.name;
document.getElementById('edit_product_form_iconpath').value = product.iconpath;
var enabled_em = document.getElementById('edit_product_form_enabled')
if (product.enabled == 1) {
enabled_em.checked = true;
} else {
enabled_em.checked = false;
}
document.getElementById('edit_product_form_div').style.display = 'block';
enableProductModeButtons();
}
function blankProductForm(formid) {
blankForm(formid);
document.getElementById('edit_product_form_product_id_display').innerHTML = '';
}
function switchProductFormToAdd() {
disableProductModeButtons();
blankProductForm('edit_product_form');
document.getElementById('edit_product_form_submit').value = 'Add Product';
document.getElementById('edit_product_form_mode').value = 'add';
enableForm('edit_product_form');
document.getElementById('edit_product_form_div').style.display = 'block';
}
function switchProductFormToEdit() {
document.getElementById('edit_product_form_submit').value = 'Submit Edits';
document.getElementById('edit_product_form_mode').value = 'edit';
enableForm('edit_product_form');
document.getElementById('edit_product_form_div').style.display = 'block';
}
function checkProductForm(f) {
return (
checkString(f.new_product_name,"product name",false) &&
checkString(f.new_product_icon_path,"icon path",true)
checkString(f.edit_product_form_name,"product name",false) &&
checkString(f.edit_product_form_iconpath,"product icon path",true)
);
}
function getProductByName(productName) {
http.open('get', 'rpc.cgi?action=getProductByName&productName='+productName);
http.onreadystatechange = updateProductForm;
http.send(null);
}
function updateProductForm() {
if(http.readyState == 4){
var response = http.responseText;
var update = new Array();
var em = document.getElementById("notification-content")
if(response.indexOf('|' != -1)) {
update = response.split('|');
document.getElementById("modify_product_id").value = update[0];
document.getElementById("modify_product_name").disabled = false;
document.getElementById("modify_product_name").value = update[1];
document.getElementById("modify_product_icon_path").disabled = false;
document.getElementById("modify_product_icon_path").value = update[2];
document.getElementById("modify_product_enabled").disabled = false;
document.getElementById("modify_product_enabled").checked = update[3] == 1 ? true : false;
document.getElementById("delete_product").disabled = false;
document.getElementById("update_product").disabled = false;
function resetProduct() {
if (document.getElementById('edit_product_form_product_id').value != '') {
populateProduct(product);
switchProductFormToEdit();
} else {
document.getElementById("notification").style.display = 'block';
em.innerHTML = response;
}
switchProductFormToAdd();
}
}
</script>
<div id="products" class="category">
<h1 id="products_header" class="firstHeading"><a name="manage_products" class="collapse-link">Manage Products&nbsp;&raquo;</a></h1>
<h2>Products</h2>
<div id="manage_products_div" class="collapsable">
<div class="section-full">
<div class="section-header">Existing Products</div>
<h3 class="display product_add"><a name="#product_add">Add&nbsp;&raquo;</a></h3>
<div id="product_add" class="collapsable">
<form name="product_add_form" id="product_add_form" action="edit_categories.cgi" method="post" onSubmit="return checkAddProductForm(this);">
<table class="category">
<tr>
<td>Name:</td>
<td><input id="new_product_name" name="new_product_name" type="text" size="30"></td>
</tr>
<tr>
<td>Icon Path:</td>
<td><input id="new_product_icon_path" name="new_product_icon_path" type="text" size="30"></td>
</tr>
<tr>
<td>Enabled:</td>
<td><input id="new_product_enabled" name="new_product_enabled" type="checkbox" class="category" checked></td>
</tr>
<tr>
<td colspan="2" align="right">
<input class="category" name="reset" type="reset" value="Reset">&nbsp;<input class="category" name="add_product" type="submit" value="Add New Product">
</td>
</tr>
</table>
</form>
<div class="section-content">
<form id="select_product_and_mode_form" name="select_product_and_mode_form" method="post" action="manage_categories.cgi">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>
[% INCLUDE form_widgets/select_product_id.tmpl name="product_id" placeholder=1 size=5 show_name=1 onChange="loadProduct();" %]
</td>
</tr>
<tr>
<td>
<input id="add_product_button" name="add_product_button" class="manage" type="button" onClick="switchProductFormToAdd();" value="Add new product">&nbsp;
<input id="edit_product_button" name="edit_product_button" class="manage" type="button" onClick="switchProductFormToEdit();" value="Edit product" disabled>&nbsp;
<input id="delete_product_button" name="delete_product_button" class="manage" type="submit" onClick="return confirm('Really delete this product?')
;" value="Delete product" disabled>&nbsp;
</td>
</tr>
</table>
</form>
</div> <!--end section-content-->
<div style="display: none;" id="edit_product_form_div">
<hr />
<div id="product-title" class="section-header">Product Info</div>
<div class="section-content">
<form id="edit_product_form" name="edit_product_form" method="post" action="manage_categories.cgi" onSubmit="return checkProductForm(this);">
<input id="edit_product_form_mode" name="edit_product_form_mode" type="hidden" value="edit">
<input id="edit_product_form_product_id" name="edit_product_form_product_id" type="hidden" value="">
<table class="manage">
<tr>
<td class="headerleft">Product ID#:</td>
<td name="edit_product_form_product_id_display" id="edit_product_form_product_id_display"></td>
</tr>
<tr>
<td class="headerleft">Name:</td>
<td colspan="2"><input name="edit_product_form_name"
id="edit_product_form_name"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Icon Path:</td>
<td colspan="2"><input name="edit_product_form_iconpath"
id="edit_product_form_iconpath"
value=""
size="55"/ disabled></td>
</tr>
<tr>
<td class="headerleft">Enabled?</td>
<td><input name="edit_product_form_enabled"
id="edit_product_form_enabled"
type="checkbox"
value="1" disabled>
</td>
<td>&lArr;&nbsp;Uncheck this to completely disable this product. <b>NOTE</b>: this will have also disable all associated test runs, test groups, subgroups, and testcases.</td>
</tr>
<tr>
<td colspan="3" align="right"><input id="edit_product_form_reset" class="button" type="button" value="Reset" disabled onClick="resetProduct();" />&nbsp;<input class="button" type="submit" id="edit_product_form_submit" name="edit_product_form_submit" value="Submit Edits" disabled /></div>
</td>
</tr>
</table>
</form>
</div>
</div>
</div> <!--end section-full-->
</div>
<h3 class="display product_modify"><a name="#product_modify">Modify / Delete&nbsp;&raquo;</a></h3>
<div id="product_modify" class="collapsable">
<form id="product_modify_form" name="product_modify_form" action="edit_categories.cgi" method="post">
<input id="modify_product_id" name="modify_product_id" type="hidden" value="">
<table class="category">
<tr>
<td colspan="2" align="left">
Select Existing Product:<br/>
[% INCLUDE form_widgets/select_product.tmpl name="product_modify_existing" size=5 onChange="getProductByName(this.options[this.selectedIndex].value);" %]
</td>
</tr>
<tr>
<td>Name:</td>
<td><input disabled id="modify_product_name" name="modify_product_name" type="text" size="30"></td>
</tr>
<tr>
<td>Icon Path:</td>
<td><input disabled id="modify_product_icon_path" name="modify_product_icon_path" type="text" size="30"></td>
</tr>
<tr>
<td>Enabled:</td>
<td><input disabled id="modify_product_enabled" name="modify_product_enabled" type="checkbox" class="category"></td>
</tr>
<tr>
<td colspan="2" align="right">
<input disabled class="category" id="delete_product" name="delete_product" type="submit" value="Delete Product">&nbsp;<input disabled class="category" id="update_product" name="update_product" type="submit" value="Update Product">
</td>
</tr>
</table>
</form>
</div>
</div>

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

@ -28,7 +28,7 @@
[% 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/html_header.tmpl js_files=['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">

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

@ -28,7 +28,7 @@
[% 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'] %]
[% INCLUDE global/html_header.tmpl js_files=['js/FormValidation.js','js/MochiKit/MochiKit.js','js/json.js','js/Help.js','js/SelectBoxes.js'] %]
[% INCLUDE global/litmus_header.tmpl %]
<script type="text/javascript">

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

@ -28,7 +28,7 @@
[% 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/html_header.tmpl js_files=['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">

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

@ -0,0 +1,9 @@
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %][% IF onChange %] onChange="[% onChange %]"[% END %][% IF multiple %] multiple[% END %]>
[% IF placeholder %]<option value="">-Branch-</option>[% END %]
[% IF branches %]
[% FOREACH branch=branches %]
<option[% IF defaults.branch==branch.name %] selected[% END %]
value="[% branch.branch_id | html %]">[% branch.name | html %] ([% branch.branch_id %])</option>
[% END %]
[% END %]
</select>

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

@ -0,0 +1,9 @@
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %][% IF onChange %] onChange="[% onChange %]"[% END %][% IF multiple %] multiple[% END %]>
[% IF placeholder %]<option value="">-Operating System-</option>[% END %]
[% IF opsyses %]
[% FOREACH opsys=opsyses %]
<option[% IF defaults.opsys==opsys.name %] selected[% END %]
value="[% opsys.opsys_id | html %]">[% opsys.name | html %] ([% opsys.opsys_id %])</option>
[% END %]
[% END %]
</select>

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

@ -0,0 +1,9 @@
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %][% IF onChange %] onChange="[% onChange %]"[% END %]>
[% IF placeholder %]<option value="">-Platform-</option>[% END %]
[% IF platforms %]
[% FOREACH platform=platforms %]
<option[% IF defaults.platform==platform.name %] selected[% END %]
value="[% platform.platform_id | html %]">[% platform.name | html %] ([% platform.platform_id %])</option>
[% END %]
[% END %]
</select>

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

@ -1,9 +1,9 @@
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %][% IF onChange %] onChange="[% onChange %]"[% END %]>
<select id="[% name %]" name="[% name %]"[% IF size %] size="[% size %]"[% END %][% IF disabled %] disabled[% END %][% IF onChange %] onChange="[% onChange %]"[% END %][% IF multiple %] multiple[% END %]>
[% IF placeholder %]<option value="">-Product-</option>[% END %]
[% IF products %]
[% FOREACH product=products %]
<option[% IF defaults.product==product.name %] selected[% END %]
value="[% product.product_id | html %]">[% product.name | html %]</option>
value="[% product.product_id | html %]">[% product.name | html %] ([% product.product_id %])</option>
[% END %]
[% END %]
</select>

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

@ -92,7 +92,7 @@
<div class="testcase-head">
<table cellpadding="0" cellspacing="0">
<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="l"><a name="test_[% i %]" onclick="allStretch.toggle('t[% i %]-content');">[% 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="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>
@ -125,7 +125,7 @@ var tmp_menub=new Array([% i=1 %][% FOREACH testcase_id=testcase_ids %]"mb[% i %
<tr>
<td class="submitall"><div class="v3"><input class="button" type="submit" id="Submit" name="Submit" value="Submit All Results" onclick="findEdited()" /></div></td>
<td class="r">
<div class="nav"><a id="bottom_all" href="#" onclick="allStretch.showAll('height'); return false;">Show All</a></div>
<div class="nav"><a id="bottom_show_all" href="#" onclick="allStretch.showAll('height'); return false;">Show All</a>&nbsp;/&nbsp;<a id="bottom_hide_all" href="#" onclick="allStretch.hideAll('height'); return false;">Hide All</a></div>
</td>
</tr>
</table>

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

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

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

@ -5,7 +5,7 @@
[% order_num=1 %]
[% FOREACH curtest=tests %]
[% results=curtest.is_completed(sysconfig.platform,sysconfig.build_id,sysconfig.locale,defaultemail) %]
<li class="tcs" id="li[% order_num %]"><a id="a[% order_num %]" href="#" onclick="allStretch.showThisHideOpen($('t[% order_num %]-content'), 100, 'height'); return false;">[% order_num %]. [% IF results %]<strike>[% END %][% curtest.summary | html %][% IF results %]</strike>[% END %]</a>
<li class="tcs" id="li[% order_num %]"><a id="a[% order_num %]" onclick="window.location.href='#test_[% order_num %]'; allStretch.showThisHideOpen($('t[% order_num %]-content'), 100, 'height'); return false;">[% order_num %]. [% IF results %]<strike>[% END %][% curtest.summary | html %][% IF results %]</strike>[% END %]</a>
</li>
[% order_num=order_num+1 %]
[% END %]