openrat-cms

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

commit 712cb2264af0a165dad823eb473eaad3209ad12d
parent ad55778676cb1fc269fddb6467560f87d6709045
Author: Jan Dankert <devnull@localhost>
Date:   Thu, 30 Aug 2018 21:57:18 +0200

Notices beim ersten Laden des HTML-Bodys anzeigen.

Diffstat:
modules/cms-ui/UI.class.php | 2+-
modules/cms-ui/action/IndexAction.class.php | 8++++++--
modules/cms-ui/themes/default/script/openrat.js | 7++++++-
modules/cms-ui/themes/default/script/openrat.min.js | 2+-
4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/modules/cms-ui/UI.class.php b/modules/cms-ui/UI.class.php @@ -49,7 +49,6 @@ class UI { $dispatcher = new Dispatcher(); - // Embedded Actions are ALWAYS Queries (means: GET). $request->isAction = true; $dispatcher->request = $request; @@ -60,6 +59,7 @@ class UI // POST-Action has ended, now we want to show the UI. $request->action = 'index'; $request->method = 'show'; + $request->isAction = false; $request->isEmbedded = true; UI::executeAction($request); } diff --git a/modules/cms-ui/action/IndexAction.class.php b/modules/cms-ui/action/IndexAction.class.php @@ -154,11 +154,15 @@ class IndexAction extends Action // Theme base color for smartphones colorizing their status bar. $this->setTemplateVar('themeColor', $this->getColorHexCode($styleConfig['title_background_color'])); - $this->setTemplateVar('notices', array()); + $messageOfTheDay = config('login', 'motd'); + + if ( !empty($messageOfTheDay) ) + $this->addNotice('user','','MOTD',OR_NOTICE_WARN,array('motd',$messageOfTheDay) ); // HTML-Datei direkt einbinden. $vars = $this->getOutputData(); - $output = $vars['output']; // will be extracted in the included template file. + $output = $vars['output']; // will be extracted in the included template file. + $notices = $vars['notices']; // will be extracted in the included template file. require('modules/cms-ui/themes/default/layout/index.php'); exit; diff --git a/modules/cms-ui/themes/default/script/openrat.js b/modules/cms-ui/themes/default/script/openrat.js @@ -6,7 +6,6 @@ var DEFAULT_CONTENT_ACTION = 'edit'; var OR_THEMES_EXT_DIR = 'modules/cms-ui/themes/'; // Execute after DOM ready: -//$( function() $( function() { // JS is available. @@ -49,6 +48,12 @@ $( function() }); + // Per Klick werden die Notices entfernt. + $('#noticebar .notice').fadeIn().click( function() + { + $(this).fadeOut('fast',function() { $(this).remove(); } ); + } ); + }); function initActualHistoryState() { 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 DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(t){registerViewEvents(this)});window.onpopstate=function(t){Navigator.navigateTo(t.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(t){if(t.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}})});function initActualHistoryState(){var t={};t.name=window.document.title;var e=new URLSearchParams(window.location.search);if(e.has('action')){t.action=e.get('action');t.id=e.get('id');t.name=window.document.title;t.data={};var e=Array.from(e.entries());for(var i in e){t.data[e[i][0]]=e[i][1]};Navigator.toActualHistory(t);filterMenus(t.action,t.id,t.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(t){Workbench.loadNewActionState(t)};this.navigateToNew=function(t){Workbench.loadNewActionState(t);window.history.pushState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))};this.navigateToNewAction=function(t,e,i,a){var n={action:t,method:e,id:i,data:a};this.navigateToNew(n)};this.toActualHistory=function(t){window.history.replaceState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var t=function(){$.ajax(createUrl('title','ping',0))},e=5;window.setInterval(t,e*60*1000)};this.loadNewActionState=function(t){Workbench.loadNewAction(t.action,t.id,t.data)};this.loadNewAction=function(t,e,i){$('#editor').attr('data-action',t);$('#editor').attr('data-id',e);$('#workbench .view-loader').each(function(a){var n=$(this),o=n.data('method');Workbench.loadViewIntoElement(n,t,o,e,i)});filterMenus(t,e,i)};this.loadViewIntoElement=function(t,e,i,a,n){var o=createUrl(e,i,a,n,!0);t.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,a){t.fadeTo(350,1);$(t).removeClass('loader');if(i=='error'){$(t).html('');notify('error',e);return};registerViewEvents(t)})}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)});$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} +;var DEFAULT_CONTENT_ACTION='edit',OR_THEMES_EXT_DIR='modules/cms-ui/themes/';$(function(){$('html').removeClass('nojs');$('.initial-hidden').removeClass('initial-hidden');registerHeaderEvents();registerWorkbenchEvents();$('.view').each(function(t){registerViewEvents(this)});window.onpopstate=function(t){Navigator.navigateTo(t.state)};initActualHistoryState();Workbench.initialize();$('#noticebar .notice').click(function(){$(this).fadeOut('fast',function(){$(this).remove()})});loadTree();$(document).keyup(function(t){if(t.keyCode==27){$('#dialog .view').fadeOut('fast').html('');$('#dialog').removeClass('is-open').addClass('is-closed')}});$('#noticebar .notice').fadeIn().click(function(){$(this).fadeOut('fast',function(){$(this).remove()})})});function initActualHistoryState(){var t={};t.name=window.document.title;var e=new URLSearchParams(window.location.search);if(e.has('action')){t.action=e.get('action');t.id=e.get('id');t.name=window.document.title;t.data={};var e=Array.from(e.entries());for(var i in e){t.data[e[i][0]]=e[i][1]};Navigator.toActualHistory(t);filterMenus(t.action,t.id,t.data)}};var Navigator=new function(){'use strict';this.navigateTo=function(t){Workbench.loadNewActionState(t)};this.navigateToNew=function(t){Workbench.loadNewActionState(t);window.history.pushState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))};this.navigateToNewAction=function(t,e,i,a){var n={action:t,method:e,id:i,data:a};this.navigateToNew(n)};this.toActualHistory=function(t){window.history.replaceState(t,t.name,createUrl(t.action,null,t.id,t.data,!1))}},Workbench=new function(){'use strict';this.initialize=function(){this.initializePingTimer()};this.initializePingTimer=function(){var t=function(){$.ajax(createUrl('title','ping',0))},e=5;window.setInterval(t,e*60*1000)};this.loadNewActionState=function(t){Workbench.loadNewAction(t.action,t.id,t.data)};this.loadNewAction=function(t,e,i){$('#editor').attr('data-action',t);$('#editor').attr('data-id',e);$('#workbench .view-loader').each(function(a){var n=$(this),o=n.data('method');Workbench.loadViewIntoElement(n,t,o,e,i)});filterMenus(t,e,i)};this.loadViewIntoElement=function(t,e,i,a,n){var o=createUrl(e,i,a,n,!0);t.empty().fadeTo(1,0.7).addClass('loader').html('').load(o,function(e,i,a){t.fadeTo(350,1);$(t).removeClass('loader');if(i=='error'){$(t).html('');notify('error',e);return};registerViewEvents(t)})}};function registerWorkbenchEvents(){$('div.header').dblclick(function(){fullscreen(this)});$('div#filler').click(function(){if($('div#dialog').hasClass('modal')){} else{$('div#dialog').removeClass('is-open').addClass('is-closed');$('div#dialog > .view').html('')}})};function loadView(t,e,i,a,n){Navigator.navigateToNewAction(e,i,a,n)};function registerViewEvents(t){$(t).trigger('orViewLoaded');$(t).closest('div.panel').find('div.header div.dropdown div.entry.perview').remove();$(t).find('div.headermenu > a').each(function(t,e){});$(t).find('div.header > a.back').each(function(e,i){$(i).removeClass('button').wrap('<div class="entry perview" />').parent().appendTo($(t).closest('div.panel').find('div.header div.dropdown').first())});$(t).find('div.selector.tree').each(function(){var t=this;$(this).orTree({type:'project',selectable:$(t).attr('data-types').split(','),id:$(t).attr('data-init-folderid'),onSelect:function(e,i,a){var n=$(t).parent();$(n).find('input[type=text]').attr('value',e);$(n).find('input[type=hidden]').attr('value',a)}})});$('div.content li.object').draggable({cursor:'move',revert:'invalid'});$('div.content li.object > .entry[data-type=\'folder\']').droppable({accept:'li.object',hoverClass:'drophover',activeClass:'dropactive',drop:function(t,e){var i=e.draggable,a=$(this).parent();startDialog($(this).text(),$(i).attr('data-type'),'copy',$(a).attr('data-id'),{'action':$(i).attr('data-type'),'subaction':'copy','id':$(i).attr('data-id'),'targetFolderId':$(a).attr('data-id')});$(i).detach().css({top:0,left:0}).appendTo(a).click()}});$(t).find('input').change(function(){$('#editor').find('header').addClass('dirty')})};function registerHeaderEvents(){$('body').click(function(){$('.toolbar-icon.menu').parent().removeClass('open')});$('#title .toolbar-icon.menu').click(function(t){t.stopPropagation();$(this).parent().toggleClass('open')});$('#title .toolbar-icon.menu').mouseover(function(){$(this).parent().find('.toolbar-icon.menu').removeClass('open');$(this).addClass('open')});$('#title div.search input').blur(function(){$('div.search input div.dropdown').fadeOut()});$('#title div.search input').orSearch({dropdown:'#title div.search div.dropdown'})};function fullscreen(t){$(t).closest('div.panel').fadeOut('fast',function(){$(this).toggleClass('fullscreen').fadeIn('fast')})};function loadTree(){$('#navigation').html('&nbsp;');$('#navigation').orTree({type:'root',id:0,onSelect:function(t,e,i,a){openNewAction(t,e,i,a)}});$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click();$('#navigation > div.sheet.action-tree.method-tree > ul.tree > div.tree').delay(500).click()};function submitUrl(t,e){postUrl(e,t)};function postUrl(t,e){t+='&output=json';$.ajax({'type':'POST',url:t,data:{},success:function(t,i,a){$('div.panel div.status div.loader').html('&nbsp;');doResponse(t,i,e)}})};function startDialog(t,e,i,a,n){if(!e)e=$('#editor').attr('data-action');a=$('#editor').attr('data-id');$('div#dialog > .view').html('<div class="header"><img class="icon" title="" src="./themes/default/images/icon/'+i+'.png" />'+t+'</div>');$('div#dialog > .view').data('id',a);$('div#dialog').removeClass('is-closed').addClass('is-open');Workbench.loadViewIntoElement($('div#dialog > .view'),e,i,a,n)};function modalView(t,e){var i=$(t).closest('div.panel').find('li.active').attr('data-action'),a=$(t).closest('div.panel').find('li.active').attr('data-method'),n=$(t).closest('div.panel').find('li.active').attr('data-id');$(t).closest('div.content').modal({'overlayClose':'true','xxxonClose':function(){alert('close)')}});loadView($(t).closest('div.content'),i,a,n)};function setTitle(t){if(t)$('head > title').text(t+' - '+$('head > title').data('default'));else $('head > title').text($('head > title').data('default'))};function openNewAction(t,e,i,a){setTitle(t);setNewAction(e,i,a)};function filterMenus(t,e,i){$('div.clickable').addClass('active');$('div.clickable.filtered').removeClass('active').addClass('inactive');$('div.clickable.filtered.on-action-'+t).addClass('active').removeClass('inactive');$('div.clickable.filtered a').attr('data-action',t);$('div.clickable.filtered a').attr('data-id',e);$('div.clickable.filtered a').attr('data-extra',JSON.stringify(i))};function setNewAction(t,e,i){Navigator.navigateToNewAction(t,'edit',e,i)};function setNewId(t){};function notifyBrowser(t){if(!('Notification' in window)){return} else if(Notification.permission==='granted'){var e=new Notification(t)} else if(Notification.permission!=='denied'){Notification.requestPermission(function(e){if(e==='granted'){var i=new Notification(t)}})}};function setUserStyle(t){var e=$('html'),i=e.attr('class').split(/\s+/);$.each(i,function(t,i){if(i.startsWith('theme-')){e.removeClass(i)}});e.addClass('theme-'+t.toLowerCase())};function insert(t,e,i){var a=document.forms[0].elements[t];a.focus();if(typeof document.selection!='undefined'){var r=document.selection.createRange(),n=r.text;r.text=e+n+i;r=document.selection.createRange();if(n.length==0){r.move('character',-i.length)}