'
.deleteIcon('op=deleteStyle&sid='.$data[0])
diff --git a/lib/WebGUI/Template.pm b/lib/WebGUI/Template.pm
index 6d113a8ae..46f6fc187 100644
--- a/lib/WebGUI/Template.pm
+++ b/lib/WebGUI/Template.pm
@@ -1,15 +1,5 @@
package WebGUI::Template;
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-
#-------------------------------------------------------------------
# WebGUI is Copyright 2001-2002 Plain Black Software.
#-------------------------------------------------------------------
@@ -20,73 +10,108 @@ package WebGUI::Template;
# http://www.plainblack.com info@plainblack.com
#-------------------------------------------------------------------
-use strict qw(vars subs);
+use strict;
use Tie::IxHash;
use WebGUI::ErrorHandler;
+use WebGUI::HTMLForm;
use WebGUI::Session;
-
+use WebGUI::SQL;
#-------------------------------------------------------------------
-sub loadTemplates {
- my ($templateDir, @files, $file, $use, @template, $i);
- if ($^O =~ /Win/i) {
- $templateDir = "\\lib\\WebGUI\\Template";
- } else {
- $templateDir = "/lib/WebGUI/Template";
- }
- opendir (DIR,$session{config}{webguiRoot}.$templateDir) or WebGUI::ErrorHandler::fatalError("Can't open template directory!");
- @files = readdir(DIR);
- foreach $file (@files) {
- if ($file =~ /(.*?)\.pm$/) {
- $template[$i] = $1;
- $use = "require WebGUI::Template::".$template[$i];
- eval($use);
- if ($@) {
- WebGUI::ErrorHandler::fatalError("Template load failed: ".$@);
- }
- $i++;
- }
- }
- closedir(DIR);
- return @template;
-}
-
-#-------------------------------------------------------------------
-sub calculatePositions {
- my (%positions, $string);
- $string = "A";
- $positions{A} = "A";
- while ($string ne $_[0]) {
- $string = ++$string;
- $positions{$string} = $string;
- }
- return %positions;
+sub generate {
+ my ($output, $content, %template);
+ %template = WebGUI::SQL->quickHash("select * from template where templateId=".$_[1]);
+ $content = $template{template};
+ $content =~ s/\^(\d+)\;/${$_[0]}{$1}/g;
+ return $content;
}
#-------------------------------------------------------------------
sub getList {
- my (@templates, $cmd, $template, $namespace, %list);
- @templates = loadTemplates();
- foreach $template (@templates) {
- #$cmd = "WebGUI::Template::".$template."::namespace";
- #$namespace = $$cmd;
- $cmd = "WebGUI::Template::".$template."::name";
- $list{$template} = &$cmd();
- }
+ my (%list);
+ tie %list, 'Tie::IxHash';
+ %list = WebGUI::SQL->buildHash("select templateId,name from template order by name");
return %list;
}
#-------------------------------------------------------------------
sub getPositions {
- my ($cmd, %hash);
+ my ($cmd, %hash, $template, $i);
tie %hash, "Tie::IxHash";
- $cmd = "use WebGUI::Template::".$_[0];
- eval($cmd);
- $cmd = "WebGUI::Template::".$_[0]."::getPositions";
- %hash = &$cmd;
- return %hash;
+ ($template) = WebGUI::SQL->quickArray("select template from template where templateId=".$_[0]);
+ $i = 0;
+ while ($template =~ m/\^$i\;/) {
+ $hash{$i} = $i;
+ $i++;
+ }
+ return \%hash;
}
+#-------------------------------------------------------------------
+sub selectTemplate {
+ my ($output, $f, %templates, $key);
+ tie %templates,'Tie::IxHash';
+ $f = WebGUI::HTMLForm->new(1);
+ %templates = WebGUI::SQL->buildHash("select templateId,name from template order by name");
+ $f->select("templateId",\%templates,'',[$_[0]],'','','onChange="changeTemplatePreview(this.form.templateId.value)"');
+ %templates = WebGUI::SQL->buildHash("select templateId,template from template");
+ $output = '
+ ';
+ $output .= $f->printRowsOnly;
+ $output .= '';
+ return $output;
+}
1;
diff --git a/lib/WebGUI/Template/Default.pm b/lib/WebGUI/Template/Default.pm
deleted file mode 100644
index 106094587..000000000
--- a/lib/WebGUI/Template/Default.pm
+++ /dev/null
@@ -1,51 +0,0 @@
-package WebGUI::Template::Default;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "Default";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-use WebGUI::Template;
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| ';
- $output .= ${$content}{A};
- $output .= ' | ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(355);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('A');
-}
-
-1;
-
diff --git a/lib/WebGUI/Template/LeftColumn.pm b/lib/WebGUI/Template/LeftColumn.pm
deleted file mode 100644
index 51cada922..000000000
--- a/lib/WebGUI/Template/LeftColumn.pm
+++ /dev/null
@@ -1,53 +0,0 @@
-package WebGUI::Template::LeftColumn;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "LeftColumn";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| ';
- $output .= ${$content}{A};
- $output .= ' | ';
- $output .= ${$content}{B};
- $output .= ' | ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(358);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('B');
-}
-
-1;
-
diff --git a/lib/WebGUI/Template/News.pm b/lib/WebGUI/Template/News.pm
deleted file mode 100644
index 0feb93583..000000000
--- a/lib/WebGUI/Template/News.pm
+++ /dev/null
@@ -1,53 +0,0 @@
-package WebGUI::Template::News;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "News";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| '.${$content}{A}.' | ';
- $output .= '| '.${$content}{B}.' | ';
- $output .= ''.${$content}{C}.' | ';
- $output .= ' | '.${$content}{D}.' | ';
- $output .= ' ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(357);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('D');
-}
-
-1;
-
diff --git a/lib/WebGUI/Template/OneOverThree.pm b/lib/WebGUI/Template/OneOverThree.pm
deleted file mode 100644
index 89cfd0a45..000000000
--- a/lib/WebGUI/Template/OneOverThree.pm
+++ /dev/null
@@ -1,55 +0,0 @@
-package WebGUI::Template::OneOverThree;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "OneOverThree";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| ';
- $output .= ${$content}{A};
- $output .= ' | ';
- $output .= '| '.${$content}{B}.' | ';
- $output .= ''.${$content}{C}.' | ';
- $output .= ''.${$content}{D}.' | ';
- $output .= ' ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(360);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('D');
-}
-
-1;
-
diff --git a/lib/WebGUI/Template/RightColumn.pm b/lib/WebGUI/Template/RightColumn.pm
deleted file mode 100644
index d034df52a..000000000
--- a/lib/WebGUI/Template/RightColumn.pm
+++ /dev/null
@@ -1,54 +0,0 @@
-package WebGUI::Template::RightColumn;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "RightColumn";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| ';
- $output .= ${$content}{A};
- $output .= ' | ';
- $output .= ${$content}{B};
- $output .= ' | ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(359);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('B');
-}
-
-
-1;
-
diff --git a/lib/WebGUI/Template/SideBySide.pm b/lib/WebGUI/Template/SideBySide.pm
deleted file mode 100644
index 631916768..000000000
--- a/lib/WebGUI/Template/SideBySide.pm
+++ /dev/null
@@ -1,53 +0,0 @@
-package WebGUI::Template::SideBySide;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "SideBySide";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| ';
- $output .= ${$content}{A};
- $output .= ' | ';
- $output .= ${$content}{B};
- $output .= ' | ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(362);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('B');
-}
-
-1;
-
diff --git a/lib/WebGUI/Template/ThreeOverOne.pm b/lib/WebGUI/Template/ThreeOverOne.pm
deleted file mode 100644
index 032101e16..000000000
--- a/lib/WebGUI/Template/ThreeOverOne.pm
+++ /dev/null
@@ -1,53 +0,0 @@
-package WebGUI::Template::ThreeOverOne;
-
-
-
-#####################################################################
-#####################################################################
-# NOTICE: Use of this subsystem is depricated and is not recommended.
-#####################################################################
-#####################################################################
-
-
-our $namespace = "ThreeOverOne";
-
-#-------------------------------------------------------------------
-# WebGUI is Copyright 2001-2002 Plain Black Software.
-#-------------------------------------------------------------------
-# Please read the legal notices (docs/legal.txt) and the license
-# (docs/license.txt) that came with this distribution before using
-# this software.
-#-------------------------------------------------------------------
-# http://www.plainblack.com info@plainblack.com
-#-------------------------------------------------------------------
-
-
-use strict;
-use WebGUI::International;
-
-
-#-------------------------------------------------------------------
-sub generate {
- my ($output, $content);
- $content = $_[0];
- $output = '';
- $output .= '| '.${$content}{A}.' | ';
- $output .= ''.${$content}{B}.' | ';
- $output .= ''.${$content}{C}.' | ';
- $output .= ' | '.${$content}{D}.' | ';
- $output .= ' ';
- return $output;
-}
-
-#-------------------------------------------------------------------
-sub name {
- return WebGUI::International::get(361);
-}
-
-#-------------------------------------------------------------------
-sub getPositions {
- return WebGUI::Template::calculatePositions('D');
-}
-
-1;
-
diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm
index 2fe9c811d..7909fe6bd 100644
--- a/lib/WebGUI/Wobject.pm
+++ b/lib/WebGUI/Wobject.pm
@@ -71,14 +71,6 @@ sub _getNextSequenceNumber {
return ($sequenceNumber+1);
}
-#-------------------------------------------------------------------
-sub _getPositions {
- my (%hash);
- tie %hash, "Tie::IxHash";
- %hash = WebGUI::Template::getPositions($session{page}{template});
- return \%hash;
-}
-
#-------------------------------------------------------------------
=head2 description ( )
@@ -402,7 +394,7 @@ sub www_edit {
$displayTitle = $_[0]->get("displayTitle");
}
$title = $_[0]->get("title") || $_[0]->get("namespace");
- $templatePosition = $_[0]->get("templatePosition") || 'A';
+ $templatePosition = $_[0]->get("templatePosition") || '0';
$endDate = $_[0]->get("endDate") || (time()+315360000);
$f = WebGUI::HTMLForm->new;
$f->hidden("wid",$_[0]->get("wobjectId"));
@@ -413,7 +405,7 @@ sub www_edit {
$f->text("title",WebGUI::International::get(99),$title);
$f->yesNo("displayTitle",WebGUI::International::get(174),$displayTitle);
$f->yesNo("processMacros",WebGUI::International::get(175),$_[0]->get("processMacros"));
- $f->select("templatePosition",_getPositions(),WebGUI::International::get(363),[$templatePosition]);
+ $f->select("templatePosition",WebGUI::Template::getPositions($session{page}{templateId}),WebGUI::International::get(363),[$templatePosition]);
$f->date("startDate",WebGUI::International::get(497),$_[0]->get("startDate"));
$f->date("endDate",WebGUI::International::get(498),$endDate);
$f->HTMLArea("description",WebGUI::International::get(85),$_[0]->get("description"));
|