commit 594dc6069ee4647fe5bfa27eddcdb7aade1ee9c7
parent c1bfd7f92721f65a009e072ebe57619c76e897e0
Author: dankert <devnull@localhost>
Date: Fri, 8 Oct 2010 00:23:04 +0200
Aktualisieren des Baumes; Öffnen aller Teilbäume im Baum.
Diffstat:
5 files changed, 84 insertions(+), 1 deletion(-)
diff --git a/actionClasses/TreeAction.class.php b/actionClasses/TreeAction.class.php
@@ -85,6 +85,21 @@ class TreeAction extends Action
*/
function openall()
{
+ $this->tree = Session::getTree();
+ $this->tree->all();
+ Session::setTree( $this->tree );
+
+ $this->callSubAction('show');
+ }
+
+
+ function refresh()
+ {
+ $this->tree = Session::getTree();
+ $this->tree->refresh();
+ Session::setTree( $this->tree );
+
+ $this->callSubAction('show');
}
diff --git a/actionClasses/TreeAction.ini.php b/actionClasses/TreeAction.ini.php
@@ -7,8 +7,14 @@ goto=show
[load]
goto=show
+[openall]
+goto=show
+
[open]
goto=show
+[refresh]
+goto=show
+
[close]
goto=show
\ No newline at end of file
diff --git a/serviceClasses/AbstractTree.class.php b/serviceClasses/AbstractTree.class.php
@@ -37,6 +37,8 @@ class AbstractTree
var $autoOpen = array(0,1);
+ var $opened = array();
+
/**
* Hoechste Element-Id
* @type Integer
@@ -60,13 +62,57 @@ class AbstractTree
$this->open($openId);
}
+ function refresh() {
+
+ $this->elements = array();
+
+ // Wurzel-Element laden
+ $this->root();
+ $this->elements[0] = $this->tempElements[0];
+ $this->tempElements = array();
+ $this->maxId = 0;
+
+ $oids = $this->opened;
+ $this->opened = array();
+ foreach( $oids as $oid)
+ {
+ if ( isset($this->elements[$oid]) )
+ $this->open($oid);
+ }
+ }
+
+
+
+ function all() {
+
+ $this->elements = array();
+ $this->opened = array();
+
+ // Wurzel-Element laden
+ $this->root();
+ $this->elements[0] = $this->tempElements[0];
+ $this->tempElements = array();
+ $this->maxId = 0;
+
+ for( $eid=0;isset($this->elements[$eid]); $eid++)
+ {
+ $this->open($eid);
+ }
+ }
+
+
/**
* Oeffnen eines Teilbaumes. Es wird der eindeutige Name des zu oeffnenden Teilbaumes als
* Parameter uebergeben
* @param elementName der Name des Elementes, welches zu oeffnen ist
*/
function open( $elementId )
- {
+ {
+ $k = array_search($elementId,$this->opened);
+ if ( $k !== false )
+ return; // Ist schon offen. Evtl. Reload gedrückt?
+
+ $this->opened[] = $elementId;
$funcName = $this->elements[$elementId]->type;
if ( empty($funcName) )
return;
@@ -102,6 +148,10 @@ class AbstractTree
function close( $elementId )
{
$this->elements[$elementId]->subElementIds = array();
+
+ $k = array_search($elementId,$this->opened);
+ if ( $k !== false )
+ unset($this->opened[$k]);
}
diff --git a/serviceClasses/AdministrationTree.class.php b/serviceClasses/AdministrationTree.class.php
@@ -335,6 +335,9 @@ class AdministrationTree extends AbstractTree
}
else
$tmpConf = $this->confCache[$id];
+
+ if ( !is_array($tmpConf) )
+ $tmpConf = array('unknown');
foreach( $tmpConf as $key=>$value )
{
diff --git a/themes/default/templates/tree/show.tpl.src.php b/themes/default/templates/tree/show.tpl.src.php
@@ -22,5 +22,14 @@ page class:tree
else
image icon:var:icon
text var:text maxlength:20 cut:right title:var:desc
+ if not: present:image
+ text raw:__
+ link action:tree subaction:refresh
+ text key:refresh
+ //image icon:refresh align:left
+ text raw:__
+ link action:tree subaction:openall
+ text key:all
+ //image icon:openall align:left
set var:url
set var:image