diff --git a/docs/gotcha.txt b/docs/gotcha.txt
index 4ec864dd1..01418820e 100644
--- a/docs/gotcha.txt
+++ b/docs/gotcha.txt
@@ -16,6 +16,8 @@ save you many hours of grief.
* All Link Lists have been reset to the default template.
+ * All Site Maps have been reset to the default template.
+
4.8.0
--------------------------------------------------------------------
diff --git a/docs/upgrades/upgrade_4.8.0-4.9.0.sql b/docs/upgrades/upgrade_4.8.0-4.9.0.sql
index 3ef3bbefb..1d11c2acf 100644
--- a/docs/upgrades/upgrade_4.8.0-4.9.0.sql
+++ b/docs/upgrades/upgrade_4.8.0-4.9.0.sql
@@ -965,6 +965,17 @@ insert into international (internationalId,languageId,namespace,message,lastUpda
alter table MessageBoard add column templateId int not null default 1;
insert into international (internationalId,languageId,namespace,message,lastUpdated) values (72,1,'MessageBoard','Main Template', 1038678090);
INSERT INTO template VALUES (1,'Default Message Board','\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 \"> | \r\n | \r\n | \r\n | \r\n \r\n \r\n \r\n @ \r\n by \">\r\n \r\n | \r\n
\r\n\r\n
\r\n\r\n\r\n\r\n \r\n\r\n\r\n','MessageBoard');
+delete from international where namespace='SiteMap' and internationalId=7;
+delete from international where namespace='SiteMap' and internationalId=8;
+delete from international where namespace='SiteMap' and internationalId=9;
+alter table SiteMap add column templateId int not null default 1;
+update SiteMap set templateId=2 where displaySynopsis=1;
+alter table SiteMap drop column displaySynopsis;
+alter table SiteMap drop column bullet;
+alter table SiteMap drop column lineSpacing;
+INSERT INTO template VALUES (1,'Default Site Map','\r\n
\r\n\r\n\r\n\r\n \r\n\r\n\r\n\r\n ·\">
\r\n','SiteMap');
+INSERT INTO template VALUES (2,'Descriptive Site Map','\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','SiteMap');
+
diff --git a/lib/WebGUI/HTMLForm.pm b/lib/WebGUI/HTMLForm.pm
index 5b029cc4a..0ff99a22d 100644
--- a/lib/WebGUI/HTMLForm.pm
+++ b/lib/WebGUI/HTMLForm.pm
@@ -1527,6 +1527,7 @@ sub template {
my ($name, $value, $label, $namespace, $afterEdit, $extras, $uiLevel) =
rearrange([qw(name value label namespace afterEdit extras uiLevel)], @p);
if (_uiLevelChecksOut($uiLevel)) {
+ $label = $_[0]->{label} || WebGUI::International::get(356);
if (WebGUI::Privilege::isInGroup($session{setting}{templateManagersGroup})) {
if ($afterEdit) {
$subtext = '{_property}{sequenceNumber}.",
".$_[0]->{_property}{pageId}."
)");
- WebGUI::SQL->write("insert into ".$_[0]->{_property}{namespace}." (wobjectId) values (".$_[0]->{_property}{wobjectId}.")");
+ WebGUI::SQL->write("insert into ".$_[0]->{_property}{namespace}." (wobjectId)
+ values (".$_[0]->{_property}{wobjectId}.")");
}
$_[0]->{_property}{lastEdited} = time();
$_[0]->{_property}{editedBy} = $session{user}{userId};
@@ -684,9 +685,10 @@ sub set {
where wobjectId=".$_[0]->{_property}{wobjectId};
WebGUI::SQL->write($sql);
if (@update) {
- WebGUI::SQL->write("update ".$_[0]->{_property}{namespace}." set ".join(",",@update)." where wobjectId=".$_[0]->{_property}{wobjectId});
+ WebGUI::SQL->write("update ".$_[0]->{_property}{namespace}." set ".join(",",@update)."
+ where wobjectId=".$_[0]->{_property}{wobjectId});
}
- WebGUI::ErrorHandler::audit("edited Wobject ".$_[0]->{_property}{wobjectId});
+ WebGUI::ErrorHandler::audit("edited Wobject ".$_[0]->{_property}{wobjectId});
}
diff --git a/lib/WebGUI/Wobject/SiteMap.pm b/lib/WebGUI/Wobject/SiteMap.pm
index 308acaf12..113b1e595 100644
--- a/lib/WebGUI/Wobject/SiteMap.pm
+++ b/lib/WebGUI/Wobject/SiteMap.pm
@@ -27,33 +27,33 @@ our $name = WebGUI::International::get(2,$namespace);
#-------------------------------------------------------------------
sub _traversePageTree {
- my ($lineSpacing, $sth, @data, $output, $depth, $i, $toLevel);
- if ($_[2] > 0) {
- $toLevel = $_[2];
- } else {
- $toLevel = 99;
+ my ($parent, $sth, $data, $indent, @pages, $i, $currentDepth, $depth, $indentString);
+ $parent = $_[0];
+ $currentDepth = $_[1];
+ $depth = $_[2] || 99;
+ $indent = $_[3];
+ for ($i=1;$i<=($indent*$currentDepth);$i++) {
+ $indentString .= " ";
}
- for ($i=1;$i<=($_[1]*$_[3]);$i++) {
- $depth .= " ";
- }
- for ($i=1;$i<=$_[5];$i++) {
- $lineSpacing .= "
";
- }
- if ($_[1] < $toLevel) {
- $sth = WebGUI::SQL->read("select urlizedTitle, title, pageId, synopsis from page where parentId='$_[0]' order by sequenceNumber");
- while (@data = $sth->array) {
- if (WebGUI::Privilege::canViewPage($data[2])) {
- $output .= $depth.$_[4].' '.$data[1].'';
- if ($data[3] ne "" && $_[6]) {
- $output .= ' - '.$data[3];
- }
- $output .= $lineSpacing;
- $output .= _traversePageTree($data[2],($_[1]+1),$_[2],$_[3],$_[4],$_[5],$_[6]);
+ if ($currentDepth < $depth) {
+ $sth = WebGUI::SQL->read("select urlizedTitle, title, pageId, synopsis from page
+ where parentId='$parent' order by sequenceNumber");
+ while ($data = $sth->hashRef) {
+ if (WebGUI::Privilege::canViewPage($data->{pageId})) {
+ push(@pages,{
+ "page.indent" => $indentString,
+ "page.url" => WebGUI::URL::gateway($data->{urlizedTitle}),
+ "page.id" => $data->{pageId},
+ "page.title" => $data->{title},
+ "page.menuTitle" => $data->{menuTitle},
+ "page.synopsis" => $data->{synopsis}
+ });
+ push(@pages,@{_traversePageTree($data->{pageId},($currentDepth+1),$depth,$indent)});
}
}
$sth->finish;
}
- return $output;
+ return \@pages;
}
#-------------------------------------------------------------------
@@ -63,35 +63,34 @@ sub duplicate {
$w = WebGUI::Wobject::SiteMap->new({wobjectId=>$w,namespace=>$namespace});
$w->set({
startAtThisLevel=>$_[0]->get("startAtThisLevel"),
+ templateId=>$_[0]->get("templateId"),
indent=>$_[0]->get("indent"),
- bullet=>$_[0]->get("bullet"),
- lineSpacing=>$_[0]->get("lineSpacing"),
- displaySynopsis=>$_[0]->get("displaySynopsis"),
depth=>$_[0]->get("depth")
});
}
#-------------------------------------------------------------------
sub set {
- $_[0]->SUPER::set($_[1],[qw(startAtThisLevel displaySynopsis indent bullet lineSpacing depth)]);
+ $_[0]->SUPER::set($_[1],[qw(startAtThisLevel indent templateId depth)]);
}
#-------------------------------------------------------------------
sub www_edit {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
- my ($output, $f, $indent, $bullet, $lineSpacing);
+ my ($output, $f, $indent);
$indent = $_[0]->get("indent") || 5;
- $bullet = $_[0]->get("bullet") || '·';
- $lineSpacing = $_[0]->get("lineSpacing") || 1;
$output = helpIcon(1,$_[0]->get("namespace"));
$output .= ''.WebGUI::International::get(5,$namespace).'
';
$f = WebGUI::HTMLForm->new;
- $f->yesNo("displaySynopsis",WebGUI::International::get(9,$namespace),$_[0]->get("displaySynopsis"));
+ $f->template(
+ -name=>"templateId",
+ -value=>$_[0]->get("templateId"),
+ -namespace=>$namespace,
+ -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
+ );
$f->yesNo("startAtThisLevel",WebGUI::International::get(3,$namespace),$_[0]->get("startAtThisLevel"));
$f->integer("depth",WebGUI::International::get(4,$namespace),$_[0]->get("depth"));
$f->integer("indent",WebGUI::International::get(6,$namespace),$indent);
- $f->text("bullet",WebGUI::International::get(7,$namespace),$bullet);
- $f->integer("lineSpacing",WebGUI::International::get(8,$namespace),$lineSpacing);
$output .= $_[0]->SUPER::www_edit($f->printRowsOnly);
return $output;
}
@@ -99,29 +98,25 @@ sub www_edit {
#-------------------------------------------------------------------
sub www_editSave {
return WebGUI::Privilege::insufficient() unless (WebGUI::Privilege::canEditPage());
- my ($property);
- $property->{indent} = $session{form}{indent};
- $property->{displaySynopsis} = $session{form}{displaySynopsis};
- $property->{bullet} = $session{form}{bullet};
- $property->{startAtThisLevel} = $session{form}{startAtThisLevel};
- $property->{depth} = $session{form}{depth};
- $property->{lineSpacing} = $session{form}{lineSpacing};
- $_[0]->SUPER::www_editSave($property);
+ $_[0]->SUPER::www_editSave({
+ indent=>$session{form}{indent},
+ startAtThisLevel=>$session{form}{startAtThisLevel},
+ depth=>$session{form}{depth},
+ templateId=>$session{form}{templateId}
+ });
return "";
}
#-------------------------------------------------------------------
sub www_view {
- my (@question, $output, $parent);
- $output = $_[0]->displayTitle;
- $output .= $_[0]->description;
+ my (%var, $parent);
if ($_[0]->get("startAtThisLevel")) {
$parent = $session{page}{pageId};
} else {
$parent = 1;
}
- $output .= _traversePageTree($parent,0,$_[0]->get("depth"),$_[0]->get("indent"),$_[0]->get("bullet"),$_[0]->get("lineSpacing"),$_[0]->get("displaySynopsis"));
- return $_[0]->processMacros($output);
+ $var{page_loop} = _traversePageTree($parent,0,$_[0]->get("depth"),$_[0]->get("indent"));
+ return $_[0]->processMacros($_[0]->processTemplate($_[0]->get("templateId"),\%var));
}
1;