-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreatefactory.html
More file actions
103 lines (89 loc) · 3.12 KB
/
createfactory.html
File metadata and controls
103 lines (89 loc) · 3.12 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<!DOCTYPE html>
<html>
<head>
{% include "styles.html" %}
<title> Create a 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>
<script type="text/javascript">
function onsubmitform()
{
if(document.pressed == 'more')
{
document.createfact.action ="/storefactory?more=True";
}
else
if(document.pressed == 'exit')
{
document.createfact.action ="/storefactory";
}
return true;
}
</script>
<body onload="initialize()">
{% include "navbar.html" %}
{% if added %}
<p>Factory added successfully</p>
{% endif %}
{% if repeat %}
<p>Factory already exists</p>
{% endif %}
<p><form name="createfact" onsubmit="return onsubmitform();" enctype="multipart/form-data" method="post">
<div>Name: <input name="name"></input></div>
<div>Address: <input id="address" onchange="address_change()" name="address"></input></div>
<div>Picture:<input type="file" name="picture"/></div><br />
<div>Unique ID (optional): <input name="unique"></input></div><br />
<input id="location" name="location" type="hidden"></input><br />
<div><input type="submit" name="more" value="Save and create another" onclick="document.pressed=this.name" a class='span4 btn medium'></div>
<div><input type="submit" name="exit" value="Save and view factory" onclick="document.pressed=this.name" a class='span4 btn medium'></div>
</form></p>
<div id="map_canvas"></div>
{% include "footer.html" %}
</body>
</html>