La partie qui pose problème est : nicURI
var nicUploadButton=nicEditorAdvancedButton.extend({nicURI:"http://www.monsite.com/membre/upload/upload.php",addPane:function(){this.im=this.ne.selectedInstance.selElm().parentTag("IMG");this.myID=Math.round(Math.random()*Math.pow(10,15));this.requestInterval=1000;this.uri=this.ne.options.uploadURI||this.nicURI;nicUploadButton.lastPlugin=this;this.myFrame=new bkElement("iframe").setAttributes({width:"100%",height:"100px",frameBorder:0,scrolling:"no"}).setStyle({border:0}).appendTo(this.pane.pane);this.progressWrapper=new bkElement("div").setStyle({display:"none",width:"100%",height:"20px",border:"1px solid #ccc"}).appendTo(this.pane.pane);this.progress=new bkElement("div").setStyle({width:"0%",height:"20px",backgroundColor:"#ccc"}).setContent(" ").appendTo(this.progressWrapper);setTimeout(this.addForm.closure(this),50)},addForm:function(){var A=this.myDoc=this.myFrame.contentWindow.document;A.open();A.write("<html><body>");A.write('<form method="post" action="'+this.uri+"?id="+this.myID+'" enctype="multipart/form-data">');A.write('<input type="hidden" name="APC_UPLOAD_PROGRESS" value="'+this.myID+'" />');if(this.uri==this.nicURI){A.write('<div style="position: absolute; margin-left: 160px;"></div>')}A.write('<div style="font-size: 14px; font-weight: bold; padding-top: 5px;">Chercher image</div>');A.write('<input name="nicImage" type="file" style="margin-top: 10px;" />');A.write("</form>");A.write("</body></html>");A.close();this.myBody=A.body;this.myForm=$BK(this.myBody.getElementsByTagName("form")[0]);this.myInput=$BK(this.myBody.getElementsByTagName("input")[1]).addEvent("change",this.startUpload.closure(this));this.myStatus=new bkElement("div",this.myDoc).setStyle({textAlign:"center",fontSize:"14px"}).appendTo(this.myBody)},startUpload:function(){this.myForm.setStyle({display:"none"});this.myStatus.setContent('<img src="http://files.nicedit.com/ajax-loader.gif" style="float: right; margin-right: 40px;" /><strong>Uploading...</strong><br />Veuillez patientez svp...');this.myForm.submit();setTimeout(this.makeRequest.closure(this),this.requestInterval)},makeRequest:function(){if(this.pane&&this.pane.pane){nicUploadButton.lastPlugin=this;var A=new bkElement("script").setAttributes({type:"text/javascript",src:this.uri+"?check="+this.myID+"&rand="+Math.round(Math.random()*Math.pow(10,15))}).addEvent("load",function(){A.parentNode.removeChild(A)}).appendTo(document.getElementsByTagName("head")[0]);if(this.requestInterval){setTimeout(this.makeRequest.closure(this),this.requestInterval)}}},setProgress:function(A){this.progressWrapper.setStyle({display:"block"});this.progress.setStyle({width:A+"%"})},update:function(C){if(C==false){this.progressWrapper.setStyle({display:"none"})}else{if(C.url){this.setProgress(100);this.requestInterval=false;if(!this.im){this.ne.selectedInstance.restoreRng();var B="javascript:nicImTemp();";this.ne.nicCommand("insertImage",B);this.im=this.findElm("IMG","src",B)}var A=parseInt(this.ne.selectedInstance.elm.getStyle("width"));if(this.im){this.im.setAttributes({src:C.url,width:(A&&C.width)?Math.min(A,C.width):""})}this.removePane()}else{if(C.error){this.requestInterval=false;this.setProgress(100);alert("Erreur pendant le téléchargement ("+C.error+").");this.removePane()}else{if(C.noprogress){this.progressWrapper.setStyle({display:"none"});if(this.uri.indexOf("http:")==-1||this.uri.indexOf(window.location.host)!=-1){this.requestInterval=false}}else{this.setProgress(Math.round((C.current/C.total)*75));if(C.interval){this.requestInterval=C.interval}}}}}}});nicUploadButton.statusCb=function(A){nicUploadButton.lastPlugin.update(A)};nicEditors.registerPlugin(nicPlugin,nicUploadOptions);
Partager