\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 | ^C; | \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 | ^T(0); | \r\n | ^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 | \r\n \r\n \r\n\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 .= '
';
+ $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));
}