Remember my filter after updating multiple or deleteing a caserun from the run page.

This commit is contained in:
ghendricks%novell.com 2007-02-09 17:31:45 +00:00
Родитель 8d41347c24
Коммит 969f4cc44b
6 изменённых файлов: 79 добавлений и 13 удалений

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

@ -143,6 +143,6 @@
</td>
</tr>
<tr><th colspan="5" style="font-size: 12pt;">[% table.list_count %] records found</th></tr>
<tr><th colspan="5" style="font-size: 12pt;">[% table.list_count %] records found [% '(filtered)' IF filtered %]</th></tr>
</table>
[% END %]

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

@ -39,7 +39,7 @@
<img src="[% query.match('assignee') AND expand_report ? 'testopia/img/td.gif' : 'testopia/img/tr.gif' %]" id="cft" onclick="_sr(document.getElementById('caserun_report'),document.getElementById('cft')); toggleExp(document.getElementById('expand_report'))">
<a href="javascript:_sr(document.getElementById('caserun_report'),document.getElementById('cft')); toggleExp(document.getElementById('expand_report'))" style="text-decoration:none;">Reports</a>
</div>
<div id="caserun_report" [% query.match('assignee') AND expand_report ? 'style="display:block"' : 'style="display:none"' %]>
<div id="caserun_report" [% expand_report ? 'style="display:block"' : 'style="display:none"' %]>
[% PROCESS "testopia/search/report-matrix.html.tmpl"
obj = table.list.0
%]
@ -49,10 +49,10 @@
</div>
[% END %]
<div class="bz_row_header" style="font-size:12pt; font-weight: bold;">
<img src="[% query.match('assignee') AND expand_filter ? 'testopia/img/td.gif' : 'testopia/img/tr.gif' %]" id="ft" onclick="_sr(document.getElementById('filter'),document.getElementById('ft')); toggleExp(document.getElementById('expand_filter'))">
<img src="[% filtered OR expand_filter ? 'testopia/img/td.gif' : 'testopia/img/tr.gif' %]" id="ft" onclick="_sr(document.getElementById('filter'),document.getElementById('ft')); toggleExp(document.getElementById('expand_filter'))">
<a href="javascript:_sr(document.getElementById('filter'),document.getElementById('ft')); toggleExp(document.getElementById('expand_filter'))" style="text-decoration:none;">Filter</a>
</div>
<div id="filter" [% query.match('assignee') AND expand_filter ? 'style="display:block"' : 'style="display:none"' %]>
<div id="filter" [% filtered OR expand_filter ? 'style="display:block"' : 'style="display:none"' %]>
<table>
<tr class="bz_row_header">
<th>Status</th>
@ -156,9 +156,13 @@
mult => 1 } %]
</td>
<td valign="bottom">
<input type="button" value="Clear" onclick="document.location='[% table.url_loc FILTER none %]?run_id=[% run.id FILTER none %]'"/><br/>
<input type="submit" value="Filter" /></td>
<input type="button" value="Clear" onclick="document.location='[% table.url_loc FILTER none %]?run_id=[% run.id FILTER none %]&action=clear_filter'"/><br/>
<input type="submit" value="Filter" name="action" /></td>
</tr>
</table>
[% IF filtered %]
<br>
<b>Results have been filtered. Click 'Clear' to see the full list.</b>
[% END %]
</div>
</form>

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

@ -38,7 +38,7 @@
[% default_build = "--Do Not Change--" %]
[% END %]
<table width="100%">
<table>
<tr>
[% IF NOT dotweak %]
<td align="center" valign="top" width="50%">
@ -83,7 +83,7 @@
</table>
<table width="100%">
<table>
<tr>
<th align="right">Build</th>
<td>
@ -112,7 +112,7 @@
</tr>
</table>
<table width="100%">
<table>
<tr>
<td colspan="2">
<table>

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

@ -47,6 +47,9 @@ $cgi->send_cookie(-name => "TEST_LAST_ORDER",
-value => $cgi->param('order'),
-expires => "Fri, 01-Jan-2038 00:00:00 GMT");
Bugzilla->login();
$vars->{'fullwidth'} = 1;
my $serverpush = support_server_push($cgi);
if ($serverpush) {
print $cgi->multipart_init;
@ -144,7 +147,15 @@ if ($action eq 'Commit'){
if ($cgi->param('run_id')){
my $run_id = $cgi->param('run_id');
my $run = Bugzilla::Testopia::TestRun->new($run_id);
$cgi->delete_all;
# See if there is a saved filter
if ($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id) && $action ne 'Filter' && $action ne 'clear_filter'){
$cgi = Bugzilla::CGI->new($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id));
$vars->{'filtered'} = 1;
}
else {
$cgi->delete_all;
}
$cgi->param('run_id', $run_id);
$cgi->param('current_tab', 'case_run');
my $search = Bugzilla::Testopia::Search->new($cgi);
@ -155,6 +166,9 @@ if ($action eq 'Commit'){
$vars->{'action'} = 'Commit';
$vars->{'backlink'} = $run;
$vars->{'form_action'} = "tr_show_run.cgi";
$vars->{'caserun'} = Bugzilla::Testopia::TestCaseRun->new({});
$vars->{'case'} = Bugzilla::Testopia::TestCase->new({});
$template->process("testopia/run/show.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
@ -268,11 +282,14 @@ if ($cgi->param('run_id')){
$vars->{'run'} = Bugzilla::Testopia::TestRun->new($cgi->param('run_id'));
}
my $case = Bugzilla::Testopia::TestCase->new({'case_id' => 0});
$vars->{'filtered'} = 1 if $cgi->cookie('TESTOPIA-FILTER-RUN-' . $vars->{'run'}->id) && $cgi->param('action') ne 'clear_filter';
$vars->{'expand_report'} = $cgi->param('expand_report') || 0;
$vars->{'expand_filter'} = $cgi->param('expand_filter') || 0;
$vars->{'dotweak'} = UserInGroup('edittestcases');
$vars->{'table'} = $table;
$vars->{'action'} = 'tr_list_caserun.cgi';
$vars->{'caserun'} = Bugzilla::Testopia::TestCaseRun->new({});
$vars->{'case'} = Bugzilla::Testopia::TestCase->new({});
if ($serverpush && !$cgi->param('debug')) {
print $cgi->multipart_end;
print $cgi->multipart_start;

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

@ -52,7 +52,7 @@ validate_test_id($caserun_id, 'case_run');
ThrowUserError('testopia-missing-parameter', {'param' => 'caserun_id'}) unless ($caserun_id);
push @{$::vars->{'style_urls'}}, 'testopia/css/default.css';
$vars->{'fullwidth'} = 1;
my $action = $cgi->param('action') || '';
# For use on the classic form
@ -112,7 +112,15 @@ elsif ($action eq 'do_delete'){
my $caserun = Bugzilla::Testopia::TestCaseRun->new($caserun_id);
ThrowUserError("testopia-read-only", {'object' => 'case run'}) if !$caserun->candelete;
$caserun->obliterate;
$cgi->delete_all;
# See if there is a saved filter
if ($cgi->cookie('TESTOPIA-FILTER-RUN-' . $caserun->run->id) && $action ne 'Filter' && $action ne 'clear_filter'){
$cgi = Bugzilla::CGI->new($cgi->cookie('TESTOPIA-FILTER-RUN-' . $caserun->run->id));
$vars->{'filtered'} = 1;
}
else {
$cgi->delete_all;
}
$cgi->param('current_tab', 'case_run');
$cgi->param('run_id', $caserun->run->id);
my $search = Bugzilla::Testopia::Search->new($cgi);
@ -128,6 +136,13 @@ elsif ($action eq 'do_delete'){
$vars->{'table'} = $table;
$vars->{'case_list'} = join(",", @case_list);
$vars->{'action'} = 'Commit';
$vars->{'tr_message'} = "Case removed";
$vars->{'backlink'} = $caserun->run;
# We need these to provide the filter values.
$vars->{'caserun'} = Bugzilla::Testopia::TestCaseRun->new({});
$vars->{'case'} = Bugzilla::Testopia::TestCase->new({});
$template->process("testopia/run/show.html.tmpl", $vars) ||
ThrowTemplateError($template->error());

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

@ -245,6 +245,24 @@ elsif ($action eq 'do_clone'){
display($newrun);
print $cgi->multipart_final if $serverpush;
}
elsif ($action eq 'Filter'){
$cgi->send_cookie(-name => 'TESTOPIA-FILTER-RUN-' . $run_id,
-value => $cgi->canonicalise_query('run_id'),
-expires => 'Fri, 01-Jan-2038 00:00:00 GMT');
$vars->{'filtered'} = 1;
print $cgi->header;
display(Bugzilla::Testopia::TestRun->new($run_id));
}
elsif ($action eq 'clear_filter'){
$cgi->remove_cookie('TESTOPIA-FILTER-RUN-' . $run_id);
$vars->{'filtered'} = 0;
print $cgi->header;
display(Bugzilla::Testopia::TestRun->new($run_id));
}
####################
### Ajax Actions ###
####################
@ -409,7 +427,15 @@ sub do_update {
sub display {
my $run = shift;
# See if there is a saved filter
if ($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id) && $action ne 'Filter' && $action ne 'clear_filter'){
$cgi = Bugzilla::CGI->new($cgi->cookie('TESTOPIA-FILTER-RUN-' . $run_id));
$cgi->param('run_id', $run_id);
$vars->{'filtered'} = 1;
}
$cgi->param('current_tab', 'case_run');
my $search = Bugzilla::Testopia::Search->new($cgi);
my $table = Bugzilla::Testopia::Table->new('case_run', 'tr_show_run.cgi', $cgi, undef, $search->query);
@ -424,6 +450,10 @@ sub display {
$vars->{'run'} = $run;
$vars->{'table'} = $table;
$vars->{'action'} = 'Commit';
if ($cgi->param('case_id')){
$vars->{'expand_filter'} = 1;
$vars->{'filtered'} = 1;
}
$template->process("testopia/run/show.html.tmpl", $vars) ||
ThrowTemplateError($template->error());
}