Source for file Administration.php
Documentation is available at Administration.php
* @license http://opensource.org/licenses/mozilla1.1.php Mozilla Public License
* @copyright 2005, diemeisterei GmbH. All rights reserved.
* @author $Author: schmunk $
* @version $Revision: 601 $ $Date: 2007-02-24 23:49:30 +0100 (Sa, 24 Feb 2007) $
* @package Phundament.Packages
* @subpackage LVirtualNodes
* Displays LVirtualNodes configuration options (sitemap)
* @subpackage LVirtualNodes
const DEFAULT_TAB = "ModifyPage";
public function getActiveTab()
return $this->getViewState("ActiveTab", self::DEFAULT_TAB);
public function setActiveTab($value)
$this->MView->ActiveView = $this->$value;
$this->setViewState("ActiveTab", $value, self::DEFAULT_TAB);
public function getTabCssClass($tab)
return $tab == $this->ActiveTab ? "TabButtonActive" : "TabButton";
public function changeView($sender, $param)
$vname = $param->CommandParameter;
$this->ActiveTab = $vname;
public function existingNodeSelected($sender, $param)
$this->SNParamsExisting->NodePath = $param;
public function newNodeSelected($sender, $param)
$this->SNParamsNew->NodePath = $param;
public function nodeAdminNeedsReload($sender, $param)
if ($at != self::DEFAULT_TAB) $param["ActiveTab"] = $at;
$url = $this->Service->constructUrl($this->Service->getRequestedPagePath(), $param);
$this->Response->redirect($url);
public function onInit($param)
$value = self::DEFAULT_TAB;
$this->MView->ActiveView = $this->$value;
public function onLoad($param)
if (!$this->IsPostBack && $this->Request->contains("ActiveTab"))
$this->ActiveTab = $this->Request->itemAt("ActiveTab");
function updateCachingTime($sender, $param)
$this->Application->Cache->flush();
$time = TPropertyValue :: ensureInteger($sender->getText());
$this->Application->setGlobalState("LVirtualNodes:cachingTime", $time);
function checkVirtualNodes()
if ($this->Off->Checked || $this->Application->Service->areNodesAvailable() === false)
$this->Application->setGlobalState("LVirtualNodes:available", false);
$this->Application->setGlobalState("LVirtualNodes:available", true);
public function movePage($sender, $param)
$src = $this->SNSelectMoveSrc->SelectedValue;
$dst = $this->SNSelectMoveDest->SelectedValue;
Prado :: log("Trying to move page from $src to $dst...", TLogger::NOTICE, "Lithron.LVirtualNodes");
Prado :: log("Cannot move page onto any of it's children!", TLogger::ERROR, "Lithron.LVirtualNodes");
$conn = $this->Application->getModule("database")->getConnection("l_virtual_nodes", "propel");
// find srcnode and it's parent
$nsrc = $this->Service->getNodes();
for ($i = 1; $i < count($sp); $i++ )
$nsrc = $nsrc->getChildNodeAt($sp[$i]);
$psrc = $nsrc->getParentNode();
$srcIndex = $nsrc->getNodeIndex();
$pdst = $this->Service->getNodes();
for ($i = 1; $i < count($dp)- 1; $i++ )
$pdst = $pdst->getChildNodeAt($dp[$i]);
$dstIndex = $dp[count($dp)- 1];
// if level is the same, and dst is behind src, we need to subtract one
if (count($sp) == count($dp) && $dstIndex > $srcIndex)
// detach src node from in-memory tree
$psrc->detachChildNode($nsrc);
// move src to fake root node "2"
LVirtualNodesSiteNodePeer::moveNodeSubTree($src, "2", $conn);
// shift src's following siblings up
$psrc->shiftChildNodes(- 1, $srcIndex+ 1, $conn);
// dst position may need to be updated
$dst = $pdst->getNodePath(). ".". $dstIndex;
//create space at dst's position
$pdst->shiftChildNodes(1, $dstIndex, $conn);
// move fake root node "2" in place
LVirtualNodesSiteNodePeer::moveNodeSubTree("2", $dst, $conn);
// adjust node-path of (in-memory) moved subtree objects
$nsrc->adjustNodePath($src, $dst);
// attach src to in-memory tree again
$pdst->attachChildNode($nsrc);
$this->nodeAdminNeedsReload($this, array());
|