Changed files:
nagios-googlemap.patch -> 1.2
---- nagios-3.2.0/cgi/statusmap.c 2009-10-22 14:54:22.000000000 +0300
-+++ nagios-3.2.0/cgi/statusmap.c 2009-10-22 16:11:22.450924994 +0300
+--- nagios-3.2.0/cgi/statusmap.c 2009-10-22 17:06:10.117113115 +0300
++++ nagios-3.2.0.googlemap/cgi/statusmap.c 2009-10-22 17:05:32.644615709 +0300
@@ -27,6 +27,10 @@
*
*****************************************************************************/
@@ -27,6 +27,10 @@
*
*****************************************************************************/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#define LAYOUT_CIRCULAR 4
#define LAYOUT_CIRCULAR_MARKUP 5
#define LAYOUT_CIRCULAR_BALLOON 6
#define LAYOUT_CIRCULAR 4
#define LAYOUT_CIRCULAR_MARKUP 5
#define LAYOUT_CIRCULAR_BALLOON 6
+#define LAYOUT_GOOGLEMAP 7
+#define LAYOUT_GOOGLEMAP 7
typedef struct layer_struct{
char *layer_name;
struct layer_struct *next;
typedef struct layer_struct{
char *layer_name;
struct layer_struct *next;
void document_header(int);
void document_footer(void);
void document_header(int);
void document_footer(void);
void draw_background_image(void);
void draw_background_extras(void);
void draw_host_links(void);
void draw_background_image(void);
void draw_background_extras(void);
void draw_host_links(void);
void draw_hosts(void);
void draw_host_text(char *,int,int);
void draw_text(char *,int,int,int);
void draw_hosts(void);
void draw_host_text(char *,int,int);
void draw_text(char *,int,int,int);
/* write JavaScript code for popup window */
write_popup_code();
/* write JavaScript code for popup window */
write_popup_code();
-+ if ( layout_method == LAYOUT_GOOGLEMAP )
++ if (layout_method == LAYOUT_GOOGLEMAP)
+ write_google_head_code();
printf("</head>\n");
+ write_google_head_code();
printf("</head>\n");
-- printf("<body CLASS='statusmap' name='mappage' id='mappage'>\n");
-+ if ( layout_method == LAYOUT_GOOGLEMAP ) {
++ if (layout_method == LAYOUT_GOOGLEMAP) {
+ printf("<body onload='load()' onunload='GUnload()' CLASS='statusmap' name='mappage' id='mappage'>\n");
+ } else
+ printf("<body onload='load()' onunload='GUnload()' CLASS='statusmap' name='mappage' id='mappage'>\n");
+ } else
-+ printf("<body CLASS='statusmap' name='mappage' id='mappage'>\n");
+ printf("<body CLASS='statusmap' name='mappage' id='mappage'>\n");
/* include user SSI header */
/* include user SSI header */
- include_ssi_files(STATUSMAP_CGI,SSI_HEADER);
-@@ -703,7 +732,7 @@
/* right hand column of top row */
printf("<td align=right valign=top>\n");
/* right hand column of top row */
printf("<td align=right valign=top>\n");
printf("<table border=0 CLASS='optBox'>\n");
printf("<tr><td valign=top>\n");
printf("<input type='hidden' name='host' value='%s'>\n",escape_string(host_name));
printf("<table border=0 CLASS='optBox'>\n");
printf("<tr><td valign=top>\n");
printf("<input type='hidden' name='host' value='%s'>\n",escape_string(host_name));
printf("<option value=%d %s>Circular\n",LAYOUT_CIRCULAR,(layout_method==LAYOUT_CIRCULAR)?"selected":"");
printf("<option value=%d %s>Circular (Marked Up)\n",LAYOUT_CIRCULAR_MARKUP,(layout_method==LAYOUT_CIRCULAR_MARKUP)?"selected":"");
printf("<option value=%d %s>Circular (Balloon)\n",LAYOUT_CIRCULAR_BALLOON,(layout_method==LAYOUT_CIRCULAR_BALLOON)?"selected":"");
printf("<option value=%d %s>Circular\n",LAYOUT_CIRCULAR,(layout_method==LAYOUT_CIRCULAR)?"selected":"");
printf("<option value=%d %s>Circular (Marked Up)\n",LAYOUT_CIRCULAR_MARKUP,(layout_method==LAYOUT_CIRCULAR_MARKUP)?"selected":"");
printf("<option value=%d %s>Circular (Balloon)\n",LAYOUT_CIRCULAR_BALLOON,(layout_method==LAYOUT_CIRCULAR_BALLOON)?"selected":"");
printf("</select>\n");
printf("</td>\n");
printf("<td CLASS='optBoxItem'>\n");
printf("</select>\n");
printf("</td>\n");
printf("<td CLASS='optBoxItem'>\n");
/* display page header */
display_page_header();
/* display page header */
display_page_header();
initialize_graphics();
draw_background_image();
draw_background_extras();
initialize_graphics();
draw_background_image();
draw_background_extras();
/******************************/
/******************************/
/***** MANUAL LAYOUT MODE *****/
/******************************/
/***** MANUAL LAYOUT MODE *****/
/******************************/
host *temp_host;
int x1, x2;
int y1, y2;
host *temp_host;
int x1, x2;
int y1, y2;
int translated_x;
int translated_y;
int translated_x;
int translated_y;
/* user didn't supply any coordinates for hosts, so display a warning */
if(coordinates_were_specified==FALSE){
/* user didn't supply any coordinates for hosts, so display a warning */
if(coordinates_were_specified==FALSE){
/************************* MISC FUNCTIONS *************************/
/******************************************************************/
/************************* MISC FUNCTIONS *************************/
/******************************************************************/
-+int check_auth_location_host(char* name)
-+{
-+ int retVal=FALSE;
-+ host *this_host;
-+
-+ //printf("false=%d,true=%d\n",FALSE,TRUE);
-+ this_host=find_host(name);
-+ // printf("this_host=%s\n",this_host->name);
-+ // printf("current_auth=%s\n",¤t_authdata);
-+ retVal=is_authorized_for_host(this_host,¤t_authdata);
-+ // printf("is_auth=%d\n",retVal);
-+ return retVal;
-+}
-+
+char* get_status_code(char* name)
+{
+ char* retVal;
+char* get_status_code(char* name)
+{
+ char* retVal;
+ char line[1024];
+ char key[1024];
+ char value[1024];
+ char line[1024];
+ char key[1024];
+ char value[1024];
+ char* filename;
+ int state = 0;
+ int counter = 0;
+ char* filename;
+ int state = 0;
+ int counter = 0;
+ if ( state == 1 ) {
+ if ( strcmp(key,"host_name") == 0) {
+ loc->name=strdup(value);
+ if ( state == 1 ) {
+ if ( strcmp(key,"host_name") == 0) {
+ loc->name=strdup(value);
+ if ( strcmp(key,"notes") == 0) {
+ loc->note = strdup(value);
+ }
+ if ( strcmp(key,"notes") == 0) {
+ loc->note = strdup(value);
+ }
+ "document.layoutform.scaling_factor.value=+zoom;\n");
+
+
+ "document.layoutform.scaling_factor.value=+zoom;\n");
+
+
-+ if ( user_supplied_scaling==TRUE )
++ if (user_supplied_scaling==TRUE)
+ {
+ printf("map.setCenter(centerPoint, %2.1f);\n",user_scaling_factor);
+ printf("document.layoutform.scaling_factor.value=%2.1f;\n",user_scaling_factor);
+ {
+ printf("map.setCenter(centerPoint, %2.1f);\n",user_scaling_factor);
+ printf("document.layoutform.scaling_factor.value=%2.1f;\n",user_scaling_factor);