commit b9cb0e03dd728bb37c89503ce9794980f304feef
parent 877b6b901a316d0e3f7a229ec37c9f4efeb77a57
Author: Jan Dankert <develop@jandankert.de>
Date: Sat, 24 Aug 2019 01:30:30 +0200
Nach der Abmeldung alle View neu laden.
Diffstat:
13 files changed, 407 insertions(+), 343 deletions(-)
diff --git a/modules/cms-core/action/LoginAction.class.php b/modules/cms-core/action/LoginAction.class.php
@@ -903,7 +903,7 @@ class LoginAction extends Action
// Anmeldung deaktiviert werden.
// Bestehendes Login-Token aus dem Cookie lesen und aus der Datenbank löschen.
- list( $selector,$token ) = array_pad( explode('.',$_COOKIE['or_token']),2,'');
+ list( $selector,$token ) = array_pad( explode('.',@$_COOKIE['or_token']),2,'');
if ( $selector )
$this->currentUser->deleteLoginToken( $selector );
@@ -911,7 +911,8 @@ class LoginAction extends Action
// Cookie mit Logintoken löschen.
$this->setCookie('or_token' ,null );
- session_unset();
+ //session_unset();
+ Session::setUser(null);
// Umleiten auf eine definierte URL.s
$redirect_url = @$conf['security']['logout']['redirect_url'];
@@ -924,7 +925,10 @@ class LoginAction extends Action
// Style zurücksetzen.
// Der Style des Benutzers koennte auch stehen bleiben. Aber dann gäbe es Rückschlüsse darauf, wer zuletzt angemeldet war (Sicherheit!).
$this->setStyle( config('interface','style','default') );
- }
+
+ $this->addNotice('user',$user->name,'LOGOUT_OK',OR_NOTICE_OK);
+
+ }
diff --git a/modules/cms-core/action/TreeAction.class.php b/modules/cms-core/action/TreeAction.class.php
@@ -1,308 +1,308 @@
-<?php
-
-namespace cms\action;
-
-use cms\model\BaseObject;
-use cms\model\Element;
-use cms\model\Template;
-use Tree;
-use cms\model\Language;
-use cms\model\Model;
-
-use Session;
-
-// OpenRat Content Management System
-// Copyright (C) 2002 Jan Dankert, jandankert@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.
-
-/**
- * Action-Klasse zum Laden/Anzeigen des Navigations-Baumes
- * @author $Author$
- * @version $Revision$
- * @package openrat.actions
- */
-
-class TreeAction extends Action
-{
- public $security = Action::SECURITY_USER;
-
- public function __construct()
- {
- parent::__construct();
- }
-
- /**
- * Anzeigen des Baumes fuer asynchrone Anfragen.
- */
- public function loadBranchView()
- {
-
- $type = $this->getRequestVar('type');
-
- $branch = $this->loadTreeBranch( $type );
-
- $this->setTemplateVar( 'branch',$branch );
- }
-
-
-
- private function loadTreeBranch( $type )
- {
- $tree = new Tree();
-
- try
- {
- $method = new \ReflectionMethod($tree,$type);
- if ( $this->hasRequestVar('id'))
- $method->invoke($tree, $this->getRequestVar('id') );
- else
- $method->invoke($tree); // <== Executing the Action
- }
- catch (\ReflectionException $re)
- {
- throw new \LogicException('Treemethod not found: '.$type);
- }
-
-
- $branch = array();
- foreach($tree->treeElements as $element )
- {
- $branch[] = get_object_vars($element);
- }
-
- return $branch;
- }
-
-
- /**
- * Initialer Aufbau des Navigationsbaums.
- */
- public function treeView()
- {
- $branch = $this->loadTreeBranch( 'root' );
-
- foreach( $branch as $k=>$b )
- {
- if ( !empty($b['type']) )
- $branch[$k]['children'] = $this->loadTreeBranch( $b['type'] );
- else
- $branch[$k]['children'] = array();
- }
-
- $this->outputTreeBranch( $branch );
-
- //$this->setTemplateVar( 'branch',$branch );
-
- }
-
-
- /**
- * The path to an object.
- */
- public function pathView() {
-
- $type = $this->getRequestVar('type');
- $id = $this->getRequestId();
-
- $result = $this->calculatePath( $type, $id );
-
- $this->setTemplateVar('path' ,$result );
-
- $this->setTemplateVar('actual',array(
- 'type'=>$this->typeToInternal($type),
- 'id'=>$id)
- );
- }
-
-
- /**
- * The path to an object.
- */
- private function calculatePath($type, $id) {
-
- switch( $type ) {
-
- case 'projectlist':
- return array();
-
- case 'project':
- return array(
- array('type'=>'projects','id'=>0)
- );
- case 'folder':
- case 'link' :
- case 'url' :
- case 'page' :
- case 'file' :
- case 'image' :
- $o = new BaseObject( $id );
- $o->load();
-
- $result= array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$o->projectid),
- );
-
- $parents = array_keys( $o->parentObjectFileNames(true) );
- foreach( $parents as $pid )
- $result[] = array('type'=>'folder' ,'id'=>$pid );
- return $result;
-
- case 'pageelement' :
- $pe = new PageelementAction( $id );
- $pe->init();
- $p = $pe->page;
- $p->load();
-
- $result= array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$p->projectid),
- );
-
- $parents = array_keys( $p->parentObjectFileNames(true ) );
- foreach( $parents as $pid )
- $result[] = array('type'=>'folder' ,'id'=>$pid );
- $result[] = array('type'=>'page' ,'id'=>$id );
- return $result;
-
- case 'userlist':
- return array(
- array('type'=>'userandgroups','id'=>0)
- );
- case 'user':
- return array(
- array('type'=>'userandgroups','id'=>0),
- array('type'=>'users' ,'id'=>0)
- );
- case 'grouplist':
- return array(
- array('type'=>'userandgroups','id'=>0)
- );
- case 'group':
- return array(
- array('type'=>'userandgroups','id'=>0),
- array('type'=>'groups' ,'id'=>0)
- );
-
- case 'templatelist':
- case 'languagelist':
- case 'modellist':
- return array(
- array('type'=>'projects','id'=>0 ),
- array('type'=>'project' ,'id'=>$id)
- );
-
- case 'template':
- $t = new Template( $id );
- $t->load();
-
- return array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$t->projectid),
- array('type'=>'templates' ,'id'=>$t->projectid)
- );
-
- case 'element':
- $e = new Element( $id );
- $e->load();
- $t = new Template( $e->templateid );
- $t->load();
-
- return array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$t->projectid),
- array('type'=>'templates' ,'id'=>$t->projectid),
- array('type'=>'template' ,'id'=>$t->templateid)
- );
-
- case 'language':
- $l = new Language( $id );
- $l->load();
-
- return array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$l->projectid),
- array('type'=>'languages','id'=>$l->projectid)
- );
-
- case 'model':
- $m = new Model( $id );
- $m->load();
-
- return array(
- array('type'=>'projects' ,'id'=>0 ),
- array('type'=>'project' ,'id'=>$m->projectid),
- array('type'=>'models' ,'id'=>$m->projectid)
- );
-
- default:
- throw new \InvalidArgumentException('Unknown type: '.$type);
- }
- }
-
-
-
- private function outputTreeBranch($branch )
- {
- $json = new \JSON();
- echo '<ul class="or-navtree-list">';
-
- foreach( $branch as $b )
- {
- $hasChildren = isset($b['children']) && !empty($b['children']);
-
- echo '<li class="or-navtree-node or-navtree-node--'.($hasChildren?'is-open':'is-closed').' or-draggable" data-id="'.$b['internalId'].'" data-type="'.$b['type'].'" data-extra="'.str_replace('"',"'",$json->encode($b['extraId'])).'"><div class="or-navtree-node-control"><i class="tree-icon image-icon image-icon--node-'.($hasChildren?'open':'closed').'"></i></div><div class="clickable"><a href="./?action='.$b['type'].'&id='.$b['internalId'].'" class="entry" data-extra="'.str_replace('"',"'",$json->encode($b['extraId'])).'" data-id="'.$b['internalId'].'" data-action="'.$b['action'].'" data-type="open" title="'.$b['description'].'"><i class="image-icon image-icon--action-'.$b['icon'].'" ></i> '.$b['text'].'</a></div>';
-
- if ($hasChildren)
- {
- $this->outputTreeBranch($b['children']);
- }
-
- echo '</li>';
- }
-
- echo '</ul>';
- }
-
- private function typeToInternal($type)
- {
- switch( $type) {
-
- case 'userlist':
- return 'users';
-
- case 'grouplist':
- return 'groups';
-
- case 'templatelist':
- return 'templates';
-
- case 'languagelist':
- return 'languages';
-
- case 'modellist':
- return 'models';
-
- default:
- return $type;
- }
-
- }
-
-
-}
-
+<?php
+
+namespace cms\action;
+
+use cms\model\BaseObject;
+use cms\model\Element;
+use cms\model\Template;
+use Tree;
+use cms\model\Language;
+use cms\model\Model;
+
+use Session;
+
+// OpenRat Content Management System
+// Copyright (C) 2002 Jan Dankert, jandankert@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.
+
+/**
+ * Action-Klasse zum Laden/Anzeigen des Navigations-Baumes
+ * @author $Author$
+ * @version $Revision$
+ * @package openrat.actions
+ */
+
+class TreeAction extends Action
+{
+ public $security = Action::SECURITY_GUEST;
+
+ public function __construct()
+ {
+ parent::__construct();
+ }
+
+ /**
+ * Anzeigen des Baumes fuer asynchrone Anfragen.
+ */
+ public function loadBranchView()
+ {
+
+ $type = $this->getRequestVar('type');
+
+ $branch = $this->loadTreeBranch( $type );
+
+ $this->setTemplateVar( 'branch',$branch );
+ }
+
+
+
+ private function loadTreeBranch( $type )
+ {
+ $tree = new Tree();
+
+ try
+ {
+ $method = new \ReflectionMethod($tree,$type);
+ if ( $this->hasRequestVar('id'))
+ $method->invoke($tree, $this->getRequestVar('id') );
+ else
+ $method->invoke($tree); // <== Executing the Action
+ }
+ catch (\ReflectionException $re)
+ {
+ throw new \LogicException('Treemethod not found: '.$type);
+ }
+
+
+ $branch = array();
+ foreach($tree->treeElements as $element )
+ {
+ $branch[] = get_object_vars($element);
+ }
+
+ return $branch;
+ }
+
+
+ /**
+ * Initialer Aufbau des Navigationsbaums.
+ */
+ public function treeView()
+ {
+ $branch = $this->loadTreeBranch( 'root' );
+
+ foreach( $branch as $k=>$b )
+ {
+ if ( !empty($b['type']) )
+ $branch[$k]['children'] = $this->loadTreeBranch( $b['type'] );
+ else
+ $branch[$k]['children'] = array();
+ }
+
+ $this->outputTreeBranch( $branch );
+
+ //$this->setTemplateVar( 'branch',$branch );
+
+ }
+
+
+ /**
+ * The path to an object.
+ */
+ public function pathView() {
+
+ $type = $this->getRequestVar('type');
+ $id = $this->getRequestId();
+
+ $result = $this->calculatePath( $type, $id );
+
+ $this->setTemplateVar('path' ,$result );
+
+ $this->setTemplateVar('actual',array(
+ 'type'=>$this->typeToInternal($type),
+ 'id'=>$id)
+ );
+ }
+
+
+ /**
+ * The path to an object.
+ */
+ private function calculatePath($type, $id) {
+
+ switch( $type ) {
+
+ case 'projectlist':
+ return array();
+
+ case 'project':
+ return array(
+ array('type'=>'projects','id'=>0)
+ );
+ case 'folder':
+ case 'link' :
+ case 'url' :
+ case 'page' :
+ case 'file' :
+ case 'image' :
+ $o = new BaseObject( $id );
+ $o->load();
+
+ $result= array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$o->projectid),
+ );
+
+ $parents = array_keys( $o->parentObjectFileNames(true) );
+ foreach( $parents as $pid )
+ $result[] = array('type'=>'folder' ,'id'=>$pid );
+ return $result;
+
+ case 'pageelement' :
+ $pe = new PageelementAction( $id );
+ $pe->init();
+ $p = $pe->page;
+ $p->load();
+
+ $result= array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$p->projectid),
+ );
+
+ $parents = array_keys( $p->parentObjectFileNames(true ) );
+ foreach( $parents as $pid )
+ $result[] = array('type'=>'folder' ,'id'=>$pid );
+ $result[] = array('type'=>'page' ,'id'=>$id );
+ return $result;
+
+ case 'userlist':
+ return array(
+ array('type'=>'userandgroups','id'=>0)
+ );
+ case 'user':
+ return array(
+ array('type'=>'userandgroups','id'=>0),
+ array('type'=>'users' ,'id'=>0)
+ );
+ case 'grouplist':
+ return array(
+ array('type'=>'userandgroups','id'=>0)
+ );
+ case 'group':
+ return array(
+ array('type'=>'userandgroups','id'=>0),
+ array('type'=>'groups' ,'id'=>0)
+ );
+
+ case 'templatelist':
+ case 'languagelist':
+ case 'modellist':
+ return array(
+ array('type'=>'projects','id'=>0 ),
+ array('type'=>'project' ,'id'=>$id)
+ );
+
+ case 'template':
+ $t = new Template( $id );
+ $t->load();
+
+ return array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$t->projectid),
+ array('type'=>'templates' ,'id'=>$t->projectid)
+ );
+
+ case 'element':
+ $e = new Element( $id );
+ $e->load();
+ $t = new Template( $e->templateid );
+ $t->load();
+
+ return array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$t->projectid),
+ array('type'=>'templates' ,'id'=>$t->projectid),
+ array('type'=>'template' ,'id'=>$t->templateid)
+ );
+
+ case 'language':
+ $l = new Language( $id );
+ $l->load();
+
+ return array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$l->projectid),
+ array('type'=>'languages','id'=>$l->projectid)
+ );
+
+ case 'model':
+ $m = new Model( $id );
+ $m->load();
+
+ return array(
+ array('type'=>'projects' ,'id'=>0 ),
+ array('type'=>'project' ,'id'=>$m->projectid),
+ array('type'=>'models' ,'id'=>$m->projectid)
+ );
+
+ default:
+ throw new \InvalidArgumentException('Unknown type: '.$type);
+ }
+ }
+
+
+
+ private function outputTreeBranch($branch )
+ {
+ $json = new \JSON();
+ echo '<ul class="or-navtree-list">';
+
+ foreach( $branch as $b )
+ {
+ $hasChildren = isset($b['children']) && !empty($b['children']);
+
+ echo '<li class="or-navtree-node or-navtree-node--'.($hasChildren?'is-open':'is-closed').' or-draggable" data-id="'.$b['internalId'].'" data-type="'.$b['type'].'" data-extra="'.str_replace('"',"'",$json->encode($b['extraId'])).'"><div class="or-navtree-node-control"><i class="tree-icon image-icon image-icon--node-'.($hasChildren?'open':'closed').'"></i></div><div class="clickable"><a href="./?action='.$b['type'].'&id='.$b['internalId'].'" class="entry" data-extra="'.str_replace('"',"'",$json->encode($b['extraId'])).'" data-id="'.$b['internalId'].'" data-action="'.$b['action'].'" data-type="open" title="'.$b['description'].'"><i class="image-icon image-icon--action-'.$b['icon'].'" ></i> '.$b['text'].'</a></div>';
+
+ if ($hasChildren)
+ {
+ $this->outputTreeBranch($b['children']);
+ }
+
+ echo '</li>';
+ }
+
+ echo '</ul>';
+ }
+
+ private function typeToInternal($type)
+ {
+ switch( $type) {
+
+ case 'userlist':
+ return 'users';
+
+ case 'grouplist':
+ return 'groups';
+
+ case 'templatelist':
+ return 'templates';
+
+ case 'languagelist':
+ return 'languages';
+
+ case 'modellist':
+ return 'models';
+
+ default:
+ return $type;
+ }
+
+ }
+
+
+}
+
?>
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/production/combined.min.js b/modules/cms-ui/themes/default/production/combined.min.js
@@ -10987,11 +10987,11 @@ jQuery.trumbowyg={langs:{en:{viewHTML:"View HTML",undo:"Undo",redo:"Redo",format
/* ./modules//template-engine/components/html/column/column.min.js */;$(document).on('orViewLoaded',function(o,n){});
/* ./modules//template-engine/components/html/image/image.min.js */;
/* ./modules//template-engine/components/html/group/group.min.js */;$(document).on('orViewLoaded',function(e,o){registerOpenClose($(e.target).find('fieldset.toggle-open-close'))});
-/* ./modules//template-engine/components/html/form/form.min.js */;function doResponse(e,t,r){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){if($(r).data('async')=='true')notifyBrowser(e.text);notify(e.type,e.name,e.status,e.text,e.log);if(e.status=='ok'){if($(r).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(r).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')};$(document).trigger('orDataChanged')}
-else{}});$.each(e['errors'],function(t,e){$('input[name='+e+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect};
+/* ./modules//template-engine/components/html/form/form.min.js */;function doResponse(e,s,a){if(s!='success'){alert('Server error: '+s);return};$.each(e['notices'],function(s,e){if($(a).data('async')=='true')notifyBrowser(e.text);notify(e.type,e.name,e.status,e.text,e.log);if(e.status=='ok'){if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')};let afterSuccess=$(a).data('afterSuccess');if(afterSuccess){if(afterSuccess=='reloadAll'){Workbench.reloadAll()}};$(document).trigger('orDataChanged')}
+else{}});$.each(e['errors'],function(s,e){$('input[name='+e+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect};
/* ./modules//template-engine/components/html/upload/upload.min.js */;$(document).on('orViewLoaded',function(e,n){var a=$(e.target).find('form'),o=$(e.target).find('div.or-dropzone-upload > div.input');o.on('dragenter',function(e){e.stopPropagation();e.preventDefault();$(this).css('border','1px dotted gray')});o.on('dragover',function(e){e.stopPropagation();e.preventDefault()});o.on('drop',function(e){$(this).css('border','1px dotted red');e.preventDefault();var n=e.originalEvent.dataTransfer.files;handleFileUpload(a,n)});$(e.target).find('input[type=file]').change(function(){var e=$(this).prop('files');handleFileUpload(a,e)})});function handleFileUpload(e,o){for(var t=0,r;r=o[t];t++){var n=new FormData();n.append('file',r);n.append('action','folder');n.append('subaction',$(e).data('method'));n.append('output','json');n.append('token',$(e).find('input[name=token]').val());n.append('id',$(e).find('input[name=id]').val());var a=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(a);$(a).show();$.ajax({'type':'POST',url:'./api/',cache:!1,contentType:!1,processData:!1,data:n,success:function(n,o,t){$(a).remove();doResponse(n,o,e)},error:function(n,o,d){$(e).closest('div.content').removeClass('loader');$(a).remove();var r;try{var t=jQuery.parseJSON(n.responseText);r=t.error+'/'+t.description+': '+t.reason}catch(i){r=n.responseText};notify('error',r)}})}};
/* ./modules//template-engine/components/html/tree/tree.min.js */;$(document).on('orViewLoaded',function(o,n){});
-/* ./modules/cms-ui/themes/default/script/openrat.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();loadTree();registerNavigation();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('#noticebar .notice .image-icon--menu-close').click(function(){$(this).closest('.notice').fadeOut('fast',function(){$(this).remove()})});$('#noticebar .notice').each(function(){let noticeToClose=this;setTimeout(function(){$(noticeToClose).fadeOut('slow',function(){$(this).remove()})},30*1000)});registerOpenClose($('section.toggle-open-close'));$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Workbench.loadNewActionIntoElement(e)})});function initActualHistoryState(){var e={};e.name=window.document.title;var t=new URLSearchParams(window.location.search);if(t.has('action')){e.action=t.get('action');e.id=t.get('id');e.name=window.document.title;e.data={};var t=Array.from(t.entries());for(var i in t){e.data[t[i][0]]=t[i][1]};Navigator.toActualHistory(e);filterMenus(e.action,e.id,e.data)}};function registerNavigation(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Workbench.state.id+'&type='+Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected')}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var o={action:e,method:t,id:i,data:n};this.navigateToNew(o)};this.toActualHistory=function(e){window.history.replaceState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.state=e;Workbench.loadNewAction(e.action,e.id,e.data);$(document).trigger('orNewAction')};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),n=$('#editor').attr('data-extra'),o=e.data('method');let view=new View(t,o,i,n);view.start(e)}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)})};function loadView(e,t,i,n,o){Navigator.navigateToNewAction(t,i,n,o)};function afterViewLoaded(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,i,n){var o=$(e).parent();$(o).find('input[type=text]').attr('value',t);$(o).find('input[type=hidden]').attr('value',n)}})});registerDragAndDrop(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){setUserStyle(this.value)})};function registerDragAndDrop(e){registerDraggable(e);registerDroppable(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;$(this).find('.or-selector-link-value').val(dropped.data('id'));$(this).find('.or-selector-link-name').val(dropped.data('id'))}})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html(' ');doResponse(e,i,t)}})};function Form(){this.setLoadStatus=function(e){$(this.element).closest('div.content').toggleClass('loader',e)};this.initOnElement=function(e){this.element=e;let form=this;$(e).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){form.submit()});$(e).find('.or-form-btn--cancel').click(function(){form.cancel()});$(e).find('.or-form-btn--reset').click(function(){form.rollback()});$(e).submit(function(e){if($(this).data('target')=='view'){form.submit();e.preventDefault()}})};this.cancel=function(){this.close()};this.rollback=function(){this.element.trigger('reset')};this.close=function(){};this.submit=function(){let status=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(status);$(status).show();$(this.element).find('.error').removeClass('error');var t=$(this.element).serializeArray(),e={};$(t).each(function(t,i){e[i.name]=i.value});if(!e.id)e.id=Workbench.state.id;if(!e.action)e.action=Workbench.state.action;let formMethod=$(this.element).attr('method').toUpperCase();if(formMethod=='GET'){this.forwardTo(e.action,e.subaction,e.id,e)}
+/* ./modules/cms-ui/themes/default/script/openrat.min.js */;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();loadTree();registerNavigation();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('#noticebar .notice .image-icon--menu-close').click(function(){$(this).closest('.notice').fadeOut('fast',function(){$(this).remove()})});$('#noticebar .notice').each(function(){let noticeToClose=this;setTimeout(function(){$(noticeToClose).fadeOut('slow',function(){$(this).remove()})},30*1000)});registerOpenClose($('section.toggle-open-close'));$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Workbench.loadNewActionIntoElement(e)})});function initActualHistoryState(){var e={};e.name=window.document.title;var t=new URLSearchParams(window.location.search);if(t.has('action')){e.action=t.get('action');e.id=t.get('id');e.name=window.document.title;e.data={};var t=Array.from(t.entries());for(var i in t){e.data[t[i][0]]=t[i][1]};Navigator.toActualHistory(e);filterMenus(e.action,e.id,e.data)}};function registerNavigation(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Workbench.state.id+'&type='+Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected')}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var o={action:e,method:t,id:i,data:n};this.navigateToNew(o)};this.toActualHistory=function(e){window.history.replaceState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.state=e;Workbench.loadNewAction(e.action,e.id,e.data);$(document).trigger('orNewAction')};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();Workbench.loadViews($('#workbench section.open .view-loader'));filterMenus(e,t,i)};this.reloadAll=function(){$('#workbench .view').empty();Workbench.loadViews($('#workbench .view'));registerHeaderEvents()};this.loadViews=function(e){e.each(function(e){let $targetDOMElement=$(this);Workbench.loadNewActionIntoElement($targetDOMElement)})};this.loadNewActionIntoElement=function(e){let action;if(e.is('.view-static'))action=e.attr('data-action');else action=$('#editor').attr('data-action');let id=$('#editor').attr('data-id');let params=$('#editor').attr('data-extra');let method=e.data('method');let view=new View(action,method,id,params);view.start(e)}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)})};function loadView(e,t,i,n,o){Navigator.navigateToNewAction(t,i,n,o)};function afterViewLoaded(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,i,n){var o=$(e).parent();$(o).find('input[type=text]').attr('value',t);$(o).find('input[type=hidden]').attr('value',n)}})});registerDragAndDrop(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){setUserStyle(this.value)})};function registerDragAndDrop(e){registerDraggable(e);registerDroppable(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;$(this).find('.or-selector-link-value').val(dropped.data('id'));$(this).find('.or-selector-link-name').val(dropped.data('id'))}})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html(' ');doResponse(e,i,t)}})};function Form(){this.setLoadStatus=function(e){$(this.element).closest('div.content').toggleClass('loader',e)};this.initOnElement=function(e){this.element=e;let form=this;$(e).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){form.submit()});$(e).find('.or-form-btn--cancel').click(function(){form.cancel()});$(e).find('.or-form-btn--reset').click(function(){form.rollback()});$(e).submit(function(e){if($(this).data('target')=='view'){form.submit();e.preventDefault()}})};this.cancel=function(){this.close()};this.rollback=function(){this.element.trigger('reset')};this.close=function(){};this.submit=function(){let status=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(status);$(status).show();$(this.element).find('.error').removeClass('error');var t=$(this.element).serializeArray(),e={};$(t).each(function(t,i){e[i.name]=i.value});if(!e.id)e.id=Workbench.state.id;if(!e.action)e.action=Workbench.state.action;let formMethod=$(this.element).attr('method').toUpperCase();if(formMethod=='GET'){this.forwardTo(e.action,e.subaction,e.id,e)}
else{let url='./api/';this.setLoadStatus(!0);url+='';e.output='json';if($(this.element).data('async')||$(this.element).data('async')=='true'){this.close()};let form=this;$.ajax({'type':'POST',url:url,data:e,success:function(e,t,i){form.setLoadStatus(!1);$(status).remove();doResponse(e,t,form)},error:function(e,t,i){form.setLoadStatus(!1);$(status).remove();try{let error=jQuery.parseJSON(e.responseText);notify('','','error',error.error,[error.description])}catch(n){let msg=e.responseText;notify('','','error','Server Error',[msg])}}});$(form.element).fadeIn()}}};function View(e,t,i,n){this.action=e;this.method=t;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};this.loadView=function(){let url=createUrl(this.action,this.method,this.id,this.params,!0);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(url,function(e,t,i){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Form();form.close=function(){view.close()};form.initOnElement(this)});if(t=='error'){$(element).html('');notify('','','error','Server Error',['Server Error while requesting url '+url,e]);return};afterViewLoaded(element)})}};function startDialog(e,t,i,n,o){if(!t)t=$('#editor').attr('data-action');if(!n)n=$('#editor').attr('data-id');let view=new View(t,i,n,o);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+e+'</div>');$('#dialog > .view').data('id',n);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function startEdit(e,t,i,n,o){if(!t)t=Workbench.state.action;if(!n)n=Workbench.state.id;let view=new View(t,i,n,o);view.before=function(){let view=this;$edit=$('#edit');$edit.addClass('is-open');$('#editor').addClass('is-closed');$('#edit .filler').click(function(){view.close()})};view.close=function(){$edit.removeClass('is-open');$('#editor').removeClass('is-closed')};view.start($('#edit > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,i,n){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,n)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return}
else if(Notification.permission==='granted'){let notification=new Notification(e)}
else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){let notification=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),o=r.text;r.text=t+o+i;r=document.selection.createRange();if(o.length==0){r.move('character',-i.length)}
@@ -11000,4 +11000,4 @@ else if(typeof n.selectionStart!='undefined'){var s=n.selectionStart,l=n.selecti
else{a=s+t.length+o.length+i.length};n.selectionStart=a;n.selectionEnd=a}
else{a=n.value.length;var o=prompt('Text');n.value=n.value.substr(0,a)+t+o+i+n.value.substr(a)}};function createUrl(e,t,i,n,a){var o='./';o+='?_='+e;if(i)o+='-'+i;if(t!=null)o+='&subaction='+t;if(a)o+='&embed=1';if(typeof n==='string'){n=n.replace(/'/g,'"');var r=jQuery.parseJSON(n);jQuery.each(r,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;o=o+'&'+e+'='+t})}
else if(typeof n==='object'){jQuery.each(n,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;o=o+'&'+e+'='+t})}
-else{};return o};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),o=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+o+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t,i,n,log=[]){let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);if(t)$(notice).append('<div class="name"><i class="or-action-full image-icon image-icon--action-'+e+'"></i> '+t+'</div>');$(notice).append('<div class="text">'+htmlEntities(n)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};function htmlEntities(e){return String(e).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};-
\ No newline at end of file
+else{};return o};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),o=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+o+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t,i,n,log=[]){let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);id=0;if(t)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+e+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+e+'"></i> '+t+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(n)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};function htmlEntities(e){return String(e).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};+
\ No newline at end of file
diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js
@@ -234,29 +234,54 @@ var Workbench = new function()
// View in geschlossenen Sektionen löschen, damit diese nicht stehen bleiben.
$('#workbench section.closed .view-loader').empty();
- $('#workbench section.open .view-loader').each( function(idx) {
+ Workbench.loadViews( $('#workbench section.open .view-loader') );
- var targetDOMElement = $(this);
+ filterMenus(action, id, params);
- Workbench.loadNewActionIntoElement(targetDOMElement)
- });
+ }
- filterMenus(action, id, params);
+ this.reloadAll = function() {
+
+ // View in geschlossenen Sektionen löschen, damit diese nicht stehen bleiben.
+ $('#workbench .view').empty();
+
+ Workbench.loadViews( $('#workbench .view') );
+
+ registerHeaderEvents();
+ }
+
+
+
+ this.loadViews = function( $views )
+ {
+
+ $views.each(function (idx) {
+
+ let $targetDOMElement = $(this);
+
+ Workbench.loadNewActionIntoElement( $targetDOMElement )
+ });
}
- this.loadNewActionIntoElement = function(targetDOMElement) {
- var action = $('#editor').attr('data-action');
- var id = $('#editor').attr('data-id' );
- var params = $('#editor').attr('data-extra' );
+ this.loadNewActionIntoElement = function( $viewElement )
+ {
+ let action;
+ if ( $viewElement.is('.view-static') )
+ // Static views have always the same action.
+ action = $viewElement.attr('data-action');
+ else
+ action = $('#editor').attr('data-action');
+
+ let id = $('#editor').attr('data-id' );
+ let params = $('#editor').attr('data-extra' );
- var method = targetDOMElement.data('method');
+ let method = $viewElement.data('method');
- //Workbench.loadViewIntoElement(targetDOMElement,action,method,id,params)
let view = new View( action,method,id,params );
- view.start( targetDOMElement );
+ view.start( $viewElement );
}
@@ -1170,8 +1195,9 @@ function notify( type,name,status,msg,log=[] )
$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');
$(notice).append(toolbar);
+ id = 0; // TODO
if (name)
- $(notice).append('<div class="name"><i class="or-action-full image-icon image-icon--action-'+type+'"></i> '+name+'</div>');
+ $(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+type+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+type+'"></i> '+name+'</a></div>');
$(notice).append( '<div class="text">'+htmlEntities(msg)+'</div>');
@@ -1185,6 +1211,7 @@ function notify( type,name,status,msg,log=[] )
}
$('#noticebar').prepend(notice); // Notice anhängen.
+ $(notice).orLinkify(); // Enable links
// Toogle Fullscreen for notice
diff --git a/modules/cms-ui/themes/default/script/openrat.min.js b/modules/cms-ui/themes/default/script/openrat.min.js
@@ -1,4 +1,4 @@
-;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();loadTree();registerNavigation();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('#noticebar .notice .image-icon--menu-close').click(function(){$(this).closest('.notice').fadeOut('fast',function(){$(this).remove()})});$('#noticebar .notice').each(function(){let noticeToClose=this;setTimeout(function(){$(noticeToClose).fadeOut('slow',function(){$(this).remove()})},30*1000)});registerOpenClose($('section.toggle-open-close'));$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Workbench.loadNewActionIntoElement(e)})});function initActualHistoryState(){var e={};e.name=window.document.title;var t=new URLSearchParams(window.location.search);if(t.has('action')){e.action=t.get('action');e.id=t.get('id');e.name=window.document.title;e.data={};var t=Array.from(t.entries());for(var i in t){e.data[t[i][0]]=t[i][1]};Navigator.toActualHistory(e);filterMenus(e.action,e.id,e.data)}};function registerNavigation(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Workbench.state.id+'&type='+Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected')}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var o={action:e,method:t,id:i,data:n};this.navigateToNew(o)};this.toActualHistory=function(e){window.history.replaceState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.state=e;Workbench.loadNewAction(e.action,e.id,e.data);$(document).trigger('orNewAction')};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();$('#workbench section.open .view-loader').each(function(e){var t=$(this);Workbench.loadNewActionIntoElement(t)});filterMenus(e,t,i)};this.loadNewActionIntoElement=function(e){var t=$('#editor').attr('data-action'),i=$('#editor').attr('data-id'),n=$('#editor').attr('data-extra'),o=e.data('method');let view=new View(t,o,i,n);view.start(e)}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)})};function loadView(e,t,i,n,o){Navigator.navigateToNewAction(t,i,n,o)};function afterViewLoaded(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,i,n){var o=$(e).parent();$(o).find('input[type=text]').attr('value',t);$(o).find('input[type=hidden]').attr('value',n)}})});registerDragAndDrop(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){setUserStyle(this.value)})};function registerDragAndDrop(e){registerDraggable(e);registerDroppable(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;$(this).find('.or-selector-link-value').val(dropped.data('id'));$(this).find('.or-selector-link-name').val(dropped.data('id'))}})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html(' ');doResponse(e,i,t)}})};function Form(){this.setLoadStatus=function(e){$(this.element).closest('div.content').toggleClass('loader',e)};this.initOnElement=function(e){this.element=e;let form=this;$(e).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){form.submit()});$(e).find('.or-form-btn--cancel').click(function(){form.cancel()});$(e).find('.or-form-btn--reset').click(function(){form.rollback()});$(e).submit(function(e){if($(this).data('target')=='view'){form.submit();e.preventDefault()}})};this.cancel=function(){this.close()};this.rollback=function(){this.element.trigger('reset')};this.close=function(){};this.submit=function(){let status=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(status);$(status).show();$(this.element).find('.error').removeClass('error');var t=$(this.element).serializeArray(),e={};$(t).each(function(t,i){e[i.name]=i.value});if(!e.id)e.id=Workbench.state.id;if(!e.action)e.action=Workbench.state.action;let formMethod=$(this.element).attr('method').toUpperCase();if(formMethod=='GET'){this.forwardTo(e.action,e.subaction,e.id,e)}
+;var OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(e){afterViewLoaded(this)});window.onpopstate=function(e){Navigator.navigateTo(e.state)};initActualHistoryState();Workbench.initialize();loadTree();registerNavigation();$('.keystroke').each(function(){let keystrokeElement=$(this);let keystroke=keystrokeElement.text();if(keystroke.length==0)return;let keyaction=function(){keystrokeElement.click()};$(document).bind('keydown',keystroke,keyaction)});$('#noticebar .notice .image-icon--menu-close').click(function(){$(this).closest('.notice').fadeOut('fast',function(){$(this).remove()})});$('#noticebar .notice').each(function(){let noticeToClose=this;setTimeout(function(){$(noticeToClose).fadeOut('slow',function(){$(this).remove()})},30*1000)});registerOpenClose($('section.toggle-open-close'));$('section.toggle-open-close .on-click-open-close').click(function(){var t=$(this).closest('section');if(t.hasClass('disabled'))return;var e=t.find('div.view-loader');if(e.children().length==0)Workbench.loadNewActionIntoElement(e)})});function initActualHistoryState(){var e={};e.name=window.document.title;var t=new URLSearchParams(window.location.search);if(t.has('action')){e.action=t.get('action');e.id=t.get('id');e.name=window.document.title;e.data={};var t=Array.from(t.entries());for(var i in t){e.data[t[i][0]]=t[i][1]};Navigator.toActualHistory(e);filterMenus(e.action,e.id,e.data)}};function registerNavigation(){$(document).on('orNewAction',function(e,t){let url='./api/?action=tree&subaction=path&id='+Workbench.state.id+'&type='+Workbench.state.action+'&output=json';$.getJSON(url,function(e){$('nav .or-navtree-node').removeClass('or-navtree-node--selected');let output=e['output'];$.each(output.path,function(e,t){$nav=$('nav .or-navtree-node[data-type='+t.type+'][data-id='+t.id+'].or-navtree-node--is-closed .or-navtree-node-control');$nav.click()});if(output.actual)$('nav .or-navtree-node[data-type='+output.actual.type+'][data-id='+output.actual.id+']').addClass('or-navtree-node--selected')}).fail(function(e){console.warn(e);console.warn('failed to load path from '+url)}).always(function(){})})};var Navigator=new function(){'use strict';this.navigateTo=function(e){Workbench.loadNewActionState(e)};this.navigateToNew=function(e){Workbench.loadNewActionState(e);window.history.pushState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))};this.navigateToNewAction=function(e,t,i,n){var o={action:e,method:t,id:i,data:n};this.navigateToNew(o)};this.toActualHistory=function(e){window.history.replaceState(e,e.name,createUrl(e.action,null,e.id,e.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var e=function(){$.ajax(createUrl('title','ping',0))},t=5;window.setInterval(e,t*60*1000)};this.loadNewActionState=function(e){Workbench.state=e;Workbench.loadNewAction(e.action,e.id,e.data);$(document).trigger('orNewAction')};this.loadNewAction=function(e,t,i){$('#editor').attr('data-action',e);$('#editor').attr('data-id',t);$('#editor').attr('data-extra',JSON.stringify(i));$('#workbench section.closed .view-loader').empty();Workbench.loadViews($('#workbench section.open .view-loader'));filterMenus(e,t,i)};this.reloadAll=function(){$('#workbench .view').empty();Workbench.loadViews($('#workbench .view'));registerHeaderEvents()};this.loadViews=function(e){e.each(function(e){let $targetDOMElement=$(this);Workbench.loadNewActionIntoElement($targetDOMElement)})};this.loadNewActionIntoElement=function(e){let action;if(e.is('.view-static'))action=e.attr('data-action');else action=$('#editor').attr('data-action');let id=$('#editor').attr('data-id');let params=$('#editor').attr('data-extra');let method=e.data('method');let view=new View(action,method,id,params);view.start(e)}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)})};function loadView(e,t,i,n,o){Navigator.navigateToNewAction(t,i,n,o)};function afterViewLoaded(e){var t=$(e).closest('section');t.toggleClass('is-empty',$(e).is(':empty'));$(e).trigger('orViewLoaded');$(e).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(e).find('.toggle-nav-open-close').click(function(){$('nav').toggleClass('open')});$(e).find('.toggle-nav-small').click(function(){$('nav').toggleClass('small')});$(e).find('div.headermenu > a').each(function(e,t){});$(e).find('div.header > a.back').each(function(t,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(e).closest('div.panel').find('div.header div.dropdown').first())});$(e).find('div.selector.tree').each(function(){var e=this;$(this).orTree({type:'project',selectable:$(e).attr('data-types').split(','),id:$(e).attr('data-init-folderid'),onSelect:function(t,i,n){var o=$(e).parent();$(o).find('input[type=text]').attr('value',t);$(o).find('input[type=hidden]').attr('value',n)}})});registerDragAndDrop(e);$(e).find('input').change(function(){$(this).parent('div.view').addClass('dirty')});$(e).find('.or-theme-chooser').change(function(){setUserStyle(this.value)})};function registerDragAndDrop(e){registerDraggable(e);registerDroppable(e)};function registerDraggable(e){$(e).find('.or-draggable').draggable({helper:'clone',opacity:0.7,zIndex:2,distance:10,cursor:'move',revert:'false'})};function registerTreeBranchEvents(e){registerDraggable(e)};function registerDroppable(e){$(e).find('.or-droppable').droppable({accept:'.or-draggable',hoverClass:'or-droppable--hover',activeClass:'or-droppable--active',drop:function(e,t){let dropped=t.draggable;$(this).find('.or-selector-link-value').val(dropped.data('id'));$(this).find('.or-selector-link-name').val(dropped.data('id'))}})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parents('.or-menu').removeClass('open')});$('#title .toolbar-icon.menu').click(function(e){e.stopPropagation();$(this).parents('.or-menu').toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parents('.or-menu').find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(e){$(e).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('.or-navtree .or-navtree-node').orTree()};function submitUrl(e,t){postUrl(t,e)};function postUrl(e,t){e+='&output=json';$.ajax({'type':'POST',url:e,data:{},success:function(e,i,n){$('div.panel div.status div.loader').html(' ');doResponse(e,i,t)}})};function Form(){this.setLoadStatus=function(e){$(this.element).closest('div.content').toggleClass('loader',e)};this.initOnElement=function(e){this.element=e;let form=this;$(e).find('form[data-autosave="true"] input[type="checkbox"]').click(function(){form.submit()});$(e).find('.or-form-btn--cancel').click(function(){form.cancel()});$(e).find('.or-form-btn--reset').click(function(){form.rollback()});$(e).submit(function(e){if($(this).data('target')=='view'){form.submit();e.preventDefault()}})};this.cancel=function(){this.close()};this.rollback=function(){this.element.trigger('reset')};this.close=function(){};this.submit=function(){let status=$('<div class="notice info"><div class="text loader"></div></div>');$('#noticebar').prepend(status);$(status).show();$(this.element).find('.error').removeClass('error');var t=$(this.element).serializeArray(),e={};$(t).each(function(t,i){e[i.name]=i.value});if(!e.id)e.id=Workbench.state.id;if(!e.action)e.action=Workbench.state.action;let formMethod=$(this.element).attr('method').toUpperCase();if(formMethod=='GET'){this.forwardTo(e.action,e.subaction,e.id,e)}
else{let url='./api/';this.setLoadStatus(!0);url+='';e.output='json';if($(this.element).data('async')||$(this.element).data('async')=='true'){this.close()};let form=this;$.ajax({'type':'POST',url:url,data:e,success:function(e,t,i){form.setLoadStatus(!1);$(status).remove();doResponse(e,t,form)},error:function(e,t,i){form.setLoadStatus(!1);$(status).remove();try{let error=jQuery.parseJSON(e.responseText);notify('','','error',error.error,[error.description])}catch(n){let msg=e.responseText;notify('','','error','Server Error',[msg])}}});$(form.element).fadeIn()}}};function View(e,t,i,n){this.action=e;this.method=t;this.id=i;this.params=n;this.before=function(){};this.start=function(e){this.before();this.element=e;this.loadView()};this.afterLoad=function(){};this.close=function(){};this.loadView=function(){let url=createUrl(this.action,this.method,this.id,this.params,!0);let element=this.element;let view=this;$(this.element).empty().fadeTo(1,0.7).addClass('loader').html('').load(url,function(e,t,i){$(element).fadeTo(350,1);$(element).removeClass('loader');$(element).find('form').each(function(){let form=new Form();form.close=function(){view.close()};form.initOnElement(this)});if(t=='error'){$(element).html('');notify('','','error','Server Error',['Server Error while requesting url '+url,e]);return};afterViewLoaded(element)})}};function startDialog(e,t,i,n,o){if(!t)t=$('#editor').attr('data-action');if(!n)n=$('#editor').attr('data-id');let view=new View(t,i,n,o);view.before=function(){$('#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+e+'</div>');$('#dialog > .view').data('id',n);$('#dialog').removeClass('is-closed').addClass('is-open');let view=this;this.escapeKeyClosingHandler=function(e){if(e.keyCode==27){view.close();$(document).off('keyup')}};$(document).keyup(this.escapeKeyClosingHandler);$('#dialog .filler').click(function(){view.close()})};view.close=function(){if($('div#dialog').hasClass('modal'))return;$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed');$(document).unbind('keyup',this.escapeKeyClosingHandler)};view.start($('div#dialog > .view'))};function startEdit(e,t,i,n,o){if(!t)t=Workbench.state.action;if(!n)n=Workbench.state.id;let view=new View(t,i,n,o);view.before=function(){let view=this;$edit=$('#edit');$edit.addClass('is-open');$('#editor').addClass('is-closed');$('#edit .filler').click(function(){view.close()})};view.close=function(){$edit.removeClass('is-open');$('#editor').removeClass('is-closed')};view.start($('#edit > .view'))};function setTitle(e){if(e)$('head > title').text(e+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(e,t,i,n){$('nav').removeClass('open');setTitle(e);setNewAction(t,i,n)};function filterMenus(e,t,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+e).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',e);$('div.clickable.filtered a').attr('data-id',t);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(e,t,i){Navigator.navigateToNewAction(e,'edit',t,i)};function setNewId(e){};function notifyBrowser(e){if(!('Notification' in window)){return}
else if(Notification.permission==='granted'){let notification=new Notification(e)}
else if(Notification.permission!=='denied'){Notification.requestPermission(function(t){if(t==='granted'){let notification=new Notification(e)}})}};function setUserStyle(e){var t=$('html'),i=t.attr('class').split(/\s+/);$.each(i,function(e,i){if(i.startsWith('theme-')){t.removeClass(i)}});t.addClass('theme-'+e.toLowerCase())};function insert(e,t,i){var n=document.forms[0].elements[e];n.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),o=r.text;r.text=t+o+i;r=document.selection.createRange();if(o.length==0){r.move('character',-i.length)}
@@ -7,4 +7,4 @@ else if(typeof n.selectionStart!='undefined'){var s=n.selectionStart,l=n.selecti
else{a=s+t.length+o.length+i.length};n.selectionStart=a;n.selectionEnd=a}
else{a=n.value.length;var o=prompt('Text');n.value=n.value.substr(0,a)+t+o+i+n.value.substr(a)}};function createUrl(e,t,i,n,a){var o='./';o+='?_='+e;if(i)o+='-'+i;if(t!=null)o+='&subaction='+t;if(a)o+='&embed=1';if(typeof n==='string'){n=n.replace(/'/g,'"');var r=jQuery.parseJSON(n);jQuery.each(r,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;o=o+'&'+e+'='+t})}
else if(typeof n==='object'){jQuery.each(n,function(e,t){if(e=='action'||e=='subaction'||e=='id')return;o=o+'&'+e+'='+t})}
-else{};return o};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),o=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+o+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t,i,n,log=[]){let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);if(t)$(notice).append('<div class="name"><i class="or-action-full image-icon image-icon--action-'+e+'"></i> '+t+'</div>');$(notice).append('<div class="text">'+htmlEntities(n)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};function htmlEntities(e){return String(e).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};-
\ No newline at end of file
+else{};return o};function resizeWorkbenchContainer(e){};function resizeWorkbench(){};function resizeTabs(e){};function help(e,t,i){var n=$(e).closest('div.panel').find('li.action.active').attr('data-action'),o=$(e).closest('div.panel').find('li.action.active').attr('data-method');window.open(t+n+'/'+o+i,'OpenRat_Help','location=no,menubar=no,scrollbars=yes,toolbar=no,resizable=yes')};function notify(e,t,i,n,log=[]){let notice=$('<div class="notice '+i+'"></div>');let toolbar=$('<div class="or-notice-toolbar"></div>');if(log.length)$(toolbar).append('<i class="or-action-full image-icon image-icon--menu-fullscreen"></i>');$(toolbar).append('<i class="or-action-close image-icon image-icon--menu-close"></i>');$(notice).append(toolbar);id=0;if(t)$(notice).append('<div class="name clickable"><a href="" data-type="open" data-action="'+e+'" data-id="'+id+'"><i class="or-action-full image-icon image-icon--action-'+e+'"></i> '+t+'</a></div>');$(notice).append('<div class="text">'+htmlEntities(n)+'</div>');if(log.length){let logLi=log.reduce((result,item)=>{result+='<li><pre>'+htmlEntities(item)+'</pre></li>';return result},'');$(notice).append('<div class="log"><ul>'+logLi+'</ul></div>')};$('#noticebar').prepend(notice);$(notice).orLinkify();$(notice).find('.or-action-full').click(function(){$(notice).toggleClass('full')});$(notice).find('.or-action-close').click(function(){$(notice).fadeOut('fast',function(){$(notice).remove()})});let timeout=1;if(i=='ok')timeout=20;if(i=='info')timeout=60;if(i=='warning')timeout=120;if(i=='error')timeout=120;if(timeout>0)setTimeout(function(){$(notice).fadeOut('slow',function(){$(this).remove()})},timeout*1000)};function htmlEntities(e){return String(e).replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/"/g,'"')};function registerOpenClose(e){$(e).children('.on-click-open-close').click(function(){$(this).closest('.toggle-open-close').toggleClass('open closed')})};+
\ No newline at end of file
diff --git a/modules/configuration/Configuration.class.php b/modules/configuration/Configuration.class.php
@@ -79,6 +79,8 @@ class Config
/**
+ * Gets the configuration value for this key.
+ *
* @param $name
* @param null $default
* @return mixed|null
@@ -102,6 +104,8 @@ class Config
/**
+ * Is the Config key present?
+ *
* @param $name
* @return bool
*/
@@ -112,8 +116,10 @@ class Config
/**
+ * Is the boolean Value true?
+ *
* @param $name
- * @param bool $default
+ * @param bool $default false
* @return bool
*/
public function is( $name, $default = false )
@@ -126,6 +132,8 @@ class Config
/**
+ * The configuration entries as an array.
+ *
* @return array
*/
public function getConfig() {
diff --git a/modules/template-engine/components/XSDGenerator.php b/modules/template-engine/components/XSDGenerator.php
@@ -13,6 +13,8 @@ require('html/HtmlComponent.class.php');
require('html/FieldComponent.class.php');
header('Content-Type: text/plain');
+echo "XSD Generator\n\n";
+
$folder = FileUtils::readDir(__DIR__ . '/html');
$componentsFile = @fopen(__DIR__ . '/components.ini', 'w');
@@ -31,7 +33,7 @@ foreach ($folder as $f) {
if (!is_file($filename))
continue;
- echo 'Working on: ' . $f . "\n";
+ echo 'Working on component: ' . $f . "\n";
fwrite($componentsFile, $f . " = \n");
fwrite($xsdFile, '<xsd:element name="' . $f . '" type="' . $f . 'Type" /><xsd:complexType name="' . $f . 'Type">');
@@ -69,4 +71,6 @@ foreach ($folder as $f) {
fwrite($xsdFile, '</xsd:schema>');
fclose($xsdFile);
-fclose($componentsFile);-
\ No newline at end of file
+fclose($componentsFile);
+
+echo "Finished.\n";+
\ No newline at end of file
diff --git a/modules/template-engine/components/html/form/Form.class.php b/modules/template-engine/components/html/form/Form.class.php
@@ -21,7 +21,6 @@ class FormComponent extends Component
public $label;
public $cancel = true;
-
public $readonly = false;
/**
@@ -39,6 +38,8 @@ class FormComponent extends Component
public $type = '';
+ public $afterSuccess;
+
protected function begin()
{
if (empty($this->label))
@@ -67,7 +68,11 @@ class FormComponent extends Component
echo ' class="or-form ' . $this->htmlvalue($this->action) . '"';
echo ' data-async="' . $this->htmlvalue($this->async) . '"';
echo ' data-autosave="' . $this->htmlvalue($this->autosave) . '"';
- echo '>';
+
+ if ( $this->afterSuccess )
+ echo ' data-after-success="' . $this->htmlvalue($this->afterSuccess) . '"';
+
+ echo '>';
// Enable Submit on Enter - no need for...we have a submit button at the end.
// echo '<input type="submit" class="invisible" />';
diff --git a/modules/template-engine/components/html/form/form.js b/modules/template-engine/components/html/form/form.js
@@ -45,7 +45,16 @@ function doResponse(data,status,element)
$(element).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty');
}
- $(document).trigger('orDataChanged');
+ let afterSuccess = $(element).data('afterSuccess');
+ if ( afterSuccess )
+ {
+ if ( afterSuccess == 'reloadAll' )
+ {
+ Workbench.reloadAll();
+ }
+ }
+
+ $(document).trigger('orDataChanged');
}
else
// Server liefert Fehler zurück.
diff --git a/modules/template-engine/components/html/form/form.min.js b/modules/template-engine/components/html/form/form.min.js
@@ -1,2 +1,2 @@
-;function doResponse(e,t,r){if(t!='success'){alert('Server error: '+t);return};$.each(e['notices'],function(t,e){if($(r).data('async')=='true')notifyBrowser(e.text);notify(e.type,e.name,e.status,e.text,e.log);if(e.status=='ok'){if($(r).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(r).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')};$(document).trigger('orDataChanged')}
-else{}});$.each(e['errors'],function(t,e){$('input[name='+e+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect};-
\ No newline at end of file
+;function doResponse(e,s,a){if(s!='success'){alert('Server error: '+s);return};$.each(e['notices'],function(s,e){if($(a).data('async')=='true')notifyBrowser(e.text);notify(e.type,e.name,e.status,e.text,e.log);if(e.status=='ok'){if($(a).data('async')!='true'){$('#dialog > .view').html('').hide();$('#dialog').removeClass('is-open').addClass('is-closed');$(a).closest('div.panel').find('div.header ul.views li.action.active').removeClass('dirty')};let afterSuccess=$(a).data('afterSuccess');if(afterSuccess){if(afterSuccess=='reloadAll'){Workbench.reloadAll()}};$(document).trigger('orDataChanged')}
+else{}});$.each(e['errors'],function(s,e){$('input[name='+e+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open')});if(!e.control){};if(e.control.redirect)window.location.href=e.control.redirect};+
\ No newline at end of file
diff --git a/modules/template-engine/components/html/link/Link.class.php b/modules/template-engine/components/html/link/Link.class.php
@@ -62,6 +62,8 @@ class LinkComponent extends Component
public $modal = false;
+ public $afterSuccess;
+
/**
* Link-Beginn
* {@inheritDoc}
@@ -71,9 +73,12 @@ class LinkComponent extends Component
{
echo '<a';
+ if ( $this->afterSuccess )
+ echo ' data-after-success="' . $this->htmlvalue($this->afterSuccess) . '"';
+
if (isset($this->class))
echo ' class="' . $this->htmlvalue($this->class) . '"';
-
+
if (isset($this->title))
echo ' title="' . $this->htmlvalue($this->title) . '"';
diff --git a/modules/template-engine/components/template.xsd b/modules/template-engine/components/template.xsd
@@ -508,6 +508,7 @@
<xsd:attribute name="anchor" type="xsd:string"/>
<xsd:attribute name="frame" type="xsd:string"/>
<xsd:attribute name="modal" type="xsd:boolean"/>
+ <xsd:attribute name="afterSuccess" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="radio" type="radioType"/>
@@ -1826,6 +1827,7 @@
<xsd:attribute name="async" type="xsd:boolean"/>
<xsd:attribute name="autosave" type="xsd:boolean"/>
<xsd:attribute name="type" type="xsd:string"/>
+ <xsd:attribute name="afterSuccess" type="xsd:string"/>
<xsd:attribute name="request" type="xsd:string"/>
</xsd:complexType>
<xsd:element name="upload" type="uploadType"/>
diff --git a/modules/util/Tree.class.php b/modules/util/Tree.class.php
@@ -32,7 +32,7 @@ class Tree
{
// Feststellen, ob der angemeldete Benutzer ein Administrator ist
$user = Session::getUser();
- $this->userIsAdmin = $user->isAdmin;
+ $this->userIsAdmin = isset($user) && $user->isAdmin;
}
public function root()