openrat-cms

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

commit 48e6bd317e3f0d05ebf827746c4ac85104433b52
parent e400d60d77c6ff33ce41c78b713528169a958dd9
Author: Jan Dankert <devnull@localhost>
Date:   Tue,  4 Dec 2018 23:11:33 +0100

Fix: Vorschau von Bildern und Texten.

Diffstat:
modules/cms-core/action/FileAction.class.php | 9+++------
modules/cms-core/action/ImageAction.class.php | 12++++++++++++
modules/cms-core/action/TextAction.class.php | 16++++++++++++++--
modules/cms-core/model/File.class.php | 2+-
modules/cms-core/model/Text.class.php | 7++++++-
modules/cms-ui/themes/default/html/views/file/edit.php | 2+-
modules/cms-ui/themes/default/html/views/file/info.php | 16++++++++--------
modules/cms-ui/themes/default/html/views/folder/createtext.php | 12++++++------
modules/cms-ui/themes/default/html/views/folder/edit.php | 2+-
modules/cms-ui/themes/default/html/views/folder/preview.php | 4++--
modules/cms-ui/themes/default/html/views/image/show.tpl.src.xml | 24+++++++++++++++++++++---
modules/cms-ui/themes/default/html/views/profile/history.php | 10+++++-----
modules/cms-ui/themes/default/html/views/text/preview.php | 6++++++
modules/cms-ui/themes/default/html/views/text/preview.tpl.src.xml | 17++++-------------
modules/cms-ui/themes/default/html/views/text/value.php | 2+-
modules/cms-ui/themes/default/html/views/url/info.php | 8++++----
16 files changed, 95 insertions(+), 54 deletions(-)

diff --git a/modules/cms-core/action/FileAction.class.php b/modules/cms-core/action/FileAction.class.php @@ -108,11 +108,8 @@ class FileAction extends ObjectAction */ function previewView() { - $url = Html::url('file','show',$this->file->objectid,array('target'=>'none',REQ_PARAM_EMBED=>'1') ); + $url = Html::url($this->file->getType(),'show',$this->file->objectid,array('target'=>'none',REQ_PARAM_EMBED=>'1') ); $this->setTemplateVar('preview_url',$url ); - - $this->setTemplateVar('image',$this->file->isImage() ); - } @@ -140,7 +137,7 @@ class FileAction extends ObjectAction if ( !empty($mime_types[$ext]) ) $mime_type = $mime_types[$ext]; else - // Wenn kein Mime-Type gefunden, dann Standartwert setzen + // Wenn kein Mime-Type gefunden, dann Standardwert setzen $mime_type = OR_FILE_DEFAULT_MIMETYPE; header('Content-Type: '.$mime_type ); @@ -160,7 +157,7 @@ class FileAction extends ObjectAction // - Dateiname wird benutzt, wenn der Browser das Bild speichern moechte header('Content-Disposition: inline; filename='.$this->file->filename() ); header('Content-Transfer-Encoding: binary' ); - header('Content-Description: '.$this->file->name ); + header('Content-Description: '.$this->file->filename() ); $this->file->write(); // Bild aus Datenbank laden diff --git a/modules/cms-core/action/ImageAction.class.php b/modules/cms-core/action/ImageAction.class.php @@ -205,4 +205,16 @@ class ImageAction extends FileAction } + /** + * Anzeigen des Inhaltes, der Inhalt wird samt Header direkt + * auf die Standardausgabe geschrieben + */ + public function previewView() + { + parent::previewView(); + } + + + + } diff --git a/modules/cms-core/action/TextAction.class.php b/modules/cms-core/action/TextAction.class.php @@ -56,9 +56,9 @@ namespace cms\action $this->text = new Text($this->getRequestId()); $this->text->load(); - $this->file = $this->text; - parent::init(); + + $this->file = $this->text; } @@ -135,5 +135,17 @@ namespace cms\action { parent::valueView(); } + + + public function showView() { + $this->file = $this->text; + + parent::showView(); + } + + public function previewView() + { + parent::previewView(); + } } } diff --git a/modules/cms-core/model/File.class.php b/modules/cms-core/model/File.class.php @@ -205,7 +205,7 @@ class File extends BaseObject * * @return String Mime-Type */ - function mimeType() + public function mimeType() { if ( !empty( $this->mime_type ) ) return $this->mime_type; diff --git a/modules/cms-core/model/Text.class.php b/modules/cms-core/model/Text.class.php @@ -31,7 +31,7 @@ class Text extends File * * @param string $objectid */ - function __construct( $objectid='' ) + public function __construct( $objectid='' ) { parent::__construct( $objectid ); @@ -40,6 +40,11 @@ class Text extends File $this->isFile = false; } + + public function mimeType() + { + return 'text/plain'; + } } ?> \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/file/edit.php b/modules/cms-ui/themes/default/html/views/file/edit.php @@ -9,7 +9,7 @@ <div class="input"> <br/> - <input size="40" id="req1543956683823043572_file" type="file" name="file" class="upload" /> + <input size="40" id="req15439595401367999399_file" type="file" name="file" class="upload" /> <br/> diff --git a/modules/cms-ui/themes/default/html/views/file/info.php b/modules/cms-ui/themes/default/html/views/file/info.php @@ -110,7 +110,7 @@ <br/> - <imgsrc="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($cache_filemtime) ?> @@ -130,7 +130,7 @@ <tr> <td> <a target="_self" data-url="<?php echo $url ?>" data-action="" data-method="info" data-id="<?php echo OR_ID ?>" data-extra="[]" href="<?php echo Html::url('','','',array()) ?>"> - <imgsrc="./modules/cms-ui/themes/default/images/icon_page.png" /> + <img src="./modules/cms-ui/themes/default/images/icon_page.png" /> <span><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span> @@ -154,13 +154,13 @@ </div> <div class="input"> - <imgsrc="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($create_date) ?> <br/> - <imgsrc="./modules/cms-ui/themes/default/images/icon/user.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/user.png" /> <?php include_once( 'modules/template-engine/components/html/user/component-user.php') ?><?php component_user($create_user) ?> @@ -172,13 +172,13 @@ </div> <div class="input"> - <imgsrc="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($lastchange_date) ?> <br/> - <imgsrc="./modules/cms-ui/themes/default/images/icon/user.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/user.png" /> <?php include_once( 'modules/template-engine/components/html/user/component-user.php') ?><?php component_user($lastchange_user) ?> @@ -192,13 +192,13 @@ </label> </div> <div class="input"> - <imgsrc="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($published_date) ?> <br/> - <imgsrc="./modules/cms-ui/themes/default/images/icon/user.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/user.png" /> <?php include_once( 'modules/template-engine/components/html/user/component-user.php') ?><?php component_user($published_user) ?> diff --git a/modules/cms-ui/themes/default/html/views/folder/createtext.php b/modules/cms-ui/themes/default/html/views/folder/createtext.php @@ -6,12 +6,12 @@ <div class="line"> <div class="label"> <label for="<?php echo REQUEST_ID ?>_name" class="label"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('global_FILE')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang('global_FILE')))); ?></span> </label> </div> <div class="input"> - <input size="40" id="req1543446099710444863_file" type="file" maxlength="<?php echo $maxlength ?>" name="file" class="upload" multiple="multiple" /> + <input size="40" id="req15439584921105687493_file" type="file" maxlength="<?php echo $maxlength ?>" name="file" class="upload" multiple="multiple" /> </div> </div> @@ -27,13 +27,13 @@ </div> <div class="input"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities($max_size))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities($max_size))); ?></span> </div> </div> <div class="line"> <div class="label"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'HTTP_URL'.'')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'HTTP_URL'.'')))); ?></span> </div> <div class="input"> @@ -45,7 +45,7 @@ </div></fieldset> <div class="line"> <div class="label"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('global_NAME')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang('global_NAME')))); ?></span> </div> <div class="input"> @@ -55,7 +55,7 @@ </div> <div class="line"> <div class="label"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('global_DESCRIPTION')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang('global_DESCRIPTION')))); ?></span> </div> <div class="input"> diff --git a/modules/cms-ui/themes/default/html/views/folder/edit.php b/modules/cms-ui/themes/default/html/views/folder/edit.php @@ -57,7 +57,7 @@ <td class="clickable"> <label for="<?php echo REQUEST_ID ?>_<?php echo $id ?>" class="label"> <a target="_self" date-name="<?php echo $name ?>" name="<?php echo $name ?>" data-type="open" data-action="<?php echo $type ?>" data-method="edit" data-id="<?php echo $objectid ?>" data-extra="[]" href="<?php echo Html::url($type,'',$objectid,array()) ?>"> - <imgsrc="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> + <img src="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> <span><?php echo nl2br(encodeHtml(htmlentities(Text::maxLength( $name,40,'..',constant('STR_PAD_BOTH') )))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/folder/preview.php b/modules/cms-ui/themes/default/html/views/folder/preview.php @@ -18,7 +18,7 @@ <?php $if3=(isset($up_url)); if($if3){?> <tr class="data"> <td> - <imgsrc="./modules/cms-ui/themes/default/images/icon_folder_up.png" /> + <img src="./modules/cms-ui/themes/default/images/icon_folder_up.png" /> <span><?php echo nl2br('..'); ?></span> @@ -33,7 +33,7 @@ <tr class="data"> <td class="clickable"> <a title="<?php echo $desc ?>" target="_self" date-name="<?php echo $name ?>" name="<?php echo $name ?>" data-type="open" data-action="<?php echo $type ?>" data-method="preview" data-id="<?php echo $id ?>" data-extra="[]" href="<?php echo Html::url($type,'',$id,array()) ?>"> - <imgsrc="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> + <img src="./modules/cms-ui/themes/default/images/icon_<?php echo $icon ?>.png" /> <span><?php echo nl2br(encodeHtml(htmlentities($name))); ?></span> diff --git a/modules/cms-ui/themes/default/html/views/image/show.tpl.src.xml b/modules/cms-ui/themes/default/html/views/image/show.tpl.src.xml @@ -1,3 +1,21 @@ <output xmlns="http://www.openrat.de/template" - xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"><dummy><window icon="folder"><row><column colspan="2"><insert url="var:preview_url"></insert><link class="action" action="file" subaction="edit"><image file="icon/edit"></image><text key="menu_file_edit"></text></link><link class="action" action="file" subaction="editvalue"><image file="icon/editvalue"></image><text key="menu_file_editvalue"></text></link></column></row></window></dummy></output>- \ No newline at end of file + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> + <dummy> + <window icon="folder"> + <row> + <column colspan="2"> + <insert url="var:preview_url"></insert> + <link class="action" action="file" subaction="edit"> + <image file="icon/edit"></image> + <text key="menu_file_edit"></text> + </link> + <link class="action" action="file" subaction="editvalue"> + <image file="icon/editvalue"></image> + <text key="menu_file_editvalue"></text> + </link> + </column> + </row> + </window> + </dummy> +</output>+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/profile/history.php b/modules/cms-ui/themes/default/html/views/profile/history.php @@ -3,15 +3,15 @@ <div class="table-wrapper"><div class="table-filter"><input type="search" name="filter" placeholder="<?php echo lang('SEARCH_FILTER') ?>" /></div><table width="100%"></div> <tr class="headline"> <td> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'project'.'')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'project'.'')))); ?></span> </td> <td> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'filename'.'')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'filename'.'')))); ?></span> </td> <td> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang(''.'lastchange'.'')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang(''.'lastchange'.'')))); ?></span> </td> </tr> @@ -19,14 +19,14 @@ <tr class="data"> <td class="clickable"> <a target="_self" data-type="open" data-action="project" data-method="history" data-id="<?php echo $projectid ?>" data-extra="[]" href="<?php echo Html::url('project','',$projectid,array()) ?>"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities($projectname))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities($projectname))); ?></span> </a> </td> <td title="<?php echo $filename ?>" class="clickable"> <a target="_self" data-type="open" data-action="<?php echo $type ?>" data-method="history" data-id="<?php echo $objectid ?>" data-extra="[]" href="<?php echo Html::url($type,'',$objectid,array()) ?>"> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(Text::maxLength( $filename,30,'..',constant('STR_PAD_BOTH') )))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(Text::maxLength( $filename,30,'..',constant('STR_PAD_BOTH') )))); ?></span> </a> diff --git a/modules/cms-ui/themes/default/html/views/text/preview.php b/modules/cms-ui/themes/default/html/views/text/preview.php @@ -0,0 +1,5 @@ + + + <iframe src="<?php echo $preview_url ?>"></iframe> + + + \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/text/preview.tpl.src.xml b/modules/cms-ui/themes/default/html/views/text/preview.tpl.src.xml @@ -1,14 +1,5 @@ <output xmlns="http://www.openrat.de/template" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" - xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> + xsi:schemaLocation="http://www.openrat.de/template ../../../../../../template-engine/components/template.xsd"> - <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 + <insert url="var:preview_url"></insert> +</output>+ \ No newline at end of file diff --git a/modules/cms-ui/themes/default/html/views/text/value.php b/modules/cms-ui/themes/default/html/views/text/value.php @@ -3,7 +3,7 @@ <form name="" target="_self" data-target="view" action="./" data-method="value" data-action="text" data-id="<?php echo OR_ID ?>" method="POST" enctype="application/x-www-form-urlencoded" class="or-form text" data-async="" data-autosave=""><input type="hidden" name="<?php echo REQ_PARAM_EMBED ?>" value="1" /><input type="hidden" name="<?php echo REQ_PARAM_TOKEN ?>" value="<?php echo token() ?>" /><input type="hidden" name="<?php echo REQ_PARAM_ACTION ?>" value="text" /><input type="hidden" name="<?php echo REQ_PARAM_SUBACTION ?>" value="value" /><input type="hidden" name="<?php echo REQ_PARAM_ID ?>" value="<?php echo OR_ID ?>" /> <tr> <td> - <span class="text"><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_VALUE')))); ?></span> + <span><?php echo nl2br(encodeHtml(htmlentities(lang('GLOBAL_VALUE')))); ?></span> </td> <td> diff --git a/modules/cms-ui/themes/default/html/views/url/info.php b/modules/cms-ui/themes/default/html/views/url/info.php @@ -46,13 +46,13 @@ </label> </div> <div class="input"> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($create_date) ?> <br/> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/user.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/user.png" /> <?php include_once( 'modules/template-engine/components/html/user/component-user.php') ?><?php component_user($create_user) ?> @@ -66,13 +66,13 @@ </label> </div> <div class="input"> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/el_date.png" /> <?php include_once( 'modules/template-engine/components/html/date/component-date.php') ?><?php component_date($lastchange_date) ?> <br/> - <img class="" title="" src="./modules/cms-ui/themes/default/images/icon/user.png" /> + <img src="./modules/cms-ui/themes/default/images/icon/user.png" /> <?php include_once( 'modules/template-engine/components/html/user/component-user.php') ?><?php component_user($lastchange_user) ?>