[icinga-checkins] icinga.org: icinga-core/next: classic-ui: applyed last commit to other cgi' s as well #2681

git at icinga.org git at icinga.org
Fri Jun 15 17:19:20 CEST 2012


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

Author: Ricardo Bartels <ricardo at bitchbrothers.com>
Date:   Wed Jun 13 01:26:17 2012 +0200

classic-ui: applyed last commit to other cgi's as well #2681

refs: #2681

---

 cgi/extinfo.c       |   14 +++++++-------
 cgi/notifications.c |    4 ++--
 cgi/outages.c       |    4 ++--
 cgi/summary.c       |    8 ++++----
 4 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/cgi/extinfo.c b/cgi/extinfo.c
index d673072..dbaea35 100644
--- a/cgi/extinfo.c
+++ b/cgi/extinfo.c
@@ -3056,9 +3056,9 @@ void show_comments(int type) {
 				printf("\"expires\": \"%s\" }", expire_time);
 		} else if (content_type == CSV_CONTENT) {
 			if (display_type == DISPLAY_COMMENTS) {
-				printf("%s%s%s%s", csv_data_enclosure, (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name, csv_data_enclosure, csv_delimiter);
+				printf("%s%s%s%s", csv_data_enclosure, temp_host->name, csv_data_enclosure, csv_delimiter);
 				if (type == SERVICE_COMMENT)
-					printf("%s%s%s%s", csv_data_enclosure, (temp_service->display_name != NULL) ? temp_service->display_name : temp_service->description, csv_data_enclosure, csv_delimiter);
+					printf("%s%s%s%s", csv_data_enclosure, temp_service->description, csv_data_enclosure, csv_delimiter);
 				else
 					printf("%s%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
 			}
@@ -3246,9 +3246,9 @@ void show_downtime(int type) {
 			}
 		} else if (content_type == CSV_CONTENT) {
 			if (display_type == DISPLAY_DOWNTIME) {
-				printf("%s%s%s%s", csv_data_enclosure, (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name, csv_data_enclosure, csv_delimiter);
+				printf("%s%s%s%s", csv_data_enclosure, temp_host->name, csv_data_enclosure, csv_delimiter);
 				if (type == SERVICE_DOWNTIME)
-					printf("%s%s%s%s", csv_data_enclosure, (temp_service->display_name != NULL) ? temp_service->display_name : temp_service->description, csv_data_enclosure, csv_delimiter);
+					printf("%s%s%s%s", csv_data_enclosure, temp_service->description, csv_data_enclosure, csv_delimiter);
 				else
 					printf("%s%s%s", csv_data_enclosure, csv_data_enclosure, csv_delimiter);
 			}
@@ -3529,14 +3529,14 @@ void show_scheduling_queue(void) {
 
 			/* host name */
 			if (temp_host != NULL)
-				snprintf(display_host, sizeof(display_host) - 1, "%s", (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name);
+				snprintf(display_host, sizeof(display_host) - 1, "%s", (temp_host->display_name != NULL && content_type == HTML_CONTENT) ? temp_host->display_name : temp_host->name);
 			else
 				snprintf(display_host, sizeof(display_host) - 1, "%s", temp_svcstatus->host_name);
 			display_host[sizeof(display_host)-1] = '\x0';
 
 			/* service name */
 			if (temp_service != NULL)
-				snprintf(display_service, sizeof(display_service) - 1, "%s", (temp_service->display_name != NULL) ? temp_service->display_name : temp_svcstatus->description);
+				snprintf(display_service, sizeof(display_service) - 1, "%s", (temp_service->display_name != NULL && content_type == HTML_CONTENT) ? temp_service->display_name : temp_svcstatus->description);
 			else
 				snprintf(display_service, sizeof(display_service) - 1, "%s", temp_svcstatus->description);
 			display_service[sizeof(display_service)-1] = '\x0';
@@ -3595,7 +3595,7 @@ void show_scheduling_queue(void) {
 
 			/* host name*/
 			if (temp_host != NULL)
-				snprintf(display_host, sizeof(display_host) - 1, "%s", (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name);
+				snprintf(display_host, sizeof(display_host) - 1, "%s", (temp_host->display_name != NULL && content_type == HTML_CONTENT) ? temp_host->display_name : temp_host->name);
 			else
 				snprintf(display_host, sizeof(display_host) - 1, "%s", temp_hststatus->host_name);
 			display_host[sizeof(display_host)-1] = '\x0';
diff --git a/cgi/notifications.c b/cgi/notifications.c
index 66df6ae..927e0ed 100644
--- a/cgi/notifications.c
+++ b/cgi/notifications.c
@@ -634,7 +634,7 @@ void display_notifications(void) {
 				temp_service = find_service(host_name, service_name);
 
 			if (temp_host != NULL) {
-				snprintf(displayed_host_name, sizeof(displayed_host_name), "%s", (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name);
+				snprintf(displayed_host_name, sizeof(displayed_host_name), "%s", (temp_host->display_name != NULL && content_type == HTML_CONTENT) ? temp_host->display_name : temp_host->name);
 				displayed_host_name[sizeof(displayed_host_name)-1] = '\x0';
 
 				if (temp_entry->type == LOGENTRY_HOST_NOTIFICATION) {
@@ -642,7 +642,7 @@ void display_notifications(void) {
 						show_entry = FALSE;
 				} else {
 					if (temp_service != NULL) {
-						snprintf(displayed_service_desc, sizeof(displayed_service_desc), "%s", (temp_service->display_name != NULL) ? temp_service->display_name : temp_service->description);
+						snprintf(displayed_service_desc, sizeof(displayed_service_desc), "%s", (temp_service->display_name != NULL && content_type == HTML_CONTENT) ? temp_service->display_name : temp_service->description);
 						displayed_service_desc[sizeof(displayed_service_desc)-1] = '\x0';
 
 						if (is_authorized_for_service(temp_service, &current_authdata) == FALSE)
diff --git a/cgi/outages.c b/cgi/outages.c
index 5b13d49..9f729e4 100644
--- a/cgi/outages.c
+++ b/cgi/outages.c
@@ -369,11 +369,11 @@ void display_network_outages(void) {
 				printf(",\n");
 			json_start = FALSE;
 			printf("{ \"severity\": %d, ", temp_hostoutage->severity);
-			printf(" \"host\": \"%s\", ", (temp_hostoutage->hst->display_name != NULL) ? json_encode(temp_hostoutage->hst->display_name) : json_encode(temp_hostoutage->hst->name));
+			printf(" \"host\": \"%s\", ", json_encode(temp_hostoutage->hst->name));
 			printf(" \"state\": \"%s\", ", status);
 		} else if (content_type == CSV_CONTENT) {
 			printf("%s%d%s%s", csv_data_enclosure, temp_hostoutage->severity, csv_data_enclosure, csv_delimiter);
-			printf("%s%s%s%s", csv_data_enclosure, (temp_hostoutage->hst->display_name != NULL) ? temp_hostoutage->hst->display_name : temp_hostoutage->hst->name, csv_data_enclosure, csv_delimiter);
+			printf("%s%s%s%s", csv_data_enclosure, temp_hostoutage->hst->name, csv_data_enclosure, csv_delimiter);
 			printf("%s%s%s%s", csv_data_enclosure, status, csv_data_enclosure, csv_delimiter);
 		} else {
 			printf("<TR CLASS='%s'>\n", bg_class);
diff --git a/cgi/summary.c b/cgi/summary.c
index 3816ef7..3f8f018 100644
--- a/cgi/summary.c
+++ b/cgi/summary.c
@@ -1762,16 +1762,16 @@ void display_recent_alerts(void) {
 			json_start = FALSE;
 			printf("{ \"time\": \"%s\", ", date_time);
 			printf("\"alert_type\": \"%s\", ", (temp_event->event_type == AE_HOST_ALERT) ? "Host Alert" : "Service Alert");
-			printf("\"host\": \"%s\", ", (temp_host->display_name != NULL) ? json_encode(temp_host->display_name) : json_encode(temp_host->name));
+			printf("\"host\": \"%s\", ", json_encode(temp_host->name));
 			if (temp_event->event_type == AE_HOST_ALERT)
 				printf("\"service\": null, ");
 			else
-				printf("\"service\": \"%s\", ", (temp_service->display_name != NULL) ? json_encode(temp_service->display_name) : json_encode(temp_service->description));
+				printf("\"service\": \"%s\", ", json_encode(temp_service->description));
 		} else if (content_type == CSV_CONTENT) {
 			printf("%s%s%s%s", csv_data_enclosure, date_time, csv_data_enclosure, csv_delimiter);
 			printf("%s%s%s%s", csv_data_enclosure, (temp_event->event_type == AE_HOST_ALERT) ? "Host Alert" : "Service Alert", csv_data_enclosure, csv_delimiter);
-			printf("%s%s%s%s", csv_data_enclosure, (temp_host->display_name != NULL) ? temp_host->display_name : temp_host->name, csv_data_enclosure, csv_delimiter);
-			printf("%s%s%s%s", csv_data_enclosure, (temp_event->event_type == AE_HOST_ALERT) ? "" : (temp_service->display_name != NULL) ? temp_service->display_name : temp_service->description, csv_data_enclosure, csv_delimiter);
+			printf("%s%s%s%s", csv_data_enclosure, temp_host->name, csv_data_enclosure, csv_delimiter);
+			printf("%s%s%s%s", csv_data_enclosure, (temp_event->event_type == AE_HOST_ALERT) ? "" : temp_service->description, csv_data_enclosure, csv_delimiter);
 		} else {
 			printf("<tr CLASS='data%s'>", (odd) ? "Even" : "Odd");
 





More information about the icinga-checkins mailing list