﻿(function () { var a = false, b = /xyz/.test(function () { xyz() }) ? /\b_super\b/ : /.*/; this.Class = function () { }; Class.extend = function (c) { var f = this.prototype, h, g; a = true; h = new this(); a = false; function e(j, i) { return function () { var k = this._super, l; this._super = f[j]; l = i.apply(this, arguments); this._super = k; return l } } for (g in c) { if (c.hasOwnProperty(g)) { h[g] = typeof c[g] === "function" && typeof f[g] === "function" && b.test(c[g]) ? e(g, c[g]) : c[g] } } function d() { if (!a && this.init) { this.init.apply(this, arguments) } } d.prototype = h; d.constructor = d; d.extend = arguments.callee; return d } } ()); (function (a) { a.fn.startsWith = function (b) { return !this[0].innerHTML.indexOf(b) }; a.ig = a.ig || {}; a.ajaxQueue = function (b, d) { var c; if (typeof document.ajaxQueue === "undefined") { document.ajaxQueue = { queue: {}} } if (typeof document.ajaxQueue.queue[b] === "undefined") { document.ajaxQueue.queue[b] = [] } if (typeof d === "undefined") { return } c = d.complete; d.complete = function (e, f) { document.ajaxQueue.queue[b].shift(); if (typeof c !== "undefined") { c(e, f) } if (document.ajaxQueue.queue[b].length > 0) { a.ajax(document.ajaxQueue.queue[b][0]) } }; document.ajaxQueue.queue[b].push(d); if (document.ajaxQueue.queue[b].length === 1) { a.ajax(document.ajaxQueue.queue[b][0]) } }; a.ig.formatter = function (c, D, b) { var q, G, u, z, p, B, j, F, H, l, A, E, C, x, g, f, r, I, w, o, v, k = c && c.getTime, t = a.ig.regional.defaults; if (b === "bool") { return c ? "ui-icon-check" : "ui-iggrid-checkboxempty" } if (!c && c !== 0 && c !== false) { return "&nbsp;" } if (D === "date" || k) { if (!c) { return "&nbsp;" } if (!k) { return c } if (!(H = t[(b && b !== "null" && b !== "undefined") ? b + "Pattern" : "datePattern"])) { H = b } G = c.getFullYear(); z = c.getMonth() + 1; k = c.getDate(); u = c.getHours(); q = c.getMinutes(); p = c.getSeconds(); B = c.getMilliseconds(); H = H.replace("MMMM", "\x01").replace("MMM", "\x02").replace("dddd", "\x03").replace("ddd", "\x04"); if (H.indexOf("t") >= 0) { if (!(j = (u >= 12) ? t.pm : t.am)) { j = " " } if (H.indexOf("tt") >= 0) { H = H.replace("tt", "t") } else { if (j.length > 1) { j = j.substring(0, 1) } } H = H.replace("t", "\x05") } if (H.indexOf("h") >= 0 && u > 12) { u -= 12 } H = H.replace(/H/g, "h"); H = H.replace("yyyy", G).replace("yy", ((G = G % 100) < 10) ? "0" + G : G).replace("y", G % 100).replace("MM", (z < 10) ? "0" + z : z).replace("M", z); H = H.replace("dd", (k < 10) ? "0" + k : k).replace("d", k); H = H.replace("hh", (u < 10) ? "0" + u : u).replace("h", u).replace("mm", (q < 10) ? "0" + q : q).replace("m", q).replace("ss", (p < 10) ? "0" + p : p).replace("s", p); H = H.replace("fff", (B < 10) ? "00" + B : ((B < 100) ? "0" + B : B)).replace("ff", ((B = Math.round(B / 10)) < 10) ? "0" + B : B).replace("f", Math.round(B / 100)); H = H.replace("\x01", t.monthNames[z - 1]).replace("\x02", t.monthNamesShort[z - 1]).replace("\x05", j); H = H.replace("\x03", t.dayNames[c.getDay()]).replace("\x04", t.dayNamesShort[c.getDay()]); return H } if (!(k = b === "double")) { if (!(I = b === (f = "currency"))) { if (!(w = b === (r = "percent"))) { v = b === "int" } } } A = typeof c === "number"; if (k || A || v || I || w || D === "number") { if (!A) { c = parseFloat(c.replace("(", "-").replace(/[^0-9\-eE\.\+]/gm, "")) } if (isNaN(c)) { return "&nbsp;" } o = I ? f : (w ? r : "numeric"); if (!(H = t[o + ((c < 0) ? "Negative" : "Positive") + "Pattern"])) { H = "n" } l = b ? b.length : 0; if (l > 0 && ((p = b.charAt(0)) === "0" || p === "#")) { q = z = 0; E = b.indexOf("."); if (E > 0) { z = l - 1 - E; while (++E < l) { if (b.charAt(E) !== "0") { break } q++ } } } else { if (!(q = t[o + "MinDecimals"])) { q = 0 } if (k) { z = 999 } else { z = t[o + "MaxDecimals"]; z = (z && !v) ? z : 0 } } if (c < 0) { c = -c } c = (z === 999) ? c.toString(10) : c.toFixed(z); if ((v = c.indexOf("E")) < 0) { v = c.indexOf("e") } F = ""; if (v > 0) { F = c.substring(v); c = c.substring(0, v) } E = c.indexOf("."); l = c.length; v = 0; while (E > 0 && z > q + v && c.charAt(l - 1 - v) === "0") { v++ } if (v > 0) { c = c.substring(0, l -= v) } if (E === l - 1) { c = c.substring(0, E) } if (E > 0) { l = E } p = t[o + "DecimalSeparator"]; if (p) { c = c.replace(".", p) } p = t[o + "GroupSeparator"]; g = p ? t[o + "Groups"] : ""; C = x = (g.length > 0) ? g[v = 0] : 0; while (C > 0 && --l > 0) { if (--C === 0) { c = c.substring(0, l) + p + c.substring(l); if (!(C = g[++v]) || C < 1) { C = x } else { x = C } } } if (!(p = t[o + "Symbol"])) { p = "" } return H.replace("-", t.negativeSign).replace("n", c + F).replace("$", p) } if (b) { if (b.indexOf(p = "{0}") >= 0) { return b.replace(p, c) } if (b.indexOf(p = "[0]") >= 0) { return b.replace(p, c) } } return (c || c === 0) ? c : "&nbsp;" }; a.ig._regional = { monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], am: "AM", pm: "PM", datePattern: "M/d/yyyy", dateLongPattern: "dddd, MMMM dd, yyyy", dateTimePattern: "M/d/yyyy h:mm tt", timePattern: "h:mm tt", timeLongPattern: "h:mm:ss tt", negativeSign: "-", numericNegativePattern: "-$n", numericDecimalSeparator: ".", numericGroupSeparator: ",", numericGroups: [3], numericMaxDecimals: 2, numericMinDecimals: 0, currencyPositivePattern: "$n", currencyNegativePattern: "$(n)", currencySymbol: "$", currencyDecimalSeparator: ".", currencyGroupSeparator: ",", currencyGroups: [3], currencyMaxDecimals: 2, currencyMinDecimals: 2, percentPositivePattern: "n$", percentNegativePattern: "-n$", percentSymbol: "%", percentDecimalSeparator: ".", percentGroupSeparator: ",", percentGroups: [3], percentDisplayFactor: 100, percentMaxDecimals: 2, percentMinDecimals: 2 }; a.ig.regional = { defaults: a.ig._regional }; a.ig.setRegionalDefault = function (b) { if (a.ui.igEditor) { a.ui.igEditor.setDefaultCulture(b) } else { a.ig.regional.defaults = a.extend(a.ig._regional, (typeof b === "string") ? a.ig.regional[b] : b) } } } (jQuery)); String.prototype.startsWith = function (a) { return this.indexOf(a) === 0 }; String.prototype.endsWith = function (a) { var b = this.length - a.length; return b >= 0 && this.lastIndexOf(a) === b }; Array.prototype.remove = function (c, a) { var b = this.slice((a || c) + 1 || this.length); this.length = c < 0 ? this.length + c : c; return this.push.apply(this, b) }; (function ($) { $.ig = $.ig || {}; $.ig.DataSource = $.ig.DataSource || Class.extend({ settings: { id: "ds", outputResultsName: null, callback: null, callee: null, data: [], dataSource: null, dataBinding: null, dataBound: null, type: "unknown", schema: null, primaryKey: null, responseTotalRecCountKey: null, responseDataKey: null, responseDataType: null, responseContentType: null, localSchemaTransform: true, urlParamsEncoding: null, urlParamsEncoded: null, paging: { enabled: false, type: "remote", pageSize: 5, pageSizeUrlKey: null, pageIndexUrlKey: null, pageIndex: 0 }, filtering: { type: "remote", caseSensitive: false, applyToAllData: true, customFunc: null, filterExprUrlKey: null, filterLogicUrlKey: "filterLogic", expressions: [], exprString: "" }, sorting: { defaultDirection: "none", defaultFields: [], applyToAllData: true, customFunc: null, compareFunc: null, customConvertFunc: null, type: "remote", caseSensitive: false, sortUrlKey: null, sortUrlAscValueKey: null, sortUrlDescValueKey: null, expressions: [], exprString: "" }, fields: [], serializeTransactionLog: true, autoCommit: false, updateUrl: null }, init: function (options) { if (options) { this.settings = $.extend(true, {}, $.ig.DataSource.prototype.settings, options) } this.settings.paging.pageIndex = 0; this._isBound = false; this._url = null; this._dsCallback = null; this._data = []; this._dataView = []; if (this.settings.type === "unknown") { this._runtimeType = this.analyzeDataSource() } else { this._runtimeType = this.settings.type } this._parser = new $.ig.TypeParser(); this._schema = null; this._isSortingReq = false; this._isFilteringReq = false; this._isPagingReq = false; this._recCount = 0; this._hasCount = false; this._initSchema(); this._filteredDataView = []; this._transactionLog = []; this._accumulatedTransactionLog = []; return this }, _initSchema: function () { if (this.settings.schema) { if (this.settings.schema instanceof $.ig.DataSchema) { this._schema = this.settings.schema } else { if (this.settings.type !== "unknown") { this._schema = new $.ig.DataSchema(this.settings.type, this.settings.schema) } else { this._schema = new $.ig.DataSchema(this._runtimeType, this.settings.schema) } } } }, fields: function (fields) { if (fields === undefined || fields === null) { return this.settings.fields } else { this.settings.fields = fields; return this } }, analyzeDataSource: function () { var ds = this.dataSource(), $ds, dc; if (ds === undefined || ds === null) { return "empty" } else { if ($.type(ds) === "function") { return "function" } else { if ($.type(ds) === "array") { return "array" } else { if ($.type(ds) === "number" || $.type(ds) === "boolean" || $.type(ds) === "date") { return "invalid" } else { if ($.type(ds) === "string") { ds = $.trim(ds); if (ds.startsWith("/")) { return "remoteUrl" } $ds = $(ds); if ($("#" + this.settings.id).length > 0 && ds.toLowerCase().startsWith("<table")) { return "htmlTableString" } if (ds.toLowerCase().startsWith("<table")) { dc = "<div id='" + this.settings.id + "' style='display:none;visibility:hidden;'>" + ds + "</div>"; $(dc).appendTo($("body")); return "htmlTableString" } if (!ds.startsWith("[") && !ds.startsWith("{") && !ds.startsWith("<")) { if (!ds.startsWith("http://") && $("#" + ds).length > 0 && $("#" + ds)[0].nodeName.toLowerCase() === "table") { return "htmlTableId" } this._url = ds; return "remoteUrl" } return "unknown" } else { if (ds.nodeName && ds.nodeName.toLowerCase() === "table") { return "htmlTableDom" } else { return "unknown" } } } } } } }, dataView: function () { return this._dataView }, data: function () { return this._data }, schema: function (s, t) { if (s === undefined || s === null) { return this._schema } else { if (s instanceof $.ig.DataSchema) { this._schema = s } else { if (t === null || t === undefined) { this._schema = new $.ig.DataSchema(s.type, s) } else { this._schema = new $.ig.DataSchema(t, s) } } return this } }, pagingSettings: function (p) { if (p === undefined || p === null) { return this.settings.paging } else { this.settings.paging = p; return this } }, filterSettings: function (f) { if (f === undefined || f === null) { return this.settings.filtering } else { this.settings.filtering = f; return this } }, sortSettings: function (s) { if (s === undefined || s === null) { return this.settings.sorting } else { this.settings.sorting = s; return this } }, dataSource: function (ds) { if (ds === undefined || ds === null) { return this.settings.dataSource } else { this.settings.dataSource = ds; this.analyzeDataSource(); return this } }, type: function (t) { if (t === undefined || t === null) { return this._runtimeType } else { this.settings.type = t; return this } }, findRecordByKey: function (key) { var i; for (i = 0; i < this._data.length; i++) { if (this._data[i][this.settings.primaryKey] === key) { return this._data[i] } } return null }, removeRecordByKey: function (key) { var i; for (i = 0; i < this._data.length; i++) { if (this._data[i][this.settings.primaryKey] === key) { this._data.remove(i); return } } }, setCellValue: function (rowId, colId, val, autoCommit) { var t = this._createCellTransaction(rowId, colId, val); this._addTransaction(t); if (autoCommit === true) { this.commit(rowId) } return t }, updateRow: function (rowId, rowObject, autoCommit) { var t = this._createRowTransaction(rowId, rowObject); this._addTransaction(t); if (autoCommit === true) { this.commit(rowId) } return t }, addRow: function (rowId, rowObject, autoCommit) { var t = this._createNewRowTransaction(rowId, rowObject); this._addTransaction(t); if (autoCommit === true) { this.commit(rowId) } return t }, deleteRow: function (rowId, autoCommit) { var t = this._createDeleteRowTransaction(rowId); this._addTransaction(t); if (autoCommit === true) { this.commit(rowId) } }, getDetachedRecord: function (t) { var o = $.type(this._data[0]) === "array" ? [] : {}, i, originalRec; if (this.settings.primaryKey === null) { originalRec = this._data[parseInt(t.rowId, 10)] } else { originalRec = this.findRecordByKey(t.rowId) } if (this._data[0] !== "array") { for (i in originalRec) { if (originalRec.hasOwnProperty(i)) { o[i] = originalRec[i] } } } else { for (i = 0; i < originalRec.length; i++) { o[i] = originalRec[i] } } if (t.type === "cell") { o[t.col] = t.value; return o } else { if (o !== "array") { for (i in t.row) { if (t.row.hasOwnProperty(i)) { o[i] = t.row[i] } } } else { for (i = 0; i < t.row.length; i++) { o[i] = t.row[i] } } return o } }, commit: function (id) { var i = 0; if (id !== null && id !== undefined) { this._commitTransactionsByRowId(id) } else { for (i = 0; i < this._transactionLog.length; i++) { this._commitTransaction(this._transactionLog[i]) } } }, rollback: function (id) { var i; if (id !== null && id !== undefined) { this._rollbackTransactionsByRowId(id) } else { for (i = 0; i < this._transactionLog.length; i++) { this._rollbackTransaction(this._transactionLog[i]) } } }, pendingTransactions: function () { return this._transactionLog }, allTransactions: function () { return this._accumulatedTransactionLog }, _createCellTransaction: function (rowId, colId, val) { return { type: "cell", rowId: rowId, tid: this._generateTransactionId(), col: colId, value: val} }, _createRowTransaction: function (rowId, rowObject) { return { type: "row", tid: this._generateTransactionId(), row: rowObject, rowId: rowId} }, _createNewRowTransaction: function (rowId, rowObject) { return { type: "newrow", tid: this._generateTransactionId(), row: rowObject, rowId: rowId} }, _createDeleteRowTransaction: function (rowId) { return { type: "deleterow", tid: this._generateTransactionId(), rowId: rowId} }, _addTransaction: function (t) { this._transactionLog.push(t); this._accumulatedTransactionLog.push(t) }, _removeTransactionByTransactionId: function (tid, removeFromAll) { var i; for (i = 0; i < this._transactionLog.length; i++) { if (this._transactionLog[i].tid === tid) { this._transactionLog.remove(i); break } } if (removeFromAll === true) { for (i = 0; i < this._accumulatedTransactionLog.length; i++) { if (this._accumulatedTransactionLog[i].tid === tid) { this._accumulatedTransactionLog.remove(i); break } } } }, _removeTransactionsByRecordId: function (id) { var i; for (i = 0; i < this._transactionLog.length; i++) { if (this._transactionLog[i].rowId === id) { this._transactionLog.remove(i); break } } }, _commitTransaction: function (t) { var i, prop, rec; if (this.settings.primaryKey === null) { rec = this._data[parseInt(t.rowId, 10)] } else { rec = this.findRecordByKey(t.rowId) } if (t.type === "cell") { rec[t.col] = t.value } else { if (t.type === "row") { if ($.type(t.row) === "array") { for (i = 0; i < t.row.length; i++) { rec[i] = t.row[i] } } else { for (prop in t.row) { if (t.row.hasOwnProperty(prop)) { rec[prop] = t.row[prop] } } } } else { if (t.type === "deleterow") { if (this.settings.primaryKey === null) { this._data.remove(parseInt(t.rowId, 10)) } else { this.removeRecordByKey(t.rowId) } } else { if (t.type === "newrow") { this._data.push(t.row) } } } } this._removeTransactionByTransactionId(t.tid) }, _rollbackTransaction: function (t) { this._removeTransactionByTransactionId(t.tid, true) }, _commitTransactionsByRowId: function (id) { var i; for (i = 0; i < this._transactionLog.length; i++) { if (this._transactionLog[i].rowId === id) { this._commitTransaction(this._transactionLog[i]) } } }, _rollbackTransactionsByRowId: function (id) { var i; for (i = 0; i < this._transactionLog.length; i++) { if (this._transactionLog[i].rowId === id) { this._rollbackTransaction(this._transactionLog[i]) } } }, transactionsAsString: function () { return JSON.stringify(this._accumulatedTransactionLog) }, _generateTransactionId: function () { return ((1 + Math.random()) * parseInt("10000", 16)).toString(16).substring(1, 5) }, saveChanges: function () { if (this.settings.updateUrl !== null) { $.post(this.settings.updateUrl, { ig_transactions: JSON.stringify(this._accumulatedTransactionLog) }) } }, dataBind: function (callback, callee) { var table, tableObj, dsObj, s, p = this.settings, args, ds, resKey, resPath, key, totalRecPath, noCancel = true, i, rec; this._transactionLog = []; this._accumulatedTransactionLog = []; if (!callback) { callback = p.callback } args = { cancel: false }; if ($.isFunction(p.dataBinding)) { noCancel = p.dataBinding(this, args); if (noCancel === undefined) { noCancel = true } } if (noCancel) { if (this.settings.type === "unknown" && (this._runtimeType === null || this._runtimeType === undefined)) { this._runtimeType = this.analyzeDataSource() } switch (this._runtimeType) { case "function": this._data = p.dataSource(); if (this.schema()) { this._data = this.schema().transform(this._data) } break; case "array": if (this.schema() && this.settings.localSchemaTransform) { this._data = this.schema().transform(this.dataSource()) } else { this._data = this.dataSource() } break; case "htmlTableDom": case "htmlTableId": case "htmlTableString": this._runtimeType = this.analyzeDataSource(); if (this._runtimeType === "htmlTableId") { tableObj = $("#" + this.dataSource()); table = this._validateTable(tableObj) } else { if (this._runtimeType === "htmlTableString") { tableObj = $("#" + this.settings.id + " > table"); table = this._validateTable(tableObj) } else { table = this.dataSource() } } if (this.schema()) { this._data = this.schema().transform(table) } else { this._data = this.tableToObject(table) } break; case "invalid": throw new Error($.ig.DataSource.locale.invalidDataSource); case "unknown": case "json": case "xml": if (this.settings.type !== "json" && p.type !== "xml") { throw new Error($.ig.DataSource.locale.unknownDataSource) } else { if ($.type(this.dataSource()) === "string") { if (p.type === "json") { dsObj = this.stringToJSONObject(this.dataSource()) } else { dsObj = this.stringToXmlObject(this.dataSource()) } } else { dsObj = this.dataSource() } if (this.schema() && this.settings.localSchemaTransform === true) { this._data = this.schema().transform(dsObj) } else { if ((!this.schema() || this.settings.localSchemaTransform === false) && p.type === "json") { resKey = this.settings.responseDataKey; if (resKey !== null && resKey !== undefined) { resPath = resKey.split("."); if (resPath.length > 0) { this._data = dsObj; for (i = 0; i < resPath.length; i++) { this._data = dsObj[resPath[i]] } } else { this._data = dsObj } } else { this._data = dsObj } } else { if (!this.schema() && p.type === "xml") { throw new Error($.ig.DataSource.locale.errorXmlSourceWithoutSchema) } } } key = this.settings.responseTotalRecCountKey; if (key) { totalRecPath = key.split("."); rec = dsObj; for (i = 0; i < totalRecPath.length; i++) { rec = rec[totalRecPath[i]] } if (rec) { if ($.type(rec) === "number") { this.totalRecordsCount(rec) } else { this.totalRecordsCount(parseInt(rec, 10)) } this.hasTotalRecordsCount(true) } else { this.hasTotalRecordsCount(false) } } else { this.hasTotalRecordsCount(false) } } break; case "remoteUrl": this._remoteData(callback, callee); break; case "empty": this._data = []; this._dataView = []; break; default: break } this._dataView = this._data; this._filter = false; s = p.sorting; if (s.type === "local" && this._runtimeType !== "remoteUrl" && s.defaultFields.length > 0) { this.sort(s.defaultFields, s.defaultDirection, false) } if (p.paging.enabled && p.paging.type === "local" && this._runtimeType !== "remoteUrl") { this._page() } ds = this; if (this._runtimeType !== "remoteUrl") { this._invokeCallback(callee, callback) } if ($.isFunction(p.dataBound) && !args.cancel) { p.dataBound(this) } } return this }, _invokeCallback: function (callee, callback) { var cbResolved, calleeResolved; cbResolved = callback ? callback : this.settings.callback; calleeResolved = callee ? callee : this.settings.callee; if (cbResolved) { if (calleeResolved) { cbResolved.apply(calleeResolved, [true, "", this]) } else { cbResolved(true, "", this) } } }, _remoteData: function (callback, callee) { var params, url = this.settings.dataSource, dataType = this.settings.responseDataType, contentType = this.settings.responseContentType, options; params = this._encodeUrl(); if (callback) { this._customCallback = callback } else { this._customCallback = null } this._callee = callee; options = { url: url, data: params, dataType: dataType, async: true, context: this, contentType: contentType, cache: false, dataFilter: this._dataFilter, success: this._successCallback, complete: this._completeCallback, error: this._errorCallback }; this._processRequest(options) }, _dataFilter: function (data, type) { var ds, schema = this.context.schema(), rawData, t = this.context.settings.type, ver; if (type === undefined) { type = "text" } if (type === "xml") { schema._type = "xml"; ds = this.context._processXmlResponse(data, this.context) } else { if (type === "json") { if (schema) { schema._type = "json" } if ($.type(data) === "string") { rawData = JSON.parse(data) } else { rawData = data } ds = this.context._processJsonResponse(rawData, this.context) } else { if (jQuery.fn.jquery) { ver = jQuery.fn.jquery.split(".") } if (ver && ver.length >= 2) { if (parseInt(ver[1], 10) > 4 || parseInt(ver[0], 10) > 1) { this.dataTypes = []; this.dataTypes.push("text") } } data = $.type(data) === "string" ? $.trim(data) : data; if ((data && $.type(data) === "string" && (data.startsWith("<?xml") || data.startsWith("<"))) || t === "xml") { if (schema) { schema._type = "xml" } ds = this.context._processXmlResponse(this.context.stringToXmlObject(data), false, this.context) } else { if ((data && $.type(data) === "string" && data.startsWith("[")) || (t === "json" || t === "array")) { if (schema) { schema._type = "json" } ds = this.context._processJsonResponse(JSON.parse(data), this.context) } else { if ((data && $.type(data) === "string" && data.startsWith("{")) || t === "json") { if (schema) { schema._type = "json" } ds = this.context._processJsonResponse(JSON.parse(data), this.context) } else { if ($.isXMLDoc(data)) { if (schema) { schema._type = "xml" } ds = this.context._processXmlResponse(data, true, this.context) } else { if (data !== "" && data !== null) { throw new Error($.ig.DataSource.locale.errorUnrecognizedResponseType) } } } } } } } return ds }, _successCallback: function (data) { if (data === undefined || data === null) { this._data = []; this._dataView = [] } else { this._data = data; this._dataView = data } this._isPagingReq = false; this._isFilteringReq = false; this._isSortingReq = false }, _errorCallback: function (req, status, error) { var f = this._customCallback ? this._customCallback : this.settings.callback, errmsg; this._isPagingReq = false; this._isFilteringReq = false; this._isSortingReq = false; errmsg = $.ig.DataSource.locale.errorRemoteRequest + " (" + status + ") " + (error !== undefined ? error.message : req && req.statusText ? req.statusText : ""); if (f && this._callee) { f.apply(this._callee, [false, errmsg, this]) } else { if (f) { f(false, errmsg, this) } } }, _completeCallback: function (req, status) { var f, callee, s = this.settings.sorting, p = this.settings.paging; if (s.type === "local" && s.defaultDirection !== "none") { this.sort(s.defaultFields, s.defaultDirection, false) } if (p.enabled && p.type === "local") { this._page() } f = this._customCallback ? this._customCallback : this.settings.callback; callee = this._callee ? this._callee : this.settings.callee; if (f && callee) { f.apply(callee, [true, "", this]) } else { if (f) { f(true, "", this) } } }, _processRequest: function (options) { if (this.settings.responseDataType === "jsonp") { $.getJSON(options.url, options.data, $.proxy(this._jsonpFilter, this)) } else { $.ajax(options) } }, _jsonpFilter: function (data, type) { var resp; this.context = this; resp = this._dataFilter(data, "json"); this._data = resp; this._dataView = resp; this._completeCallback() }, _processJsonResponse: function (data, context) { var ds, schema = context.schema(), resKey, key, resPath, i, totalRecPath, rec; if (schema && schema.fields && schema.fields().length > 0 && this.settings.localSchemaTransform) { ds = schema.transform(data) } else { resKey = context.settings.responseDataKey; if (resKey !== null && resKey !== undefined) { resPath = resKey.split("."); if (resPath.length > 0) { ds = data; for (i = 0; i < resPath.length; i++) { ds = ds[resPath[i]] } } else { ds = data } } else { ds = data } } if (context._isPagingReq || context._isFilteringReq) { key = context.settings.responseTotalRecCountKey; if (key) { totalRecPath = key.split("."); rec = data; for (i = 0; i < totalRecPath.length; i++) { rec = rec[totalRecPath[i]] } if (data && rec) { if ($.type(rec) === "number") { context.totalRecordsCount(rec) } else { context.totalRecordsCount(parseInt(rec, 10)) } this.hasTotalRecordsCount(true) } else { this.hasTotalRecordsCount(false) } } else { this.hasTotalRecordsCount(false) } } return ds }, _processXmlResponse: function (data, isParsed, context) { var ds, schema = context.schema(), tmpSchema, resKey; if (schema && schema.fields && schema.fields().length > 0) { ds = this.settings.localSchemaTransform ? schema.transform(data) : data } else { resKey = context.settings.responseDataKey; if (resKey && resKey !== "") { tmpSchema = new $.ig.DataSchema(); ds = context._xmlToArray(tmpSchema._findXmlRecordsRoot(data, resKey)) } else { ds = context._xmlToArray(data) } } return ds }, _xmlToArray: function (data) { var ds = [], root = data, i, r, j, name, val, o; o = window.ActiveXObject; if (data && data.childNodes && data.childNodes.length === 1) { root = data.childNodes[0] } for (i = 0; i < root.childNodes.length; i++) { r = root.childNodes[i]; ds[i] = []; for (j = 0; j < r.childNodes.length; j++) { name = o === undefined ? r.childNodes[j].localName : r.childNodes[j].baseName; val = o === undefined ? r.childNodes[j].textContent : r.childNodes[j].text; ds[i][name] = val } } return ds }, _encodeUrl: function () { var props = this.settings, sParams = {}, fParams = {}, pParams = {}, params, args, selParams = {}, noCancel = true; args = { cancel: false }; params = { sortingParams: sParams, filteringParams: fParams, pagingParams: pParams, selectParams: selParams }; if ($.isFunction(props.urlParamsEncoding)) { noCancel = props.urlParamsEncoding(this, params) } if (noCancel) { this._encodeSelectParams(params); this._encodeSortingParams(params); this._encodeFilteringParams(params); this._encodePagingParams(params); if ($.isFunction(props.urlParamsEncoded)) { props.urlParamsEncoded(this, params) } } return $.extend(true, {}, params.sortingParams, params.filteringParams, params.pagingParams, params.selectParams) }, _encodeSelectParams: function (params) { var selParams = params.selectParams, i; if (!this.settings.localSchemaTransform && this.schema() && this.schema().fields().length > 0) { selParams.$select = ""; for (i = 0; i < this.schema().fields().length; i++) { if (i !== 0) { selParams.$select += "," } selParams.$select += this.schema().fields()[i].name } } else { if (!this.settings.localSchemaTransform && this.schema() && this.schema().fields().length === 0) { selParams.$select = "*" } } }, _encodePagingParams: function (params) { var p = this.settings.paging; if (p.enabled && p.type === "remote") { this._isPagingReq = true; if (p.pageIndexUrlKey !== null && p.pageSizeUrlKey !== null) { params.pagingParams[p.pageIndexUrlKey] = this.pageIndex(); params.pagingParams[p.pageSizeUrlKey] = this.pageSize() } else { params.pagingParams.$skip = this.pageIndex() * this.pageSize(); params.pagingParams.$top = this.pageSize(); params.pagingParams.$inlinecount = "allpages"; if (this.settings.responseTotalRecCountKey === null) { this.settings.responseTotalRecCountKey = "d.__count" } } } }, _encodeSortingParams: function (params) { var s = this.settings.sorting, tmpdir, i, sfields; if (s.type === "remote") { if (s.exprString) { sfields = this._parseSortExpressions(s.exprString) } else { sfields = s.expressions } this._isSortingReq = true; for (i = 0; i < sfields.length; i++) { if (s.sortUrlAscValueKey !== null && s.sortUrlDescValueKey !== null && s.sortUrlKey !== null) { tmpdir = (sfields[i].dir && sfields[i].dir.toLowerCase().startsWith("asc")) ? s.sortUrlAscValueKey : s.sortUrlDescValueKey; params.sortingParams[s.sortUrlKey + "(" + sfields[i].fieldName + ")"] = tmpdir } else { if (params.sortingParams.$orderby === undefined) { params.sortingParams.$orderby = "" } params.sortingParams.$orderby = params.sortingParams.$orderby + sfields[i].fieldName + " " + sfields[i].dir.toLowerCase(); if (i < sfields.length - 1) { params.sortingParams.$orderby += "," } } } } }, _encodeFilteringParams: function (params) { var f = this.settings.filtering, ffields, i, key, exprNotReq, cond, d; if (f.type === "remote") { if (f.exprString) { ffields = this._parseFilterExprString(f.exprString) } else { ffields = f.expressions } for (i = 0; i < ffields.length; i++) { this._isFilteringReq = true; cond = ffields[i].cond; exprNotReq = cond === "false" || cond === "true" || cond === "today" || cond === "yesterday" || cond === "thisMonth" || cond === "lastMonth" || cond === "nextMonth" || cond === "thisYear" || cond === "lastYear" || cond === "nextYear" || cond === "null" || cond === "notNull" || cond === "empty" || cond === "notEmpty"; if (f.filterExprUrlKey !== null) { key = f.filterExprUrlKey + "(" + ffields[i].fieldName + ")"; if ($.type(ffields[i].expr) === "date") { d = Date.UTC(ffields[i].expr.getFullYear(), ffields[i].expr.getMonth(), ffields[i].expr.getDate(), ffields[i].expr.getHours(), ffields[i].expr.getMinutes()) } else { d = ffields[i].expr } if (params.filteringParams[key] === undefined) { params.filteringParams[key] = ffields[i].cond + "(" + (exprNotReq ? "" : d) + ")" } else { params.filteringParams[key] = params.filteringParams[key] + "," + ffields[i].cond + "(" + (exprNotReq ? "" : d) + ")" } } else { if (params.filteringParams.$filter === undefined) { params.filteringParams.$filter = "" } if (ffields[i].cond === "startsWith") { params.filteringParams.$filter += "startswith(" + ffields[i].fieldName + ",'" + ffields[i].expr + "') eq true" } else { if (ffields[i].cond === "endsWith") { params.filteringParams.$filter += "endswith(" + ffields[i].fieldName + ",'" + ffields[i].expr + "') eq true" } else { if (ffields[i].cond === "contains") { params.filteringParams.$filter += "indexof(" + ffields[i].fieldName + ",'" + ffields[i].expr + "') ge 0" } else { if (ffields[i].cond === "doesNotContain") { params.filteringParams.$filter += "indexof(" + ffields[i].fieldName + ",'" + ffields[i].expr + "') eq -1" } else { if (ffields[i].cond === "equals") { if ($.type(ffields[i].expr) === "string") { params.filteringParams.$filter += ffields[i].fieldName + " eq '" + ffields[i].expr + "'" } else { params.filteringParams.$filter += ffields[i].fieldName + " eq " + ffields[i].expr } } else { if (ffields[i].cond === "true") { params.filteringParams.$filter += ffields[i].fieldName + " eq true" } else { if (ffields[i].cond === "false") { params.filteringParams.$filter += ffields[i].fieldName + " eq false" } else { if (ffields[i].cond === "doesNotEqual") { if ($.type(ffields[i].expr) === "string") { params.filteringParams.$filter += ffields[i].fieldName + " ne '" + ffields[i].expr + "'" } else { params.filteringParams.$filter += ffields[i].fieldName + " ne " + ffields[i].expr } } else { if (ffields[i].cond === "greaterThan") { params.filteringParams.$filter += ffields[i].fieldName + " gt " + ffields[i].expr } else { if (ffields[i].cond === "lessThan") { params.filteringParams.$filter += ffields[i].fieldName + " lt " + ffields[i].expr } else { if (ffields[i].cond === "greaterThanOrEqualTo") { params.filteringParams.$filter += ffields[i].fieldName + " ge " + ffields[i].expr } else { if (ffields[i].cond === "lessThanOrEqualTo") { params.filteringParams.$filter += ffields[i].fieldName + " le " + ffields[i].expr } else { if (ffields[i].cond === "null") { params.filteringParams.$filter += ffields[i].fieldName + " eq null" } else { if (ffields[i].cond === "notNull") { params.filteringParams.$filter += ffields[i].fieldName + " ne null" } else { if (ffields[i].cond === "empty") { params.filteringParams.$filter += "length(" + ffields[i].fieldName + ") eq 0" } else { if (ffields[i].cond === "notEmpty") { params.filteringParams.$filter += "length(" + ffields[i].fieldName + ") gt 0" } } } } } } } } } } } } } } } } if (i < ffields.length - 1) { params.filteringParams.$filter += " and " } } } if (f.filterLogicUrlKey !== null && ffields.length > 0) { params.filteringParams[f.filterLogicUrlKey] = ffields[0].logic } } }, _page: function () { var count = 0, startIndex, endIndex, i = 0; this._dataView = []; if (!this._filter) { startIndex = this.pageIndex() * this.pageSize(); endIndex = startIndex + this.pageSize() >= this._data.length ? this._data.length : startIndex + this.pageSize(); for (i = startIndex; i < endIndex; i++) { this._dataView[count++] = this._data[i] } } else { startIndex = this.pageIndex() * this.pageSize(); endIndex = startIndex + this.pageSize() >= this._filteredData.length ? this._filteredData.length : startIndex + this.pageSize(); for (i = startIndex; i < endIndex; i++) { this._dataView[count++] = this._filteredData[i] } } }, sort: function (fields, direction, keepSortState) { var s = this.settings.sorting, schema, sortF, convertFunc, p = this.settings.paging, data, resetPaging = false; if (fields === undefined || fields === null) { throw new Error($.ig.DataSource.locale.noSortingFields) } sortF = function (fields, schema, reverse, convertf) { reverse = (reverse) ? -1 : 1; function compareVals(x, y) { if ((x === null || x === undefined) && (y === null || y === undefined)) { return 0 } else { if ((x === null || x === undefined) && y !== null && y !== undefined) { return -1 } else { if (x !== null && x !== undefined && (y === null || y === undefined)) { return 1 } else { return x > y ? 1 : x < y ? -1 : 0 } } } } return function (obj1, obj2) { var i, f, arr1 = [], arr2 = [], a, b; for (i = 0; i < fields.length; i++) { f = fields[i]; if (f.fieldIndex >= 0) { f.fieldName = f.fieldIndex } a = obj1[f.fieldName]; b = obj2[f.fieldName]; if (convertf !== undefined) { a = convertf(a, f.fieldName); b = convertf(b, f.fieldName) } if (s.caseSensitive === false) { if (a !== undefined && a !== null && a.toLowerCase) { a = a.toLowerCase() } if (b !== undefined && b !== null && b.toLowerCase) { b = b.toLowerCase() } } if (f.dir !== undefined && f.dir !== null) { reverse = f.dir.toLowerCase().startsWith("desc"); reverse = (reverse) ? -1 : 1 } else { if (direction !== undefined && direction !== null && direction !== "") { reverse = direction.toLowerCase().startsWith("desc"); reverse = (reverse) ? -1 : 1 } } if (fields.length === 1) { arr1 = reverse * compareVals(a, b); arr2 = reverse * compareVals(b, a) } else { if (reverse === -1) { arr1.push(-compareVals(a, b)); arr2.push(-compareVals(b, a)) } else { arr1.push(compareVals(a, b)); arr2.push(compareVals(b, a)) } } } if (arr1 < arr2) { return -1 } else { if (arr1 > arr2) { return 1 } } return 0 } }; if (s.applyToAllData && s.type === "local") { if (this._filter && ((p.type === "local" && p.enabled === true) || p.enabled === false)) { data = this._filteredData } else { data = this.data() } resetPaging = true } else { data = this.dataView() } if ($.type(s.customFunc) === "function") { data = s.customFunc(data, fields, direction) } else { schema = this.settings.schema; if (!direction) { direction = "" } if ($.type(s.compareFunc) === "function") { sortF = s.compareFunc } if ($.isFunction(s.customConvertFunc)) { convertFunc = s.customConvertFunc } if ($.type(fields) === "string") { fields = this._parseSortExpressions(fields) } data = data.sort(sortF(fields, schema, direction.toLowerCase().startsWith("asc") ? false : true, convertFunc)) } if (resetPaging && p.type === "local") { if (!this._filter) { this._filteredData = data } else { this._data = data } this._page() } else { this._dataView = data } return this }, _parseSortExpressions: function (s) { var fields = [], tmp, tmp2, i; tmp = s.split(","); for (i = 0; i < tmp.length; i++) { fields[i] = {}; tmp2 = $.trim(tmp[i]).split(" "); fields[i].fieldName = tmp2[0]; fields[i].dir = tmp2[1] } return fields }, _convertf: function (val, type) { }, filter: function (fieldExpressions, boolLogic, keepFilterState) { var i, j, expr = null, count = 0, skipRec = false, f = this.settings.filtering, p = this.settings.paging, data, t, k, schema, fields, tmpbool, resetPaging; schema = this.schema(); if (schema === null || schema === undefined) { throw new Error($.ig.DataSource.locale.filteringNoSchema) } if ($.type(fieldExpressions) === "string") { expr = fieldExpressions } if ($.type(fieldExpressions) === "array" && fieldExpressions.length === 0) { return } if (f.applyToAllData && f.type === "local") { data = this.data(); resetPaging = true } else { if (this._cachedDataView && this._cachedDataView.length > 0) { data = this._cachedDataView } else { this._cachedDataView = $.merge([], this.dataView()); data = this._cachedDataView } } if ($.type(f.customFunc) === "function") { data = f.customFunc(fieldExpressions, data); this._filteredData = data } else { this._dataView = []; this._filteredData = []; for (i = 0; i < data.length; i++) { skipRec = false; if (expr) { fieldExpressions = this._parseFilterExprString(expr) } for (j = 0; j < fieldExpressions.length; j++) { fields = schema.fields(); if (fieldExpressions[j].fieldIndex) { if (fieldExpressions[j].fieldIndex < fields.length) { t = fields[fieldExpressions[j].fieldIndex].type } skipRec = !this._findMatch(data[i][fieldExpressions[j].fieldIndex], fieldExpressions[j].expr, t, !f.caseSensitive, fieldExpressions[j].cond) } else { for (k = 0; k < fields.length; k++) { if (fields[k].name === fieldExpressions[j].fieldName) { t = fields[k].type; break } } skipRec = !this._findMatch(data[i][fieldExpressions[j].fieldName], fieldExpressions[j].expr, t, !f.caseSensitive, fieldExpressions[j].cond) } tmpbool = (fieldExpressions[j].logic !== null && fieldExpressions[j].logic !== undefined && (fieldExpressions[j].logic.toLowerCase() === "or" || fieldExpressions[j].logic.toLowerCase() === "and")) ? fieldExpressions[j].logic : boolLogic; if (tmpbool === undefined || tmpbool === null || $.type(tmpbool) !== "string") { tmpbool = "and" } if (skipRec && tmpbool.toLowerCase() === "and") { break } else { if (!skipRec && tmpbool.toLowerCase() === "or") { break } } } if (!skipRec) { this._filteredData[count++] = data[i] } } } if (resetPaging && p.type === "local" && p.enabled === true) { this._filter = true; this.settings.paging.pageIndex = 0; this.pageSizeDirty(true); this._page() } else { if (p.enabled === false) { this._filter = true } for (i = 0; i < this._filteredData.length; i++) { this._dataView[i] = this._filteredData[i] } } return this }, _parseFilterExprString: function (expr) { var exprs = $.trim(expr).split(/(?=AND+)|(?=OR+)/i), i, j, fields = [], tmp, tmp2, isInvalid = true; for (i = 0; i < exprs.length; i++) { fields[i] = {}; tmp = $.trim(exprs[i]).split(/(?= \=+)|(?=<>+)|(?=>+)|(?=<+)|(?=LIKE+)|(?=NOT\WLIKE)+|(?=>\=+)|(?=<\=+)/); if ($.trim(exprs[i]).toLowerCase().startsWith("and")) { fields[i].logic = "AND" } else { if ($.trim(exprs[i]).toLowerCase().startsWith("or")) { fields[i].logic = "OR" } } if (i > 0 && (fields[i].logic === "AND" || fields[i].logic === "OR")) { fields[i - 1].logic = fields[i].logic } if (tmp[0].toLowerCase().startsWith("and") || tmp[0].toLowerCase().startsWith("or")) { fields[i].fieldName = $.trim(tmp[0].split(" ")[1]) } else { fields[i].fieldName = $.trim(tmp[0]) } tmp2 = $.trim(tmp[1]).split(" "); if (exprs[i].indexOf("<>") !== -1) { tmp2[0] = "<>"; tmp2[1] = tmp[2].replace(">", "") } if (tmp2.length > 2) { for (j = 2; j < tmp2.length; j++) { tmp2[1] = tmp2[1] + " " + tmp2[j] } tmp2 = [tmp2[0], tmp2[1]] } if (tmp[1].startsWith("NOT")) { fields[i].expr = $.trim(tmp[2].replace("LIKE", "")) } else { fields[i].expr = tmp2[1] } for (j = 0; j < this.schema().schema.fields.length; j++) { if (this.schema().schema.fields[j].name === fields[i].fieldName) { isInvalid = false; break } } if (isInvalid) { throw new Error($.ig.DataSource.locale.fieldMismatch + fields[i].fieldName) } isInvalid = true; if (tmp2[0] === ">") { fields[i].cond = "greaterThan" } else { if (tmp2[0] === "LIKE") { if (fields[i].expr.startsWith("%") && fields[i].expr.endsWith("%")) { fields[i].cond = "contains" } else { if (fields[i].expr.endsWith("%")) { fields[i].cond = "startsWith" } else { if (fields[i].expr.startsWith("%")) { fields[i].cond = "endsWith" } else { fields[i].cond = "equals" } } } fields[i].expr = fields[i].expr.replace(/%/g, "") } else { if (tmp2[0] === "NOT LIKE" || tmp2[0] === "NOT") { if (fields[i].expr.startsWith("%") && fields[i].expr.endsWith("%")) { fields[i].cond = "doesNotContain" } else { fields[i].cond = "doesNotEqual" } fields[i].expr = fields[i].expr.replace(/%/g, "") } else { if (tmp2[0] === "=") { fields[i].cond = "equals" } else { if (tmp2[0] === "<>") { fields[i].cond = "doesNotEqual" } else { if (tmp2[0] === "<") { fields[i].cond = "lessThan" } else { if (tmp2[0] === "<=") { fields[i].cond = "lessThanOrEqualTo" } else { if (tmp2[0] === ">=") { fields[i].cond = "greaterThanOrEqualTo" } else { throw new Error($.ig.DataSource.locale.unrecognizedCondition + expr) } } } } } } } } } return fields }, _findMatch: function (val, expr, t, ignoreCase, cond) { var tmpExpr, exprNotReq = cond === "false" || cond === "true" || cond === "today" || cond === "yesterday" || cond === "thisMonth" || cond === "lastMonth" || cond === "nextMonth" || cond === "thisYear" || cond === "lastYear" || cond === "nextYear" || cond === "null" || cond === "notNull" || cond === "empty" || cond === "notEmpty"; if (expr === "" && !exprNotReq) { return true } tmpExpr = $.trim(expr); if (t === "regexp" || (t === "string" && tmpExpr.startsWith("/") && tmpExpr.endsWith("/"))) { if (t === "regexp") { return this._findRegExpMatch(val, expr, false) } else { return this._findRegExpMatch(val, tmpExpr.substring(1, tmpExpr.length - 1), true) } } else { if (($.type(val) === "date" && (t === undefined || t === null)) || t === "date") { try { expr = this._parser.toDate(expr) } catch (e) { } return this._findDateMatch(val, expr, cond) } else { if (($.type(val) === "boolean" && (t === undefined || t === null)) || (t === "boolean" || t === "bool")) { return this._findBoolMatch(val, cond) } else { if (($.type(val) === "number" && (t === undefined || t === null)) || t === "number") { return this._findNumericMatch(val, expr, cond) } else { return this._findStringMatch(val, expr, ignoreCase, cond) } } } } }, _findStringMatch: function (val, expr, ignoreCase, cond) { var localVal; if (val !== null) { localVal = ignoreCase ? val.toLowerCase() : val ? val : "" } else { localVal = val } if (expr !== null && expr !== undefined) { expr = ignoreCase ? expr.toLowerCase() : expr } if (cond === "startsWith") { return localVal !== null && localVal !== undefined && localVal.startsWith(expr) } else { if (cond === "endsWith") { return localVal !== null && localVal !== undefined && localVal.endsWith(expr) } else { if (cond === "contains") { return localVal !== null && localVal !== undefined && localVal.indexOf(expr) !== -1 } else { if (cond === "doesNotContain") { return localVal !== null && localVal !== undefined && localVal.indexOf(expr) === -1 } else { if (cond === "equals") { return localVal !== null && localVal !== undefined && localVal === expr } else { if (cond === "doesNotEqual") { return localVal !== null && localVal !== undefined && localVal !== expr } else { if (cond === "null") { return localVal === null } else { if (cond === "notNull") { return localVal !== null } else { if (cond === "empty") { return localVal === null || localVal === undefined || localVal.length === 0 } else { if (cond === "notEmpty") { return localVal === null || localVal === undefined || localVal.length !== 0 } else { throw new Error($.ig.DataSource.locale.errorUnrecognizedFilterCondition + cond) } } } } } } } } } } }, _findRegExpMatch: function (val, expr, str) { if (str) { return (new RegExp(expr)).test(val) } else { return val.match(expr) } }, _findNumericMatch: function (val, expr, cond) { if ($.type(expr) !== "number") { expr = this._parser.toNumber(expr) } if (cond === "equals") { return val === expr } else { if (cond === "doesNotEqual") { return val !== expr } else { if (cond === "greaterThan") { return val > expr } else { if (cond === "lessThan") { return val < expr } else { if (cond === "greaterThanOrEqualTo") { return val >= expr } else { if (cond === "lessThanOrEqualTo") { return val <= expr } else { if (cond === "null") { return val === null } else { if (cond === "notNull") { return val !== null } else { if (cond === "empty") { return (val === null || val === undefined || isNaN(val)) } else { if (cond === "notEmpty") { return (val !== null && val !== undefined && !isNaN(val)) } else { throw new Error($.ig.DataSource.locale.errorUnrecognizedFilterCondition + cond) } } } } } } } } } } }, _findBoolMatch: function (val, cond) { if (cond === "true") { return val } else { if (cond === "false") { return !val } else { if (cond === "null") { return val === null } else { if (cond === "notNull") { return val !== null } else { if (cond === "empty") { return (val === null || val === undefined) } else { if (cond === "notEmpty") { return (val !== null && val !== undefined) } else { throw new Error($.ig.DataSource.locale.errorUnrecognizedFilterCondition + cond) } } } } } } }, _findDateMatch: function (val, expr, cond) { var day1, mins1, secs1, hs1, ms1, yrs1, day2, mins2, secs2, hs2, ms2, yrs2, month1, month2, eq, cur, day3, mins3, secs3, hs3, ms3, yrs3, month3, mday1, mday2, mday3; if (val !== null && val !== undefined) { day1 = val.getDay(); mday1 = val.getDate(); mins1 = val.getMinutes(); secs1 = val.getSeconds(); hs1 = val.getHours(); ms1 = val.getMilliseconds(); yrs1 = val.getYear(); month1 = val.getMonth() } if ($.type(expr) === "date") { day2 = expr.getDay(); mday2 = expr.getDate(); mins2 = expr.getMinutes(); secs2 = expr.getSeconds(); hs2 = expr.getHours(); ms2 = expr.getMilliseconds(); yrs2 = expr.getYear(); month2 = expr.getMonth() } else { expr = new Date(expr) } cur = new Date(); day3 = cur.getDay(); mday3 = cur.getDate(); mins3 = cur.getMinutes(); secs3 = cur.getSeconds(); hs3 = cur.getHours(); ms3 = cur.getMilliseconds(); yrs3 = cur.getYear(); month3 = cur.getMonth(); eq = day1 === day2 && mins1 === mins2 && hs1 === hs2 && yrs1 === yrs2 && month1 === month2; if (cond === "equals") { return eq } else { if (cond === "doesNotEqual") { return !eq } else { if (cond === "before") { return val < expr } else { if (cond === "after") { return val > expr } else { if (cond === "today") { return mday1 === mday3 && month1 === month3 && yrs1 === yrs3 } else { if (cond === "yesterday") { return mday1 === mday3 - 1 && month1 === month3 && yrs1 === yrs3 } else { if (cond === "thisMonth") { return month1 === month3 && yrs1 === yrs3 } else { if (cond === "lastMonth") { if (month3 === 0) { return month1 === 11 && yrs1 === yrs3 - 1 } return month1 === month3 - 1 && yrs1 === yrs3 } else { if (cond === "nextMonth") { if (month3 === 11) { return month1 === 0 && yrs1 === yrs3 + 1 } return month1 === month3 + 1 && yrs1 === yrs3 } else { if (cond === "thisYear") { return yrs1 === yrs3 } else { if (cond === "lastYear") { return yrs1 === yrs3 - 1 } else { if (cond === "nextYear") { return yrs1 === yrs3 + 1 } else { if (cond === "on") { return yrs1 === yrs2 && month1 === month2 && mday1 === mday2 } else { if (cond === "notOn") { return !(yrs1 === yrs2 && month1 === month2 && mday1 === mday2) } else { if (cond === "null") { return val === null } else { if (cond === "notNull") { return val !== null } else { if (cond === "empty") { return (val === null || val === undefined) } else { if (cond === "notEmpty") { return (val !== null && val !== undefined) } else { throw new Error($.ig.DataSource.locale.errorUnrecognizedFilterCondition + cond) } } } } } } } } } } } } } } } } } } }, totalRecordsCount: function (count) { if (count === undefined || count === null) { return this._recCount } else { this._recCount = count } }, hasTotalRecordsCount: function (hasCount) { if (hasCount === undefined || hasCount === null) { return this._hasCount } else { this._hasCount = hasCount } }, totalLocalRecordsCount: function () { if (!this._filter) { return this._data.length } else { return this._dataView.length } }, pageCount: function () { var c, realCount; if (!this._filter) { realCount = this.totalRecordsCount() > 0 ? this.totalRecordsCount() : this._data.length } else { realCount = this.totalRecordsCount() > 0 ? this.totalRecordsCount() : this._filteredData.length } c = Math.ceil(realCount / this.settings.paging.pageSize); return c === 0 ? 1 : c }, pageIndex: function (index) { if (index === undefined || index === null) { return this.settings.paging.pageIndex === undefined ? 0 : this.settings.paging.pageIndex } else { this.settings.paging.pageIndex = parseInt(index, 10); this._cachedDataView = null; if (this.settings.paging.type === "local") { this._page(); this._invokeCallback() } else { this.dataBind() } return this } }, prevPage: function () { this.pageIndex(this.pageIndex() === 0 ? 0 : this.pageIndex() - 1); return this }, nextPage: function () { if (this.pageIndex() >= this.pageCount() - 1) { return this } this.pageIndex(this.pageIndex() + 1); return this }, pageSize: function (s) { if (s === undefined || s === null) { return this.settings.paging.pageSize } else { this.settings.paging.pageSize = parseInt(s, 10); this.dataBind(); return this } }, pageSizeDirty: function (dirty) { if (dirty === undefined || dirty === null) { return this._dirty } else { this._dirty = dirty } }, recordsForPage: function (p) { var d = [], si, ps, ei, i, c = 0; ps = this.pageSize(); si = p * ps; ei = si + ps >= this._data.length ? this._data.length : si + ps; for (i = si; i < ei; i++) { d[c++] = this._data[i] } return d }, tableToObject: function (tableDOM) { try { var rows = $(tableDOM).children("tbody").children(), len, data, i, j; len = rows.length > 0 ? rows[0].cells.length : 0; data = []; for (i = 0; i < rows.length; i++) { data[i] = []; for (j = 0; j < len; j++) { data[i][j] = rows[i].cells[j].innerHTML } } return data } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingHtmlTableNoSchema + e.message) } }, _validateTable: function (obj) { if (obj.length === 0) { throw new Error($.ig.DataSource.locale.errorTableWithIdNotFound + this.dataSource()) } else { return obj[0] } }, stringToJSONObject: function (s) { var data = {}; try { data = JSON.parse(s) } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingJsonNoSchema + e.message) } return data }, stringToXmlObject: function (s) { var doc, parser; try { if (window.ActiveXObject) { doc = new ActiveXObject("Microsoft.XMLDOM"); doc.async = "false"; doc.loadXML(s) } else { parser = new DOMParser(); doc = parser.parseFromString(s, "text/xml") } } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingXmlNoSchema + e.message) } return doc } }); $.ig.TypeParser = $.ig.TypeParser || Class.extend({ toStr: function (obj) { return this.isNullOrUndefined(obj) ? "" : obj + this.empty() }, toDate: function (obj) { if (this.isNullOrUndefined(obj) || $.type(obj) === "function") { return null } else { if ($.type(obj) === "date") { return obj } else { if (obj.length && obj.indexOf("/Date(") !== -1) { return new Date(parseInt(obj.replace("/Date(", "").replace(")/", ""), 10)) } return new Date(obj) } } }, toNumber: function (obj) { return (this.isNullOrUndefined(obj) || $.type(obj) === "function") ? null : obj * this.num() }, toBool: function (obj) { if ($.type(obj) === "boolean") { return obj } else { if (this.isNullOrUndefined(obj) || $.type(obj) === "function") { return false } else { if (obj === "1" || obj.toLowerCase() === "true" || obj === 1) { return true } else { return false } } } }, isNullOrUndefined: function (obj) { return obj === null || obj === undefined }, empty: function () { return "" }, num: function () { return 1 } }); $.ig.DataSchema = $.ig.DataSchema || Class.extend({ schema: { fields: [], searchField: null, outputResultsName: null }, init: function (type, options) { if (options) { this.schema = $.extend(true, {}, $.ig.DataSchema.prototype.schema, options) } this._type = type; this._parser = new $.ig.TypeParser() }, transform: function (data) { var ndata = []; switch (this._type) { case "array": ndata = this._arrays(data); break; case "json": ndata = this._json(data); break; case "xml": ndata = this._xml(data); break; case "htmlTableDom": ndata = this._table(data); break; default: throw new Error("unknown data source type: " + this._type) } return ndata }, _setResKey: function (resKey, out) { if (!this.isEmpty(resKey)) { out[resKey] = []; return out[resKey] } else { return out } }, _convertType: function (t, obj) { if (t === "string") { return this._parser.toStr(obj) } else { if (t === "date") { return this._parser.toDate(obj) } else { if (t === "number") { return this._parser.toNumber(obj) } else { if (t === "boolean" || t === "bool") { return this._parser.toBool(obj) } else { return obj } } } } }, _val: function (field, val, results, i, rec) { var t = field.type, j; if (!this.isEmpty(t)) { if (this.isEmpty(field.name)) { results[i][j] = this._convertType(t, val) } else { results[i][field.name] = this._convertType(t, val) } } else { if (this.isEmpty(field.name)) { if (rec) { results[i][j] = rec[i][j] } else { results[i][j] = val } } else { if (rec) { results[i][field.name] = rec[i][field.name] } else { results[i][field.name] = val } } } }, isEmpty: function (o) { return o === undefined || o === null || o === "" }, _arrays: function (data) { var i, j, tmp, hasArrays, resKey = this.schema.outputResultsName, out = {}, results; results = this._setResKey(resKey, out); if (this.isObjEmpty(results) && $.type(results) !== "array") { results = []; out = results } try { if (data.length > 0) { hasArrays = $.type(data[0]) === "array" } for (i = 0; i < data.length; i++) { results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { if (hasArrays) { tmp = data[i][j] } else { tmp = data[i][this.schema.fields[j].name] } this._val(this.schema.fields[j], tmp, results, i) } } } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingArrays + e.message) } return out }, _json: function (data) { var i, j, root, resKey = this.schema.outputResultsName, out = {}, results; results = this._setResKey(resKey, out); if (this.isObjEmpty(results)) { results = []; out = results } try { if (!this.isEmpty(this.schema.searchField)) { root = eval("data." + this.schema.searchField) } else { root = data } if (root && root.length && root.length > 0) { for (i = 0; i < root.length; i++) { results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { if (root[i][this.schema.fields[j].name] === undefined) { throw new Error($.ig.DataSource.locale.errorSchemaMismatch + this.schema.fields[j].name) } this._val(this.schema.fields[j], root[i][this.schema.fields[j].name], results, i, root) } } } } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingJson + e.message) } return out }, _xml: function (data) { var i, j, root, resNode, item, resKey = this.schema.outputResultsName, out = {}, results, namespaced, sf, k, r, rc, len1, len2, o; o = window.ActiveXObject; results = this._setResKey(resKey, out); if (this.isObjEmpty(results)) { results = []; out = results } try { if (!this.isEmpty(this.schema.searchField)) { namespaced = this._xmlHasNamespaces(data); if (!namespaced) { if (window.ActiveXObject === undefined) { root = data.evaluate(this.schema.searchField, data, null, XPathResult.ANY_TYPE, null) } else { root = data.selectNodes(this.schema.searchField) } } else { if (this.schema.searchField.startsWith("//")) { sf = this.schema.searchField.substring(2, this.schema.searchField.length) } else { sf = this.schema.searchField } root = this._findXmlRecordsRoot(data, sf) } } else { root = data } if (!namespaced) { if (root && window.ActiveXObject !== undefined) { for (i = 0; i < root.length; i++) { item = root.item(i); results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { resNode = item.selectSingleNode(this.schema.fields[j].xpath); if (resNode) { this._val(this.schema.fields[j], resNode.text, results, i) } else { results[i][this.schema.fields[j].name] = "" } } } } else { if (root) { i = 0; item = root.iterateNext(); while (item) { results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { resNode = data.evaluate(this.schema.fields[j].xpath, item, null, XPathResult.ANY_TYPE, null).iterateNext(); if (resNode) { this._val(this.schema.fields[j], resNode.textContent, results, i) } else { results[i][this.schema.fields[j].name] = "" } } i++; item = root.iterateNext() } } } } else { len1 = root.childNodes.length; for (i = 0; i < len1; i++) { r = root.childNodes[i]; results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { len2 = r.childNodes.length; for (k = 0; k < len2; k++) { rc = r.childNodes[k]; if (this.schema.fields[j].name === (o === undefined ? rc.localName : rc.baseName)) { this._val(this.schema.fields[j], o === undefined ? rc.textContent : rc.text, results, i); break } } } } } } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingXml + e.message) } return out }, _findXmlRecordsRoot: function (data, field) { var i, len, r, o, ret; o = window.ActiveXObject; if ((o === undefined ? data.localName : data.baseName) === field) { ret = data.parentNode } else { if (data && data.childNodes && data.childNodes.length > 0) { len = data.childNodes.length; for (i = 0; i < len; i++) { r = data.childNodes[i]; if (r.childNodes && r.childNodes.length > 0) { ret = this._findXmlRecordsRoot(r, field) } } } } return ret }, _xmlHasNamespaces: function (data) { var i, ns, r, len, fc; if (data.childNodes && data.childNodes.length && data.childNodes.length > 0) { len = data.childNodes.length; for (i = 0; i < len; i++) { r = data.childNodes[i]; if (!r) { return false } ns = r.namespaceURI; if (ns !== "" && ns !== undefined && ns !== null) { return true } } if (r && r.childNodes && r.childNodes.length > 0) { fc = r.childNodes[0]; if (!fc) { return false } ns = fc.namespaceURI; return (ns !== "" && ns !== undefined && ns !== null) } } return false }, _table: function (data) { var i, j, r, tbody, rows, resKey = this.schema.outputResultsName, out = {}, results; tbody = $(data).find("tbody")[0]; $(data).find("thead").remove(); results = this._setResKey(resKey, out); if (this.isObjEmpty(results)) { results = []; out = results } try { if (tbody && tbody.nodeName && tbody.nodeName === "TBODY") { rows = tbody.rows; for (i = 0; i < rows.length; i++) { r = rows[i]; results[i] = {}; for (j = 0; j < this.schema.fields.length; j++) { this._val(this.schema.fields[j], r.cells[j].innerHTML, results, i) } } } else { throw new Error($.ig.DataSource.locale.errorExpectedTbodyParameter) } } catch (e) { throw new Error($.ig.DataSource.locale.errorParsingHtmlTable + e.message) } return out }, isObjEmpty: function (obj) { var prop; for (prop in obj) { if (obj.hasOwnProperty(prop)) { return false } } return true }, fields: function () { return this.schema.fields } }); $.ig.RemoteDataSource = $.ig.RemoteDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "remoteUrl"; this._super(options); return this } }); $.ig.JSONDataSource = $.ig.JSONDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "json"; this._super(options); return this } }); $.ig.JSONPDataSource = $.ig.JSONPDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.responseDataType = "jsonp"; this._super(options); return this } }); $.ig.XmlDataSource = $.ig.XmlDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "xml"; this._super(options); return this } }); $.ig.FunctionDataSource = $.ig.FunctionDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "function"; this._super(options); return this } }); $.ig.HtmlTableDataSource = $.ig.HtmlTableDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "htmlTableDom"; this._super(options); return this } }); $.ig.ArrayDataSource = $.ig.ArrayDataSource || $.ig.DataSource.extend({ init: function (options) { if (!options) { options = {} } options.type = "array"; this._super(options); return this } }); $.ig.MashupDataSource = $.ig.MashupDataSource || $.ig.DataSource.extend({ mashupSettings: { ignorePartialRecords: false, dataSource: [] }, init: function (options) { this._super(options); if (options) { this.settings = $.extend(true, {}, $.ig.DataSource.prototype.settings, options); this.settings = $.extend(true, {}, $.ig.MashupDataSource.prototype.mashupSettings, this.settings) } this._sources = []; this._dataBindingComplete = false; this._sourcesStatus = []; this._hashedDataViews = []; return this }, _checkDataBindingComplete: function (status, msg, ownerDs) { var i, j, k, hasPrimaryKeys = true, totalLength = 0, data = [], d, rindex, keyVal, prop; this._dataBindingComplete = true; for (i = 0; i < this._sources.length; i++) { if (this._sources[i] === ownerDs) { this._sourcesStatus[i] = 1 } if (this._sourcesStatus[i] === 0) { this._dataBindingComplete = false } } if (this._dataBindingComplete) { for (i = 0; i < this._sources.length; i++) { if (this._sources[i].settings.primaryKey === "" || this._sources[i].settings.primaryKey === null || this._sources[i].settings.primaryKey === undefined) { hasPrimaryKeys = false; break } } totalLength = this._sources[0].dataView().length; for (i = 0; i < this._sources.length; i++) { totalLength = this.settings.ignorePartialRecords ? (this._sources[i].dataView().length < totalLength ? this._sources[i].dataView().length : totalLength) : (this._sources[i].dataView().length > totalLength ? this._sources[i].dataView().length : totalLength) } if (hasPrimaryKeys) { for (i = 0; i < this._sources.length; i++) { this._hashedDataViews[i] = {}; for (j = 0; j < this._sources[i].dataView().length; j++) { this._hashedDataViews[i][this._sources[i].dataView()[j][this._sources[i].settings.primaryKey]] = this._sources[i].dataView()[j] } } for (i = 0; i < totalLength; i++) { data[i] = {}; for (j = 0; j < this._sources.length; j++) { if (this._sources[j].dataView().length > i) { keyVal = this._sources[j].dataView()[i][this._sources[j].settings.primaryKey]; data[i] = $.extend(true, {}, data[i], this._hashedDataViews[j][keyVal]) } else { data[i] = $.extend(true, {}, data[i], {}) } } } } else { for (i = 0; i < totalLength; i++) { data[i] = {}; for (j = 0; j < this._sources.length; j++) { d = this._sources[j]; if (d.dataView()[0].length) { for (k = 0; k < d.dataView()[0].length; k++) { rindex += k; if (d.schema() && d.schema().fields().length > 0) { data[i][d.schema().fields()[k]] = i >= d.dataView().length ? "" : d.dataView()[i][d.schema().fields()[k]] } else { data[i][rindex] = i >= d.dataView().length ? "" : d.dataView()[i][k] } } } else { for (prop in d.dataView()[i]) { if (d.dataView()[i].hasOwnProperty(prop)) { data[i][prop] = i >= d.dataView().length ? "" : d.dataView()[i][prop] } } } } rindex = 0 } } this.settings.dataSource = data; this.settings.type = "array"; this._runtimeType = this.analyzeDataSource(); this.dataBind() } }, dataBind: function () { var i, ds = this.settings.dataSource; if (this._dataBindingComplete) { this._dataBindingComplete = false; this._super() } else { this._dataBindingComplete = false; for (i = 0; i < ds.length; i++) { if (ds[i] instanceof $.ig.DataSource) { this._sources[i] = ds[i] } else { this._sources[i] = new $.ig.DataSource(ds[i]) } this._sources[i].settings.callee = this; this._sources[i].settings.callback = this._checkDataBindingComplete; this._sourcesStatus[i] = 0 } for (i = 0; i < ds.length; i++) { this._sources[i].dataBind() } } return this } }); $.ig.HierarchicalDataSource = $.ig.HierarchicalDataSource || $.ig.DataSource.extend({ hierarchicalSettings: { autogenerate: false, initialDataBindDepth: 0, defaultChildrenFieldName: "children", childbands: null, startRecord: -1, endRecord: -1 }, init: function (options) { if (options) { this.settings = $.extend(true, {}, $.ig.HierarchicalDataSource.prototype.settings, options); this.settings = $.extend(true, {}, $.ig.HierarchicalDataSource.prototype.hierarchicalSettings, this.settings) } this._sources = {}; this._levels = []; this._dataBindingComplete = false; this._sourcesStatus = []; this._super(options); return this }, dataBind: function (callback, callee) { var i, bands; bands = this.settings.childbands; for (i = 0; i < bands.length; i++) { if (!bands[i].parentId && bands[i].settings.path) { this.schema().schema.fields.push({ name: bands[i].settings.path }) } } this._callbackInternal = this.settings.callback; this._calleeInternal = this.settings.callee; this._super(this._dataBindInternal, this); return this }, _dataBindInternal: function () { var i, mashupHierarchy = false, bands = this.settings.childbands, options; for (i = 0; i < bands.length; i++) { if (bands[i].settings.dataSource && this._levelForBand(bands[i]) < this.settings.initialDataBindDepth) { mashupHierarchy = true; options = {}; options.callee = this; options.callback = this._checkDataBindingComplete; options.schema = bands[i].settings.schema; options.dataSource = bands[i].settings.dataSource; options.primaryKey = bands[i].settings.primaryKey; bands[i].settings.dataSourceObject = new $.ig.DataSource(options); this._sourcesStatus[i] = 0; bands[i].settings.dataSourceObject.dataBind() } } if (!mashupHierarchy) { this._initializeHierarchies() } }, _checkDataBindingComplete: function (status, msg, ownerDs) { var i, bands = this.settings.childbands; this._dataBindingComplete = true; for (i = 0; i < bands.length; i++) { if (bands[i].settings.dataSourceObject === ownerDs) { this._sourcesStatus[i] = 1 } if (this._sourcesStatus[i] === 0) { this._dataBindingComplete = false } } if (this._dataBindingComplete) { this._initializeHierarchies() } }, _initializeHierarchies: function () { var depth, start, end, rootView, i; rootView = this.dataView(); start = this.settings.startRecord === -1 ? 0 : this.settings.startRecord; end = this.settings.endRecord === -1 ? rootView.length : this.settings.endRecord; depth = this.settings.initialDataBindDepth; this._initializeLevelsAndSources(); this._initializeRootLevelSources(); depth = depth > this._levels.length - 1 ? this._levels.length - 1 : depth; if (depth >= 1) { for (i = 1; i <= depth; i++) { this._bindLevel(i, start, end) } } if (this._callbackInternal) { if (this._calleeInternal) { this._callbackInternal.apply(this._calleeInternal, [true, "", this]) } else { this._callbackInternal(true, "", this) } } }, _initializeLevelsAndSources: function () { var i, bands = this.settings.childbands, level; this._sources = { root: { records: {}, ds: this} }; this._levels[0] = "root"; for (i = 0; i < bands.length; i++) { if (!bands[i].settings.parentId) { if (!this._levels[1]) { this._levels[1] = []; this._levels[1].push(bands[i].settings.id) } } else { level = this._levelForBand(bands[i]); if (!this._levels[level]) { this._levels[level] = []; this._levels[level].push(bands[i].id) } } } }, _levelForBand: function (band) { var i = 0, level = 1, parentId = band.parentId, bands = this.settings.childbands; while (!(parentId === undefined || parentId === null || parentId === "")) { for (i = 0; i < bands.length; i++) { if (bands[i].settings.id === parentId) { level++; parentId = bands[i].settings.parentId; break } } } return level }, _initializeRootLevelSources: function () { var i; for (i = 0; i < this.dataView().length; i++) { this._sources.root.records[this.dataView()[i][this.settings.primaryKey]] = this.dataView()[i] } }, _bindRecursively: function (level, recordsObj, currentLevel) { var rec, bandsForLevel = this._levels[level], band, j; if (currentLevel > level) { return } for (rec in recordsObj) { if (recordsObj.hasOwnProperty(rec)) { if (level === currentLevel) { for (j = 0; j < bandsForLevel.length; j++) { band = bandsForLevel[j]; recordsObj[rec][band] = {}; recordsObj[rec][band].ds = this._createChildSource(band, recordsObj[rec]); this._buildRecordsIndices(band, recordsObj[rec][band]) } } else { this._bindRecursively(level, recordsObj[rec], currentLevel + 1) } } } }, _buildRecordsIndices: function (id, b) { var view, k, i, key; b.records = {}; b.ds.dataBind(); view = b.ds.dataView(); for (k = 0; k < this.settings.childbands.length; k++) { if (this.settings.childbands[k].settings.id === id) { key = this.settings.childbands[k].settings.primaryKey } } for (i = 0; i < view.length; i++) { if (key) { b.records[view[i][key]] = view[i] } else { b.records[i] = view[i] } } }, _bindLevel: function (level, start, end) { this._bindRecursively(level, this._sources.root.records, 1) }, _createChildSource: function (bandId, parentRecord) { var band, options, i, ds, dv, sameStore = true, pkVal, bands = this.settings.childbands; for (i = 0; i < bands.length; i++) { if (bands[i].settings.id === bandId) { band = bands[i]; break } } if (!band.parentId) { pkVal = parentRecord[this.settings.primaryKey] } else { for (i = 0; i < bands.length; i++) { if (bands[i].settings.id === band.parentId) { pkVal = parentRecord[bands[i].settings.primaryKey]; break } } } if (band) { options = {}; options.schema = band.settings.schema; if (band.settings.dataSource === null) { options.dataSource = parentRecord[band.settings.path] } else { if (band.settings.dataSourceObject && this._levelForBand(bands) < this.settings.initialDataBindDepth) { dv = band.settings.dataSourceObject.dataView(); options.dataSource = this._matchRecords(dv, pkVal, band.settings.foreignKey) } } ds = new $.ig.DataSource(options); if (sameStore) { for (i = 0; i < this.settings.childbands.length; i++) { if (this.settings.childbands[i].settings.parentId === bandId) { ds.schema().schema.fields.push({ name: this.settings.bands[i].settings.path }) } } } return ds } }, _matchRecords: function (dataView, pkVal, fkName) { var r = [], i, c = 0; for (i = 0; i < dataView.length; i++) { if (dataView[i][fkName] === pkVal) { r[c++] = dataView[i] } } return r }, _getPath: function (band, key) { var bandPath; bandPath = band.path }, hasChildren: function (childRecordsFieldName, path) { if (path[childRecordsFieldName].length && path[childRecordsFieldName].length > 0) { return true } else { return false } }, getChildSource: function (path, dataBind) { var pathKeys = path.split("/"), i, sourcePath = this._sources, bandId, recordId; for (i = 1; i < pathKeys.length; i++) { if (i === pathKeys.length - 1) { bandId = pathKeys[i].split(":")[0]; if (dataBind) { sourcePath[bandId] = {}; sourcePath[bandId].ds = this._createChildSource(bandId, sourcePath); this._buildRecordsIndices(bandId, sourcePath[bandId]); return sourcePath[bandId].ds } else { return sourcePath[bandId].ds } } else { bandId = pathKeys[i].split(":")[0]; recordId = pathKeys[i].split(":")[1]; sourcePath = sourcePath[bandId].records[recordId] } } return null }, getChildren: function (path) { return this.getChildSource(path).dataView() }, bindChildren: function (path) { return this.getChildSource(path, true) } }); $.ig.Band = $.ig.Band || Class.extend({ settings: { id: null, parentId: null, path: null, schema: null, dataSource: null, primaryKey: null, foreignKey: null }, init: function (options) { this.settings = $.extend(true, {}, $.ig.Band.prototype.settings, options); this._ds = null } }) } (jQuery)); (function (a) { a.extend(a.ig.DataSource, { locale: { invalidDataSource: "The supplied data source is invalid. It happens to be a scalar.", unknownDataSource: "Cannot determine the data source type. Please specify if it is JSON or XML data.", errorParsingArrays: "There was an error parsing the array data and applying the defined data schema: ", errorParsingJson: "There was an error parsing the JSON data and applying the defined data schema: ", errorParsingXml: "There was an error parsing the XML data and applying the defined data schema: ", errorParsingHtmlTable: "There was an error extracting the data from the HTML Table and applying the schema : ", errorExpectedTbodyParameter: "Expected a tbody or a table as a parameter.", errorTableWithIdNotFound: "The HTML Table with the following ID was not found: ", errorParsingHtmlTableNoSchema: "There was an error parsing the Table DOM: ", errorParsingJsonNoSchema: "There was an error parsing/evaluating the JSON string: ", errorParsingXmlNoSchema: "There was an error parsing the XML string: ", errorXmlSourceWithoutSchema: "The supplied data source is an xml document, but there is no defined data schema ($.IgDataSchema) ", errorUnrecognizedFilterCondition: " The filter condition that was passed was not recognized: ", errorRemoteRequest: "The remote request to fetch data has failed: ", errorSchemaMismatch: "The input data doesn't match the schema, the following field couldn't be mapped: ", errorSchemaFieldCountMismatch: "The input data doesn't match the schema in terms of number of fields. ", errorUnrecognizedResponseType: "The response type was either not set correctly, or it was not possible to detect it automatically. Please set settings.responseDataType and/or settings.responseContentType.", hierarchicalTablesNotSupported: "Tables are not supported for HierarchicalSchema", cannotBuildTemplate: "The jQuery template could not be built. There are no records present in the data source, and no columns defined.", unrecognizedCondition: "Unrecognized filtering condition in the following expression: ", fieldMismatch: "The following expression contains an invalid field or filtering condition: ", noSortingFields: "There are no fields specified. You need to specify at least one field to sort by, when calling sort().", filteringNoSchema: "There is no schema / fields specified. You need to specify a schema with field definitions and types to be able to filter the data source."} }) } (jQuery)); (function (a) { a.widget("ui.igLoading", { options: { cssClass: null }, _indicator: null, _create: function () { var b, c; c = this.options.cssClass === null ? "ui-igloadingmsg" : this.options.cssClass; if (this.element.children("." + c).length === 0) { this._indicator = a("<span></span>").appendTo("body").attr("id", this.element[0].id + "_loading").addClass(c); b = this.element.offset(); this._indicator.css("left", b.left + this.element.innerWidth() / 2).css("top", b.top + this.element.innerHeight() / 2) } }, indicatorElement: function () { return this._indicator }, indicator: function () { return this }, show: function () { this.refreshPos(); this._resId = setInterval(a.proxy(this._resizeContainer, this), 300); this._indicator.show() }, hide: function () { this._indicator.hide(); clearInterval(this._resId) }, _resizeContainer: function () { var b = this.element.offset(); if (b.top + this.element.innerHeight() / 2 !== this._indicator.css("top")) { this.refreshPos() } }, refreshPos: function () { var b = this.element.offset(); this._indicator.css("left", b.left + this.element.innerWidth() / 2).css("top", b.top + this.element.innerHeight() / 2) }, destroy: function () { clearInterval(this._resId); this._indicator.remove() } }); a.extend(a.ui.igLoading, { version: "11.1.20111.2010" }); a.widget("ui.igSlider", a.ui.mouse, { options: { animate: false, max: 100, min: 0, orientation: "horizontal", step: 1, value: 0, bookmarks: [{ value: 0, title: "", disabled: false, css: ""}], showBookmarkTitle: true, syncHandleWithBookmark: true }, css: { baseClasses: "ui-igslider ui-widget ui-widget-content ui-corner-all", horizontalOrientationClass: "ui-igslider-horizontal", verticalOrientationClass: "ui-igslider-vertical", sliderDisabledClass: "ui-igslider-disabled ui-disabled", handleClass: "ui-igslider-handle", bookmarkClass: "ui-igslider-bookmark", bookmarkDisabledClass: "ui-igslider-bookmark-disabled", bookmarkTooltipClass: "ui-igslider-bookmark-tooltip" }, events: { start: "start", slide: "slide", stop: "stop", change: "change", bookmarkHit: "bookmarkhit", bookmarkClick: "bookmarkclick" }, _numpages: 5, widget: function () { return this.element }, _createWidget: function (c, b) { this.options.bookmarks = []; a.Widget.prototype._createWidget.apply(this, arguments) }, _create: function () { var b = this.options, d = this, c = this.css; this._keySliding = false; this._mouseSliding = false; this._animateOff = true; this._handleIndex = null; this._detectOrientation(); this._mouseInit(); this.element.addClass(c.baseClasses); if (b.disabled) { this.element.addClass(c.sliderDisabledClass) } if (a(".ui-igslider-handle", this.element).length === 0) { a("<a href='#'></a>").appendTo(this.element).addClass(c.handleClass) } this.handles = a(".ui-igslider-handle", this.element).addClass("ui-state-default ui-corner-all").bind({ click: function (e) { e.preventDefault() }, mouseover: function () { if (!b.disabled) { a(this).addClass("ui-state-hover") } }, mouseout: function () { a(this).removeClass("ui-state-hover") }, focus: function () { if (!b.disabled) { a(".ui-igslider .ui-state-focus").removeClass("ui-state-focus"); a(this).addClass("ui-state-focus") } else { a(this).blur() } }, blur: function () { a(this).removeClass("ui-state-focus") }, keydown: function (i) { var g = true, f = a(this).data("index.ui-igslider-handle"), j, k, h, e; if (d.options.disabled) { return } switch (i.keyCode) { case a.ui.keyCode.HOME: case a.ui.keyCode.END: case a.ui.keyCode.PAGE_UP: case a.ui.keyCode.PAGE_DOWN: case a.ui.keyCode.UP: case a.ui.keyCode.RIGHT: case a.ui.keyCode.DOWN: case a.ui.keyCode.LEFT: g = false; if (!d._keySliding) { d._keySliding = true; a(this).addClass("ui-state-active"); j = d._start(i, f); if (j === false) { return } } break } e = d.options.step; k = h = d.value(); switch (i.keyCode) { case a.ui.keyCode.HOME: h = d.options.min; break; case a.ui.keyCode.END: h = d.options.max; break; case a.ui.keyCode.PAGE_UP: h = d._trimValue(k + ((d.options.max - d.options.min) / this._numpages)); break; case a.ui.keyCode.PAGE_DOWN: h = d._trimValue(k - ((d.options.max - d.options.min) / this._numpages)); break; case a.ui.keyCode.UP: case a.ui.keyCode.RIGHT: if (k === d.options.max) { return } h = d._trimValue(k + e); break; case a.ui.keyCode.DOWN: case a.ui.keyCode.LEFT: if (k === d.options.min) { return } h = d._trimValue(k - e); break } d._slide(i, f, h); return g }, keyup: function (f) { var e = a(this).data("index.ui-igslider-handle"); if (d._keySliding) { d._keySliding = false; d._stop(f, e); d._change(f, e); a(this).removeClass("ui-state-active") } } }).each(function (e) { a(this).data("index.ui-igslider-handle", e) }); this.handle = this.handles.eq(0); this._renderBookmarks(); this._refreshValue(); this._animateOff = false }, _renderBookmarks: function () { if (this.options.bookmarks && this.options.bookmarks.length > 0) { var d = this.options.bookmarks.length, b = 0, e = this.options, f = this.css, g, c = this; for (b; b < d; b++) { g = e.bookmarks[b]; a("<a href='#'></a>").appendTo(this.element).data("index.ui-igslider-bookmark", b).addClass(g.disabled ? f.bookmarkDisabledClass : f.bookmarkClass).addClass(g.css && g.css.length > 0 ? g.css : "").css("left", (e.min !== e.max) ? ((g.value - e.min) / (e.max - e.min) * 100) + "%" : "0%") } this.bookmarks = a(".ui-igslider-bookmark", this.element).addClass("ui-state-default").bind({ mousedown: function (h) { var i = true, j = a(this).data("index.ui-igslider-bookmark"); h.preventDefault(); h.stopPropagation(); i = c._bookmarkClicked(h, j); if (c.options.syncHandleWithBookmark && i) { c._slide(h, 0, c.options.bookmarks[j].value) } }, mouseover: function (h) { if (!e.disabled) { a(this).addClass("ui-state-hover"); if (c.options.showBookmarkTitle) { c._showBookmarkTitle(a(this), h) } } }, mouseout: function () { if (!e.disabled) { a(this).removeClass("ui-state-hover"); if (c.options.showBookmarkTitle) { c._hideBookmarkTitle(a(this)) } } }, click: function (h) { h.preventDefault() } }); this._createBookmarkTooltip(); this._buildBookmarkHit() } }, destroy: function () { this.handles.remove(); this.clearBookmarks(); this.element.removeClass(this.css.baseClasses + " ui-igslider-horizontal ui-igslider-vertical ui-igslider-disabled").removeData("slider").unbind(".slider"); this._mouseDestroy(); return this }, _id: function (b) { return this.element[0].id + b }, _showBookmarkTitle: function (e, c) { var d = a("#" + this._id("_tooltip")), f = e.position(), b = this.options.bookmarks[e.data("index.ui-igslider-bookmark")].title; if (b && b.length > 0) { d.igTooltip("option", "text", b); d.css("top", c.pageY - d.outerHeight() - 5).css("left", c.pageX - (d.width() / 2) + (e.width() / 2)).show() } }, _hideBookmarkTitle: function (b) { a("#" + this._id("_tooltip")).hide() }, _createBookmarkTooltip: function () { var b = '<div id="' + this._id("_tooltip") + '" class="' + this.css.bookmarkTooltipClass + '"></div>'; a(b).appendTo(a(document.body)).igTooltip({ arrowLocation: "bottom" }).hide() }, clearBookmarks: function () { if (this.bookmarks) { this.bookmarks.remove() } }, _mouseCapture: function (h) { var e = this.options, f, g, j = 0, d = this.handles.eq(j), c = this, i, b, k; if (e.disabled) { return false } this.elementSize = { width: this.element.outerWidth(), height: this.element.outerHeight() }; this.elementOffset = this.element.offset(); f = { x: h.pageX, y: h.pageY }; g = this._normValueFromMouse(f); this._mouseSliding = true; c._handleIndex = j; d.addClass("ui-state-active"); if (!a.browser.opera) { d.focus() } b = d.offset(); k = !a(h.target).parents().andSelf().is(".ui-igslider-handle"); this._clickOffset = k ? { left: 0, top: 0} : { left: h.pageX - b.left - (d.width() / 2), top: h.pageY - b.top - (d.height() / 2) - (parseInt(d.css("borderTopWidth"), 10) || 0) - (parseInt(d.css("borderBottomWidth"), 10) || 0) + (parseInt(d.css("marginTop"), 10) || 0) }; this._slide(h, j, g); this._animateOff = true; this._mouseUpHandler = function (l) { return c._mouseStop(l) }; a(document).bind("mouseup." + this.widgetName, this._mouseUpHandler); return true }, _mouseStart: function (b) { a(document).unbind("mouseup." + this.widgetName, this._mouseUpHandler); return this._start(b, this._handleIndex) }, _mouseDrag: function (c) { var b = { x: c.pageX, y: c.pageY }, d = this._normValueFromMouse(b); this._slide(c, this._handleIndex, d); return false }, _mouseStop: function (b) { this.handles.removeClass("ui-state-active"); this._mouseSliding = false; this._stop(b, this._handleIndex); this._change(b, this._handleIndex); this._handleIndex = null; this._clickOffset = null; this._animateOff = false; return false }, _detectOrientation: function () { var b = this.options, c = this.css; if (b.orientation === "vertical") { this.orientation = "vertical"; this.element.removeClass(c.horizontalOrientationClass).addClass(c.verticalOrientationClass) } else { this.orientation = "horizontal"; this.element.removeClass(c.verticalOrientationClass).addClass(c.horizontalOrientationClass) } }, _normValueFromMouse: function (d) { var g, e, f, c, b; if (this.orientation === "horizontal") { g = this.elementSize.width; e = d.x - this.elementOffset.left - (this._clickOffset ? this._clickOffset.left : 0) } else { g = this.elementSize.height; e = d.y - this.elementOffset.top - (this._clickOffset ? this._clickOffset.top : 0) } f = (e / g); if (f > 1) { f = 1 } if (f < 0) { f = 0 } if (this.orientation === "vertical") { f = 1 - f } c = this.options.max - this.options.min; b = this.options.min + f * c; return this._trimValue(b) }, _start: function (c, b) { var d = { handle: this.handles[b], value: this.value() }; return this._trigger(this.events.start, c, d) }, _slide: function (c, b, d) { var e; if (d !== this.value()) { e = this._trigger(this.events.slide, c, { handle: this.handles[b], value: d }); if (e !== false) { this.value(d) } } }, _stop: function (c, b) { var d = { handle: this.handles[b], value: this.value() }; this._trigger(this.events.stop, c, d) }, _change: function (c, b) { if (!this._keySliding && !this._mouseSliding) { var d = { handle: this.handles[b], value: this.value() }; this._trigger(this.events.change, c, d); this._checkBookmarkHit(d.value, c); if (d.value === this.options.max && this._marksHit && this._marksHit.length === 0) { this._buildBookmarkHit() } } }, _checkBookmarkHit: function (c, d) { if (this._marksHit && this._marksHit.length > 0 && c >= this._marksHit[0].value) { var b = this._marksHit[0].index; this._marksHit.shift(); this._bookmarkHit(d, b) } }, _buildBookmarkHit: function () { var c = this.options.bookmarks || [], d = c.length - 1; this._marksHit = []; for (; d >= 0; d--) { if (!c[d].disabled) { this._marksHit.push({ value: c[d].value, index: d }) } } this._marksHit.sort(this._sortBookmarksJSON); this._marksHit = a.extend(true, [], this._marksHit) }, _sortBookmarksJSON: function (c, d) { return (c.value - d.value) }, _bookmarkClicked: function (c, b) { var d = { bookmarkElement: this.bookmarks[b], bookmark: this.options.bookmarks[b] }; return this._trigger(this.events.bookmarkClick, c, d) }, _bookmarkHit: function (c, b) { var d = { bookmarkElement: this.bookmarks[b], bookmark: this.options.bookmarks[b] }; if (d.bookmarkElement) { this._trigger(this.events.bookmarkHit, c, d) } }, value: function (b) { if (arguments.length) { this.options.value = this._trimValue(b); this._refreshValue(); this._change(null, 0) } return this._value() }, _setOption: function (b, c) { a.Widget.prototype._setOption.apply(this, arguments); switch (b) { case "disabled": if (c) { this.handles.filter(".ui-state-focus").blur(); this.handles.removeClass("ui-state-hover"); this.handles.attr("disabled", "disabled"); this.element.addClass("ui-disabled") } else { this.handles.removeAttr("disabled"); this.element.removeClass("ui-disabled") } break; case "orientation": this._detectOrientation(); this._refreshValue(); break; case "value": this._animateOff = true; this._refreshValue(); this._change(null, 0); this._animateOff = false; break; case "bookmarks": this.clearBookmarks(); this._renderBookmarks(); break } }, _value: function () { return this._trimValue(this.options.value) }, _trimValue: function (c) { if (c < this.options.min) { return this.options.min } if (c > this.options.max) { return this.options.max } var d = (this.options.step > 0) ? this.options.step : 1, b = c % d, e = c - b; if (Math.abs(b) * 2 >= d) { e += (b > 0) ? d : (-d) } return parseFloat(e.toFixed(5)) }, _normPercentValue: function (c) { var d = 0, b = c; if (this.orientation === "vertical") { d = (this.handle.outerHeight() / this.element.outerHeight()).toFixed(2) * 100 } if (c - d > 0) { b = c - d } return b }, _refreshValue: function () { var f = this.options, c = this, g = (!this._animateOff ? f.animate : false), h = {}, b = this.value(), i = this.options.min, e = this.options.max, d = (e !== i) ? (b - i) / (e - i) * 100 : 0; h[c.orientation === "horizontal" ? "left" : "bottom"] = this._normPercentValue(d) + "%"; this.handle.stop(1, 1)[g ? "animate" : "css"](h, f.animate) } }); a.extend(a.ui.igSlider, { version: "11.1.20111.2010" }); a.widget("ui.igProgressBar", { options: { animate: false, animateTimeout: 100, max: 100, min: 0, orientation: "horizontal", value: 0, width: "0px", height: "0px", range: false, endValue: 100 }, css: { baseClasses: "ui-igprogressbar ui-widget ui-widget-content ui-corner-all", horizontalOrientationClass: "ui-igprogressbar-horizontal", verticalOrientationClass: "ui-igprogressbar-vertical", disabledClass: "ui-igprogressbar-disabled ui-disabled", progressRangeClass: "ui-igprogressbar-range ui-widget-header ui-corner-all" }, events: { change: "change" }, _animationOff: true, widget: function () { return this.element }, _detectOrientation: function () { var b = this.css; if (this.options.orientation === "vertical") { this.orientation = "vertical"; this.element.removeClass(b.horizontalOrientationClass).addClass(b.verticalOrientationClass) } else { this.orientation = "horizontal"; this.element.removeClass(b.verticalOrientationClass).addClass(b.horizontalOrientationClass) } }, _id: function (b) { return this.element[0].id + b }, _create: function () { var b = this.options, c = this.css; this._detectOrientation(); this.element.addClass(c.baseClasses); if (b.disabled) { this.element.addClass(c.disabledClass) } if (b.width !== "0px") { this.element.css("width", b.width) } if (b.height !== "0px") { this.element.css("height", b.height) } if (b.orientation === "horizontal") { a('<div id="' + this._id("_progress") + '" class="' + c.progressRangeClass + '" style="height:100%; top:0px; left:0%; width:0%;"></div>').appendTo(this.element) } else { a('<div id="' + this._id("_progress") + '" class="' + c.progressRangeClass + '" style="height:0%; bottom:0%; left:0px; width:100%;"></div>').appendTo(this.element) } this._refreshValue() }, destroy: function () { this.element.removeClass("ui-igprogressbar ui-igprogressbar-horizontal ui-igprogressbar-vertical ui-igprogressbar-disabled ui-widget ui-widget-content ui-corner-all").removeData("igProgressBar").unbind(".igProgressBar"); a("#" + this._id("_progress")).remove(); return this }, _change: function (c) { var b = { value: this.value() }; this._trigger(this.events.change, c, b) }, value: function (b) { if (arguments.length) { this.options.value = this._trimValue(b); this._refreshValue(); this._change(null) } return this.options.value }, _setOption: function (d, b) { a.Widget.prototype._setOption.apply(this, arguments); var c = this.options; switch (d) { case "disabled": if (b) { this.element.addClass(this.css.disabledClass) } else { this.element.removeClass(this.css.disabledClass) } break; case "orientation": this._detectOrientation(); this._refreshValue(); break; case "value": this._animationOff = true; c.value = this._trimValue(b); this._refreshValue(); this._change(null); this._animationOff = false; break; case "endValue": c.endValue = this._trimValue(b); this._refreshValue(); break; case "max": if (c.endValue > c.max) { c.endValue = c.max; this._refreshValue() } break; case "width": this.element.css("width", b); break; case "height": this.element.css("height", b); break; case "animate": c.animate = b; break; case "animateTimeout": c.animateTimeout = b; break; default: break } }, _trimValue: function (b) { if (b < this.options.min) { return this.options.min } if (b > this.options.max) { return this.options.max } return parseInt(b, 10) }, _refreshValue: function () { var d = this.options, b = d.value, h = d.min, c = d.max, e = d.endValue, f = (c !== h) ? (b - h) / (c - h) * 100 : 0, g = (b !== e) ? (e - b) / (c - h) * 100 : 0, i = a("#" + this._id("_progress")); if (d.range) { if (d.orientation === "horizontal") { i.css("left", f + "%").css("width", g + "%") } else { i.css("bottom", f + "%").css("height", g + "%") } } else { if (d.animate === true) { if (d.orientation === "horizontal") { if (i[0].style.width === "0%") { i.css({ width: "0px" }) } if (i.is(":hidden") === false) { i.animate({ width: f + "%" }, d.animateTimeout) } else { i.css("width", f + "%") } } else { if (i[0].style.height === "0%") { i.css({ height: "0px" }) } if (i.is(":hidden") === false) { i.animate({ height: f + "%" }, d.animateTimeout) } else { i.animate({ height: f + "%" }, d.animateTimeout) } } } else { if (d.orientation === "horizontal") { i.css("width", f + "%") } else { i.css("height", f + "%") } } } } }); a.extend(a.ui.igProgressBar, { version: "11.1.20111.2010" }); a.widget("ui.igButton", { options: { width: null, height: null, link: { href: null, target: null, title: null }, labelText: "", centerLabel: false, css: null, onlyIcons: false, icons: { primary: null, secondary: null }, title: false }, _id: function (b) { return this.element[0].id + b }, _create: function () { var f = this, b = f.options, g = this.element, d, c = { buttonClassIE6: "ui-ie6", buttonClasses: "ui-button ui-igbutton ui-widget ui-widget-content ui-corner-all ui-state-default", buttonHoverClasses: "ui-state-hover", buttonActiveClasses: "ui-state-active", buttonFocusClasses: "ui-state-focus", buttonLabelClass: "ui-button-text", buttonDisabledClass: "ui-state-disabled", buttonPrimaryIconClass: "ui-button-icon-primary ui-icon", buttonMainElementPrimaryIconClass: " ui-button-text-icon-primary", buttonMainElementSecondaryIconClass: " ui-button-text-icon-secondary", buttonSecondaryIconClass: "ui-button-icon-secondary ui-icon", buttonIconsOnly: "ui-button-icons-only", buttonIconOnly: "ui-button-icon-only", buttonIcons: "ui-button-text-icons", buttonTextOnlyClass: "ui-button-text-only" }; this._attached = false; b.css = a.extend(c, b.css); f._getInitValues(); if (g.is("div")) { f._renderDivButton() } else { if (g.is("a")) { f._renderAHref() } else { if (g.is("input")) { d = g.attr("type").toUpperCase(); if (d === "BUTTON" || d === "SUBMIT" || d === "RESET") { f._renderInput() } else { return } } else { if (g.is("button")) { f._renderButton() } else { return } } } } if (b.width !== null) { f._setWidth(b.width) } if (b.height !== null) { f._setHeight(b.height) } g.addClass(b.css.buttonClasses).addClass(b.css.buttonDefaultClasses); if (a.browser.msie === true && a.browser.version.slice(0, 1) === "6") { g.addClass(c.buttonClassIE6) } if (b.centerLabel === true) { f._centerLabel() } if (b.disabled) { f._disableButton() } else { f._enableButton() } f._setOnlyIcons(); g.attr("role", "button"); g.attr("aria-disabled", "false"); f._attachButtonEvents(); f.setTitle(b.title); return this }, setTitle: function (c) { var b = this.element; if (c === false) { b.removeAttr("title") } else { b.attr("title", c) } }, widget: function () { return this.element }, _isRedirect: function () { return this.options.link.href !== null }, _renderDivButton: function () { this._setLabel() }, _renderAHref: function () { this._setLinkOptions(true); this._setLabel() }, _renderInput: function () { var b = this.element; b.attr("value", this.options.labelText) }, _renderButton: function () { this._setLabel() }, _disableButton: function () { var b = this, c = b.element; c.addClass(b.options.css.buttonDisabledClass); if (c.is("a") === true) { c.removeAttr("href"); c.removeAttr("target"); c.removeAttr("title") } else { c.attr("disabled", "true") } }, _enableButton: function () { var c = this, d = c.element, b = this.options; if (d.hasClass(b.css.buttonDisabledClass)) { d.removeClass(b.css.buttonDisabledClass) } d.removeAttr("disabled"); if (d.is("a") === true) { c._setLinkOptions(true) } }, _setLabel: function () { var j = this.element, g = this.options, b = g.icons, i = g.css, f = "", c = this._isSetPrimaryIcon(), h = this._isSetSecondaryIcon(), d = (g.labelText === null || g.labelText === "") ? j.text() : g.labelText; j.attr("title", g.labelText); if (j.is("input")) { j.attr("value", g.labelText); return } if (c) { f += '<span class="' + i.buttonPrimaryIconClass + " " + b.primary + '" id="' + this._id("_picn") + '"></span>' } f += '<span class="' + g.css.buttonLabelClass + '" id="' + this._id("_lbl") + '">' + d + "</span>"; if (h) { f += '<span class="' + i.buttonSecondaryIconClass + " " + b.secondary + '" id="' + this._id("_sicn") + '"></span>' } if (c && h && !g.onlyIcons) { j.addClass(i.buttonIcons) } else { if (g.onlyIcons) { this._setOnlyIcons() } else { if (c) { j.addClass(i.buttonMainElementPrimaryIconClass) } else { if (h) { j.addClass(i.buttonMainElementSecondaryIconClass) } else { j.addClass(i.buttonTextOnlyClass) } } } } j.html(f) }, _setOnlyIcons: function () { var b = this.element, c = this.options.css; if (this.options.onlyIcons === false) { if (b.hasClass(c.buttonIconsOnly)) { b.removeClass(c.buttonIconsOnly) } if (b.hasClass(c.buttonIconOnly)) { b.removeClass(c.buttonIconOnly) } if (this._isSetPrimaryIcon() && this._isSetSecondaryIcon()) { b.addClass(c.buttonIcons) } } else { if (this._isSetPrimaryIcon() && this._isSetSecondaryIcon()) { b.addClass(c.buttonIconsOnly) } else { b.addClass(c.buttonIconOnly) } } }, _setLinkOptions: function (c) { var f = this, d = f.element, b = this.options; if (c) { if (b.link !== null && b.link.href !== null) { d.attr("href", b.link.href) } else { d.removeAttr("href") } if (b.link !== null && b.link.target !== null) { d.attr("target", b.link.target) } else { d.removeAttr("target") } if (b.link !== null && b.link.title !== null) { d.attr("title", b.link.title) } else { d.removeAttr("title") } } }, _setWidth: function (c) { var b = this.element; if (c === null) { b.css("width", "") } else { b.css("width", c) } }, _setHeight: function (c) { var b = this.element; if (c === null) { b.css("height", "") } else { b.css("height", c) } }, _setOption: function (f, b) { var d = this.element, c = this; a.Widget.prototype._setOption.apply(this, arguments); switch (f) { case "width": c._setWidth(b); break; case "height": c._setHeight(b); break; case "link": c._setLinkOptions(d.is("a") === true); break; case "disabled": b = Boolean(b); if (b === true) { c._disableButton() } else { c._enableButton() } break; case "labelText": c._setLabel(); break; case "centerLabel": b = Boolean(b); if (b) { c._centerLabel() } else { c._removeCenterLabel() } break; case "onlyIcons": b = Boolean(b); c._setOnlyIcons(); break; case "icons": c._setLabel(); break; case "title": c.setTitle(b); break; default: break } }, _centerLabel: function () { var d = this, g = d.element, c = a("#" + d._id("_lbl")), b = (g.width() - c.width()) / 2, f = (g.height() - c.height()) / 2; c.css({ position: "relative", top: f + "px", left: b + "px" }) }, _removeCenterLabel: function () { var b = this, c = a("#" + b._id("_lbl")); if (c.length > 0) { c.css({ position: "", top: "", left: "" }) } }, _dettachEvents: function () { var b = this, c = b.element; this._attached = false; c.unbind(this._events); return }, _onMouseOver: function (b) { if (this.options.disabled === true) { return } this.element.addClass(this.options.css.buttonHoverClasses); if (!this._trigger("mouseover", b)) { return } }, _onMouseOut: function (c) { var d = this, f = d.element, b = this.options; if (b.disabled === true) { return } f.removeClass(b.css.buttonHoverClasses); if (!d._trigger("mouseout", c)) { return } }, _onClick: function (c) { var f = this.element, d = this, b = this.options; if (b.disabled === true) { return } if (d._isRedirect() === true && f.is("a") === false) { if (b.link.target === "_blank") { window.open(b.link.href) } else { window.location = b.link.href } } if (!d._trigger("click", c)) { return } }, _onMouseDown: function (c) { var d = this.element, b = this.options; if (b.disabled === true) { return } d.addClass(b.css.buttonActiveClasses); if (!this._trigger("mousedown", c)) { return } }, _onMouseUp: function (b) { var c = this.options; if (c.disabled === true) { return } this.element.removeClass(c.css.buttonActiveClasses); if (!this._trigger("mouseup", b)) { return } }, _onFocus: function (b) { var c = this.options; if (c.disabled === true) { return } this.element.addClass(c.css.buttonFocusClasses); if (!this._trigger("focus", b)) { return } }, _onBlur: function (b) { var c = this.options; if (c.disabled === true) { return } this.element.removeClass(c.css.buttonFocusClasses); if (!this._trigger("blur", b)) { return } }, _attachButtonEvents: function () { var b = this, c = b.element; if (this._attached === true) { return } this._attached = true; this._events = { mouseover: function (d) { b._onMouseOver(d, b) }, click: function (d) { b._onClick(d) }, mouseout: function (d) { b._onMouseOut(d) }, mousedown: function (d) { b._onMouseDown(d) }, mouseup: function (d) { b._onMouseUp(d) }, focus: function (d) { b._onFocus(d) }, blur: function (d) { b._onBlur(d) } }; c.bind(this._events) }, _isSetPrimaryIcon: function () { var c = this.options.icons.primary, b = false; if (c !== undefined && c !== null && typeof c !== undefined) { b = true } return b }, _isSetSecondaryIcon: function () { var c = this.options.icons.secondary, b = false; if (c !== undefined && c !== null && typeof c !== undefined) { b = true } return b }, _setAttribute: function (d, c, b) { if (c !== undefined && c !== "" && c !== null) { d.attr(b, c) } else { d.removeAttr(b) } }, destroy: function () { this._dettachEvents(); this._rollbackInitValues(); a.Widget.prototype.destroy.apply(this, arguments) }, _getInitValues: function () { var b = this.element; this._innerHTML = b.html(); this._cssClasses = b.attr("class"); this._role = b.attr("role"); this._href = b.attr("href"); this._title = b.attr("title"); this._target = b.attr("target"); this._width = b.attr("width"); this._height = b.attr("height"); this._disabled = b.attr("disabled"); this._value = b.val() }, _rollbackInitValues: function () { var b = this.element; b.html(this._innerHTML); if (b.is("a")) { this._setAttribute(b, this._href, "href"); this._setAttribute(b, this._target, "target") } else { if (b.is("input")) { b.val(this._value) } } this._setAttribute(b, this._title, "title"); this._setAttribute(b, this._width, "width"); this._setAttribute(b, this._height, "height"); this._setAttribute(b, this._cssClasses, "class"); this._setAttribute(b, this._role, "role"); this._setAttribute(b, this._disabled, "disabled") } }); a.extend(a.ui.igButton, { version: "11.1.20111.2010" }); a.widget("ui.igTooltip", { css: { baseClasses: "ui-widget ui-igtooltip", arrowImageBaseClass: "ui-igtooltip-arrow-" }, options: { text: "", arrowLocation: "top" }, _setOption: function (b, c) { a.Widget.prototype._setOption.apply(this, arguments); switch (b) { case "text": a("div.ui-widget-content", this.element).html(c); break; case "arrowLocation": a("div", this.element).remove(); this._renderTooltip(); break } }, _create: function () { if (this.element.is("div")) { this._renderTooltip(); this.element.addClass(this.css.baseClasses) } }, _renderTooltip: function () { switch (this.options.arrowLocation) { case "top": this._createArrowDiv(); this._createContentDiv(); break; case "bottom": this._createContentDiv(); this._createArrowDiv(); break; case "left": break; case "right": break } }, _createContentDiv: function () { var b = (this.options.text && this.options.text.length > 0) ? this.options.text : ""; a('<div class="ui-widget-content ui-corner-all">' + b + "</div>").appendTo(this.element) }, _createArrowDiv: function () { a('<div class="' + this.css.arrowImageBaseClass + this.options.arrowLocation + '"></div>').appendTo(this.element) }, destroy: function () { this.element.children().remove(); this.element.removeClass(this.css.baseClasses) } }); a.extend(a.ui.igTooltip, { version: "11.1.20111.2010" }) } (jQuery)); (function (e) { var a = "=id", f = null, c = {}, d = function (g) { try { g.preventDefault(); g.stopPropagation() } catch (h) { } }, b = function (h, g) { var i = h.id; if (!i && g) { h._fid = g } return i ? i : h._fid }; e.widget("ui.igValidator", { options: { showIcon: null, animationShow: null, animationHide: null, enableTargetErrorCss: null, alignment: null, keepFocus: null, onchange: null, onblur: null, formSubmit: null, onsubmit: null, bodyAsParent: true, required: false, minLength: -1, maxLength: -1, min: null, max: null, regExp: null, checkboxesName: false, locale: null, element: null, theme: null, errorMessage: null }, css: { label: "ui-igvalidator ui-widget ui-state-error", icon: "ui-igvalidator-icon ui-icon ui-icon-alert", target: "ui-igvalidator-target" }, locale: { defaultMessage: "Please fix this field", selectMessage: "Please select a value", rangeSelectMessage: "Please select no more than {0} and not less than {1} items", minSelectMessage: "Please select at least {0} items", maxSelectMessage: "Please select no more than {0} items", rangeLengthMessage: "Please enter a value between {0} and {1} characters long", minLengthMessage: "Please enter at least {0} characters", maxLengthMessage: "Please enter no more than {0} characters", requiredMessage: "This field is required", maskMessage: "Please fill all required positions", dateFieldsMessage: "Please enter values in date fields", invalidDayMessage: "Invalid day of month. Please enter correct day", dateMessage: "Please enter a valid date", numberMessage: "Please enter a valid number", rangeMessage: "Please enter a value between {0} and {1}", minMessage: "Please enter a value greater than or equal to {0}", maxMessage: "Please enter a value less than or equal to {0}" }, events: { checkValue: null, validation: null, errorShowing: null, errorHiding: null, errorShown: null, errorHidden: null }, _create: function () { var l, k, g, i = this.options, j = this, h = e.ui.igValidator.defaults; for (l in i) { if (i.hasOwnProperty(l) && i[l] === null && h[l] !== undefined) { i[l] = h[l] } } g = j.element; j._state = 3; j._focTime = 0; j._init0(); k = g[0].nodeName; if (k === "SELECT") { k = 5 } else { if ((k = g[0].type) === "checkbox") { k = i.checkboxesName ? 6 : 4 } else { if (k === "radio") { k = 6 } else { k = 0 } } } j._elem = (k !== 6) ? g : e("[name=" + g[0].name + "]").map(function () { return (this.form === g[0].form) ? this : null }); j._t = k; if (!i.ctl) { j._elem.bind(j._evts = { keydown: function (m) { if ((l = m.keyCode) < 15 || l > 20) { j._evt(m, (l === 9) ? null : j, l === 9) } }, change: function (m) { j._evt(m, j) }, cut: function (m) { j._evt(m, j) }, paste: function (m) { j._evt(m, j) }, beforecut: function (m) { j._evt(m, j) }, drop: function (m) { j._evt(m, j) }, dragend: function (m) { j._evt(m, j) }, blur: function (m) { j._evt(m, j, 1) } }); if (i.element) { i.element.bind(j._evtsE = { mousedown: function (m) { j._evt(m, j) }, mouseup: function (m) { j._evt(m) } }) } } }, _evt: function (j, g, h) { var i = this.options; if ((h && !i.onblur) || (!h && !i.onchange)) { return } if (g) { setTimeout(function () { g.validate(j) }, 20) } else { this.validate(j) } }, _loc: function (j, i) { var h, g = this.options; if (!(h = g.errorMessage) && !(h = g[j += (i ? "" : "Message")])) { g = g.locale; if (typeof g === "string") { g = e.ui.igValidator.locale[g] } if (!g || !(h = g[j])) { h = e.ui.igValidator.locale.defaults[j] } } return h ? h : this.locale[j] }, _foc1: function (g) { g = g.keepFocus; return (g && this._t !== 6 && !(g.indexOf && g.indexOf("n") === 0)) ? ((g === "once" || g === 1) ? 1 : 2) : null }, _init0: function (g) { var h, k, l, i = this._id, j = this.options; if (g) { this._doError() } else { if (j.ctl) { j.ctl._validator = this } } if (!(h = this.element[0].form)) { return } k = b(h, "fid"); if (!i) { if (!(i = this.element[0].id)) { i = (a += a.length) } this._id = i } l = c[k]; if (!g && (j.onsubmit || j.formSubmit)) { if (!h._ig_onsubmit && j.onsubmit) { h._ig_onsubmit = 1; e(h).submit(function (m) { var n = c[b(this)]; if (n) { n.validate(m) } }) } if (!h._ig_formsubmit && j.formSubmit) { h._ig_formsubmit = h.submit; h.submit = function () { var m = c[b(this)]; if (m && m.validate()) { return } if (this._ig_formsubmit) { this._ig_formsubmit() } } } if (!l) { l = c[k] = { ctls: {}, validate: function (q) { var m, o = false, p = 1, n = this.ctls; for (m in n) { if (n.hasOwnProperty(m) && n[m].validate(q, p)) { o = true; if (!e.ui.igValidator.defaults.showAllErrorsOnSubmit) { p = 2 } } } if (q && o) { d(q) } return o } } } l.ctls[i] = this } else { if (l && l.ctls && l.ctls[i]) { delete l.ctls[i] } } }, getLocaleOption: function (g) { return this._loc(g, 1) }, isMessageDisplayed: function () { return this._state > 6 }, isValidState: function () { return this._state < 6 }, hide: function (g) { this._doError(null, null, g ? 6 : 5) }, validate: function (n, p) { var q, r, j, h = null, i = "Length", g = this._t, k = -1, l = this.options, m = this.element; if (!m) { return } if (g > 3) { i = "Select"; k = j = (g === 5) ? (m[0].multiple ? e("option:selected", m[0]).length : m[0].selectedIndex) : this._elem.filter(":checked").length } else { j = m.val(); k = j.length } if (!this._trigger("checkValue", n, r = { message: this._loc("default"), value: l.ctl ? l.ctl.value() : j })) { return this._doError(r.message, n, p) } if (!l.required && k === 0) { return this._doError(null, n, p) } q = l.regExp; if (q) { if (!q.test) { q = new RegExp(q.toString()) } return this._doError(q.test(j) ? null : r.message, n, p) } if (l.ctl) { q = l.ctl._doInvalid(null, 9); return this._doError(q ? q.message : null, n, p) } q = l.minLength; r = l.maxLength; if (k >= 0 && (q > k || (r > 0 && r < k))) { if (q > 0 && r > 0) { h = this._loc("range" + i).replace("{0}", r).replace("{1}", q) } else { h = this._loc(((q > 0) ? "min" : "max") + i).replace("{0}", (q > 0) ? q : r) } } if (!h && l.required && (k === 0 || !j)) { h = this._loc((g > 4) ? "select" : "required") } if (!h && g < 2 && k > 0 && (q = ((typeof l.min === "number") ? 1 : 0) + ((typeof l.max === "number") ? 2 : 0)) > 0) { if (isNaN(j = parseFloat(j))) { h = this._loc("number") } else { if (q === 3 && (j < l.min || j > l.max)) { h = this._loc("range").replace("{0}", l.min).replace("{1}", l.max) } else { if (q === 1 && j < l.min) { h = this._loc("min").replace("{0}", l.min) } else { if (q === 2 && j > l.max) { h = this._loc("max").replace("{0}", l.max) } } } } } return this._doError(h, n, p) }, _doError: function (w, A, s) { var n, q, p, B, v, k, D, m, C, u, z, j = this.css, h = "left", i = "top", l = this._state, r = w, E = this._lbl, t = this, g = this.options; if (!s) { s = 0 } C = g.ctl; u = (g.alignment === "bottom") ? 0 : (g.alignment === "left") ? -1 : 1; if (!w && E) { w = E._txt } if (l < 6 && !r) { return } z = E && E._txt === w && !this._changed; this._changed = null; if (r && A && A.keyCode === 9 && t._foc1(g) === 2) { d(A); if (z) { return 2 } } if (r && z) { if (l > 5) { if (f === t) { t._focus(g, s, A) } return 2 } } if (!s && r && f && new Date().getTime() - f._focTime < 100) { return 2 } k = { message: w, invalid: !!r }; if (s < 5 && !t._trigger("validation", A, k)) { return } t._state = r ? 6 : 1; if (!(D = g.element)) { D = t.element } if (g.enableTargetErrorCss) { if (r) { D.addClass(j.target) } else { if (s !== 5) { D.removeClass(j.target) } } } if (s === 2) { return 2 } if (!t._trigger(r ? "errorShowing" : "errorHiding", A, k)) { return 1 } if (!r && !E) { return } w = k.message; t._state++; n = !g.bodyAsParent; if (n) { h = "marginLeft"; i = "marginTop" } q = C ? C._element : D; if (!E) { E = t.element[0].id; if (E) { E = ' for="' + E + '"' } E = t._lbl = e("<label" + E + "/>").addClass(j.label).css({ position: "absolute", visibility: "hidden" }); E[0].unselectable = "on"; E[0].innerHTML = w; E[0]._id = 98; t._dd = g.theme ? e("<span/>").addClass(g.theme).css("position", "absolute").append(E) : E; if (n) { t._dd.prependTo(q.parent()) } else { t._dd.appendTo(e("body")) } } if (r) { t._dd.css(h, "0px").css(i, "0px"); E._txt = w; if (g.showIcon) { if (w === " " || w === "&nbsp;") { w = "" } w = '<span class="' + j.icon + '"></span><span style="display:inline-block;width:18px;"></span>' + w } E[0].innerHTML = w; E.css("width", "auto").css("height", "auto"); E._width0 = E[0].offsetWidth; E._height0 = E[0].offsetHeight; E._width = Math.max(E.width(), 5); E._height = Math.max(E.height(), 10); if (g.showIcon) { E._height = Math.max(E.children()[0].offsetHeight, E._height) } t._focTime = 0; f = t } p = function () { if (r) { E.css("filter", "") } else { t._dd.remove(); t._dd = t._lbl = f = null } t._state++ }; if (r) { if ((m = g.animationShow) < 5) { m = null } t._focus(g, s, A); E.css({ opacity: m ? 0 : 1, height: (m ? 0 : E._height) + "px", width: Math.floor(E._width / ((m && u >= 0) ? 2 : 1)) + "px", display: "", visibility: "visible" }); B = (C && C._swap) ? t.element : D; v = B.offset(); v.top += u ? 0 : B.outerHeight(); if (C && C._swap) { v.left -= C._leftShift() } if (u) { v.left += (u < 0) ? -E[0].offsetWidth : q[0].offsetWidth } if (n) { B = E.offset(); v.left -= B.left; v.top -= B.top } t._dd.css(h, v.left + "px").css(i, v.top + "px"); if (m) { E.animate({ opacity: 1, height: E._height, width: E._width }, m, null, p) } else { p() } t._trigger("errorShown", A, k); return 2 } if ((m = g.animationHide) < 5) { m = null } if (m) { E.animate({ opacity: 0.6 }, Math.floor(m * 0.34)).animate({ opacity: 0, height: 0, width: Math.floor(E._width / ((u < 0) ? 1 : 2)) }, Math.floor(m * 0.66), null, p) } else { p() } t._trigger("errorHidden", A, k) }, _focus: function (g, i, j) { var h = (!i && this._foc1(g)) ? this.element : null; j = (j && j.keyCode !== 9) ? j.type : ""; if (h && !(g.ctl && g.ctl._fcs) && (this._foc1(g) !== 1 || !this._focTime) && j.indexOf("key") < 0 && j.indexOf("mouse") < 0) { if (e.ui.igEditor) { e.ui.igEditor._keepFoc = g.ctl } this._focTime = new Date().getTime(); setTimeout(function () { try { h.focus() } catch (k) { } }, 0) } }, _setOption: function (g, h) { if (this.options[g] === h) { return } e.Widget.prototype._setOption.apply(this, arguments); if (g !== "locale") { this._init0() } }, destroy: function () { var g = this.options; if (!g.ctl) { this._elem.unbind(this._evts); if (this._evtsE) { g.element.unbind(this._evtsE) } } this._init0(1); g.element = g.ctl = this._evts = this._evtsE = this._elem = null; e.Widget.prototype.destroy.apply(this, arguments); return this } }); e.extend(e.ui.igValidator, { version: "11.1.20111.2010" }); e.ui.igValidator.locale = { defaults: {} }; e.ui.igValidator.setDefaultCulture = function (g) { e.ui.igValidator.locale.defaults = e.extend({}, (typeof g === "string") ? e.ui.igValidator.locale[g] : g) }; e.ui.igValidator.defaults = { showAllErrorsOnSubmit: false, showIcon: true, animationShow: 300, animationHide: 300, enableTargetErrorCss: true, alignment: "bottom", keepFocus: null, onchange: true, onblur: true, formSubmit: false, onsubmit: true} } (jQuery)); (function (a) { var e = function (g, f) { return g === null || g === undefined || (f && typeof g === "number" && isNaN(g)) }, b = function (f, g) { if (isNaN(f = parseInt(f, 10))) { f = g ? g : 0 } return f }, d = function (f) { return e(f) ? "" : f.toString() }, c = function (f) { try { f.preventDefault(); f.stopPropagation() } catch (g) { } }; a.ig = a.ig || {}; a.widget("ui.igEditor", { options: { value: null, tabIndex: null, textMode: null, nullText: null, button: "none", buttonHidden: false, includeKeys: null, excludeKeys: null, textAlign: null, listItems: null, regional: null, theme: null, type: null, locale: null, width: null, height: null, validatorOptions: null, required: false, display: "inline-block", nullable: true, renderInContainer: false, toUpper: false, toLower: false, selectionOnFocus: -1, readOnly: false, maxLength: 0, spinDelta: 1, spinOnReadOnly: false, focusOnSpin: false, spinWrapAround: false, hideEnterKey: true, dropDownOnReadOnly: false, dropDownTriggers: "button, ctrl + arrow, alt + arrow", listMatchIgnoreCase: true, listMatchOnly: false, listMatchContains: false, listAutoComplete: false, listDropDownAsChild: false, listWidth: 0, listMaxHeight: 300, listColumns: 1, listAnimationShow: 400, listAnimationHide: 450, borderBetweenFieldAndButtons: false }, events: { keydown: 0, keypress: 1, keyup: 2, mousedown: 3, mouseup: 4, mousemove: 5, mouseover: 6, mouseleave: 7, focus: 8, blur: 9, valueChanging: 10, valueChanged: 11, textChanged: 12, invalidValue: 13, spin: 14, buttonClick: 15, showDropDown: 16, hideDropDown: 17, listSelecting: 18, listSelected: 19 }, css: { editor: "ui-igedit", field: "ui-igedit-field", textArea: "ui-igedit-textarea", hover: "ui-igedit-hover", focus: "ui-igedit-focus", buttonsImageStateOverride: "ui-igedit-buttonsimagestateoverride", borderColor: "ui-igedit-bordercolor", disabled: "ui-igedit-disabled ui-state-disabled", negative: "ui-igedit-negative", nullValue: "ui-igedit-nullvalue", fieldInContainer: "ui-igedit-fieldincontainer", button: "ui-igedit-button", buttonFocus: "ui-igedit-buttonfocus ui-state-focus", buttonDefault: "ui-igedit-buttondefault ui-state-default", buttonHover: "ui-igedit-buttonhover ui-state-hover", buttonPressed: "ui-igedit-buttonpressed ui-state-highlight", buttonDisabled: "ui-igedit-buttondisabled ui-state-disabled", buttonImage: "ui-igedit-buttonimage ui-icon-triangle-1-s ui-icon", buttonClearImage: "ui-icon-circle-close", buttonImageHover: "ui-igedit-buttonimagehover", buttonImagePressed: "ui-igedit-buttonimagepressed", buttonImageDisabled: "ui-igedit-buttonimagedisabled", spinHolder: "ui-igedit-spinholder", spinButton: "ui-igedit-spinbutton", spinButtonImage: "ui-igedit-spinbuttonimage", spinLowerImage: "ui-igedit-spinlowerimage ui-icon-triangle-1-s ui-icon", spinLowerImageHover: "ui-igedit-spinlowerimagehover", spinLowerImagePressed: "ui-igedit-spinlowerimagepressed", spinLowerImageDisabled: "ui-igedit-spinlowerimagedisabled", spinUpperImage: "ui-igedit-spinupperimage ui-icon-triangle-1-n ui-icon", spinUpperImageHover: "ui-igedit-spinupperimagehover", spinUpperImagePressed: "ui-igedit-spinupperimagepressed", spinUpperImageDisabled: "ui-igedit-spinupperimagedisabled", dropDown: "ui-igedit-dropdown", list: "ui-igedit-list ui-widget ui-widget-content", listItem: "ui-igedit-listitem ui-state-default", listItemHover: "ui-igedit-listitemhover ui-state-hover", listItemSelected: "ui-igedit-listitemselected ui-state-highlight", listItemColumnBorder: "ui-igedit-listitemcolumnborder" }, locale: { spinUpperTitle: "Increment", spinLowerTitle: "Decrement", buttonTitle: "Show list", clearTitle: "Clear value", datePickerButtonTitle: "Show calendar" }, regional: a.ig._regional || {}, _create: function (m) { var q, i, h = this.css, g, f, p, l, k, j = this.options, n = this; m = this._doType(e(m) ? j.type : m, i = j.value); this._listID = -1; l = j.theme; this._css = h.field; g = this._element = this._render(this.element, j, h); if (j.display) { g.css("display", j.display) } if (m === 3 && (!a.datepicker || this._ta)) { throw new Error("The ui.igDatePicker depends on jquery.ui.datepicker and TEXTAREA/multiline is not supported") } if (this._ta) { this._css += " " + h.textArea } f = this._field; this._box = f[0].type === "checkbox"; this._1e = f === g; if (j.readOnly) { f[0].readOnly = "readonly" } p = j.textAlign; if (!p && m > 3) { p = "right" } if (p) { f.css("textAlign", p) } f[0]._id = -1; f[0].disabled = j.disabled; this._hover = this._mouseDown = 0; this._fix = 1; this._fcs = -1; this._bad = 0; this._k0 = this._sel0 = 0; this._noPaste = 0; this._fixMode(1); this._butHide = false; f.bind(n._evts = { keydown: function (o) { n._onEvt(o, 0) }, keypress: function (o) { n._onEvt(o, 1) }, keyup: function (o) { n._onEvt(o, 2) }, paste: function (o) { n._onEvt(o, 11) }, beforecut: function (o) { n._onEvt(o, 11) }, cut: function (o) { n._onEvt(o, 11) }, drop: function (o) { n._onEvt(o, 11) }, focus: function (o) { n._onEvt(o, 8) }, blur: function (o) { n._onEvt(o, 9) } }); q = { mousedown: function (o) { n._onEvt(o, 3) }, mouseup: function (o) { n._onEvt(o, 4) }, mousemove: function (o) { n._onEvt(o, 5) }, mouseover: function (o) { n._onEvt(o, 6) }, mouseleave: function (o) { n._onEvt(o, 7) } }; if (this._buttons && this._buttons[1]) { q.DOMMouseScroll = function (o) { n._onEvt(o, 10) }; q.mousewheel = function (o) { n._onEvt(o, 10) } } g.bind(n._mEvts = q); this._fcs = 0; q = j.maxLength; if (q && q > 0) { f[0].maxLength = q } q = j._vsFormat; if (q && i && m > 3 && (typeof i !== "number")) { i = parseFloat(this._txtAsNum(i.toString(), q, "-")) } this._setVal(e(i) ? this._value : i); if (this._val() === "") { this._text = this._field[0].value = this._focTxt("", false, "") } this._fixCss(); k = this._oldCss; if (!(i = j.height) && !this._1e) { i = k.height; if (i) { i = (i.indexOf("px") > 0) ? b(i) : this.element.height() } } this._height(i); if (this._box) { this._fixBC(f, f) } if (!(i = j.width) && !this._1e) { i = k.width; if (i) { i = (i.indexOf("px") > 0) ? b(i) : this.element.width() } } if (this._selElem) { delete k.width; delete k.height } this._width(i); this._lastText = this._val(); this._initValidator(); this._doClear(j.value) }, _doType: function (g, f) { if (g === "text") { g = 0 } if (g === "mask") { g = 1 } if (g === "date") { g = 2 } if (g === "datepicker") { g = 3 } if (g === "numeric") { g = 4 } if (g === "currency") { g = 5 } if (g === "percent") { g = 6 } if (typeof g !== "number" || g < 0 || g > 6) { if (typeof f === "number") { g = 4 } else { if (f && f.getMonth) { g = 2 } else { g = 0 } } } this._type = g; return g }, _render: function (l, u, y) { var w, j, p, x, g, f, t, A, n, s, r, v, k, q = l.css("direction") === "rtl", B = null, m = u.button, z = l, h = null; j = l[0].nodeName; p = l[0].parentNode; if (j) { j = j.toUpperCase() } this._ta = (j === "TEXTAREA"); this._left = q; g = j === "INPUT"; h = this._selElem = j === "SELECT"; w = m && m.indexOf("spin") >= 0; k = this._clear = m && m.indexOf("clear") >= 0; m = k || (m && m.indexOf("dropdown") >= 0) || (h && !w); f = !u.borderBetweenFieldAndButtons && (w || m); t = (m || w || u.renderInContainer || u.theme); A = this._oldCss = { display: 0, visibility: 0 }; n = this._oldAttr = { className: 0, title: 0 }; if (g) { n.value = 0 } else { if (h) { if (!(h = u.listItems)) { u.listItems = []; h = l[0].options; s = h ? h.length : 0; if (s > 0) { while (s-- > 0) { r = h[s].value; u.listItems[s] = { value: r, text: e(v = h[s].text) ? r : v} } this._listID = l[0].selectedIndex } h = 1 } } else { n.innerHTML = 0 } } if (g || this._ta) { n.disabled = n.readOnly = n.alt = A.textAlign = 0; if (f) { A[q ? "borderLeftWidth" : "borderRightWidth"] = 0 } } for (s in A) { if (A.hasOwnProperty(s)) { A[s] = l.css(s) } } for (s in n) { if (n.hasOwnProperty(s)) { n[s] = l[0][s] } } A.width = l[0].style.width; A.height = l[0].style.height; if ((s = g ? n.value : (h ? l.val() : n.innerHTML)) === u.nullText) { s = "" } if (!this._ta && s) { s = s.replace(/[\x09\x0a]/g, "") } this._value = s; if (g || this._ta || h) { if (n.className) { this._css += " " + n.className } if (t) { this._swap = true; l.css("display", h ? "none" : ""); l.css("visibility", h ? "hidden" : "visible"); l = a("<span />"); p.insertBefore(l[0], z[0]); if (h) { z = a("<input />") } else { p.removeChild(z[0]) } l.css("display", A.display); l.css("visibility", A.visibility) } else { this._css += " " + y.editor; return (this._field = l) } } else { if (u.textMode === "textarea" || u.textMode === "multiline") { z = a("<textarea />"); this._ta = 1 } else { z = a(u.textMode ? '<input type="' + u.textMode + '"/>' : "<input />") } l[0].innerHTML = "" } l.addClass(y.editor); this._css += " " + y.fieldInContainer; if (u.theme) { l.addClass(u.theme) } if (m || w) { this._buttons = [] } if (f) { z.css(this._bb = q ? "borderLeftWidth" : "borderRightWidth", "0px"); if (w) { this._bb = null } } if (m) { x = [y.button + " " + y.buttonDefault, y.buttonHover, y.buttonPressed, y.buttonDisabled, y.buttonImage + (k ? " " + y.buttonClearImage : ""), y.buttonImageHover, y.buttonImagePressed, y.buttonImageDisabled]; m = this._buttons[0] = a("<span />").addClass(x[0]); m[0].longdesc = m[0].title = this._optVal("buttonTitle", 1); m._css = x; v = a("<span />").addClass(x[4]).appendTo(m); v[0]._id = 5; m[0]._id = 1; if (q) { m.css("float", "left"); m.appendTo(l) } } if (w) { B = a("<span />").addClass(y.spinHolder); x = [y.spinButton + " " + y.buttonDefault, y.buttonHover, y.buttonPressed, y.buttonDisabled, y.spinButtonImage + " " + y.spinUpperImage, y.spinUpperImageHover, y.spinUpperImagePressed, y.spinUpperImageDisabled]; r = this._buttons[1] = a("<span />").addClass(x[0]).appendTo(B); r[0].longdesc = r[0].title = this._optVal("spinUpperTitle", 3); r._css = x; r[0]._id = 2; v = a("<span />").addClass(x[4]).appendTo(r); v[0]._id = 6; x = [y.spinButton + " " + y.buttonDefault, y.buttonHover, y.buttonPressed, y.buttonDisabled, y.spinButtonImage + " " + y.spinLowerImage, y.spinLowerImageHover, y.spinLowerImagePressed, y.spinLowerImageDisabled]; r = this._buttons[2] = a("<span />").addClass(x[0]).appendTo(B); r[0].longdesc = r[0].title = this._optVal("spinLowerTitle", 3); r._css = x; r[0]._id = 3; v = a("<span />").addClass(x[4]).appendTo(r); v[0]._id = 7; if (q) { B.appendTo(l) } } this._field = z.appendTo(l); if (!e(s = u.tabIndex)) { z[0].tabIndex = s } if (!q && w) { B.appendTo(l) } if (!q && m) { m.appendTo(l) } return l }, _leftShift: function () { var f = this._buttons; return (this._left && f) ? (f[0] ? f[0].outerWidth() : 0) + (f[1] ? f[1].outerWidth() : 0) : 0 }, _val: function () { return this._box ? this._field[0].checked : (this._nullT ? "" : this._field[0].value) }, _fixNull: function () { var f, g = this.options.nullText; if (!g) { return } f = this._val(); this._nullT = null; if (f === "" && g && this._fcs < 2) { this._nullT = true; this._field[0].value = g } this._fixCss() }, _focTxt: function (g, h, i) { var f = this.options.nullText; this._nullT = null; if (!h && g === "" && f && (!e(i) || this.options.readOnly)) { g = f; this._nullT = true } return g }, validate: function (f) { return !this.options.validatorOptions || !this._doInvalid(null, f ? 2 : 1) }, isValid: function () { return !this._doInvalid(null, 9) }, _doInvalid: function (q, p) { if (!this._field) { return } var j, g, n, k = this._val(), m = false, f = 1, r = null, l = this.options, h = this._type; this._inv = null; if (l.required && (!k || (h === 1 && !this.getValueByMode(0, "", 1)))) { r = 1 } else { if (h === 0) { if (!l.nullable && !k) { r = 1 } } else { if (h === 1) { k = this._txt; g = k.length; while (g-- > 0 && !r) { j = k.charCodeAt(g); if (j < 21 && (j % 2) === 1) { r = { value: k = this._getVal(), message: this._optVal("mask", 2)} } } } else { if (h < 4) { k = this._toDate(k, q === "", true, true); r = this._inv } else { k = this._toNum(k, true, true); r = this._inv; f = this._prop(7); if (r && k && f > 1) { n = k; r.value = (k /= f) } } } } } if (r === 1) { r = { value: k = null, message: this._optVal("required", 2)} } if (p === 9) { return r } if (r) { m = this._fire(13, null, r); if (k !== r.value) { k = r.value; r = null } if (n) { if (r) { k = n } else { if (e(k, 1)) { k = null } else { if (k) { k *= f } } } } if (h <= 1 && !r) { this._setVal(k); return } } if (h > 1 && h < 4) { if (!(this._isNull = e(k))) { this._date = k } if (k && l.useLastGoodDate) { this._goodD = k } } this._value = k; if (p && r && !m && !this._setOpt) { return this._doError(p, null, r.message) } }, _focusTxt: function (m, k, f) { var j = k, l = "", g = this.options, i = this._type, n = null, h = ""; if (i === 1) { f = null; if (!e(k) && !m) { k = k !== ""; if (k && this._bad !== 0) { this._txt = this._setTxt(this._val(), 5, true) } f = this._txt; if (!k) { this._doInvalid(j) } } l = this._getTxt(m ? 5 : 4, m ? g.promptChar : g.padChar, f) } else { if (i === 2 || i === 3) { if (e(f)) { h = g.promptChar; if (e(k) && m) { return this._getTxt(5, h) } if (!e(k) && !m) { this._doInvalid(k); n = this._value } else { if (!this._isNull) { n = this._date } } } else { n = this._toDate(f, m, true) } l = this._toTxt(n, m, h, !e(k)) } else { if (i > 3) { if (!e(k) && !m) { this._doInvalid() } l = this._toTxtNum(this._value, m) } else { l = this._val(); if (!e(k) && !m) { this._doInvalid(k) } } } } return this._focTxt(l, m, k) }, _repaint: function () { if (this._val() !== this._text) { this._field[0].value = this._text } }, _instant: function (h, j, l) { var g, i = this._type, k = this._dataMode; if (this._box) { return this._val() } if (i === 1) { return this.getValueByMode(k, h, j) } if (i === 2 || i === 3) { return this.getValueByMode(h ? 0 : k, j) } if (i > 3) { g = this._toNum(this._val(), j); if (g && (j || l) && !isNaN(g)) { g /= this._prop(7) } return (h || k > 0) ? g : this._toTxtNum(g, k === 0) } return this._val() }, _optVal: function (i, g) { var h = this._validator, f = this.options; if (g === 2) { return h ? h._loc(i) : "" } if (!e(h = f[i])) { return h } if (g === 3 || g === 1) { if (this._clear) { i = "clearTitle" } else { if (g === 1 && this._type === 3) { i = "datePickerButtonTitle" } } f = f.locale; if (typeof f === "string") { f = a.ui.igEditor.locale[f] } if (!f || !(h = f[i])) { h = a.ui.igEditor.locale.defaults[i] } return h ? h : this.locale[i] } f = f.regional; if (typeof f === "string") { f = a.ig.regional[f] } if (!f || e(h = f[i])) { h = a.ig.regional.defaults[i] } return e(h) ? this.regional[i] : h }, _setOption: function (n, j) { var p, l = j, f = null, k = this.options, i = n === "locale", h = n === "regional", g = this._buttons, m = this._field; if (k[n] === j || n === "textMode") { return } if (n === "buttonHidden") { return this._butVis(j) } if (n === "theme") { if (this._1e) { return } if (k.theme) { this._element.removeClass(k.theme) } if (j) { this._element.addClass(j) } this._listRemove() } if (n === "inputMask" && this._type === 1) { l = this.getValueByMode(0, " ", 1); this._setMask(j); this._setTxt(l, 0) } k[n] = j; if (h && this._dp) { f = this._dpRegion(); if (f) { this._dpOption(k.datepickerOptions = a.extend(k.datepickerOptions, f)) } } p = "buttonTitle"; if ((i || n === p) && g && g[0]) { g[0][0].title = this._optVal(p, 1) } p = "spinUpperTitle"; if ((i || n === p) && g && g[1]) { g[1][0].title = this._optVal(p, 3) } p = "spinLowerTitle"; if ((i || n === p) && g && g[2]) { g[2][0].title = this._optVal(p, 3) } if (n === "disabled") { m[0].disabled = j; this._fixCss() } if (n === "display") { this._element.css(n, j) } if (n === "textAlign") { m.css(n, j) } if (n === "readOnly") { m[0].readOnly = j ? "readonly" : "" } if (n === "maxLength" || n === "tabIndex") { m[0][n] = j } if (n === "value") { this.value(j) } if (n === "width") { this._width(j) } if (n === "height") { this._height(j) } if (n === "validatorOptions" || n === "required") { this._initValidator() } if (n === "nullText") { this._fixNull() } if (n === "type") { this._doType(j); h = 3 } n = n.toLowerCase(); if (n.indexOf("list") === 0) { this._listRemove() } else { if (n.indexOf("kero") > 0) { if (this._dp) { this._dpOption(j) } } else { if (n.indexOf("data") >= 0 || h || !e(this.regional[n]) || n.indexOf("date") === 0 || n.indexOf("max") >= 0 || n.indexOf("min") >= 0 || n.indexOf("pat") >= 0 || n.indexOf("roup") > 0 || n.indexOf("sep") >= 0 || n.indexOf("ymb") > 0) { this._setOpt = true; this._listRemove(); this._fixMode((h === 3) ? 3 : 0); this._repaint(); this._lastText = this._val(); this._setOpt = null } } } return this }, _dpRegion: function () { var f = this.options.regional; return (a.datepicker && typeof f === "string") ? a.datepicker.regional[(f === "defaults" || f === "en-US") ? "" : f] : null }, _dpOption: function (f) { var g = this._getVal(1); this._field.datepicker("option", f); this._setVal(g) }, getRegionalOption: function (f) { return this._optVal(f) }, field: function () { return this._field }, mainElement: function () { return this._element }, dropDownElement: function () { var f = this._ddList; if (this._type === 3) { f = a.datepicker; if (f) { f = (f._ig_dp === this) ? f.dpDiv : null } } return f ? f : null }, show: function () { return this._vis(true) }, hide: function () { return this._vis() }, remove: function () { var g, f = this._element; g = (f && f[0]) ? f[0].parentNode : null; if (g && g.tagName) { this._doError(); this._doDrop(); this._stopTimer(); this._hadFocus = a.ui.igEditor._keepFoc = null; this._noPaste = this._fcs = this._k0 = this._hover = this._mouseDown = 0; g.removeChild(f[0]) } return this }, dropDownVisible: function (f) { if (!arguments.length) { return !!this._ddOn } if (!f) { this._doDrop() } else { if (!this._ddOn) { this._doDrop(1) } } return this }, findListItemIndex: function (j, g, f, i) { var h = this._find(d(j), 0, 1, g, f, i); return h ? h.id : -1 }, addListItems: function (g, f) { return this._listChange(g, f, 2) }, addListItem: function (g, f) { return this._listChange([g], f, 2) }, removeListItem: function (f) { return this._listChange(f, -1, 1) }, removeListItemAt: function (f) { return this._listChange(null, f, 1) }, clearListItems: function () { return this._listChange(null, -1, 0) }, selectedListIndex: function (f) { if (!arguments.length) { return this._listID } this._listSelect(f) }, getSelectedListItem: function () { var g = this.options.listItems, f = this._listID; return (g && f >= 0) ? g[f] : null }, hasInvalidMessage: function () { return this._validator ? this._validator.isMessageDisplayed() : false }, validator: function () { var f = this._validator; return f ? f : null }, text: function (f, g) { if (!arguments.length) { return this._val() } if (this._type > 0) { this._sTxt = 1; if (this._type === 1) { this._setTxt(f, e(g) ? 5 : (1000 + g)) } else { this._setVal(f, true) } this._sTxt = 0 } else { if (f) { this._nullT = null } this._text = f; this._repaint() } if (this._fix === 1) { this._old = this._instant(1, null, 1) } return this }, value: function (f) { if (!arguments.length) { f = this._getVal(); return (f === undefined) ? null : f } this._setVal(f, true); this._lastText = this._val(); return this }, _getVal: function (g) { var f = this.options, h = this._instant(g, 1); if (this._type > 3) { if (e(h)) { h = f.nullValue; if (this._dataMode <= 0) { return d(h) } return (f.nullable || !e(h)) ? h : NaN } } return h }, _set_val: function (f, g) { this._fix = 0; this._setVal(f, g); this._fix = 1 }, _setVal: function (h, i) { var j, g, f = this._type; if (this._box) { if (h !== true) { h = h === "true" } this._field[0].checked = h } else { if (f === 1) { this._setTxt(d(h), this._dataMode) } else { if (f === 2 || f === 3) { if (!e(h) && !h.getTime) { if (!(i = this._toDate(h = h.toString(), this._dataMode < 2))) { i = this._toDate(h, true) } h = i } i = h; if (e(h = this._limits(h))) { h = i } this._txt = this._mask; if (!(this._isNull = e(h))) { this._toTxt(h, true, "", true) } else { h = new Date() } this._date = h; if (this.options.useLastGoodDate) { this._goodD = h } this._text = this._focusTxt(this._fcs > 1); this._repaint() } else { if (f > 3) { if (e(h, 1)) { h = null } if (h && typeof h === "number" && this._fix !== 0) { h *= this._prop(7) } j = this._toTxtNum(h = this._toNum(h, true), this._fcs === 2); g = this._prop(12); if (i === 2 && g > 0 && j.length > g) { return } this._focTxt(j); this._text = j; this._value = h; this._repaint() } else { this.text(d(h)) } } } } if (this._fix === 1 && f > 0) { this._old = this._instant(1, null, 1) } j = this.options.value = this._getVal(); this._doClear(j); this._fixNull(); this._dtt() }, _doClear: function (f) { if (this._clear) { if (this._type === 1) { f = this.getValueByMode(0) } if (f === "") { f = null } this._butVis(f === null) } }, _vis: function (f) { var g = this._element; g.css("display", f ? this.options.display : "none"); g.css("visibility", f ? "visible" : "hidden"); this._fixHeight(); this._doError(); return this }, _fixHeight: function () { var g, f = this._1e ? 0 : this._field[0].offsetHeight, i = this._element; g = (f && i.css("display").indexOf("inline") < 0) ? i[0].nodeName : null; if (g === "DIV" || g === "SPAN") { i.css("height", f) } }, _butW: function (f, g) { g = g ? f[0].parentNode : f[0]; return ((g = g.offsetWidth) < 2 || (f = b(f.css("width"), 0)) < 2) ? 0 : Math.max(g, f + 2) }, _fixWidth: function () { var m, j, f, g = 0, h = this._element, k = this._field, l = this._buttons; if (l) { if ((j = this._field[0].offsetWidth - 1) < 2) { return 1 } this._noWidth = null; if (l[0]) { if ((m = this._butW(l[0])) < 2) { return 1 } j += (this._wB = m); g += (16 - m) } if (l[1]) { if ((m = this._butW(l[1], 1)) < 2) { return 1 } j += m; g += (16 - m) } f = this._field[0].offsetHeight + 7; h.css("width", this._w0); if (g < 0) { k.css("width", this._wF = Math.max(this._wF + g, 2)) } g = 0; while (g++ < 5 && f <= h[0].offsetHeight) { h.css("width", ++this._w0) } this._butVis() } this._stopTimer() }, _butVis: function (g) { var k = this._wF, j = this._bb, i = this.options, h = this._buttons, f = this._field; if (e(g)) { if (!(g = i.buttonHidden)) { return } } else { i.buttonHidden = g } if (!this._wB || !h || !(h = h[0]) || this._butHide === g) { return } this._butHide = g; if (g) { h.hide(); k += this._wB + (j ? -1 : 0) } else { h.show() } if (j) { f.css(j, g ? "" : "0px") } f.css("width", k) }, _width: function (h) { var f = this, i = this._buttons, g = this._field; if (this._1e) { if (h) { g.css("width", h) } return } h = parseInt(h, 10); if (!h || isNaN(h) || h < 1) { h = 120 } h = (this._w0 = b(h)) - 1 - b(g.css("paddingLeft")) - b(g.css("paddingRight")); if ((h -= i ? ((i[0] ? 16 : 0) + (i[1] ? 16 : 0)) : 0) > 0) { g.css("width", h) } this._wF = h; if (this._fixWidth() && !this._timer) { this._noWidth = this._timer = setInterval(function () { f._fixWidth() }, 200) } }, _height: function (g) { var h = this._field, f = this._buttons; if (this._1e) { if (g) { h.css("height", g) } return } if ((g = b(g)) > 6) { if (f && f[1]) { g -= g % 2 } h.css("height", g); if (f && f[0]) { f[0].css("height", g); f[0].find("SPAN").css("marginTop", Math.floor((g - 16) / 2)) } if (f && f[1]) { f[1].css("height", g = Math.floor(g / 2) - 1); f[2].css("height", g); f[1].find("SPAN").css("marginTop", g = Math.floor((g - 16) / 2)); f[2].find("SPAN").css("marginTop", g) } } this._fixHeight() }, _spin: function (i) { var h, f, k, g = this._nullT, j = this.options; if (this._box) { return } if (this._fcs < 1 && j.focusOnSpin) { this.setFocus(); if (this._fcs < 1) { this._focSpin = i; return } } if (this._fire(14, null, i)) { return } if (g) { this._nullT = null; this._fixCss() } k = this._val(); this.spin(i); if (this._val() === k) { if (g) { this._nullT = g; this._fixCss(); return } if (this._type > 3 && j.spinWrapAround && !e(this._prop(10)) && !e(this._prop(11))) { h = this._sel0; f = this._prop(7); if (!f) { f = 1 } i = this._limits(this._getVal(true) * f, true); this._setVal(i / f, this._fcs); this.select(h) } } if (this._val() !== k) { this._fire(12) } }, _item: function (f) { if (f && !e(f.text)) { f = f.text } if (typeof f === "function") { f = f() } return e(f) ? "" : f }, _spinList: function (l) { var f, i, g, h, k, j = this.options; k = j.listItems; h = k ? k.length : 0; if (h < 1) { return 1 } l = (l < 0) ? 1 : -1; i = this._listID + l; g = j.spinWrapAround; if (i >= h) { if (!g) { return } i = 0 } if (i < 0) { if (!g) { return } i = h - 1 } f = this._instant(1, null, 1); if (f === this._item(k[i])) { if ((i += l) < 0) { if (!g) { return } i = h - 1 } if (i >= h) { if (!g) { return } i = 0 } } f = this._item(k[i]); if (!this._listSelect(i)) { this._set_val(f) } }, _doKey: function (s, g, w, n, v, l, h, y) { var f, t, r, u, x, p, o, q, i, m, z = this._prop(12), j = this._type; if (j > 0 && j < 4) { i = this._mask; n = i ? i.length : 0; if (n < 1 || s < 7 || (s > 8 && s < 32)) { s = 0 } if (h) { if (s === 0 || !(i.indexOf(g) > 0 || this._optVal("am").indexOf(g) >= 0 || this._optVal("pm").indexOf(g) >= 0 || (s >= 48 && s <= 57))) { c(y) } return } if (s === 0) { return } w = this._txt; if (v !== l) { while (--l >= v) { w = w.substring(0, l) + i.charAt(l) + w.substring(l + 1) } l++ } else { if (s === 7) { while (l < n && i.charCodeAt(l) >= 22) { l++ } if (l >= n) { return } w = w.substring(0, l) + i.charAt(l) + w.substring(l + 1); l++ } else { if (s === 8) { while (l > 0 && i.charCodeAt(l - 1) >= 22) { l-- } if (l-- < 1) { return } w = w.substring(0, l) + i.charAt(l) + w.substring(l + 1) } } } if (s > 8 && l < n) { if (l >= n) { return } if ((v = this._maskKey(s, g, w, n, l, i)) >= 0) { w = this._txt; l = v } else { if (v === -1) { return } while (i.charCodeAt(l) >= 22) { if (++l >= n) { return } } if (e(g = this._maskFilter(i.charCodeAt(l), g, 0))) { return } w = w.substring(0, l) + g + w.substring(l + 1); l++ } } this._txt = w; this._selKey = l; w = this._focusTxt(true); this.select(this._selKey, 0, w); this._selKey = 99999; this._listSelect(-1); return } if (j > 3) { o = this._prop(4); q = this._isMinus(s); r = s >= 48 && s <= 57; if (q && v === 0) { p = this._prop(10); if (!e(p) && p >= 0) { return c(y) } } if (h) { if (!(s < 9 || q || r || s === o.charCodeAt(0))) { c(y) } return } if (v !== l) { w = w.substring(0, v) + w.substring(l); l = v; n = w.length } else { if (s === 7) { if (l++ >= n || n < 1) { return } } else { if (s === 8) { if (v-- < 1) { return } } } } if (s < 9 || z === 0 || z > n) { x = s === o.charCodeAt(0); t = w.indexOf(o); f = this._prop(8); u = r || (v === 0 && q) || (x && f > 0); m = this._ePow(); i = m ? w.indexOf(m) : -1; if (m && v > 0) { if ((s === 69 || s === 101) && i < 0) { u = g = m } if (x && i >= 0 && i < v) { u = false } } if (i < 0 && r && t >= 0 && v > t && t + f < n) { if (v === n) { u = false } else { w = w.substring(0, --n) } } if (v > 0 && q && w.charAt(v - 1).toUpperCase() === "E" && w.substring(v - 1).indexOf("-") < 0) { u = true } if (n > 0 && v === 0) { if (this._isMinus(w.charCodeAt(0))) { u = false } } if (s > 8 && !u) { return } if (x) { if (t >= 0) { if (t === v || t === v - 1) { return } n--; if (t < v) { v = --l } w = w.substring(0, t) + w.substring(t + 1) } if (i < 0 && v + f < n) { w = w.substring(0, n = v + f) } } if (s > 8 && l >= n) { w += g } else { w = w.substring(0, v) + g + w.substring(l) } } else { s = 0 } this.select((s > 10) ? l + 1 : v, 0, w); this._listSelect(-1); return } if (v !== l) { w = w.substring(0, v) + w.substring(l); l = v; n = w.length } else { if (s === 7) { if (l++ >= n || n === 0) { return } if (this._ta && w.charCodeAt(l - 1) === 13 && w.charCodeAt(l) === 10) { l++ } } else { if (s === 8) { if (v-- < 1) { return } if (this._ta && w.charCodeAt(v) === 10 && w.charCodeAt(v - 1) === 13) { v-- } } } } if (s < 9 || z === 0 || z > n) { if (s > 8 && l >= n) { w += g } else { w = w.substring(0, v) + g + w.substring(l) } } else { s = 0 } this._matchList(w, s, (s > 10) ? l + 1 : v) }, _matchList: function (g, i, f) { var h; if (this._type > 0 || (i < 0 && !this.options.listAutoComplete)) { return g } if (!(h = this._findItem(g, i, f))) { return null } this._listSelect(h.id); g = h.text; if (i >= 0) { this.select(h.sel, 0, g) } else { this._field[0].value = g } return g }, _findItem: function (h, i, g) { var f = this.options; return this._find(h, i, f.listMatchOnly, f.listMatchIgnoreCase, true, f.listMatchContains, g) }, _find: function (t, m, h, u, v, o, j) { var y, r, x, f = null, n = -1, p = 0, w = 0, q = -1, k = t, l = t.length, g = this.options.listItems, s = m >= 0 && h; if (l > 0 && g && (s || m < 0)) { x = s = -1; r = u; if (r) { k = k.toUpperCase() } while (++n < g.length) { if (e(y = this._item(g[n]))) { continue } y = y.toString(); if (r) { y = y.toUpperCase() } if ((w = y.indexOf(k)) === 0) { if (y === k) { s = n; break } p++; if (x < 0) { x = n } } else { if (w > 0 && o) { if (!f) { f = { i: n, shift: w} } p++ } } } w = 0; if (x < 0 && f) { x = f.i; w = f.shift } if (s < 0) { if (!v) { return null } if (m < 0) { s = x } else { if (x < 0) { return (m > 10 && l === j) ? null : this._find(t.substring(0, --l), m, h, u, o, j) } else { if (m > 10 && p === 1) { s = x } else { t = this._item(g[x]).toString().substring(0, l + w) } } } } if (s >= 0) { t = this._item(g[s]).toString(); if (s === x) { j = t.length } } q = (s >= 0) ? s : x } return { text: t, id: q, sel: (e(j, 1) ? l : j) + w} }, _undo: function (f) { var h, g = this._old; if (f) { if (!this._canRedo) { return } g = this._redo; this._canRedo = false } else { h = this._instant(1, null, 1); if (h === g) { return } this._canRedo = true; this._redo = h } this._set_val(g); this._text = this._focusTxt(false) }, _doKey0: function (s, r) { var m, t, l, f, i, h = this._validator, g = this, j = this._text, n = this._val(), p = this._key, q = this.options; if (!this._field) { return } if (!s) { if (j !== n) { this.paste(n) } return } if (r === 1 && p === 192 && s.altKey && !s.ctrlKey) { return } if (this._type > 0 && a.browser.opera && p > 41 && p < 48) { if (r === 0) { this._noKey = p } else { if (this._noKey === p) { c(s) } } } if (r !== 1) { this._noPaste = 2 - r } else { if (this._noPaste !== 2) { this._noPaste = 1 } } if (p === 9) { this._k0 = (r === 2) ? 0 : 9; if (r === 0 && h && h._lbl) { c(s) } } if (p === 0 || (p === 114 && r !== 1) || p === 9) { return } if (this._bad > 2) { if (r === 0) { this._bad = 2 } if (r === 2) { this._bad -= 3 } } if (r === 0 && p === 229) { if (j !== n) { this._bad = 2 } else { this._bad += 3 } } if (p === 13 && this._k0 === 229 && this._type === 1) { this._txt = this._setTxt(this._val(), 5, true) } if (r === 0 && s.ctrlKey && !s.altKey && (p === 90 || p === 89)) { this._undo(p === 89); return } if (this._bad === 2 || (r === 1 && s.ctrlKey)) { return } if (r === 0 && !s.ctrlKey && !s.altKey && !s.shiftKey) { if (this._listKey(s, p)) { this._kBad = p; return c(s) } } if (this._box) { return } if (r === 1 && p === this._kBad) { return c(s) } this._kBad = null; if (r === 0 && ((s.ctrlKey && (p === 86 || p === 88)) || (s.shiftKey && p === 45))) { setTimeout(function () { g._doKey0() }, 1) } if (r !== 1 && (s.ctrlKey || s.altKey || p === 17)) { if (s.altKey) { this._k0 = -1 } else { if (j !== n && (p === 86 || (p === 17 && r === 2))) { this.paste(n); this._noPaste = 1 } else { if (p === 17) { this.getSelectedText() } } } return } if (r === 0) { this._k0 = p } if (r === 2) { if (this._k0 > 0) { this._k0 = 0 } this._spinField = -1 } l = n.length; h = this._bad !== 0; if (p <= 46) { switch (p) { case 8: case 46: if (this._k0 === p && r === 1) { r = 2 } if (r === 0) { r = 1; if (p === 46) { p = 7 } } break; case 27: c(s); if (r === 0) { this._undo() } return; case 13: if ((q.hideEnterKey && (!this._ta || !s.shiftKey)) || (this._type > 0 && this._ta && s.shiftKey)) { c(s) } return; case 38: case 40: if (this._ta) { break } if (r === 0 && !s.shiftKey) { this._spin((p === 38) ? q.spinDelta : -q.spinDelta) } if (this._k0 === p) { r = 2 } break } } if (r === 1 && p === this._k0 && ((p < 48 && p > 9 && p !== 32) || p > 90)) { return } if (!h) { if (r !== 0 && p !== 9) { c(s) } if (r === 1 && this._k0 === -1) { this._k0 = 0; this.getSelectedText() } if (r === 0 || p < 9) { this.getSelectedText() } } if (r === 1 && p > 6) { if (p > 31) { if (this._fire(1, s)) { if (h) { c(s) } return } p = this._key; f = q.excludeKeys; i = q.includeKeys; if (q.toUpper || q.toLower || f || i) { m = String.fromCharCode(p); t = m.toUpperCase(); if ((f && f.toUpperCase().indexOf(t) >= 0) || (i && i.toUpperCase().indexOf(t) < 0)) { return c(s) } if (q.toUpper) { p = t.charCodeAt(0) } else { if (q.toLower) { p = m.toLowerCase().charCodeAt(0) } } this._key = p } } this._doKey(p, (p < 10) ? "" : String.fromCharCode(p), n, l, this._sel0, this._sel1, h, s) } }, paste: function (i, h) { var g, f = this.options; if ((this._nullT && !h) || this._noPaste === 1) { return this } g = this._prop(12); if (g > 0 && g < i.length) { i = i.substring(0, g) } g = f.includeKeys; if (g) { g = g.toUpperCase().replace(/\[/gm, "\\[").replace(/\]/gm, "\\]").replace(/\^/gm, "\\^").replace(/\-/gm, "\\-"); i = i.replace(new RegExp("[^" + g + "]", "igm"), "") } g = f.excludeKeys; if (g) { g = g.toUpperCase().replace(/\[/gm, "\\[").replace(/\]/gm, "\\]").replace(/\^/gm, "\\^").replace(/\-/gm, "\\-"); i = i.replace(new RegExp("[" + g + "]", "igm"), "") } if (f.toUpper) { i = i.toUpperCase() } else { if (f.toLower) { i = i.toLowerCase() } } if (e(i = this._matchList(i, 0))) { i = this._text } this._text = ""; this._fix = 0; this.text(i, h ? null : this._sel0); this._fix = 1; this._fire(12); return this }, _fixCss: function () { var k, g, f, q, m = this._hoverOld, r = this._hover, s = this._mouseDown, p = this._fcs > 0, l = this.options, h = this._ddList, n = this._css, j = ""; if (!this._field) { return } f = l.disabled; q = this.css; this._hoverOld = r; if (!m || m === r) { m = 0 } if (m > 99) { if (!h) { return } this._listCss(h, m, q.listItemHover) } if (r > 99) { this._listCss(h, r, q.listItemHover, 1) } if (r) { n += " " + q.hover } else { if (!f && !p) { n += (j = " " + q.borderColor) } } if (f) { n += " " + q.disabled } if (p) { n += " " + q.focus } else { if (this._nullT) { n += " " + q.nullValue } } if (this._type > 3 && q.negative && !this._nullT) { if (this._instant(1) < 0) { n += " " + q.negative } } this._setCss(this._field, n); g = this._buttons ? 3 : 0; while (g-- > 0) { if (!(k = this._buttons[g])) { continue } q = k._css; n = q[0]; if (f) { n += " " + q[3] } if (r) { n += " " + q[1] } if (p) { n += " " + this.css.buttonFocus } if (s === g + 1) { n += " " + q[2] } this._setCss(k, n + j); n = q[4]; if (f) { n += " " + q[7] } if (s === g + 1) { n += " " + q[6] } else { if (r === g + 1) { n += " " + q[5] } else { if (r || p) { n += " " + this.css.buttonsImageStateOverride } } } this._setCss(k.find("SPAN"), n) } }, _setCss: function (h, g) { var f = h[0].className, i = h[0]._ig_oldCss; h[0]._ig_oldCss = g; if (g === i) { return } if (i && f && i !== f && f.indexOf(i) >= 0) { f = f.replace(i, ""); g += ((f.charAt(0) !== " ") ? " " : "") + f } h[0].className = g }, _enterTxt: function () { var f, g = this._type; if (g === 1) { return this._getTxt(this._dataMode, "") } if (g === 2 || g === 3) { f = this._toDate(this._val(), true); return e(f) ? "" : this._toTxt(f, true, "") } if (g > 3) { return this._toTxtNum(null, true, this._val(), "-", ".") } return this._val() }, _update: function () { var g, f = this._old; if (this._lock) { return } this._lock = true; this._text = this._focusTxt(false, (this._fcs === 2 || this._hadFocus) ? "" : null); g = this._instant(1, null, 1); if (!e(g) && !e(f)) { if (g.getTime && g.getTime() === f.getTime()) { g = f } } if (g !== f || this._bad === 2) { this._val10 = g; if (this._fire(10, null, g, f)) { this._set_val(f); this._text = this._focusTxt(false) } else { if (g !== this._val10) { this._setVal(this._val10) } this._repaint(); this.options.value = g = this._instant(1, null, 1); this._fire(11, null, g, f); if (this._k0 !== 13) { this._old = g } this._dtt() } } this._lock = false }, _dropTrigger: function (l, f) { var h, g, m, i = this.options, j = this._ddOn; m = i.dropDownTriggers; if (f === 0 || !m || (i.readOnly && !i.dropDownOnReadOnly) || (f === -2 && m.indexOf("button") < 0) || (f === -1 && m.indexOf("focus") < 0)) { return } if (((f === 38 && !j) || (f === 40 && j))) { return } if (f > 0) { g = (f === 38 || f === 40) ? "arrow" : String.fromCharCode(f); if (l.ctrlKey) { g = "ctrl+" + g } else { if (l.altKey) { g = "alt+" + g } else { if (l.shiftKey) { g = "shift+" + g } } } h = g.length; g = m.indexOf(g); if (g < 0 || (g > 0 && m.charAt(g - 1) !== ",") || (g + h < m.length && m.charAt(g + h) !== ",")) { return } } if (!j || f !== -1 || new Date().getTime() - j > 900) { return this._doDrop(1, l) } }, _doDP: function (g, h) { var i, k, f, j; if (this._type !== 3) { return } if (!this._dp && g !== 1) { return 1 } if (h) { this._set_val(h); this._fire(12) } k = a.datepicker; f = this._field[0]; j = f.id; if (!k._old_selectDay) { k._old_selectDay = k._selectDay; k._old_parseDate = k.parseDate; k._old_updateDatepicker = k._updateDatepicker; k._old_checkOffset = k._checkOffset; k.dpDiv.bind("mousedown", function (l) { if (a.datepicker._ig_dp) { c(l) } }); k._selectDay = function (m, o, n, p) { var l = this._ig_dp; if (!l) { return this._old_selectDay(m, o, n, p) } if (!(m = a("a", p).html())) { m = p.firstChild.innerHTML } l._doDrop(0, { type: "mousedown" }, [n, o, b(m)], 1) }; k._updateDatepicker = function (l) { if (this._ig_dp) { this.dpDiv.addClass(this._ig_css = this._ig_dp.css.dropDown) } else { if (this._ig_css) { this.dpDiv.removeClass(this._ig_css); delete this._ig_css } } this._old_updateDatepicker(l); if (this._ig_dp) { this.dpDiv.find("*").attr("unselectable", "on") } }; k.parseDate = function (l, m, n) { return this._ig_dp ? this._ig_dp._getVal(1) : this._old_parseDate(l, m, n) }; k._checkOffset = function (m, o, l) { var n = this._ig_dp; o = this._old_checkOffset(m, o, l); if (n) { o.left -= n._leftShift() } return o } } if (g === 1) { if (j.length < 1) { j = this.element[0].id + "_ig_dp_id"; while (document.getElementById(j)) { j += Math.floor(Math.random() * 10) } f.id = j } if (!this._dp) { i = this.options.regional; if (!(i = a.extend(this.options.datepickerOptions, this._dpRegion()))) { i = {} } i.showOn = ""; i.onClose = function () { var l = k._ig_dp; if (l) { l._dpClosed = 1; l._doDrop(); delete l._dpClosed; delete k._ig_dp } }; this._dp = a(f).datepicker(i) } k._ig_dp = this; this._css += " " + a.datepicker.markerClassName; k._showDatepicker(f) } else { if (g === 2) { k._doKeyUp({ target: f }) } else { if (!this._dpClosed) { k._hideDatepicker(f) } if (g === 3) { k._destroyDatepicker(f) } } } return 1 }, _fixBC: function (f, g) { f = f.css("backgroundColor"); g.css("backgroundColor", (!f || f === "transparent" || f.replace(/ /g, "").indexOf("(0,0,0,0") > 0) ? "white" : f) }, _doDrop: function (F, u, K, h) { var E, s, p, A, O, w, g, t, n, M, z, v, k, j, D, l, L, q, C, r, x, J, f, I, N = this._ddParent, H = -1, m = K, G = this, B = this.options; I = B.listItems; F = (F === 1) ? !this._ddOn : false; if (!F && !this._ddOn && !h) { return } f = I ? I.length : 0; if (this._type === 3) { if (K && !isNaN(K[2])) { if (!(m = this._getVal(1))) { m = new Date(K[0], K[1], K[2]) } else { m.setDate(10); m.setFullYear(K[0]); m.setMonth(K[1]); m.setDate(K[2]) } } } else { if (f < 1) { return } if (K) { m = this._item(I[K - 100]) } } if (this._fire(F ? 16 : 17, u, F ? null : { value: m }) && u) { return } this._ddOn = F ? new Date().getTime() : null; if (this._type === 3) { return this._doDP(F ? 1 : 0, m) } r = G._ddList; x = G._element; J = !B.listDropDownAsChild || x === G._field; if (!r) { r = G._ddList = a("<div/>").addClass(G.css.dropDown + " " + G.css.list).scroll(function () { G._lazy() }); r[0]._id = 99; r._sel = -1; r._len = f; r.css({ position: "absolute", visibility: "hidden" }); if ((C = B.listWidth) < 5) { if ((C = x.outerWidth()) < 5) { C = 100 } } if (J) { G._ddParent = N = B.theme ? a("<span/>").addClass(B.theme).css("position", "absolute").append(r) : r; N.css({ left: "0px", top: "0px" }).appendTo(a("body")); r.bind(G._mEvts) } else { G._ddParent = N = r.prependTo(x) } E = r.css("borderRightColor"); z = Math.max(1, B.listColumns); v = r._rows = Math.ceil(f / z); k = r.outerWidth() - r.width(); C = Math.ceil((C - k) / z - 1); G._listLazy = []; for (M = 0; M < z; M++) { for (n = 0; n < v; n++) { if (++H >= f) { break } j = '<div style="width:' + C + "px;position:absolute;white-space:nowrap;overflow:hidden;"; m = G._item(I[H]); if (typeof m !== "string") { if (G._type >= 4 && typeof m === "number") { m = G._toTxtNum(m) } else { if (m && G._type === 2 && m.getMonth) { m = G._toTxt(m) } else { m = d(m) } } } L = I[H]; if (L && typeof L.getHtml === "function") { if (!(L = L.getHtml())) { L = m } } else { L = m } if (H > 0) { j += "height:" + A + "px;left:" + (M * s) + "px;top:" + n * p + "px;" } if (M + 1 < z) { j += "border-right-color:" + E } j += '" title="' + G._item(I[H]) + '" _id="' + (H + 100) + '" class="' + G.css.listItem; if (M + 1 < z) { j += " " + G.css.listItemColumnBorder } j += '">' + ((L === "") ? "&nbsp;" : L) + "</div>"; if (H === 0 || H + 1 === f) { j = a(j).appendTo(r); j[0]._id = H + 100 } else { G._listLazy[H] = j } if (H === 0) { if ((A = j.height()) < 5) { A = 18 } if ((k = j.outerWidth() - j.width()) > 0) { C -= k; j.css("width", C) } r._width = (s = j.outerWidth() + 1) * z; r._height = (r._height0 = p = j.outerHeight()) * v; G._fixBC(j, r); D = Math.max(0, B.listMaxHeight); if (D > 0 && r._height > D) { r._height = D; D = Math.ceil(16 / z); j.css("width", C -= D); s -= D } else { D = 0 } r.css("overflow", (D > 0) ? "auto" : "hidden"); j.css({ height: A, left: M * s, top: n * p }) } } } r._page = Math.max(2, Math.floor(Math.min(r._height / A), f / 3) - 1) } if (K) { if (!G._listSelect(K - 100)) { G._set_val(m = this._item(I[K - 100])); G._fire(12) } } G._listSelect(null, 1); m = F ? B.listAnimationShow : B.listAnimationHide; if (!m || m < 5) { m = null } r._hEnd = m ? 0 : r._height; l = function () { if (F) { r.css("filter", ""); G._listSelect(); if (!r._fixW && (H = r[0].scrollWidth - r[0].clientWidth) > 0 && H && H < 4) { r.css("width", r._width += (r._fixW = H + 1)) } } else { r.css({ display: "none", visibility: "hidden" }) } }; if (F) { this._lazy(); if (G._fcs < 1) { G.setFocus() } w = 999; t = document.body; L = document.documentElement; if ((H = window.innerHeight) > 50 && H) { w = H } else { if ((H = L.clientHeight) > 50 && H) { w = H } else { if ((H = t.clientHeight) > 50 && H) { w = H } } } g = Math.max(t.scrollTop, L.scrollTop); L = G._swap ? G._field : x; q = L.offset(); q.h = L[0].offsetHeight; if ((O = q.top + q.h + r._height - g - w) > 0 && g - q.top + r._height < O) { if (q.top - (O = r._height + 2) < g) { O = Math.max(q.top - g, 2) } q.top += (q.h = -O); r._hEnd = r._height } else { q.top += q.h } r.css({ opacity: m ? 0 : 1, height: r._hEnd, width: Math.floor(r._width / (m ? 2 : 1)), display: "", visibility: "visible" }); if (J) { if (G._swap) { q.left -= G._leftShift() } N.css({ left: q.left, top: q.top }) } else { N.css({ marginTop: q.h, marginLeft: 0 }); O = N.offset(); if ((O = O.left - q.left) > 30 && O < x[0].offsetWidth + 10) { N.css("marginLeft", -O + "px") } } if (m) { r.animate({ opacity: 1, height: r._height, width: r._width }, m, null, l) } else { l() } } else { if (m) { r.animate({ opacity: 0.6 }, Math.floor(m * 0.34)).animate({ opacity: 0, height: r._hEnd, width: Math.floor(r._width / 2) }, Math.floor(m * 0.66), null, l) } else { l() } } return true }, _lazy: function (f) { var k, g, l = Math.max(1, this.options.listColumns), m = this._listLazy, h = this._ddOn ? this._ddList : null; if (!h) { return } if (f) { if (m[f]) { a(m[f]).appendTo(h)[0]._id = f + 100; delete m[f] } return } k = Math.floor(h[0].scrollTop / h._height0); while (l-- > 0) { for (f = 0; f < h._page + 8; f++) { if (m[g = h._rows * l + k + f]) { a(m[g]).appendTo(h)[0]._id = g + 100; delete m[g] } } } }, _listCss: function (i, f, h, g) { i = a(i.children("[_id=" + f + "]")); if (g) { i.addClass(h) } else { i.removeClass(h) } }, _listSelect: function (j, i) { var l, g, h, m = null, f = (i !== 2 && (i || this._ddOn)) ? this._ddList : null, k = this.options; if (!k.listItems) { return } if (!e(j) && this._listID !== j) { if (this._fire(18, null, m = { index: j, oldIndex: this._listID, item: k.listItems[j] })) { return 1 } this._listID = j } j = this._listID; if (f) { if (i && j < 0) { if (!e(i = this._findItem(this.text(), -1)) && j !== i.id) { if (this._fire(18, null, m = { index: i.id, oldIndex: j, item: k.listItems[i.id] })) { return 1 } this._listID = j = i.id } } if ((h = f._sel) !== j) { this._lazy(j); this._listCss(f, h + 100, this.css.listItemSelected); this._listCss(f, (h = f._sel = j) + 100, this.css.listItemSelected, 1) } if (h >= 0) { if ((l = (h % f._rows) * f._height0) > (g = f[0].scrollTop)) { if ((l += f._height0 - f._height) < g) { l = -9 } } if (l !== -9) { if (a.browser.safari && l > 20 && f[0].scrollTop === l && !i) { f[0].scrollTop = l - 1 } f[0].scrollTop = l } } } if (m) { this._fire(19, null, m) } }, _listKey: function (n, h) { var g, j, f = this._ddOn ? this._ddList : null, l = this._listID, m = a.ui.keyCode; if (!f) { return } if (h === m.ENTER || h === m.SPACE || h === m.ESCAPE) { this._doDrop(0, n, (h === m.ESCAPE) ? null : l + 100); return true } if (h < 33 || h > 40) { return } j = f._len - 1; if ((g = l) < 0) { g = -1000 } if (h === m.DOWN) { g++ } else { if (h === m.UP) { g-- } else { if (h === m.PAGE_DOWN) { g += f._page } else { if (h === m.PAGE_UP) { g -= f._page } else { if (h === m.HOME) { g = 0 } else { if (h === m.END) { g = j } else { if (h === m.RIGHT) { if ((g += f._rows) > j) { g = l } } else { if (h === m.LEFT) { if ((g -= f._rows) < 0) { g = l } } else { return } } } } } } } } this._listSelect(Math.max(0, Math.min(g, j))); return true }, _listChange: function (m, f, h) { var l, k, g, n = this.options.listItems; l = n ? n.length : 0; g = k = m ? m.length : 0; f = (e(f) || f < 0) ? -1 : f; if (h < 2) { if (l < 1) { return this } if (h > 0 && f < 0) { if (m === null) { f = l - 1 } else { while (++f < l) { if (n[f] === m) { break } } } } if (f < 0) { n.length = 0 } else { if (f < l) { n.splice(f, 1) } } } else { if (!n) { this.options.listItems = m } else { while (g-- > 0) { if (f >= l || f < 0) { n.push(m[k - g - 1]) } else { if (f === 0) { n.unshift(m[g]) } else { n.splice(f, 0, m[g]) } } } } } this._listRemove(); return this }, _listRemove: function () { if (this._ddList) { this._ddList.unbind(); this._ddParent.remove(); this._ddOn = this._ddList = this._ddParent = this._listLazy = null; this._listID = -1 } }, _initValidator: function (g) { var h = this._validator, f = this.options.validatorOptions; if (g || !f || !this.element.igValidator) { if (h) { h.destroy(); delete this._validator } return } f.ctl = this; f.required = this.options.required; this._field.igValidator(f) }, _doError: function (g, i, h) { var f = this._validator; if (f) { if (!e(h)) { return f._doError(h, null, g) !== 1 } else { if (g) { f._evt(i, null, g === 2); if (f._lbl) { f._lbl._old = { t: new Date().getTime(), val: this._val(), sel0: this._sel0, sel1: this._sel1, lastTxt: this._lastText, last: this._last, txt: this._text} } } else { f.hide(1) } } } }, _doScrl: function (g, o) { var k, n, i = a.browser.mozilla && !this._dp, h = g.clientWidth, p = g.scrollWidth, m = o.length, q = false, j = this._sel0; if (this._tr !== 1 || m < 4) { return } k = p / m * 1.1; m -= j; if (this._ta) { if (g.clientHeight + 2 > (p = g.scrollHeight)) { return } o = o.split("\n"); if (m * 15 < h && (i || o[o.length - 1].length * 15 > h)) { g.scrollTop = p; return } if (!i) { return } } else { if (j * 15 < h) { return } } if (!i) { if (p > h + 2) { if (m * k * 1.3 < h) { g.scrollLeft = p } else { if (j * k > h + g.scrollLeft) { g.scrollLeft = Math.floor(j * k - h - 3) } } } return } this._scrl = 1; try { n = document.createEvent("KeyboardEvent"); n.initKeyEvent("keypress", !q, !q, null, q, q, q, q, 0, 32); g.dispatchEvent(n); n = document.createEvent("KeyboardEvent"); n.initKeyEvent("keypress", !q, !q, null, q, q, q, q, 8, 0); g.dispatchEvent(n) } catch (l) { } delete this._scrl }, _onEvt: function (k, i) { var h, l, f = this._field, j = this; f = f ? f[0] : null; if (!f || j._scrl) { return } j._evt = k; if (i < 11) { j._doEvt(k, i, f); delete j._evt } else { h = f.value; try { if (j._nullT && k && k.type === "drop" && !e(l = k.originalEvent.dataTransfer)) { l = l.getData("Text") } } catch (g) { l = null } j._pasting = 1; setTimeout(function () { if (!l) { if (!j._field) { return } l = f.value } if (l && h !== l) { j.paste(l, 1) } delete j._pasting }, 0) } }, _doEvt: function (s, f, u) { var j, i, l, r, t, w, p, m = null, n = 0, g = this, q = this.options; if (g._noWidth) { g._fixWidth() } if (!s || q.disabled) { return } if (f === 10) { if (!(m = s.wheelDelta)) { m = s.detail } if (m) { c(s); g._spin((m > 0) ? q.spinDelta : -q.spinDelta) } return } j = p = s.target; while (j && n++ < 4 && !(m = j._id)) { j = j.parentNode } if (f === 7) { g._hover = g._mouseDown = 0; g._fixCss(); g._fire(f, s, m); return } if (!m) { return } if (f === 6) { if (m > 0 && !p.unselectable) { p.unselectable = "on" } j = u.value; if (j === g._lastText || g._pasting) { j = null } if (!g._fcs && j && g._nullT) { if (j !== q.nullText) { g._fixNull() } j = null } if (j) { g.paste(j, 1) } } if (m > 4 && m < 8) { m -= 4 } if (f === 0 && g._fcs === 0) { g._onEvt({ target: p, type: "focus" }, 8) } if (e(g._evt0Spin1) && !g._box) { try { if (!(a.browser.msie && !g._ta) && !e(u.selectionStart)) { g._tr = 1 } } catch (h) { } if (g._tr !== 1) { g._tr = u.createTextRange ? u.createTextRange() : null } g._bad = e(g._tr) ? 1 : 0 } g._evt0Spin1 = 0; if (f === 5 && g._fcs === 2 && s.button === 1) { g.getSelectedText() } w = (new Date()).getTime(); if (f < 3) { if (!(n = s.keyCode)) { if (!(n = s.which)) { n = 0 } } g._key = n; g._time = w } if (f !== 1 && f < 8) { if (g._fire(f, s, m)) { if (f < 4) { c(s) } return } } if (f < 3) { if (f === 0 && (g._fcs === 2 || q.dropDownOnReadOnly) && g._dropTrigger(s, n)) { return } if (g._fcs === 1 && (s.shiftKey || f === 1 || !(q.spinOnReadOnly || (q.dropDownOnReadOnly && g._ddOn)) || n < 9 || n > 40)) { return } if (f === 2 && g._k0 === 0 && n > 0 && n !== 86 && g._text !== g._val()) { u.value = g._text; return } } if (f === 3 && m > 0) { if (m === 99) { this._ddmd = w } c(s) } if (f === 3 && g._mouseDown !== m) { if (m > 1 && m < 4) { g._stopTimer(); if (!q.readOnly || q.spinOnReadOnly) { t = (m === 2) ? q.spinDelta : -q.spinDelta; if (g._fcs < 1 && q.focusOnSpin) { g._evt0Spin1 = 1; g.setFocus() } g._spin(t); l = r = 5; g._spinField = -1; g._timer = setInterval(function () { if (g._mouseDown < 2) { return g._stopTimer() } if (--l < 1) { g._spin(t); l = (--r > 8) ? --r : r } }, 60) } } g._hover = g._mouseDown = m; g._fixCss() } if ((f === 5 || f === 6) && g._hover !== m) { g._hover = m; g._fixCss() } if (f === 4 && g._mouseDown) { if (m === 1 && m === g._mouseDown) { if (!g._fire(15, s)) { if (g._clear) { g._onEvt(null, 11); g._set_val(null); g.select(0) } else { g._dropTrigger(s, -2) } } } if (m > 99) { g._doDrop(0, s, m) } g._mouseDown = 0; g._fixCss() } if (m > 0) { return } i = g._focTime; if (f === 4) { if (i && i + 500 > w) { g._select() } g._focTime = 0 } if (f < 3) { g._doKey0(s, f) } j = g._val(); if (f === 2) { g._last = j; if (g._key === 13 && a.browser.mozilla && g._text !== j) { g.text(j); g._fire(12, s); g._update() } } if (f === 1 && g._keyMod) { delete g._keyMod; g._doScrl(u, j) } if (f >= 8) { if (g._bad > 2) { g._bad = 2 } g._spinField = -1; i = (f === 8); if (i === (g._fcs > 0)) { return } if (!i && w - this._ddmd < 500) { return g.setFocus(-1) } g._noPaste = 0; if (!i && g._lastText !== j) { g.paste(j, 1) } if (!i && g._type < 2 && !j && !q.nullable) { if (!(j = g._old)) { j = q.listItems ? q.listItems[0] : "" } if (j) { g._set_val(j); j = g._text = g._focusTxt(false) } else { j = "" } } g._fcs = i ? (q.readOnly ? 1 : 2) : 0; m = a.ui.igEditor._keepFoc; if (m) { if (m !== g) { return } if (!i) { a.ui.igEditor._keepFoc = null } } g._hadFocus = !i; m = g._validator; if (i) { g._k0 = 0; if (g._bad > 1) { g._bad = 0 } if (!q.readOnly) { if (g._nullT) { j = g._last = g._text = u.value = "" } g._nullT = null; m = (m && m._lbl) ? m._lbl._old : null; if (m && m.t + 200 > new Date().getTime()) { u.value = g._text = m.txt; g._lastText = m.lastTxt; g._last = m.last; g.select(m.sel0, m.sel1) } else { if (j !== g._text) { g.getSelectedText(); g.paste(j) } g._lastText = g._last = g._text = g._focusTxt(i, s) } } g._focTime = w; g._dropTrigger(s, -1) } else { if (m) { g._doError(2, s); setTimeout(function () { if (!g._fcs && !g._doInvalid(s, 9)) { g._doError() } }, 100) } g._doDrop(0, s); j = g._matchList(j, -1); g._canRedo = null; if (!q.readOnly) { if (g._last !== j || g._bad !== 0) { m = g._fix; g._fix = 0; g._fcs = 2; g.text(j); g._fcs = 0; g._fix = m } g._update() } } g._repaint(); g._fixCss(); if (i && this._prop(13) < 2) { g.select(this._prop(13) * 10000); g._select() } g._hadFocus = false; if (i && g._focSpin) { g._spin(g._focSpin) } g._focSpin = null; g._fire(f, s, -1); g._lastText = g._val(); return } if (!(f > 3 && g._k0 === 0) && !g._nullT && j !== g._text) { g._text = j; g._fire(12, s) } }, _fire: function (h, k, g, i) { var j, f = this.events, l = (h === 13 || h > 16) ? g : {}; for (j in f) { if (f.hasOwnProperty(j) && f[j] === h) { break } } if (h === 14) { l.delta = g; l.value = this._instant(1, null, 1) } if (h === 12) { if ((l.oldText = this._lastText) === (g = this._val())) { return } this._doError(1, k); this._doClear(g); l.text = this._lastText = this._text = g; if (this._fcs < 2 && this._evt0Spin1 !== 1) { this._update() } this._doDP(2); if (this._type > 3) { this._fixCss() } } if (h < 3) { l.key = this._key } else { if (h < 8) { l.elementType = (g === -1) ? "field" : ((g === 1 || g === 5) ? "button" : ((g === 2 || g === 6) ? "spinUpper" : ((g === 3 || g === 7) ? "spinLower" : ((g === 99) ? "dropDown" : ((g > 99) ? "item" + (g - 100) : ""))))); l.id = g } } if (h === 10 || h === 11) { l.value = g; l.oldValue = i } if (h === 11 && this._fcs === 2) { this._update() } l.owner = this; if (!this._trigger(j, k ? k : this._evt, l)) { return true } if (h < 3) { this._key = l.key } if (h === 10) { this._val10 = l.value } }, _select: function (i) { var j, f = this, g = this._field[0], h = this._prop(13); if (this._tr !== 1 || h > 1) { return } if (!i) { setTimeout(function () { try { f._select(1) } catch (k) { } }, 0); return } j = g.value.length; if (h === 0) { j = 0 } else { if (h < 0) { h = 0 } else { h = j } } if (h !== g.selectionStart || j !== g.selectionEnd) { this.select(h, j) } }, select: function (p, m, l) { var h, g, q = 0, n = 0, k = this._tr, f = (this._fcs === 2) ? this._field[0] : null; if (!f || f.offsetWidth < 2 || this._box) { return this } if (e(l)) { l = f.value } else { m = p; if (f && f.value !== l) { this._keyMod = f.value = l } } g = l.length; if (e(m, 1)) { m = p; if (e(p, 1) || p < 0) { p = 0; m = g } } if (m >= g) { m = g } else { if (m < p) { m = p } } if (p > m) { p = m } this._sel0 = p; this._sel1 = m; try { if (k === 1) { f.selectionStart = p; f.selectionEnd = m; return this } if (!k) { if (p !== m) { f.select() } return this } if (this._ta) { h = m; while (h-- > 0) { if (l.charCodeAt(h) === 10) { if (h < p) { q++ } n++ } } p -= q; m -= n } m -= p; if (this._ta) { k.moveToElementText(f) } else { k.move("textedit", -1) } k.move("character", p); if (m > 0) { k.moveEnd("character", m) } k.select() } catch (o) { } return this }, getSelectedText: function () { var g, j, k, m = "", f = this._field[0], h = this._tr, l = (this._sel0 = this._sel1 = 0); if (e(h)) { return m } if (h === 1) { if ((this._sel0 = f.selectionStart) < (this._sel1 = f.selectionEnd)) { m = f.value.substring(this._sel0, this._sel1) } return m } try { j = document.selection.createRange(); k = f.value; g = k.length; h = j.duplicate(); if (this._ta) { h.moveToElementText(f) } else { h.move("textedit", -1) } try { while (h.compareEndPoints("StartToStart", j) < 0) { h.moveStart("character", 1); l++; if (this._ta && k.charCodeAt(l) === 10) { l++ } if (l > g) { break } } } catch (n) { } m = j.text } catch (o) { } this._sel0 = l; this._sel1 = l + m.length; return m }, getSelection: function (f) { this.getSelectedText(); return f ? this._sel0 : this._sel1 }, setFocus: function (f) { var g = this; if (g._field) { if (f === -1) { try { g._field[0].focus() } catch (h) { } } else { setTimeout(function () { if (g._fcs < 1) { g.setFocus(-1) } }, f ? f : 0) } } return this }, hasFocus: function () { return this._fcs > 0 }, _jpn: function (f) { return (this._sTxt === 1 && f > 65295 && f < 65306) ? (f - 65248) : f }, _dtt: function () { var j, g, h = this._oldAttr.title, i = this.options; if (i._id) { g = i._vsFormat; if (e(j = this._getVal(1), this._type > 3)) { j = "" } else { if (this._date) { j = j.getFullYear() + "-" + (j.getMonth() + 1) + "-" + j.getDate() + " " + j.getHours() + ":" + j.getMinutes() + ":" + j.getSeconds() + "." + j.getMilliseconds() } else { if (g && this._type > 3) { j = j.toString().replace(".", g) } } } a("#" + i._id).val(j) } if (!h || h.indexOf("{0}") < 0) { return } if ((j = this._val()) === "") { j = this.options.nullText } this._element[0].title = this._field[0].title = this._field[0].alt = h.replace("{0}", j) }, _stopTimer: function () { if (this._timer) { clearInterval(this._timer) } this._timer = null }, _maskFlag: function (g, f) { switch (g) { case ">": return -1; case "<": return -2; case "&": g = 1; break; case "C": g = 2; break; case "A": g = 7; break; case "a": g = 8; break; case "L": g = 13; break; case "?": g = 14; break; case "0": return 19; case "9": return 20; case "#": return 21; default: return 0 } return g + f * 2 }, _maskFilter: function (l, k, g, h) { var j, m; if (g >= k.length) { return h } j = k.charCodeAt(g); m = Math.floor((l - 1) / 6); k = k.charAt(g); if (j < 22) { return h } if ((m === 1 || m === 3) && j > 100) { if ((j = this._jpn(j)) < 100) { k = String.fromCharCode(j) } } if (m === 3) { return ((l === 21 && (k === "-" || k === "+")) || (j > 47 && j < 58)) ? k : h } if (m === 1 || m === 2) { if (m === 1 && j > 47 && j < 58) { return k } if (j < 256 && k.toUpperCase() === k.toLowerCase()) { return h } } if ((l = Math.floor((l - 1) / 2) % 3) === 0) { return k } return (l === 2) ? k.toLowerCase() : k.toUpperCase() }, _getTxt: function (k, n, j, s) { var g, l, p, q = this._selKey, h = this._mask, r = "", f = !e(j), m = this.options; if (!f) { j = (this._bad !== 0 && this._fcs > 1) ? this._val() : this._txt } if (f) { f = this._type === 1 } if (e(j) || e(h)) { return r } l = h.length; q = (this._fcs > 1 && !s && m.hideMaskOnFocus) ? ((q && q < l) ? q - 1 : -1) : l; for (g = 0; g < l; g++) { if ((p = h.charCodeAt(g)) < 22) { if (g < j.length && j.charCodeAt(g) >= 22) { r += j.charAt(g); if (g > q) { q = g } f = false } else { if (k % 3 === 2 || (k % 3 === 1 && p % 2 === 1)) { r += (p === 21 && n === "") ? m.padChar : n } } } else { if (k >= 3) { r += h.charAt(g); if (g === q + 1) { if (this._selKey === g) { this._selKey++ } q++ } } } } if (q++ < l) { r = r.substring(0, q) } return f ? "" : r }, _setTxt: function (p, l, n) { var k, f, g = 0, h = -1, m = this._mask, o = this._mask; if (!e(p)) { while (++h < m.length) { if (l === 1000 + g) { l = this._dataMode } if (g >= p.length) { break } if ((f = m.charCodeAt(h)) < 22) { if (!e(k = this._maskFilter(m.charCodeAt(h), p, g))) { o = o.substring(0, h) + k + o.substring(h + 1) } g++ } else { if (l >= 3) { g++ } } } } if (n) { return o } this._txt = o; this._text = this._focusTxt(this._fcs > 1, " "); this._repaint() }, _setMask: function (l) { var h, j, g, f = 0, m = 0, k = "", o = "", n = this._getTxt(0); for (g = 0; g < l.length; g++) { if ((h = this._maskFlag(j = l.charAt(g), m)) !== 0) { if (h < 0) { m = (m === -h) ? 0 : -h; continue } k += (j = String.fromCharCode(h)); j = this._maskFilter(h, n, f++, j) } else { if (j === "\\" && g + 1 < l.length && this._maskFlag(l.charAt(g + 1), 0) !== 0) { k += (j = l.charAt(++g)) } else { k += j } } o += j } this._txt = o; this._mask = k }, _getMask: function (h, n, l) { var j, g, f = 0, k = -1, m = ""; if (!n) { n = "" } if (l) { n = n.replace("dddd", "ddd").replace("ddd,", "").replace("ddd ", "").replace(" ddd", "").replace("ddd", "") } n = n.replace(/\x08/g, " ").replace(/\x09/g, " "); n = n.replace(/\\f/g, "\x01").replace(/\\d/g, "\x02").replace(/\\s/g, "\x03").replace(/\\m/g, "\x04").replace(/\\t/g, "\x05").replace(/\\H/g, "\x06").replace(/\\h/g, "\x07").replace(/\\M/g, "\x08").replace(/\\y/g, "\x09"); n = n.replace("fff", "24").replace("ff", "23").replace("f", "22"); n = n.replace("dddd", l ? "" : "21").replace("ddd", l ? "" : "20").replace("dd", "09").replace("d", "08").replace("ss", "19").replace("s", "18").replace("mm", "17").replace("m", "16"); n = n.replace("tt", "15").replace("t", "14").replace("HH", "13").replace("H", "12").replace("hh", "11").replace("h", "10"); n = n.replace("MMMM", l ? "MM" : "07").replace("MMM", l ? "MM" : "06").replace("MM", "05").replace("M", "04").replace("yyyy", "03").replace("yy", "02").replace("y", "01"); n = n.replace(/\x01/g, "g").replace(/\x02/g, "d").replace(/\x03/g, "s").replace(/\x04/g, "m").replace(/\x05/g, "t").replace(/\x06/g, "H").replace(/\x07/g, "h").replace(/\x08/g, "M").replace(/\x09/g, "y"); for (g = 0; g < n.length; g++) { j = n.charCodeAt(g); if (j < 48 || j > 57) { if (!l && (k = n.charAt(g)) === "\\" && g + 1 < n.length) { if ((j = n.charAt(++g)) === "\\") { continue } if (j === "0" || j === "9") { m += k } m += j } else { m += n.charAt(g) } continue } k = (j - 48) * 10 + n.charCodeAt(++g) - 48; if (!l) { h[f++] = k; m += "\x01"; continue } h[f++] = k; if (k === 14) { m += "L" } else { if (k === 15) { m += "LL" } else { if (k === 22) { m += "0" } else { m += "00"; if (k === 3) { m += "00" } while (k-- > 23) { m += "0" } } } } } return m }, getValueByMode: function (j, k, f) { var i, h = this._type, g = this.options.emptyChar; j = this._mode(j, h); if (h === 0) { return this._val() } if (h > 3) { i = this._dataMode; this._dataMode = j; k = this.value(); this._dataMode = i; return k } if (h === 1) { return this._getTxt(j, k ? "" : g, null, f) } i = (this._fcs < 2) ? (this._isNull ? null : this._date) : this._toDate(this._val(), true, k); return (j === 0) ? i : (i ? this._toTxt(i, j === 1, g) : "") }, _fieldVal: function (p, m, n, k) { var q, h, g = (p % 2) * 2, l = this.options; if (p < 4) { q = m.getFullYear() + l.yearShift; if (p === 3) { g = 4 } else { q %= 100; g = (p === 2) ? 2 : 0 } } else { if (p < 8) { this.d_s = 2; q = m.getMonth() + 1; if (p > 5) { p = this._optVal((p === 6) ? "monthNamesShort" : "monthNames")[q - 1]; if (p.length > 0) { return p } } } else { if (p < 10) { q = m.getDate() } else { if (p < 16) { q = m.getHours(); if (p > 13) { q = this._optVal((q < 12) ? "am" : "pm"); if ((p -= 13) === (g = q.length)) { return q } if (g < p) { q += " " } return q.substring(0, p) } if (p < 12) { q %= 12; if (q === 0) { q = 12 } } } else { if (p < 18) { q = m.getMinutes() } else { if (p < 20) { q = m.getSeconds() } else { if (p < 22) { return this._optVal((p === 20) ? "dayNamesShort" : "dayNames")[m.getDay()] } else { q = m.getMilliseconds(); h = g = p - 21; while (h-- > 3) { q *= 10 } while (h++ < 2) { q = Math.floor(q / 10) } } } } } } } } q = d(q); if (p < 20 || p > 22) { p = q.length; if (n) { if (g === 0) { g = 2 } else { n = false } } if (g > 0) { if (g < p) { q = q.substring(0, g) } else { while (p++ < g) { q = (n ? k : "0") + q } } } } return q }, _limits: function (g, i) { var f, j = this._prop(10), h = this._prop(11); if (this._type > 3) { if (e(g, 1) && !this.options.nullable) { g = this.options.nullValue; if (!g && this._dataMode > 2) { g = 0 } } if (!e(g, 1)) { if (!e(j, 1) && g <= j) { return i ? h : j } if (!e(h, 1) && g >= h) { return i ? j : h } } return g } if (e(g)) { return g } f = g.getTime(); if (!e(j)) { j = j.getTime() } if (!e(h)) { h = h.getTime() } if (!e(j) && (f < j || (i && f === j))) { g.setTime(i ? h : j); return g } if (!e(h) && (f > h || (i && f === h))) { g.setTime(i ? j : h); return g } return null }, _date7: function (f) { var g; if (f.length < 13) { return null } f = f.replace(/[\. :]/g, "-").split("-"); if ((g = f.length) !== 7) { return null } while (g-- > 0) { if ((f[g] = b(f[g], -1)) < 0) { return null } } return new Date(f[0], f[1] - 1, f[2], f[3], f[4], f[5], f[6]) }, _toDate: function (L, H, N, O) { var r, f, C, J, u, p = 0, A = 0, G = -1, w = -1, g = -1, F = -1, E = -1, t = -2, z = -2, q = -2, l = -2, I = -1, x = false, M = null, K = {}, B = this.options, D = O ? null : this._date7(L), k = (H && O) ? this._fields0(L) : this._fields1(L, H); J = k.length; if (!D) { while (++G < J) { w++; r = k[G]; f = H ? this._field0IDs[G] : this._field1IDs[G]; if (f < 4) { if (r > 100 && r > B.yearShift) { r -= B.yearShift } if ((K.year = g = r) < 0) { p++ } else { A++; C = B.centuryThreshold; if (r < 100) { if (f < 3 && C < 0) { C = 29 } if (C >= 0) { g += (r > C) ? 1900 : 2000 } } } } else { if (f < 8) { if (r < 1 || r > 12) { p++ } else { K.month = F = r; A++ } } else { if (f < 10) { K.day = E = r; if (r < 1 || r > 31) { p++ } else { A++ } } else { if (f < 14) { if (r === 24) { r = 0 } if (f > 11) { I = -4 } else { if (r === 12) { r = 0 } if (r > 12) { p++ } } K.hours = t = r; if (r > 23 || r < 0) { p++ } } else { if (f < 16) { w--; if (r > 0) { I++ } continue } else { if (f < 18) { K.minutes = z = r; if (r > 59 || r < 0) { p++ } } else { if (f < 20) { K.seconds = q = r; if (r > 59 || r < 0) { p++ } } else { if (f < 22) { w--; continue } else { while (f++ < 24) { r *= 10 } while (f-- > 25) { r = Math.floor(r / 10) } K.milliseconds = l = r; if (r > 999 || r < 0) { p++ } } } } } } } } } if (r >= 0) { x = true } if (w < B.minNumberOfDateFields && p > 0) { if (O && x) { u = this._optVal("dateFields", 2); M = "numberOfFields" } p += 9 } } } if (I === 0 && t >= 0 && t < 12) { K.hours = (t += 12) } if (!D && (!B.nullable || p < 9)) { if (A === 3) { D = new Date(g, F - 1, E); if (g < 100) { D.setFullYear(g) } } else { D = new Date(); if (this._date) { D.setTime(this._date.getTime()) } if (E > 0) { D.setDate(10) } if (g >= 0) { D.setFullYear(g) } if (F > 0) { D.setMonth(F - 1) } if (E > 0) { D.setDate(E) } } } if (O && E > 0 && D && E !== D.getDate()) { u = this._optVal("invalidDay", 2); M = "dayOfMonth" } E = B.useLastGoodDate ? this._goodD : null; if (O && !D && !B.nullable) { D = E; if (!D || !D.getTime) { D = new Date() } else { u = this._optVal("required", 2); M = "null" } } if (D) { if (t > -2) { D.setHours((t < 0) ? 0 : t) } if (z > -2) { D.setMinutes((z < 0) ? 0 : z) } if (q > -2) { D.setSeconds((q < 0) ? 0 : q) } if (l > -2) { D.setMilliseconds((l < 0) ? 0 : l) } if (N) { if (e(D = this._limits(G = D))) { D = G } else { if (O) { if (!B.minValue) { u = this._optVal("max", 2).replace("{0}", this._toTxt(B.maxValue)) } else { if (!B.maxValue) { u = this._optVal("min", 2).replace("{0}", this._toTxt(B.minValue)) } else { u = this._optVal("range", 2).replace("{0}", this._toTxt(B.minValue)).replace("{1}", this._toTxt(B.maxValue)) } } M = "limit" } } } } if (O) { if (x && !D && L.length > 0 && E) { if (!M) { u = this._optVal("date", 2); M = "invalid" } D = E } if (!x && B.required) { u = this._optVal("required", 2); M = "null" } K.value = D; if (M && (L || !B.nullable)) { if (B.reduceDayOfInvalidDate !== false && D && x && D.getDate() < 5 && K.day > 27) { D.setDate(0); K.value = D } K.text = L; K.reason = M; K.message = u; this._inv = K } } return D }, _toTxt: function (o, r, n, h) { var l, j, g = -1, p = 0, q = "", m = r ? this._mask : this._mask1, f = r ? this._field0IDs : this._field1IDs; if (e(o)) { return r ? this._getTxt(5, n, h ? (this._txt = m) : m) : "" } this.d_s = 6; while (++g < m.length) { l = m.charAt(g); if ((j = m.charCodeAt(g)) < 22) { q += this._fieldVal(f[p++], o, r, l); if (r) { while (g + 1 < m.length) { if (m.charCodeAt(g + 1) === j) { g++ } else { break } } } } else { q += l } } if (!r) { return q } if (h) { this._txt = q } return this._getTxt(5, n, q) }, _fields1: function (r, s) { var n, l, h, o, g = -1, t = -1, f = 0, p = [], q = s ? this._field0IDs : this._field1IDs; o = q.length; while (++g < o) { p[g] = -1 } if (e(r)) { return p } r = r.toUpperCase(); g = -1; while (++g < r.length && f < o) { l = this._jpn(r.charCodeAt(g)) - 48; h = q[f]; if (h === 20 || h === 21) { h = q[++f] } if (h === 14 || h === 15) { if (l >= 0 && l <= 9) { t = -1; f++; g--; continue } if (this._optVal("pm").charAt(0).toUpperCase() === r.charAt(g)) { p[f++] = 1; t = -1 } } else { if (l >= 0 && l <= 9) { if (t < 0) { t = l } else { t = t * 10 + l } } else { if (t >= 0) { p[f++] = t; t = -1 } else { if (h === 6 || h === 7) { while (t-- > -3) { for (l = 0; l < 12; l++) { n = this._optVal((h === 6) ? "monthNamesShort" : "monthNames")[l]; n = n.toUpperCase(); if ((h = n.length) < 1) { continue } if (t === -3) { if (h < 4) { continue } n = n.substring(0, 3) } if ((h = r.indexOf(n) - 1) > -2) { if (h < 0 || r.charAt(h).toLowerCase() === r.charAt(h)) { break } } } if (l < 12) { p[f++] = l + 1; break } } } } } } } if (f < o) { p[f] = t } return p }, _fields0: function (r) { var h, m, l = -1, g = -1, s = -1, f = -1, o = 22, p = this._mask, q = []; if (!r) { r = "" } while (++g < p.length) { l++; if ((h = p.charCodeAt(g)) > 21 && o > 21) { continue } if (h > 21) { if (f >= 0) { q[f] = s } } else { if (o > 21) { s = -1; f++ } if (l < r.length) { if (h > 18) { m = this._jpn(r.charCodeAt(l)) - 48; if (m >= 0 && m <= 9) { if (s < 0) { s = m } else { s = s * 10 + m } } else { if (g + 1 < p.length && r.charAt(l) === p.charAt(g + 1)) { l-- } } } else { if (o !== h && this._optVal("pm").charAt(0).toUpperCase() === r.charAt(l).toUpperCase()) { s = 1 } } } } o = h } q[f] = s; return q }, _curField: function (l, k) { var h, g, j = 22, f = this._n0 = this._n1 = -1; for (h = 0; h < k.length; h++) { if (((g = k.charCodeAt(h)) > 21) === (j > 21)) { continue } if (g > 21) { if (h >= l) { break } } else { this._n0 = h; f++ } j = g } if (this._n0 >= 0) { this._n1 = h } if (e(f = this._field0IDs[f])) { return -1 } if (f < 8) { return (f < 4) ? 0 : 1 } if (f < 20) { return Math.floor((f - 4) / 2) } return (f > 21) ? 8 : -1 }, _maskKey: function (h, j, p, g, o, m) { var f, l = 0, q = -1; if (this._type < 2) { return -2 } f = this._curField(o, m); if (o >= this._n1) { if (p.charCodeAt(--o) > 21) { return this._maskKey(h, j, p, g, o + 2, m) } } if (f < 0) { return -1 } if (f === 5) { if (o <= this._n0) { q = this._optVal("am"); if (q.charAt(0).toUpperCase() !== (j = j.toUpperCase())) { q = this._optVal("pm"); if (q.charAt(0).toUpperCase() !== j) { return -1 } } if (this._n1 === this._n0 + 1) { q = q.charAt(0) } else { if ((g = q.length) < 2) { q += " " } else { if (g > 2) { q = q.substring(0, 2) } } } this._txt = p.substring(0, this._n0) + q + p.substring(this._n1) } return this._n1 } if (h < 48 || h > 57) { if (o === 0 || (h !== 47 && h !== 58 && (h < 44 || h > 57))) { return -1 } if (m.charCodeAt(o - 1) >= 22 || this._n1 === g) { return o } while (o < g) { if (m.charCodeAt(o++) >= 22) { break } p = p.substring(0, o - 1) + m.charAt(o - 1) + p.substring(o) } this._txt = p; return o } h -= 48; if (this._n0 === o) { q = p.charCodeAt(o + 1) - 48; if (f === 2) { if (h > 3) { l = 1 } else { if (h === 3 && q > 1) { l = 2 } } } else { if (f === 6 || f === 7) { if (h > 6) { l = 1 } else { if (h === 6 && q > 0) { l = 2 } } } else { if (f > 0 && f < 5) { if (f === 4) { h--; q -= 2 } if (h > 1) { l = 1 } else { if (h === 1 && q > 2) { l = 2 } } } } } } if (this._n0 + 1 === o) { q = p.charCodeAt(o - 1) - 48; if (f === 2) { if (q > 3 || (q === 3 && h > 1)) { l = 3 } } else { if (f === 6 || f === 7) { if (q > 6 || (q === 6 && h > 0)) { l = 3 } } else { if (f > 0 && f < 5) { if (f === 4) { q--; h -= 2 } if (q > 1 || (q === 1 && h > 2)) { l = 3 } } } } } if (l === 1) { p = p.substring(0, o) + m.charAt(o) + p.substring(o + 1); o++ } if (l === 2) { p = p.substring(0, o + 1) + m.charAt(o + 1) + p.substring(o + 2) } if (l === 3) { while (++o < g) { if (m.charCodeAt(o) < 22) { break } } if (o >= g) { return -1 } return this._maskKey(h + 48, j, p, g, o, m) } this._txt = p.substring(0, o) + j + p.substring(o + 1); return ++o }, _add: function (l, m) { var h, g, i, j, k = m.toString(), n = l.toString(), f = l + m; j = f.toString(); if ((h = n.indexOf(".")) < 1 || (g = j.indexOf(".")) < 1) { return f } if ((i = k.indexOf(".")) > 0) { i = k.length - i } if (j.length - g <= (h = Math.max(i, n.length - h))) { return f } m = 10; while (h-- > 2) { m *= 10 } return Math.round(f * m) / m }, spin: function (l) { var h, f, g, k, j = this.options; if (!this._spinList(l)) { return this } if (this._type < 2) { return this } if (this._type > 3) { if (!(h = this._toNum(this._val()))) { h = 0 } this._set_val(this._add(h, l), this._fcs); return this } g = this._spinField; k = new Date(); k.setTime(this._date.getTime()); if (g < 0 || g > 8) { if (this._fcs === 2) { this.getSelectedText(); g = this._curField(this._sel0, this._mask); if (e(k = this._toDate(this._val(), true, true))) { k = new Date() } this._spinField = g } else { this._spinField = g = this.d_s } } if (g === 5) { l = (l > 0) ? 12 : -12 } f = j.spin1Field; switch (g) { case 0: k.setFullYear(l += k.getFullYear()); if (f && l !== k.getFullYear()) { g = -1 } break; case 1: k.setMonth(l += k.getMonth()); if (f && l !== k.getMonth()) { g = -1 } break; case 2: k.setDate(l += k.getDate()); if (f && l !== k.getDate()) { g = -1 } break; case 3: case 4: case 5: g = k.getDate(); k.setHours(l += k.getHours()); if (f && g !== k.getDate()) { g = -1 } break; case 6: k.setMinutes(l += k.getMinutes()); if (f && l !== k.getMinutes()) { g = -1 } break; case 7: k.setSeconds(l += k.getSeconds()); if (f && l !== k.getSeconds()) { g = -1 } break; case 8: for (g = this._n1 - this._n0; g++ < 3; ) { l *= 10 } k.setMilliseconds(l += k.getMilliseconds()); if (f && l !== k.getMilliseconds()) { g = -1 } break } if (g < 0) { return this } if (!e(l = this._limits(k))) { k = l } this._text = this._toTxt(k, this._fcs === 2, j.promptChar, true); this._date = k; this._isNull = false; this._repaint(); this.select(this._sel0); if (this._fcs === 2) { this._last = this._val() } return this }, _mode: function (h, f) { var g; if (!h || f < 1) { h = e(h) ? ((f > 3) ? 1 : ((f === 1) ? 5 : 0)) : 0 } else { if (typeof h !== "number") { h = h.toString().toLowerCase(); if (f > 3) { g = { text: -1, editmodetext: 0, "double": 1, "float": 2, decimal: 3, "long": 4, ulong: 5, "int": 6, uint: 7, "short": 8, ushort: 9, sbyte: 10, "byte": 11} } else { if (f > 1) { g = { date: 0, editmodetext: 1, text: 2} } else { if (f > 0) { g = { rawtext: 0, rawtextwithrequiredprompts: 1, rawtextwithallprompts: 2, rawtextwithliterals: 3, rawtextwithrequiredpromptsandliterals: 4, alltext: 5} } } } if (e(h = g[h])) { h = -2 } } } return (h < -1) ? ((f > 3) ? 1 : 0) : h }, _fixMode: function (h) { var m, f, i, k, l, n = this._type, j = this.options, g = this._value; this._dataMode = l = this._mode(j.dataMode, n); this._maxLen = j.maxLength; if (n > 0 && n < 4) { if (!j.promptChar) { j.promptChar = "_" } if (!j.padChar) { j.padChar = " " } if (!j.emptyChar) { j.emptyChar = " " } if (n === 1 && h) { n = j.inputMask; this._setMask(n ? n : "CCCCCCCCCC") } } if (n < 2) { if (h === 3) { this._setVal(g) } return } if (n < 4) { if (!(f = j.dateInputFormat)) { j.dateInputFormat = f = "date" } if (!j.yearShift) { j.yearShift = 0 } if (e(j.centuryThreshold)) { j.centuryThreshold = 29 } if (e(j.minNumberOfDateFields)) { j.minNumberOfDateFields = 3 } if (!(i = k = this._optVal(f + "Pattern"))) { i = k = f } m = j.dateDisplayFormat; f = m ? m : f; if (!(k = this._optVal(f + "Pattern"))) { k = f ? f : i } i = this._getMask(this._field0IDs = [], i, 1); this._mask1 = this._getMask(this._field1IDs = [], k); if (h === 1) { this._date = new Date(); this._isNull = false } this._spinField = -1; this.d_s = 10; this._setMask(i); if (h !== 1 && !this._isNull) { this._setVal(this._date, 1) } return } if (l > 3 && this._maxLen < 1) { m = 3; if (l < 6) { m = 19 } else { if (l < 8) { m = 10 } else { if (l < 10) { m = 5 } } } this._field[0].maxLength = this._maxLen = m + (l + 1) % 2 } if (h === 3) { this._setVal(g, 1) } if (!h && (g || g === 0)) { this._setVal(g / this._prop(7)) } }, _toNum: function (n, l, k) { var i, m = null, p = null, g, j = this.options, f = n, h = 0; if (typeof n !== "number") { n = d(n); h = n.length; f = parseFloat(this._txtAsNum(n)) } if (isNaN(f)) { f = null } else { if (!isFinite(f)) { f = (f === Number.NEGATIVE_INFINITY) ? -Number.MAX_VALUE : Number.MAX_VALUE } } i = l ? this._limits(f) : f; if (k && (i !== f || (e(i, 1) && h > 0))) { k = e(f, 1) ? ((h === 0) ? "null" : "format") : "limit"; if (e(f, 1)) { if (h === 0) { k = "null"; g = this._optVal("required", 2) } else { k = "format"; g = this._optVal("number", 2) } } else { k = "limit"; l = null; if (e(m = j.minValue, 1)) { if (!e(m = this._prop(10), 1)) { if (m !== i) { m = null } } } if (e(p = j.maxValue, 1)) { if (!e(p = this._prop(11), 1)) { if (p !== i) { p = null } } } g = e(p, 1) ? this._optVal("min", 2).replace("{0}", m.toString(10)) : (e(m, 1) ? this._optVal("max", 2).replace("{0}", p.toString(10)) : this._optVal("range", 2).replace("{0}", m.toString(10)).replace("{1}", p.toString(10))) } this._inv = { value: i, text: n, reason: k, message: g} } return i }, _txtAsNum: function (g, f, j) { var i, h = g.length; if (!f) { f = this._prop(4) } if (!j) { j = this._prop(3) } while (h-- > 0) { i = g.charCodeAt(h); if (i === 12290 || i === 65294) { i = "." } else { if (i === 12289) { i = "," } else { if (i > 65295 && i < 65306) { i = String.fromCharCode(i - 65248) } else { continue } } } g = g.replace(new RegExp(g.charAt(h), "g"), i) } g = g.replace("(", (g.indexOf(j) < 0) ? "-" : "").replace(this._prop(2), "").replace(new RegExp(j, "g"), "-"); g = g.replace(f, "\x01"); if ((i = g.indexOf(f)) > 0) { g = g.substring(0, i) } g = g.replace(/[^0-9\-eE\x01]/gm, "").replace("\x01", "."); h = g.length; if ((i = g.indexOf("-")) >= 0) { if (i + 1 < h && (i = g.indexOf("-", i + 1)) > 0) { if (i > 0 && g.toUpperCase().charAt(i - 1) !== "E") { g = g.substring(0, i) } } if (i + 1 === (h = g.length)) { g = "-" + g.substring(0, h - 1) } } return (g === "-" || g === ".") ? "" : g }, _ePow: function (g) { var f, h = this.options.scientificFormat; f = (h && h.length > 0) ? h.charAt(0) : null; return (f && (f === "e" || f === "E")) ? (g ? h : f) : null }, _toTxtNum: function (m, l, t, h, q, s) { var p, v, r, g, w, k = this._ePow(), n = 0, x = 0, o = -1, u = m, f = this._prop(8); if (e(t)) { if (e(m, 1)) { return "" } u = m < 0; if (u) { m = -m } try { t = k ? m.toString(10) : m.toFixed(f) } catch (j) { s = t = d(m) } return this._toTxtNum(u, l, t.toUpperCase(), e(h) ? this._prop(3) : h, e(q) ? this._prop(4) : q, s) } if (s) { t = this._txtAsNum(t, q) } w = t.indexOf("E"); if (w > 0) { k = k ? this._ePow(!l && t.charAt(w + 1) !== "-") + t.substring(w + 1) : t.substring(w); t = t.substring(0, w) } else { k = "" } w = t.length; if (e(u)) { if (w === 0) { return l ? t : "" } u = this._isMinus(t.charCodeAt(0)); if (u) { t = t.substring(1); w-- } } while (++o < w) { g = t.charCodeAt(o); if (g < 48 || g > 57) { t = t.substring(0, o) + t.substring(o + 1); w--; break } } while (o < w) { if (t.charCodeAt(w - 1) !== 48) { break } t = t.substring(0, --w) } w = o; if (f > 0 && w < t.length) { x = t.length - w; t = t.substring(0, w) + q + t.substring(w); w += q.length + f } if (w < t.length) { t = t.substring(0, w) } if (u && (!(r = t.replace(/0/g, "")) || r === q)) { u = false } if ((w = this._prop(9)) > 0) { if (x === 0) { t += q } while (w-- > x) { t += "0" } } if (l) { t += k; return u ? (h + t) : t } p = this._prop(6); r = v = (p.length > 0) ? p[0] : 0; while (r > 0 && --o > 0) { if (--r === 0) { t = t.substring(0, o) + this._prop(5) + t.substring(o); r = p[++n]; if (e(r) || r < 1) { r = v } else { v = r } } } m = this._prop(u ? 1 : 0).replace("n", t + k); return m.replace("$", this._prop(2)) }, _prop: function (f) { var j, g, i, h = this.options, k = this._type, l = this._dataMode; if (f === 13) { h = h.selectionOnFocus; return (h === -1 || h === "select") ? -1 : ((h === 0 || h === "start") ? 0 : ((h === 1 || h === "end") ? 1 : 2)) } if (f === 12) { return (h.maxLength > 0) ? h.maxLength : this._maxLen } if (f === 0) { if (!(g = h.positivePattern)) { return (k === 6) ? this._optVal("percentPositivePattern") : ((k === 5) ? this._optVal("currencyPositivePattern") : "n") } return g } if (f === 1) { if (!(g = h.negativePattern)) { return this._optVal((k === 6) ? "percentNegativePattern" : ((k === 5) ? "currencyNegativePattern" : "numericNegativePattern")) } return g } if (f === 2) { if (!e(g = h.symbol)) { return g } return (k === 6) ? this._optVal("percentSymbol") : ((k === 5) ? this._optVal("currencySymbol") : "") } if (f === 3) { return this._optVal("negativeSign") } if (f === 4) { if (!(g = h.decimalSeparator)) { return this._optVal((k === 6) ? "percentDecimalSeparator" : ((k === 5) ? "currencyDecimalSeparator" : "numericDecimalSeparator")) } return g } if (f === 5) { if (!e(g = h.groupSeparator)) { return g } return this._optVal((k === 6) ? "percentGroupSeparator" : ((k === 5) ? "currencyGroupSeparator" : "numericGroupSeparator")) } if (f === 6) { if (!(g = h.groups)) { return this._optVal((k === 6) ? "percentGroups" : ((k === 5) ? "currencyGroups" : "numericGroups")) } return g } if (f === 7) { if (!e(g = h.displayFactor)) { return g } return (k === 6) ? this._optVal("percentDisplayFactor") : 1 } if (f === 8) { if (l > 3) { return 0 } if (!e(g = h.maxDecimals)) { return g } return this._optVal((k === 6) ? "percentMaxDecimals" : ((k === 5) ? "currencyMaxDecimals" : "numericMaxDecimals")) } if (f === 9) { if (l > 3) { return 0 } if (!e(g = h.minDecimals)) { return g } return this._optVal((k === 6) ? "percentMinDecimals" : ((k === 5) ? "currencyMinDecimals" : "numericMinDecimals")) } j = f === 10; if (j || f === 11) { g = j ? h.minValue : h.maxValue; if (k > 3 && typeof g === "string") { g = parseFloat(g) } if (!e(g, 1) || k < 4 || l < 2 || l === 3 || l > 11) { return g } if (l === 2) { return j ? -3.40282347e+38 : 3.40282347e+38 } g = 127; i = (l % 2) === 0; if (!i && j) { return 0 } if (l < 6) { g = 9.22337203685478e+18 } else { if (l < 8) { g = 2147483647 } else { if (l < 10) { g = 32767 } } } return i ? (j ? -(g + 1) : g) : (g * 2 + 1) } }, _isMinus: function (f) { return f === this._prop(3).charCodeAt(0) || f === 45 || (f === 40 && this._prop(1).indexOf("(") >= 0) || f === 12540 || f === 65293 || f === 65288 }, destroy: function () { var g, j, m, l, h = this._element, f = this._field, k = this.element, n = this._buttons; m = h ? h[0] : null; if (!f || !m) { return this } this._stopTimer(); this._doDP(3); this._initValidator(1); this._listRemove(); f.unbind(this._evts); h.unbind(this._mEvts); l = (n && n[0]) ? n[0][0] : null; if (l && l.parentNode === m) { m.removeChild(l) } l = (n && n[1]) ? n[1][0].parentNode : null; if (l && l.parentNode === m) { m.removeChild(l) } if (f[0].parentNode === m) { m.removeChild(f[0]) } if (this._selElem) { h.remove() } else { if (this._swap) { g = m.parentNode; g.insertBefore(k[0], m); g.removeChild(m) } } g = this._oldCss; for (j in g) { if (g.hasOwnProperty(j)) { k.css(j, g[j]) } } g = this._oldAttr; for (j in g) { if (g.hasOwnProperty(j)) { k[0][j] = g[j] } } k[0]._ig_oldCss = null; k = h = f = this._dp = this._buttons = this._field = this._element = null; this._evts = this._mEvts = this._oldAttr = this._oldCss = this._validator = null; a.Widget.prototype.destroy.apply(this, arguments); return this } }); a.extend(a.ui.igEditor, { version: "11.1.20111.2010" }); a.ui.igEditor.locale = { defaults: {} }; a.ui.igEditor.setDefaultCulture = function (f, g) { a.ig.regional = a.ig.regional || {}; a.ig.regional.defaults = a.extend(a.ig._regional, (typeof f === "string") ? a.ig.regional[f] : f); if (!g && typeof f === "string" && a.ui.igEditor.locale[f]) { g = f } if (g) { a.ui.igEditor.locale.defaults = a.extend({}, (typeof g === "string") ? a.ui.igEditor.locale[g] : g) } if (f === "en" || f === "en-US") { f = "" } if (a.datepicker && a.datepicker.regional && a.datepicker.regional[f]) { a.datepicker.setDefaults(a.datepicker.regional[f]) } }; a.widget("ui.igTextEditor", a.ui.igEditor, { _create: function () { a.ui.igEditor.prototype._create.apply(this, [0]) } }); a.widget("ui.igMaskEditor", a.ui.igEditor, { options: { inputMask: "CCCCCCCCCC", promptChar: "_", padChar: " ", emptyChar: " ", dataMode: "alltext", hideMaskOnFocus: false }, _create: function () { a.ui.igEditor.prototype._create.apply(this, [1]) } }); a.widget("ui.igDateEditor", a.ui.igEditor, { options: { spin1Field: false, minValue: null, maxValue: null, dateDisplayFormat: null, dateInputFormat: null, promptChar: "_", dataMode: "date", minNumberOfDateFields: 3, useLastGoodDate: false, reduceDayOfInvalidDate: true, hideMaskOnFocus: false, centuryThreshold: 29, yearShift: 0 }, _create: function () { a.ui.igEditor.prototype._create.apply(this, [2]) } }); a.widget("ui.igDatePicker", a.ui.igDateEditor, { options: { button: "dropdown", datepickerOptions: null }, _create: function () { a.ui.igEditor.prototype._create.apply(this, [3]) } }); a.widget("ui.igNumericEditor", a.ui.igEditor, { options: { positivePattern: null, negativePattern: null, symbol: null, negativeSign: null, decimalSeparator: null, groupSeparator: null, groups: null, displayFactor: null, maxDecimals: null, minDecimals: null, minValue: null, maxValue: null, scientificFormat: null, nullValue: null, dataMode: "double" }, _create: function () { a.ui.igEditor.prototype._create.apply(this, [4]) } }); a.widget("ui.igCurrencyEditor", a.ui.igNumericEditor, { _create: function () { a.ui.igEditor.prototype._create.apply(this, [5]) } }); a.widget("ui.igPercentEditor", a.ui.igNumericEditor, { _create: function () { a.ui.igEditor.prototype._create.apply(this, [6]) } }) } (jQuery)); (function (a) { a.ui.igEditor.locale["en-US"] = { spinUpperTitle: "Increment", spinLowerTitle: "Decrement", buttonTitle: "Show list", clearTitle: "Clear value", datePickerButtonTitle: "Show calendar" }; a.ui.igEditor.locale.defaults = a.extend({}, a.ui.igEditor.locale["en-US"]) } (jQuery)); (function (a) { a.ig.regional["en-US"] = { monthNames: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], am: "AM", pm: "PM", datePattern: "M/d/yyyy", dateLongPattern: "dddd, MMMM dd, yyyy", dateTimePattern: "M/d/yyyy h:mm tt", timePattern: "h:mm tt", timeLongPattern: "h:mm:ss tt", negativeSign: "-", numericNegativePattern: "-$n", numericDecimalSeparator: ".", numericGroupSeparator: ",", numericGroups: [3], numericMaxDecimals: 2, numericMinDecimals: 0, currencyPositivePattern: "$n", currencyNegativePattern: "$(n)", currencySymbol: "$", currencyDecimalSeparator: ".", currencyGroupSeparator: ",", currencyGroups: [3], currencyMaxDecimals: 2, currencyMinDecimals: 2, percentPositivePattern: "n$", percentNegativePattern: "-n$", percentSymbol: "%", percentDecimalSeparator: ".", percentGroupSeparator: ",", percentGroups: [3], percentDisplayFactor: 100, percentMaxDecimals: 2, percentMinDecimals: 2 }; a.ig.setRegionalDefault("en-US") } (jQuery)); (function (a) { a.ig = a.ig || {}; a.ig.Grid = a.ig.Grid || {}; a.extend(a.ig.Grid, { locale: { noSuchWidget: "No such widget loaded: ", autoGenerateColumnsNoRecords: "autoGenerateColumns is enabled, but there are no records in the data source in order to determine the columns", optionChangeNotSupported: "Changing the following option after the igGrid has been created is not supported:", optionChangeNotScrollingGrid: "The following option cannot be changed after the grid is created because your initial grid is not scrolling and full re-rendering is required:", noPrimaryKeyDefined: "There is no primary key defined for the grid. In order to use features such as Grid Editing, you will need to define a primary key.", indexOutOfRange: "The row index you have specified is out of range.", noSuchColumnDefined: "The specified column key does not match any of the defined grid columns.", columnIndexOutOfRange: "The specified column index is out of range.", recordNotFound: "The record with the specified id could not be found in the data view:", columnNotFound: "No column was found matching key:", colPrefix: "Column ", columnVirtualizationRequiresWidth: "You have virtualization / columnVirtualization set to true, but no width could be inferred for grid columns. You should set one of a) grid width, b) defaultColumnWidth, c) define width for each column", noColumnsButAutoGenerateTrue: "You have autoGenerateColumns set to false, but there are no columns defined in the grid. Please set autoGenerateColumns to true, or specify columns manually"} }) } (jQuery)); (function (a) { a.ig = a.ig || {}; a.ig.GridFiltering = a.ig.GridFiltering || {}; a.extend(a.ig.GridFiltering, { locale: { startsWithNullText: "Starts with...", endsWithNullText: "Ends with...", containsNullText: "Contains...", doesNotContainNullText: "Does not contain...", equalsNullText: "Equals...", doesNotEqualNullText: "Does not equal...", greaterThanNullText: "Greater than...", lessThanNullText: "Less than...", greaterThanOrEqualToNullText: "Greater than or equal to...", lessThanOrEqualToNullText: "Less than or equal to...", onNullText: "On...", notOnNullText: "Not on...", emptyNullText: "Empty", notEmptyNullText: "Not empty", nullNullText: "Null", notNullNullText: "Not null", startsWithLabel: "Starts with", endsWithLabel: "Ends with", containsLabel: "Contains", doesNotContainLabel: "Does not contain", equalsLabel: "Equals", doesNotEqualLabel: "Does not equal", greaterThanLabel: "Greater than", lessThanLabel: "Less than", greaterThanOrEqualToLabel: "Greater than or equal to", lessThanOrEqualToLabel: "Less than or equal to", trueLabel: "True", falseLabel: "False", afterLabel: "After", beforeLabel: "Before", todayLabel: "Today", yesterdayLabel: "Yesterday", thisMonthLabel: "This month", lastMonthLabel: "Last month", nextMonthLabel: "Next month", thisYearLabel: "This year", lastYearLabel: "Last year", nextYearLabel: "Next year", clearLabel: "Clear Filter", noFilterLabel: "No", onLabel: "On", notOnLabel: "Not on", advancedButtonLabel: "Advanced", filterDialogCaptionLabel: "ADVANCED SEARCH", filterDialogConditionLabel1: "Show records matching ", filterDialogConditionLabel2: " of the following criteria", filterDialogOkLabel: "Search", filterDialogCancelLabel: "Cancel", filterDialogAnyLabel: "ANY", filterDialogAllLabel: "ALL", filterDialogAddLabel: "Add", filterDialogErrorLabel: "Maximum filters count exceeded.", filterSummaryTitleLabel: "Search results", filterSummaryTemplate: "${matches} matching records", filterDialogClearAllLabel: "Clear ALL", tooltipTemplate: "${condition} filter applied", virtualizationSimpleFilteringNotAllowed: "When horizontal virtualization is enabled, simple filtering (filter row) is not supported. Please set mode to 'advanced' and/or do not enable advancedModeEditorsVisible"} }) } (jQuery)); (function (a) { a.ig = a.ig || {}; a.ig.GridPaging = a.ig.GridPaging || {}; a.extend(a.ig.GridPaging, { locale: { pageSizeDropDownLabel: "Show ", pageSizeDropDownTrailingLabel: "records", nextPageLabelText: "next", prevPageLabelText: "prev", firstPageLabelText: "", lastPageLabelText: "", currentPageDropDownLeadingLabel: "Pg", currentPageDropDownTrailingLabel: "of ${count}", currentPageDropDownTooltip: "Choose page index", pageSizeDropDownTooltip: "Choose number of records per page", pagerRecordsLabelTooltip: "Current records range", prevPageTooltip: "go to the previous page", nextPageTooltip: "go to the next page", firstPageTooltip: "go to the first page", lastPageTooltip: "go to the last page", pageTooltipFormat: "page ${index}", pagerRecordsLabelTemplate: "${startRecord} - ${endRecord} of ${recordCount} records"} }) } (jQuery)); (function (a) { a.ig = a.ig || {}; a.ig.GridSelection = a.ig.GridSelection || {}; a.extend(a.ig.GridSelection, { locale: {} }) } (jQuery)); (function (a) { a.ig = a.ig || {}; a.ig.GridSorting = a.ig.GridSorting || {}; a.extend(a.ig.GridSorting, { locale: { sortedColumnTooltipFormat: "sorted ${direction}", unsortedColumnTooltip: "click to sort column", ascending: "ascending", descending: "descending"} }) } (jQuery)); jQuery(function (a) { a.ui.igValidator.locale.en = { defaultMessage: "Please fix this field", selectMessage: "Please select a value", rangeSelectMessage: "Please select no more than {0} and not less than {1} items", minSelectMessage: "Please select at least {0} items", maxSelectMessage: "Please select no more than {0} items", rangeLengthMessage: "Please enter a value between {0} and {1} characters long", minLengthMessage: "Please enter at least {0} characters", maxLengthMessage: "Please enter no more than {0} characters", requiredMessage: "This field is required", maskMessage: "Please fill all required positions", dateFieldsMessage: "Please enter values in date fields", invalidDayMessage: "Invalid day of month. Please enter correct day", dateMessage: "Please enter a valid date", numberMessage: "Please enter a valid number", rangeMessage: "Please enter a value between {0} and {1}", minMessage: "Please enter a value greater than or equal to {0}", maxMessage: "Please enter a value less than or equal to {0}" }; a.ui.igValidator.setDefaultCulture("en") }); (function (a) { a.ig = a.ig || {}; a.ig.VideoPlayer = a.ig.VideoPlayer || {}; a.extend(a.ig.VideoPlayer, { locale: { liveStream: "Live video", live: "Live", paused: "Paused", playing: "Playing", play: "Play", volume: "Volume", unsupportedVideoSource: "The current video sources does not contain a format that is supported by your browser.", missingVideoSource: "No compatible video source.", progressLabelLongFormat: "$currentTime$ / $duration$", progressLabelShortFormat: "$currentTime$", enterFullscreen: "Go Fullscreen", exitFullscreen: "Exit Fullscreen", skipTo: "SKIP TO", unsupportedBrowser: "The current browser does not support HTML5 video. <br/>Try upgrading to any of the following versions:", currentBrowser: "Current browser: {0}", ie9: "Microsoft Internet Explorer V 9+", chrome8: "Google Chrome V 8+", firefox36: "Mozilla Firefox V 3.6+", safari5: "Apple Safari V 5+", opera11: "Opera V 11+", ieDownload: "http://www.microsoft.com/windows/internet-explorer/default.aspx", operaDownload: "http://www.opera.com/download/", chromeDownload: "http://www.google.com/chrome", firefoxDownload: "http://www.mozilla.com/", safariDownload: "http://www.apple.com/safari/download/", buffering: "Buffering...", adMessage: "Ad: Video will resume in $duration$ seconds.", adMessageLong: "Ad: Video will resume in $duration$.", adMessageNoDuration: "Ad: Video will resume after the commercial.", adNewWindowTip: "Ad: Click to open ad content in a new window.", nonDivException: "The Infragistics HTML5 Video Player can be instantated only on a DIV tag.", relatedVideos: "RELATED VIDEOS", replayButton: "Replay", replayTooltip: "Click to replay last video."} }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics Grid requires jQuery to be loaded") } (function ($) { var _hovTR; $.widget("ui.igGrid", { css: { baseClass: "ui-widget ui-helper-clearfix ui-corner-all", baseContentClass: "ui-widget-content", gridClasses: "ui-iggrid", recordClass: "ui-ig-record ui-iggrid-record", recordAltClass: "ui-ig-altrecord ui-iggrid-altrecord", headerClass: "ui-iggrid-header ui-widget-header", headerTextClass: "ui-iggrid-headertext", baseHeaderClass: "ui-widget-header", gridTableClass: "ui-iggrid-table ui-widget-content", gridHeaderTableClass: "ui-iggrid-headertable", gridCaptionTableClass: "ui-iggrid-captiontable", gridHeaderCaptionClass: "ui-iggrid-headercaption ui-widget-header ui-corner-top", gridTableBodyClass: "ui-iggrid-tablebody", gridScrollDivClass: "ui-iggrid-scrolldiv ui-widget-content", gridFooterCaptionClass: "ui-iggrid-footercaption", footerClass: "ui-widget-header ui-iggrid-footer" }, options: { width: null, height: null, autoAdjustHeight: true, avgRowHeight: 25, avgColumnWidth: null, defaultColumnWidth: null, autoGenerateColumns: true, virtualization: false, requiresDataBinding: true, rowVirtualization: false, columnVirtualization: false, virtualizationMouseWheelStep: null, adjustVirtualHeights: false, rowTemplate: null, jQueryTemplating: false, columns: [{ headerText: null, key: null, formatter: null, format: null, dataType: "string"}], dataSource: null, dataSourceUrl: null, dataSourceType: null, responseDataKey: null, responseTotalRecCountKey: null, showHeader: true, fixedHeaders: true, caption: null, features: [{}], tabIndex: 0, accessibilityRendering: false, localSchemaTransform: true, primaryKey: null, serializeTransactionLog: true, autoCommit: false, autoFormat: "date", updateUrl: null, alternateRowStyles: true }, events: { cellClick: "cellClick", dataBinding: "dataBinding", dataBound: "dataBound", rendering: "rendering", rendered: "rendered", dataRendering: "dataRendering", dataRendered: "dataRendered", headerRendering: "headerRendering", headerRendered: "headerRendered", rowAdding: "rowAdding", rowAdded: "rowAdded", headerCellRendered: "headerCellRendered" }, resizeTimeout: 300, speedupDOMCleanup: false, widget: function () { return this.element }, _createWidget: function (options, element) { this.options.columns = []; this.options.features = []; $.Widget.prototype._createWidget.apply(this, arguments) }, _init: function () { }, _setOption: function (key, value) { var header, isScrolling, id = this.element[0].id + "_scroll"; isScrolling = (this.options.height !== null || this.options.width !== null); $.Widget.prototype._setOption.apply(this, arguments); if (key === "virtualization" || key === "autoGenerateColumns" || key === "accessibilityRendering" || key === "rowVirtualization" || key === "columnVirtualization" || key === "fixedHeaders" || key === "scrollbars") { throw new Error($.ig.Grid.locale.optionChangeNotSupported + " " + key) } if (key === "width") { if (isScrolling === true) { this.container().css("width", value); this.element.css("width", value) } else { throw new Error($.ig.Grid.locale.optionChangeNotScrollingGrid + " " + key) } } else { if (key === "height") { if (isScrolling === true) { $("#" + id).css("overflow-y", "auto"); if (this.options.autoAdjustHeight) { this.container().css("height", value); this._initializeHeights() } else { this.scrollContainer().css("height", value) } } else { throw new Error($.ig.Grid.locale.optionChangeNotScrollingGrid + " " + key) } } else { if (key === "dataSource") { this.options.dataSource = value; this.dataBind() } else { if (key === "showHeader") { header = $("#" + this.id() + "_headers"); if (header.length > 0 && header.is("table")) { if (value === true) { header.show() } else { header.hide() } } else { header = this.element.find("thead tr"); if (value === true) { header.show() } else { header.hide() } } } else { if (key === "caption") { $("#" + this.id() + "caption").text(value) } } } } } }, _initialized: false, _headersInitialized: false, _footerInitialized: false, _create: function () { var grid = this; this._firstBind = true; if ((this.options.virtualization === true || this.options.columnVirtualization === true || this.options.rowVirtualization === true) && parseInt(this.options.width, 10) > 0 && this.options.fixedHeaders === true) { this.options.fixedHeaders = false } if ((this.options.height === null || parseInt(this.options.height, 10) <= 0) && this.options.fixedHeaders === true) { this.options.fixedHeaders = false } this.dataBind(true); this.element.bind({ click: function (event) { if (event.target.nodeName === "TD") { grid._trigger(grid.events.cellClick, event, { rowIndex: $(event.target).data("row"), colIndex: $(event.target).data("col"), cellElement: event.target, owner: grid }) } }, mousedown: function (event) { if (event.target.nodeName === "TD") { grid._trigger(grid.events.cellClick, event, { rowIndex: $(event.target).data("row"), colIndex: $(event.target).data("col"), cellElement: event.target, owner: grid }) } } }); if (this.options.height !== null && this.options.height.indexOf && this.options.height.indexOf("%") !== -1) { this._resId = setInterval($.proxy(this._resizeContainer, this), this.resizeTimeout) } this._uiSoftDirtyHandler = $.proxy(this._onFeaturesSoftDirty, this); this.element.bind("iggriduisoftdirty", this._uiSoftDirtyHandler) }, _resizeContainer: function () { if (this.options.autoAdjustHeight && this.container().height() !== this._prevContainerHeight) { this._initializeHeights() } }, id: function () { return this.element[0].id }, container: function () { if (this._isWrapped === true) { return this.element } else { return $("#" + this.element[0].id + "_container") } }, headersTable: function () { if (this.options.fixedHeaders === true && this.options.height !== null) { return $("#" + this.element[0].id + "_headers") } else { return this.element } }, scrollContainer: function () { return $("#" + this.element[0].id + "_scroll") }, cellAt: function (x, y) { var i; if (x === undefined || y === undefined) { return null } if (this.table === undefined) { this.table = this.element[0] } i = this._dataRowIndex(y); return this.table.rows[i].cells[x] }, _calculateHeaderFooterRows: function () { return this.element.find("thead tr").length + this.element.find("tfoot tr").length }, _dataRowIndex: function (i) { if (this._additionalTrCount === undefined || this._additionalTrCount === null) { this._additionalTrCount = this._calculateHeaderFooterRows() } if (i + this._additionalTrCount > this.table.rows.length) { i = this.table.rows.length - 1 } else { i = i + this._additionalTrCount } return i }, rowAt: function (i) { if (this.table === undefined) { this.table = this.element[0] } i = this._dataRowIndex(i); return this.table.rows[i] }, rows: function () { return this.element.find("tbody tr") }, columnByKey: function (key) { var cols = this.options.columns, i; for (i = 0; i < cols.length; i++) { if (cols[i].key === key) { return cols[i] } } return null }, columnByText: function (text) { var cols = this.options.columns, i; for (i = 0; i < cols.length; i++) { if (cols[i].headerText === text) { return cols[i] } } return null }, activeCell: function () { return this._activeCell }, activeRow: function () { return this._activeRow }, selectedCell: function () { return this._selectedCell }, selectedRow: function () { return this._selectedRow }, selectedCells: function () { return this._selectedCells }, selectedRows: function () { return this._selectedRows }, getCellValue: function (rowId, colKey) { var id = parseInt(rowId, 10), col, i, cols = this.options.columns, colFound = false, rec, primaryKeyCol; if (this.options.primaryKey !== null) { primaryKeyCol = this.columnByKey(this.options.primaryKey); if (primaryKeyCol.dataType === "number" || primaryKeyCol.dataType === "numeric") { rec = this.dataSource.findRecordByKey(parseInt(rowId, 10)) } else { rec = this.dataSource.findRecordByKey(rowId) } if (rec === null || rec === undefined) { throw new Error($.ig.Grid.locale.recordNotFound + " " + rowId) } return rec[colKey] } else { if (id >= this.dataSource.dataView().length) { throw new Error($.ig.Grid.locale.indexOutOfRange) } if ($.type(colKey) === "string") { for (i = 0; i < cols.length; i++) { if (cols[i].key === colKey) { col = cols[i]; colFound = true; break } } if (colFound === false) { throw new Error($.ig.Grid.locale.noSuchColumnDefined) } return this.dataSource.dataView()[id][colKey] } else { if (cols.length <= colKey) { throw new Error($.ig.Grid.locale.columnIndexOutOfRange) } return this.dataSource.dataView()[id][colKey] } } }, getCellText: function (rowId, colKey) { var i, cols = this.options.columns, colIndex, primaryKeyIndex; if ($.type(colKey) === "string") { for (i = 0; i < cols.length; i++) { if (cols[i].key === colKey) { colIndex = i; break } } } else { colIndex = colKey } if (colIndex === undefined) { throw new Error($.ig.Grid.locale.columnNotFound + " " + colKey) } if (this.options.primaryKey !== null) { for (i = 0; i < cols.length; i++) { if (cols[i].key === this.options.primaryKey) { primaryKeyIndex = i; break } } if (primaryKeyIndex === undefined) { throw new Error($.ig.Grid.locale.columnNotFound + " " + this.options.primaryKey) } return this.element.find("td:nth-child('" + (primaryKeyIndex + 1) + "'):contains('" + rowId + "')").parent().find("td:nth-child(" + (colIndex + 1) + ")").text() } else { return $(this.cellAt(colIndex, parseInt(rowId, 10))).text() } }, setCellValue: function (rowId, colKey, value, tableCell, autoCommit) { var rec, tr, t, key; key = this._normalizedKey(rowId); t = this.dataSource.setCellValue(key, colKey, value, autoCommit); if (tableCell === undefined || tableCell === null) { tr = this._findTableRowByKey(rowId) } else { tr = $(tableCell).parent()[0] } rec = this.dataSource.getDetachedRecord(t); this._renderRow(rec, tr) }, updateRow: function (rowId, rowObject, tableRow, autoCommit) { var rec, tr, t, key; key = this._normalizedKey(rowId); t = this.dataSource.updateRow(key, rowObject, autoCommit); if (tableRow === undefined || tableRow === null) { tr = this._findTableRowByKey(rowId) } else { tr = tableRow } rec = this.dataSource.getDetachedRecord(t); this._renderRow(rec, tr); return t }, addRow: function (rowObject, autoCommit) { var t, noCancel, rowId = null; noCancel = this._trigger(this.events.rowAdding, null, { row: rowObject }); if (noCancel) { if (this.options.primaryKey !== null && rowObject[this.options.primaryKey] !== null && rowObject[this.options.primaryKey] !== undefined) { rowId = rowObject[this.options.primaryKey] } t = this.dataSource.addRow(rowId, rowObject, autoCommit); this.renderNewRow(rowObject); this._trigger(this.events.rowAdded, null, { row: rowObject }); return t } }, deleteRow: function (rowId, tr, autoCommit) { var t; t = this.dataSource.deleteRow(rowId, autoCommit); if (!tr) { tr = this._findTableRowByKey(rowId) } $(tr).remove(); return t }, commit: function (id) { var key; key = this._normalizedKey(id); this.dataSource.commit(key) }, rollback: function (id, updateUI) { var rec, tr, primaryKeyIndex, cols = this.options.columns, key, i; key = this._normalizedKey(id); this.dataSource.rollback(key); if (updateUI === true && id !== null && id !== undefined) { if (this.options.primaryKey !== null) { rec = this.dataSource.findRecordByKey(key); if (rec === undefined || rec === null) { throw new Error($.ig.Grid.locale.recordNotFound + " " + id) } for (i = 0; i < cols.length; i++) { if (cols[i].key === this.options.primaryKey) { primaryKeyIndex = i; break } } if (primaryKeyIndex === undefined) { throw new Error($.ig.Grid.locale.columnNotFound + " " + this.options.primaryKey) } tr = this.element.find("td:nth-child('" + (primaryKeyIndex + 1) + "'):contains('" + id + "')").parent()[0] } else { if (parseInt(id, 10) >= this.dataSource.dataView().length) { throw new Error($.ig.Grid.locale.indexOutOfRange) } rec = this.dataSource.dataView()[parseInt(id, 10)]; tr = this.rowAt(parseInt(id, 10)) } this._renderRow(rec, tr) } else { if (id === true || updateUI === true) { this.dataBind() } } }, _normalizedKey: function (id) { var key, primaryKeyCol; key = id; if (this.options.primaryKey !== null) { primaryKeyCol = this.columnByKey(this.options.primaryKey); if (primaryKeyCol.dataType === "number" || primaryKeyCol.dataType === "numeric") { key = parseInt(id, 10) } } else { key = parseInt(id, 10) } return key }, saveChanges: function () { this.dataSource.saveChanges() }, _renderRow: function (rec, tr) { var cols = this.options.columns, i; if (this.options.jQueryTemplating === true) { $(tr).replaceWith($.tmpl(this._generateRowTemplate(), [rec], this._buildFormatters())) } else { for (i = 0; i < tr.cells.length; i++) { tr.cells[i].innerHTML = this._renderCell(rec[cols[i].key], cols[i]) } } }, renderNewRow: function (rec) { var tbody = this.element.children("tbody"); if (this.options.jQueryTemplating === true) { $.tmpl(this._generateRowTemplate(), [rec], this._buildFormatters()).appendTo(tbody) } else { this._renderRecord(null, tbody, rec, this.dataSource.data().length) } }, _findTableRowByKey: function (key) { var primaryKeyIndex, cols = this.options.columns, r, i; if (this.options.primaryKey !== null) { for (i = 0; i < cols.length; i++) { if (cols[i].key === this.options.primaryKey) { primaryKeyIndex = i; break } } if (primaryKeyIndex === undefined) { throw new Error($.ig.Grid.locale.columnNotFound + " " + this.options.primaryKey) } r = this.element.find("td:nth-child('" + (primaryKeyIndex + 1) + "'):contains('" + key + "')").parent(); return r.length === 0 ? null : r[0] } else { return this.rowAt(parseInt(key, 10)) } }, dataSourceObject: function (dataSource) { if (dataSource !== undefined) { this.options.dataSource = dataSource } else { return this.options.dataSource } }, totalRecordsCount: function () { return this.dataSource.totalRecordsCount() }, dataBind: function (internal) { var dataOptions, i, noCancel = true; noCancel = this._trigger(this.events.dataBinding, null, { owner: this }); if (internal === undefined) { this.options.requiresDataBinding = true } if (noCancel) { if (this.options.requiresDataBinding) { dataOptions = this._generateDataSourceOptions(this.options); this._setupDataSource(dataOptions); this._dataOptions = dataOptions; if (!this._initialized) { for (i = 0; i < this.options.features.length; i++) { this._initFeature(this.options.features[i], dataOptions) } } else { this.element.trigger("iggriduidirty", { owner: this }); for (i = 0; i < this.options.features.length; i++) { this._initFeatureSettings(this.options.features[i]) } } this._renderGrid(); if (this._loadingIndicator === undefined) { this._initLoadingIndicator() } this._loadingIndicator.show(); this.dataSource.dataBind(); this.options.requiresDataBinding = false } else { this._renderGrid() } } }, _generateDataSourceOptions: function (options) { var schema, dataOptions, t, headers, i; if (!this.options.dataSource && !this.options.dataSourceUrl && this.element.is("table") && this.element.find("tbody").children().length > 0) { this.options.dataSource = this.element[0] } if (this.options.dataSource && this.options.dataSource.tagName && this.options.dataSource.nodeType) { t = $(this.options.dataSource); if (t.is("table") && t.find("thead th").length > 0) { headers = t.find("thead tr th"); this._tb_h = true; this._tb_h_arr = []; for (i = 0; i < headers.length; i++) { this._tb_h_arr.push($(headers[i]).text()) } } } dataOptions = { callback: this._renderData, callee: this, responseDataKey: this.options.responseDataKey, responseTotalRecCountKey: this.options.responseTotalRecCountKey, dataSource: this.options.dataSource, primaryKey: this.options.primaryKey, localSchemaTransform: this.options.localSchemaTransform, autoCommit: this.options.autoCommit, serializeTransactionLog: this.options.serializeTransactionLog, updateUrl: this.options.updateUrl }; if (this.options.dataSourceType !== null) { dataOptions.type = this.options.dataSourceType } schema = this._generateDataSourceSchema(); if ((this.options.dataSource instanceof $.ig.DataSource && this.options.dataSource.settings.schema === null) || !(this.options.dataSource instanceof $.ig.DataSource)) { dataOptions = $.extend(dataOptions, { schema: schema }) } return dataOptions }, _generateDataSourceSchema: function () { var schema, i, rec, prop, count = 0, cols = this.options.columns; if (this.options.columns.length > 0 && !this.options.autoGenerateColumns) { schema = {}; schema.fields = []; for (i = 0; i < this.options.columns.length; i++) { schema.fields[i] = {}; schema.fields[i].name = this.options.columns[i].key; schema.fields[i].type = this.options.columns[i].dataType } schema.searchField = this.options.responseDataKey } else { if (this.options.autoGenerateColumns) { schema = {}; schema.fields = []; if (this.options.dataSource && this.options.dataSource.tagName && $(this.options.dataSource).is("table") && $(this.options.dataSource).find("tbody tr").length > 0) { rec = $(this.options.dataSource).find("tbody tr")[0]; $(rec).find("td").each(function () { if (cols.length > count) { schema.fields.push({ name: cols[count].key ? cols[count].key : (count + 1), type: cols[count].dataType ? cols[count].dataType : "string" }) } else { schema.fields.push({ name: (count + 1), type: "string" }) } count++ }) } else { if (this.options.dataSource && this.options.dataSource.length && this.options.dataSource.length > 0 && $.type(this.options.dataSource) === "array") { rec = this.options.dataSource[0]; for (prop in rec) { if (rec.hasOwnProperty(prop)) { if (this.columnByKey(prop) === null) { schema.fields.push({ name: prop, type: this._getColType(rec[prop]) }) } else { schema.fields.push({ name: prop, type: this.columnByKey(prop).dataType }) } count++ } } } } } } return schema }, _setupDataSource: function (dataOptions) { if (!(this.options.dataSource instanceof $.ig.DataSource)) { this.dataSource = new $.ig.DataSource(dataOptions) } else { this.dataSource = this.options.dataSource; dataOptions.dataSource = this.dataSource.settings.dataSource; if (this.dataSource.settings.responseDataKey !== null) { delete dataOptions.responseDataKey; if (dataOptions.schema) { dataOptions.schema.searchField = this.dataSource.settings.responseDataKey } } this.dataSource.settings = $.extend(true, {}, this.dataSource.settings, dataOptions); if (dataOptions.schema) { this.dataSource._initSchema() } } }, _getColType: function (o) { var t = typeof o; if (t === "undefined") { return "string" } else { if (t === "object" && t instanceof Date) { return "date" } else { if (t === "boolean") { return "bool" } else { if (t === "number") { return t } else { return "string" } } } } }, _generateColumns: function () { var r, key, i, hasExplicitCols = this.options.columns.length > 0, hasHeaders = false, len, isTable = false, arr = []; if (this.options.dataSource && this.options.dataSource.tagName && $(this.options.dataSource).is("table")) { len = $(this.options.dataSource).find("tbody tr").length; isTable = true } else { if (this.options.dataSource && this.options.dataSource.length) { len = this.options.dataSource.length } } if (this.options.dataSource && len && len === 0 && this.options.columns.length === 0) { throw new Error($.ig.Grid.locale.autoGenerateColumnsNoRecords) } else { if (this.options.dataSource && len && len > 0) { if (isTable) { r = $(this.options.dataSource).find("tbody tr")[0] } else { r = this.options.dataSource[0] } if ($.type(r) === "array" || isTable) { hasHeaders = this._tb_h; if (isTable) { $(r).find("td").each(function () { arr.push($(this).text()) }); r = arr } for (i = 0; i < r.length; i++) { if (this.columnByKey(i + 1) === null) { this.options.columns.push({ headerText: hasHeaders ? this._tb_h_arr[i] : $.ig.Grid.locale.colPrefix + (i + 1), key: (i + 1), dataType: this._getColType(r[i]) }) } else { if (hasHeaders && !this.columnByKey(i + 1).headerText) { this.columnByKey(i + 1).headerText = this._tb_h_arr[i] } } } } else { for (key in r) { if (r.hasOwnProperty(key) && this.columnByKey(key) === null) { this.options.columns.push({ headerText: key, key: key, dataType: this._getColType(r[key]) }) } } } } } if ((this.dataSource.schema() === null || this.dataSource.schema().fields().length === 0) && !hasExplicitCols) { this.dataSource.settings.schema = this._generateDataSourceSchema(); this.dataSource._initSchema() } if (this.options.width === null) { this._setContainerWidth(this.element[0].id + "_container") } }, _renderGrid: function () { var grid = this, gridElement = this.element[0], containerId, containerDiv, noCancel, tbody = this.element.children("tbody"), ar = this.options.accessibilityRendering; grid._trigger(this.events.dataBound, null, { owner: this }); noCancel = grid._trigger(this.events.rendering, null, { owner: this }); if (noCancel) { if (!this._initialized) { if ($.type(this.options.virtualization) === "number" && this.dataSource.dataView().length > this.options.virtualization && this.options.height !== null) { this.options.virtualization = true } if (gridElement.nodeName.toLowerCase() === "div") { this._isWrapped = true; this.element = $("<table></table>").appendTo(gridElement); gridElement = this.element[0] } if (ar) { this.element.attr("role", "grid") } if (this.options.virtualization === true || this.options.rowVirtualization === true || this.options.columnVirtualization === true) { this._createVirtualGrid() } else { if (this.options.height !== null || this.options.width !== null) { this._createScrollingGrid() } else { if (!this._isWrapped) { containerId = gridElement.id + "_container"; containerDiv = '<div id="' + containerId + '" class="' + this.css.gridClasses + " " + this.css.baseClass + '"> </div>'; this.element.wrap(containerDiv) } else { containerId = this.element.parent().addClass(this.css.gridClasses).addClass(this.css.baseClass).attr("id") } this.element.addClass(this.css.gridTableClass); if (ar) { this.element.attr("aria-describedby", containerId) } this._setContainerWidth(containerId); $("#" + containerId).attr("tabIndex", this.options.tabIndex); if (this.options.height !== null) { $("#" + containerId).css("overflow-y", "hidden") } } } if (this.options.columns.length > 0 && (this.options.virtualization !== true && this.options.rowVirtualization !== true && this.options.columnVirtualization !== true) && this.options.autogenerateColumns === false && this.options.columns.length > 0) { this._renderColgroup(this.element[0]) } $(gridElement).attr("cellpadding", "0"); $(gridElement).attr("cellspacing", "0"); $(gridElement).attr("border", "0"); $(gridElement).css("table-layout", "fixed"); $(gridElement).addClass(this.css.gridTableClass); if (this.options.autoGenerateColumns === false && this.options.columns.length > 0) { this._renderHeader() } this._renderCaption(); if (this.options.autoAdjustHeight) { this._initializeHeights() } } if (tbody.length === 0) { tbody = $("<tbody></tbody>").appendTo(gridElement).addClass(this.css.baseContentClass).addClass(this.css.gridTableBodyClass).addClass(this.css.recordClass) } if (this.dataSource.type() !== "htmlTableDom" && this.dataSource.type() !== "htmlTableId") { tbody.empty() } } }, _setContainerWidth: function (id, rendered) { var cols = this.options.columns, width = 0; if (cols.length > 0) { width = this._calculateContainerWidth(); if (width > 0) { if (rendered) { width = 0; this.container().find(".ui-iggrid-header").each(function () { width += $(this).outerWidth() }); $("#" + id).width(width) } else { $("#" + id).css("width", width) } } } else { if (this.options.width !== null) { $("#" + id).css("width", this.options.width) } } }, _calculateContainerWidth: function () { var width = 0, cols = this.options.columns, i; for (i = 0; i < cols.length; i++) { width += cols[i].width ? parseInt(cols[i].width, 10) : this.options.defaultColumnWidth === null ? 0 : parseInt(this.options.defaultColumnWidth, 10) } if (this.options.height !== null && this.options.fixedHeaders === true && width > 0) { width += this._scrollbarWidth() } return width }, _createScrollingGrid: function () { var id = this.element[0].id + "_scroll", scrollDiv = '<div id="' + id + '"> </div>'; this.element.wrap(scrollDiv); if (this.options.accessibilityRendering) { this.element.attr("aria-describedby", id) } $("#" + id).addClass(this.css.gridScrollDivClass).wrap("<div id='" + this.element[0].id + "_container'></div>"); this.container().attr("tabIndex", this.options.tabIndex).addClass(this.css.baseClass).addClass(this.css.gridClasses); if (this.options.width !== null) { this.container().css("width", this.options.width); if (this.options.width.indexOf && this.options.width.indexOf("%") !== -1) { this.element.css("width", "100%") } } else { this._setContainerWidth(this.element[0].id + "_container"); $("#" + this.element[0].id + "_scroll").css("overflow-x", "hidden") } if (this.options.height !== null) { $("#" + id).css("overflow-y", "auto"); if (this.options.autoAdjustHeight) { this.container().css("height", this.options.height) } else { this.scrollContainer().css("height", this.options.height) } } }, _createVirtualGrid: function () { var id = this.element[0].id, grid, percWidthStr = $.browser.webkit ? "width=100%" : "", totalWidth, scrollContainerInner, scrollbarWidth, horizontalScrollContainerInner, w = 0, virtualGridMarkup = '<div id="' + id + '_container" style="margin:0px; border:0px; padding:0px;"><table border="0" cellspacing="0" cellpadding="0" class="ui-iggrid-layout-helper" style="border-spacing:0px" id="' + id + '_virtualContainer" ><tbody><tr><td colspan="2" style="border-width:0px"><div id="' + id + '_headers_v"></div></td></tr><tr><td style="border-width:0px;"><div id="' + id + '_displayContainer"></td>$verticalMarkup$</tr>$horizontalMarkup$</tbody></table></div>', verticalMarkup, horizontalMarkup = '<tr><td colspan="2" style="border-width: 0px"><div id="' + id + '_horizontalScrollContainer"></div></td></tr>'; scrollbarWidth = this._scrollbarWidth(); if ($.browser.msie) { scrollbarWidth += 1 } if (parseInt(this.options.height, 10) > 0) { verticalMarkup = '<td style="border-width: 0px;"><div id="' + id + '_scrollContainer" style="overflow:scroll; overflow-x:hidden; width: ' + scrollbarWidth + "px; height:" + parseInt(this.options.height, 10) + 'px;"></div></td>' } else { verticalMarkup = '<td style="border-width: 0px;"><div id="' + id + '_scrollContainer" style="overflow:scroll; overflow-x:hidden; width: ' + scrollbarWidth + 'px;"></div></td>' } if (this.options.virtualization === true) { virtualGridMarkup = virtualGridMarkup.replace("$verticalMarkup$", verticalMarkup).replace("$horizontalMarkup$", horizontalMarkup) } else { if (this.options.rowVirtualization === true) { virtualGridMarkup = virtualGridMarkup.replace("$verticalMarkup$", verticalMarkup).replace("$horizontalMarkup$", "") } else { if (this.options.columnVirtualization === true) { virtualGridMarkup = virtualGridMarkup.replace("$horizontalMarkup$", horizontalMarkup).replace("$verticalMarkup$", "") } } } if (this.options.virtualization === true || this.options.columnVirtualization === true) { this.element.css("width", "100%") } this.element.wrap(virtualGridMarkup); this.container().addClass(this.css.baseClass).addClass(this.css.gridClasses); if (this.options.width !== null) { this.container().width(this.options.width) } else { this._setContainerWidth(this.container()[0].id) } $("#" + id + "_displayContainer").append(this.element[0]); this._renderColgroup(this.element[0]); grid = this; totalWidth = this._calculateContainerWidth(); if (this.options.width !== null) { w = parseInt(this.options.width, 10) } else { w = totalWidth } if (this.options.height !== null) { w -= this._scrollbarWidth() } $("<colgroup><col " + (w <= 0 ? percWidthStr : ('width="' + w + '"')) + '></col><col width="' + this._scrollbarWidth() + '"></col></colgroup>').prependTo("#" + id + "_virtualContainer"); $("#" + id + "_virtualContainer").css("width", this.options.width).css("max-width", this.options.width); scrollContainerInner = '<div style="width:1px; overflow:hidden; height:' + (this._totalRowCount * parseInt(this.options.avgRowHeight, 10)) + 'px;"></div>'; $("#" + id + "_scrollContainer").append(scrollContainerInner); if ((this.options.virtualization === true || this.options.columnVirtualization === true) && totalWidth > parseInt(this.options.width, 10)) { $("#" + id + "_horizontalScrollContainer").css("height", this._scrollbarWidth() + "px").css("overflow", "scroll"); if ($.browser.msie) { $("#" + id + "_horizontalScrollContainer").css("width", parseInt(this.options.width, 10) + 1) } else { $("#" + id + "_horizontalScrollContainer").css("width", this.options.width) } horizontalScrollContainerInner = '<div style="width:' + totalWidth + 'px;height:1px;"></div>'; $("#" + id + "_horizontalScrollContainer").append(horizontalScrollContainerInner) } if (parseInt(this.options.height, 10) > 0) { $("#" + id + "_displayContainer").css("height", this.options.height).css("vertical-align", "top") } $("#" + id + "_displayContainer").append("<a href='#' id='" + id + "_displayContainer_a'></a>").css("width", w).css("maxWidth", w); if (this.options.width && this.options.virtualization === false && this.options.columnVirtualization === false) { $("#" + id + "_displayContainer").css({ "overflow-y": "hidden", "overflow-x": "auto" }) } else { $("#" + id + "_displayContainer").css("overflow", "hidden") } $("#" + id + "_displayContainer").parent().bind({ mouseover: function (event) { grid._isMouseOverVirtualTable = true }, mouseout: function (event) { grid._isMouseOverVirtualTable = false } }); $(document).bind({ DOMMouseScroll: function (event) { var dir = "down", delta, step; step = grid.options.virtualizationMouseWheelStep === null ? parseInt(grid.options.avgRowHeight, 10) : grid.options.virtualizationMouseWheelStep; delta = -event.detail / 3; if (delta > 0) { dir = "up" } if (grid._isMouseOverVirtualTable) { grid._onVirtualVerticalScroll(event, step, dir); event.preventDefault() } }, mousewheel: function (event) { var dir = "down", delta, step; step = grid.options.virtualizationMouseWheelStep === null ? parseInt(grid.options.avgRowHeight, 10) : grid.options.virtualizationMouseWheelStep; delta = event.wheelDelta / 120; if (delta > 0) { dir = "up" } if (grid._isMouseOverVirtualTable) { grid._onVirtualVerticalScroll(event, step, dir); event.preventDefault() } } }); if (this.options.virtualization === true || this.options.rowVirtualization === true) { $("#" + id + "_scrollContainer").bind({ scroll: function (event) { grid._onVirtualVerticalScroll(event); grid._virtualScrollMouseDown = false }, mousedown: function (event) { grid._virtualScrollMouseDown = true } }) } if (this.options.virtualization === true || this.options.columnVirtualization === true) { $("#" + id + "_horizontalScrollContainer").bind({ scroll: function (event) { grid._onVirtualHorizontalScroll(event) } }) } this.element.height($("#" + id + "_scrollContainer").height()) }, _onVirtualVerticalScroll: function (event, offset, dir) { if (this._ignoreScroll && event) { return false } this._isHorizontal = false; var scrollContainer = this._scrollContainer(), scrollTopDiff, current = scrollContainer.scrollTop(); if (offset !== undefined) { if (dir === "down") { scrollContainer.scrollTop(current + offset) } else { scrollContainer.scrollTop(current - offset) } } this._startRowIndex = Math.ceil(scrollContainer.scrollTop() / parseInt(this.options.avgRowHeight, 10)); scrollTopDiff = scrollContainer.scrollTop() - this._oldScrollTop; if ((!$.browser.msie) && this._startRowIndex === this._oldStartRowIndex && this._virtualScrollMouseDown) { if (scrollTopDiff > 0 && scrollTopDiff < parseInt(this.options.avgRowHeight, 10)) { this._startRowIndex++; scrollContainer.scrollTop(scrollContainer.scrollTop() - scrollTopDiff + parseInt(this.options.avgRowHeight, 10)) } else { if (scrollTopDiff < 0 && Math.abs(scrollTopDiff) < parseInt(this.options.avgRowHeight, 10)) { this._startRowIndex--; scrollContainer.scrollTop(scrollContainer.scrollTop() - scrollTopDiff - parseInt(this.options.avgRowHeight, 10)) } } } if (this._startRowIndex > this._totalRowCount - this._virtualRowCount) { this._startRowIndex = this._totalRowCount - this._virtualRowCount } if (this._startRowIndex < 0) { this._startRowIndex = 0 } if (Math.abs(scrollTopDiff) < 5 && $.browser.mozilla && !$.browser.msie) { return } this._oldStartRowIndex = this._startRowIndex; this._renderVirtualRecords(); this._oldScrollTop = scrollContainer.scrollTop() }, _scrollContainer: function () { if (!this._scrollContainerObj) { this._scrollContainerObj = $("#" + this.element[0].id + "_scrollContainer") } return this._scrollContainerObj }, _onVirtualHorizontalScroll: function (event) { var id = this.element[0].id, horizontalScrollContainer = $("#" + id + "_horizontalScrollContainer"); this._isHorizontal = true; this._startColIndex = Math.ceil(horizontalScrollContainer.scrollLeft() * this._totalColumnCount / (horizontalScrollContainer[0].scrollWidth - horizontalScrollContainer[0].offsetWidth)); if (this._startColIndex > this._totalColumnCount - this._virtualColumnCount) { this._startColIndex = this._totalColumnCount - this._virtualColumnCount } if (Math.abs(horizontalScrollContainer.scrollLeft() - this._oldScrollLeft) < 5 && $.browser.mozilla && !$.browser.msie) { return } this._renderVirtualRecords(); this._oldScrollLeft = horizontalScrollContainer.scrollLeft(); this._trigger("virtualhorizontalscroll", null, { startColIndex: this._startColIndex, endColIndex: this._startColIndex + this._virtualColumnCount }) }, _initLoadingIndicator: function () { if (this.container().data("igLoading")) { this._loadingIndicator = this.container().data("igLoading").indicator() } else { this._loadingIndicator = this.container().igLoading().data("igLoading").indicator() } }, _renderData: function (success, errmsg) { var gridElement = this.element, noCancel = true, i, lastc, isTable = false, lastHeader, tbody; if (success === false) { throw new Error(errmsg) } if (this._fireDataBoundInternal) { this._fireDataBoundInternal = false; this._trigger(this.events.dataBound, null, { owner: this }) } this.element.trigger("iggriduisoftdirty", { owner: this }); tbody = gridElement.children("tbody"); noCancel = this._trigger(this.events.dataRendering, null, { owner: this }); if (noCancel) { if (!(this.options.dataSource && this.options.dataSource.tagName && $(this.options.dataSource).is("table"))) { if ($.ui.igGrid.speedupDOMCleanup === false) { tbody.empty() } else { if (tbody.children().length > 0) { this.element[0].removeChild(tbody[0]); tbody = $("<tbody></tbody>").appendTo(this.element).addClass(this.css.baseContentClass).addClass(this.css.gridTableBodyClass).addClass(this.css.recordClass) } } } else { isTable = true } this._virtualDom = null; if (!this._initialized) { if (this.options.autoGenerateColumns === true) { this._generateColumns(); for (i = 0; i < this.options.features.length; i++) { this._initFeature(this.options.features[i], this._dataOptions) } } if (isTable) { tbody.empty() } if (this.container().find(".ui-iggrid-header").length === 0) { this._renderHeader(); this._renderCaption() } if (this.element.find("colgroup").length === 0) { this._renderColgroup(this.element[0]) } } if (this.options.autoGenerateColumns === false && ((this.options.columns && this.options.columns.length === 0) || !this.options.columns)) { throw new Error($.ig.Grid.locale.noColumnsButAutoGenerateTrue) } if (this.options.columns.length > 0) { if (this.options.virtualization === true || this.options.rowVirtualization === true || this.options.columnVirtualization === true) { this._renderVirtualRecords() } else { this._renderRecords() } } if (this._headerParent && this.options.fixedHeaders === true && this._lastCol && this.options.showHeader && this._lastColWidth !== undefined && this.options.height && parseInt(this.options.height, 10) > 0) { if ((this.options.autoAdjustHeight && this.element.height() <= $("#" + this.element[0].id + "_scroll").height()) || (!this.options.autoAdjustHeight && this.options.avgRowHeight * this.element[0].rows.length < parseInt(this.options.height, 10))) { this._lastCol.css("width", this._lastColWidth); this._headerParent.css("padding-right", 0); lastHeader = this._headerParent.find("th:last-child"); lastHeader.css("width", this._lastColWidth) } else { if (this._lastColWidth.charAt && this._lastColWidth.endsWith("%")) { this._lastCol.css("width", this._lastColWidth); this._headerParent.css("padding-right", this._scrollbarWidth()) } else { this._lastCol.css("width", this._lastColWidth + this._scrollbarWidth()) } } } else { if (!this._lastCol && this.options.height !== null) { if (this.options.autoAdjustHeight && this.element.height() <= $("#" + this.element[0].id + "_scroll").height()) { this.headersTable().css("padding-right", 0) } else { } } } this._registerAdditionalEvents(); this._trigger(this.events.dataRendered, null, { owner: this }); this._fireInternalEvent("_dataRendered"); if (!this._initialized) { this._renderFooter(); if (this.options.autoAdjustHeight) { this._initializeHeights() } } if (!this._initialized) { this._trigger(this.events.rendered, null, { owner: this }) } if (!this._initialized) { this._initialized = true } if (this._loadingIndicator === undefined) { this._initLoadingIndicator() } this._loadingIndicator.hide() } if (this.options.dataSourceUrl !== null && this._firstBind) { this.options.dataSource = this.options.dataSourceUrl; this.dataSource.settings.dataSource = this.options.dataSourceUrl; this.dataSource.settings.type = "remoteUrl"; this.dataSource._runtimeType = this.dataSource.analyzeDataSource(); this._firstBind = false } this._fireInternalEvent("_gridRendered", $("#" + gridElement[0].id + "_container")) }, _initializeHeights: function () { var initialHeight; if (this.options.height === null || this.options.height === undefined) { return } initialHeight = parseInt(this.options.height, 10); $("#" + this.element[0].id + "_scroll").height(initialHeight); this._initializeHeightsInternal() }, _initializeHeightsInternal: function () { var children, height, i, $child, ch; ch = this.container().height(); this._prevContainerHeight = ch; if (this.options.height !== null) { children = this.container().children(); height = 0; for (i = 0; i < children.length; i++) { $child = $(children[i]); if ((($child.attr("id") !== undefined && !$child.attr("id").endsWith("_scroll") && !$child.attr("id").endsWith("_loading")) || !$child.attr("id")) && $child.is(":visible") && $child.data("efh") !== "1") { if ($child.is("table") && $child.children().first().is("caption")) { height += $child.children().first().outerHeight() } else { height += $child.outerHeight() } } } if (height > 0) { $("#" + this.element[0].id + "_scroll").height(ch - height) } } }, _registerAdditionalEvents: function () { var css = "ui-state-hover"; $("#" + this.element[0].id + " th.ui-state-default").hover(function () { $(this).addClass("ui-state-hover") }, function () { $(this).removeClass("ui-state-hover") }); this.element.bind(this._hovEvts = { mousemove: function (e) { var par, tag, tr = e.target; while (tr) { par = tr.parentNode; if ((tag = tr.nodeName) === "TR" && par.nodeName === "TBODY") { break } tr = (tag === "TABLE") ? null : par } if (_hovTR !== tr) { if (_hovTR) { $("td", _hovTR).removeClass(css) } if (tr) { $("td", tr).addClass(css) } _hovTR = tr } }, mouseleave: function (e) { if (_hovTR) { $("td", _hovTR).removeClass(css); _hovTR = null } } }) }, _renderColgroup: function (table, isHeader) { var colgroup, i, cols, defWidth = this.options.defaultColumnWidth, colWidth = 0, totalWidth = this.options.width, lastCol, isPercentage = false; colgroup = $("<colgroup></colgroup>").prependTo(table); cols = this.options.columns; if (defWidth && defWidth.charAt && defWidth.endsWith("%")) { isPercentage = true } for (i = 0; i < cols.length; i++) { if (cols[i].width) { if (cols[i].width.charAt && cols[i].width.endsWith("%")) { isPercentage = true } colWidth += parseInt(cols[i].width, 10); if (i === cols.length - 1 && isHeader === true && this.options.height && parseInt(this.options.height, 10) > 0 && this.options.showHeader) { if (!isPercentage) { lastCol = $("<col></col>").appendTo(colgroup).css("width", parseInt(cols[i].width, 10) + this._scrollbarWidth()); this._lastColWidth = parseInt(cols[i].width, 10) } else { lastCol = $("<col></col>").appendTo(colgroup).css("width", cols[i].width); this._lastColWidth = cols[i].width } this._lastCol = lastCol } else { if (this.options.fixedHeaders === false && i === cols.length - 1 && parseInt(this.options.height, 10) > 0 && this.options.showHeader) { $("<col></col>").appendTo(colgroup).css("width", cols[i].width).css("padding-right", this._scrollbarWidth()) } else { if (this._virtualColumnCount === undefined && (this.options.virtualization || this.options.columnVirtualization)) { this._virtualColumnCount = this.options.width === null ? this.options.columns.length : parseInt(this.options.width, 10) / this._avgColumnWidth(); this._virtualColumnCount = Math.ceil(this._virtualColumnCount) } if (this._virtualColumnCount && this._virtualColumnCount < cols.length && i === this._virtualColumnCount - 1 && this.options.showHeader) { this._lastCol = $("<col></col>").appendTo(colgroup).css("width", cols[i].width).css("padding-right", this._scrollbarWidth()); this._lastColWidth = cols[i].width } else { $("<col></col>").appendTo(colgroup).css("width", cols[i].width) } } } } else { colWidth += parseInt(defWidth, 10); if (defWidth !== null) { if (i === cols.length - 1 && this.options.fixedHeaders === true && isHeader === true && this.options.height && parseInt(this.options.height, 10) > 0) { if (!isPercentage) { lastCol = $("<col></col>").appendTo(colgroup).css("width", parseInt(defWidth, 10) + this._scrollbarWidth()); this._lastColWidth = parseInt(defWidth, 10) } else { lastCol = $("<col></col>").appendTo(colgroup).css("width", defWidth); this._lastColWidth = defWidth } this._lastCol = lastCol } else { $("<col></col>").appendTo(colgroup).css("width", defWidth) } } else { $("<col></col>").appendTo(colgroup) } } } if (totalWidth !== null && !isPercentage) { totalWidth = parseInt(totalWidth, 10); if (totalWidth > colWidth) { lastCol = colgroup.children().last(); lastCol.css("width", parseInt(lastCol.css("width"), 10) + totalWidth - colWidth) } } }, _generateRowTemplate: function () { var key, type, format, auto = this.options.autoFormat, ar = this.options.accessibilityRendering, firstRec = null, grid = this, i, prop, tmplName, tmpl = grid.options.rowTemplate, cols = grid.options.columns; if (this._tmpl) { return this._tmpl } if (grid.dataSource.dataView().length > 0) { firstRec = grid.dataSource.dataView()[0] } if (tmpl) { for (i = 0; i < cols.length; i++) { key = cols[i].key; if (cols[i].formatter) { format = "${$item." + key + "Formatter(this.data ? this.data." + key + " : undefined)}" } else { format = cols[i].format; type = cols[i].dataType; type = (type === "date" || type === "number") ? type : ""; if (format || ((auto === true || auto === "dateandnumber") && type) || (auto && auto === type)) { format = "${$.ig.formatter(typeof " + key + ' ==="undefined"?"":' + key + ',"' + type + '","' + (format ? format.replace("{0}", "[0]") : "") + '")}' } } if (format) { tmpl = tmpl.replace(new RegExp("\\$ *\\{ *" + key + " *\\}", "g"), format) } } } else { if (ar) { tmpl = '<tr role="row" ' } else { tmpl = "<tr " } if (this.options.alternateRowStyles) { tmpl += "class=\"${$item.data.ig_zebraStyle % 2 !== 0 ? '' : '" + this.css.recordAltClass + "' }\">" } else { tmpl += ">" } if (cols.length > 0) { if (firstRec === null || (firstRec.hasOwnProperty(cols[0].key) && $.type(firstRec) !== "array")) { for (i = 0; i < cols.length; i++) { key = cols[i].key; if (ar) { tmpl += '<td role=gridcell aria-describedby="' + key + '">' } else { tmpl += "<td>" } if (cols[i].formatter !== undefined) { tmpl += "${$item." + key + "Formatter(this.data ? this.data." + key + " : undefined)}</td>" } else { format = cols[i].format; type = cols[i].dataType; type = (type === "date" || type === "number") ? type : ""; if (format || ((auto === true || auto === "dateandnumber") && type) || (auto && auto === type)) { tmpl += "${$.ig.formatter(typeof " + key + ' ==="undefined"?"":' + key + ',"' + type + '","' + (format ? format.replace("{0}", "[0]") : "") + '")}</td>' } else { if (type === "bool") { tmpl += "${" + key + "}</td>" } else { tmpl += "${(typeof " + key + ' =="undefined"||' + key + '==null)?"&nbsp;":' + key + "}</td>" } } } } } else { tmpl += "{{each $data}}"; if (ar) { tmpl += '<td role="gridcell">${this}</td>' } else { tmpl += "<td>${this}</td>" } tmpl += "{{/each}}" } } else { if (grid.dataSource.dataView().length > 0) { for (prop in firstRec) { if (firstRec.hasOwnProperty(prop)) { if (ar) { tmpl += '<td role="gridcell">${' + prop + "}</td>" } else { tmpl += "<td>${" + prop + "}</td>" } } } } else { throw new Error($.ig.DataSource.locale.cannotBuildTemplate) } } tmpl += "</tr>" } tmplName = this.element[0].id + "rowTemplate"; $.template(tmplName, tmpl); this._tmpl = tmpl; return tmpl }, _renderRecords: function () { var grid = this, tbody = this.element.children("tbody"), tmpl, ds = this.dataSource.dataView(), i, d = []; if (!grid.options.jQueryTemplating) { $(ds).map(function (i) { d.push(grid._renderRecord(d, tbody, this, i)) }); tbody.html(d.join("")); d = [] } else { tmpl = this._generateRowTemplate(); if (this.options.alternateRowStyles) { for (i = 0; i < ds.length; i++) { ds[i].ig_zebraStyle = i } } $.tmpl(tmpl, ds, this._buildFormatters()).appendTo(tbody); if (this.options.alternateRowStyles) { for (i = 0; i < ds.length; i++) { ds[i].ig_zebraStyle = null } } } }, _buildFormatters: function () { var i, cols = this.options.columns, ret = {}; for (i = 0; i < cols.length; i++) { if (cols[i].formatter !== undefined) { if ($.type(cols[i].formatter) === "function") { ret[cols[i].key + "Formatter"] = cols[i].formatter } else { ret[cols[i].key + "Formatter"] = eval(cols[i].formatter) } } } return ret }, _renderVirtualRecords: function () { var i, j, tmpl, row, c, val, headersTexts; if (this._startRowIndex === undefined || this._startRowIndex === null) { this._startRowIndex = 0 } if (this._startColIndex === undefined || this._startColIndex === null) { this._startColIndex = 0 } if (this._virtualDom === null || this._virtualDom === undefined) { this._buildVirtualDom(); if (this.options.adjustVirtualHeights === true) { this._adjustVirtualHeights() } } else { tmpl = this._generateRowTemplate(); for (i = 0; i < this._virtualRowCount && i < this._totalRowCount; i++) { if (this.options.jQueryTemplating === false) { for (j = 0; j < this._virtualColumnCount; j++) { if (this.options.columns.length > 0) { val = this.dataSource.dataView()[this._startRowIndex + i][this.options.columns[this._startColIndex + j].key]; this._virtualDom[i][j].innerHTML = this._renderCell(val, this.options.columns[this._startColIndex + j]) } else { val = this.dataSource.dataView()[this._startRowIndex + i][this._startColIndex + j]; this._virtualDom[i][j].innerHTML = this.dataSource.dataView()[this._startRowIndex + i][this._startColIndex + j] } this._virtualDom[i][j].className = "" } } else { if ($.type(this.dataSource.dataView()[i]) === "array") { row = $.tmpl(tmpl, [this.dataSource.dataView()[this._startRowIndex + i]], this._buildFormatters()) } else { row = $.tmpl(tmpl, this.dataSource.dataView()[this._startRowIndex + i], this._buildFormatters()) } c = row.children(); for (j = 0; j < this._virtualColumnCount; j++) { this._virtualDom[i][j].innerHTML = c[j + this._startColIndex].innerHTML; this._virtualDom[i][j].className = "" } } this._virtualDom[i][0].parentNode.className = (i % 2 === 0 && this.options.alternateRowStyles) ? "ui-iggrid-virtualrow ui-ig-altrecord" : "ui-iggrid-virtualrow" } if (this._isHorizontal) { if ((this.options.virtualization === true || this.options.columnVirtualization === true) && parseInt(this.options.width, 10) > 0) { if (!this._vheaders) { headersTexts = this.element.find("thead > tr > th > a > span:first-child"); if (headersTexts.length > 0) { this._vheaders = headersTexts } else { this._vheaders = this.element.find("thead > tr > th > span") } } for (j = 0; j < this._virtualColumnCount; j++) { this._vheaders[j].innerHTML = this.options.columns[j + this._startColIndex].headerText } } } } this._trigger("virtualrecordsrender", null, { dom: this._virtualDom }) }, _buildVirtualDom: function () { var grid = this, markup = "", row, i, j, dataLinkFn, ar = this.options.accessibilityRendering, tmpl, shouldHide = false, c, tmpRow; if (this._startRowIndex === undefined || this._startRowIndex === null) { this._startRowIndex = 0; this._startColIndex = 0; this._oldStartRowIndex = 0; this._oldStartColIndex = 0 } this._virtualDom = []; this._totalRowCount = this.dataSource.dataView().length; if (this.options.height === null) { this._virtualRowCount = this._totalRowCount } else { this._virtualRowCount = parseInt(this.options.height, 10) / parseInt(this.options.avgRowHeight, 10) } this._totalColumnCount = this.options.columns ? this.options.columns.length : this.dataSource.dataView()[0].length; if (this.options.columnVirtualization === false && this.options.virtualization === false) { this._virtualColumnCount = this.options.columns.length } else { this._virtualColumnCount = this.options.width === null ? this.options.columns.length : parseInt(this.options.width, 10) / this._avgColumnWidth(); this._virtualColumnCount = Math.ceil(this._virtualColumnCount) } if (this.options.height !== null) { $("#" + this.element[0].id + "_scrollContainer").children().first().height(this._totalRowCount * parseInt(this.options.avgRowHeight, 10)) } dataLinkFn = function (row, i, vc) { var j; for (j = 0; j < vc; j++) { if (j < grid._totalColumnCount) { grid._virtualDom[i][j] = row[0].cells[j] } } }; tmpl = this._generateRowTemplate(); this.element.children("tbody").empty(); for (i = 0; i < this._virtualRowCount; i++) { shouldHide = false; this._virtualDom[i] = []; markup = ""; if (!this.options.jQueryTemplating) { for (j = this._startColIndex; j < this._virtualColumnCount + this._startColIndex; j++) { if (j >= this._totalColumnCount) { break } if (ar) { markup += '<td role="gridcell" ' } else { markup += "<td " } if (this.options.columns.length > 0) { if (ar) { markup += 'aria-describedby="' + this.options.columns[j].key + '">' } else { markup += ">" } if (!this.dataSource.dataView()[i]) { shouldHide = true } else { if (this.options.autoFormat !== false) { markup += this._renderCell(this.dataSource.dataView()[i][this.options.columns[j].key], this.options.columns[j]) + "</td>" } else { markup += this.dataSource.dataView()[i][this.options.columns[j].key] + "</td>" } } } else { if (!this.dataSource.dataView()[i]) { shouldHide = true } else { markup += this.dataSource.dataView()[i][j] + "</td>" } } } row = $("<tr>" + markup + "</tr>").appendTo(this.element.children("tbody")); if (shouldHide) { row.css("visibility", "hidden") } if (i % 2 === 0 && this.options.alternateRowStyles) { row.addClass("ui-ig-altrecord") } } else { if ($.type(this.dataSource.dataView()[i]) === "array") { row = $.tmpl(tmpl, [this.dataSource.dataView()[i]], this._buildFormatters()).appendTo(this.element.children("tbody")) } else { row = $.tmpl(tmpl, this.dataSource.dataView()[i], this._buildFormatters()); if ((this.options.virtualization === true || this.options.columnVirtualization === true) && parseInt(this.options.width, 10) > 0) { tmpRow = $("<tr></tr>").appendTo(this.element.children("tbody")); for (c = 0; c < this._virtualColumnCount; c++) { $(row[0].cells[c]).clone().appendTo(tmpRow) } row = tmpRow } else { this.element.children("tbody").append(row) } } if (!this.dataSource.dataView()[i]) { row.css("visibility", "hidden") } } row.addClass("ui-iggrid-virtualrow"); if (i % 2 === 0 && this.options.alternateRowStyles) { row.addClass("ui-ig-altrecord") } if (ar) { row.attr("role", "row") } dataLinkFn(row, i, this._virtualColumnCount) } }, _adjustVirtualHeights: function () { var c = $("#" + this.element[0].id + "_displayContainer"), tbody = c.find("tbody"), h = tbody.children().first().height(); if (this.options.height === null) { return } if (this.options.avgRowHeight !== h) { this.options.avgRowHeight = h; this._buildVirtualDom() } }, _verticalScroller: function () { if (!this._verticalScrollerObj) { this._verticalScrollerObj = $("#" + this.element[0].id + "_scrollContainer").children().first() } return this._verticalScrollerObj }, _avgColumnWidth: function () { var width = 0, cols = this.options.columns, count = cols.length, def = this.options.defaultColumnWidth, i; if (this.options.avgColumnWidth !== null) { return parseInt(this.options.avgColumnWidth, 10) } for (i = 0; i < count; i++) { width += parseInt(cols[i].width, 10) } if ((count === 0 || isNaN(width)) && def) { return parseInt(def, 10) } else { if (count > 0 && this.options.autoGenerateColumns && isNaN(width)) { if (this.options.width === null || this.options.width === undefined) { throw new Error($.ig.DataSource.locale.columnVirtualizationRequiresWidth) } else { return parseInt(this.options.width, 10) / count } } else { if (width === 0 || (width < def)) { return def } else { return width / count } } } }, _scrollHeader: function () { var scrollContainer = $("#" + this.element[0].id + "_scroll"), headers = $("#" + this.element[0].id + "_headers").parent(); headers.scrollLeft(scrollContainer.scrollLeft()) }, _renderCaption: function () { if (this.options.caption !== null) { if (this.container().find(".ui-iggrid-headercaption").length > 0) { return } if (this.options.fixedHeaders === true && this.options.showHeader === true) { $("<caption></caption>").prependTo(this.headersTable()).text(this.options.caption).attr("id", this.element[0].id + "_caption").addClass(this.css.gridHeaderCaptionClass) } else { $("<caption></caption>").appendTo($("<table></table>").prependTo(this.container()).css("width", "100%").addClass(this.css.captionTable)).text(this.options.caption).attr("id", this.element[0].id + "_caption").addClass(this.css.gridHeaderCaptionClass) } } }, _renderHeader: function () { var header, grid = this, id, headerClass, markup, headerDom, headerMarkup = "", scrollc = this.scrollContainer(), noCancel = true, headerCell, headerParent = this.element[0], width, ar = this.options.accessibilityRendering, headerText, totalHeadersWidth = 0, usingPercent = false, m, headerScrollDiv; noCancel = this._trigger(this.events.headerRendering, null, { owner: this }); if (noCancel) { id = this.element[0].id; headerMarkup = "<thead><tr></tr></thead>"; headerParent = this.container(); width = scrollc.css("width"); if (this.options.showHeader && this.options.fixedHeaders && this.options.height !== null) { if (this.options.virtualization !== true) { if (headerParent.length === 0) { scrollc.removeClass(this.css.gridClasses).removeClass(this.css.baseClasses).css("width", "").wrap("<div id='" + id + "_container'></div>"); headerParent = $("#" + id + "_container").addClass(this.css.baseClasses).addClass(this.css.gridClasses).css("width", width); this._isWrapped = true } } else { headerParent = $("#" + id + "_headers_v").css("width", width) } headerParent = $("<table id='" + id + "_headers'></table>").prependTo(headerParent).addClass(this.css.gridHeaderTableClass).attr("cellpadding", 0).attr("cellspacing", 0).attr("border", "0"); if (this.options.virtualization !== true && this.options.rowVirtualization !== true && this.options.columnVirtualization !== true) { headerScrollDiv = $("<div></div>").prependTo(headerParent.parent()); headerScrollDiv.css("overflow", "hidden").css("position", "relative"); headerScrollDiv.append(headerParent); this.element.parent().bind("scroll", $.proxy(this._scrollHeader, this)) } this._renderColgroup(headerParent, true) } else { if (this.options.fixedHeaders !== true && this.options.showHeader) { headerParent = this.element } } if (this.options.width === null && this.options.height === null) { headerParent = this.element } if (this.options.width !== null && this.options.height === null) { scrollc.css("overflow-y", "hidden").css("overflow-x", "auto"); headerParent = this.element } if (this.options.showHeader) { if (this.options.headerTemplate === null || this.options.headerTemplate === undefined) { if (this.options.virtualization === true || this.options.rowVirtualization === true) { $("#" + id + "_headers_v").addClass(this.css.gridClasses).addClass(this.css.baseClasses); headerParent.addClass(this.css.gridHeaderTableClass).attr("cellpadding", 0).attr("cellspacing", 0).attr("border", "0") } header = $(headerMarkup).appendTo(headerParent).children().first(); headerClass = this.css.headerClass; $(this.options.columns).map(function (i) { headerText = "<span>" + this.headerText + "</span>"; markup = "<th></th>"; m = this.width === undefined ? (grid.options.defaultColumnWidth === null ? this.width : grid.options.defaultColumnWidth) : this.width; if (this.key) { if (ar) { headerCell = $(markup).appendTo(header).attr("id", grid.element[0].id + "_" + this.key).attr("role", "rowheader").addClass(headerClass).data("columnIndex", i) } else { headerCell = $(markup).appendTo(header).attr("id", grid.element[0].id + "_" + this.key).addClass(headerClass).data("columnIndex", i) } $(headerText).appendTo(headerCell).addClass(grid.css.headerTextClass); if (i === grid.options.columns.length - 1 && grid.options.height && parseInt(grid.options.height, 10) > 0) { if (m && m.charAt && m.endsWith("%")) { usingPercent = true; headerCell.css("width", m) } else { if (grid.options.fixedHeaders === false && grid.options.showHeader) { headerCell.css("width", m).css("padding-right", grid._scrollbarWidth()) } else { headerCell.css("width", parseInt(m, 10) + grid._scrollbarWidth()) } } totalHeadersWidth += grid._scrollbarWidth() } else { if (grid._virtualColumnCount && grid._virtualColumnCount < grid.options.columns.length && i === grid._virtualColumnCount - 1 && grid.options.showHeader) { headerCell.css("width", m).css("padding-right", grid._scrollbarWidth()) } else { headerCell.css("width", m) } } if (m !== null && m !== undefined && m !== "") { totalHeadersWidth += parseInt(m, 10) } grid._trigger(grid.events.headerCellRendered, null, { owner: grid, th: headerCell, columnKey: this.key }) } }) } else { headerDom = this.options.headerTemplate; if (this.options.virtualization === true || this.options.rowVirtualization === true) { $(headerDom).children().map(function () { this.appendTo("#" + id + "_headers") }); header = $("#" + id + "_headers").addClass(this.css.gridClasses) } else { header = $(headerMarkup).appendTo(headerParent).append(headerDom) } } } this._headerParent = headerParent; if (parseInt(this.options.height, 10) > 0 && this.options.fixedHeaders === true && (usingPercent === true || !m) && this.options.showHeader) { headerParent.css("padding-right", this._scrollbarWidth).addClass("ui-widget-header").css("border-width", 0) } this._trigger(this.events.headerRendered, null, { owner: this }) } }, _renderFooter: function () { }, _renderRecord: function (darr, tbody, data, rowIndex) { var i, key, ar = this.options.accessibilityRendering, grid = this, appendBehavior = false; if (darr === null) { darr = []; appendBehavior = true } if (rowIndex % 2 !== 0 && this.options.alternateRowStyles) { darr.push('<tr class="' + grid.css.recordAltClass + '"') } else { darr.push("<tr") } if (ar) { darr.push(' role="row">') } else { darr.push(">") } if (this.options.columns.length > 0) { $(this.options.columns).map(function (colIndex) { if (ar) { darr.push('<td role="gridcell" aria-describedby="' + this.key + '">') } else { darr.push("<td>") } if (data[this.key] === undefined) { darr.push(grid._renderCell(data[colIndex], this)); darr.push("</td>") } else { darr.push(grid._renderCell(data[this.key], this)); darr.push("</td>") } }) } else { if ($.type(data) === "array") { for (i = 0; i < data.length; i++) { if (ar) { darr.push('<td role="gridcell">' + data[i] + "</td>") } else { darr.push("<td>"); darr.push(data[i]); darr.push("</td>") } } } else { for (key in data) { if (data.hasOwnProperty(key)) { if (ar) { darr.push('<td role="gridcell" aria-describedby="' + key + '">' + data[key] + "</td>") } else { darr.push("<td>"); darr.push(data[key]); darr.push("</td>") } } } } } darr.push("</tr>"); if (appendBehavior) { tbody.append(darr.join("")) } }, _renderCell: function (val, col) { var type = col.dataType, format = col.format, auto = this.options.autoFormat; if (col.formatter) { return col.formatter(val) } type = (type === "date" || type === "number") ? type : ""; if (format || ((auto === true || auto === "dateandnumber") && type) || (auto && auto === type)) { return $.ig.formatter(val, type, format) } return (val || val === 0 || val === false) ? val : "&nbsp;" }, _scrollbarWidth: function () { if (!this._scrollbarWidthResolved) { var $div = $("<div />").css({ width: 50, height: 50, overflow: "auto", position: "absolute", top: -500, left: -500 }).prependTo("body").append("<div />").find("div").css({ width: "100%", height: 100 }); this._scrollbarWidthResolved = 50 - $div.width(); $div.parent().remove() } return this._scrollbarWidthResolved }, _fireInternalEvent: function (name, args) { var i, f, featureName; for (i = 0; i < this.options.features.length; i++) { f = this.options.features[i]; if (f !== undefined && f !== null && f.name !== undefined) { featureName = "igGrid" + f.name; if (this.element.data(featureName)[name]) { if (args) { this.element.data(featureName)[name](args) } else { this.element.data(featureName)[name]() } } } } }, _initFeature: function (featureObject, dataOptions, destroy) { if (!featureObject) { return } if (featureObject.name === undefined) { return } var widget = "igGrid" + featureObject.name; if ($.type($("#" + this.element[0].id)[widget]) !== "function") { throw new Error($.ig.Grid.locale.noSuchWidget + " " + widget) } $("#" + this.element[0].id)[widget]("destroy"); $("#" + this.element[0].id)[widget](featureObject); this.element.data(widget)._injectGrid(this) }, _initFeatureSettings: function (featureObject) { if (!featureObject) { return } if (featureObject.name === undefined) { return } var widget = "igGrid" + featureObject.name; if ($.type($("#" + this.element[0].id)[widget]) !== "function") { throw new Error($.ig.Grid.locale.noSuchWidget + " " + widget) } this.element.data(widget)._injectGrid(this, true) }, _onFeaturesSoftDirty: function (e, args) { var i, feature; if (args.owner.options.type !== "remote") { return } for (i = 0; i < this.options.features.length; i++) { feature = $("#" + this.element[0].id).data("igGrid" + this.options.features[i].name); if (feature && feature !== args.owner && feature.options && feature.options.type === "local") { if (feature._onUIDirty && $.type(feature._onUIDirty) === "function") { feature._onUIDirty(e, args) } } } }, destroy: function () { var prev = this.container().prev(); if (prev.length === 0) { prev = this.container().parent() } prev.append(this.element); this.element.find("thead").empty(); this.element.find("colgroup").empty(); $.Widget.prototype.destroy.call(this); this.container().remove(); this.element.find("tbody").empty().removeClass(this.css.gridTableBodyClass).removeClass(this.css.gridRecordClass); this.element.removeClass(this.css.gridTableClass); this.element.unbind("iggriduisoftdirty", this._uiSoftDirtyHandler); if (this._resId) { clearInterval(this._resId) } return this } }); $.extend($.ui.igGrid, { version: "11.1.20111.2010" }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics Grid requires jQuery to be loaded") } (function (a) { a.widget("ui.igGridSorting", { grid: null, css: { sortableColumnHeader: "ui-iggrid-sortableheader ui-state-default", sortableColumnHeaderActive: "ui-iggrid-sortableheaderactive ui-state-active", sortableColumnHeaderHover: "ui-iggrid-sortableheaderhover ui-state-hover", sortableColumnHeaderFocus: "ui-iggrid-sortableheaderfocus ui-state-focus", ascendingColumnHeader: "ui-iggrid-colheaderasc", descendingColumnHeader: "ui-iggrid-colheaderdesc", ascendingColumn: "ui-iggrid-colasc ui-state-highlight", descendingColumn: "ui-iggrid-coldesc ui-state-highlight", sortIndicator: "ui-iggrid-colindicator", sortIndicatorAscending: "ui-iggrid-colindicator-asc ui-icon ui-icon-arrowthick-1-n", sortIndicatorDescending: "ui-iggrid-colindicator-desc ui-icon ui-icon-arrowthick-1-s" }, options: { type: "remote", caseSensitive: false, applySortedColumnCss: true, sortUrlKey: null, sortUrlKeyAscValue: null, sortUrlKeyDescValue: null, mode: "single", customSortFunction: null, firstSortDirection: "ascending", sortedColumnTooltip: a.ig.GridSorting.locale.sortedColumnTooltipFormat, unsortedColumnTooltip: a.ig.GridSorting.locale.unsortedColumnTooltip, columnSettings: [{ columnKey: null, columnIndex: null, firstSortDirection: null, currentSortDirection: null, allowSorting: true}] }, events: { columnSorting: "columnSorting", columnSorted: "columnSorted" }, _createWidget: function (c, b) { this.options.columnSettings = []; a.Widget.prototype._createWidget.apply(this, arguments) }, _create: function () { var b = this; this._headers = []; this._clickHandler = function (c) { a(c.currentTarget).closest("th").find("a").focus(); b._handleSort(c) }; this._dragStartHandler = function (c) { c.stopPropagation(); c.preventDefault(); return false }; this._mouseOverHandler = function (c) { var d = a(c.currentTarget), e; e = b._getColSettingFromElement(c.currentTarget); if (e && e.allowSorting !== false) { d.addClass(b.css.sortableColumnHeaderHover) } }; this._mouseOutHandler = function (c) { a(c.currentTarget).removeClass(b.css.sortableColumnHeaderHover) }; a("#" + this.element[0].id + " th").live({ click: this._clickHandler, dragstart: this._dragStartHandler, mouseover: this._mouseOverHandler, mouseout: this._mouseOutHandler }); a("#" + this.element[0].id + "_headers th").live({ click: this._clickHandler, dragstart: this._dragStartHandler, mouseover: this._mouseOverHandler, mouseout: this._mouseOutHandler }); this._keyDownHandler = function (c) { b._handleSortKb(c) }; this._focusHandler = function (c) { b._handleFocusKb(c) }; this._blurHandler = function (c) { b._handleBlurKb(c) }; a("#" + this.element[0].id + " th a").live({ keydown: this._keyDownHandler, focus: this._focusHandler, blur: this._blurHandler }); a("#" + this.element[0].id + "_headers th a").live({ keydown: this._keyDownHandler, focus: this._focusHandler, blur: this._blurHandler }) }, _setOption: function (b, c) { a.Widget.prototype._setOption.apply(this, arguments); if (b === "type") { throw new Error(a.ig.Grid.locale.optionChangeNotSupported + " " + b) } else { if (b === "caseSensitive") { this.grid.dataSource.settings.sorting.caseSensitive = this.options.caseSensitive } } }, _getColSettingFromElement: function (f) { var c, d = this.options.columnSettings, b = a(f); c = parseInt(b.data("columnIndex"), 10); return d[c] }, _handleSortKb: function (c) { var b = a(c.currentTarget).closest("th").data("columnIndex"); if (c.keyCode === a.ui.keyCode.ENTER || c.keyCode === a.ui.keyCode.SPACE) { if (this._currentActiveHeader) { this._currentActiveHeader.removeClass(this.css.sortableColumnHeaderActive) } a(c.currentTarget).closest("th").addClass(this.css.sortableColumnHeaderActive); this._currentActiveHeader = a(c.currentTarget).closest("th"); this.sortColumn(b, null, a(c.currentTarget).closest("th")); c.stopPropagation(); c.preventDefault() } }, _handleFocusKb: function (b) { a(b.currentTarget).closest("th").addClass(this.css.sortableColumnHeaderFocus) }, _handleBlurKb: function (b) { a(b.currentTarget).closest("th").removeClass(this.css.sortableColumnHeaderFocus) }, _handleSort: function (c) { var b = a(c.currentTarget).closest("th").data("columnIndex"); if (this._currentActiveHeader) { this._currentActiveHeader.removeClass(this.css.sortableColumnHeaderActive) } a(c.currentTarget).addClass(this.css.sortableColumnHeaderActive); this._currentActiveHeader = a(c.currentTarget).closest("th"); this.sortColumn(b, null, a(c.currentTarget)); c.stopPropagation(); c.preventDefault() }, _initLoadingIndicator: function () { this._loadingIndicator = this.grid.container().length > 0 ? this.grid.container().igLoading().data("igLoading").indicator() : this.grid.element.igLoading().data("igLoading").indicator() }, sortColumn: function (h, f, c) { var d, e, j, g, b, k; if (a.type(h) === "number") { d = this.grid.options.columns[h].key } else { d = h; for (b = 0; b < this.grid.options.columns.length; b++) { if (this.grid.options.columns[b].key === d) { h = b; break } } } e = this.grid.dataSource.settings.sorting.expressions; g = this._findColumnSetting(d); if (this.grid.options.virtualization === true || this.grid.options.columnVirtualization === true) { k = h - this.grid._startColIndex } else { k = h } if (c === null || c === undefined) { if (this._currentActiveHeader) { this._currentActiveHeader.removeClass(this.css.sortableColumnHeaderActive) } if (this.grid.options.fixedHeaders) { c = this.grid.container().find("#" + this.grid.element[0].id + "_headers thead th:nth-child(" + (k + 1) + ")") } else { c = this.grid.element.find("thead th:nth-child(" + (k + 1) + ")") } } if (g && g.allowSorting === false) { return } if (f !== null && f !== undefined) { g.currentSortDirection = f } else { if ((g.currentSortDirection !== undefined && g.currentSortDirection !== null && !g.currentSortDirection.startsWith("asc") && !g.currentSortDirection.startsWith("desc")) || g.currentSortDirection === undefined || g.currentSortDirection === null) { g.currentSortDirection = g.firstSortDirection === undefined ? this.options.firstSortDirection : g.firstSortDirection } else { g.currentSortDirection = (g.currentSortDirection !== undefined && g.currentSortDirection !== null && g.currentSortDirection.indexOf("asc") !== -1) ? "descending" : "ascending" } } j = this._trigger(this.events.columnSorting, null, { columnKey: d, direction: g.currentSortDirection, owner: this }); if (j) { this._loadingIndicator.show(); c.attr("title", g.currentSortDirection.startsWith("asc") ? this.options.sortedColumnTooltip.replace("${direction}", a.ig.GridSorting.locale.ascending) : this.options.sortedColumnTooltip.replace("${direction}", a.ig.GridSorting.locale.descending)); if (this.options.mode === "single") { this._clearSortStates(c, h); this.grid.dataSource.settings.sorting.expressions = [{ fieldName: d, dir: g.currentSortDirection.startsWith("asc") ? "asc" : "desc"}] } else { for (b = 0; b < e.length; b++) { if (e[b].fieldName === d) { e.splice(b, 1) } } this.grid.dataSource.settings.sorting.expressions = e.concat([{ fieldName: d, dir: g.currentSortDirection}]) } j = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); if (j) { this.grid.element.trigger("iggriduisoftdirty", { owner: this }); this._currentHeader = c; this._currentIndex = h; if (this.options.type === "remote") { this.grid._fireDataBoundInternal = true; this._shouldFireColumnSorted = true; this.grid.dataSource.dataBind() } else { this.grid.dataSource.sort(this.grid.dataSource.settings.sorting.expressions, g.currentSortDirection); this.grid._trigger(this.grid.events.dataBound, null, { owner: this.grid }); this.grid._renderData(); this._trigger(this.events.columnSorted, null, { columnKey: d, direction: g.currentSortDirection, owner: this }) } this._curColKey = d; this._curSortDir = g.currentSortDirection } } }, _excludeExpr: function (d) { var b = this.grid.dataSource.settings.sorting.expressions, c; for (c = 0; c < b.length; c++) { if (b[c].fieldName === d) { b.remove(c) } } }, _applySortStyles: function (c, g) { var f, b, d, e; if (this.grid.options.virtualization === true || this.grid.options.columnVirtualization === true) { e = g - this.grid._startColIndex } else { e = g } f = c.find(".ui-iggrid-colindicator"); d = c.find(".ui-iggrid-indicatorcontainer"); if (d.length === 0) { d = a("<div></div>").appendTo(c).addClass("ui-iggrid-indicatorcontainer") } d.append(f); if (this.grid.options.fixedHeaders !== true) { b = c.closest("thead").parent().find("tbody tr td:nth-child(" + (e + 1) + ")") } else { if (this.options.applySortedColumnCss !== false) { b = this.grid.element.find("tr td:nth-child(" + (e + 1) + ")") } } if (this.options.columnSettings[g].currentSortDirection !== undefined && this.options.columnSettings[g].currentSortDirection.indexOf("asc") !== -1) { f.removeClass(this.css.sortIndicatorDescending).addClass(this.css.sortIndicatorAscending); c.removeClass(this.css.descendingColumnHeader).addClass(this.css.ascendingColumnHeader); if (this.options.applySortedColumnCss !== false) { b.removeClass(this.css.descendingColumn).addClass(this.css.ascendingColumn) } } else { f.removeClass(this.css.sortIndicatorAscending).addClass(this.css.sortIndicatorDescending); c.removeClass(this.css.ascendingColumnHeader).addClass(this.css.descendingColumnHeader); if (this.options.applySortedColumnCss !== false) { b.removeClass(this.css.ascendingColumn).addClass(this.css.descendingColumn) } } }, _clearSortStates: function (e, c) { var b, d = this.options.columnSettings; for (b = 0; b < this.options.columnSettings.length; b++) { if (d[b].allowSorting !== false) { if (c !== undefined && d[b].columnIndex !== c) { delete d[b].currentSortDirection; this._clearSortState(e, b) } } } }, _clearSortState: function (f, b) { var c = f.closest("thead").children().first().find("th:nth-child(" + (b + 1) + ")"), e = c.find(".ui-iggrid-colindicator"), d; if (e.hasClass("ui-iggrid-colindicator-desc") || e.hasClass("ui-iggrid-colindicator-asc")) { e.removeClass(this.css.sortIndicatorDescending).removeClass(this.css.sortIndicatorAscending); c.removeClass(this.css.ascendingColumnHeader).removeClass(this.css.descendingColumnHeader).removeClass(this.css.sortableColumnHeaderFocus) } this._headers[b].header.attr("title", this.options.unsortedColumnTooltip); if (this.options.applySortedColumnCss !== false) { if (this.grid.options.fixedHeaders !== true) { d = f.closest("thead").parent().find("tbody tr td:nth-child(" + (b + 1) + ")") } else { if (this.options.applySortedColumnCss !== false) { d = this.grid.element.find("tr td:nth-child(" + (b + 1) + ")") } } d.removeClass(this.css.descendingColumn).removeClass(this.css.ascendingColumn) } }, _initDefaultSettings: function () { var e = [], f, b = this.options.columnSettings, c, d, g = []; if (this.grid.options.columns && this.grid.options.columns.length > 0) { for (c = 0; c < this.grid.options.columns.length; c++) { e[c] = { columnIndex: c, columnKey: this.grid.options.columns[c].key, allowSorting: true} } } for (c = 0; c < b.length; c++) { for (f in b[c]) { if (b[c].hasOwnProperty(f) && f !== "columnKey" && f !== "columnIndex") { if (f === "userSet_currentSortDirection") { if (b[c].userSet_currentSortDirection === "undefined") { delete b[c].currentSortDirection } else { b[c].currentSortDirection = b[c].userSet_currentSortDirection } } else { if (f === "userSet_allowSorting") { b[c].allowSorting = b[c].key; delete b[c].key } } } } } for (c = 0; c < b.length; c++) { for (d = 0; d < e.length; d++) { if (e[d].columnKey === b[c].columnKey || e[d].columnIndex === b[c].columnIndex) { break } } if (d === e.length) { continue } for (f in b[c]) { if (b[c].hasOwnProperty(f) && f !== "columnKey" && f !== "columnIndex" && !f.startsWith("userSet")) { e[d][f] = b[c][f]; e[d]["userSet_" + f] = b[c][f]; if (f === "currentSortDirection" && b[c][f]) { if (a.type(e[d].columnKey) !== "number") { g.push({ fieldName: e[d].columnKey, dir: b[c][f].startsWith("asc") ? "asc" : "desc" }) } else { g.push({ fieldIndex: e[d].columnKey, dir: b[c][f].startsWith("asc") ? "asc" : "desc" }) } } } } } for (c = 0; c < e.length; c++) { if (!e[c].hasOwnProperty("currentSortDirection")) { e[c].userSet_currentSortDirection = "undefined" } } this.options.columnSettings = e; this.grid.dataSource.settings.sorting.expressions = g; this.grid.dataSource.settings.sorting.defaultFields = g }, _headerCellRendered: function (c, b) { var d = this._findColumnSetting(b.columnKey); if (b.columnKey && d) { this._headers.push({ header: b.th, index: d.columnIndex }); if (d.allowSorting !== false) { b.th.addClass(this.css.sortableColumnHeader); if (d.currentSortDirection === undefined || d.currentSortDirection === null) { b.th.attr("title", this.options.unsortedColumnTooltip) } else { b.th.attr("title", d.currentSortDirection.startsWith("asc") ? this.options.sortedColumnTooltip.replace("${direction}", a.ig.GridSorting.locale.ascending) : this.options.sortedColumnTooltip.replace("${direction}", a.ig.GridSorting.locale.descending)) } a("<span></span>").appendTo(b.th).addClass(this.css.sortIndicator); a(b.th).wrapInner('<a href="#"></a>'); if (d.currentSortDirection !== undefined) { this._applySortStyles(b.th, d.columnIndex) } } else { a(b.th).wrapInner('<a href="#"></a>') } } }, _findColumnSetting: function (b) { var c; for (c = 0; c < this.options.columnSettings.length; c++) { if (this.options.columnSettings[c].columnKey === b) { return this.options.columnSettings[c] } } }, _dataRendered: function () { if (!this._loadingIndicator) { this._initLoadingIndicator() } if (this._shouldFireColumnSorted) { this._trigger(this.events.columnSorted, null, { columnKey: this._curColKey, direction: this._curSortDir, owner: this }); this._shouldFireColumnSorted = false } this._loadingIndicator.hide(); if (this._currentIndex !== undefined && this._currentIndex !== null && this._currentHeader !== undefined && this._currentHeader !== null) { this._applySortStyles(this._currentHeader, this._currentIndex) } }, _onUIDirty: function (b, c) { if (c.owner === this) { return } this._currentIndex = null; this._currentHeader = null; this._clearUi(true) }, _clearUi: function (c) { var b, e, d; for (b = 0; b < this._headers.length; b++) { d = this.options.columnSettings[b].userSet_currentSortDirection; if (d === undefined || d === null || d === "undefined") { this._clearSortState(this._headers[b].header, b); if (this.options.mode === "multi") { delete this.options.columnSettings[b].currentSortDirection; this._excludeExpr(this.options.columnSettings[b].columnKey) } } else { this._applySortStyles(this._headers[b].header, b) } e = this._headers[b].header; e.removeClass(this.css.sortableColumnHeaderActive).removeClass(this.css.sortableColumnHeaderHover).removeClass(this.css.sortableColumnAscending).removeClass(this.css.sortableColumnDescending).addClass(this.grid.css.headerClass).addClass(this.css.sortableColumnHeader) } }, _virtualHorizontalScroll: function (h, k) { var e = k.startColIndex, b = k.endColIndex, c, d, f = this.options.columnSettings, g; for (c = 0; c < this._headers.length; c++) { this._clearSortState(this._headers[c].header, c); g = this._headers[c].header; g.removeClass(this.css.sortableColumnHeaderActive).removeClass(this.css.sortableColumnHeaderHover).removeClass(this.css.sortableColumnAscending).removeClass(this.css.sortableColumnDescending).addClass(this.grid.css.headerClass).addClass(this.css.sortableColumnHeader) } for (c = e; c <= b; c++) { this._headers[c - e].header.data("columnIndex", c); for (d = 0; d < f.length; d++) { if (f[d].currentSortDirection && f[d].columnIndex === c) { this._applySortStyles(this._headers[c - e].header, c) } } } }, destroy: function () { var c, d, f, e, b; a("#" + this.element[0].id + " th").die("dragstart", this._dragStartHandler); a("#" + this.element[0].id + " th").die("mouseover", this._mouseOverHandler); a("#" + this.element[0].id + " th").die("mouseout", this._mouseOutHandler); a("#" + this.element[0].id + " th").die("click", this._clickHandler); a("#" + this.element[0].id + "_headers th").die("dragstart", this._dragStartHandler); a("#" + this.element[0].id + "_headers th").die("mouseover", this._mouseOverHandler); a("#" + this.element[0].id + "_headers th").die("mouseout", this._mouseOutHandler); a("#" + this.element[0].id + "_headers th").die("click", this._clickHandler); a("#" + this.element[0].id + " th a").die("keydown", this._keyDownHandler); a("#" + this.element[0].id + " th a").die("focus", this._focusHandler); a("#" + this.element[0].id + " th a").die("blur", this._blurHandler); a("#" + this.element[0].id + "_headers th a").die("keydown", this._keyDownHandler); a("#" + this.element[0].id + "_headers th a").die("focus", this._focusHandler); a("#" + this.element[0].id + "_headers th a").die("blur", this._blurHandler); this.grid.element.unbind("iggridheadercellrendered", this._headerCellRenderedHandler); this.grid.element.unbind("iggridvirtualhorizontalscroll", this._virtualHorizontalScrollHandler); this.grid.element.unbind("iggriduidirty", this._uiDirtyHandler); delete this._blurHandler; delete this._clickHandler; delete this._headerCellRenderedHandler; delete this._focusHandler; delete this._keyDownHandler; delete this._mouseOutHandler; delete this._mouseOverHandler; delete this._dragStartHandler; delete this._uiDirtyHandler; delete this._virtualHorizontalScrollHandler; this.grid.element.find(".ui-iggrid-colasc").removeClass("ui-iggrid-colasc ui-state-highlight"); this.grid.element.find(".ui-iggrid-coldesc").removeClass("ui-iggrid-coldesc ui-state-highlight"); this._clearUi(true); for (c = 0; c < this._headers.length; c++) { f = this._headers[c].header; f.removeClass("ui-iggrid-sortableheader ui-state-default ui-state-active ui-state-hover ui-state-focus"); f.attr("title", ""); e = f.find("a span"); b = e.text(); d = f.find("a"); a("<span>" + b + "</span>").appendTo(f).addClass("ui-iggrid-headertext"); d.remove() } this._headers = null; a.Widget.prototype.destroy.apply(this, arguments); return this }, _injectGrid: function (c, b) { this.grid = c; this.grid.dataSource.settings.sorting.type = this.options.type ? this.options.type : "remote"; this.grid.dataSource.settings.sorting.caseSensitive = this.options.caseSensitive; this.grid.dataSource.settings.sorting.defaultFields = this.grid.dataSource.settings.sorting.expressions; this.grid.dataSource.settings.sorting.enabled = true; this.grid.dataSource.settings.sorting.sortUrlKey = this.options.sortUrlKey; this.grid.dataSource.settings.sorting.sortUrlAscValueKey = this.options.sortUrlKeyAscValue; this.grid.dataSource.settings.sorting.sortUrlDescValueKey = this.options.sortUrlKeyDescValue; if (a.type(this.options.customSortFunction) === "function") { this.grid.dataSource.settings.sorting.customFunc = this.options.customSortFunction } if (this._headerCellRenderedHandler !== null) { this.grid.element.unbind("iggridheadercellrendered", this._headerCellRenderedHandler) } if (this._uiDirtyHandler !== null) { this.grid.element.unbind("iggriduidirty", this._uiDirtyHandler) } this._headerCellRenderedHandler = a.proxy(this._headerCellRendered, this); this._uiDirtyHandler = a.proxy(this._onUIDirty, this); this.grid.element.bind("iggridheadercellrendered", this._headerCellRenderedHandler); this._virtualHorizontalScrollHandler = a.proxy(this._virtualHorizontalScroll, this); this.grid.element.bind("iggridvirtualhorizontalscroll", this._virtualHorizontalScrollHandler); this.grid.element.bind("iggriduidirty", this._uiDirtyHandler); this._initDefaultSettings(); this._clearUi(); this._currentActiveHeader = null; this._currentHeader = null; this._currentIndex = null } }); a.extend(a.ui.igGridSorting, { version: "11.1.20111.2010" }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics Grid requires jQuery to be loaded") } (function (a) { a.widget("ui.igGridPaging", { grid: null, css: { pagerClass: "ui-widget ui-iggrid-pager ui-helper-clearfix ui-corner-bottom ui-widget-header ui-iggrid-footer", pageLink: "ui-iggrid-pagelink ui-helper-reset", page: "ui-iggrid-page ui-state-default ui-corner-all", pageHover: "ui-iggrid-page-hover ui-state-hover", pageList: "ui-helper-reset ui-iggrid-pagelist ui-iggrid-paging-item", pageLinkCurrent: "ui-iggrid-pagelinkcurrent", pageCurrent: "ui-iggrid-pagecurrent ui-state-active ui-corner-all", pageFocused: "ui-iggrid-pagefocused ui-state-focus", nextPage: "ui-iggrid-nextpage ui-iggrid-paging-item ui-state-default", prevPage: "ui-iggrid-prevpage ui-iggrid-paging-item ui-state-default", firstPage: "ui-iggrid-firstpage ui-iggrid-paging-item ui-state-default ui-corner-left", lastPage: "ui-iggrid-lastpage ui-iggrid-paging-item ui-state-default ui-corner-right", nextPageLabel: "ui-iggrid-nextpagelabel", prevPageLabel: "ui-iggrid-prevpagelabel", firstPageLabel: "ui-iggrid-firstpagelabel", lastPageLabel: "ui-iggrid-lastpagelabel", nextPageLabelDisabled: "ui-iggrid-nextpagelabeldisabled ui-state-disabled", prevPageLabelDisabled: "ui-iggrid-prevpagelabeldisabled ui-state-disabled", firstPageLabelDisabled: "ui-iggrid-firstpagelabeldisabled ui-state-disabled", lastPageLabelDisabled: "ui-iggrid-lastpagelabeldisabled ui-state-disabled", nextPageImage: "ui-iggrid-pageimg ui-iggrid-nextpageimg ui-icon ui-icon-triangle-1-e", prevPageImage: "ui-iggrid-pageimg ui-iggrid-prevpageimg ui-icon ui-icon-triangle-1-w", firstPageImage: "ui-iggrid-pageimg ui-iggrid-firstpageimg ui-icon ui-icon-arrowstop-1-w", lastPageImage: "ui-iggrid-pageimg ui-iggrid-lastpageimg ui-icon ui-icon-arrowstop-1-e", nextPageImageDisabled: "ui-iggrid-pageimg ui-iggrid-nextpageimgdisabled ui-icon ui-state-disabled ui-icon-triangle-1-e", prevPageImageDisabled: "ui-iggrid-pageimg ui-iggrid-prevpageimgdisabled ui-icon ui-state-disabled ui-icon-triangle-1-w", firstPageImageDisabled: "ui-iggrid-pageimg ui-iggrid-firstpageimgdisabled ui-icon ui-state-disabled ui-icon-arrowstop-1-w", lastPageImageDisabled: "ui-iggrid-pageimg ui-iggrid-lastpageimgdisabled ui-icon ui-state-disabled ui-icon-arrowstop-1-e", pagerRecordsLabel: "ui-iggrid-pagerrecordslabel ui-iggrid-results", pageSizeLabel: "ui-iggrid-pagesizelabel", pageSizeDropDown: "ui-iggrid-pagesizedropdown", pageSizeDropDownContainer: "ui-helper-clearfix ui-iggrid-pagesizedropdowncontainer", pageSizeDropDownContainerAbove: "ui-widget ui-helper-clearfix ui-iggrid-pagesizedropdowncontainerabove ui-iggrid-toolbar ui-widget-header and ui-corner-top", pageDropDownContainer: "ui-iggrid-pagedropdowncontainer", pageDropDownLabels: "ui-iggrid-pagedropdownlabels", pageDropDown: "ui-iggrid-pagedropdown", pagerRightAreaContainer: "ui-iggrid-paging", pagingResults: "ui-iggrid-results" }, options: { pageSize: 25, recordCountKey: null, pageSizeUrlKey: null, pageIndexUrlKey: null, currentPageIndex: 0, type: "remote", showPageSizeDropDown: true, pageSizeDropDownLabel: a.ig.GridPaging.locale.pageSizeDropDownLabel, pageSizeDropDownTrailingLabel: a.ig.GridPaging.locale.pageSizeDropDownTrailingLabel, pageSizeDropDownLocation: "above", showPagerRecordsLabel: true, pagerRecordsLabelTemplate: a.ig.GridPaging.locale.pagerRecordsLabelTemplate, nextPageLabelText: a.ig.GridPaging.locale.nextPageLabelText, prevPageLabelText: a.ig.GridPaging.locale.prevPageLabelText, firstPageLabelText: a.ig.GridPaging.locale.firstPageLabelText, lastPageLabelText: a.ig.GridPaging.locale.lastPageLabelText, showFirstLastPages: true, showPrevNextPages: true, currentPageDropDownLeadingLabel: a.ig.GridPaging.locale.currentPageDropDownLeadingLabel, currentPageDropDownTrailingLabel: a.ig.GridPaging.locale.currentPageDropDownTrailingLabel, currentPageDropDownTooltip: a.ig.GridPaging.locale.currentPageDropDownTooltip, pageSizeDropDownTooltip: a.ig.GridPaging.locale.pageSizeDropDownTooltip, pagerRecordsLabelTooltip: a.ig.GridPaging.locale.pagerRecordsLabelTooltip, prevPageTooltip: a.ig.GridPaging.locale.prevPageTooltip, nextPageTooltip: a.ig.GridPaging.locale.nextPageTooltip, firstPageTooltip: a.ig.GridPaging.locale.firstPageTooltip, lastPageTooltip: a.ig.GridPaging.locale.lastPageTooltip, pageTooltipFormat: a.ig.GridPaging.locale.pageTooltipFormat, pageSizeList: [5, 10, 20, 25, 50, 75, 100], pageCountLimit: 10, visiblePageCount: 5, defaultDropDownWidth: 70 }, events: { pageIndexChanging: "pageIndexChanging", pageIndexChanged: "pageIndexChanged", pageSizeChanging: "pageSizeChanging", pageSizeChanged: "pageSizeChanged", pagerRendering: "pagerRendering", pagerRendered: "pagerRendered" }, _loadingIndicator: null, _isPaging: false, _create: function () { }, _setOption: function (f, b) { var g, c, d, e; d = this.grid.element[0].id; e = a("#" + d + "_pager"); a.Widget.prototype._setOption.apply(this, arguments); if (f === "type" || f === "showPageSizeDropDown" || f === "pageSizeDropDownLocation" || f === "showPagerRecordsLabel" || f === "visiblePageCount") { throw new Error(a.ig.Grid.locale.optionChangeNotSupported + " " + f) } if (f === "pageSize") { this.pageSize(b) } else { if (f === "currentPageIndex") { this.pageIndex(b) } else { if (f === "showFirstLastPages") { if (b === true) { e.find(".ui-iggrid-firstpage").show(); e.find(".ui-iggrid-lastpage").show() } else { e.find(".ui-iggrid-firstpage").hide(); e.find(".ui-iggrid-lastpage").hide() } } else { if (f === "showPrevNextPages") { if (b === true) { e.find(".ui-iggrid-prevpage").show(); e.find(".ui-iggrid-nextpage").show() } else { e.find(".ui-iggrid-prevpage").hide(); e.find(".ui-iggrid-nextpage").hide() } } else { if (f === "pageSizeList") { if (a.type(b) === "string") { g = b.split(",") } else { g = b } if (this._pageSizeDD) { this._pageSizeDD.igEditor("option", "listItems", g) } } else { if (f === "nextPageLabelText") { c = e.find(".ui-iggrid-nextpagelabel"); c = c.length === 0 ? e.find(".ui-iggrid-nextpagelabeldisabled") : c; c.text(b) } else { if (f === "prevPageLabelText") { c = e.find(".ui-iggrid-prevpagelabel"); c = c.length === 0 ? e.find(".ui-iggrid-prevpagelabeldisabled") : c; c.text(b) } else { if (f === "firstPageLabelText") { c = e.find(".ui-iggrid-firstpagelabel"); c = c.length === 0 ? e.find(".ui-iggrid-firstpagelabeldisabled") : c; c.text(b) } else { if (f === "lastPageLabelText") { c = e.find(".ui-iggrid-lastpagelabel"); c = c.length === 0 ? e.find(".ui-iggrid-nextpagelabeldisabled") : c; c.text(b) } } } } } } } } } }, pageIndex: function (b) { if (b !== null && b !== undefined) { this._overrideLabel = true; this.options.currentPageIndex = b } this.grid.element.trigger("iggriduisoftdirty", { owner: this }); return this.grid.dataSource.pageIndex(b) }, pageSize: function (b) { var c = true; if (b) { this.grid.dataSource.settings.paging.pageIndex = 0; this.options.currentPageIndex = 0; c = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); if (c) { this._showLoading(); this.grid._fireDataBoundInternal = true; this.grid.dataSource.pageSize(b) } if (this._pageSizeDD) { this._pageSizeDD.igEditor("value", b) } } else { return this.grid.dataSource.pageSize() } }, _initLoadingIndicator: function () { this._loadingIndicator = this.grid.container().igLoading().data("igLoading").indicator() }, _nextPage: function () { var b = true, c = true; b = this._trigger(this.events.pageIndexChanging, null, { newPageIndex: this.options.currentPageIndex + 1, currentPageIndex: this.options.currentPageIndex, owner: this }); if (b) { if (this.options.currentPageIndex >= this.grid.dataSource.pageCount() - 1) { return } else { this.options.currentPageIndex = this.options.currentPageIndex + 1 } c = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); this._shouldFirePageIndexChanged = true; if (c) { this.grid._fireDataBoundInternal = true; this._showLoading(); this._overrideLabel = true; this.grid.dataSource.nextPage() } this.grid.element.trigger("iggriduisoftdirty", { owner: this }) } }, _prevPage: function () { var b = true, c = true; b = this._trigger(this.events.pageIndexChanging, null, { newPageIndex: this.options.currentPageIndex - 1, currentPageIndex: this.options.currentPageIndex, owner: this }); if (b) { if (this.options.currentPageIndex === 0) { return } else { this.options.currentPageIndex = this.options.currentPageIndex - 1 } c = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); this._shouldFirePageIndexChanged = true; if (c) { this._showLoading(); this._overrideLabel = true; this.grid._fireDataBoundInternal = true; this.grid.dataSource.prevPage() } this.grid.element.trigger("iggriduisoftdirty", { owner: this }) } }, _firstPage: function () { var b = true, c = true; b = this._trigger(this.events.pageIndexChanging, null, { newPageIndex: 0, currentPageIndex: this.options.currentPageIndex, owner: this }); if (b) { c = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); this._shouldFirePageIndexChanged = true; if (c) { this._showLoading(); this.grid._fireDataBoundInternal = true; this.pageIndex(0) } } }, _lastPage: function () { var b = true, c = true; b = this._trigger(this.events.pageIndexChanging, null, { newPageIndex: this.grid.dataSource.pageCount() - 1, currentPageIndex: this.options.currentPageIndex, owner: this }); if (b) { c = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); this._shouldFirePageIndexChanged = true; if (c) { this._showLoading(); this.grid._fireDataBoundInternal = true; this.pageIndex(this.grid.dataSource.pageCount() - 1) } } }, _showLoading: function () { this._loadingIndicator.show() }, _hideLoading: function () { this._loadingIndicator.hide() }, _bindEvents: function (b) { var c = this, e = this.grid, g = true, f, d = true; f = "#" + e.element[0].id + "_pager"; a(f + " li a").bind({ mousedown: function (h) { var i = a(h.target).parent().data("pageIndex"); if (a.type(i) === "number" && i !== c.options.currentPageIndex) { g = c._trigger(c.events.pageIndexChanging, h, { newPageIndex: i, currentPageIndex: c.options.currentPageIndex, owner: c }); c._shouldFirePageIndexChanged = true; if (g) { d = c.grid._trigger(c.grid.events.dataBinding, null, { owner: c.grid }); if (d) { c._showLoading(e.element.children("tbody")); c.grid._fireDataBoundInternal = true; c.pageIndex(i) } } } } }); a(f + " li").bind({ mouseover: function (h) { a(h.currentTarget).addClass(c.css.pageHover) }, mouseout: function (h) { a(h.currentTarget).removeClass(c.css.pageHover) } }) }, _gridRendered: function (b) { if (this.options.showPageSizeDropDown === true && this.options.pageSizeDropDownLocation === "above" && !this._pageSizeDropDownRendered) { this._renderPageSizeDropDown(b, true); if (this.grid.options.autoAdjustHeight) { this.grid._initializeHeights() } if (this.grid.options.caption !== null) { a("#" + this.grid.element[0].id + "_caption").removeClass("ui-corner-top") } } }, _dataRendered: function () { var q = this.grid.element[0].id, o, m, x, n = '<div id="' + q + '_pager"></div>', u = '<li class="${pageClass}"><a class="${pageLinkClass}" href="javascript:void(0);">${page}</a></li>', h = null, d = 0, k = 0, f = 0, t = 0, b = true, y, p, l, v = 0, r = 0, c = this.options.pagerRecordsLabelTemplate, w = this, g = null, s = this.options.visiblePageCount, e = 0, j = null; this._deleteOld(); b = this._trigger(this.events.pagerRendering, null, { dataSource: this.grid.dataSource, owner: this }); if (b) { if (this.grid._shouldResetPaging) { this.options.currentPageIndex = 0; this.grid._shouldResetPaging = false } if (a("#" + q + "_pager_label").length > 0) { a("#" + q + "_pager .ui-iggrid-paging").remove() } else { a("#" + q + "_pager").empty() } this._initLoadingIndicator(); if (this.grid.dataSource.pageSizeDirty()) { this.options.currentPageIndex = this.grid.dataSource.pageIndex(); this.grid.dataSource.pageSizeDirty(false) } if (a("#" + q + "_pager").length === 0) { q = this.grid.element[0].id; h = a(n).appendTo("#" + q + "_container") } else { h = a("#" + q + "_pager") } h.addClass(this.css.pagerClass); if (this.options.showPagerRecordsLabel) { f = this.grid.dataSource.totalRecordsCount() > 0 ? this.grid.dataSource.totalRecordsCount() : this.grid.dataSource.totalLocalRecordsCount(); d = this.options.currentPageIndex === 0 ? 1 : this.options.currentPageIndex * this.pageSize() + 1; if (this.grid.dataSource._filter) { f = this.grid.dataSource._filteredData.length; t = this.grid.dataSource._filteredData.length } else { t = this.grid.dataSource.totalLocalRecordsCount() } k = this.options.currentPageIndex === 0 ? this.pageSize() : d + this.pageSize() > f ? f : (d - 1) + this.pageSize(); if (this.grid.dataSource.totalLocalRecordsCount() === 0) { d = 0 } if (k > t && this.options.type === "local") { k = t } if (this._overrideLabel || !this.grid.dataSource._filter) { a("#" + h[0].id + "_label").remove(); c = c.replace("${startRecord}", d).replace("${endRecord}", k).replace("${recordCount}", f); j = a("<span>" + c + "</span>").appendTo(h).attr("id", h[0].id + "_label").addClass(this.css.pagerRecordsLabel).attr("title", this.options.pagerRecordsLabelTooltip).show() } else { if (a("#" + h[0].id + "_label").length === 0) { j = a("<span></span>").appendTo(h).attr("id", h[0].id + "_label").addClass(this.css.pagerRecordsLabel).attr("title", this.options.pagerRecordsLabelTooltip).show() } } if (j) { j.data("hideflag", false) } a(h[0].id + "_label").show(); this._overrideLabel = false } o = this.grid.dataSource.pageCount(); g = a("<div></div>").appendTo(h).addClass(this.css.pagerRightAreaContainer); if (this.options.showFirstLastPages === true) { this._renderFirstPage(g) } if (this.options.showPrevNextPages === true) { this._renderPrevPage(g) } if (this.grid.dataSource.pageCount() <= this.options.pageCountLimit) { y = a("<ul></ul>").appendTo(g).addClass(this.css.pageList); a("#" + q + "_pager li a").live({ keydown: function (i) { if (i.keyCode === a.ui.keyCode.ENTER || i.keyCode === a.ui.keyCode.SPACE) { w.pageIndex(a(i.currentTarget).closest("li").data("pageIndex")); i.stopPropagation(); i.preventDefault() } }, focus: function (i) { a(i.currentTarget).closest("li").addClass(w.css.pageFocused) }, blur: function (i) { a(i.currentTarget).closest("li").removeClass(w.css.pageFocused) } }); e = Math.floor(parseInt(s, 10) / 2); v = this.options.currentPageIndex - e; if (v < 0) { v = 0 } r = this.options.currentPageIndex + e; if (this.options.currentPageIndex - v < e) { r += e - (this.options.currentPageIndex - v) } if (this.grid.dataSource.pageCount() - (this.options.currentPageIndex + 1) < e && s % 2 !== 0) { v = v - (e - (this.grid.dataSource.pageCount() - (this.options.currentPageIndex + 1))) } if (r >= this.grid.dataSource.pageCount()) { r = this.grid.dataSource.pageCount() - 1 } if (v < 0) { v = 0 } if (s % 2 === 0 && r - v < s - 1) { v -= (s - 1) - (r - v) } if (v < 0) { v = 0 } for (m = v; m <= r && m - v < s; m++) { x = u.replace("${page}", (m + 1)).replace("${pageLinkClass}", m === this.options.currentPageIndex ? this.css.pageLinkCurrent : this.css.pageLink); x = x.replace("${pageClass}", m === this.options.currentPageIndex ? this.css.pageCurrent : this.css.page); a(x).appendTo(y).attr("title", this.options.pageTooltipFormat.replace("${index}", m + 1)).data("pageIndex", m) } } else { p = []; for (m = 1; m <= o; m++) { p.push(m + this._empty()) } l = a("<div></div>").appendTo(g).addClass(this.css.pageDropDownContainer).attr("title", this.options.currentPageDropDownTooltip); a("<span></span>").appendTo(l).text(this.options.currentPageDropDownLeadingLabel).addClass(this.css.pageDropDownLabels); this._curPageDD = a("<span />").css("display", "none").appendTo(l).addClass(this.css.pageDropDownContainer).igEditor({ listItems: p, readOnly: false, listMatchOnly: true, width: this.options.defaultDropDownWidth, nullable: false, listAutoComplete: true, button: "dropdown", type: "text", value: this.options.currentPageIndex + 1, dropDownTriggers: "button,focus", textChanged: a.proxy(this._dropDownPageIndex, this) }).css("display", ""); a("<span></span>").appendTo(l).text(this.options.currentPageDropDownTrailingLabel.replace("${count}", this.grid.dataSource.pageCount())).addClass(this.css.pageDropDownLabels) } if (this.options.showPrevNextPages === true) { this._renderNextPage(g) } if (this.options.showFirstLastPages === true) { this._renderLastPage(g) } if (this.options.showPageSizeDropDown && this.options.pageSizeDropDownLocation === "inpager") { this._renderPageSizeDropDown(g) } this._bindEvents(h); this._hideLoading(this.grid.element.children("tbody")); h.show(); this._trigger(this.events.pagerRendered, null, { dataSource: this.grid.dataSource, owner: this }); if (this._shouldFirePageIndexChanged) { this._shouldFirePageIndexChanged = false; this._trigger(this.events.pageIndexChanged, null, { pageIndex: this.options.currentPageIndex, owner: this }) } } }, _dropDownPageIndex: function (b, c) { var e = true, d = true; e = this._trigger(this.events.pageIndexChanging, null, { newPageIndex: parseInt(c.text, 10) - 1, currentPageIndex: this.options.currentPageIndex, owner: this }); if (e) { d = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); if (d) { this.grid._fireDataBoundInternal = true; this._shouldFirePageIndexChanged = true; if (c.text) { this.pageIndex(parseInt(c.text, 10) - 1) } } this.grid.element.trigger("iggriduisoftdirty", { owner: this }) } }, _renderPrevPage: function (d) { var b, e = this, c; b = a("<div></div>").appendTo(d).addClass(this.css.prevPage).attr("title", this.options.prevPageTooltip); if (this.options.currentPageIndex === 0) { a("<span></span>").appendTo(b).addClass(this.css.prevPageImageDisabled); a("<span></span>").appendTo(b).addClass(this.css.prevPageLabelDisabled).append(this.options.prevPageLabelText) } else { b.bind("mousedown", a.proxy(this._prevPage, this)); c = a("<span></span>").appendTo(b).addClass(this.css.prevPageImage); a("<span></span>").appendTo(b).addClass(this.css.prevPageLabel).append(this.options.prevPageLabelText); c.wrap('<a href="javascript:void(0);"></a>'); c.parent().bind({ keydown: function (f) { if (f.keyCode === a.ui.keyCode.ENTER || f.keyCode === a.ui.keyCode.SPACE) { e._prevPage(); f.stopPropagation(); f.preventDefault() } }, focus: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-default").addClass("ui-state-focus") }, blur: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-focus").addClass("ui-state-default") } }) } }, _renderNextPage: function (e) { var c, f, b = this, d; c = a("<div></div>").appendTo(e).addClass(this.css.nextPage).attr("title", this.options.nextPageTooltip); f = this.grid.dataSource.totalRecordsCount() > 0 ? this.grid.dataSource.totalRecordsCount() : this.grid.dataSource.data().length; if (this.options.currentPageIndex === this.grid.dataSource.pageCount() - 1) { a("<span></span>").appendTo(c).addClass(this.css.nextPageLabelDisabled).append(this.options.nextPageLabelText); a("<span></span>").appendTo(c).addClass(this.css.nextPageImageDisabled) } else { c.bind("mousedown", a.proxy(this._nextPage, this)); a("<span></span>").appendTo(c).addClass(this.css.nextPageLabel).append(this.options.nextPageLabelText); d = a("<span></span>").appendTo(c).addClass(this.css.nextPageImage); d.wrap('<a href="javascript:void(0);"></a>'); d.parent().bind({ keydown: function (g) { if (g.keyCode === a.ui.keyCode.ENTER || g.keyCode === a.ui.keyCode.SPACE) { b._nextPage(); g.stopPropagation(); g.preventDefault() } }, focus: function (g) { a(g.currentTarget).closest("div").removeClass("ui-state-default").addClass("ui-state-focus") }, blur: function (g) { a(g.currentTarget).closest("div").removeClass("ui-state-focus").addClass("ui-state-default") } }) } }, _renderFirstPage: function (b) { var d, e = this, c; d = a("<div></div>").appendTo(b).addClass(this.css.firstPage).attr("title", this.options.firstPageTooltip); if (this.options.currentPageIndex === 0) { a("<span></span>").appendTo(d).addClass(this.css.firstPageImageDisabled); a("<span></span>").appendTo(d).addClass(this.css.firstPageLabelDisabled).append(this.options.firstPageLabelText) } else { d.bind("mousedown", a.proxy(this._firstPage, this)); c = a("<span></span>").appendTo(d).addClass(this.css.firstPageImage); a("<span></span>").appendTo(d).addClass(this.css.firstPageLabel).append(this.options.firstPageLabelText); c.wrap('<a href="javascript:void(0);"></a>'); c.parent().bind({ keydown: function (f) { if (f.keyCode === a.ui.keyCode.ENTER || f.keyCode === a.ui.keyCode.SPACE) { e._firstPage(); f.stopPropagation(); f.preventDefault() } }, focus: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-default").addClass("ui-state-focus") }, blur: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-focus").addClass("ui-state-default") } }) } }, _renderLastPage: function (c) { var d, e = this, b; d = a("<div></div>").appendTo(c).addClass(this.css.lastPage).attr("title", this.options.lastPageTooltip); if (this.options.currentPageIndex === this.grid.dataSource.pageCount() - 1) { a("<span></span>").appendTo(d).addClass(this.css.lastPageLabelDisabled).append(this.options.lastPageLabelText); a("<span></span>").appendTo(d).addClass(this.css.lastPageImageDisabled) } else { d.bind("mousedown", a.proxy(this._lastPage, this)); a("<span></span>").appendTo(d).addClass(this.css.lastPageLabel).append(this.options.lastPageLabelText); b = a("<span></span>").appendTo(d).addClass(this.css.lastPageImage); b.wrap('<a href="javascript:void(0);"></a>'); b.parent().bind({ keydown: function (f) { if (f.keyCode === a.ui.keyCode.ENTER || f.keyCode === a.ui.keyCode.SPACE) { e._lastPage(); f.stopPropagation(); f.preventDefault() } }, focus: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-default").addClass("ui-state-focus") }, blur: function (f) { a(f.currentTarget).closest("div").removeClass("ui-state-focus").addClass("ui-state-default") } }) } }, _renderPageSizeDropDown: function (b, c) { var d = this.grid.id() + "_editor", f, e; f = this.options.pageSizeDropDownLocation === "above" ? this.css.pageSizeDropDownContainerAbove : this.css.pageSizeDropDownContainer; if (c) { b = a("<div></div>").prependTo(b).addClass(f) } else { b = a("<div></div>").appendTo(b).addClass(f) } b.attr("title", this.options.pageSizeDropDownTooltip); b = a("<div></div>").appendTo(b).addClass(this.css.pagingResults); if (c) { a("<span>" + this.options.pageSizeDropDownTrailingLabel + "</span>").prependTo(b).addClass(this.css.pageSizeLabel); a("<span></span>").prependTo(b).attr("id", d).addClass(this.css.pageSizeDropDown); a("<span>" + this.options.pageSizeDropDownLabel + "</span>").prependTo(b).addClass(this.css.pageSizeLabel) } else { a("<span>" + this.options.pageSizeDropDownLabel + "</span>").appendTo(b).addClass(this.css.pageSizeLabel); a("<span></span>").appendTo(b).attr("id", d).addClass(this.css.pageSizeDropDown); a("<span>" + this.options.pageSizeDropDownTrailingLabel + "</span>").appendTo(b).addClass(this.css.pageSizeLabel) } e = (this.options.pageSizeList === null || this.options.pageSizeList.length === 0) ? [5, 10, 20, 25, 50, 75, 100] : this.options.pageSizeList; if (a.type(e) === "string") { e = e.split(",") } this._pageSizeDD = a("#" + d).css("display", "none").igEditor({ width: this.options.defaultDropDownWidth, button: "dropdown", dropDownOnReadOnly: true, listItems: e, listMatchOnly: true, readOnly: true, textAlign: "left", type: "numeric", value: this.pageSize(), textChanged: a.proxy(this._changePageSize, this) }).css("display", ""); this._pageSizeDropDownRendered = true }, _changePageSize: function (b, d) { var e = true, c = parseInt(d.text, 10); e = this._trigger(this.events.pageSizeChanging, null, { currentPageSize: this.pageSize(), newPageSize: c, owner: this }); if (e) { this.pageSize(c); this._trigger(this.events.pageSizeChanged, null, { pageSize: c, owner: this }); this.grid.element.trigger("iggriduidirty", { owner: this }) } }, _deleteOld: function (b) { if (this._curPageDD) { this._curPageDD.igEditor("destroy"); delete this._curPageDD } if (this._pageSizeDD && (b || this.options.pageSizeDropDownLocation === "inpager")) { this._pageSizeDD.igEditor("destroy"); delete this._pageSizeDD } }, destroy: function () { var b = a("#" + this.grid.element[0].id + "_pager"); this.pageSize(0); this._deleteOld(true); if (this.options.showPageSizeDropDown === true && this.options.pageSizeDropDownLocation === "above") { a("#" + this.grid.container()[0].id + " .ui-iggrid-pagesizedropdowncontainerabove").remove() } b.remove(); a.Widget.prototype.destroy.call(this); return this }, _injectGrid: function (c, b) { this.grid = c; this.grid.dataSource.settings.paging.type = this.options.type ? this.options.type : "remote"; this.grid.dataSource.settings.paging.pageIndex = this.options.currentPageIndex; this.grid.dataSource.settings.paging.pageSize = parseInt(this.options.pageSize, 10); if (this.options.pageSizeUrlKey !== null && this.options.pageIndexUrlKey) { this.grid.dataSource.settings.paging.pageSizeUrlKey = this.options.pageSizeUrlKey; this.grid.dataSource.settings.paging.pageIndexUrlKey = this.options.pageIndexUrlKey } if (this.options.recordCountKey !== null) { this.grid.dataSource.settings.responseTotalRecCountKey = this.options.recordCountKey } this.grid.dataSource.settings.paging.enabled = true; if (this._pageSizeDD) { this._pageSizeDD.igEditor("option", "value", this.options.pageSize) } }, _empty: function () { return "" } }); a.extend(a.ui.igGridPaging, { version: "11.1.20111.2010" }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics Grid requires jQuery to be loaded") } (function (a) { a.widget("ui.igGridFiltering", { grid: null, options: { caseSensitive: false, filterSummaryAlwaysVisible: true, filterSummaryTemplate: a.ig.GridFiltering.locale.filterSummaryTemplate, filterDropDownAnimations: "linear", filterDropDownAnimationDuration: 500, filterDropDownWidth: 0, filterDropDownHeight: 0, filterExprUrlKey: null, filterDropDownItemIcons: true, columnSettings: [{ columnKey: null, columnIndex: null, allowFiltering: true, condition: null}], type: "remote", filterDelay: 500, mode: null, advancedModeEditorsVisible: false, advancedModeHeaderButtonLocation: "left", filterDialogWidth: 350, filterDialogHeight: "", filterDialogFilterDropDownDefaultWidth: 80, filterDialogExprInputDefaultWidth: 80, filterDialogColumnDropDownDefaultWidth: null, renderFilterButton: true, filterButtonLocation: "left", nullTexts: { startsWith: a.ig.GridFiltering.locale.startsWithNullText, endsWith: a.ig.GridFiltering.locale.endsWithNullText, contains: a.ig.GridFiltering.locale.containsNullText, doesNotContain: a.ig.GridFiltering.locale.doesNotContainNullText, equals: a.ig.GridFiltering.locale.equalsNullText, doesNotEqual: a.ig.GridFiltering.locale.doesNotEqualNullText, greaterThan: a.ig.GridFiltering.locale.greaterThanNullText, lessThan: a.ig.GridFiltering.locale.lessThanNullText, greaterThanOrEqualTo: a.ig.GridFiltering.locale.greaterThanOrEqualToNullText, lessThanOrEqualTo: a.ig.GridFiltering.locale.lessThanOrEqualToNullText, on: a.ig.GridFiltering.locale.onNullText, notOn: a.ig.GridFiltering.locale.notOnNullText, thisMonth: a.ig.GridFiltering.locale.thisMonthLabel, lastMonth: a.ig.GridFiltering.locale.lastMonthLabel, nextMonth: a.ig.GridFiltering.locale.nextMonthLabel, thisYear: a.ig.GridFiltering.locale.thisYearLabel, lastYear: a.ig.GridFiltering.locale.lastYearLabel, nextYear: a.ig.GridFiltering.locale.nextYearLabel, empty: a.ig.GridFiltering.locale.emptyNullText, notEmpty: a.ig.GridFiltering.locale.notEmptyNullText, "null": a.ig.GridFiltering.locale.nullNullText, notNull: a.ig.GridFiltering.locale.notNullNullText }, labels: { noFilter: a.ig.GridFiltering.locale.noFilterLabel, clear: a.ig.GridFiltering.locale.clearLabel, startsWith: a.ig.GridFiltering.locale.startsWithLabel, endsWith: a.ig.GridFiltering.locale.endsWithLabel, contains: a.ig.GridFiltering.locale.containsLabel, doesNotContain: a.ig.GridFiltering.locale.doesNotContainLabel, equals: a.ig.GridFiltering.locale.equalsLabel, doesNotEqual: a.ig.GridFiltering.locale.doesNotEqualLabel, greaterThan: a.ig.GridFiltering.locale.greaterThanLabel, lessThan: a.ig.GridFiltering.locale.lessThanLabel, greaterThanOrEqualTo: a.ig.GridFiltering.locale.greaterThanOrEqualToLabel, lessThanOrEqualTo: a.ig.GridFiltering.locale.lessThanOrEqualToLabel, trueLabel: a.ig.GridFiltering.locale.trueLabel, falseLabel: a.ig.GridFiltering.locale.falseLabel, after: a.ig.GridFiltering.locale.afterLabel, before: a.ig.GridFiltering.locale.beforeLabel, today: a.ig.GridFiltering.locale.todayLabel, yesterday: a.ig.GridFiltering.locale.yesterdayLabel, thisMonth: a.ig.GridFiltering.locale.thisMonthLabel, lastMonth: a.ig.GridFiltering.locale.lastMonthLabel, nextMonth: a.ig.GridFiltering.locale.nextMonthLabel, thisYear: a.ig.GridFiltering.locale.thisYearLabel, lastYear: a.ig.GridFiltering.locale.lastYearLabel, nextYear: a.ig.GridFiltering.locale.nextYearLabel, on: a.ig.GridFiltering.locale.onLabel, notOn: a.ig.GridFiltering.locale.notOnLabel, advancedButtonLabel: a.ig.GridFiltering.locale.advancedButtonLabel, filterDialogCaptionLabel: a.ig.GridFiltering.locale.filterDialogCaptionLabel, filterDialogConditionLabel1: a.ig.GridFiltering.locale.filterDialogConditionLabel1, filterDialogConditionLabel2: a.ig.GridFiltering.locale.filterDialogConditionLabel2, filterDialogOkLabel: a.ig.GridFiltering.locale.filterDialogOkLabel, filterDialogCancelLabel: a.ig.GridFiltering.locale.filterDialogCancelLabel, filterDialogAnyLabel: a.ig.GridFiltering.locale.filterDialogAnyLabel, filterDialogAllLabel: a.ig.GridFiltering.locale.filterDialogAllLabel, filterDialogAddLabel: a.ig.GridFiltering.locale.filterDialogAddLabel, filterDialogErrorLabel: a.ig.GridFiltering.locale.filterDialogErrorLabel, filterSummaryTitleLabel: a.ig.GridFiltering.locale.filterSummaryTitleLabel, filterDialogClearAllLabel: a.ig.GridFiltering.locale.filterDialogClearAllLabel, empty: a.ig.GridFiltering.locale.emptyNullText, notEmpty: a.ig.GridFiltering.locale.notEmptyNullText, nullLabel: a.ig.GridFiltering.locale.nullNullText, notNull: a.ig.GridFiltering.locale.notNullNullText }, tooltipTemplate: a.ig.GridFiltering.locale.tooltipTemplate, filterDialogAddConditionTemplate: "<div><span>${label1}</span><div><select></select></div><span>${label2}</span></div>", filterDialogAddConditionDropDownTemplate: "<option value='${value}'>${text}</option>", filterDialogFilterTemplate: "<tr><td><input/></td><td><select></select></td><td><input /> </td><td><span></span></td></tr>", filterDialogFilterColumnsListTemplate: "<option value='${columnKey}'>${columnKey}</option>", filterDialogFilterConditionTemplate: "<option value='${conditionName}'>${conditionLabel}</option>", filterDialogAddButtonWidth: 100, filterDialogOkCancelButtonWidth: 100, filterDialogMaxFilterCount: 5, showEmptyConditions: false, showNullConditions: false }, css: { filterRow: "ui-iggrid-filterrow ui-widget", filterCell: "ui-iggrid-filtercell", filterCellEditor: "ui-iggrid-filtereditor", filterDropDownList: "ui-menu ui-widget ui-widget-content ui-iggrid-filterddlist ui-corner-all", filterDropDown: "ui-iggrid-filterdd", filterDropDownListItemTextContainer: "ui-iggrid-filterddlistitemcontainer", filterDropDownListItem: "ui-iggrid-filterddlistitem", filterDropDownListItemAdvanced: "ui-iggrid-filterddlistitemadvanced", filterDropDownListItemWithIcons: "ui-iggrid-filterddlistitemicons ui-state-default", filterDropDownListItemClear: "ui-iggrid-filterddlistitemclear", filterDropDownListItemHover: "ui-iggrid-filterddlistitemhover ui-state-hover", filterDropDownListItemActive: "ui-iggrid-filterddlistitemactive ui-state-active", filterDateCell: "", filterTextCell: "", filterNumberCell: "", filterBoolCell: "", filterButton: "ui-iggrid-filterbutton ui-corner-all ui-icon ui-icon-triangle-1-s", filterButtonAdvanced: "ui-iggrid-filterbutton ui-iggrid-filterbuttonadvanced ui-icon ui-icon-search", filterButtonAdvancedRight: "ui-iggrid-filterbuttonright ui-iggrid-filterbuttonadvanced ui-icon ui-icon-search", filterButtonHover: "ui-iggrid-filterbuttonhover ui-state-hover", filterButtonActive: "ui-iggrid-filterbuttonactive ui-state-active", filterButtonFocus: "ui-iggrid-filterbuttonfocus ui-state-focus", filterButtonDisabled: "ui-iggrid-filterbuttondisabled ui-state-disabled", filterButtonDate: "ui-iggrid-filterbuttondate", filterButtonString: "ui-iggrid-filterbuttonstring", filterButtonNumber: "ui-iggrid-filterbuttonnumber", filterButtonBoolean: "ui-iggrid-filterbuttonbool", filterButtonCustom: "ui-iggrid-filterbuttoncustom", filterButtonAdvancedHover: "ui-iggrid-filterbuttonadvancedhover ui-state-hover", filterButtonAdvancedActive: "ui-iggrid-filterbuttonadvancedactive ui-state-active", filterButtonAdvancedFocus: "ui-iggrid-filterbuttonadvancedfocus ui-state-focus", filterButtonAdvancedDisabled: "ui-iggrid-filterbuttonadvanceddisabled ui-state-disabled", filterItemIcon: "ui-iggrid-filtericon", filterItemIconContainer: "ui-iggrid-filtericoncontainer", filterItemIconStartsWith: "ui-iggrid-filtericonstartswith", filterItemIconEndsWith: "ui-iggrid-filtericonendswith", filterItemIconContains: "ui-iggrid-filtericoncontains", filterItemIconEquals: "ui-iggrid-filtericonequals", filterItemIconDoesNotEqual: "ui-iggrid-filtericondoesnotequal", filterItemIconDoesNotContain: "ui-iggrid-filtericondoesnotcontain", filterItemIconGreaterThan: "ui-iggrid-filtericongreaterthan", filterItemIconLessThan: "ui-iggrid-filtericonlessthan", filterItemIconGreaterThanOrEqualTo: "ui-iggrid-filtericongreaterthanorequalto", filterItemIconLessThanOrEqualTo: "ui-iggrid-filtericonlessthanorequalto", filterItemIconTrue: "ui-iggrid-filtericontrue", filterItemIconFalse: "ui-iggrid-filtericonfalse", filterItemIconAfter: "ui-iggrid-filtericonafter", filterItemIconBefore: "ui-iggrid-filtericonbefore", filterItemIconToday: "ui-iggrid-filtericontoday", filterItemIconYesterday: "ui-iggrid-filtericonyesterday", filterItemIconThisMonth: "ui-iggrid-filtericonthismonth", filterItemIconLastMonth: "ui-iggrid-filtericonlastmonth", filterItemIconNextMonth: "ui-iggrid-filtericonnextmonth", filterItemIconThisYear: "ui-iggrid-filtericonthisyear", filterItemIconLastYear: "ui-iggrid-filtericonlastyear", filterItemIconNextYear: "ui-iggrid-filtericonnextyear", filterItemIconOn: "ui-iggrid-filtericonon", filterItemIconNotOn: "ui-iggrid-filtericonnoton", filterItemIconClear: "ui-iggrid-filtericonclear", blockArea: "ui-widget-overlay ui-iggrid-blockarea", filterDialog: "ui-dialog ui-draggable ui-resizable ui-iggrid-dialog ui-widget-content ui-corner-all", filterDialogHeaderCaption: "ui-dialog-titlebar ui-iggrid-filterdialogcaption ui-widget-header ui-corner-all ui-helper-reset ui-helper-clearfix", filterDialogHeaderCaptionTitle: "ui-dialog-title", filterDialogAddCondition: "ui-iggrid-filterdialogaddcondition", filterDialogAddConditionDropDown: "ui-iggrid-filterdialogaddconditionlist", filterDialogAddButton: "ui-iggrid-filterdialogaddbuttoncontainer ui-helper-reset", filterDialogOkCancelButton: "ui-dialog-buttonpane ui-widget-content ui-helper-clearfix ui-iggrid-filterdialogokcancelbuttoncontainer", filterDialogFiltersTable: "ui-iggrid-filtertable ui-helper-reset", filterDialogFilterRemoveButton: "ui-icon ui-icon-closethick", filterDialogClearAllButton: "ui-iggrid-filterdialogclearall" }, events: { dataFiltering: "dataFiltering", dataFiltered: "dataFiltered", dropDownOpening: "dropDownOpening", dropDownOpened: "dropDownOpened", dropDownClosing: "dropDownClosing", dropDownClosed: "dropDownClosed", filterDialogOpening: "filterDialogOpening", filterDialogOpened: "filterDialogOpened", filterDialogMoving: "filterDialogMoving", filterDialogFilterAdding: "filterDialogFilterAdding", filterDialogFilterAdded: "filterDialogFilterAdded", filterDialogClosing: "filterDialogClosing", filterDialogClosed: "filterDialogClosed", filterDialogContentsRendering: "filterDialogContentsRendering", filterDialogContentsRendered: "filterDialogContentsRendered", filterDialogFiltering: "filterDialogFiltering" }, _createWidget: function (c, b) { this.options.columnSettings = []; a.Widget.prototype._createWidget.apply(this, arguments) }, _create: function () { this._editors = []; if (!a.fn.fadeToggle) { a.fn.fadeToggle = a.fn.toggle } this._ft = "<li class='${itemClass}'><span class='${imgContainerClass}'><span class='" + this.css.filterItemIcon + " ${imgClass}'></span></span><span class='${textClass}'> ${text} </span></li>"; if (this.options.filterDropDownAnimations === "none") { this.options.filterDropDownAnimationDuration = 1; this.options.filterDropDownAnimations = "linear" } }, _setOption: function (b, c) { a.Widget.prototype._setOption.apply(this, arguments); if (b === "mode" || b === "renderFilterButton" || b === "filterButtonLocation" || b === "type") { throw new Error(a.ig.Grid.locale.optionChangeNotSupported + " " + b) } if (b === "filterDropDownWidth") { this.grid.container().find("div ul").parent().css("width", c) } else { if (b === "filterDropDownHeight") { this.grid.container().find("div ul").parent().css("height", c) } else { if (b === "filterDialogWidth") { a("#" + this.grid.container().attr("id") + "_dialog").css("width", c) } else { if (b === "filterDialogHeight") { a("#" + this.grid.container().attr("id") + "_dialog").css("height", c) } } } } }, destroy: function () { var b = a("#" + this.grid.id() + "_container_block"), c = a("#" + this.grid.id() + "_container_dialog"); a("#" + this.grid.container()[0].id + " .ui-iggrid-filterrow").remove(); a("#" + this.grid.container()[0].id + " .ui-iggrid-filterdd").remove(); if (this.options.mode === "advanced") { b.remove(); c.remove() } this.grid.element.unbind("iggridheaderrendered", this._headerRenderedHandler); this.grid.element.unbind("iggridvirtualhorizontalscroll", this._virtualHorizontalScrollHandler); a.Widget.prototype.destroy.call(this); return this }, _initLoadingIndicator: function () { this._loadingIndicator = this.grid.container().length > 0 ? this.grid.container().igLoading().data("igLoading").indicator() : this.grid.element.igLoading().data("igLoading").indicator() }, _onUIDirty: function (d, c) { var b; if (c.owner === this) { return } this._filterDialogClearAll(); if (this._editors !== null && this._editors !== undefined) { for (b = 0; b < this._editors.length; b++) { if (this.options.columnSettings[b].allowFiltering !== false) { this._editors[b].value(null) } } } a(".ui-iggrid-filterbutton", this.grid.container()).parent().attr("title", this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter)) }, _dataRendered: function () { var e = 0, d = this.grid.container().find(".ui-iggrid-footer .ui-iggrid-results"), b = d.parent(), c = false, f = null, g; if (!this._loadingIndicator) { this._initLoadingIndicator() } if (this._shouldFireDataFiltered) { this._shouldFireDataFiltered = false; this._trigger(this.events.dataFiltered, null, { columnKey: this._curColKey, columnIndex: this._curColIndex, owner: this }) } if (this._isFilteringRequest === true) { if (this.options.filterSummaryAlwaysVisible === true && d.length === 0) { b = a("<div></div>").appendTo(this.grid.container()).addClass("ui-widget ui-helper-clearfix ui-corner-bottom ui-widget-header ui-iggrid-footer"); d = a("<span></span>").appendTo(b).addClass("ui-iggrid-results"); c = true } if (this.options.type === "local" || (this.options.type === "remote" && this.grid.dataSource.hasTotalRecordsCount() === false)) { if (this.grid.dataSource._filter) { e = this.grid.dataSource._filteredData.length } else { e = this.grid.dataSource._data.length } } else { e = this.grid.dataSource.totalRecordsCount() } d.text(this.options.filterSummaryTemplate.replace("${matches}", e)).attr("title", this.options.labels.filterSummaryTitleLabel); d.show(); this._isFilteringRequest = false } else { if (this._isFilteringRequest === false) { if (d.data("hideflag") !== false) { d.hide() } else { d.data("hideflag", true) } } } this._loadingIndicator.hide(); if (c) { this.grid._initializeHeights() } f = this.grid.options.columns[this.grid.options.columns.length - 1].width; g = this.grid.container().find(".ui-iggrid-filterrow td:last-child"); if (this.grid.options.fixedHeaders && this.options.mode === "simple" && f) { if ((this.grid.options.autoAdjustHeight && this.grid.element.height() <= a("#" + this.grid.element[0].id + "_scroll").height()) || (!this.grid.options.autoAdjustHeight && this.grid.options.avgRowHeight * this.grid.element[0].rows.length < parseInt(this.grid.options.height, 10))) { this._editors[this.grid.options.columns.length - 1]._width(g.data("editorWidth") - this.grid._scrollbarWidth()) } else { g.css("width", parseInt(f, 10) + this.grid._scrollbarWidth()); this._editors[this.grid.options.columns.length - 1]._width(g.data("editorWidth")) } } }, _headerRendered: function () { var c, d, m, r, l, q, e = this.grid.options.columns, o, n, p = this.options.columnSettings, b = false, g, h = false, k, f; c = this.grid.container().find("thead"); if (this.options.mode === "simple" || this.options.advancedModeEditorsVisible === true) { d = a("<tr></tr>").appendTo(c).addClass(this.css.filterRow) } else { d = c.find("tr:first") } f = function (i) { i.preventDefault(); i.stopPropagation() }; for (m = 0; m < e.length; m++) { if (this.options.mode === "simple" || this.options.advancedModeEditorsVisible === true) { r = a("<td></td>").appendTo(d).addClass(this.css.filterCell) } else { r = a(d[0].cells[m]); if (r.children().first().is("a")) { r.children().first().css("display", "inline"); r.css("cursor", "pointer") } r.data("colName", e[m].key) } if (m === e.length - 1 && this.grid.options.height && parseInt(this.grid.options.height, 10) > 0) { r.css("width", parseInt(e[m].width, 10) + this.grid._scrollbarWidth()) } else { r.css("width", e[m].width) } for (n = 0; n < p.length; n++) { if (p[n].columnKey === e[m].key && p[n].allowFiltering === false) { if (this.options.advancedModeEditorsVisible === true || this.options.mode !== "advanced") { this._editors.push({}) } b = true; break } } if (b) { b = false; continue } if (!a.browser.opera && ((this.grid.options.height && this.grid.options.fixedHeaders === true) || a.browser.webkit)) { l = c.children().first().find("th:nth-child(" + (m + 1) + ")").innerWidth() } else { l = c.children().first().find("th:nth-child(" + (m + 1) + ")").width() } h = (this.options.advancedModeEditorsVisible === false && this.options.mode === "advanced"); if (this.options.renderFilterButton === true || h) { o = this.grid.element.attr("id") + "_dd_" + e[m].key; if (this.options.advancedModeEditorsVisible === true || this.options.mode !== "advanced") { this._renderDropDown(e[m].dataType, o, e[m].key) } g = this.options.mode === "advanced" ? this.css.filterButtonAdvanced : this.css.filterButton; if (h && this.options.advancedModeHeaderButtonLocation === "right") { g = this.css.filterButtonAdvancedRight; q = a("<span></span>").appendTo(r).addClass(g).data("colIndex", m) } else { q = a("<span></span>").prependTo(r).addClass(g).data("colIndex", m) } if (this.options.mode === "simple" || (this.options.mode === "advanced" && this.options.advancedModeEditorsVisible === true)) { q.wrap('<a id="' + o + '_button" href="#" title="' + this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter) + '" ></a>') } else { q.wrap('<a id="' + o + '_button" href="#" title="' + this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter) + '" style="display:inline;"></a>') } k = r.find(".ui-iggrid-indicatorcontainer"); if (k.length === 0) { k = a("<div></div>").appendTo(r).addClass("ui-iggrid-indicatorcontainer") } k.append(q.parent()); l = parseInt(l, 10); if (this.grid.options.height === null && a.browser.mozilla) { l -= q.outerWidth(true) } else { l -= q.outerWidth(false) } r.data("editorWidth", l) } if (this.options.renderFilterButton === true) { if (this.options.advancedModeEditorsVisible === true || this.options.mode !== "advanced") { q.parent().bind({ mousedown: a.proxy(this._toggleDropDown, this), mouseup: f, click: f, blur: a.proxy(this._closeDropDown, this), keydown: a.proxy(this._toggleDropDownKeyboard, this), mouseover: a.proxy(this._hoverButton, this), mouseout: a.proxy(this._unhoverButton, this), focus: a.proxy(this._activateButton, this) }) } else { q.parent().bind({ click: a.proxy(this._openFilterDialog, this), keydown: a.proxy(this._openFilterDialogFromKeyboard, this), focus: a.proxy(this._activateButton, this), blur: a.proxy(this._deactivateButton, this) }) } } if (this.options.advancedModeEditorsVisible === true || this.options.mode !== "advanced") { this._createEditor(r, l, m, e[m].dataType, e[m].key) } } if (this.options.mode === "advanced") { this._renderFilterDialog() } }, _createEditor: function (g, i, h, e, f) { var b, c, d = this._getEditorType(e); b = a("<span />").css("float", "left").css("width", "5px"); if (this.options.filterButtonLocation === "left") { b.appendTo(g) } else { b.prependTo(g) } c = { textChanged: a.proxy(this._filter, this), width: i, readOnly: (this.grid.options.columns[h].dataType === "bool" || this.grid.options.columns[h].dataType === "boolean"), type: d, textAlign: "left", button: (d === "datepicker") ? "dropdown" : null, maxDecimals: 6, nullText: this.options.nullTexts[this._findColumnSetting(f).condition], focus: a.proxy(this._fireEnterEditModeEvents, this), blur: a.proxy(this._fireExitEditModeEvents, this) }; b.data("colIndex", h).data("colKey", f); b.igEditor(c); this._editors.push(b.data("igEditor")); b.find("input").addClass(this.css.filterCellEditor); return b }, _showEditor: function (i) { var h = i.target, c = a(h), f = c.data("colKey"), d = c.data("colType"), b, j = c.data("editorWidth"), g; if (f === undefined || d === undefined) { return } b = a("#" + this.grid.element[0].id + "_sharedEditor", this.grid.container()); g = { width: j, type: this._getEditorType(d), nullText: this.options.nullTexts[this._findColumnSetting(f).condition], textChanged: a.proxy(this._filter, this) }; b.igEditor("destroy").css("width", j).css("height", c.height()); b.igEditor(g); if (this.options.filterButtonLocation === "left") { c.append(b) } else { c.prepend(b) } b.show().find("input").focus(); return b }, _getEditorType: function (b) { return (b === "date") ? "datepicker" : ((b === "number") ? "numeric" : "text") }, _findColumnSetting: function (b) { var c; for (c = 0; c < this.options.columnSettings.length; c++) { if (this.options.columnSettings[c].columnKey === b) { return this.options.columnSettings[c] } } }, filter: function (d, c, b) { this._loadingIndicator.show(); if (d !== undefined && d.length > 0) { this._isFilteringRequest = true } if (!b) { this._filterDataSource(d, true) } else { this._filterDataSource(d) } if (c === undefined || c === true) { this._updateFiltersUI(d === undefined ? this._generateExpressions() : d, b) } }, _filter: function (b, c) { clearTimeout(this._timeoutId); this._ui = b; this._args = c; if (parseInt(this.options.filterDelay, 10) === 0) { this._filterInternal() } else { this._timeoutId = setTimeout(a.proxy(this._filterInternal, this), this.options.filterDelay) } }, _filterInternal: function (f, d) { var g = this._args, b, c, e; if (g !== undefined) { b = a(g.owner.element).data("colIndex"); c = a(g.owner.element).data("colKey") } else { b = f; c = d } e = this._trigger(this.events.dataFiltering, null, { columnKey: c, columnIndex: b, owner: this }); if (e) { this._loadingIndicator.show(); if (this._editors && this._editors[b]) { this._editors[b]._addedFromAdvanced = false } this._curColKey = c; this._curColIndex = b; this._filterDataSource() } }, _filterDataSource: function (f, h) { var m, b, c, d, k = this.grid.options.columns, e = false, l, g; l = this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter); if (f !== undefined) { this.grid.dataSource.settings.filtering.expressions = f } else { m = this._generateExpressions(true); for (b = 0; b < k.length; b++) { e = false; d = a("#" + this.grid.element[0].id + "_dd_" + k[b].key + "_button"); for (c = 0; c < m.length; c++) { if (k[b].key === m[c].fieldName) { e = true; if ((m[c].expr === undefined || m[c].expr === null || m[c].expr === "") && this._requiresEntry(m[c].cond)) { d.attr("title", l) } else { d.attr("title", this.options.tooltipTemplate.replace("${condition}", m[c].cond)) } break } } if (!e) { d.attr("title", l) } } this.grid.dataSource.settings.filtering.expressions = m } this.grid.element.trigger("iggriduisoftdirty", { owner: this }); g = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); if (g) { m = this.grid.dataSource.settings.filtering.expressions; this.grid.dataSource.settings.paging.pageIndex = 0; this.grid._shouldResetPaging = true; if (m.length === 0) { this._isFilteringRequest = true; this.grid._fireDataBoundInternal = true; if (!h) { this._shouldFireDataFiltered = true } this.grid.dataSource.dataBind() } else { this._isFilteringRequest = true; if (this.options.type === "remote") { this.grid._fireDataBoundInternal = true; if (!h) { this._shouldFireDataFiltered = true } this.grid.dataSource.dataBind() } else { this.grid.dataSource.settings.filtering.type = "local"; this.grid.dataSource.filter(m); this.grid._trigger(this.grid.events.dataBound, null, { owner: this.grid }); this.grid._renderData(); if (!h) { this._trigger(this.events.dataFiltered, null, { columnKey: this._curColKey, columnIndex: this._curColIndex, owner: this }) } } } } }, _filterDataSourceClear: function (e) { var c, b = this._generateExpressions(true), f, d; for (c = 0; c < b.length; c++) { if (b[c].fieldName === e) { b.remove(c); break } } this.grid.dataSource.settings.filtering.expressions = b; this.grid.element.trigger("iggriduidirty", { owner: this }); d = this._trigger(this.events.dataFiltering, null, { columnKey: this._curColKey, columnIndex: this._curColIndex, owner: this }); if (d) { f = this.grid._trigger(this.grid.events.dataBinding, null, { owner: this.grid }); if (f) { this.grid.dataSource.settings.paging.pageIndex = 0; this.grid._shouldResetPaging = true; if (b.length > 0) { this._isFilteringRequest = true; if (this.options.type === "remote") { this.grid._fireDataBoundInternal = true; this._shouldFireDataFiltered = true; this.grid.dataSource.dataBind() } else { this.grid.dataSource.settings.filtering.type = "local"; this.grid.dataSource.filter(b); this.grid._trigger(this.grid.events.dataBound, null, { owner: this.grid }); this.grid._renderData(); this._trigger(this.events.dataFiltered, null, { columnKey: this._curColKey, columnIndex: this._curColIndex, owner: this }) } } else { this.grid._fireDataBoundInternal = true; this._isFilteringRequest = false; this._shouldFireDataFiltered = true; this.grid.dataSource.dataBind() } } } }, _updateFiltersUI: function (f, h) { var d, c, b, e, g; if (f.length === 0 && this.options.mode === "advanced" && this.options.advancedModeEditorsVisible === true) { for (d = 0; d < this._editors.length; d++) { if (this.options.columnSettings[d].allowFiltering !== false) { this._editors[d].value(null) } } } for (d = 0; d < f.length; d++) { e = a("#" + this.grid.element[0].id + "_dd_" + f[d].fieldName).find("ul"); g = e.children(); for (c = 0; c < g.length; c++) { if (a(g[c]).data("cond") === f[d].cond) { this._selectDropDownItem({ currentTarget: g[c] }); break } } b = this._editors[this._columnIndexFromKey(f[d].fieldName)]; if (b !== undefined && b !== null) { b.value(f[d].expr); b._addedFromAdvanced = true } } this._updateTooltips(f) }, _updateTooltips: function (h) { var b, e, g, f, l, k = this.grid.options.columns, c, d; f = this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter); e = ""; for (c = 0; c < h.length; c++) { b = a("#" + this.grid.element[0].id + "_dd_" + h[c].fieldName + "_button"); if (h[c].expr === undefined || h[c].expr === null) { l = "" } else { l = h[c].expr } if (c === 0) { b.attr("title", h[c].fieldName + " " + h[c].cond + " " + l + " ") } else { b.attr("title", e + h[c].logic + " " + h[c].fieldName + " " + h[c].cond + " " + l + " ") } e = b.attr("title") } for (c = 0; c < k.length; c++) { g = false; for (d = 0; d < h.length; d++) { if (h[d].fieldName === k[c].key) { g = true; break } } if (!g) { a("#" + this.grid.element[0].id + "_dd_" + k[c].key + "_button").attr("title", f) } } }, _columnIndexFromKey: function (b) { var c; for (c = 0; c < this.grid.options.columns.length; c++) { if (this.grid.options.columns[c].key === b) { return c } } }, _generateExpressions: function (e) { var h = [], f = this.grid.options.columns, d, b, c, g; for (b = 0; b < f.length; b++) { if (this._editors && this._editors[b] && this._editors[b]._addedFromAdvanced && !e) { continue } if (this.options.columnSettings[b].allowFiltering !== true) { continue } d = this._editors[b].value(); g = this._requiresEntry(this.options.columnSettings[b].condition); if ((d === undefined || d === null || d === "") && g) { continue } c = this.options.columnSettings[b].condition; if (c === undefined || c === null || c === "") { continue } if (f[b].dataType !== "date" || (f[b].dataType === "date" && d !== null && d !== undefined && c !== "empty" && c !== "notEmpty" && c !== "null" && c !== "notNull") || (f[b].dataType === "date" && !this._requiresEntry(this.options.columnSettings[b].condition))) { if (d !== "" && !this.options.filterExprUrlKey) { h.push({ fieldName: f[b].key, cond: c, expr: d }) } else { if ((f[b].dataType === "bool" && d !== "") || (f[b].dataType !== "bool" && ((this.options.filterExprUrlKey !== undefined && this.options.filterExprUrlKey !== null) || this.options.type === "local"))) { h.push({ fieldName: f[b].key, cond: c, expr: d }) } else { if (f[b].dataType === "bool" && d === "" && (c === "null" || c === "notNull" || c === "empty" || c === "notEmpty")) { h.push({ fieldName: f[b].key, cond: c, expr: d }) } } } } } return h }, _getDefaultCondition: function (b) { if (b === undefined || b === null || b === "string") { return "contains" } else { if (b === "number") { return "equals" } else { if (b === "date") { return "on" } else { if (b === "bool") { return "true" } } } } return "equals" }, _initDefaultSettings: function () { var e = [], g, b = this.options.columnSettings, c, d, h = [], f = this.grid.options.columns; if (f && f.length > 0) { for (c = 0; c < f.length; c++) { e[c] = { columnIndex: c, columnKey: f[c].key, condition: this._getDefaultCondition(f[c].dataType), allowFiltering: true} } } for (c = 0; c < b.length; c++) { for (d = 0; d < e.length; d++) { if (e[d].columnKey === b[c].columnKey || e[d].columnIndex === b[c].columnIndex) { break } } if (d === e.length) { continue } for (g in b[c]) { if (b[c].hasOwnProperty(g) && g !== "columnKey" && g !== "columnIndex") { e[d][g] = b[c][g] } } } this.options.columnSettings = e; this.grid.dataSource.settings.filtering.expressions = h }, _renderDropDown: function (g, e, k) { var j, c, b = this.options.columnSettings, h = this.grid.options.columns, d, f; if (g === "number") { j = this._renderNumericFilterDropDown(e, k) } else { if (g === "date") { j = this._renderDateFilterDropDown(e, k) } else { if (g === "boolean" || g === "bool") { j = this._renderBooleanFilterDropDown(e, k) } else { j = this._renderStringFilterDropDown(e, k) } } } if (this.options.filterDropDownItemIcons !== true) { if (this.options.showEmptyConditions) { a("<a></a>").appendTo(a("<li></li>").appendTo(j).addClass(this.css.filterDropDownListItem).data("cond", "empty")).text(this.options.labels.empty).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(j).addClass(this.css.filterDropDownListItem).data("cond", "notEmpty")).text(this.options.labels.notEmpty).addClass("ui-corner-all") } if (this.options.showNullConditions) { a("<a></a>").appendTo(a("<li></li>").appendTo(j).addClass(this.css.filterDropDownListItem).data("cond", "null")).text(this.options.labels.nullLabel).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(j).addClass(this.css.filterDropDownListItem).data("cond", "notNull")).text(this.options.labels.notNull).addClass("ui-corner-all") } } else { f = { itemClass: this.css.filterDropDownListItemWithIcons, imgContainerClass: this.css.filterItemIconContainer, textClass: this.css.filterDropDownListItemTextContainer }; if (this.options.showEmptyConditions) { f.text = this.options.labels.empty; f.imgClass = this.css.filterItemIcon; a.tmpl(this._ft, f).appendTo(j).data("cond", "empty"); f.text = this.options.labels.notEmpty; f.imgClass = this.css.filterItemIcon; a.tmpl(this._ft, f).appendTo(j).data("cond", "notEmpty") } if (this.options.showNullConditions) { f.text = this.options.labels.nullLabel; f.imgClass = this.css.filterItemIcon; a.tmpl(this._ft, f).appendTo(j).data("cond", "null"); f.text = this.options.labels.notNull; f.imgClass = this.css.filterItemIcon; a.tmpl(this._ft, f).appendTo(j).data("cond", "notNull") } } if (this.options.mode === "advanced") { this._renderAdvancedButton(j) } for (c = 0; c < b.length; c++) { if (b[c].columnKey === k && b[c].condition !== this._getDefaultCondition(h[c].dataType)) { if (b[c].condition === "null") { d = j.find(':contains("' + this.options.labels.nullLabel + '")') } else { d = j.find(':contains("' + this.options.labels[b[c].condition] + '")') } d = d.children().first().closest("li"); d.addClass(this.css.filterDropDownListItemActive).parent().data("selectedItem", a("li", d.parent()).index(d)) } } }, _renderAdvancedButton: function (b) { var c; c = a("<li></li>").appendTo(b).addClass(this.css.filterDropDownListItemAdvanced); this._currentButton = a('<input type="button"></input>'); this._currentButton.igButton({ labelText: this.options.labels.advancedButtonLabel }).bind({ mousedown: a.proxy(this._openFilterDialog, this) }); c.append(this._currentButton) }, _openFilterDialogFromKeyboard: function (b) { if (b.keyCode === a.ui.keyCode.ENTER) { this._openFilterDialog(b) } }, _openFilterDialog: function (n) { var k, e, g, c, m, j, q, b = true, d = a("#" + this.grid.container().attr("id") + "_block"), s = a("#" + this.grid.container().attr("id") + "_dialog"), l, o, f, r, p = true; this._dialogCurrentColumn = a(n.target).closest("ul").data("colName"); if (this._dialogCurrentColumn === undefined || this._dialogCurrentColumn === null) { this._dialogCurrentColumn = a(n.target).closest("th").data("colName") } l = a("#" + this.grid.container().attr("id") + "_dialog table tbody"); r = l.find("tr"); for (o = 0; o < r.length; o++) { if (a(r[o]).children().first().find("input").attr("value") === this._dialogCurrentColumn) { p = false; break } } f = this._dialogCurrentColumn; for (o = 0; o < this.grid.options.columns.length; o++) { if (this.grid.options.columns[o].key === f) { this._dialogCurrentType = this.grid.options.columns[o].dataType } } if (p === true) { this._addFilterFromDialog() } b = this._trigger(this.events.filterDialogOpening, null, { dialog: s, owner: this }); if (b) { g = this.grid.container().offset(); k = g.left; e = g.top; if (d.outerWidth() !== this.grid.container().outerWidth()) { d.css("width", this.grid.container().outerWidth()).css("height", this.grid.container().outerHeight()) } a("#" + this.grid.container().attr("id") + "_dialog_error").hide(); d.css({ left: k, top: e }).fadeToggle(); m = this.grid.container().outerWidth(); c = this.grid.container().outerHeight(); q = a(window).width(); j = a(window).height(); if (m + k > q) { m = m - (m + k - q) } if (m <= 0) { m = this.grid.container().outerWidth() } if (c + e > j) { c = c - (c + e - j) } if (c <= 0) { c = this.grid.container().outerHeight() } s.css({ left: k + parseInt(m / 2, 10) - this.options.filterDialogWidth / 2, top: e + parseInt(c / 2, 10) - this.options.filterDialogHeight / 2 }).fadeToggle(); this._trigger(this.events.filterDialogOpened, null, { dialog: s, owner: this }); s.focus(); n.preventDefault(); n.stopPropagation(); if (!(this.options.mode === "advanced" && this.options.advancedModeEditorsVisible === false)) { this._toggleDropDown({ currentTarget: this._currentTarget }, true) } } }, _closeFilterDialog: function (b) { var c = true; c = this._trigger(this.events.filterDialogClosing, null, { owner: this }); if (c) { a("#" + this.grid.container().attr("id") + "_block").fadeToggle(); a("#" + this.grid.container().attr("id") + "_dialog").fadeToggle(); this._trigger(this.events.filterDialogClosed, null, { owner: this }); if (b) { b.preventDefault(); b.stopPropagation() } return false } }, _searchFilterDialog: function (k) { var g = [], m, d, c, l = true, b, h, f, j = true; l = this._trigger(this.events.filterDialogFiltering, null, { dialog: a("#" + this.grid.container().attr("id") + "_dialog"), owner: this }); if (l) { m = a("#" + this.grid.container().attr("id") + "_dialog table tbody").children(); d = "and"; c = a("#" + this.grid.container().attr("id") + "_dialog select:first"); if (c.length > 0) { d = a("#" + this.grid.container().attr("id") + "_dialog select:first")[0].value === "all" ? "AND" : "OR" } for (b = 0; b < m.length; b++) { h = this.grid.columnByText(a(m[b].cells[0]).find("input")[0].value).dataType; f = a(m[b].cells[2]).find("input").igEditor("value"); if (f && (f.nodeName || (f[0] && f[0].nodeName))) { f = a(m[b].cells[2]).find("span").igEditor("value") } g.push({ fieldName: this.grid.columnByText(a(m[b].cells[0]).find("input")[0].value).key, cond: a(m[b].cells[1]).find("select")[0].value, expr: f, logic: d, type: h }) } this._closeFilterDialog(k); if (this.options.advancedModeEditorsVisible === true && this.options.mode === "advanced") { a.merge(g, this._generateExpressions()) } this._currentAdvancedExpressions = g; j = this._trigger(this.events.dataFiltering, null, { owner: this }); if (j) { this.filter(g, true, true) } } k.preventDefault(); k.stopPropagation() }, _filterDialogStartMove: function (b) { this._isFilterDialogMouseDown = true }, _filterDialogStopMove: function (b) { this._isFilterDialogMouseDown = false; this._dialogClientX = undefined; this._dialogClientY = undefined }, _filterDialogMove: function (b) { a(b.target).find(".ui-igedit-fieldincontainer").igEditor("dropDownVisible", false); this._trigger(this.events.filterDialogMoving, null, { dialog: b.target, owner: this }) }, _renderFilterDialog: function () { var d, e, h, l, c, k = this, i, b, g = true, j; a("<div></div>").appendTo("body").attr("id", this.grid.container().attr("id") + "_block").css("position", "absolute").addClass(this.css.blockArea).data("efh", "1").hide(); d = a("<div></div>").appendTo("body").attr("id", this.grid.container().attr("id") + "_dialog").css("position", "absolute").css("width", this.options.filterDialogWidth).css("height", this.options.filterDialogHeight).addClass(this.css.filterDialog).data("efh", "1").hide(); g = this._trigger(this.events.filterDialogContentsRendering, null, { dialogElement: d, owner: this }); if (g) { a("<span></span>").appendTo(i = a("<div></div>").appendTo(d).addClass(this.css.filterDialogHeaderCaption)).text(this.options.labels.filterDialogCaptionLabel).addClass(this.css.filterDialogHeaderCaptionTitle); a("<span></span>").appendTo(a("<a></a>").appendTo(i).attr("href", "#").attr("role", "button").addClass("ui-dialog-titlebar-close ui-corner-all")).bind({ click: a.proxy(this._closeFilterDialog, this) }).addClass("ui-icon ui-icon-closethick"); b = a("<div></div>").appendTo(d).css("overflow", "hidden").addClass("ui-dialog-content"); e = { label1: this.options.labels.filterDialogConditionLabel1, label2: this.options.labels.filterDialogConditionLabel2 }; h = [{ text: this.options.labels.filterDialogAllLabel, value: "all" }, { text: this.options.labels.filterDialogAnyLabel, value: "any"}]; l = a.tmpl(this.options.filterDialogAddConditionTemplate, e).appendTo(b).addClass(this.css.filterDialogAddCondition); a.tmpl(this.options.filterDialogAddConditionDropDownTemplate, h).appendTo(l.find("div").addClass(this.css.filterDialogAddConditionDropDown).find("select")); j = a("<div></div>").appendTo(b); a('<input type="button"></input>').appendTo(a("<span></span>").appendTo(j).addClass(this.css.filterDialogAddButton)).igButton({ labelText: this.options.labels.filterDialogAddLabel, width: this.options.filterDialogAddButtonWidth }).bind({ mousedown: a.proxy(this._addFilterFromDialog, this) }); a("<button />").appendTo(j).css("float", "right").igButton({ labelText: this.options.labels.filterDialogClearAllLabel, click: a.proxy(this._filterDialogClearAll, this), css: { buttonClasses: this.css.filterDialogClearAllButton, buttonHoverClasses: "", buttonActiveClasses: "", buttonFocusClasses: "", buttonLabelClass: ""} }); a("<label></label>").appendTo(b).attr("id", d.attr("id") + "_error").hide().text(this.options.labels.filterDialogErrorLabel).addClass("ui-widget ui-state-error ui-igvalidator-label"); a("<table><tbody></tbody></table>").appendTo(b).addClass(this.css.filterDialogFiltersTable); c = a("<div></div>").appendTo(a("<div></div>").appendTo(d).addClass(this.css.filterDialogOkCancelButton)).addClass("ui-dialog-buttonset"); a("<button/>").appendTo(c).igButton({ labelText: this.options.labels.filterDialogCancelLabel, width: this.options.filterDialogOkCancelButtonWidth }).bind({ mousedown: a.proxy(this._closeFilterDialog, this) }); a("<button/>").appendTo(c).igButton({ labelText: this.options.labels.filterDialogOkLabel, width: this.options.filterDialogOkCancelButtonWidth }).bind({ click: a.proxy(this._searchFilterDialog, this) }); d.bind({ keydown: function (f) { if (f.keyCode === a.ui.keyCode.ESCAPE) { k._closeFilterDialog() } } }).draggable({ containment: this.grid.container(), handle: i, drag: a.proxy(this._filterDialogMove, this) }).resizable({ alsoResize: b, minHeight: d.outerHeight() / 4, minWidth: d.outerWidth() / 2, containment: "parent" }).attr("role", "dialog").attr("tabIndex", -1); this._trigger(this.events.filterDialogContentsRendered, null, { dialogElement: d, owner: this }) } }, _changeFilterCondition: function (h) { var d, b, c, f, g; f = h.target.value; b = this.grid.columnByText(a(h.target).closest("td").parent().find("td:nth-child(1)").find("input")[0].value); c = a(h.target).closest("td").parent().find("td:nth-child(3)").find("input"); d = this._requiresEntry(f); if (!d) { c.igEditor("option", "readOnly", true); g = c.data("igEditor"); this._editorValueForCondition(f, g) } else { c.igEditor("option", "readOnly", false) } }, _addFilterFromDialog: function (q) { var g = a("#" + this.grid.container().attr("id") + "_dialog table tbody"), m, n = this.options.columnSettings, d = {}, o, f, l, b = true, k, p, h, c; b = this._trigger(this.events.filterDialogFilterAdding, null, { filtersTableBody: g, owner: this }); if (b) { if (g.children().length >= this.options.filterDialogMaxFilterCount) { a("#" + this.grid.container().attr("id") + "_dialog_error").show(); return } o = a.tmpl(this.options.filterDialogFilterTemplate, d).appendTo(g).hide(); f = []; for (l = 0; l < this.grid.options.columns.length; l++) { c = true; for (m = 0; m < n.length; m++) { if ((this.grid.options.columns[l].key === n[m].columnKey || l === n[m].columnIndex) && n[m].allowFiltering === false) { c = false; break } } if (c) { f.push(this.grid.options.columns[l].headerText) } } k = this._dialogCurrentColumn === undefined ? this.grid.options.columns[0].headerText : this.grid.columnByKey(this._dialogCurrentColumn).headerText; p = this._dialogCurrentType === undefined ? this.grid.options.columns[0].dataType : this._dialogCurrentType; o.find("td:first").find("input").igEditor({ listItems: f, button: "dropdown", listAutoComplete: true, listMatchOnly: true, width: this.options.filterDialogColumnDropDownDefaultWidth, textChanged: a.proxy(this._polulateFilterConditionDropDown, this), value: k }); h = o.find("td:nth-child(2)").children().first(); this._populateConditionsList(h, k, p); h.bind("change", a.proxy(this._changeFilterCondition, this)); o.find("td:nth-child(2)").children().first().css("width", this.options.filterDialogFilterDropDownDefaultWidth); o.show(); this._populateFilterDialogInput(o.find("td:nth-child(3)").children().first(), p); o.find("td:last").children().first().addClass(this.css.filterDialogFilterRemoveButton).bind({ mousedown: a.proxy(this._removeFilterFromDialog, this) }); this._trigger(this.events.filterDialogFilterAdded, null, { filter: o, owner: this }) } }, _filterDialogClearAll: function (c) { var b = a("#" + this.grid.container().attr("id") + "_dialog table tbody"); b.empty(); a("#" + this.grid.container().attr("id") + "_dialog_error").hide() }, _polulateFilterConditionDropDown: function (g) { var h = g.target.value, j, f = this.grid.options.columns, d, c, b; j = a(g.target).closest("tr").find("td:nth-child(2)").children().first(); c = a(g.target).closest("tr").find("td:nth-child(3)").children().first(); for (b = 0; b < f.length; b++) { if (f[b].headerText === h) { d = f[b].dataType; break } } if (d === undefined) { return } this._populateConditionsList(j, h, d); this._populateFilterDialogInput(c, d) }, _populateFilterDialogInput: function (b, c) { var d = { type: this._getEditorType(c), buttonHidden: c !== "date", button: "dropdown", disabled: c === "bool", maxDecimals: 12, textAlign: (c === "number") ? "right" : "left", width: this.options.filterDialogExprInputDefaultWidth, value: null }; if (!b.is("input")) { b = b.find("INPUT") } b.igEditor(d) }, _populateConditionsList: function (d, e, c) { var b = []; if (c === "number") { b.push({ conditionName: "equals", conditionLabel: this.options.labels.equals }); b.push({ conditionName: "doesNotEqual", conditionLabel: this.options.labels.doesNotEqual }); b.push({ conditionName: "greaterThan", conditionLabel: this.options.labels.greaterThan }); b.push({ conditionName: "lessThan", conditionLabel: this.options.labels.lessThan }); b.push({ conditionName: "greaterThanOrEqualTo", conditionLabel: this.options.labels.greaterThanOrEqualTo }); b.push({ conditionName: "lessThanOrEqualTo", conditionLabel: this.options.labels.lessThanOrEqualTo }) } else { if (c === "bool" || c === "boolean") { b.push({ conditionName: "true", conditionLabel: this.options.labels.trueLabel }); b.push({ conditionName: "false", conditionLabel: this.options.labels.falseLabel }) } else { if (c === "date") { b.push({ conditionName: "on", conditionLabel: this.options.labels.on }); b.push({ conditionName: "notOn", conditionLabel: this.options.labels.notOn }); b.push({ conditionName: "after", conditionLabel: this.options.labels.after }); b.push({ conditionName: "before", conditionLabel: this.options.labels.before }); b.push({ conditionName: "today", conditionLabel: this.options.labels.today }); b.push({ conditionName: "yesterday", conditionLabel: this.options.labels.yesterday }); b.push({ conditionName: "thisMonth", conditionLabel: this.options.labels.thisMonth }); b.push({ conditionName: "lastMonth", conditionLabel: this.options.labels.lastMonth }); b.push({ conditionName: "nextMonth", conditionLabel: this.options.labels.nextMonth }); b.push({ conditionName: "thisYear", conditionLabel: this.options.labels.thisYear }); b.push({ conditionName: "lastYear", conditionLabel: this.options.labels.lastYear }); b.push({ conditionName: "nextYear", conditionLabel: this.options.labels.nextYear }) } else { b.push({ conditionName: "startsWith", conditionLabel: this.options.labels.startsWith }); b.push({ conditionName: "endsWith", conditionLabel: this.options.labels.endsWith }); b.push({ conditionName: "contains", conditionLabel: this.options.labels.contains }); b.push({ conditionName: "doesNotContain", conditionLabel: this.options.labels.doesNotContain }); b.push({ conditionName: "equals", conditionLabel: this.options.labels.equals }); b.push({ conditionName: "doesNotEqual", conditionLabel: this.options.labels.doesNotEqual }) } } } if (this.options.showEmptyConditions) { b.push({ conditionName: "empty", conditionLabel: this.options.labels.empty }); b.push({ conditionName: "notEmpty", conditionLabel: this.options.labels.notEmpty }) } if (this.options.showNullConditions) { b.push({ conditionName: "null", conditionLabel: this.options.labels.nullLabel }); b.push({ conditionName: "notNull", conditionLabel: this.options.labels.notNull }) } d.empty(); a.tmpl(this.options.filterDialogFilterConditionTemplate, b).appendTo(d); if (a.browser.msie) { d.parent().append(d); d.width(d.width()) } }, _removeFilterFromDialog: function (c) { var b = a("#" + this.grid.container().attr("id") + "_dialog table tbody"); a(c.target).closest("tr").remove(); if (b.children().length < this.options.filterDialogMaxFilterCount) { a("#" + this.grid.container().attr("id") + "_dialog_error").hide() } }, _renderStringFilterDropDown: function (b, e) { var c = this._renderDropDownElement(b, e), d; if (this.options.filterDropDownItemIcons !== true) { a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).addClass(this.css.filterDropDownListItemClear)).text(this.options.labels.clear).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "startsWith")).text(this.options.labels.startsWith).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "endsWith")).text(this.options.labels.endsWith).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "contains")).text(this.options.labels.contains).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "doesNotContain")).text(this.options.labels.doesNotContain).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "equals")).text(this.options.labels.equals).addClass("ui-corner-all"); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "doesNotEqual")).text(this.options.labels.doesNotEqual).addClass("ui-corner-all") } else { d = { itemClass: this.css.filterDropDownListItemWithIcons, imgContainerClass: this.css.filterItemIconContainer, imgClass: this.css.filterItemIconClear, textClass: this.css.filterDropDownListItemTextContainer, text: this.options.labels.clear }; a.tmpl(this._ft, d).appendTo(c); d.text = this.options.labels.startsWith; d.imgClass = this.css.filterItemIconStartsWith; a.tmpl(this._ft, d).appendTo(c).data("cond", "startsWith"); d.text = this.options.labels.endsWith; d.imgClass = this.css.filterItemIconEndsWith; a.tmpl(this._ft, d).appendTo(c).data("cond", "endsWith"); d.text = this.options.labels.contains; d.imgClass = this.css.filterItemIconContains; a.tmpl(this._ft, d).appendTo(c).data("cond", "contains"); d.text = this.options.labels.doesNotContain; d.imgClass = this.css.filterItemIconDoesNotContain; a.tmpl(this._ft, d).appendTo(c).data("cond", "doesNotContain"); d.text = this.options.labels.equals; d.imgClass = this.css.filterItemIconEquals; a.tmpl(this._ft, d).appendTo(c).data("cond", "equals"); d.text = this.options.labels.doesNotEqual; d.imgClass = this.css.filterItemIconDoesNotEqual; a.tmpl(this._ft, d).appendTo(c).data("cond", "doesNotEqual") } return c }, _renderNumericFilterDropDown: function (b, e) { var c = this._renderDropDownElement(b, e), d; if (this.options.filterDropDownItemIcons !== true) { a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).addClass(this.css.filterDropDownListItemClear)).text(this.options.labels.clear); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "equals")).text(this.options.labels.equals); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "doesNotEqual")).text(this.options.labels.doesNotEqual); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "greaterThan")).text(this.options.labels.greaterThan); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "lessThan")).text(this.options.labels.lessThan); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "greaterThanOrEqualTo")).text(this.options.labels.greaterThanOrEqualTo); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "lessThanOrEqualTo")).text(this.options.labels.lessThanOrEqualTo) } else { d = { itemClass: this.css.filterDropDownListItemWithIcons, imgContainerClass: this.css.filterItemIconContainer, imgClass: this.css.filterItemIconClear, textClass: this.css.filterDropDownListItemTextContainer, text: this.options.labels.clear }; a.tmpl(this._ft, d).appendTo(c); d.text = this.options.labels.equals; d.imgClass = this.css.filterItemIconEquals; a.tmpl(this._ft, d).appendTo(c).data("cond", "equals"); d.text = this.options.labels.doesNotEqual; d.imgClass = this.css.filterItemIconDoesNotEqual; a.tmpl(this._ft, d).appendTo(c).data("cond", "doesNotEqual"); d.text = this.options.labels.greaterThan; d.imgClass = this.css.filterItemIconGreaterThan; a.tmpl(this._ft, d).appendTo(c).data("cond", "greaterThan"); d.text = this.options.labels.lessThan; d.imgClass = this.css.filterItemIconLessThan; a.tmpl(this._ft, d).appendTo(c).data("cond", "lessThan"); d.text = this.options.labels.greaterThanOrEqualTo; d.imgClass = this.css.filterItemIconGreaterThanOrEqualTo; a.tmpl(this._ft, d).appendTo(c).data("cond", "greaterThanOrEqualTo"); d.text = this.options.labels.lessThanOrEqualTo; d.imgClass = this.css.filterItemIconLessThanOrEqualTo; a.tmpl(this._ft, d).appendTo(c).data("cond", "lessThanOrEqualTo") } return c }, _renderDateFilterDropDown: function (b, e) { var c = this._renderDropDownElement(b, e), d; if (this.options.filterDropDownItemIcons !== true) { a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).addClass(this.css.filterDropDownListItemClear)).text(this.options.labels.clear); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "on")).text(this.options.labels.on); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "notOn")).text(this.options.labels.notOn); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "after")).text(this.options.labels.after); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "before")).text(this.options.labels.before); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "today")).text(this.options.labels.today); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "yesterday")).text(this.options.labels.yesterday); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "thisMonth")).text(this.options.labels.thisMonth); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "lastMonth")).text(this.options.labels.lastMonth); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "nextMonth")).text(this.options.labels.nextMonth); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "thisYear")).text(this.options.labels.thisYear); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "lastYear")).text(this.options.labels.lastYear); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "nextYear")).text(this.options.labels.nextYear) } else { d = { itemClass: this.css.filterDropDownListItemWithIcons, imgContainerClass: this.css.filterItemIconContainer, imgClass: this.css.filterItemIconClear, textClass: this.css.filterDropDownListItemTextContainer, text: this.options.labels.clear }; a.tmpl(this._ft, d).appendTo(c); d.text = this.options.labels.on; d.imgClass = this.css.filterItemIconOn; a.tmpl(this._ft, d).appendTo(c).data("cond", "on"); d.text = this.options.labels.notOn; d.imgClass = this.css.filterItemIconNotOn; a.tmpl(this._ft, d).appendTo(c).data("cond", "notOn"); d.text = this.options.labels.after; d.imgClass = this.css.filterItemIconAfter; a.tmpl(this._ft, d).appendTo(c).data("cond", "after"); d.text = this.options.labels.before; d.imgClass = this.css.filterItemIconBefore; a.tmpl(this._ft, d).appendTo(c).data("cond", "before"); d.text = this.options.labels.today; d.imgClass = this.css.filterItemIconToday; a.tmpl(this._ft, d).appendTo(c).data("cond", "today"); d.text = this.options.labels.yesterday; d.imgClass = this.css.filterItemIconYesterday; a.tmpl(this._ft, d).appendTo(c).data("cond", "yesterday"); d.text = this.options.labels.thisMonth; d.imgClass = this.css.filterItemIconThisMonth; a.tmpl(this._ft, d).appendTo(c).data("cond", "thisMonth"); d.text = this.options.labels.lastMonth; d.imgClass = this.css.filterItemIconLastMonth; a.tmpl(this._ft, d).appendTo(c).data("cond", "lastMonth"); d.text = this.options.labels.nextMonth; d.imgClass = this.css.filterItemIconNextMonth; a.tmpl(this._ft, d).appendTo(c).data("cond", "nextMonth"); d.text = this.options.labels.thisYear; d.imgClass = this.css.filterItemIconThisYear; a.tmpl(this._ft, d).appendTo(c).data("cond", "thisYear"); d.text = this.options.labels.lastYear; d.imgClass = this.css.filterItemIconLastYear; a.tmpl(this._ft, d).appendTo(c).data("cond", "lastYear"); d.text = this.options.labels.nextYear; d.imgClass = this.css.filterItemIconNextYear; a.tmpl(this._ft, d).appendTo(c).data("cond", "nextYear") } return c }, _renderBooleanFilterDropDown: function (b, e) { var c = this._renderDropDownElement(b, e), d; if (this.options.filterDropDownItemIcons !== true) { a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).addClass(this.css.filterDropDownListItemClear)).text(this.options.labels.clear); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "true")).text(this.options.labels.trueLabel); a("<a></a>").appendTo(a("<li></li>").appendTo(c).addClass(this.css.filterDropDownListItem).data("cond", "false")).text(this.options.labels.falseLabel) } else { d = { itemClass: this.css.filterDropDownListItemWithIcons, imgContainerClass: this.css.filterItemIconContainer, imgClass: this.css.filterItemIconClear, textClass: this.css.filterDropDownListItemTextContainer, text: this.options.labels.clear }; a.tmpl(this._ft, d).appendTo(c); d.text = this.options.labels.trueLabel; d.imgClass = this.css.filterItemIconTrue; a.tmpl(this._ft, d).appendTo(c).data("cond", "true"); d.text = this.options.labels.falseLabel; d.imgClass = this.css.filterItemIconFalse; a.tmpl(this._ft, d).appendTo(c).data("cond", "false") } return c }, _renderDropDownElement: function (b, e) { var c, d; c = a("<ul></ul>").appendTo("body").addClass(this.css.filterDropDownList); d = a("<div></div>").appendTo("body").attr("id", b).addClass(this.css.filterDropDown).css("overflow", "hidden").css("position", "absolute").hide(); if (!a.browser.msie) { d.css("overflow-y", "auto") } d.remove(); if (this.options.filterDropDownWidth > 0) { c.css("width", this.options.filterDropDownWidth) } if (this.options.filterDropDownHeight > 0) { d.css("height", this.options.filterDropDownHeight) } c.data("colName", e); c.wrap(d); c.parent().data("efh", "1"); a("#" + b + " li").live({ mousedown: a.proxy(this._selectDropDownItem, this), mouseover: a.proxy(this._hoverDropDownItem, this), mouseout: a.proxy(this._unhoverDropDownItem, this) }); return c }, _hoverButton: function (c) { var b = a(c.currentTarget).find("span"); if (this.options.mode === "advanced") { b.addClass(this.css.filterButtonAdvancedHover) } else { b.addClass(this.css.filterButtonHover) } }, _unhoverButton: function (c) { var b = a(c.currentTarget).find("span"); if (this.options.mode === "advanced") { b.removeClass(this.css.filterButtonAdvancedHover) } else { b.removeClass(this.css.filterButtonHover) } }, _activateButton: function (c) { var b = a(c.currentTarget).find("span"); if (this._dontApplyStyles) { this._dontApplyStyles = false; return } if (this.options.mode === "advanced") { b.addClass(this.css.filterButtonAdvancedActive) } else { b.addClass(this.css.filterButtonActive) } }, _deactivateButton: function (b) { var c = a(b.target).find("span"); c.removeClass(this.css.filterButtonAdvancedActive); c.removeClass(this.css.filterButtonActive) }, _toggleDropDown: function (k, h, j) { var c = a(k.currentTarget), g = c.attr("id"), b, i, l, f, d, m = true, e = c.find("span"); if (this._animating && g === this._animatingId) { return } b = a("#" + g.substring(0, g.indexOf("_button"))); f = 0; d = 0; if (!(!b.is(":visible") && h === true)) { this._animating = true; this._animatingId = g } if (this._openingAnimation !== true) { this._dontFocus = j } else { this._dontFocus = null } this._isClosing = false; if (b.is(":visible")) { m = this._trigger(this.events.dropDownClosing, null, { dropDown: b, owner: this }); this._isClosing = true } else { if (!h) { m = this._trigger(this.events.dropDownOpening, null, { dropDown: b, owner: this }) } } if (m) { i = e.offset().left; l = e.offset().top + e.outerHeight(); if (b.offset().left !== i && b.offset().top !== l) { b.css("left", i).css("top", l) } this._currentTarget = c; this._dd = b; if (!this._isClosing) { this._opendd = b } if (a.browser.msie) { b.css("overflow-x", "hidden"); b.css("overflow-y", "hidden") } if (h !== undefined && h === true) { if (b.is(":visible")) { if (this.options.filterDropDownAnimations !== "none") { b.hide(this.options.filterDropDownAnimationDuration, a.proxy(this._animationEnd, this)) } else { b.hide(); this._trigger(this.events.dropDownClosed, null, { dropDown: b, owner: this }) } } } else { if (this.options.filterDropDownAnimations !== "none") { if (b.is(":visible")) { this._closingTarget = this._currentTarget } else { this._openingTarget = this._currentTarget; this._openingAnimation = true } b.toggle(this.options.filterDropDownAnimationDuration, a.proxy(this._animationEnd, this)) } else { b.toggle(); if (this._isClosing) { this._trigger(this.events.dropDownClosed, null, { dropDown: b, owner: this }) } else { this._trigger(this.events.dropDownOpened, null, { dropDown: b, owner: this }) } if (j !== true) { this._dontApplyStyles = true; c.focus() } } } } }, _animationEnd: function () { if (this._isClosing === true) { this._trigger(this.events.dropDownClosed, null, { dropDown: this._dd, owner: this }) } else { this._trigger(this.events.dropDownOpened, null, { dropDown: this._opendd, owner: this }); this._openingAnimation = false } if (this._dd && a.browser.msie) { this._dd.css("overflow-y", "auto") } this._isClosing = null; if (this._dontFocus !== true) { this._dontApplyStyles = true; this._openingTarget.focus() } this._animating = false }, _toggleDropDownKeyboard: function (b) { if (b.keyCode === a.ui.keyCode.ENTER || b.keyCode === a.ui.keyCode.SPACE) { b.stopPropagation(); b.preventDefault(); this._toggleDropDown(b) } else { if (b.keyCode === a.ui.keyCode.DOWN) { b.stopPropagation(); b.preventDefault(); this._selectDropDownItem(b, "next") } else { if (b.keyCode === a.ui.keyCode.UP) { b.stopPropagation(); b.preventDefault(); this._selectDropDownItem(b, "prev") } } } }, _closeDropDown: function (c) { var b = a(c.currentTarget).find("span"); if (this._openingTarget && c.target.id === this._openingTarget.attr("id") && this._openingAnimation === true) { return } this._toggleDropDown(c, true, true); if (this._dontApplyStyles) { this._dontApplyStyles = false; return } if (this.options.mode === "advanced") { b.removeClass(this.css.filterButtonAdvancedActive) } else { b.removeClass(this.css.filterButtonActive) } }, _selectDropDownItem: function (h, e) { var d = a(h.currentTarget), i, k, f, g, c, j, b; if (d.find("input").length > 0 && this.options.mode === "advanced") { return } if (e === "next" || e === "prev") { g = a("#" + d.attr("id").substring(0, d.attr("id").indexOf("_button"))).find("ul") } if (e === "next") { if (g.data("selectedItem") === undefined) { d = g.find("li:first") } else { d = g.find("li:nth-child(" + (g.data("selectedItem") + 1) + ")"); if (d.next().length === 0) { d = g.find("li:first") } else { d = d.next() } } } if (e === "prev") { if (g.data("selectedItem") === undefined) { d = g.find("li:last") } else { d = g.find("li:nth-child(" + (g.data("selectedItem") + 1) + ")"); if (d.prev().length === 0) { d = g.find("li:last") } else { d = d.prev() } } } i = d.data("cond"); c = a("#" + d.closest("div").attr("id") + "_button"); if (d.data("cond") === undefined) { c.attr("title", this.options.tooltipTemplate.replace("${condition}", this.options.labels.noFilter)) } else { c.attr("title", this.options.tooltipTemplate.replace("${condition}", d.text())) } k = a("#" + d.closest("div").attr("id") + "_button").find("span").data("colIndex"); b = this.options.columnSettings[parseInt(k, 10)].condition; if (i !== undefined) { this.options.columnSettings[parseInt(k, 10)].condition = i } else { if (b === "empty" || b === "notEmpty" || b === "null" || b === "notNull" || !this._requiresEntry(b)) { this.options.columnSettings[parseInt(k, 10)].condition = this._getDefaultCondition(this.grid.options.columns[k].dataType) } } f = d.parent().data("selectedItem"); if (f !== undefined) { d.parent().find("li:nth-child(" + (f + 1) + ")").removeClass(this.css.filterDropDownListItemActive) } d.addClass(this.css.filterDropDownListItemActive); d.parent().data("selectedItem", a("li", d.parent()).index(d)); this._editors[k].element.igEditor("option", "nullText", this.options.nullTexts[i]); j = this._requiresEntry(i); if (d.hasClass("ui-iggrid-filterddlistitemclear") || (this.options.filterDropDownItemIcons === true && d.find(".ui-iggrid-filtericonclear").length > 0)) { if (!j || i === undefined) { this._editors[k].element.igEditor("option", "readOnly", false) } this._editors[k].value(null); this._filterDataSourceClear(this.grid.options.columns[k].key) } else { if (!j) { this._editors[k].element.igEditor("option", "readOnly", true); this._editorValueForCondition(i, this._editors[k]); this._filterInternal(k, this.grid.options.columns[k].key) } else { if (this._editors[k].value() !== "" && this._editors[k].value() !== null) { this._editors[k].value(null) } } if (j) { this._editors[k].element.igEditor("option", "readOnly", false) } if (e === undefined && i !== undefined) { this._editors[k].setFocus() } } }, _requiresEntry: function (b) { if (b === "true" || b === "false" || b === "today" || b === "yesterday" || b === "thisMonth" || b === "nextMonth" || b === "lastMonth" || b === "thisYear" || b === "lastYear" || b === "empty" || b === "notEmpty" || b === "null" || b === "notNull" || b === "nextYear") { return false } if (b === undefined || b === null) { return false } return true }, _editorValueForCondition: function (b, c) { var d = new Date(); if (b === "true") { c.value(true) } else { if (b === "false") { c.value(false) } else { if (b === "today") { c.value(new Date()) } else { if (b === "yesterday") { c.value(new Date(d.getFullYear(), d.getMonth(), d.getDate() - 1, 0, 0, 0, 0)) } else { c.value(null) } } } } }, _hoverDropDownItem: function (b) { if (a(b.currentTarget).find("input").length === 0) { a(b.currentTarget).addClass(this.css.filterDropDownListItemHover) } }, _unhoverDropDownItem: function (b) { a(b.currentTarget).removeClass(this.css.filterDropDownListItemHover) }, _virtualHorizontalScroll: function (b, c) { var f = c.startColIndex, d, e = this.grid.headersTable().find("th"); if (this._currentTarget) { this._toggleDropDown({ currentTarget: this._currentTarget }, true) } if (this.options.mode === "advanced" && this.options.advancedModeEditorsVisible !== true) { for (d = 0; d < this.grid._virtualColumnCount; d++) { a(e[d]).data("colName", this.grid.options.columns[d + f].key); a(e[d]).find("a").attr("id", this.grid.element[0].id + "_dd_" + this.grid.options.columns[d + f].key + "_button") } this._updateTooltips(this._currentAdvancedExpressions ? this._currentAdvancedExpressions : []) } else { throw new Error(a.ig.GridFiltering.locale.virtualizationSimpleFilteringNotAllowed) } }, _injectGrid: function (c, b) { this.grid = c; if (this.options.filterExprUrlKey) { this.grid.dataSource.settings.filtering.filterExprUrlKey = this.options.filterExprUrlKey } this.grid.dataSource.settings.filtering.caseSensitive = this.options.caseSensitive; if (this._headerRenderedHandler !== null) { this.grid.element.unbind("iggridheaderrendered", this._headerRenderedHandler) } this._headerRenderedHandler = a.proxy(this._headerRendered, this); this.grid.element.bind("iggridheaderrendered", this._headerRenderedHandler); this._initDefaultSettings(); this.grid.element.bind("iggriduidirty", a.proxy(this._onUIDirty, this)); this._virtualHorizontalScrollHandler = a.proxy(this._virtualHorizontalScroll, this); this.grid.element.bind("iggridvirtualhorizontalscroll", this._virtualHorizontalScrollHandler); if (((this.grid.options.virtualization === true && this.grid.options.width !== null) || this.grid.options.columnVirtualization === true) && this.options.mode === null) { this.options.mode = "advanced" } else { if (((this.grid.options.virtualization === false || (this.grid.options.virtualization === true && this.grid.options.width === null)) && this.grid.options.columnVirtualization === false) && this.options.mode === null) { this.options.mode = "simple" } else { if (this.options.mode === "simple" && (this.grid.options.virtualization === true || this.grid.options.columnVirtualization === true)) { throw new Error(a.ig.GridFiltering.locale.virtualizationSimpleFilteringNotAllowed) } } } } }); a.extend(a.ui.igGridFiltering, { version: "11.1.20111.2010" }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics Grid Selection feature requires jQuery to be loaded") } (function (a) { a.widget("ui.igGridSelection", { grid: null, css: { selectedCell: "ui-iggrid-selectedcell ui-state-active", selectedRow: "ui-iggrid-selectedrow ui-state-active", activeCell: "ui-iggrid-activecell ui-state-focus", activeRow: "ui-iggrid-activerow ui-state-focus" }, options: { multipleSelection: false, mouseDragSelect: true, mode: "row", activation: true, wrapAround: true }, events: { rowSelectionChanging: "rowSelectionChanging", rowSelectionChanged: "rowSelectionChanged", cellSelectionChanging: "cellSelectionChanging", cellSelectionChanged: "cellSelectionChanged", activeCellChanging: "activeCellChanging", activeCellChanged: "activeCellChanged", activeRowChanging: "activeRowChanging", activeRowChanged: "activeRowChanged" }, _create: function () { this._isMouseDown = false; this._isDrag = false; this._registeredEvents = false }, _setOption: function (b, c) { a.Widget.prototype._setOption.apply(this, arguments); if (b === "mode") { throw new Error(a.ig.Grid.locale.optionChangeNotSupported + " " + b) } }, _dataRendered: function () { if (!this._registeredEvents) { this._registerEvents(); this._registeredEvents = true } else { this._registerTbodyEvents() } this._refresh(true); if (!this._initialSelectionInitialized) { if (this.options.selectedRowIndex !== undefined && this.options.selectedRowIndex !== null && this.options.selectedRowIndex >= 0) { if (this.options.selectedCellIndex === undefined) { this.selectRow(this.options.selectedRowIndex) } else { if (this.options.selectedCellIndex !== undefined && this.options.selectedRowIndex !== null && this.options.selectedCellIndex >= 0) { this.selectCell(this.options.selectedRowIndex, this.options.selectedCellIndex) } } } this._initialSelectionInitialized = true } }, _refresh: function (b) { if (!b || !this._firstCell) { this._firstCell = this.grid.element.find("tbody tr:nth-child(1) td:nth-child(1)"); if (!this._firstCell) { this._firstRow = this.grid.element.find("tbody tr:nth-child(1)") } } if (!b || !this._firstRow || !this._rowCount) { this._firstRow = this.grid.element.find("tbody tr:nth-child(1)"); if (this.grid.options.virtualization || this.grid.options.rowVirtualization) { this._rowCount = this.grid.dataSource.dataView().length } else { this._rowCount = this.grid.element.find("tbody tr").length } this._length = this._firstRow ? this._firstRow.children().length : 0 } }, _registerTbodyEvents: function () { if (!this._mouseDownHandler) { this._mouseDownHandler = a.proxy(this._mouseDown, this); this._selectStartHandler = a.proxy(this._selectStart, this); this._mouseMoveHandler = a.proxy(this._dragSelectChange, this); this._mouseUpHandler = a.proxy(this._selectInternal, this) } else { this.grid.element.find("tbody").unbind({ mousedown: this._mouseDownHandler, selectstart: this._selectStartHandler, mousemove: this._mouseMoveHandler, mouseup: this._mouseUpHandler }) } this.grid.element.find("tbody").bind({ mousedown: this._mouseDownHandler, selectstart: this._selectStartHandler, mousemove: this._mouseMoveHandler, mouseup: this._mouseUpHandler }) }, _registerEvents: function () { this._registerTbodyEvents(); a(document).bind({ mouseup: a.proxy(this._releaseMouse, this) }); if (this.grid.options.virtualization) { a("#" + this.grid.element[0].id + "_scrollContainer").bind({ scroll: a.proxy(this._releaseMouse, this) }) } else { a("#" + this.grid.element[0].id + "_scroll").bind({ scroll: a.proxy(this._releaseMouse, this) }) } this._keyDownHandler = a.proxy(this._navigate, this); this._focusHandler = a.proxy(this._navigateFocus, this); this._markMouseDownHandler = a.proxy(this._markMouseDown, this); if (this.grid.options.virtualization || this.grid.options.rowVirtualization) { a("#" + this.grid.element[0].id + "_displayContainer_a").bind({ keydown: this._keyDownHandler, focus: this._focusHandler }) } else { this.grid.container().bind({ keydown: this._keyDownHandler, focus: this._focusHandler }) } if (this.options.multipleSelection === true) { this.grid.element.addClass("ui-iggrid-canceltextselection") } }, _unregisterEvents: function () { this.grid.element.unbind("mousedown", this._mouseDownHandler); this.grid.element.unbind("selectstart", this._selectStartHandler); this.grid.element.unbind("mousemove", this._mouseMoveHandler); this.grid.element.unbind("mouseup", this._mouseUpHandler); this.grid.container().unbind("keydown", this._keyDownHandlerHandler); this.grid.container().unbind("focus", this._focusHandler); this.grid.container().unbind("mousedown", this._markMouseDownHandler); this.grid.element.unbind("iggriduisoftdirty", this._uiDirtyHandler); delete this._uiDirtyHandler; this.grid.element.removeClass("ui-iggrid-canceltextselection") }, _dragSelectChange: function (h) { var f = [], d, o, e, c, k, l, n, m, p, b = true, g = this.grid.options.virtualization || this.grid.options.rowVirtualization; if (h && this._suspend) { return } if (this.options.mouseDragSelect === false || this.options.multipleSelection === false || this.options.mode === "row") { return } if (this._isMouseDown === true) { this._isDrag = true } else { return } if (this._isMouseDown !== true || this.options.mode !== "cell") { return } n = this._cellFromEvent(h); if (!n) { return } if (n && this.grid._activeCell && n.index === this.grid._activeCell.index && n.rowIndex === this.grid._activeCell.rowIndex) { return } b = this._trigger(this.events.cellSelectionChanging, h, { cell: n, selectedCells: this.grid._selectedCells, owner: this, manual: false }); if (b) { if (this.options.activation === true) { this._activateCell(n, h) } d = this._firstDragCell.rowIndex; o = this._firstDragCell.index; e = n.rowIndex; c = n.index; if (e < d) { m = d; d = e; e = m } if (c < o) { m = o; o = c; c = m } this.clearSelection(true); if (g) { d -= this.grid._startRowIndex; e -= this.grid._startRowIndex } for (k = d; k <= e; k++) { for (l = o; l <= c; l++) { p = a(this.grid.cellAt(l, k)).addClass(this.css.selectedCell); this.grid._selectedCells.push(this._cellFromElement(p, k + this.grid._startRowIndex, l)) } } this._currentCells = f; this._trigger(this.events.cellSelectionChanged, h, { cell: n, selectedCells: this.grid._selectedCells, owner: this, manual: false }) } }, _cellFromEvent: function (c) { var b, d; d = a(c.originalEvent.originalTarget ? c.originalEvent.originalTarget : c.originalEvent.srcElement); b = d.is("td") ? d[0] : d.closest("td")[0]; return this._cellFromElement(b) }, _cellFromElement: function (j, f, b) { var c, i, d, h, g; c = a(j); i = c.parent(); if (f === undefined || b === undefined) { h = c.index(); d = i.index(); if (this.grid.options.virtualization || this.grid.options.rowVirtualization || this.grid.options.columnVirtualization) { if (this.grid._startRowIndex > 0) { d += this.grid._startRowIndex } if (this.grid._startColIndex > 0) { h += this.grid._startColIndex } } } else { h = b; d = f } if (h === -1) { return } g = this.grid.options.columns.length > 0 ? this.grid.options.columns[h].key : null; return { element: c, row: i, index: h, rowIndex: d, columnKey: g} }, _mouseDown: function (b) { var c = (this.grid.options.virtualization || this.grid.options.rowVirtualization || this.grid.options.columnVirtualization); if (b && this._suspend) { return } if (b.which === 2) { return } this._isMouseDown = true; if (this.options.multipleSelection === false && c) { a("#" + this.grid.element[0].id + "_displayContainer_a").focus() } if (this.options.mouseDragSelect === false || this.options.multipleSelection === false) { if (this.grid.options.virtualization || this.grid.options.rowVirtualization) { return false } else { return } } this._mouseLocation = { clientX: b.clientX, clientY: b.clientY }; this._firstDragCell = this._cellFromEvent(b); if (!b.ctrlKey && !b.shiftKey && this.options.multipleSelection !== true) { this.clearSelection(true) } this._isInternalFocus = true; if (this.options.multipleSelection === true && c) { a("#" + this.grid.element[0].id + "_displayContainer_a").focus() } else { this.grid.container().focus() } b.stopPropagation(); b.preventDefault() }, _markMouseDown: function (b) { this._isMouseDown = true }, _selectStart: function (b) { if (b && this._suspend) { return } if (this.options.mouseDragSelect === false || this.options.multipleSelection === false) { return false } b.stopPropagation(); b.preventDefault() }, _releaseMouse: function () { this._isMouseDown = false }, _selectInternal: function (j, d, e) { var p, l, m, o, f, k, b = true, c = false, q, n = false, g, h = this.grid.options.virtualization || this.grid.options.columnVirtualization; if (this.grid._startRowIndex === undefined) { this.grid._startRowIndex = 0 } if (j && this._suspend) { return } if (j !== null) { this._isMouseDown = false } if (j && j.which === 2) { return } if (this._isDrag === true && j !== null) { this._isDrag = false; return } if (j === null) { c = true; q = d; j = { originalEvent: {} }; if (e === null || e === undefined) { n = true; if (h) { j.originalEvent.originalTarget = this.grid.rowAt(q) } else { j.originalEvent.originalTarget = this.grid.rowAt(d) } } else { if (h) { j.originalEvent.originalTarget = this.grid.cellAt(e, q) } else { j.originalEvent.originalTarget = this.grid.cellAt(e, d) } } j.originalEvent.srcElement = j.originalEvent.originalTarget } p = j.originalEvent.originalTarget ? j.originalEvent.originalTarget : j.originalEvent.srcElement; m = a(p); l = m.closest("tr"); if (m.closest("th").length > 0) { return } if (j.ctrlKey) { this._mouseCtrlSelect = true } if (this.options.mode === "cell" && n === false) { p = m.is("td") ? m[0] : m.closest("td")[0]; o = this._cellFromElement(p); if (this.options.activation === true && this._rangeSelect !== true && this._singleShiftSelect !== true && this._ctrlSelect !== true) { if (this.grid._activeCell && o && this._mouseCtrlSelect !== true && o.index === this.grid._activeCell.index && o.rowIndex === this.grid._activeCell.rowIndex) { return } if (this._mouseCtrlSelect !== true) { this._activateCell(o, j) } else { if (this.grid._activeCell && (o.index !== this.grid._activeCell.index || o.rowIndex !== this.grid._activeCell.rowIndex)) { this._activateCell(o, j) } } } } else { if (c) { l = a(p) } g = l.index(); f = { element: l, index: g + this.grid._startRowIndex }; if (this.options.activation === true && this._rangeSelect !== true && this._singleShiftSelect !== true && this._ctrlSelect !== true) { if (this.grid._activeRow && f && this._mouseCtrlSelect !== true && f.index === this.grid._activeRow.index) { return } if (this._mouseCtrlSelect !== true) { this._activateRow(f, j) } else { if (this.grid._activeRow && f.index !== this.grid._activeRow.index) { this._activateRow(f, j) } } } } if (this.options.mode === "row" && this.grid._selectedRow && this._singleShiftSelect !== true && this._ctrlSelect !== true && this._mouseCtrlSelect !== true && f && f.index === this.grid._selectedRow.index) { return } if (this.options.mode === "cell" && this.grid._selectedCell && o && this._singleShiftSelect !== true && this._ctrlSelect !== true && this._mouseCtrlSelect !== true && o.index === this.grid._selectedCell.index && o.rowIndex === this.grid._selectedCell.rowIndex) { return } if ((c === false && this.options.mode === "cell") || (c === true && n === false)) { if ((c === false && !j.shiftKey) || this._ctrlSelect === true) { b = this._trigger(this.events.cellSelectionChanging, j, { cell: o, selectedCells: this.grid._selectedCells, owner: this, manual: c }) } if (b) { if (this.options.multipleSelection !== true) { if (this.grid._selectedCell !== null) { this.grid._selectedCell.element.removeClass(this.css.selectedCell) } } else { if (j.ctrlKey || this._ctrlSelect === true) { if (o.element.hasClass(this.css.selectedCell)) { for (k = 0; k < this.grid._selectedCells.length; k++) { if (this.grid._selectedCells[k].index === o.index && this.grid._selectedCells[k].rowIndex === o.rowIndex) { this.grid._selectedCells.remove(k) } } } else { this.grid._selectedCells.push(o) } } else { if (j.shiftKey) { this._shiftCellSelection(o); return } else { if (!c) { this.clearSelection(true) } if (!this._isCellSelected(o.rowIndex, o.index)) { this.grid._selectedCells.push(o) } if (!c) { this._realActiveCell = o } } } } if ((j.ctrlKey || this._ctrlSelect === true) && m.hasClass(this.css.selectedCell)) { o.element.removeClass(this.css.selectedCell) } else { o.element.addClass(this.css.selectedCell); this.grid._selectedCell = o } if (c === false || this._ctrlSelect === true) { this._trigger(this.events.cellSelectionChanged, j, { cell: o, selectedCells: this.grid._selectedCells, owner: this, manual: c }) } } } else { if ((c === false && this.options.mode === "row") || (c === true && n === true)) { if ((c === false && !j.shiftKey) || this._ctrlSelect === true) { b = this._trigger(this.events.rowSelectionChanging, j, { row: f, selectedRows: this.grid._selectedRows, owner: this, manual: c }) } if (b) { if (this.options.multipleSelection !== true) { if (this.grid._selectedRow !== null) { a(this.grid._selectedRow.element).children().removeClass(this.css.selectedCell) } } else { if (j.ctrlKey || this._ctrlSelect === true) { if (f.element.children().hasClass(this.css.selectedCell)) { for (k = 0; k < this.grid._selectedRows.length; k++) { if (this.grid._selectedRows[k].index === f.index) { this.grid._selectedRows.remove(k) } } } else { this.grid._selectedRows.push(f) } } else { if (j.shiftKey) { this._shiftRowSelection(f); return } else { if (!c) { this.clearSelection(true) } this.grid._selectedRows.push(f); if (!c) { this._realActiveRow = f } } } } if ((j.ctrlKey || this._ctrlSelect === true) && f.element.children().hasClass(this.css.selectedCell)) { f.element.removeClass(this.css.selectedRow); f.element.children().removeClass(this.css.selectedCell) } else { if (l.is("tr")) { l.children().addClass(this.css.selectedCell) } } this.grid._selectedRow = f; if (c === false || this._ctrlSelect === true) { this._trigger(this.events.rowSelectionChanged, j, { row: f, selectedRows: this.grid._selectedRows, owner: this, manual: c }) } } } } this._mouseCtrlSelect = false }, _shiftRowSelection: function (d, e, j, f, g) { var b, k, h, c = true; if (this.grid._selectedRows.length === 0) { this._singleShiftSelect = true; c = this._trigger(this.events.rowSelectionChanging, null, { row: d, startIndex: d.index, endIndex: d.index, selectedRows: this.grid._selectedRows, owner: this, manual: false }); if (c) { this.selectRow(d.index); this._trigger(this.events.rowSelectionChanged, null, { row: d, selectedRows: this.grid._selectedRows, owner: this, manual: false }) } this._singleShiftSelect = false; return } h = d.index; k = this.grid._selectedRows[0].index; c = this._trigger(this.events.rowSelectionChanging, null, { row: d, startIndex: k, endIndex: h, selectedRows: this.grid._selectedRows, owner: this, manual: false }); if (c) { if (!j) { this._rangeSelect = true; if (this.grid._selectedRows.length > 0 && this.grid._selectedRows[0].index < d.index) { if (e !== false) { this.clearSelection(true) } for (b = k; b <= h; b++) { this.selectRow(b) } } if (this.grid._selectedRows.length > 0 && this.grid._selectedRows[0].index > d.index) { if (e !== false) { this.clearSelection(true) } for (b = k; b >= h; b--) { this.selectRow(b) } } this._rangeSelect = false } else { this._singleShiftSelect = true; if (g) { this._activateRow(d, g) } if (this._isRowSelected(this.grid._activeRow.index)) { this.deselectRow(f.index) } else { this.selectRow(this.grid._activeRow.index) } this._singleShiftSelect = false } this._trigger(this.events.rowSelectionChanged, null, { row: d, selectedRows: this.grid._selectedRows, owner: this, manual: false }) } }, _shiftCellSelection: function (t, e, h, q, m) { var f, s, c, o, l, n, k, b = true, g = 0, p = Number.MAX_VALUE, r = 0, d = Number.MAX_VALUE; if (this.grid._selectedCells.length === 0) { this._singleShiftSelect = true; b = this._trigger(this.events.cellSelectionChanging, null, { cell: t, firstRowIndex: t.rowIndex, lastRowIndex: t.rowIndex, firstColumnIndex: t.index, lastColumnIndex: t.index, selectedCells: this.grid._selectedCells, owner: this, manual: false }); if (b) { this.selectCell(t.rowIndex, t.index); this._trigger(this.events.cellSelectionChanged, null, { cell: t, selectedCells: this.grid._selectedCells, owner: this, manual: false }) } this._singleShiftSelect = false; return } f = this.grid._selectedCells[0]; s = f.rowIndex; c = t.rowIndex; o = f.index; l = t.index; b = this._trigger(this.events.cellSelectionChanging, null, { cell: t, firstRowIndex: s, lastRowIndex: c, firstColumnIndex: o, lastColumnIndex: l, selectedCells: this.grid._selectedCells, owner: this, manual: false }); if (b) { if (e !== false) { this.clearSelection(true) } if (!h) { this._rangeSelect = true; if (s <= c) { for (n = s; n <= c; n++) { if (o <= l) { for (k = o; k <= l; k++) { this.selectCell(n, k) } } else { for (k = o; k >= l; k--) { this.selectCell(n, k) } } } } else { for (n = s; n >= c; n--) { if (o <= l) { for (k = o; k <= l; k++) { this.selectCell(n, k) } } else { for (k = o; k >= l; k--) { this.selectCell(n, k) } } } } this._rangeSelect = false } else { this._singleShiftSelect = true; if (m) { this._activateCell(t, m) } if (this._isCellSelected(this.grid._activeCell.rowIndex, this.grid._activeCell.index)) { this.deselectCell(q.rowIndex, q.index); for (n = 0; n < this.grid._selectedCells.length; n++) { if (this.grid._selectedCells[n].rowIndex > g) { g = this.grid._selectedCells[n].rowIndex } if (this.grid._selectedCells[n].rowIndex < p) { p = this.grid._selectedCells[n].rowIndex } if (this.grid._selectedCells[n].index > r) { r = this.grid._selectedCells[n].index } if (this.grid._selectedCells[n].index < d) { d = this.grid._selectedCells[n].index } } if (Math.abs(p - g) > 0 && Math.abs(this.grid._activeCell.index - q.index) > 0) { if (p <= g) { for (n = p; n <= g; n++) { this.deselectCell(n, q.index) } } else { for (n = p; n >= g; n--) { this.deselectCell(n, q.index) } } } else { if (Math.abs(d - r) > 0 && Math.abs(this.grid._activeCell.rowIndex - q.rowIndex) > 0) { if (d <= r) { for (n = d; n <= r; n++) { this.deselectCell(q.rowIndex, n) } } else { for (n = d; n >= r; n--) { this.deselectCell(q.rowIndex, n) } } } } } else { this.selectCell(this.grid._activeCell.rowIndex, this.grid._activeCell.index); for (n = 0; n < this.grid._selectedCells.length; n++) { if (this.grid._selectedCells[n].rowIndex > g) { g = this.grid._selectedCells[n].rowIndex } if (this.grid._selectedCells[n].rowIndex < p) { p = this.grid._selectedCells[n].rowIndex } if (this.grid._selectedCells[n].index > r) { r = this.grid._selectedCells[n].index } if (this.grid._selectedCells[n].index < d) { d = this.grid._selectedCells[n].index } } if (Math.abs(p - g) > 0 && Math.abs(this.grid._activeCell.index - q.index) > 0) { if (p <= g) { for (n = p; n <= g; n++) { this.selectCell(n, this.grid._activeCell.index) } } else { for (n = p; n >= g; n--) { this.selectCell(n, this.grid._activeCell.index) } } } else { if (Math.abs(d - r) > 0 && Math.abs(this.grid._activeCell.rowIndex - q.rowIndex) > 0) { if (d <= r) { for (n = d; n <= r; n++) { this.selectCell(this.grid._activeCell.rowIndex, n) } } else { for (n = d; n >= r; n--) { this.selectCell(this.grid._activeCell.rowIndex, n) } } } } } this._singleShiftSelect = false } this._trigger(this.events.cellSelectionChanged, null, { cell: t, selectedCells: this.grid._selectedCells, owner: this, manual: false }) } }, _navigate: function (d) { var b, c, f, e = a("#" + this.grid.element[0].id + "_displayContainer_a"); if (d && this._suspend) { return } if (this._isMouseDown === true) { return } if (this.grid.options.virtualization) { if (a.browser.msie && document.activeElement && (document.activeElement.id !== e.attr("id") && !a(document.activeElement).is("td"))) { return } else { if (!a.browser.msie && d.target.id !== e.attr("id")) { return } } } else { if (a.browser.msie && document.activeElement && (document.activeElement.id !== this.grid.container().attr("id") && !a(document.activeElement).is("td"))) { return } else { if (!a.browser.msie && d.target.id !== this.grid.container().attr("id")) { return } } } c = this.grid.options.columns.length > 0 ? this.grid.options.columns[0].key : null; b = this._firstCell; f = this._firstRow; if (this.options.activation === true) { if (this.options.mode === "cell") { if (this.options.multipleSelection === true) { if (this.grid._activeCell === null || this.grid._activeCell === undefined) { this.selectCell(0, 0) } else { this._navigateCell(d, false) } } else { if ((this.grid._activeCell === null && this.grid._selectedCell === null) || (this.grid._activeCell === undefined && this.grid._selectedCell === undefined)) { this.selectCell(0, 0) } else { this._navigateCell(d, true) } } } else { if (this.options.multipleSelection === true) { if (this.grid._activeRow === null || this.grid._activeRow === undefined) { this.selectRow(0) } else { this._navigateRow(d, false) } } else { if ((this.grid._activeRow === null && this.grid._selectedRow === null) || (this.grid._activeRow === undefined && this.grid._selectedRow === undefined)) { this.selectRow(0) } else { this._navigateRow(d, true) } } } } }, _navigateFocus: function (b) { if ((a.browser.mozilla && b.originalEvent && a(b.originalEvent.explicitOriginalTarget).is("th"))) { return } this._navigate(b) }, _navigateCell: function (h, j) { var l, m, c, d, k = this.grid._activeCell, p, o, n, f, i, b = true, g, q = this.grid._startRowIndex, e = this.grid._startColIndex; g = this.grid.options.virtualization || this.grid.options.rowVirtualization; if (q === undefined || q === null) { q = 0 } if (e === undefined || q === null) { e = 0 } if (g) { c = k.index - e; d = k.rowIndex - q } else { c = k.index; d = k.rowIndex } p = this._firstRow; o = this._rowCount; f = this._length; if (h.keyCode === a.ui.keyCode.ENTER || h.keyCode === a.ui.keyCode.SPACE) { l = c; m = d; if (h.ctrlKey && this._isCellSelected(d + q, c + e)) { b = this._trigger(this.events.cellSelectionChanging, h, { cell: k, selectedCells: this.grid._selectedCells, owner: this, manual: false }); if (b) { this.deselectCell(d + q, c + e); this._trigger(this.events.cellSelectionChanged, h, { cell: k, selectedCells: this.grid._selectedCells, owner: this, manual: false }) } } else { if (h.ctrlKey || !this._isCellSelected(d, c)) { this._ctrlSelect = true; this._selectInternal(null, d, c); this._ctrlSelect = false } } } else { if (h.keyCode === a.ui.keyCode.DOWN) { l = c; m = d + 1; if (this._realActiveCell !== null && this._realActiveCell !== undefined && this.options.multipleSelection === true && this.grid._selectedCells.length > 1 && !h.shiftKey && !h.ctrlKey) { l = this._realActiveCell.index - e; m = this._realActiveCell.rowIndex + 1 - q } if (m > o - 1 - q && this.options.wrapAround === true && !g) { m = 0 } else { if (m > o - 1 - q && this.options.wrapAround === false) { return } } } else { if (h.keyCode === a.ui.keyCode.UP) { l = c; m = d - 1; if (this._realActiveCell !== null && this._realActiveCell !== undefined && this.options.multipleSelection === true && this.grid._selectedCells.length > 1 && !h.shiftKey && !h.ctrlKey) { l = this._realActiveCell.index - e; m = this._realActiveCell.rowIndex - 1 - q } if (!g) { if (m < 0 && this.options.wrapAround === true) { m = o - 1 } else { if (m < 0 && this.options.wrapAround === false) { return } } } } else { if (h.keyCode === a.ui.keyCode.LEFT) { l = c - 1; m = d; if (l < 0) { l = f - 1; m = d - 1 } if (this._realActiveCell !== null && this._realActiveCell !== undefined && this.options.multipleSelection === true && this.grid._selectedCells.length > 1 && !h.shiftKey && !h.ctrlKey) { l = this._realActiveCell.index - 1 - e; m = this._realActiveCell.rowIndex - q } if (!g) { if (m < 0 && this.options.wrapAround === true) { l = f - 1; m = o - 1 } else { if (m < 0 && this.options.wrapAround === false) { return } } } } else { if (h.keyCode === a.ui.keyCode.RIGHT) { l = c + 1; m = d; if (l >= f) { l = 0; m = d + 1 } if (this._realActiveCell !== null && this._realActiveCell !== undefined && this.options.multipleSelection === true && this.grid._selectedCells.length > 1 && !h.shiftKey && !h.ctrlKey) { l = this._realActiveCell.index + 1 - e; m = this._realActiveCell.rowIndex - q } if (!g) { if (m >= o && this.options.wrapAround === true) { l = 0; m = 0 } else { if (m >= o && this.options.wrapAround === false) { return } } } } else { return } } } } } if (g && m >= this.grid._virtualRowCount) { this._setScrollTop(this.grid.element.parent(), n, m > d ? "down" : "up", m); m = this.grid._virtualRowCount - 1; n = this.grid.cellAt(l, m) } else { if (g && m < 0 && q > 0) { this._setScrollTop(this.grid.element.parent(), n, "up", m); m = 0; n = this.grid.cellAt(l, m) } else { if (g && m < 0) { return } else { n = this.grid.cellAt(l, m) } } } if (!g) { this._setScrollTop(this.grid.element.parent(), n, m >= d ? "down" : "up", m); this._setScrollLeft(this.grid.element.parent(), n, l >= c ? "right" : "left", l) } if (n === undefined || n.length > 1) { return } if (h.keyCode !== a.ui.keyCode.ENTER && h.keyCode !== a.ui.keyCode.SPACE) { a(k.element).removeClass(this.css.activeCell); if (g) { i = { element: a(n), index: l + e, rowIndex: m + q, row: a(this.grid.rowAt(m)), columnKey: this.grid.options.columns[l].key} } else { i = { element: a(n), index: l, rowIndex: m, row: a(this.grid.rowAt(m)), columnKey: this.grid.options.columns[l].key} } if (h.ctrlKey && this.grid._activeCell && (this.grid._activeCell.index !== i.index || this.grid._activeCell.rowIndex !== i.rowIndex)) { this._activateCell(i, h) } if (!h.ctrlKey && h.shiftKey && this.options.multipleSelection === true) { this._shiftCellSelection(i, false, true, k, h) } else { if (!h.ctrlKey) { b = this._trigger(this.events.cellSelectionChanging, h, { cell: i, selectedCells: this.grid._selectedCells, owner: this, manual: false }); if (b) { this.clearSelection(true); this._selectInternal(null, m, l); this._trigger(this.events.cellSelectionChanged, h, { cell: i, selectedCells: this.grid._selectedCells, owner: this, manual: false }) } } } } h.preventDefault(); h.stopPropagation() }, _navigateRow: function (f, i) { var k, c, h = this.grid._activeRow, j, m, d, g, l, b = true, e, o = this.grid._startRowIndex, n = this.grid._startColIndex; e = this.grid.options.virtualization || this.grid.options.rowVirtualization; if (e) { c = h.index - o } else { c = h.index } j = this._firstRow; m = this._rowCount; d = this._length; if (f.keyCode === a.ui.keyCode.ENTER || f.keyCode === a.ui.keyCode.SPACE) { k = c; if (f.ctrlKey && this._isRowSelected(c)) { b = this._trigger(this.events.rowSelectionChanging, f, { row: h, selectedRows: this.grid._selectedRows, owner: this, manual: false }); if (b) { this.deselectRow(c); this._trigger(this.events.rowSelectionChanged, f, { row: h, selectedRows: this.grid._selectedRows, owner: this, manual: false }) } b = true } else { this._ctrlSelect = true; this._selectInternal(null, c); this._ctrlSelect = false } } else { if (f.keyCode === a.ui.keyCode.DOWN) { k = c + 1; if (this._realActiveRow !== null && this._realActiveRow !== undefined && this.options.multipleSelection === true && this.grid._selectedRows.length > 1 && !f.shiftKey && !f.ctrlKey) { k = this._realActiveRow.index + 1 } if (!e) { if (k > m - 1 && this.options.wrapAround === true) { k = 0 } else { if (k > m - 1 && this.options.wrapAround === false) { return } } } } else { if (f.keyCode === a.ui.keyCode.UP) { k = c - 1; if (this._realActiveRow !== null && this._realActiveRow !== undefined && this.options.multipleSelection === true && this.grid._selectedRows.length > 1 && !f.shiftKey && !f.ctrlKey) { k = this._realActiveRow.index - 1 } if (!e) { if (k < 0 && this.options.wrapAround === true) { k = m - 1 } else { if (k < 0 && this.options.wrapAround === false) { return } } } } else { return } } } f.preventDefault(); f.stopPropagation(); if (e && k >= this.grid._virtualRowCount) { this._setScrollTop(this.grid.element.parent(), l, k >= c ? "down" : "up", k); k = this.grid._virtualRowCount - 1; l = this.grid.rowAt(k) } else { if (e && k < 0 && o > 0) { this._setScrollTop(this.grid.element.parent(), l, "up", k); k = 0; l = this.grid.rowAt(k) } else { if (e && k < 0) { return } else { l = this.grid.rowAt(k) } } } if (l === undefined || l.length > 1) { return } if (!e) { this._setScrollTop(this.grid.element.parent(), l, k >= c ? "down" : "up", k) } if (f.keyCode !== a.ui.keyCode.ENTER && f.keyCode !== a.ui.keyCode.SPACE) { a(h.element).removeClass(this.css.activeRow); if (e) { g = { element: a(l), index: k + o} } else { g = { element: a(l), index: k} } if (f.ctrlKey && this.grid._activeRow && this.grid._activeRow.index !== g.index) { this._activateRow(g, f) } if (!f.ctrlKey && f.shiftKey && this.options.multipleSelection === true) { this._shiftRowSelection(g, false, true, h, f) } else { if (!f.ctrlKey) { b = this._trigger(this.events.rowSelectionChanging, f, { row: g, selectedRows: this.grid._selectedRows, owner: this, manual: false }); if (b) { this.clearSelection(true); this._selectInternal(null, k); this._trigger(this.events.rowSelectionChanged, f, { row: g, selectedRows: this.grid._selectedRows, owner: this, manual: false }) } } } } }, _setScrollTop: function (c, d, g, j) { var h = c.offset(), e = a(d).offset(), b, i, k, l, f; l = this.grid.options.virtualization === true || this.grid.options.rowVirtualization === true; b = l ? parseInt(this.grid.options.avgRowHeight, 10) : a(d).outerHeight(); if (!l) { i = e.top + b + this.grid._scrollbarWidth() > h.top + a(c).outerHeight(); k = e.top < h.top } else { i = b * (j + 1) >= parseInt(this.grid.options.height, 10); k = j < 0 } if (j === 0) { c[0].scrollTop = 0 } else { if (g === "down") { if (i) { if (!l) { f = c[0].scrollTop + e.top + this.grid._scrollbarWidth() - (h.top + c.outerHeight()) + a(d).outerHeight(); c[0].scrollTop = f } else { this._scrollVmanual(true) } } } else { if (k) { if (!l) { f = c[0].scrollTop - a(d).outerHeight(); c[0].scrollTop = f } else { this._scrollVmanual(false) } } } } }, _scrollVmanual: function (d) { var b = a("#" + this.grid.element[0].id + "_scrollContainer"), c = parseInt(this.grid.options.avgRowHeight, 10); this.grid._ignoreScroll = true; if (d) { b.scrollTop(b.scrollTop() + c) } else { b.scrollTop(b.scrollTop() - c) } this.grid._onVirtualVerticalScroll(); this.grid._ignoreScroll = false }, _setScrollLeft: function (b, c, e, g) { var f = b.offset(), d = a(c).offset(); if (g === 0) { b[0].scrollLeft = 0 } else { if (e === "right") { if (d.left + a(c).outerWidth() > f.left + a(b).outerWidth()) { b[0].scrollLeft = b[0].scrollLeft + d.left - (f.left + b.outerWidth()) + a(c).outerWidth() } } else { if (d.left < f.left) { b[0].scrollLeft = b[0].scrollLeft - a(c).outerWidth() } } } }, _isRowSelected: function (b) { var c; for (c = 0; c < this.grid._selectedRows.length; c++) { if (this.grid._selectedRows[c].index === b) { return true } } return false }, _isCellSelected: function (d, c) { var b; for (b = 0; b < this.grid._selectedCells.length; b++) { if (this.grid._selectedCells[b].index === c && this.grid._selectedCells[b].rowIndex === d) { return true } } return false }, _rs: function (k, m) { var f = m.dom, b = 0, c = 0, l = this.grid._activeCell, d = this.grid._activeRow, h = this.grid._startRowIndex, g = this.grid._startColIndex; for (b = 0; b < f.length; b++) { for (c = 0; c < f[b].length; c++) { if (this.options.mode === "cell") { if (this.options.multipleSelection) { if (this._isCellSelected(b + h, c + g)) { a(f[b][c]).addClass(this.css.selectedCell) } } else { if (this.grid._selectedCell) { if (b + h === this.grid._selectedCell.rowIndex && c + g === this.grid._selectedCell.index) { a(f[b][c]).addClass(this.css.selectedCell) } } } } else { if (this.options.multipleSelection) { if (this._isRowSelected(b + h)) { a(f[b][c]).addClass(this.css.selectedRow) } } else { if (this.grid._selectedRow) { if (b + h === this.grid._selectedRow.index) { a(f[b][c]).addClass(this.css.selectedRow) } } } } } } if (!a.browser.mozilla) { if (l) { a(f[l.rowIndex - h][l.index - g]).addClass(this.css.activeCell) } if (d) { a(f[d.index - h]).addClass(this.css.activeRow) } } }, selectCell: function (b, c) { this._selectInternal(null, b, c) }, deselectCell: function (b, d) { var c; if (this.options.multipleSelection === true) { for (c = 0; c < this.selectedCells().length; c++) { if (this.selectedCells()[c].index === d && this.selectedCells()[c].rowIndex === b) { this.selectedCells()[c].element.removeClass(this.css.selectedCell); this.selectedCells().remove(c); this.grid._selectedCell = null; break } } } else { if (this.selectedCell() !== null && this.selectedCell() !== undefined) { this.selectedCell().element.removeClass(this.css.selectedCell); this.grid._selectedCell = null } } }, selectRow: function (b) { this._selectInternal(null, b) }, deselectRow: function (b) { var c; if (this.options.multipleSelection === true) { for (c = 0; c < this.selectedRows().length; c++) { if (this.selectedRows()[c].index === b) { this.selectedRows()[c].element.removeClass(this.css.selectedRow); this.selectedRows()[c].element.children().removeClass(this.css.selectedCell); this.selectedRows().remove(c); this.grid._selectedRow = null; break } } } else { if (this.selectedRow() !== null && this.selectedRow() !== undefined) { this.selectedRow().element.removeClass(this.css.selectedRow); this.selectedRow().element.children().removeClass(this.css.selectedCell); this.grid._selectedRow = null } } }, _activateCell: function (d, c) { var b = true; b = this._trigger(this.events.activeCellChanging, c, { cell: d, owner: this }); if (b) { if (this.grid._activeCell) { a(this.grid._activeCell.element).removeClass(this.css.activeCell) } this.grid._activeCell = d; a(this.grid._activeCell.element).addClass(this.css.activeCell); this._trigger(this.events.activeCellChanged, c, { cell: d, owner: this }) } }, _activateRow: function (b, c) { var e = true, d = this.grid.options.virtualization || this.grid.options.rowVirtualization; e = this._trigger(this.events.activeRowChanging, c, { row: b, owner: this }); if (e) { if (this.grid._activeRow) { a(this.grid._activeRow.element).removeClass(this.css.activeRow) } this.grid._activeRow = b; a(this.grid._activeRow.element).addClass(this.css.activeRow); this._trigger(this.events.activeRowChanged, c, { row: b, owner: this }) } }, selectedCells: function () { return this.grid._selectedCells }, selectedRows: function () { return this.grid._selectedRows }, selectedCell: function () { return this.grid._selectedCell }, selectedRow: function () { return this.grid._selectedRow }, activeCell: function () { return this.grid._activeCell }, activeRow: function () { return this.grid._activeRow }, clearSelection: function (c, d) { var b, e = this.grid.options.virtualization || this.grid.options.rowVirtualization; for (b = 0; b < this.grid._selectedCells.length; b++) { if (!e || (e && this.grid._selectedCells[b].rowIndex - this.grid._startRowIndex >= 0)) { this.grid._selectedCells[b].element.removeClass(this.css.selectedCell) } } this.grid._selectedCells = []; for (b = 0; b < this.grid._selectedRows.length; b++) { if (!e || (e && this.grid._selectedRows[b].index - this.grid._startRowIndex >= 0)) { a(this.grid._selectedRows[b].element.children()).removeClass(this.css.selectedCell) } } this.grid._selectedRows = []; if (this.grid._selectedRow !== null && this.grid._selectedRow !== undefined) { if (e && this.grid._selectedRow.index - this.grid._startRowIndex >= 0) { a(this.grid.rowAt(this.grid._selectedRow.index - this.grid._startRowIndex)).children().removeClass(this.css.selectedCell) } else { a(this.grid._selectedRow.element.children()).removeClass(this.css.selectedCell) } this.grid._selectedRow = null } if (this.grid._selectedCell !== null && this.grid._selectedCell !== undefined) { if (e && this.grid._selectedCell.rowIndex - this.grid._startRowIndex >= 0) { a(this.grid.cellAt(this.grid._selectedCell.index, this.grid._selectedCell.rowIndex - this.grid._startRowIndex)).removeClass(this.css.selectedCell) } else { this.grid._selectedCell.element.removeClass(this.css.selectedCell) } this.grid._selectedCell = null } if (d) { this.grid._activeCell = null; this.grid._activeRow = null } if (!c) { if (this.grid._activeCell) { this.grid._activeCell.element.removeClass(this.css.activeCell); this.grid._activeCell = null } if (this.grid._activeRow) { this.grid._activeRow.element.removeClass(this.css.activeRow); this.grid._activeRow = null } } }, destroy: function () { this.clearSelection(); this._unregisterEvents(); a.Widget.prototype.destroy.call(this); return this }, _onUIDirty: function (b, c) { if (c.owner === this) { return } if (!this.grid.options.virtualization && !this.grid.options.rowVirtualization) { this._rowCount = this.grid.dataSource.dataView().length } this.clearSelection(true, true) }, _injectGrid: function (b) { this.grid = b; this.grid._activeCell = null; this.grid._selectedCell = null; this.grid._selectedRow = null; this.grid._activeRow = null; this.grid._selectedCells = []; this.grid._selectedRows = []; this.grid.element.bind("iggridvirtualrecordsrender", a.proxy(this._rs, this)); this._uiDirtyHandler = a.proxy(this._onUIDirty, this); this.grid.element.bind("iggriduisoftdirty", this._uiDirtyHandler) } }); a.extend(a.ui.igGridSelection, { version: "11.1.20111.2010" }) } (jQuery)); (function (a) { var d = function (f, e) { return f === null || f === undefined || (e && isNaN(f)) }, b = function (h, g) { g = h ? h.css(g) : 0; try { g = parseInt(g, 10) } catch (f) { } return (g && !isNaN(g)) ? g : 0 }, c = function (f) { if (f && f !== 1) { try { f.preventDefault(); f.stopPropagation() } catch (g) { } } }; a.widget("ui.igGridUpdating", { grid: null, options: { columnSettings: [{ columnKey: null, editorType: null, editorOptions: null, required: null, readOnly: null, validation: null, defaultValue: null}], editMode: "row", enableDeleteRow: true, enableAddRow: true, validation: false, locale: null, showDoneIcon: true, showCancelIcon: true, showAddRowIcon: true, showAddRowText: true, showDoneCancelButtons: true, showDeleteText: true, showDeleteIcon: true, autoCommit: true, startEditTriggers: "click,F2,enter" }, events: { editRowStarting: 0, editRowStarted: 1, editRowEnding: 2, editRowEnded: 3, editCellStarting: 4, editCellStarted: 5, editCellEnding: 6, editCellEnded: 7, rowAdding: 8, rowAdded: 9, rowDeleting: 10, rowDeleted: 11 }, css: { buttonContainer: "ui-iggrid-buttoncontainer ui-widget-content", button: "ui-iggrid-button ui-state-default", doneButton: "ui-iggrid-donebutton ui-priority-primary", cancelButton: "ui-iggrid-cancelbutton", deleteButton: "ui-iggrid-deletebutton ui-state-default", buttonHover: "ui-iggrid-buttonhover ui-state-hover", buttonDisabled: "ui-iggrid-buttondisabled ui-state-disabled", buttonActive: "ui-iggrid-buttonactive ui-state-active", doneIcon: "ui-iggrid-doneicon ui-icon ui-icon-check", cancelIcon: "ui-iggrid-cancelicon ui-icon ui-icon-cancel", editingCell: "ui-iggrid-editingcell", addRow: "ui-iggrid-addrow ui-widget-header", addRowHover: "ui-iggrid-addrowhover ui-state-hover", addRowActive: "ui-iggrid-addrowactive ui-state-active", addRowIcon: "ui-iggrid-addrowicon ui-icon ui-icon-circle-plus", deleteIcon: "ui-iggrid-deleteicon ui-icon ui-icon-circle-close", editor: "ui-iggrid-editor" }, locale: { done: "Done", doneTitle: "Stop editing and update", cancel: "Cancel", cancelTitle: "Stop editing and do not update", addRow: "Add new row", addRowTitle: "Click to start adding new row", deleteRow: "Delete", deleteRowTitle: "Delete row" }, startEdit: function (f, h, i) { var g = this.grid.cellAt(h, f); if (g) { return this._startEdit(a(g), i ? i : 1, 1) === 1 } }, startAddRowEdit: function (f) { var g = this._newTR; if (g) { return this._startEdit(a(g.children()[0]), f ? f : 1, 1, 1, this._addTR.children()[0].offsetHeight) === 1 } }, endEdit: function (f, g) { return !this._endEdit(g ? g : 1, f) }, findInvalid: function () { var e, f = this._editors; for (e in f) { if (f.hasOwnProperty(e) && f[e] && f[e].igEditor("validator") && !f[e].igEditor("isValid")) { return e } } }, isEditing: function () { return !!this._tds }, editorForKey: function (f) { var g = this._editors; return g ? g[f] : null }, editorForCell: function (h, g) { var j, f = this._key(h), i = this._editors; if (!i) { i = this._editors = {} } if (!(j = i[f]) && g) { j = i[f] = this._createEditor(h, f) } return j }, numberOfRows: function () { return this.grid.dataSource.dataView().length }, _setOption: function (g, e) { var f = this.options; if (f[g] === e) { return } this._endEdit(); this._doButtons(2); f[g] = e; if (g.indexOf("ddRow") > 0 || (g === "locale" && f.enableAddRow)) { this._headerRendered(); this.grid._initializeHeights() } }, _fire: function (g, j, h) { var i, f = this.events; if (h && j && j !== 1) { for (i in f) { if (f.hasOwnProperty(i) && f[i] === g) { return this._trigger(i, j, h) } } } return 1 }, _loc: function (f) { var g, e = this.options; if (d(g = e[f]) && d(g = e[f + "Text"])) { e = e.locale; if (typeof e === "string") { e = a.ui.igGridUpdating.locale[e] } if (!e || d(g = e[f])) { g = a.ui.igGridUpdating.locale.defaults[f] } } return d(g) ? this.locale[f] : g }, _div: function () { return this.grid.container() }, _headerRendered: function (e) { var j, n, f, m, p, l = this.css, g = this._addTR, k = this.options, h = this.grid; if (!k.enableAddRow || e === 1) { if (g) { g.remove(); this._newTR.remove(); this._newTR = this._addTR = null } return } p = this._loc("addRow"); p = (!p || !k.showAddRowText) ? "&nbsp;" : p; if (g) { g.find(".anr_t").attr("innerHTML", p); g.find(".anr_i").css("display", k.showAddRowIcon ? "inline-block" : "none") } j = this._div().find("thead"); if (!j || g) { return } n = k.showPlusIcon; m = h.options.columns; g = this._addTR = a("<tr />").addClass(l.addRow).appendTo(j); f = a('<td colspan="' + m.length + '"></td>').attr("title", this._loc("addRowTitle")).addClass(l.addRow).bind(this._evts).appendTo(g); f.attr("tabIndex", this._ti); this._addLeft = b(f, "paddingLeft"); a("<span />").css("display", k.showAddRowIcon ? "inline-block" : "none").addClass(l.addRowIcon).addClass("anr_i").appendTo(f); a("<span>" + p + "</span>").addClass("anr_t").appendTo(f); g = this._newTR = a("<tr />").appendTo(j).hide(); for (e = 0; e < m.length; e++) { f = a("<td>&nbsp;</td>").addClass(l.editingCell).appendTo(g) } }, _dataRendered: function () { if (this._wasInit) { return } this._scrollDiv(); this._div().bind(this._evts); this._wasInit = true }, _findCell: function (j) { var f = 0, g = a(j), h = this.grid.element[0]; if (!g.is("td")) { g = g.closest("td") } j = g; while (j && f++ < 5) { j = j.parent(); if (j && j[0] === h) { break } } return (f === 3 && this._col(g) >= 0 && this._row(g) >= 0) ? g : null }, _td: function () { var f, e = this._tds; if (e) { for (f in e) { if (e.hasOwnProperty(f) && e[f]) { return e[f] } } } }, _row: function (e) { return e ? e.parent().index() : -1 }, _col: function (e) { return e ? e.index() : -1 }, _colSet: function (f, h) { var e, g = this.options.columnSettings; if (!h) { h = this._key(f) } e = (g && h) ? g.length : 0; while (e-- > 0) { if (g[e].columnKey === h) { return g[e] } } }, _isSame: function (e, f) { return this._row(e) === this._row(f) && this._col(e) === this._col(f) }, _gridCol: function (h, f) { var g = -1, e = this.grid.options.columns; while (++g < e.length) { if (e[g].key === h) { return f ? g : e[g] } } }, _prime: function (e) { var f = this._gridCol(this.grid.options.primaryKey, 1); if (!d(f)) { e = e.parent()[0].childNodes[f]; f = d(f = e._txt) ? a(e).text() : f; e = this._gridCol(this.grid.options.primaryKey); if (e && e.dataType === "number" && !isNaN(e = parseFloat(f))) { f = e } return f } return this._row(e) }, _key: function (e) { var f = this.grid.options.columns, g = this._col(e); g = (f && g >= 0) ? f[g] : null; return g ? g.key : null }, _equals: function (e, f) { return e === f || (e && f && e.getTime && f.getTime && e.getTime() === f.getTime()) }, _val: function (f, h, e) { var i, k = this._adding, g = this.grid, l = this._row_, j = this._key(f); if (k) { i = this._colSet(f, j); if (i) { i = i.defaultValue } } else { i = g.getCellValue(l, j) } if (h) { if (k || !this._equals(i, h.value)) { if (e) { return (e[j] = h.value) } g.setCellValue(l, j, h.value, f[0], this.options.autoCommit) } return undefined } return i }, _nextTD: function (k, l, j) { var e, f, m, g, h, n = k.tbl.childNodes; if (!n || !(g = n[k.row])) { return } f = g.childNodes; m = f.length; e = k.col + l; g = k.row + (l ? l : 1); if (l) { if (e >= 0 && e < m) { h = f[k.col = e] } else { if (j) { h = (g >= 0 && g < n.length) ? n[k.row = g].childNodes[k.col = (l > 0) ? 0 : m - 1] : null } } } else { h = (g < n.length) ? n[k.row = g].childNodes[k.col = e] : null } k.td = h ? a(h) : null; return h ? k : null }, _nextEditor: function (j, i) { var k, f, g = null, h = this._editors; for (f in h) { if (h.hasOwnProperty(f)) { if (i && j === f) { return g } if (f) { k = h[f]; if (k && k[0] && k[0].offsetWidth > 0) { if (j === null) { return k } g = k } } if (j === f) { j = null } } } }, _nextEdit: function (i, f) { var g, h = this._td(); if (!h) { return } g = { tbl: h.parent().parent()[0], row: this._rowIndex, col: this._col(h) }; while (this._nextTD(g, f, 1)) { if (this._startEdit(g.td, i, 1)) { return } } this._endEdit(i, 1) }, _createEditor: function (n, s) { var k, l, p, g, e, q = this._gridCol(s), m = this.options, t = this.css, f = this, r = this.grid.options, i = this._xy, j = {}, h = this._colSet(n, s); if (h) { if (h.readOnly) { return null } l = h.editorOptions; if (l) { j = l } p = j.validatorOptions; l = h.required; if (l) { j.required = true } if (!p && (h.validation || l)) { p = {} } l = h.editorType; if (l) { j.type = l } } e = q ? q.format : null; if (!(l = j.type)) { g = q ? q.dataType : null; if (g === "bool") { j.textMode = "checkbox" } else { if (e === "currency" || e === "percent" || e === "date") { l = e } else { if (g === "number") { l = "numeric" } else { if (g === "date") { l = "date" } else { if (!g) { l = this._val(n); l = (typeof l === "number") ? "numeric" : ((l && l.getTime) ? "date" : null) } } } } } j.type = l } if (e === "int") { j.maxDecimals = 0 } else { if (e === "double" && !j.maxDecimals) { j.maxDecimals = 100 } else { if (e && l && l.toString().indexOf("date") === 0 && !j.dateInputFormat) { j.dateInputFormat = e } } } if (l === "datepicker" && !j.button) { j.button = "dropdown" } if (m.validation && !p) { p = {} } if (p) { p.bodyAsParent = false; j.validatorOptions = p; p.errorHidden = function () { f._error = null }; p.errorShowing = function () { if (!d(f._error) && f._error !== s) { return false } if (f._hideError && f._hideError > new Date().getTime()) { return false } }; p.errorShown = function () { f._error = s; if (f._butDone) { f._butDone.addClass(t.buttonDisabled) } f._scrollTo(s) } } l = r.theme; if (l && l !== "default") { j.theme = l; if (p) { p.theme = l } } j.tabIndex = this._ti; j.textChanged = function (o) { o = f._butDone; if (o) { if (f.findInvalid()) { o.addClass(t.buttonDisabled) } else { o.removeClass(t.buttonDisabled) } } f._modified = 1 }; j.keydown = function (o) { f._editorKey(o, s) }; if (!i) { l = a("<span />").addClass(t.editor).prependTo(n); this._xy = i = { x: b(l, "marginLeft"), y: b(l, "marginTop") }; i.dx = i.x + b(l, "marginRight"); i.dy = i.y + b(l, "marginBottom"); l.remove() } k = a("<span />").igEditor(j).addClass(t.editor).css({ marginLeft: (i.x - b(n, "paddingLeft")) + "px", marginTop: (i.y - b(n, "paddingTop")) + "px" }); return k }, _editorKey: function (p, i) { var j, l, h, k, m, f, g = p.keyCode, n = this.options; f = g === 27; if (g !== 9 && g !== 13 && !f) { return } if (!(m = this._editors[i])) { return } if (f) { l = m._oldCellVal; h = m.igEditor("value"); if (!this._equals(l, h)) { m.igEditor("value", l); return } return this._endEdit(p, null, 200) } if (g === 13 || (!this._adding && n.editMode === "cell")) { return this._nextEdit(p, (g === 9) ? (p.shiftKey ? -1 : 1) : 0) } k = this._nextEditor(i, p.shiftKey); if (!m.igEditor("validate")) { c(p); return } c(p); if (k) { this._scrollTo(k.parent(), k); return } j = this._butDone; if (!j || j[0].offsetWidth === 0) { return this._nextEdit(p, 0) } if (j.hasClass(this.css.buttonDisabled)) { j = this._butCancel } j[0].focus(); this._lastEditor = m }, _evtArg: function (g, i, e, f) { var h = { rowAdding: !!this._adding, column: this._col(g), row: this._row_, key: this._key(g), editor: i }; if (e !== undefined) { h.value = e; if (!d(f)) { h.update = !!f } } return h }, _startEdit: function (n, s, j, r, l) { var m, p, t, g, f, h = null, k = false, q = this.options; if (!n) { return } if (s) { this._delHover(); if (this._tds) { if (!r) { n = { tbl: n.parent().parent()[0], row: this._row(n), col: this._col(n)} } if (this._endEdit(s, 1)) { return 1 } if (!r) { if (!(n = (n.row < 0 || n.col < 0) ? null : n.tbl.childNodes[n.row].childNodes[n.col])) { return } n = a(n) } } if (!r && !this._checkRow(n.parent())) { return } this._row_ = r ? -1 : this._prime(n); this._rowIndex = r ? -1 : this._row(n); if (!l) { l = n[0].offsetHeight } if (r || q.editMode === "row") { if (!this._fire(0, s, g = { rowAdding: !!r, row: this._row_ })) { this._row_ = null; this._rowIndex = -3; return } if (r) { this._adding = r; this._addTR.hide(); this._newTR.show() } p = n.parent().children(); this._evt = s; for (m = 0; m < p.length; m++) { n = a(p[m]); n.addClass(this.css.editingCell); if (!h && p[m].offsetWidth > 0) { h = n } if (this._startEdit(n, null, j, r, l)) { k = 1; j = null } } delete this._evt; if (k && h && q.showDoneCancelButtons) { this._doButtons(h) } if (k) { c(s); this._fire(1, s, g) } else { for (m = 0; m < p.length; m++) { a(p[m]).removeClass(this.css.editingCell) } } this._sel(s, h); this._sel(1); return k } } if (d(this._row_) || !(f = this.editorForCell(n, 1))) { return } t = n.outerWidth(); if (!l) { l = n[0].offsetHeight } if (!t || !l || !this._fire(4, s ? s : this._evt, g = this._evtArg(n, f, this._val(n)))) { return } t -= this._xy.dx + 2; l -= this._xy.dy + 2; if (s) { c(s); n.addClass(this.css.editingCell) } f.igEditor({ width: Math.max(8, t), height: Math.max(10, l) }).prependTo(n); if (!this._tds) { this._tds = {} } this._tds[this._key(n)] = n; k = f.igEditor("validator"); if (k && k._setOption) { k._setOption("bodyAsParent", !!this._adding) } f.igEditor("value", g.value); f._oldCellVal = f.igEditor("value"); this._fire(5, s ? s : this._evt, g); if (j) { this._scrollTo(n, f, false, 300) } if (s) { this._sel(s, n); this._sel(1) } return 1 }, _endEdit: function (v, g, k) { var p, f, l, t, q, n, u = this._adding, h = null, j = null, m = null, r = this._tds, s = this.options; if (!r) { return } c(v); p = u || s.editMode === "row"; if (!this._modified) { g = false } if (v && p) { if (!this._fire(2, v, j = { row: this._row_, keepEditing: false, update: !!g, rowAdding: !!u })) { j.update = g = false } if (j.keepEditing) { return 1 } for (t in r) { if (r.hasOwnProperty(t) && !d(q = r[t])) { if (g && !d(f = this.editorForCell(q)) && f.igEditor("hasInvalidMessage")) { this._scrollTo(q, f, 1); return 1 } } } for (t in r) { if (r.hasOwnProperty(t) && g && !d(q = r[t]) && !d(f = this.editorForCell(q))) { if (!f.igEditor("validate", !s)) { if (s) { this._scrollTo(q, f, 1) } s = null } } } if (!s) { return 1 } m = {} } if (p) { h = this._td().parent().children(); for (p = 0; p < h.length; p++) { a(h[p]).removeClass(this.css.editingCell) } } h = null; for (t in r) { if (r.hasOwnProperty(t) && !d(q = r[t]) && !d(f = this.editorForCell(q))) { if (!m) { if (g && !f.igEditor("validate")) { this._scrollTo(q, f, 1); return 1 } q.removeClass(this.css.editingCell) } this._doButtons(1); l = f.igEditor("value"); f.igEditor("remove"); if (!this._fire(6, v, n = this._evtArg(q, f, l, g))) { n.value = f._oldCellVal } l = n.value; if (g && !u && !h && !this._equals(l, f._oldCellVal) && this._val(q, n, m) !== undefined) { h = q.parent()[0] } delete r[t]; this._fire(7, v, n) } } this._modified = this._lastEditor = this._tds = this._error = null; if (u) { this._addTR.show(); this._newTR.hide(); this._adding = null; if (g && this._fire(8, v, m)) { this.grid.addRow(m, s.autoCommit); this._sel(2); this._fire(9, v, m) } } else { if (h) { this.grid.updateRow(this._row_, m, h, s.autoCommit) } } this._fire(3, v, j); this._rowIndex = -3; this._row_ = null; this._sel(); this._focusGrid(k) }, _scrollDiv: function () { var g, e = this, f = this.grid.element; g = f ? f.parent() : null; if (g && !this._sEvts && g.is("div")) { this._scrollX = g.scrollLeft; g.bind(this._sEvts = { scroll: function (h) { e._onEvt(h, 9) } }) } return g ? g : f }, _scrollTo: function (m, g, i, k) { var s, r, h, e, f, o, n, t, q = this._adding, l = 0, p = 0, j = g; if (!g && typeof m === "string") { if (!(m = this._tds ? this._tds[m] : null)) { return } if (!(g = this.editorForCell(m))) { return } i = 1 } if (j) { g.igEditor("setFocus", 100); if (k) { g.igEditor("setFocus", k) } } if (g && i) { o = g.igEditor("validator"); o = o ? o._lbl : null; if (o && (q || m.has(o).length !== 0)) { l = o._width0; p = o._height0; s = { tbl: m.parent().parent()[0], row: this._row(m), col: this._col(m)} } } h = this._scrollDiv(); n = m.offset(); r = h.offset(); h = h[0]; r.w = h.clientWidth; r.h = h.clientHeight; n.w = m.outerWidth(); n.h = m.outerHeight(); e = n.left - r.left; f = n.top - r.top; if (l > n.w) { k = s.col; t = n.w; n.w = (l += 5); while (t < l && this._nextTD(s, 1)) { t += s.td[0].offsetWidth } if ((t -= l) < 0) { if ((n.x += t) < 0 && !q) { t -= n.x; n.x = 0 } o.css("marginLeft", t + "px") } } if (!q && p > 1 && s.row > 1) { s.col = k; t = p += 3; while (t > 0 && this._nextTD(s, 0)) { t -= s.td[0].offsetHeight } if (t > 0) { o.css("marginTop", "-" + p + "px"); f -= p } } if (h.nodeName !== "DIV") { return } if (e > 0) { if ((e += n.w - r.w) < 0) { e = 0 } } if (f > 0) { if ((f += p + n.h - r.h) < 0) { f = 0 } } if (e !== 0) { h.scrollLeft += e } if (!q && f !== 0) { h.scrollTop += f } }, _doButtons: function (j) { var t, n, i, e, q, g, m, l, k, r = this._adding, s = this.css, f = null, u = this.grid.element, h = this._buts, p = this.options; if (j === 1 || j === 2) { if (h) { h.hide(); if (j === 2) { h.remove(); this._buts = null } } if (j === 2 && this._delBut) { this._delHover(); delete this._delBut } return } if (j) { m = u.parent(); if (!h) { h = this._buts = a("<div />").css("position", "absolute").addClass(s.buttonContainer).attr("unselectable", "on").prependTo(m); this._butDone = f = a("<span />").addClass("done_id").addClass(s.button).addClass(s.doneButton).attr("unselectable", "on").attr("title", this._loc("doneTitle")).appendTo(h).bind(this._evts); if (p.showDoneIcon) { a("<span />").css("display", "inline-block").addClass(s.doneIcon).attr("unselectable", "on").appendTo(f) } q = this._loc("done"); if (q) { a("<span />").css("display", "inline-block").attr("innerHTML", q).attr("unselectable", "on").appendTo(f) } this._butCancel = f = a("<span />").addClass(s.button).addClass(s.cancelButton).attr("unselectable", "on").attr("title", this._loc("cancelTitle")).appendTo(h).bind(this._evts); if (p.showCancelIcon) { a("<span />").css("display", "inline-block").addClass(s.cancelIcon).attr("unselectable", "on").appendTo(f) } q = this._loc("cancel"); if (q) { a("<span />").css("display", "inline-block").attr("innerHTML", q).attr("unselectable", "on").appendTo(f) } h._height = h[0].offsetHeight; h.css("width", Math.max(h[0].clientWidth, (h._width = h[0].offsetWidth) - 4)) } } if (!h) { return } g = this._scrollDiv(); if (j) { h.show(); this._butDone.addClass(s.buttonDisabled); h.css({ marginLeft: (this._butsX = 0) + "px", marginTop: "0px" }); n = h.offset(); i = h[0].offsetHeight; t = j.offset(); e = j[0].offsetHeight; t.top -= n.top; l = g[0].scrollTop; k = g[0].clientHeight + l - t.top - e - 5 - i; if (k < 1 && k > t.top - i - l - 5) { k = 1 } k = (k > 0 || r) ? (t.top + e + 5) : (t.top - i - 5); h.css({ marginTop: k + "px" }); this._butsY = (r && u.has(this._addTR).length === 1) ? k : 0 } if ((f = g[0].clientWidth - (h.offset().left + h._width + 3 - g.offset().left)) !== 0) { h.css("marginLeft", (this._butsX += f) + "px") } if (r) { h.css("marginTop", (this._butsY + g[0].scrollTop + 2) + "px") } }, _isEditor: function (m) { var f, k, g, j, h, l = this._tds, i = this.options; if (!l) { return } h = this._findCell(m); if (h && i.editMode === "row" && (this._row(h) === this._rowIndex)) { return 1 } f = this.grid.element[0]; for (j in l) { if (l.hasOwnProperty(j)) { h = l[j]; if (h) { g = this.editorForCell(h); if (g) { k = m; g = g[0]; while (k && k !== f) { if (k === g) { return 1 } k = k.parentNode } } } } } }, _aCell: function () { var f, e = -1, g = this._sel(0, 1); f = g ? g.activeCell() : null; if (f) { return f.element } f = g ? g.activeRow() : null; if (f) { f = f.element[0].childNodes; while (++e < f.length) { if (f[e].offsetWidth > 0) { return a(f[e]) } } } }, _sel: function (f, g) { var e = this.grid.element.data("igGridSelection"); if (e) { if (g === 1) { return e } if (g) { if (!f) { return } if (e.options.mode === "row") { return e._activateRow(e._realActiveRow = { element: g.parent(), index: this._row(g) }) } g = e._cellFromElement(g[0], this._row(g), this._col(g)); return e._activateCell(g) } if (f === 2) { e._refresh() } else { e._suspend = f } } }, _doDelete: function (k, g) { var f, j, h; if (!g) { j = this._sel(0, 1); h = j ? j.selectedRows() : null; for (f = 0; f < (h ? h.length : 0); f++) { this._doDelete(k, h[f].element) } } if (!g || !this._fire(10, k, h = { element: g, row: this._prime(a(g.children()[0])) })) { return } c(k); this._delHover(); this.grid.deleteRow(h.row, g[0], this.options.autoCommit); if (k) { this._sel(2) } this._fire(11, k, h); return 1 }, _checkRow: function (e) { return (e && e.index() < this.numberOfRows()) ? e[0] : null }, _delHover: function (u) { var q, n, l, p, s, j, f, z, t, y, m, g, e, r, k = this._delBut, h = this._delTR, x = this.css, w = this.options; if (k) { this._doHov(this._isSrc(k, u) ? k[0] : null, x.buttonHover) } u = u ? this._checkRow(a(u).closest("tr")) : null; if (u === h || (!h && !u)) { return } this._delTR = u; if (!k) { this._delBut = k = a("<span />").css("position", "absolute").addClass(x.deleteButton).attr("unselectable", "on").attr("title", this._loc("deleteRowTitle")); if (w.showDeleteIcon) { a("<span />").css("display", "inline-block").addClass(x.deleteIcon).attr("unselectable", "on").appendTo(k) } n = this._loc("deleteRow"); if (n && w.showDeleteText) { a("<span />").css("display", "inline-block").attr("innerHTML", n).attr("unselectable", "on").appendTo(k) } } if (h) { r = k.parent()[0]; if (r) { delete r._txt } k.remove() } if (!u) { return } e = u.childNodes; for (q = 0; q < e.length; q++) { if (e[q].offsetWidth > 0) { break } } if (!(u = e[q])) { return } r = a(u); g = this._scrollDiv(); u._txt = r.text(); k.css({ marginLeft: "0px", marginTop: "0px" }).prependTo(r); t = k.offset(); y = r.offset(); m = this.grid.element.offset(); p = k[0].offsetHeight; s = u.offsetHeight; j = g[0].clientHeight; f = g[0].scrollTop; z = y.top - t.top; y.top -= m.top; q = j + f - y.top - s - p; q = (q >= 0 || q > y.top - f - p || y.top < p) ? s + z - 1 : z + 1 - p; f = g[0].scrollLeft; j = g[0].clientWidth; p = k[0].offsetWidth; l = j + f - p - b(r, "paddingLeft") - b(r, "borderLeftWidth") - 5; k.css({ marginTop: q + "px", marginLeft: l + "px" }); if ((z = p + k.offset().left - y.left - f - j + 5) > 0) { k.css("marginLeft", (l - z) + "px") } }, _isSrc: function (g, f) { if (g && f && (g[0] === f || g.has(f).length > 0)) { return g } }, _doHov: function (h, f) { var g = this._hov; if (g && f && g.e[0] === h) { return 1 } if (g) { g.e.removeClass(g.css) } if (f) { this._hov = { e: h = a(h), css: f }; return h.addClass(f) } delete this._hov }, _focusGrid: function (f) { var e = this; if (f) { setTimeout(function () { try { e._div()[0].focus() } catch (g) { } }, f) } }, _onEvt: function (u, m) { var r, n, t, i, l, w, f, j, v = this.css, q = this._newTR, g = this._addTR, h = this._error, p = this.grid.element, s = this.options; if (!u || !p || !(r = u.target)) { return } if (m < 4 && (u.shiftKey || u.ctrlKey)) { return } if (m === 8) { this._delHover(); return this._doHov() } if (this._delBut && m < 3 && this._isSrc(this._delBut, r)) { if (m === 2 && this._doDelete(u, a(this._delTR))) { delete this._delTR } return } w = g ? g.children()[0] : null; l = u.keyCode; if (l === 46) { return s.enableDeleteRow ? this._doDelete(u) : null } if (m === 9) { this._delHover(); f = r.scrollLeft; if (this._tds) { this._doButtons(); if (this._adding && f !== this._scrollX) { this._hideError = new Date().getTime() + 700; if (h) { h = this._editors[h].igEditor("validator").hide() } } } if (g && f !== this._scrollX) { a(w).css("paddingLeft", (this._addLeft + f) + "px") } this._scrollX = f; return } if (this._isSrc(g, r)) { this._delHover(); r = w; if (m === 5) { return a(r).addClass(v.addRowActive) } if (m === 6) { return a(r).removeClass(v.addRowActive) } if (m === 7) { return this._doHov(r, v.addRowHover) } if (l === 32 || l === 13) { return this.startAddRowEdit(u) } } if (l === 27) { return this._endEdit(u, null, 50) } i = this._isSrc(this._butDone, r); t = this._isSrc(this._butCancel, r); n = this._isSrc(this._buts, r); if (n || i || t) { if (i || t) { c(u); r = i ? i : t; if (m === 2) { if (r.hasClass(v.buttonDisabled)) { return } this._endEdit(u, i, 1) } else { if (m === 7 && !r.hasClass(v.buttonDisabled)) { this._doHov(r[0], v.buttonHover) } else { if (m === 5) { r.addClass(v.buttonActive) } else { if (m === 6) { r.removeClass(v.buttonActive) } else { if (l === 13 || l === 32) { this._endEdit(u, i, 1) } else { if (l === 9) { if (u.shiftKey) { n = (i || this._butDone.hasClass(v.buttonDisabled)) ? null : this._butDone } else { if (!n) { return } n = this._butCancel } if (n) { n[0].focus(); return } r = this._lastEditor; n = r ? r.parent() : null; if (n) { this._scrollTo(n, r) } } } } } } } } return } j = p.find("tbody"); if (m === 7) { return this._delHover((this._tds || !s.enableDeleteRow || (!s.showDeleteText && !s.showDeleteIcon) || !this._isSrc(j, r)) ? null : r) } if (q && m < 4) { if (this._isSrc(q, r)) { return } if (this._isSrc(g, r)) { if (m === 2) { this.startAddRowEdit(u) } return } } if (m < 4 && !this._isSrc(j, r)) { if (this._tds && r !== p.parent()[0] && r !== this._div()[0]) { this._endEdit(u) } return } if (l === 13) { this._nextEdit(u, 0); if (this._tds) { return } } if (this._isEditor(r)) { return } n = this._findCell(r); if (this._tds && m > 1 && m < 4) { if (this._endEdit(u, 1)) { return } } f = s.editMode === "cell"; r = s.startEditTriggers; if (r && !this._tds && (f || s.editMode === "row")) { r = r.toLowerCase(); if ((l === 113 && r.indexOf("f2") >= 0) || (l === 13 && r.indexOf("enter") >= 0)) { n = this._aCell() } else { if (r.indexOf(u.type) < 0 || (m === 2 && r.indexOf("dbl") >= 0)) { n = null } } if (n && this._startEdit(n, u, f)) { return } } if (!this._tds && m === 1 && !this._sel(0, 1)) { this._focusGrid(1) } }, destroy: function () { var f, g, e = this.grid; if (!this._evts || !(f = e.element) || !(g = this._div())) { return this } this._doButtons(2); g.unbind(this._evts); if (this._sEvts) { f.parent().unbind(this._sEvts) } f.unbind(this._gEvts); this._endEdit(); this._headerRendered(1); this._evts = this._sEvts = this._gEvts = null; a.Widget.prototype.destroy.call(this); return this }, _injectGrid: function (f) { var e = this, g = f.options.tabIndex; this.grid = f; this._gEvts = { iggriduidirty: function () { e._delHover(); e._endEdit() } }; if (this.options.enableAddRow) { this._gEvts.iggridheaderrendered = function () { e._headerRendered() } } f.element.bind(this._gEvts); this._ti = g ? g : 1; this._evts = { mousedown: function (h) { e._onEvt(h, 1) }, click: function (h) { e._onEvt(h, 2) }, dblclick: function (h) { e._onEvt(h, 3) }, keydown: function (h) { e._onEvt(h, 4) }, focus: function (h) { e._onEvt(h, 5) }, blur: function (h) { e._onEvt(h, 6) }, mousemove: function (h) { e._onEvt(h, 7) }, mouseleave: function (h) { e._onEvt(h, 8) } } } }); a.extend(a.ui.igGridUpdating, { version: "11.1.20111.2010" }); a.ui.igGridUpdating.locale = { defaults: {} }; a.ui.igGridUpdating.setDefaultCulture = function (e) { a.ui.igGridUpdating.locale.defaults = a.extend({}, (typeof e === "string") ? a.ui.igGridUpdating.locale[e] : e) } } (jQuery)); jQuery(function (a) { a.ui.igGridUpdating.locale.en = { done: "Done", doneTitle: "Stop editing and update", cancel: "Cancel", cancelTitle: "Stop editing and do not update", addRow: "Add new row", addRowTitle: "Click to start adding new row", deleteRow: "Delete", deleteRowTitle: "Delete row" }; a.ui.igGridUpdating.setDefaultCulture("en") }); (function (a) { a.ig = a.ig || {}; a.ig.Upload = a.ig.Upload || {}; a.extend(a.ig.Upload, { locale: { labelUploadButton: "Upload File", labelAddButton: "Add", labelClearAllButton: "Clear Uploaded", labelSummaryTemplate: "{0} of {1} uploaded", labelSummaryProgressBarTemplate: "{0}/{1}", labelShowDetails: "Show Details", labelHideDetails: "Hide Details", labelSummaryProgressButtonCancel: "Cancel", labelSummaryProgressButtonContinue: "Upload", labelSummaryProgressButtonDone: "Done", labelProgressBarFileNameContinue: "...", errorMessageFileSizeExceeded: "Max file size exceeded.", errorMessageGetFileStatus: "Could not get your current file status! Probably connection dropped.", errorMessageCancelUpload: "Could not send to server command to cancel upload! Probably connection dropped.", errorMessageNoSuchFile: "The file you requested could not be found. Probably this file is too big.", errorMessageOther: "There is internal error uploading file. Error code: {0}.", errorMessageValidatingFileExtension: "File extension validation failed.", errorMessageAJAXRequestFileSize: "AJAX error while trying to get file size.", errorMessageMaxUploadedFiles: "Maximum count of uploading files exceeded.", errorMessageMaxSimultaneousFiles: "Value of maxSimultaneousFilesUploads is incorrect. It should be more than 0 or null.", errorMessageTryToRemoveNonExistingFile: "You are trying to remove non-existing file with id {0}.", errorMessageTryToStartNonExistingFile: "You are trying to start non-existing file with id {0}.", titleUploadFileButtonInit: "Upload File", titleAddFileButton: "Add", titleCancelUploadButton: "Cancel", titleSummaryProgressButtonContinue: "Upload", titleClearUploaded: "Clear Uploaded", titleShowDetailsButton: "Show Details", titleHideDetailsButton: "Hide Details", titleSummaryProgressButtonCancel: "Cancel", titleSummaryProgressButtonDone: "Done", titleSingleUploadButtonContinue: "Upload", titleClearAllButton: "Clear Uploaded"} }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics File Upload requires jQuery to be loaded") } (function (a) { a.widget("ui.igBrowseButton", a.ui.igButton, { _const: { filePickerWidth: "220px", filePickerHeight: "30px" }, css: { filePickerClass: "ui-igbrowsebutton-filepicker" }, options: { autoselect: true, multiplefiles: false }, _id: function (b) { return this.element[0].id + b }, _create: function () { var b = this._id("_fp"); a.extend(a.ui.igBrowseButton.prototype.options, a.ui.igButton.prototype.options); a.extend(a.ui.igBrowseButton.prototype.css, a.ui.igButton.prototype.css); a.ui.igButton.prototype._create.apply(this); this._createFilePicker(b); this._attachBrowseButtonEvents(); if (this.options.disabled === true) { this._enableFilePicker(true) } }, _createFilePicker: function (b) { this.filePicker = a('<input type="file" id="' + b + '" />').appendTo(a(document.body)); this.filePicker.css({ position: "absolute", margin: "-5px 0 0 -175px", padding: "0", width: "1px", height: "1px", fontSize: "14px", opacity: "0", cursor: "pointer", display: "block", zIndex: "2147483583", filter: "alpha(opacity=0)" }); this._setTitle(this.options.title) }, _setTitle: function (b) { var c = a("#" + this._id("_fp")); if (b === false) { c.removeAttr("title") } else { c.attr("title", b) } }, _attachBrowseButtonEvents: function () { var b = this; this.mouseMoveEvent = { mousemove: function (c) { b._mousemove(c) } }; this._internalEvents = { mouseover: function () { b._attachMouseMove(true) } }; b.element.bind(this._internalEvents); b._filePickerBindChange() }, _filePickerBindChange: function () { var d = this, b, c = a("#" + this._id("_fp")); d.tempClicked = false; d._filePickerEvents = { change: function (e) { b = d._fileFromPath(c.val()); if (!d._trigger("fileselect", e, { filePath: b })) { return } }, click: function (e) { if (!d._trigger("click", e)) { return false } } }; c.bind(d._filePickerEvents) }, attachFilePicker: function (l, i) { var d = this, k, m, j = d.element, g = this.filePicker, b = j.offset(), h = parseInt(b.left, 10), f = parseInt(b.top, 10), c = g[0]; k = parseInt(h + j[0].offsetWidth, 10); m = parseInt(f + j[0].offsetHeight, 10); if (l.pageX >= h && l.pageX <= k && l.pageY >= f && l.pageY <= m) { c.style.top = l.pageY + "px"; c.style.left = l.pageX + "px"; if (i === true) { g.css({ width: "1px", height: "1px" }) } else { d.isVisibleFilePicker = true; g.css({ width: d._const.filePickerWidth, height: d._const.filePickerHeight }) } c.style.display = "block"; d._onMouseOver(l) } }, getFilePicker: function () { var b = this._id("_fp"), c = a("#" + b); c.attr("id", "").css({ display: "none" }); this._createFilePicker(b); this._filePickerBindChange(); return c }, _mousemove: function (k) { var d = this, j, l, i = d.element, g = this.filePicker, b = i.offset(), h = parseInt(b.left, 10), f = parseInt(b.top, 10), c = g[0]; j = parseInt(h + i[0].offsetWidth, 10); l = parseInt(f + i[0].offsetHeight, 10); if (k.pageX >= h && k.pageX <= j && k.pageY >= f && k.pageY <= l) { c.style.top = k.pageY + "px"; c.style.left = k.pageX + "px"; if (!d.isVisibleFilePicker) { g.css({ width: d._const.filePickerWidth, height: d._const.filePickerHeight }); d.isVisibleFilePicker = true } c.style.display = "block"; d._onMouseOver(k) } else { if (d.isVisibleFilePicker) { g.css({ width: "1px", height: "1px" }); d.isVisibleFilePicker = false } d._attachMouseMove(false); d._onMouseOut(k) } }, _attachMouseMove: function (b) { if (b) { a(document).bind(this.mouseMoveEvent) } else { a(document).unbind(this.mouseMoveEvent) } }, _setOption: function (b, c) { a.ui.igButton.prototype._setOption.apply(this, arguments); a.Widget.prototype._setOption.apply(this, arguments); switch (b) { case "disabled": c = Boolean(c); this._enableFilePicker(c); a.ui.igButton.prototype._setOption.apply(this, arguments); break; case "title": this._setTitle(c); break; default: break } }, _enableFilePicker: function (c) { var b = a("#" + this._id("_fp")); if (c === false) { this.isVisibleFilePicker = false; this._attachMouseMove(true); this.element.bind(this._internalEvents).mouseover() } else { this._attachMouseMove(false); b.css({ width: "1px", height: "1px" }); this.element.unbind(this._internalEvents) } }, destroy: function () { this.element.unbind(this._internalEvents); this.element.unbind(this.mouseMoveEvent); a.Widget.prototype.destroy.apply(this, arguments); a.ui.igButton.prototype.destroy.apply(this); a("#" + this._id("_fp")).remove() }, _fileFromPath: function (b) { return b.replace(/(\/|\\)$/, "") } }); a.extend(a.ui.igBrowseButton, { version: "11.1.20111.2010" }); a.widget("ui.igUpload", { _const: { fileNameLimit: 100, AjaxQueueName: "uploadrequestsqueue", debug: true, isProgressBarAnimationEnabled: true, isProgressBarRange: false, timeoutGetFileSize: 300, status: { NotStarted: 0, Started: 1, Finished: 2, NoSuchFile: 3, Canceled: 4 }, errorCode: { MimeTypeValidation: 1, FileSizeExceeded: 2 }, clientSideErrorCode: { maxAllowedUploadingFiles: 1, extensionValidation: 2, startUpload: 3, ajaxErrorGetFileStatus: 4, ajaxErrorCancelUpload: 5, removeFileUpload: 6, ajaxErrorRequestFileSize: 7, checkCanUpload: 8 }, fileStatusNoError: -1, progressUpdateInterval: 800, animateProgressBarInterval: 200, showHideDetailsAnimationTimeout: 500, doubleCheckRequestInterval: 1000, removeSingleUploadAnimationTimeout: 300, maxUploadFilesDefault: -1 }, css: { clearClass: "ui-helper-clearfix", hiddenClass: "ui-helper-hidden", baseClassIE6: "ui-ie6", baseClassIE7: "ui-ie7", baseClassMoz: "ui-moz", baseClassOpera: "ui-opera", startupBrowseButtonClasses: "ui-igstartupbrowsebutton", baseClass: "ui-widget ui-widget ui-widget-content ui-corner-all ui-igupload", baseMainContainerClass: "ui-igupload-basemaincontainer", multipleDialogClasses: "ui-iguploadmultiple", singleDialogClass: "ui-iguploadsingle", browseButtonClass: "ui-igupload-browsebutton", containerClass: "ui-igupload-container ui-widget-content", uploadProgressClass: "ui-igupload-uploadprogress", fileInfoMainContainer: "ui-igupload-fimaincontainer", progressContainer: "ui-helper-clearfix", progressBarUploadClass: "ui-igupload-progressbar-upload ui-igupload-progressbar-upload-single ui-helper-clearfix", progressBarFileNameClass: "ui-igupload-progressbar-filename", progressBarFileSizeClass: "ui-igupload-progressbar-filesize", progressBarInnerHTMLContainerClass: "ui-igupload-progressbar-container ui-helper-clearfix", containerButtonCancelClass: "ui-container-button-cancel-class  ui-helper-clearfix", summaryProgressBarClass: "ui-igupload-summaryprogressbar", summaryProgressContainerClass: "ui-igupload-summaryprogresscontainer", summaryProgressbarLabelClass: "ui-igupload-summaryprogress-label", summaryInformationContainerClass: "ui-igupload-summaryinformation-container ui-helper-clearfix", summaryUploadedFilesLabelClass: "ui-igupload-summaryuploadedfiles-label", summaryShowHideDetailsButtonClass: "ui-igupload-showhidedetails-button", summaryButtonClass: "ui-igupload-summary-button", summaryProgressBarInnerProgress: "ui-igupload-summaryprogres_summpbar_progress", summaryProgressBarSecondaryLabel: "ui-igupload-summaryprogress-label ui-igupload-summaryprogress-secondary-label", containerFUS: "ui-widget-content ui-igupload-progress-container ui-corner-all ui-helper-clearfix" }, options: { width: "", height: "", autostartupload: false, labelUploadButton: a.ig.Upload.locale.labelUploadButton, labelAddButton: a.ig.Upload.locale.labelAddButton, labelClearAllButton: a.ig.Upload.locale.labelClearAllButton, labelSummaryTemplate: a.ig.Upload.locale.labelSummaryTemplate, labelSummaryProgressBarTemplate: a.ig.Upload.locale.labelSummaryProgressBarTemplate, labelShowDetails: a.ig.Upload.locale.labelShowDetails, labelHideDetails: a.ig.Upload.locale.labelHideDetails, labelSummaryProgressButtonCancel: a.ig.Upload.locale.labelSummaryProgressButtonCancel, labelSummaryProgressButtonContinue: a.ig.Upload.locale.labelSummaryProgressButtonContinue, labelSummaryProgressButtonDone: a.ig.Upload.locale.labelSummaryProgressButtonDone, labelProgressBarFileNameContinue: a.ig.Upload.locale.labelProgressBarFileNameContinue, errorMessageMaxFileSizeExceeded: a.ig.Upload.locale.errorMessageFileSizeExceeded, errorMessageGetFileStatus: a.ig.Upload.locale.errorMessageGetFileStatus, errorMessageCancelUpload: a.ig.Upload.locale.errorMessageCancelUpload, errorMessageNoSuchFile: a.ig.Upload.locale.errorMessageNoSuchFile, errorMessageOther: a.ig.Upload.locale.errorMessageOther, errorMessageValidatingFileExtension: a.ig.Upload.locale.errorMessageValidatingFileExtension, errorMessageAJAXRequestFileSize: a.ig.Upload.locale.errorMessageAJAXRequestFileSize, errorMessageTryToRemoveNonExistingFile: a.ig.Upload.locale.errorMessageTryToRemoveNonExistingFile, errorMessageTryToStartNonExistingFile: a.ig.Upload.locale.errorMessageTryToStartNonExistingFile, errorMessageMaxUploadedFiles: a.ig.Upload.locale.errorMessageMaxUploadedFiles, errorMessageMaxSimultaneousFiles: a.ig.Upload.locale.errorMessageMaxSimultaneousFiles, uploadUrl: "ig_fua34sf345sdf13sdf3454erdsf2345asd3425df5235d54df345.aspx", progressUrl: "IGUploadStatusHandler.ashx", allowedExtensions: [], showFileExtensionIcon: true, css: null, fileExtensionIcons: [{ ext: [], css: "ui-icon ui-icon-document ui-igupload-progressbar-icon ui-igupload-progressbar-icon-default", def: true }, { ext: ["exe", "app"], css: "ui-icon ui-icon-gear ui-igupload-progressbar-icon ui-igupload-progressbar-icon-exe", def: false }, { ext: ["gif", "jpg", "jpeg", "png", "bmp", "yuv", "tif", "thm", "psd"], css: "ui-icon ui-icon-image ui-igupload-progressbar-icon ui-igupload-progressbar-icon-images", def: false }, { ext: ["mp3", "wav", "mp4", "aac", "mid", "wma", "ra", "iff", "aif", "m3u", "mpa"], css: "ui-icon ui-icon-volume-on ui-icon ui-icon-image ui-igupload-progressbar-icon ui-igupload-progressbar-icon-music", def: false }, { ext: ["doc", "docx", "xls", "xlsx", "txt", "ppt", "pptx", "pdf"], css: "ui-icon ui-icon-document ui-igupload-progressbar-icon ui-igupload-progressbar-icon-docs", def: false }, { ext: ["3gp", "asf", "asx", "avi", "flv", "mov", "mp4", "mpg", "rm", "swf", "vob", "wmv"], css: "ui-icon ui-icon-video ui-igupload-progressbar-icon ui-igupload-progressbar-icon-video", def: false}], mode: "single", maxUploadedFiles: -1, maxSimultaneousFilesUploads: 1, fileSizeMetric: "auto", controlId: "", fileSizeDecimalDisplay: 2 }, events: { fileSelecting: "fileSelecting", fileSelected: "fileSelected", fileUploading: "fileUploading", fileUploaded: "fileUploaded", fileUploadAborted: "fileUploadAborted", cancelAllClicked: "cancelAllClicked", onError: "onError" }, summaryButtonModes: { cancel: 1, startupload: 2, done: 3 }, container: function () { return a("#" + this.element[0].id + "_wrprinit") }, widget: function () { return this.element }, _id: function (b, d) { var c = this.element[0].id; if (d !== undefined) { return c + "_" + d + "_" + b } return c + b }, _create: function () { var b = { formNumber: 0, iframe: { ids: [] }, pendingQueueIDs: [], uploadingIDs: [], batch: [], lastId: -1, filesInfo: [], countUploadingFiles: 0, countTotalFiles: 0, fileSizeUploaded: 0, fileSizeTotal: 0 }; this.allCancelled = false; this.fileInfoData = b; this._renderStartupBrowseButton(); this.container().width(this.options.width).height(this.options.height); this._attachFakeIframe() }, _attachFakeIframe: function () { var b = this._id("_tempIframe"), c = a.browser.version.slice(0, 1); if (a.browser.msie === true && (c === "6" || c === "7" || c === "8")) { a("#" + b).remove(); setTimeout(a('<iframe src="javascript:false;" id="' + b + '" style="display: none;"></iframe>').appendTo(a("#" + this._id("_fu"))), 300) } }, _renderStartupBrowseButton: function () { var c = this, g = c.css, i = c.element, d = c.options, h = this._id("_ibb"), f = this._id("_wrprinit"), j, b; this.originalElement = i; j = '<div id="' + f + '"></div>'; i.wrap(j); i.hide(); i = a("#" + f); h = this._id("_ibb"); if (a.browser.msie === true && a.browser.version.slice(0, 1) === "6") { i.addClass(g.baseClassIE6) } else { if (a.browser.msie === true && a.browser.version.slice(0, 1) === "7") { i.addClass(g.baseClassIE7) } else { if (a.browser.opera === true) { i.addClass(g.baseClassOpera) } else { if (a.browser.mozilla === true) { i.addClass(g.baseClassMoz) } } } } b = a("<button></button>").appendTo(i).attr("id", h).addClass(g.startupBrowseButtonClasses); b.igBrowseButton({ labelText: d.labelUploadButton, title: a.ig.Upload.locale.titleUploadFileButtonInit, fileselect: function (e) { a(this).css({ display: "none" }); c._HTMLUpload(); c._onBrowseButtonFileSelected(e, true) }, click: function (e) { var k = false; if (c._trigger(c.events.fileSelecting, e) === false) { k = true } return !k } }) }, _HTMLUpload: function () { var m = this._id("_fu"), i = this._id("_bmncntr"), h = this.options, l = this.container(), c = this, f = c.css, j = this._id("_fc"), n = this._id("_bb"), b = this._id("_clrabtn"), k = this._id("_fi_main_cntnr"), g, d = ""; if (h.mode === "single") { d += '<div  class="' + f.singleDialogClass + '" id="$baseMainContainerId">'; d += '   <div id="$uploaderId$" class="$baseMainContainerClass">'; d += '       <div id="$fileContainerId$"></div>'; d += '       <button id="$browseButtonId$" class="$browseButtonClass$"></button>'; d += "   </div>"; d += "</div>" } else { if (h.mode === "multiple") { d = '<div class="' + f.multipleDialogClasses + '" id="$baseMainContainerId">'; d += '   <div  id="$uploaderId$" class="$baseMainContainerClass">'; d += '       <div id="$uploaderFilesContainer" class="$fuMainContainerClass">'; d += '           <button id="$browseButtonId$" class="$browseButtonClass$"></button>'; d += '           <button id="$clearAllButtonId$"></button>'; d += '           <div id="$fileContainerId$"></div>'; d += "       </div>"; d += "   </div>"; d += "</div>" } } d = d.replace("$uploaderId$", m).replace("$browseButtonId$", n).replace("$baseMainContainerId", i).replace("$browseButtonClass$", f.browseButtonClass).replace("$fileContainerId$", j).replace("$clearAllButtonId$", b).replace("$uploaderFilesContainer", k).replace("$fuMainContainerClass", f.fileInfoMainContainer).replace("$baseMainContainerClass", f.baseMainContainerClass); a(d).appendTo(l).css({ width: h.width, height: h.height }).addClass(f.baseClass); g = a("#" + b); if (g.length > 0) { g.igButton({ title: a.ig.Upload.locale.titleClearAllButton, labelText: h.labelClearAllButton, disabled: true, click: function (e) { e.preventDefault(); c.clearAll() }, css: { buttonClasses: "ui-igbutton ui-igupload-button-clear-all", buttonHoverClasses: "", buttonActiveClasses: "", buttonFocusClasses: "", buttonLabelClass: ""} }) } a("#" + n).igBrowseButton({ labelText: this.options.labelAddButton, title: a.ig.Upload.locale.titleAddFileButton, fileselect: function (e) { c._onBrowseButtonFileSelected(e, false) }, click: function (e) { var o = false; if (c._trigger(c.events.fileSelecting, e) === false) { o = true } return !o } }); a("#" + j).addClass(f.containerClass); if (h.mode === "multiple") { c._spbRenderInit() } }, _disableBrowseButton: function (b) { a("#" + this._id("_bb")).igBrowseButton("option", "disabled", b); a("#" + this._id("_ibb")).igBrowseButton("option", "disabled", b) }, _checkMaxUploadingFilesCount: function () { var b = this.options, d = true, c = this.fileInfoData.countTotalFiles + 1; if (b.maxUploadedFiles !== this._const.maxUploadFilesDefault && b.maxUploadedFiles !== null && c > b.maxUploadedFiles) { d = false } return d }, _onBrowseButtonFileSelected: function (b, f) { var c = this, e = this.fileInfoData, d = c.options, g = a("#" + this._id("_fu")); if (c._checkMaxUploadingFilesCount() === false) { c._setError(d.errorMessageMaxUploadedFiles, c._const.clientSideErrorCode.maxAllowedUploadingFiles, "clientside"); c._disableBrowseButton(true); return } else { if (d.maxUploadedFiles !== null && d.maxUploadedFiles !== this._const.maxUploadFilesDefault && d.maxUploadedFiles === (e.countTotalFiles + 1)) { c._disableBrowseButton(true) } } if (d.mode === "single") { if (e.iframe.ids.length === 0) { c._removeSingleUpload(e.lastId); if (c._attachIframe(b, g, f) === true) { c._disableBrowseButton(true) } } } else { if (d.mode === "multiple") { if (c._attachIframe(b, g, f) === false) { c._disableBrowseButton(false) } } } }, clearAll: function () { var f = this.container(), b = f.data("finishedIDs"), c, d; if (b === undefined) { return } d = b.length; for (c = 0; c < d; c++) { this._removeSingleUpload(b[c]) } b = []; f.data("finishedIDs", b); this._disableClearAllButton() }, _enableClearAllButton: function () { a("#" + this._id("_clrabtn")).igButton({ disabled: false }) }, _disableClearAllButton: function () { a("#" + this._id("_clrabtn")).igButton("option", "disabled", true) }, _attachIframe: function (d, n, l) { var i = this, q = i.options, b = this.fileInfoData, g = this._id("_bb"), r = a("#" + g), p = b.formNumber++, j = this._id("_ifrm", p), s = this._id("_frm", p), m, k = this.fileInfoData, c, h, u = i._randomString(30), e = i._const.status.Started, f = q.controlId, t = q.uploadUrl + "?key=" + u + "&cid=" + f; if (l === true) { m = a("#" + this._id("_ibb")).igBrowseButton("getFilePicker") } else { m = r.igBrowseButton("getFilePicker") } if (i._validateFileExtension(m[0].value) === false) { m.remove(); i._setError(q.errorMessageValidatingFileExtension, i._const.clientSideErrorCode.extensionValidation, "clientside"); if (q.mode === "multiple") { i._spbRenderProgress() } return false } k.filesInfo[p] = { path: m.val(), key: u, sizeBytes: 0, uploadedBytes: 0, status: i._const.status.NotStarted, checksNoSuchFile: 0, innerStatus: i._const.status.NotStarted }; k.countTotalFiles++; i._spbRenderProgress(); c = a('<iframe src="javascript:false;" id="' + j + '" name="' + j + '"></iframe>').appendTo(n).css({ display: "none" }); h = a('<form method="post" enctype="multipart/form-data"></form>').attr("id", s).attr("target", j).attr("action", t).appendTo(n); m.attr("name", s + "_if").attr("id", s + "_if").appendTo(h); i._HTMLSingleUpload(p); if (q.autostartupload === true) { if (i._checkCanUpload() === true) { i.startUpload(p); i._addUploadingID(p) } else { i._addPendingId(p); e = i._const.status.NotStarted; i._getFileSize(p, u) } } else { if (q.mode === "single") { i._showSingleUploadStartUpload(true, p); i._getFileSize(p, u) } else { i._addIDBatch(p); e = i._const.status.NotStarted; i._getFileSize(p, u) } } b.iframe.ids[b.iframe.ids.fileId] = { id: p, status: e }; if (q.mode === "multiple") { i._spbCheckModeButton() } i._trigger(i.events.fileSelected, d, { fileId: p, filePath: i._getOnlyFileName(m.val()) }); return true }, _showSingleUploadStartUpload: function () { var f = this, b = f.options, c = "_strtuplbtn", d = a("#" + this._id(c)), e = a("#" + this._id("_bb")); if (d.length === 0) { a('<button id="' + f._id(c) + '"></button>').appendTo(a("#" + f._id("_fu"))).igButton({ labelText: b.labelSummaryProgressButtonContinue, title: a.ig.Upload.locale.titleSingleUploadButtonContinue, click: function (g) { g.preventDefault(); f.startUpload((f.fileInfoData.formNumber - 1)); a("#" + f._id(c)).hide(); e.igBrowseButton("option", "disabled", true).show(); e.igBrowseButton("attachFilePicker", g, true) } }); d = a("#" + this._id(c)) } e.hide(); d.show() }, _removeIframe: function (b) { var d = this, c = this.fileInfoData, e = this._id("_ifrm", b), f = this._id("_frm", b), g = a("#" + d._id("_bb")); a("#" + e).remove(); a("#" + f).remove(); c.iframe.ids = d._removeElementArrayById(c.iframe.ids, b); if (d.options.mode === "single") { g.igBrowseButton("option", "disabled", false); c.lastId = b } this._attachFakeIframe() }, _HTMLSingleUpload: function (w) { var i = this, q = this.options, f = i.css, j = i._id("_fc"), b = i._id("_fus", w), g = i._id("_snglpbar", w), k = i._id("_icn", w), s = i._id("_frm", w), h = i._id("_cbtn", w), u = s + "_if", d = a("#" + j), n = a("#" + u), e, c = n.val(), x, l = i._id("_pbrflnm", w), r = i._id("_pbrflsz", w), m, v, p, t = i._getFileExtensionIconPath(i._getFileExtension(c)); x = '<div id="' + b + '">'; x += '   <div class="' + f.containerFUS + '">'; x += '       <div class="' + f.containerButtonCancelClass + '">'; x += '           <button id="' + h + '"></button>'; x += "       </div>"; x += '       <div class="' + f.progressContainer + '">'; x += '           <div class="' + f.progressBarInnerHTMLContainerClass + '">'; x += '               <span id="' + k + '" class="' + t + '"></span>'; x += '               <span class="' + f.progressBarFileNameClass + '" id="' + l + '"></span>'; x += '               <span class="' + f.progressBarFileSizeClass + '" id="' + r + '"></span>'; x += "           </div>"; x += '           <div id="' + g + '" class="' + f.progressBarUploadClass + '"></div>'; x += "       </div>"; x += "   </div>"; x += "</div>"; a(x).appendTo(d); e = a("#" + b).addClass(f.uploadProgressClass + " " + f.clearClass); p = a("#" + g); a("#" + h).igButton({ onlyIcons: true, icons: { primary: "ui-icon-closethick" }, title: a.ig.Upload.locale.titleCancelUploadButton, click: function (o) { o.preventDefault(); i.cancelUpload(w); a("#" + h).igButton("option", "disabled", true).igButton("option", "icons", { primary: "ui-icon-check", secondary: null }) }, css: { buttonClasses: "ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-igbutton ui-igupload-cancel-button", buttonHoverClasses: "ui-state-hover", buttonActiveClasses: "ui-state-active", buttonFocusClasses: "ui-state-focus", buttonLabelClass: "ui-button-text", buttonDisabledClass: "ui-state-disabled", buttonPrimaryIconClass: "ui-button-icon-primary ui-icon", buttonMainElementPrimaryIconClass: " ui-button-text-icon-primary", buttonMainElementSecondaryIconClass: " ui-button-text-icon-secondary", buttonSecondaryIconClass: "ui-button-icon-secondary ui-icon", buttonIconsOnly: "ui-button-icons-only", buttonIconOnly: "ui-button-icon-only", buttonIcons: "ui-button-text-icons", buttonTextOnlyClass: "ui-button-text-only"} }); p.igProgressBar({ animate: i._const.isProgressBarAnimationEnabled, animateTimeout: i._const.animateProgressBarInterval, range: i._const.isProgressBarRange, value: 0 }); if (!q.showFileExtensionIcon) { a("#" + k).css("display", "none") } m = a("#" + l); v = a("#" + r); c = i._getOnlyFileName(c); p.data("originalFileName", c); if (c.length > i._const.fileNameLimit) { c = c.substr(0, i._const.fileNameLimit) } m.text(i._formatFilePath(c)); i._renderFileName(w, 0, c) }, _renderFileName: function (m, d, i) { var g = this, j = g.options, b = i, k = "", n, h = a("#" + g._id("_pbrflnm", m)), l = a("#" + g._id("_pbrflsz", m)), f = a("#" + g._id("_snglpbar", m)).width(), e = a("#" + g._id("_snglpbar", m)), c = l.width(); if (b === undefined || b === null) { b = e.data("fileName") } if (f <= 0) { b = j.labelProgressBarFileNameContinue; h.text(b) } else { if (d !== 0 && d !== undefined && d !== null) { n = l.text(); c = l.text(g._formatFileSize(d) + "/" + g._formatFileSize(d)).width(); l.text(n) } while (h.position().left + h.width() + c >= f && (k !== b)) { k = b; b = b.substr(0, b.length / 2); if (k === b && b.length - 1 > 1) { b = b.substr(0, (b.length - 1) / 2) } h.text(b + j.labelProgressBarFileNameContinue) } if (h.position().left + h.width() + l.width() >= f) { b = j.labelProgressBarFileNameContinue } } e.data("fileName", b) }, _removeSingleUpload: function (c) { var e = this, d = e._id("_fus", c), b = d + "_" + e._randomString(20); if (e.options.mode === "multiple") { a("#" + d).attr("id", b); e._renderAnimatedRemovingUpload(b) } else { if (e.options.mode === "single") { a("#" + d).hide().remove() } } }, _renderAnimatedRemovingUpload: function (b) { a("#" + b).slideUp(this._const.removeSingleUploadAnimationTimeout, function () { a(this).remove() }) }, startUpload: function (d) { var e = this, c = e._id("_frm", d), b = this.fileInfoData; if (d === null || b.filesInfo[d] === null || b.filesInfo[d] === undefined) { e._setError(e.options.errorMessageTryToStartNonExistingFile.replace("{0}", d), e._const.clientSideErrorCode.startUpload, "clientside"); return } if (b.filesInfo[d].status !== e._const.status.NotStarted) { return } a("#" + c).submit(); b.filesInfo[d].status = e._const.status.Started; b.filesInfo[d].innerStatus = e._const.status.Started; e._spbRenderProgress(); setTimeout(function () { e._getFileStatus(d, true) }, e._const.progressUpdateInterval) }, _getFileStatus: function (t, q) { var g = this, k = g.options, p = g._id("_frm", t), l = p + "_if", b = false, r = "", s = 0, n = 0, i = a("#" + l), c = this._getFileInfo(t), h = this.fileInfoData, e = g._getKey(t), f = h.filesInfo[t], d, m, j = ""; if (e === null || e === undefined) { return } e = e.replace("-$#", "").replace("#$-", ""); a.ajaxQueue("uploadrequestsqueue", { url: g._formatURL(k.progressUrl, a.param({ key: e, command: "status" })), dataType: "json", cache: false, success: function (o) { s = parseInt(o.bytesUploaded, 10); r = parseInt(o.status, 10); n = parseInt(o.size, 10); j = o.serverMessage; b = (r === g._const.status.Finished); d = parseInt(o.error, 10); m = (!isNaN(d) && d !== g._const.fileStatusNoError); if (f.innerStatus === g._const.status.Canceled && m) { return } if (m === true && r !== g._const.status.NoSuchFile) { g._removeUploadSetError(t, k.errorMessageOther.replace("{0}", d), d, "serverside", j); return } if (c !== null && c.status !== g._const.status.Canceled) { h.fileSizeUploaded -= c.uploadedBytes; if (c.sizeBytes === 0 || c.sizeBytes === null) { c.sizeBytes = n; h.fileSizeTotal += n } else { if (c.sizeBytes !== n) { n = c.sizeBytes } } if (b) { h.countUploadingFiles++ } c.uploadedBytes = s; c.status = r; h.fileSizeUploaded += c.uploadedBytes; g._spbRenderProgress(); if (g._trigger(g.events.fileUploading, null, { fileId: t, filePath: g._getOnlyFileName(i.val()), totalSize: n, uploadedBytes: s, fileStatus: r }) === false) { g.cancelUpload(t) } } if (b || r === g._const.status.Started) { if (b) { g._removeUploadingID(t); if (k.mode === "multiple") { g._spbCheckModeButton(); g._submitNextPendingId() } } g._renderStatus(t, s, n, b, q); if (!b) { setTimeout(function () { g._getFileStatus(t, false) }, g._const.progressUpdateInterval) } } else { if (r === g._const.status.NoSuchFile) { if (f !== null && f !== undefined && f.checksNoSuchFile === 0) { f.checksNoSuchFile++; setTimeout(function () { g._getFileStatus(t, false) }, g._const.doubleCheckRequestInterval) } else { g._removeUploadSetError(t, k.errorMessageNoSuchFile, "nosuchfilekeyid", "serverside", j) } } } }, error: function () { g._setError(k.errorMessageGetFileStatus, g._const.clientSideErrorCode.ajaxErrorGetFileStatus, "clientside") } }) }, _removeUploadSetError: function (f, b, g, h, d) { var c = this, e = this.options; c._removeIframe(f); c._removeFileUpload(f); c._setError(b, g, h, d); if (e.mode === "multiple") { c._spbCheckModeButton(); c._submitNextPendingId() } }, cancelUpload: function (m) { var d = this, i = d.options, k = null, c = d._id("_snglpbar", m), g = a("#" + c), f = a("#" + d._id("_frm", m) + "_if"), b = f.val(), n = 0, l = 0, h = null, j = this._getKey(m), e = this._getFileInfo(m); n = g.data("totalSize"); l = g.data("bytesUploaded"); if (n === undefined) { n = 0 } if (l === undefined) { l = 0 } if (e !== null) { if (e.status === d._const.status.Started) { e.innerStatus = d._const.status.Canceled; a.ajaxQueue("uploadrequestsqueue", { url: d._formatURL(i.progressUrl, a.param({ key: j, command: "cancel" })), dataType: "json", cache: false, success: function () { if (i.autostartupload === false && i.mode === "multiple") { k = a("#" + d._id("_spbtncncl")); h = k.data("ids"); h = d._removeElementFromArray(h, m); k.data("ids", h) } d._trigger(d.events.fileUploadAborted, null, { fileId: m, filePath: d._getOnlyFileName(b), uploadedBytes: l, totalSize: n, status: d._const.status.Canceled }); d._removeFileUpload(m) }, error: function () { d._setError(i.errorMessageCancelUpload, d._const.clientSideErrorCode.ajaxErrorCancelUpload, "clientside"); d._removeFileUpload(m) } }) } else { if (e.status === d._const.status.NotStarted) { if (i.mode === "single") { a("#" + this._id("_strtuplbtn")).hide(); a("#" + this._id("_bb")).igBrowseButton("option", "disabled", "false").show() } d._trigger(d.events.fileUploadAborted, null, { fileId: m, filePath: d._getOnlyFileName(b), uploadedBytes: 0, totalSize: n, status: d._const.status.NotStarted }); d._removeFileUpload(m) } } } d._disableBrowseButton(!d._checkMaxUploadingFilesCount()) }, _removeFileUpload: function (j) { var c = this, g = c.options, b = c._id("_cbtn", j), i = c._id("_snglpbar", j), k = a("#" + i), d = 0, h = 0, f = this.fileInfoData, e = this._getFileInfo(j); if (e === null) { c._setError(g.errorMessageTryToRemoveNonExistingFile.replace("{0}", j), c._const.clientSideErrorCode.removeFileUpload, "clientside"); return } d = k.data("totalSize"); h = k.data("bytesUploaded"); if (d === undefined) { d = 0 } if (h === undefined) { h = 0 } f.countTotalFiles--; e.status = c._const.status.Canceled; f.fileSizeUploaded -= e.uploadedBytes; f.fileSizeTotal -= e.sizeBytes; c._spbRenderProgress(); if (g.mode === "multiple") { c._removeUploadingID(j); c._removePendingId(j); c._removeIDBatch(j); if (this.allCancelled === false) { c._submitNextPendingId() } c._spbCheckModeButton() } a("#" + b).remove(); c._removeIframe(j); c._removeSingleUpload(j) }, _getKey: function (c) { var b = this.fileInfoData.filesInfo[c]; if (b !== null && b !== undefined) { return b.key } else { return null } }, _singleFileUploadFinished: function (c) { var f = this.container(), d = this, b; a("#" + d._id("_cbtn", c)).igButton("option", "disabled", true).igButton("option", "icons", { primary: "ui-icon-check", secondary: null }); d._removeIframe(c); if (d.options.mode === "multiple") { d._enableClearAllButton(); b = f.data("finishedIDs"); if (b === undefined) { b = [] } b.push(c); f.data("finishedIDs", b) } }, _renderStatus: function (k, h, d, m) { var e = this, b, f, i = a("#" + e._id("_pbrflsz", k)), g = e._id("_snglpbar", k), l = a("#" + g), c = 0, j; if (m) { h = d; e._singleFileUploadFinished(k) } if (d !== 0 && isNaN(h) === false && isNaN(d) === false) { c = (h / d) * 100 } l.data("totalSize", d); l.data("bytesUploaded", h); j = l.data("isFileNameRendered"); b = l.data("fileName"); f = l.data("originalFileName"); l.igProgressBar("option", "value", c); i.text(e._formatFileSize(h) + "/" + e._formatFileSize(d)); if (j !== true) { l.data("isFileNameRendered", true); e._renderFileName(k, d) } if (m) { e._trigger(e.events.fileUploaded, null, { fileId: k, filePath: f, totalSize: h }); if (e._checkMaxUploadingFilesCount() === false) { e._disableBrowseButton(true); return } } }, _formatURL: function (c, b) { if (c.indexOf("?") === -1) { c += "?" } c += b; return c }, _showHideIcons: function (b) { var d = this.fileInfoData.filesInfo, c; for (c in d) { if (d[c] !== undefined) { a("#" + this._id("_icn", c)).css(b) } } }, _setWidthHeightAllUploads: function (b, e) { var f = this.fileInfoData.filesInfo, d = ((e) ? "height" : "width"), c; for (c in f) { if (f[c] !== undefined) { a("#" + this._id("_snglpbar", c)).igProgressBar("option", d, b) } } }, _setOption: function (d, b) { var c = this.options.mode; a.Widget.prototype._setOption.apply(this, arguments); switch (d) { case "width": this.container().width(b); a("#" + this._id("_bmncntr")).width(b); this._reRenderFileSizeMetrics(); break; case "height": this.container().height(b); a("#" + this._id("_bmncntr")).height(b); break; case "labelUploadButton": a("#" + this._id("_ibb")).igBrowseButton("option", "labelText", b); break; case "labelAddButton": a("#" + this._id("_bb")).igBrowseButton("option", "labelText", b); break; case "labelClearAllButton": a("#" + this._id("_clrabtn")).igButton("option", "labelText", b); break; case "labelSummaryTemplate": case "labelSummaryProgressBarTemplate": this._spbRenderProgress(); break; case "labelShowDetails": case "labelHideDetails": this._setShowHideDetailsButtonText(a("#" + this._id("_shdbtn")).is("hidden")); a("#" + this._id("_shdbtn")).text(b); break; case "labelSummaryProgressButtonCancel": if (this.spbButtonMode === this.summaryButtonModes.cancel) { a("#" + this._id("_spbtncncl")).igButton("option", "labelText", b) } break; case "labelSummaryProgressButtonContinue": if (this.spbButtonMode === this.summaryButtonModes.startupload) { a("#" + this._id("_spbtncncl")).igButton("option", "labelText", b) } break; case "labelSummaryProgressButtonDone": if (this.spbButtonMode === this.summaryButtonModes.done) { a("#" + this._id("_spbtncncl")).igButton("option", "labelText", b) } break; case "showFileExtensionIcon": b = Boolean(b); this._showHideIcons({ display: ((!b) ? "none" : "block") }); break; case "fileSizeMetric": this._reRenderFileSizeMetrics(); break; case "fileSizeDecimalDisplay": this._reRenderFileSizeMetrics(); break; case "maxUploadedFiles": this._disableBrowseButton(!this._checkMaxUploadingFilesCount()); break; case "mode": if (c !== b) { this.destroy(); this._create() } break } }, _reRenderFileSizeMetrics: function () { var m = this.fileInfoData.filesInfo, f = m.length, c, j = 0, e = this, d, b, g, n, k, h = 0; for (c = 0; c < f; c++) { n = a("#" + e._id("_pbrflsz", c)); if (n.length === 0) { continue } d = m[c].sizeBytes; j = m[c].uploadedBytes; k = a("#" + e._id("_snglpbar", c)); if (d !== 0 && isNaN(j) === false && isNaN(d) === false) { h = (j / d) * 100 } b = k.data("fileName"); g = k.data("originalFileName"); n.text(e._formatFileSize(j) + "/" + e._formatFileSize(d)); k.data("isFileNameRendered", true); e._renderFileName(c, d); a("#" + e._id("_summpbrlbl_1")).width(a("#" + this._id("_summpbar")).width()) } this._spbRenderProgress() }, destroy: function () { var d = a("#" + this._id("_ibb")), c = a("#" + this._id("_bb")), b = a("#" + this._id("_bmncntr")); this.originalElement.show().unwrap(); d.igBrowseButton("destroy"); c.igBrowseButton("destroy"); d.remove(); b.remove(); this.container().remove(); a.Widget.prototype.destroy.apply(this, arguments) }, _getFileSize: function (h, j) { var b = this, f = this.options, g = this._id("_fszfrm", h), k = a("#" + b._id("_frm", h) + "_if"), e = this._id("_fszifrm", h), i = a("#" + this._id("_fu")), c, d = b._formatURL(f.uploadUrl, a.param({ key: j, command: "fileSize" })); a('<iframe src="javascript:false;" id="' + e + '" name="' + e + '"></iframe>').appendTo(i).css({ display: "none" }); a('<form method="post" id="' + g + '" target="' + e + '" enctype="multipart/form-data"></form>').appendTo(i).css({ display: "none" }).attr("action", d); c = a("#" + g); k.appendTo(c); c.submit(); c.remove(); a("#" + e).ready(function () { setTimeout(function () { b._sendRequestFileSize(h, j) }, b._const.timeoutGetFileSize) }); k.appendTo(a("#" + b._id("_frm", h))) }, _removeGetFileSizeHTML: function (b) { var d = a("#" + this._id("_fszifrm", b)), c = a("#" + this._id("_fszfrm", b)); d.remove(); c.remove() }, _sendRequestFileSize: function (h, i) { var c = this, f = c._id("_snglpbar", h), j = a("#" + f), e = this.options, b = 0, d = this.fileInfoData, g = this._getFileInfo(h); if (g.sizeBytes !== 0) { return } a.ajaxQueue("uploadrequestsqueue", { url: c._formatURL(e.progressUrl, a.param({ key: i, command: "fileSize" })), dataType: "json", cache: false, success: function (k) { b = parseInt(k.fileSize, 10); if (isNaN(b) === true) { return } j.data("totalSize", b); if (g !== null) { g.sizeBytes = b; d.fileSizeTotal += b; c._spbRenderProgress() } c._renderStatus(h, 0, b, false, false); c._removeGetFileSizeHTML(h) }, error: function () { c._setError(e.errorMessageAJAXRequestFileSize, c._const.clientSideErrorCode.ajaxErrorRequestFileSize, "clientside"); c._removeGetFileSizeHTML(h) } }) }, _onShowHideDetailsClick: function () { var c = this, b = a("#" + c._id("_fc")), d = b.css("margin-top"), e = b.css("margin-bottom"); if ((a.browser.msie === true && a.browser.version.slice(0, 1) === "6") || (a.browser.msie === true && a.browser.version.slice(0, 1) === "7")) { c._setShowHideDetailsButtonText(b.is(":hidden")); if (b.is(":hidden")) { b.show() } else { b.hide() } } else { b.css({ "margin-top": 0, "margin-bottom": 0 }); b.slideToggle(c._const.showHideDetailsAnimationTimeout, function () { b.css({ "margin-top": d, "margin-bottom": e }); c._setShowHideDetailsButtonText(b.is(":hidden")) }) } }, _setShowHideDetailsButtonText: function (c) { var b = this.options, d = a("#" + this._id("_shdbtn")); if (c) { d.text(b.labelShowDetails); d.attr("title", a.ig.Upload.locale.titleShowDetailsButton) } else { d.text(b.labelHideDetails); d.attr("title", a.ig.Upload.locale.titleHideDetailsButton) } }, getFileInfoData: function () { return this.fileInfoData }, cancelAll: function () { var c, b = this.fileInfoData, j = b.uploadingIDs, e = j.length, d = b.pendingQueueIDs, f = d.length, g = b.batch, h = g.length; this.allCancelled = true; for (c = 0; c < e; c++) { if (j[c] !== undefined) { this.cancelUpload(j[c]) } } for (c = 0; c < f; c++) { if (d[c] !== undefined) { this.cancelUpload(d[c]) } } for (c = 0; c < h; c++) { if (g[c] !== undefined) { this.cancelUpload(g[c]) } } j = []; d = []; g = []; a("#" + this._id("_spbtncncl")).data("ids", []); this.allCancelled = false }, _submitAllFormsUpload: function () { var c = this, b, f, g = this.fileInfoData.batch, d = g.length, h = [], e = []; for (b = 0; b < d; b++) { f = g[b]; if (c._checkCanUpload()) { c._addUploadingID(f); c.startUpload(f); h.push(f) } else { c._addPendingId(f); e.push(f) } } this.fileInfoData.batch = [] }, _spbRenderInit: function () { var r = this, j = this.options, p = r.css, d = this._id("_fu"), k = j.labelSummaryProgressButtonContinue, l = this._id("_spbcntr"), f = this._id("_summpbrlbl"), i = this._id("_summpbar"), h = this._id("_summplbl"), c = this._id("_shdbtn"), g = this._id("_spbtncncl"), n = this._id("_spdtlbtn"), m, s = "", b, q = "progressData", e = a.ig.Upload.locale.titleSummaryProgressButtonContinue; s += '<div id="$summaryProgressContainerId$">'; s += '   <div  class="' + p.summaryInformationContainerClass + '">'; s += '       <span id="$summaryProgressLabelId$" class="' + p.summaryUploadedFilesLabelClass + '"></span><a href="javascript:void(0);" id="$showHideDetailsId$" class="' + p.summaryShowHideDetailsButtonClass + '">$labelShowHideDetails$</a>'; s += "   </div>"; s += '   <div class="' + p.clearClass + '">'; s += '       <button id="$summaryProgressButtonCancelId$"></button>'; s += '       <div id="$summaryProgressBarId$"></div>'; s += "   </div>"; s += "</div>"; s = s.replace("$summaryProgressContainerId$", l).replace("$summaryProgressLabelId$", h).replace("$summaryProgressDetailsButtonId$", n).replace("$summaryProgressBarId$", i).replace("$showHideDetailsId$", c).replace("$labelShowHideDetails$", j.labelHideDetails).replace("$labelSummaryProgressButtonCancel$", j.labelSummaryProgressButtonCancel).replace("$summaryProgressButtonCancelId$", g); a(s).appendTo(a("#" + d)); b = { IDs: {}, CurrentUploadedFiles: 0, CurrentUploadedSize: 0, TotalFileSize: 0, TotalFiles: 0, UploadingFiles: 0 }; a("#" + l).data(q, b).addClass(p.summaryProgressContainerClass + " " + p.clearClass); m = a("#" + i); a('<span id="' + f + '"></span>').addClass(p.summaryProgressbarLabelClass).appendTo(m.igProgressBar({ animate: r._const.isProgressBarAnimationEnabled, animateTimeout: r._const.animateProgressBarInterval, range: r._const.isProgressBarRange, value: 0 }).addClass(p.summaryProgressBarClass)); a('<div id="' + f + '_1"></div>').width(m.width()).addClass(p.summaryProgressBarSecondaryLabel).appendTo(a("#" + this._id("_summpbar_progress")).addClass(p.summaryProgressBarInnerProgress)); a("#" + c).bind({ click: function (o) { o.preventDefault(); r._onShowHideDetailsClick() } }); if (a.ig.Upload.locale.titleHideDetailsButton !== false) { a("#" + c).attr("title", a.ig.Upload.locale.titleHideDetailsButton) } if (j.autostartupload) { k = j.labelSummaryProgressButtonCancel; e = a.ig.Upload.locale.titleSummaryProgressButtonCancel; this.spbButtonMode = this.summaryButtonModes.cancel } a("#" + g).igButton({ labelText: k, title: e, disabled: false, click: function (o) { o.preventDefault(); r._spbOnClickButton(o) } }).addClass(p.summaryButtonClass) }, _spbRenderProgress: function () { var h = this.options, k = a("#" + this._id("_summpbar")), e = a("#" + this._id("_summplbl")), g = a("#" + this._id("_summpbrlbl")), j = a("#" + this._id("_summpbrlbl_1")), d = "", b = 0, c = this.fileInfoData, i = c.fileSizeTotal, f = c.fileSizeUploaded; if (i !== 0 && isNaN(i) === false) { b = (f / i) * 100 } else { if (i === 0) { b = 0 } } if (c.countUploadingFiles === c.countTotalFiles) { if (c.countTotalFiles === 0) { b = 0 } else { b = 100 } f = i } k.igProgressBar("option", "value", b); d = h.labelSummaryProgressBarTemplate.replace("{0}", this._formatFileSize(f)).replace("{1}", this._formatFileSize(i)).replace("{3}", b); e.html(h.labelSummaryTemplate.replace("{0}", c.countUploadingFiles).replace("{1}", c.countTotalFiles)); g.text(d); j.text(d) }, _spbOnClickButton: function (c) { var d = this.summaryButtonModes, b = this.spbButtonMode; c.preventDefault(); if (b === d.cancel) { this._trigger(this.events.cancelAllClicked, c); this.cancelAll() } else { if (b === d.startupload) { this._spbSubmitAllButton() } } }, _spbSubmitAllButton: function () { this._submitAllFormsUpload(); this._spbCheckModeButton() }, _spbCheckModeButton: function () { var b = this.fileInfoData; if (this.options.autostartupload) { if (b.pendingQueueIDs.length > 0 || b.uploadingIDs.length > 0) { this._spbSetCancelButton() } else { this._spbSetButtonDone() } } else { if (b.pendingQueueIDs.length === 0 && b.uploadingIDs.length === 0) { if (b.batch.length > 0) { this._spbSetContinueButton() } else { this._spbSetButtonDone() } } else { this._spbSetCancelButton() } } }, _spbSetButtonDone: function () { var c = this.options, b = a("#" + this._id("_spbtncncl")); this.spbButtonMode = this.summaryButtonModes.done; b.igButton("option", "labelText", c.labelSummaryProgressButtonDone).igButton("option", "title", a.ig.Upload.locale.titleSummaryProgressButtonDone).igButton("option", "disabled", true) }, _spbSetContinueButton: function () { var c = this.options, b = a("#" + this._id("_spbtncncl")); this.spbButtonMode = this.summaryButtonModes.startupload; b.igButton({ title: a.ig.Upload.locale.titleSummaryProgressButtonContinue, labelText: c.labelSummaryProgressButtonContinue, disabled: false }) }, _spbSetCancelButton: function () { var b = a("#" + this._id("_spbtncncl")); this.spbButtonMode = this.summaryButtonModes.cancel; b.igButton("option", "labelText", this.options.labelSummaryProgressButtonCancel).igButton("option", "title", a.ig.Upload.locale.titleSummaryProgressButtonCancel).igButton("option", "disabled", false) }, _getFileInfo: function (b) { var c = this.fileInfoData.filesInfo[b]; if (c === undefined || c === null) { return null } return c }, _formatFilePath: function (b) { var c = b.lastIndexOf("/"); b = b.replace(/(\/|\\)$/, ""); if (c === -1) { c = b.lastIndexOf("\\") } return b.substring(c + 1) }, _checkCanUpload: function () { var b = this.options, c = this.fileInfoData, d = true, e = b.maxSimultaneousFilesUploads; if (b.mode === "multiple" && e !== null && c.uploadingIDs.length >= e) { d = false; if (e <= 0) { this._setError(b.errorMessageMaxSimultaneousFiles, this._const.clientSideErrorCode.checkCanUpload, "clientside") } } return d }, _addPendingId: function (b) { this.fileInfoData.pendingQueueIDs.push(b) }, _removePendingId: function (c) { var d = this.fileInfoData.pendingQueueIDs, b; if (c !== undefined && c !== null) { b = c; this.fileInfoData.pendingQueueIDs = this._removeElementFromArray(d, b) } else { b = d.shift(); if (b === undefined) { b = null } } return b }, _addUploadingID: function (b) { this.fileInfoData.uploadingIDs.push(b) }, _removeUploadingID: function (b) { this.fileInfoData.uploadingIDs = this._removeElementFromArray(this.fileInfoData.uploadingIDs, b) }, _addIDBatch: function (b) { this.fileInfoData.batch.push(b) }, _removeIDBatch: function (b) { this.fileInfoData.batch = this._removeElementFromArray(this.fileInfoData.batch, b) }, _submitNextPendingId: function () { var b = this, c; if (b._checkCanUpload() === true) { c = b._removePendingId(); if (c !== null) { b._addUploadingID(c); b.startUpload(c) } } }, _randomString: function (b) { var e = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXTZabcdefghiklmnopqrstuvwxyz", c = "", f, d; for (f = 0; f < b; f++) { d = Math.floor(Math.random() * e.length); c += e.substring(d, d + 1) } return c }, _cutFilePath: function (d, c) { var b = d.length; if (b <= c) { return d } }, _getOnlyFileName: function (b) { var c = ""; if (b === null || b === undefined) { return "" } if (b.indexOf("/") !== -1) { c = "/" } else { if (b.indexOf("\\") !== -1) { c = "\\" } } if (c !== "") { b = b.substr(b.lastIndexOf(c) + 1) } return b }, _getFileExtension: function (b) { return b.substring(b.lastIndexOf(".") + 1) }, _validateFileExtension: function (c) { var d = "", b = this.options.allowedExtensions; if (b.length === 0) { return true } else { d = c.substring(c.lastIndexOf(".") + 1); return a.inArray(d, b) >= 0 } }, _getFileExtensionIconPath: function (f) { var e = this.options.fileExtensionIcons, c, b = "", d = e.length; f = String(f).toLowerCase(); for (c = 0; c < d; c++) { if (e[c].ext !== undefined && (e[c].ext === f || a.inArray(f, e[c].ext) !== -1)) { b = e[c].css; break } else { if (b === "" && e[c].def === true) { b = e[c].css } } } return b }, _setError: function (e, d, g, b) { var c = this.options, f = this._const.errorCode; if (b === undefined) { b = "" } if (g === "serverside") { switch (d) { case f.MimeTypeValidation: e = c.errorMessageValidatingFileExtension; break; case f.FileSizeExceeded: e = c.errorMessageMaxFileSizeExceeded; break } } this._trigger(this.events.onError, null, { errorCode: d, errorMessage: e, errorType: g, serverMessage: b }) }, _formatFileSize: function (c) { var d = this.options.fileSizeMetric, b = c; switch (d) { case "bytes": b = c + "B"; break; case "kbytes": b = this._convertToKBytes(c); break; case "mbytes": b = this._convertToMBytes(c); break; case "gbytes": b = this._convertToGBytes(c); break; case "auto": if (c < 1024) { b = c + "B" } else { if (c < 1024 * 1024) { b = this._convertToKBytes(c) } else { if (c < 1024 * 1024 * 1024) { b = this._convertToMBytes(c) } else { b = this._convertToGBytes(c) } } } break; default: break } return b }, _convertToKBytes: function (b) { var c = b / 1024; return c.toFixed(this.options.fileSizeDecimalDisplay) + "KB" }, _convertToMBytes: function (b) { var c = b / (1024 * 1024); return c.toFixed(this.options.fileSizeDecimalDisplay) + "MB" }, _convertToGBytes: function (b) { var c = b / (1024 * 1024 * 1024); return c.toFixed(this.options.fileSizeDecimalDisplay) + "GB" }, _removeElementArrayById: function (c, b) { if (c === undefined || c === null) { return [] } return a.grep(c, function (d) { return (d.id !== b) }) }, _removeElementFromArray: function (c, b) { if (c === undefined || c === null) { return [] } return a.grep(c, function (d) { return (d !== b) }) } }); a.extend(a.ui.igUpload, { version: "11.1.20111.2010" }) } (jQuery)); (function (a) { a.widget("ui.igRating", { options: { vertical: false, value: null, valueHover: null, voteCount: 5, voteWidth: 0, voteHeight: 0, swapDirection: false, valueAsPercent: true, focusable: true, precision: "exact", precisionZeroVote: 0.25, roundedDecimalPlaces: 3, theme: null, validatorOptions: null, cssVotes: null }, css: { normal: "ui-igrating ui-state-default ui-widget-content", active: "ui-igrating-active", selected: "ui-igrating-selected ui-state-highlight", hover: "ui-igrating-hover ui-state-hover", vote: "ui-igrating-vote ui-icon ui-icon-star", voteSelected: "ui-igrating-voteselected", voteDisabled: "ui-igrating-votedisabled ui-state-disabled", voteHover: "ui-igrating-votehover", voteDisabledSelected: "ui-igrating-votedisabledselected ui-state-disabled" }, events: { hoverChange: null, valueChange: null }, _create: function () { var e, d, l, m, j, i, b, h = { width: "100%", height: "100%", position: "relative", overflow: "hidden" }, f = this.options, c = this.element, k = this, g = this.css; d = this._count(f); l = c[0].style; k._old = { width: l.width, height: l.height, html: c[0].innerHTML }; if (!(e = f.targetID)) { c[0].innerHTML = "" } if (f.theme) { c.addClass(f.theme) } k._swap = f.swapDirection; k._hasHov = 0; b = k._elem = a("<div/>").css(h).addClass(g.normal).appendTo(c); i = a("<div/>").css(h).appendTo(b); if (f.focusable) { j = k._foc = a('<input type="button"/>').css({ left: "5px", top: "5px", opacity: 0.1, position: "absolute", width: "1px", height: "1px", padding: "0px", zIndex: -1, border: "0px", outline: 0 }).appendTo(i); j.focus(function (n) { if (f.disabled || k._fcs) { return } k._fcs = 1; if (k._hasHov < 2) { k._hasHov += 2 } if (k._hov) { k._doVal(k._valH, 1, n); k._hov.css("visibility", "visible") } k._elem.addClass(g.active) }); j.blur(function (n) { if (f.disabled || !k._fcs) { return } k._fcs = null; k._hasHov %= 2; if (k._hov && k._hasHov === 0) { k._hov.css("visibility", "hidden") } k._elem.removeClass(g.active) }); j.keydown(function (s) { var r, v = 0, o = s.keyCode, q = a.ui.keyCode, p = k._valH, n = f.swapDirection ? -1 : 1, u = f.vertical, t = 1 / k._count(f); if (f.disabled) { return } r = p; t /= k._prec(f); if (o === q.SPACE || o === q.ENTER) { k._doVal(p, false, s); return } if (o === q.HOME) { p = 0 } else { if (o === q.END) { p = 1 } else { if (o === q.PAGE_DOWN) { p += t * 4 } else { if (o === q.PAGE_UP) { p -= t * 4 } else { if (o === q.UP && u) { p += (v = -t * n) } else { if (o === q.DOWN && u) { p += (v = t * n) } else { if (o === q.LEFT && !u) { p += (v = -t * n) } else { if (o === q.RIGHT && !u) { p += (v = t * n) } } } } } } } } for (o = 0; o < 3; o++) { if (r !== (p = Math.max(Math.min(p, 1), 0))) { if (k._doVal(p, 1, s) && v) { p += v; continue } } break } }) } k._doVotes(f, i); if (e) { m = a("input[name=" + e + "]"); if (m.length <= 0) { m = a("#" + e) } l = m[0] ? m[0].value : null; if (l) { f.value = k._toNum(l, f) } } k._val = k._toNum(f.value, f); l = f.valueHover; k._valH = (l === null) ? k._val : k._toNum(l, f); if (!f.valueAsPercent) { k._val /= d; k._valH /= d } k._validator(); k._doVal(k._val, null, m ? 2 : m); k._doVal(k._valH, 1); b.bind(k._evts = { mousedown: function (n) { k._doEvt(n, 1) }, mousemove: function (n) { k._doEvt(n, 2) }, mouseleave: function (n) { k._doEvt(n, 3) } }) }, _toNum: function (b, c) { if (!b) { return 0 } c = c._vsFormat; if (typeof b === "string") { b = parseFloat(c ? b.replace(c, "_").replace(/[`,\. \':]/g, "").replace("_", ".") : b) } return (isNaN(b) || b < 0) ? 0 : b }, _count: function (b) { b = parseInt(b.voteCount, 10); return isNaN(b) ? 5 : Math.max(b, 1) }, _doVotes: function (s, r) { var j, g, b, n, w, f, e, h, l = r, p = this._count(s), v = { width: "100%", height: "100%" }, m = { left: "0px", top: "0px", position: "absolute", overflow: "hidden", border: "none", background: "none" }, d = -1, c = this, u = this.css, q = this._elem, t = this.element; if (!r) { r = c._div.parent(); c._div.remove(); c._hov.remove(); c._sel.remove(); c._selSwap = c._hovSwap = null } f = c._div = a("<div/>").addClass(u.vote).css(m).appendTo(r); if (!s.vertical) { f.css("whiteSpace", "nowrap") } n = parseInt(s.voteHeight, 10); w = parseInt(s.voteWidth, 10); if (isNaN(n) || n < 2) { n = f.css("height"); n = (!n || n.indexOf("px") < 1) ? 16 : parseInt(n, 10) } if (isNaN(w) || w < 2) { w = f.css("width"); w = (!w || w.indexOf("px") < 1) ? 16 : parseInt(w, 10) } f.removeClass(u.vote); g = c._sel = a("<div/>").addClass(u.selected).css(v).css(m).appendTo(r); if (!s.vertical) { g.css("whiteSpace", "nowrap") } j = c._hov = a("<div/>").addClass(u.hover).css(v).css(m).css("visibility", "hidden").appendTo(r); if (!s.vertical) { j.css("whiteSpace", "nowrap") } if (c._swap && !s.vertical) { c._hovSwap = j = a("<div/>").css(v).appendTo(c._hov); c._selSwap = g = a("<div/>").css(v).appendTo(c._sel) } b = { display: s.vertical ? "block" : "inline-block", width: w, height: n, textIndent: "0px", overflow: "visible" }; while (++d < p) { e = a("<span />").addClass(u.vote).css(b).appendTo(f); if (s.disabled) { e.addClass(u.voteDisabled) } h = s.cssVotes ? s.cssVotes[d] : null; if (h && h[0]) { e.addClass(h[0]) } e[0]._i = d; e = a("<span />").addClass(u.vote).addClass(u.voteSelected).css(b).appendTo(g); if (s.disabled) { e.addClass(u.voteDisabledSelected) } if (h && h[1]) { e.addClass(h[1]) } e[0]._i = d; if (c._swap && !c._selSwap) { c._selSwap = e } e = a("<span />").addClass(u.vote).addClass(u.voteHover).css(b).appendTo(j); if (h && h[2]) { e.addClass(h[2]) } e[0]._i = d; if (c._swap && !c._hovSwap) { c._hovSwap = e } } if (s.vertical) { c._size = n; n *= p } else { c._size = w; w *= p } q.css({ height: n + "px", width: w + "px" }); try { n += ((d = Math.max(q.outerHeight() - q.innerHeight(), 0)) > 10) ? 2 : d; w += ((d = Math.max(q.outerWidth() - q.innerWidth(), 0)) > 10) ? 2 : d } catch (k) { } t.css({ height: n + "px", width: w + "px" }); f.css(v); if (!l) { c.value(c.value()) } }, _validator: function (c) { var b = this.options.validatorOptions, d = this._foc; if (d && d.igValidator && (b || this._vld)) { if (c || !b) { b = "destroy"; delete this._vld } else { b.element = this.element.find(":first-child"); this._vld = 1 } d.igValidator(b) } }, _doEvt: function (f, d) { var e, b = this, c = this.options; if (c.disabled) { return } if (d === 3) { b._hasHov -= b._hasHov % 2; if (b._hov && b._hasHov === 0) { b._hov[0].style.visibility = "hidden" } return } e = b._valFromEvt(f); if (e < 0) { return } if (d === 1) { if (!b._sel) { return } b._doVal(e, false, f); b._doVal(e, 1, f); if (b._foc && document.hasFocus && !document.hasFocus()) { return setTimeout(function () { b.focus() }, 0) } else { b.focus() } } if (d === 2) { if (!b._hov) { return } if (b._hasHov % 2 === 0) { b._hasHov++ } b._hov[0].style.visibility = "visible"; b._doVal(e, 1, f) } f.preventDefault() }, _setOption: function (g, d) { var b, c, f, e = this.options; if (e[g] === d || g === "swapDirection" || g === "vertical" || g === "focusable") { return } c = this._count(e); if (g === "disabled") { b = a("SPAN", this._div); f = this.css.voteDisabled; if (b.length !== c) { return } if (d) { b.addClass(f) } else { b.removeClass(f) } b = a("SPAN", this._sel); f = this.css.voteDisabledSelected; if (b.length !== c && this._selSwap) { b = a("SPAN", this._selSwap) } if (b.length === c) { if (d) { b.addClass(f) } else { b.removeClass(f) } } } if (g === "theme") { if (e.theme) { this.element.removeClass(e.theme) } if (d) { this.element.addClass(d) } } e[g] = d; if (g === "precision" || g === "valueAsPercent") { this._doVal(this._val, false, 1); this._doVal(this._valH, 1, 1) } if (g.indexOf("vote") === 0 || g === "theme" || g === "cssVotes") { this._doVotes(e) } if (g.indexOf("value") >= 0) { this._doVal(d, g.length > 6, 1, 1) } if (g === "validatorOptions") { this._validator() } }, _valFromEvt: function (f) { var h, j, d, b, c, e = this.options, g = f ? f.target : null; c = (g && g.nodeName === "SPAN") ? g._i : null; if (c === null || c === undefined) { return -1 } if (!g.unselectable) { g.unselectable = "on" } b = e.vertical ? f.offsetY : f.offsetX; if (b === null || b === undefined) { b = e.vertical ? f.layerY : f.layerX } h = this._size; j = -(e.vertical ? g.offsetTop : g.offsetLeft); if (this._swap && a.browser.mozilla && j < h) { b += j } h *= c; if (h > b) { b += h } d = b / this._count(e) / this._size; if (this._swap) { d = 1 - d } return Math.max(Math.min(d, 1), 0) }, _doVal: function (g, l, j, k) { var h, m, b, f, i = this.options, c = l ? this._hov : this._sel, e = this._size, d = this._swap ? (l ? this._hovSwap : this._selSwap) : null; if (c) { c = c[0]; if (c) { c = c.style } } if (!c) { return } f = this._count(i); if (k) { g = parseFloat(g) } if (isNaN(g)) { g = -1 } else { if (k && !i.valueAsPercent) { g /= f } } if (j && j.type && g >= 0) { k = this._fixVal(l ? this._valH : this._val, 1); b = this._fixVal(g, 1); if (k === b) { return 1 } if (!this._trigger(l ? "hoverChange" : "valueChange", j, { value: b, oldValue: k })) { return } } if (g < 0 && l) { g = this._val } g = this._fixVal(g); if (j) { k = this._round(i.valueAsPercent ? g : g * f, i); if (l) { this._valH = g; i.valueHover = k } else { if (j !== 2) { this._val = g; i.value = k } h = i.targetID; if (h) { m = a("input[name=" + h + "]"); if (m.length <= 0) { m = a("#" + h) } b = i._vsFormat; m.val(b ? k.toString().replace(".", b) : k) } } } if (!l && this._foc) { this._foc.val(this._fixVal(g, 1)) } if (d) { g = 1 - g } g = Math.floor(g * e * f + 0.3); g += "px"; if (d) { d = d[0]; if (d) { d = d.style } } if (i.vertical) { if (d) { c.top = g; d.marginTop = "-" + g } else { c.height = g } } else { if (d) { c.left = g; d.marginLeft = "-" + g } else { c.width = g } } }, _prec: function (b) { b = b.precision; if (b) { b = b.toLowerCase() } return (b === "half") ? 2 : ((b === "whole") ? 1 : 4) }, _fixVal: function (d, b) { var f, g, c, e = this.options; f = this._prec(e); c = this._count(e); d = Math.max(Math.min(d, 1), 0); if (f < 4) { g = c * f; d *= g; d = (d < e.precisionZeroVote) ? 0 : Math.floor(Math.floor(d + 0.99) + 0.499 * f) / g } if (!b) { return d } if (!e.valueAsPercent) { d *= c; d = (f > 1) ? d : Math.floor(d + 0.1) } return this._round(d, e) }, _round: function (d, b) { var e = 1, c = parseInt(b.roundedDecimalPlaces, 10); if (isNaN(c) || c < 0) { return d } c = Math.min(15, Math.max(c, (this._prec(b) < 4) ? 3 : (b.valueAsPercent ? 1 : 0))); while (c-- > 0) { e *= 10 } return Math.round(d * e) / e }, value: function (b) { var c = this.options; if (typeof b !== "number") { return this._fixVal(this._val, 1) } this._doVal(b, false, 1, 1); return this }, valueHover: function (b) { var c = this.options; if (typeof b !== "number") { return this._fixVal(this._valH, 1) } this._doVal(b, 1, 1, 1); return this }, hasFocus: function () { return this._fcs === 1 }, focus: function () { if (this._foc) { try { this._foc[0].focus() } catch (b) { } } return this }, destroy: function () { var b = this.options, d = this._old, c = this.element; if (!this._elem) { return this } this._validator(1); if (this._foc) { this._foc.unbind().remove() } this._elem.remove(); if (b.theme) { c.removeClass(b.theme) } c[0].style.width = d.width; c[0].style.height = d.height; if (!b.targetID) { c[0].innerHTML = d.html } a.Widget.prototype.destroy.apply(this, arguments); this._elem = this._hov = this._sel = this._selSwap = this._hovSwap = this._foc = this._evts = null; return this } }); a.extend(a.ui.igRating, { version: "11.1.20111.2010" }) } (jQuery)); if (typeof (jQuery) === "undefined") { throw new Error("The Infragistics HTML5 Video Player requires jQuery to be loaded") } (function (a) { a.widget("ui.igVideoPlayer", { _const: { VOLUME_MAX: 1, VOLUME_MIN: 0, VIDEO_STATE_TIMEOUT: 200, SCROLL_TIMEOUT: 100, COMMERCIAL_SEEK_DELTA: 2, SLIDE_SEEK_TIMEOUT: 500, HREF: "#" }, _id: function (b) { return this.element[0].id + b }, options: { sources: [], width: null, height: null, posterUrl: "", preload: false, autoplay: false, autohide: true, volumeAutohideDelay: 1000, centerButtonHideDelay: 1200, loop: false, browserControls: false, fullscreen: false, volume: 0.5, muted: false, title: "", showSeekTime: true, progressLabelFormat: "${currentTime} / ${duration}", bookmarks: [{ time: 0, title: "", disabled: false}], relatedVideos: [{ imageUrl: "", title: "", width: null, height: null, link: "", sources: [], css: null}], banners: [{ imageUrl: "", times: [], closeBanner: true, animate: true, visible: true, duration: 1000, autohide: false, hidedelay: 10000, link: null, width: null, height: null, css: null}], commercials: { linkedCommercials: [{ sources: [], startTime: 10, link: "", title: ""}], embeddedCommercials: [{ startTime: 20, endTime: 30, link: "", title: ""}], alwaysPlayCommercials: false, showBookmarks: true, adMessage: { animate: true, autoHide: true, hideDelay: 20000, animationDuration: 1000}} }, events: { ended: "ended", playing: "playing", paused: "paused", buffering: "buffering", progress: "progress", waiting: "waiting", bookmarkHit: "bookmarkHit", bookmarkClick: "bookmarkClick", enterFullScreen: "enterFullScreen", exitFullScreen: "exitFullScreen", relatedVideoClick: "relatedVideoClick", bannerVisible: "bannerVisible", bannerHidden: "bannerHidden", bannerClick: "bannerClick", browserNotSupported: "browserNotSupported" }, css: { baseClasses: "ui-widget ui-igplayer", controlsClass: "ui-widget-header ui-igplayer-controls ui-igplayer-grid ui-igplayer-autohide ui-corner-all", controlsHideClass: "ui-igplayer-controls-hide", videoClass: "ui-igplayer-video", unsupportedBrowserClass: "ui-igvideoplayer-non-html5-supported-message ui-helper-clearfix", activeVideoClass: "ui-igplayer-active-video", playButtonClass: "ui-igplayer-playbutton", progressBarClass: "ui-igplayer-progressbar ui-corner-all", fullScreenClass: "ui-igplayer-fullscreen-button", fullScreenIconClass: "ui-icon ui-igbutton-icon ui-icon-arrow-4-diag", volumeControlClass: "ui-igplayer-volumecontrol", volumeSliderClass: "ui-igplayer-volumeslider", progressLabelClass: "ui-igplayer-progresslabel", bookmarkContainerClass: "ui-widget ui-igplayer-bookmark-container", bookmarkContainerHeaderClass: "ui-widget-header ui-igplayer-bookmark-header", bookmarkListClass: "ui-widget-content ui-igplayer-bookmark-list", bookmarkItemDisabledClass: "ui-igplayer-bookmark-item-disabled", bookmarkItemTimeClass: "ui-igplayer-bookmark-item-time", bookmarkItemTitleClass: "ui-igplayer-bookmark-item-title", bookmarkActiveItemClass: "ui-igplayer-bookmark-active-item", relatedVideosContainerClass: "ui-igplayer-related-video-container", relatedVideosOuterContainerClass: "ui-igplayer-related-video-outer-container", relatedVideoClass: "ui-igplayer-related-video", relatedVideoFirstClass: "ui-igplayer-related-video-first", relatedVideoLastClass: "ui-igplayer-related-video-last", relatedVideoHoverClass: "ui-igplayer-related-video-hover", relatedVideoScrollLeftClass: "ui-igplayer-related-scroller-left", relatedVideoScrollLeftIconClass: "ui-icon-triangle-1-w", relatedVideoScrollRightClass: "ui-igplayer-related-scroller-right", relatedVideoScrollRightIconClass: "ui-icon-triangle-1-e", relatedVideoScrollListClass: "ui-igplayer-related-list", relatedVideosHeaderClass: "ui-igplayer-related-video-header", relatedVideoBarClass: "ui-igplayer-related-video-bar", relatedVideoReplayClass: "ui-igplayer-related-video-replay", relatedVideoReplayIconClass: "ui-icon-arrowrefresh-1-s", bannerContainerClass: "ui-igplayer-banner-container", bannerClass: "ui-igplayer-banner ui-corner-all", bannerCloseClass: "ui-igplayer-banner-close", bannerCloseIconClass: "ui-icon-close", adMsgContainerClass: "ui-igplayer-ad-msg-container", adMsgClass: "ui-igplayer-ad-msg", adMsgCloseClass: "ui-igplayer-ad-msg-close", adMsgCloseIconClass: "ui-icon-close", linkedBookmarkClass: "ui-igplayer-linked-bookmark", adBookmarkClass: "ui-igplayer-ad-bookmark", unsupportedVideoSourceClass: "ui-igplayer-not-supported-video-source", unsupportedVideoSourceIconClass: "ui-igplayer-not-supported-video-source-icon", centerPlayButtonClass: "ui-igplayer-centerplaybutton-play", centerPauseButtonClass: "ui-igplayer-centerplaybutton-pause", centerPlayButtonIconClass: "ui-igplayer-centerplaybutton-icon", waitingIndicatorClass: "ui-igplayer-waiting", waitingIndicatorIconClass: "ui-igplayer-waiting-icon", seekTooltipClass: "ui-igplayer-seektooltip" }, widget: function () { return this.element }, _createWidget: function () { var b = this.options; b.bookmarks = []; b.relatedVideos = []; b.banners = []; b.commercials.linkedCommercials = []; b.commercials.embeddedCommercials = []; a.Widget.prototype._createWidget.apply(this, arguments) }, _create: function () { this.supportsVideo = this.supports_video(); if (this.element.is("div")) { this.container = this.element } else { if (this.element.is("video")) { this.container = a("<div></div>").attr("id", this._id("_container")).insertBefore(this.element); this.element.appendTo(this.container) } else { throw new Error(a.ig.VideoPlayer.locale.nonDivException) } } this._oldWidth = this.element.css("width"); this._oldHeight = this.element.css("height"); this._renderControl() }, _renderControl: function () { var b = this.options, d, c = this.css; this._prevReadyState = 0; this._bookmarksRendered = false; if (this.supportsVideo) { this._renderBanners() } this.currentVideo = d = this._createMainVideoElement().addClass(c.videoClass); if (b.disabled) { this.container.addClass("ui-state-disabled") } if (b.width) { d.css("width", b.width); this.container.css("width", b.width) } if (b.height) { d.css("height", b.height); this.container.css("height", b.height) } if (this.supportsVideo) { this._baseZIndex = parseInt(this.container.css("z-index"), 10) || 0; this._attachEvents(d); this._renderSources(b.sources, d); this._analyzeSource(d); setTimeout(a.proxy(this._onVideoStateChange, this), this._const.VIDEO_STATE_TIMEOUT); this._createBigPlayButton(); this._createWaitingIndicator(); this._renderEmbeddedCommercials(); this._renderCommercials(); d[0].muted = b.muted; if (b.muted && a.browser.webkit) { d[0].volume = 0 } else { if (b.volume >= this._const.VOLUME_MIN && b.volume <= this._const.VOLUME_MAX) { d[0].volume = b.volume } } if (!b.browserControls) { this._renderControls() } this._lastPausedState = d[0].paused; if (b.fullscreen) { this._setOption("fullscreen", true, true) } this._renderRelatedVideos() } else { this.currentVideo.hide(); this._renderUnsupportedBrowser() } a("#" + this._id("_detectError")).appendTo(this.container).bind({ click: function (e) { e.preventDefault() } }); this.container.addClass(c.baseClasses) }, _createVideoElement: function (b) { var c = a("<video></video>").attr("id", b); return c }, _saveExistingVideoProperties: function (b) { this._oldAutoPlay = b.attr("autoplay"); this._oldPreload = b.attr("preload"); this._oldLoop = b.attr("loop"); this._oldPoster = b.attr("poster"); this._oldControls = b.attr("controls"); this._oldSrc = b.attr("src"); this._oldMuted = b[0].muted; this._oldVolume = b[0].volume; b.removeAttr("autoplay"); b.removeAttr("preload"); b.removeAttr("loop"); b.removeAttr("poster"); b.removeAttr("controls"); b.removeAttr("src") }, _restoreExistingVideoProperties: function (b) { b.attr("autoplay", this._oldAutoPlay); b.attr("preload", this._oldPreload); b.attr("loop", this._oldLoop); b.attr("poster", this._oldPoster); b.attr("controls", this._oldControls); b.attr("src", this._oldSrc); b[0].muted = this._oldMuted; b[0].volume = this._oldVolume }, _createMainVideoElement: function () { var b = this.options, c = this.element.is("video"), d = (c ? this.element : this._createVideoElement(this._id("_video"))); if (c) { this._saveExistingVideoProperties(d) } if (b.autoplay) { d.attr("autoplay", true) } d.attr("preload", "metadata"); if (b.preload) { d.attr("preload", "auto") } if (b.browserControls) { d.attr("controls", true) } if (b.loop) { d.attr("loop", true) } if (b.posterUrl.length > 0) { d.attr("poster", b.posterUrl) } return d.appendTo(this.container) }, _renderUnsupportedBrowser: function () { if (this._trigger(this.events.browserNotSupported)) { var d = a("<div></div>").addClass(this.css.unsupportedBrowserClass).appendTo(this.container), c, b; if (a.browser.msie) { b = "Internet Explorer " + a.browser.version } else { if (a.browser.opera) { b = "Opera " + a.browser.version } else { if (a.browser.webkit) { b = "Webkit " + a.browser.version } else { if (a.browser.mozilla) { b = "Mozilla Firefox " + a.browser.version } else { b = a.browser.version } } } } a("<div></div>").addClass("ui-igvideoplayer-current-browser-label").html(a.ig.VideoPlayer.locale.currentBrowser.replace("{0}", b)).appendTo(d); a("<div></div>").addClass("ui-igvideoplayer-non-html5-text").html(a.ig.VideoPlayer.locale.unsupportedBrowser).appendTo(d); c = a("<ul></ul>").addClass("ui-igplayer-browsers-list").appendTo(d); a("<a></a>").attr("href", a.ig.VideoPlayer.locale.chromeDownload).attr("target", "_blank").addClass("ui-igplayer-chrome-icon").html(a.ig.VideoPlayer.locale.chrome8).appendTo(a("<li></li>").addClass("ui-corner-all").appendTo(c)); a("<a></a>").attr("href", a.ig.VideoPlayer.locale.firefoxDownload).attr("target", "_blank").addClass("ui-igplayer-firefox-icon").html(a.ig.VideoPlayer.locale.firefox36).appendTo(a("<li></li>").addClass("ui-corner-all").appendTo(c)); a("<a></a>").attr("href", a.ig.VideoPlayer.locale.operaDownload).attr("target", "_blank").addClass("ui-igplayer-Opera-icon").html(a.ig.VideoPlayer.locale.opera11).appendTo(a("<li></li>").addClass("ui-corner-all").appendTo(c)); a("<a></a>").attr("href", a.ig.VideoPlayer.locale.safariDownload).attr("target", "_blank").addClass("ui-igplayer-safari-icon").html(a.ig.VideoPlayer.locale.safari5).appendTo(a("<li></li>").addClass("ui-corner-all").appendTo(c)); a("<a></a>").attr("href", a.ig.VideoPlayer.locale.ieDownload).attr("target", "_blank").addClass("ui-igplayer-ie-icon").html(a.ig.VideoPlayer.locale.ie9).appendTo(a("<li></li>").addClass("ui-corner-all").appendTo(c)); this.container.addClass("ui-igvideoplayer-non-html5") } }, _renderRelatedVideoBar: function (d) { var c = this.css, b = this, e = a("<div></div>").attr("id", this._id("_rv_bar")).addClass(c.relatedVideoBarClass).appendTo(d); a("<a></a>").attr("id", this._id("_rv_bar_fs")).app
