Commit 031803b2a1571ad7c6612ce7837b174f111354c4

  • avatar
  • arvind
  • Tue Apr 16 23:17:17 IST 2013
Hyd demo
server.py
(10 / 3)
  
3434 resource = "default"
3535 if request.args.has_key('uri'):
3636 resource = request.args['uri']
37 for i in collection.find({'resource':resource}):
37 for i in collection.find({'uri':resource}):
3838 del(i['_id'])
3939 ret[x] = i
4040 x = x + 1
41 else:
42 for i in collection.find():
43 del(i['_id'])
44 ret[x] = i
45 x = x + 1
4146 if len(ret) == 0:
4247 ret['error'] = "Sorry! No re-treats for you."
4348 return jsonify(ret)
4449
50@app.route('/sweets', methods=['GET'])
51def displaySweet():
52 return render_template('sweets.html')
4553
4654@app.route('/search', methods=['GET'])
4755def search():
6565 try:
6666 if keyword in i['nodes']:
6767 del(i['_id'])
68 i['text'] = urllib.unquote_plus(i['text'])
6968 ret[y] = i
7069 y = y + 1
7170 except:
126126
127127 bs_js = root.makeelement('script')
128128 bs_js.set('src', 'static/bootstrap.js')
129
129
130130 jit = root.makeelement('script')
131131 jit.set('src', 'static/jit.js')
132132
  
44 iStuff = ua.match(/iPhone/i) || ua.match(/iPad/i),
55 typeOfCanvas = typeof HTMLCanvasElement,
66 nativeCanvasSupport = (typeOfCanvas == 'object' || typeOfCanvas == 'function'),
7 textSupport = nativeCanvasSupport
7 textSupport = nativeCanvasSupport
88 && (typeof document.createElement('canvas').getContext('2d').fillText == 'function');
99 //I'm setting this based on the fact that ExCanvas provides text support for IE
1010 //and that as of today iPhone/iPad current text support is lame
121121 }
122122 //Log.write('centering node ', node.name);
123123 console.log('centering node', node.name);
124 RGraph.onClick(node.id, {
125 hideLabels: false,
126 onComplete: function() {
127 //Log.write("done");
124 RGraph.onClick(node.id, {
125 hideLabels: false,
126 onComplete: function() {
127 //Log.write("done");
128128 }
129 });
129 });
130130 var html = '<h4>' + node.name + '</h4><b>Links To:</b>:<ul>';
131131 node.eachAdjacency(function(adj) {
132132 html += '<li><a class="list-nodes" href="#" id="list-' + adj.nodeTo.id + '">' +
159159 },
160160 save: function() {
161161 var resource = window.location.search ? window.location.search.split('=')[1] :
162 'default';
162 window.location.href;
163163 resource = decodeURIComponent(resource).replace('"', '', 'gi');
164164 var data = {
165165 user: user,
166166 type: this.type,
167167 uri: resource,
168168 nodes: this.nodes,
169 name: attribs.name
169170 };
170171 if(attribs.hasOwnProperty('top') &&
171172 attribs.hasOwnProperty('bottom') &&
  
1<!DOCTYPE html>
2<html>
3<head>
4 <meta charset="utf-8">
5 <meta http-equiv='imagetoolbar' content='no'/>
6 <title> Web Annotation </title>
7 <link rel="stylesheet" type="text/css" href="static/bootstrap.css"></link>
8 <script type="text/javascript" src="static/jquery-1.9.1.min.js"></script>
9 <script type="text/javascript" src="static/bootstrap.js"></script>
10 <style type="text/css">
11 .container {
12 margin-top: 30px;
13 }
14 .box{
15 border: 1px solid black;
16 padding: 10px;
17 margin: 10px;
18}
19 </style>
20</head>
21 <body>
22 <div class="container"></div>
23 <script>
24 window.onload = function(){
25
26 $.get('{{ url_for('fetch') }}', function(data){
27 var html = '';
28 for(var i in data){
29 html += "<div class='box'><ul>";
30 for(var j in data[i]){
31 html += "<li>"+j+" : "+data[i][j]+"</li>";
32 }
33 html+= "</ul></div>";
34 }
35 $(".container").html(html);
36});
37}
38 </script>
39
40 </body>
41</html>