[icinga-checkins] icinga.org: icinga-core/mfriedrich/core: classic ui: Implement #3467, " set_ack_notifications"

git at icinga.org git at icinga.org
Thu Jan 3 10:31:26 CET 2013


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

Author: Carl Friend <crfriend at rcn.com>
Date:   Tue Dec 11 18:38:07 2012 -0500

classic ui: Implement #3467, "set_ack_notifications"

refs: #3467

This commit implements proposed feature #3467 from "TheCry" to tick
or untick the "Send Notification" checkbox in the Acknowledge Problem
dialog.  The default behaviour is set to leave the checkbox ticked
thereby sending notifications when a problem is acknowledged and
preserving the original behaviour.

Thanks to Ricardo for the suggestion of using "set_{option}" as
syntax.

---

 Changelog                |    1 +
 cgi/cgiutils.c           |    4 ++++
 cgi/cmd.c                |    3 ++-
 cgi/config.c             |    4 ++++
 sample-config/cgi.cfg.in |   10 ++++++++++
 5 files changed, 21 insertions(+), 1 deletions(-)

diff --git a/Changelog b/Changelog
index cb9a95d..7dbef61 100644
--- a/Changelog
+++ b/Changelog
@@ -15,6 +15,7 @@ UPGRADE NOTES
 1.9.0 - 25/04/2012
 
 ENHANCEMENTS
+* classic ui: Add "set_ack_notifications" to cgi configuration (TheCry) #3467 - CF
 
 FIXES
 * core: fix faulty macro cleaning, replacing spaces with pluses where they shouldn't be cleaned #3397 - MF
diff --git a/cgi/cgiutils.c b/cgi/cgiutils.c
index 0baad7b..04d9ad6 100644
--- a/cgi/cgiutils.c
+++ b/cgi/cgiutils.c
@@ -146,6 +146,7 @@ int             refresh_type = JAVASCRIPT_REFRESH;
 int             escape_html_tags = FALSE;
 
 int             persistent_ack_comments = FALSE;
+int		set_ack_notifications = TRUE;
 
 int             use_ssl_authentication = FALSE;
 
@@ -558,6 +559,9 @@ int read_cgi_config_file(char *filename) {
 		else if (!strcmp(var, "persistent_ack_comments"))
 			persistent_ack_comments = (atoi(val) > 0) ? TRUE : FALSE;
 
+		else if (!strcmp(var, "set_ack_notifications"))
+			set_ack_notifications = (atoi(val) > 0) ? TRUE : FALSE;
+
 		else if (!strcmp(var, "default_expiring_acknowledgement_duration"))
 			default_expiring_acknowledgement_duration = atoi(val);
 
diff --git a/cgi/cmd.c b/cgi/cmd.c
index ae0279b..3d75a61 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -53,6 +53,7 @@ extern int  check_external_commands;
 extern int  use_authentication;
 extern int  lock_author_names;
 extern int  persistent_ack_comments;
+extern int  set_ack_notifications;
 extern int  default_expiring_acknowledgement_duration;
 extern int  set_expire_ack_by_default;
 extern int  default_expiring_disabled_notifications_duration;
@@ -1012,7 +1013,7 @@ 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" : "");
+		printf("<INPUT TYPE='checkbox' NAME='send_notification' %s></td></tr>\n", (set_ack_notifications == TRUE) ? "CHECKED" : "");
 		break;
 
 	case PRINT_PERSISTENT:
diff --git a/cgi/config.c b/cgi/config.c
index b4a10e6..8ace40f 100644
--- a/cgi/config.c
+++ b/cgi/config.c
@@ -106,6 +106,7 @@ extern int color_transparency_index_g;
 extern int color_transparency_index_r;
 extern int cgi_log_rotation_method;
 extern int default_downtime_duration;
+extern int set_ack_notifications;
 extern int default_expiring_acknowledgement_duration;
 extern int set_expire_ack_by_default;
 extern int display_status_totals;
@@ -226,6 +227,7 @@ int org_color_transparency_index_g;
 int org_color_transparency_index_r;
 int org_cgi_log_rotation_method;
 int org_default_downtime_duration;
+int org_set_ack_notifications;
 int org_default_expiring_acknowledgement_duration;
 int org_set_expire_ack_by_default;
 int org_display_status_totals;
@@ -4115,6 +4117,7 @@ void display_cgiconfig(void) {
 	PRINT_CONFIG_LINE_STRING(service_critical_sound, org_service_critical_sound)
 	PRINT_CONFIG_LINE_STRING(service_unknown_sound, org_service_unknown_sound)
 	PRINT_CONFIG_LINE_STRING(service_warning_sound, org_service_warning_sound)
+	PRINT_CONFIG_LINE_INT(set_ack_notifications, org_set_ack_notifications, "bool")
 	PRINT_CONFIG_LINE_INT(set_expire_ack_by_default, org_set_expire_ack_by_default, "bool")
 	PRINT_CONFIG_LINE_INT(show_all_services_host_is_authorized_for, org_show_all_services_host_is_authorized_for, "bool")
 	PRINT_CONFIG_LINE_INT(show_partial_hostgroups, org_show_partial_hostgroups, "bool")
@@ -4523,6 +4526,7 @@ void store_default_settings(void) {
 	org_color_transparency_index_r = color_transparency_index_r;
 	org_cgi_log_rotation_method = org_cgi_log_rotation_method;
 	org_default_downtime_duration = default_downtime_duration;
+	org_set_ack_notifications = set_ack_notifications;
 	org_default_expiring_acknowledgement_duration = default_expiring_acknowledgement_duration;
 	org_set_expire_ack_by_default = set_expire_ack_by_default;
 	org_display_status_totals = display_status_totals;
diff --git a/sample-config/cgi.cfg.in b/sample-config/cgi.cfg.in
index 69e3221..9d4c2e6 100644
--- a/sample-config/cgi.cfg.in
+++ b/sample-config/cgi.cfg.in
@@ -436,6 +436,16 @@ escape_html_tags=1
 
 
 
+# SET ACK NOTIFICATIONS
+# This options determines whether the initial state of the
+# checkbox "Send Notifications" when acknowledging a problem.
+# A value of 1 ticks the checkbox and 0 does not.  The default
+# is 1, which will send notifications on acknowledged problems.
+
+set_ack_notifications=1
+
+
+
 # PERSISTENT ACKNOWLEDGEMENT COMMENTS
 # This options determines whether the initial state of the
 # checkbox "Persistent Comment:" for service and host problem





More information about the icinga-checkins mailing list