Mercurial > hg > AnnotationManagerN4J
annotate src/main/webapp/annotationBrowser/js/annotation.js @ 79:4466194a4eae
upped version number to 0.4. use neo4j 2.1.
| author | casties |
|---|---|
| date | Fri, 18 Jul 2014 18:08:41 +0200 |
| parents | 39bc52f9b102 |
| children |
| rev | line source |
|---|---|
| 37 | 1 function annotations(){ |
| 2 | |
| 31 | 3 |
| 37 | 4 if (token==""){ |
| 5 setTimeout(function(){annotations();},500); | |
| 6 return; | |
| 7 } | |
| 31 | 8 |
| 37 | 9 var headers = {'x-annotator-auth-token':token}; |
| 31 | 10 |
| 37 | 11 $.ajax({ |
| 12 url: annotServer+'annotations?sortBy=uri', | |
| 13 dataType: 'json', | |
| 14 headers:headers, | |
| 15 success: function(data) { | |
| 31 | 16 //var items = []; |
| 17 var rows = data["rows"]; | |
| 18 | |
| 19 $('#annotations').html(""); | |
| 20 for (var i=0;i<rows.length;i++){ | |
| 21 var text=rows[i]['text']; | |
|
68
39bc52f9b102
(hopefully) fixed issues with neo4j 2.0 transactions.
casties
parents:
37
diff
changeset
|
22 var author= (rows[i]['user'] != null) ? rows[i]['user']['name'] : 'NO USER'; |
| 31 | 23 var docUri=createLinkFromURI(rows[i]['uri']); |
| 24 | |
| 25 var ret = '<div id="an_'+i+'" class="annotationRow">'; | |
| 26 ret +='<div class="annotationCol">'+text+'</div>'; | |
| 27 ret +='<div class="annotationCol">'+author+'</div>'; | |
| 28 ret +='<div class="annotationCol"><a target="libcoll" href="'+docUri+'">'+docUri+'</a></div>'; | |
| 29 ret+="</div>"; | |
| 30 | |
| 31 $('#annotations').append(ret); | |
| 32 //items.push(ret); | |
| 33 getDCdata(rows[i]['uri'],$('#an_'+i)); | |
| 34 } | |
| 35 //$('#annotations').html(items.join('')); | |
| 36 | |
| 37 | 37 } |
| 31 | 38 }); |
| 39 } | |
| 40 | |
| 41 | |
| 42 $(document).ready(function(){ | |
| 37 | 43 |
| 44 getToken(tokenGenerator,username); | |
| 31 | 45 $.getJSON(annotServer+'tags', function(data) { |
| 46 var items = []; | |
| 47 var rows = data["rows"]; | |
| 48 | |
| 49 // for (var i=0;i<rows.length;i++){ | |
| 50 // val=rows[i]['name']; | |
| 51 // items.push('<div class="tagLink" onclick="javascript: annotations(\''+rows[i]["id"]+'\');">'+val+'</div>'); | |
| 52 // | |
| 53 // } | |
| 54 | |
| 55 items.push('<div class="tagLink" onclick="javascript: annotations();">all</div>'); | |
| 56 $('#tagList').html(items.join('')); | |
| 57 annotations(); | |
| 58 }); | |
| 59 | |
| 60 | |
| 61 | |
| 62 }); | |
| 37 | 63 |
| 64 | |
| 65 |
