From 8aae73342050a63d6767b7cb7ef94487c927a1d1 Mon Sep 17 00:00:00 2001 From: "ccooper%deadsquid.com" Date: Thu, 22 Jun 2006 22:05:33 +0000 Subject: [PATCH] - rebuild js cache after management activities --- webtools/litmus/manage_subgroups.cgi | 11 ++++++++++- webtools/litmus/manage_testcases.cgi | 10 ++++++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/webtools/litmus/manage_subgroups.cgi b/webtools/litmus/manage_subgroups.cgi index 642bd4a5bb6f..bee550d47202 100755 --- a/webtools/litmus/manage_subgroups.cgi +++ b/webtools/litmus/manage_subgroups.cgi @@ -33,6 +33,7 @@ use strict; use Litmus; use Litmus::Auth; +use Litmus::Cache; use Litmus::Error; use Litmus::FormWidget; use Litmus::Utils; @@ -55,7 +56,7 @@ my $rv; if ($c->param("subgroup_id")) { $subgroup_id = $c->param("subgroup_id"); } - +my $rebuild_cache = 0; if ($c->param("delete_subgroup_button")) { my $subgroup = Litmus::DB::Subgroup->retrieve($subgroup_id); if ($subgroup) { @@ -63,6 +64,7 @@ if ($c->param("delete_subgroup_button")) { if ($rv) { $status = "success"; $message = "Subgroup ID# $subgroup_id deleted successfully."; + $rebuild_cache = 1; } else { $status = "failure"; $message = "Failed to delete Subgroup ID# $subgroup_id."; @@ -77,6 +79,7 @@ if ($c->param("delete_subgroup_button")) { if ($new_subgroup) { $status = "success"; $message = "Subgroup cloned successfully. New subgroup ID# is " . $new_subgroup->subgroup_id; + $rebuild_cache = 1; } else { $status = "failure"; $message = "Failed to clone Subgroup ID# $subgroup_id."; @@ -101,6 +104,7 @@ if ($c->param("delete_subgroup_button")) { $new_subgroup->update_testcases(\@selected_testcases); $status = "success"; $message = "Subgroup added successfully. New subgroup ID# is " . $new_subgroup->subgroup_id; + $rebuild_cache = 1; } else { $status = "failure"; $message = "Failed to add subgroup."; @@ -121,6 +125,7 @@ if ($c->param("delete_subgroup_button")) { $subgroup->update_testcases(\@selected_testcases); $status = "success"; $message = "Subgroup ID# $subgroup_id updated successfully."; + $rebuild_cache = 1; } else { $status = "failure"; $message = "Failed to update subgroup ID# $subgroup_id."; @@ -140,6 +145,10 @@ if ($status and $message) { $vars->{'onload'} = "toggleMessage('$status','$message');"; } +if ($rebuild_cache) { + rebuildCache(); +} + my $subgroups = Litmus::FormWidget->getSubgroups; my $products = Litmus::FormWidget->getProducts(); my $testcases = Litmus::FormWidget->getTestcases; diff --git a/webtools/litmus/manage_testcases.cgi b/webtools/litmus/manage_testcases.cgi index 392b689f6b99..e7e8c279668a 100755 --- a/webtools/litmus/manage_testcases.cgi +++ b/webtools/litmus/manage_testcases.cgi @@ -33,6 +33,7 @@ use strict; use Litmus; use Litmus::Auth; +use Litmus::Cache; use Litmus::Error; use Litmus::FormWidget; use Litmus::Utils; @@ -55,6 +56,7 @@ if ($c->param("testcase_id")) { $testcase_id = $c->param("testcase_id"); } +my $rebuild_cache = 0; if ($c->param("delete_testcase_button")) { my $testcase = Litmus::DB::Testcase->retrieve($testcase_id); if ($testcase) { @@ -62,6 +64,7 @@ if ($c->param("delete_testcase_button")) { if ($rv) { $status = "success"; $message = "Testcase ID# $testcase_id deleted successfully."; + $rebuild_cache=1; } else { $status = "failure"; $message = "Failed to delete Testcase ID# $testcase_id."; @@ -76,6 +79,7 @@ if ($c->param("delete_testcase_button")) { if ($new_testcase) { $status = "success"; $message = "Testcase cloned successfully. New testcase ID# is " . $new_testcase->testcase_id; + $rebuild_cache=1; } else { $status = "failure"; $message = "Failed to clone Testcase ID# $testcase_id."; @@ -109,6 +113,7 @@ if ($c->param("delete_testcase_button")) { $new_testcase->update_subgroups(\@selected_subgroups); $status = "success"; $message = "Testcase added successfully. New testcase ID# is " . $new_testcase->testcase_id; + $rebuild_cache=1; } else { $status = "failure"; $message = "Failed to add testcase."; @@ -135,6 +140,7 @@ if ($c->param("delete_testcase_button")) { $testcase->update_subgroups(\@selected_subgroups); $status = "success"; $message = "Testcase ID# $testcase_id updated successfully."; + $rebuild_cache=1; } else { $status = "failure"; $message = "Failed to update testcase ID# $testcase_id."; @@ -154,6 +160,10 @@ if ($status and $message) { $vars->{'onload'} = "toggleMessage('$status','$message');"; } +if ($rebuild_cache) { + rebuildCache(); +} + my $testcases = Litmus::FormWidget->getTestcases; my $products = Litmus::FormWidget->getProducts(); my $authors = Litmus::FormWidget->getAuthors();