--- a/src/pyams_content/skin/resources/js/pyams_content.min.js Wed Sep 20 12:11:23 2017 +0200
+++ b/src/pyams_content/skin/resources/js/pyams_content.min.js Wed Sep 20 12:12:58 2017 +0200
@@ -1,1 +1,1 @@
-(function(c,b){var e=b.MyAMS;var d={TinyMCE:{initEditor:function(f){f.image_list=d.TinyMCE.getImagesList;f.link_list=d.TinyMCE.getLinksList;return f},getImagesList:function(i){var f=c(document.activeElement).parents("form");if(f.exists()){var g=f.attr("data-ams-form-handler")||f.attr("action");var h=g.substr(0,g.lastIndexOf("/")+1);return e.ajax.post(h+"get-images-list.json",{},i)}},getLinksList:function(i){var f=c(document.activeElement).parents("form");if(f.exists()){var g=f.attr("data-ams-form-handler")||f.attr("action");var h=g.substr(0,g.lastIndexOf("/")+1);return e.ajax.post(h+"get-links-list.json",{},i)}}},profile:{switchFavorite:function(){var g=c(this);var f=g.data("sequence-oid");e.ajax.post("switch-user-favorite.json",{oid:f},function(h,i){if(h.favorite){g.removeClass("fa-star-o").addClass("fa-star")}else{g.removeClass("fa-star").addClass("fa-star-o")}})}},galleries:{switchImageVisibility:function(f){return function(){var h=c(this);var i=h.parents(".image");var g=i.parents(".gallery");e.ajax.post(g.data("ams-location")+"/set-image-visibility.json",{object_name:i.data("ams-element-name")},function(j,k){if(j.visible){c("i",h).attr("class","fa fa-fw fa-eye")}else{c("i",h).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refresh:function(g){if(typeof(g)==="string"){g=JSON.parse(g)}var f=c('select[name="form.widgets.galleries:list"]');var h=f.data("select2");c("<option></option>").attr("value",g.new_gallery.id).attr("selected","selected").text(g.new_gallery.text).appendTo(f);var i=f.select2("data");i.push(g.new_gallery);f.select2("data",i);h.results.empty();h.opts.populateResults.call(h,h.results,g.galleries,{term:""})},setOrder:function(h,i){if(i&&i.item.hasClass("already-dropped")){return}var f=i.item.parents(".gallery");var g=c(".image",f).listattr("data-ams-element-name");e.ajax.post(f.data("ams-location")+"/set-images-order.json",{images:JSON.stringify(g)})},removeFile:function(f){return function(){var g=c(this);e.skin.bigBox({title:e.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+e.i18n.DELETE_WARNING,buttons:e.i18n.BTN_OK_CANCEL},function(k){if(k===e.i18n.BTN_OK){var j=g.parents(".gallery");var i=j.data("ams-location");var l=g.parents(".image");var h=l.data("ams-element-name");e.ajax.post(i+"/delete-element.json",{object_name:h},function(m,n){l.remove()})}})}},refreshContainer:function(h){var f=c('tr[data-ams-element-name="'+h.object_name+'"]');var g=c("span.count",c("div.action.galleries",f));if(h.nb_galleries>0){g.text("("+h.nb_galleries+")")}else{g.text("")}}},imgmap:{init:function(){var f=c(this);e.ajax.check(c.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+e.devext+".js",function(){f.canvasAreaDraw({imageUrl:f.data("ams-image-url")})})},initSummary:function(){var f=c(this);e.ajax.check(c.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+e.devext+".js",function(){f.mapster({fillColor:"ff0000",fillOpacity:0.35,selected:true,highlight:true,staticState:true})})}},paragraphs:{switchVisibility:function(f){return function(){var i=c(this);var g=i.parents("tr");var h=g.parents("table");e.ajax.post(h.data("ams-location")+"/set-paragraph-visibility.json",{object_name:g.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refreshParagraph:function(h){var g=c('table[id="paragraphs_list"]');var f=c('tr[data-ams-element-name="'+h.object_name+'"]',g);c("span.title",f).html(h.title||" - - - - - - - -")},switchEditor:function(h){var k=c(this);var j=c("i",k);var l=k.parents("td");var i=c(".editor",l);var f=k.parents("tr");if(j.hasClass("fa-plus-square-o")){var g=f.parents("table");i.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>');e.ajax.post(g.data("ams-location")+"/get-paragraph-editor.json",{object_name:f.data("ams-element-name")},function(m){i.html(m);if(m){e.initContent(i);j.removeClass("fa-plus-square-o").addClass("fa-minus-square-o");f.data("ams-disabled-handlers",true)}})}else{e.skin.cleanContainer(i);i.empty();j.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");f.removeData("ams-disabled-handlers")}},switchAllEditors:function(g){var i=c(this);var h=c("i",i);var f=i.parents("table");if(h.hasClass("fa-plus-square-o")){h.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin");e.ajax.post(f.data("ams-location")+"/get-paragraphs-editors.json",{},function(k){for(var l in k){if(!k.hasOwnProperty(l)){continue}var j=c('tr[data-ams-element-name="'+l+'"]',f);var m=c(".editor",j);if(m.is(":empty")){m.html(k[l]);e.initContent(m)}c(".fa-plus-square-o",j).removeClass("fa-plus-square-o").addClass("fa-minus-square-o");j.data("ams-disabled-handlers",true)}if(!c("i.fa-plus-square-o",c("tbody",f)).exists()){h.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")}})}else{c(".editor",f).each(function(){e.skin.cleanContainer(c(this));c(this).empty()});c(".fa-minus-square-o",f).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");c("tr",f).removeData("ams-disabled-handlers")}}},associations:{afterUpdateCallback:function(f){var h=c("#"+f.parent).parent(".ams-widget");h.replaceWith(c(f.table));h=c("#"+f.parent).parent(".ams-widget");e.initContent(h);var g=h.siblings("legend");if(g.parents("fieldset:first").hasClass("switched")){g.click()}},switchVisibility:function(f){return function(){var i=c(this);var h=i.parents("tr");var g=h.parents("table");e.ajax.post(g.data("ams-location")+"/set-association-visibility.json",{object_name:h.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}}},fields:{switchVisibility:function(f){return function(){var i=c(this);var h=i.parents("tr");var g=h.parents("table");e.ajax.post(g.data("ams-location")+"/set-form-field-visibility.json",{object_name:h.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refreshField:function(h){var g=c('table[id="form_fields_list"]');var f=c('tr[data-ams-element-name="'+h.object_name+'"]',g);c("td:nth-child(4)",f).html(h.title)}},illustration:{afterUpdateCallback:function(f){var g=c("#"+f.parent);g.replaceWith(c(f.form));g=c("#"+f.parent);e.initContent(g)}},themes:{initExtracts:function(h){var g=c('select[name="form.widgets.thesaurus_name:list"]',h);var f=g.val();var j=c('select[name="form.widgets.extract_name:list"]',h);var i=j.val();if(f){e.jsonrpc.post("getExtracts",{thesaurus_name:f},{url:"/api/thesaurus/json"},function(k){j.empty();c(k.result).each(function(){c("<option></option>").attr("value",this.id).attr("selected",this.id===i).text(this.text).appendTo(j)})})}j.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(i){var f=c(i.currentTarget);var h=f.parents("form");var g=c('select[name="form.widgets.thesaurus_name:list"]',h).val();if(g){e.jsonrpc.post("getExtracts",{thesaurus_name:g},{url:"/api/thesaurus/json"},function(l){var k=c('select[name="form.widgets.extract_name:list"]',h);var j=k.data("select2");j.results.empty();j.opts.populateResults.call(j,j.results,l.result,{term:""})})}}},review:{timer:null,timer_duration:{general:30000,chat:5000},initComments:function(g){var f=c(".chat-body",g);f.animate({scrollTop:f[0].scrollHeight},1000);clearInterval(d.review.timer);d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.chat);e.skin.registerCleanCallback(d.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(d.review.timer);d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.general)},updateComments:function(){var f=c(".badge",'nav a[href="#review-comments.html"]'),h;var g=c(".chat-body",".widget-body");if(g.exists()){h=c(".message",g).length}else{h=parseInt(f.text())}e.ajax.post("get-last-review-comments.json",{count:h},function(i){if(g.exists()){f.removeClass("bg-color-danger").addClass("bg-color-info")}if(h!==i.count){f.text(i.count).removeClass("hidden");if(g.exists()){c(".messages",g).append(i.content);g.animate({scrollTop:g[0].scrollHeight},1000)}if(!g.exists()){f.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){c(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")})}}})},initCommentData:function(f){var g=c(".chat-body",".widget-body");return{count:c(".message",g).length}},addCommentCallback:function(g){var h=c(this);var i=h.parents(".widget-body");c(".messages",i).append(g.content);c('textarea[name="comment"]',h).val("");var f=c(".chat-body",i);f.animate({scrollTop:f[0].scrollHeight},1000);c(".badge",'nav a[href="#review-comments.html"]').text(g.count).removeClass("hidden")}}};b.PyAMS_content=d;c(b.document).on("PyAMS_content.changed_item",function(g,f){switch(f.object_type){case"paragraph":d.paragraphs.refreshParagraph(f);break;case"form_field":d.fields.refreshField(f);break;case"review_comments":d.review.updateComments();break}});var a=c(".badge",'nav a[href="#review-comments.html"]');if(a.exists()){d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.general)}})(jQuery,this);
\ No newline at end of file
+(function(c,b){var e=b.MyAMS;var d={TinyMCE:{initEditor:function(f){f.image_list=d.TinyMCE.getImagesList;f.link_list=d.TinyMCE.getLinksList;return f},getImagesList:function(i){var f=c(document.activeElement).parents("form");if(f.exists()){var g=f.attr("data-ams-form-handler")||f.attr("action");var h=g.substr(0,g.lastIndexOf("/")+1);return e.ajax.post(h+"get-images-list.json",{},i)}},getLinksList:function(i){var f=c(document.activeElement).parents("form");if(f.exists()){var g=f.attr("data-ams-form-handler")||f.attr("action");var h=g.substr(0,g.lastIndexOf("/")+1);return e.ajax.post(h+"get-links-list.json",{},i)}}},profile:{switchFavorite:function(){var g=c(this);var f=g.data("sequence-oid");e.ajax.post("switch-user-favorite.json",{oid:f},function(h,i){if(h.favorite){g.removeClass("fa-star-o").addClass("fa-star")}else{g.removeClass("fa-star").addClass("fa-star-o")}})}},galleries:{switchImageVisibility:function(f){return function(){var h=c(this);var i=h.parents(".image");var g=i.parents(".gallery");e.ajax.post(g.data("ams-location")+"/set-image-visibility.json",{object_name:i.data("ams-element-name")},function(j,k){if(j.visible){c("i",h).attr("class","fa fa-fw fa-eye")}else{c("i",h).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refresh:function(g){if(typeof(g)==="string"){g=JSON.parse(g)}var f=c('select[name="form.widgets.galleries:list"]');var h=f.data("select2");c("<option></option>").attr("value",g.new_gallery.id).attr("selected","selected").text(g.new_gallery.text).appendTo(f);var i=f.select2("data");i.push(g.new_gallery);f.select2("data",i);h.results.empty();h.opts.populateResults.call(h,h.results,g.galleries,{term:""})},setOrder:function(h,i){if(i&&i.item.hasClass("already-dropped")){return}var f=i.item.parents(".gallery");var g=c(".image",f).listattr("data-ams-element-name");e.ajax.post(f.data("ams-location")+"/set-images-order.json",{images:JSON.stringify(g)})},removeFile:function(f){return function(){var g=c(this);e.skin.bigBox({title:e.i18n.WARNING,content:'<i class="text-danger fa fa-2x fa-bell shake animated"></i> '+e.i18n.DELETE_WARNING,buttons:e.i18n.BTN_OK_CANCEL},function(k){if(k===e.i18n.BTN_OK){var j=g.parents(".gallery");var i=j.data("ams-location");var l=g.parents(".image");var h=l.data("ams-element-name");e.ajax.post(i+"/delete-element.json",{object_name:h},function(m,n){l.remove()})}})}},refreshContainer:function(h){var f=c('tr[data-ams-element-name="'+h.object_name+'"]');var g=c("span.count",c("div.action.galleries",f));if(h.nb_galleries>0){g.text("("+h.nb_galleries+")")}else{g.text("")}}},imgmap:{init:function(){var f=c(this);e.ajax.check(c.fn.canvasAreaDraw,"/--static--/pyams_content/js/jquery-canvasAreaDraw"+e.devext+".js",function(){f.canvasAreaDraw({imageUrl:f.data("ams-image-url")})})},initSummary:function(){var f=c(this);e.ajax.check(c.fn.mapster,"/--static--/pyams_content/js/jquery-imagemapster-1.2.10"+e.devext+".js",function(){f.mapster({fillColor:"ff0000",fillOpacity:0.35,selected:true,highlight:true,staticState:true})})}},paragraphs:{switchVisibility:function(f){return function(){var i=c(this);var g=i.parents("tr");var h=g.parents("table");e.ajax.post(h.data("ams-location")+"/set-paragraph-visibility.json",{object_name:g.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}},refreshParagraph:function(h){var g=c('table[id="paragraphs_list"]');var f=c('tr[data-ams-element-name="'+h.object_name+'"]',g);c("span.title",f).html(h.title||" - - - - - - - -")},switchEditor:function(h){var k=c(this);var j=c("i",k);var l=k.parents("td");var i=c(".editor",l);var f=k.parents("tr");if(j.hasClass("fa-plus-square-o")){var g=f.parents("table");i.html('<h1 class="loading"><i class="fa fa-2x fa-gear fa-spin"></i></h1>');e.ajax.post(g.data("ams-location")+"/get-paragraph-editor.json",{object_name:f.data("ams-element-name")},function(m){i.html(m);if(m){e.initContent(i);j.removeClass("fa-plus-square-o").addClass("fa-minus-square-o");f.data("ams-disabled-handlers",true)}})}else{e.skin.cleanContainer(i);i.empty();j.removeClass("fa-minus-square-o").addClass("fa-plus-square-o");f.removeData("ams-disabled-handlers")}},switchAllEditors:function(g){var i=c(this);var h=c("i",i);var f=i.parents("table");if(h.hasClass("fa-plus-square-o")){h.removeClass("fa-plus-square-o").addClass("fa-cog fa-spin");e.ajax.post(f.data("ams-location")+"/get-paragraphs-editors.json",{},function(k){for(var l in k){if(!k.hasOwnProperty(l)){continue}var j=c('tr[data-ams-element-name="'+l+'"]',f);var m=c(".editor",j);if(m.is(":empty")){m.html(k[l]);e.initContent(m)}c(".fa-plus-square-o",j).removeClass("fa-plus-square-o").addClass("fa-minus-square-o");j.data("ams-disabled-handlers",true)}if(!c("i.fa-plus-square-o",c("tbody",f)).exists()){h.removeClass("fa-cog fa-spin").addClass("fa-minus-square-o")}})}else{c(".editor",f).each(function(){e.skin.cleanContainer(c(this));c(this).empty()});c(".fa-minus-square-o",f).removeClass("fa-minus-square-o").addClass("fa-plus-square-o");c("tr",f).removeData("ams-disabled-handlers")}}},associations:{refreshAssociations:function(f){var h=c("#"+f.object_name).parent(".ams-widget");h.replaceWith(c(f.table));h=c("#"+f.object_name).parent(".ams-widget");e.initContent(h);var g=h.siblings("legend");if(g.parents("fieldset:first").hasClass("switched")){g.click()}},switchVisibility:function(f){return function(){var i=c(this);var h=i.parents("tr");var g=h.parents("table");e.ajax.post(g.data("ams-location")+"/set-association-visibility.json",{object_name:h.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}}},fields:{refreshField:function(h){var g=c('table[id="form_fields_list"]');var f=c('tr[data-ams-element-name="'+h.object_name+'"]',g);c("td:nth-child(4)",f).html(h.title)},switchVisibility:function(f){return function(){var i=c(this);var h=i.parents("tr");var g=h.parents("table");e.ajax.post(g.data("ams-location")+"/set-form-field-visibility.json",{object_name:h.data("ams-element-name")},function(j,k){if(j.visible){c("i",i).attr("class","fa fa-fw fa-eye")}else{c("i",i).attr("class","fa fa-fw fa-eye-slash text-danger")}})}}},illustration:{refreshIllustration:function(f){var g=c("#"+f.object_name);g.replaceWith(c(f.form));g=c("#"+f.object_name);e.initContent(g)}},themes:{initExtracts:function(h){var g=c('select[name="form.widgets.thesaurus_name:list"]',h);var f=g.val();var j=c('select[name="form.widgets.extract_name:list"]',h);var i=j.val();if(f){e.jsonrpc.post("getExtracts",{thesaurus_name:f},{url:"/api/thesaurus/json"},function(k){j.empty();c(k.result).each(function(){c("<option></option>").attr("value",this.id).attr("selected",this.id===i).text(this.text).appendTo(j)})})}j.attr("data-ams-events-handlers",'{"select2-open": "PyAMS_content.themes.getExtracts"}')},getExtracts:function(i){var f=c(i.currentTarget);var h=f.parents("form");var g=c('select[name="form.widgets.thesaurus_name:list"]',h).val();if(g){e.jsonrpc.post("getExtracts",{thesaurus_name:g},{url:"/api/thesaurus/json"},function(l){var k=c('select[name="form.widgets.extract_name:list"]',h);var j=k.data("select2");j.results.empty();j.opts.populateResults.call(j,j.results,l.result,{term:""})})}}},review:{timer:null,timer_duration:{general:30000,chat:5000},initComments:function(g){var f=c(".chat-body",g);f.animate({scrollTop:f[0].scrollHeight},1000);clearInterval(d.review.timer);d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.chat);e.skin.registerCleanCallback(d.review.cleanCommentsCallback)},cleanCommentsCallback:function(){clearInterval(d.review.timer);d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.general)},updateComments:function(){var f=c(".badge",'nav a[href="#review-comments.html"]'),h;var g=c(".chat-body",".widget-body");if(g.exists()){h=c(".message",g).length}else{h=parseInt(f.text())}e.ajax.post("get-last-review-comments.json",{count:h},function(i){if(g.exists()){f.removeClass("bg-color-danger").addClass("bg-color-info")}if(h!==i.count){f.text(i.count).removeClass("hidden");if(g.exists()){c(".messages",g).append(i.content);g.animate({scrollTop:g[0].scrollHeight},1000)}if(!g.exists()){f.removeClass("bg-color-info").addClass("bg-color-danger").animate({padding:"3px 12px 2px","margin-right":"9px"},"slow",function(){c(this).animate({padding:"3px 6px 2px","margin-right":"15px"},"slow")})}}})},initCommentData:function(f){var g=c(".chat-body",".widget-body");return{count:c(".message",g).length}},addCommentCallback:function(g){var h=c(this);var i=h.parents(".widget-body");c(".messages",i).append(g.content);c('textarea[name="comment"]',h).val("");var f=c(".chat-body",i);f.animate({scrollTop:f[0].scrollHeight},1000);c(".badge",'nav a[href="#review-comments.html"]').text(g.count).removeClass("hidden")}}};b.PyAMS_content=d;c(b.document).on("PyAMS_content.changed_item",function(g,f){switch(f.object_type){case"paragraph":d.paragraphs.refreshParagraph(f);break;case"associations":d.associations.refreshAssociations(f);break;case"illustration":d.illustration.refreshIllustration(f);break;case"form_field":d.fields.refreshField(f);break;case"review_comments":d.review.updateComments();break}});var a=c(".badge",'nav a[href="#review-comments.html"]');if(a.exists()){d.review.timer=setInterval(d.review.updateComments,d.review.timer_duration.general)}})(jQuery,this);
\ No newline at end of file