[icinga-checkins] icinga.org: icinga-core/mfriedrich/cgis: ugly workaround for sending (un) checked values for sticky_ack and send_notification values on acknowledgement (refs #3329)

git at icinga.org git at icinga.org
Sat Oct 27 15:35:30 CEST 2012


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

Author: Michael Friedrich <michael.friedrich at gmail.com>
Date:   Sat Oct 27 15:34:47 2012 +0200

ugly workaround for sending (un)checked values for sticky_ack and send_notification values on acknowledgement (refs #3329)

---

 cgi/cmd.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/cgi/cmd.c b/cgi/cmd.c
index 1cf832b..35ba013 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -1010,7 +1010,9 @@ void print_form_element(int element, int cmd) {
 		printf("<tr><td class=\"objectDescription descriptionleft\">Sticky Acknowledgement:");
 		print_help_box(help_text);
 		printf("</td><td align=\"left\">");
-		printf("<INPUT TYPE='checkbox' NAME='sticky_ack' %s></td></tr>\n", (sticky_ack == TRUE) ? "CHECKED" : "");
+		/* http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ */
+		printf("<INPUT TYPE='hidden' NAME='sticky_ack' value='%d'>", (sticky_ack == TRUE) ? 0 : 1); /* negate value hack, if checkbox is unchecked */
+		printf("<INPUT TYPE='checkbox' NAME='sticky_ack' value='%d' %s></td></tr>\n", (sticky_ack == TRUE) ? 1 : 0, (sticky_ack == TRUE) ? "CHECKED" : "");
 		break;
 
 	case PRINT_SEND_NOTFICATION:
@@ -1020,7 +1022,9 @@ void print_form_element(int element, int cmd) {
 		printf("<tr><td class=\"objectDescription descriptionleft\">Send Notification:");
 		print_help_box(help_text);
 		printf("</td><td align=\"left\">");
-		printf("<INPUT TYPE='checkbox' NAME='send_notification' %s></td></tr>\n", (send_notification == TRUE) ? "CHECKED" : "");
+		/* http://iamcam.wordpress.com/2008/01/15/unchecked-checkbox-values/ */
+		printf("<INPUT TYPE='hidden' NAME='send_notification' value='%d'>", (send_notification == TRUE) ? 0 : 1); /* negate value hack, if checkbox is unchecked */
+		printf("<INPUT TYPE='checkbox' NAME='send_notification' value='%d' %s></td></tr>\n", (send_notification == TRUE) ? 1 : 0, (send_notification == TRUE) ? "CHECKED" : "");
 		break;
 
 	case PRINT_PERSISTENT:





More information about the icinga-checkins mailing list