Commit 11e0e84b5ead4de67e2cd04b9ae11e708b80450c
Integrating old changes.
- Annotations come in a popup.
- URLs in annotations are decoded.
| | | | 11 | import urllib2 | 11 | import urllib2 |
---|
12 | import StringIO | 12 | import StringIO |
---|
13 | import json | 13 | import json |
---|
| | 14 | import urllib |
---|
14 | | 15 | |
---|
15 | app = Flask(__name__) | 16 | app = Flask(__name__) |
---|
16 | | 17 | |
---|
… | | … | |
---|
34 | resource = "default" | 34 | resource = "default" |
---|
35 | if request.args.has_key('uri'): | 35 | if request.args.has_key('uri'): |
---|
36 | resource = request.args['uri'] | 36 | resource = request.args['uri'] |
---|
37 | for i in collection.find({'uri':resource}): | | for i in collection.find({'uri':resource}): |
---|
| | 37 | for i in collection.find({'resource':resource}): | 38 | del(i['_id']) | 38 | del(i['_id']) |
---|
39 | ret[x] = i | 39 | ret[x] = i |
---|
40 | x = x + 1 | 40 | x = x + 1 |
---|
… | | … | |
---|
51 | y = 0 | 51 | y = 0 |
---|
52 | ret = {} | 52 | ret = {} |
---|
53 | keywords_dict = json.loads(request.args['data']) | 53 | keywords_dict = json.loads(request.args['data']) |
---|
54 | keywords = json.loads(keywords_dict)['data'] | | keywords = json.loads(keywords_dict)['data'] |
---|
| | 54 | #keywords = json.loads(keywords_dict)['data'] | 55 | for i in collection.find(): | 55 | for i in collection.find(): |
---|
56 | for keyword in keywords: | | for keyword in keywords: |
---|
57 | print keyword | | print keyword |
---|
| | 56 | for keyword in keywords_dict: | 58 | try: | 57 | try: |
---|
59 | if keyword in i['nodes']: | 58 | if keyword in i['nodes']: |
---|
60 | del(i['_id']) | 59 | del(i['_id']) |
---|
| | 60 | i['text'] = urllib.unquote_plus(i['text']) |
---|
61 | ret[y] = i | 61 | ret[y] = i |
---|
62 | y = y + 1 | 62 | y = y + 1 |
---|
63 | except: | 63 | except: |
---|
| | | | 72 | str['material'] = ans.ans[i]['material']; | 72 | str['material'] = ans.ans[i]['material']; |
---|
73 | // str['jewellery'] = ans.ans[i]['jewellery'] | 73 | // str['jewellery'] = ans.ans[i]['jewellery'] |
---|
74 | } | 74 | } |
---|
| | 75 | |
---|
75 | z = new OpenLayers.Popup.FramedCloud( | 76 | z = new OpenLayers.Popup.FramedCloud( |
---|
76 | "test", | 77 | "test", |
---|
77 | feature.geometry.getBounds().getCenterLonLat(), | 78 | feature.geometry.getBounds().getCenterLonLat(), |
---|
78 | new OpenLayers.Size(640,480), | 79 | new OpenLayers.Size(640,480), |
---|
79 | JSON.stringify(str,null,' '),null,true); | | JSON.stringify(str,null,' '),null,true); |
---|
| | 80 | '<iframe src='+config.indexer+"/search?data="+JSON.stringify(ans.ans[i]["nodes"])+" ></iframe>",null,true); | 80 | feature.popup = z; | 81 | feature.popup = z; |
---|
81 | z.panMapIfOutOfView = true; | 82 | z.panMapIfOutOfView = true; |
---|
82 | map.addPopup(z); | 83 | map.addPopup(z); |
---|
… | | … | |
---|
181 | numZoomLevels: 8 | 181 | numZoomLevels: 8 |
---|
182 | }; | 182 | }; |
---|
183 | map = new OpenLayers.Map('map', options); | 183 | map = new OpenLayers.Map('map', options); |
---|
184 | $.get(config.indexer+"/fetch",{url:window.location.href} , function(data){ | | $.get(config.indexer+"/fetch",{url:window.location.href} , function(data){ |
---|
| | 184 | $.get(config.indexer+"/fetch",{uri:"default"} , function(data){ | 185 | if (data != undefined) | 185 | if (data != undefined) |
---|
186 | { | 186 | { |
---|
187 | ans.ans = data; | 187 | ans.ans = data; |
---|
| | | | 1 | {% for obj in content %} | 1 | {% for obj in content %} |
---|
2 | <div> | 2 | <div> |
---|
3 | {% for key in content[obj].keys() %} | 3 | {% for key in content[obj].keys() %} |
---|
4 | {{ key }}: {{ content[obj][key] }} | | {{ key }}: {{ content[obj][key] }} |
---|
| | 4 | <p>{{ key }}: {{ content[obj][key] }}</p> | 5 | {% endfor %} | 5 | {% endfor %} |
---|
6 | </div> | 6 | </div> |
---|
7 | {% endfor %} | 7 | {% endfor %} |
---|