commit 01d161c878c5c069503a8dd82b2fb0bc0ada80ce
parent c366e7af07800595aa0f7df9d9177bfb41ffda28
Author: Jan Dankert <devnull@localhost>
Date: Sun, 14 Oct 2012 23:24:57 +0200
Struktur von Seiten, Verknüpfungen und Dateien anzeigen.
Diffstat:
7 files changed, 213 insertions(+), 2 deletions(-)
diff --git a/action/FileAction.class.php b/action/FileAction.class.php
@@ -753,6 +753,64 @@ class FileAction extends ObjectAction
return true;
}
}
+
+
+
+ /**
+ * Liefert die Struktur zu diesem Ordner:
+ * - Mit den übergeordneten Ordnern und
+ * - den in diesem Ordner enthaltenen Objekten
+ *
+ * Beispiel:
+ * <pre>
+ * - A
+ * - B
+ * - C (dieser Ordner)
+ * - Unterordner
+ * - Seite
+ * - Seite
+ * - Datei
+ * </pre>
+ */
+ public function structureView()
+ {
+
+ $structure = array();
+ $tmp = &$structure;
+ $nr = 0;
+
+ $folder = new Folder( $this->file->parentid );
+ $parents = $folder->parentObjectNames(false,true);
+
+ foreach( $parents as $id=>$name)
+ {
+ unset($children);
+ unset($o);
+ $children = array();
+ $o = array('id'=>$id,'name'=>$name,'type'=>'folder','level'=>++$nr,'children'=>&$children);
+
+ $tmp[$id] = &$o;;
+
+ unset($tmp);
+
+ $tmp = &$children;
+ }
+
+
+
+ unset($children);
+ unset($id);
+ unset($name);
+
+ $elementChildren = array();
+
+ $tmp[ $this->file->objectid ] = array('id'=>$this->file->objectid,'name'=>$this->file->name,'type'=>'file','self'=>true,'children'=>&$elementChildren);
+
+
+ //Html::debug($structure);
+
+ $this->setTemplateVar('outline',$structure);
+ }
}
?>
\ No newline at end of file
diff --git a/action/LinkAction.class.php b/action/LinkAction.class.php
@@ -200,4 +200,63 @@ class LinkAction extends ObjectAction
{
$this->setTemplateVars( $this->link->getProperties() );
}
+
+
+ /**
+ * Liefert die Struktur zu diesem Ordner:
+ * - Mit den übergeordneten Ordnern und
+ * - den in diesem Ordner enthaltenen Objekten
+ *
+ * Beispiel:
+ * <pre>
+ * - A
+ * - B
+ * - C (dieser Ordner)
+ * - Unterordner
+ * - Seite
+ * - Seite
+ * - Datei
+ * </pre>
+ */
+ public function structureView()
+ {
+
+ $structure = array();
+ $tmp = &$structure;
+ $nr = 0;
+
+ $folder = new Folder( $this->link->parentid );
+ $parents = $folder->parentObjectNames(false,true);
+
+ foreach( $parents as $id=>$name)
+ {
+ unset($children);
+ unset($o);
+ $children = array();
+ $o = array('id'=>$id,'name'=>$name,'type'=>'folder','level'=>++$nr,'children'=>&$children);
+
+ $tmp[$id] = &$o;;
+
+ unset($tmp);
+
+ $tmp = &$children;
+ }
+
+
+
+ unset($children);
+ unset($id);
+ unset($name);
+
+ $elementChildren = array();
+
+ $tmp[ $this->link->objectid ] = array('id'=>$this->link->objectid,'name'=>$this->link->name,'type'=>'link','self'=>true,'children'=>&$elementChildren);
+
+ //
+ //$elementChildren[$id] = array('id'=>$this->page->objectid.'_'.$id,'name'=>$name,'type'=>'pageelement','children'=>array() );
+
+ //Html::debug($structure);
+
+ $this->setTemplateVar('outline',$structure);
+ }
}
\ No newline at end of file
diff --git a/action/PageAction.class.php b/action/PageAction.class.php
@@ -838,6 +838,73 @@ class PageAction extends ObjectAction
}
}
+
+ /**
+ * Liefert die Struktur zu diesem Ordner:
+ * - Mit den übergeordneten Ordnern und
+ * - den in diesem Ordner enthaltenen Objekten
+ *
+ * Beispiel:
+ * <pre>
+ * - A
+ * - B
+ * - C (dieser Ordner)
+ * - Unterordner
+ * - Seite
+ * - Seite
+ * - Datei
+ * </pre>
+ */
+ public function structureView()
+ {
+
+ $structure = array();
+ $tmp = &$structure;
+ $nr = 0;
+
+ $folder = new Folder( $this->page->parentid );
+ $parents = $folder->parentObjectNames(false,true);
+
+ foreach( $parents as $id=>$name)
+ {
+ unset($children);
+ unset($o);
+ $children = array();
+ $o = array('id'=>$id,'name'=>$name,'type'=>'folder','level'=>++$nr,'children'=>&$children);
+
+ $tmp[$id] = &$o;;
+
+ unset($tmp);
+
+ $tmp = &$children;
+ }
+
+
+
+ unset($children);
+ unset($id);
+ unset($name);
+
+ $elementChildren = array();
+
+ $tmp[ $this->page->objectid ] = array('id'=>$this->page->objectid,'name'=>$this->page->name,'type'=>'page','self'=>true,'children'=>&$elementChildren);
+
+ $template = new Template( $this->page->templateid );
+ $elements = $template->getElementNames();
+
+ foreach( $elements as $id=>$name )
+ {
+ $elementChildren[$id] = array('id'=>$this->page->objectid.'_'.$id,'name'=>$name,'type'=>'pageelement','children'=>array() );
+ }
+
+ //Html::debug($structure);
+
+ $this->setTemplateVar('outline',$structure);
+ }
+
+
+
+
}
?>
\ No newline at end of file
diff --git a/themes/default/include/html/tree.inc.php b/themes/default/include/html/tree.inc.php
@@ -1,10 +1,13 @@
<?php showList($attr_tree);
-function showList( &$contents )
+function showList( $contents )
{
+ //Html::debug($contents,'contents');
+
echo '<ul class="tree">';
foreach( $contents as $key=>$el) {
+ //Html::debug($el['name'],'Name');
$selected = isset($el['self']);
if ($selected )
echo '<li class="">';
@@ -12,7 +15,7 @@ function showList( &$contents )
echo '<li>';
echo '<div class="tree" />';
- echo '<div class="entry '.($selected?' selected':'').'" onclick="javascript:openNewAction( \''.$el['name'].'\',\''.$el['type'].'\','.$el['id'].',0 );">';
+ echo '<div class="entry '.($selected?' selected':'').'" onclick="javascript:openNewAction( \''.$el['name'].'\',\''.$el['type'].'\',\''.$el['id'].'\',0 );">';
//Html::debug($el);
echo '<img src="'.OR_THEMES_EXT_DIR.'default/images/icon_'.$el['type'].'.png" />';
echo $el['name'];
diff --git a/themes/default/templates/file/structure.tpl.src.xml b/themes/default/templates/file/structure.tpl.src.xml
@@ -0,0 +1,7 @@
+<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.openrat.de/template ../template.xsd">
+ <part class="structure tree">
+ <tree tree="var:outline"></tree>
+ </part>
+
+</output>
+\ No newline at end of file
diff --git a/themes/default/templates/link/structure.tpl.src.xml b/themes/default/templates/link/structure.tpl.src.xml
@@ -0,0 +1,7 @@
+<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.openrat.de/template ../template.xsd">
+ <part class="structure tree">
+ <tree tree="var:outline"></tree>
+ </part>
+
+</output>
+\ No newline at end of file
diff --git a/themes/default/templates/page/structure.tpl.src.xml b/themes/default/templates/page/structure.tpl.src.xml
@@ -0,0 +1,7 @@
+<output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.openrat.de/template ../template.xsd">
+ <part class="structure tree">
+ <tree tree="var:outline"></tree>
+ </part>
+
+</output>
+\ No newline at end of file