diff --git a/mozilla/webtools/litmus/Litmus/DB/TestDay.pm b/mozilla/webtools/litmus/Litmus/DB/TestDay.pm new file mode 100755 index 00000000000..8d1fe7fa92c --- /dev/null +++ b/mozilla/webtools/litmus/Litmus/DB/TestDay.pm @@ -0,0 +1,53 @@ +# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*- + +=head1 COPYRIGHT + + # ***** 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): + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** + +=cut + +package Litmus::DB::TestDay; +$VERSION = 1.00; +use strict; +use base 'Litmus::DBI'; + +Litmus::DB::TestDay->table('testdays'); + +Litmus::DB::TestDay->columns(All => qw/testday_id last_updated start_timestamp finish_timestamp description product_id testgroup_id build_id branch_id locale_abbrev/); +Litmus::DB::TestDay->columns(Essential => qw/testday_id last_updated start_timestamp finish_timestamp description product_id testgroup_id build_id branch_id locale_abbrev/); +Litmus::DB::TestDay->columns(TEMP => qw //); + +Litmus::DB::TestDay->column_alias("product_id", "product"); +Litmus::DB::TestDay->column_alias("testgroup_id", "testgroup"); +Litmus::DB::TestDay->column_alias("branch_id", "branch"); +Litmus::DB::TestDay->column_alias("locale_abbrev", "locale"); + +Litmus::DB::TestDay->has_a(product => "Litmus::DB::Product"); +Litmus::DB::TestDay->has_a(testgroup => "Litmus::DB::Testgroup"); +Litmus::DB::TestDay->has_a(branch => "Litmus::DB::Branch"); +Litmus::DB::TestDay->has_a(locale => "Litmus::DB::Locale"); + +1; diff --git a/mozilla/webtools/litmus/Litmus/FormWidget.pm b/mozilla/webtools/litmus/Litmus/FormWidget.pm index bd731d612e5..7716dc42e5c 100755 --- a/mozilla/webtools/litmus/Litmus/FormWidget.pm +++ b/mozilla/webtools/litmus/Litmus/FormWidget.pm @@ -46,6 +46,7 @@ BEGIN { use DBI; use Litmus::DBI; +use Litmus::DB::TestDay; our $_dbh = Litmus::DBI->db_Main(); @@ -115,7 +116,7 @@ See Also : ######################################################################### sub getProducts() { - my $sql = "SELECT name, product_id FROM products ORDER BY name"; + my $sql = "SELECT name, product_id FROM products ORDER BY name ASC"; return _getValues($sql); } @@ -136,7 +137,7 @@ sub getPlatforms() ######################################################################### sub getBranches() { - my $sql = "SELECT name, branch_id FROM branches ORDER BY name ASC"; + my $sql = "SELECT name, branch_id, product_id FROM branches ORDER BY name ASC"; return _getValues($sql); } @@ -150,7 +151,7 @@ sub getUniqueBranches() ######################################################################### sub getOpsyses() { - my $sql = "SELECT name, opsys_id FROM opsyses ORDER BY name ASC"; + my $sql = "SELECT name, opsys_id, platform_id FROM opsyses ORDER BY name ASC"; return _getValues($sql); } @@ -226,6 +227,13 @@ sub getUsers() return \@users; } +######################################################################### +sub getTestdays() +{ + my @testdays = reverse Litmus::DB::TestDay->retrieve_all(); + return \@testdays; +} + ######################################################################### sub getAuthors() { @@ -235,7 +243,7 @@ sub getAuthors() ######################################################################### sub getTestRuns() { - my $sql = "SELECT test_run_id, name FROM test_runs ORDER BY finish_timestamp DESC, name ASC"; + my $sql = "SELECT test_run_id, name FROM test_runs ORDER BY finish_timestamp DESC, name DESC"; return _getValues($sql); } diff --git a/mozilla/webtools/litmus/Litmus/TestEvent.pm b/mozilla/webtools/litmus/Litmus/TestEvent.pm new file mode 100755 index 00000000000..45762da5810 --- /dev/null +++ b/mozilla/webtools/litmus/Litmus/TestEvent.pm @@ -0,0 +1,394 @@ +# -*- mode: cperl; c-basic-offset: 8; indent-tabs-mode: nil; -*- + +=head1 COPYRIGHT + + # ***** 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): + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** + +=cut + +package Litmus::TestEvent; +$VERSION = 1.00; +use strict; + +use Litmus::DBI; +use Litmus::DB::TestDay; + +use Date::Manip; + +sub new { + my ($class, %args) = @_; + my $self = bless {}, ref($class)||$class; + $self->_init(%args); + return $self; +} + +sub _init { + my ($self, %args) = @_; + + if (!$args{testday_id} and + !$args{testdate} and + !($args{start_timestamp} and $args{finish_timestamp})) { + warn "Error initializing TestEvent - please supply either a testday_id, testdate or a start_timestamp/finish_timestamp pair."; + return 1; + } + + $self->{_dbh} = Litmus::DBI->db_Main; + + if ($args{testday_id}) { + my $testday = Litmus::DB::TestDay->retrieve($args{testday_id}); + + if ($testday) { + $self->{_planned_testday} = 1; + + $self->{_start_timestamp} = &UnixDate($testday->start_timestamp,"%q"); + $self->{_finish_timestamp} = &UnixDate($testday->finish_timestamp,"%q"); + $self->{_description} = $testday->description; + $self->{_product_id} = $testday->product_id; + $self->{_testgroup_id} = $testday->testgroup_id; + $self->{_build_id} = $testday->build_id; + $self->{_branch_id} = $testday->branch_id; + $self->{_locale} = $testday->locale_abbrev; + } else { + warn "Unable to lookup testday for testday_id: " . $args{testday_id}; + return 1; + } + return; + } + + if ($args{testdate}) { + $self->{_start_timestamp} = &UnixDate($args{testdate} . " 07:00:00", "%q"); + $self->{_finish_timestamp} = &UnixDate($args{testdate} . " 17:00:00", "%q"); + } elsif ($args{start_timestamp} and $args{finish_timestamp}) { + $self->{_start_timestamp} = &UnixDate($args{start_timestamp}, "%q"); + $self->{_finish_timestamp} = &UnixDate($args{finish_timestamp}, "%q"); + } + + $self->{_description} = "User-defined"; + $self->{_product_id} = $args{product_id}; + $self->{_testgroup_id} = $args{testgroup_id}; + $self->{_build_id} = $args{build_id}; + $self->{_branch_id} = $args{branch_id}; + $self->{_locale} = $args{locale}; +} + +######################################################################### +sub getBreakdownByLocale { + my ($self) = @_; + my $locale_sql_select = "SELECT tr.locale_abbrev,count(tr.testresult_id) as num_results"; + my $locale_sql_from = "FROM test_results tr"; + my $locale_sql_where ="WHERE tr.submission_time>=" . $self->{_start_timestamp} . " and tr.submission_time<" . $self->{_finish_timestamp}; + my $locale_sql_group_by = "GROUP BY tr.locale_abbrev"; + my $locale_sql_order_by = "ORDER BY num_results DESC"; + + if ($self->{_testgroup_id}) { + $locale_sql_from .= ", testcase_subgroups tsg, subgroup_testgroups sgtg"; + $locale_sql_where .= " AND tr.testcase_id=tsg.testcase_id AND tsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=".$self->{_testgroup_id}; + } + + if ($self->{_build_id}) { + $locale_sql_where .= " AND tr.build_id LIKE '" . $self->{_build_id} . "%'"; + } + + if ($self->{_branch_id}) { + $locale_sql_where .= " AND tr.branch_id=" . $self->{_branch_id}; + } + + if ($self->{_locale}) { + $locale_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $locale_sql = "$locale_sql_select $locale_sql_from $locale_sql_where $locale_sql_group_by $locale_sql_order_by"; + + my $sth = $self->{_dbh}->prepare($locale_sql); + $sth->execute(); + + my @locales; + while (my $result = $sth->fetchrow_hashref) { + push @locales, $result; + } + $sth->finish; + + return \@locales; +} + +######################################################################### +sub getBreakdownByPlatform { + my ($self) = @_; + + my $platform_sql_select = "SELECT pl.name,count(tr.testresult_id) AS num_results"; + my $platform_sql_from = "FROM test_results tr, testcases t, platforms pl, opsyses o"; + my $platform_sql_where = "WHERE tr.testcase_id=t.testcase_id AND tr.submission_time>=$self->{_start_timestamp} and tr.submission_time<$self->{_finish_timestamp} AND tr.opsys_id=o.opsys_id AND o.platform_id=pl.platform_id"; + my $platform_sql_group_by = "GROUP BY o.platform_id"; + my $platform_sql_order_by = "ORDER BY num_results DESC"; + + if ($self->{_testgroup_id}) { + $platform_sql_from .= ", testcase_subgroups tsg, subgroup_testgroups sgtg"; + $platform_sql_where .= " AND tr.testcase_id=tsg.testcase_id AND tsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=$self->{_testgroup_id}"; + } + + if ($self->{_build_id}) { + $platform_sql_where .= " AND tr.build_id LIKE '" . $self->{_build_id} . "%'"; + } + + if ($self->{_branch_id}) { + $platform_sql_where .= " AND tr.branch_id=" . $self->{_branch_id}; + } + + if ($self->{_locale}) { + $platform_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $platform_sql = "$platform_sql_select $platform_sql_from $platform_sql_where $platform_sql_group_by $platform_sql_order_by"; + + my $sth = $self->{_dbh}->prepare($platform_sql); + $sth->execute(); + + my @platforms; + while (my $result = $sth->fetchrow_hashref) { + push @platforms, $result; + } + $sth->finish; + + return \@platforms; +} + +######################################################################### +sub getBreakdownByResultStatus { + my ($self) = @_; + + my $status_sql_select = "SELECT rs.name,count(tr.testresult_id) AS num_results,rs.class_name"; + my $status_sql_from = "FROM test_results tr, test_result_status_lookup rs"; + my $status_sql_where = "WHERE tr.submission_time>=$self->{_start_timestamp} and tr.submission_time<$self->{_finish_timestamp} AND rs.result_status_id=tr.result_status_id"; + my $status_sql_group_by = "GROUP BY tr.result_status_id"; + my $status_sql_order_by = "ORDER BY num_results DESC"; + + if ($self->{_testgroup_id}) { + $status_sql_from .= ", testcase_subgroups tsg, subgroup_testgroups sgtg"; + $status_sql_where .= " AND tr.testcase_id=tsg.testcase_id AND tsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=" . $self->{_testgroup_id}; + } + + if ($self->{_build_id}) { + $status_sql_where .= " AND tr.build_id LIKE '" . $self->{_build_id} . "%'"; + } + + if ($self->{_branch_id}) { + $status_sql_where .= " AND tr.branch_id=" . $self->{_branch_id}; + } + + if ($self->{_locale}) { + $status_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $status_sql = "$status_sql_select $status_sql_from $status_sql_where $status_sql_group_by $status_sql_order_by"; + + my $sth = $self->{_dbh}->prepare($status_sql); + $sth->execute(); + + my @statuses; + while (my $result = $sth->fetchrow_hashref) { + push @statuses, $result; + } + $sth->finish; + + return \@statuses; +} + +######################################################################### +sub getBreakdownBySubgroup { + my ($self) = @_; + + my $subgroup_sql_select = "SELECT CONCAT(p.name,':',tg.name,':',s.name) as name,count(tr.testresult_id) as num_results,sgtg.subgroup_id"; + my $subgroup_sql_from = "FROM test_results tr, testcases t, testcase_subgroups tsg, subgroups s, subgroup_testgroups sgtg, testgroups tg, products p"; + my $subgroup_sql_where = "WHERE tr.submission_time>=$self->{_start_timestamp} and tr.submission_time<$self->{_finish_timestamp} AND tg.product_id=p.product_id AND tg.testgroup_id=sgtg.testgroup_id AND sgtg.subgroup_id=s.subgroup_id AND tsg.subgroup_id=s.subgroup_id AND tsg.testcase_id=t.testcase_id AND tr.testcase_id=t.testcase_id"; + my $subgroup_sql_group_by = "GROUP BY tg.product_id,tg.testgroup_id,s.subgroup_id"; + my $subgroup_sql_order_by = "ORDER BY num_results DESC, p.name ASC, tg.name ASC, sgtg.sort_order ASC"; + + if ($self->{_testgroup_id}) { + $subgroup_sql_where .= " AND tg.testgroup_id=" . $self->{_testgroup_id}; + } + + if ($self->{_build_id}) { + $subgroup_sql_where .= " AND tr.build_id LIKE '" . $self->{_build_id} . "%'"; + } + + if ($self->{_branch_id}) { + $subgroup_sql_where .= " AND tr.branch_id=$self->{_branch_id}"; + } + if ($self->{_locale}) { + $subgroup_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $subgroup_sql = "$subgroup_sql_select $subgroup_sql_from $subgroup_sql_where $subgroup_sql_group_by $subgroup_sql_order_by"; + + my @subgroups; + my $sth = $self->{_dbh}->prepare($subgroup_sql); + $sth->execute(); + + while (my $result = $sth->fetchrow_hashref) { + push @subgroups, $result; + } + $sth->finish; + + my $subgroup_count_sql = "SELECT COUNT(t.testcase_id) FROM testcases t, testcase_subgroups tsg WHERE tsg.subgroup_id=? AND t.testcase_id=tsg.testcase_id AND t.enabled=1 AND t.community_enabled=1"; + $sth = $self->{_dbh}->prepare($subgroup_count_sql); + $sth->execute(); + + foreach my $result (@subgroups) { + $sth->execute($result->{'subgroup_id'}); + my ($testcase_count) = $sth->fetchrow_array; + $result->{'testcase_count'} = $testcase_count; + } + $sth->finish; + + return \@subgroups; +} + +######################################################################### +sub getBreakdownByUser { + my ($self) = @_; + + my $user_sql_select = "SELECT u.user_id,u.email,count(tr.testresult_id) AS num_results,u.irc_nickname"; + my $user_sql_from = "FROM test_results tr, testcases t, users u"; + my $user_sql_where = "WHERE tr.testcase_id=t.testcase_id AND tr.submission_time>=$self->{_start_timestamp} and tr.submission_time<$self->{_finish_timestamp} AND tr.user_id=u.user_id"; + my $user_sql_group_by = "GROUP BY tr.user_id"; + my $user_sql_order_by = "ORDER BY num_results DESC"; + + if ($self->{_testgroup_id}) { + $user_sql_from .= ", testcase_subgroups tsg, subgroup_testgroups sgtg"; + $user_sql_where .= " AND tr.testcase_id=tsg.testcase_id AND tsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=" . $self->{_testgroup_id}; + } + + if ($self->{_build_id}) { + $user_sql_where .= " AND tr.build_id LIKE '" . $self->{_build_id} . "%'"; + } + + if ($self->{_branch_id}) { + $user_sql_where .= " AND tr.branch_id=" . $self->{_branch_id}; + } + if ($self->{_locale}) { + $user_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $user_sql = "$user_sql_select $user_sql_from $user_sql_where $user_sql_group_by $user_sql_order_by"; + + my $sth = $self->{_dbh}->prepare($user_sql); + $sth->execute(); + + my @users; + while (my $result = $sth->fetchrow_hashref) { + push @users, $result; + } + $sth->finish; + + return \@users; +} + +######################################################################### +sub getBreakdownByUserAndResultStatus { + my ($self) = @_; + + my $tester_sql_select = "SELECT u.email,rs.class_name AS result_status,count(rs.name) as num_results,u.irc_nickname"; + my $tester_sql_from = "FROM test_results tr, users u, test_result_status_lookup rs"; + my $tester_sql_where = "WHERE tr.submission_time>=$self->{_start_timestamp} and tr.submission_time<$self->{_finish_timestamp} AND tr.user_id=u.user_id AND rs.result_status_id=tr.result_status_id"; + my $tester_sql_group_by = "GROUP BY tr.user_id,rs.name"; + my $tester_sql_order_by = "ORDER BY u.irc_nickname DESC, u.email DESC"; + + if ($self->{_testgroup_id}) { + $tester_sql_from .= ", testcase_subgroups tsg, subgroup_testgroups sgtg"; + $tester_sql_where .= " AND tr.testcase_id=tsg.testcase_id AND tsg.subgroup_id=sgtg.subgroup_id AND sgtg.testgroup_id=$self->{_testgroup_id}"; + } + + if ($self->{_build_id}) { + $tester_sql_where .= " AND tr.build_id LIKE '$self->{_build_id}%'"; + } + + if ($self->{_branch_id}) { + $tester_sql_where .= " AND tr.branch_id=$self->{_branch_id}"; + } + + if ($self->{_locale}) { + $tester_sql_where .= " AND tr.locale_abbrev='" . $self->{_locale} . "'"; + } + + my $tester_sql = "$tester_sql_select $tester_sql_from $tester_sql_where $tester_sql_group_by $tester_sql_order_by"; + + my $sth = $self->{_dbh}->prepare($tester_sql); + $sth->execute(); + + my $testers; + while (my @result = $sth->fetchrow_array) { + $testers->{$result[0]}->{$result[1]} = $result[2]; + $testers->{$result[0]}->{'irc_nickname'} = $result[3]; + } + $sth->finish; + + my @tester_result_statuses; + foreach my $key (sort keys %$testers) { + my $hash_ref; + $hash_ref->{'email'} = $key; + $hash_ref->{'irc_nickname'} = $testers->{$key}->{'irc_nickname'}; + $hash_ref->{'pass'} = $testers->{$key}->{'pass'} || 0; + $hash_ref->{'fail'} = $testers->{$key}->{'fail'} || 0; + $hash_ref->{'unclear'} = $testers->{$key}->{'unclear'} || 0; + push @tester_result_statuses, $hash_ref; + } + + return \@tester_result_statuses; +} + +######################################################################### +sub getDescription { + my ($self) = @_; + + return $self->{_description}; +} + +######################################################################### +sub getStartTimestamp { + my ($self, $for_display) = @_; + + if ($for_display) { + return &UnixDate($self->{_start_timestamp},"%Y-%m-%d %H:%M:%S"); + } + + return $self->{_start_timestamp}; +} + +######################################################################### +sub getFinishTimestamp { + my ($self, $for_display) = @_; + + if ($for_display) { + return &UnixDate($self->{_finish_timestamp},"%Y-%m-%d %H:%M:%S"); + } + + return $self->{_finish_timestamp}; +} + +1; + + + diff --git a/mozilla/webtools/litmus/css/litmus.css b/mozilla/webtools/litmus/css/litmus.css index 4d066bf3d5c..0d3ca3db27f 100755 --- a/mozilla/webtools/litmus/css/litmus.css +++ b/mozilla/webtools/litmus/css/litmus.css @@ -944,11 +944,11 @@ table.manage input.button { margin: 5px; } -select.testcase-subgroups, select.subgroup-testgroups { +select.testcase-subgroups, select.subgroup-testgroups, select.testgroup-test-runs { width: 300px; } -select.testcase, select.testcase_id, select.subgroup_id, select.testgroup_id { +select.testcase, select.testcase_id, select.subgroup_id, select.testgroup_id, select.test_run_id { width: 700px; } @@ -1137,7 +1137,7 @@ div.section-content { padding-right: 10px; } -div.testcase-content, div.subgroup-content, div.testgroup-content { +div.testcase-content, div.subgroup-content, div.testgroup-content, div.test-run-content { padding: 0px; margin: 5px 10px 0px 10px; width: auto; @@ -1239,7 +1239,17 @@ table.testcase-search th, table.test-runs th { border: 0; } -table.testcases th, table.testcases td.headerleft { + +table.result_container th { + vertical-align: middle; + font-weight: bold; + text-transform: lowercase; + color: #000000; + padding: 0px 5px 0px 5px; + border: 0; +} + +table.testcases th, table.testcases td.headerleft, table.testday_results td.headerleft, table.testday_results th { vertical-align: middle; font-weight: bold; text-transform: lowercase; @@ -1248,10 +1258,6 @@ table.testcases th, table.testcases td.headerleft { border: 0; } -table.testcases td.headerleft { - text-align: left; -} - table.testcases td { padding-left: 5px; } diff --git a/mozilla/webtools/litmus/enter_test.cgi b/mozilla/webtools/litmus/enter_test.cgi index 47450973f70..b14f1aee2fa 100755 --- a/mozilla/webtools/litmus/enter_test.cgi +++ b/mozilla/webtools/litmus/enter_test.cgi @@ -25,7 +25,6 @@ use strict; use Litmus; use Litmus::Error; use Litmus::DB::Product; -use Litmus::DB::TestcaseSubgroup; use Litmus::Auth; use Litmus::Utils; diff --git a/mozilla/webtools/litmus/images/comment.png b/mozilla/webtools/litmus/images/comment.png new file mode 100644 index 00000000000..2a3205127a8 Binary files /dev/null and b/mozilla/webtools/litmus/images/comment.png differ diff --git a/mozilla/webtools/litmus/images/trophy.gif b/mozilla/webtools/litmus/images/trophy.gif new file mode 100644 index 00000000000..816a4ec016c Binary files /dev/null and b/mozilla/webtools/litmus/images/trophy.gif differ diff --git a/mozilla/webtools/litmus/js/FormValidation.js b/mozilla/webtools/litmus/js/FormValidation.js index 7c854882836..0e3ce3c241e 100644 --- a/mozilla/webtools/litmus/js/FormValidation.js +++ b/mozilla/webtools/litmus/js/FormValidation.js @@ -367,6 +367,19 @@ function verifySelected(theField, fieldName) { } } +function verifySelectNotEmpty(selectBox, message) { + if (selectBox.options.length > 0) { + // We just need to find one option with a non-empty value. + var ems = selectBox.getElementsByTagName('option'); + for (var i in ems) { + if (!isEmpty(ems[i].value)) { + return true; + } + } + } + return warnInvalid (selectBox, message + ' Please make a selection now.'); +} + function toggleMessage(msgType,msg) { var em = document.getElementById("message"); if (toggleMessage.arguments.length < 1) { diff --git a/mozilla/webtools/litmus/js/ManageCategories.js b/mozilla/webtools/litmus/js/ManageCategories.js index c75c71df897..2e5b90ae01f 100644 --- a/mozilla/webtools/litmus/js/ManageCategories.js +++ b/mozilla/webtools/litmus/js/ManageCategories.js @@ -2,6 +2,7 @@ var product; var platform; var opsys; var branch; +var testday; function enableBranchModeButtons() { document.getElementById("edit_branch_button").disabled=false; @@ -409,3 +410,109 @@ function resetProduct() { switchProductFormToAdd(); } } + +function enableTestdayModeButtons() { + document.getElementById("edit_testday_button").disabled=false; + document.getElementById("delete_testday_button").disabled=false; +} + +function disableTestdayModeButtons() { + document.getElementById("edit_testday_button").disabled=true; + document.getElementById("delete_testday_button").disabled=true; +} + +function loadTestday() { + var testday_select = document.getElementById("testday_id"); + + if (! testday_select || + testday_select.options[testday_select.selectedIndex].value=="") { + disableTestdayModeButtons(); + document.getElementById('edit_testday_form_div').style.display = 'none'; + disableForm('edit_testday_form'); + blankTestdayForm('edit_testday_form'); + return false; + } + + var testday_id = testday_select.options[testday_select.selectedIndex].value; + + disableForm('edit_testday_form'); + toggleMessage('loading','Loading Testday ID# ' + testday_id + '...'); + var url = 'json.cgi?testday_id=' + testday_id; + fetchJSON(url,populateTestday); +} + +function populateTestday(data) { + testday=data; + document.getElementById('edit_testday_form_testday_id').value = testday.testday_id; + document.getElementById('edit_testday_form_testday_id_display').innerHTML = testday.testday_id; + document.getElementById('edit_testday_form_desc').value = testday.description; + document.getElementById('edit_testday_form_start_timestamp').value = testday.start_timestamp.replace(/-| |:/g, ""); + document.getElementById('edit_testday_form_finish_timestamp').value = testday.finish_timestamp.replace(/-| |:/g, ""); + productBox = document.getElementById('testday_product_id'); + branchBox = document.getElementById('testday_branch_id'); + testgroupBox = document.getElementById('testday_testgroup_id'); + if (testday.product_id) { + changeSelected(productBox,testday.product_id.product_id); + changeProduct(productBox,branchBox,testgroupBox); + if (testday.branch_id) { + changeSelected(branchBox,testday.branch_id.branch_id); + changeBranch(branchBox,testgroupBox); + if (testday.testgroup_id) { + changeSelected(testgroupBox,testday.testgroup_id.testgroup_id); + } + } + } else { + changeSelected(productBox,""); + changeProduct(productBox,branchBox,testgroupBox); + } + document.getElementById('testday_build_id').value = testday.build_id + localeBox = document.getElementById('testday_locale'); + if (testday.locale_abbrev) { + changeSelected(localeBox,testday.locale_abbrev.abbrev); + } else { + changeSelected(localeBox,""); + } + + document.getElementById('edit_testday_form_div').style.display = 'block'; + enableTestdayModeButtons(); +} + +function blankTestdayForm(formid) { + blankForm(formid); + document.getElementById('edit_testday_form_testday_id_display').innerHTML = ''; +} + +function switchTestdayFormToAdd() { + disableTestdayModeButtons(); + blankTestdayForm('edit_testday_form'); + document.getElementById('edit_testday_form_testday_id_display').innerHTML = 'Automatically generated for a new testday'; + document.getElementById('edit_testday_form_submit').value = 'Add Testday'; + document.getElementById('edit_testday_form_mode').value = 'add'; + enableForm('edit_testday_form'); + document.getElementById('edit_testday_form_div').style.display = 'block'; +} + +function switchTestdayFormToEdit() { + document.getElementById('edit_testday_form_submit').value = 'Submit Edits'; + document.getElementById('edit_testday_form_mode').value = 'edit'; + enableForm('edit_testday_form'); + document.getElementById('edit_testday_form_div').style.display = 'block'; +} + + +function checkTestdayForm(f) { + return ( + checkString(f.edit_testday_form_name,"testday description",false) && + checkString(f.edit_testday_form_start_timestamp,"testday start timestamp",false) && + checkString(f.edit_testday_form_finish_timestamp,"testday finish timestamp",false) + ); +} + +function resetTestday() { + if (document.getElementById('edit_testday_form_testday_id').value != '') { + populateTestday(testday); + switchTestdayFormToEdit(); + } else { + switchTestdayFormToAdd(); + } +} diff --git a/mozilla/webtools/litmus/js/ManageTestdays.js b/mozilla/webtools/litmus/js/ManageTestdays.js new file mode 100644 index 00000000000..e998bca17f7 --- /dev/null +++ b/mozilla/webtools/litmus/js/ManageTestdays.js @@ -0,0 +1,70 @@ +function populateProductSelect(selectID) +{ + if (products) { + var selectBox = document.getElementById(selectID) + selectBox.options.length = 0; + selectBox.options[0] = new Option('-Product-',''); + for (var i=0; iparam("testcase_id")) { my $json = JSON->new(skipinvalid => 1, convblessed => 1); my $js = $json->objToJson($branch); print $js; +} elsif ($c->param("testday_id")) { + use Litmus::DB::TestDay; + my $testday_id = $c->param("testday_id"); + my $testday = Litmus::DB::TestDay->retrieve($testday_id); + my $json = JSON->new(skipinvalid => 1, convblessed => 1); + my $js = $json->objToJson($testday); + print $js; } elsif ($c->param("products")) { my @products = Litmus::DB::Product->retrieve_all(); my $json = JSON->new(skipinvalid => 1, convblessed => 1); diff --git a/mozilla/webtools/litmus/manage_categories.cgi b/mozilla/webtools/litmus/manage_categories.cgi index 7b32d23c57e..72487f742c6 100755 --- a/mozilla/webtools/litmus/manage_categories.cgi +++ b/mozilla/webtools/litmus/manage_categories.cgi @@ -40,10 +40,9 @@ use Litmus::Error; use Litmus::FormWidget; use CGI; +use JSON; use Time::Piece::MySQL; - - Litmus->init(); Litmus::Auth::requireAdmin("edit_categories.cgi"); @@ -309,6 +308,100 @@ if ($c->param) { } } + # Process testday changes. + if ($c->param("delete_testday_button") and + $c->param("testday_id")) { + my $testday_id = $c->param("testday_id"); + my $testday = Litmus::DB::TestDay->retrieve($testday_id); + if ($testday) { + $rv = $testday->delete; + if ($rv) { + $status = "success"; + $message = "Testday ID# $testday_id deleted successfully."; + $rebuild_cache=1; + } else { + $status = "failure"; + $message = "Failed to delete testday ID# $testday_id."; + } + } else { + $status = "failure"; + $message = "Testday ID# $testday_id does not exist. (Already deleted?)"; + } + } elsif ($c->param("edit_testday_form_mode")) { + if ($c->param("edit_testday_form_mode") eq "add") { + my %hash = ( + description => $c->param('edit_testday_form_desc'), + start_timestamp => $c->param('edit_testday_form_start_timestamp'), + finish_timestamp => $c->param('edit_testday_form_finish_timestamp'), + ); + if ($c->param('testday_product_id')) { + $hash{product_id} = $c->param('testday_product_id'); + } + if ($c->param('testday_branch_id')) { + $hash{branch_id} = $c->param('testday_branch_id'); + } + if ($c->param('testday_testgroup_id')) { + $hash{testgroup_id} = $c->param('testday_testgroup_id'); + } + if ($c->param('testday_build_id')) { + $hash{build_id} = $c->param('testday_build_id'); + } + if ($c->param('testday_locale') and + $c->param('testday_locale') ne "") { + $hash{locale_abbrev} = $c->param('testday_locale'); + } + my $new_testday = + Litmus::DB::TestDay->create(\%hash); + if ($new_testday) { + $status = "success"; + $message = "Testday added successfully. New testday ID# is " . $new_testday->testday_id; + $defaults->{'testday_id'} = $new_testday->testday_id; + $rebuild_cache=1; + } else { + $status = "failure"; + $message = "Failed to add testday."; + } + } elsif ($c->param("edit_testday_form_mode") eq "edit") { + my $testday_id = $c->param("edit_testday_form_testday_id"); + my $testday = Litmus::DB::TestDay->retrieve($testday_id); + if ($testday) { + $testday->description($c->param('edit_testday_form_desc')); + $testday->start_timestamp($c->param('edit_testday_form_start_timestamp')); + $testday->finish_timestamp($c->param('edit_testday_form_finish_timestamp')); + if ($c->param('testday_product_id')) { + $testday->product_id($c->param('testday_product_id')); + } + if ($c->param('testday_branch_id')) { + $testday->branch_id($c->param('testday_branch_id')); + } + if ($c->param('testday_testgroup_id')) { + $testday->testgroup_id($c->param('testday_testgroup_id')); + } + if ($c->param('testday_build_id')) { + $testday->build_id($c->param('testday_build_id')); + } + if ($c->param('testday_locale') and + $c->param('testday_locale') ne "") { + $testday->locale_abbrev($c->param('testday_locale')); + } + + $rv = $testday->update(); + if ($rv) { + $status = "success"; + $message = "Testday ID# $testday_id updated successfully."; + $defaults->{'testday_id'} = $testday_id; + $rebuild_cache=1; + } else { + $status = "failure"; + $message = "Failed to update testday ID# $testday_id."; + } + } else { + $status = "failure"; + $message = "Testday ID# $testday_id not found."; + } + } + } + } if ($rebuild_cache) { @@ -318,7 +411,15 @@ if ($rebuild_cache) { my $products = Litmus::FormWidget->getProducts(); my $platforms = Litmus::FormWidget->getPlatforms(); my $branches = Litmus::FormWidget->getBranches(); +my $testgroups = Litmus::FormWidget->getTestgroups(); my $opsyses = Litmus::FormWidget->getOpsyses(); +my $testdays = Litmus::FormWidget->getTestdays(); +my $locales = Litmus::FormWidget->getLocales; + +my $json = JSON->new(skipinvalid => 1, convblessed => 1); +my $products_js = $json->objToJson($products); +my $branches_js = $json->objToJson($branches); +my $testgroups_js = $json->objToJson($testgroups); my $vars = { title => 'Manage Categories', @@ -326,8 +427,14 @@ my $vars = { platforms => $platforms, branches => $branches, opsyses => $opsyses, + testdays => $testdays, + locales => $locales, }; +$vars->{'products_js'} = $products_js; +$vars->{'branches_js'} = $branches_js; +$vars->{'testgroups_js'} = $testgroups_js; + if ($status and $message) { $vars->{'onload'} = "toggleMessage('$status','$message');"; } diff --git a/mozilla/webtools/litmus/schema.pl b/mozilla/webtools/litmus/schema.pl index 206a7dcc717..9f5b532dc93 100755 --- a/mozilla/webtools/litmus/schema.pl +++ b/mozilla/webtools/litmus/schema.pl @@ -323,6 +323,27 @@ $table{testcases} = fulltext key(summary,steps,expected_results)'; +$table{testdays} = + 'testday_id smallint(6) not null primary key auto_increment, + last_updated timestamp(14), + start_timestamp timestamp(14) not null, + finish_timestamp timestamp(14) not null, + description varchar(255) not null, + product_id tinyint(4), + testgroup_id smallint(6), + build_id int(10) unsigned, + branch_id smallint(6), + locale_abbrev varchar(16), + + index(start_timestamp), + index(finish_timestamp), + index(description), + index(product_id), + index(testgroup_id), + index(build_id), + index(branch_id), + index(locale_abbrev)'; + $table{testgroup_branches} = 'testgroup_id smallint(6) not null, branch_id smallint(6) not null, diff --git a/mozilla/webtools/litmus/templates/en/default/admin/edit_categories.tmpl b/mozilla/webtools/litmus/templates/en/default/admin/edit_categories.tmpl index a5de6d1eb7b..4239e8fc4dc 100644 --- a/mozilla/webtools/litmus/templates/en/default/admin/edit_categories.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/admin/edit_categories.tmpl @@ -25,9 +25,15 @@ # ***** 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','js/MochiKit/MochiKit.js','js/json.js','js/Help.js','js/SelectBoxes.js','js/SelectSort.js','js/ManageCategories.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','js/ManageCategories.js','js/ManageTestdays.js'] %] [% INCLUDE global/litmus_header.tmpl %] +
@@ -39,6 +45,7 @@ [% 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_testdays.tmpl %]
@@ -47,6 +54,7 @@ Element.cleanWhitespace('manage_platforms_div'); Element.cleanWhitespace('manage_opsyses_div'); Element.cleanWhitespace('manage_branches_div'); + Element.cleanWhitespace('manage_testdays_div'); ec_init(); diff --git a/mozilla/webtools/litmus/templates/en/default/admin/form_widgets/update_testdays.tmpl b/mozilla/webtools/litmus/templates/en/default/admin/form_widgets/update_testdays.tmpl new file mode 100755 index 00000000000..ba5c7ffc659 --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/admin/form_widgets/update_testdays.tmpl @@ -0,0 +1,98 @@ +

Manage Testdays »

+ +
+
+
Existing Testdays
+ +
+ +
+ + + + + + + +
+ [% INCLUDE form_widgets/select_testday_id.tmpl name="testday_id" placeholder=1 size=5 show_name=1 onchange="loadTestday();" %] +
+   +   +   +
+
+ +
+ + + +
+
\ No newline at end of file diff --git a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_opsys_id.tmpl b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_opsys_id.tmpl index cf0d542ce81..9edfe68b167 100644 --- a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_opsys_id.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_opsys_id.tmpl @@ -1,9 +1,17 @@ - diff --git a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_platform_id.tmpl b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_platform_id.tmpl index 70f344ba337..5a0ed98ab03 100644 --- a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_platform_id.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_platform_id.tmpl @@ -1,9 +1,15 @@ - diff --git a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testday_id.tmpl b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testday_id.tmpl new file mode 100755 index 00000000000..7513fe5e8c2 --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testday_id.tmpl @@ -0,0 +1,9 @@ + diff --git a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testgroup_id.tmpl b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testgroup_id.tmpl index fad4d71274b..7e43e8577df 100644 --- a/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testgroup_id.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/form_widgets/select_testgroup_id.tmpl @@ -1,9 +1,9 @@ diff --git a/mozilla/webtools/litmus/templates/en/default/index.tmpl b/mozilla/webtools/litmus/templates/en/default/index.tmpl index 3eef5bd8d63..2551ef96651 100644 --- a/mozilla/webtools/litmus/templates/en/default/index.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/index.tmpl @@ -28,11 +28,11 @@ [% INCLUDE global/html_header.tmpl js_files=['js/Help.js'] %] [% INCLUDE global/litmus_header.tmpl %] -[% staricon="\"*\"" %] +[% commenticon="\"*\"" %]
diff --git a/mozilla/webtools/litmus/templates/en/default/reporting/test_results.tmpl b/mozilla/webtools/litmus/templates/en/default/reporting/test_results.tmpl index 6ce82297d94..afd6fe97b29 100644 --- a/mozilla/webtools/litmus/templates/en/default/reporting/test_results.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/reporting/test_results.tmpl @@ -25,7 +25,7 @@ # ***** END LICENSE BLOCK ***** #%] -[% staricon="*" %] +[% commenticon="*" %] [% IF results %] @@ -39,7 +39,7 @@ var comments = new Array(); [% subscript=0 %] [% FOREACH result=results %] - comments[[% subscript | js %]] = "[% IF result.comments %][% FOREACH comment=result.comments %][% IF loop.count>1 %]
[% END %]

[% IF show_admin %][% END %][% comment.user.getDisplayName | html | js | email %][% IF show_admin %][% END %]
[% comment.submission_time.strftime("%Y-%m-%d %T") %]

[% staricon | none %] [% comment.comment | js | html %]

[% END %][% END %]"; + comments[[% subscript | js %]] = "[% IF result.comments %][% FOREACH comment=result.comments %][% IF loop.count>1 %]
[% END %]

[% IF show_admin %][% END %][% comment.user.getDisplayName | html | js | email %][% IF show_admin %][% END %]
[% comment.submission_time.strftime("%Y-%m-%d %T") %]

[% commenticon | none %] [% comment.comment | js | html %]

[% END %][% END %]"; [% subscript=subscript+1 %] [% END %] @@ -67,12 +67,12 @@ [% FOREACH result=results %] [% result.created | html %] - - [% result.testresult_id | html %]
+ + [% result.testresult_id | html %]
[% IF result.comments %] - [% staricon | none%] - [% END %] + [% commenticon | none%] + [% END %] [% result.testcase_id | html %]: [% result.summary | html %] diff --git a/mozilla/webtools/litmus/templates/en/default/reporting/testday_report.tmpl b/mozilla/webtools/litmus/templates/en/default/reporting/testday_report.tmpl new file mode 100755 index 00000000000..cc98f53ed17 --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/reporting/testday_report.tmpl @@ -0,0 +1,55 @@ +[%# ***** 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 + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** +#%] + +[%# INTERFACE: +#%] + +[% INCLUDE global/html_header.tmpl js_files=['js/prototype.lite.js','js/moo.fx.js','js/moo.fx.pack.js','js/MochiKit/MochiKit.js','js/json.js'] %] +[% INCLUDE global/litmus_header.tmpl %] + +
+ +[% INCLUDE sidebar/sidebar.tmpl %] + +
+ + [% IF display_results %] +

[% title %]

+ + [% INCLUDE reporting/testday_results.tmpl %] + [% END %] + +

Testday Report - Search Criteria

+ + [% INCLUDE reporting/testday_search.tmpl %] + +
+ +
+ +[% INCLUDE global/litmus_footer.tmpl %] +[% INCLUDE global/html_footer.tmpl %] diff --git a/mozilla/webtools/litmus/templates/en/default/reporting/testday_results.tmpl b/mozilla/webtools/litmus/templates/en/default/reporting/testday_results.tmpl new file mode 100755 index 00000000000..238b28897df --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/reporting/testday_results.tmpl @@ -0,0 +1,277 @@ +[%# ***** 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 + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** +#%] + +[%# INTERFACE: + # no interface for this template +#%] + +
+ + + +[% IF user_results %] + + + + + [% IF user_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +[% IF user_status_results %] + + + + + [% IF user_status_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +[% IF locale_results %] + + + + + [% IF locale_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +[% IF platform_results %] + + + + + [% IF platform_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +[% IF status_results %] + + + + + [% IF status_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +[% IF subgroup_results %] + + + + + [% IF subgroup_results.size <= 0 %] + + + + [% ELSE %] + + + + [% END %] + + + + +[% END %] + +
Breakdown By Tester
No results
+ +

Breakdown By Tester and Result Status
No results
+ +

Breakdown By Locale
No results
+ +

Breakdown By Platform
No results
+ +

Breakdown By Result Status
No results
+ +

Breakdown By Subgroup
No results
+ +

+ +
\ No newline at end of file diff --git a/mozilla/webtools/litmus/templates/en/default/reporting/testday_search.tmpl b/mozilla/webtools/litmus/templates/en/default/reporting/testday_search.tmpl new file mode 100755 index 00000000000..28ca8bbdc47 --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/reporting/testday_search.tmpl @@ -0,0 +1,204 @@ +[%# ***** 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 + # Zach Lipton + # + # ***** END LICENSE BLOCK ***** +#%] + +[%# INTERFACE: + # no interface for this template +#%] + + + +
+ +
+ + + + + + + + + + +
+ +
+ + + + + + + + + + +
+ +
+ diff --git a/mozilla/webtools/litmus/templates/en/default/sidebar/runtests_sidebar.tmpl b/mozilla/webtools/litmus/templates/en/default/sidebar/runtests_sidebar.tmpl index ade022f9691..8e143b141d5 100644 --- a/mozilla/webtools/litmus/templates/en/default/sidebar/runtests_sidebar.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/sidebar/runtests_sidebar.tmpl @@ -6,7 +6,9 @@ [% INCLUDE sidebar/widget_testcases.tmpl %] -[% INCLUDE sidebar/widget_options.tmpl %] +[% INCLUDE sidebar/widget_testing.tmpl %] + +[% INCLUDE sidebar/widget_reporting.tmpl %] [% INCLUDE sidebar/widget_admin.tmpl %] diff --git a/mozilla/webtools/litmus/templates/en/default/sidebar/sidebar.tmpl b/mozilla/webtools/litmus/templates/en/default/sidebar/sidebar.tmpl index 62c83232295..26d1b7a8527 100644 --- a/mozilla/webtools/litmus/templates/en/default/sidebar/sidebar.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/sidebar/sidebar.tmpl @@ -4,7 +4,9 @@ [% INCLUDE sidebar/widget_login.tmpl %] -[% INCLUDE sidebar/widget_options.tmpl %] +[% INCLUDE sidebar/widget_testing.tmpl %] + +[% INCLUDE sidebar/widget_reporting.tmpl %] [% INCLUDE sidebar/widget_admin.tmpl %] diff --git a/mozilla/webtools/litmus/templates/en/default/sidebar/widget_login.tmpl b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_login.tmpl index 8a8e11ad682..24e491f74a2 100644 --- a/mozilla/webtools/litmus/templates/en/default/sidebar/widget_login.tmpl +++ b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_login.tmpl @@ -1,6 +1,6 @@
-

Welcome!

+

Welcome

[% IF defaultemail %]

[% IF ! show_admin %]Update profile
[% END %]Log out

diff --git a/mozilla/webtools/litmus/templates/en/default/sidebar/widget_reporting.tmpl b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_reporting.tmpl new file mode 100755 index 00000000000..3c59496300d --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_reporting.tmpl @@ -0,0 +1,11 @@ +
+ +
diff --git a/mozilla/webtools/litmus/templates/en/default/sidebar/widget_testing.tmpl b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_testing.tmpl new file mode 100755 index 00000000000..8769b2f623e --- /dev/null +++ b/mozilla/webtools/litmus/templates/en/default/sidebar/widget_testing.tmpl @@ -0,0 +1,9 @@ +
+
+

Get Testing!

+ +
+
diff --git a/mozilla/webtools/litmus/testday_report.cgi b/mozilla/webtools/litmus/testday_report.cgi new file mode 100755 index 00000000000..d1337ce9d83 --- /dev/null +++ b/mozilla/webtools/litmus/testday_report.cgi @@ -0,0 +1,100 @@ +#!/usr/bin/perl -w +# -*- Mode: cperl; indent-tabs-mode: nil -*- +# +# 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 Netscape Communications +# Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All +# Rights Reserved. +# +# Contributor(s): Zach Lipton + +use strict; + +use Litmus; +use Litmus::Error; +use Litmus::FormWidget; +use Litmus::UserAgentDetect; +use Litmus::SysConfig; +use Litmus::Auth; +use Litmus::Utils; +use Litmus::TestEvent; + +use CGI; +use Date::Manip; +use JSON; +use Time::Piece::MySQL; + +Litmus->init(); +my $c = Litmus->cgi(); + +print $c->header(); + +my $vars; +my $cookie = Litmus::Auth::getCookie(); +$vars->{"defaultemail"} = $cookie; +$vars->{"show_admin"} = Litmus::Auth::istrusted($cookie); + +$vars->{'title'} = "Testday Report"; + +if ($c->param) { + my $testday; + if ($c->param("testday_id")) { + $testday = Litmus::TestEvent->new(testday_id => $c->param("testday_id")); + } elsif ($c->param("start_timestamp") and + $c->param("finish_timestamp")) { + $testday = Litmus::TestEvent->new(start_timestamp => $c->param("start_timestamp"), + finish_timestamp => $c->param("finish_timestamp"), + testgroup_id => $c->param("testgroup_id"), + build_id => $c->param("build_id"), + branch_id => $c->param("branch_id"), + locale => $c->param("locale"), +); + + } + + if ($testday) { + $vars->{'title'} .= " - " . $testday->getDescription . ", " . $testday->getStartTimestamp(1) . " - " . $testday->getFinishTimestamp(1); + + $vars->{'display_results'} = 1; + $vars->{'locale_results'} = $testday->getBreakdownByLocale(); + $vars->{'platform_results'} = $testday->getBreakdownByPlatform(); + $vars->{'status_results'} = $testday->getBreakdownByResultStatus(); + $vars->{'subgroup_results'} = $testday->getBreakdownBySubgroup(); + $vars->{'user_results'} = $testday->getBreakdownByUser(); + $vars->{'user_status_results'} = $testday->getBreakdownByUserAndResultStatus(); + + $vars->{'test_event'} = $testday; + } +} + +my $products = Litmus::FormWidget->getProducts; +my $branches = Litmus::FormWidget->getBranches; +my $testgroups = Litmus::FormWidget->getTestgroups; +my $json = JSON->new(skipinvalid => 1, convblessed => 1); +my $products_js = $json->objToJson($products); +my $branches_js = $json->objToJson($branches); +my $testgroups_js = $json->objToJson($testgroups); + +$vars->{'products_js'} = $products_js; +$vars->{'branches_js'} = $branches_js; +$vars->{'testgroups_js'} = $testgroups_js; + +my $locales = Litmus::FormWidget->getLocales; +my $testdays = Litmus::FormWidget->getTestdays; +$vars->{'locales'} = $locales; +$vars->{'testdays'} = $testdays; + +Litmus->template()->process("reporting/testday_report.tmpl", $vars) || + internalError(Litmus->template()->error());