Mercurial > hg > digilib-old
changeset 1125:f1be20adc98b
annotatorPlugins is now a list of plugin names (preserving order).
author | robcast |
---|---|
date | Fri, 09 Nov 2012 15:07:12 +0100 |
parents | bd90fdfd55f7 |
children | f14220f939d5 |
files | webapp/src/main/webapp/jquery/digilib-ann.html webapp/src/main/webapp/jquery/jquery.digilib.annotator.js |
diffstat | 2 files changed, 14 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/digilib-ann.html Fri Nov 09 14:33:49 2012 +0100 +++ b/webapp/src/main/webapp/jquery/digilib-ann.html Fri Nov 09 15:07:12 2012 +0100 @@ -41,24 +41,8 @@ //'annotationServerUrl' : 'http://tuxserve03.mpiwg-berlin.mpg.de/AnnotationManager/annotator', // URL of authentication token server 'annotationTokenUrl' : 'http://localhost:8080/test/docuviewa/template/token/getLoginToken', - 'annotatorPlugins' : { - 'Markdown' : {}, - 'Permissions' : { - //user: data.settings.annotationUser, - userString : function(user) { - if (user && user.name) { - return user.name; - } - return user; - }, - userId: function (user) { - if (user && user.id) { - return user.id; - } - return user; - } - } - } + // list of Annotator plugins + 'annotatorPlugins' : ['Auth', 'Permissions', 'Store', 'Markdown', 'DigilibIntegrator'], }; var $div = $('div#digilib'); $div.digilib(opts);
--- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Fri Nov 09 14:33:49 2012 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Fri Nov 09 15:07:12 2012 +0100 @@ -56,9 +56,10 @@ return this.user; }, + // list of Annotator plugins + 'annotatorPlugins' : ['Auth', 'Permissions', 'Store', 'DigilibIntegrator'], // Annotator plugin settings (some values provided in handleSetup) - 'annotatorPlugins' : { - //'Tags' : {}, + 'annotatorPluginSettings' : { 'Auth' : { //token : data.annotationToken //tokenUrl: data.settings.annotationTokenUrl @@ -359,7 +360,7 @@ }; /** - * returns handleUnauthorized function for Annotator.Auth plugin. + * returns unauthorizedCallback function for Annotator authlogin plugin. */ var getHandleUnauthorized = function (data) { return function (auth) { @@ -425,6 +426,7 @@ var handleSetup = function(evt) { console.debug("annotations: handleSetup"); var data = this; + var settings = data.settings; // set up annotator (after html has been set up) var uri = getAnnotationPageUrl(data); var annotator = new Annotator(data.$elem.get(0)); @@ -432,19 +434,19 @@ var pluginParams = { 'Auth' : { 'token' : data.dlOpts.annotationToken, - 'tokenUrl' : data.settings.annotationTokenUrl, + 'tokenUrl' : settings.annotationTokenUrl, 'autoFetch' : true, 'requestMethod' : 'POST', 'requestData' : { - 'user': data.settings.annotationUser, + 'user': settings.annotationUser, }, 'unauthorizedCallback' : getHandleUnauthorized(data) }, 'Permissions' : { - 'user' : data.settings.annotationUser + 'user' : settings.annotationUser }, 'Store' : { - 'prefix' : data.settings.annotationServerUrl, + 'prefix' : settings.annotationServerUrl, 'annotationData' : { 'uri': uri }, @@ -460,9 +462,10 @@ } }; // merge with settings - $.extend(true, pluginParams, data.settings.annotatorPlugins); + $.extend(true, pluginParams, data.settings.annotatorPluginSettings); // add plugins - $.each(pluginParams, function (name, params) { + $.each(settings.annotatorPlugins, function (idx, name) { + var params = pluginParams[name]; console.debug("plugin:", name, params); annotator.addPlugin(name, params); });