Changeset 4545
- Timestamp:
- 02/21/14 14:45:20 (10 years ago)
- Location:
- DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/annotation-service.js
r4357 r4545 20 20 } 21 21 }, 22 getAnnotations: function(params, callback) { 22 getAnnotations: function(url, callback) { 23 annotationProxy.log('calling the annotation backend '); 24 23 25 $.ajax({ 24 26 type: "GET", 25 url: this.getBackend() + '/annotations', 26 data: params, 27 url: this.getBackend() + '/api/annotations?link='+url, 27 28 dataType: "xml", 28 success: function(xml) { 29 beforeSend: function(xhr){xhr.setRequestHeader('Content-Type', 'application/xml');}, 30 success: function(xml, textStatus, jqXHR) { 31 32 29 33 var annotations = Array(); 30 31 $xml = $(xml); 32 $xml.find('annotation').each(function() { 33 var annotation = $.xml2json(this); 34 35 annotations.push(annotation); 34 35 $xml = $.parseXML(jqXHR.responseText); 36 annotationProxy.log($xml); 37 38 jQuery($xml).find('annotationInfo').each(function() { 39 annotationProxy.log(this); 40 annotationProxy.log(this.getAttribute('ref')); 41 42 43 annotations.push(this.getAttribute('ref')); 36 44 }); 45 37 46 38 47 callback.call(undefined, annotations); 48 }, 49 error: function(result){ 50 annotationProxy.log('ERROR calling the annotation backend '+result); 51 Firebug.Console.log(result); 39 52 } 40 53 }); 41 54 }, 42 getAnnotation: function(aid, callback) { 55 getAnnotation: function(annotationURL, callback) { 56 annotationProxy.log('getAnnotation '+annotationURL); 43 57 $.ajax({ 44 58 type: "GET", 45 url: this.getBackend() + '/' + aid,59 url: annotationURL, 46 60 dataType: "xml", 47 success: function(xml) { 48 var annotation = $xml.find('annotation'); 49 50 callback.call(undefined, annotation); 61 success: function(xml, textStatus, jqXHR) { 62 $xml = $.parseXML(jqXHR.responseText); 63 annotationProxy.log('GOT annotation in getAnnotation '); 64 annotationProxy.log($xml); 65 var om_object = annotation2om_object($xml); 66 67 callback.call(undefined, om_object); 68 }, 69 error: function(error) { 70 annotationProxy.log('ERROR in getAnnotation '); 71 annotationProxy.log(error); 51 72 } 52 73 }); 53 74 }, 54 75 deleteAnnotationByOid: function(oid) { 76 Firebug.Console.log('entering DELETE for oid: '+oid); 55 77 var aid; 56 78 var aSql = 'select dasish_aid from om_object where oid="' + oid + '"'; 57 79 var rtn = bitsObjectMng.Database.selectB("", aSql); // aMode = "" defaults to predefined value; aSql contains sql statement 58 80 59 81 aid = rtn[0].dasish_aid; 60 82 Firebug.Console.log('Resolved the AID for DELETE for aid: '+aid); 61 83 if (aid) { // ajax request only for annotations posted to and available in backend database 62 84 return $.ajax({ … … 105 127 Firebug.Console.log("+ + + + + + + + + + + + + + + + + + + + + + + +"); 106 128 } 107 //Firebug.Console.log("OID: " + oid);108 //Firebug.Console.log("AID: " + aid);129 Firebug.Console.log("OID: " + oid); 130 Firebug.Console.log("AID: " + aid); 109 131 // Firebug.Console.log(bitsObjectMng.Database.getObject({oid: oid})); 110 132 111 133 var aSql = 'update om_object set dasish_aid = "' + aid + '" where oid="' + oid + '"'; 134 Firebug.Console.log(aSql); 112 135 // insert request to local sqlite database where aid gets inserted 113 rtn = bitsObjectMng.Database.cmd("", aSql); // aMode = "" defaults to predefined value; aSql contains sql statement 114 136 var rtn = bitsObjectMng.Database.cmd("", aSql); // aMode = "" defaults to predefined value; aSql contains sql statement 137 Firebug.Console.log('UPDATE of AID done'); 138 Firebug.Console.log(rtn); 115 139 // Database insert request is true if successful 116 140 // Firebug.Console.log(rtn); -
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js
r4544 r4545 5 5 6 6 7 7 annotationFramework.getAnnotations(url, 8 function(annotations){ 9 annotationProxy.log('got annotations '); 10 Firebug.Console.log(annotations); 11 12 $.each(annotations, function(index, annotationURL){ 13 annotationFramework.getAnnotation(annotationURL, function(result){ 14 annotationProxy.log('got Annotation '); 15 annotationProxy.log(result); 16 }); 17 }); 18 } 19 ); 8 20 9 21 //if (bitsObjectMng.Database.existsObject(tmp, undefined)) { -
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/conversion.utils.js
r4331 r4545 31 31 var body = $(annotation).find('body').text().trim(); 32 32 var style = $(annotation).find('body').find('xhtml\\:span').attr('style'); 33 var type = $(annotation).find(' body').attr('type').toLowerCase();33 var type = $(annotation).find('mimeType').text(); 34 34 var link = $(annotation).find('link').text(); 35 var time = $(annotation). attr('timeStamp');35 var time = $(annotation).find('lastModified').text(); 36 36 37 37 var urlParts = link.split("#xpointer"); … … 66 66 om_object.oid_property = "<PROPERTY><HYPER_ANCHOR>" + om_object.doc_url + hyperanchor + "</HYPER_ANCHOR><NOTE>" + body + "</NOTE></PROPERTY>"; 67 67 68 if (type === ' note') {68 if (type === 'application/xml+xhtml') { //TODO: better handeling of the body 69 69 om_object.oid_txt = body; 70 70 om_object.oid_type = 'text';
Note: See TracChangeset
for help on using the changeset viewer.