[icinga-checkins] icinga.org: icinga-core/cmaser/fixes: new config option to set initial state of persistence for

git at icinga.org git at icinga.org
Sun Jul 25 10:09:21 CEST 2010


Module: icinga-core
Branch: cmaser/fixes
Commit: 4640b3a8bca6ada7ab3de9eaa957e38b64ac9d63
URL:    https://git.icinga.org/?p=icinga-core.git;a=commit;h=4640b3a8bca6ada7ab3de9eaa957e38b64ac9d63

Author: Christoph Maser <cmr at financial.com>
Date:   Sun Jul 25 09:57:32 2010 +0200

new config option to set initial state of persistence for
acknowledgements

---

 cgi/cgiutils.c           |    5 +++++
 cgi/cmd.c                |   14 ++++++++++++--
 sample-config/cgi.cfg.in |    8 ++++++++
 3 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index b84f4c9..cd07287 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -109,6 +109,8 @@ int             refresh_rate=DEFAULT_REFRESH_RATE;
 
 int             escape_html_tags=FALSE;
 
+int             persistent_ack_comments=FALSE;
+
 int             use_ssl_authentication=FALSE;
 
 int             default_statusmap_layout_method=0;
@@ -429,6 +431,9 @@ int read_cgi_config_file(char *filename){
 		else if(!strcmp(var,"escape_html_tags"))
 			escape_html_tags=(atoi(val)>0)?TRUE:FALSE;
 
+		else if(!strcmp(var,"persistent_ack_comments"))
+			persistent_ack_comments=(atoi(val)>0)?TRUE:FALSE;
+
 		else if(!strcmp(var,"lock_author_names"))
 			lock_author_names=(atoi(val)>0)?TRUE:FALSE;
 
diff --git a/cgi/cmd.c b/cgi/cmd.c
index f8cde83..f6866ca 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -50,6 +50,8 @@ extern int  use_authentication;
 
 extern int  lock_author_names;
 
+extern int  persistent_ack_comments;
+
 extern scheduled_downtime *scheduled_downtime_list;
 extern comment *comment_list;
 
@@ -960,7 +962,11 @@ void request_command_data(int cmd){
 			printf("</b></td></tr>\n");
 		        }
 		printf("<tr><td CLASS='optBoxItem'>Persistent%s:</td><td><b>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?" Comment":"");
-		printf("<INPUT TYPE='checkbox' NAME='persistent' %s>",(cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM)?"":"CHECKED");
+		if ( (persistent_ack_comments==TRUE) && (cmd==CMD_ACKNOWLEDGE_HOST_PROBLEM) ) {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s>","CHECKED");
+		} else {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s>","");
+		}
 		printf("</b></td></tr>\n");
 		printf("<tr><td CLASS='optBoxRequiredItem'>Author (Your Name):</td><td><b>");
 		printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s' %s>",escape_string(comment_author),(lock_author_names==TRUE)?"READONLY DISABLED":"");
@@ -986,7 +992,11 @@ void request_command_data(int cmd){
 			printf("</b></td></tr>\n");
 		        }
 		printf("<tr><td CLASS='optBoxItem'>Persistent%s:</td><td><b>",(cmd==CMD_ACKNOWLEDGE_SVC_PROBLEM)?" Comment":"");
-		printf("<INPUT TYPE='checkbox' NAME='persistent' %s",(cmd==CMD_ACKNOWLEDGE_SVC_PROBLEM)?"":"CHECKED");
+		if ( (persistent_ack_comments==TRUE) && (cmd==CMD_ACKNOWLEDGE_SVC_PROBLEM) ){
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s","CHECKED");
+		} else {
+			printf("<INPUT TYPE='checkbox' NAME='persistent' %s","");
+		}
 		printf("</b></td></tr>\n");
 		printf("<tr><td CLASS='optBoxRequiredItem'>Author (Your Name):</td><td><b>");
 		printf("<INPUT TYPE='TEXT' NAME='com_author' VALUE='%s' %s>",escape_string(comment_author),(lock_author_names==TRUE)?"READONLY DISABLED":"");
diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in
index 200cdd0..9458fef 100644
--- a/sample-config/cgi.cfg.in
+++ b/sample-config/cgi.cfg.in
@@ -292,6 +292,14 @@ escape_html_tags=1
 
 
 
+# PERSISTENT ACKNOWLEDGEMENT COMMENTS
+# This options determines whether wether the initial state
+# of the checkbox "Persistent Comment:" for service and host
+# problem acknowledgements is checked or uncheckd
+
+persistent_ack_comments=0
+
+
 
 # SOUND OPTIONS
 # These options allow you to specify an optional audio file





More information about the icinga-checkins mailing list