From 0ebac2be413d0e826f267b5a93f52bb1c9932fd1 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sun, 2 Mar 2003 17:02:18 +0000 Subject: [PATCH] Macros process on one pass. --- lib/WebGUI.pm | 3 +-- lib/WebGUI/Privilege.pm | 1 - lib/WebGUI/Style.pm | 3 +-- lib/WebGUI/Wobject.pm | 13 ++----------- lib/WebGUI/Wobject/Article.pm | 2 +- lib/WebGUI/Wobject/EventsCalendar.pm | 11 ++--------- lib/WebGUI/Wobject/ExtraColumn.pm | 1 - lib/WebGUI/Wobject/FAQ.pm | 2 +- lib/WebGUI/Wobject/FileManager.pm | 2 +- lib/WebGUI/Wobject/HttpProxy.pm | 1 - lib/WebGUI/Wobject/Item.pm | 2 +- lib/WebGUI/Wobject/LinkList.pm | 3 +-- lib/WebGUI/Wobject/MailForm.pm | 10 ++++------ lib/WebGUI/Wobject/MessageBoard.pm | 4 ++-- lib/WebGUI/Wobject/Poll.pm | 2 +- lib/WebGUI/Wobject/Product.pm | 2 +- lib/WebGUI/Wobject/SQLReport.pm | 2 +- lib/WebGUI/Wobject/SiteMap.pm | 2 +- lib/WebGUI/Wobject/Survey.pm | 2 +- lib/WebGUI/Wobject/SyndicatedContent.pm | 2 -- lib/WebGUI/Wobject/USS.pm | 4 ++-- lib/WebGUI/Wobject/WobjectProxy.pm | 1 - 22 files changed, 24 insertions(+), 51 deletions(-) diff --git a/lib/WebGUI.pm b/lib/WebGUI.pm index 1a1c1739f..af2ded042 100644 --- a/lib/WebGUI.pm +++ b/lib/WebGUI.pm @@ -271,8 +271,7 @@ sub page { } $httpHeader = WebGUI::Session::httpHeader(); unless ($useCache && defined $content) { - $content = WebGUI::Template::process(WebGUI::Style::get($pageEdit.WebGUI::Page::getTemplate($template)), - $positions); + $content = WebGUI::Macro::process(WebGUI::Template::process(WebGUI::Style::get($pageEdit.WebGUI::Page::getTemplate($template)), $positions)); $cache->set($cacheKey, $content, $session{config}{cachePages}) if ($useCache); } $debug = _generateDebug(); diff --git a/lib/WebGUI/Privilege.pm b/lib/WebGUI/Privilege.pm index 279cd4f90..17343438b 100644 --- a/lib/WebGUI/Privilege.pm +++ b/lib/WebGUI/Privilege.pm @@ -173,7 +173,6 @@ sub insufficient { $output = '

'.WebGUI::International::get(37).'

'; $output .= WebGUI::International::get(38); $output .= '

'; - $output = WebGUI::Macro::process($output); return $output; } diff --git a/lib/WebGUI/Style.pm b/lib/WebGUI/Style.pm index 99f0cb961..4f048411e 100644 --- a/lib/WebGUI/Style.pm +++ b/lib/WebGUI/Style.pm @@ -17,7 +17,6 @@ package WebGUI::Style; use strict; use Tie::CPHash; -use WebGUI::Macro; use WebGUI::Session; use WebGUI::SQL; use WebGUI::Template; @@ -79,7 +78,7 @@ sub get { } $header .= ''.$body[0]; $footer = $body[1].' '; - return WebGUI::Macro::process($header.$_[0].$footer); + return $header.$_[0].$footer; } diff --git a/lib/WebGUI/Wobject.pm b/lib/WebGUI/Wobject.pm index 3e7246436..05c03d41e 100644 --- a/lib/WebGUI/Wobject.pm +++ b/lib/WebGUI/Wobject.pm @@ -264,7 +264,6 @@ sub duplicate { title => $_[0]->get("title"), description => $_[0]->get("description"), displayTitle => $_[0]->get("displayTitle"), - processMacros => $_[0]->get("processMacros"), startDate => $_[0]->get("startDate"), endDate => $_[0]->get("endDate"), 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: - title, displayTitle, description, processMacros, pageId, templatePosition, startDate, endDate, sequenceNumber + title, displayTitle, description, pageId, templatePosition, startDate, endDate, sequenceNumber =item arrayRef @@ -678,7 +677,7 @@ sub set { $sql = "update wobject set"; foreach $key (keys %{$_[1]}) { $_[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}).","; } if (isIn($key, @{$_[2]})) { @@ -1023,12 +1022,6 @@ sub www_edit { -value=>$displayTitle, -uiLevel=>5 ); - $f->yesNo( - -name=>"processMacros", - -label=>WebGUI::International::get(175), - -value=>$_[0]->get("processMacros"), - -uiLevel=>5 - ); $f->select( -name=>"templatePosition", -label=>WebGUI::International::get(363), @@ -1084,7 +1077,6 @@ sub www_editSave { $_[0]->set({ title=>$title, displayTitle=>$session{form}{displayTitle}, - processMacros=>$session{form}{processMacros}, templatePosition=>$templatePosition, startDate=>$startDate, endDate=>$endDate, @@ -1348,7 +1340,6 @@ sub www_view { my ($output); $output = $_[0]->displayTitle; $output .= $_[0]->description; - $output = $_[0]->processMacros($output); return $output; } diff --git a/lib/WebGUI/Wobject/Article.pm b/lib/WebGUI/Wobject/Article.pm index c371e89c7..ece1097e9 100644 --- a/lib/WebGUI/Wobject/Article.pm +++ b/lib/WebGUI/Wobject/Article.pm @@ -166,7 +166,7 @@ sub www_view { $var{"post.URL"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); $var{"post.label"} = WebGUI::International::get(24,$namespace); } - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/EventsCalendar.pm b/lib/WebGUI/Wobject/EventsCalendar.pm index aaa1fb193..d2d031586 100644 --- a/lib/WebGUI/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Wobject/EventsCalendar.pm @@ -510,7 +510,7 @@ sub www_view { $var{"list.pageList"} = $p->getPageLinks; $var{"list.previousPage"} = $p->getPreviousPageLink; $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).'»'; $var{"next.url"} = WebGUI::URL::page("func=viewEvent&wid=".$_[0]->get("wobjectId")."&eid=".$id) if ($id); $var{description} = $event{description}; - return WebGUI::Macro::process( - WebGUI::Template::process( - WebGUI::Template::get( - $_[0]->get("eventTemplateId"), - "EventsCalendar/Event" - ), - \%var) - ); + return WebGUI::Template::process( WebGUI::Template::get( $_[0]->get("eventTemplateId"), "EventsCalendar/Event"), \%var); } 1; diff --git a/lib/WebGUI/Wobject/ExtraColumn.pm b/lib/WebGUI/Wobject/ExtraColumn.pm index 91a1efdbd..144d9268c 100644 --- a/lib/WebGUI/Wobject/ExtraColumn.pm +++ b/lib/WebGUI/Wobject/ExtraColumn.pm @@ -69,7 +69,6 @@ sub www_edit { $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); $f->hidden("title",$namespace); $f->hidden("displayTitle",0); - $f->hidden("processMacros",0); $f->select( -name=>"templatePosition", -label=>WebGUI::International::get(363), diff --git a/lib/WebGUI/Wobject/FAQ.pm b/lib/WebGUI/Wobject/FAQ.pm index 27869e3b9..ce2ae8377 100644 --- a/lib/WebGUI/Wobject/FAQ.pm +++ b/lib/WebGUI/Wobject/FAQ.pm @@ -195,7 +195,7 @@ sub www_view { } $sth->finish; $var{qa_loop} = \@qa; - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/FileManager.pm b/lib/WebGUI/Wobject/FileManager.pm index 379e77f9a..46ea836e5 100644 --- a/lib/WebGUI/Wobject/FileManager.pm +++ b/lib/WebGUI/Wobject/FileManager.pm @@ -366,7 +366,7 @@ sub www_view { $var{pageList} = $p->getPageLinks; $var{previousPage} = $p->getPreviousPageLink; $var{multiplePages} = ($p->getNumberOfPages > 1); - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/HttpProxy.pm b/lib/WebGUI/Wobject/HttpProxy.pm index 4279276c2..89f78bf7d 100644 --- a/lib/WebGUI/Wobject/HttpProxy.pm +++ b/lib/WebGUI/Wobject/HttpProxy.pm @@ -139,7 +139,6 @@ sub www_view { $output = $_[0]->displayTitle; $output .= $_[0]->description; - $output = $_[0]->processMacros($output); if(not(-w $_[0]->get("cookiebox") && -r $_[0]->get("cookiebox"))) { return "Error while opening cookie directory ".$_[0]->get("cookiebox")."

$!"; diff --git a/lib/WebGUI/Wobject/Item.pm b/lib/WebGUI/Wobject/Item.pm index 5ec9d70a9..17c82e457 100644 --- a/lib/WebGUI/Wobject/Item.pm +++ b/lib/WebGUI/Wobject/Item.pm @@ -89,7 +89,7 @@ sub www_view { $var{"attachment.URL"} = $file->getURL; $var{"attachment.Icon"} = $file->getIcon; } - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/LinkList.pm b/lib/WebGUI/Wobject/LinkList.pm index 58c63700a..42309de75 100644 --- a/lib/WebGUI/Wobject/LinkList.pm +++ b/lib/WebGUI/Wobject/LinkList.pm @@ -15,7 +15,6 @@ use Tie::CPHash; use WebGUI::HTMLForm; use WebGUI::Icon; use WebGUI::International; -use WebGUI::Macro; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; @@ -206,7 +205,7 @@ sub www_view { } $sth->finish; $var{link_loop} = \@linkloop; - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/MailForm.pm b/lib/WebGUI/Wobject/MailForm.pm index 57e27880d..abfe279a8 100755 --- a/lib/WebGUI/Wobject/MailForm.pm +++ b/lib/WebGUI/Wobject/MailForm.pm @@ -321,8 +321,6 @@ sub www_view { $sth = WebGUI::SQL->read("select * from MailForm_field where wobjectId=".$_[0]->get("wobjectId")." order by sequenceNumber"); while (%data = $sth->hash) { - # process macros on default values - $data{defaultValue} = $_[0]->processMacros($data{defaultValue}); if ($data{status} == 1) { # hidden field, don't show on form for security reasons $row = ""; @@ -348,7 +346,7 @@ sub www_view { $f->submit(WebGUI::International::get(73, $namespace)); $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 foreach (split(/\n/, $data->{possibleValues})) { s/\s+$//; # remove trailing spaces - $selectOptions{$_} = $_[0]->processMacros($_); + $selectOptions{$_} = $_; } $f->selectList( -name=>$name, @@ -470,7 +468,7 @@ sub _createField { tie %selectOptions, 'Tie::IxHash'; foreach (split(/\n/, $data->{possibleValues})) { s/\s+$//; # remove trailing spaces - $selectOptions{$_} = $_[0]->processMacros($_); + $selectOptions{$_} = $_; } if ($session{form}{$name}) { @defaultValues = $session{cgi}->param($name); @@ -498,7 +496,7 @@ sub _createField { tie %selectOptions, 'Tie::IxHash'; foreach (split(/\n/, $data->{possibleValues})) { s/\s+$//; # remove trailing spaces - $selectOptions{$_} = $_[0]->processMacros($_); + $selectOptions{$_} = $_; } if ($session{form}{$name}) { @defaultValues = $session{cgi}->param($name); diff --git a/lib/WebGUI/Wobject/MessageBoard.pm b/lib/WebGUI/Wobject/MessageBoard.pm index 411df5646..1b1f59e93 100644 --- a/lib/WebGUI/Wobject/MessageBoard.pm +++ b/lib/WebGUI/Wobject/MessageBoard.pm @@ -95,8 +95,8 @@ sub www_showMessage { #------------------------------------------------------------------- sub www_view { my ($p, $data, %var, @message_loop, $rows, @last, $replies); - $var{title} = $_[0]->processMacros($_[0]->get("title")); - $var{description} = $_[0]->processMacros($_[0]->get("description")); + $var{title} = $_[0]->get("title"); + $var{description} = $_[0]->get("description"); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToPost")); $var{"post.url"} = WebGUI::URL::page('func=post&mid=new&wid='.$_[0]->get("wobjectId")); $var{"post.label"} = WebGUI::International::get(17,$namespace); diff --git a/lib/WebGUI/Wobject/Poll.pm b/lib/WebGUI/Wobject/Poll.pm index 63fd2a1f4..64db08d00 100644 --- a/lib/WebGUI/Wobject/Poll.pm +++ b/lib/WebGUI/Wobject/Poll.pm @@ -201,7 +201,7 @@ sub www_view { } $output .= '


'.WebGUI::International::get(12,$namespace).' '.$totalResponses.''; } - return $_[0]->processMacros($output); + return $output; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Wobject/Product.pm b/lib/WebGUI/Wobject/Product.pm index bb5f4dc0f..262c7abdb 100644 --- a/lib/WebGUI/Wobject/Product.pm +++ b/lib/WebGUI/Wobject/Product.pm @@ -642,7 +642,7 @@ sub www_view { } $sth->finish; $var{relatedproduct_loop} = \@relatedloop; - return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); + return $_[0]->processTemplate($_[0]->get("templateId"),\%var); } diff --git a/lib/WebGUI/Wobject/SQLReport.pm b/lib/WebGUI/Wobject/SQLReport.pm index 22c3989c1..04fc73953 100644 --- a/lib/WebGUI/Wobject/SQLReport.pm +++ b/lib/WebGUI/Wobject/SQLReport.pm @@ -183,7 +183,7 @@ sub www_view { $output .= WebGUI::International::get(12,$namespace).'

' if ($_[0]->get("debugMode")); WebGUI::ErrorHandler::warn("SQLReport [".$_[0]->get("wobjectId")."] Could not connect to database."); } - return $_[0]->processMacros($output); + return $output; } diff --git a/lib/WebGUI/Wobject/SiteMap.pm b/lib/WebGUI/Wobject/SiteMap.pm index be92bbae6..02b304dea 100644 --- a/lib/WebGUI/Wobject/SiteMap.pm +++ b/lib/WebGUI/Wobject/SiteMap.pm @@ -128,7 +128,7 @@ sub www_editSave { sub www_view { my (%var); $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; diff --git a/lib/WebGUI/Wobject/Survey.pm b/lib/WebGUI/Wobject/Survey.pm index 4704f7d66..779d22edb 100644 --- a/lib/WebGUI/Wobject/Survey.pm +++ b/lib/WebGUI/Wobject/Survey.pm @@ -677,7 +677,7 @@ sub www_view { $output .= WebGUI::International::get(49,$namespace); } } - return $_[0]->processMacros($output); + return $output; } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Wobject/SyndicatedContent.pm b/lib/WebGUI/Wobject/SyndicatedContent.pm index ecdf5b17c..04e37a90c 100644 --- a/lib/WebGUI/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Wobject/SyndicatedContent.pm @@ -16,7 +16,6 @@ use WebGUI::DateTime; use WebGUI::HTMLForm; use WebGUI::Icon; use WebGUI::International; -use WebGUI::Macro; use WebGUI::Privilege; use WebGUI::Session; use WebGUI::SQL; @@ -83,7 +82,6 @@ sub www_view { my ($output); $output = $_[0]->displayTitle; $output .= $_[0]->description; - $output = $_[0]->processMacros($output); $output .= $_[0]->get("content"); return $output; } diff --git a/lib/WebGUI/Wobject/USS.pm b/lib/WebGUI/Wobject/USS.pm index 1f9201332..93d521617 100644 --- a/lib/WebGUI/Wobject/USS.pm +++ b/lib/WebGUI/Wobject/USS.pm @@ -320,8 +320,8 @@ sub www_view { $numResults = $_[0]->get("submissionsPerPage"); $var{"readmore.label"} = WebGUI::International::get(46,$namespace); $var{"responses.label"} = WebGUI::International::get(57,$namespace); - $var{title} = $_[0]->processMacros($_[0]->get("title")); - $var{description} = $_[0]->processMacros($_[0]->get("description")); + $var{title} = $_[0]->get("title"); + $var{description} = $_[0]->get("description"); $var{canPost} = WebGUI::Privilege::isInGroup($_[0]->get("groupToContribute")); $var{"post.url"} = WebGUI::URL::page('func=editSubmission&sid=new&wid='.$_[0]->get("wobjectId")); $var{"post.label"} = WebGUI::International::get(20,$namespace); diff --git a/lib/WebGUI/Wobject/WobjectProxy.pm b/lib/WebGUI/Wobject/WobjectProxy.pm index a828113fb..6c9573904 100644 --- a/lib/WebGUI/Wobject/WobjectProxy.pm +++ b/lib/WebGUI/Wobject/WobjectProxy.pm @@ -67,7 +67,6 @@ sub www_edit { $f->readOnly($_[0]->get("wobjectId"),WebGUI::International::get(499)); $f->hidden("title",$namespace); $f->hidden("displayTitle",0); - $f->hidden("processMacros",0); $f->select( -name=>"templatePosition", -label=>WebGUI::International::get(363),