diff --git a/application/controllers/StaticController.php b/application/controllers/StaticController.php index bb5723a84..5704dbf4a 100644 --- a/application/controllers/StaticController.php +++ b/application/controllers/StaticController.php @@ -9,6 +9,7 @@ use Icinga\Web\ActionController; use Icinga\Application\Icinga; use Zend_Controller_Action_Exception as ActionException; +use Icinga\Application\Benchmark; /** * Class StaticController * @package Icinga\Web\Form @@ -69,7 +70,7 @@ class StaticController extends ActionController */ public function javascriptAction() { - $module = $this->_getParam('moduleName'); + $module = $this->_getParam('module_name'); $file = $this->_getParam('file'); $basedir = Icinga::app()->getModule($module)->getBaseDir(); @@ -96,15 +97,16 @@ class StaticController extends ActionController ) . ' GMT' ); + $hash = md5_file($filePath); + if ($hash === $this->getRequest()->getHeader('If-None-Match')) { $response->setHttpResponseCode(304); return; } else { readfile($filePath); } - // TODO: get rid of exit: - exit; + return; } } -// @codingStandardsIgnoreEnd \ No newline at end of file +// @codingStandardsIgnoreEnd diff --git a/library/Icinga/Application/Web.php b/library/Icinga/Application/Web.php index d034d344f..123c25acf 100644 --- a/library/Icinga/Application/Web.php +++ b/library/Icinga/Application/Web.php @@ -60,6 +60,17 @@ class Web extends ApplicationBootstrap ) ) ); + + $this->frontController->getRouter()->addRoute( + 'module_javascript', + new Route( + 'js/modules/:module_name/:file', + array( + 'controller' => 'static', + 'action' => 'javascript' + ) + ) + ); return $this; } @@ -173,6 +184,7 @@ class Web extends ApplicationBootstrap */ protected function configurePagination() { + Paginator::addScrollingStylePrefixPath( 'Icinga_Web_Paginator_ScrollingStyle', 'Icinga/Web/Paginator/ScrollingStyle' diff --git a/public/js/icinga/modules/actionTable.js b/public/js/icinga/components/actionTable.js similarity index 100% rename from public/js/icinga/modules/actionTable.js rename to public/js/icinga/components/actionTable.js diff --git a/public/js/icinga/modules/mainDetail.js b/public/js/icinga/components/mainDetail.js similarity index 100% rename from public/js/icinga/modules/mainDetail.js rename to public/js/icinga/components/mainDetail.js diff --git a/public/js/icinga/container.js b/public/js/icinga/container.js index 08d60f047..8e0891802 100755 --- a/public/js/icinga/container.js +++ b/public/js/icinga/container.js @@ -5,7 +5,7 @@ var containerMgrInstance = null; var async; - var ContainerMgr = function($,log,Widgets,SubTable,holder) { + var ContainerMgr = function($,log,Widgets,SubTable) { var enhanceDetachLinks = function() { @@ -34,14 +34,12 @@ } target.focus(); this.initializeContainers(target); - holder.run(); }; this.updateControlTargets = function(ctrl, req) { $('a',ctrl).each(function() { $(this).attr("href",req.url); }); - holder.run(); }; this.initControlBehaviour = function(root) { @@ -86,7 +84,6 @@ this.initExpandables(root); this.drawImplicitWidgets(root); this.loadAsyncContainers(root); - holder.run(); }; this.createPopupContainer = function(content,req) { @@ -96,7 +93,6 @@ .append($("
").addClass('modal-body').html(content)).appendTo(document.body); closeButton.on("click",function() {container.remove();}); - holder.run(); }; this.getContainer = function(id) { @@ -107,9 +103,9 @@ }; }; - define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable','Holder'],function($,log,widgets,subTable,holder) { + define(['jquery','logging','icinga/widgets/checkIcons','icinga/widgets/subTable'],function($,log,widgets,subTable) { if (containerMgrInstance === null) { - containerMgrInstance = new ContainerMgr($,log,widgets,subTable,holder); + containerMgrInstance = new ContainerMgr($,log,widgets,subTable); } return containerMgrInstance; diff --git a/public/js/icinga/icinga.js b/public/js/icinga/icinga.js index 9be6b9013..ff59321f6 100755 --- a/public/js/icinga/icinga.js +++ b/public/js/icinga/icinga.js @@ -13,7 +13,7 @@ define([ * Icinga prototype */ var Icinga = function() { - var internalModules = ['icinga/modules/actionTable','icinga/modules/mainDetail']; + var internalModules = ['icinga/components/actionTable','icinga/components/mainDetail']; this.modules = {}; var failedModules = []; @@ -37,7 +37,7 @@ define([ }; var loadModuleScript = function(name) { - moduleMgr.enableModule("modules/"+name, function(error) { + moduleMgr.enableModule("modules/"+name+"/"+name, function(error) { failedModules.push({ name: name, errorMessage: error