- Timestamp:
- 03/16/14 12:27:31 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DASISH/t5.6/client/trunk/chrome/markingcollection/content/markingcollection/annotator-service/annotations.wired.marker.js
r4714 r4716 5 5 * @returns {undefined} false if user in not loged in. user object if loged in 6 6 */ 7 getLoggedInInfo: function(){ 7 getLoggedInInfo: function(callback) { 8 var authURL = annotationFramework.getBackend() + "/api/authentication/user"; 9 $.ajax({ 10 type: 'GET', 11 url: authURL, 12 dataType: "xml", 13 success: function(xml ,textStatus, jqXHR) { 14 $xml = $.parseXML(jqXHR.responseText); 15 // alert(JSON.stringify($xml)); 16 }, 17 error: function(jqXHR, status, thrownError) { 18 // alert("statusCode in ajax error method: " + jqXHR.status); 19 callback.call(undefined, jqXHR.status); 20 } 21 }); 22 8 23 var user_placeholder = { 9 URI 10 uid 11 dislayName 12 eMail 13 }; 14 24 URI: 'https://lux17.mpi.nl/ds/webannotator/api/users/00000000-0000-0000-0000-0000000009999', 25 uid: '00000000-0000-0000-0000-0000000009999', 26 dislayName: 'Test Testsson', 27 eMail: 'test@test.com' 28 }; 29 15 30 return user_placeholder; 16 31 }, … … 18 33 annotationProxy.log('getAnnotations for: ' + url); 19 34 20 annotationFramework.getAnnotations(url, 21 function(annotations){22 annotationProxy.log('got annotations ');23 annotationProxy.log(annotations);24 25 $.each(annotations, function(index, annotationURL){26 annotationFramework.getAnnotation(annotationURL, function(result){27 annotationProxy.log('checking if annotation exist in DB:');28 annotationProxy.log(result);29 if(bitsObjectMng.Database._dasish_aid_exists('', result.dasish_aid, true)){30 annotationProxy.log('AID already in database : ' + result.dasish_aid);31 }else{32 annotationProxy.log('Adding annotation to database : ' + result.dasish_aid);33 bitsObjectMng.Database.addObject(result, '', undefined);34 }35 });36 });37 }35 annotationFramework.getAnnotations(url, 36 function(annotations) { 37 annotationProxy.log('got annotations '); 38 annotationProxy.log(annotations); 39 40 $.each(annotations, function(index, annotationURL) { 41 annotationFramework.getAnnotation(annotationURL, function(result) { 42 annotationProxy.log('checking if annotation exist in DB:'); 43 annotationProxy.log(result); 44 if (bitsObjectMng.Database._dasish_aid_exists('', result.dasish_aid, true)) { 45 annotationProxy.log('AID already in database : ' + result.dasish_aid); 46 } else { 47 annotationProxy.log('Adding annotation to database : ' + result.dasish_aid); 48 bitsObjectMng.Database.addObject(result, '', undefined); 49 } 50 }); 51 }); 52 } 38 53 ); 39 54 … … 91 106 var aid = this.getAidFromOid(om_object.oid); 92 107 this.log('updateAnnotation : ' + JSON.stringify(om_object)); 93 this.log('UPDATED ANNOTATION AS XML (aid: ' +aid+')');108 this.log('UPDATED ANNOTATION AS XML (aid: ' + aid + ')'); 94 109 var xml = om_object_annotation_body(om_object); 95 110 96 111 this.log(xml); 97 112 98 113 annotationFramework.putAnnotation(aid, xml); 99 114 }, 100 getAidFromOid: function(oid) {115 getAidFromOid: function(oid) { 101 116 var aSql = 'SELECT dasish_aid FROM om_object WHERE oid="' + oid + '"'; 102 117 var rtn = bitsObjectMng.Database.selectB('_uncategorized', aSql); // aMode = "" defaults to predefined value; aSql contains sql statement 103 118 104 119 return rtn[0].dasish_aid; 105 120 }, … … 112 127 log: function(message) { 113 128 //log to console 114 if (typeof Firebug !='undefined' && Firebug.Console) {129 if (typeof Firebug != 'undefined' && Firebug.Console) { 115 130 Firebug.Console.log(message); 116 131 } 117 132 //log this to the local proxy 118 133 /* 119 $.ajax({120 121 122 123 });124 */134 $.ajax({ 135 type: "POST", 136 url: 'http://localhost/annotations/annotator-service/test/proxy.php', 137 data: {log: 'true', message: message} 138 }); 139 */ 125 140 } 126 141 }
Note: See TracChangeset
for help on using the changeset viewer.