-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditfactory.html
More file actions
88 lines (75 loc) · 2.79 KB
/
editfactory.html
File metadata and controls
88 lines (75 loc) · 2.79 KB
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
<!DOCTYPE html>
<html>
<head>
{% include "styles.html" %}
<title> Edit Factory </title>
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
</head>
<script>
var map;
var marker;
function initialize() {
var latlng = new google.maps.LatLng(39.095963, -102.744141);
var myOptions = {
zoom: 2,
center: latlng,
mapTypeId: google.maps.MapTypeId.ROADMAP
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
google.maps.event.addListener(map, 'click', function(event) {
if (!marker) {
marker = new google.maps.Marker({
map: map,
position: event.latLng
});
} else {
marker.setPosition(event.latLng);
}
changeInput();
});
}
function address_change() {
var address = $('#address').val();
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
if (status == google.maps.GeocoderStatus.OK) {
map.setCenter(results[0].geometry.location);
marker = new google.maps.Marker({
map: map,
position: results[0].geometry.location
});
map.setZoom(9);
changeInput();
} else {
}
});
}
function changeInput() {
var lat = marker.getPosition().lat();
var lng = marker.getPosition().lng();
$('#location').val(lat+','+lng);
}
</script>
<body onload="initialize()">
{% include "navbar.html" %}
{% if repeatedit %}
<p>Unique ID already exists</p>
{% endif %}
<h2>
{% if redirect %}
<form action="/storeeditedfactory?id={{id}}&redirect={{redirect}}" enctype="multipart/form-data" method="post">
{% else %}
<form action="/storeeditedfactory?id={{id}}" enctype="multipart/form-data" method="post">
{% endif %}
<div>Name: <input name="name" value="{{name_old}}"></input></div>
<div>Address: <input id="address" onchange="address_change()" name="address" value="{{address_old}}"></input></div>
<div>Picture:<input type="file" name="picture"/></div><br />
<div>Unique ID (optional): <input name="unique" value="{{unique_old}}"></input></div><br />
<input id="location" name="location" type="hidden"></input><br />
<div><input type="submit" value="Save" a class='span4 btn medium'></div>
</form></h2>
<div id="map_canvas"></div>
{% include "footer.html" %}
</body>
</html>