function escapeExtended(string){string=new String(string);string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n0)params.addNameValue('cXML_ID',PREFS.cXML_ID);ajaxPostFunction(params,function(sc,st,rt,rxml){var status=getTagValue(rxml,"status");instance.div.style["display"]="none";instance.div.innerHTML="";if(status=="FAILED"){var errors=rxml.getElementsByTagName("error");if(errors){for(var i=0;i";instance.div.style["display"]="";}} instance.notAvailable();}else{instance.pfID=getTagValue(rxml,"pfid");if(instance.pfID=="")instance.notAvailable();else instance.processPreview(PREFS.PF_SERVER_DOMAIN+'pfupload/download.iml?PF_ID='+instance.pfID+'&client_dir='+PREFS.Site_Dir);} instance.isLoadingPreview=false;if(instance.isWaitingForNewPreview)instance.getPreview(obj);},"ajax.iml");} PageFlexPreview.prototype.processPreview=function(rt){var instance=this;if(this.fullImg!=null){this.fullImg.onclick=function(){instance.fullImg.scrollIntoView();};this.fullImg.src=rt;this.fullImg.style["visibility"]="";this.loadingImg.style["display"]="none";this.fullImg.onclick=function(){instance.enlargeDirect();};}} PageFlexPreview.prototype.enlargeDirect=function(){var form=ce('form');form.action="popup2.iml";form.target="PROOF";form.method="post";document.body.appendChild(form);var input;var inputs=this.form.getElementsByTagName("*");for(var i=0;i=0&&(typeof inputs[i].options[inputs[i].selectedIndex]!=='undefined')) input.value=inputs[i].options[inputs[i].selectedIndex].value;else input.value="";form.appendChild(input);}}}} input=ce('input');input.type="hidden";input.name="PF_Job";input.value=this.job;form.appendChild(input);input=ce('input');input.type="hidden";input.name="PF_Project";input.value=this.project;form.appendChild(input);input=ce('input');input.type="hidden";input.name="cXML_ID";input.value=PREFS.cXML_ID;form.appendChild(input);input=ce('input');input.type="hidden";input.name="mdl";input.value="pageflex/getDirect2.mdl";form.appendChild(input);var blank=PREFS.WEBBASE+'blank.htm';if(PREFS.cXML_ID&&PREFS.cXML_ID>0)blank+='?cXML_ID='+PREFS.cXML_ID;var tmp=window.open(blank,'PROOF','width=400,height=400,toolbar=0,location=0,status=0,menubar=0,scrollbars=1',false);form.submit();document.body.removeChild(form);tmp.focus();} PageFlexPreview.prototype.loading=function(){if(this.fullImg!=null){this.fullImg.style["visibility"]="hidden";this.loadingImg.style["display"]="";}} PageFlexPreview.prototype.notAvailable=function(){if(this.fullImg!=null){this.fullImg.style["visibility"]="";this.loadingImg.style["display"]="none";this.fullImg.src="no_image.jpg";}} function PageFlexProduction(ticket,project,job,previewWindow){this.project=project;this.job=job;this.ticket=ticket;this.index=PageFlexList.length;this.previewWindow=previewWindow;PageFlexList[this.index]=this;} PageFlexProduction.prototype.get=function(alink){this.alink=null;this.textLink=null;this.processImg=null;if(alink){this.alink=alink;this.processText=ce('span');this.processText.innerHTML="Processing...";for(var i=0;i0)params.addNameValue('cXML_ID',PREFS.cXML_ID);ajaxPostFunction(params,function(sc,st,rt,rxml){var status=getTagValue(rxml,"status");if(status=="FAILED"){var errors=rxml.getElementsByTagName("error");if(errors){for(var i=0;i0)params.addNameValue('cXML_ID',PREFS.cXML_ID);ajaxPostFunction(params,function(sc,st,rt,rxml){var status=getTagValue(rxml,"status");if(status=="FAILED"){var errors=rxml.getElementsByTagName("error");if(errors){for(var i=0;i');l_alink.find('img').clone().appendTo(l_processText);l_processText.append('Processing...');l_processText.insertAfter(l_alink);l_alink.hide();} this.loading();var instance=this;var data={PF_Job:this.job,PF_Project:this.project};$(this.form).find('input:text:visible,input:hidden,input:checked,select,textarea:visible').each(function(){data[$(this).attr('name')]=escapeExtended($(this).val());});data['mdl']="pageflex/getPreview.aj";if(PREFS.cXML_ID&&PREFS.cXML_ID>0)data['cXML_ID']=PREFS.cXML_ID;$.post("ajax.iml",data,function(d){var status=$(d).find("status").text();if(status=="FAILED"){$(d).find("error").each(function(){alert($(this).find("msg").text());}) instance.notAvailable();l_processText.remove();l_alink.show();}else{instance.pfID=$(d).find("pfid").text();if(instance.pfID==""){instance.notAvailable();l_processText.remove();l_alink.show();}else{window.location.replace(PREFS.PF_SERVER_DOMAIN+'pfupload/download.iml?PF_ID='+instance.pfID+'&client_dir='+PREFS.Site_Dir);l_processText.html('
Click here if download doesn\'t start immediately.');l_alink.show();}}});} PageFlexPDFPreview.prototype.getDirect2=function(alink){var l_alink=null;var l_processText=null if(alink){l_alink=$(alink);l_processText=$('');l_alink.find('img').clone().appendTo(l_processText);l_processText.append('Processing...');l_processText.insertAfter(l_alink);l_processText.show(1).delay(10000).hide(1);} var form=$('
');form.append('').append('');$(this.form).find('input:text,input[type=hidden],input:checked,select,textarea:visible').each(function(){form.append($('').attr('name',$(this).attr('name')).val($(this).val()));});form.find('[name=mdl]').val("");if(form.find('[name=update_mdl]').length==0){form.append('');}else{form.find('[name=update_mdl]').val("pageflex/getPreview2.aj");} $('body').append(form);form.submit();if(l_alink)l_alink.hide(1).delay(10000).show(1);} PageFlexPDFPreview.prototype.loading=function(){if(this.fullImg!=null){this.fullImg.src="images/Spinning-Ball2.gif";}} PageFlexPDFPreview.prototype.notAvailable=function(){if(this.processImg)this.processImg.parentNode.removeChild(this.processImg);if(this.processText)this.processText.parentNode.removeChild(this.processText);if(this.alink)this.alink.style["display"]="";if(this.fullImg!=null)this.fullImg.src="no_image.jpg";}