From 9aa26fa2214257dcd3bb7adacff8ead56972734e Mon Sep 17 00:00:00 2001 From: JT Smith Date: Sat, 2 Nov 2002 20:02:37 +0000 Subject: [PATCH] Items now use H::T --- docs/upgrades/upgrade_4.6.9-4.7.0.sql | 7 +++--- lib/WebGUI/Wobject/Item.pm | 35 ++++++++++++--------------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/docs/upgrades/upgrade_4.6.9-4.7.0.sql b/docs/upgrades/upgrade_4.6.9-4.7.0.sql index cad669072..dfa36af34 100644 --- a/docs/upgrades/upgrade_4.6.9-4.7.0.sql +++ b/docs/upgrades/upgrade_4.6.9-4.7.0.sql @@ -1042,10 +1042,9 @@ INSERT INTO template VALUES (1,'Default FAQ','\r\n\r\n\r\n

\r\n\r\n\r\n

\r\n\r\n\r\nQ:
\r\nA: \r\n

\r\n\r\n\r\n','FAQ'); INSERT INTO template VALUES (3,'Topics','\r\n

\r\n\r\n\r\n

\r\n\r\n\r\n

\r\n\r\n

\r\n\r\n\r\n','FAQ'); INSERT INTO style VALUES (-7,'Smooth Blues','\r\n','^AdminBar;\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n\r\n\r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n \r\n \r\n
Home\r\n
\r\n
\r\n \r\n \r\n
Print!\r\n
\r\n
\r\n \r\n \r\n
My Account\r\n
\r\n
\r\n
\r\n\r\n\r\n \r\n \r\n \r\n \r\n
^C;^?;
\r\n\r\n\r\n \r\n \r\n \r\n\r\n \r\n \r\n
\r\n \r\n
\r\n

Site Navigation

\r\n
\r\n \r\n \r\n \r\n \r\n
^T(0);
^L;
\r\n
\r\n\r\n \r\n\r\n \r\n
\r\n \r\n\r\n^-;\r\n\r\n\r\n
\r\n
\r\n\r\n\r\n


This Design ©2002 OpenServe
\r\n\r\n
\r\n\r\n'); - - - - +alter table Item add column templateId int not null default 1; +insert into international (internationalId,languageId,namespace,message,lastUpdated) values (72,1,'Item','Template', 1036267550); +INSERT INTO template VALUES (1,'Default Item','\r\n \r\n \">\r\n \r\n \r\n \r\n \r\n \r\n\r\n\r\n\r\n - \r\n \">\" border=0 alt=\"\" width=16 height=16 border=0 align=\"middle\">\r\n\r\n\r\n\r\n - \r\n','Item'); diff --git a/lib/WebGUI/Wobject/Item.pm b/lib/WebGUI/Wobject/Item.pm index e2d116105..fc92fad57 100644 --- a/lib/WebGUI/Wobject/Item.pm +++ b/lib/WebGUI/Wobject/Item.pm @@ -34,7 +34,8 @@ sub duplicate { $w = WebGUI::Wobject::Item->new({wobjectId=>$w,namespace=>$namespace}); $w->set({ linkURL=>$_[0]->get("linkURL"), - attachment=>$_[0]->get("attachment") + attachment=>$_[0]->get("attachment"), + templateId=>$_[0]->get("templateId") }); $f = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); $f->copy($w->get("wobjectId")); @@ -42,18 +43,26 @@ sub duplicate { #------------------------------------------------------------------- sub set { - $_[0]->SUPER::set($_[1],[qw(linkURL attachment)]); + $_[0]->SUPER::set($_[1],[qw(linkURL attachment templateId)]); } #------------------------------------------------------------------- sub www_edit { return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage()); - my ($output, $f); + my ($output, $f, $template); + $template = $_[0]->get("templateId") || 1; $output = helpIcon(1,$_[0]->get("namespace")); $output .= '

'.WebGUI::International::get(6,$namespace).'

'; $f = WebGUI::HTMLForm->new; $f->url("linkURL",WebGUI::International::get(1,$_[0]->get("namespace")),$_[0]->get("linkURL")); $f->raw($_[0]->fileProperty("attachment",2)); + $f->template( + -name=>"templateId", + -value=>$template, + -namespace=>$namespace, + -label=>WebGUI::International::get(72,$namespace), + -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") + ); $output .= $_[0]->SUPER::www_edit($f->printRowsOnly); return $output; } @@ -73,25 +82,13 @@ sub www_editSave { #------------------------------------------------------------------- sub www_view { - my (@test, $output, $file); - if ($_[0]->get("displayTitle")) { - $output = ''.$_[0]->get("title").''; - if ($_[0]->get("linkURL")) { - $output = ''.$output.''; - } - } + my ($file, %var); if ($_[0]->get("attachment") ne "") { $file = WebGUI::Attachment->new($_[0]->get("attachment"),$_[0]->get("wobjectId")); - if ($_[0]->get("displayTitle")) { - $output .= ' - '; - } - $output .= ''.
-			$_[0]->get('; + $var{attachmentURL} = $file->getURL; + $var{attachmentIcon} = $file->getIcon; } - if ($_[0]->get("description") ne "") { - $output .= ' - '.$_[0]->get("description"); - } - return $_[0]->processMacros($output); + return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var)); }