// Copyright Nintex ´╗┐Type.registerNamespace('NWF');Type.registerNamespace('NWF.FormFiller');NWF.FormFiller.Attachments=function(){var FileuploadString="fileupload";var FileUploadIndex=0;var OkInProgress=false;return{UploadAttachment:function(){ULS1Lu:;ShowPartAttachment();},ShowPartAttachment:function(){ULS1Lu:;document.getElementById("partAttachment").style.display="block";document.getElementById("idAttachmentsLink").style.display="none";NWF.FormFiller.Attachments.AdjustAttachmentControlHeight(parseInt(NWF$("#partAttachment").outerHeight()));},CancelAttach:function(){ULS1Lu:;fileID=FileuploadString+FileUploadIndex;fileInput=NWF.FormFiller.Attachments.GetAttachElement(fileID);filename=fileInput.value;if(filename){fileInput.outerHTML="";} document.getElementById("partAttachment").style.display="none";document.getElementById("idAttachmentsLink").style.display="";NWF.FormFiller.Attachments.AdjustAttachmentControlHeight();},ClearUploadFileValue:function(fileInput){var newFileInput=fileInput.cloneNode(false);newFileInput.onchange=fileInput.onchange;fileInput.parentNode.replaceChild(newFileInput,fileInput);},OkAttach:function(){if(OkInProgress)return true;OkInProgress=true;ULS1Lu:;fileID=FileuploadString+FileUploadIndex;fileInput=NWF.FormFiller.Attachments.GetAttachElement(fileID);filename=NWF.FormFiller.Attachments.TrimWhiteSpaces(fileInput.value);var ext=/^.+\.([^.]+)$/.exec(filename);var fileExtension=(ext==null?"":ext[1]);var fileExtensionBlocked=true;if(fileExtension!=""&&NWF.Utilities.GetIndexOf(NWF.FormFiller.Attachments.BlockedFileExtenstions,fileExtension,0)==-1){fileExtensionBlocked=false;} if(!filename){var L_FileNameRequired_TXT="You must specify a non-blank value for File Name.";alert(L_FileNameRequired_TXT);fileInput.focus();NWF.FormFiller.Attachments.ClearUploadFileValue(fileInput);OkInProgress=false;return false;} else if(fileExtensionBlocked){alert("The selected file type is blocked by the server. Please select another file.");fileInput.focus();NWF.FormFiller.Attachments.ClearUploadFileValue(fileInput);OkInProgress=false;return false;} else{var L_FileUploadToolTip_text="GetLocalizedString(Filler_Attachments_Select_File)";oRow=document.getElementById("idAttachmentsTable").insertRow(-1);RowID='attachRow'+FileUploadIndex;oRow.id=RowID;oCellFileName=oRow.insertCell(-1);oCellFileName.className="ms-vb";oCellFileName.innerHTML=""+filename.replace(/^.*[\\\/]/,'')+"    ";oCellControl=oRow.insertCell(-1);oCellControl.className="ms-propertysheet";oCellControl.innerHTML=" "+"Delete"+"";fileInput.style.display="none";++FileUploadIndex;oAttachments=document.getElementById("attachmentsOnClient");var inputNode=document.createElement("input");inputNode.tabIndex="1";inputNode.type="File";inputNode.className="ms-longfileinput";inputNode.title=L_FileUploadToolTip_text;inputNode.name=FileuploadString+FileUploadIndex;inputNode.id=FileuploadString+FileUploadIndex;inputNode.size="56";inputNode.setAttribute("style","min-width:200px;width:100%");oAttachments.appendChild(inputNode);NWF$("#"+FileuploadString+FileUploadIndex).bind("change",function(event){if(NWF.FormFiller.Attachments.OkAttach()){NWF.FormFiller.Attachments.AdjustAttachmentControlHeight();}});var theForm=fileInput.form;theForm.encoding='multipart/form-data';document.getElementById("idAttachmentsLink").style.display="";document.getElementById("partAttachment").style.display="none";OkInProgress=false;return true;}},RemoveLocal:function(RowID,FileID){ULS1Lu:;if(document.getElementById("partAttachment").style.display=="block"){document.getElementById("idAttachmentsLink").style.display="";document.getElementById("partAttachment").style.display="none";NWF.FormFiller.Attachments.AdjustAttachmentControlHeight();} document.getElementById("idAttachmentsTable").deleteRow(document.getElementById(RowID).rowIndex);var nodeForRemoval=NWF.FormFiller.Attachments.GetAttachElement(FileID);nodeForRemoval.parentNode.removeChild(nodeForRemoval);},GetAttachElement:function(elem){ULS1Lu:;var ret=document.getElementById(elem);if(ret==null) ret=document.getElementsByName(elem).item(0);return ret;},TrimWhiteSpaces:function(str){ULSxSy:;var start;var end;str=str.toString();var len=str.length;for(start=0;startstart;end--){ch=str.charAt(end);if(ch!=' '&&ch!='\t'&&ch!='\n'&&ch!='\r'&&ch!='\f') break;} end++;return str.substring(start,end);},AdjustAttachmentControlHeight:function(controlInnerHeight){var attachmentsLinkHeight;var currentControl=NWF$("#idAttachmentsRow").parent().parent().parent();var controlHeight=NWF$(currentControl).outerHeight();var currentControlInner=NWF$("#idAttachmentsRow").parent();var attachmentHeightAdjustment=0;if(controlInnerHeight==undefined){controlInnerHeight=0;if(NWF$("#idAttachmentsLink").length==1){attachmentsLinkHeight=parseInt(NWF$("#idAttachmentsLink").outerHeight());if(attachmentsLinkHeight>0){attachmentHeightAdjustment+=parseInt(NWF$("#idAttachmentsLink").outerHeight());} else{attachmentHeightAdjustment+=parseInt(NWF$("#idAttachmentsLink .ms-addnew").outerHeight());}}} controlInnerHeight+=parseInt(NWF$("#idAttachmentsTable").outerHeight());var newControlHeight=controlInnerHeight+parseInt(NWF$(currentControlInner).css("top"))+parseInt(NWF$(currentControlInner).css("bottom"))+attachmentHeightAdjustment;if(newControlHeight0){for(var ii=0;ii0){document.forms[f][i].focus();bFound=true;}}} if(bFound==true) break;} if(bFound==true) break;} if(!bFound){NWF$("a:visible").first().focus();}},AjaxPost:function(service,requestData,cbSuccess){var webserviceUrl=NFApplicationWebUrl+service;if(!SP.ScriptUtility.isUndefined(window._spPageContextInfo)&&!SP.ScriptUtility.isUndefined(window._spFormDigestRefreshInterval)&&!SP.ScriptUtility.isUndefined(window.UpdateFormDigest)){var context=window._spPageContextInfo;var webServerUrl=context.webServerRelativeUrl;var refreshInterval=window._spFormDigestRefreshInterval;window.UpdateFormDigest(webServerUrl,refreshInterval);} NWF$.ajax({type:"POST",url:webserviceUrl,data:requestData,headers:{"X-RequestDigest":NWF$("#__REQUESTDIGEST").val()},contentType:"application/json; charset=utf-8",dataType:"json",success:cbSuccess,error:function(XMLHttpRequest,textStatus,errorThrown){NWF.Utilities.HideProgressDiv();alert(XMLHttpRequest.responseText);}});},AdjustControlHeights:function(fillerDiv,fillerInnerDiv,borderDiv,formControl){var formControlHeightOriginal=parseInt(formControl.outerHeight());var fillerInnerDivBorderTopWidth=isNaN(parseInt(fillerInnerDiv.css("border-top-width")))?0:parseInt(fillerInnerDiv.css("border-top-width"));var fillerInnerDivBorderBottomWidth=isNaN(parseInt(fillerInnerDiv.css("border-bottom-width")))?0:parseInt(fillerInnerDiv.css("border-bottom-width"));var fillerInnerDivTop=isNaN(parseInt(fillerInnerDiv.css("top")))?0:parseInt(fillerInnerDiv.css("top"));var fillerInnerDivBottom=isNaN(parseInt(fillerInnerDiv.css("bottom")))?0:parseInt(fillerInnerDiv.css("bottom"));var fillerInnerDivPaddingTop=isNaN(parseInt(fillerInnerDiv.css("padding-top")))?0:parseInt(fillerInnerDiv.css("padding-top"));var fillerInnerDivPaddingBottom=isNaN(parseInt(fillerInnerDiv.css("padding-bottom")))?0:parseInt(fillerInnerDiv.css("padding-bottom"));var fillerDivBorderTopWidth=isNaN(parseInt(fillerDiv.css("border-top-width")))?0:parseInt(fillerDiv.css("border-top-width"));var fillerDivBorderBottomWidth=isNaN(parseInt(fillerDiv.css("border-bottom-width")))?0:parseInt(fillerDiv.css("border-bottom-width"));var fillerDivMarginTop=isNaN(parseInt(fillerDiv.css("margin-top")))?0:parseInt(fillerDiv.css("margin-top"));var fillerDivMarginBottom=isNaN(parseInt(fillerDiv.css("margin-bottom")))?0:parseInt(fillerDiv.css("margin-bottom"));var formControlMaginTop=isNaN(parseInt(formControl.css("margin-top")))?0:parseInt(formControl.css("margin-top"));var formControlMaginBottom=isNaN(parseInt(formControl.css("margin-bottom")))?0:parseInt(formControl.css("margin-bottom"));var borderDivBorderTopWidth=isNaN(parseInt(borderDiv.css("border-top-width")))?0:parseInt(borderDiv.css("border-top-width"));var borderDivBorderBottomWidth=isNaN(parseInt(borderDiv.css("border-bottom-width")))?0:parseInt(borderDiv.css("border-bottom-width"));var fillerInnerDivExtraHeight=fillerInnerDivBorderTopWidth+fillerInnerDivBorderBottomWidth+fillerInnerDivPaddingTop+fillerInnerDivPaddingBottom+fillerDivMarginTop+fillerDivMarginBottom+formControlMaginTop+formControlMaginBottom;var borderDivExtraHeight=borderDivBorderTopWidth+borderDivBorderBottomWidth+fillerInnerDivExtraHeight;var fillerDivExtraHeight=borderDivExtraHeight+fillerDivBorderTopWidth+fillerDivBorderBottomWidth+fillerInnerDivTop+fillerInnerDivBottom;var newFillerDivHeight=formControlHeightOriginal+fillerDivExtraHeight;var newborderDivHeight=formControlHeightOriginal+borderDivExtraHeight;var newFillerInnerDivHeight=formControlHeightOriginal+fillerInnerDivExtraHeight;var fillerDivHeight=parseInt(fillerDiv.outerHeight());if(newFillerDivHeight>fillerDivHeight){fillerDiv.height(newFillerDivHeight,true);} var borderDivHeight=parseInt(borderDiv.outerHeight());if(newborderDivHeight>borderDivHeight){borderDiv.height(newborderDivHeight,true);} var fillerInnerDivHeight=parseInt(fillerInnerDiv.outerHeight());if(newFillerInnerDivHeight>fillerInnerDivHeight){fillerInnerDiv.height(newFillerInnerDivHeight,true);}},AdjustControlWidths:function(fillerDiv,fillerInnerDiv,borderDiv,formControl){var formControlWidthOriginal=parseInt(formControl.outerWidth());var fillerInnerDivBorderLeftWidth=isNaN(parseInt(fillerInnerDiv.css("border-left-width")))?0:parseInt(fillerInnerDiv.css("border-left-width"));var fillerInnerDivBorderRightWidth=isNaN(parseInt(fillerInnerDiv.css("border-right-width")))?0:parseInt(fillerInnerDiv.css("border-right-width"));var fillerInnerDivLeft=isNaN(parseInt(fillerInnerDiv.css("left")))?0:parseInt(fillerInnerDiv.css("left"));var fillerInnerDivRight=isNaN(parseInt(fillerInnerDiv.css("right")))?0:parseInt(fillerInnerDiv.css("right"));var fillerInnerDivPaddingLeft=isNaN(parseInt(fillerInnerDiv.css("padding-left")))?0:parseInt(fillerInnerDiv.css("padding-left"));var fillerInnerDivPaddingRight=isNaN(parseInt(fillerInnerDiv.css("padding-right")))?0:parseInt(fillerInnerDiv.css("padding-right"));var fillerDivBorderLeftWidth=isNaN(parseInt(fillerDiv.css("border-left-width")))?0:parseInt(fillerDiv.css("border-left-width"));var fillerDivBorderRightWidth=isNaN(parseInt(fillerDiv.css("border-right-width")))?0:parseInt(fillerDiv.css("border-right-width"));var fillerDivMarginLeft=isNaN(parseInt(fillerDiv.css("margin-left")))?0:parseInt(fillerDiv.css("margin-left"));var fillerDivMarginRight=isNaN(parseInt(fillerDiv.css("margin-right")))?0:parseInt(fillerDiv.css("margin-right"));var formControlMaginLeft=isNaN(parseInt(formControl.css("margin-left")))?0:parseInt(formControl.css("margin-left"));var formControlMaginRight=isNaN(parseInt(formControl.css("margin-right")))?0:parseInt(formControl.css("margin-right"));var borderDivBorderLeftWidth=isNaN(parseInt(borderDiv.css("border-left-width")))?0:parseInt(borderDiv.css("border-left-width"));var borderDivBorderRightWidth=isNaN(parseInt(borderDiv.css("border-right-width")))?0:parseInt(borderDiv.css("border-right-width"));var fillerInnerDivExtraWidth=fillerInnerDivBorderLeftWidth+fillerInnerDivBorderRightWidth+fillerInnerDivPaddingLeft+fillerInnerDivPaddingRight+fillerDivMarginLeft+fillerDivMarginRight+formControlMaginLeft+formControlMaginRight;var borderDivExtraWidth=borderDivBorderLeftWidth+borderDivBorderRightWidth+fillerInnerDivExtraWidth;var fillerDivExtraWidth=borderDivExtraWidth+fillerDivBorderLeftWidth+fillerDivBorderRightWidth+fillerInnerDivLeft+fillerInnerDivRight;var newFillerDivWidth=formControlWidthOriginal+fillerDivExtraWidth;var newborderDivWidth=formControlWidthOriginal+borderDivExtraWidth;var newFillerInnerDivWidth=formControlWidthOriginal+fillerInnerDivExtraWidth;var fillerDivWidth=parseInt(fillerDiv.outerWidth());if(newFillerDivWidth>fillerDivWidth){fillerDiv.width(newFillerDivWidth,true);} var borderDivWidth=parseInt(borderDiv.outerWidth());if(newborderDivWidth>borderDivWidth){borderDiv.width(newborderDivWidth,true);} var fillerInnerDivWidth=parseInt(fillerInnerDiv.outerWidth());if(newFillerInnerDivWidth>fillerInnerDivWidth){fillerInnerDiv.width(newFillerInnerDivWidth,true);}},RepositionAndResizeOtherControlsAndContainerHeight:function(currentControl,heightIncrease,heightDifferenceWithBorders){var currentControlTop=parseInt(currentControl.css("top"));if(heightIncrease!=0||heightDifferenceWithBorders!=0){NWF.Utilities.RepositionAndResizeOtherControls(currentControl,currentControlTop,heightIncrease,heightDifferenceWithBorders);var container=NWF$(".nf-filler-container");var outerDiv=NWF$(".nf-outer");var newContainerHeight=heightDifferenceWithBorders+container.height();outerDiv.height(newContainerHeight,true);container.height(newContainerHeight,true);}},RepositionAndResizeOtherControlsAndContainerWidth:function(currentControl,widthIncrease,widthDifferenceWithBorders){var currentControlTop=parseInt(currentControl.css("top"));if(widthIncrease!=0||widthDifferenceWithBorders!=0){var container=NWF$(".nf-filler-container");var outerDiv=NWF$(".nf-outer");var newContainerWidth=widthDifferenceWithBorders+container.width();outerDiv.width(newContainerWidth,true);container.width(newContainerWidth,true);}},GetRowControlIds:function(control,thisRepeaterControl,controlIds){var controlId=control.attr('id');var controlName=control.prop('name');if(controlName!=undefined){controlIds.push(controlId);} NWF$(control.children()).each(function(){return NWF.FormFiller.Functions.GetRowControlIds(NWF$(this),thisRepeaterControl,controlIds);});return controlIds;},DisableEnableAddRowLink:function(thisRepeaterControl,noOfRows,maxRows){var addROwDiv=NWF$(".nf-repeater-addrow",thisRepeaterControl);if(noOfRows>=maxRows){if(!addROwDiv.hasClass("nf-disabled")){addROwDiv.addClass("nf-disabled");}}else{if(addROwDiv.hasClass("nf-disabled")){addROwDiv.removeClass("nf-disabled");}}},DisableValidationForRow:function(thisRepeaterControl,rowControlIds,saveValidators){try{NWF$.each(Page_Validators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);if(NWF.Utilities.GetIndexOf(rowControlIds,controlToValidate.attr('id'))!=-1){if(saveValidators){var disabledValidators=thisRepeaterControl.data('DisabledValidators');disabledValidators.push(this);thisRepeaterControl.data('DisabledValidators',disabledValidators);} ValidatorEnable(this,false);}});}catch(e){}},DisableAllClientValidators:function(){try{NWF$.each(Page_Validators,function(){ValidatorEnable(this,false);});}catch(e){}},HasScrollbar:function(elem_id){elem=document.getElementById(elem_id);if(elem.clientHeight0){for(var i in controlfunctions){NWF.FormFiller.Functions.CalculateFormulaForControl(controlfunctions[i],control);}} var controlrules=NWF.FormFiller.Functions.GetAssociatedFunctions(Rules,"Control",control.parents(".nf-filler-control").attr("FormControlId"));if(controlrules.length>0){for(i in controlrules){var controlRuleName=controlrules[i].Result+"|"+controlrules[i].Name;NWF.FormFiller.Functions.ProcessRuleForControl(controlrules[i],control);NWF.FormFiller.Functions.FunctionsProcessed.push(controlRuleName);}}}},GetAssociatedFunctions:function(array,attrName,attrValue){var associatedFunctions=[];for(index in array){if(NWF$(array[index]).attr(attrName)===attrValue){associatedFunctions.push(array[index]);}} return associatedFunctions;},GetTypedValue:function(rawValue){try{return NWF$.parseJSON(rawValue.toLowerCase());}catch(e){return NWF.FormFiller.Functions.GetControlValue(rawValue);}},GetValue:function(controlId,sourceContext){var controlMultiValues;var controlValues="";var controlValue="";var i;var valueControls;var checkedControlValue;var datetime;var hours;var hourspart;var minutes;valueControls=NWF$(".nf-filler-control",sourceContext).filter('[FormControlId ="'+controlId+'"]').find(".nf-associated-control");if(valueControls.length==0){valueControls=NWF$(".nf-filler-control",sourceContext).filter('[FormControlId ="'+controlId+'"]').find(".nf-hidden-associated-control");} if(valueControls.length==0){valueControls=NWF$(".nf-filler-control",sourceContext).filter('[FormControlId ="'+controlId+'"]').find(".nf-calculation-control-value");} if(valueControls.length==1&&NWF$(valueControls).val()==""&&NWF$(valueControls[0]).find("input").length>0){if(NWF$(valueControls[0]).find("input").length>0){controlValues=false;valueControls=NWF$(".nf-filler-control",sourceContext).filter('[FormControlId ="'+controlId+'"]').find("input[type='checkbox'], input[type='radio']");}} if(valueControls!=null&&valueControls.length!=0){if(valueControls[0].multiple&&NWF$(valueControls).children("option").length>0){controlMultiValues=NWF$(valueControls).val();if(controlMultiValues!=null){if(controlMultiValues.length>1||valueControls[0].type=="select-multiple"){controlValues=[];for(i=0;i1){controlValues=[];for(i=0;i1?NWF.FormFiller.Functions.DecimalSymbol+x[1]:'';var rgx=/(\d+)(\d{3})/;while(rgx.test(x1)){x1=x1.replace(rgx,'$1'+NWF.FormFiller.Functions.ThousandSeparatorSymbol+'$2');} return x1+x2;},ConvertNumberToProcess:function(numberToFormat){if(isNaN(Number.parseLocale(numberToFormat))){return numberToFormat;} else{return Number.parseLocale(numberToFormat);}},ConvertNumberToDisplay:function(numberToDisplay,addThousandSeparator){if(NWF.FormFiller.Functions.DecimalSymbol!="."){numberToDisplay+='';x=numberToDisplay.split(".");x1=x[0];x2=x.length>1?NWF.FormFiller.Functions.DecimalSymbol+x[1]:'';numberToDisplay=x1+''+x2;} if(addThousandSeparator){numberToDisplay=NWF.FormFiller.Functions.AddThousandSeparator(numberToDisplay);} return numberToDisplay;},CalculateFormulaForControl:function(controlfunction,currentControl){var controlContext=currentControl.parents(".nf-repeater-row").length>0?NWF$(currentControl.parents(".nf-repeater-row")[0]):NWF$(currentControl.parents(".nf-filler-container")[0]);var controlFunctionName=NWF$(controlContext)[0].uniqueID+"|"+controlfunction.Result+"|"+controlfunction.Name;if(NWF.Utilities.GetIndexOf(NWF.FormFiller.Functions.FunctionsProcessed,controlFunctionName)===-1){NWF.FormFiller.Functions.CalculateFormula(controlfunction,controlContext);NWF.FormFiller.Functions.FunctionsProcessed.push(controlFunctionName);}},ProcessRuleForControl:function(controlRule,currentControl){var controlContext=currentControl.parents(".nf-repeater-row").length>0?NWF$(currentControl.parents(".nf-repeater-row")[0]):NWF$(currentControl.parents(".nf-filler-container")[0]);NWF.FormFiller.Functions.ProcessRule(controlRule,controlContext);},CalculateFormula:function(controlfunction,controlContext){try{var resultControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+controlfunction.Result+'"]');if(resultControl.length==0){while(resultControl.length==0&&controlContext.length!=0){controlContext=controlContext.parents(".nf-repeater-row").length>0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);resultControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+controlfunction.Result+'"]');}} var functionResult=controlfunction.Name(controlContext);var formattedFunctionResult=functionResult;var resultValueControl=NWF$(resultControl.find(".nf-calculation-control-value"));if(functionResult==Infinity){functionResult="#DIV/0!";formattedFunctionResult=functionResult;} else if(NWF$.isArray(functionResult)){functionResult=functionResult.toString();formattedFunctionResult="["+functionResult+"]";} else if(!NWF.FormFiller.Functions.IsString(functionResult)&&isNaN(functionResult)){functionResult="#Value!";formattedFunctionResult=functionResult;} else if(!isNaN(parseFloat(functionResult))&&isFinite(functionResult)){functionResult=Number(functionResult);var decimalPlaces=resultValueControl.attr("no-of-decimals");if(isNaN(decimalPlaces)){formattedFunctionResult=functionResult;} else{formattedFunctionResult=functionResult.toFixed(decimalPlaces).replace('.',NWF.FormFiller.Functions.DecimalSymbol);} formattedFunctionResult=NWF.FormFiller.Functions.ConvertNumberToDisplay(formattedFunctionResult,resultControl.find(".nf-calculation-control-value").attr("thousand-separator")=="1");} if(formattedFunctionResult!==null){resultControl.find(".nf-calculation-control").html(formattedFunctionResult.toString());resultValueControl.val(formattedFunctionResult);} if(NWF.Utilities.GetIndexOf(NWF.FormFiller.Functions.ChangeEventProcessedControls,resultControl[0].uniqueID)!=-1){if(!NWF.FormFiller.Functions.SuppressExceptions){alert("Circular reference detected. Aborting...");} NWF.FormFiller.Functions.PropagateEvent=false;} if(NWF.FormFiller.Functions.PropagateEvent){NWF.FormFiller.Functions.ChangeEventProcessedControls.push(resultControl[0].uniqueID);NWF.FormFiller.Functions.ProcessOnChange(NWF$(resultControl.find(".nf-calculation-control-value")));}} catch(e){if(!NWF.FormFiller.Functions.SuppressExceptions){alert("Error in formula: "+e.message);}}},ProcessRule:function(controlfunction,originalControlContext){var i;var controlContext=originalControlContext;for(i=0;i0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);associatedControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+associatedControlId+'"]');}} associatedControl.addClass("nfExcludethis");} for(i=0;i0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);resultControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+controlfunction.Result[i]+'"]');}} resultControl.addClass("nfExcludethis");} for(i=0;i0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);resultControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+resultControlId+'"]');}} functionResult=controlfunction.Name(controlContext);if(functionResult){if(resultControl.hasClass(controlfunction.CssClass)){} else{NWF$(resultControl).addClass(controlfunction.CssClass);if(controlfunction.Hide){hideCounter=resultControl.data("HideCounter");if(hideCounter==""||hideCounter==undefined){hideCounter=0;} if(hideCounter==0){for(i=0;i0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);associatedControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+associatedControlId+'"]');}} associatedControl.hide();}} controlToConditionalDisplayTop=parseInt(resultControl.css("top"));heightIncrease=-parseInt(resultControl.css("height"));NWF.Utilities.RepositionAndResizeOtherControlsForRule(resultControl,controlToConditionalDisplayTop,parseInt(resultControl.css("height")),heightIncrease,".nfExcludethis");resultControl.hide();} resultControl.data("HideCounter",++hideCounter);} if(controlfunction.Disable){disableCounter=resultControl.data("DisableCounter");if(disableCounter==""||disableCounter==undefined){disableCounter=0;} if(disableCounter==0){subControls=resultControl.find("*").not("iframe").not("input");for(k=subControls.length-1;k>=0;k--){subControls[k].disabled=true;} frames=NWF$(resultControl.find("iframe"));for(k=0;k=0;m--){frameContents[m].disabled=true;}} if(resultControl.find("*").not("div").length>0){resultControl.find("*").not("div")[0].disabled=true;}} resultControl.data("DisableCounter",++disableCounter);}}} else{if(resultControl.hasClass(controlfunction.CssClass)){if(controlfunction.Hide){hideCounter=resultControl.data("HideCounter");if(hideCounter==""||hideCounter==undefined){hideCounter=1;} resultControl.data("HideCounter",--hideCounter);if(hideCounter==0){controlToConditionalDisplayTop=parseInt(resultControl.css("top"))-1;heightIncrease=parseInt(resultControl.css("height"));NWF.Utilities.RepositionAndResizeOtherControlsForRule(resultControl,controlToConditionalDisplayTop,parseInt(resultControl.css("height")),heightIncrease,".nfExcludethis");for(i=0;i0?NWF$(controlContext.parents(".nf-repeater-row")[0]):NWF$(controlContext.parents(".nf-filler-container")[0]);associatedControl=NWF$(".nf-filler-control",controlContext).filter('[FormControlId ="'+associatedControlId+'"]');}} associatedControl.show();}} resultControl.show();}} if(controlfunction.Disable){disableCounter=resultControl.data("DisableCounter");if(disableCounter==""||disableCounter==undefined){disableCounter=1;} resultControl.data("DisableCounter",--disableCounter);if(disableCounter==0){subControls=resultControl.find("*").not("iframe").not("input");for(k=0;k0){resultControl.find("*").not("div")[0].disabled=false;}}} NWF$(resultControl).removeClass(controlfunction.CssClass);} else{}};} catch(e){if(!NWF.FormFiller.Functions.SuppressExceptions){alert("Error in formula: "+e.message);}}},ResizeFillerControls:function(){NWF.FormFiller.Functions.AddedRowsCounter=0;NWF$('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);NWF.FormFiller.Functions.AddedRowsCounter=0;thisRepeaterControl.data('MaxRows',thisRepeaterControl.attr("maxRows")==""?1000:thisRepeaterControl.attr("maxRows"));thisRepeaterControl.data('MinRows',thisRepeaterControl.attr("maxRows")==""?0:thisRepeaterControl.attr("minRows"));thisRepeaterControl.data('AddedRowPrefixes',new Array());thisRepeaterControl.data('HiddenControlIds',new Array());thisRepeaterControl.data('DisabledValidators',new Array());thisRepeaterControl.data('CurrentRowControlIdPrefix',"");var repeaterReadOnlyMode=false;if(NWF$("."+RepeaterRowIndexClass,this).length==0){repeaterReadOnlyMode=true;} var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length>1){var repeaterFirstRow=NWF$(repeaterRows[0]);thisRepeaterControl.data('HiddenControlIds',NWF.FormFiller.Functions.GetRowControlIds(repeaterFirstRow,thisRepeaterControl,thisRepeaterControl.data('HiddenControlIds')));NWF.FormFiller.Functions.DisableValidationForRow(thisRepeaterControl,thisRepeaterControl.data('HiddenControlIds'),true);NWF$(".nf-filler-control",repeaterFirstRow).find('input').each(function(){if(this.type=="text")NWF$(this).val("");});for(var rowCnt=0;rowCnt0){newRepeaterRow.attr("class",repeaterFirstRow.data('itemClass'));} var beforeHeight=thisRepeaterControl.outerHeight();thisRepeaterControl.children(".nf-repeater-addeddrow-suffixes").before(newRepeaterRow);NWF.FormFiller.Functions.ProcessCalculations(newRepeaterRow,true);if(thisRepeaterControl.outerHeight()==beforeHeight){thisRepeaterControl.outerHeight(beforeHeight+newRepeaterRow.outerHeight());} NWF$('.nf-repeater',newRepeaterRow).each(function(){var childRepeaterControl=NWF$(this);childRepeaterControl.data('CurrentRowControlIdPrefix',addedrowPrefix+childRepeaterControl.data('CurrentRowControlIdPrefix'));childRepeaterControl.data('AddedRowPrefixes',new Array());});NWF.FormFiller.Functions.LoadControlInitScripts();var disabledValidators=thisRepeaterControl.data('DisabledValidators');var i=0;NWF$.each(disabledValidators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);controlToValidate.attr('title',"");controlToValidate.attr('oldtitle',"");var hiddenControlIds=thisRepeaterControl.data('HiddenControlIds');if(NWF.Utilities.GetIndexOf(hiddenControlIds,controlToValidate.attr('id'))!=-1){var hiddenControlId=controlToValidate.attr('id');var newControlId=currentRowControlIdPrefix+hiddenControlId;var newValidator=NWF$(this).clone(true,true);NWF$(newValidator)[0].controltovalidate=newControlId;NWF$(newValidator)[0].validationGroup=this.validationGroup;NWF$(newValidator)[0].evaluationfunction=this.evaluationfunction;NWF$(newValidator)[0].initialvalue=this.initialvalue;NWF$(newValidator)[0].errormessage=this.errormessage;NWF$(newValidator)[0].operator=this.operator;NWF$(newValidator)[0].type=this.type;NWF$(newValidator)[0].decimalchar=this.decimalchar;NWF$(newValidator)[0].digits=this.digits;NWF$(newValidator)[0].groupsize=this.groupsize;NWF$(newValidator)[0].groupchar=this.groupchar;if(this.controltocompare!=undefined){var controltocompare=NWF$('#'+this.controltocompare);NWF$(newValidator)[0].controltocompare=currentRowControlIdPrefix+controltocompare.attr('id');} if(this.controlhookup!=undefined){var controlhookup=NWF$('#'+this.controlhookup);NWF$(newValidator)[0].controlhookup=currentRowControlIdPrefix+controlhookup.attr('id');} NWF$(newValidator).attr({"id":newControlId+"val"+i});NWF$(newValidator).prop({"name":newControlId+"val"+i++});Page_Validators.push(newValidator[0]);NWF$(currentControl.parent().parent()[0]).append(newValidator);ValidatorEnable(newValidator[0],true);}});NWF$('.nf-repeater',newRepeaterRow).each(function(){var childRepeaterControl=NWF$(this);var childRepeaterRows=NWF$(childRepeaterControl.children('.nf-repeater-row'));if(childRepeaterRows.length>1){var childRepeaterFirstRow=NWF$(childRepeaterRows[0]);childRepeaterControl.data('CurrentRowControlIds',NWF.FormFiller.Functions.GetRowControlIds(childRepeaterFirstRow,childRepeaterControl,new Array()));NWF.FormFiller.Functions.DisableValidationForRow(childRepeaterControl,childRepeaterControl.data('CurrentRowControlIds'),false);}});var currentControl=thisRepeaterControl.parent().parent().parent();var heightIncrease=newRepeaterRow.outerHeight();NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerHeight(currentControl,heightIncrease,heightIncrease);thisRepeaterControl.data('AddedRowsCounter',NWF.FormFiller.Functions.AddedRowsCounter);thisRepeaterControl.data('AddedRowPrefixes',addedRowPrefixes);NWF.FormFiller.Functions.DisableEnableAddRowLink(thisRepeaterControl,repeaterRows.length,parseInt(thisRepeaterControl.data('MaxRows')));} NWF$('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);var repeaterOuterControl=thisRepeaterControl.parent().parent().parent();var repeaterInnerControl=thisRepeaterControl.parent();var thisRepeaterControlHeight=parseInt(thisRepeaterControl.outerHeight());repeaterInnerControl.outerHeight(thisRepeaterControlHeight);repeaterOuterControl.outerHeight(thisRepeaterControlHeight);});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());}});NWF$('.nf-repeater-deleterow-image').live('click',function(event){var currentObject=NWF$(this);var thisRepeaterControl=NWF$(NWF$(currentObject.parents('.nf-repeater'))[0]);var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length-1>parseInt(thisRepeaterControl.data('MinRows'))){var currentControl=thisRepeaterControl.parent().parent().parent();var currentRow=NWF$(NWF$(currentObject.parents('.nf-repeater-row'))[0]);var addedRowPrefixes=null;addedRowPrefixes=thisRepeaterControl.data('AddedRowPrefixes');var repeaterRowIdControl=NWF$(currentRow.children("."+RepeaterRowIndexClass));rowToIdDelete=repeaterRowIdControl.attr('value');thisRepeaterControl.data('CurrentRowControlIds',NWF.FormFiller.Functions.GetRowControlIds(currentRow,thisRepeaterControl,new Array()));NWF.FormFiller.Functions.DisableValidationForRow(thisRepeaterControl,thisRepeaterControl.data('CurrentRowControlIds'),false);var deletedRowIndexInArray=NWF.Utilities.GetIndexOf(addedRowPrefixes,rowToIdDelete);if(deletedRowIndexInArray!=-1){addedRowPrefixes.splice(deletedRowIndexInArray,1);NWF$(thisRepeaterControl.children("."+RepeaterAddedRowPrefixesClass)).attr('value',addedRowPrefixes.join(","));} NWF$(currentRow.children("."+RepeaterRowIndexClass)).attr('value','');var beforeHeight=thisRepeaterControl.outerHeight();var heightIncrease=-currentRow.outerHeight();currentRow.css({"display":"none"});currentRow.remove();var repeaterRowsNew=NWF$(thisRepeaterControl.children('.nf-repeater-row'));for(var k=1;k0){currentRow.attr("class",repeaterFirstRow.data('itemClass'));} else{currentRow.attr("class",repeaterFirstRow.attr("class"));}}} thisRepeaterControl.data('AddedRowPrefixes',addedRowPrefixes);NWF.FormFiller.Functions.DisableEnableAddRowLink(thisRepeaterControl,repeaterRows.length-2,parseInt(thisRepeaterControl.data('MaxRows')))} NWF$('.nf-repeater').each(function(){var thisRepeaterControl=NWF$(this);var repeaterOuterControl=thisRepeaterControl.parent().parent().parent();var repeaterInnerControl=thisRepeaterControl.parent();var thisRepeaterControlHeight=parseInt(thisRepeaterControl.outerHeight());repeaterInnerControl.outerHeight(thisRepeaterControlHeight);repeaterOuterControl.outerHeight(thisRepeaterControlHeight);});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());}});var container=NWF$(".nf-filler-container");var outerDiv=NWF$(".nf-outer");var maxHeight=0;var maxWidth=0;NWF$(".nf-filler-control").each(function(){var fillerDiv=NWF$(this);if(fillerDiv.children().length==0)return;var fillerDivTop=parseInt(fillerDiv.css("top"));var fillerDivLeft=parseInt(fillerDiv.css("left"));var fillerDivHeightOriginal=parseInt(fillerDiv.css("height"));var fillerDivWidthOriginal=parseInt(fillerDiv.css("width"));var fillerDivRight=fillerDivLeft+fillerDivWidthOriginal;if((fillerDivHeightOriginal+fillerDivTop)>maxHeight)maxHeight=fillerDivHeightOriginal+fillerDivTop;if(fillerDivRight>maxWidth)maxWidth=fillerDivRight;var borderDiv=NWF$(fillerDiv.children()[0]);var fillerInnerDiv=NWF$(fillerDiv.children()[0].children[0]);var formControl=NWF$(fillerInnerDiv.children()[0]);var formControlMaginTop=isNaN(parseInt(formControl.css("margin-top")))?0:parseInt(formControl.css("margin-top"));var formControlMaginBottom=isNaN(parseInt(formControl.css("margin-bottom")))?0:parseInt(formControl.css("margin-bottom"));var formControlHeightOriginal=parseInt(formControl.outerHeight())+formControlMaginTop+formControlMaginBottom;NWF.FormFiller.Functions.AdjustControlHeights(fillerDiv,fillerInnerDiv,borderDiv,formControl);var fillerDivHeightNew=parseInt(fillerDiv.outerHeight());if(!fillerDiv.hasClass("nf-resizable"))return;if(fillerDivHeightOriginalmaxHeight)maxHeight=formControlHeightOriginal+fillerDivTop;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerHeight(fillerDiv,formControlHeightOriginal-fillerDivHeightOriginal,fillerDivHeightNew-fillerDivHeightOriginal);} else if(fillerDiv.hasClass("nf-recurrence-control")){formControlHeightOriginal=0;NWF$(NWF$(formControl).children()).each(function(){if(NWF$(this).css("display")!="none"){formControlHeightOriginal+=parseInt(NWF$(this).outerHeight());}});fillerDivHeightNew=formControlHeightOriginal+parseInt(fillerInnerDiv.css("border-top-width"))+parseInt(fillerInnerDiv.css("border-bottom-width"));if(fillerDivHeightOriginalmaxHeight)maxHeight=formControlHeightOriginal+fillerDivTop;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerHeight(fillerDiv,formControlHeightOriginal-fillerDivHeightOriginal,fillerDivHeightNew-fillerDivHeightOriginal);}} var formControlMaginLeft=isNaN(parseInt(formControl.css("margin-left")))?0:parseInt(formControl.css("margin-left"));var formControlMaginRight=isNaN(parseInt(formControl.css("margin-right")))?0:parseInt(formControl.css("margin-right"));var formControlWidthOriginal=parseInt(formControl.outerWidth())+formControlMaginLeft+formControlMaginRight;NWF.FormFiller.Functions.AdjustControlWidths(fillerDiv,fillerInnerDiv,borderDiv,formControl);var fillerDivWidthNew=parseInt(fillerDiv.outerWidth());if(!fillerDiv.hasClass("nf-resizable"))return;if(fillerDivWidthOriginalmaxWidth)maxWidth=formControlWidthOriginal+fillerDivLeft;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerWidth(fillerDiv,formControlWidthOriginal-fillerDivWidthOriginal,fillerDivWidthNew-fillerDivWidthOriginal);} else if(fillerDiv.hasClass("nf-recurrence-control")){formControlWidthOriginal=0;NWF$(NWF$(formControl).children()).each(function(){if(NWF$(this).css("display")!="none"){if(formControlWidthOriginalmaxWidth)maxWidth=formControlWidthOriginal+fillerDivLeft;NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerWidth(fillerDiv,formControlWidthOriginal-fillerDivWidthOriginal,fillerDivWidthNew-fillerDivWidthOriginal);}}});if(container.height()=0;a--){var thisRepeaterControl=NWF$(allRepeaters[a]);var repeaterRows=NWF$(thisRepeaterControl.children('.nf-repeater-row'));if(repeaterRows.length>1){var totalRowHeights=0;var heightIncrease=0;for(var i=1;i0){currentControl.outerHeight(totalRowHeights,true);NWF.FormFiller.Functions.RepositionAndResizeOtherControlsAndContainerHeight(currentControl,-firstRowHeight,-currentChildControlHeightWithBorders);}}}},ResolvePeoplePickersOnForm:function(){var peoplepickerControlsOnForm=NWF$('.nf-people-picker');NWF$.each(peoplepickerControlsOnForm,function(){try{NWF$(this).trigger("blur");} catch(e){}});},Ready:function(){NWF$(".nf-filler-control").find('input').live('blur change',function(event){NWF.FormFiller.Functions.ChangeEventProcessedControls.length=0;NWF.FormFiller.Functions.FunctionsProcessed.length=0;NWF.FormFiller.Functions.PropagateEvent=true;if(event.originalEvent==undefined||event.originalEvent.toElement==null||NWF$(event.originalEvent.toElement).attr("commandtype")=="Cancel"){NWF.FormFiller.Functions.SuppressExceptions=true;} else{NWF.FormFiller.Functions.SuppressExceptions=false;} NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});NWF$(".nf-filler-control").find('select').live('change',function(event){NWF.FormFiller.Functions.ChangeEventProcessedControls.length=0;NWF.FormFiller.Functions.FunctionsProcessed.length=0;NWF.FormFiller.Functions.PropagateEvent=true;if(event.originalEvent==undefined||event.originalEvent.toElement==null||NWF$(event.originalEvent.toElement).attr("commandtype")=="Cancel"){NWF.FormFiller.Functions.SuppressExceptions=true;} else{NWF.FormFiller.Functions.SuppressExceptions=false;} NWF.FormFiller.Functions.ProcessOnChange(NWF$(this));});var attachmentControl=NWF$("#idAttachmentsRow").parent().parent().parent();AttachmentControlInitHeight=NWF$(attachmentControl).outerHeight();if(NWF.FormFiller.Functions.IsiPad()){ResizeWorkspace=true;} NWF$("#idAttachmentsTable").find("a").live({click:function(){var currentControl=NWF$("#idAttachmentsRow").parent().parent().parent();var controlHeight=NWF$(currentControl).outerHeight();if(AttachmentControlInitHeight0){for(var i in controlRules){NWF.FormFiller.Functions.ProcessRule(controlRules[i],NWF$(NWF$(".nf-filler-container")[0]));}} var controlfunctions=NWF.FormFiller.Functions.GetAssociatedFunctions(CalculationFunctions,"Control","");if(controlfunctions.length>0){for(var i in controlfunctions){NWF.FormFiller.Functions.CalculateFormula(controlfunctions[i],NWF$(NWF$(".nf-filler-container")[0]));}} var highlightControlError=function(control,errorMessage){errorMessage=NWF.Utilities.UnescapeString(errorMessage);if(!control.hasClass('nf-error-highlight')){control.addClass('nf-error-highlight');if(control.attr('oldtitle')===undefined){control.attr('oldtitle',control.attr('title'));} control.attr('title',errorMessage);}};var clearControlError=function(control){control.removeClass('nf-error-highlight');if(control.attr('oldtitle')!==undefined){control.attr('title',control.attr('oldtitle'));control.attr('oldtitle',"");}else{control.attr('title',"");}};NWF$('#aspnetForm').bind('submit',function(e){if(!NWF.FormFiller.Functions.SubmitInProgress){if(NWF$("input:focus").length==1){NWF$("input:focus").trigger("blur");} NWF.FormFiller.Functions.ResolvePeoplePickersOnForm();NWF$(".nf-disableonsubmit").css('filter','alpha(opacity = 40)');var errorDisplayed=false;if(typeof(Page_IsValid)!='undefined'&&!Page_IsValid&&typeof(Page_Validators)!='undefined'){NWF$.each(Page_Validators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);clearControlError(controlToValidate);if(typeof(this.controltocompare)!='undefined'){var controlToCompare=NWF$('#'+this.controltocompare);clearControlError(controlToCompare);}});NWF$.each(Page_Validators,function(){var controlToValidate=NWF$('#'+this.controltovalidate);if(!this.isvalid){highlightControlError(controlToValidate,this.errormessage);errorDisplayed=true;if(typeof(this.controltocompare)!='undefined'){var controlToCompare=NWF$('#'+this.controltocompare);highlightControlError(controlToCompare,this.errormessage);}}});if(ResizeWorkspace){NWF$("#s4-workspace").outerHeight(NWF$("#s4-mainarea").outerHeight());}} if(errorDisplayed){NWF$(".nf-disableonsubmit").css('filter','alpha(opacity = 100)');} else{NWF.FormFiller.Functions.SubmitInProgress=true;} if(typeof(RefreshCommandUI)!='undefined'){RefreshCommandUI();}}});this.SetFocusToFirstElement();}};}();RepeaterRowIndexClass="nf-repeater-rowIndex";RepeaterAddedRowPrefixesClass="nf-repeater-addeddrow-suffixes";NWF.FormFiller.Functions.AddedRowsCounter=0;ResizeWorkspace=false;NWF.FormFiller.Functions.SubmitInProgress=false;AttachmentControlInitHeight=0;CalculationFunctions=[];Rules=[];NWF.FormFiller.Functions.ChangeEventProcessedControls=[];NWF.FormFiller.Functions.FunctionsProcessed=[];NWF.FormFiller.Functions.PropagateEvent=true;NWF.FormFiller.Functions.SuppressExceptions=false;NWF.FormFiller.Functions.DecimalSymbol=".";NWF.FormFiller.Functions.ThousandSeparatorSymbol=",";NWF.FormFiller.Attachments.BlockedFileExtenstions=[];NWF.FormFiller.Attachments.MaximumFileSize=0;NWF$(function(){NWF.FormFiller.Functions.Ready();if(typeof(isTrial)!="undefined"&&isTrial){var trialDiv=NWF$("
");var trialImg=NWF$("");trialImg.attr({src:'/_layouts/NintexForms/Images/Trial.png',width:'59px',height:'60px'});trialDiv.addClass("trialDivFiller");trialImg.addClass("trialImg");NWF$(".nf-filler-container").append(trialDiv.append(trialImg));} if(typeof(isWorkflowForm)=="undefined"||!isWorkflowForm){NWF$('.ms-dialog #s4-workspace').addClass('overflowY');}});