changeset 46:c6cab006f799

js for resources
author dwinter
date Wed, 26 Sep 2012 17:29:46 +0200
parents 5e9d90461929
children 54a4a96ad0c3
files src/main/webapp/annotationBrowser/js/annotation-core.js src/main/webapp/annotationBrowser/js/resource.js
diffstat 2 files changed, 27 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/webapp/annotationBrowser/js/annotation-core.js	Wed Sep 26 17:01:59 2012 +0200
+++ b/src/main/webapp/annotationBrowser/js/annotation-core.js	Wed Sep 26 17:29:46 2012 +0200
@@ -33,7 +33,7 @@
 	var md = dcDataPath+docUri+"/index.meta";
 	
 	 $('<div/>', {
-		    'class': 'annotatonMetaData',
+		    'class': 'annotationMetaData',
 		  }).load(md, function (){
 			 $(this).children().children().addClass('dcMetaData');
 		  }).appendTo(obj);
--- a/src/main/webapp/annotationBrowser/js/resource.js	Wed Sep 26 17:01:59 2012 +0200
+++ b/src/main/webapp/annotationBrowser/js/resource.js	Wed Sep 26 17:29:46 2012 +0200
@@ -9,7 +9,7 @@
 	var headers = {'x-annotator-auth-token':token};
 	
 	$.ajax({
-		  url: annotServer+'ressources/'+ressourceId+'/annotations?sortBy=uri',
+		  url: annotServer+'resources/'+ressourceId+'/annotations?sortBy=uri',
 		  dataType: 'json',
 		  headers:headers,
 		  success: function(data) {
@@ -30,7 +30,7 @@
 				
 			  $('#annotations').append(ret);
 			  //items.push(ret);
-			  getDCdata(rows[i]['uri'],$('#an_'+i));
+			  //getDCdata(rows[i]['uri'],$('#an_'+i));
 		  }
 		  //$('#annotations').html(items.join(''));
 		 
@@ -42,19 +42,37 @@
 $(document).ready(function(){
 	
 	getToken(tokenGenerator,username);
-	$.getJSON(annotServer+'ressources', function(data) {
+	$.getJSON(annotServer+'resources', function(data) {
 		  var items = [];
 		  var rows = data["rows"];
 		 
+		  
+		  $('#tagList').html("");
 		  for (var i=0;i<rows.length;i++){
-			  	 val=rows[i]['name'];
-				 items.push('<div class="tagLink" onclick="javascript: annotations(\''+rows[i]["id"]+'\');">'+val+'</div>');
-			
+			  	 val=rows[i]['uri'];
+				 ret='<div  id="res_'+i+'" class="tagLink" onclick="javascript: annotations(\''+rows[i]["id"]+'\');"></div>';
+				 $('#tagList').append(ret);
+				 
+				 var splitted = val.split("?");
+				 var docUri=splitted[0];
+					
+				docUri = docUri.replace(docNamespace,textPath);
+				var md = dcDataPath+docUri+"/index.meta";
+					
+				$('<div/>', {
+						    'class': 'annotationMetaData',
+						  }).load(md, function (){
+							 $(this).children().children().addClass('dcMetaData');
+						  }).appendTo("#res_"+i);
+					
+				 
+				 
+				 
 		  }
 		  
 		
-		  $('#tagList').html(items.join(''));
-		  annotations();		 
+		  //$('#tagList').html(items.join(''));
+		 
 		});