Macros process on one pass.

This commit is contained in:
JT Smith 2003-03-02 17:02:18 +00:00
parent 8e4c8a9fd8
commit 0ebac2be41
22 changed files with 24 additions and 51 deletions

View file

@ -271,8 +271,7 @@ sub page {
} }
$httpHeader = WebGUI::Session::httpHeader(); $httpHeader = WebGUI::Session::httpHeader();
unless ($useCache && defined $content) { unless ($useCache && defined $content) {
$content = WebGUI::Template::process(WebGUI::Style::get($pageEdit.WebGUI::Page::getTemplate($template)), $content = WebGUI::Macro::process(WebGUI::Template::process(WebGUI::Style::get($pageEdit.WebGUI::Page::getTemplate($template)), $positions));
$positions);
$cache->set($cacheKey, $content, $session{config}{cachePages}) if ($useCache); $cache->set($cacheKey, $content, $session{config}{cachePages}) if ($useCache);
} }
$debug = _generateDebug(); $debug = _generateDebug();

View file

@ -173,7 +173,6 @@ sub insufficient {
$output = '<h1>'.WebGUI::International::get(37).'</h1>'; $output = '<h1>'.WebGUI::International::get(37).'</h1>';
$output .= WebGUI::International::get(38); $output .= WebGUI::International::get(38);
$output .= '<p>'; $output .= '<p>';
$output = WebGUI::Macro::process($output);
return $output; return $output;
} }

View file

@ -17,7 +17,6 @@ package WebGUI::Style;
use strict; use strict;
use Tie::CPHash; use Tie::CPHash;
use WebGUI::Macro;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Template; use WebGUI::Template;
@ -79,7 +78,7 @@ sub get {
} }
$header .= '</head>'.$body[0]; $header .= '</head>'.$body[0];
$footer = $body[1].' </html>'; $footer = $body[1].' </html>';
return WebGUI::Macro::process($header.$_[0].$footer); return $header.$_[0].$footer;
} }

View file

@ -264,7 +264,6 @@ sub duplicate {
title => $_[0]->get("title"), title => $_[0]->get("title"),
description => $_[0]->get("description"), description => $_[0]->get("description"),
displayTitle => $_[0]->get("displayTitle"), displayTitle => $_[0]->get("displayTitle"),
processMacros => $_[0]->get("processMacros"),
startDate => $_[0]->get("startDate"), startDate => $_[0]->get("startDate"),
endDate => $_[0]->get("endDate"), endDate => $_[0]->get("endDate"),
templatePosition => $_[0]->get("templatePosition") templatePosition => $_[0]->get("templatePosition")
@ -642,7 +641,7 @@ NOTE: This method should be extended by all subclasses.
A hash reference of the properties of this wobject instance. This method will accept any name/value pair and associate it with this wobject instance in memory, but will only store the following fields to the database: A hash reference of the properties of this wobject instance. This method will accept any name/value pair and associate it with this wobject instance in memory, but will only store the following fields to the database:
title, displayTitle, description, processMacros, pageId, templatePosition, startDate, endDate, sequenceNumber title, displayTitle, description, pageId, templatePosition, startDate, endDate, sequenceNumber
=item arrayRef =item arrayRef
@ -678,7 +677,7 @@ sub set {
$sql = "update wobject set"; $sql = "update wobject set";
foreach $key (keys %{$_[1]}) { foreach $key (keys %{$_[1]}) {
$_[0]->{_property}{$key} = ${$_[1]}{$key}; $_[0]->{_property}{$key} = ${$_[1]}{$key};
if (isIn($key, qw(userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 moderationType groupToModerate groupToPost karmaPerPost editTimeout title displayTitle description processMacros pageId templatePosition startDate endDate sequenceNumber))) { if (isIn($key, qw(userDefined1 userDefined2 userDefined3 userDefined4 userDefined5 moderationType groupToModerate groupToPost karmaPerPost editTimeout title displayTitle description pageId templatePosition startDate endDate sequenceNumber))) {
$sql .= " ".$key."=".quote(${$_[1]}{$key}).","; $sql .= " ".$key."=".quote(${$_[1]}{$key}).",";
} }
if (isIn($key, @{$_[2]})) { if (isIn($key, @{$_[2]})) {
@ -1023,12 +1022,6 @@ sub www_edit {
-value=>$displayTitle, -value=>$displayTitle,
-uiLevel=>5 -uiLevel=>5
); );
$f->yesNo(
-name=>"processMacros",
-label=>WebGUI::International::get(175),
-value=>$_[0]->get("processMacros"),
-uiLevel=>5
);
$f->select( $f->select(
-name=>"templatePosition", -name=>"templatePosition",
-label=>WebGUI::International::get(363), -label=>WebGUI::International::get(363),
@ -1084,7 +1077,6 @@ sub www_editSave {
$_[0]->set({ $_[0]->set({
title=>$title, title=>$title,
displayTitle=>$session{form}{displayTitle}, displayTitle=>$session{form}{displayTitle},
processMacros=>$session{form}{processMacros},
templatePosition=>$templatePosition, templatePosition=>$templatePosition,
startDate=>$startDate, startDate=>$startDate,
endDate=>$endDate, endDate=>$endDate,
@ -1348,7 +1340,6 @@ sub www_view {
my ($output); my ($output);
$output = $_[0]->displayTitle; $output = $_[0]->displayTitle;
$output .= $_[0]->description; $output .= $_[0]->description;
$output = $_[0]->processMacros($output);
return $output; return $output;
} }

View file

@ -166,7 +166,7 @@ sub www_view {
$var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); $var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(24,$namespace); $var{"post.label"} = WebGUI::International::get(24,$namespace);
} }
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -510,7 +510,7 @@ sub www_view {
$var{"list.pageList"} = $p->getPageLinks; $var{"list.pageList"} = $p->getPageLinks;
$var{"list.previousPage"} = $p->getPreviousPageLink; $var{"list.previousPage"} = $p->getPreviousPageLink;
$var{"list.multiplePages"} = ($p->getNumberOfPages > 1); $var{"list.multiplePages"} = ($p->getNumberOfPages > 1);
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -540,14 +540,7 @@ sub www_viewEvent {
$var{"next.label"} = WebGUI::International::get(93,$namespace).'&raquo;'; $var{"next.label"} = WebGUI::International::get(93,$namespace).'&raquo;';
$var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id); $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id);
$var{description} = $event{description}; $var{description} = $event{description};
return WebGUI::Macro::process( return WebGUI::Template::process( WebGUI::Template::get( $_[0]->get("eventTemplateId"), "EventsCalendar/Event"), \%var);
WebGUI::Template::process(
WebGUI::Template::get(
$_[0]->get("eventTemplateId"),
"EventsCalendar/Event"
),
\%var)
);
} }
1; 1;

View file

@ -69,7 +69,6 @@ sub www_edit {
$f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden("title",$namespace); $f->hidden("title",$namespace);
$f->hidden("displayTitle",0); $f->hidden("displayTitle",0);
$f->hidden("processMacros",0);
$f->select( $f->select(
-name=>"templatePosition", -name=>"templatePosition",
-label=>WebGUI::International::get(363), -label=>WebGUI::International::get(363),

View file

@ -195,7 +195,7 @@ sub www_view {
} }
$sth->finish; $sth->finish;
$var{qa_loop} = \@qa; $var{qa_loop} = \@qa;
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -366,7 +366,7 @@ sub www_view {
$var{pageList} = $p->getPageLinks; $var{pageList} = $p->getPageLinks;
$var{previousPage} = $p->getPreviousPageLink; $var{previousPage} = $p->getPreviousPageLink;
$var{multiplePages} = ($p->getNumberOfPages > 1); $var{multiplePages} = ($p->getNumberOfPages > 1);
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -139,7 +139,6 @@ sub www_view {
$output = $_[0]->displayTitle; $output = $_[0]->displayTitle;
$output .= $_[0]->description; $output .= $_[0]->description;
$output = $_[0]->processMacros($output);
if(not(-w $_[0]->get("cookiebox") && -r $_[0]->get("cookiebox"))) { if(not(-w $_[0]->get("cookiebox") && -r $_[0]->get("cookiebox"))) {
return "<b>Error while opening cookie directory ".$_[0]->get("cookiebox")."</b><p><i>$!</i>"; return "<b>Error while opening cookie directory ".$_[0]->get("cookiebox")."</b><p><i>$!</i>";

View file

@ -89,7 +89,7 @@ sub www_view {
$var{"attachment.URL"} = $file->getURL; $var{"attachment.URL"} = $file->getURL;
$var{"attachment.Icon"} = $file->getIcon; $var{"attachment.Icon"} = $file->getIcon;
} }
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -15,7 +15,6 @@ use Tie::CPHash;
use WebGUI::HTMLForm; use WebGUI::HTMLForm;
use WebGUI::Icon; use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
@ -206,7 +205,7 @@ sub www_view {
} }
$sth->finish; $sth->finish;
$var{link_loop} = \@linkloop; $var{link_loop} = \@linkloop;
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -321,8 +321,6 @@ sub www_view {
$sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); $sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber");
while (%data = $sth->hash) { while (%data = $sth->hash) {
# process macros on default values
$data{defaultValue} = $_[0]->processMacros($data{defaultValue});
if ($data{status} == 1) { if ($data{status} == 1) {
# hidden field, don't show on form for security reasons # hidden field, don't show on form for security reasons
$row = ""; $row = "";
@ -348,7 +346,7 @@ sub www_view {
$f->submit(WebGUI::International::get(73, $namespace)); $f->submit(WebGUI::International::get(73, $namespace));
$output .= $f->print; $output .= $f->print;
return $_[0]->processMacros($output); return $output;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------
@ -452,7 +450,7 @@ sub _createField {
# add an empty option if no default value is provided # add an empty option if no default value is provided
foreach (split(/\n/, $data->{possibleValues})) { foreach (split(/\n/, $data->{possibleValues})) {
s/\s+$//; # remove trailing spaces s/\s+$//; # remove trailing spaces
$selectOptions{$_} = $_[0]->processMacros($_); $selectOptions{$_} = $_;
} }
$f->selectList( $f->selectList(
-name=>$name, -name=>$name,
@ -470,7 +468,7 @@ sub _createField {
tie %selectOptions, 'Tie::IxHash'; tie %selectOptions, 'Tie::IxHash';
foreach (split(/\n/, $data->{possibleValues})) { foreach (split(/\n/, $data->{possibleValues})) {
s/\s+$//; # remove trailing spaces s/\s+$//; # remove trailing spaces
$selectOptions{$_} = $_[0]->processMacros($_); $selectOptions{$_} = $_;
} }
if ($session{form}{$name}) { if ($session{form}{$name}) {
@defaultValues = $session{cgi}->param($name); @defaultValues = $session{cgi}->param($name);
@ -498,7 +496,7 @@ sub _createField {
tie %selectOptions, 'Tie::IxHash'; tie %selectOptions, 'Tie::IxHash';
foreach (split(/\n/, $data->{possibleValues})) { foreach (split(/\n/, $data->{possibleValues})) {
s/\s+$//; # remove trailing spaces s/\s+$//; # remove trailing spaces
$selectOptions{$_} = $_[0]->processMacros($_); $selectOptions{$_} = $_;
} }
if ($session{form}{$name}) { if ($session{form}{$name}) {
@defaultValues = $session{cgi}->param($name); @defaultValues = $session{cgi}->param($name);

View file

@ -95,8 +95,8 @@ sub www_showMessage {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_view { sub www_view {
my ($p, $data, %var, @message_loop, $rows, @last, $replies); my ($p, $data, %var, @message_loop, $rows, @last, $replies);
$var{title} = $_[0]->processMacros($_[0]->get("title")); $var{title} = $_[0]->get("title");
$var{description} = $_[0]->processMacros($_[0]->get("description")); $var{description} = $_[0]->get("description");
$var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToPost")); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToPost"));
$var{"post.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); $var{"post.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(17,$namespace); $var{"post.label"} = WebGUI::International::get(17,$namespace);

View file

@ -201,7 +201,7 @@ sub www_view {
} }
$output .= '<span class="pollAnswer"><hr size="1"><b>'.WebGUI::International::get(12,$namespace).'</b> '.$totalResponses.'</span>'; $output .= '<span class="pollAnswer"><hr size="1"><b>'.WebGUI::International::get(12,$namespace).'</b> '.$totalResponses.'</span>';
} }
return $_[0]->processMacros($output); return $output;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -642,7 +642,7 @@ sub www_view {
} }
$sth->finish; $sth->finish;
$var{relatedproduct_loop} = \@relatedloop; $var{relatedproduct_loop} = \@relatedloop;
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }

View file

@ -183,7 +183,7 @@ sub www_view {
$output .= WebGUI::International::get(12,$namespace).'<p>' if ($_[0]->get("debugMode")); $output .= WebGUI::International::get(12,$namespace).'<p>' if ($_[0]->get("debugMode"));
WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] Could not connect to database."); WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] Could not connect to database.");
} }
return $_[0]->processMacros($output); return $output;
} }

View file

@ -128,7 +128,7 @@ sub www_editSave {
sub www_view { sub www_view {
my (%var); my (%var);
$var{page_loop} = _traversePageTree($_[0]->get("startAtThisLevel"),0,$_[0]->get("depth"),$_[0]->get("indent")); $var{page_loop} = _traversePageTree($_[0]->get("startAtThisLevel"),0,$_[0]->get("depth"),$_[0]->get("indent"));
return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); return $_[0]->processTemplate($_[0]->get("templateId"),\%var);
} }
1; 1;

View file

@ -677,7 +677,7 @@ sub www_view {
$output .= WebGUI::International::get(49,$namespace); $output .= WebGUI::International::get(49,$namespace);
} }
} }
return $_[0]->processMacros($output); return $output;
} }
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -16,7 +16,6 @@ use WebGUI::DateTime;
use WebGUI::HTMLForm; use WebGUI::HTMLForm;
use WebGUI::Icon; use WebGUI::Icon;
use WebGUI::International; use WebGUI::International;
use WebGUI::Macro;
use WebGUI::Privilege; use WebGUI::Privilege;
use WebGUI::Session; use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
@ -83,7 +82,6 @@ sub www_view {
my ($output); my ($output);
$output = $_[0]->displayTitle; $output = $_[0]->displayTitle;
$output .= $_[0]->description; $output .= $_[0]->description;
$output = $_[0]->processMacros($output);
$output .= $_[0]->get("content"); $output .= $_[0]->get("content");
return $output; return $output;
} }

View file

@ -320,8 +320,8 @@ sub www_view {
$numResults = $_[0]->get("submissionsPerPage"); $numResults = $_[0]->get("submissionsPerPage");
$var{"readmore.label"} = WebGUI::International::get(46,$namespace); $var{"readmore.label"} = WebGUI::International::get(46,$namespace);
$var{"responses.label"} = WebGUI::International::get(57,$namespace); $var{"responses.label"} = WebGUI::International::get(57,$namespace);
$var{title} = $_[0]->processMacros($_[0]->get("title")); $var{title} = $_[0]->get("title");
$var{description} = $_[0]->processMacros($_[0]->get("description")); $var{description} = $_[0]->get("description");
$var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute"));
$var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId")); $var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId"));
$var{"post.label"} = WebGUI::International::get(20,$namespace); $var{"post.label"} = WebGUI::International::get(20,$namespace);

View file

@ -67,7 +67,6 @@ sub www_edit {
$f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499));
$f->hidden("title",$namespace); $f->hidden("title",$namespace);
$f->hidden("displayTitle",0); $f->hidden("displayTitle",0);
$f->hidden("processMacros",0);
$f->select( $f->select(
-name=>"templatePosition", -name=>"templatePosition",
-label=>WebGUI::International::get(363), -label=>WebGUI::International::get(363),