Commit 8b999e85de835640e0758bebdd4c0e4796533356

  • avatar
  • arvind
  • Mon Jul 23 12:21:51 IST 2012
Use tags for 5el ala comments
  
273273 except IndexError:
274274 pass
275275
276 elif request.args['type'] == 'comment':
276 elif request.args['type'] == '5el':
277277 query = []
278278 query = collection.group(
279279 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"},
281281 initial={'narration': []},
282282 reduce=Code('function(doc,out){out.narration.push(doc);}')
283283 )
321321 d['lang'] = request.form['lang']
322322 d['location'] = request.form['location']
323323 coll.insert(d)
324 if d['type'] == 'comment':
324 if d['type'] == '5el':
325325 collection = g.db['post']
326326 root = html5parser.parse(d['blog']).getroot()
327327 tree = root.getroottree()
  
1111 $.each(data, function(i, val)
1212 {
1313 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 }
1522 });
1623 $("#feeds").html(str);
1724 });
1825 </script>
1926</head>
2027<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();" />
2229<div id="feeds">
2330</div>
2431<script type="text/javascript">
4040 arr['type'] = $("#selected").val();
4141 arr['lang'] = $('#t6').val();
4242 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)
4444 {
4545 alert("Posted");
4646 });
4747}
4848function checkVal(){
49 if($("#selected").val() == "comment")
50 $("#post").hide();
49 if($("#selected").val() == "5el")
50 {
51 $("#t7, #remove").hide();
52 $("#t6").val("tags");
53 }
5154 else
52 $("#post").show();
53}
55 {
56 $("#t7, #remove").show();
57 $("#t6").val("language");
58 }
59 }
5460
5561</script>
5662</body>
server/ui.js
(11 / 7)
  
4949 var para = document.createElement("p");
5050 var newel = document.createElement("a");
5151 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);
5356 para.appendChild(newel);
5457 xyz.appendChild(para);
5558 }
179179 // dump( 'error: Document tree modified during iteration ' + e );
180180 }
181181 }
182 else if(a['type']=='comment')
182 else if(a['type']=='5el')
183183 {
184184
185185 try{
186186 var result = nodes.iterateNext();
187187 while (result)
188188 {
189 result.innerHTML = a['data'];
189 $(result).html($(result).html()+a['data']);
190 $(result).get(0).scrollIntoView();
190191 result=nodes.iterateNext();
191192 }
192193 }
303303 '<button id="edit-current" class="alipi" onclick="a11ypi.editPage();" title="Allow to edit this page">Re-narrate</button> '+
304304 '<button id="see-narration" class="alipi" onclick="a11ypi.showBox();" title="See other renarrations, which are in same or other languages"> '+
305305 '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>'+
308308 '<button id="see-links" class="alipi" onclick="a11ypi.showBox1();" title="See other re-narrated pages of this domain">Re-narrated Pages '+
309309 '</button>'+
310310 '<select id="blog-filter" class="alipi" onChange="a11ypi.checkSelect();" title="Select one of the blog name"></select>'+
621621 modal: true
622622 });
623623 });
624 a11ypi.createMenu('comment');
624 a11ypi.createMenu('5el');
625625 },
626626
627627 ajaxLinks1: function() {
998998 {
999999 d = window.location.search.split('?')[1];
10001000 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]);
10021002 }
10031003 return a;
10041004 }