Bugfix 914825 / 912203: Bug in template system
This commit is contained in:
parent
afa1db977c
commit
d391a0a78d
2 changed files with 18 additions and 9 deletions
|
|
@ -4,6 +4,7 @@
|
||||||
- Added Text::Balanced to the distro.
|
- Added Text::Balanced to the distro.
|
||||||
= Fixed bug [ 910145 ] htmlArea - insert image not working (Len Kranendonk /
|
= Fixed bug [ 910145 ] htmlArea - insert image not working (Len Kranendonk /
|
||||||
Andreas Graf).
|
Andreas Graf).
|
||||||
|
- Bugfix 914825 / 912203: Bug in template system (LenK).
|
||||||
|
|
||||||
6.0.0
|
6.0.0
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ sub www_copyTemplate {
|
||||||
if (WebGUI::Privilege::isInGroup(8)) {
|
if (WebGUI::Privilege::isInGroup(8)) {
|
||||||
%template = WebGUI::SQL->quickHash("select * from template where templateId=$session{form}{tid} and namespace=".quote($session{form}{namespace}));
|
%template = WebGUI::SQL->quickHash("select * from template where templateId=$session{form}{tid} and namespace=".quote($session{form}{namespace}));
|
||||||
WebGUI::SQL->write("insert into template (templateId,name,template,namespace)
|
WebGUI::SQL->write("insert into template (templateId,name,template,namespace)
|
||||||
values (".getNextId("templateId").",
|
values ("._getNextTemplateId($session{form}{namespace}).",
|
||||||
".quote('Copy of '.$template{name}).", ".quote($template{template}).",
|
".quote('Copy of '.$template{name}).", ".quote($template{template}).",
|
||||||
".quote($template{namespace}).")");
|
".quote($template{namespace}).")");
|
||||||
return www_listTemplates();
|
return www_listTemplates();
|
||||||
|
|
@ -157,13 +157,7 @@ sub www_editTemplate {
|
||||||
sub www_editTemplateSave {
|
sub www_editTemplateSave {
|
||||||
if (WebGUI::Privilege::isInGroup(8)) {
|
if (WebGUI::Privilege::isInGroup(8)) {
|
||||||
if ($session{form}{tid} eq "new") {
|
if ($session{form}{tid} eq "new") {
|
||||||
($session{form}{tid}) = WebGUI::SQL->quickArray("select max(templateId)
|
$session{form}{tid} = _getNextTemplateId($session{form}{namespace});
|
||||||
from template where namespace=".quote($session{form}{namespace}));
|
|
||||||
if ($session{form}{tid} > 999) {
|
|
||||||
$session{form}{tid}++;
|
|
||||||
} else {
|
|
||||||
$session{form}{tid} = 1000;
|
|
||||||
}
|
|
||||||
WebGUI::SQL->write("insert into template (templateId,namespace) values
|
WebGUI::SQL->write("insert into template (templateId,namespace) values
|
||||||
($session{form}{tid}, ".quote($session{form}{namespace}).")");
|
($session{form}{tid}, ".quote($session{form}{namespace}).")");
|
||||||
}
|
}
|
||||||
|
|
@ -214,6 +208,20 @@ sub www_listTemplates {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub _getNextTemplateId {
|
||||||
|
my $namespace = shift;
|
||||||
|
my $templateId;
|
||||||
|
my $query = "select max(templateId) from template";
|
||||||
|
if ($namespace) {
|
||||||
|
$query .= " where namespace = ".quote($namespace);
|
||||||
|
}
|
||||||
|
($templateId) = WebGUI::SQL->quickArray($query);
|
||||||
|
if ($templateId > 999) {
|
||||||
|
$templateId++;
|
||||||
|
} else {
|
||||||
|
$templateId = 1000;
|
||||||
|
}
|
||||||
|
return $templateId;
|
||||||
|
}
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue