Source for file LSitenodeSelection.php
Documentation is available at LSitenodeSelection.php
* @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
* @copyright 2005, diemeisterei GmbH. All rights reserved.
* @author $Author: schmunk $
* @version $Revision: 128 $ $Date: 2006-04-25 15:50:26 +0000 (Di, 25 Apr 2006) $
* @package Phundament.Packages
* @subpackage LVirtualNodes
* Displays and manages the CSS menu (sitemap tree)
* @package System.Web.UI.WebControls
return $this->getViewState("mode", "select");
$this->setViewState("mode", $mode, "select");
return $this->getViewState("sel", "1");
$this->setViewState("sel", $sel, "1");
return $this->getViewState("beh", "None");
$this->setViewState("beh", TPropertyValue::ensureEnum($sel, array("None", "Postback", "Callback")), "None");
private function onSelectionChanged($param)
$this->raiseEvent('OnSelectionChanged', $this, $param);
parent :: onLoad($param);
if (!$this->Page->IsPostBack && $this->Request->contains("selectedNode"))
$root= $this->Service->getNodes();
$this->setStyle("font-family: Andale mono, Courier new, monospace; line-height: 1.4em; font-size: 1.1em");
$this->setCssClass("LSitenodeSelection");
private function genRadioButton($cdata)
$cname = $b == "Callback" ? "TActiveRadioButton" : "TRadioButton";
$rb= Prado :: createComponent($cname);
$rb->setGroupName($this->getClientID(false));
$rb->setCustomData($cdata);
$rb->setAutoPostBack($b != "None");
$rb->OnCallback[]= array (
$rb->OnCheckedChanged[]= array (
private function genTree($node, $level= 0, $first= true)
if ((LRightsManager::getRights($node) & 1))
// generate tree-like prefix
for ($i= 0; $i < $level; $i++ )
$trace= $trace->getParentNode();
if ($trace->getSiblingNode() || $this->Mode == "insert")
$prefix= "| " . $prefix;
$prefix= " " . $prefix;
$prefix .= ($node->getSiblingNode() || $this->Mode == "insert" ? "|" : "+") . "--";
$prefix= substr($prefix, $this->Mode == "insert" ? 13 : 18);
// generate Insert-Before-Box
if ($this->Mode == "insert" && $level != 0
&& LRightsManager::getRights($node->getParentNode()) & LPermissions::CREATE)
$rb = $this->genRadioButton($node->getPath());
$this->Controls[]= $prefix;
$this->Controls[]= "<br/>";
if (!$this->Page->IsPostBack)
// generate Current-Node-Box
if ($this->Mode != "select") # insert - mode
$string= ($node->getDescriptiveName()) ? $node->getDescriptiveName() : $node->getAlias();
$this->Controls[]= $prefix . "<b>". $string. "</b> ($level)";
$this->Controls[]= "<br/>";
$rb = $this->genRadioButton($node->getPath());
$this->Controls[]= $prefix;
if (LRightsManager::getRights($node) & LPermissions::EDIT)
$this->Controls[]= "<b>". TPropertyValue :: ensureString($node->getDescriptiveName()). "</b>";
$this->Controls[]= " (" . $node->getAlias() . ")";
$this->Controls[]= "<br/>";
if (!$this->Page->IsPostBack)
$subnode= $node->getFirstChildNode();
if (!$subnode && $this->Mode == "insert"
&& LRightsManager::getRights($node) & LPermissions::CREATE)
// generate Node-Child-Insertion-Box
$rb = $this->genRadioButton($node->getPath() . ".1");
$this->Controls[]= $otherprefix . " +--";
$this->Controls[]= "<br/>";
// walk through child nodes
$this->genTree($subnode, $level + 1, $isf);
$subnode= $subnode->getSiblingNode();
// generate Insert-After-Box
if ($this->Mode == "insert" && $level != 0
&& LRightsManager::getRights($node->getParentNode()) & LPermissions::CREATE)
$parr= explode(".", $node->getPath());
$parr[count($parr) - 1]++ ;
if (!$node->getSiblingNode())
$prefix[strlen($prefix) - 3]= "+";
$rb = $this->genRadioButton($p);
$this->Controls[]= $prefix;
$this->Controls[]= "<br/>";
if (!$this->Page->IsPostBack)
$np = $sender->CustomData;
$this->onSelectionChanged($np);
|