From 629658786f41d6bc8582e107b03c326c6072fe59 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Fri, 31 May 2002 23:58:08 +0000 Subject: [PATCH] Default wobjects to template position 0 if the current template is deleted. --- lib/WebGUI/Operation/Template.pm | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/WebGUI/Operation/Template.pm b/lib/WebGUI/Operation/Template.pm index c29344329..812d789c5 100644 --- a/lib/WebGUI/Operation/Template.pm +++ b/lib/WebGUI/Operation/Template.pm @@ -62,9 +62,15 @@ sub www_deleteTemplate { #------------------------------------------------------------------- sub www_deleteTemplateConfirm { + my ($a, $pageId); if ($session{form}{tid} < 1000 && $session{form}{tid} > 1000) { return WebGUI::Privilege::vitalComponent(); } elsif (WebGUI::Privilege::isInGroup(8)) { + $a = WebGUI::SQL->read("select * from page where templateId=".$session{form}{tid}); + while (($pageId) = $a->array) { + WebGUI::SQL->write("update wobject set templatePosition=0 where pageId=$pageId"); + } + $a->finish; WebGUI::SQL->write("delete from template where templateId=".$session{form}{tid}); WebGUI::SQL->write("update page set templateId=2 where templateId=".$session{form}{tid}); return www_listTemplates(); @@ -89,7 +95,7 @@ sub www_editTemplate { $f->hidden("op","editTemplateSave"); $f->hidden("tid",$session{form}{tid}); $f->readOnly($session{form}{tid},WebGUI::International::get(503)); - $f->text("name",WebGUI::International::get(151),$template{name}); + $f->text("name",WebGUI::International::get(528),$template{name}); $f->HTMLArea("template",WebGUI::International::get(504),$template{template},'','','',(5+$session{setting}{textAreaRows})); $f->submit; $output .= $f->print;