Permalink
Browse files

$msg

  • Loading branch information...
1 parent 0ff880a commit 45196d11377fde08fca0fe7fa51f9f43359ed42e robengel committed Jul 29, 2011
Showing with 78 additions and 7 deletions.
  1. +31 −6 geocamCover/templates/geocamCover/index.html
  2. +47 −1 geocamCover/views.py
@@ -20,14 +20,18 @@
<body onload="setTimeout(function() { window.scrollTo(0, 0) }, 100);">
+<!--
+ ID: map-page
+ This is the main page which displays the map. Includes the menu bar at the bottom.
+-->
<div class='mobile-page' id="map-page">
<div id="map-header" class='header ui-bar-a ui-header'>
<h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">GeoCam Cover</h1>
</div>
<div id="map_canvas"></div>
<div class="open-menu" id="menu">
- <div>Hello World</div>
- <div>Blah Blah Blah</div>
+ <div>Item 1</div>
+ <div>Item 2</div>
</div>
<div id="footer" class="footer ui-bar-a ui-header">
<div onclick="return showPage('#address-form');" id="show-address-button">Search By Location</div>
@@ -40,6 +44,10 @@ <h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">GeoCam Cover</h
</div>
</div>
+<!--
+ ID: address-form
+ The form for entering an address to search for.
+-->
<div class="mobile-page" id="address-form">
<div class='header ui-bar-a ui-header'>
<h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">Add Place</h1>
@@ -53,6 +61,10 @@ <h1 class="page-h1">Search By Location</h1>
<input class="big-button" type="button" value="Load Fusion Table" onclick="loadFusionData();"/>
</div>
+<!--
+ ID: place-form
+ Main form for adding a new place to the map.
+-->
<div class="mobile-page" id="place-form">
<div class='header ui-bar-a ui-header'>
<h1 class='ui-title' style="margin-left: 0px;margin-right: 0px;">Add Place</h1>
@@ -66,7 +78,11 @@ <h1 class="page-h1">Do you want to add this as a place?</h1>
</form>
</div>
-
+<!--
+ ID: logs-page
+ Page which displays information for a place as well as each of the tasks and
+ reports for that place.
+-->
<div class='mobile-page' id="logs-page">
<div class='header ui-bar-a ui-header'>
<input class='button ui-btn-left' type='button' onclick="return showMap();" value="Back"/>
@@ -88,7 +104,10 @@ <h1 class='page-h1' id='place-name-h1'></h1>
</div>
</div>
-
+<!--
+ ID: tasks-page
+ Form for creating/editing a task.
+-->
<div class='mobile-page' id="tasks-page">
<div class='header ui-bar-a ui-header'>
<input class='button ui-btn-left' type='submit' onclick='return showPage("#logs-page");' data-icon="delete"
@@ -122,7 +141,10 @@ <h1 class='page-h1' id='task-name-h1'></h1>
</div>
</div>
-
+<!--
+ ID: reports-page
+ Form for creating/editing a report
+-->
<div class='mobile-page' id="reports-page">
<div class='header ui-bar-a ui-header'>
<input class='button ui-btn-left' type='submit' onclick='return showPage("#logs-page");' data-icon="delete"
@@ -186,7 +208,10 @@ <h1 class='page-h1' id='report-name-h1'></h1>
</div>
</div>
-
+<!--
+ ID: edit-place-page
+ Form for editing an already existing place.
+-->
<div class='mobile-page' id="edit-place-page">
<div class='header ui-bar-a ui-header'>
<input class='button ui-btn-left' type='submit' onclick='return showPage("#logs-page");' value="Cancel"/>
View
@@ -16,14 +16,24 @@
from datetime import datetime
+# Function: index()
+# Arguments: request - HTTP Request
+#
+# Description: Simply renders the index.html page.
+#
def index(request):
t = loader.get_template('geocamCover/index.html')
c = RequestContext(request)
- # places = Place.objects.all()
return HttpResponse(t.render(c))
+# Function: places_json()
+# Arguments: request - HTTP Request
+#
+# Description: Returns a JSON response containing all places in the
+# database along with their associated tasks and repots.
+#
def places_json(request):
place_hash = {"places": []}
for p in Place.objects.all():
@@ -42,6 +52,13 @@ def places_json(request):
places = json.dumps(place_hash, sort_keys=True, indent=4)
return HttpResponse(places, mimetype="application/json")
+
+# Function: categories_json()
+# Arguments: request - HTTP Request
+#
+# Description: Returns a JSON response that includes the categories
+# that can be applied to a place.
+#
def categories_json(request):
categories_enum = Place.get_categories()
categories_hash = {}
@@ -51,6 +68,12 @@ def categories_json(request):
return HttpResponse(categories, mimetype="application/json")
+# Function: place()
+# Arguments: request - HTTP Request
+#
+# Description: Creates a new place or updates an existing place
+# if a valid place ID is included in the request.
+#
def place(request):
if request.method == 'POST':
user = get_user(request)
@@ -69,6 +92,12 @@ def place(request):
return HttpResponse("error")
+# Function: delete_item()
+# Arguments: request - HTTP Request
+#
+# Description: Takes an ID and an item type (place, task, or report).
+# Deletes the item of the specified type and id.
+#
def delete_item(request):
if request.method == 'DELETE':
struct = json.loads(request.raw_post_data)
@@ -81,6 +110,12 @@ def delete_item(request):
return HttpResponse("error")
+# Function: task()
+# Arguments: request - HTTP Request
+#
+# Description: Creates a new task or updates an existing task
+# if a valid task ID is included in the request.
+#
def task(request):
if request.method == 'POST':
user = get_user(request)
@@ -100,6 +135,12 @@ def task(request):
return HttpResponse("error")
+# Function: report()
+# Arguments: request - HTTP Request
+#
+# Description: Creates a new report or updates an existing report
+# if a valid report ID is included in the request.
+#
def report(request):
if request.method == 'POST':
user = get_user(request)
@@ -129,6 +170,11 @@ def report(request):
return HttpResponse("error")
+# Function: get_user()
+# Arguments: request - HTTP Request
+#
+# Description: Helper function to get the current user object.
+#
def get_user(request):
user = None
if request.user == None or not request.user.is_authenticated():

0 comments on commit 45196d1

Please sign in to comment.