templatePosition is set to '0' on any wobject that belongs to a page where the templatePosition is higher than the number of positions available.

This commit is contained in:
JT Smith 2002-06-18 04:14:40 +00:00
parent 1fe905fee4
commit 8ebfe3f788
2 changed files with 14 additions and 1 deletions

View file

@ -231,6 +231,8 @@ sub www_editPageSave {
menuTitle=".quote($session{form}{menuTitle}).",
synopsis=".quote($session{form}{synopsis})."
where pageId=$session{form}{pageId}");
WebGUI::SQL->write("update wobject set templatePosition=0 where pageId=$session{form}{pageId}
and templatePosition>".(WebGUI::Template::countPositions($session{form}{templateId})-1));
_recursivelyChangeStyle($session{page}{pageId}) if ($session{form}{recurseStyle});
_recursivelyChangePrivileges($session{page}{pageId}) if ($session{form}{recursePrivs});
WebGUI::Session::refreshPageInfo($session{page}{pageId}) if ($session{form}{pageId} == $session{page}{pageId});

View file

@ -17,6 +17,17 @@ use WebGUI::HTMLForm;
use WebGUI::Session;
use WebGUI::SQL;
#-------------------------------------------------------------------
sub countPositions {
my ($template, $i);
($template) = WebGUI::SQL->quickArray("select template from template where templateId=".$_[0]);
$i = 0;
while ($template =~ m/\^$i\;/) {
$i++;
}
return $i;
}
#-------------------------------------------------------------------
sub generate {
my ($output, $content, %template);
@ -36,7 +47,7 @@ sub getList {
#-------------------------------------------------------------------
sub getPositions {
my ($cmd, %hash, $template, $i);
my (%hash, $template, $i);
tie %hash, "Tie::IxHash";
($template) = WebGUI::SQL->quickArray("select template from template where templateId=".$_[0]);
$i = 0;