[icinga-checkins] icinga.org: icinga-core/test/cgis: classic ui: fixed Commit commands with more then 500 multiple pairs of hosts and services #2373

git at icinga.org git at icinga.org
Tue Apr 3 09:26:30 CEST 2012


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

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Mon Feb 27 22:36:58 2012 +0100

classic ui: fixed Commit commands with more then 500 multiple pairs of hosts and services #2373

refs: #2373

* now it's possible to submit ~990 commands at the same time

---

 Changelog |    1 +
 cgi/cmd.c |   28 ++++++++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)

diff --git a/Changelog b/Changelog
index 1d05e7c..af8534f 100644
--- a/Changelog
+++ b/Changelog
@@ -36,6 +36,7 @@ FIXES
 * classic ui: fixed json output for comments and downtimes in extinfo.cgi sometimes invalid #2343
 * classic ui: fixed invalid json output for tac.cgi #2160
 * classic ui: Fixed Invalid json data if field value is multiline #2263
+* classic ui: fixed Commit commands with more then 500 multiple pairs of hosts and services #2373
 
 * idoutils: fix ORA-00913 too many values when MERGE INTO eventhandlers #2319
 * idoutils: change standard string escaping for postgresql queries to use the E'foo' notation #1974
diff --git a/cgi/cmd.c b/cgi/cmd.c
index 56976ff..76611b9 100644
--- a/cgi/cmd.c
+++ b/cgi/cmd.c
@@ -811,16 +811,24 @@ void print_object_list(int list_type) {
 
 		printf("<tr class=\"status%s\"><td width=\"50%%\"", (row_color == 0) ? "Even" : "Odd ");
 		if (list_type == PRINT_SERVICE_LIST) {
-			/* if hostname is empty print inputbox instead */
-			if (!strcmp(commands[x].host_name, ""))
-				printf("><INPUT TYPE='TEXT' NAME='host' SIZE=30></td>");
-			else
-				printf("><INPUT TYPE='HIDDEN' NAME='host' VALUE='%s'>%s</td>", escape_string(commands[x].host_name), escape_string(commands[x].host_name));
-			/* if service description is empty print inputbox instead */
-			if (!strcmp(commands[x].description, ""))
-				printf("<td><INPUT TYPE='TEXT' NAME='service' SIZE=30></td></tr>\n");
-			else
-				printf("<td><INPUT TYPE='HIDDEN' NAME='service' VALUE='%s'>%s</td></tr>\n", escape_string(commands[x].description), escape_string(commands[x].description));
+			/* hostname and service description are present */
+			if (strlen(commands[x].host_name) != 0  && strlen(commands[x].description) != 0) {
+				printf(">%s</td>", escape_string(commands[x].host_name));
+				/* we can use "escape_string" only twice in one line */
+				printf("<td><INPUT TYPE='HIDDEN' NAME='hostservice' VALUE='%s^%s'>", escape_string(commands[x].host_name), escape_string(commands[x].description));
+				printf("%s</td></tr>\n", escape_string(commands[x].description));
+			} else {
+				/* if hostname is empty print inputbox instead */
+				if (!strcmp(commands[x].host_name, ""))
+					printf("><INPUT TYPE='TEXT' NAME='host' SIZE=30></td>");
+				else
+					printf("><INPUT TYPE='HIDDEN' NAME='host' VALUE='%s'>%s</td>", escape_string(commands[x].host_name), escape_string(commands[x].host_name));
+				/* if service description is empty print inputbox instead */
+				if (!strcmp(commands[x].description, ""))
+					printf("<td><INPUT TYPE='TEXT' NAME='service' SIZE=30></td></tr>\n");
+				else
+					printf("<td><INPUT TYPE='HIDDEN' NAME='service' VALUE='%s'>%s</td></tr>\n", escape_string(commands[x].description), escape_string(commands[x].description));
+			}
 		} else if (list_type == PRINT_HOST_LIST) {
 			/* if hostname is empty print inputbox instead */
 			if (!strcmp(commands[x].host_name, ""))





More information about the icinga-checkins mailing list