").addClass("last").text(t("last")).button(),y=e.currentPage2?e.currentPage+2:4;s.append(u,v);for(var A=y;z>=A;A++)if(A>=0&&r>A){var B=l("
").text(A-0+1).attr("data-pn",A).button();A===e.currentPage&&B.addClass("nx-button-selected"),s.append(B)}s.append(w,x).buttonset(),s.children().filter('[data-pn="'+e.currentPage+'"]').button("disable"),0===e.currentPage?(u.button("disable"),v.button("disable")):e.currentPage==r-1&&(x.button("disable"),w.button("disable")),this.footerright.append(s),s.on("click",".ui-button",function(){var a=l(this);a.is(".first")?e.goToPage(0):a.is(".prev")?e.prevPage():a.is(".next")?e.nextPage():e.goToPage(a.is(".last")?r-1:parseInt(a.data("pn"),10))})}if(o&&"all"!=o&&n){var C=[5,10,25,50];-1==C.indexOf(e.options.pageSize)&&C.push(e.options.pageSize),-1==C.indexOf(e.currentPageSize)&&C.push(e.currentPageSize);var D=function(a,b){return a-b};C.sort(D);for(var E=l(""),F=0;F<C.length;F++)E.append(''+C[F]+"");E.children().filter('[value="'+o+'"]').attr("selected","selected"),E.change(function(){l.cookie("nx-page-"+a.page.id+"-"+e.model.id+"-ps",l(this).val()),e.currentPageSize=parseInt(l(this).val(),10),e.render()});var G=l("");G.append(""+t("show")+" ",E," "+a.label.merge(t("objects_per_page"),e.model.labelPlural)+""),this.footerleft.append(G)}var H=t("pagination_limit_reached"),I=e.model.debug===H,J=e.model.canRetrieveMoreRows===!0;if(n){var K=n+"";J&&(K+="+"),this.footercenter.append(""+a.label.merge(t("showing_rows"),p+1,q,K)+(I?" ("+H+")":"")+"")}if(J&&!I){var L=l('').text(t("load_more"));L.on("click.skuid",function(){e.blockUI({message:t("loading")}),e.model.loadNextOffsetPage(function(){e.unblockUI()})}),this.footerleft.append(L)}n||this.footercenter.append(""+a.label.merge(t("no_objects_to_display"),e.model.labelPlural)+"").css("line-height","25px"),b.doNotCache&&(l.each(e.renderedItems,function(a,b){b&&b.destroy()}),e.renderedItems={},e.makeConditionsBar()),e.beforeRender(j),e.visibleItems=[],b.destroyDeletedRows===!0&&l.each(e.renderedItems,function(a,b){!b||a in e.model.dataMap&&!(b.row&&"__deleted"in b.row)||(b.destroy(),delete e.renderedItems[a])}),l.each(d,function(){var a=this,c=e.renderedItems[a.Id];c&&!b.doNotCache?(b.resetItemModes===!0&&c.resetMode(),b.refreshFields!==!1&&(m&&m[a.Id]?c.refreshFields(m[a.Id]):c.refreshFields())):c=e.newItem(this,b),"__notdeleted"in this&&c.element.removeClass("deleted"),"__deleted"in this?c.element.addClass("deleted"):c.element.removeClass("deleted"),g.push(c.element),e.visibleItems.push(c)}),j.noAutoAppend||(e.contents.children().detach(),e.contents.append(g)),k&&e.attach(),e.renderComplete(j)},d.prototype.showRow=function(a){var b=this,c=!0;return b.conditions&&b.conditions.length&&(c=n.doesRowMeetConditions(a,b.conditions)),c},d.prototype.handleNewRow=function(a,b){var c=this,d={};if(b&&l.extend(d,b),a.Id&&!(a.Id in c.renderedItems)&&c.showRow(a)){var e=c.newItem(a,d);if(c.contents.prepend(e.element),c.render({resetPagination:!0,refreshFields:!1}),e&&"edit"===e.mode){var f=e.element.find(".nx-field > :input:visible:not(.nx-skootable-rowselect):not(.hasDatepicker):not(select)").first();f&&f.focus()}}},d.prototype.handleRowDeletion=function(a){a&&a in this.renderedItems&&this.renderedItems[a].destroy()},d.prototype.newItem=function(a,b){if(a.Id){var c=new e(this,a,{mode:b&&b.editModeForNewItems?"edit":this.mode,selected:b&&b.selected});return c.render(),this.renderedItems[a.Id]=c,c}},d.prototype.attach=function(){this.editor.contents.append(this.element,this.footer)},d.prototype.makeViewSwitcher=function(){var b=this,c=[];l.each(b.views,function(a,d){c.push({value:a,label:d.label||a,icon:d.icon,isSelected:b.currentView===a})});var d=l("").actionSelect({items:c,onItemSelect:function(c){var d=b.currentView;b.currentView=c.value,b.render({doNotCache:!0,previousView:d}),l.cookie("nx-list-view-"+a.page.name+"-"+b.model.id,c.value)}});return d.addClass("nx-viewswitcher")},d.prototype.makeSearchBox=function(){var a=this;if("client"===a.searchMethod&&(a.customFilter=function(b,c){var d=!1;return l.each(a.searchFields,function(e,f){var g=a.model.getFieldValue(c,f.id,!0);return null!==g&&(d=-1!=g.toLowerCase().indexOf(b.toLowerCase())),!d}),!d&&a.searchSubFields&&l.each(a.searchSubFields,function(e,f){var g=c[e];g&&g.totalSize&&f.length&&l.each(g.records,function(c,e){return l.each(f,function(c,f){var g=a.model.getFieldValue(e,f.id,!0);return null!==g&&(d=-1!==g.toLowerCase().indexOf(b.toLowerCase())),!d}),!d})}),d}),a.searchFields||"custom"===a.searchMethod){var b="placeholder"in document.createElement("input"),c=l(''),d=a.searchPlaceholderText?n.mergeAsText("model",a.searchPlaceholderText,{createFields:!0,registerFields:!1},a.model):t("search")+" "+a.model.labelPlural;a.customFilterValue&&c.val(a.customFilterValue),b?c.attr("placeholder",d):(c.addClass("unchanged").val(d),c.focus(function(){c.hasClass("unchanged")&&c.val("").removeClass("unchanged")}).blur(function(){""===c.val()&&c.val(d).addClass("unchanged")}));var e=a.model.getConditionByName(a.searchConditionName);return e&&"group"===e.type&&!e.inactive&&e.value&&c.val(e.value),a.options.delayFilterExecution&&c.on("keyup",function(b){13===b.which&&a.applyFiltersAndSearch()}),n.delayInputCallback(c,function(b,d){a.options.delayFilterExecution&&"undefined"==typeof c.data("originalValue")&&c.data("originalValue",d),"client"===a.searchMethod||"custom"===a.searchMethod?(a.customFilterValue=b,a.render()):a.options.delayFilterExecution?a.showFilterActions():(a.setSearchCondition(b),"remove"!==a.options.emptySearchBehavior||b?a.updateData({message:t("searching"),failmessage:t("error_performing_requested_search"),showerror:!0}):a.model.abandonAllRows())}),c}return!1},d.prototype.setSearchCondition=function(a){var b=this;b.model.buildSearchCondition(b.searchConditionName,a,b.searchFields,{tokenize:b.options.tokenizeSearch,useSOSLSearch:b.options.useSOSLSearch,SOSLFields:b.options.SOSLFields})},d.prototype.showFilterActions=function(){this.applyFiltersBtn.show("fast"),this.cancelFiltersBtn.show("fast"),this.editor.options.showSaveCancel&&this.editor.submitbuttons.hide("fast")},d.prototype.hideFilterActions=function(){this.applyFiltersBtn.hide("fast"),this.cancelFiltersBtn.hide("fast"),this.editor.options.showSaveCancel&&this.editor.submitbuttons.show("fast")},d.prototype.applyFiltersAndSearch=function(){var a,b=this,c=b.searchBox;c&&(a=c.is(".unchanged")?"":c.val(),c.data("originalValue",a),b.setSearchCondition(a)),b.filters&&l.each(b.filters,function(){var a=this.activateFilter;a&&a()}),"remove"!==b.options.emptySearchBehavior||a?b.updateData({message:t("searching"),failmessage:t("error_performing_requested_search"),showerror:!0,successcallback:function(){b.hideFilterActions()}}):(b.model.abandonAllRows(),b.hideFilterActions())},d.prototype.cancelFiltersAndSearch=function(){var a=this,b=a.searchBox;b&&b.val(b.data("originalValue")),a.filters&&l.each(a.filters,function(){this.restoreOriginalValue()}),a.hideFilterActions()},d.prototype.updateData=function(a){var b=this;b.blockUI({message:a.message});var c=b.model.updateData();l.when(c).then(function(){b.unblockUI(),a.successcallback&&a.successcallback()},function(c){b.unblockUI({failmessage:a.failmessage+(a.showerror&&c?"
"+t("error")+": "+c:"")})})},d.prototype.makeConditionsBar=function(){this.makeFiltersBar()},d.prototype.enableFiltersAndSearch=function(){var a,b=this;b.conditionsBar&&(a=b.conditionsBar.find(".nx-conditiontoken"),a.removeClass("unavailable"),a.children("select").multiselect("enable")),"server"===b.searchMethod&&b.searchBox&&b.searchBox.prop("disabled",!1)},d.prototype.disableFiltersAndSearch=function(){var a,b=this;b.conditionsBar&&(a=b.conditionsBar.find(".nx-conditiontoken"),a.addClass("unavailable"),a.children("select").multiselect("disable")),"server"===b.searchMethod&&b.searchBox&&b.searchBox.prop("disabled",!0)},d.prototype.blockUI=function(a){var b=this;a=a||{};var c={message:a.message};b.options.blockUICSS&&(c.css=b.options.blockUICSS),b.options.blockOverlayCSS&&(c.overlayCSS=b.options.blockOverlayCSS),b.editor.element.block(c)},d.prototype.unblockUI=function(a){var b=this;a=a||{};var c={};a.failmessage?(b.options.blockUICSS&&(c.css=b.options.blockUICSS),b.options.blockOverlayCSS&&(c.overlayCSS=b.options.blockOverlayCSS),c.timeout=a.timeout||4e3,c.message=a.failmessage,b.editor.element.block(c)):b.editor.element.unblock()},d.prototype.makeFiltersBar=function(){var a=this,b=a.options.listFilters;if(a.filters=[],!b)return!1;var c=a.conditionsBar;return c.empty(),l.each(b.children(),function(){var b=new g({xml:l(this),list:a});a.filters.push(b),b&&b.element&&c.append(b.element)}),c},d.prototype.nextPage=function(){this.currentPage++,this.render({refreshFields:!1})},d.prototype.prevPage=function(){this.currentPage--,this.render({refreshFields:!1})},d.prototype.goToPage=function(a){this.currentPage=a,this.render({refreshFields:!1})},e.prototype.id=function(){return this._GUID},e.prototype.render=function(){if(this.list&&this.list.views&&this.list.currentView){var a=this.list.views[this.list.currentView];this.element&&this.element.remove(),this.element=l("<"+(a.itemNodeType||"div")+">").addClass("nx-item"),this.element.data("object",this),a.render(this)}return this},e.prototype.refreshFields=function(a){var b=this;return l.each(b.fields,function(){(b.mode!==this.mode||!a||this.id in a)&&(this.mode=b.mode,this.render())}),b},e.prototype.resetMode=function(){return this.mode!==this.defaultMode&&(this.mode=this.defaultMode),this},e.prototype.toggleEdit=function(){return"readonly"!==this.mode&&(this.mode="read"==this.mode?"edit":"read",this.refreshFields()),this},e.prototype.toggleDelete=function(a){var b=this;return b.deleted?b.unMarkForDelete(a):b.markForDelete(a),b},e.prototype.handleUnmarkRowForDeletion=function(a){return!this.row||this.row!==a&&this.row.Id!=a.Id||this.unMarkForDelete(!1),this},e.prototype.handleMarkRowForDeletion=function(a){return!this.row||this.row!==a&&this.row.Id!=a.Id||this.markForDelete(!1),this},e.prototype.unMarkForDelete=function(a){return this.element.removeClass("deleted"),this.deleted=!1,a&&this.list.model.undeleteRow(this.row),this},e.prototype.markForDelete=function(a){return this.element.addClass("deleted"),this.deleted=!0,a&&this.list.model.deleteRow(this.row),this},e.prototype.registerField=function(a){this.fields.push(a)},e.prototype.unregister=function(){var a=this;return a.list&&a.list.model&&a.list.model.unregisterItem(this),a.fields&&a.fields.length&&l.each(a.fields,function(){this.destroy()}),a},e.prototype.destroy=function(){this.element&&this.element.remove(),this.unregister()},f.prototype.uid=function(){return this._GUID},f.prototype.register=function(a){return this.model&&this.model.registerField(this,a),this},f.prototype.unregister=function(){var a=this,b=a.options;a.model&&a.model.unregisterField(a,b?b.controllingFields:!1)},f.prototype.calculateReferenceText=function(){return n.calculateReferenceText({model:this.model,row:this.row,template:this.options.template,fieldMetadata:this.metadata})},f.prototype.calculateReferenceMerges=function(a){return a||(a={}),n.calculateReferenceMerges(l.extend(a,{model:this.model,row:this.row,template:this.options.template,fieldMetadata:this.metadata}))},f.prototype.getValidPicklistEntries=function(){var a,b,c=n.toArray,d=this,e=d.item,f=this.metadata.controllingField,g=function(a,b){var c=new sforce.Base64Binary(""),d=c.decode(b),e=d.charCodeAt(a>>3);return 0!==(e&128>>a%8)},h=e&&e.ValidRecordTypeIds?e.ValidRecordTypeIds:[],i=d.model.getFieldValue(d.row,"RecordTypeId",!0);if(i&&-1===l.inArray(i,h)&&h.push(i),h.length&&(a=n.getPicklistEntriesValidForRecordTypes(this.model.objectName,d.id,h)),f){var j,k,m=n.getAPIDescribeSObject(this.model.objectName);if(m&&(l.each(c(m.fields),function(){return d.id===this.name?j=this:d.metadata.controllingField===this.name&&(k=this),j&&k?!1:void 0}),j&&k)){var o,p=d.model.getFieldValue(d.row,f,!0);a&&a.length?(b={},l.each(a,function(){b[this.value]=1}),a.length=0):a=[],"boolean"===k.type?o=p?1:0:l.each(c(k.picklistValues),function(a){this.value===p&&(o=a)}),(o||0===o)&&l.each(c(j.picklistValues),function(){g(o,this.validFor)&&(!b||this.value in b)&&a.push(this)})}}return a?a:this.metadata.picklistEntries},f.prototype.addOrReplaceConditionsForLookupFiltersToModel=function(b){var c=this,d=[],e=c.options&&c.options.filters?c.options.filters:!1;return b||(b=c.model),e&&e.length&&l.each(e,function(e,f){var g,h,i=c.id+"_"+f.field+"_"+e,j=b.getConditionByName(i);if(j||(j=new a.model.Condition,j.name=i,b.addCondition(j)),j.field=f.field,j.operator=f.operator||"=",j.encloseValueInQuotes=f.encloseValueInQuotes,g=n.isMultiValueOperator(j.operator),"dependent"===f.type)h=c.model.getFieldValue(c.row,f.depfield,!0),"undefined"!=typeof h&&(g?j.values=h&&-1!=h.indexOf(";")?h.split(";"):[h]:j.value=h),j.type="fieldvalue";else if("param"===f.type)h=a.page.params[f.mergeField],"undefined"!=typeof h&&(g?j.values=h&&-1!=h.indexOf(";")?h.split(";"):[h]:j.value=h),j.type="fieldvalue";else if("modelmerge"===f.type){var k=a.model.getModel(f.mergeModel);k&&(g?(j.values=[],l.each(k.data,function(){j.values.push(k.getFieldValue(this,f.mergeField,!0))})):j.value=k.getFieldValue(k.getFirstRow(),f.mergeField,!0),j.type="fieldvalue")}else j.type=f.type,f.values?j.values=f.values:j.value=f.value,f.mergeField&&(j.mergeField=f.mergeField,j.originalValue=null);d.push(j)}),d};var y=function(a){if(a&&a.length){var b=[];return a.children().each(function(){var a=l(this),c="false"!==a.attr("enclosevalueinquotes"),d={field:a.attr("field"),type:a.attr("type"),operator:a.attr("operator"),value:a.attr("value"),depfield:a.attr("depfield"),encloseValueInQuotes:c};if("multiple"==d.type){d.values=[];var e=a.children("values");e.length&&e.first().children("value").each(function(){var a=n.getXML(this);a.length>8?(a=n.decodeXML(a.substring(7,a.length-8)),d.values.push(n.adjustValueBasedOnQuotedness(a,c))):d.values.push("")})}else"userinfo"==d.type?d.mergeField=a.attr("userinfotype"):"param"===d.type?d.mergeField=a.attr("value"):"modelmerge"===d.type&&(d.mergeField=a.attr("mergefield"),d.mergeModel=a.attr("model"));b.push(d)}),b}};g.prototype.setOriginalValue=function(a){"undefined"==typeof this.element.data("originalValue")&&this.element.data("originalValue",a)},g.prototype.restoreOriginalValue=function(){var a=this,b=a.element,c=b.data("originalValue");if(a.isMultiselect&&!a.isReferenceFilter){if(b=b.find("select"),"__reset"===c)b.val("");else if(c){var d=c.split(";");l.each(b.children("option"),function(a,b){l(b).prop("selected",l.inArray(b.value,d)>-1)})}b.data("echMultiselect")&&b.multiselect("refresh")}else"undefined"!=typeof c&&("toggle"===a.type?b.toggleClass("disabled",c):"daterange"===a.type?a.updateDisplayValue(c.start,c.end):a.isReferenceFilter?b.actionAutocomplete("resetItem",c):c&&"undefined"!=typeof c.value&&(a.element.is(".nx-actionautocomplete")?b.actionAutocomplete("resetItem",c.value):b.actionSelect("selectItem",c,{triggerHandlers:!1})))},g.prototype.isSelectedFromEffects=function(b){var c=this,d=!1;return b.each(function(){var b=l(this),e=c.affectedConditions[b.attr("condition")];if(e)if("deactivate"===b.attr("action")){if(!e.inactive)return d=!1,!1}else if("set"===b.attr("action")){var f=a.utils.mergeAsText("global",b.attr("value")||"",{createFields:!0,registerFields:!1});if(f!==e.value||e.inactive)return d=!1,!1}else if("activate"===b.attr("action")&&e.inactive)return d=!1,!1;d=!0}),d},g.prototype.resetAffectedConditions=function(){var a=this;l.each(a.affectedConditions,function(){a.model.resetCondition(this,a.affectCookies)})},g.prototype.applyFilterForItem=function(b){var c,d=this,e=[],f=b.effects,g=b.source,h=g&&g.effects,i=b.affectDefaultCondition;if(f&&f.length&&l.each(f,function(){e.push(this)}),h&&h.length&&l.each(h,function(){e.push(this)}),c=e&&e.length,c&&l.each(e,function(){var c=l(this),e=d.affectedConditions[c.attr("condition")];if(e)if("deactivate"===c.attr("action"))d.model.deactivateCondition(e,d.affectCookies);else if("set"===c.attr("action")){var f,h={};b.row&&(h.row=b.row),g&&g.model&&(h.model=g.model),c.attr("value")?f=c.attr("value"):b.value&&(f=b.value),f=a.utils.mergeAsTextInContext(f,h,{createFields:!1,registerFields:!1}),d.model.setCondition(e,f,d.affectCookies)}else"activate"===c.attr("action")&&d.model.activateCondition(e,d.affectCookies)}),i&&"undefined"!=typeof b.value&&d.filterCondition)