openrat-cms

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

commit c824052df0caaa7cef5542458b2618e2d104c549
parent 39fd717b0851d9c0d177c563c7a9c3b65026f39c
Author: dankert <openrat@jandankert.de>
Date:   Mon,  6 Dec 2021 01:00:00 +0100

New: Show a version from file history; New: Text history.

Diffstat:
Mmodules/cms/action/file/FileShowAction.class.php | 27+++++++++++++++++++++------
Mmodules/cms/action/image/ImagePreviewAction.class.php | 22++++++++++++++++++++--
Mmodules/cms/action/pageelement/PageelementDiffAction.class.php | 4++--
Mmodules/cms/action/text/TextDiffAction.class.php | 18++++++++----------
Mmodules/cms/action/text/TextValueAction.class.php | 3++-
Mmodules/cms/generator/FileContext.class.php | 3++-
Amodules/cms/generator/FileHistoryContext.class.php | 50++++++++++++++++++++++++++++++++++++++++++++++++++
Amodules/cms/generator/FileHistoryGenerator.class.php | 133+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mmodules/cms/model/File.class.php | 17+++++++----------
Mmodules/cms/ui/themes/default/html/views/image/history.php | 11+++--------
Mmodules/cms/ui/themes/default/html/views/image/history.tpl.src.xml | 11+++--------
Mmodules/cms/ui/themes/default/html/views/text/history.php | 175+++++++++++++++++++++++++++++++++++++------------------------------------------
Mmodules/cms/ui/themes/default/html/views/text/history.tpl.src.xml | 166+++++++++++++++++++++++++++++++++++++------------------------------------------
Mmodules/cms/ui/themes/default/html/views/text/value.php | 43++++++++++++++++++++++++++++++++++++-------
Mmodules/cms/ui/themes/default/html/views/text/value.tpl.src.xml | 13+++++++++++--
15 files changed, 458 insertions(+), 238 deletions(-)

diff --git a/modules/cms/action/file/FileShowAction.class.php b/modules/cms/action/file/FileShowAction.class.php @@ -5,16 +5,33 @@ use cms\action\Method; use cms\base\Configuration; use cms\generator\FileContext; use cms\generator\FileGenerator; +use cms\generator\FileHistoryContext; +use cms\generator\FileHistoryGenerator; use cms\generator\Producer; use cms\model\File; +use cms\model\Value; +use util\exception\SecurityException; class FileShowAction extends FileAction implements Method { public function view() { - $fileContext = new FileContext($this->file->objectid, Producer::SCHEME_PREVIEW ); - $generator = new FileGenerator( $fileContext); + $valueId = $this->request->getNumber('valueid'); + + if ( $valueId ) { + $value = new Value(); + $value->loadWithId( $valueId ); + if ( $value->contentid != $this->file->contentid ) + throw new SecurityException('Content-Id does not match'); + + $fileHistoryContext = new FileHistoryContext($this->file->objectid, $valueId ); + $generator = new FileHistoryGenerator( $fileHistoryContext ); + } else { + $fileContext = new FileContext($this->file->objectid, Producer::SCHEME_PREVIEW ); + $generator = new FileGenerator( $fileContext ); + } + $this->lastModified( $this->file->lastchangeDate ); @@ -42,14 +59,12 @@ class FileShowAction extends FileAction implements Method { header('X-File-Id: ' .$this->file->fileid ); header('X-Id: ' .$this->file->objectid ); - // Angabe Content-Disposition - // - Bild soll "inline" gezeigt werden - // - Dateiname wird benutzt, wenn der Browser das Bild speichern moechte + // Image should be displayed inline. + // Filename is used if the user agent is saving the file. header('Content-Disposition: inline; filename='.$this->file->filename() ); header('Content-Transfer-Encoding: binary' ); header('Content-Description: '.$this->file->filename() ); - //$this->file->write(); // Bild aus Datenbank laden // Groesse des Bildes in Bytes // Der Browser hat so die Moeglichkeit, einen Fortschrittsbalken zu zeigen diff --git a/modules/cms/action/image/ImagePreviewAction.class.php b/modules/cms/action/image/ImagePreviewAction.class.php @@ -2,13 +2,31 @@ namespace cms\action\image; use cms\action\ImageAction; use cms\action\Method; +use cms\model\Value; +use util\exception\SecurityException; use util\Html; class ImagePreviewAction extends ImageAction implements Method { + public function view() { - $this->setTemplateVar('url', Html::url('image','show',$this->image->objectid ) ); + $params = []; + + $valueid = $this->request->getNumber('valueid'); + + if ( $valueid ) { + + $value = new Value(); + $value->loadWithId( $valueid ); + if ( $value->contentid != $this->image->contentid ) + throw new SecurityException('content '.$value->contentid.' does not belong to this file which has content-id '.$this->image->contentid); + + $params[ 'valueid' ] = $valueid; + $this->setTemplateVar('lastchange_date', $value->lastchangeTimeStamp); + }else { + $this->setTemplateVar('lastchange_date', $this->image->lastchangeDate); + } - //parent::previewView(); + $this->setTemplateVar('url', Html::url('image','show',$this->image->objectid,$params ) ); } diff --git a/modules/cms/action/pageelement/PageelementDiffAction.class.php b/modules/cms/action/pageelement/PageelementDiffAction.class.php @@ -22,8 +22,8 @@ class PageelementDiffAction extends PageelementAction implements Method { if ( $value1id > $value2id ) list($value1id,$value2id) = array( $value2id,$value1id ); - $value1 = new Value( $value1id ); - $value2 = new Value( $value2id ); + $value1 = new Value(); + $value2 = new Value(); $value1->loadWithId( $value1id ); $value2->loadWithId( $value2id ); diff --git a/modules/cms/action/text/TextDiffAction.class.php b/modules/cms/action/text/TextDiffAction.class.php @@ -2,13 +2,14 @@ namespace cms\action\text; use cms\action\Method; use cms\action\PageelementAction; +use cms\action\TextAction; use cms\generator\PublishEdit; use cms\generator\PublishPreview; use cms\model\Value; use util\exception\ValidationException; use util\Text; -class TextDiffAction extends PageelementAction implements Method { +class TextDiffAction extends TextAction implements Method { public function view() { $value1id = $this->request->getNumber('compareid'); @@ -23,19 +24,16 @@ class TextDiffAction extends PageelementAction implements Method { list($value1id,$value2id) = array( $value2id,$value1id ); - $value1 = new Value( $value1id ); - $value2 = new Value( $value2id ); - $value1->valueid = $value1id; - $value2->valueid = $value2id; - - $value1->loadWithId(); - $value2->loadWithId(); + $value1 = new Value(); + $value2 = new Value(); + $value1->loadWithId( $value1id ); + $value2->loadWithId( $value2id ); $this->setTemplateVar('date_left' ,$value1->lastchangeTimeStamp); $this->setTemplateVar('date_right',$value2->lastchangeTimeStamp); - $text1 = explode("\n",$value1->text); - $text2 = explode("\n",$value2->text); + $text1 = explode("\n",$value1->file); + $text2 = explode("\n",$value2->file); // Unterschiede feststellen. $diffResult = Text::diff($text1,$text2); diff --git a/modules/cms/action/text/TextValueAction.class.php b/modules/cms/action/text/TextValueAction.class.php @@ -21,7 +21,8 @@ class TextValueAction extends TextAction implements Method { public function post() { - $this->text->value = $this->request->getText('text'); + $this->text->value = $this->request->getText('text'); + $this->text->public = $this->request->has('release'); $this->text->saveValue(); $this->addNoticeFor($this->text,Messages::VALUE_SAVED); diff --git a/modules/cms/generator/FileContext.class.php b/modules/cms/generator/FileContext.class.php @@ -6,7 +6,7 @@ namespace cms\generator; /** - * The page context, necessary for generating and publishing a page. + * The page context, necessary for generating and publishing a file. */ class FileContext extends BaseContext { @@ -29,6 +29,7 @@ class FileContext extends BaseContext public function getCacheKey() { return [ + 'file', $this->sourceObjectId, $this->scheme ]; diff --git a/modules/cms/generator/FileHistoryContext.class.php b/modules/cms/generator/FileHistoryContext.class.php @@ -0,0 +1,49 @@ +<?php + + +namespace cms\generator; + + + +/** + * The file history context, necessary for generating and publishing a file. + */ +class FileHistoryContext extends BaseContext +{ + public $sourceObjectId; + + /** + * value id. + * + * @var int + */ + public $valueId; + + /** + * FileHistoryContext constructor. + * + * @param $sourceObjectId + * @param $valueId + */ + public function __construct($sourceObjectId,$valueId ) + { + $this->sourceObjectId = $sourceObjectId; + $this->valueId = $valueId; + $this->scheme = Producer::SCHEME_PREVIEW; + } + + public function getCacheKey() + { + return [ + 'filehistory', + $this->sourceObjectId, + $this->valueId + ]; + } + + + public function getObjectId() + { + return $this->sourceObjectId; + } +} +\ No newline at end of file diff --git a/modules/cms/generator/FileHistoryGenerator.class.php b/modules/cms/generator/FileHistoryGenerator.class.php @@ -0,0 +1,132 @@ +<?php + + +namespace cms\generator; + + +use cms\generator\filter\AbstractFilter; +use cms\model\File; +use cms\model\Value; +use logger\Logger; +use util\exception\GeneratorException; + +class FileHistoryGenerator extends BaseGenerator +{ + /** + * @param $fileContext FileHistoryContext + */ + public function __construct($fileContext ) + { + $this->context = $fileContext; + } + + protected function generate() + { + $value = new Value(); + $value->loadWithId( $this->context->valueId); + + return $value->file; // Should we filter here? + } + + public function getPublicFilename() + { + return null; + } + + + /** + * @param $file File + * @return string + */ + private function filterValue( $file ) + { + $contentId = $file->contentid; + + $totalSettings = $file->getTotalSettings(); + $proxyFileId = @$totalSettings['proxy-file-id']; + + if ( $proxyFileId ) { + $proxyFile = new File( $proxyFileId ); // This is a proxy for another file. + $proxyFile->load(); + $contentId = $proxyFile->contentid; + } + + $v = new Value(); + $v->contentid = $contentId; + + if ( $this->context->scheme == Producer::SCHEME_PREVIEW ) + $v->load(); + else + $v->loadPublished(); + + $value = $v->file; + + foreach(\util\ArrayUtils::getSubArray($totalSettings, array( 'filter')) as $filterEntry ) + { + $filterName = ucfirst(@$filterEntry['name']); + $extension = @$filterEntry['extension']; + + if ( $extension && strtolower($extension) != strtolower($file->getRealExtension()) ) + continue; // File extension does not match + + $filterType = $this->context->scheme==Producer::SCHEME_PUBLIC?'public':'preview'; + + $onPublish = (array) @$filterEntry['on']; + if ( ! $onPublish || in_array('all',$onPublish ) ) + $onPublish = ['edit','public','preview','show']; + + if ( $onPublish && ! in_array($filterType,$onPublish)) + continue; // Publish type does not match + + $parameter = (array) @$filterEntry['parameter']; + + $filterClassNameWithNS = 'cms\\generator\\filter\\' . $filterName.'Filter'; + + if ( !class_exists( $filterClassNameWithNS ) ) + throw new \LogicException("Filter '$filterName' does not exist."); + + /** @var AbstractFilter $filter */ + $filter = new $filterClassNameWithNS(); + $filter->context = $this->context; + + // Copy filter configuration to filter instance. + foreach( $parameter as $parameterName=>$parameterValue) { + if ( property_exists($filter,$parameterName)) + $filter->$parameterName = $parameterValue; + } + + + // Execute the filter. + Logger::debug("Filtering '$file->filename' with filter '$filterName'."); + + try { + + $value = $filter->filter( $value ); + } catch( \Exception $e ) { + // Filter has some undefined error. + Logger::warn( $e->getTraceAsString() ); + throw new GeneratorException('Could not generate file '.$file->objectid.'. Filter '.$filterName.' has an error.', $e ); + } + } + + return $value; + + } + + + /** + * Calculates the MIME type of this file. + * + * @return string + */ + public function getMimeType() + { + $file = new File( $this->context->sourceObjectId ); + $file->load(); + $ext = strtolower( $file->getRealExtension() ); + + $mimeType = File::getMimeType( $ext ); + + return( $mimeType ); + } +} +\ No newline at end of file diff --git a/modules/cms/model/File.class.php b/modules/cms/model/File.class.php @@ -21,8 +21,6 @@ namespace cms\model; // Standard Mime-Type use cms\base\Configuration; use cms\base\DB as Db; -use cms\generator\filter\AbstractFilter; -use logger\Logger; use util\cache\FileCache; @@ -313,8 +311,9 @@ class File extends BaseObject var $storeValueAsBase64 = false; public $filterid; + public $public; - /** + /** * Konstruktor * * @param Objekt-Id @@ -583,7 +582,7 @@ SQL /** * Speichert den Inhalt in der Datenbank. */ - function saveValue( $value = '' ) + function saveValue() { $this->getCache()->invalidate(); @@ -600,12 +599,10 @@ SQL $value = new Value(); $value->contentid = $this->contentid; - $storeValueAsBase64 = DB::get()->conf['base64']; - - if ( $storeValueAsBase64 ) - $value->file = base64_encode($this->value); - else - $value->file = $this->value; + // Base64-encoding is done in the Value. + $value->file = $this->value; + + $value->publish = $this->public; $value->persist(); } diff --git a/modules/cms/ui/themes/default/html/views/image/history.php b/modules/cms/ui/themes/default/html/views/image/history.php @@ -36,17 +36,12 @@ <span><?php echo O::escapeHtml(''.@O::lang('ACTION').'') ?></span> </td> </tr> - <?php $if5=(($values)==FALSE); if($if5) { ?> - <tr><?php echo O::escapeHtml('') ?> - <td colspan="<?php echo O::escapeHtml('8') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('NOT_FOUND').'') ?></span> - </td> - </tr> - <?php } ?> <?php foreach((array)@$values as $list_key=>$list_value) { extract($list_value); ?> <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> <td><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-image') ?>"><?php echo O::escapeHtml('') ?></i> + <a title="<?php echo O::escapeHtml(''.@O::lang('preview').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('preview') ?>" data-id="<?php echo O::escapeHtml('') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--action-image') ?>"><?php echo O::escapeHtml('') ?></i> + </a> </td> <td class="<?php echo O::escapeHtml('or--visible-on-desktop') ?>"><?php echo O::escapeHtml('') ?> <?php include_once( 'modules/template_engine/components/html/component_date/component-date.php'); { component_date($date); ?> diff --git a/modules/cms/ui/themes/default/html/views/image/history.tpl.src.xml b/modules/cms/ui/themes/default/html/views/image/history.tpl.src.xml @@ -24,17 +24,12 @@ </column> </row> - <if empty="${values}"> - <row> - <column colspan="8"> - <text value="${message:NOT_FOUND}"/> - </column> - </row> - </if> <list list="${values}" extract="true"> <row class="data"> <column> - <image action="image" /> + <link clickable="true" type="dialog" subaction="preview" var1="valueid" value1="${id}" title="${message:preview}"> + <image action="image" /> + </link> </column> <column class="-visible-on-desktop"> <date date="${date}"/> diff --git a/modules/cms/ui/themes/default/html/views/text/history.php b/modules/cms/ui/themes/default/html/views/text/history.php @@ -6,108 +6,97 @@ <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('action') ?>" value="<?php echo O::escapeHtml('text') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('subaction') ?>" value="<?php echo O::escapeHtml('diff') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('id') ?>" value="<?php echo O::escapeHtml(''.@$_id.'') ?>" /><?php echo O::escapeHtml('') ?> - <?php foreach((array)@$languages as $list_key=>$language) { ?> - <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--is-visible or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> - <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?></i> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-open or-collapsible--on-open') ?>"><?php echo O::escapeHtml('') ?></i> - <span><?php echo O::escapeHtml(''.@O::lang('language').'') ?></span> - </h2> - <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> - <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> - <div class="<?php echo O::escapeHtml('or-table-filter') ?>"><?php echo O::escapeHtml('') ?> - <input type="<?php echo O::escapeHtml('search') ?>" name="<?php echo O::escapeHtml('filter') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('SEARCH_FILTER').'') ?>" class="<?php echo O::escapeHtml('or-input or-table-filter-input') ?>" /><?php echo O::escapeHtml('') ?> - </div> - <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> - <table class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> - <tr class="<?php echo O::escapeHtml('or-table-header') ?>"><?php echo O::escapeHtml('') ?> - <td colspan="<?php echo O::escapeHtml('2') ?>" class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('COMPARE').'') ?></span> + <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--is-visible or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> + <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?></i> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-open or-collapsible--on-open') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('history').'') ?></span> + </h2> + <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-wrapper') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-table-filter') ?>"><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('search') ?>" name="<?php echo O::escapeHtml('filter') ?>" placeholder="<?php echo O::escapeHtml(''.@O::lang('SEARCH_FILTER').'') ?>" class="<?php echo O::escapeHtml('or-input or-table-filter-input') ?>" /><?php echo O::escapeHtml('') ?> + </div> + <div class="<?php echo O::escapeHtml('or-table-area') ?>"><?php echo O::escapeHtml('') ?> + <table class="<?php echo O::escapeHtml('or-table') ?>"><?php echo O::escapeHtml('') ?> + <tr class="<?php echo O::escapeHtml('or-table-header') ?>"><?php echo O::escapeHtml('') ?> + <td colspan="<?php echo O::escapeHtml('2') ?>" class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('COMPARE').'') ?></span> + </td> + <td class="<?php echo O::escapeHtml('or-table-column-auto') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('VALUE').'') ?></span> + </td> + <td class="<?php echo O::escapeHtml('or--visible-on-desktop or-table-column-date') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('DATE').'') ?></span> + </td> + <td class="<?php echo O::escapeHtml('or--visible-on-desktop or-table-column-user') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('USER').'') ?></span> + </td> + <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('STATE').'') ?></span> + </td> + <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@O::lang('ACTION').'') ?></span> + </td> + </tr> + <?php foreach((array)@$values as $list_key=>$list_value) { extract($list_value); ?> + <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> + <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> + <?php $if8=($comparable); if($if8) { ?> + <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('compareid') ?>" value="<?php echo O::escapeHtml(''.@$id.'') ?>" <?php if(@$compareid=='${id}'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> + <?php } ?> + <?php if(!$if8) { ?> + <span><?php echo O::escapeHtml(' ') ?></span> + <?php } ?> </td> - <td class="<?php echo O::escapeHtml('or-table-column-auto') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('VALUE').'') ?></span> + <td><?php echo O::escapeHtml('') ?> + <?php $if8=($comparable); if($if8) { ?> + <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('withid') ?>" value="<?php echo O::escapeHtml(''.@$id.'') ?>" <?php if(@$withid=='${id}'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> + <?php } ?> + <?php if(!$if8) { ?> + <span><?php echo O::escapeHtml(' ') ?></span> + <?php } ?> </td> - <td class="<?php echo O::escapeHtml('or--visible-on-desktop or-table-column-date') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('DATE').'') ?></span> + <td><?php echo O::escapeHtml('') ?> + <span title="<?php echo O::escapeHtml(''.@$text.'') ?>"><?php echo O::escapeHtml(''.@$text.'') ?></span> </td> - <td class="<?php echo O::escapeHtml('or--visible-on-desktop or-table-column-user') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('USER').'') ?></span> + <td class="<?php echo O::escapeHtml('or--visible-on-desktop') ?>"><?php echo O::escapeHtml('') ?> + <?php include_once( 'modules/template_engine/components/html/component_date/component-date.php'); { component_date($date); ?> + <?php } ?> </td> - <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('STATE').'') ?></span> + <td class="<?php echo O::escapeHtml('or--visible-on-desktop') ?>"><?php echo O::escapeHtml('') ?> + <span><?php echo O::escapeHtml(''.@$user.'') ?></span> </td> - <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('ACTION').'') ?></span> + <td><?php echo O::escapeHtml('') ?> + <?php $if8=($publish); if($if8) { ?> + <i title="<?php echo O::escapeHtml(''.@O::lang('PAGEELEMENT_RELEASED').'') ?>" class="<?php echo O::escapeHtml('or-image-icon or-image-icon--status-released') ?>"><?php echo O::escapeHtml('') ?></i> + <?php } ?> + <?php $if8=($active); if($if8) { ?> + <i title="<?php echo O::escapeHtml(''.@O::lang('active').'') ?>" class="<?php echo O::escapeHtml('or-image-icon or-image-icon--status-active') ?>"><?php echo O::escapeHtml('') ?></i> + <?php } ?> + </td> + <td><?php echo O::escapeHtml('') ?> + <?php $if8=($releasable); if($if8) { ?> + <a title="<?php echo O::escapeHtml(''.@O::lang('RELEASE_DESC').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('post') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('release') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" data-data="<?php echo O::escapeHtml('{"action":"text","subaction":"release","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$id.'","none":0}') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-release') ?>"><?php echo O::escapeHtml('') ?></i> + </a> + <?php } ?> + <?php $if8=($usable); if($if8) { ?> + <a title="<?php echo O::escapeHtml(''.@O::lang('RESTORE_DESC').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('post') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('restore') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" data-data="<?php echo O::escapeHtml('{"action":"text","subaction":"restore","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$id.'","none":0}') ?>" class="<?php echo O::escapeHtml('or-link or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-restore') ?>"><?php echo O::escapeHtml('') ?></i> + </a> + <a title="<?php echo O::escapeHtml(''.@O::lang('edit').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('value') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-edit') ?>"><?php echo O::escapeHtml('') ?></i> + </a> + <?php } ?> </td> </tr> - <?php { $values= $language['values']; ?> - <?php } ?> - <?php $if6=(($values)==FALSE); if($if6) { ?> - <tr><?php echo O::escapeHtml('') ?> - <td colspan="<?php echo O::escapeHtml('8') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@O::lang('NOT_FOUND').'') ?></span> - </td> - </tr> - <?php } ?> - <?php foreach((array)@$values as $list_key=>$list_value) { extract($list_value); ?> - <tr class="<?php echo O::escapeHtml('or-data') ?>"><?php echo O::escapeHtml('') ?> - <td class="<?php echo O::escapeHtml('or-table-column-action') ?>"><?php echo O::escapeHtml('') ?> - <?php $if9=($comparable); if($if9) { ?> - <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('compareid') ?>" value="<?php echo O::escapeHtml(''.@$id.'') ?>" <?php if(@$compareid=='${id}'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> - <?php } ?> - <?php if(!$if9) { ?> - <span><?php echo O::escapeHtml(' ') ?></span> - <?php } ?> - </td> - <td><?php echo O::escapeHtml('') ?> - <?php $if9=($comparable); if($if9) { ?> - <input type="<?php echo O::escapeHtml('radio') ?>" name="<?php echo O::escapeHtml('withid') ?>" value="<?php echo O::escapeHtml(''.@$id.'') ?>" <?php if(@$withid=='${id}'){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-radio') ?>" /><?php echo O::escapeHtml('') ?> - <?php } ?> - <?php if(!$if9) { ?> - <span><?php echo O::escapeHtml(' ') ?></span> - <?php } ?> - </td> - <td><?php echo O::escapeHtml('') ?> - <span title="<?php echo O::escapeHtml(''.@$text.'') ?>"><?php echo O::escapeHtml(''.@$text.'') ?></span> - </td> - <td class="<?php echo O::escapeHtml('or--visible-on-desktop') ?>"><?php echo O::escapeHtml('') ?> - <?php include_once( 'modules/template_engine/components/html/component_date/component-date.php'); { component_date($date); ?> - <?php } ?> - </td> - <td class="<?php echo O::escapeHtml('or--visible-on-desktop') ?>"><?php echo O::escapeHtml('') ?> - <span><?php echo O::escapeHtml(''.@$user.'') ?></span> - </td> - <td><?php echo O::escapeHtml('') ?> - <?php $if9=($publish); if($if9) { ?> - <i title="<?php echo O::escapeHtml(''.@O::lang('PAGEELEMENT_RELEASED').'') ?>" class="<?php echo O::escapeHtml('or-image-icon or-image-icon--status-released') ?>"><?php echo O::escapeHtml('') ?></i> - <?php } ?> - <?php $if9=($active); if($if9) { ?> - <i title="<?php echo O::escapeHtml(''.@O::lang('active').'') ?>" class="<?php echo O::escapeHtml('or-image-icon or-image-icon--status-active') ?>"><?php echo O::escapeHtml('') ?></i> - <?php } ?> - </td> - <td><?php echo O::escapeHtml('') ?> - <?php $if9=($releasable); if($if9) { ?> - <a title="<?php echo O::escapeHtml(''.@O::lang('RELEASE_DESC').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('post') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('release') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" data-data="<?php echo O::escapeHtml('{"action":"text","subaction":"release","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$id.'","none":0}') ?>" class="<?php echo O::escapeHtml('or-link') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-release') ?>"><?php echo O::escapeHtml('') ?></i> - </a> - <?php } ?> - <?php $if9=($usable); if($if9) { ?> - <a title="<?php echo O::escapeHtml(''.@O::lang('RESTORE_DESC').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('post') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('restore') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" data-data="<?php echo O::escapeHtml('{"action":"text","subaction":"restore","id":"'.@$objectid.'","token":"'.@$_token.'","valueid":"'.@$id.'","none":0}') ?>" class="<?php echo O::escapeHtml('or-link or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-restore') ?>"><?php echo O::escapeHtml('') ?></i> - </a> - <a title="<?php echo O::escapeHtml(''.@O::lang('edit').'') ?>" target="<?php echo O::escapeHtml('_self') ?>" data-type="<?php echo O::escapeHtml('dialog') ?>" data-action="<?php echo O::escapeHtml('') ?>" data-method="<?php echo O::escapeHtml('value') ?>" data-id="<?php echo O::escapeHtml(''.@$objectid.'') ?>" data-extra-valueid="<?php echo O::escapeHtml(''.@$id.'') ?>" data-extra="<?php echo O::escapeHtml('{&quot;valueid&quot;:&quot;'.@$id.'&quot;}') ?>" href="<?php echo O::escapeHtml('') ?>" class="<?php echo O::escapeHtml('or-link or-act-clickable') ?>"><?php echo O::escapeHtml('') ?> - <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--method-edit') ?>"><?php echo O::escapeHtml('') ?></i> - </a> - <?php } ?> - </td> - </tr> - <?php } ?> - </table> - </div> + <?php } ?> + </table> </div> </div> - </section> - <?php } ?> + </div> + </section> </div> <div class="<?php echo O::escapeHtml('or-form-actionbar') ?>"><?php echo O::escapeHtml('') ?> <div class="<?php echo O::escapeHtml('or-btn or-btn--control or-btn--primary or-act-form-save') ?>"><?php echo O::escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/text/history.tpl.src.xml b/modules/cms/ui/themes/default/html/views/text/history.tpl.src.xml @@ -1,103 +1,93 @@ <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"> - <form method="get" subaction="diff" label="${message:compare}" cancel="false" visible="true"> - <list list="${languages}" value="language"> + <form method="get" subaction="diff" label="${message:compare}" cancel="false" > - <group collapsible="true" title="${message:language}"> + <group collapsible="true" title="${message:history}"> - <table> - <row header="true"> + <table> + <row header="true"> - <column class="table-column-action" colspan="2"> - <text value="${message:COMPARE}"/> + <column class="table-column-action" colspan="2"> + <text value="${message:COMPARE}"/> + </column> + <column class="table-column-auto"> + <text value="${message:VALUE}"/> + </column> + <column class="-visible-on-desktop,table-column-date"> + <text class="" value="${message:DATE}"/> + </column> + <column class="-visible-on-desktop,table-column-user"> + <text class="" value="${message:USER}"/> + </column> + <column class="table-column-action"> + <text value="${message:STATE}"/> + </column> + <column class="table-column-action"> + <text value="${message:ACTION}"/> + </column> + </row> + + <list list="${values}" extract="true"> + <row class="data"> + <column class="table-column-action"> + <if true="${comparable}"> + <radio name="compareid" value="${id}"/> + </if> + <else> + <text value=" "/> + </else> </column> - <column class="table-column-auto"> - <text value="${message:VALUE}"/> + <column> + <if true="${comparable}"> + <radio name="withid" value="${id}"/> + </if> + <else> + <text value=" "/> + </else> </column> - <column class="-visible-on-desktop,table-column-date"> - <text class="" value="${message:DATE}"/> + <column> + <text value="${text}" title="${text}"/> </column> - <column class="-visible-on-desktop,table-column-user"> - <text class="" value="${message:USER}"/> + <column class="-visible-on-desktop"> + <date date="${date}"/> </column> - <column class="table-column-action"> - <text value="${message:STATE}"/> - </column> - <column class="table-column-action"> - <text value="${message:ACTION}"/> + <column class="-visible-on-desktop"> + <text value="${user}"/> </column> - </row> - - <set var="values" value="${language}" key="values"/> - <if empty="${values}"> - <row> - <column colspan="8"> - <text value="${message:NOT_FOUND}"/> - </column> - </row> - </if> - <list list="${values}" extract="true"> - <row class="data"> - <column class="table-column-action"> - <if true="${comparable}"> - <radio name="compareid" value="${id}"/> - </if> - <else> - <text value=" "/> - </else> - </column> - <column> - <if true="${comparable}"> - <radio name="withid" value="${id}"/> - </if> - <else> - <text value=" "/> - </else> - </column> - <column> - <text value="${text}" title="${text}"/> - </column> - <column class="-visible-on-desktop"> - <date date="${date}"/> - </column> - <column class="-visible-on-desktop"> - <text value="${user}"/> - </column> - <!-- State --> - <column> - <if true="${publish}"> - <image symbol="status-released" title="${message:PAGEELEMENT_RELEASED}"/> - </if> - <if true="${active}"> - <image symbol="status-active" title="${message:active}"/> - </if> - </column> + <!-- State --> + <column> + <if true="${publish}"> + <image symbol="status-released" title="${message:PAGEELEMENT_RELEASED}"/> + </if> + <if true="${active}"> + <image symbol="status-active" title="${message:active}"/> + </if> + </column> - <!-- Actions --> - <column> - <if true="${releasable}"> - <link type="post" subaction="release" var1="valueid" value1="${id}" - id="${objectid}" title="${message:RELEASE_DESC}"> - <image method="release"/> - </link> - </if> - <if true="${usable}"> - <link clickable="true" type="post" subaction="restore" var1="valueid" value1="${id}" - id="${objectid}" title="${message:RESTORE_DESC}"> - <image method="restore"/> - </link> + <!-- Actions --> + <column> + <if true="${releasable}"> + <link type="post" subaction="release" var1="valueid" value1="${id}" + id="${objectid}" title="${message:RELEASE_DESC}"> + <image method="release"/> + </link> + </if> + <if true="${usable}"> + <link clickable="true" type="post" subaction="restore" var1="valueid" value1="${id}" + id="${objectid}" title="${message:RESTORE_DESC}"> + <image method="restore"/> + </link> - <link clickable="true" type="dialog" subaction="value" var1="valueid" value1="${id}" - id="${objectid}" title="${message:edit}"> - <image method="edit"/> - </link> - </if> - </column> - </row> - </list> - </table> - </group> - </list> + <link clickable="true" type="dialog" subaction="value" var1="valueid" value1="${id}" + id="${objectid}" title="${message:edit}"> + <image method="edit"/> + </link> + </if> + </column> + </row> + </list> + </table> + </group> </form> </output> diff --git a/modules/cms/ui/themes/default/html/views/text/value.php b/modules/cms/ui/themes/default/html/views/text/value.php @@ -6,13 +6,42 @@ <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('action') ?>" value="<?php echo O::escapeHtml('text') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('subaction') ?>" value="<?php echo O::escapeHtml('value') ?>" /><?php echo O::escapeHtml('') ?> <input type="<?php echo O::escapeHtml('hidden') ?>" name="<?php echo O::escapeHtml('id') ?>" value="<?php echo O::escapeHtml(''.@$_id.'') ?>" /><?php echo O::escapeHtml('') ?> - <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> - <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('VALUE').'') ?></h3> - <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> - <div><?php echo O::escapeHtml('') ?> - <textarea name="<?php echo O::escapeHtml('text') ?>" data-extension="<?php echo O::escapeHtml(''.@$extension.'') ?>" data-mimetype="<?php echo O::escapeHtml(''.@$mimetype.'') ?>" data-mode="<?php echo O::escapeHtml('htmlmixed') ?>" class="<?php echo O::escapeHtml('or-input or-editor or-code-editor') ?>"><?php echo O::escapeHtml(''.@$text.'') ?></textarea> - <trix-editor input="<?php echo O::escapeHtml('text') ?>"><?php echo O::escapeHtml('') ?></trix-editor> - </div> + <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--is-visible or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> + <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?></i> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-open or-collapsible--on-open') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('edit').'') ?></span> + </h2> + <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> + <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> + <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml(''.@O::lang('VALUE').'') ?></h3> + <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> + <div><?php echo O::escapeHtml('') ?> + <textarea name="<?php echo O::escapeHtml('text') ?>" data-extension="<?php echo O::escapeHtml(''.@$extension.'') ?>" data-mimetype="<?php echo O::escapeHtml(''.@$mimetype.'') ?>" data-mode="<?php echo O::escapeHtml('htmlmixed') ?>" class="<?php echo O::escapeHtml('or-input or-editor or-code-editor') ?>"><?php echo O::escapeHtml(''.@$text.'') ?></textarea> + <trix-editor input="<?php echo O::escapeHtml('text') ?>"><?php echo O::escapeHtml('') ?></trix-editor> + </div> + </div> + </section> + </div> + </section> + <section class="<?php echo O::escapeHtml('or-group or-collapsible or-collapsible--is-open or-collapsible--is-visible or-collapsible--show') ?>"><?php echo O::escapeHtml('') ?> + <h2 class="<?php echo O::escapeHtml('or-collapsible-title or-group-title or-collapsible-act-switch') ?>"><?php echo O::escapeHtml('') ?> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-closed or-collapsible--on-closed') ?>"><?php echo O::escapeHtml('') ?></i> + <i class="<?php echo O::escapeHtml('or-image-icon or-image-icon--node-open or-collapsible--on-open') ?>"><?php echo O::escapeHtml('') ?></i> + <span><?php echo O::escapeHtml(''.@O::lang('options').'') ?></span> + </h2> + <div class="<?php echo O::escapeHtml('or-collapsible-value or-group-value') ?>"><?php echo O::escapeHtml('') ?> + <section class="<?php echo O::escapeHtml('or-fieldset') ?>"><?php echo O::escapeHtml('') ?> + <h3 class="<?php echo O::escapeHtml('or-fieldset-label') ?>"><?php echo O::escapeHtml('') ?></h3> + <div class="<?php echo O::escapeHtml('or-fieldset-value') ?>"><?php echo O::escapeHtml('') ?> + <div class="<?php echo O::escapeHtml('or-') ?>"><?php echo O::escapeHtml('') ?> + <label><?php echo O::escapeHtml('') ?> + <input type="<?php echo O::escapeHtml('checkbox') ?>" name="<?php echo O::escapeHtml('release') ?>" value="<?php echo O::escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo O::escapeHtml('checked') ?>"<?php } ?> class="<?php echo O::escapeHtml('or-form-checkbox') ?>" /><?php echo O::escapeHtml('') ?> + <span class="<?php echo O::escapeHtml('or-form-label') ?>"><?php echo O::escapeHtml(''.@O::lang('RELEASE').'') ?></span> + </label> + </div> + </div> + </section> </div> </section> </div> diff --git a/modules/cms/ui/themes/default/html/views/text/value.tpl.src.xml b/modules/cms/ui/themes/default/html/views/text/value.tpl.src.xml @@ -1,11 +1,20 @@ <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"> - <form> + <form> + <group title="${message:edit}"> <fieldset label="${message:VALUE}"> <editor name="text" type="code" extension="${extension}" mimetype="${mimetype}"/> </fieldset> - </form> + </group> + <group title="${message:options}"> + <fieldset> + <part> + <checkbox name="release" label="${message:RELEASE}"/> + </part> + </fieldset> + </group> + </form> </output>