diff --git a/application/controllers/ProcessController.php b/application/controllers/ProcessController.php index 25071e5..9f1ed46 100644 --- a/application/controllers/ProcessController.php +++ b/application/controllers/ProcessController.php @@ -242,6 +242,19 @@ class ProcessController extends Controller ) ) ); + + $this->actions()->add( + Link::create( + $this->translate('Fullscreen'), + $this->url()->with('showFullscreen', true), + null, + array( + 'class' => 'icon-resize-full-alt', + 'title' => $this->translate('Switch to fullscreen mode'), + 'data-base-target' => '_main', + ) + ) + ); } protected function simulationForm() diff --git a/library/Businessprocess/Controller.php b/library/Businessprocess/Controller.php index da4b3ed..44da2bb 100644 --- a/library/Businessprocess/Controller.php +++ b/library/Businessprocess/Controller.php @@ -32,7 +32,7 @@ class Controller extends ModuleController private $storage; /** @var bool */ - private $showFullscreen; + protected $showFullscreen; /** @var Url */ private $url; diff --git a/public/css/module.less b/public/css/module.less index 01c0b9d..784db3f 100644 --- a/public/css/module.less +++ b/public/css/module.less @@ -460,6 +460,10 @@ div.knightrider table.bp { .tiles.many { font-size: 0.9em; } } +#layout.fullscreen-layout .controls { + padding: 0 1em; +} + /** END of tiles **/ /** BEGIN breadcrumb **/ diff --git a/public/js/module.js b/public/js/module.js index 09372dd..0504318 100644 --- a/public/js/module.js +++ b/public/js/module.js @@ -22,7 +22,7 @@ * Tell Icinga about our event handlers */ this.module.on('beforerender', this.rememberOpenedBps); - this.module.on('rendered', this.fixOpenedBps); + this.module.on('rendered', this.onRendered); this.module.on('click', 'table.bp.process > tbody > tr:first-child > td > a:last-child', this.processTitleClick); this.module.on('click', 'table.bp > tbody > tr:first-child > th', this.processOperatorClick); @@ -35,6 +35,12 @@ this.module.icinga.logger.debug('BP module loaded'); }, + onRendered: function (event) { + var $container = $(event.currentTarget); + this.fixFullscreen($container); + this.fixOpenedBps($container); + }, + processTitleClick: function (event) { event.stopPropagation(); var $el = $(event.currentTarget).closest('table.bp'); @@ -133,8 +139,29 @@ });*/ }, - fixOpenedBps: function(event) { - var $bpDiv = $(event.currentTarget).find('div.bp'); + fixFullscreen: function($container) { + var $controls = $container.find('div.controls'); + var $layout = $('#layout'); + var icinga = this.module.icinga; + if ($controls.hasClass('want-fullscreen')) { + if (!$layout.hasClass('fullscreen-layout')) { + + $layout.addClass('fullscreen-layout'); + $controls.removeAttr('style'); + $container.find('.fake-controls').remove(); + icinga.ui.currentLayout = 'fullscreen'; + } + } else { + if ($layout.hasClass('fullscreen-layout')) { + $layout.removeClass('fullscreen-layout'); + icinga.ui.layoutHasBeenChanged(); + icinga.ui.initializeControls($container); + } + } + }, + + fixOpenedBps: function($container) { + var $bpDiv = $container.find('div.bp'); var bpName = $bpDiv.attr('id'); if (typeof this.idCache[bpName] === 'undefined') {