commit 33ff67e2fe3dac407cfb499b2550d7377ffcc046
parent 553b5f4c9642201ef73409c084f51530bd4f916b
Author: Jan Dankert <devnull@localhost>
Date: Mon, 15 Oct 2012 00:56:34 +0200
Vorschau für Ordner und Vorlagen.
Diffstat:
3 files changed, 131 insertions(+), 1 deletion(-)
diff --git a/action/FolderAction.class.php b/action/FolderAction.class.php
@@ -967,12 +967,82 @@ class FolderAction extends ObjectAction
$this->addNotice('folder',$this->folder->name,'NO_TEMPLATES_AVAILABLE',OR_NOTICE_WARN);
}
+
+ /**
+ * Anzeigen des Inhaltes, der Inhalt wird samt Header direkt
+ * auf die Standardausgabe geschrieben
+ */
+ private function previewViewUnused()
+ {
+ $this->setTemplateVar('preview_url',Html::url('folder','show',$this->folder->objectid,array('target'=>'none') ) );
+ }
+
+
+
+ /**
+ * Anzeige aller Objekte in diesem Ordner.
+ * @return unknown_type
+ */
+ public function previewView()
+ {
+ global $conf_php;
+
+ if ( ! $this->folder->isRoot )
+ $this->setTemplateVar('up_url',Html::url('folder','show',$this->folder->parentid));
+
+ $list = array();
+
+ // Schleife ueber alle Objekte in diesem Ordner
+ foreach( $this->folder->getObjects() as $o )
+ {
+ $id = $o->objectid;
+
+ if ( $o->hasRight(ACL_READ) )
+ {
+ $list[$id]['name'] = Text::maxLaenge( 30,$o->name );
+ $list[$id]['filename'] = Text::maxLaenge( 20,$o->filename );
+ $list[$id]['desc'] = Text::maxLaenge( 30,$o->desc );
+ if ( $list[$id]['desc'] == '' )
+ $list[$id]['desc'] = lang('NO_DESCRIPTION_AVAILABLE');
+ $list[$id]['desc'] = $list[$id]['desc'].' - '.lang('IMAGE').' '.$id;
+
+ $list[$id]['type'] = $o->getType();
+ $list[$id]['id' ] = $id;
+
+ $list[$id]['icon' ] = $o->getType();
+ $list[$id]['class'] = $o->getType();
+ $list[$id]['url' ] = Html::url($o->getType(),'',$id);
+
+ if ( $o->getType() == 'file' )
+ {
+ $file = new File( $id );
+ $file->load();
+ $list[$id]['desc'] .= ' - '.intval($file->size/1000).'kB';
+
+ if ( $file->isImage() )
+ {
+ $list[$id]['icon' ] = 'image';
+ $list[$id]['class'] = 'image';
+ //$list[$id]['url' ] = Html::url('file','show',$id) nur sinnvoll bei Lightbox-Anzeige
+ }
+// if ( substr($file->mimeType(),0,5) == 'text/' )
+// $list[$id]['icon'] = 'text';
+ }
+
+ $list[$id]['date'] = $o->lastchangeDate;
+ $list[$id]['user'] = $o->lastchangeUser;
+ }
+ }
+
+ $this->setTemplateVar('object' ,$list );
+ }
+
/**
* Anzeige aller Objekte in diesem Ordner.
* @return unknown_type
*/
- function showView()
+ function contentView()
{
global $conf_php;
diff --git a/action/TemplateAction.class.php b/action/TemplateAction.class.php
@@ -411,6 +411,18 @@ class TemplateAction extends Action
$this->setTemplateVar('type','text');
}
+
+
+ /**
+ * Anzeigen des Inhaltes, der Inhalt wird samt Header direkt
+ * auf die Standardausgabe geschrieben
+ */
+ function previewView()
+ {
+ $this->setTemplateVar('preview_url',Html::url('template','show',$this->template->templateid,array('target'=>'none') ) );
+ }
+
+
/**
diff --git a/themes/default/templates/folder/preview.tpl.src.xml b/themes/default/templates/folder/preview.tpl.src.xml
@@ -0,0 +1,47 @@
+<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">
+ <table>
+ <row class="headline">
+ <column class="help">
+ <text key="GLOBAL_TYPE"></text>
+ <text raw="_/_"></text>
+ <text key="GLOBAL_NAME"></text>
+ </column>
+ <column class="help">
+ <text key="GLOBAL_LASTCHANGE"></text>
+ </column>
+ </row>
+ <if present="up_url">
+ <row class="data">
+ <column url="var:up_url">
+ <image type="folder_up"></image>
+ <text raw=".."></text>
+ </column>
+ <column>
+ <text raw=""></text>
+ </column>
+ </row>
+ </if>
+ <list list="object" extract="true">
+ <row class="data">
+ <column id="var:id" name="var:name" action="var:type" title="var:desc"
+ class="var:class">
+ <image type="var:icon"></image>
+ <text var="name"></text>
+ <text raw="_"></text>
+ </column>
+ <column>
+ <date date="var:date"></date>
+ </column>
+ </row>
+ </list>
+ <if empty="object">
+ <row>
+ <column colspan="2">
+ <text text="GLOBAL_NOT_FOUND"></text>
+ </column>
+ </row>
+ </if>
+
+ </table>
+</output>
+\ No newline at end of file