comparison webapp/src/main/webapp/jquery/jquery.digilib.annotator.js @ 1118:f0474c1faaff

trying new annotator authentication.
author robcast
date Tue, 06 Nov 2012 18:24:39 +0100
parents 08206603c7dc
children 036efe7361c8
comparison
equal deleted inserted replaced
1117:5768d4ccb53e 1118:f0474c1faaff
49 return this.user.name; 49 return this.user.name;
50 } 50 }
51 return this.user; 51 return this.user;
52 }, 52 },
53 53
54 // Annotator plugin settings 54 // Annotator plugin settings (some values provided in handleSetup)
55 'annotatorPlugins' : { 55 'annotatorPlugins' : {
56 //'Tags' : {}, 56 //'Tags' : {},
57 'Auth' : { 57 'Auth' : {
58 //token : data.annotationToken 58 //token : data.annotationToken
59 //tokenUrl: data.settings.annotationTokenUrl 59 //tokenUrl: data.settings.annotationTokenUrl
60 //autoFetch: false 60 autoFetch: true,
61 requestMethod: 'POST',
62 requestData: {
63 //'user': data.settings.annotationUser,
64 //'password': data.annotationPassword
65 }
61 }, 66 },
62 'Permissions' : { 67 'Permissions' : {
63 //user: data.settings.annotationUser, 68 //user: data.settings.annotationUser,
64 userString : function(user) { 69 userString : function(user) {
65 if (user && user.name) { 70 if (user && user.name) {
134 if (mpos == null) { 139 if (mpos == null) {
135 // interactive 140 // interactive
136 setAnnotationMark(data); 141 setAnnotationMark(data);
137 } else { 142 } else {
138 // use position and text (and user-id) 143 // use position and text (and user-id)
139 var annotation = newAnnotation(data, mpos, text, null, null, data.settings.annotationUser); 144 console.error("Currently only interactive annotations!");
140 storeAnnotation(data, annotation);
141 // TODO: replace with annotation returned by server
142 data.annotations.push(annotation);
143 digilib.fn.redisplay(data);
144 } 145 }
145 }, 146 },
146 }; 147 };
147 148
148 /** 149 /**
356 * setup creates Annotator object. 357 * setup creates Annotator object.
357 */ 358 */
358 var handleSetup = function(evt) { 359 var handleSetup = function(evt) {
359 console.debug("annotations: handleSetup"); 360 console.debug("annotations: handleSetup");
360 var data = this; 361 var data = this;
361 if (data.annotationToken == null) { 362 /* if (data.annotationToken == null) {
362 loadAnnotationToken(data); 363 loadAnnotationToken(data);
363 } 364 } */
364 // set up annotator (after html has been set up) 365 // set up annotator (after html has been set up)
365 var uri = getAnnotationPageUrl(data); 366 var uri = getAnnotationPageUrl(data);
366 var annotator = new Annotator(data.$elem.get(0)); 367 var annotator = new Annotator(data.$elem.get(0));
367 // set plugin parameters 368 // set plugin parameters
368 var pluginParams = { 369 var pluginParams = {
369 'Auth' : { 370 'Auth' : {
370 'token' : data.annotationToken, 371 'token' : data.annotationToken,
371 'tokenUrl' : data.settings.annotationTokenUrl, 372 'tokenUrl' : data.settings.annotationTokenUrl,
372 'autoFetch' : false 373 'autoFetch' : true
373 }, 374 },
374 'Permissions' : { 375 'Permissions' : {
375 'user' : data.settings.annotationUser 376 'user' : data.settings.annotationUser
376 }, 377 },
377 'Store' : { 378 'Store' : {