openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4974a294cbb86911f6063272289b269fdca244bd
parent 732f533666f1fafb347e56e1bb9572de521389da
Author: Jan Dankert <devnull@localhost>
Date:   Wed, 31 Oct 2012 19:40:15 +0100

In der Vorschau nur Bilder anzeigen. Alles andere ist über einen Button in einem neuen Fenster darstellbar.

Diffstat:
action/FileAction.class.php | 7++++++-
themes/default/templates/file/preview.tpl.src.xml | 12+++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/action/FileAction.class.php b/action/FileAction.class.php @@ -99,7 +99,12 @@ class FileAction extends ObjectAction */ function previewView() { - $this->setTemplateVar('preview_url',Html::url('file','show',$this->file->objectid,array('target'=>'none') ) ); + $url = Html::url('file','show',$this->file->objectid,array('target'=>'none') ); + $this->setTemplateVar('preview_url',$url ); + + $isImage = substr($this->file->mimeType(),0,6) == 'image/'; + $this->setTemplateVar('image',$isImage ); + } diff --git a/themes/default/templates/file/preview.tpl.src.xml b/themes/default/templates/file/preview.tpl.src.xml @@ -1,4 +1,14 @@ <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"> - <insert url="var:preview_url"></insert> + + <if true="var:image"> + <insert url="var:preview_url"></insert> + </if> + <else> + <part class="clickable"> + <link type="popup" url="var:preview_url" class="action"> + <text key="LINK_OPEN_IN_NEW_WINDOW" /> + </link> + </part> + </else> </output> \ No newline at end of file