aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorheather <unknown>2011-05-03 19:26:03 -0400
committerheather <unknown>2011-05-03 19:26:03 -0400
commitbdde115451a7b1a9ad9746ca69b468420616e4cc (patch)
tree45fb118360620991c519111afaeca73f29b8383e
parent5093e3b212ee692a3cc0f4f6273b87417200241d (diff)
downloadd2-bdde115451a7b1a9ad9746ca69b468420616e4cc.tar.bz2
d2-bdde115451a7b1a9ad9746ca69b468420616e4cc.tar.xz
d2-bdde115451a7b1a9ad9746ca69b468420616e4cc.zip
commit what I have so far
-rw-r--r--lib/d2/app/controllers/index.py13
-rw-r--r--lib/d2/bin/d2_server.py2
-rw-r--r--static/html/test_label.html6
-rw-r--r--templates/index.html15
4 files changed, 17 insertions, 19 deletions
diff --git a/lib/d2/app/controllers/index.py b/lib/d2/app/controllers/index.py
index f691bfc..440bc56 100644
--- a/lib/d2/app/controllers/index.py
+++ b/lib/d2/app/controllers/index.py
@@ -32,12 +32,14 @@ class IndexController(BaseController):
32 32
33 def get(self, id_type=None, id=None): 33 def get(self, id_type=None, id=None):
34 if id_type and id: 34 if id_type and id:
35 if id_type == 'occupant_id': 35 if id_type == 'occupant':
36 forges = self._forge.get_forge_by_occupant_id(id) 36 forges = self._forge.get_forge_by_occupant_id(id)
37 details = self._detail.occupant_details(id) 37 details = self._detail.occupant_details(id)
38 plot_ids = [forge.plot_id for forge in forges] 38 plots = []
39 plots = self._plot.get_all(plot_ids) 39 if len(forges) > 0:
40 else: # plot_id 40 plot_ids = [forge.plot_id for forge in forges]
41 plots = self._plot.get_all(plot_ids)
42 else: # plot
41 forges = self._forge.get_forge_by_plot_id(id) 43 forges = self._forge.get_forge_by_plot_id(id)
42 details = self._detail.plot_details(id) 44 details = self._detail.plot_details(id)
43 plots = self._plot.get_all([id]) 45 plots = self._plot.get_all([id])
@@ -45,8 +47,7 @@ class IndexController(BaseController):
45 self.render('index.html', 47 self.render('index.html',
46 mode="map", 48 mode="map",
47 details=details, 49 details=details,
48 plots=plots, 50 plots=plots)
49 forges=forges)
50 else: 51 else:
51 self.render('index.html', mode="get") 52 self.render('index.html', mode="get")
52 53
diff --git a/lib/d2/bin/d2_server.py b/lib/d2/bin/d2_server.py
index 46e465d..fbe4741 100644
--- a/lib/d2/bin/d2_server.py
+++ b/lib/d2/bin/d2_server.py
@@ -19,7 +19,7 @@ def main():
19 } 19 }
20 application = tornado.web.Application([ 20 application = tornado.web.Application([
21 (r"/svg_text/(.*)", SvgTextController, extras), 21 (r"/svg_text/(.*)", SvgTextController, extras),
22 (r"/(occupant_id|plot_id)/(.*)", IndexController, extras), 22 (r"/(occupant|plot)/(.*)", IndexController, extras),
23 (r"/", IndexController, extras), 23 (r"/", IndexController, extras),
24 ], **settings) 24 ], **settings)
25 http_server = tornado.httpserver.HTTPServer(application) 25 http_server = tornado.httpserver.HTTPServer(application)
diff --git a/static/html/test_label.html b/static/html/test_label.html
index 24b6fce..0c31610 100644
--- a/static/html/test_label.html
+++ b/static/html/test_label.html
@@ -14,9 +14,9 @@
14 function init() 14 function init()
15 { 15 {
16 var ext = new OpenLayers.Bounds(-2671.7575, -109.76259, 4500, 4000); 16 var ext = new OpenLayers.Bounds(-2671.7575, -109.76259, 4500, 4000);
17 var size = new OpenLayers.Size(4500/10, 4000/10); 17 var size = new OpenLayers.Size(4500, 4000);
18 18
19 options = {numZoomLevels: 20, 19 options = {numZoomLevels: 1,
20 units: 'pixels', 20 units: 'pixels',
21 maxExtent: ext, 21 maxExtent: ext,
22 controls:[ 22 controls:[
@@ -52,7 +52,7 @@
52 map.addLayers([outline, ntwk_id, label]); 52 map.addLayers([outline, ntwk_id, label]);
53 map.zoomToExtent(ext); 53 map.zoomToExtent(ext);
54 //Note: origin is set at the bottom left corner for OpenLayers !!! 54 //Note: origin is set at the bottom left corner for OpenLayers !!!
55 map.setCenter(new OpenLayers.LonLat(4500/5, 4000/5), 0, true, true) ; 55 map.setCenter(new OpenLayers.LonLat(0, 0), 0, true, true) ;
56 } 56 }
57 57
58 </script> 58 </script>
diff --git a/templates/index.html b/templates/index.html
index 23e6b76..467cd7d 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -78,12 +78,6 @@
78 78
79 function emphasize() 79 function emphasize()
80 { 80 {
81 var e = document.getElementById("{{forges[0].occupant_id}}");
82
83 e.setAttributeNS(null, "fill", "red");
84 e.style.fontFamily = "Arial";
85 e.style.fontSize = 20;
86 setCenter();
87 } 81 }
88 82
89 //Note: origin is set at the bottom left corner for OpenLayers !!! 83 //Note: origin is set at the bottom left corner for OpenLayers !!!
@@ -120,10 +114,10 @@
120 Found: 114 Found:
121 {% for detail in details %} 115 {% for detail in details %}
122 <ul id="result-list"> 116 <ul id="result-list">
123 {% if detail.id_type == u'occupant_id' %} 117 {% if detail.id_type == u'occupant' %}
124 <li><a href="/occupant_id/{{detail.id}}">{{detail.label}}</a></li> 118 <li><a href="/occupant/{{detail.id}}">{{detail.label}}</a></li>
125 {% else %} 119 {% else %}
126 <li><a href="/plot_id/{{detail.id}}">{{detail.label}} </a></li> 120 <li><a href="/plot/{{detail.id}}">{{detail.label}} </a></li>
127 {% end %} 121 {% end %}
128 </ul> 122 </ul>
129 {% end %} 123 {% end %}
@@ -143,6 +137,9 @@ Sorry, no match found. Please try to broaden your search by entering less in t h
143 <h2>{{details[0]}}</h2> 137 <h2>{{details[0]}}</h2>
144 <ul id="details"> 138 <ul id="details">
145 <li>Location: {{plots[0].map.location.name}} </li> 139 <li>Location: {{plots[0].map.location.name}} </li>
140 {% for i in xrange(3, len(details._fields)) %}
141 <li>{{getattr(details, details._fields[i]).name}}: {{getattr(details, details._fields[i]).data}}</li>
142 {% end %}
146 </ul> 143 </ul>
147 </div> 144 </div>
148 </div> 145 </div>