From 11e0e84b5ead4de67e2cd04b9ae11e708b80450c Mon Sep 17 00:00:00 2001 From: Arvind Date: Tue, 16 Apr 2013 21:04:44 +0530 Subject: [PATCH] Integrating old changes. - Annotations come in a popup. - URLs in annotations are decoded. --- fetch.py | 9 +++++---- static/myVector.js | 5 +++-- templates/blank.html | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/fetch.py b/fetch.py index 74d02e9..954f3ef 100755 --- a/fetch.py +++ b/fetch.py @@ -11,6 +11,7 @@ import lxml.html import urllib2 import StringIO import json +import urllib app = Flask(__name__) @@ -33,7 +34,7 @@ def fetch(): resource = "default" if request.args.has_key('uri'): resource = request.args['uri'] - for i in collection.find({'uri':resource}): + for i in collection.find({'resource':resource}): del(i['_id']) ret[x] = i x = x + 1 @@ -50,13 +51,13 @@ def search(): y = 0 ret = {} keywords_dict = json.loads(request.args['data']) - keywords = json.loads(keywords_dict)['data'] + #keywords = json.loads(keywords_dict)['data'] for i in collection.find(): - for keyword in keywords: - print keyword + for keyword in keywords_dict: try: if keyword in i['nodes']: del(i['_id']) + i['text'] = urllib.unquote_plus(i['text']) ret[y] = i y = y + 1 except: diff --git a/static/myVector.js b/static/myVector.js index f67cd1c..a574819 100755 --- a/static/myVector.js +++ b/static/myVector.js @@ -72,11 +72,12 @@ function onFeatureSelect(feature) str['material'] = ans.ans[i]['material']; // str['jewellery'] = ans.ans[i]['jewellery'] } + z = new OpenLayers.Popup.FramedCloud( "test", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(640,480), - JSON.stringify(str,null,' '),null,true); + '