[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: classic ui: add url_stylesheet_path to cgi.cfg to allow custom css path #898

git at icinga.org git at icinga.org
Wed Nov 24 14:56:28 CET 2010


Module: icinga-core
Branch: mfriedrich/core
Commit: d50fd6ce2ab16ace251ce7fc667ee68425216858
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=d50fd6ce2ab16ace251ce7fc667ee68425216858

Author: Michael Friedrich <michael.friedrich at univie.ac.at>
Date:   Wed Nov 24 14:56:09 2010 +0100

classic ui: add url_stylesheet_path to cgi.cfg to allow custom css path #898

fixes #898

---

 Changelog                |    3 ++-
 cgi/cgiutils.c           |   21 ++++++++++++++++++++-
 sample-config/cgi.cfg.in |   10 ++++++++++
 3 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 7d9a57d..966b011 100644
--- a/Changelog
+++ b/Changelog
@@ -14,7 +14,8 @@ ENHANCEMENTS
 * classic ui: add service states to annotate with current notification number opt-in (Jochen Bern) #976
 * classic ui: change displayed name for hostgroups and servicegroups in extinfo.cgi
 * classic ui: adding "Attempt" column to host status detail list
-* classic ui: change default url target frame to main #1014 
+* classic ui: change default url target frame to main #1014
+* classic ui: add url_stylesheet_path to cgi.cfg to allow custom css path #898
 
 * install: add sysconfig source to init script #1015
 * install: set -Wall gcc flags based on os/compiler #959
diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index d16a381..9046b29 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -410,8 +410,10 @@ int read_cgi_config_file(char *filename){
 			snprintf(url_logo_images_path,sizeof(url_logo_images_path),"%slogos/",url_images_path);
 			url_logo_images_path[sizeof(url_logo_images_path)-1]='\x0';
 
+			/*
 			snprintf(url_stylesheets_path,sizeof(url_stylesheets_path),"%sstylesheets/",url_html_path);
 			url_stylesheets_path[sizeof(url_stylesheets_path)-1]='\x0';
+			*/
 
 			snprintf(url_js_path,sizeof(url_js_path),"%sjs/",url_html_path);
 			url_js_path[sizeof(url_js_path)-1]='\x0';
@@ -420,6 +422,16 @@ int read_cgi_config_file(char *filename){
 			url_media_path[sizeof(url_media_path)-1]='\x0';
 		        }
 
+		else if(!strcmp(var,"url_stylesheets_path")){
+
+                        strncpy(url_stylesheets_path,val,sizeof(url_stylesheets_path));
+                        url_stylesheets_path[sizeof(url_stylesheets_path)-1]='\x0';
+
+                        strip(url_stylesheets_path);
+                        if(url_stylesheets_path[strlen(url_stylesheets_path)-1]!='/' && (strlen(url_stylesheets_path) < sizeof(url_stylesheets_path)-1))
+                                strcat(url_stylesheets_path,"/");
+
+			}
 		else if(!strcmp(var,"service_critical_sound"))
 			service_critical_sound=strdup(val);
 
@@ -522,11 +534,18 @@ int read_cgi_config_file(char *filename){
 	free(input);
 	mmap_fclose(thefile);
 
+	/* check if stylesheet path was set */
+	if(!strcmp(url_stylesheets_path,"")){
+		snprintf(url_stylesheets_path,sizeof(url_stylesheets_path),"%sstylesheets/",url_html_path);
+		url_stylesheets_path[sizeof(url_stylesheets_path)-1]='\x0';
+	}
+
 	if(!strcmp(main_config_file,""))
 		return ERROR;
 	else
 		return OK;
-        }
+}
+
 
 
 
diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in
index e034a4d..1d67559 100644
--- a/sample-config/cgi.cfg.in
+++ b/sample-config/cgi.cfg.in
@@ -41,6 +41,16 @@ url_html_path=@htmurl@
 
 
 
+# URL STYLESHEETS PATH
+# This option allows to define an url stylesheet path other than the
+# default ($url_html_path/stylesheets). This will be useful when
+# adding custom stylesheets in another location.
+# If not set, the default location will be used.
+
+url_stylesheets_path=@htmlurl@/stylesheets
+
+
+
 # CONTEXT-SENSITIVE HELP
 # This option determines whether or not a context-sensitive
 # help icon will be displayed for most of the CGIs.





More information about the icinga-checkins mailing list