Commit c6d359e0d93c019dc8a6c40499d2a570ef951858
- .gitignore 0
- README.md 0
- fetch.py 50 -------------+++++++++++++++++++++++++++++++++++++
- static/bootstrap.css 0
- static/bootstrap.js 0
- static/graphs/Hampi_GirijaKalyana.json 0
- static/jit.js 0
- static/myVector.js 0
- static/old.json 0
- static/test.json 0
- static/tree.css 0
- static/tree.js 59 ---------++++++++++++++++++++++++++++++++++++++++++++++++++
- submit.wsgi 0
- templates/index.html 1 +
- tileStache.cfg 0
- Diff rendering mode:
- inline
- side by side
fetch.py
10 | import lxml.html | 10 | import lxml.html |
---|---|---|---|
11 | import urllib2 | 11 | import urllib2 |
12 | import StringIO | 12 | import StringIO |
13 | import json | ||
13 | 14 | ||
14 | app = Flask(__name__) | 15 | app = Flask(__name__) |
15 | 16 | ||
… | … | ||
47 | c = pymongo.Connection() | 47 | c = pymongo.Connection() |
48 | db = c['mural'] | 48 | db = c['mural'] |
49 | coll = db['data'] | 49 | coll = db['data'] |
50 | |||
51 | |||
52 | |||
53 | |||
54 | |||
55 | |||
56 | |||
57 | |||
58 | |||
59 | |||
60 | |||
61 | 50 | for i in request.form['data']: | |
51 | coll.insert(i) | ||
52 | response = make_response() | ||
53 | response.status = "200 OK" | ||
54 | return response | ||
62 | 55 | ||
56 | @app.route('/web', methods=['GET']) | ||
57 | def web(): | ||
58 | return render_template('web.html') | ||
63 | 59 | ||
64 | @app.route('/SWeeText', methods=['GET']) | 60 | @app.route('/SWeeText', methods=['GET']) |
65 | def SWeeText(): | 61 | def SWeeText(): |
… | … | ||
74 | # inject the JS toolbar to annotate text | 74 | # inject the JS toolbar to annotate text |
75 | script = root.makeelement('script') | 75 | script = root.makeelement('script') |
76 | script.set('src', 'static/text-annotation.js') | 76 | script.set('src', 'static/text-annotation.js') |
77 | tree = root.makeelement('script') | ||
78 | tree.set('src', 'static/tree.js') | ||
79 | bs_js = root.makeelement('script') | ||
80 | bs_js.set('src', 'static/bootstrap.js') | ||
81 | jq = root.makeelement('script') | ||
82 | jq.set('src', 'static/jquery-1.9.1.min.js') | ||
83 | jit = root.makeelement('script') | ||
84 | jit.set('src', 'static/jit.js') | ||
85 | us = root.makeelement('script') | ||
86 | us.set('src', 'static/underscore-min-1.4.4.js') | ||
87 | |||
77 | link = root.makeelement('link') | 88 | link = root.makeelement('link') |
78 | link.set('href', 'static/text-annotation.css') | 89 | link.set('href', 'static/text-annotation.css') |
79 | link.set('type', 'text/css') | 90 | link.set('type', 'text/css') |
80 | link.set('rel', 'stylesheet') | 91 | link.set('rel', 'stylesheet') |
92 | bs = root.makeelement('link') | ||
93 | bs.set('href', 'static/bootstrap.css') | ||
94 | bs.set('type', 'text/css') | ||
95 | bs.set('rel', 'stylesheet') | ||
96 | tree_css = root.makeelement('link') | ||
97 | tree_css.set('href', 'static/tree.css') | ||
98 | tree_css.set('type', 'text/css') | ||
99 | tree_css.set('rel', 'stylesheet') | ||
81 | 100 | ||
101 | root.body.append(jq) | ||
102 | root.body.append(bs_js) | ||
103 | root.body.append(jit) | ||
104 | root.body.append(us) | ||
105 | root.body.append(tree) | ||
82 | root.body.append(script) | 106 | root.body.append(script) |
107 | |||
108 | root.head.append(bs) | ||
83 | root.head.append(link) | 109 | root.head.append(link) |
110 | root.head.append(tree_css) | ||
84 | 111 | ||
85 | return lxml.html.tostring(root) | 112 | return lxml.html.tostring(root) |
86 | 113 |
static/tree.js
111 | event.stopPropagation(); | 111 | event.stopPropagation(); |
---|---|---|---|
112 | } | 112 | } |
113 | //Log.write('centering node ', node.name); | 113 | //Log.write('centering node ', node.name); |
114 | console.log('centering node', node.name); | ||
114 | RGraph.onClick(node.id, { | 115 | RGraph.onClick(node.id, { |
115 | hideLabels: false, | 116 | hideLabels: false, |
116 | onComplete: function() { | 117 | onComplete: function() { |
… | … | ||
151 | user: user, | 151 | user: user, |
152 | type: this.type, | 152 | type: this.type, |
153 | uri: resource, | 153 | uri: resource, |
154 | |||
155 | |||
156 | |||
157 | |||
158 | nodes: this.nodes, | 154 | nodes: this.nodes, |
159 | }; | 155 | }; |
156 | if(attribs.hasOwnProperty('top') && | ||
157 | attribs.hasOwnProperty('bottom') && | ||
158 | attribs.hasOwnProperty('right') && | ||
159 | attribs.hasOwnProperty('left')) { | ||
160 | data.top = attribs.top; | ||
161 | data.bottom = attribs.bottom; | ||
162 | data.left = attribs.left; | ||
163 | data.right = attribs.right; | ||
164 | } | ||
165 | if(attribs.hasOwnProperty('xpath')) { | ||
166 | data.xpath = attribs.xpath; | ||
167 | } | ||
160 | this.swts.push(data); | 168 | this.swts.push(data); |
161 | this.nodes = []; | 169 | this.nodes = []; |
162 | }, | 170 | }, |
… | … | ||
173 | return; | 173 | return; |
174 | } | 174 | } |
175 | $('#publish').attr('disabled', 'disabled'); | 175 | $('#publish').attr('disabled', 'disabled'); |
176 | //$('#posted').show(); | ||
177 | var swts = ''; | ||
178 | for(var i in this.swts) { | ||
179 | var data = this.swts[i]; | ||
180 | var swt = '@'+data.user+' '+data.type+' '+data.uri; | ||
181 | if(data.hasOwnProperty('xpath')) { | ||
182 | swt += ' xpath: '+data.xpath; | ||
183 | } | ||
184 | if(data.hasOwnProperty('top')) { | ||
185 | swt += ' #['+data.top+','+data.right+','+data.bottom+','+data.left+']'; | ||
186 | } | ||
187 | swt += ' ' + data.nodes; | ||
188 | swts += swt + '\n'; | ||
189 | } | ||
190 | $('#sweet').html(swts); | ||
191 | $('#sweeted').show(); | ||
176 | $.ajax({ | 192 | $.ajax({ |
177 | type: 'POST', | 193 | type: 'POST', |
178 | url: config.indexer + '/submit', | 194 | url: config.indexer + '/submit', |
179 | 195 | data: {'data': this.swts}, | |
180 | success: function() { | 196 | success: function() { |
181 | 197 | /*$.ajax({ | |
182 | type: 'POST', | 198 | type: 'POST', |
183 | url: config.postTweetUrl, | 199 | url: config.postTweetUrl, |
184 | data: {'data': JSON.stringify(this.swts)}, | 200 | data: {'data': JSON.stringify(this.swts)}, |
… | … | ||
205 | error: function() { | 205 | error: function() { |
206 | $('#fail-posting').show(); | 206 | $('#fail-posting').show(); |
207 | } | 207 | } |
208 | 208 | });*/ | |
209 | $('#posted').show(); | ||
210 | var swts = ''; | ||
211 | for(var i in this.swts) { | ||
212 | var data = this.swts[i]; | ||
213 | var swt = '@'+data.user+' '+data.type+' '+data.uri; | ||
214 | if(data.hasOwnProperty('xpath')) { | ||
215 | swt += ' xpath: '+data.xpath; | ||
216 | } | ||
217 | if(data.hasOwnProperty('top')) { | ||
218 | swt += ' #['+data.top+','+data.right+','+data.bottom+','+data.left+']'; | ||
219 | } | ||
220 | swt += ' ' + data.nodes; | ||
221 | swts += swt + '\n'; | ||
222 | } | ||
223 | $('#sweet').html(swts); | ||
224 | this.swts = []; | ||
209 | }, | 225 | }, |
210 | error: function() { | 226 | error: function() { |
211 | 227 | //$('#fail-posting').show(); | |
212 | } | 228 | } |
213 | }); | 229 | }); |
214 | } | 230 | } |
… | … | ||
266 | size: 14 | 266 | size: 14 |
267 | }, | 267 | }, |
268 | interpolation: 'polar', | 268 | interpolation: 'polar', |
269 | 269 | transition: $jit.Trans.Sine.easeIn, | |
270 | levelDistance: 150, | 270 | levelDistance: 150, |
271 | onCreateLabel: function(domElement, node) { | 271 | onCreateLabel: function(domElement, node) { |
272 | console.log('oncreatelabel'); | 272 | console.log('oncreatelabel'); |
templates/index.html
70 | <!-- PLEASE, LET THIS NOTE ABOUT AUTHOR AND PROJECT SOMEWHERE ON YOUR WEBSITE, OR AT LEAST IN THE COMMENT IN HTML. THANK YOU --> | 70 | <!-- PLEASE, LET THIS NOTE ABOUT AUTHOR AND PROJECT SOMEWHERE ON YOUR WEBSITE, OR AT LEAST IN THE COMMENT IN HTML. THANK YOU --> |
---|---|---|---|
71 | </div> | 71 | </div> |
72 | 72 | ||
73 | </div> | ||
73 | </div> | 74 | </div> |
74 | 75 | ||
75 | <script type="text/javascript" >resize();</script> | 76 | <script type="text/javascript" >resize();</script> |