From ae80c03e36c75196a6269898f877df87b29ab311 Mon Sep 17 00:00:00 2001 From: Mark Nelson Date: Wed, 15 Jun 2016 12:51:16 +0800 Subject: [PATCH] Renamed rest.php to ajax.php --- rest.php => ajax.php | 0 .../moodle-mod_customcert-rearrange-debug.js | 2 +- .../moodle-mod_customcert-rearrange-min.js | 2 +- .../moodle-mod_customcert-rearrange.js | 2 +- yui/src/rearrange/js/rearrange.js | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename rest.php => ajax.php (100%) diff --git a/rest.php b/ajax.php similarity index 100% rename from rest.php rename to ajax.php diff --git a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-debug.js b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-debug.js index 3666e3c..86d0aec 100644 --- a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-debug.js +++ b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-debug.js @@ -256,7 +256,7 @@ Y.extend(Rearrange, Y.Base, { params.values = JSON.stringify(params.values); // Save these positions. - Y.io(M.cfg.wwwroot + '/mod/customcert/rest.php', { + Y.io(M.cfg.wwwroot + '/mod/customcert/ajax.php', { method: 'POST', data: params, on: { diff --git a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-min.js b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-min.js index 017b5f9..80eace1 100644 --- a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-min.js +++ b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange-min.js @@ -1 +1 @@ -YUI.add("moodle-mod_customcert-rearrange",function(e,t){var n=function(){n.superclass.constructor.apply(this,[arguments])};e.extend(n,e.Base,{templateid:0,page:[],elements:[],pdfx:0,pdfy:0,pdfwidth:0,pdfheight:0,elementxy:0,pdfleftboundary:0,pdfrightboundary:0,pixelsinmm:3.779527559055,initializer:function(t){this.templateid=t[0],this.page=t[1],this.elements=t[2],this.pdfx=e.one("#pdf").getX(),this.pdfy=e.one("#pdf").getY(),this.pdfwidth=parseFloat(e.one("#pdf").getComputedStyle("width"),10),this.pdfheight=parseFloat(e.one("#pdf").getComputedStyle("height"),10),this.pdfleftboundary=this.pdfx,this.page.leftmargin&&(this.pdfleftboundary+=parseInt(this.page.leftmargin*this.pixelsinmm,10)),this.pdfrightboundary=this.pdfx+this.pdfwidth,this.page.rightmargin&&(this.pdfrightboundary-=parseInt(this.page.rightmargin*this.pixelsinmm,10)),this.set_data(),this.set_positions(),this.create_events()},set_data:function(){for(var t in this.elements){var n=this.elements[t];e.one("#element-"+n.id).setData("refpoint",n.refpoint),e.one("#element-"+n.id).setData("width",n.width)}},set_positions:function(){for(var t in this.elements){var n=this.elements[t],r=this.pdfx+n.posx*this.pixelsinmm,i=this.pdfy+n.posy*this.pixelsinmm,s=parseFloat(e.one("#element-"+n.id).getComputedStyle("width"),10),o=n.width*this.pixelsinmm;o&&s>o&&(s=o),e.one("#element-"+n.id).setStyle("width",s+"px");switch(n.refpoint){case"1":r-=s/2;break;case"2":r=r-s+2}e.one("#element-"+n.id).setX(r),e.one("#element-"+n.id).setY(i)}},create_events:function(){e.one(".savepositionsbtn input[type=submit]").on("click",function(e){this.save_positions(e)},this),e.one(".applypositionsbtn input[type=submit]").on("click",function(e){this.save_positions(e),e.preventDefault()},this);var t=new e.DD.Delegate({container:"#pdf",nodes:".element"});t.on("drag:start",function(){var e=t.get("currentNode");this.elementxy=e.getXY(),this.elementwidth=e.getComputedStyle("width")},this),t.on("drag:end",function(){var e=t.get("currentNode");this.is_out_of_bounds(e)&&(e.setXY(this.elementxy),e.setStyle("width",this.elementwidth))},this)},is_out_of_bounds:function(e){var t=parseFloat(e.getComputedStyle("width"),10),n=parseFloat(e.getComputedStyle("height"),10),r=e.getX(),i=r+t,s=e.getY(),o=s+n;return rthis.pdfrightboundary?!0:sthis.pdfy+this.pdfheight?!0:!1},save_positions:function(t){var n={tid:this.templateid,values:[]};for(var r in this.elements){var i=this.elements[r],s=e.one("#element-"+i.id),o=s.getX()-this.pdfx,u=s.getY()-this.pdfy,a=parseFloat(s.getComputedStyle("width"),10);switch(i.refpoint){case"1":o+=a/2;break;case"2":o+=a}n.values.push({id:i.id,posx:Math.round(parseFloat(o/this.pixelsinmm,10)),posy:Math.round(parseFloat(u/this.pixelsinmm,10))})}n.values=JSON.stringify(n.values),e.io(M.cfg.wwwroot+"/mod/customcert/rest.php",{method:"POST",data:n,on:{failure:function(e,t){this.ajax_failure(t)},success:function(){var e=t.currentTarget.ancestor("form",!0),n=e.getAttribute("action"),r=e.one("[name=pid]");if(r){var i=r.get("value");window.location=n+"?pid="+i}else{var s=e.one("[name=tid]").get("value");window.location=n+"?tid="+s}}},context:this}),t.preventDefault()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)}}),M.mod_customcert=M.mod_customcert||{},M.mod_customcert.rearrange=M.mod_customcert.rearrange||{},M.mod_customcert.rearrange.init=function(e,t,r){new n(e,t,r)}},"@VERSION@",{requires:["dd-delegate","dd-drag"]}); +YUI.add("moodle-mod_customcert-rearrange",function(e,t){var n=function(){n.superclass.constructor.apply(this,[arguments])};e.extend(n,e.Base,{templateid:0,page:[],elements:[],pdfx:0,pdfy:0,pdfwidth:0,pdfheight:0,elementxy:0,pdfleftboundary:0,pdfrightboundary:0,pixelsinmm:3.779527559055,initializer:function(t){this.templateid=t[0],this.page=t[1],this.elements=t[2],this.pdfx=e.one("#pdf").getX(),this.pdfy=e.one("#pdf").getY(),this.pdfwidth=parseFloat(e.one("#pdf").getComputedStyle("width"),10),this.pdfheight=parseFloat(e.one("#pdf").getComputedStyle("height"),10),this.pdfleftboundary=this.pdfx,this.page.leftmargin&&(this.pdfleftboundary+=parseInt(this.page.leftmargin*this.pixelsinmm,10)),this.pdfrightboundary=this.pdfx+this.pdfwidth,this.page.rightmargin&&(this.pdfrightboundary-=parseInt(this.page.rightmargin*this.pixelsinmm,10)),this.set_data(),this.set_positions(),this.create_events()},set_data:function(){for(var t in this.elements){var n=this.elements[t];e.one("#element-"+n.id).setData("refpoint",n.refpoint),e.one("#element-"+n.id).setData("width",n.width)}},set_positions:function(){for(var t in this.elements){var n=this.elements[t],r=this.pdfx+n.posx*this.pixelsinmm,i=this.pdfy+n.posy*this.pixelsinmm,s=parseFloat(e.one("#element-"+n.id).getComputedStyle("width"),10),o=n.width*this.pixelsinmm;o&&s>o&&(s=o),e.one("#element-"+n.id).setStyle("width",s+"px");switch(n.refpoint){case"1":r-=s/2;break;case"2":r=r-s+2}e.one("#element-"+n.id).setX(r),e.one("#element-"+n.id).setY(i)}},create_events:function(){e.one(".savepositionsbtn input[type=submit]").on("click",function(e){this.save_positions(e)},this),e.one(".applypositionsbtn input[type=submit]").on("click",function(e){this.save_positions(e),e.preventDefault()},this);var t=new e.DD.Delegate({container:"#pdf",nodes:".element"});t.on("drag:start",function(){var e=t.get("currentNode");this.elementxy=e.getXY(),this.elementwidth=e.getComputedStyle("width")},this),t.on("drag:end",function(){var e=t.get("currentNode");this.is_out_of_bounds(e)&&(e.setXY(this.elementxy),e.setStyle("width",this.elementwidth))},this)},is_out_of_bounds:function(e){var t=parseFloat(e.getComputedStyle("width"),10),n=parseFloat(e.getComputedStyle("height"),10),r=e.getX(),i=r+t,s=e.getY(),o=s+n;return rthis.pdfrightboundary?!0:sthis.pdfy+this.pdfheight?!0:!1},save_positions:function(t){var n={tid:this.templateid,values:[]};for(var r in this.elements){var i=this.elements[r],s=e.one("#element-"+i.id),o=s.getX()-this.pdfx,u=s.getY()-this.pdfy,a=parseFloat(s.getComputedStyle("width"),10);switch(i.refpoint){case"1":o+=a/2;break;case"2":o+=a}n.values.push({id:i.id,posx:Math.round(parseFloat(o/this.pixelsinmm,10)),posy:Math.round(parseFloat(u/this.pixelsinmm,10))})}n.values=JSON.stringify(n.values),e.io(M.cfg.wwwroot+"/mod/customcert/ajax.php",{method:"POST",data:n,on:{failure:function(e,t){this.ajax_failure(t)},success:function(){var e=t.currentTarget.ancestor("form",!0),n=e.getAttribute("action"),r=e.one("[name=pid]");if(r){var i=r.get("value");window.location=n+"?pid="+i}else{var s=e.one("[name=tid]").get("value");window.location=n+"?tid="+s}}},context:this}),t.preventDefault()},ajax_failure:function(e){var t={name:e.status+" "+e.statusText,message:e.responseText};return new M.core.exception(t)}}),M.mod_customcert=M.mod_customcert||{},M.mod_customcert.rearrange=M.mod_customcert.rearrange||{},M.mod_customcert.rearrange.init=function(e,t,r){new n(e,t,r)}},"@VERSION@",{requires:["dd-delegate","dd-drag"]}); diff --git a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange.js b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange.js index 3666e3c..86d0aec 100644 --- a/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange.js +++ b/yui/build/moodle-mod_customcert-rearrange/moodle-mod_customcert-rearrange.js @@ -256,7 +256,7 @@ Y.extend(Rearrange, Y.Base, { params.values = JSON.stringify(params.values); // Save these positions. - Y.io(M.cfg.wwwroot + '/mod/customcert/rest.php', { + Y.io(M.cfg.wwwroot + '/mod/customcert/ajax.php', { method: 'POST', data: params, on: { diff --git a/yui/src/rearrange/js/rearrange.js b/yui/src/rearrange/js/rearrange.js index bfaa875..7170474 100644 --- a/yui/src/rearrange/js/rearrange.js +++ b/yui/src/rearrange/js/rearrange.js @@ -254,7 +254,7 @@ Y.extend(Rearrange, Y.Base, { params.values = JSON.stringify(params.values); // Save these positions. - Y.io(M.cfg.wwwroot + '/mod/customcert/rest.php', { + Y.io(M.cfg.wwwroot + '/mod/customcert/ajax.php', { method: 'POST', data: params, on: {