forked from leonardoxc/leonardoxc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
GUI_EXT_area_show.php
331 lines (267 loc) · 9.41 KB
/
GUI_EXT_area_show.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
<?
//************************************************************************
// Leonardo XC Server, http://www.leonardoxc.net
//
// Copyright (c) 2004-2010 by Andreadakis Manolis
//
// This program is free software. You can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License.
//
// $Id: GUI_EXT_area_show.php,v 1.3 2010/03/14 20:56:10 manolis Exp $
//
//************************************************************************
require_once dirname(__FILE__)."/EXT_config_pre.php";
require_once dirname(__FILE__)."/config.php";
$CONF_use_utf=1;
require_once dirname(__FILE__)."/EXT_config.php";
require_once dirname(__FILE__)."/CL_area.php";
$areaID=makeSane($_GET['areaID'],0);
?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml">
<head>
<title>Google Maps</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script src="http://maps.google.com/maps?file=api&v=2&key=<?=$CONF_google_maps_api_key ?>" type="text/javascript"></script>
<script src="<?=$moduleRelPath?>/js/AJAX_functions.js" type="text/javascript"></script>
<script src="<?=$moduleRelPath?>/js/jquery.js" type="text/javascript"></script>
<script src="<?=$moduleRelPath?>/js/facebox/facebox.js" type="text/javascript"></script>
<link href="js/facebox/facebox.css" media="screen" rel="stylesheet" type="text/css"/>
<style type="text/css">
<!--
body{margin:0}
table,td,tr { font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px; }
div#floatDiv , div#takeoffInfoDiv
{
width: 20%;
float: right;
border: 1px solid #8cacbb;
margin: 0.5em;
background-color: #dee7ec;
padding-bottom: 5px;
position :fixed;
right :0.5em;
top :13em;
width :15em;
display:none;
}
div#takeoffInfoDiv {
float :left;
left : 0.5em;
}
div#floatDiv h3, div#takeoffInfoDiv h3
{
margin:0;
font-size:12px;
background-color:#336699;
color:#FFFFFF;
}
#sidebar {
cursor: pointer;
text-decoration:underline;
color: #4444ff;
padding-right:0;
}
#sidebar a, #sidebar a:visited, #sidebar div {
color: #4444ff;
margin-bottom:5px;
padding:4px;
padding-right:0;
line-height:15px;
}
#takeoffHeader {
width:100%;
background-color:#FF9933;
font-size:12px;
margin-bottom:5px;
color:#FFFFFF;
padding:5px;
padding-right:0;
}
#takeoffHeader a {
color:#FFFFFF;
padding:5px;
}
-->
</style>
</head>
<body>
<div id ='floatDiv'>
<h3>Results</h3>
<div id ='resDiv'><BR /><BR /></div>
</div>
<?
$area=new area($areaID);
$area->getFromDB();
?>
<table border="0" cellpadding="0" cellspacing="0" width=720>
<tr>
<td colspan="2"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="100"><div id='takeoffHeader'>Area</div></td>
<td ><div id='takeoffHeader'><b><?=$area->name?></b></div></td>
</tr>
<tr>
<td colspan="2"><?=$area->desc?></td>
</tr>
<tr>
<td colspan=2> </td>
</tr>
</table></td>
</tr>
<tr>
<td><div name="map" id="map" style="width:565px; height: 450px"></div></td>
<td width = 150 valign="top" bgcolor="#F4F4EA" >
<div id='takeoffHeader'>Takeoffs</div>
<div id="sidebar"></div> </td>
</tr>
<tr>
<td colspan=2>
<div id="siteInfo"></div> </td>
</tr>
</table>
<script type="text/javascript">
$(document).ready(function(){
$('a[rel*=facebox]').facebox()
})
//<![CDATA[
if (GBrowserIsCompatible() ) {
var wpID=0;
var site_list_html = "";
// Creates a marker whose info window displays the given description
function createMarker(point, id , description, iconUrl, shadowUrl ) {
if (iconUrl){
var baseIcon = new GIcon();
var sizeFactor;
if (id==wpID) sizeFactor=1.1;
else sizeFactor=1;
baseIcon.iconSize=new GSize(24*sizeFactor,24*sizeFactor);
baseIcon.shadowSize=new GSize(42*sizeFactor,24*sizeFactor);
baseIcon.iconAnchor=new GPoint(12*sizeFactor,24*sizeFactor);
baseIcon.infoWindowAnchor=new GPoint(12*sizeFactor,0);
var newIcon = new GIcon(baseIcon, iconUrl, null,shadowUrl);
var marker = new GMarker(point,newIcon);
} else {
var marker = new GMarker(point);
}
site_list_html += '<a href="javascript:openSite(' + id + ')">' + description + '</a><br>';
GEvent.addListener(marker, "click", function() {
getAjax('EXT_takeoff.php?op=get_info&inPageLink=1&wpID='+id,null,openMarkerInfoWindow);
});
return marker;
}
function openSite(id) {
getAjax('EXT_takeoff.php?op=get_info&inPageLink=1&wpID='+id,null,openMarkerInfoWindow);
// gmarkers[i].openInfoWindowHtml(htmls[i]);
}
function show_waypoint(id) {
jQuery.facebox(
function() {
jQuery.get("GUI_EXT_waypoint_info.php?wID="+id, function(data) {
jQuery.facebox (data )
}
)
})
//$("#siteInfo").load("GUI_EXT_waypoint_info.php?wID="+id);
}
function openMarkerInfoWindow(jsonString) {
var results= eval("(" + jsonString + ")");
var i=results.takeoffID;
var html=results.html;
takeoffMarkers[i].openInfoWindowHtml(html);
}
var map = new GMap2(document.getElementById("map"), {mapTypes:[G_HYBRID_MAP,G_NORMAL_MAP,G_PHYSICAL_MAP,G_SATELLITE_MAP]});
// map.addControl(new GSmallMapControl());
map.addControl(new GLargeMapControl());
map.addControl(new GMapTypeControl());
// map.addControl(new GOverviewMapControl(new GSize(200,120)));
var takeoffPoint= new GLatLng(40, 22) ;
map.setCenter(takeoffPoint , 8);
var iconUrl = "http://maps.google.com/mapfiles/kml/pal2/icon5.png";
var shadowUrl = "http://maps.google.com/mapfiles/kml/pal2/icon5s.png";
var takeoffMarkers=[];
var bounds = new GLatLngBounds();
function drawTakeoffs(jsonString){
var results= eval("(" + jsonString + ")");
//$("#resDiv").html(results.waypoints.length);
for(i=0;i<results.waypoints.length;i++) {
var takeoffPoint= new GLatLng(results.waypoints[i].lat, results.waypoints[i].lon) ;
//$("#resDiv").append('#'+results.waypoints[i].lat+'#'+ results.waypoints[i].lon+'#'+results.waypoints[i].id+'#'+
//results.waypoints[i].name+'$');
if (results.waypoints[i].id ==wpID ) {
var iconUrl = "http://maps.google.com/mapfiles/kml/pal2/icon5.png";
var shadowUrl = "http://maps.google.com/mapfiles/kml/pal2/icon5s.png";
} else if (results.waypoints[i].type<1000) {
var iconUrl = "http://maps.google.com/mapfiles/kml/pal3/icon21.png";
var shadowUrl = "http://maps.google.com/mapfiles/kml/pal3/icon21s.png";
} else {
var iconUrl = "http://maps.google.com/mapfiles/kml/pal2/icon13.png";
var shadowUrl = "http://maps.google.com/mapfiles/kml/pal2/icon13s.png";
}
var takeoffMarker= createMarker(takeoffPoint,results.waypoints[i].id, results.waypoints[i].name,iconUrl,shadowUrl);
takeoffMarkers[takeoffPoint,results.waypoints[i].id] = takeoffMarker;
map.addOverlay(takeoffMarker);
bounds.extend(takeoffPoint);
}
map.setZoom(map.getBoundsZoomLevel(bounds));
map.setCenter(bounds.getCenter());
//minimap.setZoom(minimap.getBoundsZoomLevel(bounds));
//minimap.setCenter(bounds.getCenter());
$("#sidebar").html(site_list_html);
}
<? if(0) { ?>
// create the crosshair icon, which will indicate where we are on the minimap
// Lets not bother with a shadow
var Icon = new GIcon();
Icon.image = "xhair.png";
//Icon.shadow = "http://www.google.com/mapfiles/shadow50.png";
Icon.iconSize = new GSize(21, 21);
Icon.shadowSize = new GSize(0,0);
Icon.iconAnchor = new GPoint(11, 11);
Icon.infoWindowAnchor = new GPoint(11, 11);
Icon.infoShadowAnchor = new GPoint(11, 11);
// Create the minimap
var minimap = new GMap(document.getElementById("minimap"));
minimap.addControl(new GScaleControl());
minimap.centerAndZoom(new GPoint(0,0), 12);
// Add the crosshair marker at the centre of the minimap and keep a reference to it
var xhair = new GMarker(minimap.getCenterLatLng(), Icon);
minimap.addOverlay(xhair);
// ====== Handle the Map movements ======
// Variables that log whether we are currently causing the maps to be moved
var map_moving = 0;
var minimap_moving = 0;
// This function handles what happens when the main map moves
// If we arent moving it (i.e. if the user is moving it) move the minimap to match
// and reposition the crosshair back to the centre
function Move(){
minimap_moving = true;
if (map_moving == false) {
minimap.centerAtLatLng(map.getCenterLatLng());
xhair.point = map.getCenterLatLng();
xhair.redraw(true);
}
minimap_moving = false;
}
// This function handles what happens when the mini map moves
// If we arent moving it (i.e. if the user is moving it) move the main map to match
// and reposition the crosshair back to the centre
function MMove(){
map_moving = true;
if (minimap_moving == false) {
map.centerAtLatLng(minimap.getCenterLatLng());
xhair.point = minimap.getCenterLatLng();
xhair.redraw(true);
}
map_moving = false;
}
// Listen for when the user moves either map
GEvent.addListener(map, 'move', Move);
GEvent.addListener(minimap, 'moveend', MMove);
<? } ?>
getAjax('EXT_takeoff.php?op=getTakeoffsForArea&areaID=<?=$areaID?>',null,drawTakeoffs);
}
//]]>
</script>
</body>
</html>