Commit 658cf57802dbce0ec6027e740b094bc722c9a698
- Diff rendering mode:
- inline
- side by side
alipi/alipi.py
(27 / 0)
  | |||
455 | 455 | connection.disconnect() | |
456 | 456 | return "empty" | |
457 | 457 | ||
458 | |||
459 | @app.route("/domain") | ||
460 | def serve_domain_info(): | ||
461 | collection = g.db['post'] | ||
462 | url = request.args['url'] | ||
463 | #all re-narrations of the same xpath are grouped | ||
464 | query = collection.group( | ||
465 | key = None, | ||
466 | condition={"about" :{'$regex':url+'*'}}, | ||
467 | initial={'narration': []}, | ||
468 | reduce=Code('function(doc,out){out.narration.push(doc["about"]);}') | ||
469 | ) | ||
470 | |||
471 | string='' | ||
472 | if len(query)==0: | ||
473 | return 'empty' | ||
474 | else: | ||
475 | otherlist = [] | ||
476 | mylist = query[0]['narration'] | ||
477 | for i in mylist: | ||
478 | if i in otherlist: | ||
479 | pass | ||
480 | else: | ||
481 | otherlist.append(str(i)) | ||
482 | return json.dumps(otherlist) | ||
483 | |||
484 | |||
458 | 485 | import logging,os | |
459 | 486 | from logging import FileHandler | |
460 | 487 |
alipi/ui.js
(23 / 19)
  | |||
653 | 653 | }, | |
654 | 654 | ||
655 | 655 | ajaxLinks1: function() { | |
656 | var xhr = new XMLHttpRequest(); | ||
657 | xhr.onreadystatechange = function() | ||
658 | { | ||
659 | if(xhr.readyState == 4) | ||
660 | { | ||
661 | if(xhr.responseText == "empty") | ||
662 | { } | ||
663 | else | ||
664 | { | ||
665 | $('#see-links').show(); | ||
666 | a11ypi.showlinks = JSON.parse(xhr.responseText); | ||
667 | } | ||
668 | } | ||
669 | } | ||
670 | xhr.open("POST",config.root+"/domain",true); | ||
671 | xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
672 | d = window.location.search.split('?')[1]; | ||
673 | a = a11ypi.getParams(); | ||
674 | xhr.send('url='+a['foruri']) | ||
656 | // var xhr = new XMLHttpRequest(); | ||
657 | // xhr.onreadystatechange = function() | ||
658 | // { | ||
659 | // if(xhr.readyState == 4) | ||
660 | // { | ||
661 | // if(xhr.responseText == "empty") | ||
662 | // { } | ||
663 | // else | ||
664 | // { | ||
665 | // $('#see-links').show(); | ||
666 | // a11ypi.showlinks = JSON.parse(xhr.responseText); | ||
667 | // } | ||
668 | // } | ||
669 | // } | ||
670 | // xhr.open("POST",config.deploy+"/domain",true); | ||
671 | // xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); | ||
672 | // d = window.location.search.split('?')[1]; | ||
673 | // a = a11ypi.getParams(); | ||
674 | // xhr.send('url='+a['foruri']) | ||
675 | |||
676 | $.get(config.deploy+"/domain", {"url":a['foruri']}, function(data){ | ||
677 | a11ypi.showlinks = JSON.parse(data); | ||
678 | }); | ||
675 | 679 | }, | |
676 | 680 | showBox1: function() { | |
677 | 681 | this.hideAll(); |