Gitlab CSE Unil

Commit 5be8c22e authored by M. Chardon's avatar M. Chardon
Browse files

Merge branch '35-dev' into 'master'

35 dev

See merge request Marion.Chardon/editpdfplus!4
parents 80ee5635 b92a7bff
/.old/
/.scannerwork/
\ No newline at end of file
......@@ -33,6 +33,10 @@ require_once($CFG->dirroot . '/mod/assign/locallib.php');
require_sesskey();
const PLUGIN_NAME = "assignfeedback_editpdfplus";
const PERMISSION_ASSIGN_GRADE = "mod/assign:grade";
const PERMISSION_ASSIGN_SUBMIT = "mod/assign:submit";
$action = optional_param('action', '', PARAM_ALPHANUM);
$assignmentid = required_param('assignmentid', PARAM_INT);
$userid = required_param('userid', PARAM_INT);
......@@ -52,11 +56,11 @@ if (!$assignment->can_view_submission($userid)) {
if ($action === 'pollconversions') {
$draft = true;
if (!has_capability('mod/assign:grade', $context)) {
if (!has_capability(PERMISSION_ASSIGN_GRADE, $context)) {
// A student always sees the readonly version.
$readonly = true;
$draft = false;
require_capability('mod/assign:submit', $context);
require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
}
if ($readonly) {
......@@ -96,7 +100,7 @@ if ($action === 'pollconversions') {
$index = count($response->pages);
$page = new stdClass();
//$comments = page_editor::get_comments($grade->id, $index, $draft);
$page->url = moodle_url::make_pluginfile_url($context->id, 'assignfeedback_editpdfplus', $filearea, $grade->id, '/', $pagefile->get_filename())->out();
$page->url = moodle_url::make_pluginfile_url($context->id, PLUGIN_NAME, $filearea, $grade->id, '/', $pagefile->get_filename())->out();
//$page->comments = $comments;
if ($imageinfo = $pagefile->get_imageinfo()) {
$page->width = $imageinfo['width'];
......@@ -109,7 +113,7 @@ if ($action === 'pollconversions') {
$page->annotations = $annotations;
$response->pages[] = $page;
$component = 'assignfeedback_editpdfplus';
$component = PLUGIN_NAME;
$filearea = document_services::PAGE_IMAGE_FILEAREA;
$filepath = '/';
$fs = get_file_storage();
......@@ -128,7 +132,7 @@ if ($action === 'pollconversions') {
echo json_encode($response);
die();
} else if ($action == 'savepage') {
require_capability('mod/assign:grade', $context);
require_capability(PERMISSION_ASSIGN_GRADE, $context);
$response = new stdClass();
$response->errors = array();
......@@ -141,19 +145,18 @@ if ($action === 'pollconversions') {
$added = page_editor::set_annotations($grade->id, $index, $page->annotations);
if ($added != count($page->annotations)) {
array_push($response->errors, get_string('couldnotsavepage', 'assignfeedback_editpdfplus', $index + 1));
array_push($response->errors, get_string('couldnotsavepage', PLUGIN_NAME, $index + 1));
}
echo json_encode($response);
die();
} else if ($action == 'generatepdf') {
$refresh = optional_param('refresh', false, PARAM_BOOL);
if (!$refresh) {
require_capability('mod/assign:grade', $context);
require_capability(PERMISSION_ASSIGN_GRADE, $context);
} else {
require_capability('mod/assign:submit', $context);
require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
}
$response = new stdClass();
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
......@@ -161,7 +164,7 @@ if ($action === 'pollconversions') {
$response->url = '';
if ($file) {
$url = moodle_url::make_pluginfile_url($assignment->get_context()->id, 'assignfeedback_editpdfplus', document_services::FINAL_PDF_FILEAREA, $grade->id, '/', $file->get_filename(), false);
$url = moodle_url::make_pluginfile_url($assignment->get_context()->id, PLUGIN_NAME, document_services::FINAL_PDF_FILEAREA, $grade->id, '/', $file->get_filename(), false);
$response->url = $url->out(true);
$response->filename = $file->get_filename();
}
......@@ -174,31 +177,30 @@ if ($action === 'pollconversions') {
$modulename = get_string('modulename', 'assign');
$assignmentname = $assignment->get_instance()->name;
$formatparams = array('context' => $contextb->get_course_context());
$flecheHtml = ' → ';
$retourChariot = "\n";
$body = format_string($course->shortname, true, $formatparams)
. ' -> '
. $flecheHtml
. $modulename
. ' -> '
. format_string($assignmentname, true, $formatparams) . "\n"
. "\n---------------------------------------------------------------------\n"
. $flecheHtml
. format_string($assignmentname, true, $formatparams) . $retourChariot
. $retourChariot . "---------------------------------------------------------------------" . $retourChariot
. "La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce lien : "
. $response->url
. "\n\nCeci est un mail automatique.";
. $retourChariot . $retourChariot . "Ceci est un mail automatique.";
$bodyhtml = '<p><font face="sans-serif">'
. '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">'
. format_string($course->shortname, true, $formatparams)
. '</a> ->'
. '<a href="' . $CFG->wwwroot . '/mod/assign/index.php?id=' . $course->id . '">'
. $modulename
. '</a> ->'
. '<a href="' . $CFG->wwwroot . '/mod/assign/view.php?id=' . $coursemodule->id . '">'
. format_string($assignmentname, true, $formatparams)
. '</a></font></p>'
. '<hr /><font face="sans-serif">'
. getHtmlLink($CFG->wwwroot . '/course/view.php?id=' . $course->id, format_string($course->shortname, true, $formatparams))
. $flecheHtml
. getHtmlLink($CFG->wwwroot . '/mod/assign/index.php?id=' . $course->id, $modulename)
. $flecheHtml
. getHtmlLink($CFG->wwwroot . '/mod/assign/view.php?id=' . $coursemodule->id, format_string($assignmentname, true, $formatparams))
. '</font></p>'
. '<hr/><font face="sans-serif">'
. "<b>Information Moodle</b><br/>"
. "<p>La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce <a href='"
. $response->url
. "'>lien</a></p>"
. "<i>Ceci est un mail automatique.</i>";
. "<p>La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce "
. getHtmlLink($response->url, "lien")
. "</p>"
. "<i>Ceci est un mail automatique, merci de ne pas y répondre.</i>";
foreach ($teachers as $teacher) {
$res = email_to_user($teacher, $USER, "[Moodle] Mise à jour devoir", $body, $bodyhtml);
}
......@@ -207,7 +209,7 @@ if ($action === 'pollconversions') {
echo json_encode($response);
die();
} else if ($action == 'revertchanges') {
require_capability('mod/assign:grade', $context);
require_capability(PERMISSION_ASSIGN_GRADE, $context);
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
......@@ -216,7 +218,7 @@ if ($action === 'pollconversions') {
echo json_encode($result);
die();
} else if ($action == 'deletefeedbackdocument') {
require_capability('mod/assign:grade', $context);
require_capability(PERMISSION_ASSIGN_GRADE, $context);
$grade = $assignment->get_user_grade($userid, true, $attemptnumber);
$result = document_services::delete_feedback_document($assignment, $userid, $attemptnumber);
......@@ -225,7 +227,7 @@ if ($action === 'pollconversions') {
echo json_encode($result);
die();
} else if ($action == 'updatestudentview') {
require_capability('mod/assign:submit', $context);
require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
$response = new stdClass();
$response->errors = array();
......@@ -238,9 +240,12 @@ if ($action === 'pollconversions') {
$added = page_editor::update_annotations_status($page->annotations);
if ($added != count($page->annotations)) {
array_push($response->errors, get_string('couldnotsavepage', 'assignfeedback_editpdfplus', $index + 1));
array_push($response->errors, get_string('couldnotsavepage', PLUGIN_NAME, $index + 1));
}
echo json_encode($response);
die();
}
function getHtmlLink($url, $text) {
return '<a href="' . $url . '">' . $text . '</a>';
}
define(["jquery","jqueryui","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/tool","assignfeedback_editpdfplus/tooltype","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus","assignfeedback_editpdfplus/annotationframe","assignfeedback_editpdfplus/annotationcommentplus","assignfeedback_editpdfplus/annotationverticalline","assignfeedback_editpdfplus/annotationstampcomment"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=null,q=null,r=null,s=null,t=null,u=function(a,b){p=a,this.initTypeTool(b),this.init()};u.messageDelOk="",u.messageDelKo="",u.messageko="",u.messageaddok="",u.messageaddlibelleko="",u.messageEditOk="",u.prototype.selectTool=null;var v=function(){g.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageDelOk=a}).fail(c.exception),g.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){u.messageDelKo=a}).fail(c.exception),g.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageaddok=a}).fail(c.exception),g.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){u.messageko=a}).fail(c.exception),g.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageEditOk=a}).fail(c.exception),g.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){u.messageaddlibelleko=a}).fail(c.exception)};u.prototype.initTypeTool=function(a){var b=JSON.parse(a);s=[];for(var c=0;c<b.length;c++){var d=new i;d.initAdmin(b[c]),s[c]=d}},u.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();if(b&&""!==b){a("#editpdlplus_toolbar_"+b).show();var c=a("#editpdlplus_axes option:selected").data("delete");c?parseInt(c)>0?a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled"):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"))}else a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide();a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",B),this.selectTool=a(".editpdlplus_tool").first(),this.initToolUI(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),v()},u.prototype.initToolUI=function(){a(this.selectTool).removeClass("btn-default"),a(this.selectTool).addClass("btn-primary"),w()};var w=function(){a(".sortable").sortable({placeholder:"alert-warning",handle:"button",cancel:"",stop:function(b,d){var e=a(d.item).prev().find("button").val(),g=a(d.item).next().find("button").val(),h=a(d.item).find("button").val();a("input[name^='previoustoolid']").val(e),a("input[name^='toolid']").val(h),a("input[name^='nexttoolid']").val(g);var i=a("#assignfeedback_editpdfplus_order_tool"),j=i.serialize()+"&courseid="+a("#courseid").val();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_order_form",args:{jsonformdata:JSON.stringify(j)}}])[0].done(function(b){"ok"===b.message?(a("#message_order_tool").show(),a("#message_order_tool").html(u.messageEditOk),a("#message_order_tool").addClass("alert-success"),a("#message_order_tool").removeClass("alert-danger"),a("#message_order_tool").removeClass("alert-warning"),a("#message_order_tool").fadeOut(5e3)):(a("#message_order_tool").show(),a("#message_order_tool").html(u.messageko),a("#message_order_tool").addClass("alert-danger"),a("#message_order_tool").removeClass("alert-success"),a("#message_order_tool").fadeOut(5e3))}).fail(c.exception)}}),a(".sortable").disableSelection()};u.prototype.refreshPrevisu=function(){q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val(),q.colors=a("#color").val(),q.cartridge=a("#libelle").val(),q.cartridgeColor=a("#cartridgecolor").val();var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1)),q.texts=a("#texts").val(),q.label=a("#button").val(),q.enabled=a("#enabled").val(),q.reply=0,a("#reply").is(":checked")&&(q.reply=1),q.orderTool=a("#order").val(),z(),y()};var x=function(a){for(var b=0;b<s.length;b++)if(s[b].id==a)return s[b]},y=function(){var b=parseInt(a("#typetool").val()),c=x(b),d=!1,e=!1;c.configurableCartridge&&0===parseInt(c.configurableCartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurableCartridgeColor&&0===parseInt(c.configurableCartridgeColor)?(a("#cartridgecolor").hide(),a("label[for='cartridgecolor']").hide(),e=!0):(a("#cartridgecolor").show(),a("label[for='cartridgecolor']").show()),d&&e?a("#collapse3").parent().hide():a("#collapse3").parent().show();var f=!1,g=!1,h=!1;c.configurableColor&&0===parseInt(c.configurableColor)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurableTexts&&0===parseInt(c.configurableTexts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurableQuestion&&0===parseInt(c.configurableQuestion)?(a("#reply").hide(),a("label[for='reply']").hide(),h=!0):(a("#reply").show(),a("label[for='reply']").show()),f&&h&&g?a("#collapse4").parent().hide():a("#collapse4").parent().show()},z=function(){a("#canevas").html(""),t=null;var b=parseInt(a("#typetool").val());if(3===b||4===b||7===b?a("#canevas").css("background-image","url("+a("#map01").val()+")"):1===b||6===b?a("#canevas").css("background-image","url("+a("#map02").val()+")"):5===b&&a("#canevas").css("background-image","url("+a("#map03").val()+")"),1===b)t=new j;else if(3===b)t=new k;else if(4===b){t=new l;var c=new l}else 5===b?t=new n:6===b?t=new o:7===b&&(t=new m);if(t){var d=x(b);q.type=d,q.reply=0,a("#reply").is(":checked")&&(q.reply=1),t.initAdminDemo(q),t.draw(a("#canevas")),c&&(c.initChildAdminDemo(t),c.draw(a("#canevas")))}};u.prototype.openDivAddAxis=function(){var b=a("#editpdlplus_axes").val();b&&""!==b?(a("#message_edit_tool").hide(),a("#axistool").hide()):(a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#editpdlplus_axes_worspace").hide()),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var f={};e.loadFragment("assignfeedback_editpdfplus","axisadd",p,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body",a,b)}.bind(this)).fail(c.exception)},u.prototype.openDivEditAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var b=a("#editpdlplus_axes option:selected").val(),f={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisedit",p,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body",a,b)}.bind(this)).fail(c.exception)},u.prototype.openDivDelAxis=function(){var b=a("#editpdlplus_axes option:selected").data("delete");if(null!==b&&0===parseInt(b)){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled","disabled");var f=a("#editpdlplus_axes option:selected").val(),g={axeid:f};e.loadFragment("assignfeedback_editpdfplus","axisdel",p,g).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body",a,b)}.bind(this)).fail(c.exception)}};var A=function(b,c,e){var f=a.Deferred();return b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()};u.prototype.importAxis=function(){var b=a(this).data("axis");if(b&&parseInt(b)>0){a("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(b);var d=a("#assignfeedback_editpdfplus_import_axis"),e=d.serialize()+"&courseid="+a("#courseid").val();f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_import_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_import_axis").show(),a("#message_import_axis").html(u.messageaddok),a("#message_import_axis").addClass("alert-success"),a("#message_import_axis").removeClass("alert-danger"),a("#message_import_axis").removeClass("alert-warning"),a("#message_import_axis").fadeOut(5e3);var c="<div id='editpdlplus_toolbar_"+b[0].axeid+"' class='btn-group toolbar' style='display: none;'><ul class='sortable' style='list-style-type: none;margin: 0;padding: 0;width: 100%;'></ul></div>";a("#editpdlplus_toolbars").append(c),w();var d=new Option(b[0].axelabel,b[0].axeid,(!0),(!0));a("#editpdlplus_axes").append(d);var e=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");e.data("delete",1);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");if(f.addClass("disabled"),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var g=0;g<b.length;g++){var i=new h;i.initAdmin(b[g]);var j=i.getButtonSortable(b[g].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(j)}else{var k=b[0].axeid,e=a("#editpdlplus_axes option[value='"+k+"']");e.data("delete",0);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");f.removeClass("disabled")}a(".editpdlplus_tool").on("click",B),a("#editpdlplus_axes").change(),a("a[href^='#collapseadmin1'").click(),a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()}else a("#message_import_axis").show(),a("#message_import_axis").html(b[0].message),a("#message_import_axis").addClass("alert-danger"),a("#message_import_axis").removeClass("alert-success"),a("#message_import_axis").fadeOut(5e3)}).fail(c.exception)}};var B=function(){var b=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).removeClass("btn-default"),a(this).css("background-image",""),a(this).css("background-color","");var c=a(this).data("enable");1===c&&a(this).val()!==b?a(this).addClass("btn-default"):a(this).val()!==b&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),q&&q.id===b||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var d={toolid:b};e.loadFragment("assignfeedback_editpdfplus","tooledit",p,d).done(function(d,e){A(a("#editpdlplus_tool_item"),d,e).done(function(){q=new h,q.id=b,q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val();var d=x(q.typetool);q.type=d;var e=a("#realcolor").val();e.length>0?q.colors=a("#color").val():(a("#color").val(d.color),q.colors=null),q.cartridge=a("#libelle").val(),a("#realcartridgecolor").val()&&a("#realcartridgecolor").val().length>0?q.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.get_color_cartridge()),q.cartridgeColor=null),q.texts=a("#texts").val(),q.label=a("#button").val(),q.enabled=a("#enabled").val(),q.reply=a("#reply").val(),q.orderTool=a("#order").val(),a("#typetool").on("change",function(){q.typetool=a("#typetool").val();var b=x(q.typetool);q.type=b,q.colors=b.get_color(),q.cartridgeColor=b.get_color_cartridge(),a("#color").val(q.colors),a("#cartridgecolor").val(q.cartridgeColor),y(),z()}),a("#toolFormSubmit").on("click",function(){var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_tool_"+b[0].selecttool).remove(),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B);var f=a("#axisid").val();f!==b[0].axeid&&(a("#editpdlplus_axes").val(b[0].axeid),a("#editpdlplus_axes").change()),a("#editpdlplus_tool_"+b[0].selecttool).click()}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){r="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).hasClass("disabled")){var b=a("#assignfeedback_editpdfplus_edit_tool"),d=b.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message||"1"===b[0].message){if(a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageDelOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B)}else{var f=b[0].axeid,g=a("#editpdlplus_axes option[value='"+f+"']");g.data("delete",0);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.removeClass("disabled")}a("#toolworkspace").html("")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}}),a("#toolRefesh").on("click",function(){u.prototype.refreshPrevisu()}),z(),y()}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)};return u.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".btn-primary").addClass("btn-default"),a(".editpdlplus_tool").removeClass("btn-primary");var b=a("#editpdlplus_axes option:selected").val(),d={axisid:b};e.loadFragment("assignfeedback_editpdfplus","tooladd",p,d).done(function(d,e){A(a("#editpdlplus_tool_item"),d,e).done(function(){a("#canevas").hide(),a("#toolaxis").val(b),"clone"===r?(a("#toolaxis").val(q.axis),a("#typetool").val(q.typetool),a("#color").val(q.colors),a("#libelle").val(q.cartridge),a("#cartridgecolor").val(q.cartridgeColor),a("#texts").val(q.texts),a("#button").val(q.label),a("#enabled").val(q.enabled),a("#reply").val(q.reply),a("#order").val(q.orderTool),q=new h,r=null):(q=new h,a("#typetool").on("change",function(){q=new h,q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val();var b=x(q.typetool);q.type=b,q.colors=b.get_color(),q.cartridgeColor=b.get_color_cartridge(),a("#color").val(q.colors),a("#cartridgecolor").val(q.cartridgeColor),y()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageaddok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B),a("#toolworkspace").html("");var f=b[0].axeid,g=a("#editpdlplus_axes option[value='"+f+"']");g.data("delete",1);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.addClass("disabled")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}})}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)},u});
\ No newline at end of file
define(["jquery","jqueryui","core/notification","core/templates","core/fragment","core/ajax","core/str","assignfeedback_editpdfplus/tool","assignfeedback_editpdfplus/tooltype","assignfeedback_editpdfplus/annotationhighlightplus","assignfeedback_editpdfplus/annotationstampplus","assignfeedback_editpdfplus/annotationframe","assignfeedback_editpdfplus/annotationcommentplus","assignfeedback_editpdfplus/annotationverticalline","assignfeedback_editpdfplus/annotationstampcomment"],function(a,b,c,d,e,f,g,h,i,j,k,l,m,n,o){var p=null,q=null,r=null,s=null,t=null,u=function(a,b){p=a,this.initTypeTool(b),this.init()};u.messageDelOk="",u.messageDelKo="",u.messageko="",u.messageaddok="",u.messageaddlibelleko="",u.messageEditOk="",u.prototype.selectTool=null;var v=function(){g.get_string("admindeltool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageDelOk=a}).fail(c.exception),g.get_string("admindeltool_messageko","assignfeedback_editpdfplus").done(function(a){u.messageDelKo=a}).fail(c.exception),g.get_string("adminaddtool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageaddok=a}).fail(c.exception),g.get_string("admin_messageko","assignfeedback_editpdfplus").done(function(a){u.messageko=a}).fail(c.exception),g.get_string("adminedittool_messageok","assignfeedback_editpdfplus").done(function(a){u.messageEditOk=a}).fail(c.exception),g.get_string("adminaddtool_messagelibelleko","assignfeedback_editpdfplus").done(function(a){u.messageaddlibelleko=a}).fail(c.exception)};u.prototype.initTypeTool=function(a){var b=JSON.parse(a);s=[];for(var c=0;c<b.length;c++){var d=new i;d.initAdmin(b[c]),s[c]=d}},u.prototype.init=function(){a("#editpdlplus_axes").on("change",function(){a(".toolbar").hide();var b=a("#editpdlplus_axes").val();if(b&&""!==b){a("#editpdlplus_toolbar_"+b).show();var c=a("#editpdlplus_axes option:selected").data("delete");c?parseInt(c)>0?a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").prop("disabled",!0):a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"):(a("#editpdlplus_axes option[value='"+b+"']").data("delete",0),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeAttr("disabled"))}else a("#assignfeedback_editpdfplus_widget_admin_workspace").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide();a("#toolworkspace").html("")}),a("#editpdlplus_axes").change(),a(".editpdlplus_tool").on("click",B),this.selectTool=a(".editpdlplus_tool").first(),this.initToolUI(),a("#assignfeedback_editpdfplus_widget_admin_button_addaxis").on("click",this.openDivAddAxis),a("#assignfeedback_editpdfplus_widget_admin_button_editaxis").on("click",this.openDivEditAxis),a("#assignfeedback_editpdfplus_widget_admin_button_delaxis").on("click",this.openDivDelAxis),a("#assignfeedback_editpdfplus_widget_admin_button_addtool").on("click",this.openDivAddTool),a(".btn-primary").click(),a(".btnimport").on("click",this.importAxis),v()},u.prototype.initToolUI=function(){a(this.selectTool).addClass("btn-primary"),w()};var w=function(){a(".sortable").sortable({placeholder:"alert-warning",handle:"button",cancel:"",stop:function(b,d){var e=a(d.item).prev().find("button").val(),g=a(d.item).next().find("button").val(),h=a(d.item).find("button").val();a("input[name^='previoustoolid']").val(e),a("input[name^='toolid']").val(h),a("input[name^='nexttoolid']").val(g);var i=a("#assignfeedback_editpdfplus_order_tool"),j=i.serialize()+"&courseid="+a("#courseid").val();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_order_form",args:{jsonformdata:JSON.stringify(j)}}])[0].done(function(b){"ok"===b.message?(a("#message_order_tool").show(),a("#message_order_tool").html(u.messageEditOk),a("#message_order_tool").addClass("alert-success"),a("#message_order_tool").removeClass("alert-danger"),a("#message_order_tool").removeClass("alert-warning"),a("#message_order_tool").fadeOut(5e3)):(a("#message_order_tool").show(),a("#message_order_tool").html(u.messageko),a("#message_order_tool").addClass("alert-danger"),a("#message_order_tool").removeClass("alert-success"),a("#message_order_tool").fadeOut(5e3))}).fail(c.exception)}}),a(".sortable").disableSelection()};u.prototype.refreshPrevisu=function(){q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val(),q.colors=a("#color").val(),q.cartridge=a("#libelle").val(),q.cartridgeColor=a("#cartridgecolor").val();var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1)),q.texts=a("#texts").val(),q.label=a("#button").val(),q.enabled=a("#enabled").val(),q.reply=0,a("#reply").is(":checked")&&(q.reply=1),q.orderTool=a("#order").val(),z(),y()};var x=function(a){for(var b=0;b<s.length;b++)if(s[b].id==a)return s[b]},y=function(){var b=parseInt(a("#typetool").val()),c=x(b),d=!1,e=!1;c.configurableCartridge&&0===parseInt(c.configurableCartridge)?(a("#libelle").hide(),a("label[for='libelle']").hide(),d=!0):(a("#libelle").show(),a("label[for='libelle']").show()),c.configurableCartridgeColor&&0===parseInt(c.configurableCartridgeColor)?(a("#cartridgecolor").hide(),a("label[for='cartridgecolor']").hide(),e=!0):(a("#cartridgecolor").show(),a("label[for='cartridgecolor']").show()),d&&e?a("#collapse3").parent().hide():a("#collapse3").parent().show();var f=!1,g=!1,h=!1;c.configurableColor&&0===parseInt(c.configurableColor)?(a("#color").hide(),a("label[for='color']").hide(),f=!0):(a("#color").show(),a("label[for='color']").show()),c.configurableTexts&&0===parseInt(c.configurableTexts)?(a(".textform").hide(),a("label[for='texts']").hide(),g=!0):(a(".textform").show(),a("label[for='texts']").show()),c.configurableQuestion&&0===parseInt(c.configurableQuestion)?(a("#reply").hide(),a("label[for='reply']").hide(),h=!0):(a("#reply").show(),a("label[for='reply']").show()),f&&h&&g?a("#collapse4").parent().hide():a("#collapse4").parent().show()},z=function(){a("#canevas").html(""),t=null;var b=parseInt(a("#typetool").val());if(3===b||4===b||7===b?a("#canevas").css("background-image","url("+a("#map01").val()+")"):1===b||6===b?a("#canevas").css("background-image","url("+a("#map02").val()+")"):5===b&&a("#canevas").css("background-image","url("+a("#map03").val()+")"),1===b)t=new j;else if(3===b)t=new k;else if(4===b){t=new l;var c=new l}else 5===b?t=new n:6===b?t=new o:7===b&&(t=new m);if(t){var d=x(b);q.type=d,q.reply=0,a("#reply").is(":checked")&&(q.reply=1),t.initAdminDemo(q),t.draw(a("#canevas")),c&&(c.initChildAdminDemo(t),c.draw(a("#canevas")))}};u.prototype.openDivAddAxis=function(){var b=a("#editpdlplus_axes").val();b&&""!==b?(a("#message_edit_tool").hide(),a("#axistool").hide()):(a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#editpdlplus_axes_worspace").hide()),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_addaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var f={};e.loadFragment("assignfeedback_editpdfplus","axisadd",p,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_addaxis",a,b)}.bind(this)).fail(c.exception)},u.prototype.openDivEditAxis=function(){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_editaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var b=a("#editpdlplus_axes option:selected").val(),f={axeid:b};e.loadFragment("assignfeedback_editpdfplus","axisedit",p,f).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_editaxis",a,b)}.bind(this)).fail(c.exception)},u.prototype.openDivDelAxis=function(){var b=a("#editpdlplus_axes option:selected").data("delete");if(null!==b&&0===parseInt(b)){a("#message_edit_tool").hide(),a("#axistool").hide(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").show(),a("#assignfeedback_editpdfplus_widget_admin_div_delaxis").html(""),a("#assignfeedback_editpdfplus_widget_admin_toolheader").hide(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").hide(),a("#editpdlplus_axes").prop("disabled",!0);var f=a("#editpdlplus_axes option:selected").val(),g={axeid:f};e.loadFragment("assignfeedback_editpdfplus","axisdel",p,g).done(function(a,b){d.appendNodeContents("#assignfeedback_editpdfplus_widget_admin_div_delaxis",a,b)}.bind(this)).fail(c.exception)}};var A=function(b,c,e){var f=a.Deferred();return b.fadeOut("fast",function(){d.replaceNodeContents(b,c,e),b.fadeIn("fast",function(){f.resolve()})}),f.promise()};u.prototype.importAxis=function(){var b=a(this).data("axis");if(b&&parseInt(b)>0){a("#assignfeedback_editpdfplus_import_axis > div > input[name^='axeid']").val(b);var d=a("#assignfeedback_editpdfplus_import_axis"),e=d.serialize()+"&courseid="+a("#courseid").val();f.call([{methodname:"assignfeedback_editpdfplus_submit_axis_import_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_import_axis").show(),a("#message_import_axis").html(u.messageaddok),a("#message_import_axis").addClass("alert-success"),a("#message_import_axis").removeClass("alert-danger"),a("#message_import_axis").removeClass("alert-warning"),a("#message_import_axis").fadeOut(5e3);var c="<div id='editpdlplus_toolbar_"+b[0].axeid+"' class='btn-group toolbar' style='display: none;'><ul class='sortable' style='list-style-type: none;margin: 0;padding: 0;width: 100%;'></ul></div>";a("#editpdlplus_toolbars").append(c),w();var d=new Option(b[0].axelabel,b[0].axeid,(!0),(!0));a("#editpdlplus_axes").append(d);var e=a("#editpdlplus_axes option[value='"+b[0].axeid+"']");e.data("delete",1);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");if(f.prop("disabled",!0),a("#editpdlplus_tool_item").html(""),b[0].toolid&&b[0].toolid>0)for(var g=0;g<b.length;g++){var i=new h;i.initAdmin(b[g]);var j=i.getButtonSortable(b[g].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(j)}else{var k=b[0].axeid,e=a("#editpdlplus_axes option[value='"+k+"']");e.data("delete",0);var f=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");f.removeAttr("disabled")}a(".editpdlplus_tool").on("click",B),a("#editpdlplus_axes").change(),a("a[href^='#collapseadmin1'").click(),a("#axistool").show(),a("#assignfeedback_editpdfplus_widget_admin_toolheader").show(),a("#assignfeedback_editpdfplus_widget_admin_workspace").show(),a("#assignfeedback_editpdfplus_widget_admin_toolworkspace").show()}else a("#message_import_axis").show(),a("#message_import_axis").html(b[0].message),a("#message_import_axis").addClass("alert-danger"),a("#message_import_axis").removeClass("alert-success"),a("#message_import_axis").fadeOut(5e3)}).fail(c.exception)}};var B=function(){var b=a(this).val();a(".editpdlplus_tool").each(function(){a(this).removeClass("btn-primary"),a(this).css("background-image",""),a(this).css("background-color","");var c=a(this).data("enable");1!==c&&a(this).val()!==b&&(a(this).css("background-image","none"),a(this).css("background-color","#CCCCCC"))}),a(this).addClass("btn-primary"),q&&q.id===b||a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html("");var d={toolid:b};e.loadFragment("assignfeedback_editpdfplus","tooledit",p,d).done(function(d,e){A(a("#editpdlplus_tool_item"),d,e).done(function(){q=new h,q.id=b,q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val();var d=x(q.typetool);q.type=d;var e=a("#realcolor").val();e.length>0?q.colors=a("#color").val():(a("#color").val(d.color),q.colors=null),q.cartridge=a("#libelle").val(),a("#realcartridgecolor").val()&&a("#realcartridgecolor").val().length>0?q.cartridgeColor=a("#cartridgecolor").val():(a("#cartridgecolor").val(d.get_color_cartridge()),q.cartridgeColor=null),q.texts=a("#texts").val(),q.label=a("#button").val(),q.enabled=a("#enabled").val(),q.reply=a("#reply").val(),q.orderTool=a("#order").val(),a("#typetool").on("change",function(){q.typetool=a("#typetool").val();var b=x(q.typetool);q.type=b,q.colors=b.get_color(),q.cartridgeColor=b.get_color_cartridge(),a("#color").val(q.colors),a("#cartridgecolor").val(q.cartridgeColor),y(),z()}),a("#toolFormSubmit").on("click",function(){var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_edit_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageEditOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_tool_"+b[0].selecttool).remove(),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B);var f=a("#axisid").val();f!==b[0].axeid&&(a("#editpdlplus_axes").val(b[0].axeid),a("#editpdlplus_axes").change()),a("#editpdlplus_tool_"+b[0].selecttool).click()}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}),a("#toolEnabled").on("click",function(){var b=a("#toolenabled").val();1==b?(a("#toolEnabled > i").addClass("fa-eye-slash"),a("#toolEnabled > i").removeClass("fa-eye"),a("#toolenabled").val(0)):(a("#toolEnabled > i").addClass("fa-eye"),a("#toolEnabled > i").removeClass("fa-eye-slash"),a("#toolenabled").val(1)),a("#toolFormSubmit").click()}),a("#toolClone").on("click",function(){r="clone",a("#assignfeedback_editpdfplus_widget_admin_button_addtool").click()}),a("#toolRemove").on("click",function(){if(!a(this).prop("disabled")){var b=a("#assignfeedback_editpdfplus_edit_tool"),d=b.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_del_form",args:{jsonformdata:JSON.stringify(d)}}])[0].done(function(b){if(""===b[0].message||"1"===b[0].message){if(a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageDelOk),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html(""),parseInt(b[0].toolid)>0){for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B)}else{var f=b[0].axeid,g=a("#editpdlplus_axes option[value='"+f+"']");g.data("delete",0);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.removeAttr("disabled")}a("#toolworkspace").html("")}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}}),a("#toolRefesh").on("click",function(){u.prototype.refreshPrevisu()}),z(),y()}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)};return u.prototype.openDivAddTool=function(){a("#message_edit_tool").hide(),a("#editpdlplus_tool_item").html(""),a(".editpdlplus_tool").removeClass("btn-primary");var b=a("#editpdlplus_axes option:selected").val(),d={axisid:b};e.loadFragment("assignfeedback_editpdfplus","tooladd",p,d).done(function(d,e){A(a("#editpdlplus_tool_item"),d,e).done(function(){a("#canevas").hide(),a("#toolaxis").val(b),"clone"===r?(a("#toolaxis").val(q.axis),a("#typetool").val(q.typetool),a("#color").val(q.colors),a("#libelle").val(q.cartridge),a("#cartridgecolor").val(q.cartridgeColor),a("#texts").val(q.texts),a("#button").val(q.label),a("#enabled").val(q.enabled),a("#reply").val(q.reply),a("#order").val(q.orderTool),q=new h,r=null):(q=new h,a("#typetool").on("change",function(){q=new h,q.axis=a("#toolaxis").val(),q.typetool=a("#typetool").val();var b=x(q.typetool);q.type=b,q.colors=b.get_color(),q.cartridgeColor=b.get_color_cartridge(),a("#color").val(q.colors),a("#cartridgecolor").val(q.cartridgeColor),y()}),a("#typetool").change()),a("#toolFormSubmit").on("click",function(){if(""===a("#button").val())a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageaddlibelleko),a("#message_edit_tool").addClass("alert-warning"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success");else{var b="";a("input[name^='text[']").each(function(){a(this).val()&&a(this).val().length>0&&(b+='"'+a(this).val().replace(/"/g,"")+'",')}),b.length>0&&a("#texts").val(b.substring(0,b.length-1));var d=a("#assignfeedback_editpdfplus_edit_tool"),e=d.serialize();f.call([{methodname:"assignfeedback_editpdfplus_submit_tool_add_form",args:{jsonformdata:JSON.stringify(e)}}])[0].done(function(b){if(""===b[0].message){a("#message_edit_tool").show(),a("#message_edit_tool").html(u.messageaddok),a("#message_edit_tool").addClass("alert-success"),a("#message_edit_tool").removeClass("alert-danger"),a("#message_edit_tool").removeClass("alert-warning"),a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").html("");for(var c=0;c<b.length;c++){var d=new h;d.initAdmin(b[c]);var e=d.getButtonSortable(b[c].selecttool);a("#editpdlplus_toolbar_"+b[0].axeid+" > ul").append(e)}a(".editpdlplus_tool").on("click",B),a("#toolworkspace").html("");var f=b[0].axeid,g=a("#editpdlplus_axes option[value='"+f+"']");g.data("delete",1);var i=a("#assignfeedback_editpdfplus_widget_admin_button_delaxis");i.prop("disabled",!0)}else a("#message_edit_tool").show(),a("#message_edit_tool").html(b[0].message),a("#message_edit_tool").addClass("alert-danger"),a("#message_edit_tool").removeClass("alert-success")}).fail(c.exception)}})}.bind(this)).fail(c.exception)}.bind(this)).fail(c.exception)},u});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.x=0,c.y=0,c.endx=0,c.endy=0,c.path="",c.toolid=0,c.colour="red",c.tooltype=null,c.id=0,c.cartridgex=0,c.cartridgey=0,c.adminDemo=0,c.prototype.init=function(a){this.cartridgex=parseInt(a.cartridgex,10)||0,this.cartridgey=parseInt(a.cartridgey,10)||0,this.colour=a.colour||"red",this.tooltype=a.tooltype,this.id=a.id,this.x=parseInt(a.x,10)||0,this.y=parseInt(a.y,10)||0,this.endx=parseInt(a.endx,10)||0,this.endy=parseInt(a.endy,10)||0,this.path=a.path||"",this.toolid=a.toolid},c.prototype.initAdminDemo=function(a){this.id="previsu_annot",this.displaylock=1,this.adminDemo=1,this.tooltype=a,this.colour=a.get_color()},c.prototype.draw=function(){},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colour];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.tooltype.get_color_cartridge()];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.get_color_cartridge(),a},c.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.tooltype.id?this.divcartridge="ct_"+this.tooltype.id+"_"+a:this.divcartridge="ct_"+this.id+"_"+a},c.prototype.get_div_cartridge=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"' ",d+="class='assignfeedback_editpdfplus_cartridge' ",d+="style='border-color: "+b+";position:relative;'> ",d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge);return this.adminDemo<1,e},c.prototype.get_div_cartridge_label=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_cartridge' ",d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.cartridge,d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge+"_cartridge");return e},c.prototype.get_div_input=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_display' ",d+="style='color:"+b+"; ",d+="'></div>",c.append(d);var e=a("#"+this.divcartridge+"_display");return e.on("click",{annotation:this},this.edit_annot),e},c.prototype.get_div_edition=function(b){var c="<div ";c+="id='"+this.divcartridge+"_edit' ",c+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_edition' ",c+="style='display:none;'> ",c+="<textarea id='"+this.divcartridge+"_editinput' type='text' class='form-control' style='margin-bottom:5px;'",1===this.adminDemo&&(c+=" readonly"),c+="></textarea>",c+="</div>",b&&b.append(c);var d=a("#"+this.divcartridge+"_edit"),e=this.tooltype.texts;if(e&&e.length>0){var f="<div id='"+this.divcartridge+"_edit_propositions'></div>";d.append(f);for(var g=a("#"+this.divcartridge+"_edit_propositions"),h=e.split('","'),i=0;i<h.length;i++){var j="<button class='btn btn-default";1===this.adminDemo&&(j+=" disabled"),j+="' type='button' style='width:100%;font-size: x-small;'>"+h[i].replace(/"/g,"")+"</button>",g.append(j),this.adminDemo<1,g.append("<br/>")}}return d},c.prototype.get_div_container=function(b,c){var d="<div ";d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_input");var g=1;(this.displaylock||this.displaylock>=0)&&(g=this.displaylock);var h="<input type='hidden' id='"+this.divcartridge+"_onof' value="+g+" />";return c&&e.append(h),e.append(this.get_input_question()),this.get_button_visibility_left(e),this.get_button_visibility_right(e),this.get_button_save(e),this.get_button_cancel(e),1===this.tooltype.reply&&this.get_button_question(e),this.get_button_remove(e),e},c.prototype.get_input_question=function(){var a=0;return this.answerrequested&&1===this.answerrequested&&(a=1),"<input type='hidden' id='"+this.divcartridge+"_question' value='"+a+"'/>"},c.prototype.get_button_visibility_right=function(b){var c="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'>",c+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",c+="</button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonedit_right");return this.adminDemo<1,d},c.prototype.get_button_visibility_left=function(b){var c="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'>",c+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",c+="</button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonedit_left");return this.adminDemo<1,d},c.prototype.get_button_save=function(b){var c="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-check' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonsave");return this.adminDemo<1&&d.on("click",this.save_annot),d},c.prototype.get_button_cancel=function(b){var c="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttoncancel");return this.adminDemo<1,d},c.prototype.get_button_question=function(b){var c="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+='\' type=\'button\'><span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span></button>',b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonquestion");return this.adminDemo<1,d},c.prototype.get_button_remove=function(b){var c="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-default";1===this.adminDemo&&(c+=" disabled"),c+="' type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>",b&&b.append(c);var d=a("#"+this.divcartridge+"_buttonremove");return this.adminDemo<1,d},c.prototype.apply_visibility_annot=function(){var b=a("#"+this.divcartridge+"_display"),c=a("#"+this.divcartridge+"_onof"),d=a("#"+this.divcartridge+"_buttonedit_right"),e=a("#"+this.divcartridge+"_buttonedit_left"),f=a("#"+this.divcartridge+"_radioContainer");c&&("1"===c.val()?(d&&d.show(),e&&e.show()):"0"===c.val()?(d&&d.show(),e&&e.hide()):(d&&d.hide(),e&&e.show())),b&&b.html(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltype.getToolTypeLabel()&&d&&(d.hide(),e.hide()),f&&f.hide(),this.apply_question_status()},c.prototype.get_text_to_diplay_in_cartridge=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_onof"),d="";return""===b&&(d="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===c.val()&&""!==b?d=b.substr(0,20):"0"===c.val()&&""!==b?d="...":""!==b&&(d=b),1===this.answerrequested&&(d+='&nbsp;<span style="color:red;">[?]</span>'),d},c.prototype.apply_question_status=function(){var b=a("#"+this.divcartridge+"_buttonquestion"),c=a("#"+this.divcartridge+"_question"),d=0;c&&(d=parseInt(c.val(),10)),b&&(1===d?b.html('<i class="fa fa-question-circle-o"></i>'):b.html('<span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span>'))},c.prototype.draw_catridge=function(){return!0},c.prototype.edit_annot=function(c){if(c.data.annotation.tooltype.typetool<=b.TOOLTYPE.COMMENTPLUS){var d=c.data.annotation,e=a("#"+d.divcartridge),f=a("#"+d.divcartridge+"_display"),g=a("#"+d.divcartridge+"_edit"),h=a("#"+d.divcartridge+"_buttonedit_right"),i=a("#"+d.divcartridge+"_buttonedit_left"),j=a("#"+d.divcartridge+"_buttonsave"),k=a("#"+d.divcartridge+"_buttoncancel"),l=a("#"+d.divcartridge+"_buttonquestion"),m=a("#"+d.divcartridge+"_buttonrotation"),n=a("#"+d.divcartridge+"_buttonremove"),o=a("#"+d.divcartridge+"_editinput");f.hide(),h&&h.hide(),i&&i.hide(),m&&m.hide(),g.show(),j.show(),k.show(),l&&l.show(),n.show(),e.css("z-index",1e3),o&&o.attr("focus","on"),c.data.annotation.disabled_canvas_event(),a("#canevas").on("click",{annotation:d,action:"clickoutside"},d.save_annot_clickout)}},c.prototype.fill_input_edition=function(b,c){var d=a("#"+this.divcartridge+"_editinput");d&&d.set("value",c),this.save_annot(c)},c.prototype.save_annot_clickout=function(a){"canevas"===a.target.id&&1===a.data.annotation.adminDemo&&a.data.annotation.cancel_edit()},c.prototype.save_annot=function(b){if("string"!=typeof b){var c=a("#"+this.divcartridge+"_editinput");c&&(b=c.val())}this.textannot=b,0===b.length&&(b="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},c.prototype.cancel_edit=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_editinput");b&&c&&c.set("value",b),this.hide_edit(),this.apply_visibility_annot();var d=a("#"+this.divcartridge);d&&d.off()},c.prototype.hide_edit=function(b,c){if(!c||"clickoutside"!==c||this.editor.currentannotation!==this){var d=a("#"+this.divcartridge),e=a("#"+this.divcartridge+"_display"),f=a("#"+this.divcartridge+"_edit"),g=a("#"+this.divcartridge+"_visu"),h=a("#"+this.divcartridge+"_buttonsave"),i=a("#"+this.divcartridge+"_buttoncancel"),j=a("#"+this.divcartridge+"_buttonquestion"),k=a("#"+this.divcartridge+"_buttonrotation"),l=a("#"+this.divcartridge+"_buttonremove"),m=a("#"+this.divcartridge+"_radioContainer");e&&(e.show(),e.css("color",this.get_color_cartridge())),k&&k.show(),f&&(f.hide(),h.hide(),i.hide()),g&&g.hide(),j&&j.hide(),l&&l.hide(),d&&(d.css("z-index",1),a("#canevas").off()),f&&this.enabled_canvas_event(),m&&m.hide()}},c.prototype.disabled_canvas_event=function(){var c=a(b.SELECTOR.DRAWINGCANVAS);c.off("click")},c.prototype.enabled_canvas_event=function(){},c.prototype.change_visibility_annot=function(b){var c=a("#"+this.divcartridge+"_onof"),d=parseInt(c.val(),10);"r"===b?d+=1:d-=1,c.val(d),this.displaylock=d,this.apply_visibility_annot()},c.prototype.get_valref=function(){return this.textannot&&this.textannot.length>0&&"string"==typeof this.textannot?this.textannot:""},c});
\ No newline at end of file
define(["jquery","./global"],function(a,b){function c(){return this._instanceID=e(),this}var d=0,e=function(){return++d};return c.getInstanceCount=function(){return d},c.prototype.getInstanceID=function(){return this._instanceID},c.x=0,c.y=0,c.endx=0,c.endy=0,c.path="",c.toolid=0,c.colour="red",c.tooltype=null,c.id=0,c.cartridgex=0,c.cartridgey=0,c.adminDemo=0,c.prototype.init=function(a){this.cartridgex=parseInt(a.cartridgex,10)||0,this.cartridgey=parseInt(a.cartridgey,10)||0,this.colour=a.colour||"red",this.tooltype=a.tooltype,this.id=a.id,this.x=parseInt(a.x,10)||0,this.y=parseInt(a.y,10)||0,this.endx=parseInt(a.endx,10)||0,this.endy=parseInt(a.endy,10)||0,this.path=a.path||"",this.toolid=a.toolid},c.prototype.initAdminDemo=function(a){this.id="previsu_annot",this.displaylock=1,this.adminDemo=1,this.tooltype=a,this.colour=a.get_color()},c.prototype.draw=function(){},c.prototype.get_color=function(){var a=b.ANNOTATIONCOLOUR[this.colour];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.colour,a},c.prototype.get_color_cartridge=function(){var a=b.ANNOTATIONCOLOUR[this.tooltype.get_color_cartridge()];return a?(a=a.replace("rgb","rgba"),a=a.replace(")",",0.5)")):a=this.tooltype.get_color_cartridge(),a},c.prototype.init_div_cartridge_id=function(){var a=(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");this.tooltype.id?this.divcartridge="ct_"+this.tooltype.id+"_"+a:this.divcartridge="ct_"+this.id+"_"+a},c.prototype.get_div_cartridge=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"' ",d+="class='assignfeedback_editpdfplus_cartridge' ",d+="style='border-color: "+b+";position:relative;'> ",d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge);return this.adminDemo<1,e},c.prototype.get_div_cartridge_label=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_cartridge' ",d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_cartridge' ",d+="style='border-right-color: "+b+";color:"+b+";' ",d+="> ",d+=this.tooltype.cartridge,d+="</div>",c&&c.append(d);var e=a("#"+this.divcartridge+"_cartridge");return e},c.prototype.get_div_input=function(b,c){var d="<div ";d+="id='"+this.divcartridge+"_display' ",d+="style='color:"+b+"; ",d+="'></div>",c.append(d);var e=a("#"+this.divcartridge+"_display");return e.on("click",{annotation:this},this.edit_annot),e},c.prototype.get_div_edition=function(b){var c="<div ";c+="id='"+this.divcartridge+"_edit' ",c+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_edition' ",c+="style='display:none;'> ",c+="<textarea id='"+this.divcartridge+"_editinput' type='text' class='form-control' style='margin-bottom:5px;'",1===this.adminDemo&&(c+=" readonly"),c+="></textarea>",c+="</div>",b&&b.append(c);var d=a("#"+this.divcartridge+"_edit"),e=this.tooltype.texts;if(e&&e.length>0){for(var f="<div class='btn-group-vertical aepp-toolbar-vertical'></div>",g=a(f),h=e.split('","'),i=0;i<h.length;i++){var j="<button class='btn btn-outline-dark'";1===this.adminDemo&&(j+=" disabled"),j+=" type='button'>"+h[i].replace(/"/g,"")+"</button>",g.append(j),this.adminDemo<1,g.append("<br/>")}d.append(g)}return d},c.prototype.get_div_container=function(b,c){var d="<div ";d+="class='assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur' >",d+="</div>",c&&c.append(d);var e=a(".assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_conteneur"),f=this.get_div_input(b,e);f.addClass("assignfeedback_editpdfplus_"+this.tooltype.getToolTypeLabel()+"_input");var g=1;(this.displaylock||this.displaylock>=0)&&(g=this.displaylock);var h="<input type='hidden' id='"+this.divcartridge+"_onof' value="+g+" />";return c&&e.append(h),e.append(this.get_input_question()),e},c.prototype.get_toolbar=function(){var b=a("<div id='"+this.divcartridge+"_toolbar' class='btn-group btn-group-sm aepp-toolbar'></div>");return b.append(this.get_button_visibility_left()),b.append(this.get_button_visibility_right()),b.append(this.get_button_save()),b.append(this.get_button_cancel()),1===this.tooltype.reply&&b.append(this.get_button_question()),b.append(this.get_button_remove()),b},c.prototype.get_input_question=function(){var a=0;return this.answerrequested&&1===this.answerrequested&&(a=1),"<input type='hidden' id='"+this.divcartridge+"_question' value='"+a+"'/>"},c.prototype.get_button_visibility_right=function(){var b="<button id='"+this.divcartridge+"_buttonedit_right' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-right' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_visibility_left=function(){var b="<button id='"+this.divcartridge+"_buttonedit_left' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'>",b+="<i class='fa fa-arrow-left' aria-hidden='true'></i>",b+="</button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_save=function(){var b="<button id='"+this.divcartridge+"_buttonsave' style='display:none;margin-left:110px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-check' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1&&c.on("click",this.save_annot),c},c.prototype.get_button_cancel=function(){var b="<button id='"+this.divcartridge+"_buttoncancel' style='display:none;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-undo' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_question=function(){var b="<button id='"+this.divcartridge+"_buttonquestion' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=' type=\'button\'><span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span></button>';var c=a(b);return this.adminDemo<1,c},c.prototype.get_button_remove=function(){var b="<button id='"+this.divcartridge+"_buttonremove' style='display:none;margin-left:10px;' class='btn btn-sm btn-outline-dark'";1===this.adminDemo&&(b+=" disabled"),b+=" type='button'><i class='fa fa-trash' aria-hidden='true'></i></button>";var c=a(b);return this.adminDemo<1,c},c.prototype.apply_visibility_annot=function(){var b=a("#"+this.divcartridge+"_display"),c=a("#"+this.divcartridge+"_onof"),d=a("#"+this.divcartridge+"_buttonedit_right"),e=a("#"+this.divcartridge+"_buttonedit_left"),f=a("#"+this.divcartridge+"_radioContainer");c&&("1"===c.val()?(d&&d.show(),e&&e.show()):"0"===c.val()?(d&&d.show(),e&&e.hide()):(d&&d.hide(),e&&e.show())),b&&b.html(this.get_text_to_diplay_in_cartridge()),"frame"===this.tooltype.getToolTypeLabel()&&d&&(d.hide(),e.hide()),f&&f.hide(),this.apply_question_status()},c.prototype.get_text_to_diplay_in_cartridge=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_onof"),d="";return""===b&&(d="&nbsp;&nbsp;&nbsp;&nbsp"),"1"===c.val()&&""!==b?d=b.substr(0,20):"0"===c.val()&&""!==b?d="...":""!==b&&(d=b),1===this.answerrequested&&(d+='&nbsp;<span style="color:red;">[?]</span>'),d},c.prototype.apply_question_status=function(){var b=a("#"+this.divcartridge+"_buttonquestion"),c=a("#"+this.divcartridge+"_question"),d=0;c&&(d=parseInt(c.val(),10)),b&&(1===d?b.html('<i class="fa fa-question-circle-o"></i>'):b.html('<span class="fa-stack fa-lg" style="line-height: 1em;width: 1em;"><i class="fa fa-question-circle-o fa-stack-1x"></i><i class="fa fa-ban fa-stack-1x text-danger"></i></span>'))},c.prototype.draw_catridge=function(){return!0},c.prototype.edit_annot=function(c){if(c.data.annotation.tooltype.typetool<=b.TOOLTYPE.COMMENTPLUS){var d=c.data.annotation,e=a("#"+d.divcartridge),f=a("#"+d.divcartridge+"_display"),g=a("#"+d.divcartridge+"_edit"),h=a("#"+d.divcartridge+"_buttonedit_right"),i=a("#"+d.divcartridge+"_buttonedit_left"),j=a("#"+d.divcartridge+"_buttonsave"),k=a("#"+d.divcartridge+"_buttoncancel"),l=a("#"+d.divcartridge+"_buttonquestion"),m=a("#"+d.divcartridge+"_buttonrotation"),n=a("#"+d.divcartridge+"_buttonremove"),o=a("#"+d.divcartridge+"_editinput");f.hide(),h&&h.hide(),i&&i.hide(),m&&m.hide(),g.show(),j.show(),k.show(),l&&l.show(),n.show(),e.css("z-index",1e3),o&&o.attr("focus","on"),c.data.annotation.disabled_canvas_event(),a("#canevas").on("click",{annotation:d,action:"clickoutside"},d.save_annot_clickout)}},c.prototype.fill_input_edition=function(b,c){var d=a("#"+this.divcartridge+"_editinput");d&&d.set("value",c),this.save_annot(c)},c.prototype.save_annot_clickout=function(a){"canevas"===a.target.id&&1===a.data.annotation.adminDemo&&a.data.annotation.cancel_edit()},c.prototype.save_annot=function(b){if("string"!=typeof b){var c=a("#"+this.divcartridge+"_editinput");c&&(b=c.val())}this.textannot=b,0===b.length&&(b="&nbsp;&nbsp;"),this.hide_edit(),this.apply_visibility_annot()},c.prototype.cancel_edit=function(){var b=this.get_valref(),c=a("#"+this.divcartridge+"_editinput");b&&c&&c.set("value",b),this.hide_edit(),this.apply_visibility_annot();var d=a("#"+this.divcartridge);d&&d.off()},c.prototype.hide_edit=function(b,c){if(!c||"clickoutside"!==c||this.editor.currentannotation!==this){var d=a("#"+this.divcartridge),e=a("#"+this.divcartridge+"_display"),f=a("#"+this.divcartridge+"_edit"),g=a("#"+this.divcartridge+"_visu"),h=a("#"+this.divcartridge+"_buttonsave"),i=a("#"+this.divcartridge+"_buttoncancel"),j=a("#"+this.divcartridge+"_buttonquestion"),k=a("#"+this.divcartridge+"_buttonrotation"),l=a("#"+this.divcartridge+"_buttonremove"),m=a("#"+this.divcartridge+"_radioContainer");e&&(e.show(),e.css("color",this.get_color_cartridge())),k&&k.show(),f&&(f.hide(),h.hide(),i.hide()),g&&g.hide(),j&&j.hide(),l&&l.hide(),d&&(d.css("z-index",1),a("#canevas").off()),f&&this.enabled_canvas_event(),m&&m.hide()}},c.prototype.disabled_canvas_event=function(){var c=a(b.SELECTOR.DRAWINGCANVAS);c.off("click")},c.prototype.enabled_canvas_event=function(){},c.prototype.change_visibility_annot=function(b){var c=a("#"+this.divcartridge+"_onof"),d=parseInt(c.val(),10);"r"===b?d+=1:d-=1,c.val(d),this.displaylock=d,this.apply_visibility_annot()},c.prototype.get_valref=function(){return this.textannot&&this.textannot.length>0&&"string"==typeof this.textannot?this.textannot:""},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=30,this.y=90},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'><i class='fa fa-commenting' aria-hidden='true' style='color:black;'></i></div>";b.append(c),a("#"+this.id).css("color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("padding","0 2px"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_commentplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+20+this.cartridgex),b.css("top",this.y-20+this.cartridgey),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=30,this.y=90},c.prototype.draw=function(b){if(b){var c=this.get_color_cartridge(),d="<div id='"+this.id+"'><i class='fa fa-commenting' aria-hidden='true' style='color:"+c+";'></i></div>";b.append(d),a("#"+this.id).css("color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("padding","0 2px"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_commentplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=this.get_toolbar();d.append(e),this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+20+this.cartridgex),b.css("top",this.y-20+this.cartridgey),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=279,this.y=113,this.endx=435,this.endy=129,this.parent_annot=0,this.colour="#FF0000"},c.prototype.initChildAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a.tooltype),this.x=144,this.y=192,this.endx=296,this.endy=208,this.parent_annot=a.id,this.id="previsu_annot_child",this.colour="#FF0000"},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("border","solid 2px red"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y),a("#"+this.id).css("box-sizing","inherit")}return this.draw_catridge(b),this},c.prototype.draw_catridge=function(b){if(!this.parent_annot_element&&0===this.parent_annot){var c;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var d=a("#"+this.id);d&&d.addClass("class_"+this.divcartridge);var e=this.get_color();c=this.get_div_cartridge(e,b),c.addClass("assignfeedback_editpdfplus_frame"),this.get_div_cartridge_label(e,c,!0);var f=this.get_div_container(e,c),g="<button id='"+this.divcartridge+"_buttonpencil' class='btn btn-default";this.adminDemo&&(g+=" disabled"),g+="' type='button'>",g+='<i class="fa fa-eyedropper" aria-hidden="true"></i>',g+="</button>";var h="<button id='"+this.divcartridge+"_buttonadd' class='btn btn-default";this.adminDemo&&(h+=" disabled"),h+="' type='button'>",h+='<i class="fa fa-plus" aria-hidden="true"></i>',h+="</button>",f.append(g),f.append(h),this.get_div_edition(f),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),c.css("left",this.cartridgex+15),c.css("top",this.y+this.cartridgey-12),this.apply_visibility_annot()}}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=279,this.y=113,this.endx=435,this.endy=129,this.parent_annot=0,this.colour="#FF0000"},c.prototype.initChildAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a.tooltype),this.x=144,this.y=192,this.endx=296,this.endy=208,this.parent_annot=a.id,this.id="previsu_annot_child",this.colour="#FF0000"},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("border","solid 2px red"),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y),a("#"+this.id).css("box-sizing","inherit")}return this.draw_catridge(b),this},c.prototype.draw_catridge=function(b){if(!this.parent_annot_element&&0===this.parent_annot){var c;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var d=a("#"+this.id);d&&d.addClass("class_"+this.divcartridge);var e=this.get_color();c=this.get_div_cartridge(e,b),c.addClass("assignfeedback_editpdfplus_frame"),this.get_div_cartridge_label(e,c,!0);var f=this.get_div_container(e,c),g=this.get_toolbar(),h="<button id='"+this.divcartridge+"_buttonpencil' class='btn btn-sm btn-outline-dark'";this.adminDemo&&(h+=" disabled"),h+=" type='button'>",h+='<i class="fa fa-eyedropper" aria-hidden="true"></i>',h+="</button>";var i=a(h),j="<button id='"+this.divcartridge+"_buttonadd' class='btn btn-sm btn-outline-dark'";this.adminDemo&&(j+=" disabled"),j+=" type='button'>",j+='<i class="fa fa-plus" aria-hidden="true"></i>',j+="</button>";var k=a(j);g.append(i),g.append(k),f.append(g),this.get_div_edition(f),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),c.css("left",this.cartridgex+15),c.css("top",this.y+this.cartridgey-12),this.apply_visibility_annot()}}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=83,this.y=84,this.endx=239,this.endy=100},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("opacity",.5),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_hightlightplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-15),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=83,this.y=84,this.endx=239,this.endy=100},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",this.endx-this.x),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("opacity",.5),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_hightlightplus"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=this.get_toolbar();d.append(e),this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-15),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=188,this.y=118,this.displayrotation=1},c.prototype.draw=function(b){if(b){this.shape_id="ct_stampcomment_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");var c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-h fa-2x" aria-hidden="true"></i>';this.displayrotation>0&&(c='<i id="'+this.shape_id+'_img" class="fa fa-arrows-v fa-2x" aria-hidden="true"></i>');var d="<div id='"+this.id+"'>"+c+"</div>";b.append(d),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_stampcomment"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=0;this.displayrotation>0&&(e=1);var f="<input type='hidden' id='"+this.divcartridge+"_rotation' value="+e+" />";d.append(f);var g="<button id='"+this.divcartridge+"_buttonrotation' class='btn btn-default";this.adminDemo&&(g+=" disabled"),g+='\' type=\'button\'><i class="fa fa-refresh" aria-hidden="true"></i></button>',d.append(g),this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-30),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=188,this.y=118,this.displayrotation=1},c.prototype.draw=function(b){if(b){var c=this.get_color_cartridge(),d="fa-arrows-h";this.displayrotation>0&&(d="fa-arrows-v"),this.shape_id="ct_stampcomment_"+(new Date).toJSON().replace(/:/g,"").replace(/\./g,"");var e='<i id="'+this.shape_id+'_img" class="fa '+d+' fa-2x" aria-hidden="true" style="color:'+c+';"></i>',f="<div id='"+this.id+"'>"+e+"</div>";b.append(f),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y)}this.draw_catridge(b)},c.prototype.draw_catridge=function(b){var c;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var d=this.get_color_cartridge();c=this.get_div_cartridge(d,b),c.addClass("assignfeedback_editpdfplus_stampcomment"),this.get_div_cartridge_label(d,c);var e=this.get_div_container(d,c),f=this.get_toolbar(),g=0;this.displayrotation>0&&(g=1);var h="<input type='hidden' id='"+this.divcartridge+"_rotation' value="+g+" />";e.append(h);var i="<button id='"+this.divcartridge+"_buttonrotation' class='btn btn-sm btn-outline-dark'";this.adminDemo&&(i+=" disabled"),i+=' type=\'button\'><i class="fa fa-refresh" aria-hidden="true"></i></button>';var j=a(i);f.append(j),e.append(f),this.get_div_edition(e),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),c.css("left",this.x+this.cartridgex),c.css("top",this.y+this.cartridgey-30),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=285,this.y=65,this.endy=175},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",3),this.endy-this.y<=30&&(this.endy=this.y+30),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y),this.draw_catridge(b)}},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_verticalline"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b);this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-109),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["jquery","./annotation"],function(a,b){function c(){return b.call(this),this}return c.prototype=Object.create(b.prototype),c.prototype.initAdminDemo=function(a){b.prototype.initAdminDemo.call(this,a),this.x=285,this.y=65,this.endy=175},c.prototype.draw=function(b){if(b){var c="<div id='"+this.id+"'></div>";b.append(c),a("#"+this.id).css("background-color",this.get_color()),a("#"+this.id).css("width",3),this.endy-this.y<=30&&(this.endy=this.y+30),a("#"+this.id).css("height",this.endy-this.y),a("#"+this.id).css("position","relative"),a("#"+this.id).css("left",this.x),a("#"+this.id).css("top",this.y),this.draw_catridge(b)}},c.prototype.draw_catridge=function(a){var b;if(!this.divcartridge||""===this.divcartridge){this.init_div_cartridge_id();var c=this.get_color_cartridge();b=this.get_div_cartridge(c,a),b.addClass("assignfeedback_editpdfplus_verticalline"),this.get_div_cartridge_label(c,b);var d=this.get_div_container(c,b),e=this.get_toolbar();d.append(e),this.get_div_edition(d),this.cartridgex&&0!==this.cartridgex||(this.cartridgex=parseInt(this.tooltype.getToolTypeCartX(),10)),this.cartridgey&&0!==this.cartridgey||(this.cartridgey=parseInt(this.tooltype.getToolTypeCartY(),10)),b.css("left",this.x+this.cartridgex),b.css("top",this.y+this.cartridgey-109),this.apply_visibility_annot()}return!0},c});
\ No newline at end of file
define(["./global"],function(a){function b(){return this._instanceID=d(),this}var c=0,d=function(){return++c};return b.getInstanceCount=function(){return c},b.prototype.getInstanceID=function(){return this._instanceID},b.id=-1,b.axis=-1,b.typetool=-1,b.type=null,b.colors="",b.cartridge="",b.cartridgeColor="",b.texts="",b.label="",b.reply=!0,b.enabled=!0,b.orderTool=1e3,b.prototype.init=function(a){this.id=parseInt(a.id,10)||0,this.axis=parseInt(a.axis,10)||0,this.type=a.type,this.colors=a.colors,this.cartridge=a.cartridge,this.cartridgeColor=a.cartridgeColor,this.texts=a.texts,this.label=a.label,this.reply=a.reply,this.enabled=a.enabled,this.orderTool=a.orderTool},b.prototype.initAdmin=function(a){this.id=parseInt(a.toolid,10)||0,this.axis=parseInt(a.axis,10)||0,this.typetool=a.typetool,this.label=a.button,this.enabled=a.enable,this.orderTool=a.orderTool},b.prototype.getToolTypeLabel=function(){return this.type.label},b.prototype.getToolTypeCartX=function(){return this.type.cartridgeX},b.prototype.getToolTypeCartY=function(){return this.type.cartridgeY},b.prototype.get_color=function(){var b=a.ANNOTATIONCOLOUR[this.colors];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.colors,b&&""!==b?b:this.type.get_color()},b.prototype.get_color_cartridge=function(){var b=a.ANNOTATIONCOLOUR[this.cartridgeColor];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.cartridgeColor,b&&""!==b?b:this.type.get_color_cartridge()},b.prototype.getButton=function(a){var b="btn-default",c="";1!==this.enabled&&(b="",c="background-image:none;background-color:#CCCCCC;"),this.id===a&&(b="btn-primary"),4!==this.typetool&&1!==this.typetool||(c+="text-decoration: underline;");var d=this.label;4!==this.typetool&&5!==this.typetool||(d="| "+d,4===this.typetool&&(d+=" |"));var e="<button class='btn "+b+" editpdlplus_tool' id='editpdlplus_tool_"+this.id+"' style='"+c+"' value='"+this.id+"' data-enable='"+this.enabled+"'>"+d+"</button>";return e},b.prototype.getButtonSortable=function(a){return"<li style='float: left;display: block;'>"+this.getButton(a)+"</li>"},b});
\ No newline at end of file
define(["./global"],function(a){function b(){return this._instanceID=d(),this}var c=0,d=function(){return++c};return b.getInstanceCount=function(){return c},b.prototype.getInstanceID=function(){return this._instanceID},b.id=-1,b.axis=-1,b.typetool=-1,b.type=null,b.colors="",b.cartridge="",b.cartridgeColor="",b.texts="",b.label="",b.reply=!0,b.enabled=!0,b.orderTool=1e3,b.prototype.init=function(a){this.id=parseInt(a.id,10)||0,this.axis=parseInt(a.axis,10)||0,this.type=a.type,this.colors=a.colors,this.cartridge=a.cartridge,this.cartridgeColor=a.cartridgeColor,this.texts=a.texts,this.label=a.label,this.reply=a.reply,this.enabled=a.enabled,this.orderTool=a.orderTool},b.prototype.initAdmin=function(a){this.id=parseInt(a.toolid,10)||0,this.axis=parseInt(a.axis,10)||0,this.typetool=a.typetool,this.label=a.button,this.enabled=a.enable,this.orderTool=a.orderTool},b.prototype.getToolTypeLabel=function(){return this.type.label},b.prototype.getToolTypeCartX=function(){return this.type.cartridgeX},b.prototype.getToolTypeCartY=function(){return this.type.cartridgeY},b.prototype.get_color=function(){var b=a.ANNOTATIONCOLOUR[this.colors];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.colors,b&&""!==b?b:this.type.get_color()},b.prototype.get_color_cartridge=function(){var b=a.ANNOTATIONCOLOUR[this.cartridgeColor];return b?(b=b.replace("rgb","rgba"),b=b.replace(")",",0.5)")):b=this.cartridgeColor,b&&""!==b?b:this.type.get_color_cartridge()},b.prototype.getButton=function(a){var b=" btn-sm",c="";1!==this.enabled&&(c="background-image:none;background-color:#CCCCCC;"),this.id===a&&(b="btn-primary"),4!==this.typetool&&1!==this.typetool||(c+="text-decoration: underline;");var d=this.label;4!==this.typetool&&5!==this.typetool||(d="| "+d,4===this.typetool&&(d+=" |"));var e="<button class='btn "+b+" editpdlplus_tool' id='editpdlplus_tool_"+this.id+"' style='"+c+"' value='"+this.id+"' data-enable='"+this.enabled+"'>"+d+"</button>";return e},b.prototype.getButtonSortable=function(a){return"<li style='float: left;display: block;'>"+this.getButton(a)+"</li>"