forked from khoegenauer/tickets-cad
-
Notifications
You must be signed in to change notification settings - Fork 0
/
circle.php
1511 lines (1390 loc) · 67 KB
/
circle.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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/**
* @package circle.php
* @author John Doe <[email protected]>
* @since 2011-05-25
* @version 2013-05-22
*/
/*
5/25/11 initial release
7/2/11 corrections to include filled data as hiddens
7/3/11 added 2 fields to schema
7/30/11 table renamed
5/22/13 Totally revised for google maps API V3
*/
if ( !defined( 'E_DEPRECATED' ) ) { define( 'E_DEPRECATED',8192 );} // 11/8/09
error_reporting (E_ALL ^ E_DEPRECATED);
require_once 'incs/functions.inc.php';
$tablename = "{$GLOBALS['mysql_prefix']}mmarkup"; // 7/30/11
@session_start();
do_login(basename(__FILE__));
extract ($_POST);
$_type = "c";
$by = empty($_SESSION)? 0: $_SESSION['user_id'];
$from = $_SERVER['REMOTE_ADDR'];
$now = mysql_format_date(time() - (intval(get_variable('delta_mins')*60))); // 6/20/10
if (array_key_exists("id", $_POST) && (!(empty($_POST['id'])))) {
$query = "SELECT *, UNIX_TIMESTAMP(_on) AS `_on` FROM `{$tablename}` WHERE `id` = {$_POST['id']}"; // 1/27/09
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
if (mysql_num_rows ($result) > 0) {
$row = stripslashes_deep(mysql_fetch_assoc($result));
extract ($row);
$points_ary = array();
$points = explode (";", $line_data);
for ($i = 0; $i<count($points); $i++) {
array_push($points_ary, $points[$i]);
}
// dump($points_ary );
}
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD><TITLE><?php print gettext('Tickets Circle Module');?></TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"/>
<META HTTP-EQUIV="Expires" CONTENT="0"/>
<META HTTP-EQUIV="Cache-Control" CONTENT="NO-CACHE"/>
<META HTTP-EQUIV="Pragma" CONTENT="NO-CACHE"/>
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript"/>
<META HTTP-EQUIV="Script-date" CONTENT="12/15/10 3:55"> <!-- 7/7/09 -->
<LINK REL="StyleSheet" HREF="stylesheet.php?version=<?php print time();?>" TYPE="text/css" />
<STYLE>
/* comment */
A:hover {text-decoration: underline; color: red;}
TH:hover {text-decoration: underline; color: red;}
td.mylink:hover {background-color: rgb(255, 255, 255); }
INPUT.button {background-color: rgb(255, 255, 255); }
input.text:focus, textarea:focus {background-color: lightyellow; color:black;}
tr {height: 30px; }
tr.front {height: 18px; }
.style1 {background-color:transparent;font-weight:bold;border:0px black solid;white-space:nowrap; font-size : 1.5em; font-family:"arial"; opacity: 0.75; font-style:italic}
</STYLE>
<SCRIPT SRC="./js/jscolor/jscolor.js" type="text/javascript"></SCRIPT>
<?php
$api_key = trim(get_variable('gmaps_api_key'));
$key_str = (strlen($api_key) == 39)? "key={$api_key}&" : "";
if((array_key_exists('HTTPS', $_SERVER)) && ($_SERVER['HTTPS'] == 'on')) {
$gmaps_url = "https://maps.google.com/maps/api/js?" . $key_str . "libraries=geometry,weather&sensor=false";
} else {
$gmaps_url = "http://maps.google.com/maps/api/js?" . $key_str . "libraries=geometry,weather&sensor=false";
}
?>
<SCRIPT TYPE="text/javascript" src="<?php print $gmaps_url;?>"></SCRIPT>
<SCRIPT SRC="./js/usng.js" TYPE="text/javascript"></SCRIPT> <!-- 8/23/08 -->
<SCRIPT SRC="./js/lat_lng.js" TYPE="text/javascript"></SCRIPT> <!-- 11/8/11 -->
<SCRIPT SRC="./js/geotools2.js" TYPE="text/javascript"></SCRIPT> <!-- 11/8/11 -->
<SCRIPT SRC="./js/osgb.js" TYPE="text/javascript"></SCRIPT> <!-- 11/8/11 -->
<SCRIPT SRC='./js/graticule_V3.js' type='text/javascript'></SCRIPT>
<SCRIPT SRC='./js/misc_function.js' type='text/javascript'></SCRIPT> <!-- 4/14/10 -->
<SCRIPT SRC="./js/domready.js" TYPE="text/javascript" ></script>
<SCRIPT SRC="./js/gmaps_v3_init.js" TYPE="text/javascript" ></script>
<SCRIPT src = "./js/elabel_v3.js"></SCRIPT>
<SCRIPT>
var map; // note global
var comma = ",";
var semic = ";";
var draw_circle;
var icon_file = new google.maps.MarkerImage(
'./markers/yellow.png',
new google.maps.Size(16, 28),
new google.maps.Point(0,0),
new google.maps.Point(8, 28)
);
var shadow = new google.maps.MarkerImage(
'./markers/sm_shadow.png',
new google.maps.Size(22, 20),
new google.maps.Point(0,0),
new google.maps.Point(8, 28)
);
var base_icon = new google.maps.MarkerImage(
'./markers/sm_red.png',
new google.maps.Size(16, 28),
new google.maps.Point(0,0),
new google.maps.Point(8, 28)
);
/**
*
* @returns {undefined}
*/
function testBanner() {
// map = new GMap2(document.getElementById("map"));
// var marker = drawBanner(points[0],'Some Italic partially opaque text to place on a map','Some partially opaque text');
} // end function test Banner ()
/**
*
* @returns {Array}
*/
function $() { // 12/20/08
var elements = new Array();
for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
element = document.getElementById(element);
if (arguments.length == 1)
return element;
elements.push(element);
}
return elements;
}
/**
*
* @returns {unresolved}
*/
String.prototype.trim = function () {
return this.replace(/^\s*(\S*(\s+\S+)*)\s*$/, "$1");
};
/**
*
* @param {type} instr
* @returns {RegExp}
*/
function hex_OK(instr) {
return (/^(#[A-F0-9]{6})$/i.test(instr));
}
/**
*
* @param {type} in_str
* @returns {String|add_hash.in_str}
*/
function add_hash(in_str) { // prepend # if absent
return (in_str.substr(0,1)=="#")? in_str : "#" + in_str;
}
/**
*
* @param {type} theForm
* @returns {undefined}
*/
function do_checked(theForm) {
$('fill_tr').style.display = '';
theForm.frm_filled.value = 1;
theForm.frm_filled_n.checked = false;
theForm.frm_filled_y.checked = true;
}
/**
*
* @param {type} theForm
* @returns {undefined}
*/
function do_un_checked(theForm) {
$('fill_tr').style.display = "none"; // hide input row
theForm.frm_filled.value = 0;
theForm.frm_filled_n.checked = true;
theForm.frm_filled_y.checked = false;
}
/**
*
* @param {type} lat
* @param {type} lng
* @param {type} radius
* @param {type} strokeColor
* @param {type} strokeWidth
* @param {type} strokeOpacity
* @param {type} fillColor
* @param {type} fillOpacity
* @returns {undefined}
*/
function drawCircle(lat, lng, radius, strokeColor, strokeWidth, strokeOpacity, fillColor, fillOpacity) {
var d2r = Math.PI/180;
var r2d = 180/Math.PI;
var Clat = radius * 0.014483;
var Clng = Clat/Math.cos(lat * d2r);
var Cpoints = [];
for (var i=0; i < 33; i++) {
var theta = Math.PI * (i/16);
Cy = lat + (Clat * Math.sin(theta));
Cx = lng + (Clng * Math.cos(theta));
var P = new google.maps.LatLng(Cy,Cx);
Cpoints.push(P);
}
if (draw_circle != null) {
draw_circle.setMap(null);
}
draw_circle = new google.maps.Circle({
center: new google.maps.LatLng(lat,lng),
map: map,
fillColor: fillColor,
fillOpacity: fillOpacity,
strokeColor: strokeColor,
strokeOpacity: strokeOpacity,
strokeWeight: strokeWidth,
editable: true
});
draw_circle.setRadius(radius*5000);
google.maps.event.addListener(draw_circle, 'radius_changed', function () {
new_radius = draw_circle.getRadius()/5000;
if (document.c) {
document.c.circ_radius.value = new_radius;
}
if (document.u) {
document.u.circ_radius.value = new_radius;
}
});
google.maps.event.addListener(draw_circle, 'center_changed', function () {
new_center = draw_circle.getCenter();
if (document.c) {
var temp = document.c.frm_line_data.value.split(semic, 2);
document.c.frm_line_data.value = new_center.lat().toFixed(6) + comma + new_center.lng().toFixed(6) + semic + temp[1] ;
}
if (document.u) {
var temp = document.u.frm_line_data.value.split(semic, 2);
document.u.frm_line_data.value = new_center.lat().toFixed(6) + comma + new_center.lng().toFixed(6) + semic + temp[1] ;
}
});
draw_circle.setMap(map);
}
/**
*
* @param {type} point
* @param {type} html
* @param {type} text
* @param {type} font_size
* @param {type} color
* @param {type} name
* @returns {undefined}
*/
function drawBanner(point, html, text, font_size, color, name) { // Create the banner
var invisibleIcon = new google.maps.MarkerImage("./markers/markerTransparent.png");
map.setCenter(point, 8);
var the_color = (typeof color == 'undefined')? "000000" : color; // default to black
if (label != null) {
label.setMap(null);
}
label = new ELabel({
latlng: point,
label: html,
offset: new google.maps.Size(-8, 4),
opacity: 100,
theSize: font_size + "px",
theColor:add_hash(the_color),
overlap: true,
clicktarget: false
});
label.setMap(map);
var marker = new google.maps.Marker(point,invisibleIcon); // Create an invisible google.maps.Marker
marker.setMap(map);
} // end function draw Banner()
var circle_OK = false;
/**
*
* @param {type} theForm
* @returns {unresolved}
*/
function chk_circle(theForm) {
var err_msg = "";
if (!(count == 1)) {err_msg += "<?php print gettext('Click map for circle center.');?>\n";}
if (!(is_ok_radius (theForm.circ_radius.value))) {err_msg += "<?php print gettext('Valid circle radius is required.');?>\n";};
if (!(err_msg == "")) {
alert ("<?php print gettext('Please correct the following');?>:\n\n" + err_msg);
return;
}
else {
circle_OK = true;
var lat = parseFloat(points[0].lat().toFixed(6));
var lng = parseFloat(points[0].lng().toFixed(6));
var radius = parseFloat(theForm.circ_radius.value);
strokeColor = theForm.frm_line_color.value;
strokeWidth = parseInt(theForm.frm_line_width.value);
strokeOpacity = parseFloat(theForm.frm_line_opacity.value);
fillColor = (theForm.frm_filled.value = 0)? 0: theForm.frm_fill_color.value;
fillOpacity = (theForm.frm_filled.value = 0)? 0: parseFloat(theForm.frm_fill_opacity.value);
drawCircle(lat, lng, radius, add_hash(strokeColor), strokeWidth, strokeOpacity, add_hash(fillColor), fillOpacity); // 191
}
}
/**
*
* @param {type} instr
* @returns {Boolean}
*/
function is_ok_radius(instr) {
if (instr.trim() == "") {return false;}
if (instr.trim() == "0.0") {return false;}
instr_ary = instr.split(".");
if ((instr_ary.length)>2) {return false;}
if (instr_ary[0].NaN) {return false;}
if (((instr_ary.length)==2) && (instr_ary[1].NaN)) {return false;}
return true;
}
/**
*
* @param {type} myform
* @param {type} mybutton
* @param {type} test
* @returns {Boolean}
*/
function JSfnCheckInput(myform, mybutton, test) { // reject empty form elements
var errmsg = "";
if (myform.frm_name.value.trim()=="") {errmsg+= "\t<?php print gettext('Description is required');?>\n";}
if (myform.frm_ident.value.trim()=="") {errmsg+= "\t<?php print gettext('Ident is required');?>\n";}
if (myform.frm_line_cat_id.value ==0) {errmsg+= "\t<?php print gettext('Category selection is required');?>\n";}
var temp = myform.frm_line_data.value.split(";", 2);
if (!(temp.length == 2)) {errmsg+= "\t<?php print gettext('Map center is required');?>\n";}
if (myform.frm_line_color.value.trim()=="") {errmsg+= "\t<?php print gettext('Color is required');?>\n";}
if (myform.frm_line_opacity.value.trim()=="") {errmsg+= "\t<?php print gettext('Opacity is required');?>\n";}
if (myform.frm_line_width.value.trim()=="") {errmsg+= "\t<?php print gettext('Width is required');?>\n";}
if (!(is_ok_radius (myform.circ_radius.value.trim()))) {errmsg += "\t<?php print gettext('Valid circle radius is required');?>\n";};
if (!((myform.box_use_with_bm.checked) ||
(myform.box_use_with_r.checked) ||
(myform.box_use_with_f.checked) ||
(myform.box_use_with_u_ex.checked) ||
(myform.box_use_with_u_rf.checked) )) {errmsg+= "\t<?php print gettext('At least one \'Apply to ...\' is required');?>\n";}
if (errmsg!="") {
$(mybutton).disabled = false;
alert ("<?php print gettext('Please correct the following and re-submit');?>:\n\n" + errmsg);
return false;
}
else { // test?
if (!(typeof test == 'undefined' )) { // display for review/approval
do_display(myform.frm_line_type.value);
return;
}
myform.frm_use_with_bm.value=(myform.box_use_with_bm.checked)? 1: 0;
myform.frm_use_with_r.value=(myform.box_use_with_r.checked)? 1: 0;
myform.frm_use_with_f.value=(myform.box_use_with_f.checked)? 1: 0;
myform.frm_use_with_u_ex.value=(myform.box_use_with_u_ex.checked)? 1: 0;
myform.frm_use_with_u_rf.value=(myform.box_use_with_u_rf.checked)? 1: 0;
var comma = ",";
var semic = ";";
var temp = myform.frm_line_data.value.split(semic, 2);
myform.frm_line_data.value = temp[0] + semic + myform.circ_radius.value.trim();
myform.submit();
} // end if/else errormsg
} // end function JSfn CheckInput
<?php
if (!(empty($_POST))) {
?>
/**
*
* @param {type} the_type
* @returns {undefined}
*/
function do_display(the_type) {
switch (the_type) {
case "p": // poly
points.length = 0;
for (i = 0; i < markers.length; i++) {
points.push(markers[i].getPosition());
}
if (document.c.frm_filled.value == 1) { // Polygon mode - filled
points.push(markers[0].getPosition());
var poly = new google.maps.Polygon({
paths: points,
strokeColor: add_hash(strokeColor),
strokeOpacity: strokeOpacity,
strokeWeight: strokeWidth,
fillColor: add_hash(fillColor),
fillOpacity: fillOpacity
});
} else { // Polyline mode - not filled
var poly = new google.maps.Polygon({
paths: points,
strokeColor: add_hash(strokeColor),
strokeOpacity: strokeOpacity,
strokeWeight: strokeWidth
});
}
poly.setMap(map);
break; // end poly
case "c": // circle
theForm = (document.u)? document.u : document.c ;
var temp = theForm.frm_line_data.value;
var temp = theForm.frm_line_data.value.split(semic);
var coords = temp[0].split(comma);
var lat = parseFloat(coords[0]);
var lng = parseFloat(coords[1]);
var radius = parseFloat(theForm.circ_radius.value);
strokeColor = theForm.frm_line_color.value;
strokeWidth = parseInt(theForm.frm_line_width.value);
strokeOpacity = parseFloat(theForm.frm_line_opacity.value);
fillColor = (theForm.frm_filled.value = 0)? 0: theForm.frm_fill_color.value;
fillOpacity = (theForm.frm_filled.value = 0)? 0: parseFloat(theForm.frm_fill_opacity.value);
drawCircle(lat, lng, radius, add_hash(strokeColor), strokeWidth, strokeOpacity, add_hash(fillColor), fillOpacity); // 324
break;
case "t": // text
var theForm = document.c;
var html = text = theForm.text_text.value.trim();
drawBanner(points[0],html,text) ;
break;
} // end switch()
} // end function do_display()
<?php
} // end if (!(empty($_POST)))
?>
var map, poly; // Global variables
var count = 0;
var points = new Array();
var markers = new Array();
var icon_url ="./markers/";
var tooltip;
//var report= document.getElementById("status");
/**
*
* @param {type} in_array
* @returns {undefined}
*/
function to_string(in_array) {
var sep = ""; // separator
var out_str = "";
for (i=0;i<in_array.length;i++) {
temp = in_array[i].join(","); // comma-separate the coords
out_str += (sep + temp);
sep="\t"; // tab-separate the points
}
}
/**
*
* @param {type} marker
* @returns {undefined}
*/
function showTooltip(marker) { // Display tooltips
tooltip.innerHTML = marker.tooltip;
tooltip.style.display = "block";
if (typeof(tooltip.style.filter) == "string") { // Tooltip transparency specially for IE
tooltip.style.filter = "alpha(opacity:70)";
}
var currtype = map.getCurrentMapType().getProjection();
var point= currtype.fromLatLngToPixel(map.fromDivPixelToLatLng(new GPoint(0,0),true),map.getZoom());
var offset= currtype.fromLatLngToPixel(marker.getPosition(),map.getZoom());
var anchor = marker.getIcon().iconAnchor;
var width = marker.getIcon().iconSize.width + 6;
// var height = tooltip.clientHeight +18;
var height = 10;
var pos = new GControlPosition(G_ANCHOR_TOP_LEFT, new google.maps.Size(offset.x - point.x - anchor.x + width, offset.y - point.y -anchor.y - height));
pos.apply(tooltip);
}
/**
*
* @param {type} point
* @returns {undefined}
*/
function leftClick(point) {
var marker = new google.maps.Marker({
position:point,
icon:base_icon,
draggable:true,
bouncy:false,
dragCrossMove:true,
title: "Point " + count,
map: map
});
marker.setMap(map);
}
/**
*
* @returns {undefined}
*/
function toggleMode() {
if(markers.length > 1) drawOverlay();
}
/**
*
* @returns {undefined}
*/
function drawOverlay() { // edit function - input is markers array
// var lineMode = document.forms["f"].elements["mode"][0].checked; // Check radio button
var lineMode = true; // Check mode
if (poly) { map.removeOverlay(poly); }
points.length = 0;
for (i = 0; i < markers.length; i++) {
points.push(markers[i].getPosition());
}
if (lineMode) { // Polyline mode
poly = new google.maps.Polygon({
paths: points,
strokeColor: "#ff0000",
strokeOpacity: .9,
strokeWeight: 2
});
var length = poly.getLength()/1000;
var unit = " km";
// report.innerHTML = "Total line length:<br> " + length.toFixed(3) + unit;
}
else { // Polygon mode
points.push(markers[0].getPosition());
poly = new google.maps.Polygon({
paths: points,
strokeColor: "#ff0000",
strokeOpacity: .9,
strokeWeight: 2,
fillColor: "#ff0000",
fillOpacity: .2
});
// var area = poly.getArea()/(1000*1000);
// var unit = " km²";
// report.innerHTML = "Area of polygon:<br> " + area.toFixed(3) + unit;
}
poly.setMap(map);
}
/**
*
* @returns {undefined}
*/
function clearMap() { // Clear current map and reset globals
draw_circle.setMap(null);
points.length = 0;
markers.length = 0;
count = 0;
}
/**
*
* @param {type} id
* @returns {undefined}
*/
function to_view(id) { // invoke switch case 'u' for selected id
document.to_view_form.id.value = id;
document.to_view_form.submit();
}
/**
*
* @returns {undefined}
*/
function buildMap_l() { // 'list' version
var container = document.getElementById("map_canvas");
var myLatlng = new google.maps.LatLng(<?php print get_variable('def_lat');?>, <?php print get_variable('def_lng');?>);
var mapOptions = {
zoom: <?php print get_variable('def_zoom');?>,
center: myLatlng,
panControl: true,
zoomControl: true,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.<?php echo get_maptype_str(); ?>
};
var map = new google.maps.Map($('map_canvas'), mapOptions); // 481
map.setCenter(new google.maps.LatLng(<?php echo get_variable('def_lat'); ?>, <?php echo get_variable('def_lng'); ?>), <?php echo get_variable('def_zoom'); ?>);
var bounds = new google.maps.LatLngBounds(); // Initialize bounds for the map
var points = new Array();
<?php
$query = "SELECT * FROM `{$tablename}` WHERE `line_type` = 'c'";
$result = mysql_query($query)or do_error($query,$query, mysql_error(), basename(__FILE__), __LINE__);
$empty = TRUE;
//
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
$empty = FALSE;
extract ($row);
$name = $row['line_name'];
$use_w_bm = ($use_with_bm==1) ? "CHECKED" : ""; // checkbox settings
$use_w_r = ($use_with_r==1) ? "CHECKED" : "";
$use_w_f = ($use_with_f==1) ? "CHECKED" : "";
$use_w_u_ex = ($use_with_u_ex==1) ? "CHECKED" : "";
$use_w_u_rf = ($use_with_u_rf==1) ? "CHECKED" : "";
switch ($row['line_type']) {
case "p": // poly
$points = explode (";", $line_data);
echo "\n\tvar points = new Array();\n";
for ($i = 0; $i<count($points); $i++) {
$coords = explode (",", $points[$i]);
?>
var thepoint = new googl.maps.LatLng(<?php print $coords[0];?>, <?php print $coords[1];?>);
bounds.extend(thepoint);
points.push(thepoint);
<?php } // end for ($i = 0 ... )
if ((intval($filled) == 1) && (count($points) > 2)) {?>
var polyline = new google.maps.Polygon({
paths: points,
strokeColor: add_hash("<?php print $line_color;?>"),
strokeOpacity: <?php print $line_opacity;?>,
strokeWeight: <?php print $line_width;?>,
fillColor: add_hash("<?php print $fill_color;?>"),
fillOpacity: <?php print $fill_opacity;?>
});
<?php } else {?>
var polyline = new google.maps.Polygon({
paths: points,
strokeColor: add_hash("<?php print $line_color;?>"),
strokeOpacity: <?php print $line_opacity;?>,
strokeWeight: <?php print $line_width;?>
});
<?php } ?>
polyline.setMap(map);
<?php
break;
case "c": // circle
// dump($row);
$temp = explode (";", $line_data);
$radius = $temp[1];
$coords = explode (",", $temp[0]);
$lat = $coords[0];
$lng = $coords[1];
$fill_opacity = (intval($filled) == 0)? 0 : $fill_opacity;
echo "\n drawCircle({$lat}, {$lng}, {$radius}, add_hash('{$line_color}'), {$line_width}, {$line_opacity}, add_hash('{$fill_color}'), {$fill_opacity}); // 472\n";
?>
// alert(<?php echo __LINE__;?>);
<?php
break;
case "t": // banner
// dump($row);
$temp = explode (";", $line_data);
$banner = $temp[1];
$coords = explode (",", $temp[0]);
echo "\n var point = new google.maps.LatLng(parseFloat({$coords[0]}) , parseFloat({$coords[1]}));\n";
$the_banner = htmlentities($banner, ENT_QUOTES);
$the_width = intval( trim($line_width), 10); // font size
echo "\n drawBanner( point, '{$the_banner}', '{$the_banner}', {$the_width});\n";
break;
} // end switch
} // end while ()
unset($query, $result);
?>
map.setCenter(new google.maps.LatLng(<?php echo get_variable('def_lat'); ?>, <?php echo get_variable('def_lng'); ?>), <?php echo (get_variable('def_zoom')-4); ?>);
} // end function buildMap_l()
<?php
$func = (has_admin())? "u": "r";
?>
/**
*
* @param {type} the_id
* @returns {undefined}
*/
function to_p(the_id) { // poly
document.navform.id.value = the_id;
document.navform._func.value = "<?php echo $func;?>";
document.navform.action = "<?php echo basename(__FILE__);?>";
document.navform.submit();
}
/**
*
* @param {type} the_id
* @returns {undefined}
*/
function to_c(the_id) { // circle
document.navform.id.value = the_id;
document.navform._func.value = "<?php echo $func;?>";
document.navform.action = "circle.php";
document.navform.submit();
}
/**
*
* @param {type} the_id
* @returns {undefined}
*/
function to_t(the_id) { // text/banner
document.navform.id.value = the_id;
document.navform._func.value = "<?php echo $func;?>";
document.navform.action = "banner.php";
document.navform.submit();
}
/**
*
* @param {type} the_id
* @returns {undefined}
*/
function to_k(the_id) { // kml
document.navform.id.value = the_id;
document.navform._func.value = "<?php echo $func;?>";
document.navform.action = "kml.php";
document.navform.submit();
}
</SCRIPT>
</HEAD>
<?php
dump($_POST);
switch ($_POST["_func"]) {
case "l": // list
?>
<BODY onLoad = "buildMap_l();"> <!-- <?php echo basename(__FILE__); ?> -->
<SCRIPT TYPE='text/javascript' src='./js/wz_tooltip.js'></SCRIPT>
<TABLE ID = 'outer' ALIGN='center' BORDER = 0 STYLE = 'margin-left:20px;margin-top:20px;'>
<TR CLASS='even'><TH colspan=2><?php print gettext('Lines and Boundaries');?></TH></TR>
<TR VALIGN='top'><TD>
<TABLE ALIGN='center' ID = 'sidebar_tbl'>
<?php
$line_types = array("p" => "Poly", "c" =>"Circle", "t" =>"Banner");
$query = "SELECT *, UNIX_TIMESTAMP(_on) AS `_on` FROM `{$tablename}` WHERE `line_type` = 'c'"; // 1/27/09
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
if (mysql_num_rows($result)==0) {
print "<TR CLASS = 'odd'><TH COLSPAN=99>" . gettext('No data') . "</TH></TR>\n";
}
else {
print "<TR STYLE = 'height:8px;'><TD COLSPAN=99 ALIGN='center'><I>" . gettext('Click to view/edit') . "</I></TD></TR>";
print "<TR CLASS = 'odd' STYLE = 'height:16px;'><TD ALIGN='left'><B> " . gettext('Name') . "</B></TD>
<TD><B>" . gettext('Type') . " </B></TD>
<TD><B> " . gettext('Visible') . " </B></TD>
<TD onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext('Apply to base map') . "');\"><B> " . gettext('BM') . " </B></TD>
<TD onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext('Apply to regions') . "');\"><B> " . gettext('R') . " </B></TD>
<TD onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext('Apply to facilities') . "');\"><B> " . gettext('F') . " </B></TD>
<TD onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext('Apply to units - Exclusion zone') . "');\"><B> " . gettext('EX') . " </B></TD>
<TD onmouseout=\"UnTip();\" onmouseover=\"Tip('" . gettext('Apply to units - Ringfence') . "');\"><B> " . gettext('RF') . " </B></TD>
<TD><B> " . gettext('As of') . "</B></TD></TR>\n";
$i = 0;
$targets = array( "p" =>"to_p", "c" => "to_c", "t" => "to_t", "k" => "to_k");
while ($row = stripslashes_deep(mysql_fetch_assoc($result))) {
extract ($row);
$visible = (intval($row['line_status'])==0)? "<IMG SRC = './markers/checked.png' BORDER=0 />" : "";
$to_func = "{$targets[$row['line_type']]}({$row['id']})";
print "<TR CLASS = '{$evenodd[$i%2]} front ' onClick = '{$to_func}'>
<TD ALIGN='left'>{$row['line_name']} </TD>
<TD ALIGN='left'>{$line_types[$row['line_type']]}</TD>
<TD ALIGN='center'>{$visible}</TD>
<TD ALIGN='center'>{$use_with_bm}</TD>
<TD ALIGN='center'>{$use_with_r}</TD>
<TD ALIGN='center'>{$use_with_f}</TD>
<TD ALIGN='center'>{$use_with_u_ex}</TD>
<TD ALIGN='center'>{$use_with_u_rf}</TD>
<TD ALIGN='right'> " . format_date($row['_on']) . "</TD></TR>\n";
$i++;
}
} // end if/else (mysql_num_rows($result)==0)
?>
<TR CLASS = 'odd'><TD COLSPAN=99 ALIGN='center' STYLE = 'white-space:nowrap;'><BR />
<INPUT TYPE="button" VALUE="<?php print gettext('Add new');?> =>" />
<INPUT TYPE = 'button' VALUE = "<?php print gettext('Polygon');?>" onClick = "document.new_form._type.value='p'; document.new_form.submit();"/>
<INPUT TYPE = 'button' VALUE = "<?php print gettext('Circle');?>" onClick = "location.href='circle.php';"/>
<INPUT TYPE = 'button' VALUE = "<?php print gettext('Banner');?>" onClick = "location.href='banner.php';"/>
</TD>
</TR></TABLE>
</TD>
<TD ID = 'map_td'>
<DIV id="map" STYLE = "margin-left:8px; width:<?php print get_variable('map_width');?>px; height:<?php print get_variable('map_height');?>px;" ></DIV>
</TD>
</TR></TABLE>
<FORM NAME = 'new_form' METHOD = 'post' ACTION = '<?php print basename(__FILE__);?>'>
<INPUT TYPE= 'hidden' NAME = '_func' VALUE = 'c'/>
<INPUT TYPE= 'hidden' NAME = '_type' VALUE = ''/>
</FORM>
<FORM NAME = 'to_view_form' METHOD = 'post' ACTION = '<?php print basename(__FILE__);?>'>
<INPUT TYPE= 'hidden' NAME = '_func' VALUE = 'r'/>
<INPUT TYPE= 'hidden' NAME = 'id' VALUE = ''/>
</FORM>
<?php
break;
case "c": // create
?>
<SCRIPT>
/**
*
* @returns {undefined}
*/
function buildMap_c() { // 'create' version
var container = document.getElementById("map_canvas");
var myLatlng = new google.maps.LatLng(<?php print get_variable('def_lat');?>, <?php print get_variable('def_lng');?>);
var mapOptions = {
zoom: <?php print get_variable('def_zoom');?>,
center: myLatlng,
panControl: true,
zoomControl: true,
scaleControl: true,
mapTypeId: google.maps.MapTypeId.<?php echo get_maptype_str(); ?>
};
map = new google.maps.Map($('map_canvas'), mapOptions); // 481
var bounds = new google.maps.LatLngBounds(); // Initialize bounds for the map
google.maps.event.addListener(map, 'click', function (event) {
var thePos = event.latLng;
var thelat = thePos.lat().toFixed(6);
var thelng = thePos.lng().toFixed(6);
var theradius = document.c.circ_radius.value.trim();
var thecolor = document.c.frm_line_color.value;
var thewidth = document.c.frm_line_width.value;
var theopacity = document.c.frm_line_opacity.value;
var thefillcolor = document.c.frm_fill_color.value;
var thefillopacity = document.c.frm_fill_opacity.value;
if (thePos) {
document.c.frm_line_data.value = (thelat + "," + thelng + ";" + theradius);
drawCircle(thelat, thelng, theradius, add_hash(thecolor), thewidth, theopacity, add_hash(thefillcolor), thefillopacity);
} // end if (thePos)
else {
alert(<?php echo __LINE__;?>);
}
}); // end google.maps.event.add Listener()
} // end function buildMap_c()
</SCRIPT>
<BODY onLoad = "buildMap_c();" >
<?php
print (array_key_exists("caption", $_POST))? "<H3>{$_POST['caption']}</H3>" : "";
$type_ary = array( "p" =>"Polygon", "c" => "Circle", "t" => "Banner", "k" => "kml");
$capt_ary = array( "p" =>gettext("click map - drag icons"), "c" => gettext("Click map and enter form values"), "t" => gettext("Click map and enter form values"), "k" => gettext("kml"));
$line_ary = array( "p" =>"Line", "c" =>"Circle", "t" => "Text", "k" => "kml");
$query = "SELECT * FROM `$GLOBALS[mysql_prefix]mmarkup_cats` ORDER BY `category` ASC";
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
$cats_sel = "<SELECT NAME = 'frm_cat_list' onChange = 'this.form.frm_line_cat_id.value = this.options[this.selectedIndex].value;'>\n";
$cats_sel .= "<OPTION VALUE=0 SELECTED >" . gettext('Select') . "</OPTION>\n";
while ($row = mysql_fetch_assoc($result)) {
$cats_sel .= "<OPTION VALUE=\"{$row['id']}\">" . shorten($row['category'], 30) . "</OPTION>\n";
}
$cats_sel .= "</SELECT>\n";
?>
<FORM NAME="c" METHOD="post" ACTION="<?php print basename(__FILE__); ?>">
<TABLE BORDER="0" ALIGN="center" ID = 'outer' STYLE = 'margin-left:20px;margin-top:20px;'><TR VALIGN='top'><TD>
<TABLE BORDER="0" ALIGN="center">
<TR CLASS="even" VALIGN="top" >
<TD COLSPAN="2" ALIGN="CENTER"><FONT SIZE="+1"><?php print gettext('New');?> <?php echo $type_ary[$_type];?></FONT><BR /><BR />
<FONT SIZE = 'normal'><EM><?php echo $capt_ary[$_type];?></EM></FONT></TD>
</TR>
<TR CLASS="odd" VALIGN="top" >
<TD COLSPAN="2" ALIGN="CENTER"> </TD>
</TR>
<TR VALIGN="baseline" CLASS="odd">
<TD CLASS="td_label" ALIGN="left"><?php print gettext('Description');?>:</TD>
<TD><INPUT MAXLENGTH="32" SIZE="32" type="text" NAME="frm_name" VALUE="" onChange = "this.value.trim();" />
<SPAN STYLE = 'margin-left:20px' CLASS="td_label" ><?php print gettext('Visible');?> » </SPAN>
<SPAN STYLE = 'margin-left:10px'><?php print gettext('Yes');?> » <INPUT TYPE='radio' NAME = 'rb_line_is_vis' onClick = "document.c.rb_line_not_vis.checked = false;document.c.frm_line_status.value=0;" CHECKED /></SPAN>
<SPAN STYLE = 'margin-left:20px'><?php print gettext('No');?> » <INPUT TYPE='radio' NAME = 'rb_line_not_vis' onClick = "document.c.rb_line_is_vis.checked = false;document.c.frm_line_status.value=1;" /></SPAN>
</TD></TR>
<TR VALIGN="baseline" CLASS="even">
<TD CLASS="td_label" ALIGN="left"><?php print gettext('Ident');?>:</TD>
<TD ALIGN="left"><INPUT MAXLENGTH="10" SIZE="10" type="text" NAME="frm_ident" VALUE="" onChange = "this.value.trim();" />
<SPAN STYLE = 'margin-left:20px' CLASS="td_label"><?php print gettext('Category');?>: » </SPAN><?php echo $cats_sel;?>
<SPAN CLASS="td_label" STYLE = 'margin-left:20px;'><?php print gettext('Radius');?> » <INPUT NAME = 'circ_radius' VALUE= '' TYPE = 'text' SIZE = 6 MAXLENGTH = 6 /> <i>(mi)</i>
</TD></TR>
<TR VALIGN="baseline" CLASS="odd"><TD CLASS="td_label" ALIGN="left"><?php print gettext('Apply to');?>:</TD>
<TD ALIGN='left' CLASS="td_label" STYLE = 'white-space:nowrap;' >
<SPAN STYLE="margin-left: 20px;border:1px; width:20%"><?php print gettext('Base Map');?> » <INPUT TYPE= "checkbox" NAME="box_use_with_bm" onClick = "this.form.frm_use_with_bm.value=1;"/></SPAN>
<SPAN STYLE="border:1px; width:20%"> <?php print get_text("Regions");?> » <INPUT TYPE= "checkbox" NAME="box_use_with_r" onClick = "this.form.frm_use_with_r.value=1;"/></SPAN>
<SPAN STYLE="border:1px; width:20%"> <?php print gettext('Facilities');?> » <INPUT TYPE= "checkbox" NAME="box_use_with_f" onClick = "this.form.frm_use_with_f.value=1;"/></SPAN>
<SPAN STYLE="border:1px; width:20%"> <?php print gettext('Unit Exclusion Zone');?> » <INPUT TYPE= "checkbox" NAME="box_use_with_u_ex" onClick = "this.form.frm_use_with_u_ex.value=1;"/></SPAN>
<SPAN STYLE="border:1px; width:20%"> <?php print gettext('Unit Ringfence');?> » <INPUT TYPE= "checkbox" NAME="box_use_with_u_rf" onClick = "this.form.frm_use_with_u_rf.value=1;"/></SPAN>
</TD>
</TR>
<TR VALIGN="baseline" CLASS="even"><TD CLASS="td_label" ALIGN="left"><?php echo $line_ary[$_type];?>:</TD>
<TD ALIGN="left"><SPAN CLASS="td_label" STYLE= "margin-left:20px" >
<?php print gettext('Color');?> » <INPUT MAXLENGTH="8" SIZE="8" type="text" NAME="frm_line_color" VALUE="#FF0000" class="color" />
<?php print gettext('Opacity');?> » <INPUT MAXLENGTH=3 SIZE=3 TYPE= "text" NAME="frm_line_opacity" VALUE="0.5" />
<?php print gettext('Width');?> » <INPUT MAXLENGTH=2 SIZE=2 TYPE= "text" NAME="frm_line_width" VALUE="2" /> (px)
</SPAN></TD>
</TR>
<TR VALIGN="baseline" CLASS="odd" ID = 'fill_cb_tr' >
<TD CLASS="td_label" ALIGN="left"><?php print gettext('Filled');?>: </TD>
<TD ALIGN="left"><SPAN CLASS="td_label" STYLE = "margin-left: 20px;" >
<?php print gettext('No');?> » <input type = radio name = 'frm_filled_n' value = 'n' onClick = 'do_un_checked(this.form);' CHECKED />
<?php print gettext('Yes');?> » <input type = radio name = 'frm_filled_y' value = 'y' onClick = 'do_checked(this.form);'/>
</SPAN>
</TD>
</TR>
<TR VALIGN="baseline" CLASS="even" ID = 'fill_tr' STYLE = 'display:none' >
<TD CLASS="td_label" ALIGN="left"><?php print gettext('Fill');?>:</TD>
<TD ALIGN="left"><SPAN CLASS="td_label" STYLE= "margin-left:20px" >
<?php print gettext('Color');?> » <INPUT MAXLENGTH="8" SIZE="8" type="text" NAME="frm_fill_color" VALUE="#FF0000" class="color" />
<?php print gettext('Opacity');?> » <INPUT MAXLENGTH=3 SIZE=3 TYPE= "text" NAME="frm_fill_opacity" VALUE="0.5" />
</SPAN>
</TD>
</TR>
<TR VALIGN="baseline"CLASS="odd"><TD COLSPAN="2" ALIGN="center" STYLE = 'white-space:nowrap;'>
<INPUT TYPE='hidden' NAME = '_func' VALUE='cp' />
<INPUT TYPE='hidden' NAME = 'frm_line_status' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_line_cat_id' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_line_type' VALUE='<?php echo $_type;?>' />
<INPUT TYPE='hidden' NAME = 'frm_line_data' VALUE='' />
<INPUT TYPE='hidden' NAME = 'frm_filled' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_use_with_bm' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_use_with_r' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_use_with_f' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_use_with_u_ex' VALUE='0' />
<INPUT TYPE='hidden' NAME = 'frm_use_with_u_rf' VALUE='0' />
<INPUT TYPE="button" VALUE="<?php print gettext('Cancel');?>" STYLE = 'width:auto;' onClick = "document.canform.submit();"/>
<INPUT TYPE="button" VALUE="<?php print gettext('Reset');?>" STYLE = 'width:auto; margin-left:40px;' onClick = "do_un_checked(this.form);this.form.reset(); clearMap();buildMap_c();"/>
<INPUT TYPE="button" NAME="sub_but" VALUE="<?php print gettext('Next');?>" STYLE = 'width:120px; margin-left:40px;' onclick="this.disabled=true; JSfnCheckInput(this.form, this);"/>
<INPUT TYPE="button" VALUE="<?php print gettext('Test');?>" onClick = "JSfnCheckInput(this.form, this, true);" STYLE = 'margin-left:20px' />
</TD></TR>
<TR><TD COLSPAN=3> </TD></TR>
</FORM>
</TD></TR></TABLE>
</TD><TD>
<DIV id="map_canvas" STYLE = "margin-left:8px; width:<?php print get_variable('map_width');?>px; height:<?php print get_variable('map_height');?>px;" ></DIV>
</TD></TR></TABLE>
<CENTER>
<?php
break; // end case "c"
case "cp": // 'create' process
dump($_POST);
$filled = (trim($_POST['frm_line_type']) == "t")? "NULL" : quote_smart(trim($_POST['frm_filled'])) ;
$fill_color = (trim($_POST['frm_line_type']) == "t")? "NULL" : quote_smart(trim($_POST['frm_fill_color'])) ;
$fill_opacity = (trim($_POST['frm_line_type']) == "t")? "NULL" : quote_smart(trim($_POST['frm_fill_opacity'])) ;
// dump($fill_opacity);
$query = "INSERT INTO `{$tablename}` (`line_name`, `line_ident`, `line_cat_id`, `line_status`, `line_type`, `line_data`, `use_with_bm`, `use_with_r`, `use_with_f`, `use_with_u_ex`, `use_with_u_rf`, `line_color`, `line_opacity`, `filled`, `fill_color`, `fill_opacity`,`line_width`,
`_by`, `_from`, `_on`)
VALUES (" .
quote_smart(trim($_POST['frm_name'])) ."," .
quote_smart(trim($_POST['frm_ident'])) ."," .
quote_smart(trim($_POST['frm_line_cat_id'])) ."," .
quote_smart(trim($_POST['frm_line_status'])) ."," .
quote_smart(trim($_POST['frm_line_type'])) ."," .
quote_smart(trim($_POST['frm_line_data'])) ."," .
quote_smart(trim($_POST['frm_use_with_bm'])) ."," .
quote_smart(trim($_POST['frm_use_with_r'])) ."," .
quote_smart(trim($_POST['frm_use_with_f'])) ."," .
quote_smart(trim($_POST['frm_use_with_u_ex'])) ."," .
quote_smart(trim($_POST['frm_use_with_u_rf'])) ."," .
quote_smart(trim($_POST['frm_line_color'])) ."," .
quote_smart(trim($_POST['frm_line_opacity'])) ."," .
$filled ."," .
$fill_color ."," .
$fill_opacity ."," .
quote_smart(trim($_POST['frm_line_width'])) ."," .
quote_smart($by) ."," .
quote_smart($from) ."," .
quote_smart(trim($now)) . ")" ;
$result = mysql_query($query) or do_error($query, 'mysql query failed', mysql_error(),basename( __FILE__), __LINE__);
$insert_id = mysql_insert_id();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML><HEAD><TITLE><?php echo basename(__FILE__);?></TITLE></HEAD>
<BODY onload = 'document.dummy.submit();'>
<FORM NAME='dummy' METHOD = 'post' ACTION = '<?php echo basename(__FILE__);?>'>
<INPUT TYPE = 'hidden' NAME = '_func' VALUE = 'r' />
<INPUT TYPE = 'hidden' NAME = 'id' VALUE = '<?php echo $insert_id;?>' />
</FORM></BODY></HTML>
<?php