[icinga-checkins] icinga.org: icinga-web/mhein/default: * running the web within a subdir

Marius Hein marius.hein at netways.de
Sun Oct 4 11:27:26 CEST 2009


Module: icinga-web
Branch: mhein/default
Commit: 61493256328ec1ab01af0ed3ca071ef223733d75
URL:    https://git.icinga.org/?p=icinga-web.git;a=commit;h=61493256328ec1ab01af0ed3ca071ef223733d75

Author: Marius Hein <marius.hein at netways.de>
Date:   Sun Oct  4 11:27:04 2009 +0200

* running the web within a subdir

---

 app/config/databases.xml                           |    6 +++---
 app/config/icinga.xml                              |   15 +++++++++------
 .../AppKit/models/HeaderDataModel.class.php        |    7 +++++++
 lib/appkit/js/SimpleDataProvider.js                |    2 +-
 lib/appkit/js/ext/CronkMgr.js                      |    2 +-
 lib/appkit/js/ext/grid/ColumnRenderer.js           |    2 +-
 6 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/app/config/databases.xml b/app/config/databases.xml
index 853a105..d7846ab 100755
--- a/app/config/databases.xml
+++ b/app/config/databases.xml
@@ -6,16 +6,16 @@
 			
 			<database name="appkit_default" class="AgaviDoctrineDatabase">
 
-				<!-- 								 
+				 								 
 				<ae:parameter name="dsn">mysql://icinga_dev:icinga_dev@127.0.0.1:3307/icinga</ae:parameter>
 				<ae:parameter name="username">icinga_dev</ae:parameter>
 				<ae:parameter name="password">icinga_dev</ae:parameter>
-				-->
 				
+				<!--
 				<ae:parameter name="dsn">mysql://icinga_web:icinga_web@127.0.0.1:3306/icinga_web</ae:parameter>
 				<ae:parameter name="username">icinga_web</ae:parameter>
 				<ae:parameter name="password">icinga_web</ae:parameter>
-
+				-->
 				<ae:parameter name="charset">utf8</ae:parameter>
 				
 				<ae:parameter name="manager_attributes">
diff --git a/app/config/icinga.xml b/app/config/icinga.xml
index 064a30b..fffafcb 100644
--- a/app/config/icinga.xml
+++ b/app/config/icinga.xml
@@ -2,6 +2,9 @@
 
 <settings prefix="de.icinga." xmlns="http://agavi.org/agavi/1.0/config">
 	
+	<!-- The webpath, with a leading slash and no trailing -->
+	<setting name="appkit.web_path"><![CDATA[/icinga-web]]></setting>
+	
 	<setting name="appkit.php_settings">
 		<parameter name="session.gc_probability">3</parameter>
 		<parameter name="session.gc_divisor">100</parameter>
@@ -216,20 +219,20 @@
 			<parameter name="config_type">mysql</parameter>
 			<parameter name="config_host">127.0.0.1</parameter>
 
-			<!--
+			
 			<parameter name="config_port">3307</parameter>
 			<parameter name="config_database">ndo_demo</parameter>
-			-->			
-
+						
+			<!--
 			<parameter name="config_port">3306</parameter>
 			<parameter name="config_database">icinga</parameter>
-
+			-->
 			<parameter name="config_user">icinga</parameter>
 			<parameter name="config_password">icinga</parameter>
 			
 			
-			<!-- <parameter name="config_table_prefix">nagios_</parameter> -->
-			<parameter name="config_table_prefix">icinga_</parameter>
+			<parameter name="config_table_prefix">nagios_</parameter>
+			<!-- <parameter name="config_table_prefix">icinga_</parameter> -->
 		</parameter>
 	</setting>
 	
diff --git a/app/modules/AppKit/models/HeaderDataModel.class.php b/app/modules/AppKit/models/HeaderDataModel.class.php
index 74baee9..a88d331 100755
--- a/app/modules/AppKit/models/HeaderDataModel.class.php
+++ b/app/modules/AppKit/models/HeaderDataModel.class.php
@@ -62,6 +62,13 @@ implements AgaviISingletonModel
 	
 	private function addFileToStore($type, $name, $file, $insert_type = self::INSERT_PUSH) {
 		if (array_key_exists($type, $this->data)) {
+			
+			if ($type == self::TYPE_CSS_FILE || $type == self::TYPE_JS_FILE) {
+				if (!preg_match('@^'. preg_quote(AgaviConfig::get('de.icinga.appkit.web_path')). '@', $file)) {
+					$file = AgaviConfig::get('de.icinga.appkit.web_path').$file;
+				}
+			}
+			
 			$this->data[$type][$name] = $file;
 			return true;
 		}
diff --git a/lib/appkit/js/SimpleDataProvider.js b/lib/appkit/js/SimpleDataProvider.js
index c98303a..efa3c20 100644
--- a/lib/appkit/js/SimpleDataProvider.js
+++ b/lib/appkit/js/SimpleDataProvider.js
@@ -16,7 +16,7 @@ function SimpleDataProvider (config) {
 		};
 
 		this.reset = function () {
-			this.config.url = "/web/simpleDataProvider/json?src_id=";
+			this.config.url = "web/simpleDataProvider/json?src_id=";
 			this.config.srcId = "";
 			this.config.width = 200;
 			this.config.filter = {};
diff --git a/lib/appkit/js/ext/CronkMgr.js b/lib/appkit/js/ext/CronkMgr.js
index a039e38..78a14ae 100644
--- a/lib/appkit/js/ext/CronkMgr.js
+++ b/lib/appkit/js/ext/CronkMgr.js
@@ -8,7 +8,7 @@ AppKit.Ext.CronkMgr = function() {
 	}
 	
 	var defaultCronkConfig = {
-		loaderUrl : '/web/cronks/cloader/',
+		loaderUrl : 'web/cronks/cloader/',
 		layout : 'fit',
 		xtype : 'panel',
 		params : {}
diff --git a/lib/appkit/js/ext/grid/ColumnRenderer.js b/lib/appkit/js/ext/grid/ColumnRenderer.js
index f58a833..abf35e7 100644
--- a/lib/appkit/js/ext/grid/ColumnRenderer.js
+++ b/lib/appkit/js/ext/grid/ColumnRenderer.js
@@ -73,7 +73,7 @@ AppKit.Ext.grid.ColumnRenderer = {
 				return '[no image defined (attr=image)]';
 			}
 			else {
-				return String.format('<img src="/appkit/image/{0}"{1} />', my.image, (flat_attr && " " + flat_attr + " "));
+				return String.format('<img src="appkit/image/{0}"{1} />', my.image, (flat_attr && " " + flat_attr + " "));
 			}
 		}
 	},





More information about the icinga-checkins mailing list