openrat-cms

OpenRat Content Management System
git clone http://git.code.weiherhei.de/openrat-cms.git
Log | Files | Refs

commit 910f634aee65b916b3b6e05af1ced86656839b5c
parent ca0beb7d616105143590d6fb3c7f11a074d18c4c
Author: Jan Dankert <develop@jandankert.de>
Date:   Mon, 21 Sep 2020 22:48:59 +0200

Complexe refactoring: Moving all generation logic from the model (Value,Page,File) to generators classes.

Diffstat:
modules/cms/action/FileAction.class.php | 29++++++++++++++++++-----------
modules/cms/action/FolderAction.class.php | 80++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-----------------
modules/cms/action/PageAction.class.php | 151+++++++++++++++++++++++++++++++++++++++++++++----------------------------------
modules/cms/action/PageelementAction.class.php | 53++++++++++++++++++++++++++++++++---------------------
modules/cms/action/ProjectAction.class.php | 4+++-
modules/cms/generator/BaseContext.class.php | 13+++++++++++++
modules/cms/generator/BaseGenerator.class.php | 25+++++++++++++++++++++++++
modules/cms/generator/FileContext.class.php | 37+++++++++++++++++++++++++++++++++++++
modules/cms/generator/FileGenerator.class.php | 30++++++++++++++++++++++++++++++
modules/cms/generator/Generator.class.php | 13+++++++++++++
modules/cms/generator/PageContext.class.php | 44+++++++++++++++++++++++++++++++++++++++++---
modules/cms/generator/PageGenerator.class.php | 256+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/Producer.class.php | 93+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/PublishPreview.class.php | 132-------------------------------------------------------------------------------
modules/cms/generator/PublishPublic.class.php | 390-------------------------------------------------------------------------------
modules/cms/generator/Publisher.class.php | 204+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/ValueContext.class.php | 38++++++++++++++++++++++++++++++++++++++
modules/cms/generator/ValueGenerator.class.php | 1025+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/filter/AbstractFilter.class.php | 3++-
modules/cms/generator/filter/Filter.class.php | 11+++++++++++
modules/cms/generator/link/LinkFormat.class.php | 13+++++++++++++
modules/cms/generator/link/PreviewLink.class.php | 112+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/link/PublicLink.class.php | 178+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
modules/cms/generator/target/Dav.class.php | 2+-
modules/cms/generator/target/Fax.class.php | 2+-
modules/cms/generator/target/Ftp.class.php | 4++--
modules/cms/generator/target/Local.class.php | 54+++++++++++++++++++++++++++++++++++++++++++++++++++++-
modules/cms/generator/target/NoTarget.class.php | 2+-
modules/cms/generator/target/README.md | 9+++++++--
modules/cms/generator/target/Scp.class.php | 9++++++---
modules/cms/generator/target/Target.class.php | 70++++++++++++----------------------------------------------------------
modules/cms/macros/MacroRunner.class.php | 14+++++++++++---
modules/cms/macros/macro/ClassicMenu.class.php | 33++++++++++++++++++++-------------
modules/cms/macros/macro/LastChanges.class.php | 32++++++++++++++++++++++++--------
modules/cms/macros/macro/SearchIndex.class.php | 26++++++++++++++++++--------
modules/cms/macros/macro/TeaserList.class.php | 26+++++++++++++++++++-------
modules/cms/model/File.class.php | 16----------------
modules/cms/model/Folder.class.php | 6+++++-
modules/cms/model/Name.class.php | 2+-
modules/cms/model/Page.class.php | 191+++----------------------------------------------------------------------------
modules/cms/model/Pageelement.class.php | 5+----
modules/cms/model/Project.class.php | 32+++-----------------------------
modules/cms/model/Value.class.php | 1002+------------------------------------------------------------------------------
modules/cms/ui/themes/default/html/views/element/advanced.php | 8++++----
modules/cms/ui/themes/default/html/views/element/properties.php | 6+++---
modules/cms/ui/themes/default/html/views/element/remove.php | 6+++---
modules/cms/ui/themes/default/html/views/file/compress.php | 4++--
modules/cms/ui/themes/default/html/views/file/remove.php | 2+-
modules/cms/ui/themes/default/html/views/file/uncompress.php | 4++--
modules/cms/ui/themes/default/html/views/folder/advanced.php | 8++++----
modules/cms/ui/themes/default/html/views/folder/pub.php | 8++++----
modules/cms/ui/themes/default/html/views/folder/remove.php | 4++--
modules/cms/ui/themes/default/html/views/group/memberships.php | 2+-
modules/cms/ui/themes/default/html/views/group/remove.php | 2+-
modules/cms/ui/themes/default/html/views/group/rights.php | 2+-
modules/cms/ui/themes/default/html/views/image/compress.php | 4++--
modules/cms/ui/themes/default/html/views/image/size.php | 6+++---
modules/cms/ui/themes/default/html/views/image/uncompress.php | 4++--
modules/cms/ui/themes/default/html/views/language/prop.php | 2+-
modules/cms/ui/themes/default/html/views/language/remove.php | 2+-
modules/cms/ui/themes/default/html/views/link/remove.php | 2+-
modules/cms/ui/themes/default/html/views/login/login.php | 2+-
modules/cms/ui/themes/default/html/views/login/openid.php | 2+-
modules/cms/ui/themes/default/html/views/model/prop.php | 2+-
modules/cms/ui/themes/default/html/views/model/remove.php | 2+-
modules/cms/ui/themes/default/html/views/object/aclform.php | 10+++++-----
modules/cms/ui/themes/default/html/views/object/inherit.php | 2+-
modules/cms/ui/themes/default/html/views/page/form.php | 6+++---
modules/cms/ui/themes/default/html/views/page/name.php | 2+-
modules/cms/ui/themes/default/html/views/page/pub.php | 2+-
modules/cms/ui/themes/default/html/views/page/remove.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/history.php | 4++--
modules/cms/ui/themes/default/html/views/pageelement/link.php | 4++--
modules/cms/ui/themes/default/html/views/pageelement/pub.php | 2+-
modules/cms/ui/themes/default/html/views/pageelement/value.php | 8++++----
modules/cms/ui/themes/default/html/views/profile/edit.php | 4++--
modules/cms/ui/themes/default/html/views/project/add.php | 4++--
modules/cms/ui/themes/default/html/views/project/maintenance.php | 4++--
modules/cms/ui/themes/default/html/views/project/prop.php | 14+++++++-------
modules/cms/ui/themes/default/html/views/project/remove.php | 2+-
modules/cms/ui/themes/default/html/views/projectlist/add.php | 4++--
modules/cms/ui/themes/default/html/views/search/edit.php | 10+++++-----
modules/cms/ui/themes/default/html/views/template/addel.php | 2+-
modules/cms/ui/themes/default/html/views/template/pub.php | 2+-
modules/cms/ui/themes/default/html/views/template/remove.php | 2+-
modules/cms/ui/themes/default/html/views/template/srcelement.php | 8++++----
modules/cms/ui/themes/default/html/views/templatelist/add.php | 6+++---
modules/cms/ui/themes/default/html/views/text/compress.php | 4++--
modules/cms/ui/themes/default/html/views/text/size.php | 6+++---
modules/cms/ui/themes/default/html/views/text/uncompress.php | 4++--
modules/cms/ui/themes/default/html/views/url/remove.php | 2+-
modules/cms/ui/themes/default/html/views/user/info.php | 4++--
modules/cms/ui/themes/default/html/views/user/memberships.php | 2+-
modules/cms/ui/themes/default/html/views/user/prop.php | 6+++---
modules/cms/ui/themes/default/html/views/user/pw.php | 10+++++-----
modules/cms/ui/themes/default/html/views/user/remove.php | 2+-
modules/cms/ui/themes/default/html/views/user/rights.php | 2+-
modules/cms/ui/themes/default/script/openrat.js | 2+-
modules/cms/ui/themes/default/script/openrat.min.js | 2+-
modules/template_engine/components/html/checkbox/Checkbox.class.php | 2+-
modules/template_engine/components/html/radio/Radio.class.php | 7++++++-
modules/util/Macro.class.php | 44++++++++++++++++++++++++++++++++------------
modules/util/Transformer.class.php | 14++++++++++----
modules/util/cache/Cache.class.php | 41+++++++++++++++++++++++++++++++++++++++++
modules/util/cache/FileCache.class.php | 41+++++++++++++++++++++++++++--------------
modules/wikiparser/model/DocumentElement.class.php | 8+++++++-
modules/wikiparser/renderer/HtmlRenderer.class.php | 8+++++++-
107 files changed, 2736 insertions(+), 2134 deletions(-)

diff --git a/modules/cms/action/FileAction.class.php b/modules/cms/action/FileAction.class.php @@ -2,6 +2,10 @@ namespace cms\action; +use cms\generator\FileContext; +use cms\generator\FileGenerator; +use cms\generator\Producer; +use cms\generator\Publisher; use cms\model\Folder; use cms\model\BaseObject; use cms\model\File; @@ -149,7 +153,6 @@ class FileAction extends ObjectAction */ function previewView() { - $this->file->publisher = new PublishPreview(); $url = Html::url($this->file->getType(),'show',$this->file->objectid,array('target'=>'none') ); $this->setTemplateVar('preview_url',$url ); } @@ -161,7 +164,10 @@ class FileAction extends ObjectAction */ function showView() { - $this->file->publisher = new PublishPreview(); + $producer = new Producer(); + $producer->generate( $this->file,Producer::SCHEME_PREVIEW ); + + //$this->file->publisher = new PublishPreview(); $this->lastModified( $this->file->lastchangeDate ); if ( $this->file->extension == 'gz' ) @@ -202,11 +208,11 @@ class FileAction extends ObjectAction header('Content-Transfer-Encoding: binary' ); header('Content-Description: '.$this->file->filename() ); - $this->file->write(); // Bild aus Datenbank laden + //$this->file->write(); // Bild aus Datenbank laden // Groesse des Bildes in Bytes // Der Browser hat so die Moeglichkeit, einen Fortschrittsbalken zu zeigen - header('Content-Length: '.filesize($this->file->getCache()->getFilename()) ); + header('Content-Length: '.$this->file->size ); if ( $this->request->getRequestVar('encoding') == 'base64') @@ -232,12 +238,12 @@ class FileAction extends ObjectAction // PHP-Code ausfuehren ob_start(); - require( $this->file->getCache()->getFilename() ); + require( $producer->getCache()->getFilename() ); $this->setTemplateVar('value',$encodingFunction(ob_get_contents()) ); ob_end_clean(); } else - $this->setTemplateVar('value',$encodingFunction(file_get_contents( $this->file->getCache()->getFilename()) ) ); + $this->setTemplateVar('value',$encodingFunction( $producer->getValue() ) ); // Maybe we want some gzip-encoding? } @@ -536,11 +542,12 @@ class FileAction extends ObjectAction */ function pubPost() { - $this->file->publisher = new PublishPublic( $this->file->projectid ); - $this->file->publish(); - $this->file->publisher->close(); - - $this->addNotice('file',$this->file->fullFilename,'PUBLISHED',OR_NOTICE_OK,array(),$this->file->publisher->log); + $fileGenerator = new FileGenerator( new FileContext( $this->file->objectid, Producer::SCHEME_PUBLIC)); + + $publisher = new Publisher( $this->file->projectid ); + $publisher->publish( $fileGenerator->getCache()->load()->getFilename(),$fileGenerator->getPublicFilename(),$this->file->lastchangeDate ); + + $this->addNoticeFor($this->file,'PUBLISHED',OR_NOTICE_OK ); } diff --git a/modules/cms/action/FolderAction.class.php b/modules/cms/action/FolderAction.class.php @@ -2,6 +2,12 @@ namespace cms\action; +use cms\generator\FileContext; +use cms\generator\FileGenerator; +use cms\generator\PageContext; +use cms\generator\PageGenerator; +use cms\generator\Producer; +use cms\generator\Publisher; use language\Messages; use util\ArchiveTar; use cms\model\Acl; @@ -1279,32 +1285,72 @@ class FolderAction extends ObjectAction if ( !$this->folder->hasRight( Acl::ACL_PUBLISH ) ) throw new \util\exception\SecurityException('no rights for publish'); - $subdirs = ( $this->hasRequestVar('subdirs') ); - $pages = ( $this->hasRequestVar('pages' ) ); - $files = ( $this->hasRequestVar('files' ) ); + $project = $this->folder->getProject(); + $project->load(); + // Nothing is written to the session from this point. so we should free the session. Session::close(); - $publisher = new PublishPublic( $this->folder->projectid ); - $this->folder->publisher = &$publisher; - $this->folder->publish( $pages,$files,$subdirs ); + $publisher = new Publisher( $project->projectid ); - $publisher->close(); + // Create a list of all folders. + $folderList = [ $this->folder->objectid ]; + // Add all subfolders to the list + if ( $this->request->hasRequestVar('subdirs') ) + $folderList = array_merge( $folderList, $this->folder->getAllSubFolderIds() ); + + foreach( $folderList as $folderId ) { + + $folder = new Folder( $folderId ); + $folder->load(); + + // Publish all pages + if ( $this->request->hasRequestVar('pages' ) ) { + + foreach( $folder->getPages() as $pageObjectId ) { + + foreach( $project->getModelIds() as $modelId ) { + + foreach( $project->getLanguageIds() as $languageId ) { + + $pageContext = new PageContext( $pageObjectId, Producer::SCHEME_PUBLIC ); + $pageContext->modelId = $modelId; + $pageContext->languageId = $languageId; + + $pageGenerator = new PageGenerator( $pageContext ); + + $publisher->publish( $pageGenerator->getCache()->load()->getFilename(),$pageGenerator->getPublicFilename(), 0 ); + } + } + } + } + + // Publish all files + if ( $this->hasRequestVar('files' ) ) { + + foreach( $folder->getFiles() as $fileid ) { + + $fileGenerator = new FileGenerator( new FileContext( $fileid, Producer::SCHEME_PUBLIC)); + $publisher->publish( $fileGenerator->getCache()->load()->getFilename(),$fileGenerator->getPublicFilename(),0 ); + + } + } + } - $list = array_map( - function($obj) - { - return $obj['full_filename']; - }, - $publisher->publishedObjects - ); - $this->addNotice('folder',$this->folder->getDefaultName()->name,'PUBLISHED',OR_NOTICE_OK,array(),$list); - // Wenn gewuenscht, das Zielverzeichnis aufraeumen + + // Cleanup the target directory (if supported by the underlying target) if ( $this->hasRequestVar('clean') ) - $publisher->clean(); + $publisher->cleanOlderThan( START_TIME ); + + + $this->addNoticeFor( $this->folder, + 'PUBLISHED', + array(), + implode("\n",$publisher->publishedObjects) + ); } diff --git a/modules/cms/action/PageAction.class.php b/modules/cms/action/PageAction.class.php @@ -2,6 +2,9 @@ namespace cms\action; +use cms\generator\PageGenerator; +use cms\generator\Producer; +use cms\generator\Publisher; use cms\model\Acl; use cms\model\Project; use cms\model\Value; @@ -49,26 +52,26 @@ class PageAction extends ObjectAction public function init() { $page = new Page( $this->getRequestId() ); - $context = new PageContext(); - $context->sourceObjectId = $page->objectid; + //$context = new PageContext(); + //$context->sourceObjectId = $page->objectid; - if ( $this->request->hasLanguageId()) - $context->languageId = $this->request->getLanguageId(); - - if ( $this->request->hasModelId()) - $context->modelId = $this->request->getModelId(); +// if ( $this->request->hasLanguageId()) +// $context->languageId = $this->request->getLanguageId(); +// +// if ( $this->request->hasModelId()) +// $context->modelId = $this->request->getModelId(); $page->load(); +// +// if ( !$context->languageId ) +// $context->languageId = $page->getProject()->getDefaultLanguageId(); +// +// if ( !$context->modelId ) +// $context->modelId = $page->getProject()->getDefaultModelId(); - if ( !$context->languageId ) - $context->languageId = $page->getProject()->getDefaultLanguageId(); - - if ( !$context->modelId ) - $context->modelId = $page->getProject()->getDefaultModelId(); - - $page->languageid = $context->languageId; - $page->modelid = $context->modelId; - $page->context = $context; +// $page->languageid = $context->languageId; +// $page->modelid = $context->modelId +// $page->context = $context; // Hier kann leider nicht das Datum der letzten Änderung verwendet werden, // da sich die Seite auch danach ändern kann, z.B. durch Includes anderer @@ -202,6 +205,7 @@ class PageAction extends ObjectAction // Vorschau anzeigen if ( $value->element->type=='longtext' && ($this->hasRequestVar('preview')||$this->hasRequestVar('addmarkup')) ) { + /* if ( $this->hasRequestVar('preview') ) { $value->page = $this->page; @@ -210,7 +214,7 @@ class PageAction extends ObjectAction $value->page->load(); $value->generate(); $this->setTemplateVar('preview_text',$value->value ); - } + }*/ if ( $this->hasRequestVar('addmarkup') ) { @@ -339,7 +343,7 @@ class PageAction extends ObjectAction { $this->setTemplateVar('id',$this->page->objectid); - $this->page->publisher = new PublishPublic( $this->page->projectid ); + //$this->page->publisher = new PublishPublic( $this->page->projectid ); $this->page->load(); $this->page->full_filename(); @@ -634,7 +638,6 @@ class PageAction extends ObjectAction $this->setTemplateVar( 'release',$this->page->hasRight(Acl::ACL_RELEASE) ); $this->setTemplateVar( 'publish',$this->page->hasRight(Acl::ACL_PUBLISH) ); - $this->setWindowMenu( 'elements' ); $this->setTemplateVar('el',$list); } @@ -667,12 +670,15 @@ class PageAction extends ObjectAction if ( $this->hasRequestVar('withIcons') ) $this->page->icons = true; - $publisher = new PublishPreview(); + //$publisher = new PublishPreview(); - $this->page->publisher = $publisher; + //$this->page->publisher = $publisher; $this->page->load(); - $this->page->generate(); + //$this->page->generate(); + + $project = $this->page->getProject(); + $this->page->modelid = $project->getDefaultModelId(); // FIXME header('Content-Type: '.$this->page->mimeType().'; charset=UTF-8' ); @@ -683,17 +689,27 @@ class PageAction extends ObjectAction Logger::debug("Preview page: ".$this->page->__toString() ); + + //$producer = new Producer(); + //$producer->languages[] = $this->getRequestVar( REQ_PARAM_LANGUAGE_ID ); + //$producer->models[] = $this->getRequestVar( REQ_PARAM_MODEL_ID ); + //$producer->languages[] = $project->getDefaultLanguageId(); + //producer->models[] = $project->getDefaultModelId(); + + //$producer->generate( $this->page,Producer::SCHEME_PREVIEW ); + $generator = new PageGenerator( $this->createPageContext( Producer::SCHEME_PREVIEW) ); + // Executing PHP in Pages. if ( ( config('publish','enable_php_in_page_content')=='auto' && $this->page->template->extension == 'php') || config('publish','enable_php_in_page_content')===true ) { ob_start(); - require( $this->page->getCache()->getFilename() ); + require( $generator->getCache()->load()->getFilename() ); $this->setTemplateVar('output',ob_get_contents() ); ob_end_clean(); } else - $this->setTemplateVar('output',file_get_contents( $this->page->getCache()->getFilename() ) ); + $this->setTemplateVar('output',$generator->getCache()->get()); } @@ -703,21 +719,18 @@ class PageAction extends ObjectAction * * Alle HTML-Sonderzeichen werden maskiert */ - function srcView() + public function srcView() { $project = new Project( $this->page->projectid ); - - $this->page->withLanguage = config('publish','filename_language') == 'always' || count($project->getLanguageIds()) > 1; - $this->page->withModel = config('publish','filename_type' ) == 'always' || count($project->getModelIds() ) > 1; - - $this->page->publisher = new PublishPublic( $this->page->projectid ); - $this->page->load(); - $this->setModelAndLanguage(); - $src = $this->page->generate(); + $pageContext = new PageContext( $this->page->objectid,Producer::SCHEME_PUBLIC); + $pageContext->languageId = $project->getDefaultLanguageId(); + $pageContext->modelId = $project->getDefaultModelId(); - $this->setTemplateVar('src',$src); + $generator = new PageGenerator( $pageContext ); + + $this->setTemplateVar('src',$generator->getCache()->get() ); } @@ -779,45 +792,37 @@ class PageAction extends ObjectAction if ( !$this->page->hasRight( Acl::ACL_PUBLISH ) ) throw new \util\exception\SecurityException( 'no right for publish' ); + $project = $this->page->getProject(); + + // Nothing is written to the session from this point. so we should free the session. Session::close(); - $publisher = new PublishPublic( $this->page->projectid ); + $publisher = new Publisher( $project->projectid ); - $this->page->publisher = $publisher; - $this->page->publish(); - $publisher->close(); + foreach( $project->getModelIds() as $modelId ) { - $this->addNotice( 'page', - $this->page->fullFilename, - 'PUBLISHED', - OR_NOTICE_OK, - array(), - array_map(function($obj) { - return $obj['full_filename']; - },$publisher->publishedObjects) - ); - } + foreach( $project->getLanguageIds() as $languageId ) { + $pageContext = new PageContext( $this->page->objectid, Producer::SCHEME_PUBLIC ); + $pageContext->modelId = $modelId; + $pageContext->languageId = $languageId; - function setWindowMenu( $type ) { - switch( $type) - { - case 'elements': - $menu = array( array('subaction'=>'el' ,'text'=>'all'), - array('subaction'=>'form','text'=>'change' ) ); - $this->setTemplateVar('windowMenu',$menu); - break; - case 'acl': - $menu = array( array('subaction'=>'rights' ,'text'=>'show'), - array('subaction'=>'aclform','text'=>'add' ) ); - $this->setTemplateVar('windowMenu',$menu); - break; + $pageGenerator = new PageGenerator( $pageContext ); + $publisher->publish( $pageGenerator->getCache()->load()->getFilename(),$pageGenerator->getPublicFilename(), $this->page->lastchangeDate ); + } } + + $this->addNoticeFor( $this->page, + 'PUBLISHED', + array(), + implode("\n",$publisher->publishedObjects) + ); } + public function removeView() { $this->setTemplateVar( 'name',$this->page->filename ); @@ -847,6 +852,25 @@ class PageAction extends ObjectAction } -} -?>- \ No newline at end of file + protected function createPageContext( $scheme ) { + + $context = new PageContext( $this->page->objectid,$scheme ); + $context->sourceObjectId = $this->page->objectid; + + if ( $this->request->hasLanguageId()) + $context->languageId = $this->request->getLanguageId(); + + if ( $this->request->hasModelId()) + $context->modelId = $this->request->getModelId(); + + if ( !$context->languageId ) + $context->languageId = $this->page->getProject()->getDefaultLanguageId(); + + if ( !$context->modelId ) + $context->modelId = $this->page->getProject()->getDefaultModelId(); + + return $context; + } + +} diff --git a/modules/cms/action/PageelementAction.class.php b/modules/cms/action/PageelementAction.class.php @@ -2,6 +2,10 @@ namespace cms\action; +use cms\generator\PageContext; +use cms\generator\Producer; +use cms\generator\ValueContext; +use cms\generator\ValueGenerator; use cms\model\Acl; use cms\model\Project; use cms\model\User; @@ -115,6 +119,28 @@ class PageelementAction extends BaseAction } + protected function createValueContext( $scheme ) { + + $pageContext = new PageContext( $this->page->objectid,$scheme ); + + if ( $this->request->hasLanguageId()) + $pageContext->languageId = $this->request->getLanguageId(); + + if ( $this->request->hasModelId()) + $pageContext->modelId = $this->request->getModelId(); + + if ( !$pageContext->languageId ) + $pageContext->languageId = $this->page->getProject()->getDefaultLanguageId(); + + if ( !$pageContext->modelId ) + $pageContext->modelId = $this->page->getProject()->getDefaultModelId(); + + $valueContext = new ValueContext( $pageContext ); + $valueContext->elementid = $this->element->elementid; + + return $valueContext; + } + /** * Anzeigen des Element-Inhaltes. @@ -224,7 +250,7 @@ class PageelementAction extends BaseAction $languages[$languageId] = array( 'languageid' => $languageId, 'languagename' => $languageName, - 'value' => $this->value->generate() + 'value' => $this->value->value ); } @@ -263,7 +289,7 @@ class PageelementAction extends BaseAction $languages[$languageId] = array( 'languageid' => $languageId, 'languagename' => $languageName, - 'value' => $this->value->generate(), + 'value' => $this->value->value, 'editors' => Element::getAvailableFormats() ); } @@ -321,24 +347,8 @@ class PageelementAction extends BaseAction */ public function previewView() { - $this->value->languageid = $this->page->languageid; - $this->value->objectid = $this->page->objectid; - $this->value->pageid = $this->page->pageid; - $this->value->element = &$this->element; - $this->value->element->load(); - - if ( intval($this->value->valueid)!=0 ) - $this->value->loadWithId(); - else - $this->value->load(); - - - $this->value->page = new Page( $this->page->objectid ); - $this->value->page->languageid = $this->value->languageid; - $this->value->page->load(); - - $this->value->generate(); - $this->setTemplateVar('preview' ,$this->value->value ); + $valueGenerator = new ValueGenerator( $this->createValueContext( Producer::SCHEME_PREVIEW) ); + $this->setTemplateVar('preview' ,$valueGenerator->getCache()->get() ); } @@ -963,6 +973,7 @@ class PageelementAction extends BaseAction { $inputText = $this->getRequestVar('text','raw'); + /* if ( $this->hasRequestVar('preview') ) { $value->page = $this->page; @@ -971,7 +982,7 @@ class PageelementAction extends BaseAction $value->page->load(); $value->generate(); $this->setTemplateVar('preview',$value->value ); - } + }*/ $this->setTemplateVar( 'release' ,$this->page->hasRight(Acl::ACL_RELEASE) ); diff --git a/modules/cms/action/ProjectAction.class.php b/modules/cms/action/ProjectAction.class.php @@ -4,6 +4,8 @@ namespace cms\action; use cms\model\Project; use cms\model\Folder; +use language\Messages; +use logger\Logger; // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de @@ -69,7 +71,7 @@ class ProjectAction extends BaseAction $this->project->publishPageExtension = $this->getRequestVar('publishPageExtension',OR_FILTER_NUMBER ); $this->project->linkAbsolute = $this->getRequestVar('linksAbsolute' ,OR_FILTER_NUMBER ) == '1'; - $this->addNotice('project',$this->project->name,'SAVED','ok'); + $this->addNoticeFor($this->project,Messages::SAVED); $this->project->save(); // speichern $root = new Folder( $this->project->getRootObjectId() ); diff --git a/modules/cms/generator/BaseContext.class.php b/modules/cms/generator/BaseContext.class.php @@ -0,0 +1,12 @@ +<?php + + +namespace cms\generator; + + +abstract class BaseContext +{ + public $scheme; + + public abstract function getCacheKey(); +}+ \ No newline at end of file diff --git a/modules/cms/generator/BaseGenerator.class.php b/modules/cms/generator/BaseGenerator.class.php @@ -0,0 +1,24 @@ +<?php + + +namespace cms\generator; + + +use util\cache\FileCache; + +abstract class BaseGenerator implements Generator +{ + /** + * @var BaseContext + */ + protected $context; + + public function getCache() { + + return new FileCache( $this->context->getCacheKey(),function() { + return $this->generate(); + }, 0 ); + } + + protected abstract function generate(); +}+ \ No newline at end of file diff --git a/modules/cms/generator/FileContext.class.php b/modules/cms/generator/FileContext.class.php @@ -0,0 +1,36 @@ +<?php + + +namespace cms\generator; + + + +/** + * The page context, necessary for generating and publishing a page. + */ +class FileContext extends BaseContext +{ + /** + * File id. + * @var int + */ + public $sourceObjectId; + + /** + * FileContext constructor. + * @param $sourceObjectId + */ + public function __construct($sourceObjectId,$scheme ) + { + $this->sourceObjectId = $sourceObjectId; + $this->scheme = $scheme; + } + + public function getCacheKey() + { + return [ + $this->sourceObjectId, + $this->scheme + ]; + } +}+ \ No newline at end of file diff --git a/modules/cms/generator/FileGenerator.class.php b/modules/cms/generator/FileGenerator.class.php @@ -0,0 +1,29 @@ +<?php + + +namespace cms\generator; + + +use cms\model\File; + +class FileGenerator extends BaseGenerator +{ + + + public function __construct($fileContext ) + { + $this->context = $fileContext; + } + + protected function generate() + { + $file = new File( $this->context->sourceObjectId ); + return $file->loadValue(); + } + + public function getPublicFilename() + { + $file = new File( $this->context->sourceObjectId ); + return $file->filename(); + } +}+ \ No newline at end of file diff --git a/modules/cms/generator/Generator.class.php b/modules/cms/generator/Generator.class.php @@ -0,0 +1,12 @@ +<?php + + +namespace cms\generator; + + +interface Generator +{ + public function getCache(); + + public function getPublicFilename(); +}+ \ No newline at end of file diff --git a/modules/cms/generator/PageContext.class.php b/modules/cms/generator/PageContext.class.php @@ -4,10 +4,14 @@ namespace cms\generator; + +use cms\generator\link\PreviewLink; +use cms\generator\link\PublicLink; + /** * The page context, necessary for generating and publishing a page. */ -class PageContext +class PageContext extends BaseContext { /** @@ -16,6 +20,8 @@ class PageContext */ public $sourceObjectId; + public $objectId; + /** * Language. * @var int @@ -28,8 +34,40 @@ class PageContext */ public $modelId; - public function __construct( $sourceObjectId = null ) + /** + * @var link\PreviewLink|link\PublicLink + */ + public $linkFormat; + + public function __construct($objectId, $scheme ) { - $this->sourceObjectId = $sourceObjectId; + $this->objectId = $objectId; + $this->sourceObjectId = $objectId; + $this->scheme = $scheme; } + + public function getCacheKey() + { + return [ + $this->sourceObjectId, + $this->languageId, + $this->modelId, + $this->scheme + ]; + } + + + + public function getLinkScheme() { + + switch( $this->scheme ) { + case Producer::SCHEME_PREVIEW: + return new PreviewLink(); + case Producer::SCHEME_PUBLIC: + return new PublicLink(); + default: + return null; + } + } + } \ No newline at end of file diff --git a/modules/cms/generator/PageGenerator.class.php b/modules/cms/generator/PageGenerator.class.php @@ -0,0 +1,255 @@ +<?php + + +namespace cms\generator; + + +use cms\generator\PageContext; +use cms\model\File; +use cms\model\Folder; +use cms\model\Language; +use cms\model\Page; +use cms\model\Project; +use cms\model\Template; +use cms\model\TemplateModel; +use cms\model\Value; +use logger\Logger; +use util\exception\GeneratorException; +use util\Mustache; + + +class PageGenerator extends BaseGenerator +{ + + /** + * PageGenerator constructor. + * @param $pageContext PageContext + */ + public function __construct($pageContext ) + { + $this->context = $pageContext; + } + + + + /** + * Erzeugen der Inhalte zu allen Elementen dieser Seite + * wird von generate() aufgerufen + */ + protected function generatePageElements( $page ) + { + $values = array(); + + //if ( $this->publisher->isSimplePreview() ) + // $elements = $this->getWritableElements(); + //else + $elements = $page->getElements(); + + foreach( $elements as $elementid=>$element ) + { + // neues Inhaltobjekt erzeugen + $valueContext = new ValueContext($this->context); + $valueContext->elementid = $elementid; + $valueGenerator = new ValueGenerator( $valueContext ); + try { + $values[$elementid] = $valueGenerator->getCache()->get(); + } catch( \Exception $e ) { + // Unrecoverable Error while generating the content. + throw new GeneratorException('Could not generate Value',$e ); + } + + } + + return $values; + } + + + + /** + * Erzeugen des Inhaltes der gesamten Seite. + * + * @return String Inhalt + */ + private function generatePageValue() + { + global $conf; + + // Setzen der 'locale', damit sprachabhängige Systemausgaben (wie z.B. die + // Ausgabe von strftime()) in der korrekten Sprache dargestellt werden. + $language = new Language($this->context->languageId); + $language->load(); + + $language->setCurrentLocale(); + + $page = new Page( $this->context->sourceObjectId ); + $page->load(); + + $template = new Template( $page->templateid ); + $template->modelid = $this->context->modelId; + $template->load(); + $this->ext = $template->extension; + + $values = $this->generatePageElements( $page ); + + // Get a List with ElementId->ElementName + $elements = array_map(function($element) { + return $element->name; + },$page->getElements() ); + + $templatemodel = new TemplateModel( $template->templateid, $this->context->modelId ); + $templatemodel->load(); + $src = $templatemodel->src; + + $data = array(); + + // Template should have access to the page properties. + // Template should have access to the settings of this node object. + $data['_page' ] = $page->getProperties() ; + $data['_localsettings'] = $page->getSettings() ; + $data['_settings' ] = $page->getTotalSettings(); + + // No we are collecting the data and are fixing some old stuff. + + foreach( $elements as $elementId=>$elementName ) + { + $data[ $elementName ] = $values[$elementId]; + + // The following code is for old template values: + + // convert {{<id>}} to {{<name>}} + $src = str_replace( '{{'.$elementId.'}}','{{'.$elementName.'}}',$src ); + + $src = str_replace( '{{IFNOTEMPTY:'.$elementId.':BEGIN}}','{{#'.$elementName.'}}',$src ); + $src = str_replace( '{{IFNOTEMPTY:'.$elementId.':END}}' ,'{{/'.$elementName.'}}',$src ); + $src = str_replace( '{{IFEMPTY:' .$elementId.':BEGIN}}','{{^'.$elementName.'}}',$src ); + $src = str_replace( '{{IFEMPTY:' .$elementId.':END}}' ,'{{/'.$elementName.'}}',$src ); + + /*if ( $this->icons ) + $src = str_replace( '{{->'.$elementId.'}}','<a href="javascript:parent.openNewAction(\''.$elementName.'\',\'pageelement\',\''.$this->objectid.'_'.$value->element->elementid.'\');" title="'.$value->element->desc.'"><img src="'.OR_THEMES_DIR.$conf['interface']['theme'].'/images/icon_el_'.$value->element->type.IMG_ICON_EXT.'" border="0" align="left"></a>',$src ); + else*/ + $src = str_replace( '{{->'.$elementId.'}}','',$src ); + } + + Logger::trace( 'pagedata: '.print_r($data,true) ); + + // Now we have collected all data, lets call the template engine: + + $mustache = new Mustache(); + $mustache->escape = null; // No HTML escaping, this is the job of this CMS ;) + $mustache->partialLoader = function( $name ) use ($page,$template) { + + if ( substr($name,0,5) == 'file:') { + $fileid = intval( substr($name,5) ); + $file = new File( $fileid ); + return $file->loadValue(); + } + + + $project = Project::create( $page->projectid ); + $templateid = array_search($name,$project->getTemplates() ); + + if ( ! $templateid ) + throw new \InvalidArgumentException('template '.Logger::sanitizeInput($name).' not found'); + + if ( $templateid == $template->templateid ) + throw new \InvalidArgumentException('Template recursion detected on template-id '.$templateid); + + + $templatemodel = new TemplateModel( $templateid, $this->context->modelId ); + $templatemodel->load(); + + return $templatemodel->src; + }; + + try { + $mustache->parse($src); + } catch (\Exception $e) { + // Should we throw it to the caller? + // No, because it is not a technical error. So let's only log it. + Logger::warn("Template rendering failed: ".$e->getMessage() ); + return $e->getMessage(); + } + $src = $mustache->render( $data ); + + // now we have the fully generated source. + + // should we do a UTF-8-escaping here? + // Default should be off, because if you are fully using utf-8 (you should do), this is unnecessary. + if ( config('publish','escape_8bit_characters') ) + if ( substr($this->mimeType(),-4) == 'html' ) + { + /* + * + $src = htmlentities($src,ENT_NOQUOTES,'UTF-8'); + $src = str_replace('&lt;' , '<', $src); + $src = str_replace('&gt;' , '>', $src); + $src = str_replace('&amp;', '&', $src); + */ + $src = translateutf8tohtml($src); + } + + return $src; + } + + protected function generate() + { + return $this->generatePageValue(); + } + + + /** + * Creating the public filename of a page. + * + * @return string + * @throws \ObjectNotFoundException + */ + public function getPublicFilename() + { + $page = new Page( $this->context->sourceObjectId ); + $page->load(); + + $parentFolder = new Folder( $page->parentid ); + $parentFolder->load(); + + $project = $page->getProject(); + $project->load(); + + $format = config('publish','format'); + $format = str_replace('{filename}',$page->filename,$format ); + + $allLanguages = $project->getLanguageIds(); + $allModels = $project->getModelIds(); + + $withLanguage = count($allLanguages) > 1 || config('publish','filename_language') == 'always'; + $withModel = count($allModels ) > 1 || config('publish','filename_type' ) == 'always'; + + if ( !$withLanguage || $project->content_negotiation && config('publish','negotiation','page_negotiate_language' ) ) + { + $format = str_replace('{language}' ,'',$format ); + $format = str_replace('{language_sep}','',$format ); + } + else + { + $l = new Language( $this->context->languageId ); + $l->load(); + $format = str_replace('{language}' ,$l->isoCode ,$format ); + $format = str_replace('{language_sep}',config('publish','language_sep'),$format ); + } + + if ( !$withModel || $project->content_negotiation && config('publish','negotiation','page_negotiate_type' ) ) + { + $format = str_replace('{type}' ,'',$format ); + $format = str_replace('{type_sep}','',$format ); + } + else + { + $templateModel = new TemplateModel( $page->templateid, $this->context->modelId ); + $templateModel->load(); + + $format = str_replace('{type}' ,$templateModel->extension ,$format ); + $format = str_replace('{type_sep}',config('publish','type_sep'),$format ); + } + + return $page->path().'/'.$format; + } +}+ \ No newline at end of file diff --git a/modules/cms/generator/Producer.class.php b/modules/cms/generator/Producer.class.php @@ -0,0 +1,92 @@ +<?php + +namespace cms\generator; + + +use cms\generator\link\PreviewLink; +use cms\generator\link\PublicLink; +use cms\model\BaseObject; +use cms\model\File; +use cms\model\Page; + +class Producer { + + public $objectid; + + public $languages; + public $models; + + const SCHEME_PREVIEW = 1; + const SCHEME_EDIT = 2; + const SCHEME_PUBLIC = 3; + + + /** + * @var \util\cache\FileCache + */ + private $cache; + + + /** + * @param $object BaseObject + * @param $scheme + * @throws \ObjectNotFoundException + */ + public function generate( $object,$scheme ) { + + $project = $object->getProject(); + + if ( $this->languages ) + $languages = $this->languages; + else + $languages = $project->getLanguageIds(); + + if ( $this->models ) + $models = $this->models; + else + $models = $project->getModelIds(); + + + if ( $object instanceof File ) { + + $fileContext = new FileContext($object->objectid, $scheme); + + $generator = new FileGenerator( $fileContext); + } + + if ( $object instanceof Page ) { + + foreach( $models as $model ) { + + foreach ( $languages as $language ) { + $pageContext = new PageContext( $object->objectid,$scheme); + $pageContext->modelId = $model; + $pageContext->languageId = $language; + + $generator = new PageGenerator( $pageContext ); + } + } + } + + $this->cache = $generator->getCache(); + } + + + public function getValue() { + return $this->cache->get(); + } + + + public function getCache() { + return $this->cache; + } + + + public function publish() { + $publisher = new Publisher( ); + $publisher->publish( $this->cache->getFilename(), $this->filename, time() ); + } + + + +}+ \ No newline at end of file diff --git a/modules/cms/generator/PublishPreview.class.php b/modules/cms/generator/PublishPreview.class.php @@ -1,132 +0,0 @@ -<?php - -namespace cms\generator; - -use cms\model\Alias; -use cms\model\BaseObject; -use cms\model\Link; -use cms\model\Url; -use util\exception\GeneratorException; - -/** - * Created by PhpStorm. - * User: dankert - * Date: 10.08.18 - * Time: 23:47 - */ - -class PublishPreview extends Publish -{ - /** - * @param $from \cms\model\BaseObject - * @param $to \cms\model\BaseObject - */ - public function linkToObject( BaseObject $from, BaseObject $to ) - { - - $param = array( - 'oid' => '__OID__'.$to->objectid.'__', - REQ_PARAM_MODEL_ID => $from->modelid , - REQ_PARAM_LANGUAGE_ID => $from->languageid ); - - if ( $from->icons ) - $param['withIcons'] = '1'; - - - // Interne Verlinkungen in der Seitenvorschau - switch( $to->typeid ) - { - case BaseObject::TYPEID_FILE: - case BaseObject::TYPEID_IMAGE: - case BaseObject::TYPEID_TEXT: - $inhalt = \util\Html::url('file','show',$to->objectid,$param); - break; - case BaseObject::TYPEID_PAGE: - $inhalt = \util\Html::url('page','show',$to->objectid,$param); - break; - - case BaseObject::TYPEID_LINK: - $link = new Link( $to->objectid ); - $link->load(); - - $linkedObject = new BaseObject( $link->linkedObjectId ); - $linkedObject->objectLoad(); - - switch( $linkedObject->typeid ) - { - case BaseObject::TYPEID_FILE: - $inhalt = \util\Html::url('file','show',$link->linkedObjectId,$param); - break; - - case BaseObject::TYPEID_PAGE: - $inhalt = \util\Html::url('page','show',$link->linkedObjectId,$param); - break; - case BaseObject::TYPEID_URL: - $inhalt = \util\Html::url('url','show',$link->linkedObjectId,$param); - break; - default: - $inhalt = 'Unknown link type: '.$linkedObject->typeid; - } - break; - - case BaseObject::TYPEID_ALIAS: - $alias = new Alias( $to->objectid ); - $alias->load(); - $alias->linkedObjectId; - - $linkedObject = new BaseObject( $alias->linkedObjectId ); - $linkedObject->objectLoad(); - - switch( $linkedObject->typeid ) - { - case BaseObject::TYPEID_FILE: - $inhalt = \util\Html::url('file','show',$alias->linkedObjectId,$param); - break; - - case BaseObject::TYPEID_PAGE: - $inhalt = \util\Html::url('page','show',$alias->linkedObjectId,$param); - break; - default: - $inhalt = 'Unknown link type: '.$linkedObject->typeid; - } - break; - - case BaseObject::TYPEID_URL: - $url = new Url( $to->objectid ); - $url->load(); - $inhalt = $url->url; - - break; - default: - throw new GeneratorException('Unknown type '.$to->typeid.' in target '.$to->__toString() ); - - } - - return $inhalt; - - } - - public function isPublic() - { - return false; - } - - public function copy($tmp_filename,$dest_filename,$lastChangeDate=null) - { - // nothing to do. - } - - public function clean() - { - // nothing to do. - } - - public function close() - { - // nothing to do. - } - public function isSimplePreview() - { - return false; - } -} diff --git a/modules/cms/generator/PublishPublic.class.php b/modules/cms/generator/PublishPublic.class.php @@ -1,389 +0,0 @@ -<?php - -namespace cms\generator; - -use cms\model\BaseObject; -use cms\model\File; -use cms\model\Folder; -use cms\model\Link; -use cms\model\Page; -use cms\model\Project; -use cms\model\Url; -use cms\generator\target\Dav; -use cms\generator\target\Fax; -use cms\generator\target\Ftp; -use cms\generator\target\Ftps; -use cms\generator\target\Local; -use cms\generator\target\NoTarget; -use cms\generator\target\Scp; -use cms\generator\target\SFtp; -use cms\generator\target\Target; -use util\exception\PublisherException; -use util\FileUtils; -use logger\Logger; -use util\exception\UIException; -use util\Session; - - - -/** - * User: dankert - * Date: 10.08.18 - * Time: 23:47 - */ - -class PublishPublic extends Publish -{ - const SCHEMA_ABSOLUTE = 1; - const SCHEMA_RELATIVE = 2; - - const MAX_RECURSIVE_COUNT = 10; - - - /** - * The target to which the file will be copied to. - * - * @var Target - */ - private $target; - - private $localDestinationDirectory = ''; - - /** - * Enthaelt die gleichnamige Einstellung aus dem Projekt. - * @var boolean - */ - private $contentNegotiation = false; - - /** - * Enthaelt die gleichnamige Einstellung aus dem Projekt. - * @var boolean - */ - private $cutIndex = false; - - /** - * Enthaelt die gleichnamige Einstellung aus dem Projekt. - * @var String - */ - private $commandAfterPublish = ''; - - /** - * Enthaelt am Ende der Ver�ffentlichung ein Array mit den ver�ffentlichten Objekten. - * @var Array - */ - public $publishedObjects = array(); - - /** - * Enthaelt im Fehlerfall (wenn 'ok' auf 'false' steht) eine - * Fehlermeldung. - * - * @var String - */ - public $log = array(); - - /** - * Konstruktor.<br> - * <br> - * Oeffnet ggf. Verbindungen. - * - * @return Publish - */ - public function __construct( $projectid ) - { - $confPublish = config('publish'); - - $project = Project::create( $projectid ); - $project->load(); - - $this->linkSchema = ($project->linkAbsolute ? self::SCHEMA_ABSOLUTE : self::SCHEMA_RELATIVE); - - $targetScheme = parse_url( $project->target_dir,PHP_URL_SCHEME ); - - $availableTargets = [ Local::class,Ftp::class,Ftps::class,Fax::class,SFtp::class,Scp::class,Dav::class ]; - - /** @var Target $target */ - foreach($availableTargets as $target ) - { - if ( $target::isAvailable() && $target::accepts( $targetScheme )) - { - $this->target = new $target( $project->target_dir ); - break; - } - } - - if ( empty( $this->target ) ) - throw new PublisherException('Cannot publish to the scheme '.$targetScheme ); - - $this->contentNegotiation = ( $project->content_negotiation == '1' ); - $this->cutIndex = ( $project->cut_index == '1' ); - - if ( $confPublish['command']['enable'] ) - { - if ( $confPublish['command']['per_project'] && !empty($project->cmd_after_publish) ) - $this->commandAfterPublish = $project->cmd_after_publish; - else - $this->commandAfterPublish = @$confPublish['command']['command']; - } - - // Im Systemkommando Variablen ersetzen - $this->commandAfterPublish = str_replace('{name}' ,$project->name ,$this->commandAfterPublish); - $this->commandAfterPublish = str_replace('{dir}' ,$this->localDestinationDirectory ,$this->commandAfterPublish); - $this->commandAfterPublish = str_replace('{dirbase}',basename($this->localDestinationDirectory),$this->commandAfterPublish); - - if ( config('security','nopublish') ) - { - $this->target = new NoTarget(); - Logger::warn('publishing is disabled.'); - } - } - - - - /** - * @var int - */ - private $linkSchema; - - /** - * @param $from \cms\model\BaseObject - * @param $to \cms\model\BaseObject - */ - public function linkToObject( BaseObject $from, BaseObject $to ) { - - $schema = $this->linkSchema; - - $counter = 0; - while( $to->typeid == BaseObject::TYPEID_LINK ) - { - if ( $counter++ > self::MAX_RECURSIVE_COUNT) - throw new \LogicException("Too much redirects while following a link. Stopped at #".$to->objectid ); - - $link = new Link( $to->objectid ); - $link->load(); - - $to = new BaseObject( $link->linkedObjectId ); - $to->objectLoad(); - } - - switch( $to->typeid ) - { - case BaseObject::TYPEID_FILE: - case BaseObject::TYPEID_IMAGE: - case BaseObject::TYPEID_TEXT: - - $f = new File( $to->objectid ); - - $p = Project::create( $to->projectid )->load(); - $f->content_negotiation = $p->content_negotiation; - - $f->load(); - $filename = $f->filename(); - break; - - case BaseObject::TYPEID_PAGE: - - $p = new Page( $to->objectid ); - $p->languageid = $from->languageid; - $p->modelid = $from->modelid; - $p->cut_index = $from->cut_index; - $p->content_negotiation = $from->content_negotiation; - $p->withLanguage = $from->withLanguage; - $p->withModel = $from->withModel; - $p->load(); - $filename = $p->getFilename(); - break; - - case BaseObject::TYPEID_URL: - $url = new Url( $to->objectid ); - $url->load(); - return $url->url; - default: - throw new \LogicException("Could not build a link to the unknown Type ".$to->typeid.':'.$to->getType() ); - } - - - if ( $from->projectid != $to->projectid ) - { - // Target object is in another project. - // we have to use absolute URLs. - $schema = self::SCHEMA_ABSOLUTE; - - // Target is in another Project. So we have to create an absolute URL. - $targetProject = Project::create( $to->projectid )->load(); - $host = $targetProject->url; - - if ( ! strpos($host,'//' ) === FALSE ) { - // No protocol in hostname. So we have to prepend the URL with '//'. - $host = '//'.$host; - } - } - else { - $host = ''; - } - - - - - if ( $schema == self::SCHEMA_RELATIVE ) - { - $folder = new Folder( $from->getParentFolderId() ); - $folder->load(); - $fromPathFolders = $folder->parentObjectFileNames(false,true); - - $folder = new Folder($to->getParentFolderId() ); - - $toPathFolders = $folder->parentObjectFileNames(false, true); - - // Shorten the relative URL - // if the actual page is /path/folder1/page1 - // and the target page is /path/folder2/page2 - // we shorten the link from ../../path/folder2/page2 - // to ../folder2/page2 - foreach( $fromPathFolders as $folderId => $folderFileName ) { - if ( count($toPathFolders) >= 1 && array_keys($toPathFolders)[0] == $folderId ) { - unset( $fromPathFolders[$folderId] ); - unset( $toPathFolders [$folderId] ); - }else { - break; - } - - } - - if ( $fromPathFolders ) - $path = str_repeat( '../',count($fromPathFolders) ); - else - $path = './'; // Just to clarify- this could be blank too. - - if ( $toPathFolders ) - $path .= implode('/',$toPathFolders).'/'; - } - else { - // Absolute Pfadangaben - $folder = new Folder( $to->getParentFolderId() ); - $toPathFolders = $folder->parentObjectFileNames(false, true); - - $path = '/'; - - if ( $toPathFolders ) - $path .= implode('/',$toPathFolders).'/'; - } - - - $uri = $host . $path . $filename; - - if( !$uri ) - $uri = '.'; - - return $uri; - } - - - - - - /** - * Kopieren einer Datei aus dem tempor�ren Verzeichnis in das Zielverzeichnis.<br> - * Falls notwenig, wird ein Hochladen per FTP ausgef�hrt. - * - * @param String $tmp_filename - * @param String $dest_filename - */ - public function copy( $tmp_filename,$dest_filename,$lastChangeDate=null ) - { - $this->target->put($tmp_filename,$dest_filename,$lastChangeDate); - } - - - - - /** - * Beenden des Ver�ffentlichungs-Vorganges.<br> - * Eine vorhandene FTP-Verbindung wird geschlossen.<br> - * Falls entsprechend konfiguriert, wird ein Systemkommando ausgef�hrt. - */ - public function close() - { - $this->target->close(); - - // Ausfuehren des Systemkommandos. - if ( !empty($this->commandAfterPublish) ) - { - $ausgabe = array(); - $rc = false; - Logger::debug('Executing system command: '.Logger::sanitizeInput($this->commandAfterPublish) ); - $user = Session::getUser(); - putenv("CMS_USER_NAME=".$user->name ); - putenv("CMS_USER_ID=" .$user->userid); - putenv("CMS_USER_MAIL=".$user->mail ); - - exec( $this->commandAfterPublish,$ausgabe,$rc ); - - if ( $rc != 0 ) // Wenn Returncode ungleich 0, dann Fehler melden. - throw new PublisherException('System command failed - returncode is ' . $rc . "\n" . - $ausgabe); - else - Logger::debug('System command successful' ); - - } - } - - - - /** - * Aufraeumen des Zielverzeichnisses.<br><br> - * Es wird der komplette Zielordner samt Unterverzeichnissen durchsucht. Jede - * Datei, die laenger existiert als der aktuelle Request alt ist, wird geloescht.<br> - * Natuerlich darf diese Funktion nur nach einem Gesamt-Veroeffentlichen ausgefuehrt werden. - */ - public function clean() - { - if ( !empty($this->localDestinationDirectory) ) - $this->cleanFolder($this->localDestinationDirectory); - } - - - - /** - * Aufr�umen eines Verzeichnisses.<br><br> - * Dateien, die l�nger existieren als der aktuelle Request alt ist, werden gel�scht.<br> - * - * @param String Verzeichnis - */ - private function cleanFolder( $folderName ) - { - $dh = opendir( $folderName ); - - while( $file = readdir($dh) ) - { - if ( $file != '.' && $file != '..') - { - $fullpath = $folderName.'/'.$file; - - // Wenn eine Datei beschreibbar und entsprechend alt - // ist, dann entfernen - if ( is_file($fullpath) && - is_writable($fullpath) && - filemtime($fullpath) < START_TIME ) - unlink($fullpath); - - // Bei Ordnern rekursiv absteigen - if ( is_dir( $fullpath) ) - { - $this->cleanFolder($fullpath); - @rmdir($fullpath); - } - } - } - } - - - public function isSimplePreview() - { - return false; - } - - public function isPublic() - { - return true; - } -}- \ No newline at end of file diff --git a/modules/cms/generator/Publisher.class.php b/modules/cms/generator/Publisher.class.php @@ -0,0 +1,203 @@ +<?php + + +namespace cms\generator; + + +use cms\generator\target\Dav; +use cms\generator\target\Fax; +use cms\generator\target\Ftp; +use cms\generator\target\Ftps; +use cms\generator\target\Local; +use cms\generator\target\NoBaseTarget; +use cms\generator\target\Scp; +use cms\generator\target\SFtp; +use cms\generator\target\BaseTarget; +use cms\model\BaseObject; +use cms\model\File; +use cms\model\Folder; +use cms\model\Link; +use cms\model\Page; +use cms\model\Project; +use cms\model\Url; +use logger\Logger; +use util\exception\PublisherException; +use util\Session; +use util\text\variables\VariableResolver; + +/** + * Publisher for publishing files. + * + * This publisher is publishing files to the live server. It doesn't care about the node type, it just publishes files. + * + * @package cms\generator + */ +class Publisher +{ + /** + * The target to which the file will be copied to. + * + * @var BaseTarget + */ + private $target; + + private $localDestinationDirectory = ''; + + /** + * Enthaelt die gleichnamige Einstellung aus dem Projekt. + * @var boolean + */ + private $contentNegotiation = false; + + /** + * Enthaelt die gleichnamige Einstellung aus dem Projekt. + * @var boolean + */ + private $cutIndex = false; + + /** + * Enthaelt die gleichnamige Einstellung aus dem Projekt. + * @var String + */ + private $commandAfterPublish = ''; + + /** + * Enthaelt am Ende der Ver�ffentlichung ein Array mit den ver�ffentlichten Objekten. + * @var Array + */ + public $publishedObjects = array(); + + /** + * Enthaelt im Fehlerfall (wenn 'ok' auf 'false' steht) eine + * Fehlermeldung. + * + * @var String + */ + public $log = array(); + + /** + * @var Project + */ + private $project; + + public function __construct( $projectid ) + { + $this->project = Project::create( $projectid ); + $this->project->load(); + + $this->init(); + } + + public function publish( $filename,$destination,$time ) { + $this->target->put( $filename,$destination,$time ); + + $this->publishedObjects[] = $destination; + } + + + public function cleanOlderThan( $time ) { + + if ( $this->target instanceof Local ) + $this->target->clean(); + + } + + + + /** + * Konstruktor.<br> + * <br> + * Oeffnet ggf. Verbindungen. + * + * @return Publish + */ + public function init() + { + $confPublish = config('publish'); + + if ( config('security','nopublish') ) + { + $this->target = new NoBaseTarget(); + Logger::warn('publishing is disabled.'); + } + + + $targetScheme = parse_url( $this->project->target_dir,PHP_URL_SCHEME ); + + $availableTargets = [ Local::class,Ftp::class,Ftps::class,Fax::class,SFtp::class,Scp::class,Dav::class ]; + + /** @var BaseTarget $target */ + foreach($availableTargets as $target ) + { + if ( $target::accepts( $targetScheme )) + { + if ( ! $target::isAvailable() ) + throw new PublisherException('The target "'.$targetScheme.'" is not available.' ); + + $this->target = new $target( $this->project->target_dir ); + break; + } + } + + if ( empty( $this->target ) ) + throw new PublisherException('The scheme "'.$targetScheme.'" is not supported.' ); + + $this->contentNegotiation = ( $this->project->content_negotiation == '1' ); + $this->cutIndex = ( $this->project->cut_index == '1' ); + + if ( $confPublish['command']['enable'] ) + { + if ( $confPublish['command']['per_project'] && !empty($project->cmd_after_publish) ) + $this->commandAfterPublish = $project->cmd_after_publish; + else + $this->commandAfterPublish = @$confPublish['command']['command']; + } + + // Im Systemkommando Variablen ersetzen + $resolver = new VariableResolver(); + $resolver->addResolver('project', function( $property) { + return @$this->project->getProperties()[$property]; + }); + $resolver->addResolver('target', function( $property) { + return @parse_url( $this->project->target_dir )[$property]; + }); + + $this->commandAfterPublish = $resolver->resolveVariables( $this->commandAfterPublish ); + + } + + + + /** + * Beenden des Ver�ffentlichungs-Vorganges.<br> + * Eine vorhandene FTP-Verbindung wird geschlossen.<br> + * Falls entsprechend konfiguriert, wird ein Systemkommando ausgef�hrt. + */ + public function end() + { + $this->target->close(); + + // Ausfuehren des Systemkommandos. + if ( !empty($this->commandAfterPublish) ) + { + $ausgabe = array(); + $rc = false; + Logger::debug('Executing system command: '.Logger::sanitizeInput($this->commandAfterPublish) ); + $user = Session::getUser(); + putenv("CMS_USER_NAME=".$user->name ); + putenv("CMS_USER_ID=" .$user->userid); + putenv("CMS_USER_MAIL=".$user->mail ); + + exec( $this->commandAfterPublish,$ausgabe,$rc ); + + if ( $rc != 0 ) // Wenn Returncode ungleich 0, dann Fehler melden. + throw new PublisherException('System command failed - returncode is ' . $rc . "\n" . + $ausgabe); + else + Logger::debug('System command successful' ); + + } + } + + +}+ \ No newline at end of file diff --git a/modules/cms/generator/ValueContext.class.php b/modules/cms/generator/ValueContext.class.php @@ -0,0 +1,37 @@ +<?php + + +namespace cms\generator; + + + +use cms\generator\link\PreviewLink; +use cms\generator\link\PublicLink; + +/** + * The page context, necessary for generating and publishing a page. + */ +class ValueContext extends BaseContext +{ + public $elementid; + + /** + * @var PageContext + */ + public $pageContext; + + public function __construct($pageContext ) + { + $this->pageContext = $pageContext; + $this->scheme = $pageContext->scheme; + } + + public function getCacheKey() + { + return array_merge( ['value'], $this->pageContext->getCacheKey(), [ $this->elementid ] ); + } + + public function isPublic() { + return $this->scheme == Producer::SCHEME_PUBLIC; + } +}+ \ No newline at end of file diff --git a/modules/cms/generator/ValueGenerator.class.php b/modules/cms/generator/ValueGenerator.class.php @@ -0,0 +1,1024 @@ +<?php + + +namespace cms\generator; + + +use cms\macros\MacroRunner; +use cms\model\BaseObject; +use cms\model\Element; +use cms\model\File; +use cms\model\Folder; +use cms\model\Image; +use cms\model\Language; +use cms\model\Link; +use cms\model\Page; +use cms\model\Project; +use cms\model\Template; +use cms\model\Value; +use logger\Logger; +use LogicException; +use util\Code; +use util\exception\GeneratorException; +use util\exception\PublisherException; +use util\Html; +use util\Http; +use util\Text; +use util\Transformer; + + +class ValueGenerator extends BaseGenerator +{ + + /** + * PageGenerator constructor. + * @param $valueContext ValueContext + */ + public function __construct($valueContext ) + { + $this->context = $valueContext; + } + + + + protected function generate() + { + return $this->generateValue(); + } + + + + + /** + * Hier findet die eigentliche Bereitstellung des Inhaltes statt, zu + * jedem Elementtyp wird ein Inhalt ermittelt. + * + * @return void (aber Eigenschaft 'value' wird gesetzt). + */ + private function generateValue() + { + $pageContext = $this->context->pageContext; + $page = new Page( $pageContext->objectId ); + $page->load(); + + $element = new Element( $this->context->elementid ); + $element->load(); + + $value = new Value(); + $value->pageid = $page->pageid; + $value->elementid = $this->context->elementid; + $value->languageid = $pageContext->languageId; + $value->load(); + + $inhalt = ''; + + global $conf; + + // Inhalt ist mit anderer Seite verkn�pft. + if ( in_array($element->typeid,[Element::ELEMENT_TYPE_TEXT,Element::ELEMENT_TYPE_LONGTEXT,Element::ELEMENT_TYPE_DATE,Element::ELEMENT_TYPE_NUMBER]) && intval($value->linkToObjectId) != 0 && !$value->isLink ) + { + $pageContext = clone $this->context->pageContext; + $pageContext->objectId = $value->linkToObjectId; + + $valueContext = clone $this->context; + $valueContext->pageContext = $pageContext; + + $generator = new ValueGenerator( $valueContext ); + + return $generator->getCache()->get(); + } + + switch( $element->typeid ) + { + case Element::ELEMENT_TYPE_INSERT: + + $objectid = $value->linkToObjectId; + + if ( intval($objectid) == 0 ) + $objectid = $element->defaultObjectId; + + if ( ! BaseObject::available( $objectid) ) + return; + + $object = new BaseObject( $objectid ); + $object->objectLoadRaw(); + + if ( $object->isFolder ) + { + if ( false&&$value->publisher->isSimplePreview() ) // FIXME + { + $f = new Folder( $objectid ); + $f->load(); + $inhalt = $f->filename; + unset( $f ); + } + else + { + if ( $objectid != $page->objectid ) // Rekursion vermeiden + { + $f = new Folder( $objectid ); + foreach( $f->getObjectIds() as $oid ) + { + if ( $oid != $page->objectid ) // Rekursion vermeiden + { + switch( $element->subtype ) + { + case '': + case 'inline': + $o = new BaseObject( $oid ); + $o->load(); + switch( $o->typeid ) + { + case BaseObject::TYPEID_PAGE: + $newPageContext = clone $pageContext; + $newPageContext->objectId = $oid; + $pageGenerator = new PageGenerator( $newPageContext ); + + $inhalt .= $pageGenerator->getCache()->get(); + + break; + case BaseObject::TYPEID_LINK: + $l = new Link( $oid ); + $l->load(); + if ( $l->isLinkToObject ) + { + $op = new BaseObject( $l->linkedObjectId ); + $op->load(); + if ( $op->isPage ) + { + $newPageContext = clone $pageContext; + $newPageContext->objectId = $l->linkedObjectId; + $pageGenerator = new PageGenerator( $newPageContext ); + + $inhalt .= $pageGenerator->getCache()->get(); + } + } + break; + } + break; + + case 'ssi': + $inhalt .= '<!--#include virtual="'.$page->path_to_object($oid).'" -->'; + break; + + default: + $inhalt = '?'.$element->subtype.'?'; + } + } + else throw new \LogicException('FATAL: recursion detected'); + } + } + else throw new LogicException('FATAL: recursion detected'); + } + } + elseif ( $object->isPage ) + { + if ( $value->publisher->isSimplePreview() ) + { + $p = new Page( $objectid ); + $p->context = $page->context; + $p->load(); + $inhalt = $p->filename; + unset( $p ); + } + else + { + if ( $objectid != $page->objectid ) // Rekursion vermeiden + { + switch( $element->subtype ) + { + case '': + case 'inline': + $newPageContext = clone $pageContext; + $newPageContext->objectId = $objectid; + $pageGenerator = new PageGenerator( $newPageContext ); + + $inhalt = $pageGenerator->getCache()->get(); + unset( $p ); + break; + + case 'ssi': + $inhalt = '<!--#include virtual="'.$page->path_to_object($objectid).'" -->'; + break; + + default: + $inhalt = '?'.$element->subtype.'?'; + break; + } + } + else throw new LogicException('FATAL: recursion detected'); + } + } + + if ( false&& $value->publisher->isSimplePreview() ) + { + $inhalt = strip_tags( $inhalt ); + $inhalt = str_replace( "\n",'',$inhalt ); + $inhalt = str_replace( "\r",'',$inhalt ); + } + + break; + + + case Element::ELEMENT_TYPE_LINK: + + $objectid = $value->linkToObjectId; + if ( intval($objectid) == 0 ) + $objectid = $element->defaultObjectId; + + if ( $objectid==0 ) + { + // Link noch nicht gefuellt + $inhalt = ''; + } + elseif ( ! BaseObject::available($objectid) ) + { + $inhalt = /*$value->publisher->isSimplePreview()?'-':*/''; + } + elseif ( /*$value->publisher->isSimplePreview()*/false ) + { + $o = new BaseObject( $objectid ); + $o->load(); + $inhalt = $o->filename; + } + elseif ($element->subtype == 'image_data_uri' ) + { + $file = new File($objectid); + $file->load(); + $inhalt = 'data:'.$file->mimeType().';base64,'.base64_encode($file->loadValue()); + } + else + { + $linkScheme = $pageContext->getLinkScheme(); + $target = new BaseObject( $objectid ); + $target->load(); + + $inhalt = $linkScheme->linkToObject( $page, $target ); + } + + break; + + + case Element::ELEMENT_TYPE_COPY: + + list($linkElementName,$targetElementName) = explode('%',$element->name.'%'); + + if ( empty($targetElementName) ) + break; + + $element = new Element(); + $element->name = $linkElementName; + $element->load(); + + if ( intval($element->elementid)==0 ) + break; + + $linkValue = new Value(); + $linkValue->elementid = $element->elementid; + $linkValue->element = $element; + $linkValue->pageid = $page->pageid; + $linkValue->page = $page; + $linkValue->languageid = $value->languageid; + $linkValue->load(); + + if ( !BaseObject::available( $linkValue->linkToObjectId ) ) + break; + + $linkedPage = new Page( $linkValue->linkToObjectId ); + $linkedPage->context = $page->context; + $linkedPage->load(); + + $linkedPageTemplate = new Template( $linkedPage->templateid ); + $targetElementId = array_search( $targetElementName, $linkedPageTemplate->getElementNames() ); + + if ( intval($targetElementId)==0 ) + break; + + $valueContext = new ValueContext( $pageContext ); + $valueContext->elementid = $targetElementId; + + $value = new ValueGenerator($valueContext); + $inhalt = $value->getCache()->get(); + + break; + + + case Element::ELEMENT_TYPE_LINKINFO: + + @list( $linkElementName, $name ) = explode('%',$element->name); + if ( is_null($name) ) + break; + + $template = new Template( $page->templateid ); + $elementId = array_search( $linkElementName, $template->getElementNames() ); + + + $element = new Element($elementId); + $element->load(); + + $linkValue = new Value(); + $linkValue->elementid = $element->elementid; + $linkValue->element = $element; + $linkValue->pageid = $page->pageid; + $linkValue->languageid = $value->languageid; + $linkValue->publisher = $value->publisher; + $linkValue->load(); + + $objectid = $linkValue->linkToObjectId; + + if ( intval($objectid) == 0 ) + $objectid = $linkValue->element->defaultObjectId; + + if ( !BaseObject::available( $objectid ) ) + break; + + $linkedObject = new BaseObject( $objectid ); + $linkedObject->languageid = $value->languageid; + $linkedObject->load(); + + switch( $element->subtype ) + { + case 'width': + $f = new Image( $objectid ); + $f->load(); + if ( $f->isImage() ) + { + $f->getImageSize(); + $inhalt = $f->width; + } + unset($f); + break; + + case 'height': + $f = new Image( $objectid ); + $f->load(); + if ( $f->isImage() ) + { + $f->getImageSize(); + $inhalt = $f->height; + } + unset($f); + break; + + case 'id': + $inhalt = $objectid; + break; + + case 'name': + $inhalt = $linkedObject->name; + break; + + case 'description': + $inhalt = $linkedObject->description; + break; + + case 'create_user_desc': + $user = $linkedObject->createUser; + try + { + $user->load(); + $inhalt = $user->desc; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'create_user_fullname': + $user = $linkedObject->createUser; + try + { + $user->load(); + $inhalt = $user->fullname; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'create_user_mail': + $user = $linkedObject->createUser; + try + { + $user->load(); + $inhalt = $user->mail; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'create_user_tel': + $user = $linkedObject->createUser; + try + { + $user->load(); + $inhalt = $user->tel; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'create_user_username': + $user = $linkedObject->createUser; + try + { + $user->load(); + $inhalt = $user->name; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'lastch_user_desc': + $user = $linkedObject->lastchangeUser; + try + { + $user->load(); + $inhalt = $user->desc; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'lastch_user_fullname': + $user = $linkedObject->lastchangeUser; + try + { + $user->load(); + $inhalt = $user->fullname; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'lastch_user_mail': + $user = $linkedObject->lastchangeUser; + try + { + $user->load(); + $inhalt = $user->mail; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'lastch_user_tel': + $user = $linkedObject->lastchangeUser; + try + { + $user->load(); + $inhalt = $user->tel; + } + catch( ObjectNotFoundException $e ) + { + } + + break; + + case 'lastch_user_username': + $user = $linkedObject->lastchangeUser; + try + { + $user->load(); + $inhalt = $user->name; + } + catch( ObjectNotFoundException $e ) + { + } + break; + + case 'mime-type': + if ( $linkedObject->isFile || $linkedObject->isImage || $linkedObject->isText ) + { + $f = new File( $objectid ); + $f->load(); + $inhalt = $f->mimeType(); + unset($f); + } + break; + + case 'filename': + $inhalt = $linkedObject->filename(); + break; + + case 'full_filename': + $inhalt = $linkedObject->full_filename(); + break; + + default: + $inhalt = ''; + Logger::error('subtype for linkinfo not implemented:'.$element->subtype); + } + + break; + + case Element::ELEMENT_TYPE_LINKDATE: + + @list( $linkElementName, $name ) = explode('%',$element->name); + if ( is_null($name) ) + break; + + $template = new Template( $page->templateid ); + $elementId = array_search( $linkElementName, $template->getElementNames() ); + + $element = new Element($elementId); + $element->load(); + + $linkValue = new Value(); + $linkValue->elementid = $element->elementid; + $linkValue->element = $element; + $linkValue->pageid = $page->pageid; + $linkValue->languageid = $value->languageid; + $linkValue->load(); + + $objectid = $linkValue->linkToObjectId; + + if ( intval($objectid) == 0 ) + $objectid = $linkValue->element->defaultObjectId; + + if ( !BaseObject::available( $objectid ) ) + break; + + $linkedObject = new BaseObject( $objectid ); + $linkedObject->load(); + + + switch( $element->subtype ) + { + case 'date_published': + // START_TIME wird zu Beginn im Controller gesetzt. + // So erh�lt jede Datei das gleiche Ver�ffentlichungsdatum. + $date = START_TIME; + break; + + case 'date_saved': + $date = $linkedObject->lastchangeDate; + break; + + case 'date_created': + $date = $linkedObject->createDate; + break; + + default: + Logger::warn('element:'.$element->name.', '. + 'type:'.$element->type.', '. + 'unknown subtype:'.$element->subtype); + $date = START_TIME; + } + + if ( strpos($element->dateformat,'%')!==FALSE ) + $inhalt = strftime( $element->dateformat,$date ); + else + $inhalt = date ( $element->dateformat,$date ); + break; + + case Element::ELEMENT_TYPE_LONGTEXT: + case Element::ELEMENT_TYPE_TEXT: + case Element::ELEMENT_TYPE_SELECT: + + $inhalt = $value->text; + $format = $value->format; + + // Wenn Inhalt leer, dann versuchen, den Inhalt der Default-Sprache zu laden. + if ( $inhalt == '' && $conf['content']['language']['use_default_language'] ) + { + $project = new Project($page->projectid); + $value->languageid = $project->getDefaultLanguageId(); + $value->load(); + $inhalt = $value->text; + } + + // Wenn Inhalt leer, dann Vorbelegung verwenden + if ( $inhalt == '' ) { + + $inhalt = $element->defaultText; + $format = $element->format; + } + + // Wenn HTML nicht erlaubt und Wiki-Formatierung aktiv, dann einfache HTML-Tags in Wiki umwandeln + $pageIsHtml = $page->isHtml(); + + // + switch( $format ) + { + case Element::ELEMENT_FORMAT_TEXT: + case Element::ELEMENT_FORMAT_HTML: + + if ( !$element->html ) + { + // HTML not allowed. + $inhalt = Text::encodeHtml( $inhalt ); + $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); + } + + break; + + case Element::ELEMENT_FORMAT_WIKI: + + if ( $conf['editor']['wiki']['convert_bbcode'] ) + $inhalt = Text::bbCode2Wiki( $inhalt ); + + if ( !$element->html && $conf['editor']['wiki']['convert_html'] && $pageIsHtml) + $inhalt = Text::html2Wiki( $inhalt ); + + $transformer = new Transformer(); + $transformer->text = $inhalt; + $transformer->page = $page; + $transformer->pageContext = $pageContext; + $transformer->element = $element; + + $transformer->transform(); + $inhalt = $transformer->text; + break; + + case Element::ELEMENT_FORMAT_MARKDOWN: + + $mdConfig = Config()->subset('editor')->subset('markdown'); + + $parser = new \util\Parsedown(); + $parser->setUrlsLinked( $mdConfig->is('urls-linked',true)); + $parser->setMarkupEscaped( !$element->html ); + + $inhalt = $parser->parse( $inhalt ); + break; + + default: + throw new \LogicException('Unknown format: '.$value->format ); + } + + /*if ( $value->publisher->isSimplePreview() ) + { + // Simple Preview with bare text. + $inhalt = strip_tags( $inhalt ); + $inhalt = str_replace( "\n",'',$inhalt ); + $inhalt = str_replace( "\r",'',$inhalt ); + }*/ + + // "__OID__nnn__" ersetzen durch einen richtigen Link + foreach( Text::parseOID($inhalt) as $oid=>$t ) + { + $linkFormat = $pageContext->getLinkScheme(); + $target = new BaseObject($oid); + $target->load(); + $url = $linkFormat->linkToObject($page,$target); + + foreach( $t as $match ) + $inhalt = str_replace($match,$url,$inhalt); + } + + break; + + + // Zahl + // + // wird im entsprechenden Format angezeigt. + case Element::ELEMENT_TYPE_NUMBER: + + if ( $value->number == 0 ) + { + // Zahl ist gleich 0, dann Default-Text + $inhalt = $element->defaultText; + break; + } + + $number = $value->number / pow(10,$element->decimals); + $inhalt = number_format( $number,$element->decimals,$element->decPoint,$element->thousandSep ); + + break; + + + // Datum + case Element::ELEMENT_TYPE_DATE: + + $date = $value->date; + + if ( intval($date) == 0 ) + { + // Datum wurde noch nicht eingegeben + $inhalt = $element->defaultText; + break; + } + + // Datum gemaess Elementeinstellung formatieren + if ( strpos($element->dateformat,'%')!==FALSE ) + $inhalt = strftime( $element->dateformat,$date ); + else + $inhalt = date ( $element->dateformat,$date ); + break; + + + // Programmcode (PHP) + case Element::ELEMENT_TYPE_CODE: + + /*if ( $value->publisher->isSimplePreview() ) + break;*/ + + // Die Ausführung von benutzer-erzeugtem PHP-Code kann in der + // Konfiguration aus Sicherheitsgründen deaktiviert sein. + if ( $conf['security']['disable_dynamic_code'] ) + { + Logger::warn("Execution of dynamic code elements is disabled by configuration. Set security/disable_dynamic_code to true to allow this"); + break; + } + + $page->load(); + + // Das Ausführen geschieht über die Klasse "Code". + // In dieser wird der Code in eine Datei geschrieben und + // von dort eingebunden. + $code = new Code(); + $code->setPageContext($this->context->pageContext ); + $code->code = $element->code; + + ob_start(); + + // Jetzt ausfuehren des temporaeren PHP-Codes + $code->execute(); + + $output = ob_get_contents(); + ob_end_clean(); + + // Ausgabe ermitteln. + $inhalt = $output; + + + break; + + + // Makros (dynamische Klassen) + case Element::ELEMENT_TYPE_DYNAMIC: + + /*if ( $value->publisher->isSimplePreview() ) + break;*/ + + $page->load(); + $macroName = $element->subtype; + $macroSettings = $element->getDynamicParameters(); + + $runner = new MacroRunner(); + try { + $inhalt .= $runner->executeMacro( $macroName, $macroSettings,$page, $pageContext ); + } + catch( \Exception $e ) { + throw new GeneratorException("Macro ".$macroName.' in value '.$value->__toString().' could not executed',$e); + } + + // Wenn HTML-Ausgabe, dann Sonderzeichen in HTML �bersetzen + if ( $page->isHtml() ) + $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); + + break; + + + // Info-Feld als Datum + case Element::ELEMENT_TYPE_INFODATE: + + /*if ( $value->publisher->isSimplePreview() ) + break;*/ + + switch( $element->subtype ) + { + case 'date_published': + // START_TIME wird zu Beginn im Controller gesetzt. + // So erh�lt jede Datei das gleiche Ver�ffentlichungsdatum. + $date = START_TIME; + break; + + case 'date_saved': + $date = $page->lastchangeDate; + break; + + case 'date_created': + $date = $page->createDate; + break; + + default: + throw new PublisherException('element:'.$element->name.', '. + 'type:'.$element->type.', '. + 'unknown subtype:'.$element->subtype); + /*if ( !$value->publisher->isPublic() ) + $inhalt = lang('ERROR_IN_ELEMENT');*/ + } + + if ( strpos($element->dateformat,'%')!==FALSE ) + $inhalt = strftime( $element->dateformat,$date ); + else + $inhalt = date ( $element->dateformat,$date ); + + break; + + + // Info-Feld + case Element::ELEMENT_TYPE_INFO: + + /*if ( $value->publisher->isSimplePreview() ) + break;*/ + + switch( $element->subtype ) + { + case 'db_id': + $inhalt = db()->id; + break; + case 'db_name': + $inhalt = $conf['database_'.db()->id]['description']; + break; + case 'project_id': + $inhalt = $page->projectid; + break; + case 'project_name': + $inhalt = Project::create( $page->projectid )->load()->name; + break; + case 'language_id': + $inhalt = $page->languageid; + break; + case 'language_iso': + $language = new Language( $page->languageid ); + $language->load(); + $inhalt = $language->isoCode; + break; + case 'language_name': + $language = new Language( $page->languageid ); + $language->load(); + $inhalt = $language->name; + break; + case 'page_id': + $inhalt = $page->objectid; + break; + case 'page_name': + $inhalt = $page->getNameForLanguage( $pageContext->languageId )->name; + break; + case 'page_desc': + $inhalt = $page->getNameForLanguage( $pageContext->languageId )->description; + break; + case 'page_fullfilename': + $inhalt = $page->full_filename(); + break; + case 'page_filename': + $inhalt = $page->filename(); + break; + case 'page_extension': + $inhalt = ''; + break; + case 'edit_url': + $raw = true; + $db = \util\Session::getDatabase(); + $inhalt = Html::url('page',null,$page->objectid,array('dbid'=>$db->id)); + break; + case 'edit_fullurl': + $raw = true; + $inhalt = Http::getServer(); + + // Der Link soll nicht auf die API, sondern auf das UI zeigen. + if ( substr($inhalt,-4) == 'api/' ) + $inhalt = substr($inhalt,0,-4); + + $db = db(); + $inhalt .= '/#/page/'.$page->objectid; + break; + case 'lastch_user_username': + $user = $page->lastchangeUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->name; + break; + case 'lastch_user_fullname': + $user = $page->lastchangeUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->fullname; + break; + case 'lastch_user_mail': + $user = $page->lastchangeUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->mail; + break; + case 'lastch_user_desc': + $user = $page->lastchangeUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->desc; + break; + case 'lastch_user_tel': + $user = $page->lastchangeUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->tel; + break; + + case 'create_user_username': + $user = $page->createUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->name; + break; + case 'create_user_fullname': + $user = $page->createUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->fullname; + break; + case 'create_user_mail': + $user = $page->createUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->mail; + break; + case 'create_user_desc': + $user = $page->createUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->desc; + break; + case 'create_user_tel': + $user = $page->createUser; + if ( $user->userid ) + $user->load(); + $inhalt = $user->tel; + break; + + case 'act_user_username': + $user = \util\Session::getUser(); + if ( $user ) + $inhalt = $user->name; + break; + case 'act_user_fullname': + $user = \util\Session::getUser(); + if ( $user ) + $inhalt = $user->fullname; + break; + case 'act_user_mail': + $user = \util\Session::getUser(); + if ( $user ) + $inhalt = $user->mail; + break; + case 'act_user_desc': + $user = \util\Session::getUser(); + if ( $user ) + $inhalt = $user->desc; + break; + case 'act_user_tel': + $user = \util\Session::getUser(); + if ( $user ) + $inhalt = $user->tel; + break; + default: + Logger::warn('element:'.$element->name.', '. + 'type:'.$element->type.', '. + 'unknown subtype:'.$element->subtype); + // Keine Fehlermeldung in erzeugte Seite schreiben. + } + + break; + + default: + // this should never happen in production. + // inform the user. + throw new GeneratorException( 'Error in element '.$element->name.': '. + 'unknown type: '.$element->typeid.''); + + } + + + switch( $element->type ) + { + case 'longtext': + case 'text': + case 'select': + + if ( $conf['publish']['encode_utf8_in_html'] ) + // Wenn HTML-Ausgabe, dann UTF-8-Zeichen als HTML-Code uebersetzen + if ( $page->isHtml() ) + $inhalt = translateutf8tohtml($inhalt); + break; + + default: + } + + + + if ( $page->icons && $element->withIcon && $page->isHtml() ) + { + // Anklickbaren Link voranstellen. + $iconLink = '<a href="javascript:parent.openNewAction(\''.$element->name.'\',\'pageelement\',\''.$page->objectid.'_'.$element->elementid.'\');" title="'.$element->desc.'"><img src="'.OR_THEMES_DIR.$conf['interface']['theme'].'/images/icon_el_'.$element->type.IMG_ICON_EXT.'" border="0" align="left"></a>'; + $inhalt = $iconLink.$inhalt; + } + + return $inhalt; + } + + /** + * A pure value does not have a public filename. Therefor, this method returns nothing. + * @return string + */ + public function getPublicFilename() + { + return null; + } +}+ \ No newline at end of file diff --git a/modules/cms/generator/filter/AbstractFilter.class.php b/modules/cms/generator/filter/AbstractFilter.class.php @@ -3,8 +3,9 @@ namespace cms\generator\filter; +use modules\cms\generator\filter\Filter; -abstract class AbstractFilter +abstract class AbstractFilter implements Filter { public abstract function filter( $value ); } \ No newline at end of file diff --git a/modules/cms/generator/filter/Filter.class.php b/modules/cms/generator/filter/Filter.class.php @@ -0,0 +1,10 @@ +<?php + + +namespace modules\cms\generator\filter; + + +interface Filter +{ + public function filter( $value ); +}+ \ No newline at end of file diff --git a/modules/cms/generator/link/LinkFormat.class.php b/modules/cms/generator/link/LinkFormat.class.php @@ -0,0 +1,12 @@ +<?php + + +namespace cms\generator\link; + + +use cms\model\BaseObject; + +interface LinkFormat +{ + public function linkToObject( BaseObject $from, BaseObject $to ); +}+ \ No newline at end of file diff --git a/modules/cms/generator/link/PreviewLink.class.php b/modules/cms/generator/link/PreviewLink.class.php @@ -0,0 +1,112 @@ +<?php + +namespace cms\generator\link; + +use cms\model\Alias; +use cms\model\BaseObject; +use cms\model\Link; +use cms\model\Url; +use util\exception\GeneratorException; + +/** + * Created by PhpStorm. + * User: dankert + * Date: 10.08.18 + * Time: 23:47 + */ + +class PreviewLink implements LinkFormat +{ + /** + * @param $from \cms\model\BaseObject + * @param $to \cms\model\BaseObject + */ + public function linkToObject( BaseObject $from, BaseObject $to ) + { + + $param = array( + 'oid' => '__OID__'.$to->objectid.'__', + REQ_PARAM_MODEL_ID => $from->modelid , + REQ_PARAM_LANGUAGE_ID => $from->languageid ); + + if ( $from->icons ) + $param['withIcons'] = '1'; + + + // Interne Verlinkungen in der Seitenvorschau + switch( $to->typeid ) + { + case BaseObject::TYPEID_FOLDER: + $inhalt = \util\Html::url('folder','show',$to->objectid,$param); + break; + case BaseObject::TYPEID_FILE: + case BaseObject::TYPEID_IMAGE: + case BaseObject::TYPEID_TEXT: + $inhalt = \util\Html::url('file','show',$to->objectid,$param); + break; + case BaseObject::TYPEID_PAGE: + $inhalt = \util\Html::url('page','show',$to->objectid,$param); + break; + + case BaseObject::TYPEID_LINK: + $link = new Link( $to->objectid ); + $link->load(); + + $linkedObject = new BaseObject( $link->linkedObjectId ); + $linkedObject->objectLoad(); + + switch( $linkedObject->typeid ) + { + case BaseObject::TYPEID_FILE: + $inhalt = \util\Html::url('file','show',$link->linkedObjectId,$param); + break; + + case BaseObject::TYPEID_PAGE: + $inhalt = \util\Html::url('page','show',$link->linkedObjectId,$param); + break; + case BaseObject::TYPEID_URL: + $inhalt = \util\Html::url('url','show',$link->linkedObjectId,$param); + break; + default: + $inhalt = 'Unknown link type: '.$linkedObject->typeid; + } + break; + + case BaseObject::TYPEID_ALIAS: + $alias = new Alias( $to->objectid ); + $alias->load(); + $alias->linkedObjectId; + + $linkedObject = new BaseObject( $alias->linkedObjectId ); + $linkedObject->objectLoad(); + + switch( $linkedObject->typeid ) + { + case BaseObject::TYPEID_FILE: + $inhalt = \util\Html::url('file','show',$alias->linkedObjectId,$param); + break; + + case BaseObject::TYPEID_PAGE: + $inhalt = \util\Html::url('page','show',$alias->linkedObjectId,$param); + break; + default: + $inhalt = 'Unknown link type: '.$linkedObject->typeid; + } + break; + + case BaseObject::TYPEID_URL: + $url = new Url( $to->objectid ); + $url->load(); + $inhalt = $url->url; + + break; + default: + throw new GeneratorException('Unknown type '.$to->typeid.' in target '.$to->__toString() ); + + } + + return $inhalt; + + } + +} diff --git a/modules/cms/generator/link/PublicLink.class.php b/modules/cms/generator/link/PublicLink.class.php @@ -0,0 +1,177 @@ +<?php + +namespace cms\generator\link; + +use cms\model\BaseObject; +use cms\model\File; +use cms\model\Folder; +use cms\model\Link; +use cms\model\Page; +use cms\model\Project; +use cms\model\Url; +use cms\generator\target\Dav; +use cms\generator\target\Fax; +use cms\generator\target\Ftp; +use cms\generator\target\Ftps; +use cms\generator\target\Local; +use cms\generator\target\NoBaseTarget; +use cms\generator\target\Scp; +use cms\generator\target\SFtp; +use cms\generator\target\BaseTarget; +use util\exception\PublisherException; +use util\FileUtils; +use logger\Logger; +use util\exception\UIException; +use util\Session; + + + +/** + * @author Jan Dankert + */ + +class PublicLink implements LinkFormat +{ + const SCHEMA_ABSOLUTE = 1; + const SCHEMA_RELATIVE = 2; + + const MAX_RECURSIVE_COUNT = 10; + + + /** + * @param $from \cms\model\BaseObject + * @param $to \cms\model\BaseObject + */ + public function linkToObject( BaseObject $from, BaseObject $to ) { + + $from->load(); + $fromProject = $from->getProject()->load(); + + $schema = $fromProject->linkAbsolute?self::SCHEMA_ABSOLUTE:self::SCHEMA_RELATIVE; + + $counter = 0; + while( $to->typeid == BaseObject::TYPEID_LINK ) + { + if ( $counter++ > self::MAX_RECURSIVE_COUNT) + throw new \LogicException("Too much redirects while following a link. Stopped at #".$to->objectid ); + + $link = new Link( $to->objectid ); + $link->load(); + + $to = new BaseObject( $link->linkedObjectId ); + $to->objectLoad(); + } + + switch( $to->typeid ) + { + case BaseObject::TYPEID_FILE: + case BaseObject::TYPEID_IMAGE: + case BaseObject::TYPEID_TEXT: + + $f = new File( $to->objectid ); + + $p = Project::create( $to->projectid )->load(); + $f->content_negotiation = $p->content_negotiation; + + $f->load(); + $filename = $f->filename(); + break; + + case BaseObject::TYPEID_PAGE: + + $p = new Page( $to->objectid ); + $p->languageid = $from->languageid; + $p->modelid = $from->modelid; + $p->cut_index = $from->cut_index; + $p->content_negotiation = $from->content_negotiation; + $p->withLanguage = $from->withLanguage; + $p->withModel = $from->withModel; + $p->load(); + $filename = $p->getFilename(); + break; + + case BaseObject::TYPEID_URL: + $url = new Url( $to->objectid ); + $url->load(); + return $url->url; + default: + throw new \LogicException("Could not build a link to the unknown Type ".$to->typeid.':'.$to->getType() ); + } + + + if ( $from->projectid != $to->projectid ) + { + // BaseTarget object is in another project. + // we have to use absolute URLs. + $schema = self::SCHEMA_ABSOLUTE; + + // BaseTarget is in another Project. So we have to create an absolute URL. + $targetProject = Project::create( $to->projectid )->load(); + $host = $targetProject->url; + + if ( ! strpos($host,'//' ) === FALSE ) { + // No protocol in hostname. So we have to prepend the URL with '//'. + $host = '//'.$host; + } + } + else { + $host = ''; + } + + + + + if ( $schema == self::SCHEMA_RELATIVE ) + { + $folder = new Folder( $from->getParentFolderId() ); + $folder->load(); + $fromPathFolders = $folder->parentObjectFileNames(false,true); + + $folder = new Folder($to->getParentFolderId() ); + + $toPathFolders = $folder->parentObjectFileNames(false, true); + + // Shorten the relative URL + // if the actual page is /path/folder1/page1 + // and the target page is /path/folder2/page2 + // we shorten the link from ../../path/folder2/page2 + // to ../folder2/page2 + foreach( $fromPathFolders as $folderId => $folderFileName ) { + if ( count($toPathFolders) >= 1 && array_keys($toPathFolders)[0] == $folderId ) { + unset( $fromPathFolders[$folderId] ); + unset( $toPathFolders [$folderId] ); + }else { + break; + } + + } + + if ( $fromPathFolders ) + $path = str_repeat( '../',count($fromPathFolders) ); + else + $path = './'; // Just to clarify- this could be blank too. + + if ( $toPathFolders ) + $path .= implode('/',$toPathFolders).'/'; + } + else { + // Absolute Pfadangaben + $folder = new Folder( $to->getParentFolderId() ); + $toPathFolders = $folder->parentObjectFileNames(false, true); + + $path = '/'; + + if ( $toPathFolders ) + $path .= implode('/',$toPathFolders).'/'; + } + + + $uri = $host . $path . $filename; + + if( !$uri ) + $uri = '.'; + + return $uri; + } + +}+ \ No newline at end of file diff --git a/modules/cms/generator/target/Dav.class.php b/modules/cms/generator/target/Dav.class.php @@ -28,7 +28,7 @@ use util\Url; * * @author Jan Dankert */ -class Dav extends Target +class Dav extends BaseTarget { /** * @var false|resource diff --git a/modules/cms/generator/target/Fax.class.php b/modules/cms/generator/target/Fax.class.php @@ -27,7 +27,7 @@ use util\exception\UIException; * * @author Jan Dankert */ -class Fax extends Target +class Fax extends BaseTarget { public function open() { diff --git a/modules/cms/generator/target/Ftp.class.php b/modules/cms/generator/target/Ftp.class.php @@ -23,11 +23,11 @@ use util\exception\UIException; /** - * FTP-Target. + * FTP-BaseTarget. * * @author Jan Dankert */ -class Ftp extends Target +class Ftp extends BaseTarget { private $connection; diff --git a/modules/cms/generator/target/Local.class.php b/modules/cms/generator/target/Local.class.php @@ -29,7 +29,7 @@ use util\Url; * * @author Jan Dankert */ -class Local extends Target +class Local extends BaseTarget { /** * @var string @@ -149,4 +149,56 @@ class Local extends Target } } + + + + + + /** + * Aufraeumen des Zielverzeichnisses.<br><br> + * Es wird der komplette Zielordner samt Unterverzeichnissen durchsucht. Jede + * Datei, die laenger existiert als der aktuelle Request alt ist, wird geloescht.<br> + * Natuerlich darf diese Funktion nur nach einem Gesamt-Veroeffentlichen ausgefuehrt werden. + */ + public function clean() + { + if ( !empty($this->localDestinationDirectory) ) + $this->cleanFolder($this->localDestinationDirectory); + } + + + + /** + * Aufr�umen eines Verzeichnisses.<br><br> + * Dateien, die l�nger existieren als der aktuelle Request alt ist, werden gel�scht.<br> + * + * @param String Verzeichnis + */ + private function cleanFolder( $folderName ) + { + $dh = opendir( $folderName ); + + while( $file = readdir($dh) ) + { + if ( $file != '.' && $file != '..') + { + $fullpath = $folderName.'/'.$file; + + // Wenn eine Datei beschreibbar und entsprechend alt + // ist, dann entfernen + if ( is_file($fullpath) && + is_writable($fullpath) && + filemtime($fullpath) < START_TIME ) + unlink($fullpath); + + // Bei Ordnern rekursiv absteigen + if ( is_dir( $fullpath) ) + { + $this->cleanFolder($fullpath); + @rmdir($fullpath); + } + } + } + } + } \ No newline at end of file diff --git a/modules/cms/generator/target/NoTarget.class.php b/modules/cms/generator/target/NoTarget.class.php @@ -27,7 +27,7 @@ use util\exception\UIException; * * @author Jan Dankert */ -class NoTarget extends Target +class NoBaseTarget extends BaseTarget { public static function acceptsSchemes() { diff --git a/modules/cms/generator/target/README.md b/modules/cms/generator/target/README.md @@ -21,4 +21,9 @@ The target is selected by the scheme in the target url in the project properties ## Example -`scp://user@host/var/www` is publishing all files via SCP to the SSH-Server on host 'host'. - \ No newline at end of file +`scp://user@host/var/www` is publishing all files via SCP to the SSH-Server on host 'host'. + +## Requirements + +Some targets need special php modules: +- `scp` and `sftp` need the php-ssh lib. On Ubuntu simply install it with `sudo apt-get install php-ssh2`.+ \ No newline at end of file diff --git a/modules/cms/generator/target/Scp.class.php b/modules/cms/generator/target/Scp.class.php @@ -31,7 +31,7 @@ use util\exception\UIException; * @version $Revision$ * @package openrat.services */ -class Scp extends Target +class Scp extends BaseTarget { /** * @var resource @@ -52,14 +52,17 @@ class Scp extends Target protected function createConnection() { + if ( empty($this->url->port) ) + $this->url->port = 22; // Default-SSH-port + $sshConnection = @ssh2_connect($this->url->host,$this->url->port ); if (! $sshConnection) - throw new PublisherException("Could not connect to ".$this->url ); + throw new PublisherException("Could not connect to ".$this->url->host.':'.$this->url->port ); if (! @ssh2_auth_password($sshConnection, $this->url->user,$this->url->pass) ) - throw new PublisherException("Could not authenticate"); + throw new PublisherException("Could not authenticate with user ".$this->url->user); $this->sshConnection = $sshConnection; diff --git a/modules/cms/generator/target/Target.class.php b/modules/cms/generator/target/Target.class.php @@ -1,79 +1,32 @@ <?php -// OpenRat Content Management System -// Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de -// -// This program is free software; you can redistribute it and/or -// modify it under the terms of the GNU General Public License -// as published by the Free Software Foundation; either version 2 -// of the License, or (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -namespace cms\generator\target; - -use logger\Logger; -use util\exception\PublisherException; -use util\exception\UIException; -use util\Url; - -/** - * Superclass for publication targets. - * - * @author Jan Dankert - */ -abstract class Target -{ - /** - * @var Url - */ - protected $url; - public function __construct( $targetUrl ) { - $this->url = new Url( $targetUrl ); +namespace cms\generator\target; - $this->open(); - } +use util\Url; - public static function accepts( $scheme ) { - return in_array( $scheme, static::acceptsSchemes() ); - } +interface Target +{ + public function __construct( $targetUrl ); - /** - * For which types this target is reponsible? - * - * @return array - */ - protected abstract static function acceptsSchemes(); + public static function accepts( $scheme ); - public function open() { - } + public function open(); - public abstract function put($source, $dest, $timestamp); + public function put($source, $dest, $timestamp); /** * Closes the connection. */ - public function close() { - - } - + public function close(); - public static function isAvailable() { - return true; - } + public static function isAvailable(); -} +}+ \ No newline at end of file diff --git a/modules/cms/macros/MacroRunner.class.php b/modules/cms/macros/MacroRunner.class.php @@ -3,20 +3,28 @@ namespace cms\macros; +use cms\generator\PageContext; use cms\model\Element; use cms\model\Template; use cms\model\Value; use logger\Logger; use util\ArrayUtils; use util\exception\GeneratorException; -use util\exception\UIException; use util\text\variables\VariableResolver; class MacroRunner { public $page; - public function executeMacro($name, $parameter, $page) + /** + * @param $name + * @param $parameter + * @param $page + * @param $pageContext PageContext + * @return string + * @throws GeneratorException + */ + public function executeMacro($name, $parameter, $page, $pageContext) { $this->page = $page; @@ -32,7 +40,7 @@ class MacroRunner if (!method_exists($macro, 'execute')) throw new GeneratorException(' (missing method: execute())'); - $macro->setContextPage($page); + $macro->setPageContext($pageContext); $resolver = new VariableResolver(); diff --git a/modules/cms/macros/macro/ClassicMenu.class.php b/modules/cms/macros/macro/ClassicMenu.class.php @@ -16,6 +16,7 @@ namespace cms\macros\macro; // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +use cms\model\BaseObject; use cms\model\Folder; use cms\model\Page; use util\Macro; @@ -42,14 +43,18 @@ class ClassicMenu extends Macro // Erstellen des Hauptmenues + /** + * @var array + */ + private $parentFolders; + public function execute() { $rootId = $this->getRootObjectId(); // Erstellen eines Untermenues - $f = new Folder( $this->page->parentid ); + $f = new Folder( $this->getPage()->parentid ); $this->parentFolders = $f->parentObjectFileNames(false,true); - $this->showFolder( $rootId ); } @@ -59,11 +64,15 @@ class ClassicMenu extends Macro $f = new Folder( $oid ); // Schleife ueber alle Objekte im aktuellen Ordner - foreach( $f->getObjects() as $o ) + /** @var BaseObject $o */ + foreach($f->getObjects() as $o ) { $o->languageid = $this->page->languageid; $o->load(); - + + // Wenn aktuelle Seite, dann markieren, sonst Link + $name = $o->getNameForLanguage($this->pageContext->languageId)->name; + // Ordner anzeigen if ($o->isFolder ) { @@ -72,14 +81,12 @@ class ClassicMenu extends Macro if ( is_object($fp) ) { - - // Wenn aktuelle Seite, dann markieren, sonst Link - if ( $this->page->objectid == $fp->objectid ) + if ( $this->getPage()->objectid == $fp->objectid ) // aktuelle Seite - $this->outputLn( '<li class="active">'.$o->name.'' ); + $this->outputLn( '<li class="active">'.$name.'' ); else // Link erzeugen - $this->outputLn( '<li><a href="'.$this->pathToObject($fp->objectid).'">'.$o->name.'</a>' ); + $this->outputLn( '<li><a href="'.$this->pathToObject($fp->objectid).'">'.$name.'</a>' ); if ( in_array($o->objectid,array_keys($this->parentFolders)) ) { @@ -94,7 +101,7 @@ class ClassicMenu extends Macro { $page = new Page($o->objectid); $page->load(); - if ( $page->templateid != $this->page->templateid && $this->onlySameTemplate ) + if ( $page->templateid != $this->getPage()->templateid && $this->onlySameTemplate ) continue; } @@ -104,13 +111,13 @@ class ClassicMenu extends Macro // Wenn aktuelle Seite, dann markieren, sonst Link if ( $this->getObjectId() == $o->objectid) // aktuelle Seite - $this->output( '<li class="active">'.$o->name.'</li>' ); + $this->output( '<li class="active">'.$name.'</li>' ); elseif ( $o->isLink ) // Link mit HTML-Sonderzeichenumwandlung erzeugen - $this->output( '<li><a href="'.htmlspecialchars($this->pathToObject($o->objectid)).'">'.$o->name.'</a></li>' ); + $this->output( '<li><a href="'.htmlspecialchars($this->pathToObject($o->objectid)).'">'.$name.'</a></li>' ); else // Link erzeugen - $this->output( '<li><a href="'.$this->pathToObject($o->objectid).'">'.$o->name.'</a></li>' ); + $this->output( '<li><a href="'.$this->pathToObject($o->objectid).'">'.$name.'</a></li>' ); } } $this->output('</ul>'); diff --git a/modules/cms/macros/macro/LastChanges.class.php b/modules/cms/macros/macro/LastChanges.class.php @@ -16,6 +16,9 @@ namespace cms\macros\macro; // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +use cms\generator\PageContext; +use cms\generator\ValueContext; +use cms\generator\ValueGenerator; use cms\model\BaseObject; use cms\model\Folder; use cms\model\Link; @@ -115,13 +118,22 @@ class LastChanges extends Macro if ( $this->limit >= 0 && $count > $this->limit) break; // Maximale Anzahl erreicht. - $desc = $p->desc; - $p->generate_elements(); - + $desc = $p->getNameForLanguage( $this->pageContext->languageId )->description; + + $pageContext = clone $this->pageContext; + $pageContext->objectId = $o['objectid']; + if ( !empty($this->teaserElementId) ) { - $value = $p->values[$this->teaserElementId]; - $desc = $value->value; + $valueContext = new ValueContext( $pageContext ); + $valueContext->elementid = $this->teaserElementId; + + $value = new ValueGenerator($valueContext); + + + $desc = $value->getCache()->get(); + + if ( istrue($this->plaintext) ) { $desc = strip_tags($desc); @@ -135,8 +147,12 @@ class LastChanges extends Macro $time = ''; if ( !empty($this->timeelementid) ) { - $value = $p->values[$this->timeelementid]; - $time = $value->value; + $valueContext = new ValueContext( $pageContext ); + $valueContext->elementid = $this->timeelementid; + + $value = new ValueGenerator($valueContext); + + $time = $value->getCache()->get(); } $this->output('<div class="'.$this->css_class.'">'); @@ -151,7 +167,7 @@ class LastChanges extends Macro $this->output( '<h3>'); - $this->output( $p->name ); + $this->output( $p->getNameForLanguage( $pageContext->languageId )->name ); $this->output( '</h3>' ); $this->output( '<p>' ); diff --git a/modules/cms/macros/macro/SearchIndex.class.php b/modules/cms/macros/macro/SearchIndex.class.php @@ -1,11 +1,15 @@ <?php namespace cms\macros\macro; +use cms\generator\ValueContext; +use cms\generator\ValueGenerator; +use cms\model\Element; use cms\model\Folder; use cms\model\Name; use cms\model\Page; use cms\model\Project; use cms\generator\PublishEdit; +use JSON; use util\Macro; @@ -44,13 +48,19 @@ class SearchIndex extends Macro foreach( $tf->getPages() as $pageid ) { $page = new Page( $pageid ); - - // Den einfachen Publisher benutzen, damit nur beschreibbare Inhalte auch in den Index wandern. - $page->publisher = new PublishEdit(); $page->load(); - $page->generate(); - $name = $page->getNameForLanguage( $this->page->languageid ); + // Generating all values + $values = []; + /** @var Element $element */ + foreach($page->getWritableElements() as $element ) { + $valueContext = new ValueContext($this->pageContext); + $valueContext->elementid = $element->elementid; + $generator = new ValueGenerator( $valueContext ); + $value[] = $generator->getCache()->get(); + } + + $name = $page->getNameForLanguage( $this->getPage()->languageid ); $searchIndex[] = array( 'id' => $pageid, @@ -58,10 +68,10 @@ class SearchIndex extends Macro 'filename'=> $page->filename, 'url' => $this->pathToObject( $pageid ), 'content' => $this->truncate(array_reduce( - $page->values, + $values, function($act, $value) { - return $act.' '.$value->value; + return $act.' '.$value; }, '' )) @@ -71,7 +81,7 @@ class SearchIndex extends Macro // Output search index as JSON $json = new JSON(); - $this->output( $json->encode( $searchIndex ) ); + echo $json->encode( $searchIndex ); } diff --git a/modules/cms/macros/macro/TeaserList.class.php b/modules/cms/macros/macro/TeaserList.class.php @@ -16,6 +16,8 @@ namespace cms\macros\macro; // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +use cms\generator\ValueContext; +use cms\generator\ValueGenerator; use cms\model\Folder; use cms\model\Page; use util\Macro; @@ -48,7 +50,6 @@ class TeaserList extends Macro */ var $description = 'Creates a teaser list of pages in a folder'; - // Erstellen des Hauptmenues function execute() { $feed = array(); @@ -66,16 +67,23 @@ class TeaserList extends Macro { if ( $o->isPage ) // Nur wenn Ordner { + + $p = new Page( $o->objectid ); $p->load(); $desc = $p->desc; - $p->generate_elements(); - + if ( !empty($this->teaserElementId) ) { - $value = $p->values[$this->teaserElementId]; - $desc = $value->value; + $valueContext = new ValueContext( $this->pageContext ); + $valueContext->elementid = $this->teaserElementId; + + $value = new ValueGenerator($valueContext); + + + $desc = $value->getCache()->get(); + if ( istrue($this->plaintext) ) { $desc = strip_tags($desc); @@ -89,8 +97,12 @@ class TeaserList extends Macro $time = ''; if ( !empty($this->timeelementid) ) { - $value = $p->values[$this->timeelementid]; - $time = $value->value; + $valueContext = new ValueContext( $this->pageContext ); + $valueContext->elementid = $this->timeelementid; + + $value = new ValueGenerator($valueContext); + + $time = $value->getCache()->get(); } $this->output('<'.$this->time_html_tag.'>'.$time.'</'.$this->time_html_tag.'>'); diff --git a/modules/cms/model/File.class.php b/modules/cms/model/File.class.php @@ -43,11 +43,6 @@ class File extends BaseObject var $log_filenames = array(); var $fullFilename = ''; - /** - * @var \Publish - */ - var $publish = null; - var $mime_type = ''; var $tmpfile; @@ -65,8 +60,6 @@ class File extends BaseObject public $filterid; - public $public = false ; - /** * Konstruktor * @@ -471,15 +464,6 @@ EOF } - public function publish() - { - $this->write(); - $this->publisher->copy( $this->getCache()->getFilename(),$this->full_filename(),$this->lastchangeDate ); - - $this->publisher->publishedObjects[] = $this->getProperties(); - } - - /** * Setzt den Zeitstempel der Datei auf die aktuelle Zeit. * diff --git a/modules/cms/model/Folder.class.php b/modules/cms/model/Folder.class.php @@ -364,7 +364,11 @@ class Folder extends BaseObject return $o; } - + + /** + * Returns a list of files. + * @return array + */ function getFiles() { $db = db_connection(); diff --git a/modules/cms/model/Name.class.php b/modules/cms/model/Name.class.php @@ -16,8 +16,8 @@ namespace cms\model { */ public $nameid; - public $objectid; + public $objectid; /** Sprach-ID * @see Language * @type Integer diff --git a/modules/cms/model/Page.class.php b/modules/cms/model/Page.class.php @@ -104,7 +104,7 @@ class Page extends BaseObject $this->isPage = true; $this->typeid = BaseObject::TYPEID_PAGE; - $this->publisher = new PublishPreview(); + //$this->publisher = new PublishPreview(); } @@ -424,6 +424,7 @@ SQL * ermittelt. * * @return String Kompletter Dateiname, z.B. '/pfad/seite.en.html' + * @deprecated use pagecontext */ function filename() { @@ -470,9 +471,9 @@ SQL /** - * Erzeugen der Inhalte zu allen Elementen dieser Seite - * wird von generate() aufgerufen - */ + * Get all elements from this page. + * @return Array + */ public function getElementIds() { $t = new Template( $this->templateid ); @@ -513,184 +514,8 @@ SQL /** - * Erzeugen der Inhalte zu allen Elementen dieser Seite - * wird von generate() aufgerufen - */ - public function generate_elements() - { - $this->values = array(); - - if ( $this->publisher->isSimplePreview() ) - $elements = $this->getWritableElements(); - else - $elements = $this->getElements(); - - foreach( $elements as $elementid=>$element ) - { - // neues Inhaltobjekt erzeugen - $val = new Value(); - $val->element = $element; - - $val->publisher = $this->publisher; - $val->objectid = $this->objectid; - $val->pageid = $this->pageid; - $val->languageid = $this->languageid; - $val->modelid = $this->modelid; - $val->page = $this; - try { - $val->generate(); - } catch( \Exception $e ) { - // Unrecoverable Error while generating the content. - throw new GeneratorException('Could not generate Value '.$val->__toString(),$e ); - } - - $this->values[$elementid] = $val; - } - } - - - - public function generate() { - - return $this->getCache()->get(); - } - - /** - * Erzeugen des Inhaltes der gesamten Seite. - * - * @return String Inhalt - */ - private function generateValue() - { - global $conf; - - // Setzen der 'locale', damit sprachabhängige Systemausgaben (wie z.B. die - // Ausgabe von strftime()) in der korrekten Sprache dargestellt werden. - $language = new Language($this->languageid); - $language->load(); - - $language->setCurrentLocale(); - - - $this->template = new Template( $this->templateid ); - $this->template->modelid = $this->modelid; - $this->template->load(); - $this->ext = $this->template->extension; - - $this->generate_elements(); - - // Get a List with ElementId->ElementName - $elements = array_map(function($element) { - return $element->name; - },$this->getElements() ); - - $templatemodel = new TemplateModel( $this->template->templateid, $this->modelid ); - $templatemodel->load(); - $src = $templatemodel->src; - - $data = array(); - - // Template should have access to the page properties. - // Template should have access to the settings of this node object. - $data['_page' ] = $this->getProperties() ; - $data['_localsettings'] = $this->getSettings() ; - $data['_settings' ] = $this->getTotalSettings(); - - // No we are collecting the data and are fixing some old stuff. - - foreach( $elements as $elementId=>$elementName ) - { - $data[ $elementName ] = $this->values[$elementId]->generate(); - - // The following code is for old template values: - - // convert {{<id>}} to {{<name>}} - $src = str_replace( '{{'.$elementId.'}}','{{'.$elementName.'}}',$src ); - - $src = str_replace( '{{IFNOTEMPTY:'.$elementId.':BEGIN}}','{{#'.$elementName.'}}',$src ); - $src = str_replace( '{{IFNOTEMPTY:'.$elementId.':END}}' ,'{{/'.$elementName.'}}',$src ); - $src = str_replace( '{{IFEMPTY:' .$elementId.':BEGIN}}','{{^'.$elementName.'}}',$src ); - $src = str_replace( '{{IFEMPTY:' .$elementId.':END}}' ,'{{/'.$elementName.'}}',$src ); - - if ( $this->icons ) - $src = str_replace( '{{->'.$elementId.'}}','<a href="javascript:parent.openNewAction(\''.$elementName.'\',\'pageelement\',\''.$this->objectid.'_'.$value->element->elementid.'\');" title="'.$value->element->desc.'"><img src="'.OR_THEMES_DIR.$conf['interface']['theme'].'/images/icon_el_'.$value->element->type.IMG_ICON_EXT.'" border="0" align="left"></a>',$src ); - else - $src = str_replace( '{{->'.$elementId.'}}','',$src ); - } - - Logger::trace( 'pagedata: '.print_r($data,true) ); - - // Now we have collected all data, lets call the template engine: - - $template = new Mustache(); - $template->escape = null; // No HTML escaping, this is the job of this CMS ;) - $template->partialLoader = function( $name ) { - - if ( substr($name,0,5) == 'file:') { - $fileid = intval( substr($name,5) ); - $file = new File( $fileid ); - return $file->loadValue(); - } - - - $project = new Project($this->projectid); - $templateid = array_search($name,$project->getTemplates() ); - - if ( ! $templateid ) - throw new \InvalidArgumentException('template '.Logger::sanitizeInput($name).' not found'); - - if ( $templateid == $this->template->templateid ) - throw new \InvalidArgumentException('Template recursion detected on template-id '.$templateid); - - - $templatemodel = new TemplateModel( $templateid, $this->modelid ); - $templatemodel->load(); - - return $templatemodel->src; - }; - - try { - $template->parse($src); - } catch (\Exception $e) { - // Should we throw it to the caller? - // No, because it is not a technical error. So let's only log it. - Logger::warn("Template rendering failed: ".$e->getMessage() ); - return $e->getMessage(); - } - $src = $template->render( $data ); - - // now we have the fully generated source. - - // should we do a UTF-8-escaping here? - // Default should be off, because if you are fully using utf-8 (you should do), this is unnecessary. - if ( config('publish','escape_8bit_characters') ) - if ( substr($this->mimeType(),-4) == 'html' ) - { - /* - * - $src = htmlentities($src,ENT_NOQUOTES,'UTF-8'); - $src = str_replace('&lt;' , '<', $src); - $src = str_replace('&gt;' , '>', $src); - $src = str_replace('&amp;', '&', $src); - */ - $src = translateutf8tohtml($src); - } - - return $src; - } - - - /** - * Schreiben des Seiteninhaltes in die temporaere Datei - */ - public function write() - { - $this->getCache()->load(); - } - - - /** * Generieren dieser Seite in Dateisystem und/oder auf FTP-Server + * @deprecated */ public function publish() { @@ -754,10 +579,8 @@ SQL - function setTimestamp() + public function setTimestamp() { - $this->getCache()->invalidate(); - parent::setTimestamp(); } diff --git a/modules/cms/model/Pageelement.class.php b/modules/cms/model/Pageelement.class.php @@ -1,5 +1,6 @@ <?php namespace cms\model; + // OpenRat Content Management System // Copyright (C) 2002-2012 Jan Dankert, cms@jandankert.de // @@ -16,10 +17,6 @@ namespace cms\model; // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. -use cms\mustache\Mustache; -use cms\generator\PublishPreview;use cms\generator\PublishPublic; -use logger\Logger; -use util\cache\FileCache; /** diff --git a/modules/cms/model/Project.class.php b/modules/cms/model/Project.class.php @@ -261,36 +261,10 @@ class Project extends ModelBase } - // Laden - public function loadByName() - { - $db = db_connection(); - - $sql = $db->sql( 'SELECT * FROM {{project}} '. - ' WHERE name={projectname}' ); - $sql->setString( 'projectname',$this->name ); - - $row = $sql->getRow(); - - $this->projectid = $row['id' ]; - $this->target_dir = $row['target_dir' ]; - $this->ftp_url = $row['ftp_url' ]; - $this->url = $row['url' ]; - $this->ftp_passive = $row['ftp_passive' ]; - $this->cmd_after_publish = $row['cmd_after_publish' ]; - $this->cut_index = $row['flags']&self::FLAG_CUT_INDEX; - $this->content_negotiation = $row['flags']&self::FLAG_CONTENT_NEGOTIATION; - $this->publishFileExtension = $row['flags']&self::FLAG_PUBLISH_FILE_EXTENSION; - $this->publishPageExtension = $row['flags']&self::FLAG_PUBLISH_PAGE_EXTENSION; - $this->linkAbsolute = $row['flags']&self::FLAG_LINK_ABSOLUTE; - } - // Speichern public function save() { - $this->cleanTarget(); - $stmt = DB::sql( <<<SQL UPDATE {{project}} SET name = {name}, @@ -312,7 +286,7 @@ SQL $stmt->setString('cmd_after_publish' ,$this->cmd_after_publish ); $flags = 0; - if( $this->cut_index) $flags |= self::FLAG_CUT_INDEX; + if( $this->cut_index ) $flags |= self::FLAG_CUT_INDEX; if( $this->content_negotiation ) $flags |= self::FLAG_CONTENT_NEGOTIATION; if( $this->publishFileExtension) $flags |= self::FLAG_PUBLISH_FILE_EXTENSION; if( $this->publishPageExtension) $flags |= self::FLAG_PUBLISH_PAGE_EXTENSION; @@ -1066,7 +1040,7 @@ SQL /** * Cleans up the target url. */ - private function cleanTarget() + public function getCleanTarget() { $target = parse_url( $this->target_dir ); @@ -1083,7 +1057,7 @@ SQL $query = isset($target['query']) ? '?' . $target['query'] : ''; $fragment = isset($target['fragment']) ? '#' . $target['fragment'] : ''; - $this->target_dir = "$scheme$user$pass$host$port$path$query$fragment"; + return "$scheme$user$pass$host$port$path$query$fragment"; } } diff --git a/modules/cms/model/Value.class.php b/modules/cms/model/Value.class.php @@ -181,7 +181,7 @@ class Value extends ModelBase */ function load() { - if ( $this->publisher->isPublic() ) + if ( 1==1 || $this->publisher->isPublic() ) $stmt = db()->sql( 'SELECT * FROM {{value}}'. ' WHERE elementid ={elementid}'. ' AND pageid ={pageid}'. @@ -193,7 +193,7 @@ class Value extends ModelBase ' AND pageid ={pageid}'. ' AND languageid={languageid}'. ' AND active=1' ); - $stmt->setInt( 'elementid' ,$this->element->elementid ); + $stmt->setInt( 'elementid' ,$this->elementid ); $stmt->setInt( 'pageid' ,$this->pageid ); $stmt->setInt( 'languageid',$this->languageid); $row = $stmt->getRow(); @@ -536,1004 +536,6 @@ SQL } - public function generate() { - - return $this->getCache()->get(); - } - - - /** - * - * @return FileCache - */ - public function getCache() { - - $cacheKey = array('db'=>db()->id, - 'value'=>$this->valueid, - 'page' =>is_object($this->page)?$this->page->objectid:0, - 'el'=>is_object($this->element)?$this->element->elementid:0, - 'language'=>$this->languageid, - 'model' =>is_object($this->page)?$this->page->modelid:0, - 'publish'=> \util\ClassUtils::getSimpleClassName($this->publisher) ); - return new FileCache( $cacheKey,function() { - return $this->generateValue(); - },$this->lastchangeTimeStamp ); - } - - /** - * Hier findet die eigentliche Bereitstellung des Inhaltes statt, zu - * jedem Elementtyp wird ein Inhalt ermittelt. - * - * @return void (aber Eigenschaft 'value' wird gesetzt). - */ - private function generateValue() - { - if ( intval($this->valueid)==0 ) - $this->load(); - - $inhalt = ''; - - global $conf; - - // Inhalt ist mit anderer Seite verkn�pft. - if ( in_array($this->element->typeid,[Element::ELEMENT_TYPE_TEXT,Element::ELEMENT_TYPE_LONGTEXT,Element::ELEMENT_TYPE_DATE,Element::ELEMENT_TYPE_NUMBER]) && intval($this->linkToObjectId) != 0 && !$this->isLink ) - { - $linkedPage = new Page( $this->linkToObjectId ); - $linkedPage->context = $this->page->context; - $linkedPage->load(); - - $linkedValue = new Value(); - $linkedValue->isLink = true; - $linkedValue->pageid = $linkedPage->pageid; - $linkedValue->page = $linkedPage; - $linkedValue->page->context = $this->page->context; - $linkedValue->element = $this->element; - $linkedValue->languageid = $this->languageid; - //$v->modelid = $this->modelid; - $linkedValue->load(); - $linkedValue->generate(); - $this->value = $linkedValue->value; - return; - } - - switch( $this->element->typeid ) - { - case Element::ELEMENT_TYPE_INSERT: - - $objectid = $this->linkToObjectId; - - if ( intval($objectid) == 0 ) - $objectid = $this->element->defaultObjectId; - - if ( ! BaseObject::available( $objectid) ) - return; - - $object = new BaseObject( $objectid ); - $object->objectLoadRaw(); - - if ( $object->isFolder ) - { - if ( $this->publisher->isSimplePreview() ) - { - $f = new Folder( $objectid ); - $f->load(); - $inhalt = $f->filename; - unset( $f ); - } - else - { - if ( $objectid != $this->page->objectid ) // Rekursion vermeiden - { - $f = new Folder( $objectid ); - foreach( $f->getObjectIds() as $oid ) - { - if ( $oid != $this->page->objectid ) // Rekursion vermeiden - { - switch( $this->element->subtype ) - { - case '': - case 'inline': - $o = new BaseObject( $oid ); - $o->load(); - switch( $o->typeid ) - { - case BaseObject::TYPEID_PAGE: - $p = new Page( $oid ); - $p->enclosingObjectId = $this->page->id; - $p->public = $this->page->publisher->isPublic(); - $p->modelid = $this->page->modelid; - $p->languageid = $this->languageid; - $p->mime_type = $this->page->mimeType(); - $p->context = $this->page->context; - $p->load(); - $p->generate(); - $inhalt .= $p->value; - unset( $p ); - break; - case BaseObject::TYPEID_LINK: - $l = new Link( $oid ); - $l->load(); - if ( $l->isLinkToObject ) - { - $op = new BaseObject( $l->linkedObjectId ); - $op->load(); - if ( $op->isPage ) - { - $p = new Page( $l->linkedObjectId ); - $p->enclosingObjectId = $this->page->id; - $p->public = $this->page->publisher->isPublic(); - $p->modelid = $this->page->modelid; - $p->languageid = $this->languageid; - $p->context = $this->page->context; - $p->load(); - $p->generate(); - $inhalt .= $p->value; - unset( $p ); - } - } - break; - } - break; - - case 'ssi': - $inhalt .= '<!--#include virtual="'.$this->page->path_to_object($oid).'" -->'; - break; - - default: - $inhalt = '?'.$this->element->subtype.'?'; - } - } - else throw new \LogicException('FATAL: recursion detected'); - } - } - else throw new LogicException('FATAL: recursion detected'); - } - } - elseif ( $object->isPage ) - { - if ( $this->publisher->isSimplePreview() ) - { - $p = new Page( $objectid ); - $p->context = $this->page->context; - $p->load(); - $inhalt = $p->filename; - unset( $p ); - } - else - { - if ( $objectid != $this->page->objectid ) // Rekursion vermeiden - { - switch( $this->element->subtype ) - { - case '': - case 'inline': - $p = new Page( $objectid ); - $p->enclosingObjectId = $this->page->id; - $p->publisher = $this->page->publisher; - $p->modelid = $this->page->modelid; - $p->languageid = $this->languageid; - $p->mime_type = $this->page->mimeType(); - $p->context = $this->page->context; - $p->load(); - $p->generate(); - $inhalt = $p->value; - unset( $p ); - break; - - case 'ssi': - $inhalt = '<!--#include virtual="'.$this->page->path_to_object($objectid).'" -->'; - break; - - default: - $inhalt = '?'.$this->element->subtype.'?'; - break; - } - } - else throw new LogicException('FATAL: recursion detected'); - } - } - - if ( $this->publisher->isSimplePreview() ) - { - $inhalt = strip_tags( $inhalt ); - $inhalt = str_replace( "\n",'',$inhalt ); - $inhalt = str_replace( "\r",'',$inhalt ); - } - - break; - - - case Element::ELEMENT_TYPE_LINK: - - $objectid = $this->linkToObjectId; - if ( intval($objectid) == 0 ) - $objectid = $this->element->defaultObjectId; - - if ( $objectid==0 ) - { - // Link noch nicht gefuellt - $inhalt = ''; - } - elseif ( ! BaseObject::available($objectid) ) - { - $inhalt = $this->publisher->isSimplePreview()?'-':''; - } - elseif ( $this->publisher->isSimplePreview() ) - { - $o = new BaseObject( $objectid ); - $o->load(); - $inhalt = $o->filename; - } - elseif ($this->element->subtype == 'image_data_uri' ) - { - $file = new File($objectid); - $file->load(); - $inhalt = 'data:'.$file->mimeType().';base64,'.base64_encode($file->loadValue()); - } - else - { - $inhalt = $this->page->path_to_object( $objectid ); - } - - break; - - - case Element::ELEMENT_TYPE_COPY: - - list($linkElementName,$targetElementName) = explode('%',$this->element->name.'%'); - - if ( empty($targetElementName) ) - break; - - $element = new Element(); - $element->name = $linkElementName; - $element->load(); - - if ( intval($element->elementid)==0 ) - break; - - $linkValue = new Value(); - $linkValue->elementid = $element->elementid; - $linkValue->element = $element; - $linkValue->pageid = $this->pageid; - $linkValue->page = $this->page; - $linkValue->languageid = $this->languageid; - $linkValue->load(); - - if ( !BaseObject::available( $linkValue->linkToObjectId ) ) - break; - - $linkedPage = new Page( $linkValue->linkToObjectId ); - $linkedPage->context = $this->page->context; - $linkedPage->load(); - - $linkedPageTemplate = new Template( $linkedPage->templateid ); - $targetElementId = array_search( $targetElementName, $linkedPageTemplate->getElementNames() ); - - if ( intval($targetElementId)==0 ) - break; - - $targetValue = new Value(); - $targetValue->elementid = $targetElementId; - $targetValue->element = new Element($targetElementId); - $targetValue->element->load(); - $targetValue->pageid = $linkedPage->pageid; - $targetValue->page = $linkedPage; - $targetValue->generate(); - - $inhalt = $targetValue->value; - - break; - - - case Element::ELEMENT_TYPE_LINKINFO: - - @list( $linkElementName, $name ) = explode('%',$this->element->name); - if ( is_null($name) ) - break; - - $template = new Template( $this->page->templateid ); - $elementId = array_search( $linkElementName, $template->getElementNames() ); - - - $element = new Element($elementId); - $element->load(); - - $linkValue = new Value(); - $linkValue->elementid = $element->elementid; - $linkValue->element = $element; - $linkValue->pageid = $this->pageid; - $linkValue->languageid = $this->languageid; - $linkValue->publisher = $this->publisher; - $linkValue->load(); - - $objectid = $linkValue->linkToObjectId; - - if ( intval($objectid) == 0 ) - $objectid = $linkValue->element->defaultObjectId; - - if ( !BaseObject::available( $objectid ) ) - break; - - $linkedObject = new BaseObject( $objectid ); - $linkedObject->languageid = $this->languageid; - $linkedObject->load(); - - switch( $this->element->subtype ) - { - case 'width': - $f = new Image( $objectid ); - $f->load(); - if ( $f->isImage() ) - { - $f->getImageSize(); - $inhalt = $f->width; - } - unset($f); - break; - - case 'height': - $f = new Image( $objectid ); - $f->load(); - if ( $f->isImage() ) - { - $f->getImageSize(); - $inhalt = $f->height; - } - unset($f); - break; - - case 'id': - $inhalt = $objectid; - break; - - case 'name': - $inhalt = $linkedObject->name; - break; - - case 'description': - $inhalt = $linkedObject->description; - break; - - case 'create_user_desc': - $user = $linkedObject->createUser; - try - { - $user->load(); - $inhalt = $user->desc; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'create_user_fullname': - $user = $linkedObject->createUser; - try - { - $user->load(); - $inhalt = $user->fullname; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'create_user_mail': - $user = $linkedObject->createUser; - try - { - $user->load(); - $inhalt = $user->mail; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'create_user_tel': - $user = $linkedObject->createUser; - try - { - $user->load(); - $inhalt = $user->tel; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'create_user_username': - $user = $linkedObject->createUser; - try - { - $user->load(); - $inhalt = $user->name; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'lastch_user_desc': - $user = $linkedObject->lastchangeUser; - try - { - $user->load(); - $inhalt = $user->desc; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'lastch_user_fullname': - $user = $linkedObject->lastchangeUser; - try - { - $user->load(); - $inhalt = $user->fullname; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'lastch_user_mail': - $user = $linkedObject->lastchangeUser; - try - { - $user->load(); - $inhalt = $user->mail; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'lastch_user_tel': - $user = $linkedObject->lastchangeUser; - try - { - $user->load(); - $inhalt = $user->tel; - } - catch( ObjectNotFoundException $e ) - { - } - - break; - - case 'lastch_user_username': - $user = $linkedObject->lastchangeUser; - try - { - $user->load(); - $inhalt = $user->name; - } - catch( ObjectNotFoundException $e ) - { - } - break; - - case 'mime-type': - if ( $linkedObject->isFile || $linkedObject->isImage || $linkedObject->isText ) - { - $f = new File( $objectid ); - $f->load(); - $inhalt = $f->mimeType(); - unset($f); - } - break; - - case 'filename': - $inhalt = $linkedObject->filename(); - break; - - case 'full_filename': - $inhalt = $linkedObject->full_filename(); - break; - - default: - $inhalt = ''; - Logger::error('subtype for linkinfo not implemented:'.$this->element->subtype); - } - - break; - - case Element::ELEMENT_TYPE_LINKDATE: - - @list( $linkElementName, $name ) = explode('%',$this->element->name); - if ( is_null($name) ) - break; - - $template = new Template( $this->page->templateid ); - $elementId = array_search( $linkElementName, $template->getElementNames() ); - - $element = new Element($elementId); - $element->load(); - - $linkValue = new Value(); - $linkValue->elementid = $element->elementid; - $linkValue->element = $element; - $linkValue->pageid = $this->pageid; - $linkValue->languageid = $this->languageid; - $linkValue->load(); - - $objectid = $linkValue->linkToObjectId; - - if ( intval($objectid) == 0 ) - $objectid = $linkValue->element->defaultObjectId; - - if ( !BaseObject::available( $objectid ) ) - break; - - $linkedObject = new BaseObject( $objectid ); - $linkedObject->load(); - - - switch( $this->element->subtype ) - { - case 'date_published': - // START_TIME wird zu Beginn im Controller gesetzt. - // So erh�lt jede Datei das gleiche Ver�ffentlichungsdatum. - $date = START_TIME; - break; - - case 'date_saved': - $date = $linkedObject->lastchangeDate; - break; - - case 'date_created': - $date = $linkedObject->createDate; - break; - - default: - Logger::warn('element:'.$this->element->name.', '. - 'type:'.$this->element->type.', '. - 'unknown subtype:'.$this->element->subtype); - $date = START_TIME; - } - - if ( strpos($this->element->dateformat,'%')!==FALSE ) - $inhalt = strftime( $this->element->dateformat,$date ); - else - $inhalt = date ( $this->element->dateformat,$date ); - break; - - case Element::ELEMENT_TYPE_LONGTEXT: - case Element::ELEMENT_TYPE_TEXT: - case Element::ELEMENT_TYPE_SELECT: - - $inhalt = $this->text; - $format = $this->format; - - // Wenn Inhalt leer, dann versuchen, den Inhalt der Default-Sprache zu laden. - if ( $inhalt == '' && $conf['content']['language']['use_default_language'] ) - { - $project = new Project($this->page->projectid); - $this->languageid = $project->getDefaultLanguageId(); - $this->load(); - $inhalt = $this->text; - } - - // Wenn Inhalt leer, dann Vorbelegung verwenden - if ( $inhalt == '' ) { - - $inhalt = $this->element->defaultText; - $format = $this->element->format; - } - - // Wenn HTML nicht erlaubt und Wiki-Formatierung aktiv, dann einfache HTML-Tags in Wiki umwandeln - $pageIsHtml = $this->page->isHtml(); - - // - switch( $format ) - { - case Element::ELEMENT_FORMAT_TEXT: - case Element::ELEMENT_FORMAT_HTML: - - if ( !$this->element->html ) - { - // HTML not allowed. - $inhalt = Text::encodeHtml( $inhalt ); - $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); - } - - break; - - case Element::ELEMENT_FORMAT_WIKI: - - if ( $conf['editor']['wiki']['convert_bbcode'] ) - $inhalt = Text::bbCode2Wiki( $inhalt ); - - if ( !$this->element->html && $conf['editor']['wiki']['convert_html'] && $pageIsHtml) - $inhalt = Text::html2Wiki( $inhalt ); - - $transformer = new Transformer(); - $transformer->text = $inhalt; - $transformer->page = $this->page; - $transformer->element = $this->element; - - $transformer->transform(); - $inhalt = $transformer->text; - break; - - case Element::ELEMENT_FORMAT_MARKDOWN: - - $mdConfig = Config()->subset('editor')->subset('markdown'); - - $parser = new \util\Parsedown(); - $parser->setUrlsLinked( $mdConfig->is('urls-linked',true)); - $parser->setMarkupEscaped( !$this->element->html ); - - $inhalt = $parser->parse( $inhalt ); - break; - - default: - throw new \LogicException('Unknown format: '.$this->format ); - } - - if ( $this->publisher->isSimplePreview() ) - { - // Simple Preview with bare text. - $inhalt = strip_tags( $inhalt ); - $inhalt = str_replace( "\n",'',$inhalt ); - $inhalt = str_replace( "\r",'',$inhalt ); - } - - // "__OID__nnn__" ersetzen durch einen richtigen Link - foreach( Text::parseOID($inhalt) as $oid=>$t ) - { - $url = $this->page->path_to_object($oid); - - foreach( $t as $match ) - $inhalt = str_replace($match,$url,$inhalt); - } - - break; - - - // Zahl - // - // wird im entsprechenden Format angezeigt. - case Element::ELEMENT_TYPE_NUMBER: - - if ( $this->number == 0 ) - { - // Zahl ist gleich 0, dann Default-Text - $inhalt = $this->element->defaultText; - break; - } - - $number = $this->number / pow(10,$this->element->decimals); - $inhalt = number_format( $number,$this->element->decimals,$this->element->decPoint,$this->element->thousandSep ); - - break; - - - // Datum - case Element::ELEMENT_TYPE_DATE: - - $date = $this->date; - - if ( intval($date) == 0 ) - { - // Datum wurde noch nicht eingegeben - $inhalt = $this->element->defaultText; - break; - } - - // Datum gemaess Elementeinstellung formatieren - if ( strpos($this->element->dateformat,'%')!==FALSE ) - $inhalt = strftime( $this->element->dateformat,$date ); - else - $inhalt = date ( $this->element->dateformat,$date ); - break; - - - // Programmcode (PHP) - case Element::ELEMENT_TYPE_CODE: - - if ( $this->publisher->isSimplePreview() ) - break; - - // Die Ausführung von benutzer-erzeugtem PHP-Code kann in der - // Konfiguration aus Sicherheitsgründen deaktiviert sein. - if ( $conf['security']['disable_dynamic_code'] ) - { - Logger::warn("Execution of dynamic code elements is disabled by configuration. Set security/disable_dynamic_code to true to allow this"); - break; - } - - $this->page->load(); - - // Das Ausführen geschieht über die Klasse "Code". - // In dieser wird der Code in eine Datei geschrieben und - // von dort eingebunden. - $code = new Code(); - $code->setContextPage($this->page ); - $code->code = $this->element->code; - - ob_start(); - - // Jetzt ausfuehren des temporaeren PHP-Codes - $code->execute(); - - $output = ob_get_contents(); - ob_end_clean(); - - // Ausgabe ermitteln. - $inhalt = $output; - - - break; - - - // Makros (dynamische Klassen) - case Element::ELEMENT_TYPE_DYNAMIC: - - if ( $this->publisher->isSimplePreview() ) - break; - - $this->page->load(); - $macroName = $this->element->subtype; - $macroSettings = $this->element->getDynamicParameters(); - - $runner = new MacroRunner(); - try { - $inhalt .= $runner->executeMacro($macroName, $macroSettings,$this->page); - } - catch( \Exception $e ) { - throw new GeneratorException("Macro ".$macroName.' in value '.$this->__toString().' could not executed',$e); - } - - // Wenn HTML-Ausgabe, dann Sonderzeichen in HTML �bersetzen - if ( $this->page->isHtml() ) - $inhalt = Text::encodeHtmlSpecialChars( $inhalt ); - - break; - - - // Info-Feld als Datum - case Element::ELEMENT_TYPE_INFODATE: - - if ( $this->publisher->isSimplePreview() ) - break; - - switch( $this->element->subtype ) - { - case 'date_published': - // START_TIME wird zu Beginn im Controller gesetzt. - // So erh�lt jede Datei das gleiche Ver�ffentlichungsdatum. - $date = START_TIME; - break; - - case 'date_saved': - $date = $this->page->lastchangeDate; - break; - - case 'date_created': - $date = $this->page->createDate; - break; - - default: - Logger::warn('element:'.$this->element->name.', '. - 'type:'.$this->element->type.', '. - 'unknown subtype:'.$this->element->subtype); - if ( !$this->publisher->isPublic() ) - $inhalt = lang('ERROR_IN_ELEMENT'); - } - - if ( strpos($this->element->dateformat,'%')!==FALSE ) - $inhalt = strftime( $this->element->dateformat,$date ); - else - $inhalt = date ( $this->element->dateformat,$date ); - - break; - - - // Info-Feld - case Element::ELEMENT_TYPE_INFO: - - if ( $this->publisher->isSimplePreview() ) - break; - - switch( $this->element->subtype ) - { - case 'db_id': - $inhalt = $SESS['dbid']; - break; - case 'db_name': - $inhalt = $conf['database_'.$SESS['dbid']]['description']; - break; - case 'project_id': - $inhalt = $this->page->projectid; - break; - case 'project_name': - $inhalt = Project::create( $this->page->projectid )->load()->name; - break; - case 'language_id': - $inhalt = $this->page->languageid; - break; - case 'language_iso': - $language = new Language( $this->page->languageid ); - $language->load(); - $inhalt = $language->isoCode; - break; - case 'language_name': - $language = new Language( $this->page->languageid ); - $language->load(); - $inhalt = $language->name; - break; - case 'page_id': - $inhalt = $this->page->objectid; - break; - case 'page_name': - $inhalt = $this->page->name; - break; - case 'page_desc': - $inhalt = $this->page->desc; - break; - case 'page_fullfilename': - $inhalt = $this->page->full_filename(); - break; - case 'page_filename': - $inhalt = $this->page->filename(); - break; - case 'page_extension': - $inhalt = ''; - break; - case 'edit_url': - $raw = true; - $db = \util\Session::getDatabase(); - $inhalt = Html::url('page',null,$this->page->objectid,array('dbid'=>$db->id)); - break; - case 'edit_fullurl': - $raw = true; - $inhalt = Http::getServer(); - - // Der Link soll nicht auf die API, sondern auf das UI zeigen. - if ( substr($inhalt,-4) == 'api/' ) - $inhalt = substr($inhalt,0,-4); - - $db = db(); - $inhalt .= '/#/page/'.$this->page->objectid; - break; - case 'lastch_user_username': - $user = $this->page->lastchangeUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->name; - break; - case 'lastch_user_fullname': - $user = $this->page->lastchangeUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->fullname; - break; - case 'lastch_user_mail': - $user = $this->page->lastchangeUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->mail; - break; - case 'lastch_user_desc': - $user = $this->page->lastchangeUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->desc; - break; - case 'lastch_user_tel': - $user = $this->page->lastchangeUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->tel; - break; - - case 'create_user_username': - $user = $this->page->createUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->name; - break; - case 'create_user_fullname': - $user = $this->page->createUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->fullname; - break; - case 'create_user_mail': - $user = $this->page->createUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->mail; - break; - case 'create_user_desc': - $user = $this->page->createUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->desc; - break; - case 'create_user_tel': - $user = $this->page->createUser; - if ( $user->userid ) - $user->load(); - $inhalt = $user->tel; - break; - - case 'act_user_username': - $user = \util\Session::getUser(); - if ( $user ) - $inhalt = $user->name; - break; - case 'act_user_fullname': - $user = \util\Session::getUser(); - if ( $user ) - $inhalt = $user->fullname; - break; - case 'act_user_mail': - $user = \util\Session::getUser(); - if ( $user ) - $inhalt = $user->mail; - break; - case 'act_user_desc': - $user = \util\Session::getUser(); - if ( $user ) - $inhalt = $user->desc; - break; - case 'act_user_tel': - $user = \util\Session::getUser(); - if ( $user ) - $inhalt = $user->tel; - break; - default: - Logger::warn('element:'.$this->element->name.', '. - 'type:'.$this->element->type.', '. - 'unknown subtype:'.$this->element->subtype); - // Keine Fehlermeldung in erzeugte Seite schreiben. - } - - break; - - default: - // this should never happen in production. - // inform the user. - throw new GeneratorException( 'Error in element '.$this->element->name.': '. - 'unknown type: '.$this->element->typeid.''); - - } - - - switch( $this->element->type ) - { - case 'longtext': - case 'text': - case 'select': - - if ( $conf['publish']['encode_utf8_in_html'] ) - // Wenn HTML-Ausgabe, dann UTF-8-Zeichen als HTML-Code uebersetzen - if ( $this->page->isHtml() ) - $inhalt = translateutf8tohtml($inhalt); - break; - - default: - } - - - - if ( $this->page->icons && $this->element->withIcon && $this->page->isHtml() ) - { - // Anklickbaren Link voranstellen. - $iconLink = '<a href="javascript:parent.openNewAction(\''.$this->element->name.'\',\'pageelement\',\''.$this->page->objectid.'_'.$this->element->elementid.'\');" title="'.$this->element->desc.'"><img src="'.OR_THEMES_DIR.$conf['interface']['theme'].'/images/icon_el_'.$this->element->type.IMG_ICON_EXT.'" border="0" align="left"></a>'; - $inhalt = $iconLink.$inhalt; - } - - $this->value = $inhalt; - - return $this->value; - } - /** * Es werden Objekte mit einem Inhalt gesucht. diff --git a/modules/cms/ui/themes/default/html/views/element/advanced.php b/modules/cms/ui/themes/default/html/views/element/advanced.php @@ -45,7 +45,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('with_icon') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$with_icon){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('with_icon') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$with_icon){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('EL_PROP_WITH_ICON').'') ?> </span> @@ -58,7 +58,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('inherit') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$inherit){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('inherit') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$inherit){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('EL_PROP_INHERIT').'') ?> </span> @@ -71,7 +71,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('all_languages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$all_languages){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('all_languages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$all_languages){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('EL_PROP_ALL_LANGUAGES').'') ?> </span> @@ -84,7 +84,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('writable') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$writable){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('writable') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$writable){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('EL_PROP_writable').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/element/properties.php b/modules/cms/ui/themes/default/html/views/element/properties.php @@ -37,7 +37,7 @@ </span> </td> <td><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('with_icon') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$with_icon){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('with_icon') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$with_icon){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> </tr> <?php } ?> @@ -48,7 +48,7 @@ </span> </td> <td><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('all_languages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$all_languages){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('all_languages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$all_languages){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> </tr> <?php } ?> @@ -59,7 +59,7 @@ </span> </td> <td><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('writable') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$writable){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('writable') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$writable){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> </tr> <?php } ?> diff --git a/modules/cms/ui/themes/default/html/views/element/remove.php b/modules/cms/ui/themes/default/html/views/element/remove.php @@ -32,7 +32,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> @@ -45,7 +45,7 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('value') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('value') ?>" <?php if(@$type=='value'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('ELEMENT_DELETE_VALUES').'') ?> </span> @@ -53,7 +53,7 @@ <br /><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('all') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('all') ?>" <?php if(@$type=='all'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/file/compress.php b/modules/cms/ui/themes/default/html/views/file/compress.php @@ -30,13 +30,13 @@ </select> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/file/remove.php b/modules/cms/ui/themes/default/html/views/file/remove.php @@ -14,7 +14,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> </label> </div> <div class="<?php echo escapeHtml('or-form-actionbar') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/file/uncompress.php b/modules/cms/ui/themes/default/html/views/file/uncompress.php @@ -22,13 +22,13 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/folder/advanced.php b/modules/cms/ui/themes/default/html/views/folder/advanced.php @@ -13,7 +13,7 @@ <table width="<?php echo escapeHtml('100%') ?>"><?php echo escapeHtml('') ?> <tr class="<?php echo escapeHtml('headline') ?>"><?php echo escapeHtml('') ?> <td class="<?php echo escapeHtml('help') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('checkall') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$checkall){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('checkall') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$checkall){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <td class="<?php echo escapeHtml('help') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('TYPE').'') ?> @@ -28,7 +28,7 @@ <tr class="<?php echo escapeHtml('data') ?>"><?php echo escapeHtml('') ?> <td width="<?php echo escapeHtml('1%') ?>"><?php echo escapeHtml('') ?> <?php $if1=($writable); if($if1) { ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$id.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$id){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$id.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$id){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <?php } ?> <?php $if1=(!writable); if($if1) { ?> <span><?php echo escapeHtml(' ') ?> @@ -90,7 +90,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml(''.@$actiontype.'') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml(''.@$actiontype.'') ?>" <?php if(@$type=='${actiontype}'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -106,7 +106,7 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/folder/pub.php b/modules/cms/ui/themes/default/html/views/folder/pub.php @@ -16,7 +16,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('pages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$pages){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('pages') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$pages){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -31,7 +31,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -55,7 +55,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('subdirs') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$subdirs){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('subdirs') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$subdirs){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -70,7 +70,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('clean') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$clean){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('clean') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$clean){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/folder/remove.php b/modules/cms/ui/themes/default/html/views/folder/remove.php @@ -14,12 +14,12 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE_WITH_CHILDREN').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('withChildren') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$withChildren){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('withChildren') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$withChildren){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> <div class="<?php echo escapeHtml('or-form-actionbar') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/group/memberships.php b/modules/cms/ui/themes/default/html/views/group/memberships.php @@ -22,7 +22,7 @@ <?php foreach((array)$memberships as $list_key=>$list_value) { extract($list_value); ?> <tr class="<?php echo escapeHtml('data') ?>"><?php echo escapeHtml('') ?> <td><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$var.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$var){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$var.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$var){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <td><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/group/remove.php b/modules/cms/ui/themes/default/html/views/group/remove.php @@ -30,7 +30,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('GROUP_DELETE').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/group/rights.php b/modules/cms/ui/themes/default/html/views/group/rights.php @@ -87,7 +87,7 @@ <td><?php echo escapeHtml('') ?> <?php { $$list_value= $bits[$list_value]; ?> <?php } ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$list_value.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$list_value){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$list_value.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$list_value){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <?php } ?> </tr> diff --git a/modules/cms/ui/themes/default/html/views/image/compress.php b/modules/cms/ui/themes/default/html/views/image/compress.php @@ -30,13 +30,13 @@ </select> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/image/size.php b/modules/cms/ui/themes/default/html/views/image/size.php @@ -33,7 +33,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('factor') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('factor') ?>" <?php if(@$type=='factor'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('FILE_IMAGE_SIZE_FACTOR').'') ?> </span> @@ -52,7 +52,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" <?php if(@$type=='input'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('FILE_IMAGE_NEW_WIDTH_HEIGHT').'') ?> </span> @@ -120,7 +120,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('copy') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$copy){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('copy') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$copy){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('copy').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/image/uncompress.php b/modules/cms/ui/themes/default/html/views/image/uncompress.php @@ -22,13 +22,13 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/language/prop.php b/modules/cms/ui/themes/default/html/views/language/prop.php @@ -31,7 +31,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_default') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_default){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_default') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_default){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('is_default').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/language/remove.php b/modules/cms/ui/themes/default/html/views/language/remove.php @@ -32,7 +32,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/link/remove.php b/modules/cms/ui/themes/default/html/views/link/remove.php @@ -14,7 +14,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> <div class="<?php echo escapeHtml('or-form-actionbar') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/login/login.php b/modules/cms/ui/themes/default/html/views/login/login.php @@ -71,7 +71,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('remember') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$remember){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('remember') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$remember){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('REMEMBER_ME').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/login/openid.php b/modules/cms/ui/themes/default/html/views/login/openid.php @@ -33,7 +33,7 @@ <br /><?php echo escapeHtml('') ?> <?php } ?> <?php $if1=($openid_user_identity); if($if1) { ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('openid_provider') ?>" value="<?php echo escapeHtml('identity') ?>" checked="<?php echo escapeHtml(''.@$openid_provider.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('openid_provider') ?>" value="<?php echo escapeHtml('identity') ?>" <?php if(@$openid_provider=='identity'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('inputholder') ?>"><?php echo escapeHtml('') ?> <input name="<?php echo escapeHtml('openid_url') ?>" type="<?php echo escapeHtml('text') ?>" maxlength="<?php echo escapeHtml('256') ?>" value="<?php echo escapeHtml(''.@$openid_url.'') ?>" class="<?php echo escapeHtml('name') ?>" /><?php echo escapeHtml('') ?> </div> diff --git a/modules/cms/ui/themes/default/html/views/model/prop.php b/modules/cms/ui/themes/default/html/views/model/prop.php @@ -20,7 +20,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_default') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_default){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_default') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_default){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('is_default').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/model/remove.php b/modules/cms/ui/themes/default/html/views/model/remove.php @@ -32,7 +32,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/object/aclform.php b/modules/cms/ui/themes/default/html/views/object/aclform.php @@ -16,7 +16,7 @@ <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('all') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('all') ?>" <?php if(@$type=='all'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('ALL').'') ?> </span> @@ -27,7 +27,7 @@ </div> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('user') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('user') ?>" <?php if(@$type=='user'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('USER').'') ?> </span> @@ -47,7 +47,7 @@ <?php $if1=(isset($groups)); if($if1) { ?> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('group') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('group') ?>" <?php if(@$type=='group'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('GROUP').'') ?> </span> @@ -112,7 +112,7 @@ <?php $if1=($t=='read'); if($if1) { ?> <?php { $$t= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$t.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$t){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$t.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$t){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <?php } ?> <?php if(!$if1) { ?> <?php { unset($$t) ?> @@ -120,7 +120,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('acl_'.@$t.'').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$t.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$t){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$t.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$t){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> <?php } ?> </div> diff --git a/modules/cms/ui/themes/default/html/views/object/inherit.php b/modules/cms/ui/themes/default/html/views/object/inherit.php @@ -21,7 +21,7 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <?php { $inherit= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('inherit') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$inherit){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('inherit') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$inherit){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('inherit_rights').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/page/form.php b/modules/cms/ui/themes/default/html/views/page/form.php @@ -45,7 +45,7 @@ </label> </td> <td><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$saveid.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$saveid){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$saveid.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$saveid){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <td><?php echo escapeHtml('') ?> <?php $if1=(in_array($type,explode(",",text,date,number)); if($if1) { ?> @@ -83,7 +83,7 @@ <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <?php $if1=(isset($release)); if($if1) { ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -94,7 +94,7 @@ <?php } ?> <?php $if1=(isset($publish)); if($if1) { ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/page/name.php b/modules/cms/ui/themes/default/html/views/page/name.php @@ -55,7 +55,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('leave_link').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('leave_link') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$leave_link){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('leave_link') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$leave_link){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> </fieldset> diff --git a/modules/cms/ui/themes/default/html/views/page/pub.php b/modules/cms/ui/themes/default/html/views/page/pub.php @@ -24,7 +24,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('files').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/page/remove.php b/modules/cms/ui/themes/default/html/views/page/remove.php @@ -14,7 +14,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> <div class="<?php echo escapeHtml('or-form-actionbar') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/history.php b/modules/cms/ui/themes/default/html/views/pageelement/history.php @@ -63,7 +63,7 @@ </td> <td><?php echo escapeHtml('') ?> <?php $if1=(isset($compareid)); if($if1) { ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('compareid') ?>" value="<?php echo escapeHtml(''.@$id.'') ?>" checked="<?php echo escapeHtml(''.@$compareid.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('compareid') ?>" value="<?php echo escapeHtml(''.@$id.'') ?>" <?php if(@$compareid=='${id}'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <?php } ?> <?php if(!$if1) { ?> <span><?php echo escapeHtml(' ') ?> @@ -72,7 +72,7 @@ </td> <td><?php echo escapeHtml('') ?> <?php $if1=(isset($compareid)); if($if1) { ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('withid') ?>" value="<?php echo escapeHtml(''.@$id.'') ?>" checked="<?php echo escapeHtml(''.@$withid.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('withid') ?>" value="<?php echo escapeHtml(''.@$id.'') ?>" <?php if(@$withid=='${id}'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <?php } ?> <?php if(!$if1) { ?> <span><?php echo escapeHtml(' ') ?> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/link.php b/modules/cms/ui/themes/default/html/views/pageelement/link.php @@ -43,7 +43,7 @@ <?php $if1=(isset($release)); if($if1) { ?> <tr><?php echo escapeHtml('') ?> <td colspan="<?php echo escapeHtml('2') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> @@ -56,7 +56,7 @@ <?php $if1=(isset($publish)); if($if1) { ?> <tr><?php echo escapeHtml('') ?> <td colspan="<?php echo escapeHtml('2') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(' ') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/pub.php b/modules/cms/ui/themes/default/html/views/pageelement/pub.php @@ -24,7 +24,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('files') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$files){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('files').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/pageelement/value.php b/modules/cms/ui/themes/default/html/views/pageelement/value.php @@ -286,7 +286,7 @@ <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> <?php foreach((array)$languages as $languageid=>$languagename) { ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('otherlanguageid') ?>" value="<?php echo escapeHtml(''.@$languageid.'') ?>" checked="<?php echo escapeHtml(''.@$otherlanguageid.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('otherlanguageid') ?>" value="<?php echo escapeHtml(''.@$languageid.'') ?>" <?php if(@$otherlanguageid=='${languageid}'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@$languagename.'') ?> </span> @@ -307,7 +307,7 @@ </legend> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('preview') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$preview){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('preview') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$preview){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('PAGE_PREVIEW').'') ?> </span> @@ -328,7 +328,7 @@ <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <?php $if1=(isset($release)); if($if1) { ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('release') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$release){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('RELEASE').'') ?> </span> @@ -337,7 +337,7 @@ <?php } ?> <?php $if1=(isset($publish)); if($if1) { ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publish') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publish){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('PAGE_PUBLISH_AFTER_SAVE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/profile/edit.php b/modules/cms/ui/themes/default/html/views/profile/edit.php @@ -172,7 +172,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_totp').'') ?> </label> <i data-qrcode="<?php echo escapeHtml(''.@$totpSecretUrl.'') ?>" title="<?php echo escapeHtml(''.@lang('QRCODE_SHOW').'') ?>" class="<?php echo escapeHtml('image-icon image-icon--menu-qrcode or-qrcode or-info') ?>"><?php echo escapeHtml('') ?> @@ -183,7 +183,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('hotp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$hotp){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('hotp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$hotp){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_hotp').'') ?> </label> <i data-qrcode="<?php echo escapeHtml(''.@$hotpSecretUrl.'') ?>" title="<?php echo escapeHtml(''.@lang('QRCODE_SHOW').'') ?>" class="<?php echo escapeHtml('image-icon image-icon--menu-qrcode or-qrcode or-info') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/project/add.php b/modules/cms/ui/themes/default/html/views/project/add.php @@ -28,14 +28,14 @@ </legend> <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" <?php if(@$type=='empty'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('empty').'') ?> </span> </label> </div> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" <?php if(@$type=='copy'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('copy').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/project/maintenance.php b/modules/cms/ui/themes/default/html/views/project/maintenance.php @@ -17,7 +17,7 @@ <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml('') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('check_limit') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('check_limit') ?>" <?php if(@$type=='check_limit'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('project_check_limit').'') ?> </span> @@ -26,7 +26,7 @@ <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml('') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('check_files') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('check_files') ?>" <?php if(@$type=='check_files'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('project_check_files').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/project/prop.php b/modules/cms/ui/themes/default/html/views/project/prop.php @@ -75,7 +75,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publishFileExtension') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publishFileExtension){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publishFileExtension') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publishFileExtension){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('PROJECT_publish_File_Extension').'') ?> </label> </div> @@ -84,7 +84,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publishPageExtension') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publishPageExtension){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('publishPageExtension') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$publishPageExtension){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('PROJECT_publish_page_Extension').'') ?> </label> </div> @@ -92,12 +92,12 @@ <label class="<?php echo escapeHtml('or-form-row or-form-radio') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('LINKS_RELATIVE').'') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('linksAbsolute') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$linksAbsolute.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('linksAbsolute') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$linksAbsolute=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> <label class="<?php echo escapeHtml('or-form-row or-form-radio') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('LINKS_ABSOLUTE').'') ?> </span> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('linksAbsolute') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$linksAbsolute.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('linksAbsolute') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$linksAbsolute=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> </fieldset> @@ -121,7 +121,7 @@ <input name="<?php echo escapeHtml('ftp_url') ?>" type="<?php echo escapeHtml('text') ?>" maxlength="<?php echo escapeHtml('256') ?>" value="<?php echo escapeHtml(''.@$ftp_url.'') ?>" class="<?php echo escapeHtml('filename') ?>" /><?php echo escapeHtml('') ?> </div> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('ftp_passive') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$ftp_passive){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('ftp_passive') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$ftp_passive){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('PROJECT_FTP_PASSIVE').'') ?> </label> </div> @@ -142,7 +142,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('content_negotiation') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$content_negotiation){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('content_negotiation') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$content_negotiation){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('PROJECT_CONTENT_NEGOTIATION').'') ?> </label> </div> @@ -151,7 +151,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('cut_index') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$cut_index){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('cut_index') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$cut_index){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('PROJECT_CUT_INDEX').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/project/remove.php b/modules/cms/ui/themes/default/html/views/project/remove.php @@ -29,7 +29,7 @@ </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/projectlist/add.php b/modules/cms/ui/themes/default/html/views/projectlist/add.php @@ -29,13 +29,13 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" <?php if(@$type=='empty'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('empty').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" <?php if(@$type=='copy'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('copy').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/search/edit.php b/modules/cms/ui/themes/default/html/views/search/edit.php @@ -28,31 +28,31 @@ <br /><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('id') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','id')){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('id') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','id')){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('id').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('name') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','name')){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('name') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','name')){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('name').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('filename') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','filename')){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('filename') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','filename')){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('filename').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('description') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','description')){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('description') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','description')){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('description').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('content') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','content')){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('content') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(config('search','quicksearch','flag','content')){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('content').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/template/addel.php b/modules/cms/ui/themes/default/html/views/template/addel.php @@ -48,7 +48,7 @@ </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('addtotemplate') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(1){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('addtotemplate') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(1){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('menu_template_srcelement').'') ?> </span> </label> diff --git a/modules/cms/ui/themes/default/html/views/template/pub.php b/modules/cms/ui/themes/default/html/views/template/pub.php @@ -24,7 +24,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('pages') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(1){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('pages') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(1){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('publish').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/template/remove.php b/modules/cms/ui/themes/default/html/views/template/remove.php @@ -32,7 +32,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('CONFIRM_DELETE').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/template/srcelement.php b/modules/cms/ui/themes/default/html/views/template/srcelement.php @@ -8,7 +8,7 @@ <?php $if1=(isset($elements)); if($if1) { ?> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addelement') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addelement') ?>" <?php if(@$type=='addelement'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('value').'') ?> </span> @@ -31,7 +31,7 @@ </fieldset> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addicon') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addicon') ?>" <?php if(@$type=='addicon'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('ICON').'') ?> </span> @@ -48,7 +48,7 @@ </div> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addifempty') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addifempty') ?>" <?php if(@$type=='addifempty'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('TEMPLATE_SRC_IFEMPTY').'') ?> </span> @@ -59,7 +59,7 @@ </div> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addifnotempty') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('addifnotempty') ?>" <?php if(@$type=='addifnotempty'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('TEMPLATE_SRC_IFNOTEMPTY').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/templatelist/add.php b/modules/cms/ui/themes/default/html/views/templatelist/add.php @@ -27,7 +27,7 @@ <div class="<?php echo escapeHtml('closable') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('line') ?>"><?php echo escapeHtml('') ?> <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('empty') ?>" <?php if(@$type=='empty'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> @@ -42,7 +42,7 @@ <span><?php echo escapeHtml(''.@lang('copy').'') ?> </span> </label> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('copy') ?>" <?php if(@$type=='copy'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <select name="<?php echo escapeHtml('templateid') ?>" size="<?php echo escapeHtml('1') ?>"><?php echo escapeHtml('') ?> @@ -59,7 +59,7 @@ <span><?php echo escapeHtml(''.@lang('example').'') ?> </span> </label> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('example') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('example') ?>" <?php if(@$type=='example'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <select name="<?php echo escapeHtml('example') ?>" size="<?php echo escapeHtml('1') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/text/compress.php b/modules/cms/ui/themes/default/html/views/text/compress.php @@ -30,13 +30,13 @@ </select> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/text/size.php b/modules/cms/ui/themes/default/html/views/text/size.php @@ -33,7 +33,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('factor') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('factor') ?>" <?php if(@$type=='factor'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('FILE_IMAGE_SIZE_FACTOR').'') ?> </span> @@ -52,7 +52,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" <?php if(@$type=='input'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('FILE_IMAGE_NEW_WIDTH_HEIGHT').'') ?> </span> @@ -120,7 +120,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('copy') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$copy){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('copy') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$copy){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('copy').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/text/uncompress.php b/modules/cms/ui/themes/default/html/views/text/uncompress.php @@ -22,13 +22,13 @@ <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> <?php { $replace= 1; ?> <?php } ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$replace=='1'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('replace').'') ?> </span> </label> <br /><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" checked="<?php echo escapeHtml(''.@$replace.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('replace') ?>" value="<?php echo escapeHtml('') ?>" <?php if(@$replace=='0'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> <span><?php echo escapeHtml(''.@lang('new').'') ?> </span> diff --git a/modules/cms/ui/themes/default/html/views/url/remove.php b/modules/cms/ui/themes/default/html/views/url/remove.php @@ -14,7 +14,7 @@ <label class="<?php echo escapeHtml('or-form-row or-form-checkbox') ?>"><?php echo escapeHtml('') ?> <span class="<?php echo escapeHtml('or-form-label') ?>"><?php echo escapeHtml(''.@lang('DELETE').'') ?> </span> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('delete') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$delete){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </label> </div> <div class="<?php echo escapeHtml('or-form-actionbar') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/info.php b/modules/cms/ui/themes/default/html/views/user/info.php @@ -128,7 +128,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_admin') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_admin){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_admin') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_admin){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_admin').'') ?> </label> </div> @@ -210,7 +210,7 @@ </label> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_totp').'') ?> </label> <i data-qrcode="<?php echo escapeHtml(''.@$totpSecretUrl.'') ?>" title="<?php echo escapeHtml(''.@lang('QRCODE_SHOW').'') ?>" class="<?php echo escapeHtml('image-icon image-icon--menu-qrcode or-qrcode or-info') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/memberships.php b/modules/cms/ui/themes/default/html/views/user/memberships.php @@ -20,7 +20,7 @@ <?php foreach((array)$memberships as $list_key=>$list_value) { extract($list_value); ?> <tr class="<?php echo escapeHtml('data') ?>"><?php echo escapeHtml('') ?> <td width="<?php echo escapeHtml('10%') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$var.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$var){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$var.'') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$var){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <td><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/prop.php b/modules/cms/ui/themes/default/html/views/user/prop.php @@ -126,7 +126,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_admin') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_admin){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('is_admin') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$is_admin){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_admin').'') ?> </label> </div> @@ -171,7 +171,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('totp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$totp){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_totp').'') ?> </label> <i data-qrcode="<?php echo escapeHtml(''.@$totpSecretUrl.'') ?>" title="<?php echo escapeHtml(''.@lang('QRCODE_SHOW').'') ?>" class="<?php echo escapeHtml('image-icon image-icon--menu-qrcode or-qrcode or-info') ?>"><?php echo escapeHtml('') ?> @@ -182,7 +182,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('hotp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$hotp){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('hotp') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$hotp){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_hotp').'') ?> </label> <i data-qrcode="<?php echo escapeHtml(''.@$hotpSecretUrl.'') ?>" title="<?php echo escapeHtml(''.@lang('QRCODE_SHOW').'') ?>" class="<?php echo escapeHtml('image-icon image-icon--menu-qrcode or-qrcode or-info') ?>"><?php echo escapeHtml('') ?> diff --git a/modules/cms/ui/themes/default/html/views/user/pw.php b/modules/cms/ui/themes/default/html/views/user/pw.php @@ -9,7 +9,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('proposal') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('proposal') ?>" <?php if(@$type=='proposal'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@$password_proposal.'') ?> <span><?php echo escapeHtml(''.@lang('USER_new_password').'') ?> </span> @@ -26,7 +26,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('random') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('random') ?>" <?php if(@$type=='random'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_random_password').'') ?> </label> </div> @@ -36,7 +36,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" checked="<?php echo escapeHtml(''.@$type.'') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('radio') ?>" name="<?php echo escapeHtml('type') ?>" value="<?php echo escapeHtml('input') ?>" <?php if(@$type=='input'){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('USER_NEW_PASSWORD_INPUT').'') ?> </label> </div> @@ -80,7 +80,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('email') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$email){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('email') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$email){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_mail_new_password').'') ?> </label> </div> @@ -89,7 +89,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('timeout') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$timeout){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('timeout') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$timeout){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('user_password_timeout').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/user/remove.php b/modules/cms/ui/themes/default/html/views/user/remove.php @@ -39,7 +39,7 @@ <div class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml('') ?> </div> <div class="<?php echo escapeHtml('input') ?>"><?php echo escapeHtml('') ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml('confirm') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$confirm){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> required="<?php echo escapeHtml('required') ?>" /><?php echo escapeHtml('') ?> <label class="<?php echo escapeHtml('label') ?>"><?php echo escapeHtml(''.@lang('delete').'') ?> </label> </div> diff --git a/modules/cms/ui/themes/default/html/views/user/rights.php b/modules/cms/ui/themes/default/html/views/user/rights.php @@ -90,7 +90,7 @@ <td><?php echo escapeHtml('') ?> <?php { $$list_value= $bits[$list_value]; ?> <?php } ?> - <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$list_value.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$list_value){ ?>checked="<?php echo escapeHtml('1') ?>"<?php } ?> /><?php echo escapeHtml('') ?> + <input type="<?php echo escapeHtml('checkbox') ?>" name="<?php echo escapeHtml(''.@$list_value.'') ?>" disabled="<?php echo escapeHtml('disabled') ?>" value="<?php echo escapeHtml('1') ?>" <?php if(@$$list_value){ ?>checked="<?php echo escapeHtml('checked') ?>"<?php } ?> /><?php echo escapeHtml('') ?> </td> <?php } ?> </tr> diff --git a/modules/cms/ui/themes/default/script/openrat.js b/modules/cms/ui/themes/default/script/openrat.js @@ -1552,7 +1552,7 @@ header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\ }(navigator.userAgent||navigator.vendor||window.opera),e},V="",K={bold:{name:"bold",action:c,className:"fa fa-bold",title:"Bold","default":!0},italic:{name:"italic",action:u,className:"fa fa-italic",title:"Italic","default":!0},strikethrough:{name:"strikethrough",action:f,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:p,className:"fa fa-header",title:"Heading","default":!0},"heading-smaller":{name:"heading-smaller",action:p,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:h,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:d,className:"fa fa-quote-left",title:"Quote","default":!0},"unordered-list":{name:"unordered-list",action:x,className:"fa fa-list-ul",title:"Generic List","default":!0},"ordered-list":{name:"ordered-list",action:b,className:"fa fa-list-ol",title:"Numbered List","default":!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:k,className:"fa fa-link",title:"Create Link","default":!0},image:{name:"image",action:S,className:"fa fa-picture-o",title:"Insert Image","default":!0},table:{name:"table",action:C,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:L,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:A,className:"fa fa-eye no-disable",title:"Toggle Preview","default":!0},"side-by-side":{name:"side-by-side",action:N,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side","default":!0},fullscreen:{name:"fullscreen",action:s,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen","default":!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide","default":!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:T,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:M,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Z={link:"URL for the link:",image:"URL of the image:"},J={bold:"**",code:"```",italic:"*"};B.prototype.markdown=function(e){if(j){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),j.setOptions(t),j(e)}},B.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==q[o]&&!function(e){i[r(t.shortcuts[e])]=function(){q[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&s(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&s(n)},!1);var a,l;if(t.spellChecker!==!1?(a="spell-checker",l=t.parsingConfig,l.name="gfm",l.gitHubSpice=!1,z({codeMirrorInstance:F})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=F.fromTextArea(e,{mode:a,backdrop:l,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0!=t.styleSelectedText?t.styleSelectedText:!0}),t.forceSync===!0){var c=this.codemirror;c.on("change",function(){c.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var u=this.codemirror;setTimeout(function(){u.refresh()}.bind(u),0)}},B.prototype.autosave=function(){if(_()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=10>i?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.clearAutosavedValue=function(){if(_()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},B.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t<e.length;t++)void 0!=K[e[t]]&&(e[t]=K[e[t]]);var n=document.createElement("div");n.className="editor-toolbar";var r=this,a={};for(r.toolbar=e,t=0;t<e.length;t++)if(("guide"!=e[t].name||r.options.toolbarGuideIcon!==!1)&&!(r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[t].name)||("fullscreen"==e[t].name||"side-by-side"==e[t].name)&&$())){if("|"===e[t]){for(var s=!1,c=t+1;c<e.length;c++)"|"===e[c]||r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[c].name)||(s=!0);if(!s)continue}!function(e){var t;t="|"===e?o():i(e,r.options.toolbarTips,r.options.shortcuts),e.action&&("function"==typeof e.action?t.onclick=function(t){t.preventDefault(),e.action(r)}:"string"==typeof e.action&&(t.href=e.action,t.target="_blank")),a[e.name||e]=t,n.appendChild(t)}(e[t])}r.toolbarElements=a;var u=this.codemirror;u.on("cursorActivity",function(){var e=l(u);for(var t in a)!function(t){var n=a[t];e[t]?n.className+=" active":"fullscreen"!=t&&"side-by-side"!=t&&(n.className=n.className.replace(/\s*active\s*/g,""))}(t)});var f=u.getWrapperElement();return f.parentNode.insertBefore(n,f),n}},B.prototype.createStatusbar=function(e){e=e||this.options.status;var t=this.options,n=this.codemirror;if(e&&0!==e.length){var r,i,o,a=[];for(r=0;r<e.length;r++)if(i=void 0,o=void 0,"object"==typeof e[r])a.push({className:e[r].className,defaultValue:e[r].defaultValue,onUpdate:e[r].onUpdate});else{var l=e[r];"words"===l?(o=function(e){e.innerHTML=W(n.getValue())},i=function(e){e.innerHTML=W(n.getValue())}):"lines"===l?(o=function(e){e.innerHTML=n.lineCount()},i=function(e){e.innerHTML=n.lineCount()}):"cursor"===l?(o=function(e){e.innerHTML="0:0"},i=function(e){var t=n.getCursor();e.innerHTML=t.line+":"+t.ch}):"autosave"===l&&(o=function(e){void 0!=t.autosave&&t.autosave.enabled===!0&&e.setAttribute("id","autosaved")}),a.push({className:l,defaultValue:o,onUpdate:i})}var s=document.createElement("div");for(s.className="editor-statusbar",r=0;r<a.length;r++){var c=a[r],u=document.createElement("span");u.className=c.className,"function"==typeof c.defaultValue&&c.defaultValue(u),"function"==typeof c.onUpdate&&this.codemirror.on("update",function(e,t){return function(){t.onUpdate(e)}}(u,c)),s.appendChild(u)}var f=this.codemirror.getWrapperElement();return f.parentNode.insertBefore(s,f.nextSibling),s}},B.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},B.toggleBold=c,B.toggleItalic=u,B.toggleStrikethrough=f,B.toggleBlockquote=d,B.toggleHeadingSmaller=p,B.toggleHeadingBigger=m,B.toggleHeading1=g,B.toggleHeading2=v,B.toggleHeading3=y,B.toggleCodeBlock=h,B.toggleUnorderedList=x,B.toggleOrderedList=b,B.cleanBlock=w,B.drawLink=k,B.drawImage=S,B.drawTable=C,B.drawHorizontalRule=L,B.undo=T,B.redo=M,B.togglePreview=A,B.toggleSideBySide=N,B.toggleFullScreen=s,B.prototype.toggleBold=function(){c(this)},B.prototype.toggleItalic=function(){u(this)},B.prototype.toggleStrikethrough=function(){f(this)},B.prototype.toggleBlockquote=function(){d(this)},B.prototype.toggleHeadingSmaller=function(){p(this)},B.prototype.toggleHeadingBigger=function(){m(this)},B.prototype.toggleHeading1=function(){g(this)},B.prototype.toggleHeading2=function(){v(this)},B.prototype.toggleHeading3=function(){y(this)},B.prototype.toggleCodeBlock=function(){h(this)},B.prototype.toggleUnorderedList=function(){x(this)},B.prototype.toggleOrderedList=function(){b(this)},B.prototype.cleanBlock=function(){w(this)},B.prototype.drawLink=function(){k(this)},B.prototype.drawImage=function(){S(this)},B.prototype.drawTable=function(){C(this)},B.prototype.drawHorizontalRule=function(){L(this)},B.prototype.undo=function(){T(this)},B.prototype.redo=function(){M(this)},B.prototype.togglePreview=function(){A(this)},B.prototype.toggleSideBySide=function(){N(this)},B.prototype.toggleFullScreen=function(){s(this)},B.prototype.isPreviewActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.lastChild;return/editor-preview-active/.test(n.className)},B.prototype.isSideBySideActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;return/editor-preview-active-side/.test(n.className)},B.prototype.isFullscreenActive=function(){var e=this.codemirror;return e.getOption("fullScreen")},B.prototype.getState=function(){var e=this.codemirror;return l(e)},B.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement();t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide&&t.parentNode.removeChild(this.gui.sideBySide)),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},t.exports=B},{"./codemirror/tablist":19,codemirror:10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14,marked:17}]},{},[20])(20)}); /* Include script: trumbowyg */ /** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ -jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector("base")?t.location.href.split("#")[0]:"",0===a("#"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName("script"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match("trumbowyg(.min)?.js");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+"ui/icons.svg")}null==d&&console.warn("You must define svgPath: https://goo.gl/CfTY9U")}var h=i.doc.createElement("div");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:m,key:"Z"},redo:{isSupported:m,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:p+" 1"},h2:{fn:"formatBlock",title:p+" 2"},h3:{fn:"formatBlock",title:p+" 3"},h4:{fn:"formatBlock",title:p+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{"class":"trumbowyg-not-disable"},close:{fn:"destroy","class":"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf("MSIE")!==-1||e.appVersion.indexOf("Trident/")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":/:\/\/$/.test(e)?e:e+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("<div/>",{"class":n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(o),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.$c.is("[spellcheck]")&&e.$ed.attr("spellcheck",e.$c.attr("spellcheck")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+"autogrow-on-enter");var r,i=!1,s=!1,l="keyup";e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on("compositionstart compositionupdate",function(){s=!0}).on(l+" compositionend",function(t){if("compositionend"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)"undefined"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||"compositionend"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger("tbwchange")}else e.$c.trigger("tbwchange");setTimeout(function(){i=!1},50)}}).on("mouseup keydown keyup",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on("focus blur",function(t){if(e.$c.trigger("tbw"+t.type),"blur"===t.type&&a("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;"focus"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css("min-height")}),e.$c.trigger("tbwresize"))}}).on("cut",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger("tbwchange",n)}catch(i){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup",function(){e.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){e.$c.trigger("tbwchange")},0)}),e.$box.on("keydown",function(t){if(27===t.which&&1===a("."+n+"modal-box",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a("<div/>",{"class":t+"button-pane"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a("<div/>",{"class":t+"button-group "+(r.indexOf("fullscreen")>=0?t+"right":"")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a("<button/>",{type:"button","class":n+e+"-button "+(o["class"]||"")+(i?"":" "+n+"textual-button"),html:t.hasSvg&&i?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?" (Ctrl + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!a("."+e+"-"+n+"dropdown",t.$box).is(":hidden")||a("body",t.doc).trigger("mousedown"),!((t.$btnPane.hasClass(n+"disable")||t.$box.hasClass(n+"disabled"))&&!a(this).hasClass(n+"active")&&!a(this).hasClass(n+"not-disable"))&&(t.execCmd(!!r&&"dropdown"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+"open-dropdown");var d=n+"dropdown",c={"class":d+"-"+e+" "+d+" "+n+"fixed-top"};c["data-"+d]=e;var u=a("<div/>",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a("<button/>",{type:"button","class":n+e+"-dropdown-button"+(o.ico?" "+n+o.ico+"-button":""),html:t.hasSvg&&r?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?" (Ctrl + "+o.key+")":null,style:o.style||null,mousedown:function(){return a("body",t.doc).trigger("mousedown"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a("<div/>",{"class":e.o.prefix+"overlay"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on("scroll."+e.eventNamespace+" resize."+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":o.width()-1+"px"}),a("."+e.o.prefix+"fixed-top",o).css({position:n?"fixed":"absolute",top:n?l:l+(r-i)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),a([e.$ta,e.$ed]).css({marginTop:0}),a("."+e.o.prefix+"fixed-top",o).css({position:"absolute",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(n+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(n+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),a("body").removeClass(n+"body-fullscreen"),e.$c.trigger("tbwclose"),a(t).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),a("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a("[data-"+r+"dropdown="+e+"]",n.$box),s=a("."+r+e+"-button",n.$btnPane),l=i.is(":hidden");if(a("body",o).trigger("mousedown"),l){var d=s.offset().left;s.addClass(r+"active"),i.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+"px":d-n.$btnPane.offset().left+"px"}).show(),a(t).trigger("scroll"),a("body",o).on("mousedown."+n.eventNamespace,function(e){i.is(e.target)||(a("."+r+"dropdown",n.$box).hide(),a("."+r+"active",n.$btnPane).removeClass(r+"active"),a("body",o).off("mousedown."+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,iframe,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(":visible"))t.syncTextarea();else{var n=a("<div>").html(t.$ta.val()),o=a("<div>").append(n);a(t.o.tagsToRemove.join(","),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize"))),t.o.autogrowOnEnter){t.$ed.height("auto");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");r!==t.$ta.css("height")&&(t.$ed.css({height:r}),t.$c.trigger("tbwresize"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag("b"),o.semanticTag("i"),o.semanticTag("s"),o.semanticTag("strike"),t){var r=o.o.inlineElementsSelector,i=":not("+r+")";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag("div",!0),o.$ed.find("p").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not("br,span").length)}).contents().unwrap(),a("[data-tbw]",o.$ed).contents().unwrap(),o.$ed.find("p:empty").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap("<"+n+"/>"),t&&a.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&"A"===i.nodeName){var l=a(i);s=l.text(),e=l.attr("href"),o.o.minimalLinks||(t=l.attr("title"),n=l.attr("target"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:"URL",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href="',e.url,'">',e.text||e.url,"</a>"].join(""));return o.o.minimalLinks||(e.title.length>0&&n.attr("title",e.title),e.target.length>0&&n.attr("target",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;const n=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(n.test(e))return e;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a.test(e)?"mailto:"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd("insertImage",t.url);var n=a('img[src="'+t.url+'"]:not([alt])',e.$box);return n.attr("alt",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+"fullscreen";n.$box.toggleClass(r),e=n.$box.hasClass(r),a("body").toggleClass(o+"body-fullscreen",e),a(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(e,t,n,a){var o=this;a=!!a||"","dropdown"!==e&&o.$ed.focus();try{o.doc.execCommand("styleWithCSS",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){"insertHorizontalRule"===e?t=void 0:"formatBlock"===e&&o.isIE&&(t="<"+t+">"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a("."+s+"modal-box",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+"disable");var l=a("<div/>",{"class":s+"modal "+s+"fixed-top"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one("click",function(){return l.trigger(r),!1});var d=a("<form/>",{action:"",html:n}).on("submit",function(){return l.trigger(o),!1}).on("reset",function(){return l.trigger(r),!1}).on("submit reset",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a("<div/>",{"class":s+"modal-box",html:d}).css({top:"-"+i.$btnPane.outerHeight()+"px",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a("<span/>",{text:e,"class":s+"modal-title"}).prependTo(c),l.height(c.outerHeight()+10),a("input:first",c).focus(),i.buildModalBtn("submit",c),i.buildModalBtn("reset",c),a(t).trigger("scroll"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a("<button/>",{"class":o+"modal-button "+o+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(a("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=a("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d="";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");d+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+r+'><span class="'+s+'input-infos"><span>'+(l[n]?l[n]:n)+"</span></span></label>"}),i.openModal(e,d).on(o,function(){var e=a("form",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name="'+o+'"]',e),d=l.attr("type");switch(d.toLowerCase()){case"checkbox":s[o]=l.is(":checked");break;case"radio":s[o]=l.filter(":checked").val();break;default:s[o]=a.trim(l.val())}n.required&&""===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger("tbwchange"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error")}),o.addClass(n+"input-error").find("input+span").append(a("<span/>",{"class":n+"msg-error",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr("src"),o="(Base64)";0===n.indexOf("data:image")&&(n=o);var r={url:{label:"URL",value:n,required:!0},alt:{label:e.lang.description,value:t.attr("alt")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr("width")?t.attr("width"):""}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.src!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+"").length,e.metaRange={start:n,end:n+(a+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+"active-button "+t+"active";a("."+t+"active-button",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a("."+t+i+"-button",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a("."+t+"dropdown ."+t+i+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");a("."+t+l+"-button",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return"DIV"===o?t:("P"===o&&""!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery); +jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"BaseTarget",width:"Width"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector("base")?t.location.href.split("#")[0]:"",0===a("#"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName("script"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match("trumbowyg(.min)?.js");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+"ui/icons.svg")}null==d&&console.warn("You must define svgPath: https://goo.gl/CfTY9U")}var h=i.doc.createElement("div");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:m,key:"Z"},redo:{isSupported:m,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:p+" 1"},h2:{fn:"formatBlock",title:p+" 2"},h3:{fn:"formatBlock",title:p+" 3"},h4:{fn:"formatBlock",title:p+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{"class":"trumbowyg-not-disable"},close:{fn:"destroy","class":"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf("MSIE")!==-1||e.appVersion.indexOf("Trident/")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":/:\/\/$/.test(e)?e:e+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("<div/>",{"class":n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(o),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.$c.is("[spellcheck]")&&e.$ed.attr("spellcheck",e.$c.attr("spellcheck")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+"autogrow-on-enter");var r,i=!1,s=!1,l="keyup";e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on("compositionstart compositionupdate",function(){s=!0}).on(l+" compositionend",function(t){if("compositionend"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)"undefined"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||"compositionend"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger("tbwchange")}else e.$c.trigger("tbwchange");setTimeout(function(){i=!1},50)}}).on("mouseup keydown keyup",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on("focus blur",function(t){if(e.$c.trigger("tbw"+t.type),"blur"===t.type&&a("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;"focus"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css("min-height")}),e.$c.trigger("tbwresize"))}}).on("cut",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger("tbwchange",n)}catch(i){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup",function(){e.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){e.$c.trigger("tbwchange")},0)}),e.$box.on("keydown",function(t){if(27===t.which&&1===a("."+n+"modal-box",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a("<div/>",{"class":t+"button-pane"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a("<div/>",{"class":t+"button-group "+(r.indexOf("fullscreen")>=0?t+"right":"")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a("<button/>",{type:"button","class":n+e+"-button "+(o["class"]||"")+(i?"":" "+n+"textual-button"),html:t.hasSvg&&i?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?" (Ctrl + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!a("."+e+"-"+n+"dropdown",t.$box).is(":hidden")||a("body",t.doc).trigger("mousedown"),!((t.$btnPane.hasClass(n+"disable")||t.$box.hasClass(n+"disabled"))&&!a(this).hasClass(n+"active")&&!a(this).hasClass(n+"not-disable"))&&(t.execCmd(!!r&&"dropdown"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+"open-dropdown");var d=n+"dropdown",c={"class":d+"-"+e+" "+d+" "+n+"fixed-top"};c["data-"+d]=e;var u=a("<div/>",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a("<button/>",{type:"button","class":n+e+"-dropdown-button"+(o.ico?" "+n+o.ico+"-button":""),html:t.hasSvg&&r?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?" (Ctrl + "+o.key+")":null,style:o.style||null,mousedown:function(){return a("body",t.doc).trigger("mousedown"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a("<div/>",{"class":e.o.prefix+"overlay"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on("scroll."+e.eventNamespace+" resize."+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":o.width()-1+"px"}),a("."+e.o.prefix+"fixed-top",o).css({position:n?"fixed":"absolute",top:n?l:l+(r-i)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),a([e.$ta,e.$ed]).css({marginTop:0}),a("."+e.o.prefix+"fixed-top",o).css({position:"absolute",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(n+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(n+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),a("body").removeClass(n+"body-fullscreen"),e.$c.trigger("tbwclose"),a(t).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),a("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a("[data-"+r+"dropdown="+e+"]",n.$box),s=a("."+r+e+"-button",n.$btnPane),l=i.is(":hidden");if(a("body",o).trigger("mousedown"),l){var d=s.offset().left;s.addClass(r+"active"),i.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+"px":d-n.$btnPane.offset().left+"px"}).show(),a(t).trigger("scroll"),a("body",o).on("mousedown."+n.eventNamespace,function(e){i.is(e.target)||(a("."+r+"dropdown",n.$box).hide(),a("."+r+"active",n.$btnPane).removeClass(r+"active"),a("body",o).off("mousedown."+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,iframe,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(":visible"))t.syncTextarea();else{var n=a("<div>").html(t.$ta.val()),o=a("<div>").append(n);a(t.o.tagsToRemove.join(","),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize"))),t.o.autogrowOnEnter){t.$ed.height("auto");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");r!==t.$ta.css("height")&&(t.$ed.css({height:r}),t.$c.trigger("tbwresize"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag("b"),o.semanticTag("i"),o.semanticTag("s"),o.semanticTag("strike"),t){var r=o.o.inlineElementsSelector,i=":not("+r+")";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag("div",!0),o.$ed.find("p").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not("br,span").length)}).contents().unwrap(),a("[data-tbw]",o.$ed).contents().unwrap(),o.$ed.find("p:empty").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap("<"+n+"/>"),t&&a.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&"A"===i.nodeName){var l=a(i);s=l.text(),e=l.attr("href"),o.o.minimalLinks||(t=l.attr("title"),n=l.attr("target"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:"URL",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href="',e.url,'">',e.text||e.url,"</a>"].join(""));return o.o.minimalLinks||(e.title.length>0&&n.attr("title",e.title),e.target.length>0&&n.attr("target",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;const n=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(n.test(e))return e;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a.test(e)?"mailto:"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd("insertImage",t.url);var n=a('img[src="'+t.url+'"]:not([alt])',e.$box);return n.attr("alt",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+"fullscreen";n.$box.toggleClass(r),e=n.$box.hasClass(r),a("body").toggleClass(o+"body-fullscreen",e),a(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(e,t,n,a){var o=this;a=!!a||"","dropdown"!==e&&o.$ed.focus();try{o.doc.execCommand("styleWithCSS",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){"insertHorizontalRule"===e?t=void 0:"formatBlock"===e&&o.isIE&&(t="<"+t+">"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a("."+s+"modal-box",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+"disable");var l=a("<div/>",{"class":s+"modal "+s+"fixed-top"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one("click",function(){return l.trigger(r),!1});var d=a("<form/>",{action:"",html:n}).on("submit",function(){return l.trigger(o),!1}).on("reset",function(){return l.trigger(r),!1}).on("submit reset",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a("<div/>",{"class":s+"modal-box",html:d}).css({top:"-"+i.$btnPane.outerHeight()+"px",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a("<span/>",{text:e,"class":s+"modal-title"}).prependTo(c),l.height(c.outerHeight()+10),a("input:first",c).focus(),i.buildModalBtn("submit",c),i.buildModalBtn("reset",c),a(t).trigger("scroll"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a("<button/>",{"class":o+"modal-button "+o+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(a("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=a("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d="";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");d+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+r+'><span class="'+s+'input-infos"><span>'+(l[n]?l[n]:n)+"</span></span></label>"}),i.openModal(e,d).on(o,function(){var e=a("form",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name="'+o+'"]',e),d=l.attr("type");switch(d.toLowerCase()){case"checkbox":s[o]=l.is(":checked");break;case"radio":s[o]=l.filter(":checked").val();break;default:s[o]=a.trim(l.val())}n.required&&""===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger("tbwchange"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error")}),o.addClass(n+"input-error").find("input+span").append(a("<span/>",{"class":n+"msg-error",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr("src"),o="(Base64)";0===n.indexOf("data:image")&&(n=o);var r={url:{label:"URL",value:n,required:!0},alt:{label:e.lang.description,value:t.attr("alt")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr("width")?t.attr("width"):""}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.src!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+"").length,e.metaRange={start:n,end:n+(a+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+"active-button "+t+"active";a("."+t+"active-button",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a("."+t+i+"-button",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a("."+t+"dropdown ."+t+i+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");a("."+t+l+"-button",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return"DIV"===o?t:("P"===o&&""!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery); /* Include script: init */ // Create own namespace. diff --git a/modules/cms/ui/themes/default/script/openrat.min.js b/modules/cms/ui/themes/default/script/openrat.min.js @@ -1168,7 +1168,7 @@ h(r);var l=t.sol(),s=t.next();if(r.linkTitle){r.linkTitle=!1;var u=s;"("===s&&(u header:o[1].replace(/^ *| *\| *$/g,"").split(/ *\| */),align:o[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:o[3].replace(/(?: *\| *)?\n$/,"").split("\n")},u=0;u<s.align.length;u++)/^ *-+: *$/.test(s.align[u])?s.align[u]="right":/^ *:-+: *$/.test(s.align[u])?s.align[u]="center":/^ *:-+ *$/.test(s.align[u])?s.align[u]="left":s.align[u]=null;for(u=0;u<s.cells.length;u++)s.cells[u]=s.cells[u].replace(/^ *\| *| *\| *$/g,"").split(/ *\| */);this.tokens.push(s)}else if(t&&(o=this.rules.paragraph.exec(e)))e=e.substring(o[0].length),this.tokens.push({type:"paragraph",text:"\n"===o[1].charAt(o[1].length-1)?o[1].slice(0,-1):o[1]});else if(o=this.rules.text.exec(e))e=e.substring(o[0].length),this.tokens.push({type:"text",text:o[0]});else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0));return this.tokens};var p={escape:/^\\([\\`*{}\[\]()#+\-.!_>])/,autolink:/^<([^ >]+(@|:\/)[^ >]+)>/,url:u,tag:/^<!--[\s\S]*?-->|^<\/?\w+(?:"[^"]*"|'[^']*'|[^'">])*?>/,link:/^!?\[(inside)\]\(href\)/,reflink:/^!?\[(inside)\]\s*\[([^\]]*)\]/,nolink:/^!?\[((?:\[[^\]]*\]|[^\[\]])*)\]/,strong:/^__([\s\S]+?)__(?!_)|^\*\*([\s\S]+?)\*\*(?!\*)/,em:/^\b_((?:[^_]|__)+?)_\b|^\*((?:\*\*|[\s\S])+?)\*(?!\*)/,code:/^(`+)\s*([\s\S]*?[^`])\s*\1(?!`)/,br:/^ {2,}\n(?!\s*$)/,del:u,text:/^[\s\S]+?(?=[\\<!\[_*`]| {2,}\n|$)/};p._inside=/(?:\[[^\]]*\]|[^\[\]]|\](?=[^\[]*\]))*/,p._href=/\s*<?([\s\S]*?)>?(?:\s+['"]([\s\S]*?)['"])?\s*/,p.link=c(p.link)("inside",p._inside)("href",p._href)(),p.reflink=c(p.reflink)("inside",p._inside)(),p.normal=f({},p),p.pedantic=f({},p.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/}),p.gfm=f({},p.normal,{escape:c(p.escape)("])","~|])")(),url:/^(https?:\/\/[^\s<]+[^<.,:;"')\]\s])/,del:/^~~(?=\S)([\s\S]*?\S)~~/,text:c(p.text)("]|","~]|")("|","|https?://|")()}),p.breaks=f({},p.gfm,{br:c(p.br)("{2,}","*")(),text:c(p.gfm.text)("{2,}","*")()}),i.rules=p,i.output=function(e,t,n){var r=new i(t,n);return r.output(e)},i.prototype.output=function(e){for(var t,n,r,i,o="";e;)if(i=this.rules.escape.exec(e))e=e.substring(i[0].length),o+=i[1];else if(i=this.rules.autolink.exec(e))e=e.substring(i[0].length),"@"===i[2]?(n=":"===i[1].charAt(6)?this.mangle(i[1].substring(7)):this.mangle(i[1]),r=this.mangle("mailto:")+n):(n=l(i[1]),r=n),o+=this.renderer.link(r,null,n);else if(this.inLink||!(i=this.rules.url.exec(e))){if(i=this.rules.tag.exec(e))!this.inLink&&/^<a /i.test(i[0])?this.inLink=!0:this.inLink&&/^<\/a>/i.test(i[0])&&(this.inLink=!1),e=e.substring(i[0].length),o+=this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):l(i[0]):i[0];else if(i=this.rules.link.exec(e))e=e.substring(i[0].length),this.inLink=!0,o+=this.outputLink(i,{href:i[2],title:i[3]}),this.inLink=!1;else if((i=this.rules.reflink.exec(e))||(i=this.rules.nolink.exec(e))){if(e=e.substring(i[0].length),t=(i[2]||i[1]).replace(/\s+/g," "),t=this.links[t.toLowerCase()],!t||!t.href){o+=i[0].charAt(0),e=i[0].substring(1)+e;continue}this.inLink=!0,o+=this.outputLink(i,t),this.inLink=!1}else if(i=this.rules.strong.exec(e))e=e.substring(i[0].length),o+=this.renderer.strong(this.output(i[2]||i[1]));else if(i=this.rules.em.exec(e))e=e.substring(i[0].length),o+=this.renderer.em(this.output(i[2]||i[1]));else if(i=this.rules.code.exec(e))e=e.substring(i[0].length),o+=this.renderer.codespan(l(i[2],!0));else if(i=this.rules.br.exec(e))e=e.substring(i[0].length),o+=this.renderer.br();else if(i=this.rules.del.exec(e))e=e.substring(i[0].length),o+=this.renderer.del(this.output(i[1]));else if(i=this.rules.text.exec(e))e=e.substring(i[0].length),o+=this.renderer.text(l(this.smartypants(i[0])));else if(e)throw new Error("Infinite loop on byte: "+e.charCodeAt(0))}else e=e.substring(i[0].length),n=l(i[1]),r=n,o+=this.renderer.link(r,null,n);return o},i.prototype.outputLink=function(e,t){var n=l(t.href),r=t.title?l(t.title):null;return"!"!==e[0].charAt(0)?this.renderer.link(n,r,this.output(e[1])):this.renderer.image(n,r,l(e[1]))},i.prototype.smartypants=function(e){return this.options.smartypants?e.replace(/---/g,"—").replace(/--/g,"–").replace(/(^|[-\u2014\/(\[{"\s])'/g,"$1‘").replace(/'/g,"’").replace(/(^|[-\u2014\/(\[{\u2018\s])"/g,"$1“").replace(/"/g,"”").replace(/\.{3}/g,"…"):e},i.prototype.mangle=function(e){if(!this.options.mangle)return e;for(var t,n="",r=e.length,i=0;r>i;i++)t=e.charCodeAt(i),Math.random()>.5&&(t="x"+t.toString(16)),n+="&#"+t+";";return n},o.prototype.code=function(e,t,n){if(this.options.highlight){var r=this.options.highlight(e,t);null!=r&&r!==e&&(n=!0,e=r)}return t?'<pre><code class="'+this.options.langPrefix+l(t,!0)+'">'+(n?e:l(e,!0))+"\n</code></pre>\n":"<pre><code>"+(n?e:l(e,!0))+"\n</code></pre>"},o.prototype.blockquote=function(e){return"<blockquote>\n"+e+"</blockquote>\n"},o.prototype.html=function(e){return e},o.prototype.heading=function(e,t,n){return"<h"+t+' id="'+this.options.headerPrefix+n.toLowerCase().replace(/[^\w]+/g,"-")+'">'+e+"</h"+t+">\n"},o.prototype.hr=function(){return this.options.xhtml?"<hr/>\n":"<hr>\n"},o.prototype.list=function(e,t){var n=t?"ol":"ul";return"<"+n+">\n"+e+"</"+n+">\n"},o.prototype.listitem=function(e){return"<li>"+e+"</li>\n"},o.prototype.paragraph=function(e){return"<p>"+e+"</p>\n"},o.prototype.table=function(e,t){return"<table>\n<thead>\n"+e+"</thead>\n<tbody>\n"+t+"</tbody>\n</table>\n"},o.prototype.tablerow=function(e){return"<tr>\n"+e+"</tr>\n"},o.prototype.tablecell=function(e,t){var n=t.header?"th":"td",r=t.align?"<"+n+' style="text-align:'+t.align+'">':"<"+n+">";return r+e+"</"+n+">\n"},o.prototype.strong=function(e){return"<strong>"+e+"</strong>"},o.prototype.em=function(e){return"<em>"+e+"</em>"},o.prototype.codespan=function(e){return"<code>"+e+"</code>"},o.prototype.br=function(){return this.options.xhtml?"<br/>":"<br>"},o.prototype.del=function(e){return"<del>"+e+"</del>"},o.prototype.link=function(e,t,n){if(this.options.sanitize){try{var r=decodeURIComponent(s(e)).replace(/[^\w:]/g,"").toLowerCase()}catch(i){return""}if(0===r.indexOf("javascript:")||0===r.indexOf("vbscript:"))return""}var o='<a href="'+e+'"';return t&&(o+=' title="'+t+'"'),o+=">"+n+"</a>"},o.prototype.image=function(e,t,n){var r='<img src="'+e+'" alt="'+n+'"';return t&&(r+=' title="'+t+'"'),r+=this.options.xhtml?"/>":">"},o.prototype.text=function(e){return e},a.parse=function(e,t,n){var r=new a(t,n);return r.parse(e)},a.prototype.parse=function(e){this.inline=new i(e.links,this.options,this.renderer),this.tokens=e.reverse();for(var t="";this.next();)t+=this.tok();return t},a.prototype.next=function(){return this.token=this.tokens.pop()},a.prototype.peek=function(){return this.tokens[this.tokens.length-1]||0},a.prototype.parseText=function(){for(var e=this.token.text;"text"===this.peek().type;)e+="\n"+this.next().text;return this.inline.output(e)},a.prototype.tok=function(){switch(this.token.type){case"space":return"";case"hr":return this.renderer.hr();case"heading":return this.renderer.heading(this.inline.output(this.token.text),this.token.depth,this.token.text);case"code":return this.renderer.code(this.token.text,this.token.lang,this.token.escaped);case"table":var e,t,n,r,i,o="",a="";for(n="",e=0;e<this.token.header.length;e++)r={header:!0,align:this.token.align[e]},n+=this.renderer.tablecell(this.inline.output(this.token.header[e]),{header:!0,align:this.token.align[e]});for(o+=this.renderer.tablerow(n),e=0;e<this.token.cells.length;e++){for(t=this.token.cells[e],n="",i=0;i<t.length;i++)n+=this.renderer.tablecell(this.inline.output(t[i]),{header:!1,align:this.token.align[i]});a+=this.renderer.tablerow(n)}return this.renderer.table(o,a);case"blockquote_start":for(var a="";"blockquote_end"!==this.next().type;)a+=this.tok();return this.renderer.blockquote(a);case"list_start":for(var a="",l=this.token.ordered;"list_end"!==this.next().type;)a+=this.tok();return this.renderer.list(a,l);case"list_item_start":for(var a="";"list_item_end"!==this.next().type;)a+="text"===this.token.type?this.parseText():this.tok();return this.renderer.listitem(a);case"loose_item_start":for(var a="";"list_item_end"!==this.next().type;)a+=this.tok();return this.renderer.listitem(a);case"html":var s=this.token.pre||this.options.pedantic?this.token.text:this.inline.output(this.token.text);return this.renderer.html(s);case"paragraph":return this.renderer.paragraph(this.inline.output(this.token.text));case"text":return this.renderer.paragraph(this.parseText())}},u.exec=u,h.options=h.setOptions=function(e){return f(h.defaults,e),h},h.defaults={gfm:!0,tables:!0,breaks:!1,pedantic:!1,sanitize:!1,sanitizer:null,mangle:!0,smartLists:!1,silent:!1,highlight:null,langPrefix:"lang-",smartypants:!1,headerPrefix:"",renderer:new o,xhtml:!1},h.Parser=a,h.parser=a.parse,h.Renderer=o,h.Lexer=t,h.lexer=t.lex,h.InlineLexer=i,h.inlineLexer=i.output,h.parse=h,"undefined"!=typeof n&&"object"==typeof r?n.exports=h:"function"==typeof e&&e.amd?e(function(){return h}):this.marked=h}).call(function(){return this||("undefined"!=typeof window?window:t)}())}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],18:[function(e,t,n){(function(n,r){"use strict";var i=function(e,t,n,i){if(i=i||{},this.dictionary=null,this.rules={},this.dictionaryTable={},this.compoundRules=[],this.compoundRuleCodes={},this.replacementTable=[],this.flags=i.flags||{},e){if(this.dictionary=e,"undefined"!=typeof window&&"chrome"in window&&"extension"in window.chrome&&"getURL"in window.chrome.extension)t||(t=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".aff"))),n||(n=this._readFile(chrome.extension.getURL("lib/typo/dictionaries/"+e+"/"+e+".dic")));else{if(i.dictionaryPath)var o=i.dictionaryPath;else if("undefined"!=typeof r)var o=r+"/dictionaries";else var o="./dictionaries";t||(t=this._readFile(o+"/"+e+"/"+e+".aff")),n||(n=this._readFile(o+"/"+e+"/"+e+".dic"))}this.rules=this._parseAFF(t),this.compoundRuleCodes={};for(var a=0,l=this.compoundRules.length;l>a;a++)for(var s=this.compoundRules[a],c=0,u=s.length;u>c;c++)this.compoundRuleCodes[s[c]]=[];"ONLYINCOMPOUND"in this.flags&&(this.compoundRuleCodes[this.flags.ONLYINCOMPOUND]=[]),this.dictionaryTable=this._parseDIC(n);for(var a in this.compoundRuleCodes)0==this.compoundRuleCodes[a].length&&delete this.compoundRuleCodes[a];for(var a=0,l=this.compoundRules.length;l>a;a++){for(var f=this.compoundRules[a],h="",c=0,u=f.length;u>c;c++){var d=f[c];h+=d in this.compoundRuleCodes?"("+this.compoundRuleCodes[d].join("|")+")":d}this.compoundRules[a]=new RegExp(h,"i")}}return this};i.prototype={load:function(e){for(var t in e)this[t]=e[t];return this},_readFile:function(t,r){if(r||(r="utf8"),"undefined"!=typeof XMLHttpRequest){var i=new XMLHttpRequest;return i.open("GET",t,!1),i.overrideMimeType&&i.overrideMimeType("text/plain; charset="+r),i.send(null),i.responseText}if("undefined"!=typeof e){var o=e("fs");try{if(o.existsSync(t)){var a=o.statSync(t),l=o.openSync(t,"r"),s=new n(a.size);return o.readSync(l,s,0,s.length,null),s.toString(r,0,s.length)}console.log("Path "+t+" does not exist.")}catch(c){return console.log(c),""}}},_parseAFF:function(e){var t={};e=this._removeAffixComments(e);for(var n=e.split("\n"),r=0,i=n.length;i>r;r++){var o=n[r],a=o.split(/\s+/),l=a[0];if("PFX"==l||"SFX"==l){for(var s=a[1],c=a[2],u=parseInt(a[3],10),f=[],h=r+1,d=r+1+u;d>h;h++){var o=n[h],p=o.split(/\s+/),m=p[2],g=p[3].split("/"),v=g[0];"0"===v&&(v="");var y=this.parseRuleCodes(g[1]),x=p[4],b={};b.add=v,y.length>0&&(b.continuationClasses=y),"."!==x&&("SFX"===l?b.match=new RegExp(x+"$"):b.match=new RegExp("^"+x)),"0"!=m&&("SFX"===l?b.remove=new RegExp(m+"$"):b.remove=m),f.push(b)}t[s]={type:l,combineable:"Y"==c,entries:f},r+=u}else if("COMPOUNDRULE"===l){for(var u=parseInt(a[1],10),h=r+1,d=r+1+u;d>h;h++){var o=n[h],p=o.split(/\s+/);this.compoundRules.push(p[1])}r+=u}else if("REP"===l){var p=o.split(/\s+/);3===p.length&&this.replacementTable.push([p[1],p[2]])}else this.flags[l]=a[1]}return t},_removeAffixComments:function(e){return e=e.replace(/#.*$/gm,""),e=e.replace(/^\s\s*/m,"").replace(/\s\s*$/m,""),e=e.replace(/\n{2,}/g,"\n"),e=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"")},_parseDIC:function(e){function t(e,t){e in r&&"object"==typeof r[e]||(r[e]=[]),r[e].push(t)}e=this._removeDicComments(e);for(var n=e.split("\n"),r={},i=1,o=n.length;o>i;i++){var a=n[i],l=a.split("/",2),s=l[0];if(l.length>1){var c=this.parseRuleCodes(l[1]);"NEEDAFFIX"in this.flags&&-1!=c.indexOf(this.flags.NEEDAFFIX)||t(s,c);for(var u=0,f=c.length;f>u;u++){var h=c[u],d=this.rules[h];if(d)for(var p=this._applyRule(s,d),m=0,g=p.length;g>m;m++){var v=p[m];if(t(v,[]),d.combineable)for(var y=u+1;f>y;y++){var x=c[y],b=this.rules[x];if(b&&b.combineable&&d.type!=b.type)for(var w=this._applyRule(v,b),k=0,S=w.length;S>k;k++){var C=w[k];t(C,[])}}}h in this.compoundRuleCodes&&this.compoundRuleCodes[h].push(s)}}else t(s.trim(),[])}return r},_removeDicComments:function(e){return e=e.replace(/^\t.*$/gm,"")},parseRuleCodes:function(e){if(!e)return[];if(!("FLAG"in this.flags))return e.split("");if("long"===this.flags.FLAG){for(var t=[],n=0,r=e.length;r>n;n+=2)t.push(e.substr(n,2));return t}return"num"===this.flags.FLAG?textCode.split(","):void 0},_applyRule:function(e,t){for(var n=t.entries,r=[],i=0,o=n.length;o>i;i++){var a=n[i];if(!a.match||e.match(a.match)){var l=e;if(a.remove&&(l=l.replace(a.remove,"")),"SFX"===t.type?l+=a.add:l=a.add+l,r.push(l),"continuationClasses"in a)for(var s=0,c=a.continuationClasses.length;c>s;s++){var u=this.rules[a.continuationClasses[s]];u&&(r=r.concat(this._applyRule(l,u)))}}}return r},check:function(e){var t=e.replace(/^\s\s*/,"").replace(/\s\s*$/,"");if(this.checkExact(t))return!0;if(t.toUpperCase()===t){var n=t[0]+t.substring(1).toLowerCase();if(this.hasFlag(n,"KEEPCASE"))return!1;if(this.checkExact(n))return!0}var r=t.toLowerCase();if(r!==t){if(this.hasFlag(r,"KEEPCASE"))return!1;if(this.checkExact(r))return!0}return!1},checkExact:function(e){var t=this.dictionaryTable[e];if("undefined"==typeof t){if("COMPOUNDMIN"in this.flags&&e.length>=this.flags.COMPOUNDMIN)for(var n=0,r=this.compoundRules.length;r>n;n++)if(e.match(this.compoundRules[n]))return!0;return!1}if("object"==typeof t){for(var n=0,r=t.length;r>n;n++)if(!this.hasFlag(e,"ONLYINCOMPOUND",t[n]))return!0;return!1}},hasFlag:function(e,t,n){if(t in this.flags){if("undefined"==typeof n)var n=Array.prototype.concat.apply([],this.dictionaryTable[e]);if(n&&-1!==n.indexOf(this.flags[t]))return!0}return!1},alphabet:"",suggest:function(e,t){function n(e){for(var t=[],n=0,r=e.length;r>n;n++){for(var i=e[n],o=[],a=0,l=i.length+1;l>a;a++)o.push([i.substring(0,a),i.substring(a,i.length)]);for(var s=[],a=0,l=o.length;l>a;a++){var u=o[a];u[1]&&s.push(u[0]+u[1].substring(1))}for(var f=[],a=0,l=o.length;l>a;a++){var u=o[a];u[1].length>1&&f.push(u[0]+u[1][1]+u[1][0]+u[1].substring(2))}for(var h=[],a=0,l=o.length;l>a;a++){var u=o[a];if(u[1])for(var d=0,p=c.alphabet.length;p>d;d++)h.push(u[0]+c.alphabet[d]+u[1].substring(1))}for(var m=[],a=0,l=o.length;l>a;a++){var u=o[a];if(u[1])for(var d=0,p=c.alphabet.length;p>d;d++)h.push(u[0]+c.alphabet[d]+u[1])}t=t.concat(s),t=t.concat(f),t=t.concat(h),t=t.concat(m)}return t}function r(e){for(var t=[],n=0;n<e.length;n++)c.check(e[n])&&t.push(e[n]);return t}function i(e){function i(e,t){return e[1]<t[1]?-1:1}for(var o=n([e]),a=n(o),l=r(o).concat(r(a)),s={},u=0,f=l.length;f>u;u++)l[u]in s?s[l[u]]+=1:s[l[u]]=1;var h=[];for(var u in s)h.push([u,s[u]]);h.sort(i).reverse();for(var d=[],u=0,f=Math.min(t,h.length);f>u;u++)c.hasFlag(h[u][0],"NOSUGGEST")||d.push(h[u][0]);return d}if(t||(t=5),this.check(e))return[];for(var o=0,a=this.replacementTable.length;a>o;o++){var l=this.replacementTable[o];if(-1!==e.indexOf(l[0])){var s=e.replace(l[0],l[1]);if(this.check(s))return[s]}}var c=this;return c.alphabet="abcdefghijklmnopqrstuvwxyz",i(e)}},"undefined"!=typeof t&&(t.exports=i)}).call(this,e("buffer").Buffer,"/node_modules/typo-js")},{buffer:3,fs:2}],19:[function(e,t,n){var r=e("codemirror");r.commands.tabAndIndentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentMore");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}},r.commands.shiftTabAndUnindentMarkdownList=function(e){var t=e.listSelections(),n=t[0].head,r=e.getStateAfter(n.line),i=r.list!==!1;if(i)return void e.execCommand("indentLess");if(e.options.indentWithTabs)e.execCommand("insertTab");else{var o=Array(e.options.tabSize+1).join(" ");e.replaceSelection(o)}}},{codemirror:10}],20:[function(e,t,n){"use strict";function r(e){return e=U?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function i(e,t,n){e=e||{};var r=document.createElement("a");return t=void 0==t?!0:t,e.title&&t&&(r.title=a(e.title,e.action,n),U&&(r.title=r.title.replace("Ctrl","⌘"),r.title=r.title.replace("Alt","⌥"))),r.tabIndex=-1,r.className=e.className,r}function o(){var e=document.createElement("i");return e.className="separator",e.innerHTML="|",e}function a(e,t,n){var i,o=e;return t&&(i=Y(t),n[i]&&(o+=" ("+r(n[i])+")")),o}function l(e,t){t=t||e.getCursor("start");var n=e.getTokenAt(t);if(!n.type)return{};for(var r,i,o=n.type.split(" "),a={},l=0;l<o.length;l++)r=o[l],"strong"===r?a.bold=!0:"variable-2"===r?(i=e.getLine(t.line),/^\s*\d+\.\s/.test(i)?a["ordered-list"]=!0:a["unordered-list"]=!0):"atom"===r?a.quote=!0:"em"===r?a.italic=!0:"quote"===r?a.quote=!0:"strikethrough"===r?a.strikethrough=!0:"comment"===r?a.code=!0:"link"===r?a.link=!0:"tag"===r?a.image=!0:r.match(/^header(\-[1-6])?$/)&&(a[r.replace("header","heading")]=!0);return a}function s(e){var t=e.codemirror;t.setOption("fullScreen",!t.getOption("fullScreen")),t.getOption("fullScreen")?(V=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=V;var n=t.getWrapperElement();/fullscreen/.test(n.previousSibling.className)?n.previousSibling.className=n.previousSibling.className.replace(/\s*fullscreen\b/,""):n.previousSibling.className+=" fullscreen";var r=e.toolbarElements.fullscreen;/active/.test(r.className)?r.className=r.className.replace(/\s*active\s*/g,""):r.className+=" active";var i=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(i.className)&&N(e)}function c(e){P(e,"bold",e.options.blockStyles.bold)}function u(e){P(e,"italic",e.options.blockStyles.italic)}function f(e){P(e,"strikethrough","~~")}function h(e){function t(e){if("object"!=typeof e)throw"fencing_line() takes a 'line' object (not a line number, or line text). Got: "+typeof e+": "+e;return e.styles&&e.styles[2]&&-1!==e.styles[2].indexOf("formatting-code-block")}function n(e){return e.state.base.base||e.state.base}function r(e,r,i,o,a){i=i||e.getLineHandle(r),o=o||e.getTokenAt({line:r,ch:1}),a=a||!!i.text&&e.getTokenAt({line:r,ch:i.text.length-1});var l=o.type?o.type.split(" "):[];return a&&n(a).indentedCode?"indented":-1===l.indexOf("comment")?!1:n(o).fencedChars||n(a).fencedChars||t(i)?"fenced":"single"}function i(e,t,n,r){var i=t.line+1,o=n.line+1,a=t.line!==n.line,l=r+"\n",s="\n"+r;a&&o++,a&&0===n.ch&&(s=r+"\n",o--),E(e,!1,[l,s]),e.setSelection({line:i,ch:0},{line:o,ch:0})}var o,a,l,s=e.options.blockStyles.code,c=e.codemirror,u=c.getCursor("start"),f=c.getCursor("end"),h=c.getTokenAt({line:u.line,ch:u.ch||1}),d=c.getLineHandle(u.line),p=r(c,u.line,d,h);if("single"===p){var m=d.text.slice(0,u.ch).replace("`",""),g=d.text.slice(u.ch).replace("`","");c.replaceRange(m+g,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),u.ch--,u!==f&&f.ch--,c.setSelection(u,f),c.focus()}else if("fenced"===p)if(u.line!==f.line||u.ch!==f.ch){for(o=u.line;o>=0&&(d=c.getLineHandle(o),!t(d));o--);var v,y,x,b,w=c.getTokenAt({line:o,ch:1}),k=n(w).fencedChars;t(c.getLineHandle(u.line))?(v="",y=u.line):t(c.getLineHandle(u.line-1))?(v="",y=u.line-1):(v=k+"\n",y=u.line),t(c.getLineHandle(f.line))?(x="",b=f.line,0===f.ch&&(b+=1)):0!==f.ch&&t(c.getLineHandle(f.line+1))?(x="",b=f.line+1):(x=k+"\n",b=f.line+1),0===f.ch&&(b-=1),c.operation(function(){c.replaceRange(x,{line:b,ch:0},{line:b+(x?0:1),ch:0}),c.replaceRange(v,{line:y,ch:0},{line:y+(v?0:1),ch:0})}),c.setSelection({line:y+(v?1:0),ch:0},{line:b+(v?1:-1),ch:0}),c.focus()}else{var S=u.line;if(t(c.getLineHandle(u.line))&&("fenced"===r(c,u.line+1)?(o=u.line,S=u.line+1):(a=u.line,S=u.line-1)),void 0===o)for(o=S;o>=0&&(d=c.getLineHandle(o),!t(d));o--);if(void 0===a)for(l=c.lineCount(),a=S;l>a&&(d=c.getLineHandle(a),!t(d));a++);c.operation(function(){c.replaceRange("",{line:o,ch:0},{line:o+1,ch:0}),c.replaceRange("",{line:a-1,ch:0},{line:a,ch:0})}),c.focus()}else if("indented"===p){if(u.line!==f.line||u.ch!==f.ch)o=u.line,a=f.line,0===f.ch&&a--;else{for(o=u.line;o>=0;o--)if(d=c.getLineHandle(o),!d.text.match(/^\s*$/)&&"indented"!==r(c,o,d)){o+=1;break}for(l=c.lineCount(),a=u.line;l>a;a++)if(d=c.getLineHandle(a),!d.text.match(/^\s*$/)&&"indented"!==r(c,a,d)){a-=1;break}}var C=c.getLineHandle(a+1),L=C&&c.getTokenAt({line:a+1,ch:C.text.length-1}),T=L&&n(L).indentedCode;T&&c.replaceRange("\n",{line:a+1,ch:0});for(var M=o;a>=M;M++)c.indentLine(M,"subtract");c.focus()}else{var N=u.line===f.line&&u.ch===f.ch&&0===u.ch,A=u.line!==f.line;N||A?i(c,u,f,s):E(c,!1,["`","`"])}}function d(e){var t=e.codemirror;I(t,"quote")}function p(e){var t=e.codemirror;O(t,"smaller")}function m(e){var t=e.codemirror;O(t,"bigger")}function g(e){var t=e.codemirror;O(t,void 0,1)}function v(e){var t=e.codemirror;O(t,void 0,2)}function y(e){var t=e.codemirror;O(t,void 0,3)}function x(e){var t=e.codemirror;I(t,"unordered-list")}function b(e){var t=e.codemirror;I(t,"ordered-list")}function w(e){var t=e.codemirror;R(t)}function k(e){var t=e.codemirror,n=l(t),r=e.options,i="http://";return r.promptURLs&&(i=prompt(r.promptTexts.link),!i)?!1:void E(t,n.link,r.insertTexts.link,i)}function S(e){var t=e.codemirror,n=l(t),r=e.options,i="http://";return r.promptURLs&&(i=prompt(r.promptTexts.image),!i)?!1:void E(t,n.image,r.insertTexts.image,i)}function C(e){var t=e.codemirror,n=l(t),r=e.options;E(t,n.table,r.insertTexts.table)}function L(e){var t=e.codemirror,n=l(t),r=e.options;E(t,n.image,r.insertTexts.horizontalRule)}function T(e){var t=e.codemirror;t.undo(),t.focus()}function M(e){var t=e.codemirror;t.redo(),t.focus()}function N(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.nextSibling,i=e.toolbarElements["side-by-side"],o=!1;/editor-preview-active-side/.test(r.className)?(r.className=r.className.replace(/\s*editor-preview-active-side\s*/g,""),i.className=i.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*CodeMirror-sided\s*/g," ")):(setTimeout(function(){t.getOption("fullScreen")||s(e),r.className+=" editor-preview-active-side"},1),i.className+=" active",n.className+=" CodeMirror-sided",o=!0);var a=n.lastChild;if(/editor-preview-active/.test(a.className)){a.className=a.className.replace(/\s*editor-preview-active\s*/g,"");var l=e.toolbarElements.preview,c=n.previousSibling;l.className=l.className.replace(/\s*active\s*/g,""),c.className=c.className.replace(/\s*disabled-for-preview*/g,"")}var u=function(){r.innerHTML=e.options.previewRender(e.value(),r)};t.sideBySideRenderingFunction||(t.sideBySideRenderingFunction=u),o?(r.innerHTML=e.options.previewRender(e.value(),r),t.on("update",t.sideBySideRenderingFunction)):t.off("update",t.sideBySideRenderingFunction),t.refresh()}function A(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.previousSibling,i=e.options.toolbar?e.toolbarElements.preview:!1,o=n.lastChild;o&&/editor-preview/.test(o.className)||(o=document.createElement("div"),o.className="editor-preview",n.appendChild(o)),/editor-preview-active/.test(o.className)?(o.className=o.className.replace(/\s*editor-preview-active\s*/g,""),i&&(i.className=i.className.replace(/\s*active\s*/g,""),r.className=r.className.replace(/\s*disabled-for-preview*/g,""))):(setTimeout(function(){o.className+=" editor-preview-active"},1),i&&(i.className+=" active",r.className+=" disabled-for-preview")),o.innerHTML=e.options.previewRender(e.value(),o);var a=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(a.className)&&N(e)}function E(e,t,n,r){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){var i,o=n[0],a=n[1],l=e.getCursor("start"),s=e.getCursor("end");r&&(a=a.replace("#url#",r)),t?(i=e.getLine(l.line),o=i.slice(0,l.ch),a=i.slice(l.ch),e.replaceRange(o+a,{line:l.line,ch:0})):(i=e.getSelection(),e.replaceSelection(o+i+a),l.ch+=o.length,l!==s&&(s.ch+=o.length)),e.setSelection(l,s),e.focus()}}function O(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var r=e.getCursor("start"),i=e.getCursor("end"),o=r.line;o<=i.line;o++)!function(r){var i=e.getLine(r),o=i.search(/[^#]/);i=void 0!==t?0>=o?"bigger"==t?"###### "+i:"# "+i:6==o&&"smaller"==t?i.substr(7):1==o&&"bigger"==t?i.substr(2):"bigger"==t?i.substr(1):"#"+i:1==n?0>=o?"# "+i:o==n?i.substr(o+1):"# "+i.substr(o+1):2==n?0>=o?"## "+i:o==n?i.substr(o+1):"## "+i.substr(o+1):0>=o?"### "+i:o==n?i.substr(o+1):"### "+i.substr(o+1),e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(o);e.focus()}}function I(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n=l(e),r=e.getCursor("start"),i=e.getCursor("end"),o={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},s=r.line;s<=i.line;s++)!function(r){var i=e.getLine(r);i=n[t]?i.replace(o[t],"$1"):a[t]+i,e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(s);e.focus()}}function P(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r="undefined"==typeof r?n:r;var i,o=e.codemirror,a=l(o),s=n,c=r,u=o.getCursor("start"),f=o.getCursor("end");a[t]?(i=o.getLine(u.line),s=i.slice(0,u.ch),c=i.slice(u.ch),"bold"==t?(s=s.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),c=c.replace(/(\*\*|__)/,"")):"italic"==t?(s=s.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),c=c.replace(/(\*|_)/,"")):"strikethrough"==t&&(s=s.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),c=c.replace(/(\*\*|~~)/,"")),o.replaceRange(s+c,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==f&&(f.ch-=2)):"italic"==t&&(u.ch-=1,u!==f&&(f.ch-=1))):(i=o.getSelection(),"bold"==t?(i=i.split("**").join(""),i=i.split("__").join("")):"italic"==t?(i=i.split("*").join(""),i=i.split("_").join("")):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(s+i+c),u.ch+=n.length,f.ch=u.ch+i.length),o.setSelection(u,f),o.focus()}}function R(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=e.getLine(i),t=t.replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}function D(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=D(e[n]||{},t[n]):e[n]=t[n]);return e}function H(e){for(var t=1;t<arguments.length;t++)e=D(e,arguments[t]);return e}function W(e){var t=/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g,n=e.match(t),r=0;if(null===n)return r;for(var i=0;i<n.length;i++)r+=n[i].charCodeAt(0)>=19968?n[i].length:1;return r}function B(e){e=e||{},e.parent=this;var t=!0;if(e.autoDownloadFontAwesome===!1&&(t=!1),e.autoDownloadFontAwesome!==!0)for(var n=document.styleSheets,r=0;r<n.length;r++)n[r].href&&n[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")>-1&&(t=!1);if(t){var i=document.createElement("link");i.rel="stylesheet",i.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(i)}if(e.element)this.element=e.element;else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.");if(void 0===e.toolbar){e.toolbar=[];for(var o in K)K.hasOwnProperty(o)&&(-1!=o.indexOf("separator-")&&e.toolbar.push("|"),(K[o]["default"]===!0||e.showIcons&&e.showIcons.constructor===Array&&-1!=e.showIcons.indexOf(o))&&e.toolbar.push(o))}e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=H({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=H({},X,e.insertTexts||{}),e.promptTexts=Z,e.blockStyles=H({},J,e.blockStyles||{}),e.shortcuts=H({},G,e.shortcuts||{}),void 0!=e.autosave&&void 0!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&this.options.autosave.foundSavedValue===!0||this.value(e.initialValue)}function _(){if("object"!=typeof localStorage)return!1;try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}var F=e("codemirror");e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js");var z=e("codemirror-spell-checker"),j=e("marked"),U=/Mac/.test(navigator.platform),q={toggleBold:c,toggleItalic:u,drawLink:k,toggleHeadingSmaller:p,toggleHeadingBigger:m,drawImage:S,toggleBlockquote:d,toggleOrderedList:b,toggleUnorderedList:x,toggleCodeBlock:h,togglePreview:A,toggleStrikethrough:f,toggleHeading1:g,toggleHeading2:v,toggleHeading3:y,cleanBlock:w,drawTable:C,drawHorizontalRule:L,undo:T,redo:M,toggleSideBySide:N,toggleFullScreen:s},G={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},Y=function(e){for(var t in q)if(q[t]===e)return t;return null},$=function(){var e=!1;return function(t){(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(t)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(t.substr(0,4)))&&(e=!0); }(navigator.userAgent||navigator.vendor||window.opera),e},V="",K={bold:{name:"bold",action:c,className:"fa fa-bold",title:"Bold","default":!0},italic:{name:"italic",action:u,className:"fa fa-italic",title:"Italic","default":!0},strikethrough:{name:"strikethrough",action:f,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:p,className:"fa fa-header",title:"Heading","default":!0},"heading-smaller":{name:"heading-smaller",action:p,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:m,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:g,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:v,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:y,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:h,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:d,className:"fa fa-quote-left",title:"Quote","default":!0},"unordered-list":{name:"unordered-list",action:x,className:"fa fa-list-ul",title:"Generic List","default":!0},"ordered-list":{name:"ordered-list",action:b,className:"fa fa-list-ol",title:"Numbered List","default":!0},"clean-block":{name:"clean-block",action:w,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:k,className:"fa fa-link",title:"Create Link","default":!0},image:{name:"image",action:S,className:"fa fa-picture-o",title:"Insert Image","default":!0},table:{name:"table",action:C,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:L,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:A,className:"fa fa-eye no-disable",title:"Toggle Preview","default":!0},"side-by-side":{name:"side-by-side",action:N,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side","default":!0},fullscreen:{name:"fullscreen",action:s,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen","default":!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide","default":!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:T,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:M,className:"fa fa-repeat no-disable",title:"Redo"}},X={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},Z={link:"URL for the link:",image:"URL of the image:"},J={bold:"**",code:"```",italic:"*"};B.prototype.markdown=function(e){if(j){var t={};return this.options&&this.options.renderingConfig&&this.options.renderingConfig.singleLineBreaks===!1?t.breaks=!1:t.breaks=!0,this.options&&this.options.renderingConfig&&this.options.renderingConfig.codeSyntaxHighlighting===!0&&window.hljs&&(t.highlight=function(e){return window.hljs.highlightAuto(e).value}),j.setOptions(t),j(e)}},B.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e;var t=this.options,n=this,i={};for(var o in t.shortcuts)null!==t.shortcuts[o]&&null!==q[o]&&!function(e){i[r(t.shortcuts[e])]=function(){q[e](n)}}(o);i.Enter="newlineAndIndentContinueMarkdownList",i.Tab="tabAndIndentMarkdownList",i["Shift-Tab"]="shiftTabAndUnindentMarkdownList",i.Esc=function(e){e.getOption("fullScreen")&&s(n)},document.addEventListener("keydown",function(e){e=e||window.event,27==e.keyCode&&n.codemirror.getOption("fullScreen")&&s(n)},!1);var a,l;if(t.spellChecker!==!1?(a="spell-checker",l=t.parsingConfig,l.name="gfm",l.gitHubSpice=!1,z({codeMirrorInstance:F})):(a=t.parsingConfig,a.name="gfm",a.gitHubSpice=!1),this.codemirror=F.fromTextArea(e,{mode:a,backdrop:l,theme:"paper",tabSize:void 0!=t.tabSize?t.tabSize:2,indentUnit:void 0!=t.tabSize?t.tabSize:2,indentWithTabs:t.indentWithTabs!==!1,lineNumbers:!1,autofocus:t.autofocus===!0,extraKeys:i,lineWrapping:t.lineWrapping!==!1,allowDropFileTypes:["text/plain"],placeholder:t.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:void 0!=t.styleSelectedText?t.styleSelectedText:!0}),t.forceSync===!0){var c=this.codemirror;c.on("change",function(){c.save()})}this.gui={},t.toolbar!==!1&&(this.gui.toolbar=this.createToolbar()),t.status!==!1&&(this.gui.statusbar=this.createStatusbar()),void 0!=t.autosave&&t.autosave.enabled===!0&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element;var u=this.codemirror;setTimeout(function(){u.refresh()}.bind(u),0)}},B.prototype.autosave=function(){if(_()){var e=this;if(void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature");null!=e.element.form&&void 0!=e.element.form&&e.element.form.addEventListener("submit",function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)}),this.options.autosave.loaded!==!0&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value());var t=document.getElementById("autosaved");if(null!=t&&void 0!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r;a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=10>i?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout(function(){e.autosave()},this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.clearAutosavedValue=function(){if(_()){if(void 0==this.options.autosave||void 0==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value");localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},B.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;n&&/editor-preview-side/.test(n.className)||(n=document.createElement("div"),n.className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling));var r=!1,i=!1;return e.on("scroll",function(e){if(r)return void(r=!1);i=!0;var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.getScrollInfo().top)/t,a=(n.scrollHeight-n.clientHeight)*o;n.scrollTop=a}),n.onscroll=function(){if(i)return void(i=!1);r=!0;var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o;e.scrollTo(0,a)},n},B.prototype.createToolbar=function(e){if(e=e||this.options.toolbar,e&&0!==e.length){var t;for(t=0;t<e.length;t++)void 0!=K[e[t]]&&(e[t]=K[e[t]]);var n=document.createElement("div");n.className="editor-toolbar";var r=this,a={};for(r.toolbar=e,t=0;t<e.length;t++)if(("guide"!=e[t].name||r.options.toolbarGuideIcon!==!1)&&!(r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[t].name)||("fullscreen"==e[t].name||"side-by-side"==e[t].name)&&$())){if("|"===e[t]){for(var s=!1,c=t+1;c<e.length;c++)"|"===e[c]||r.options.hideIcons&&-1!=r.options.hideIcons.indexOf(e[c].name)||(s=!0);if(!s)continue}!function(e){var t;t="|"===e?o():i(e,r.options.toolbarTips,r.options.shortcuts),e.action&&("function"==typeof e.action?t.onclick=function(t){t.preventDefault(),e.action(r)}:"string"==typeof e.action&&(t.href=e.action,t.target="_blank")),a[e.name||e]=t,n.appendChild(t)}(e[t])}r.toolbarElements=a;var u=this.codemirror;u.on("cursorActivity",function(){var e=l(u);for(var t in a)!function(t){var n=a[t];e[t]?n.className+=" active":"fullscreen"!=t&&"side-by-side"!=t&&(n.className=n.className.replace(/\s*active\s*/g,""))}(t)});var f=u.getWrapperElement();return f.parentNode.insertBefore(n,f),n}},B.prototype.createStatusbar=function(e){e=e||this.options.status;var t=this.options,n=this.codemirror;if(e&&0!==e.length){var r,i,o,a=[];for(r=0;r<e.length;r++)if(i=void 0,o=void 0,"object"==typeof e[r])a.push({className:e[r].className,defaultValue:e[r].defaultValue,onUpdate:e[r].onUpdate});else{var l=e[r];"words"===l?(o=function(e){e.innerHTML=W(n.getValue())},i=function(e){e.innerHTML=W(n.getValue())}):"lines"===l?(o=function(e){e.innerHTML=n.lineCount()},i=function(e){e.innerHTML=n.lineCount()}):"cursor"===l?(o=function(e){e.innerHTML="0:0"},i=function(e){var t=n.getCursor();e.innerHTML=t.line+":"+t.ch}):"autosave"===l&&(o=function(e){void 0!=t.autosave&&t.autosave.enabled===!0&&e.setAttribute("id","autosaved")}),a.push({className:l,defaultValue:o,onUpdate:i})}var s=document.createElement("div");for(s.className="editor-statusbar",r=0;r<a.length;r++){var c=a[r],u=document.createElement("span");u.className=c.className,"function"==typeof c.defaultValue&&c.defaultValue(u),"function"==typeof c.onUpdate&&this.codemirror.on("update",function(e,t){return function(){t.onUpdate(e)}}(u,c)),s.appendChild(u)}var f=this.codemirror.getWrapperElement();return f.parentNode.insertBefore(s,f.nextSibling),s}},B.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},B.toggleBold=c,B.toggleItalic=u,B.toggleStrikethrough=f,B.toggleBlockquote=d,B.toggleHeadingSmaller=p,B.toggleHeadingBigger=m,B.toggleHeading1=g,B.toggleHeading2=v,B.toggleHeading3=y,B.toggleCodeBlock=h,B.toggleUnorderedList=x,B.toggleOrderedList=b,B.cleanBlock=w,B.drawLink=k,B.drawImage=S,B.drawTable=C,B.drawHorizontalRule=L,B.undo=T,B.redo=M,B.togglePreview=A,B.toggleSideBySide=N,B.toggleFullScreen=s,B.prototype.toggleBold=function(){c(this)},B.prototype.toggleItalic=function(){u(this)},B.prototype.toggleStrikethrough=function(){f(this)},B.prototype.toggleBlockquote=function(){d(this)},B.prototype.toggleHeadingSmaller=function(){p(this)},B.prototype.toggleHeadingBigger=function(){m(this)},B.prototype.toggleHeading1=function(){g(this)},B.prototype.toggleHeading2=function(){v(this)},B.prototype.toggleHeading3=function(){y(this)},B.prototype.toggleCodeBlock=function(){h(this)},B.prototype.toggleUnorderedList=function(){x(this)},B.prototype.toggleOrderedList=function(){b(this)},B.prototype.cleanBlock=function(){w(this)},B.prototype.drawLink=function(){k(this)},B.prototype.drawImage=function(){S(this)},B.prototype.drawTable=function(){C(this)},B.prototype.drawHorizontalRule=function(){L(this)},B.prototype.undo=function(){T(this)},B.prototype.redo=function(){M(this)},B.prototype.togglePreview=function(){A(this)},B.prototype.toggleSideBySide=function(){N(this)},B.prototype.toggleFullScreen=function(){s(this)},B.prototype.isPreviewActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.lastChild;return/editor-preview-active/.test(n.className)},B.prototype.isSideBySideActive=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling;return/editor-preview-active-side/.test(n.className)},B.prototype.isFullscreenActive=function(){var e=this.codemirror;return e.getOption("fullScreen")},B.prototype.getState=function(){var e=this.codemirror;return l(e)},B.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement();t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide&&t.parentNode.removeChild(this.gui.sideBySide)),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},t.exports=B},{"./codemirror/tablist":19,codemirror:10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14,marked:17}]},{},[20])(20)}); /** Trumbowyg v2.10.0 - A lightweight WYSIWYG editor - alex-d.github.io/Trumbowyg - License MIT - Author : Alexandre Demode (Alex-D) / alex-d.fr */ -jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"Target",width:"Width"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector("base")?t.location.href.split("#")[0]:"",0===a("#"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName("script"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match("trumbowyg(.min)?.js");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+"ui/icons.svg")}null==d&&console.warn("You must define svgPath: https://goo.gl/CfTY9U")}var h=i.doc.createElement("div");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:m,key:"Z"},redo:{isSupported:m,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:p+" 1"},h2:{fn:"formatBlock",title:p+" 2"},h3:{fn:"formatBlock",title:p+" 3"},h4:{fn:"formatBlock",title:p+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{"class":"trumbowyg-not-disable"},close:{fn:"destroy","class":"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf("MSIE")!==-1||e.appVersion.indexOf("Trident/")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":/:\/\/$/.test(e)?e:e+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("<div/>",{"class":n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(o),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.$c.is("[spellcheck]")&&e.$ed.attr("spellcheck",e.$c.attr("spellcheck")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+"autogrow-on-enter");var r,i=!1,s=!1,l="keyup";e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on("compositionstart compositionupdate",function(){s=!0}).on(l+" compositionend",function(t){if("compositionend"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)"undefined"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||"compositionend"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger("tbwchange")}else e.$c.trigger("tbwchange");setTimeout(function(){i=!1},50)}}).on("mouseup keydown keyup",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on("focus blur",function(t){if(e.$c.trigger("tbw"+t.type),"blur"===t.type&&a("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;"focus"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css("min-height")}),e.$c.trigger("tbwresize"))}}).on("cut",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger("tbwchange",n)}catch(i){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup",function(){e.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){e.$c.trigger("tbwchange")},0)}),e.$box.on("keydown",function(t){if(27===t.which&&1===a("."+n+"modal-box",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a("<div/>",{"class":t+"button-pane"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a("<div/>",{"class":t+"button-group "+(r.indexOf("fullscreen")>=0?t+"right":"")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a("<button/>",{type:"button","class":n+e+"-button "+(o["class"]||"")+(i?"":" "+n+"textual-button"),html:t.hasSvg&&i?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?" (Ctrl + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!a("."+e+"-"+n+"dropdown",t.$box).is(":hidden")||a("body",t.doc).trigger("mousedown"),!((t.$btnPane.hasClass(n+"disable")||t.$box.hasClass(n+"disabled"))&&!a(this).hasClass(n+"active")&&!a(this).hasClass(n+"not-disable"))&&(t.execCmd(!!r&&"dropdown"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+"open-dropdown");var d=n+"dropdown",c={"class":d+"-"+e+" "+d+" "+n+"fixed-top"};c["data-"+d]=e;var u=a("<div/>",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a("<button/>",{type:"button","class":n+e+"-dropdown-button"+(o.ico?" "+n+o.ico+"-button":""),html:t.hasSvg&&r?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?" (Ctrl + "+o.key+")":null,style:o.style||null,mousedown:function(){return a("body",t.doc).trigger("mousedown"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a("<div/>",{"class":e.o.prefix+"overlay"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on("scroll."+e.eventNamespace+" resize."+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":o.width()-1+"px"}),a("."+e.o.prefix+"fixed-top",o).css({position:n?"fixed":"absolute",top:n?l:l+(r-i)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),a([e.$ta,e.$ed]).css({marginTop:0}),a("."+e.o.prefix+"fixed-top",o).css({position:"absolute",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(n+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(n+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),a("body").removeClass(n+"body-fullscreen"),e.$c.trigger("tbwclose"),a(t).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),a("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a("[data-"+r+"dropdown="+e+"]",n.$box),s=a("."+r+e+"-button",n.$btnPane),l=i.is(":hidden");if(a("body",o).trigger("mousedown"),l){var d=s.offset().left;s.addClass(r+"active"),i.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+"px":d-n.$btnPane.offset().left+"px"}).show(),a(t).trigger("scroll"),a("body",o).on("mousedown."+n.eventNamespace,function(e){i.is(e.target)||(a("."+r+"dropdown",n.$box).hide(),a("."+r+"active",n.$btnPane).removeClass(r+"active"),a("body",o).off("mousedown."+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,iframe,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(":visible"))t.syncTextarea();else{var n=a("<div>").html(t.$ta.val()),o=a("<div>").append(n);a(t.o.tagsToRemove.join(","),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize"))),t.o.autogrowOnEnter){t.$ed.height("auto");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");r!==t.$ta.css("height")&&(t.$ed.css({height:r}),t.$c.trigger("tbwresize"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag("b"),o.semanticTag("i"),o.semanticTag("s"),o.semanticTag("strike"),t){var r=o.o.inlineElementsSelector,i=":not("+r+")";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag("div",!0),o.$ed.find("p").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not("br,span").length)}).contents().unwrap(),a("[data-tbw]",o.$ed).contents().unwrap(),o.$ed.find("p:empty").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap("<"+n+"/>"),t&&a.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&"A"===i.nodeName){var l=a(i);s=l.text(),e=l.attr("href"),o.o.minimalLinks||(t=l.attr("title"),n=l.attr("target"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:"URL",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href="',e.url,'">',e.text||e.url,"</a>"].join(""));return o.o.minimalLinks||(e.title.length>0&&n.attr("title",e.title),e.target.length>0&&n.attr("target",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;const n=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(n.test(e))return e;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a.test(e)?"mailto:"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd("insertImage",t.url);var n=a('img[src="'+t.url+'"]:not([alt])',e.$box);return n.attr("alt",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+"fullscreen";n.$box.toggleClass(r),e=n.$box.hasClass(r),a("body").toggleClass(o+"body-fullscreen",e),a(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(e,t,n,a){var o=this;a=!!a||"","dropdown"!==e&&o.$ed.focus();try{o.doc.execCommand("styleWithCSS",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){"insertHorizontalRule"===e?t=void 0:"formatBlock"===e&&o.isIE&&(t="<"+t+">"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a("."+s+"modal-box",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+"disable");var l=a("<div/>",{"class":s+"modal "+s+"fixed-top"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one("click",function(){return l.trigger(r),!1});var d=a("<form/>",{action:"",html:n}).on("submit",function(){return l.trigger(o),!1}).on("reset",function(){return l.trigger(r),!1}).on("submit reset",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a("<div/>",{"class":s+"modal-box",html:d}).css({top:"-"+i.$btnPane.outerHeight()+"px",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a("<span/>",{text:e,"class":s+"modal-title"}).prependTo(c),l.height(c.outerHeight()+10),a("input:first",c).focus(),i.buildModalBtn("submit",c),i.buildModalBtn("reset",c),a(t).trigger("scroll"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a("<button/>",{"class":o+"modal-button "+o+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(a("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=a("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d="";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");d+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+r+'><span class="'+s+'input-infos"><span>'+(l[n]?l[n]:n)+"</span></span></label>"}),i.openModal(e,d).on(o,function(){var e=a("form",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name="'+o+'"]',e),d=l.attr("type");switch(d.toLowerCase()){case"checkbox":s[o]=l.is(":checked");break;case"radio":s[o]=l.filter(":checked").val();break;default:s[o]=a.trim(l.val())}n.required&&""===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger("tbwchange"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error")}),o.addClass(n+"input-error").find("input+span").append(a("<span/>",{"class":n+"msg-error",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr("src"),o="(Base64)";0===n.indexOf("data:image")&&(n=o);var r={url:{label:"URL",value:n,required:!0},alt:{label:e.lang.description,value:t.attr("alt")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr("width")?t.attr("width"):""}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.src!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+"").length,e.metaRange={start:n,end:n+(a+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+"active-button "+t+"active";a("."+t+"active-button",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a("."+t+i+"-button",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a("."+t+"dropdown ."+t+i+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");a("."+t+l+"-button",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return"DIV"===o?t:("P"===o&&""!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery); +jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",formatting:"Formatting",p:"Paragraph",blockquote:"Quote",code:"Code",header:"Header",bold:"Bold",italic:"Italic",strikethrough:"Stroke",underline:"Underline",strong:"Strong",em:"Emphasis",del:"Deleted",superscript:"Superscript",subscript:"Subscript",unorderedList:"Unordered list",orderedList:"Ordered list",insertImage:"Insert Image",link:"Link",createLink:"Insert link",unlink:"Remove link",justifyLeft:"Align Left",justifyCenter:"Align Center",justifyRight:"Align Right",justifyFull:"Align Justify",horizontalRule:"Insert horizontal rule",removeformat:"Remove format",fullscreen:"Fullscreen",close:"Close",submit:"Confirm",reset:"Cancel",required:"Required",description:"Description",title:"Title",text:"Text",target:"BaseTarget",width:"Width"}},plugins:{},svgPath:null,hideButtonTexts:null},Object.defineProperty(jQuery.trumbowyg,"defaultOptions",{value:{lang:"en",fixedBtnPane:!1,fixedFullWidth:!1,autogrow:!1,autogrowOnEnter:!1,imageWidthModalEdit:!1,prefix:"trumbowyg-",semantic:!0,resetCss:!1,removeformatPasted:!1,tagsToRemove:[],btns:[["viewHTML"],["undo","redo"],["formatting"],["strong","em","del"],["superscript","subscript"],["link"],["insertImage"],["justifyLeft","justifyCenter","justifyRight","justifyFull"],["unorderedList","orderedList"],["horizontalRule"],["removeformat"],["fullscreen"]],btnsDef:{},inlineElementsSelector:"a,abbr,acronym,b,caption,cite,code,col,dfn,dir,dt,dd,em,font,hr,i,kbd,li,q,span,strikeout,strong,sub,sup,u",pasteHandlers:[],plugins:{},urlProtocol:!1,minimalLinks:!1},writable:!1,enumerable:!0,configurable:!1}),function(e,t,n,a){"use strict";var o="tbwconfirm",r="tbwcancel";a.fn.trumbowyg=function(e,t){var n="trumbowyg";if(e===Object(e)||!e)return this.each(function(){a(this).data(n)||a(this).data(n,new i(this,e))});if(1===this.length)try{var o=a(this).data(n);switch(e){case"execCmd":return o.execCmd(t.cmd,t.param,t.forceCss);case"openModal":return o.openModal(t.title,t.content);case"closeModal":return o.closeModal();case"openModalInsert":return o.openModalInsert(t.title,t.fields,t.callback);case"saveRange":return o.saveRange();case"getRange":return o.range;case"getRangeText":return o.getRangeText();case"restoreRange":return o.restoreRange();case"enable":return o.setDisabled(!1);case"disable":return o.setDisabled(!0);case"toggle":return o.toggle();case"destroy":return o.destroy();case"empty":return o.empty();case"html":return o.html(t)}}catch(r){}return!1};var i=function(o,r){var i=this,s="trumbowyg-icons",l=a.trumbowyg;i.doc=o.ownerDocument||n,i.$ta=a(o),i.$c=a(o),r=r||{},null!=r.lang||null!=l.langs[r.lang]?i.lang=a.extend(!0,{},l.langs.en,l.langs[r.lang]):i.lang=l.langs.en,i.hideButtonTexts=null!=l.hideButtonTexts?l.hideButtonTexts:r.hideButtonTexts;var d=null!=l.svgPath?l.svgPath:r.svgPath;if(i.hasSvg=d!==!1,i.svgPath=i.doc.querySelector("base")?t.location.href.split("#")[0]:"",0===a("#"+s,i.doc).length&&d!==!1){if(null==d){for(var c=n.getElementsByTagName("script"),u=0;u<c.length;u+=1){var g=c[u].src,f=g.match("trumbowyg(.min)?.js");null!=f&&(d=g.substring(0,g.indexOf(f[0]))+"ui/icons.svg")}null==d&&console.warn("You must define svgPath: https://goo.gl/CfTY9U")}var h=i.doc.createElement("div");h.id=s,i.doc.body.insertBefore(h,i.doc.body.childNodes[0]),a.ajax({async:!0,type:"GET",contentType:"application/x-www-form-urlencoded; charset=UTF-8",dataType:"xml",crossDomain:!0,url:d,data:null,beforeSend:null,complete:null,success:function(e){h.innerHTML=(new XMLSerializer).serializeToString(e.documentElement)}})}var p=i.lang.header,m=function(){return(t.chrome||t.Intl&&Intl.v8BreakIterator)&&"CSS"in t};i.btnsDef={viewHTML:{fn:"toggle"},undo:{isSupported:m,key:"Z"},redo:{isSupported:m,key:"Y"},p:{fn:"formatBlock"},blockquote:{fn:"formatBlock"},h1:{fn:"formatBlock",title:p+" 1"},h2:{fn:"formatBlock",title:p+" 2"},h3:{fn:"formatBlock",title:p+" 3"},h4:{fn:"formatBlock",title:p+" 4"},subscript:{tag:"sub"},superscript:{tag:"sup"},bold:{key:"B",tag:"b"},italic:{key:"I",tag:"i"},underline:{tag:"u"},strikethrough:{tag:"strike"},strong:{fn:"bold",key:"B"},em:{fn:"italic",key:"I"},del:{fn:"strikethrough"},createLink:{key:"K",tag:"a"},unlink:{},insertImage:{},justifyLeft:{tag:"left",forceCss:!0},justifyCenter:{tag:"center",forceCss:!0},justifyRight:{tag:"right",forceCss:!0},justifyFull:{tag:"justify",forceCss:!0},unorderedList:{fn:"insertUnorderedList",tag:"ul"},orderedList:{fn:"insertOrderedList",tag:"ol"},horizontalRule:{fn:"insertHorizontalRule"},removeformat:{},fullscreen:{"class":"trumbowyg-not-disable"},close:{fn:"destroy","class":"trumbowyg-not-disable"},formatting:{dropdown:["p","blockquote","h1","h2","h3","h4"],ico:"p"},link:{dropdown:["createLink","unlink"]}},i.o=a.extend(!0,{},l.defaultOptions,r),i.o.hasOwnProperty("imgDblClickHandler")||(i.o.imgDblClickHandler=i.getDefaultImgDblClickHandler()),i.urlPrefix=i.setupUrlPrefix(),i.disabled=i.o.disabled||"TEXTAREA"===o.nodeName&&o.disabled,r.btns?i.o.btns=r.btns:i.o.semantic||(i.o.btns[3]=["bold","italic","underline","strikethrough"]),a.each(i.o.btnsDef,function(e,t){i.addBtnDef(e,t)}),i.eventNamespace="trumbowyg-event",i.keys=[],i.tagToButton={},i.tagHandlers=[],i.pasteHandlers=[].concat(i.o.pasteHandlers),i.isIE=e.userAgent.indexOf("MSIE")!==-1||e.appVersion.indexOf("Trident/")!==-1,i.init()};i.prototype={DEFAULT_SEMANTIC_MAP:{b:"strong",i:"em",s:"del",strike:"del",div:"p"},init:function(){var e=this;e.height=e.$ta.height(),e.initPlugins();try{e.doc.execCommand("enableObjectResizing",!1,!1),e.doc.execCommand("defaultParagraphSeparator",!1,"p")}catch(t){}e.buildEditor(),e.buildBtnPane(),e.fixedBtnPaneEvents(),e.buildOverlay(),setTimeout(function(){e.disabled&&e.setDisabled(!0),e.$c.trigger("tbwinit")})},addBtnDef:function(e,t){this.btnsDef[e]=t},setupUrlPrefix:function(){var e=this.o.urlProtocol;if(e)return"string"!=typeof e?"https://":/:\/\/$/.test(e)?e:e+"://"},buildEditor:function(){var e=this,n=e.o.prefix,o="";e.$box=a("<div/>",{"class":n+"box "+n+"editor-visible "+n+e.o.lang+" trumbowyg"}),e.isTextarea=e.$ta.is("textarea"),e.isTextarea?(o=e.$ta.val(),e.$ed=a("<div/>"),e.$box.insertAfter(e.$ta).append(e.$ed,e.$ta)):(e.$ed=e.$ta,o=e.$ed.html(),e.$ta=a("<textarea/>",{name:e.$ta.attr("id"),height:e.height}).val(o),e.$box.insertAfter(e.$ed).append(e.$ta,e.$ed),e.syncCode()),e.$ta.addClass(n+"textarea").attr("tabindex",-1),e.$ed.addClass(n+"editor").attr({contenteditable:!0,dir:e.lang._dir||"ltr"}).html(o),e.o.tabindex&&e.$ed.attr("tabindex",e.o.tabindex),e.$c.is("[placeholder]")&&e.$ed.attr("placeholder",e.$c.attr("placeholder")),e.$c.is("[spellcheck]")&&e.$ed.attr("spellcheck",e.$c.attr("spellcheck")),e.o.resetCss&&e.$ed.addClass(n+"reset-css"),e.o.autogrow||e.$ta.add(e.$ed).css({height:e.height}),e.semanticCode(),e.o.autogrowOnEnter&&e.$ed.addClass(n+"autogrow-on-enter");var r,i=!1,s=!1,l="keyup";e.$ed.on("dblclick","img",e.o.imgDblClickHandler).on("keydown",function(t){if((t.ctrlKey||t.metaKey)&&!t.altKey){i=!0;var n=e.keys[String.fromCharCode(t.which).toUpperCase()];try{return e.execCmd(n.fn,n.param),!1}catch(a){}}}).on("compositionstart compositionupdate",function(){s=!0}).on(l+" compositionend",function(t){if("compositionend"===t.type)s=!1;else if(s)return;var n=t.which;if(!(n>=37&&n<=40)){if(!t.ctrlKey&&!t.metaKey||89!==n&&90!==n)if(i||17===n)"undefined"==typeof t.which&&e.semanticCode(!1,!1,!0);else{var a=!e.isIE||"compositionend"===t.type;e.semanticCode(!1,a&&13===n),e.$c.trigger("tbwchange")}else e.$c.trigger("tbwchange");setTimeout(function(){i=!1},50)}}).on("mouseup keydown keyup",function(t){(!t.ctrlKey&&!t.metaKey||t.altKey)&&setTimeout(function(){i=!1},50),clearTimeout(r),r=setTimeout(function(){e.updateButtonPaneStatus()},50)}).on("focus blur",function(t){if(e.$c.trigger("tbw"+t.type),"blur"===t.type&&a("."+n+"active-button",e.$btnPane).removeClass(n+"active-button "+n+"active"),e.o.autogrowOnEnter){if(e.autogrowOnEnterDontClose)return;"focus"===t.type?(e.autogrowOnEnterWasFocused=!0,e.autogrowEditorOnEnter()):e.o.autogrow||(e.$ed.css({height:e.$ed.css("min-height")}),e.$c.trigger("tbwresize"))}}).on("cut",function(){setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwchange")},0)}).on("paste",function(n){if(e.o.removeformatPasted){n.preventDefault(),t.getSelection&&t.getSelection().deleteFromDocument&&t.getSelection().deleteFromDocument();try{var o=t.clipboardData.getData("Text");try{e.doc.selection.createRange().pasteHTML(o)}catch(r){e.doc.getSelection().getRangeAt(0).insertNode(e.doc.createTextNode(o))}e.$c.trigger("tbwchange",n)}catch(i){e.execCmd("insertText",(n.originalEvent||n).clipboardData.getData("text/plain"))}}a.each(e.pasteHandlers,function(e,t){t(n)}),setTimeout(function(){e.semanticCode(!1,!0),e.$c.trigger("tbwpaste",n)},0)}),e.$ta.on("keyup",function(){e.$c.trigger("tbwchange")}).on("paste",function(){setTimeout(function(){e.$c.trigger("tbwchange")},0)}),e.$box.on("keydown",function(t){if(27===t.which&&1===a("."+n+"modal-box",e.$box).length)return e.closeModal(),!1})},autogrowEditorOnEnter:function(){var e=this;e.$ed.removeClass("autogrow-on-enter");var t=e.$ed[0].clientHeight;e.$ed.height("auto");var n=e.$ed[0].scrollHeight;e.$ed.addClass("autogrow-on-enter"),t!==n&&(e.$ed.height(t),setTimeout(function(){e.$ed.css({height:n}),e.$c.trigger("tbwresize")},0))},buildBtnPane:function(){var e=this,t=e.o.prefix,n=e.$btnPane=a("<div/>",{"class":t+"button-pane"});a.each(e.o.btns,function(o,r){a.isArray(r)||(r=[r]);var i=a("<div/>",{"class":t+"button-group "+(r.indexOf("fullscreen")>=0?t+"right":"")});a.each(r,function(t,n){try{e.isSupportedBtn(n)&&i.append(e.buildBtn(n))}catch(a){}}),i.html().trim().length>0&&n.append(i)}),e.$box.prepend(n)},buildBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=o.dropdown,i=null==o.hasIcon||o.hasIcon,s=t.lang[e]||e,l=a("<button/>",{type:"button","class":n+e+"-button "+(o["class"]||"")+(i?"":" "+n+"textual-button"),html:t.hasSvg&&i?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>':t.hideButtonTexts?"":o.text||o.title||t.lang[e]||e,title:(o.title||o.text||s)+(o.key?" (Ctrl + "+o.key+")":""),tabindex:-1,mousedown:function(){return r&&!a("."+e+"-"+n+"dropdown",t.$box).is(":hidden")||a("body",t.doc).trigger("mousedown"),!((t.$btnPane.hasClass(n+"disable")||t.$box.hasClass(n+"disabled"))&&!a(this).hasClass(n+"active")&&!a(this).hasClass(n+"not-disable"))&&(t.execCmd(!!r&&"dropdown"||o.fn||e,o.param||e,o.forceCss),!1)}});if(r){l.addClass(n+"open-dropdown");var d=n+"dropdown",c={"class":d+"-"+e+" "+d+" "+n+"fixed-top"};c["data-"+d]=e;var u=a("<div/>",c);a.each(r,function(e,n){t.btnsDef[n]&&t.isSupportedBtn(n)&&u.append(t.buildSubBtn(n))}),t.$box.append(u.hide())}else o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e});return r||(t.tagToButton[(o.tag||e).toLowerCase()]=e),l},buildSubBtn:function(e){var t=this,n=t.o.prefix,o=t.btnsDef[e],r=null==o.hasIcon||o.hasIcon;return o.key&&(t.keys[o.key]={fn:o.fn||e,param:o.param||e}),t.tagToButton[(o.tag||e).toLowerCase()]=e,a("<button/>",{type:"button","class":n+e+"-dropdown-button"+(o.ico?" "+n+o.ico+"-button":""),html:t.hasSvg&&r?'<svg><use xlink:href="'+t.svgPath+"#"+n+(o.ico||e).replace(/([A-Z]+)/g,"-$1").toLowerCase()+'"/></svg>'+(o.text||o.title||t.lang[e]||e):o.text||o.title||t.lang[e]||e,title:o.key?" (Ctrl + "+o.key+")":null,style:o.style||null,mousedown:function(){return a("body",t.doc).trigger("mousedown"),t.execCmd(o.fn||e,o.param||e,o.forceCss),!1}})},isSupportedBtn:function(e){try{return this.btnsDef[e].isSupported()}catch(t){}return!0},buildOverlay:function(){var e=this;return e.$overlay=a("<div/>",{"class":e.o.prefix+"overlay"}).appendTo(e.$box),e.$overlay},showOverlay:function(){var e=this;a(t).trigger("scroll"),e.$overlay.fadeIn(200),e.$box.addClass(e.o.prefix+"box-blur")},hideOverlay:function(){var e=this;e.$overlay.fadeOut(50),e.$box.removeClass(e.o.prefix+"box-blur")},fixedBtnPaneEvents:function(){var e=this,n=e.o.fixedFullWidth,o=e.$box;e.o.fixedBtnPane&&(e.isFixed=!1,a(t).on("scroll."+e.eventNamespace+" resize."+e.eventNamespace,function(){if(o){e.syncCode();var r=a(t).scrollTop(),i=o.offset().top+1,s=e.$btnPane,l=s.outerHeight()-2;r-i>0&&r-i-e.height<0?(e.isFixed||(e.isFixed=!0,s.css({position:"fixed",top:0,left:n?"0":"auto",zIndex:7}),a([e.$ta,e.$ed]).css({marginTop:s.height()})),s.css({width:n?"100%":o.width()-1+"px"}),a("."+e.o.prefix+"fixed-top",o).css({position:n?"fixed":"absolute",top:n?l:l+(r-i)+"px",zIndex:15})):e.isFixed&&(e.isFixed=!1,s.removeAttr("style"),a([e.$ta,e.$ed]).css({marginTop:0}),a("."+e.o.prefix+"fixed-top",o).css({position:"absolute",top:l}))}}))},setDisabled:function(e){var t=this,n=t.o.prefix;t.disabled=e,e?t.$ta.attr("disabled",!0):t.$ta.removeAttr("disabled"),t.$box.toggleClass(n+"disabled",e),t.$ed.attr("contenteditable",!e)},destroy:function(){var e=this,n=e.o.prefix;e.isTextarea?e.$box.after(e.$ta.css({height:""}).val(e.html()).removeClass(n+"textarea").show()):e.$box.after(e.$ed.css({height:""}).removeClass(n+"editor").removeAttr("contenteditable").removeAttr("dir").html(e.html()).show()),e.$ed.off("dblclick","img"),e.destroyPlugins(),e.$box.remove(),e.$c.removeData("trumbowyg"),a("body").removeClass(n+"body-fullscreen"),e.$c.trigger("tbwclose"),a(t).off("scroll."+e.eventNamespace+" resize."+e.eventNamespace)},empty:function(){this.$ta.val(""),this.syncCode(!0)},toggle:function(){var e=this,t=e.o.prefix;e.o.autogrowOnEnter&&(e.autogrowOnEnterDontClose=!e.$box.hasClass(t+"editor-hidden")),e.semanticCode(!1,!0),setTimeout(function(){e.doc.activeElement.blur(),e.$box.toggleClass(t+"editor-hidden "+t+"editor-visible"),e.$btnPane.toggleClass(t+"disable"),a("."+t+"viewHTML-button",e.$btnPane).toggleClass(t+"active"),e.$box.hasClass(t+"editor-visible")?e.$ta.attr("tabindex",-1):e.$ta.removeAttr("tabindex"),e.o.autogrowOnEnter&&!e.autogrowOnEnterDontClose&&e.autogrowEditorOnEnter()},0)},dropdown:function(e){var n=this,o=n.doc,r=n.o.prefix,i=a("[data-"+r+"dropdown="+e+"]",n.$box),s=a("."+r+e+"-button",n.$btnPane),l=i.is(":hidden");if(a("body",o).trigger("mousedown"),l){var d=s.offset().left;s.addClass(r+"active"),i.css({position:"absolute",top:s.offset().top-n.$btnPane.offset().top+s.outerHeight(),left:n.o.fixedFullWidth&&n.isFixed?d+"px":d-n.$btnPane.offset().left+"px"}).show(),a(t).trigger("scroll"),a("body",o).on("mousedown."+n.eventNamespace,function(e){i.is(e.target)||(a("."+r+"dropdown",n.$box).hide(),a("."+r+"active",n.$btnPane).removeClass(r+"active"),a("body",o).off("mousedown."+n.eventNamespace))})}},html:function(e){var t=this;return null!=e?(t.$ta.val(e),t.syncCode(!0),t.$c.trigger("tbwchange"),t):t.$ta.val()},syncTextarea:function(){var e=this;e.$ta.val(e.$ed.text().trim().length>0||e.$ed.find("hr,img,embed,iframe,input").length>0?e.$ed.html():"")},syncCode:function(e){var t=this;if(!e&&t.$ed.is(":visible"))t.syncTextarea();else{var n=a("<div>").html(t.$ta.val()),o=a("<div>").append(n);a(t.o.tagsToRemove.join(","),o).remove(),t.$ed.html(o.contents().html())}if(t.o.autogrow&&(t.height=t.$ed.height(),t.height!==t.$ta.css("height")&&(t.$ta.css({height:t.height}),t.$c.trigger("tbwresize"))),t.o.autogrowOnEnter){t.$ed.height("auto");var r=t.autogrowOnEnterWasFocused?t.$ed[0].scrollHeight:t.$ed.css("min-height");r!==t.$ta.css("height")&&(t.$ed.css({height:r}),t.$c.trigger("tbwresize"))}},semanticCode:function(e,t,n){var o=this;if(o.saveRange(),o.syncCode(e),o.o.semantic){if(o.semanticTag("b"),o.semanticTag("i"),o.semanticTag("s"),o.semanticTag("strike"),t){var r=o.o.inlineElementsSelector,i=":not("+r+")";o.$ed.contents().filter(function(){return 3===this.nodeType&&this.nodeValue.trim().length>0}).wrap("<span data-tbw/>");var s=function(e){if(0!==e.length){var t=e.nextUntil(i).addBack().wrapAll("<p/>").parent(),n=t.nextAll(r).first();t.next("br").remove(),s(n)}};s(o.$ed.children(r).first()),o.semanticTag("div",!0),o.$ed.find("p").filter(function(){return(!o.range||this!==o.range.startContainer)&&(0===a(this).text().trim().length&&0===a(this).children().not("br,span").length)}).contents().unwrap(),a("[data-tbw]",o.$ed).contents().unwrap(),o.$ed.find("p:empty").remove()}n||o.restoreRange(),o.syncTextarea()}},semanticTag:function(e,t){var n;if(null!=this.o.semantic&&"object"==typeof this.o.semantic&&this.o.semantic.hasOwnProperty(e))n=this.o.semantic[e];else{if(this.o.semantic!==!0||!this.DEFAULT_SEMANTIC_MAP.hasOwnProperty(e))return;n=this.DEFAULT_SEMANTIC_MAP[e]}a(e,this.$ed).each(function(){var e=a(this);e.wrap("<"+n+"/>"),t&&a.each(e.prop("attributes"),function(){e.parent().attr(this.name,this.value)}),e.contents().unwrap()})},createLink:function(){for(var e,t,n,o=this,r=o.doc.getSelection(),i=r.focusNode,s=(new XMLSerializer).serializeToString(r.getRangeAt(0).cloneContents());["A","DIV"].indexOf(i.nodeName)<0;)i=i.parentNode;if(i&&"A"===i.nodeName){var l=a(i);s=l.text(),e=l.attr("href"),o.o.minimalLinks||(t=l.attr("title"),n=l.attr("target"));var d=o.doc.createRange();d.selectNode(i),r.removeAllRanges(),r.addRange(d)}o.saveRange();var c={url:{label:"URL",required:!0,value:e},text:{label:o.lang.text,value:s}};o.o.minimalLinks||Object.assign(c,{title:{label:o.lang.title,value:t},target:{label:o.lang.target,value:n}}),o.openModalInsert(o.lang.createLink,c,function(e){var t=o.prependUrlPrefix(e.url);if(!t.length)return!1;var n=a(['<a href="',e.url,'">',e.text||e.url,"</a>"].join(""));return o.o.minimalLinks||(e.title.length>0&&n.attr("title",e.title),e.target.length>0&&n.attr("target",e.target)),o.range.deleteContents(),o.range.insertNode(n[0]),o.syncCode(),o.$c.trigger("tbwchange"),!0})},prependUrlPrefix:function(e){var t=this;if(!t.urlPrefix)return e;const n=/^([a-z][-+.a-z0-9]*:|\/|#)/i;if(n.test(e))return e;const a=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;return a.test(e)?"mailto:"+e:t.urlPrefix+e},unlink:function(){var e=this,t=e.doc.getSelection(),n=t.focusNode;if(t.isCollapsed){for(;["A","DIV"].indexOf(n.nodeName)<0;)n=n.parentNode;if(n&&"A"===n.nodeName){var a=e.doc.createRange();a.selectNode(n),t.removeAllRanges(),t.addRange(a)}}e.execCmd("unlink",void 0,void 0,!0)},insertImage:function(){var e=this;e.saveRange();var t={url:{label:"URL",required:!0},alt:{label:e.lang.description,value:e.getRangeText()}};e.o.imageWidthModalEdit&&(t.width={}),e.openModalInsert(e.lang.insertImage,t,function(t){e.execCmd("insertImage",t.url);var n=a('img[src="'+t.url+'"]:not([alt])',e.$box);return n.attr("alt",t.alt),e.o.imageWidthModalEdit&&n.attr({width:t.width}),e.syncCode(),e.$c.trigger("tbwchange"),!0})},fullscreen:function(){var e,n=this,o=n.o.prefix,r=o+"fullscreen";n.$box.toggleClass(r),e=n.$box.hasClass(r),a("body").toggleClass(o+"body-fullscreen",e),a(t).trigger("scroll"),n.$c.trigger("tbw"+(e?"open":"close")+"fullscreen")},execCmd:function(e,t,n,a){var o=this;a=!!a||"","dropdown"!==e&&o.$ed.focus();try{o.doc.execCommand("styleWithCSS",!1,n||!1)}catch(r){}try{o[e+a](t)}catch(r){try{e(t)}catch(i){"insertHorizontalRule"===e?t=void 0:"formatBlock"===e&&o.isIE&&(t="<"+t+">"),o.doc.execCommand(e,!1,t),o.syncCode(),o.semanticCode(!1,!0)}"dropdown"!==e&&(o.updateButtonPaneStatus(),o.$c.trigger("tbwchange"))}},openModal:function(e,n){var i=this,s=i.o.prefix;if(a("."+s+"modal-box",i.$box).length>0)return!1;i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!0),i.saveRange(),i.showOverlay(),i.$btnPane.addClass(s+"disable");var l=a("<div/>",{"class":s+"modal "+s+"fixed-top"}).css({top:i.$btnPane.height()}).appendTo(i.$box);i.$overlay.one("click",function(){return l.trigger(r),!1});var d=a("<form/>",{action:"",html:n}).on("submit",function(){return l.trigger(o),!1}).on("reset",function(){return l.trigger(r),!1}).on("submit reset",function(){i.o.autogrowOnEnter&&(i.autogrowOnEnterDontClose=!1)}),c=a("<div/>",{"class":s+"modal-box",html:d}).css({top:"-"+i.$btnPane.outerHeight()+"px",opacity:0}).appendTo(l).animate({top:0,opacity:1},100);return a("<span/>",{text:e,"class":s+"modal-title"}).prependTo(c),l.height(c.outerHeight()+10),a("input:first",c).focus(),i.buildModalBtn("submit",c),i.buildModalBtn("reset",c),a(t).trigger("scroll"),l},buildModalBtn:function(e,t){var n=this,o=n.o.prefix;return a("<button/>",{"class":o+"modal-button "+o+"modal-"+e,type:e,text:n.lang[e]||e}).appendTo(a("form",t))},closeModal:function(){var e=this,t=e.o.prefix;e.$btnPane.removeClass(t+"disable"),e.$overlay.off();var n=a("."+t+"modal-box",e.$box);n.animate({top:"-"+n.height()},100,function(){n.parent().remove(),e.hideOverlay()}),e.restoreRange()},openModalInsert:function(e,t,n){var i=this,s=i.o.prefix,l=i.lang,d="";return a.each(t,function(e,t){var n=t.label||e,a=t.name||e,o=t.attributes||{},r=Object.keys(o).map(function(e){return e+'="'+o[e]+'"'}).join(" ");d+='<label><input type="'+(t.type||"text")+'" name="'+a+'"'+("checkbox"===t.type&&t.value?' checked="checked"':' value="'+(t.value||"").replace(/"/g,"&quot;"))+'"'+r+'><span class="'+s+'input-infos"><span>'+(l[n]?l[n]:n)+"</span></span></label>"}),i.openModal(e,d).on(o,function(){var e=a("form",a(this)),r=!0,s={};a.each(t,function(t,n){var o=n.name||t,l=a('input[name="'+o+'"]',e),d=l.attr("type");switch(d.toLowerCase()){case"checkbox":s[o]=l.is(":checked");break;case"radio":s[o]=l.filter(":checked").val();break;default:s[o]=a.trim(l.val())}n.required&&""===s[o]?(r=!1,i.addErrorOnModalField(l,i.lang.required)):n.pattern&&!n.pattern.test(s[o])&&(r=!1,i.addErrorOnModalField(l,n.patternError))}),r&&(i.restoreRange(),n(s,t)&&(i.syncCode(),i.$c.trigger("tbwchange"),i.closeModal(),a(this).off(o)))}).one(r,function(){a(this).off(o),i.closeModal()})},addErrorOnModalField:function(e,t){var n=this.o.prefix,o=e.parent();e.on("change keyup",function(){o.removeClass(n+"input-error")}),o.addClass(n+"input-error").find("input+span").append(a("<span/>",{"class":n+"msg-error",text:t}))},getDefaultImgDblClickHandler:function(){var e=this;return function(){var t=a(this),n=t.attr("src"),o="(Base64)";0===n.indexOf("data:image")&&(n=o);var r={url:{label:"URL",value:n,required:!0},alt:{label:e.lang.description,value:t.attr("alt")}};return e.o.imageWidthModalEdit&&(r.width={value:t.attr("width")?t.attr("width"):""}),e.openModalInsert(e.lang.insertImage,r,function(n){return n.src!==o&&t.attr({src:n.url}),t.attr({alt:n.alt}),e.o.imageWidthModalEdit&&(parseInt(n.width)>0?t.attr({width:n.width}):t.removeAttr("width")),!0}),!1}},saveRange:function(){var e=this,t=e.doc.getSelection();if(e.range=null,t.rangeCount){var n,a=e.range=t.getRangeAt(0),o=e.doc.createRange();o.selectNodeContents(e.$ed[0]),o.setEnd(a.startContainer,a.startOffset),n=(o+"").length,e.metaRange={start:n,end:n+(a+"").length}}},restoreRange:function(){var e,t=this,n=t.metaRange,a=t.range,o=t.doc.getSelection();if(a){if(n&&n.start!==n.end){var r,i=0,s=[t.$ed[0]],l=!1,d=!1;for(e=t.doc.createRange();!d&&(r=s.pop());)if(3===r.nodeType){var c=i+r.length;!l&&n.start>=i&&n.start<=c&&(e.setStart(r,n.start-i),l=!0),l&&n.end>=i&&n.end<=c&&(e.setEnd(r,n.end-i),d=!0),i=c}else for(var u=r.childNodes,g=u.length;g>0;)g-=1,s.push(u[g])}o.removeAllRanges(),o.addRange(e||a)}},getRangeText:function(){return this.range+""},updateButtonPaneStatus:function(){var e=this,t=e.o.prefix,n=e.getTagsRecursive(e.doc.getSelection().focusNode),o=t+"active-button "+t+"active";a("."+t+"active-button",e.$btnPane).removeClass(o),a.each(n,function(n,r){var i=e.tagToButton[r.toLowerCase()],s=a("."+t+i+"-button",e.$btnPane);if(s.length>0)s.addClass(o);else try{s=a("."+t+"dropdown ."+t+i+"-dropdown-button",e.$box);var l=s.parent().data("dropdown");a("."+t+l+"-button",e.$box).addClass(o)}catch(d){}})},getTagsRecursive:function(e,t){var n=this;if(t=t||(e&&e.tagName?[e.tagName]:[]),!e||!e.parentNode)return t;e=e.parentNode;var o=e.tagName;return"DIV"===o?t:("P"===o&&""!==e.style.textAlign&&t.push(e.style.textAlign),a.each(n.tagHandlers,function(a,o){t=t.concat(o(e,n))}),t.push(o),n.getTagsRecursive(e,t).filter(function(e){return null!=e}))},initPlugins:function(){var e=this;e.loadedPlugins=[],a.each(a.trumbowyg.plugins,function(t,n){n.shouldInit&&!n.shouldInit(e)||(n.init(e),n.tagHandler&&e.tagHandlers.push(n.tagHandler),e.loadedPlugins.push(n))})},destroyPlugins:function(){a.each(this.loadedPlugins,function(e,t){t.destroy&&t.destroy()})}}}(navigator,window,document,jQuery); ;window.Openrat={}; ;Openrat.View=function(e,t,i,r){this.action=e;this.method=t;this.id=i;this.params=r;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};function n(e){Openrat.Workbench.afterViewLoadedHandler.fire(e);let f=$(e).data('afterViewLoaded');if(f instanceof Function)f(e)};this.loadView=function(){let url=Openrat.View.createUrl(this.action,this.method,this.id,this.params,!1);let element=this.element;let view=this;let loadViewHtmlPromise=$.ajax(url);$(this.element).addClass('loader');loadViewHtmlPromise.done(function(e,t){if(!e)e='';$(element).html(e).removeClass('loader');$(element).find('form').each(function(){let form=new Openrat.Form();form.close=function(){view.close()};form.initOnElement(this)});n(element)});loadViewHtmlPromise.fail(function(e,t,i){$(element).html('');Openrat.Workbench.notify('','','error','Server Error',['Server Error while requesting url '+url,t])});let apiUrl=Openrat.View.createUrl(this.action,this.method,this.id,this.params,!0);loadViewHtmlPromise.done(function(){})};Openrat.View.createUrl=function(e,subaction,i,extraid={},api=!1){let url='./';if(api)url+='api/';url+='?';if(e)url+='&action='+e;if(subaction)url+='&subaction='+subaction;if(i)url+='&id='+i;if(typeof extraid==='string'){extraid=extraid.replace(/'/g,'"');let extraObject=jQuery.parseJSON(extraid);jQuery.each(extraObject,function(e,t){url=url+'&'+e+'='+t})} else if(typeof extraid==='object'){jQuery.each(extraid,function(e,t){url=url+'&'+e+'='+t})} diff --git a/modules/template_engine/components/html/checkbox/Checkbox.class.php b/modules/template_engine/components/html/checkbox/Checkbox.class.php @@ -31,7 +31,7 @@ class CheckboxComponent extends Component else $condition = '@$'.PHPBlockElement::value($this->name); - $checkbox->addConditionalAttribute('checked', $condition, '1'); + $checkbox->addConditionalAttribute('checked', $condition, 'checked'); if ( $this->required ) $checkbox->addAttribute( 'required','required'); diff --git a/modules/template_engine/components/html/radio/Radio.class.php b/modules/template_engine/components/html/radio/Radio.class.php @@ -4,6 +4,7 @@ namespace template_engine\components; use template_engine\components\html\FieldComponent; use template_engine\element\CMSElement; +use template_engine\element\PHPBlockElement; use template_engine\element\Value; use template_engine\element\ValueExpression; @@ -41,7 +42,11 @@ class RadioComponent extends FieldComponent if ($this->readonly) $radio->addAttribute('disabled','disabled'); $radio->addAttribute('value',$this->value); - $radio->addAttribute('checked',Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->name)); + + $condition = '@$'.PHPBlockElement::value($this->name).'==\''.$this->value.'\''; + $radio->addConditionalAttribute('checked', $condition, 'checked'); + + //$radio->addAttribute('checked',Value::createExpression(ValueExpression::TYPE_DATA_VAR,$this->name)); if ( $this->readonly && $this->required ) { $hidden = (new CMSElement('input'))->addAttribute('type','hidden')->addAttribute('name',$this->name)->addAttribute('value','1'); diff --git a/modules/util/Macro.class.php b/modules/util/Macro.class.php @@ -17,6 +17,8 @@ // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. namespace util; +use cms\generator\PageContext; +use cms\model\BaseObject; use cms\model\Page; use cms\model\Project; use util\Session; @@ -32,13 +34,22 @@ use util\Session; class Macro { /** + * @var PageContext + */ + protected $pageContext; + + /** * @var Page + * @deprecated use getPage() */ protected $page; - public function setContextPage(&$page) - { - $this->page = $page; + /** + * @param $pageContext PageContext + */ + public function setPageContext( $pageContext) { + $this->pageContext = $pageContext; + $this->page = new Page( $pageContext->objectId ); } /** @@ -65,7 +76,7 @@ class Macro */ protected function getObjectId() { - return $this->page->objectid; + return $this->pageContext->objectId; } @@ -75,7 +86,10 @@ class Macro */ protected function getPage() { - return $this->page; + $page = new Page($this->pageContext->objectId); + $page->load(); + + return $page; } @@ -85,7 +99,7 @@ class Macro */ protected function &getObject() { - return $this->page; + return new Page( $this->pageContext->objectId ); } @@ -94,7 +108,10 @@ class Macro */ protected function getRootObjectId() { - $project = new Project($this->page->projectid); + $page = new Page( $this->pageContext->objectId ); + $page->load(); + $project = $page->getProject(); +; return $project->getRootObjectId(); } @@ -156,12 +173,15 @@ class Macro * @param Object * @return string */ - public function pathToObject($obj) + public function pathToObject($targetObject) { - if (is_object($obj)) - return $this->page->path_to_object($obj->objectid); - else - return $this->page->path_to_object($obj); + if (is_numeric($targetObject)) + $targetObject = new BaseObject( $targetObject ); + + $targetObject->load(); + $linkFormat = $this->pageContext->getLinkScheme(); + + return $linkFormat->linkToObject( new Page( $this->pageContext->sourceObjectId), $targetObject ); } } \ No newline at end of file diff --git a/modules/util/Transformer.class.php b/modules/util/Transformer.class.php @@ -23,8 +23,12 @@ class Transformer var $doc; var $page; var $element; + /** + * @var \cms\generator\PageContext + */ + public $pageContext; - function transform() + function transform() { $this->parseDocument(); $this->renderDocument(); @@ -50,6 +54,7 @@ class Transformer $this->doc->element = $this->element; $this->doc->parse($zeilen); $this->doc->page = $this->page; + $this->doc->pageContext = $this->pageContext; } @@ -73,7 +78,10 @@ class Transformer // Das Dokument-Objekt hat keine Information ueber die aktuelle Seite, // daher werden die Links auf Objekte hier gesetzt. foreach ($linkedObjectIds as $objectId) { - $targetPath = $this->page->path_to_object($objectId); + $linkFormat = $this->pageContext->getLinkScheme(); + $target = new BaseObject($objectId); + $target->load(); + $targetPath = $linkFormat->linkToObject( $this->page, $target ); // Hack: Sonderzeichen muessen in URLs maskiert werden, aber nur bei URLs die aus Link-Objekten kommen, bei allem // anderen (insbesondere Preview-Links zu andereen Seiten) darf die Umsetzung nicht erfolgen. @@ -101,4 +109,3 @@ class Transformer } } -?>- \ No newline at end of file diff --git a/modules/util/cache/Cache.class.php b/modules/util/cache/Cache.class.php @@ -0,0 +1,40 @@ +<?php + +namespace util\cache; + + +/** + * Cache. + */ +interface Cache +{ + public function invalidateIfOlderThan($lastModified); + + /** + * Invalidates a cache entry. + */ + public function invalidate(); + + /** + * Get the content. Loads the value if nessecary. + */ + public function get(); + + /** + * Loads the content. + * @return $this + */ + public function load(); + + /** + * Refreshes the cache. + * @return $this + */ + public function refresh(); + + /** + * Getting only the filename of the cache. + * @return string + */ + public function getFilename(); +}+ \ No newline at end of file diff --git a/modules/util/cache/FileCache.class.php b/modules/util/cache/FileCache.class.php @@ -6,13 +6,12 @@ use util\FileUtils; /** - * Simple Cache for caching of generated content. - * - * @package util + * File-based cache. */ -class FileCache +class FileCache implements Cache { - /** + const CACHE_FILENAME_PREFIX = 'openrat-cache'; + /** * @var Callable */ private $loader; @@ -30,14 +29,14 @@ class FileCache */ public function __construct( $key, $loader, $lastModified = 0 ) { - $filename = FileUtils::getTempDir() . '/'. 'openrat-cache'; - - if ( is_array($key)) - foreach ($key as $a => $w) - $filename .= '.' . $a .'-'. $w; - else - $filename .= strval($key); - + if ( !is_array($key)) + $key = [ $key ]; + $key = array_merge([ db()->id ], $key); + + $filename = FileUtils::getTempDir() . '/'. self::CACHE_FILENAME_PREFIX; + $filename .= array_reduce($key,function($carry,$item){ + return $carry.'-'.$item; + }); $filename .= '.tmp'; $this->filename = $filename; @@ -69,7 +68,7 @@ class FileCache /** - * Get the content. + * Get the content. Loads the value if nessecary. */ public function get() { @@ -89,9 +88,23 @@ class FileCache if ( ! is_file($this->filename)) { file_put_contents($this->filename,call_user_func($this->loader) ); } + + return $this; } + /** + * Refreshes the cache. + * @return $this + */ + public function refresh() { + + file_put_contents($this->filename,call_user_func($this->loader) ); + + return $this; + } + + public function getFilename() { return $this->filename; } diff --git a/modules/wikiparser/model/DocumentElement.class.php b/modules/wikiparser/model/DocumentElement.class.php @@ -30,7 +30,12 @@ class DocumentElement extends AbstractElement var $encodeHtml = false; - /** + /** + * @var \cms\generator\PageContext + */ + public $pageContext; + + /** * Ein Text wird geparst.<br> * <br> * Zerlegt den Text zeilenweise und erzeugt die Unterobjekte.<br> @@ -90,6 +95,7 @@ class DocumentElement extends AbstractElement $renderer = new $rendererClass(); $renderer->children = $this->children; $renderer->page = $this->page; + $renderer->pageContext = $this->pageContext; $renderer->linkedObjectIds = $this->linkedObjectIds; $renderer->encodeHtml = $this->encodeHtml; diff --git a/modules/wikiparser/renderer/HtmlRenderer.class.php b/modules/wikiparser/renderer/HtmlRenderer.class.php @@ -2,6 +2,7 @@ namespace wikiparser\renderer; +use cms\generator\PageContext; use cms\model\File; use cms\model\Image; use cms\model\BaseObject; @@ -52,6 +53,11 @@ class HtmlRenderer public $page; /** + * @var PageContext + */ + public $pageContext; + + /** * @var array */ public $children; @@ -221,7 +227,7 @@ class HtmlRenderer $runner = new MacroRunner(); try { - $val .= $runner->executeMacro($className, $child->attributes, $this->page); + $val .= $runner->executeMacro($className, $child->attributes, $this->page,$this->pageContext); } catch (Exception $e) { throw new GeneratorException('Could not execute the macro '.$className,$e); }