Gitlab CSE Unil

Commit e2a714c8 authored by M. Chardon's avatar M. Chardon
Browse files

correction erreur init Rater

parent 737162c3
......@@ -599,7 +599,10 @@ function ($, _, paper, Signal, config, Users, tools) {
imageLayer.activate();
_raster = new paper.Raster();
_raster = new paper.Raster({
source:imageConfig.url,
position : [0,0]
});
_raster.onLoad = function() {
var currentLayer = paper.project.activeLayer;
imageLayer.activate();
......@@ -628,8 +631,8 @@ function ($, _, paper, Signal, config, Users, tools) {
};
//_raster.source = "adim-src-image";
_raster.source = imageConfig.url;
_raster.position = [0,0];
//_raster.source = imageConfig.url;
//_raster.position = [0,0];
currentLayer.activate();
},
......
......@@ -23911,7 +23911,10 @@ function ($, _, paper, Signal, config, Users, tools) {
 
imageLayer.activate();
 
_raster = new paper.Raster();
_raster = new paper.Raster({
source:imageConfig.url,
position : [0,0]
});
_raster.onLoad = function() {
var currentLayer = paper.project.activeLayer;
imageLayer.activate();
......@@ -23940,8 +23943,8 @@ function ($, _, paper, Signal, config, Users, tools) {
};
 
//_raster.source = "adim-src-image";
_raster.source = imageConfig.url;
_raster.position = [0,0];
//_raster.source = imageConfig.url;
//_raster.position = [0,0];
 
currentLayer.activate();
},
......@@ -23911,7 +23911,10 @@ function ($, _, paper, Signal, config, Users, tools) {
 
imageLayer.activate();
 
_raster = new paper.Raster();
_raster = new paper.Raster({
source:imageConfig.url,
position : [0,0]
});
_raster.onLoad = function() {
var currentLayer = paper.project.activeLayer;
imageLayer.activate();
......@@ -23940,8 +23943,8 @@ function ($, _, paper, Signal, config, Users, tools) {
};
 
//_raster.source = "adim-src-image";
_raster.source = imageConfig.url;
_raster.position = [0,0];
//_raster.source = imageConfig.url;
//_raster.position = [0,0];
 
currentLayer.activate();
},
......@@ -23911,7 +23911,10 @@ function ($, _, paper, Signal, config, Users, tools) {
 
imageLayer.activate();
 
_raster = new paper.Raster();
_raster = new paper.Raster({
source:imageConfig.url,
position : [0,0]
});
_raster.onLoad = function() {
var currentLayer = paper.project.activeLayer;
imageLayer.activate();
......@@ -23940,8 +23943,8 @@ function ($, _, paper, Signal, config, Users, tools) {
};
 
//_raster.source = "adim-src-image";
_raster.source = imageConfig.url;
_raster.position = [0,0];
//_raster.source = imageConfig.url;
//_raster.position = [0,0];
 
currentLayer.activate();
},
......@@ -23911,7 +23911,10 @@ function ($, _, paper, Signal, config, Users, tools) {
 
imageLayer.activate();
 
_raster = new paper.Raster();
_raster = new paper.Raster({
source:imageConfig.url,
position : [0,0]
});
_raster.onLoad = function() {
var currentLayer = paper.project.activeLayer;
imageLayer.activate();
......@@ -23940,8 +23943,8 @@ function ($, _, paper, Signal, config, Users, tools) {
};
 
//_raster.source = "adim-src-image";
_raster.source = imageConfig.url;
_raster.position = [0,0];
//_raster.source = imageConfig.url;
//_raster.position = [0,0];
 
currentLayer.activate();
},
......@@ -15903,7 +15903,7 @@ define('tools/textgeo',["paper","jquery","adim/category"],function(a,b,c){functi
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b,annotationCheckCancel:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster,A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},A.source=b.url,A.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster({source:b.url,position:[0,0]}),A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/io',["jquery","underscore","paper","signals","adim/config","adim/view"],function(a,b,c,d,e,f){function g(){}function h(b,c,d,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(d)for(var i in d)h[i]=d[i];var j,k=e.api.annotations;return g?(j="POST",a.extend(h,{annotable:e.annotable.id,owner:e.user.id,owner_id:e.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h}).done(function(a,b,c){201===c.status?m.annotationAdded.dispatch(a):200===c.status&&m.annotationSaved.dispatch(a)}).fail(function(a){m.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation",jqXHR:a})})}function i(b,c){var d=new FormData;return d.append("aid",b),d.append("file",c),a.ajax({type:"POST",url:e.annotable.thumbnail,data:d,processData:!1,contentType:!1}).done(function(a){})}function j(a){function c(a,c){e.push(a),e.length===f&&m.annotationsSavedStatusChanged.dispatch({status:b.every(e)?"saved":"error"})}for(var d,e=[],f=a.length,g=0;d=a[g];g++)h(d.id,d.itemStr,d.prop,d.index).done(function(a){return function(){c(!0,a)}}(d.id)).fail(function(a){return function(){c(!1,a)}}(d.id))}function k(b){a.ajax({url:e.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&m.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&m.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function l(b,c){return a.ajax({url:e.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){m.annotableChanged.dispatch(a)}})}var m={annotableLoaded:new d,annotableChanged:new d,annotationsLoaded:new d,loadingError:new d,annotationAdded:new d,annotationSaved:new d,annotationRemoved:new d,annotationsSavedStatusChanged:new d},n=!1;return{init:g,events:m,setAutoSave:function(a){return n=!!a},getAutoSave:function(){return n},loadData:function(b){console.time("loadData"),a.ajax({url:b,dataType:"json",success:function(a){console.timeEnd("loadData"),m.annotableLoaded.dispatch(a)},error:function(){m.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){console.log("loadSharedAnnotations");var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};m.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||e.user.id;var b=f.getUserAnnnotationsSerialized(a);return j(b),!0},saveAnnotations:function(a,b){if(!n&&!b)return!1;m.annotationsSavedStatusChanged.dispatch({status:"dirty"});var c=f.getAnnotationsSerialized(a);return j(c),!0},removeAnnotation:k,saveThumbnail:i,setAnnotableName:l}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
......@@ -15903,7 +15903,7 @@ define('tools/textgeo',["paper","jquery","adim/category"],function(a,b,c){functi
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/tools',["underscore","signals","tools/select","tools/pan","tools/drawing","tools/lines","tools/ellipse","tools/rectangle","tools/text","tools/arrow","tools/fieldedges","tools/concordantstr","tools/discordantstr","tools/cmsarea","tools/marker","tools/drawinggeo","tools/linesgeo","tools/ellipsegeo","tools/rectanglegeo","tools/arrowgeo","tools/textgeo"],function(a,b){function c(a,b){return b.importJSON(a)}function d(a){return this.exportJSON(a)}function e(){return n}function f(a){return m[a]?m[a].tool:null}function g(a){if(a&&m[a]){var b=f(n);b&&q.annotationCheckCancel.dispatch(b);var c=f(a);c?(n=a,c.activate(),q.activated.dispatch(a)):console&&console.warn&&console.warn("Tool «"+a+"» not activated")}}function h(a){return m[a]&&"function"==typeof m[a].importJSON?m[a].importJSON:p}function i(a){return m[a]&&"function"==typeof m[a].exportJSON?m[a].exportJSON:p}function j(a,b){var c=i(a.data.type);return c.call(a,$.extend({asString:!0},b))}function k(b){b!==o&&(o=b,a.invoke(m,"setRo",b))}for(var l,m={},n=null,o=null,p=function(){},q={activated:new b,annotationAdded:new b,annotationChanged:new b,annotationSelected:new b,annotationCheckCancel:new b},r=1;l=arguments[r];r++)m[l.name]={tool:l.tool,importJSON:l.importJSON||c,exportJSON:l.exportJSON||d,setRo:l.setRo||p,listeners:l.listeners||{},events:l.events||{}},"function"==typeof l.registerEvent&&(l.registerEvent("annotationAdded",q.annotationAdded),l.registerEvent("annotationChanged",q.annotationChanged),l.registerEvent("annotationSelected",q.annotationSelected)),l.listeners&&"function"==typeof l.listeners.onToolActivated&&q.activated.add(l.listeners.onToolActivated);return function(){var a=new paper.Tool({onMouseDown:p,onMouseUp:p,onMouseDrag:p,onKeyDown:p,onKeyUp:p});a.activate()}(),{events:q,tools:m,getTool:f,getToolJSONImporter:h,getToolJSONExporter:i,activateTool:g,getActiveTool:e,serializeItem:j,setRo:k}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster,A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},A.source=b.url,A.position=[0,0],f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
define('adim/view',["jquery","underscore","paper","signals","adim/config","adim/users","adim/tools"],function(a,b,c,d,e,f,g){function h(a){if(!a)return!1;if(!isNaN(parseInt(a,10)))return i(a);var b=F[a]||null;if(!b)for(var d,e=2===a.indexOf(":")?a.substr(3):null,f=c.project.layers,g=0;d=f[g];g++){var h=e?d.id.toString()===e:d.name===a;if(h){b=d,F[a]=d;break}}return b}function i(a){return a=parseInt(a,10),b(c.project.layers).findWhere({id:a})}function j(b,d){var e=h(b);if(d=d||{},!e){var f=c.project.activeLayer;e=new c.Layer({name:b}),a.extend(e.data,d),F[b]=e,f&&f.activate()}return e}function k(a,b){var c="user_"+a,d=b||f.getById(a)||a;return j(c,{owner:d,ownerId:a})}function l(a,b){var d=h(a);return d?(b="undefined"==typeof b?!d.visible:"function"==typeof b?!!b():!!b,d.visible=b,c.view.draw(),C.userLayerVisibilityChanged.dispatch(d,d.visible),d.visible):null}function m(){var a=[];return c.project.getSelectedItems().map(function(b){b.parent&&b.parent.data&&b.parent.data.type&&a.indexOf(b.parent)===-1?a.push(b.parent):b.data&&b.data.type&&a.indexOf(b)===-1&&a.push(b)}),a}function n(c,d){var f,h,i;try{f="string"==typeof c.item?JSON.parse(c.item):c.item}catch(a){throw"Unable to parse annotation's item"}if(!a.isArray(f)||f.length<2)return null;if("string"==typeof f[0]?h=f[1].data:a.isArray(f[0])&&(h=f[1][1].data),!h)return null;if(i=h.type,!b.isEmpty(e.activeTools)&&!b.contains(e.activeTools,i))return null;var j=k(c.owner),l=g.getToolJSONImporter(i)(f,j,d);return l&&(l.data.id=c.id,l.selected=!1),l}function o(a){for(var b,c=[],d=0;b=a[d];d++)if(b.data&&b.data.type){var e={id:b.data.id,itemStr:g.serializeItem(b),index:b.index};b.data.prop&&(e.prop=b.data.prop),c.push(e)}return c}function p(a){for(var b=c.project.layers,d=null,e=0,f=b.length;e<f;e++)for(var g=b[e].children,h=0,i=g.length;h<i;h++)if(g[h].data.tId===a){d=g[h];break}return d}function q(){for(var a,b=m(),d=0;a=b[d];d++)a.remove(),C.annotationRemoved.dispatch(a);c.view.draw()}function r(a){c.project.view.scrollBy(a),c.project.view.draw()}function s(a,b){if(b=void 0===b||!!b,"string"==typeof a){for(var d,e=a.split(","),f=0,h=c.project.layers;d=h[f];f++)for(var i,j=0,k=d.children;i=k[j];j++)i.data&&i.data.type&&e.indexOf(i.data.type)>-1&&(i.selected&&(i.selected=!1,g.events.annotationSelected.dispatch(null)),i.visible=b);c.view.draw()}}function t(a,d){d=!!b.isUndefined(d)||!!d;for(var e,f=a.val.split(","),h=0,i=c.project.layers;e=i[h];h++)for(var j,k=0,l=e.children;j=l[k];k++)if(j.data&&j.data.prop){var m=b.isUndefined(j.data.prop[a.prop])?f.indexOf("")>-1&&a.undef===!0:f.indexOf(j.data.prop[a.prop])>-1;m&&(j.selected&&(j.selected=!1,g.events.annotationSelected.dispatch(null)),j.visible=d)}c.view.draw()}function u(a,d){d=!!b.isUndefined(d)||d;for(var e,f=a.split(","),h=[],i=0,j=c.project.layers;e=j[i];i++)for(var k,l=0,m=e.children;k=m[l];l++)k.data&&k.data.type&&f.indexOf(k.data.type)>-1&&k.visible&&(k.selected=d,h.push(k));g.events.annotationSelected.dispatch(h),c.view.draw()}function v(a,b,c){var d=!1;return a.data&&a.data.prop&&(d=a.data.prop[b]!==c,d&&(a.data.prop[b]=c,"function"==typeof a.onPropertyChange&&a.onPropertyChange(b,c),C.annotationPropertyChanged.dispatch(a,b,c))),d}function w(a,b,c){var d=m();c||(d=d.length?d[0]:[]);for(var e,f=!0,g=0;e=d[g];g++)f=v(e,a,b)&&f;return f}function x(a,b){return a.data&&a.data.prop&&a.data.prop.hasOwnProperty(b)?a.data.prop[b]:null}function y(a){var b=c.project.getSelectedItems();return 1===b.length?x(b[0],a):null}var z=null,A=null,B=null,C={imageLoaded:new d,annotationsLoaded:new d,annotationRemoved:new d,annotationPropertyChanged:new d,userLayerVisibilityChanged:new d},D=e.users,E={strokeWidth:7,strokeColor:"red",font:"Helvetica,Arial,sans-serif",fontSize:32},F={};return{init:function(b){return"string"==typeof b&&"#"!==b.substr(0,1)&&(b="#"+b),z=a(b),0===z.length?(console&&console.warn&&console.warn("Unable to find canvas element: "+b),!1):(c.setup(z.get(0)),c.project.activeLayer.name="image",a.extend(c.project.currentStyle,E),B=k(e.user.id,e.user.username),B.opacity=1,!0)},events:C,loadUserDict:function(a){D=e.users},updateUserDict:function(b){a.extend(D,b)},resize:function(a,b){z&&(a=parseInt(a,10)||z.width(),b=parseInt(b,10)||z.height(),z.width("100%").height(b),c.view.viewSize=[a,b],A&&(A.position=[A.bounds.width/2,A.bounds.height/2]))},scrollBy:r,loadImage:function(b,d,e){b="string"==typeof b?{url:b}:a.extend({url:""},b);var f=c.project.activeLayer,g=j("image");g.activate(),A=new c.Raster({source:b.url,position:[0,0]}),A.onLoad=function(){var a=c.project.activeLayer;g.activate();var f;b.bgUrl?(f=new c.Raster(b.bgUrl),f.translate(A.width/2,A.height/2)):f=new c.Path.Rectangle({from:[0,0],to:[A.width,A.height],fillColor:"white",strokeColor:null}),f.sendToBack(),a.activate(),C.imageLoaded.dispatch({raster:A}),"function"==typeof d&&d.call(e,A)},f.activate()},loadAnnotation:n,loadAnnotations:function(b,d){for(var f,i=[],j=b.length-1;f=b[j];j--){var k=f.owner===d;(e.ui.show_users_results||k)&&i.push(n(f,k))}if(d){var l=h("user_"+d);if(l){var m=c.project.layers,o=m.splice(l._index,1);m.push(o[0]),a.each(m,function(a,b){b._index=a}),l=h("user_"+d),l.activate(),c.view.draw()}}console.log(">> before dispatch annotationsLoaded"),C.annotationsLoaded.dispatch(i,d),c.project.deselectAll(),g.events.annotationSelected.dispatch(null),c.view.draw()},removeSelectedItems:q,getUserAnnnotationsSerialized:function(a){var b=h("user_"+a);return o(b.children)},getSelectedAnnotations:m,getSelectedAnnnotationsSerialized:function(){for(var a,b=c.project.getSelectedItems(),d=[],e=0;a=b[e];e++)a.data.type&&d.push(a);return o(d)},getAnnotationsSerialized:function(b){return a.isArray(b)||(b=[b]),o(b)},getItemByTempId:p,setItemProperty:v,setSelectedItemProperty:w,getSelectedItemProperty:y,showItemsByType:function(a){s(a,!0)},hideItemsByType:function(a){s(a,!1)},toggleItemsByType:s,toggleItemsByProp:t,selectItemsByType:u,getLayerByName:h,getOrCreateLayerByName:j,getOrCreateUserLayer:k,getUserLayer:function(a){return h("user_"+a)},getAllUsersLayers:function(){for(var a=[],b=0,d=c.project.layers;b<d.length;b++)"user_"===d[b].name.substr(0,5)&&a.push(d[b]);return a},showLayer:function(a){l(a,!0)},hideLayer:function(a){l(a,!1)},toggleLayer:function(a,b){return l(a,b)},toggleMembersLayers:function(){function a(a,b){return b?e[a.id]:b}var d,e={};return function(f,h){c.project.deselectAll(),g.events.annotationSelected.dispatch(null);var i=this.getAllUsersLayers();f||(d=c.project.activeLayer,b.reduce(i,function(a,b){return a[b.id]=b.visible,a},e)),b.each(i,function(b){l(b.name,h?f:a(b,f))}),f?d&&d.activate():(l(B.id,!0),B.activate())}}(),_raster:function(){return A}}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
define('adim/io',["jquery","underscore","paper","signals","adim/config","adim/view"],function(a,b,c,d,e,f){function g(){}function h(b,c,d,f){b=parseInt(b,10);var g=!b;f=parseInt(f,10)||0;var h={item:c,order:f};if(d)for(var i in d)h[i]=d[i];var j,k=e.api.annotations;return g?(j="POST",a.extend(h,{annotable:e.annotable.id,owner:e.user.id,owner_id:e.user.id})):(j="PATCH",k+=b+"/"),a.ajax({url:k,type:j,dataType:"json",data:h}).done(function(a,b,c){201===c.status?m.annotationAdded.dispatch(a):200===c.status&&m.annotationSaved.dispatch(a)}).fail(function(a){m.loadingError.dispatch({msg:"Erreur lors de l'enregistrement d'une annotation",jqXHR:a})})}function i(b,c){var d=new FormData;return d.append("aid",b),d.append("file",c),a.ajax({type:"POST",url:e.annotable.thumbnail,data:d,processData:!1,contentType:!1}).done(function(a){})}function j(a){function c(a,c){e.push(a),e.length===f&&m.annotationsSavedStatusChanged.dispatch({status:b.every(e)?"saved":"error"})}for(var d,e=[],f=a.length,g=0;d=a[g];g++)h(d.id,d.itemStr,d.prop,d.index).done(function(a){return function(){c(!0,a)}}(d.id)).fail(function(a){return function(){c(!1,a)}}(d.id))}function k(b){a.ajax({url:e.api.annotations+parseInt(b,10)+"/",type:"DELETE",success:function(a,c,d){204===d.status&&m.annotationRemoved.dispatch(b)},error:function(a){404!==a.status&&m.loadingError.dispatch({msg:"Erreur lors de la suppression d'une annotation"})}})}function l(b,c){return a.ajax({url:e.api.annotables+parseInt(b,10)+"/",type:"PATCH",dataType:"json",data:{name:c},success:function(a){m.annotableChanged.dispatch(a)}})}var m={annotableLoaded:new d,annotableChanged:new d,annotationsLoaded:new d,loadingError:new d,annotationAdded:new d,annotationSaved:new d,annotationRemoved:new d,annotationsSavedStatusChanged:new d},n=!1;return{init:g,events:m,setAutoSave:function(a){return n=!!a},getAutoSave:function(){return n},loadData:function(b){console.time("loadData"),a.ajax({url:b,dataType:"json",success:function(a){console.timeEnd("loadData"),m.annotableLoaded.dispatch(a)},error:function(){m.loadingError.dispatch({msg:"Une erreur est survenue lors du chargement des données."})}})},loadSharedAnnotations:function(b){console.log("loadSharedAnnotations");var c=a.Deferred();return a.ajax({url:b,dataType:"json",success:function(a){c.resolve(a)},error:function(){var a={msg:"Une erreur est survenue lors du chargement des données."};m.loadingError.dispatch(a),c.reject(a)}}),c},saveUserAnnotations:function(a){a=a||e.user.id;var b=f.getUserAnnnotationsSerialized(a);return j(b),!0},saveAnnotations:function(a,b){if(!n&&!b)return!1;m.annotationsSavedStatusChanged.dispatch({status:"dirty"});var c=f.getAnnotationsSerialized(a);return j(c),!0},removeAnnotation:k,saveThumbnail:i,setAnnotableName:l}});
/*! AdIm - v0.0.0 - 2018-03-05 - Copyright (C) 2018 Université de Lausanne - see licence */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment