Commit 11e0e84b5ead4de67e2cd04b9ae11e708b80450c

  • avatar
  • arvind
  • Tue Apr 16 21:04:44 IST 2013
Integrating old changes.
- Annotations come in a popup.
- URLs in annotations are decoded.
fetch.py
(5 / 4)
  
1111import urllib2
1212import StringIO
1313import json
14import urllib
1415
1516app = Flask(__name__)
1617
3434 resource = "default"
3535 if request.args.has_key('uri'):
3636 resource = request.args['uri']
37 for i in collection.find({'uri':resource}):
37 for i in collection.find({'resource':resource}):
3838 del(i['_id'])
3939 ret[x] = i
4040 x = x + 1
5151 y = 0
5252 ret = {}
5353 keywords_dict = json.loads(request.args['data'])
54 keywords = json.loads(keywords_dict)['data']
54 #keywords = json.loads(keywords_dict)['data']
5555 for i in collection.find():
56 for keyword in keywords:
57 print keyword
56 for keyword in keywords_dict:
5857 try:
5958 if keyword in i['nodes']:
6059 del(i['_id'])
60 i['text'] = urllib.unquote_plus(i['text'])
6161 ret[y] = i
6262 y = y + 1
6363 except:
  
7272 str['material'] = ans.ans[i]['material'];
7373 // str['jewellery'] = ans.ans[i]['jewellery']
7474 }
75
7576 z = new OpenLayers.Popup.FramedCloud(
7677 "test",
7778 feature.geometry.getBounds().getCenterLonLat(),
7879 new OpenLayers.Size(640,480),
79 JSON.stringify(str,null,' '),null,true);
80 '<iframe src='+config.indexer+"/search?data="+JSON.stringify(ans.ans[i]["nodes"])+" ></iframe>",null,true);
8081 feature.popup = z;
8182 z.panMapIfOutOfView = true;
8283 map.addPopup(z);
181181 numZoomLevels: 8
182182 };
183183 map = new OpenLayers.Map('map', options);
184 $.get(config.indexer+"/fetch",{url:window.location.href} , function(data){
184 $.get(config.indexer+"/fetch",{uri:"default"} , function(data){
185185 if (data != undefined)
186186 {
187187 ans.ans = data;
  
11{% for obj in content %}
22<div>
33{% for key in content[obj].keys() %}
4{{ key }}: {{ content[obj][key] }}
4<p>{{ key }}: {{ content[obj][key] }}</p>
55{% endfor %}
66</div>
77{% endfor %}