Added a template variable called "isTop".

This commit is contained in:
JT Smith 2003-03-15 22:20:31 +00:00
parent 3370363c8d
commit d865b27dd5

View file

@ -37,7 +37,8 @@ sub _traversePageTree {
$sth = WebGUI::SQL->read("select urlizedTitle, menuTitle, title, pageId, synopsis from page $sth = WebGUI::SQL->read("select urlizedTitle, menuTitle, title, pageId, synopsis from page
where parentId='$parent' order by sequenceNumber"); where parentId='$parent' order by sequenceNumber");
while ($data = $sth->hashRef) { while ($data = $sth->hashRef) {
if (($data->{pageId}>999 || $data->{pageId}==1) && WebGUI::Privilege::canViewPage($data->{pageId})) { if (($data->{pageId}<0 || $data->{pageId}>999 || $data->{pageId}==1) && WebGUI::Privilege::canViewPage($data->{pageId})) {
WebGUI::ErrorHandler::warn("got here");
push(@pages,{ push(@pages,{
"page.indent" => $indentString, "page.indent" => $indentString,
"page.url" => WebGUI::URL::gateway($data->{urlizedTitle}), "page.url" => WebGUI::URL::gateway($data->{urlizedTitle}),
@ -45,7 +46,8 @@ sub _traversePageTree {
"page.title" => $data->{title}, "page.title" => $data->{title},
"page.menuTitle" => $data->{menuTitle}, "page.menuTitle" => $data->{menuTitle},
"page.synopsis" => $data->{synopsis}, "page.synopsis" => $data->{synopsis},
"page.isRoot" => ($parent == 0) "page.isRoot" => ($parent == 0),
"page.isTop" => ($currentDepth == 0 || ($currentDepth == 1 && $parent == 0))
}); });
push(@pages,@{_traversePageTree($data->{pageId},($currentDepth+1),$depth,$indent)}); push(@pages,@{_traversePageTree($data->{pageId},($currentDepth+1),$depth,$indent)});
} }
@ -90,35 +92,37 @@ sub new {
sub www_edit { sub www_edit {
my $options = WebGUI::SQL->buildHashRef("select pageId,title from page where parentId=0 my $options = WebGUI::SQL->buildHashRef("select pageId,title from page where parentId=0
and (pageId=1 or pageId>999) order by title"); and (pageId=1 or pageId>999) order by title");
my $f = WebGUI::HTMLForm->new; my $layout = WebGUI::HTMLForm->new;
$f->template( my $properties = WebGUI::HTMLForm->new;
$layout->template(
-name=>"templateId", -name=>"templateId",
-value=>$_[0]->getValue("templateId"), -value=>$_[0]->getValue("templateId"),
-namespace=>$_[0]->get("namespace"), -namespace=>$_[0]->get("namespace"),
-afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId") -afterEdit=>'func=edit&wid='.$_[0]->get("wobjectId")
); );
$f->select( $properties->select(
-name=>"startAtThisLevel", -name=>"startAtThisLevel",
-label=>WebGUI::International::get(3,$_[0]->get("namespace")), -label=>WebGUI::International::get(3,$_[0]->get("namespace")),
-value=>[$_[0]->getValue("startLevel")], -value=>[$_[0]->getValue("startAtThisLevel")],
-options=>{ -options=>{
0=>WebGUI::International::get(75,$_[0]->get("namespace")), 0=>WebGUI::International::get(75,$_[0]->get("namespace")),
$session{page}{pageId}=>WebGUI::International::get(74,$_[0]->get("namespace")), $session{page}{pageId}=>WebGUI::International::get(74,$_[0]->get("namespace")),
%{$options} %{$options}
} }
); );
$f->integer( $layout->integer(
-name=>"depth", -name=>"depth",
-label=>WebGUI::International::get(4,$_[0]->get("namespace")), -label=>WebGUI::International::get(4,$_[0]->get("namespace")),
-value=>$_[0]->getValue("depth") -value=>$_[0]->getValue("depth")
); );
$f->integer( $layout->integer(
-name=>"indent", -name=>"indent",
-label=>WebGUI::International::get(6,$_[0]->get("namespace")), -label=>WebGUI::International::get(6,$_[0]->get("namespace")),
-value=>$_[0]->getValue("indent") -value=>$_[0]->getValue("indent")
); );
return $_[0]->SUPER::www_edit( return $_[0]->SUPER::www_edit(
-layout=>$f->printRowsOnly, -properties=>$properties->printRowsOnly,
-layout=>$layout->printRowsOnly,
-headingId=>5, -headingId=>5,
-helpId=>1 -helpId=>1
); );