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/ /.old/
\ No newline at end of file /.scannerwork/
\ No newline at end of file
...@@ -33,6 +33,10 @@ require_once($CFG->dirroot . '/mod/assign/locallib.php'); ...@@ -33,6 +33,10 @@ require_once($CFG->dirroot . '/mod/assign/locallib.php');
require_sesskey(); 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); $action = optional_param('action', '', PARAM_ALPHANUM);
$assignmentid = required_param('assignmentid', PARAM_INT); $assignmentid = required_param('assignmentid', PARAM_INT);
$userid = required_param('userid', PARAM_INT); $userid = required_param('userid', PARAM_INT);
...@@ -52,11 +56,11 @@ if (!$assignment->can_view_submission($userid)) { ...@@ -52,11 +56,11 @@ if (!$assignment->can_view_submission($userid)) {
if ($action === 'pollconversions') { if ($action === 'pollconversions') {
$draft = true; $draft = true;
if (!has_capability('mod/assign:grade', $context)) { if (!has_capability(PERMISSION_ASSIGN_GRADE, $context)) {
// A student always sees the readonly version. // A student always sees the readonly version.
$readonly = true; $readonly = true;
$draft = false; $draft = false;
require_capability('mod/assign:submit', $context); require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
} }
if ($readonly) { if ($readonly) {
...@@ -96,7 +100,7 @@ if ($action === 'pollconversions') { ...@@ -96,7 +100,7 @@ if ($action === 'pollconversions') {
$index = count($response->pages); $index = count($response->pages);
$page = new stdClass(); $page = new stdClass();
//$comments = page_editor::get_comments($grade->id, $index, $draft); //$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; //$page->comments = $comments;
if ($imageinfo = $pagefile->get_imageinfo()) { if ($imageinfo = $pagefile->get_imageinfo()) {
$page->width = $imageinfo['width']; $page->width = $imageinfo['width'];
...@@ -109,7 +113,7 @@ if ($action === 'pollconversions') { ...@@ -109,7 +113,7 @@ if ($action === 'pollconversions') {
$page->annotations = $annotations; $page->annotations = $annotations;
$response->pages[] = $page; $response->pages[] = $page;
$component = 'assignfeedback_editpdfplus'; $component = PLUGIN_NAME;
$filearea = document_services::PAGE_IMAGE_FILEAREA; $filearea = document_services::PAGE_IMAGE_FILEAREA;
$filepath = '/'; $filepath = '/';
$fs = get_file_storage(); $fs = get_file_storage();
...@@ -128,7 +132,7 @@ if ($action === 'pollconversions') { ...@@ -128,7 +132,7 @@ if ($action === 'pollconversions') {
echo json_encode($response); echo json_encode($response);
die(); die();
} else if ($action == 'savepage') { } else if ($action == 'savepage') {
require_capability('mod/assign:grade', $context); require_capability(PERMISSION_ASSIGN_GRADE, $context);
$response = new stdClass(); $response = new stdClass();
$response->errors = array(); $response->errors = array();
...@@ -141,19 +145,18 @@ if ($action === 'pollconversions') { ...@@ -141,19 +145,18 @@ if ($action === 'pollconversions') {
$added = page_editor::set_annotations($grade->id, $index, $page->annotations); $added = page_editor::set_annotations($grade->id, $index, $page->annotations);
if ($added != count($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); echo json_encode($response);
die(); die();
} else if ($action == 'generatepdf') { } else if ($action == 'generatepdf') {
$refresh = optional_param('refresh', false, PARAM_BOOL); $refresh = optional_param('refresh', false, PARAM_BOOL);
if (!$refresh) { if (!$refresh) {
require_capability('mod/assign:grade', $context); require_capability(PERMISSION_ASSIGN_GRADE, $context);
} else { } else {
require_capability('mod/assign:submit', $context); require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
} }
$response = new stdClass(); $response = new stdClass();
$grade = $assignment->get_user_grade($userid, true, $attemptnumber); $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
...@@ -161,7 +164,7 @@ if ($action === 'pollconversions') { ...@@ -161,7 +164,7 @@ if ($action === 'pollconversions') {
$response->url = ''; $response->url = '';
if ($file) { 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->url = $url->out(true);
$response->filename = $file->get_filename(); $response->filename = $file->get_filename();
} }
...@@ -174,31 +177,30 @@ if ($action === 'pollconversions') { ...@@ -174,31 +177,30 @@ if ($action === 'pollconversions') {
$modulename = get_string('modulename', 'assign'); $modulename = get_string('modulename', 'assign');
$assignmentname = $assignment->get_instance()->name; $assignmentname = $assignment->get_instance()->name;
$formatparams = array('context' => $contextb->get_course_context()); $formatparams = array('context' => $contextb->get_course_context());
$flecheHtml = ' → ';
$retourChariot = "\n";
$body = format_string($course->shortname, true, $formatparams) $body = format_string($course->shortname, true, $formatparams)
. ' -> ' . $flecheHtml
. $modulename . $modulename
. ' -> ' . $flecheHtml
. format_string($assignmentname, true, $formatparams) . "\n" . format_string($assignmentname, true, $formatparams) . $retourChariot
. "\n---------------------------------------------------------------------\n" . $retourChariot . "---------------------------------------------------------------------" . $retourChariot
. "La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce lien : " . "La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce lien : "
. $response->url . $response->url
. "\n\nCeci est un mail automatique."; . $retourChariot . $retourChariot . "Ceci est un mail automatique.";
$bodyhtml = '<p><font face="sans-serif">' $bodyhtml = '<p><font face="sans-serif">'
. '<a href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . getHtmlLink($CFG->wwwroot . '/course/view.php?id=' . $course->id, format_string($course->shortname, true, $formatparams))
. format_string($course->shortname, true, $formatparams) . $flecheHtml
. '</a> ->' . getHtmlLink($CFG->wwwroot . '/mod/assign/index.php?id=' . $course->id, $modulename)
. '<a href="' . $CFG->wwwroot . '/mod/assign/index.php?id=' . $course->id . '">' . $flecheHtml
. $modulename . getHtmlLink($CFG->wwwroot . '/mod/assign/view.php?id=' . $coursemodule->id, format_string($assignmentname, true, $formatparams))
. '</a> ->' . '</font></p>'
. '<a href="' . $CFG->wwwroot . '/mod/assign/view.php?id=' . $coursemodule->id . '">' . '<hr/><font face="sans-serif">'
. format_string($assignmentname, true, $formatparams)
. '</a></font></p>'
. '<hr /><font face="sans-serif">'
. "<b>Information Moodle</b><br/>" . "<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='" . "<p>La correction du devoir a été mise à jour. Vous pouvez accéder au document en suivant ce "
. $response->url . getHtmlLink($response->url, "lien")
. "'>lien</a></p>" . "</p>"
. "<i>Ceci est un mail automatique.</i>"; . "<i>Ceci est un mail automatique, merci de ne pas y répondre.</i>";
foreach ($teachers as $teacher) { foreach ($teachers as $teacher) {
$res = email_to_user($teacher, $USER, "[Moodle] Mise à jour devoir", $body, $bodyhtml); $res = email_to_user($teacher, $USER, "[Moodle] Mise à jour devoir", $body, $bodyhtml);
} }
...@@ -207,7 +209,7 @@ if ($action === 'pollconversions') { ...@@ -207,7 +209,7 @@ if ($action === 'pollconversions') {
echo json_encode($response); echo json_encode($response);
die(); die();
} else if ($action == 'revertchanges') { } else if ($action == 'revertchanges') {
require_capability('mod/assign:grade', $context); require_capability(PERMISSION_ASSIGN_GRADE, $context);
$grade = $assignment->get_user_grade($userid, true, $attemptnumber); $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
...@@ -216,7 +218,7 @@ if ($action === 'pollconversions') { ...@@ -216,7 +218,7 @@ if ($action === 'pollconversions') {
echo json_encode($result); echo json_encode($result);
die(); die();
} else if ($action == 'deletefeedbackdocument') { } else if ($action == 'deletefeedbackdocument') {
require_capability('mod/assign:grade', $context); require_capability(PERMISSION_ASSIGN_GRADE, $context);
$grade = $assignment->get_user_grade($userid, true, $attemptnumber); $grade = $assignment->get_user_grade($userid, true, $attemptnumber);
$result = document_services::delete_feedback_document($assignment, $userid, $attemptnumber); $result = document_services::delete_feedback_document($assignment, $userid, $attemptnumber);
...@@ -225,7 +227,7 @@ if ($action === 'pollconversions') { ...@@ -225,7 +227,7 @@ if ($action === 'pollconversions') {
echo json_encode($result); echo json_encode($result);
die(); die();
} else if ($action == 'updatestudentview') { } else if ($action == 'updatestudentview') {
require_capability('mod/assign:submit', $context); require_capability(PERMISSION_ASSIGN_SUBMIT, $context);
$response = new stdClass(); $response = new stdClass();
$response->errors = array(); $response->errors = array();
...@@ -238,9 +240,12 @@ if ($action === 'pollconversions') { ...@@ -238,9 +240,12 @@ if ($action === 'pollconversions') {
$added = page_editor::update_annotations_status($page->annotations); $added = page_editor::update_annotations_status($page->annotations);
if ($added != count($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); echo json_encode($response);
die(); die();
} }
function getHtmlLink($url, $text) {
return '<a href="' . $url . '">' . $text . '</a>';
}
This diff is collapsed.
This diff is collapsed.
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}); 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 \ 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}); 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 \ 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}); 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 \ 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}); 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 \ 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}); 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 \ 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}); 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>"},b});
\ No newline at end of file \ No newline at end of file
...@@ -183,13 +183,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -183,13 +183,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete'); var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete) { if (canBeDelete) {
if (parseInt(canBeDelete) > 0) { if (parseInt(canBeDelete) > 0) {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled"); //$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").addClass("disabled");
$('#assignfeedback_editpdfplus_widget_admin_button_delaxis').prop('disabled', true);
} else { } else {
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"); //$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled");
$('#assignfeedback_editpdfplus_widget_admin_button_delaxis').removeAttr('disabled');
} }
} else { } else {
$("#editpdlplus_axes option[value='" + selectAxis + "']").data('delete', 0); $("#editpdlplus_axes option[value='" + selectAxis + "']").data('delete', 0);
$("#assignfeedback_editpdfplus_widget_admin_button_delaxis").removeClass("disabled"); $('#assignfeedback_editpdfplus_widget_admin_button_delaxis').removeAttr('disabled');
} }
} else { } else {
$("#assignfeedback_editpdfplus_widget_admin_workspace").hide(); $("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
...@@ -218,7 +220,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -218,7 +220,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
* Init too UI for select element * Init too UI for select element
*/ */
AdminPanel.prototype.initToolUI = function () { AdminPanel.prototype.initToolUI = function () {
$(this.selectTool).removeClass("btn-default"); //$(this.selectTool).removeClass("btn-default");
$(this.selectTool).addClass("btn-primary"); $(this.selectTool).addClass("btn-primary");
initSortableToolBar(); initSortableToolBar();
...@@ -431,14 +433,14 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -431,14 +433,14 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#editpdlplus_axes_worspace").hide(); $("#editpdlplus_axes_worspace").hide();
} }
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis').show(); $('#assignfeedback_editpdfplus_widget_admin_div_addaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body').html(""); $('#assignfeedback_editpdfplus_widget_admin_div_addaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled'); $("#editpdlplus_axes").prop('disabled', true);
var params = {}; var params = {};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisadd', contextid, params) fragment.loadFragment('assignfeedback_editpdfplus', 'axisadd', contextid, params)
.done(function (html, js) { .done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body', templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_addaxis',
html, js); html, js);
}.bind(this)).fail(notification.exception); }.bind(this)).fail(notification.exception);
}; };
...@@ -450,15 +452,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -450,15 +452,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#message_edit_tool").hide(); $("#message_edit_tool").hide();
$("#axistool").hide(); $("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis').show(); $('#assignfeedback_editpdfplus_widget_admin_div_editaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body').html(""); $('#assignfeedback_editpdfplus_widget_admin_div_editaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled'); $("#editpdlplus_axes").prop('disabled', true);
var axeid = $("#editpdlplus_axes option:selected").val(); var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid}; var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisedit', contextid, params) fragment.loadFragment('assignfeedback_editpdfplus', 'axisedit', contextid, params)
.done(function (html, js) { .done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body', templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_editaxis',
html, js); html, js);
}.bind(this)).fail(notification.exception); }.bind(this)).fail(notification.exception);
}; };
...@@ -472,15 +474,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -472,15 +474,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#message_edit_tool").hide(); $("#message_edit_tool").hide();
$("#axistool").hide(); $("#axistool").hide();
$('#assignfeedback_editpdfplus_widget_admin_div_delaxis').show(); $('#assignfeedback_editpdfplus_widget_admin_div_delaxis').show();
$('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body').html(""); $('#assignfeedback_editpdfplus_widget_admin_div_delaxis').html("");
$('#assignfeedback_editpdfplus_widget_admin_toolheader').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolheader').hide();
$('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide(); $('#assignfeedback_editpdfplus_widget_admin_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled'); $("#editpdlplus_axes").prop('disabled', true);
var axeid = $("#editpdlplus_axes option:selected").val(); var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid}; var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisdel', contextid, params) fragment.loadFragment('assignfeedback_editpdfplus', 'axisdel', contextid, params)
.done(function (html, js) { .done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body', templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_delaxis',
html, js); html, js);
}.bind(this)).fail(notification.exception); }.bind(this)).fail(notification.exception);
} }
...@@ -543,7 +545,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -543,7 +545,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + toolbar[0].axeid + "']"); var axeOption = $("#editpdlplus_axes option[value='" + toolbar[0].axeid + "']");
axeOption.data('delete', 1); axeOption.data('delete', 1);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis"); var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.addClass("disabled"); btr.prop("disabled", true);
$('#editpdlplus_tool_item').html(""); $('#editpdlplus_tool_item').html("");
//maj toolbar //maj toolbar
if (toolbar[0].toolid && toolbar[0].toolid > 0) { if (toolbar[0].toolid && toolbar[0].toolid > 0) {
...@@ -558,7 +560,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -558,7 +560,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']"); var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']");
axeOption.data('delete', 0); axeOption.data('delete', 0);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis"); var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.removeClass("disabled"); btr.removeAttr("disabled");
} }
$(".editpdlplus_tool").on("click", refreshToolView); $(".editpdlplus_tool").on("click", refreshToolView);
//maj visu //maj visu
...@@ -586,13 +588,13 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -586,13 +588,13 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var selectid = $(this).val(); var selectid = $(this).val();
$(".editpdlplus_tool").each(function () { $(".editpdlplus_tool").each(function () {
$(this).removeClass("btn-primary"); $(this).removeClass("btn-primary");
$(this).removeClass("btn-default"); //$(this).removeClass("btn-default");
$(this).css("background-image", ""); $(this).css("background-image", "");
$(this).css("background-color", ""); $(this).css("background-color", "");
var enabled = $(this).data('enable'); var enabled = $(this).data('enable');
if (enabled === 1 && $(this).val() !== selectid) { /*if (enabled === 1 && $(this).val() !== selectid) {
$(this).addClass("btn-default"); $(this).addClass("btn-default");
} else if ($(this).val() !== selectid) { } else*/ if (enabled !== 1 && $(this).val() !== selectid) {
$(this).css("background-image", "none"); $(this).css("background-image", "none");
$(this).css("background-color", "#CCCCCC"); $(this).css("background-color", "#CCCCCC");
} }
...@@ -711,7 +713,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -711,7 +713,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#assignfeedback_editpdfplus_widget_admin_button_addtool").click(); $("#assignfeedback_editpdfplus_widget_admin_button_addtool").click();
}); });
$("#toolRemove").on("click", function () { $("#toolRemove").on("click", function () {
if (!$(this).hasClass("disabled")) { if (!$(this).prop("disabled")) {
var form = $('#assignfeedback_editpdfplus_edit_tool'); var form = $('#assignfeedback_editpdfplus_edit_tool');
var data = form.serialize(); var data = form.serialize();
ajax.call([ ajax.call([
...@@ -742,7 +744,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -742,7 +744,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']"); var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']");
axeOption.data('delete', 0); axeOption.data('delete', 0);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis"); var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.removeClass("disabled"); btr.removeAttr("disabled");
} }
$('#toolworkspace').html(""); $('#toolworkspace').html("");
} else { } else {
...@@ -771,7 +773,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm ...@@ -771,7 +773,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
AdminPanel.prototype.openDivAddTool = function () { AdminPanel.prototype.openDivAddTool = function () {
$("#message_edit_tool").hide(); $("#message_edit_tool").hide();
$('#editpdlplus_tool_item').html(""); $('#editpdlplus_tool_item').html("");
$('.btn-primary').addClass("btn-default"); //$('.btn-primary').addClass("btn-default");
$('.editpdlplus_tool').removeClass("btn-primary"); $('.editpdlplus_tool').removeClass("btn-primary");
var axeid = $