From c0915a0a33ee777e8fffa7dc9ac11f542c6e6d39 Mon Sep 17 00:00:00 2001 From: Jakob Andersson Date: Thu, 14 Sep 2023 11:53:24 +0200 Subject: [PATCH 1/8] INT-18508 Supress warning with attribute flag `ReturnTypeWillChange` hides warning in PHP 8.1 and is ignored as a comment in earlier versions.` --- sdk/soap.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/soap.class.php b/sdk/soap.class.php index f4e781df..b64b4929 100644 --- a/sdk/soap.class.php +++ b/sdk/soap.class.php @@ -282,7 +282,8 @@ public function __construct( $wsdl, $options, $logpath = null ) { parent::__construct( $wsdl, $options ); } - + + #[\ReturnTypeWillChange] public function __doRequest($request, $location, $action, $version, $one_way = null) { $http_headers = array( From 7c52dbbf70f811b163eb6efb27c7be1cf171c085 Mon Sep 17 00:00:00 2001 From: Jakob Andersson Date: Thu, 14 Sep 2023 13:35:13 +0200 Subject: [PATCH 2/8] INT-18633 supress warning with attribute flag `ReturnTypeWillChange` hides warning in PHP 8.1 and is ignored as a comment in earlier versions. --- sdk/soap.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sdk/soap.class.php b/sdk/soap.class.php index f4e781df..b64b4929 100644 --- a/sdk/soap.class.php +++ b/sdk/soap.class.php @@ -282,7 +282,8 @@ public function __construct( $wsdl, $options, $logpath = null ) { parent::__construct( $wsdl, $options ); } - + + #[\ReturnTypeWillChange] public function __doRequest($request, $location, $action, $version, $one_way = null) { $http_headers = array( From 5f20c331bf6e489379f687aab2298fb1e758d9b7 Mon Sep 17 00:00:00 2001 From: Isaac Xiong Date: Thu, 11 Jan 2024 13:05:52 -0600 Subject: [PATCH 3/8] remove summary from plugin inbox --- turnitintooltwo_view.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/turnitintooltwo_view.class.php b/turnitintooltwo_view.class.php index 4f4f8dd3..9829332c 100755 --- a/turnitintooltwo_view.class.php +++ b/turnitintooltwo_view.class.php @@ -715,7 +715,6 @@ private function get_submission_inbox_part_details($cm, $turnitintooltwoassignme $hidetext = html_writer::tag('i', '', array('class' => 'fa fa-minus-circle red fa-lg '.$hideclass)); $showclass = 'show_summary_'.$turnitintooltwoassignment->turnitintooltwo->id; $showtext = html_writer::tag('i', '', array('class' => 'fa fa-plus-circle green fa-lg '.$showclass)); - $links = html_writer::link('javascript:void(0)', $showtext.$hidetext , array('class' => 'toggle_summary')); } // Allow part name to be editable if a tutor is logged in. From df19aa8e4292aca9daf7be215454800e7e5b3505 Mon Sep 17 00:00:00 2001 From: Isaac Xiong Date: Fri, 12 Jan 2024 11:23:23 -0600 Subject: [PATCH 4/8] remove summary block --- turnitintooltwo_view.class.php | 8 -------- 1 file changed, 8 deletions(-) diff --git a/turnitintooltwo_view.class.php b/turnitintooltwo_view.class.php index 9829332c..decd76b9 100755 --- a/turnitintooltwo_view.class.php +++ b/turnitintooltwo_view.class.php @@ -708,14 +708,6 @@ private function get_submission_inbox_part_details($cm, $turnitintooltwoassignme $partsheaders = $cells; $cells = array(); - // Link to show intro/summary. - $links = ""; - if (!empty($turnitintooltwoassignment->turnitintooltwo->intro)) { - $hideclass = 'hide_summary_'.$turnitintooltwoassignment->turnitintooltwo->id; - $hidetext = html_writer::tag('i', '', array('class' => 'fa fa-minus-circle red fa-lg '.$hideclass)); - $showclass = 'show_summary_'.$turnitintooltwoassignment->turnitintooltwo->id; - $showtext = html_writer::tag('i', '', array('class' => 'fa fa-plus-circle green fa-lg '.$showclass)); - } // Allow part name to be editable if a tutor is logged in. $textfield = $partdetails[$partid]->partname; From a3272a40db0d88367dd8476e91c3a6c29f694132 Mon Sep 17 00:00:00 2001 From: Isaac Xiong Date: Wed, 17 Jan 2024 10:00:56 -0600 Subject: [PATCH 5/8] remove undefined instances of --- turnitintooltwo_view.class.php | 1 - 1 file changed, 1 deletion(-) diff --git a/turnitintooltwo_view.class.php b/turnitintooltwo_view.class.php index decd76b9..a3ad9cb8 100755 --- a/turnitintooltwo_view.class.php +++ b/turnitintooltwo_view.class.php @@ -721,7 +721,6 @@ private function get_submission_inbox_part_details($cm, $turnitintooltwoassignme $turnitintooltwoassignment->turnitintooltwo->id.", ". "'action': 'edit_field', 'sesskey': '".sesskey()."' }")); } - $cells[0] = new html_table_cell($links.$turnitintooltwoassignment->turnitintooltwo->name." - ".$textfield." "); // Allow start date field to be editable if a tutor is logged in. $dateformat = ($CFG->ostype == 'WINDOWS') ? '%d %b %Y - %H:%M' : '%d %h %Y - %H:%M'; From 31c4777153192649647889f9290b5c5a445ac02b Mon Sep 17 00:00:00 2001 From: Isaac Xiong Date: Wed, 17 Jan 2024 10:31:41 -0600 Subject: [PATCH 6/8] refactor --- turnitintooltwo_view.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/turnitintooltwo_view.class.php b/turnitintooltwo_view.class.php index a3ad9cb8..00eaaf8b 100755 --- a/turnitintooltwo_view.class.php +++ b/turnitintooltwo_view.class.php @@ -721,6 +721,7 @@ private function get_submission_inbox_part_details($cm, $turnitintooltwoassignme $turnitintooltwoassignment->turnitintooltwo->id.", ". "'action': 'edit_field', 'sesskey': '".sesskey()."' }")); } + $cells[0] = new html_table_cell($turnitintooltwoassignment->turnitintooltwo->name." - ".$textfield." "); // Allow start date field to be editable if a tutor is logged in. $dateformat = ($CFG->ostype == 'WINDOWS') ? '%d %b %Y - %H:%M' : '%d %h %Y - %H:%M'; From c9af0ce9d37d555546f92cad4373fd19d83f99d4 Mon Sep 17 00:00:00 2001 From: Isaac Xiong Date: Thu, 18 Jan 2024 15:27:37 -0600 Subject: [PATCH 7/8] fix reveal anonymous buton --- ajax.php | 9 +++---- jquery/turnitintooltwo-2023032701.js | 28 ++++++++++++-------- jquery/turnitintooltwo-2023032701.min.js | 2 +- jquery/turnitintooltwo-2023032701.min.js.map | 1 + 4 files changed, 22 insertions(+), 18 deletions(-) create mode 100644 jquery/turnitintooltwo-2023032701.min.js.map diff --git a/ajax.php b/ajax.php index c352f61c..486fbb65 100644 --- a/ajax.php +++ b/ajax.php @@ -569,15 +569,12 @@ $turnitintooltwosubmission = new turnitintooltwo_submission($submissionid, "turnitin"); if ($turnitintooltwosubmission->unanonymise_submission($reason)) { if ($turnitintooltwosubmission->userid == 0) { - $tmpuser = new stdClass(); - $tmpuser->firstname = $turnitintooltwosubmission->nmfirstname; - $tmpuser->lastname = $turnitintooltwosubmission->nmlastname; - + $tmpuser->firstname = $turnitintooltwosubmission->firstname; + $tmpuser->lastname = $turnitintooltwosubmission->lastname; $return["name"] = fullname($tmpuser); } else { - $user = new turnitintooltwo_user($turnitintooltwosubmission->userid); - $return["name"] = fullname($user); + $return["name"] = $turnitintooltwosubmission->fullname; } $return["status"] = "success"; $return["userid"] = $turnitintooltwosubmission->userid; diff --git a/jquery/turnitintooltwo-2023032701.js b/jquery/turnitintooltwo-2023032701.js index d855fa35..9588ba39 100755 --- a/jquery/turnitintooltwo-2023032701.js +++ b/jquery/turnitintooltwo-2023032701.js @@ -1094,8 +1094,14 @@ } $("#submission_id").html(submission_id); $('#cboxLoadedContent .mod_turnitintooltwo_unanonymise_form').show(); - $('#id_reveal').unbind("click"); - $('#id_reveal').click(function () { + $('#id_reveal').prop('disabled', true); + + $('#id_anonymous_reveal_reason').on('input', function() { + var reason_text = $(this).val(); + $('#id_reveal').prop('disabled', reason_text === ''); // Enable/disable button based on textarea content + }); + + $('#id_reveal').on('click', function() { $.ajax({ "dataType": 'json', "type": "POST", @@ -1158,10 +1164,10 @@ // ZIP containing all files in original format. function initialiseZipDownloads(part_id) { // Unbind the event first to stop it being binded multiple times. - $('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').unbind("click"); + $('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').off("click"); // Open a spreadsheet or a zip file containing all the relevant data. - $('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').click(function () { + $('#tabs-' + part_id + ' .orig_zip_open, #tabs-' + part_id + ' .pdf_zip_open, #tabs-' + part_id + ' .xls_inbox_open').on(function () { var idStr = $(this).attr("id").split("_"); downloadZipFile(idStr[0] + "_" + idStr[1], idStr[2]); }); @@ -1233,9 +1239,9 @@ function initialiseHiddenZipDownloads(part_id) { // Unbind the event first to stop it being binded multiple times. - $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').unbind("click"); + $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').off("click"); // Seperate binder for hidden zip file link. - $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').click(function () { + $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').on(function () { var idStr = $(this).attr("id").split("_"); downloadZipFile(idStr[0] + "_" + idStr[1], part_id); return false; @@ -1249,9 +1255,9 @@ } // Unbind the event first to stop it being binded multiple times. - $(identifier).unbind("click"); + $(identifier).off("click"); - $(identifier).click(function () { + $(identifier).on(function () { $(this).hide(); $(this).siblings('.fa-spinner').css("display", "inline-block").addClass('fa-lg'); var idStr = $(this).parent().attr("id").split("_"); @@ -1267,9 +1273,9 @@ } // Unbind the event first to stop it being binded multiple times. - $(identifier).unbind("click"); + $(identifier).off("click"); - $(identifier).click(function () { + $(identifier).on(function () { var idStr = $(this).attr("id").split("_"); // Don't open OR DV if score is pending. if (!$(this).children('.score_colour').hasClass('score_colour_')) { @@ -1419,7 +1425,7 @@ $('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').removeAttr("title"); initialiseHiddenZipDownloads(part_id); } else { - $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').unbind('click'); + $('#tabs-' + part_id + ' .mod_turnitintooltwo_origchecked_zip_open').off('click'); $('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').prop("disabled", true); $('#tabs-' + part_id + ' .mod_turnitintooltwo_zip_downloads button').prop("title", M.str.turnitintooltwo.download_button_warning); } diff --git a/jquery/turnitintooltwo-2023032701.min.js b/jquery/turnitintooltwo-2023032701.min.js index 523f3ad6..41e16ba9 100644 --- a/jquery/turnitintooltwo-2023032701.min.js +++ b/jquery/turnitintooltwo-2023032701.min.js @@ -1 +1 @@ -(function($){$(window).on("load",(function(){if($(".js_required").show(),$(".js_hide").hide(),1==$("#id_submissiontype").val()&&$("#id_submissiontext").parent().parent().hide(),2==$("#id_submissiontype").val()&&$("#id_submissionfile").parent().parent().hide(),$("#id_submissionagreement").length&&$("#id_submitbutton").attr("disabled","disabled"),$("#id_submissionagreement").on("click",(function(){$(this).is(":checked")?$("#id_submissionagreement").each((function(){$("#id_submitbutton").removeAttr("disabled")})):$("#id_submissionagreement").each((function(){$("#id_submitbutton").attr("disabled","disabled")}))})),$("div.mod_turnitintooltwo").parent().css("width","100%"),$(document).on("click",".delete_paper",(function(){var i=$(this).data("confirm"),t=M.str.turnitintooltwo[i].replace(/\\n/g,"\n");confirm(t)&&$.ajax({type:"POST",url:"ajax.php",dataType:"html",data:{action:"deletesubmission",sesskey:M.cfg.sesskey,paper:$(this).data("paper"),part:$(this).data("part"),assignment:$(this).data("assignment")},success:function(){window.location.href=window.location.href}})})),$(document).on("click",".submit_nothing",(function(){if(!$(this).hasClass("disabled")){$(this).addClass("disabled");var i=$(this).prop("id").split("_")[2],t=$(this).prop("id").split("_")[3],e=M.str.turnitintooltwo.submitnothingwarning.replace(/
/g,"\n").replace(/'/g,"'");$.cookie("submitnothingaccept")||confirm(e)?submitNothing(t,i):$(this).removeClass("disabled")}})),$(document).on("change","#id_submissiontype",(function(){1==$("#id_submissiontype").val()&&($("#id_submissiontext").parent().parent().hide(),$("#id_submissionfile").parent().parent().show()),2==$("#id_submissiontype").val()&&($("#id_submissionfile").parent().parent().hide(),$("#id_submissiontext").parent().parent().show())})),$(document).on("submit",".submission_form_container form",(function(){return $("#id_submissiontitle").val().length>0&&($("#general").slideUp("slow"),$(".mod_turnitintooltwo .noticebox").slideUp("slow"),$(".submission_form_container form").slideUp("slow"),$("#submitting_loader").slideDown("slow"),!0)})),$(".toggle_summary").length>0&&($.cookie("show_summary_"+$("#assignment_id").html())||$.cookie("show_summary_"+$("#assignment_id").html(),!0,{expires:30}),"true"==$.cookie("show_summary_"+$("#assignment_id").html())?($(".hide_summary_"+$("#assignment_id").html()).show(),$(".show_summary_"+$("#assignment_id").html()).hide(),$(".introduction").slideDown()):($(".show_summary_"+$("#assignment_id").html()).show(),$(".hide_summary_"+$("#assignment_id").html()).hide(),$(".introduction").slideUp()),$(".toggle_summary i").click((function(){$(this).hasClass("show_summary_"+$("#assignment_id").html())?($.cookie("show_summary_"+$("#assignment_id").html(),!0,{expires:30}),$(".show_summary_"+$("#assignment_id").html()).hide(),$(".hide_summary_"+$("#assignment_id").html()).show(),$(".introduction").slideDown()):($.cookie("show_summary_"+$("#assignment_id").html(),!1,{expires:30}),$(".show_summary_"+$("#assignment_id").html()).show(),$(".hide_summary_"+$("#assignment_id").html()).hide(),$(".introduction").slideUp())}))),$(".toggle_peermarks").length>0&&($.cookie("show_peermarks_"+$("#assignment_id").html())||$.cookie("show_peermarks_"+$("#assignment_id").html(),!0,{expires:30}),"true"==$.cookie("show_peermarks_"+$("#assignment_id").html())?($(".hide_peermarks_"+$("#assignment_id").html()).show(),$(".show_peermarks_"+$("#assignment_id").html()).hide(),$(".peermark_assignments_container").slideDown()):($(".show_peermarks_"+$("#assignment_id").html()).show(),$(".hide_peermarks_"+$("#assignment_id").html()).hide(),$(".peermark_assignments_container").slideUp()),$(".toggle_peermarks i").click((function(){$(this).hasClass("show_peermarks_"+$("#assignment_id").html())?($.cookie("show_peermarks_"+$("#assignment_id").html(),!0,{expires:30}),$(".show_peermarks_"+$("#assignment_id").html()).hide(),$(".hide_peermarks_"+$("#assignment_id").html()).show(),$(".peermark_assignments_container").slideDown()):($.cookie("show_peermarks_"+$("#assignment_id").html(),!1,{expires:30}),$(".show_peermarks_"+$("#assignment_id").html()).show(),$(".hide_peermarks_"+$("#assignment_id").html()).hide(),$(".peermark_assignments_container").slideUp())}))),$(document).on("click",".show_peermark_instructions, .hide_peermark_instructions",(function(){var i=$(this).attr("id").split("_");"show"==i[0]?($("#show_peermark_instructions_"+i[3]).hide(),$("#hide_peermark_instructions_"+i[3]).show(),$("#peermark_instructions_"+i[3]).slideDown()):($("#show_peermark_instructions_"+i[3]).show(),$("#hide_peermark_instructions_"+i[3]).hide(),$("#peermark_instructions_"+i[3]).slideUp())})),showPartDatesBoxes(),$(document).on("change","#id_numparts",(function(){showPartDatesBoxes()})),$(document).on("click",".splitter-lastname, .splitter-firstname",(function(i){var t=$(i.target),e=t.hasClass("sorting_asc"),s="asc",n="desc",o=t.attr("data-col");e||(s="desc",n="asc"),t.closest(".mod_turnitintooltwo_submissions_data_table").DataTable().order([o,n]).draw(),t.addClass("sorting_"+n).removeClass("sorting sorting_"+s),t.parent().removeClass("sorting sorting_asc sorting_desc"),t.siblings().removeClass("sorting_asc sorting_desc").addClass("sorting")})),$("#dataTable").length>0&&$("#dataTable").dataTable(),void 0!==M.str.turnitintooltwo)var dataTablesLang={sProcessing:''+M.str.turnitintooltwo.sprocessing+"",sZeroRecords:M.str.turnitintooltwo.szerorecords,sInfo:M.str.turnitintooltwo.sinfo,sSearch:M.str.turnitintooltwo.ssearch,sLengthMenu:M.str.turnitintooltwo.slengthmenu,oPaginate:{sNext:M.str.turnitintooltwo.snext,sPrevious:M.str.turnitintooltwo.sprevious}};if($("#tabs").length>0){var activeTab=0;$("#tab_position").length>0&&(activeTab=$("#tab_position").text()),$("#tabs").tabs({active:activeTab,show:function(){var i=$.fn.dataTable.fnTables(!0);i.length>0&&$(i).dataTable().fnAdjustColumnSizing()}})}$(".enrolledMembers").length>0&&$(".enrolledMembers").dataTable({bProcessing:!0,sAjaxSource:"ajax.php",aoColumnDefs:[{bSortable:!1,sClass:"centered_cell",aTargets:[0]},{sClass:"left",aTargets:[1]}],oLanguage:dataTablesLang,fnServerData:function(i,t,e){$.ajax({dataType:"json",type:"POST",url:i,data:{action:"get_members",assignment:$("#assignment_id").html(),role:$("#user_role").html()},success:function(i){e(i)},error:function(i,t){$(".dataTables_processing").attr("style","visibility: hidden"),$(".dataTables_empty").html(M.str.turnitintooltwo.membercheckerror)}})}});var submissionsDataTableColumns=[],visibleCols=[],noOfColumns=$("table.mod_turnitintooltwo_submissions_data_table th").length/$("table.mod_turnitintooltwo_submissions_data_table").length,notStudentView=$("table.mod_turnitintooltwo_submissions_data_table th.sorting_name").length>0,showOrigReport=$("table.mod_turnitintooltwo_submissions_data_table th.creport").length>0,useGradeMark=$("table.mod_turnitintooltwo_submissions_data_table th.cgrade").length>0,multipleParts=$("table.mod_turnitintooltwo_submissions_data_table th.coverallgrade").length>0;if(notStudentView)for(var i=0;i=9&&!showOrigReport&&!useGradeMark||i>=11&&(!showOrigReport&&useGradeMark||showOrigReport&&!useGradeMark)||i>=13&&showOrigReport&&useGradeMark?(submissionsDataTableColumns.push({sClass:"center",bSortable:!1}),visibleCols.push(!0)):(0==i||4==i||7==i||9==i&&showOrigReport||9==i&&!showOrigReport||11==i&&useGradeMark)&&(submissionsDataTableColumns.push({bVisible:!1}),visibleCols.push(!1));else for(var i=0;i=8&&!showOrigReport&&!useGradeMark||i>=10&&(!showOrigReport&&useGradeMark||showOrigReport&&!useGradeMark)||i>=12&&showOrigReport&&useGradeMark?(submissionsDataTableColumns.push({sClass:"center",bSortable:!1}),visibleCols.push(!0)):(0==i||3==i||6==i||8==i&&showOrigReport||8==i&&!showOrigReport||10==i&&useGradeMark)&&(submissionsDataTableColumns.push({bVisible:!1}),visibleCols.push(!1));var partTables=[],refreshRequested=[];$("table.mod_turnitintooltwo_submissions_data_table").each((function(){var i=$(this).attr("id");refreshRequested[i]=0,partTables[i]=$("table#"+i).dataTable({bProcessing:!0,aoColumns:submissionsDataTableColumns,aLengthMenu:[[10,25,50,100,-1],[10,25,50,100,"All"]],aaSorting:[[2,"asc"],[4,"asc"]],sAjaxSource:"ajax.php",oLanguage:dataTablesLang,sDom:'r<"mod_turnitintooltwo_listbar-container"<"top mod_turnitintooltwo_listbar clearfix"lf>><"dt_pagination clearfix"pi>t<"bottom"><"dt_pagination clearfix"pi>',fnServerData:function(t,e,s){$.ajax({dataType:"json",type:"POST",url:t,data:{action:"initialise_redraw"},success:function(t){disableEditingText(i),s(t),$("#"+i+"_processing").attr("style","visibility: visible"),getSubmissions(partTables[i],$("#assignment_id").html(),i,0,refreshRequested,0)}})},bStateSave:!0,fnStateSave:function(t,e){try{localStorage.setItem(i+"DataTables",JSON.stringify(e))}catch(i){}},fnStateSaveParams:function(i,t){t.abVisCols=visibleCols},fnStateLoad:function(t){try{return JSON.parse(localStorage.getItem(i+"DataTables"))}catch(i){}},fnStateLoadParams:function(i,t){t.abVisCols=visibleCols},fnDrawCallback:function(t){initialiseDigitalReceipt(),initialiseDVLaunchers("all",0,i,0),initialiseRefreshRow("all",0,i,0),initialiseUploadBox("all",0,0,0),initialiseZipDownloads(i),initialiseCheckboxes(0,i),initialiseUnanoymiseForm("all",0,0)}})})),$("table.mod_turnitintooltwo_submissions_data_table").each((function(){refreshPeermarkAssignments($(this).attr("id"),0)})),$(".messages_amount").length>0&&refreshUserMessages(),$(".tii_table_functions").each((function(){var i=$(this).attr("id").split("tii_table_functions_")[1],t=$("#tii_table_functions_"+i).html();$("#tii_table_functions_"+i).remove(),$("#"+i+"_length").after(t),$(".mod_turnitintooltwo_messages_inbox").show(),$("#refresh_"+i).show(),$("#refreshing_"+i).hide()}));var zip_downloads=$(".mod_turnitintooltwo_zip_downloads");if($.each(zip_downloads,(function(){var i=$(this).attr("id").split("_")[1];$(this).remove(),$("#"+i+"_length").after($(this))})),"Learner"==$("#user_role").html()&&$(".dataTables_length, .dataTables_filter, .dt_pagination").hide(),$(".mod_turnitintooltwo_refresh_link").click((function(){return $(this).is(":visible")&&($(".mod_turnitintooltwo_refresh_link").hide(),$(".mod_turnitintooltwo_refreshing_link").show(),$("table.mod_turnitintooltwo_submissions_data_table").each((function(){refreshRequested[$(this).attr("id")]=1,partTables[$(this).attr("id")].fnReloadAjax(),partTables[$(this).attr("id")].fnStandingRedraw()}))),!1})),$("#turnitin_sync_all_grades").length>0&&$(".turnitin_sync_grades").click((function(){$(".turnitin_sync_grades").hide(),$(".turnitin_syncing_grades").show(),$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"sync_all_submissions",assignment:$("#turnitin_sync_all_grades").data("turnitintooltwoid"),sesskey:M.cfg.sesskey},success:function(i){$(".turnitin_sync_grades").show(),$(".turnitin_syncing_grades").hide()}})})),$(".submission_failure_msg").length>0&&window.parent.$(".upload_box").colorbox.resize({width:"800px",height:"240px"}),$(".enrol_link").click((function(){$("#enrolling_error").hide(),$(".enrol_link").hide(),$(".enrolling_container").show(),$.ajax({type:"POST",url:"ajax.php",dataType:"html",data:{action:"enrol_all_students",assignment:$("#assignment_id").html(),sesskey:M.cfg.sesskey},success:function(i){window.location.href=window.location.href},error:function(i,t){$(".enrol_link").show(),$(".enrolling_container").hide(),$("#enrolling_error").show()}})})),$(".mod_turnitintooltwo_rubric_manager_launch").length>0&&$(".mod_turnitintooltwo_rubric_manager_launch").colorbox({iframe:!0,width:"832px",height:"682px",opacity:"0.7",className:"rubric_manager",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){hideLoadingGif(),"rubric_manager_inbox_launch"!=$(this).attr("id")&&refreshRubricSelect(),$("#tii_close_bar").remove()}}),$(".mod_turnitintooltwo_rubric_view_launch").length>0&&$(".mod_turnitintooltwo_rubric_view_launch").colorbox({iframe:!0,width:"832px",height:"682px",opacity:"0.7",className:"rubric_view",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$("#id_rubric, #id_plagiarism_rubric").mousedown((function(){""!=$('input[name="instance"]').val()&&"Y"!=$('input[name="rubric_warning_seen"]').val()&&confirm(M.str.turnitintooltwo.changerubricwarning)&&$('input[name="rubric_warning_seen"]').val("Y")})),$(".mod_turnitintooltwo_quickmark_manager_launch").length>0&&$(".mod_turnitintooltwo_quickmark_manager_launch").colorbox({iframe:!0,width:"770px",height:"600px",opacity:"0.7",className:"quickmark_manager",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$(".tii_peermark_manager_launch").length>0&&$(".tii_peermark_manager_launch").colorbox({iframe:!0,width:"915px",height:"772px",opacity:"0.7",className:"peermark_manager",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()},onClosed:function(){refreshPeermarkAssignments($(this).attr("id").split("_")[2],1)}}),$(".tii_peermark_reviews_launch").length>0&&$(".tii_peermark_reviews_launch").colorbox({iframe:!0,width:"915px",height:"772px",opacity:"0.7",className:"peermark_reviews",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$(".mod_turnitintooltwo_messages_inbox").length>0&&$(".mod_turnitintooltwo_messages_inbox").colorbox({iframe:!0,width:"772px",height:"772px",opacity:"0.7",className:"messages",transition:"none",closeButton:!0,onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$(".mod_turnitintooltwo_nonsubmitters_link").length>0&&$(".mod_turnitintooltwo_nonsubmitters_link").colorbox({iframe:!0,width:"740px",height:"540px",opacity:"0.7",className:"nonsubmitters",transition:"none",closeButton:!0,onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$(".mod_turnitintooltwo_nonsubmittersformsuccessmsg").length>0&&(hideLoadingGif(),window.parent.$(".nonsubmitters").colorbox.resize({width:"740px",height:"120px"})),$(".mod_turnitintooltwo_rubric_view_launch").length>0&&$(".mod_turnitintooltwo_rubric_view_launch").colorbox({iframe:!0,width:"832px",height:"682px",opacity:"0.7",className:"rubric_view",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}}),$(document).on("click",".default_open, .origreport_open, .grademark_open",(function(){var i=!0,t=$(this).attr("id").split("_"),e=$("#date_due_"+t[2]).html(),s=moment(e).unix(),n=t[0],o=t[1],a=t[2];if(s>moment().unix()&&$(this).hasClass("graded_warning")&&(confirm(M.str.turnitintooltwo.resubmissiongradewarn)||(i=!1)),i){dvWindow=window.open("","_blank");var r='
';r+='',r+='

'+M.str.turnitintooltwo.loadingdv+"

",r+="
",$(dvWindow.document.body).html(r),$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:n,submission:o,assignment:$("#assignment_id").html()},success:function(i){$(dvWindow.document.body).html(r+i),dvWindow.document.forms[0].submit(),dvWindow.document.close(),checkDVClosed(a)}})}})),$("#id_rubric").length>0&&refreshRubricSelect(),self!=top&&"box"==$("#view_context").html()?$("html").css("background","none"):self!=top&&"box_solid"==$("#view_context").html()&&$("html").css("background","#FFF"),$(".editable_postdue").on("click",(function(){1==$(this).data("anon")&&alert(M.str.turnitintooltwo.postdate_warning)})),$(".max_marks_warning").on("click",(function(){alert(M.str.turnitintooltwo.max_marks_warning)})),$(".editable_text").length>0){$.fn.editable.defaults.mode="inline",$.fn.editable.defaults.url="ajax.php",$.fn.editable.defaults.onblur="submit",$.fn.editable.defaults.showbuttons=!1,$.fn.editable.defaults.ajaxOptions={dataType:"json"},$(".editable_text").editable({validate:function(i){if($(this).attr("id").indexOf("marks_")>=0&&(Math.floor(i)!=i||!$.isNumeric(i)||-1!=i.indexOf(".")))return M.str.turnitintooltwo.maxmarkserror},success:function(i,t){if(!i.success)return i.msg;if("maxmarks"==i.field)$("#refresh_"+i.partid).click(),$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"sync_all_submissions",assignment:$("#assignment_id").html(),sesskey:M.cfg.sesskey}});else if("partname"==i.field){var e=$(this).parentsUntil(".ui-tabs-panel").parent().attr("aria-labelledby");$("#"+e).text(t)}}}),$("#export_options").hasClass("tii_export_options_hide")&&($("#export_options").hide(),$(".export_data").html('--')),$(".editable_postdue").on("click",(function(){var i=$(this);$.ajax({type:"POST",url:"ajax.php",dataType:"json",data:{action:"check_anon",part:i.data("pk"),assignment:$("#assignment_id").html()},success:function(t){i.data("anon",t.anon),i.data("unanon",t.unanon),i.data("submitted",t.submitted)}})}));var theDate=new Date;$(".editable_date").editable({type:"combodate",format:"YYYY-MM-DD HH:mm",viewformat:"D MMM YYYY, HH:mm",template:"D MMM YYYY HH:mm",combodate:{minuteStep:1,minYear:2e3,maxYear:theDate.getFullYear()+2,smartDays:!0},validate:function(i){if(i.format("X")--')):($(".empty-dash").remove(),$("#export_options").show())}}),$(".editable_date").click((function(){if($(this).hasClass("editable-disabled"))return!1})),$(".editable_date, .editable_text").on("shown",(function(i,t){var e=$(this).prop("id");$(".editable_date, .editable_text").not("#"+e).editable("disable"),$(".submit_nothing").addClass("disabled")})),$(".editable_date, .editable_text").on("hidden",(function(){var i=$(this).prop("id");$(".editable_date, .editable_text").not("#"+i).editable("enable"),$(".submit_nothing").removeClass("disabled")}))}function enableEditingText(i){$("#tabs-"+i+" .editable_date, #tabs-"+i+" .editable_text").editable("enable")}function disableEditingText(i){$("#tabs-"+i+" .editable_date, #tabs-"+i+" .editable_text").editable("disable")}function getLoadingGif(){$("#cboxOverlay").after('
');var i=$(window).scrollTop()+$(window).height()/2;$(".loading_gif").css("top",i+"px")}function hideLoadingGif(){$(".loading_gif").remove()}function getSubmissions(table,assignment_id,part_id,start,refresh_requested,total){$.ajax({dataType:"json",type:"POST",url:"ajax.php",async:!0,data:{action:"get_submissions",assignment:assignment_id,part:part_id,start:start,refresh_requested:refresh_requested[part_id],sesskey:M.cfg.sesskey,total:total},success:function(result){if(eval(result),start=result.end,result.aaData.length>0&&table.fnAddData(result.aaData),result.end$(".mod_turnitintooltwo_submissions_data_table .refresh_row").length&&$(".mod_turnitintooltwo_nonsubmitters_link").attr("style","display: block")}},error:function(i,t){$("#"+part_id+"_processing").attr("style","visibility: hidden"),$(".dataTables_empty").html(M.str.turnitintooltwo.tiisubmissionsgeterror)}})}function submitVisibility(){1==$(".upload_box").data("user-type")||1==$(".upload_box").data("eula")?$(".upload_box").show():$(".upload_box").hide()}function refreshRubricSelect(){var i=$("#id_rubric").length?"#id_rubric":"#id_plagiarism_rubric",t=$(i).val();$.ajax({dataType:"json",type:"POST",url:"../mod/turnitintooltwo/ajax.php",data:{action:"refresh_rubric_select",assignment:$('input[name="instance"]').val(),modulename:$('input[name="modulename"]').val(),course:$('input[name="course"]').val()},success:function(e){$($(i)).empty();var s=e;$.each(s,(function(t,e){if($.isNumeric(t)||""===t)$($(i)).append($("");s.attr("label",t),$.each(e,(function(i,t){var e=$("");e.val(i),e.text(t),s.append(e)})),$(i).append(s)}})),$(i+' option[value="'+t+'"]').attr("selected","selected")}})}function refreshUserMessages(){$(".mod_turnitintooltwo_messages_loading").show(),$(".messages_amount").html(""),$.ajax({dataType:"html",type:"POST",url:"ajax.php",data:{action:"refresh_user_messages",assignment:$("#assignment_id").html()},success:function(i){$(".mod_turnitintooltwo_messages_loading").hide(),$(".messages_amount").html(i)}})}function resetPeermarkSection(i){$("#tabs-"+i+" .toggle_peermarks").hide(),$("#tabs-"+i+" .peermark_count").html(""),$("#tabs-"+i+" .peermark-loading").show(),$("#tabs-"+i+" .peermark_assignments_container").hide()}function refreshPeermarkAssignments(part_id,refresh_requested){var user_role=$(".tii_peermark_manager_launch").length>0?"Instructor":"Learner";$("#tabs-"+part_id+" .peermark_assignments_container").length>0&&(resetPeermarkSection(part_id),$.ajax({dataType:"json",type:"POST",url:"ajax.php",data:{action:"refresh_peermark_assignments",assignment:$("#assignment_id").html(),part:part_id,refresh_requested:refresh_requested,sesskey:M.cfg.sesskey},success:function(data){eval(data),$("#tabs-"+part_id+" .peermark_assignments_container").html(data.peermark_table),$("#tabs-"+part_id+" .peermark-loading").hide(),$("#tabs-"+part_id+" .peermark_count").html(data.no_of_peermarks),data.no_of_peermarks>0?$("#tabs-"+part_id+" .toggle_peermarks").show():$("#tabs-"+part_id+" .toggle_peermarks").hide(),(data.no_of_peermarks>0&&"Instructor"==user_role||data.peermarks_active&&"Learner"==user_role)&&$("#tabs-"+part_id+" .row_peermark_reviews").show(),"true"==$.cookie("show_peermarks_"+$("#assignment_id").html())&&data.no_of_peermarks>0?($(".show_peermarks_"+$("#assignment_id").html()).hide(),$(".hide_peermarks_"+$("#assignment_id").html()).show(),$(".peermark_assignments_container").slideDown()):($(".show_peermarks_"+$("#assignment_id").html()).show(),$(".hide_peermarks_"+$("#assignment_id").html()).hide(),$(".peermark_assignments_container").slideUp())}}))}function initialiseUnanoymiseForm(scope,assignment_id,submission_id){var identifier="a.unanonymise";"row"==scope&&(identifier="#submission_"+submission_id),$(identifier).colorbox({inline:!0,width:"50%",top:"100px",height:"260px",opacity:"0.7",className:"tii_unanonymise_reveal_form",onComplete:function(){var idStr=$(this).attr("id").split("_");if(0==submission_id||null==submission_id)var submission_id=idStr[1];0==assignment_id&&(assignment_id=$("#assignment_id").html()),$("#submission_id").html(submission_id),$("#cboxLoadedContent .mod_turnitintooltwo_unanonymise_form").show(),$("#id_reveal").unbind("click"),$("#id_reveal").click((function(){$.ajax({dataType:"json",type:"POST",url:"ajax.php",data:{action:"reveal_submission_name",assignment:assignment_id,submission_id:submission_id,reason:encodeURIComponent($("#id_anonymous_reveal_reason").val()),sesskey:M.cfg.sesskey},success:function(data){if(eval(data),"success"==data.status)$.colorbox.close(),$("#submission_"+submission_id).attr("href",M.cfg.wwwroot+"/user/view.php?id="+data.userid+"&course="+data.courseid),$("#submission_"+submission_id).html(data.name),$("#submission_"+submission_id).removeClass("unanonymise cboxElement");else{var current_msg=$("#mod_turnitintooltwo_unanonymise_desc").html;$("#mod_turnitintooltwo_unanonymise_desc").html(current_msg+" "+data.msg)}}})}))},onCleanup:function(){$(".mod_turnitintooltwo_unanonymise_form").hide()}})}function initialiseUploadBox(i,t,e,s){var n=".upload_box";"row"==i&&(n="#upload_"+t+"_"+e+"_"+s);$(n).colorbox({onLoad:function(){getLoadingGif(),lightBoxCloseButton(),$(this).hide()},onClosed:function(){hideLoadingGif()},onCleanup:function(){hideLoadingGif();var i=$(this).attr("id").split("_");refreshInboxRow("upload",i[1],i[2],i[3]),$("#tii_close_bar").remove()},iframe:!0,width:"80%",height:"80%",opacity:"0.7",className:"upload",transition:"none"})}function initialiseZipDownloads(i){$("#tabs-"+i+" .orig_zip_open, #tabs-"+i+" .pdf_zip_open, #tabs-"+i+" .xls_inbox_open").unbind("click"),$("#tabs-"+i+" .orig_zip_open, #tabs-"+i+" .pdf_zip_open, #tabs-"+i+" .xls_inbox_open").click((function(){var i=$(this).attr("id").split("_");downloadZipFile(i[0]+"_"+i[1],i[2])})),$("#tabs-"+i+" .downloadpdf_box").colorbox({iframe:!0,width:"40%",height:"60%",opacity:"0.7",className:"downloadpdf_window",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()},onClosed:function(){refreshUserMessages()}}),$(document).on("click","#tabs-"+i+" .mod_turnitintooltwo_gmpdfzip_box",(function(t){return $(this).colorbox({open:!0,iframe:!0,width:"786px",height:"300px",opacity:"0.7",className:"gmpdfzip_window",transition:"none",href:function(){var t="";return $("#tabs-"+i+" .inbox_checkbox:checked").each((function(i){t+="&submission_id"+i+"="+$(this).val(),i++})),$(this).attr("href")+t},onLoad:function(){getLoadingGif()},onCleanup:function(){hideLoadingGif()},onClosed:function(){refreshUserMessages()}}),!1}))}function lightBoxCloseButton(){$("body").append('")}function initialiseDigitalReceipt(){$(".mod_turnitintooltwo_digital_receipt").length>0&&$(".mod_turnitintooltwo_digital_receipt").colorbox({iframe:!0,width:"832px",height:"482px",opacity:"0.7",className:"rubric_view",transition:"none",onLoad:function(){lightBoxCloseButton(),getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove(),hideLoadingGif()}})}function initialiseHiddenZipDownloads(i){$("#tabs-"+i+" .mod_turnitintooltwo_origchecked_zip_open").unbind("click"),$("#tabs-"+i+" .mod_turnitintooltwo_origchecked_zip_open").click((function(){var t=$(this).attr("id").split("_");return downloadZipFile(t[0]+"_"+t[1],i),!1}))}function initialiseRefreshRow(i,t,e,s){var n=".refresh_row .fa-refresh";"row"==i&&(n="#refreshrow_"+t+"_"+e+"_"+s+" .fa-refresh"),$(n).unbind("click"),$(n).click((function(){$(this).hide(),$(this).siblings(".fa-spinner").css("display","inline-block").addClass("fa-lg");var i=$(this).parent().attr("id").split("_");refreshInboxRow(i[0],i[1],i[2],i[3])}))}function initialiseDVLaunchers(i,t,e,s){var n="#"+e+" .download_original_open";"row"==i&&(n="#downloadoriginal_"+t+"_"+e+"_"+s),$(n).unbind("click"),$(n).click((function(){var i=$(this).attr("id").split("_");$(this).children(".score_colour").hasClass("score_colour_")||downloadOriginalFile(i[0],i[1],i[2],i[3])}))}function downloadZipFile(i,t){var e=[];"origchecked_zip"!=i&&"gmpdf_zip"!=i||$("#tabs-"+t+" .inbox_checkbox:checked").each((function(i){e[i]=$(this).val()})),$.ajax({type:"POST",url:"ajax.php",dataType:"html",data:{action:i,assignment:$("#assignment_id").html(),part:t,submission_ids:e},success:function(e){$("#"+i+"_form_"+t).html(e),$("#"+i+"_form_"+t).children("form").submit(),$("#"+i+"_form_"+t).html("")}})}function downloadOriginalFile(i,t,e,s){$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"html",data:{action:i,submission:t,assignment:$("#assignment_id").html()},success:function(e){$("#"+i+"_form_"+t).html(e),$("#"+i+"_form_"+t).children("form").submit(),$("#"+i+"_form_"+t).html("")}})}function checkDVClosed(i){window.dvWindow.closed?$("#refresh_"+i).click():setTimeout((function(){checkDVClosed(i)}),500)}function submitNothing(user_id,part_id){$("#submitnothing_0_"+part_id+"_"+user_id+" i").attr("class","fa fa-spin fa-spinner fa-lg"),$.ajax({type:"POST",url:"ajax.php",dataType:"json",data:{action:"submit_nothing",assignment:$("#assignment_id").html(),part:part_id,user:user_id,sesskey:M.cfg.sesskey},success:function(data){eval(data),$.cookie("submitnothingaccept",!0,{expires:365}),$("table#"+part_id+" .select_all_checkbox").attr("checked",!1)},error:function(i){$("#submitnothing_0_"+part_id+"_"+user_id+" i").attr("class","fa fa-pencil fa-lg"),$("#submitnothing_0_"+part_id+"_"+user_id).removeClass("disabled"),alert(i.responseText)},complete:function(){refreshInboxRow("submitnothing",0,part_id,user_id)}})}function refreshInboxRow(link,submission_id,part_id,user_id){$.ajax({type:"POST",url:"ajax.php",dataType:"json",data:{action:"refresh_submission_row",assignment:$("#assignment_id").html(),part:part_id,user:user_id,sesskey:M.cfg.sesskey},success:function(data){$("table#"+part_id+" .select_all_checkbox").attr("checked",!1),eval(data);var i=0;0==submission_id?(link+="_0",submission_id=data.submission_id):link=null==data.submission_id&&0!=submission_id?link+"_"+submission_id:link+"_"+data.submission_id,0!=submission_id&&$("#export_links").removeClass("hidden_class"),oTable=$("table#"+part_id).dataTable();var tr=$("#"+link+"_"+part_id+"_"+user_id).parent().parent(),rowindex=tr.index();oTable.fnDeleteRow(tr),oTable.fnAddData(data.row),submitVisibility(),initialiseUploadBox("row",data.submission_id,part_id,user_id),initialiseDVLaunchers("row",data.submission_id,part_id,user_id),initialiseRefreshRow("row",data.submission_id,part_id,user_id),initialiseCheckboxes(data.submission_id,part_id),initialiseUnanoymiseForm("row",$("#assignment_id").html(),data.submission_id)}})}function initialiseCheckboxes(i,t){var e="#tabs-"+t+" .inbox_checkbox";0!=i&&(e="check_"+i),$("#tabs-"+t+" .inbox_checkbox").click((function(){$("table#"+t+" .select_all_checkbox").attr("checked",!1)})),$(document).on("click",e+", .select_all_checkbox",(function(){$("#tabs-"+t+" .inbox_checkbox:checked").length>0?($("#tabs-"+t+" .mod_turnitintooltwo_zip_downloads button").prop("disabled",!1),$("#tabs-"+t+" .mod_turnitintooltwo_zip_downloads button").removeAttr("title"),initialiseHiddenZipDownloads(t)):($("#tabs-"+t+" .mod_turnitintooltwo_origchecked_zip_open").unbind("click"),$("#tabs-"+t+" .mod_turnitintooltwo_zip_downloads button").prop("disabled",!0),$("#tabs-"+t+" .mod_turnitintooltwo_zip_downloads button").prop("title",M.str.turnitintooltwo.download_button_warning))}))}function showPartDatesBoxes(){for(var i=0;i<=5;i++)i<=$("#id_numparts").val()?$('fieldset[id$="partdates'+i+'"]').slideDown():$('fieldset[id$="partdates'+i+'"]').slideUp()}$("#inbox_form form, .launch_form form").submit(),$(".turnitin_eula_link").length>0&&$(".turnitin_eula_link").colorbox({iframe:!0,width:"766px",height:"596px",opacity:"0.7",className:"eula_view",scrolling:"false",onLoad:function(){getLoadingGif()},onComplete:function(){$(window).on("message",(function(i){var t=void 0===i.data?i.originalEvent.data:i.data;"turnitin_eula_declined"!=t&&"turnitin_eula_accepted"!=t||$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"acceptuseragreement",message:t,sesskey:M.cfg.sesskey},success:function(i){window.location.reload()},error:function(i){window.location.reload()}})}))},onCleanup:function(){hideLoadingGif()}}),$("#mod_turnitintooltwo_receipt_print").click((function(){window.print()})),$(".select_all_checkbox").on("click",(function(){var i=$(this).parent().parent().parent().parent().attr("id");$(this).is(":checked")?($("#"+i+" .inbox_checkbox").length&&($("#tabs-"+i+" .mod_turnitintooltwo_zip_downloads button").prop("disabled",!1),$("#tabs-"+i+" .mod_turnitintooltwo_zip_downloads button").removeAttr("title")),$("#"+i+" .inbox_checkbox").each((function(){$(this).prop("checked",!0)}))):($("#"+i+" .inbox_checkbox").each((function(){$(this).prop("checked",!1)})),$("#"+i+" .inbox_checkbox").length&&($("#tabs-"+i+" .mod_turnitintooltwo_zip_downloads button").prop("disabled",!0),$("#tabs-"+i+" .mod_turnitintooltwo_zip_downloads button").prop("title",M.str.turnitintooltwo.download_button_warning)))})),$("[id^=fitem_id_dtpost] select").change((function(){var i=$(this).parent().parent().parent();buildUnixDate("#fitem_id_dtpost",i.data("partId"))/g,"\n").replace(/'/g,"'");var cookieseen=$.cookie("submitnothingaccept");if(cookieseen||confirm(message)){submitNothing(student_id,part_id)}else{$(this).removeClass("disabled")}return});$(document).on("change","#id_submissiontype",function(){if($("#id_submissiontype").val()==1){$("#id_submissiontext").parent().parent().hide();$("#id_submissionfile").parent().parent().show()}if($("#id_submissiontype").val()==2){$("#id_submissionfile").parent().parent().hide();$("#id_submissiontext").parent().parent().show()}});$(document).on("submit",".submission_form_container form",function(){if($("#id_submissiontitle").val().length>0){$("#general").slideUp("slow");$(".mod_turnitintooltwo .noticebox").slideUp("slow");$(".submission_form_container form").slideUp("slow");$("#submitting_loader").slideDown("slow");return true}else{return false}});if($(".toggle_summary").length>0){if(!$.cookie("show_summary_"+$("#assignment_id").html())){$.cookie("show_summary_"+$("#assignment_id").html(),true,{expires:30})}if($.cookie("show_summary_"+$("#assignment_id").html())=="true"){$(".hide_summary_"+$("#assignment_id").html()).show();$(".show_summary_"+$("#assignment_id").html()).hide();$(".introduction").slideDown()}else{$(".show_summary_"+$("#assignment_id").html()).show();$(".hide_summary_"+$("#assignment_id").html()).hide();$(".introduction").slideUp()}$(".toggle_summary i").click(function(){if($(this).hasClass("show_summary_"+$("#assignment_id").html())){$.cookie("show_summary_"+$("#assignment_id").html(),true,{expires:30});$(".show_summary_"+$("#assignment_id").html()).hide();$(".hide_summary_"+$("#assignment_id").html()).show();$(".introduction").slideDown()}else{$.cookie("show_summary_"+$("#assignment_id").html(),false,{expires:30});$(".show_summary_"+$("#assignment_id").html()).show();$(".hide_summary_"+$("#assignment_id").html()).hide();$(".introduction").slideUp()}})}if($(".toggle_peermarks").length>0){if(!$.cookie("show_peermarks_"+$("#assignment_id").html())){$.cookie("show_peermarks_"+$("#assignment_id").html(),true,{expires:30})}if($.cookie("show_peermarks_"+$("#assignment_id").html())=="true"){$(".hide_peermarks_"+$("#assignment_id").html()).show();$(".show_peermarks_"+$("#assignment_id").html()).hide();$(".peermark_assignments_container").slideDown()}else{$(".show_peermarks_"+$("#assignment_id").html()).show();$(".hide_peermarks_"+$("#assignment_id").html()).hide();$(".peermark_assignments_container").slideUp()}$(".toggle_peermarks i").click(function(){if($(this).hasClass("show_peermarks_"+$("#assignment_id").html())){$.cookie("show_peermarks_"+$("#assignment_id").html(),true,{expires:30});$(".show_peermarks_"+$("#assignment_id").html()).hide();$(".hide_peermarks_"+$("#assignment_id").html()).show();$(".peermark_assignments_container").slideDown()}else{$.cookie("show_peermarks_"+$("#assignment_id").html(),false,{expires:30});$(".show_peermarks_"+$("#assignment_id").html()).show();$(".hide_peermarks_"+$("#assignment_id").html()).hide();$(".peermark_assignments_container").slideUp()}})}$(document).on("click",".show_peermark_instructions, .hide_peermark_instructions",function(){var idStr=$(this).attr("id").split("_");if(idStr[0]=="show"){$("#show_peermark_instructions_"+idStr[3]).hide();$("#hide_peermark_instructions_"+idStr[3]).show();$("#peermark_instructions_"+idStr[3]).slideDown()}else{$("#show_peermark_instructions_"+idStr[3]).show();$("#hide_peermark_instructions_"+idStr[3]).hide();$("#peermark_instructions_"+idStr[3]).slideUp()}});showPartDatesBoxes();$(document).on("change","#id_numparts",function(){showPartDatesBoxes()});$(document).on("click",".splitter-lastname, .splitter-firstname",function(event){var node=$(event.target),isAscending=node.hasClass("sorting_asc"),currentsort="asc",sortby="desc",sortColumn=node.attr("data-col");if(!isAscending){currentsort="desc";sortby="asc"}node.closest(".mod_turnitintooltwo_submissions_data_table").DataTable().order([sortColumn,sortby]).draw();node.addClass("sorting_"+sortby).removeClass("sorting sorting_"+currentsort);node.parent().removeClass("sorting sorting_asc sorting_desc");node.siblings().removeClass("sorting_asc sorting_desc").addClass("sorting")});if($("#dataTable").length>0){$("#dataTable").dataTable()}if(typeof M.str.turnitintooltwo!=="undefined"){var dataTablesLang={sProcessing:''+M.str.turnitintooltwo.sprocessing+"",sZeroRecords:M.str.turnitintooltwo.szerorecords,sInfo:M.str.turnitintooltwo.sinfo,sSearch:M.str.turnitintooltwo.ssearch,sLengthMenu:M.str.turnitintooltwo.slengthmenu,oPaginate:{sNext:M.str.turnitintooltwo.snext,sPrevious:M.str.turnitintooltwo.sprevious}}}if($("#tabs").length>0){var activeTab=0;if($("#tab_position").length>0){activeTab=$("#tab_position").text()}$("#tabs").tabs({active:activeTab,show:function(){var table=$.fn.dataTable.fnTables(true);if(table.length>0){$(table).dataTable().fnAdjustColumnSizing()}}})}if($(".enrolledMembers").length>0){$(".enrolledMembers").dataTable({bProcessing:true,sAjaxSource:"ajax.php",aoColumnDefs:[{bSortable:false,sClass:"centered_cell",aTargets:[0]},{sClass:"left",aTargets:[1]}],oLanguage:dataTablesLang,fnServerData:function(sSource,aoData,fnCallback){$.ajax({dataType:"json",type:"POST",url:sSource,data:{action:"get_members",assignment:$("#assignment_id").html(),role:$("#user_role").html()},success:function(result){fnCallback(result)},error:function(data,response){$(".dataTables_processing").attr("style","visibility: hidden");$(".dataTables_empty").html(M.str.turnitintooltwo.membercheckerror)}})}})}var submissionsDataTableColumns=[];var visibleCols=[];var noOfColumns=$("table.mod_turnitintooltwo_submissions_data_table th").length/$("table.mod_turnitintooltwo_submissions_data_table").length;var notStudentView=$("table.mod_turnitintooltwo_submissions_data_table th.sorting_name").length>0?true:false;var showOrigReport=$("table.mod_turnitintooltwo_submissions_data_table th.creport").length>0?true:false;var useGradeMark=$("table.mod_turnitintooltwo_submissions_data_table th.cgrade").length>0?true:false;var multipleParts=$("table.mod_turnitintooltwo_submissions_data_table th.coverallgrade").length>0?true:false;if(notStudentView){for(var i=0;i=9&&!showOrigReport&&!useGradeMark||i>=11&&(!showOrigReport&&useGradeMark||showOrigReport&&!useGradeMark)||i>=13&&showOrigReport&&useGradeMark)){submissionsDataTableColumns.push({sClass:"center",bSortable:false});visibleCols.push(true)}else if(i==0||i==4||i==7||i==9&&showOrigReport||(i==9&&!showOrigReport||i==11&&useGradeMark)){submissionsDataTableColumns.push({bVisible:false});visibleCols.push(false)}}}else{for(var i=0;i=8&&!showOrigReport&&!useGradeMark||i>=10&&(!showOrigReport&&useGradeMark||showOrigReport&&!useGradeMark)||i>=12&&showOrigReport&&useGradeMark)){submissionsDataTableColumns.push({sClass:"center",bSortable:false});visibleCols.push(true)}else if(i==0||i==3||i==6||i==8&&showOrigReport||(i==8&&!showOrigReport||i==10&&useGradeMark)){submissionsDataTableColumns.push({bVisible:false});visibleCols.push(false)}}}var partTables=[];var refreshRequested=[];$("table.mod_turnitintooltwo_submissions_data_table").each(function(){var part_id=$(this).attr("id");refreshRequested[part_id]=0;partTables[part_id]=$("table#"+part_id).dataTable({bProcessing:true,aoColumns:submissionsDataTableColumns,aLengthMenu:[[10,25,50,100,-1],[10,25,50,100,"All"]],aaSorting:[[2,"asc"],[4,"asc"]],sAjaxSource:"ajax.php",oLanguage:dataTablesLang,sDom:'r<"mod_turnitintooltwo_listbar-container"<"top mod_turnitintooltwo_listbar clearfix"lf>><"dt_pagination clearfix"pi>t<"bottom"><"dt_pagination clearfix"pi>',fnServerData:function(sSource,aoData,fnCallback){$.ajax({dataType:"json",type:"POST",url:sSource,data:{action:"initialise_redraw"},success:function(result){disableEditingText(part_id);fnCallback(result);$("#"+part_id+"_processing").attr("style","visibility: visible");getSubmissions(partTables[part_id],$("#assignment_id").html(),part_id,0,refreshRequested,0)}})},bStateSave:true,fnStateSave:function(oSettings,oData){try{localStorage.setItem(part_id+"DataTables",JSON.stringify(oData))}catch(e){}},fnStateSaveParams:function(oSettings,oData){oData.abVisCols=visibleCols},fnStateLoad:function(oSettings){try{return JSON.parse(localStorage.getItem(part_id+"DataTables"))}catch(e){}},fnStateLoadParams:function(oSettings,oData){oData.abVisCols=visibleCols},fnDrawCallback:function(oSettings){initialiseDigitalReceipt();initialiseDVLaunchers("all",0,part_id,0);initialiseRefreshRow("all",0,part_id,0);initialiseUploadBox("all",0,0,0);initialiseZipDownloads(part_id);initialiseCheckboxes(0,part_id);initialiseUnanoymiseForm("all",0,0)}})});$("table.mod_turnitintooltwo_submissions_data_table").each(function(){var part_id=$(this).attr("id");refreshPeermarkAssignments(part_id,0)});if($(".messages_amount").length>0){refreshUserMessages()}$(".tii_table_functions").each(function(){var part_id=$(this).attr("id").split("tii_table_functions_")[1];var tii_table_functions=$("#tii_table_functions_"+part_id).html();$("#tii_table_functions_"+part_id).remove();$("#"+part_id+"_length").after(tii_table_functions);$(".mod_turnitintooltwo_messages_inbox").show();$("#refresh_"+part_id).show();$("#refreshing_"+part_id).hide()});var zip_downloads=$(".mod_turnitintooltwo_zip_downloads");$.each(zip_downloads,function(){var part_id=$(this).attr("id").split("_")[1];$(this).remove();$("#"+part_id+"_length").after($(this))});if($("#user_role").html()=="Learner"){$(".dataTables_length, .dataTables_filter, .dt_pagination").hide()}$(".mod_turnitintooltwo_refresh_link").click(function(){if($(this).is(":visible")){$(".mod_turnitintooltwo_refresh_link").hide();$(".mod_turnitintooltwo_refreshing_link").show();$("table.mod_turnitintooltwo_submissions_data_table").each(function(){refreshRequested[$(this).attr("id")]=1;partTables[$(this).attr("id")].fnReloadAjax();partTables[$(this).attr("id")].fnStandingRedraw()})}return false});if($("#turnitin_sync_all_grades").length>0){$(".turnitin_sync_grades").click(function(){$(".turnitin_sync_grades").hide();$(".turnitin_syncing_grades").show();$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"sync_all_submissions",assignment:$("#turnitin_sync_all_grades").data("turnitintooltwoid"),sesskey:M.cfg.sesskey},success:function(data){$(".turnitin_sync_grades").show();$(".turnitin_syncing_grades").hide()}})})}if($(".submission_failure_msg").length>0){window.parent.$(".upload_box").colorbox.resize({width:"800px",height:"240px"})}$(".enrol_link").click(function(){$("#enrolling_error").hide();$(".enrol_link").hide();$(".enrolling_container").show();$.ajax({type:"POST",url:"ajax.php",dataType:"html",data:{action:"enrol_all_students",assignment:$("#assignment_id").html(),sesskey:M.cfg.sesskey},success:function(data){window.location.href=window.location.href},error:function(data,response){$(".enrol_link").show();$(".enrolling_container").hide();$("#enrolling_error").show()}})});if($(".mod_turnitintooltwo_rubric_manager_launch").length>0){$(".mod_turnitintooltwo_rubric_manager_launch").colorbox({iframe:true,width:"832px",height:"682px",opacity:"0.7",className:"rubric_manager",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){hideLoadingGif();if($(this).attr("id")!="rubric_manager_inbox_launch"){refreshRubricSelect()}$("#tii_close_bar").remove()}})}if($(".mod_turnitintooltwo_rubric_view_launch").length>0){$(".mod_turnitintooltwo_rubric_view_launch").colorbox({iframe:true,width:"832px",height:"682px",opacity:"0.7",className:"rubric_view",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}$("#id_rubric, #id_plagiarism_rubric").mousedown(function(){if($('input[name="instance"]').val()!=""&&$('input[name="rubric_warning_seen"]').val()!="Y"){if(confirm(M.str.turnitintooltwo.changerubricwarning)){$('input[name="rubric_warning_seen"]').val("Y")}}});if($(".mod_turnitintooltwo_quickmark_manager_launch").length>0){$(".mod_turnitintooltwo_quickmark_manager_launch").colorbox({iframe:true,width:"770px",height:"600px",opacity:"0.7",className:"quickmark_manager",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}if($(".tii_peermark_manager_launch").length>0){$(".tii_peermark_manager_launch").colorbox({iframe:true,width:"915px",height:"772px",opacity:"0.7",className:"peermark_manager",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()},onClosed:function(){var idStr=$(this).attr("id").split("_");refreshPeermarkAssignments(idStr[2],1)}})}if($(".tii_peermark_reviews_launch").length>0){$(".tii_peermark_reviews_launch").colorbox({iframe:true,width:"915px",height:"772px",opacity:"0.7",className:"peermark_reviews",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}if($(".mod_turnitintooltwo_messages_inbox").length>0){$(".mod_turnitintooltwo_messages_inbox").colorbox({iframe:true,width:"772px",height:"772px",opacity:"0.7",className:"messages",transition:"none",closeButton:true,onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}if($(".mod_turnitintooltwo_nonsubmitters_link").length>0){$(".mod_turnitintooltwo_nonsubmitters_link").colorbox({iframe:true,width:"740px",height:"540px",opacity:"0.7",className:"nonsubmitters",transition:"none",closeButton:true,onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}if($(".mod_turnitintooltwo_nonsubmittersformsuccessmsg").length>0){hideLoadingGif();window.parent.$(".nonsubmitters").colorbox.resize({width:"740px",height:"120px"})}if($(".mod_turnitintooltwo_rubric_view_launch").length>0){$(".mod_turnitintooltwo_rubric_view_launch").colorbox({iframe:true,width:"832px",height:"682px",opacity:"0.7",className:"rubric_view",transition:"none",onLoad:function(){lightBoxCloseButton();getLoadingGif()},onCleanup:function(){$("#tii_close_bar").remove();hideLoadingGif()}})}$(document).on("click",".default_open, .origreport_open, .grademark_open",function(){var proceed=true;var idStr=$(this).attr("id").split("_");var due_date=$("#date_due_"+idStr[2]).html();var due_date_unix=moment(due_date).unix();var dvtype=idStr[0];var submission_id=idStr[1];var part_id=idStr[2];if(due_date_unix>moment().unix()){if($(this).hasClass("graded_warning")){if(!confirm(M.str.turnitintooltwo.resubmissiongradewarn)){proceed=false}}}if(proceed){dvWindow=window.open("","_blank");var loading='
';loading+='';loading+='

'+M.str.turnitintooltwo.loadingdv+"

";loading+="
";$(dvWindow.document.body).html(loading);$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:dvtype,submission:submission_id,assignment:$("#assignment_id").html()},success:function(data){$(dvWindow.document.body).html(loading+data);dvWindow.document.forms[0].submit();dvWindow.document.close();checkDVClosed(part_id)}})}});if($("#id_rubric").length>0){refreshRubricSelect()}if(self!=top&&$("#view_context").html()=="box"){$("html").css("background","none")}else if(self!=top&&$("#view_context").html()=="box_solid"){$("html").css("background","#FFF")}$(".editable_postdue").on("click",function(){if($(this).data("anon")==1){alert(M.str.turnitintooltwo.postdate_warning)}});$(".max_marks_warning").on("click",function(){alert(M.str.turnitintooltwo.max_marks_warning)});if($(".editable_text").length>0){$.fn.editable.defaults.mode="inline";$.fn.editable.defaults.url="ajax.php";$.fn.editable.defaults.onblur="submit";$.fn.editable.defaults.showbuttons=false;$.fn.editable.defaults.ajaxOptions={dataType:"json"};$(".editable_text").editable({validate:function(value){if($(this).attr("id").indexOf("marks_")>=0&&(Math.floor(value)!=value||!$.isNumeric(value)||value.indexOf(".")!=-1)){return M.str.turnitintooltwo.maxmarkserror}},success:function(response,newValue){if(!response.success){return response.msg}else if(response.field=="maxmarks"){$("#refresh_"+response.partid).click();$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"sync_all_submissions",assignment:$("#assignment_id").html(),sesskey:M.cfg.sesskey}})}else if(response.field=="partname"){var tabId=$(this).parentsUntil(".ui-tabs-panel").parent().attr("aria-labelledby");$("#"+tabId).text(newValue)}}});if($("#export_options").hasClass("tii_export_options_hide")){$("#export_options").hide();$(".export_data").html('--')}$(".editable_postdue").on("click",function(){var $this=$(this);$.ajax({type:"POST",url:"ajax.php",dataType:"json",data:{action:"check_anon",part:$this.data("pk"),assignment:$("#assignment_id").html()},success:function(data){$this.data("anon",data["anon"]);$this.data("unanon",data["unanon"]);$this.data("submitted",data["submitted"])}})});var theDate=new Date;$(".editable_date").editable({type:"combodate",format:"YYYY-MM-DD HH:mm",viewformat:"D MMM YYYY, HH:mm",template:"D MMM YYYY HH:mm",combodate:{minuteStep:1,minYear:2e3,maxYear:theDate.getFullYear()+2,smartDays:true},validate:function(value){if(value.format("X")--')}else{$(".empty-dash").remove();$("#export_options").show()}}}});$(".editable_date").click(function(){if($(this).hasClass("editable-disabled")){return false}});$(".editable_date, .editable_text").on("shown",function(e,editable){var current=$(this).prop("id");$(".editable_date, .editable_text").not("#"+current).editable("disable");$(".submit_nothing").addClass("disabled")});$(".editable_date, .editable_text").on("hidden",function(){var current=$(this).prop("id");$(".editable_date, .editable_text").not("#"+current).editable("enable");$(".submit_nothing").removeClass("disabled")})}$("#inbox_form form, .launch_form form").submit();if($(".turnitin_eula_link").length>0){$(".turnitin_eula_link").colorbox({iframe:true,width:"766px",height:"596px",opacity:"0.7",className:"eula_view",scrolling:"false",onLoad:function(){getLoadingGif()},onComplete:function(){$(window).on("message",function(ev){var message=typeof ev.data==="undefined"?ev.originalEvent.data:ev.data;if(message=="turnitin_eula_declined"||message=="turnitin_eula_accepted"){$.ajax({type:"POST",url:M.cfg.wwwroot+"/mod/turnitintooltwo/ajax.php",dataType:"json",data:{action:"acceptuseragreement",message:message,sesskey:M.cfg.sesskey},success:function(data){window.location.reload()},error:function(data){window.location.reload()}})}})},onCleanup:function(){hideLoadingGif()}})}function enableEditingText(part_id){$("#tabs-"+part_id+" .editable_date, #tabs-"+part_id+" .editable_text").editable("enable")}function disableEditingText(part_id){$("#tabs-"+part_id+" .editable_date, #tabs-"+part_id+" .editable_text").editable("disable")}function getLoadingGif(){var img='
';$("#cboxOverlay").after(img);var top=$(window).scrollTop()+$(window).height()/2;$(".loading_gif").css("top",top+"px")}function hideLoadingGif(){$(".loading_gif").remove()}function getSubmissions(table,assignment_id,part_id,start,refresh_requested,total){$.ajax({dataType:"json",type:"POST",url:"ajax.php",async:true,data:{action:"get_submissions",assignment:assignment_id,part:part_id,start:start,refresh_requested:refresh_requested[part_id],sesskey:M.cfg.sesskey,total:total},success:function(result){eval(result);start=result.end;if(result.aaData.length>0){table.fnAddData(result.aaData)}if(result.end$(".mod_turnitintooltwo_submissions_data_table .refresh_row").length){$(".mod_turnitintooltwo_nonsubmitters_link").attr("style","display: block")}}},error:function(data,response){$("#"+part_id+"_processing").attr("style","visibility: hidden");$(".dataTables_empty").html(M.str.turnitintooltwo.tiisubmissionsgeterror)}})}function submitVisibility(){if($(".upload_box").data("user-type")==1||$(".upload_box").data("eula")==1){$(".upload_box").show()}else{$(".upload_box").hide()}}function refreshRubricSelect(){var rubricElementId=$("#id_rubric").length?"#id_rubric":"#id_plagiarism_rubric";var currentRubric=$(rubricElementId).val();$.ajax({dataType:"json",type:"POST",url:"../mod/turnitintooltwo/ajax.php",data:{action:"refresh_rubric_select",assignment:$('input[name="instance"]').val(),modulename:$('input[name="modulename"]').val(),course:$('input[name="course"]').val()},success:function(data){$($(rubricElementId)).empty();var options=data;$.each(options,function(i,val){if(!$.isNumeric(i)&&i!==""){var optgroup=$("");optgroup.attr("label",i);$.each(val,function(j,rubric){var option=$("");option.val(j);option.text(rubric);optgroup.append(option)});$(rubricElementId).append(optgroup)}else{$($(rubricElementId)).append($("