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>';
}
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});
\ 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>"},b});
\ No newline at end of file
......@@ -183,13 +183,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var canBeDelete = $("#editpdlplus_axes option:selected").data('delete');
if (canBeDelete) {
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 {
$("#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 {
$("#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 {
$("#assignfeedback_editpdfplus_widget_admin_workspace").hide();
......@@ -218,7 +220,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
* Init too UI for select element
*/
AdminPanel.prototype.initToolUI = function () {
$(this.selectTool).removeClass("btn-default");
//$(this.selectTool).removeClass("btn-default");
$(this.selectTool).addClass("btn-primary");
initSortableToolBar();
......@@ -431,14 +433,14 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#editpdlplus_axes_worspace").hide();
}
$('#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_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
$("#editpdlplus_axes").prop('disabled', true);
var params = {};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisadd', contextid, params)
.done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_addaxis > .panel-body',
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_addaxis',
html, js);
}.bind(this)).fail(notification.exception);
};
......@@ -450,15 +452,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#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_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
$("#editpdlplus_axes").prop('disabled', true);
var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisedit', contextid, params)
.done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_editaxis > .panel-body',
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_editaxis',
html, js);
}.bind(this)).fail(notification.exception);
};
......@@ -472,15 +474,15 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#message_edit_tool").hide();
$("#axistool").hide();
$('#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_toolworkspace').hide();
$("#editpdlplus_axes").prop('disabled', 'disabled');
$("#editpdlplus_axes").prop('disabled', true);
var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axeid: axeid};
fragment.loadFragment('assignfeedback_editpdfplus', 'axisdel', contextid, params)
.done(function (html, js) {
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_delaxis > .panel-body',
templates.appendNodeContents('#assignfeedback_editpdfplus_widget_admin_div_delaxis',
html, js);
}.bind(this)).fail(notification.exception);
}
......@@ -543,7 +545,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + toolbar[0].axeid + "']");
axeOption.data('delete', 1);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.addClass("disabled");
btr.prop("disabled", true);
$('#editpdlplus_tool_item').html("");
//maj toolbar
if (toolbar[0].toolid && toolbar[0].toolid > 0) {
......@@ -558,7 +560,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']");
axeOption.data('delete', 0);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.removeClass("disabled");
btr.removeAttr("disabled");
}
$(".editpdlplus_tool").on("click", refreshToolView);
//maj visu
......@@ -586,13 +588,13 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var selectid = $(this).val();
$(".editpdlplus_tool").each(function () {
$(this).removeClass("btn-primary");
$(this).removeClass("btn-default");
//$(this).removeClass("btn-default");
$(this).css("background-image", "");
$(this).css("background-color", "");
var enabled = $(this).data('enable');
if (enabled === 1 && $(this).val() !== selectid) {
/*if (enabled === 1 && $(this).val() !== selectid) {
$(this).addClass("btn-default");
} else if ($(this).val() !== selectid) {
} else*/ if (enabled !== 1 && $(this).val() !== selectid) {
$(this).css("background-image", "none");
$(this).css("background-color", "#CCCCCC");
}
......@@ -711,7 +713,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
$("#assignfeedback_editpdfplus_widget_admin_button_addtool").click();
});
$("#toolRemove").on("click", function () {
if (!$(this).hasClass("disabled")) {
if (!$(this).prop("disabled")) {
var form = $('#assignfeedback_editpdfplus_edit_tool');
var data = form.serialize();
ajax.call([
......@@ -742,7 +744,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']");
axeOption.data('delete', 0);
var btr = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
btr.removeClass("disabled");
btr.removeAttr("disabled");
}
$('#toolworkspace').html("");
} else {
......@@ -771,7 +773,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
AdminPanel.prototype.openDivAddTool = function () {
$("#message_edit_tool").hide();
$('#editpdlplus_tool_item').html("");
$('.btn-primary').addClass("btn-default");
//$('.btn-primary').addClass("btn-default");
$('.editpdlplus_tool').removeClass("btn-primary");
var axeid = $("#editpdlplus_axes option:selected").val();
var params = {axisid: axeid};
......@@ -857,7 +859,7 @@ define(['jquery', 'jqueryui', 'core/notification', 'core/templates', 'core/fragm
var axeOption = $("#editpdlplus_axes option[value='" + axeid + "']");
axeOption.data('delete', 1);
var delAxBt = $("#assignfeedback_editpdfplus_widget_admin_button_delaxis");
delAxBt.addClass("disabled");
delAxBt.prop("disabled", true);
} else {
$("#message_edit_tool").show();
$("#message_edit_tool").html(toolbar[0].message);
......
......@@ -341,16 +341,15 @@ define(['jquery', './global'],
var diveditiondisplay = $("#" + this.divcartridge + "_edit");
var propositions = this.tooltype.texts;
if (propositions && propositions.length > 0) {
var divproposition = "<div id='" + this.divcartridge + "_edit_propositions'></div>";
diveditiondisplay.append(divproposition);
var divpropositiondisplay = $("#" + this.divcartridge + "_edit_propositions");
var divproposition = "<div class='btn-group-vertical aepp-toolbar-vertical'></div>";
var divpropositiondisplay = $(divproposition);
var propositionarray = propositions.split('","');
for (var i = 0; i < propositionarray.length; i++) {
var buttontmp = "<button class='btn btn-default";
var buttontmp = "<button class='btn btn-outline-dark'";
if (this.adminDemo === 1) {
buttontmp += ' disabled';
}
buttontmp += "' type='button' style='width:100%;font-size: x-small;'>"
buttontmp += " type='button'>"
+ propositionarray[i].replace(/"/g, "")
+ "</button>";
divpropositiondisplay.append(buttontmp);
......@@ -359,6 +358,7 @@ define(['jquery', './global'],
}
divpropositiondisplay.append("<br/>");
}
diveditiondisplay.append(divpropositiondisplay);
}
return diveditiondisplay;
};
......@@ -387,24 +387,35 @@ define(['jquery', './global'],
if (canevas) {
divconteneurdisplay.append(inputonof);
}
//var readonly = this.editor.get('readonly');
divconteneurdisplay.append(this.get_input_question());
//readonly = this.editor.get('readonly');
return divconteneurdisplay;
};
/**
* get the html node for toolbar on annotation
* @return node
*/
Annotation.prototype.get_toolbar = function () {
var divtoolbar = $("<div id='"
+ this.divcartridge
+ "_toolbar' class='btn-group btn-group-sm aepp-toolbar'></div>");
//var readonly = this.editor.get('readonly');
//if (!readonly) {
this.get_button_visibility_left(divconteneurdisplay);
this.get_button_visibility_right(divconteneurdisplay);
this.get_button_save(divconteneurdisplay);
this.get_button_cancel(divconteneurdisplay);
divtoolbar.append(this.get_button_visibility_left());
divtoolbar.append(this.get_button_visibility_right());
divtoolbar.append(this.get_button_save());
divtoolbar.append(this.get_button_cancel());
if (this.tooltype.reply === 1) {
this.get_button_question(divconteneurdisplay);
divtoolbar.append(this.get_button_question());
}
this.get_button_remove(divconteneurdisplay);
divtoolbar.append(this.get_button_remove());
//} else {
// divconteneurdisplay.append(this.get_button_student_status());
// divtoolbar.append(this.get_button_student_status());
//}
return divconteneurdisplay;
};
return divtoolbar;
}
;
/**
* get the html node for the hidden input to keep information about question state
......@@ -423,20 +434,17 @@ define(['jquery', './global'],
* @param {JQuery Entity} canevas
* @return {JQuery Entity} node
*/
Annotation.prototype.get_button_visibility_right = function (canevas) {
Annotation.prototype.get_button_visibility_right = function () {
var buttonvisibility = "<button id='"
+ this.divcartridge
+ "_buttonedit_right' class='btn btn-default";
+ "_buttonedit_right' class='btn btn-sm btn-outline-dark'";
if (this.adminDemo === 1) {
buttonvisibility += ' disabled';
}
buttonvisibility += "' type='button'>";
buttonvisibility += " type='button'>";
buttonvisibility += "<i class='fa fa-arrow-right' aria-hidden='true'></i>";
buttonvisibility += "</button>";
if (canevas) {
canevas.append(buttonvisibility);
}
var buttonvisibilitydisplay = $('#' + this.divcartridge + "_buttonedit_right");
var buttonvisibilitydisplay = $(buttonvisibility);
if (this.adminDemo < 1) {
//buttonvisibilitydisplay.on('click', this.change_visibility_annot('r'));
}
......@@ -448,20 +456,17 @@ define(['jquery', './global'],
* @param {JQuery Entity} canevas
* @return {JQuery Entity} node
*/
Annotation.prototype.get_button_visibility_left = function (canevas) {
Annotation.prototype.get_button_visibility_left = function () {
var buttonvisibility = "<button id='"
+ this.divcartridge
+ "_buttonedit_left' class='btn btn-default";
+ "_buttonedit_left' class='btn btn-sm btn-outline-dark'";
if (this.adminDemo === 1) {
buttonvisibility += ' disabled';
}
buttonvisibility += "' type='button'>";
buttonvisibility += " type='button'>";
buttonvisibility += "<i class='fa fa-arrow-left' aria-hidden='true'></i>";
buttonvisibility += "</button>";
if (canevas) {
canevas.append(buttonvisibility);
}
var buttonvisibilitydisplay = $('#' + this.divcartridge + "_buttonedit_left");
var buttonvisibilitydisplay = $(buttonvisibility);
if (this.adminDemo < 1) {
//buttonvisibilitydisplay.on('click', this.change_visibility_annot('l'));
}
......@@ -473,20 +478,17 @@ define(['jquery', './global'],
* @param {JQuery Entity} canevas
* @return {JQuery Entity} node
*/
Annotation.prototype.get_button_save = function (canevas) {
Annotation.prototype.get_button_save = function () {
var buttonsave = "<button id='"
+ this.divcartridge
+ "_buttonsave' style='display:none;margin-left:110px;' class='btn btn-default";