' where templateId=1 and namespace='USS';
+delete from template where templateId>=1 and templateId<=6 and namespace='richEditor';
+delete from template where templateId=6 and namespace='Navigation';
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('6','dtree','^StyleSheet(\"/Navigation/dtree/dtree.css\");\r\n^JavaScript(\"/Navigation/dtree/dtree.js\");\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n\r\n
','Navigation',1,1);
+delete from template where templateId=7 and namespace='Navigation';
+delete from template where templateId=2 and namespace='Macro/AdminBar';
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('2','DHTML Admin Bar','^JavaScript(\"/coolmenus/coolmenus4.js\");\r\n\r\n\r\n\r\n','Macro/AdminBar',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('7','Cool Menus','\r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n^JavaScript(\"/coolmenus/coolmenus4.js\");\r\n','Navigation',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('3','Midas','^JavaScript(\"/textFix.js\");\r\n\r\n\r\n \r\n \r\n\r\n\r\n\r\n','richEditor',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('4','Classic','^JavaScript(\"/textFix.js\");\r\n\r\n\r\n \r\n \r\n\r\n\r\n\r\n','richEditor',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('2','EditOnPro2','^JavaScript(\"/textFix.js\");\r\n\r\n','richEditor',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('6','HTMLArea 3 (Mozilla / IE)','^JavaScript(\"/textFix.js\");\r\n \r\n^RawHeadTags(\"\n \n\");\r\n^JavaScript(\"/htmlArea3/htmlarea.js\"); \r\n^RawHeadTags(\"\n\n\");\n \r\n \r\n\r\n ','richEditor',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('5','lastResort','^JavaScript(\"/textFix.js\");\r\n\r\n\r\n\r\n\r\n\r\n','richEditor',1,1);
+INSERT INTO template (templateId, name, template, namespace, isEditable, showInForms) VALUES ('1','HTMLArea','^JavaScript(\"/textFix.js\");\r\n\r\n \r\n \r\n \r\n ^JavaScript(\"/htmlArea/editor.js\");\r\n \r\n \r\n\r\n\r\n\r\n\r\n\r\n \r\n\r\n','richEditor',1,1);
+
diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original
index 0159bb47f..8e10043c9 100644
--- a/etc/WebGUI.conf.original
+++ b/etc/WebGUI.conf.original
@@ -52,6 +52,7 @@ macros = a => a_account, \
H => H_homeLink, \
i => i_imageNoTags, \
I => I_imageWithTags, \
+ JavaScript => JavaScript, \
L => L_loginBox, \
LastModified => LastModified, \
LoginToggle => LoginToggle, \
@@ -59,12 +60,14 @@ macros = a => a_account, \
PageTitle => PageTitle, \
RandomImage => RandomImage, \
RandomSnippet => RandomSnippet, \
+ RawHeadTags => RawHeadTags, \
RootTitle => RootTitle, \
r => r_printable, \
/ => Slash_gatewayUrl, \
Snippet => Snippet, \
Spacer => Spacer, \
SI => SI_scaledImage, \
+ StyleSheet => StyleSheet, \
ThumbnailLinker => ThumbnailLinker, \
Thumbnail => Thumbnail, \
u => u_companyUrl
diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm
index ef9fcc205..63f2dc71d 100644
--- a/lib/WebGUI.pm
+++ b/lib/WebGUI.pm
@@ -19,7 +19,6 @@ use WebGUI::ErrorHandler;
use WebGUI::Grouping;
use WebGUI::HTTP;
use WebGUI::International;
-use WebGUI::Macro;
use WebGUI::Operation;
use WebGUI::Privilege;
use WebGUI::Session;
@@ -40,7 +39,7 @@ sub _generatePage {
".quote($session{env}{HTTP_REFERER}).", ".$session{page}{pageId}.",
".quote($session{page}{title}).", ".quote($session{form}{wid}).", ".quote($session{form}{func}).")");
}
- my $output = WebGUI::Macro::process(WebGUI::Style::process($content));
+ my $output = WebGUI::Style::process($content);
if ($session{setting}{showDebug} || ($session{form}{debug}==1 && WebGUI::Grouping::isInGroup(3))) {
$output .= WebGUI::ErrorHandler::showDebug();
}
diff --git a/lib/WebGUI/Macro/JavaScript.pm b/lib/WebGUI/Macro/JavaScript.pm
new file mode 100644
index 000000000..68f3e5e0d
--- /dev/null
+++ b/lib/WebGUI/Macro/JavaScript.pm
@@ -0,0 +1,27 @@
+package WebGUI::Macro::JavaScript;
+
+#-------------------------------------------------------------------
+# WebGUI is Copyright 2001-2004 Plain Black LLC.
+#-------------------------------------------------------------------
+# 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::Macro;
+use WebGUI::Session;
+use WebGUI::Style;
+
+#-------------------------------------------------------------------
+sub process {
+ my ($script) = WebGUI::Macro::getParams(shift);
+ WebGUI::Style::setScript($script,{type=>'text/javascript'});
+ return "";
+}
+
+1;
+
+
diff --git a/lib/WebGUI/Macro/RawHeadTags.pm b/lib/WebGUI/Macro/RawHeadTags.pm
new file mode 100644
index 000000000..6e01232a3
--- /dev/null
+++ b/lib/WebGUI/Macro/RawHeadTags.pm
@@ -0,0 +1,27 @@
+package WebGUI::Macro::RawHeadTags;
+
+#-------------------------------------------------------------------
+# WebGUI is Copyright 2001-2004 Plain Black LLC.
+#-------------------------------------------------------------------
+# 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::Macro;
+use WebGUI::Session;
+use WebGUI::Style;
+
+#-------------------------------------------------------------------
+sub process {
+ my ($html) = WebGUI::Macro::getParams(shift);
+ WebGUI::Style::setRawHeadTags($html);
+ return "";
+}
+
+1;
+
+
diff --git a/lib/WebGUI/Macro/StyleSheet.pm b/lib/WebGUI/Macro/StyleSheet.pm
new file mode 100644
index 000000000..33776e8b3
--- /dev/null
+++ b/lib/WebGUI/Macro/StyleSheet.pm
@@ -0,0 +1,30 @@
+package WebGUI::Macro::StyleSheet;
+
+#-------------------------------------------------------------------
+# WebGUI is Copyright 2001-2004 Plain Black LLC.
+#-------------------------------------------------------------------
+# 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::Macro;
+use WebGUI::Session;
+use WebGUI::Style;
+
+#-------------------------------------------------------------------
+sub process {
+ my ($file) = WebGUI::Macro::getParams(shift);
+ WebGUI::Style::setLink($file,{
+ type=>'text/css',
+ rel=>'stylesheet'
+ });
+ return "";
+}
+
+1;
+
+
diff --git a/lib/WebGUI/Style.pm b/lib/WebGUI/Style.pm
index 462b0a4d2..9fd842a74 100644
--- a/lib/WebGUI/Style.pm
+++ b/lib/WebGUI/Style.pm
@@ -18,6 +18,7 @@ package WebGUI::Style;
use strict;
use Tie::CPHash;
use WebGUI::International;
+use WebGUI::Macro;
use WebGUI::Session;
use WebGUI::Template;
use WebGUI::URL;
@@ -36,6 +37,7 @@ This package contains utility methods for WebGUI's style system.
$template = WebGUI::Style::getTemplate();
$html = WebGUI::Style::process($content);
+ $html = generateAdditionalHeadTags();
setLink($url,\%params);
setMeta(\%params);
setRawHeadTags($html);
@@ -47,6 +49,44 @@ These subroutines are available from this package:
=cut
+#-------------------------------------------------------------------
+
+=head2 generateAdditionalHeadTags ( )
+
+Creates tags that were set using setLink, setMeta, setScript, and setRawHeadTags.
+
+=cut
+
+sub generateAdditionalHeadTags {
+ # generate additional raw tags
+ my $tags = $session{page}{head}{raw};
+ # generate additional link tags
+ foreach my $url (keys %{$session{page}{head}{link}}) {
+ $tags .= '{$name}.'"';
+ }
+ $tags .= '>'."\n";
+ }
+ # generate additional meta tags
+ foreach my $tag (@{$session{page}{head}{meta}}) {
+ $tags .= '{$name}.'"';
+ }
+ $tags .= ' />'."\n";
+ }
+ delete $session{page}{head};
+ return $tags;
+}
#-------------------------------------------------------------------
@@ -110,7 +150,6 @@ sub process {
- '.$session{page}{head}{raw}.'
';
- # generate additional link tags
- foreach my $url (keys %{$session{page}{head}{link}}) {
- $var{'head.tags'} .= '{$name}.'"';
- }
- $var{'head.tags'} .= '>'."\n";
- }
- # generate additional meta tags
- foreach my $tag (@{$session{page}{head}{meta}}) {
- $var{'head.tags'} .= '{$name}.'"';
- }
- $var{'head.tags'} .= ' />'."\n";
- }
if ($session{var}{adminOn}) {
# This "triple incantation" panders to the delicate tastes of various browsers for reliable cache suppression.
$var{'head.tags'} .= '
@@ -152,7 +167,14 @@ sub process {
';
}
- return WebGUI::Template::process($templateId,"style",\%var);
+ $var{'head.tags'} .= generateAdditionalHeadTags();
+ $var{'head.tags'} .= "\n\n";
+ my $output = WebGUI::Template::process($templateId,"style",\%var);
+ $output = WebGUI::Macro::process($output);
+ my $macroHeadTags = generateAdditionalHeadTags();
+ $macroHeadTags = WebGUI::Macro::process($macroHeadTags);
+ $output =~ s/\<\!-- macro head tags --\>/$macroHeadTags/;
+ return $output;
}
diff --git a/lib/WebGUI/Wobject/DataForm.pm b/lib/WebGUI/Wobject/DataForm.pm
index 96766ba96..31c059e1c 100644
--- a/lib/WebGUI/Wobject/DataForm.pm
+++ b/lib/WebGUI/Wobject/DataForm.pm
@@ -116,16 +116,30 @@ sub _createTabInit {
#-------------------------------------------------------------------
sub duplicate {
- my ($w, %data, $sth);
- tie %data, 'Tie::CPHash';
- $w = $_[0]->SUPER::duplicate($_[1]);
- $w = WebGUI::Wobject::DataForm->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
- $sth = WebGUI::SQL->read("select * from DataForm_field where wobjectId=".quote($_[0]->get("wobjectId")));
- while (%data = $sth->hash) {
- $data{DataForm_fieldId} = "new";
- $w->setCollateral("DataForm_field","DataForm_fieldId",\%data);
- }
- $sth->finish;
+ my ($w, %dataField, %dataTab, $sthField, $sthTab, $newTabId);
+ tie %dataTab, 'Tie::CPHash';
+ tie %dataField, 'Tie::CPHash';
+ $w = $_[0]->SUPER::duplicate($_[1]);
+ $w = WebGUI::Wobject::DataForm->new({wobjectId=>$w,namespace=>$_[0]->get("namespace")});
+ $sthTab = WebGUI::SQL->read("select * from DataForm_tab where wobjectId=".$_[0]->get("wobjectId"));
+ while (%dataTab = $sthTab->hash) {
+ $sthField = WebGUI::SQL->read("select * from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." AND DataForm_tabId=".$dataTab{DataForm_tabId});
+ $dataTab{DataForm_tabId} = "new";
+ $newTabId = $w->setCollateral("DataForm_tab","DataForm_tabId",\%dataTab);
+ while (%dataField = $sthField->hash) {
+ $dataField{DataForm_fieldId} = "new";
+ $dataField{DataForm_tabId} = $newTabId;
+ $w->setCollateral("DataForm_field","DataForm_fieldId",\%dataField);
+ }
+ $sthField->finish;
+ }
+ $sthField = WebGUI::SQL->read("select * from DataForm_field where wobjectId=".$_[0]->get("wobjectId")." AND DataForm_tabId=0");
+ while (%dataField = $sthField->hash) {
+ $dataField{DataForm_fieldId} = "new";
+ $w->setCollateral("DataForm_field","DataForm_fieldId",\%dataField);
+ }
+ $sthField->finish;
+ $sthTab->finish;
}
#-------------------------------------------------------------------
diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm
index b9563fe59..5d01f16f0 100644
--- a/lib/WebGUI/i18n/English/WebGUI.pm
+++ b/lib/WebGUI/i18n/English/WebGUI.pm
@@ -169,6 +169,10 @@ The email address for your company specified in the settings by your Administrat
Returns the path to the WebGUI "extras" folder, which contains things like WebGUI icons.
+^JavaScript();
+This macro allows you to set a javascript in the head section of the page. Just pass in the URL to the javascript file.
+
+
^LastModified; or ^LastModified();
Displays the date that the current page was last modified based upon the wobjects on the page. The date is defaultly displayed based upon the user's date preferences. Optionally, it can take two parameters. The first is text to display before the date. The second is a date format string (see the D (date) macro for details.
@@ -215,20 +219,27 @@ The translated label for the printable link, or the text that you supply to the
Returns the title of the root of the current page. For instance, the main root in WebGUI is the "Home" page. Many advanced sites have many roots and thus need a way to display to the user which root they are in.
-^u; - Company URL
-The URL for your company specified in the settings by your Administrator.
+^StyleSheet();
+This macro allows you to set a cascading style sheet in the head section of the page. Just pass in the URL to the CSS file.
-
-
^Spacer();
Create a spacer in your layout. Great for creating blocks of color with divs and tables. It takes two parameters, width and height.
Example: ^Spacer("100","50");
+^RawHeadTags();
+This macro allows you to set some arbitrary tags in the head section of the page. Just pass in the text.
+
+
+^u; - Company URL
+The URL for your company specified in the settings by your Administrator.
+