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.
  • Diff rendering mode:
  • inline
  • side by side

fetch.py

11import urllib211import urllib2
12import StringIO12import StringIO
13import json13import json
14import urllib
1415
15app = Flask(__name__)16app = Flask(__name__)
1617
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}):
37 for i in collection.find({'resource':resource}):
38 del(i['_id'])38 del(i['_id'])
39 ret[x] = i39 ret[x] = i
40 x = x + 140 x = x + 1
51 y = 051 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']
54 #keywords = json.loads(keywords_dict)['data']
55 for i in collection.find():55 for i in collection.find():
56 for keyword in keywords:
57 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] = i61 ret[y] = i
62 y = y + 162 y = y + 1
63 except:63 except:

static/myVector.js

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);
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: 8181 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){
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;

templates/blank.html

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] }}
4<p>{{ key }}: {{ content[obj][key] }}</p>
5{% endfor %}5{% endfor %}
6</div>6</div>
7{% endfor %}7{% endfor %}