Commit 8b999e85de835640e0758bebdd4c0e4796533356
- Diff rendering mode:
- inline
- side by side
server/alipi.py
(3 / 3)
  | |||
273 | 273 | except IndexError: | |
274 | 274 | pass | |
275 | 275 | ||
276 | elif request.args['type'] == 'comment': | ||
276 | elif request.args['type'] == '5el': | ||
277 | 277 | query = [] | |
278 | 278 | query = collection.group( | |
279 | 279 | key = Code('function(doc){return {"xpath" : doc.xpath, "about": doc.url}}'), | |
280 | condition={"about" : url, "lang" : lang,"type":"comment"}, | ||
280 | condition={"about" : url, "lang" : lang,"type":"5el"}, | ||
281 | 281 | initial={'narration': []}, | |
282 | 282 | reduce=Code('function(doc,out){out.narration.push(doc);}') | |
283 | 283 | ) | |
… | … | ||
321 | 321 | d['lang'] = request.form['lang'] | |
322 | 322 | d['location'] = request.form['location'] | |
323 | 323 | coll.insert(d) | |
324 | if d['type'] == 'comment': | ||
324 | if d['type'] == '5el': | ||
325 | 325 | collection = g.db['post'] | |
326 | 326 | root = html5parser.parse(d['blog']).getroot() | |
327 | 327 | tree = root.getroottree() |
server/templates/feeds.html
(20 / 7)
  | |||
11 | 11 | $.each(data, function(i, val) | |
12 | 12 | { | |
13 | 13 | if(val['about'] != undefined && val['about'] != 'undefined' && val['author'] != 'undefined' ) | |
14 | str += "<p>\n<b>@" +val['author']+"</b> has narrated <b>"+val['about']+"#"+val['xpath']+"</b> at <b>"+val['blog']+"#"+val['bxpath']+"</b> for <b>"+val['location']+"</b> in <b>"+val['lang']+"</b>\n</p>"; | ||
14 | { | ||
15 | if(val['location']!='location') | ||
16 | { | ||
17 | str += "<p>\n<b>@" +val['author']+"</b> has "+val['type']+" for <b>"+val['about']+"#"+val['xpath']+"</b> at <b>"+val['blog']+"#"+val['bxpath']+"</b> for <b>"+val['location']+"</b> in <b>"+val['lang']+"</b>\n</p>"; | ||
18 | } | ||
19 | else | ||
20 | str += "<p>\n<b>@" +val['author']+"</b> has "+val['type']+" for <b>"+val['about']+"#"+val['xpath']+"</b> at <b>"+val['blog']+"#"+val['bxpath']+"</b> for <b>"+val['lang']+"</b>\n</p>"; | ||
21 | } | ||
15 | 22 | }); | |
16 | 23 | $("#feeds").html(str); | |
17 | 24 | }); | |
18 | 25 | </script> | |
19 | 26 | </head> | |
20 | 27 | <body style="text-wrap:normal"> | |
21 | @<input type="text" id="t1" name="author" value="author" /> says <input type="text" id="t2" name="about" value="about" /> <input type="text" id="t3" name="xpath" value="xpath" /> has <select id="selected" ><option>re-narrations</option><option>comment</option></select> at <input type="text" id="t4" name="blog" value="blog" /> <input type="text" id="t5" name="bxpath" value="bxpath" /> in <input type="text" name="lang" value="language" id="t6" /> targetting <input type="text" name="loc" value="location" id="t7"/> <input type="submit" id="post" name="alipi" value="Feed" onclick="postForm();" /> | ||
28 | @<input type="text" id="t1" name="author" value="author" /> says <input type="text" id="t2" name="about" value="about" /> <input type="text" id="t3" name="xpath" value="xpath" /> has <select id="selected" onchange="checkVal();"><option>re-narrations</option><option>5el</option></select> at <input type="text" id="t4" name="blog" value="blog" /> <input type="text" id="t5" name="bxpath" value="bxpath" /> in <input type="text" name="lang" value="language" id="t6" /> <span id="remove">targetting</span> <input type="text" name="loc" value="location" id="t7"/> <input type="submit" id="post" name="alipi" value="Feed" onclick="postForm();" /> | ||
22 | 29 | <div id="feeds"> | |
23 | 30 | </div> | |
24 | 31 | <script type="text/javascript"> | |
… | … | ||
40 | 40 | arr['type'] = $("#selected").val(); | |
41 | 41 | arr['lang'] = $('#t6').val(); | |
42 | 42 | arr['location'] = $('#t7').val(); | |
43 | $.post("http://127.0.0.1:5000/feeds/write", arr, function(data) | ||
43 | $.post(config.deploy+"/feeds/write", arr, function(data) | ||
44 | 44 | { | |
45 | 45 | alert("Posted"); | |
46 | 46 | }); | |
47 | 47 | } | |
48 | 48 | function checkVal(){ | |
49 | if($("#selected").val() == "comment") | ||
50 | $("#post").hide(); | ||
49 | if($("#selected").val() == "5el") | ||
50 | { | ||
51 | $("#t7, #remove").hide(); | ||
52 | $("#t6").val("tags"); | ||
53 | } | ||
51 | 54 | else | |
52 | $("#post").show(); | ||
53 | } | ||
55 | { | ||
56 | $("#t7, #remove").show(); | ||
57 | $("#t6").val("language"); | ||
58 | } | ||
59 | } | ||
54 | 60 | ||
55 | 61 | </script> | |
56 | 62 | </body> |
server/ui.js
(11 / 7)
  | |||
49 | 49 | var para = document.createElement("p"); | |
50 | 50 | var newel = document.createElement("a"); | |
51 | 51 | newel.textContent = a11ypi.showbox[i]['lang']; | |
52 | $(newel).attr("href",config.deploy+"/?foruri="+a['foruri']+"&lang="+a11ypi.showbox[i]['lang']+"&interactive=1"+"&type="+type); | ||
52 | if(type == 'renarration') | ||
53 | $(newel).attr("href",config.deploy+"/?foruri="+a['foruri']+"&lang="+a11ypi.showbox[i]['lang']+"&interactive=1"+"&type="+type); | ||
54 | else | ||
55 | $(newel).attr("href",config.deploy+"/?foruri="+a['foruri']+"&lang="+a11ypi.showbox[i]['lang']+"&interactive=0"+"&type="+type); | ||
53 | 56 | para.appendChild(newel); | |
54 | 57 | xyz.appendChild(para); | |
55 | 58 | } | |
… | … | ||
179 | 179 | // dump( 'error: Document tree modified during iteration ' + e ); | |
180 | 180 | } | |
181 | 181 | } | |
182 | else if(a['type']=='comment') | ||
182 | else if(a['type']=='5el') | ||
183 | 183 | { | |
184 | 184 | ||
185 | 185 | try{ | |
186 | 186 | var result = nodes.iterateNext(); | |
187 | 187 | while (result) | |
188 | 188 | { | |
189 | result.innerHTML = a['data']; | ||
189 | $(result).html($(result).html()+a['data']); | ||
190 | $(result).get(0).scrollIntoView(); | ||
190 | 191 | result=nodes.iterateNext(); | |
191 | 192 | } | |
192 | 193 | } | |
… | … | ||
303 | 303 | '<button id="edit-current" class="alipi" onclick="a11ypi.editPage();" title="Allow to edit this page">Re-narrate</button> '+ | |
304 | 304 | '<button id="see-narration" class="alipi" onclick="a11ypi.showBox();" title="See other renarrations, which are in same or other languages"> '+ | |
305 | 305 | 'Re-narrations</button>'+ | |
306 | '<button id="see-comment" class="alipi" onclick="a11ypi.showComment();" title="Comments"> '+ | ||
307 | 'Comments</button>'+ | ||
306 | '<button id="see-comment" class="alipi" onclick="a11ypi.showComment();" title="5el"> '+ | ||
307 | '5el</button>'+ | ||
308 | 308 | '<button id="see-links" class="alipi" onclick="a11ypi.showBox1();" title="See other re-narrated pages of this domain">Re-narrated Pages '+ | |
309 | 309 | '</button>'+ | |
310 | 310 | '<select id="blog-filter" class="alipi" onChange="a11ypi.checkSelect();" title="Select one of the blog name"></select>'+ | |
… | … | ||
621 | 621 | modal: true | |
622 | 622 | }); | |
623 | 623 | }); | |
624 | a11ypi.createMenu('comment'); | ||
624 | a11ypi.createMenu('5el'); | ||
625 | 625 | }, | |
626 | 626 | ||
627 | 627 | ajaxLinks1: function() { | |
… | … | ||
998 | 998 | { | |
999 | 999 | d = window.location.search.split('?')[1]; | |
1000 | 1000 | for (var i = 0;i<d.split('&').length;i++){ | |
1001 | a[d.split('&')[i].split('=')[0]] = d.split('&')[i].split('=')[1]; | ||
1001 | a[d.split('&')[i].split('=')[0]] = decodeURIComponent(d.split('&')[i].split('=')[1]); | ||
1002 | 1002 | } | |
1003 | 1003 | return a; | |
1004 | 1004 | } |