- rebuild js cache after management activities

This commit is contained in:
ccooper%deadsquid.com 2006-06-22 22:05:33 +00:00
Родитель 1ce39d3737
Коммит 8aae733420
2 изменённых файлов: 20 добавлений и 1 удалений

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

@ -33,6 +33,7 @@ use strict;
use Litmus; use Litmus;
use Litmus::Auth; use Litmus::Auth;
use Litmus::Cache;
use Litmus::Error; use Litmus::Error;
use Litmus::FormWidget; use Litmus::FormWidget;
use Litmus::Utils; use Litmus::Utils;
@ -55,7 +56,7 @@ my $rv;
if ($c->param("subgroup_id")) { if ($c->param("subgroup_id")) {
$subgroup_id = $c->param("subgroup_id"); $subgroup_id = $c->param("subgroup_id");
} }
my $rebuild_cache = 0;
if ($c->param("delete_subgroup_button")) { if ($c->param("delete_subgroup_button")) {
my $subgroup = Litmus::DB::Subgroup->retrieve($subgroup_id); my $subgroup = Litmus::DB::Subgroup->retrieve($subgroup_id);
if ($subgroup) { if ($subgroup) {
@ -63,6 +64,7 @@ if ($c->param("delete_subgroup_button")) {
if ($rv) { if ($rv) {
$status = "success"; $status = "success";
$message = "Subgroup ID# $subgroup_id deleted successfully."; $message = "Subgroup ID# $subgroup_id deleted successfully.";
$rebuild_cache = 1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to delete Subgroup ID# $subgroup_id."; $message = "Failed to delete Subgroup ID# $subgroup_id.";
@ -77,6 +79,7 @@ if ($c->param("delete_subgroup_button")) {
if ($new_subgroup) { if ($new_subgroup) {
$status = "success"; $status = "success";
$message = "Subgroup cloned successfully. New subgroup ID# is " . $new_subgroup->subgroup_id; $message = "Subgroup cloned successfully. New subgroup ID# is " . $new_subgroup->subgroup_id;
$rebuild_cache = 1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to clone Subgroup ID# $subgroup_id."; $message = "Failed to clone Subgroup ID# $subgroup_id.";
@ -101,6 +104,7 @@ if ($c->param("delete_subgroup_button")) {
$new_subgroup->update_testcases(\@selected_testcases); $new_subgroup->update_testcases(\@selected_testcases);
$status = "success"; $status = "success";
$message = "Subgroup added successfully. New subgroup ID# is " . $new_subgroup->subgroup_id; $message = "Subgroup added successfully. New subgroup ID# is " . $new_subgroup->subgroup_id;
$rebuild_cache = 1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to add subgroup."; $message = "Failed to add subgroup.";
@ -121,6 +125,7 @@ if ($c->param("delete_subgroup_button")) {
$subgroup->update_testcases(\@selected_testcases); $subgroup->update_testcases(\@selected_testcases);
$status = "success"; $status = "success";
$message = "Subgroup ID# $subgroup_id updated successfully."; $message = "Subgroup ID# $subgroup_id updated successfully.";
$rebuild_cache = 1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to update subgroup ID# $subgroup_id."; $message = "Failed to update subgroup ID# $subgroup_id.";
@ -140,6 +145,10 @@ if ($status and $message) {
$vars->{'onload'} = "toggleMessage('$status','$message');"; $vars->{'onload'} = "toggleMessage('$status','$message');";
} }
if ($rebuild_cache) {
rebuildCache();
}
my $subgroups = Litmus::FormWidget->getSubgroups; my $subgroups = Litmus::FormWidget->getSubgroups;
my $products = Litmus::FormWidget->getProducts(); my $products = Litmus::FormWidget->getProducts();
my $testcases = Litmus::FormWidget->getTestcases; my $testcases = Litmus::FormWidget->getTestcases;

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

@ -33,6 +33,7 @@ use strict;
use Litmus; use Litmus;
use Litmus::Auth; use Litmus::Auth;
use Litmus::Cache;
use Litmus::Error; use Litmus::Error;
use Litmus::FormWidget; use Litmus::FormWidget;
use Litmus::Utils; use Litmus::Utils;
@ -55,6 +56,7 @@ if ($c->param("testcase_id")) {
$testcase_id = $c->param("testcase_id"); $testcase_id = $c->param("testcase_id");
} }
my $rebuild_cache = 0;
if ($c->param("delete_testcase_button")) { if ($c->param("delete_testcase_button")) {
my $testcase = Litmus::DB::Testcase->retrieve($testcase_id); my $testcase = Litmus::DB::Testcase->retrieve($testcase_id);
if ($testcase) { if ($testcase) {
@ -62,6 +64,7 @@ if ($c->param("delete_testcase_button")) {
if ($rv) { if ($rv) {
$status = "success"; $status = "success";
$message = "Testcase ID# $testcase_id deleted successfully."; $message = "Testcase ID# $testcase_id deleted successfully.";
$rebuild_cache=1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to delete Testcase ID# $testcase_id."; $message = "Failed to delete Testcase ID# $testcase_id.";
@ -76,6 +79,7 @@ if ($c->param("delete_testcase_button")) {
if ($new_testcase) { if ($new_testcase) {
$status = "success"; $status = "success";
$message = "Testcase cloned successfully. New testcase ID# is " . $new_testcase->testcase_id; $message = "Testcase cloned successfully. New testcase ID# is " . $new_testcase->testcase_id;
$rebuild_cache=1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to clone Testcase ID# $testcase_id."; $message = "Failed to clone Testcase ID# $testcase_id.";
@ -109,6 +113,7 @@ if ($c->param("delete_testcase_button")) {
$new_testcase->update_subgroups(\@selected_subgroups); $new_testcase->update_subgroups(\@selected_subgroups);
$status = "success"; $status = "success";
$message = "Testcase added successfully. New testcase ID# is " . $new_testcase->testcase_id; $message = "Testcase added successfully. New testcase ID# is " . $new_testcase->testcase_id;
$rebuild_cache=1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to add testcase."; $message = "Failed to add testcase.";
@ -135,6 +140,7 @@ if ($c->param("delete_testcase_button")) {
$testcase->update_subgroups(\@selected_subgroups); $testcase->update_subgroups(\@selected_subgroups);
$status = "success"; $status = "success";
$message = "Testcase ID# $testcase_id updated successfully."; $message = "Testcase ID# $testcase_id updated successfully.";
$rebuild_cache=1;
} else { } else {
$status = "failure"; $status = "failure";
$message = "Failed to update testcase ID# $testcase_id."; $message = "Failed to update testcase ID# $testcase_id.";
@ -154,6 +160,10 @@ if ($status and $message) {
$vars->{'onload'} = "toggleMessage('$status','$message');"; $vars->{'onload'} = "toggleMessage('$status','$message');";
} }
if ($rebuild_cache) {
rebuildCache();
}
my $testcases = Litmus::FormWidget->getTestcases; my $testcases = Litmus::FormWidget->getTestcases;
my $products = Litmus::FormWidget->getProducts(); my $products = Litmus::FormWidget->getProducts();
my $authors = Litmus::FormWidget->getAuthors(); my $authors = Litmus::FormWidget->getAuthors();