From 341eb1790dc7a347c3faa165bb9027b383c5bbe5 Mon Sep 17 00:00:00 2001 From: "gamboa_at_co.sapo.pt" Date: Thu, 30 May 2013 17:40:50 +0100 Subject: [PATCH] Added JS bundles to release 2.0.0 --- VERSION | 2 +- js/ink-all.js | 26 +++++++++----------------- js/ink-all.min.js | 2 +- js/ink-ui.js | 26 +++++++++----------------- js/ink-ui.min.js | 2 +- 5 files changed, 21 insertions(+), 37 deletions(-) diff --git a/VERSION b/VERSION index 6ae756c47..227cea215 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.9.9 +2.0.0 diff --git a/js/ink-all.js b/js/ink-all.js index 3e04453f0..283a2ba51 100644 --- a/js/ink-all.js +++ b/js/ink-all.js @@ -11921,7 +11921,7 @@ Ink.createModule('Ink.UI.Sticky', '1', ['Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Do * @author inkdev AT sapo.pt * @version 1 */ -Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Ajax, Aux, Event, Css, Element, Selector, InkArray ) { +Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1','Ink.Util.String_1'], function(Ajax, Aux, Event, Css, Element, Selector, InkArray, InkString ) { 'use strict'; /** @@ -12086,6 +12086,7 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. /** * Set pagination if defined + * */ if( ("pageSize" in this._options) && (typeof this._options.pageSize !== 'undefined') ){ /** @@ -12149,17 +12150,17 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. for( var prop in this._sortableFields ){ if( prop !== ('col_' + index) ){ this._sortableFields[prop] = 'none'; - this._headers[prop.replace('col_','')].innerHTML = this._headers[prop.replace('col_','')].innerText; + this._headers[prop.replace('col_','')].innerHTML = InkString.stripTags(this._headers[prop.replace('col_','')].innerHTML); } } if( this._sortableFields['col_'+index] === 'asc' ) { this._sortableFields['col_'+index] = 'desc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } else { this._sortableFields['col_'+index] = 'asc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } @@ -12173,18 +12174,9 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. if( (this._sortableFields['col_'+index] === 'desc') && (this._options.allowResetSorting && (this._options.allowResetSorting.toString() === 'true')) ) { - this._headers[index].innerHTML = this._headers[index].innerText; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML); this._sortableFields['col_'+index] = 'none'; - // var found = false; - // for(var prop in this._sortableFields ){ - // if( this._sortableFields[prop] === 'asc' || this._sortableFields[prop] === 'desc' ){ - // found = true; - // this._sort(prop.replace('col_','')); - // break; - // } - // } - // if( !found ){ this._data = this._originalData.slice(0); // } @@ -12193,7 +12185,7 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. for( var prop in this._sortableFields ){ if( prop !== ('col_' + index) ){ this._sortableFields[prop] = 'none'; - this._headers[prop.replace('col_','')].innerHTML = this._headers[prop.replace('col_','')].innerText; + this._headers[prop.replace('col_','')].innerHTML = InkString.stripTags(this._headers[prop.replace('col_','')].innerHTML); } } @@ -12203,10 +12195,10 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. { this._data.reverse(); this._sortableFields['col_'+index] = 'desc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } else { this._sortableFields['col_'+index] = 'asc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } } diff --git a/js/ink-all.min.js b/js/ink-all.min.js index 1b4ee6df8..2ea607a81 100644 --- a/js/ink-all.min.js +++ b/js/ink-all.min.js @@ -21,7 +21,7 @@ Ink.createModule("Ink.UI.Pagination","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink. Ink.createModule("Ink.UI.SortableList","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,r,i,o){"use strict";var s=function(t,n){if(this._element=e.elOrSelector(t,"1st argument"),!e.isDOMElement(t)&&"string"!=typeof t)throw"[Ink.UI.SortableList] :: Invalid selector";if("string"==typeof t){if(this._element=Ink.Dom.Selector.select(t),1>this._element.length)throw"[Ink.UI.SortableList] :: Selector has returned no elements";this._element=this._element[0]}else this._element=t;if(this._options=Ink.extendObj({dragObject:"li"},Ink.Dom.Element.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={down:Ink.bindEvent(this._onDown,this),move:Ink.bindEvent(this._onMove,this),up:Ink.bindEvent(this._onUp,this)},this._model=[],this._index=void 0,this._isMoving=!1,this._options.model instanceof Array)this._model=this._options.model,this._createdFrom="JSON";else{if("ul"!==this._element.nodeName.toLowerCase())throw new TypeError("You must pass a selector expression/DOM element as 1st option or provide a model on 2nd argument!");this._createdFrom="DOM"}if(this._dragTriggers=i.select(this._options.dragObject,this._element),!this._dragTriggers)throw"[Ink.UI.SortableList] :: Drag object not found";this._init()};return s.prototype={_init:function(){"DOM"===this._createdFrom&&(this._extractModelFromDOM(),this._createdFrom="JSON");var n="ontouchstart"in document.documentElement;this._down=n?"touchstart":"mousedown",this._move=n?"touchmove":"mousemove",this._up=n?"touchend":"mouseup";var r=document.body;t.observe(r,this._move,this._handlers.move),t.observe(r,this._up,this._handlers.up),this._observe(),e.registerInstance(this,this._element,"sortableList")},_observe:function(){t.observe(this._element,this._down,this._handlers.down)},_extractModelFromDOM:function(){this._model=[];var e=this,t=i.select("> li",this._element);o.each(t,function(t){var n=t.innerHTML;e._model.push(n)})},_generateMarkup:function(){var e=document.createElement("ul");e.className="unstyled ink-sortable-list";var t=this;return o.each(this._model,function(n,r){var i=document.createElement("li");r===t._index&&(i.className="drag"),i.innerHTML=[n].join(""),e.appendChild(i)}),e},_getY:function(e){return 0===e.type.indexOf("touch")?e.changedTouches[0].pageY:"number"==typeof e.pageY?e.pageY:e.clientY},_refresh:function(t){var n=this._generateMarkup();this._element.parentNode.replaceChild(n,this._element),this._element=n,e.restoreIdAndClasses(this._element,this),this._dragTriggers=i.select(this._options.dragObject,this._element),t||this._observe()},_onDown:function(n){if(!this._isMoving){var r=t.element(n);if(!o.inArray(r,this._dragTriggers)){for(;!o.inArray(r,this._dragTriggers)&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;if("body"===r.nodeName.toLowerCase())return}t.stop(n);var i;if("li"!==r.nodeName.toLowerCase())for(;"li"!==r.nodeName.toLowerCase()&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;return i=r,this._index=e.childIndex(i),this._height=i.offsetHeight,this._startY=this._getY(n),this._isMoving=!0,document.body.style.cursor="move",this._refresh(!1),!1}},_onMove:function(e){if(this._isMoving){t.stop(e);var n=this._getY(e),r=n-this._startY,i=r>0?1:-1,o=i*Math.floor(Math.abs(r)/this._height);if(0!==o&&(o/=Math.abs(o),!(-1===o&&0===this._index||1===o&&this._index===this._model.length-1))){var s=o>0?this._index:this._index+o,a=0>o?this._index:this._index+o;this._model.splice(s,2,this._model[a],this._model[s]),this._index+=o,this._startY=n,this._refresh(!1)}}},_onUp:function(e){this._isMoving&&(t.stop(e),this._index=void 0,this._isMoving=!1,document.body.style.cursor="",this._refresh())},getModel:function(){return this._model.slice()},destroy:e.destroyComponent},s}); Ink.createModule("Ink.UI.Spy","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,r,i,o){"use strict";var s=function(t,n){this._rootElement=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({target:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.target=e.elOrSelector(this._options.target,"Target"),this._scrollTimeout=null,this._init()};return s.prototype={_elements:[],_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),this._elements.push(this._rootElement)},_onScroll:function(){if(!(window.scrollYe;e++)if(this._elements[e].offsetTop<=window.scrollY&&this._elements[e]!==this._rootElement&&this._elements[e].offsetTop>this._rootElement.offsetTop)return;o.each(i.select("a",this._options.target),Ink.bind(function(e){var t="name"in this._rootElement&&this._rootElement.name?"#"+this._rootElement.name:"#"+this._rootElement.id;e.href.substr(e.href.indexOf("#"))===t?n.addClassName(r.findUpwardsByTag(e,"li"),"active"):n.removeClassName(r.findUpwardsByTag(e,"li"),"active")},this))}}},s}); Ink.createModule("Ink.UI.Sticky","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,r,i){"use strict";var o=function(t,n){if("object"!=typeof t&&"string"!=typeof t)throw"[Sticky] :: Invalid selector defined";if("object"==typeof t)this._rootElement=t;else{if(this._rootElement=i.select(t),0>=this._rootElement.length)throw"[Sticky] :: Can't find any element with the specified selector";this._rootElement=this._rootElement[0]}this._options=Ink.extendObj({offsetBottom:0,offsetTop:0,topElement:void 0,bottomElement:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.topElement=this._options.topElement!==void 0?e.elOrSelector(this._options.topElement,"Top Element"):e.elOrSelector("body","Top Element"),this._options.bottomElement=this._options.bottomElement!==void 0?e.elOrSelector(this._options.bottomElement,"Bottom Element"):e.elOrSelector("body","Top Element"),this._computedStyle=window.getComputedStyle?window.getComputedStyle(this._rootElement,null):this._rootElement.currentStyle,this._init()};return o.prototype={_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),t.observe(window,"resize",Ink.bindEvent(this._onResize,this)),this._calculateOriginalSizes(),this._calculateOffsets()},_onScroll:function(){var e="CSS1Compat"===document.compatMode?document.documentElement:document.body;if(100*r.elementWidth(this._rootElement)/e.clientWidth>90)return r.hasAttribute(this._rootElement,"style")&&this._rootElement.removeAttribute("style"),void 0;if(r.hasAttribute(this._rootElement,"style"))window.scrollY<=this._options.offsetTop?this._rootElement.removeAttribute("style"):document.body.scrollHeight-(window.scrollY+parseInt(this._computedStyle.height,10))=this._options.offsetBottom&&(this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.top=this._options.originalOffsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px");else{if(window.scrollY<=this._options.offsetTop)return;this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.top=this._options.offsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px"}},_onResize:function(){this._rootElement.removeAttribute("style"),this._calculateOriginalSizes(),this._calculateOffsets()},_calculateOffsets:function(){if(this._options.topElement!==void 0)if("body"!==this._options.topElement.nodeName.toLowerCase()){var e=r.elementHeight(this._options.topElement),t=r.elementTop(this._options.topElement);this._options.offsetTop=parseInt(e,10)+parseInt(t,10)+parseInt(this._options.originalOffsetTop,10)}else this._options.offsetTop=parseInt(this._options.originalOffsetTop,10);if(this._options.bottomElement!==void 0)if("body"!==this._options.bottomElement.nodeName.toLowerCase()){var n=r.elementHeight(this._options.bottomElement);this._options.offsetBottom=parseInt(n,10)+parseInt(this._options.originalOffsetBottom,10)}else this._options.offsetBottom=parseInt(this._options.originalOffsetBottom,10);this._onScroll()},_calculateOriginalSizes:function(){this._options.originalOffsetTop=parseInt(this._options.offsetTop,10),this._options.originalOffsetBottom=parseInt(this._options.offsetBottom,10),this._options.originalTop=parseInt(this._rootElement.offsetTop,10),this._options.originalWidth=parseInt(this._computedStyle.width,10)}},o}); -Ink.createModule("Ink.UI.Table","1",["Ink.Net.Ajax_1","Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r,s){"use strict";var a=function(e,n){if(this._rootElement=t.elOrSelector(e,"1st argument"),"table"!==this._rootElement.nodeName.toLowerCase())throw"[Ink.UI.Table] :: The element is not a table";this._options=Ink.extendObj({pageSize:void 0,endpoint:void 0,loadMode:"full",allowResetSorting:!1,visibleFields:void 0},o.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._markupMode=this._options.endpoint===void 0,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.split(",")),this._handlers={click:Ink.bindEvent(this._onClick,this)},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._headers=[],this._pagination=null,this._totalRows=0,this._init()};return a.prototype={_init:function(){if(this._markupMode){if(this._setHeadersHandlers(),s.each(r.select("tbody tr",this._rootElement),Ink.bind(function(e){this._data.push(e)},this)),this._originalData=this._data.slice(0),this._totalRows=this._data.length,"pageSize"in this._options&&this._options.pageSize!==void 0){for(this._pagination=this._rootElement.nextSibling;1!==this._pagination.nodeType;)this._pagination=this._pagination.nextSibling;if("nav"!==this._pagination.nodeName.toLowerCase())throw"[Ink.UI.Table] :: Missing the pagination markup or is mis-positioned";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(e){this._paginate(e._current+1)},this)}),this._paginate(1)}}else this._getData(this._options.endpoint,!0)},_onClick:function(e){n.stop(e);var i,a,l=n.element(e),u=o.data(l),c="pageSize"in this._options&&this._options.pageSize!==void 0;if("th"===l.nodeName.toLowerCase()&&"sortable"in u&&"true"==""+u.sortable){if(i=-1,s.inArray(l,this._headers))for(a=0;this._headers.length>a;a++)if(this._headers[a]===l){i=a;break}if(!this._markupMode&&c){for(var h in this._sortableFields)h!=="col_"+i&&(this._sortableFields[h]="none",this._headers[h.replace("col_","")].innerHTML=this._headers[h.replace("col_","")].innerText);"asc"===this._sortableFields["col_"+i]?(this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=this._headers[i].innerText+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=this._headers[i].innerText+''),this._pagination.setCurrent(this._pagination._current)}else{if(-1===i)return;if("desc"===this._sortableFields["col_"+i]&&this._options.allowResetSorting&&"true"==""+this._options.allowResetSorting)this._headers[i].innerHTML=this._headers[i].innerText,this._sortableFields["col_"+i]="none",this._data=this._originalData.slice(0);else{for(var h in this._sortableFields)h!=="col_"+i&&(this._sortableFields[h]="none",this._headers[h.replace("col_","")].innerHTML=this._headers[h.replace("col_","")].innerText);this._sort(i),"asc"===this._sortableFields["col_"+i]?(this._data.reverse(),this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=this._headers[i].innerText+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=this._headers[i].innerText+'')}var d=r.select("tbody",this._rootElement)[0];t.cleanChildren(d),s.each(this._data,function(e){d.appendChild(e)}),this._pagination.setCurrent(0),this._paginate(1)}}},_paginate:function(e){s.each(this._data,Ink.bind(function(t,n){n>=(e-1)*parseInt(this._options.pageSize,10)&&(e-1)*parseInt(this._options.pageSize,10)+parseInt(this._options.pageSize,10)>n?i.removeClassName(t,"hide-all"):i.addClassName(t,"hide-all")},this))},_sort:function(e){this._data.sort(Ink.bind(function(t,n){var i=r.select("td",t)[e].innerText,o=r.select("td",n)[e].innerText,s=RegExp(/\d/g);return!isNaN(i)&&s.test(i)?i=parseInt(i,10):isNaN(i)||(i=parseFloat(i)),!isNaN(o)&&s.test(o)?o=parseInt(o,10):isNaN(o)||(o=parseFloat(o)),i===o?0:i>o?1:-1},this))},_setHeaders:function(e,t){var n,i,o,s,a;if(0===(o=r.select("thead",this._rootElement)).length){o=this._rootElement.createTHead(),s=o.insertRow(0);for(n in e)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||(a=document.createElement("th"),i=e[n],"sortable"in i&&"true"==""+i.sortable&&a.setAttribute("data-sortable","true"),"label"in i&&(a.innerText=i.label),this._originalFields.push(n),s.appendChild(a))}else{var l=t[0];for(n in l)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||this._originalFields.push(n)}},_setHeadersHandlers:function(){n.observe(r.select("thead",this._rootElement)[0],"click",this._handlers.click),this._headers=r.select("thead tr th",this._rootElement),s.each(this._headers,Ink.bind(function(e,t){var n=o.data(e);"sortable"in n&&"true"==""+n.sortable&&(this._sortableFields["col_"+t]="none")},this))},_setData:function(e){var t,n,i,o,s,a;n=r.select("tbody",this._rootElement),0===n.length?(n=document.createElement("tbody"),this._rootElement.appendChild(n)):(n=n[0],n.innerHTML=""),this._data=[];for(s in e){i=document.createElement("tr"),n.appendChild(i),a=0;for(t in e[s])this._options.visibleFields&&-1===this._options.visibleFields.indexOf(t)||(o=i.insertCell(a++),o.innerHTML=e[s][t]);this._data.push(i)}this._originalData=this._data.slice(0)},setEndpoint:function(e,t){this._markupMode||(this._options.endpoint=e,this._pagination.setCurrent(t?parseInt(t,10):0))},_setPagination:function(){if("pageSize"in this._options&&this._options.pageSize!==void 0,"pageSize"in this._options&&this._options.pageSize!==void 0&&!this._pagination){this._pagination=document.createElement("nav"),this._pagination.className="ink-navigation",this._rootElement.parentNode.insertBefore(this._pagination,this._rootElement.nextSibling),this._pagination.appendChild(document.createElement("ul")).className="pagination";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(){this._getData(this._options.endpoint)},this)})}},_getData:function(e){Ink.requireModules(["Ink.Util.Url_1"],Ink.bind(function(t){var n=t.parseUrl(e),i="pageSize"in this._options&&this._options.pageSize!==void 0,o=this._pagination?this._pagination._current+1:1;if(n.query=n.query?n.query.split("&"):[],i){n.query.push("rows_per_page="+this._options.pageSize),n.query.push("page="+o);for(var r in this._sortableFields)if("none"!==this._sortableFields[r]){n.query.push("sortField="+this._originalFields[parseInt(r.replace("col_",""),10)]),n.query.push("sortOrder="+this._sortableFields[r]);break}this._getDataViaAjax(e+"?"+n.query.join("&"))}else this._getDataViaAjax(e)},this))},_getDataViaAjax:function(t){var n="pageSize"in this._options&&this._options.pageSize!==void 0;new e(t,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(e){if(200===e.status){var t=JSON.parse(e.responseText);0===this._headers.length&&(this._setHeaders(t.headers,t.rows),this._setHeadersHandlers()),this._setData(t.rows),n?this._totalRows&&parseInt(t.totalRows,10)!==parseInt(this._totalRows,10)?(this._totalRows=t.totalRows,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.totalRows:this._totalRows&&t.rows.length!==parseInt(this._totalRows,10)?(this._totalRows=t.rows.length,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.rows.length,this._setPagination()}},this)})}},a}); +Ink.createModule("Ink.UI.Table","1",["Ink.Net.Ajax_1","Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.String_1"],function(e,t,n,i,o,r,s,a){"use strict";var l=function(e,n){if(this._rootElement=t.elOrSelector(e,"1st argument"),"table"!==this._rootElement.nodeName.toLowerCase())throw"[Ink.UI.Table] :: The element is not a table";this._options=Ink.extendObj({pageSize:void 0,endpoint:void 0,loadMode:"full",allowResetSorting:!1,visibleFields:void 0},o.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._markupMode=this._options.endpoint===void 0,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.split(",")),this._handlers={click:Ink.bindEvent(this._onClick,this)},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._headers=[],this._pagination=null,this._totalRows=0,this._init()};return l.prototype={_init:function(){if(this._markupMode){if(this._setHeadersHandlers(),s.each(r.select("tbody tr",this._rootElement),Ink.bind(function(e){this._data.push(e)},this)),this._originalData=this._data.slice(0),this._totalRows=this._data.length,"pageSize"in this._options&&this._options.pageSize!==void 0){for(this._pagination=this._rootElement.nextSibling;1!==this._pagination.nodeType;)this._pagination=this._pagination.nextSibling;if("nav"!==this._pagination.nodeName.toLowerCase())throw"[Ink.UI.Table] :: Missing the pagination markup or is mis-positioned";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(e){this._paginate(e._current+1)},this)}),this._paginate(1)}}else this._getData(this._options.endpoint,!0)},_onClick:function(e){n.stop(e);var i,l,u=n.element(e),c=o.data(u),h="pageSize"in this._options&&this._options.pageSize!==void 0;if("th"===u.nodeName.toLowerCase()&&"sortable"in c&&"true"==""+c.sortable){if(i=-1,s.inArray(u,this._headers))for(l=0;this._headers.length>l;l++)if(this._headers[l]===u){i=l;break}if(!this._markupMode&&h){for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));"asc"===this._sortableFields["col_"+i]?(this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''),this._pagination.setCurrent(this._pagination._current)}else{if(-1===i)return;if("desc"===this._sortableFields["col_"+i]&&this._options.allowResetSorting&&"true"==""+this._options.allowResetSorting)this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML),this._sortableFields["col_"+i]="none",this._data=this._originalData.slice(0);else{for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));this._sort(i),"asc"===this._sortableFields["col_"+i]?(this._data.reverse(),this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'')}var p=r.select("tbody",this._rootElement)[0];t.cleanChildren(p),s.each(this._data,function(e){p.appendChild(e)}),this._pagination.setCurrent(0),this._paginate(1)}}},_paginate:function(e){s.each(this._data,Ink.bind(function(t,n){n>=(e-1)*parseInt(this._options.pageSize,10)&&(e-1)*parseInt(this._options.pageSize,10)+parseInt(this._options.pageSize,10)>n?i.removeClassName(t,"hide-all"):i.addClassName(t,"hide-all")},this))},_sort:function(e){this._data.sort(Ink.bind(function(t,n){var i=r.select("td",t)[e].innerText,o=r.select("td",n)[e].innerText,s=RegExp(/\d/g);return!isNaN(i)&&s.test(i)?i=parseInt(i,10):isNaN(i)||(i=parseFloat(i)),!isNaN(o)&&s.test(o)?o=parseInt(o,10):isNaN(o)||(o=parseFloat(o)),i===o?0:i>o?1:-1},this))},_setHeaders:function(e,t){var n,i,o,s,a;if(0===(o=r.select("thead",this._rootElement)).length){o=this._rootElement.createTHead(),s=o.insertRow(0);for(n in e)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||(a=document.createElement("th"),i=e[n],"sortable"in i&&"true"==""+i.sortable&&a.setAttribute("data-sortable","true"),"label"in i&&(a.innerText=i.label),this._originalFields.push(n),s.appendChild(a))}else{var l=t[0];for(n in l)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||this._originalFields.push(n)}},_setHeadersHandlers:function(){n.observe(r.select("thead",this._rootElement)[0],"click",this._handlers.click),this._headers=r.select("thead tr th",this._rootElement),s.each(this._headers,Ink.bind(function(e,t){var n=o.data(e);"sortable"in n&&"true"==""+n.sortable&&(this._sortableFields["col_"+t]="none")},this))},_setData:function(e){var t,n,i,o,s,a;n=r.select("tbody",this._rootElement),0===n.length?(n=document.createElement("tbody"),this._rootElement.appendChild(n)):(n=n[0],n.innerHTML=""),this._data=[];for(s in e){i=document.createElement("tr"),n.appendChild(i),a=0;for(t in e[s])this._options.visibleFields&&-1===this._options.visibleFields.indexOf(t)||(o=i.insertCell(a++),o.innerHTML=e[s][t]);this._data.push(i)}this._originalData=this._data.slice(0)},setEndpoint:function(e,t){this._markupMode||(this._options.endpoint=e,this._pagination.setCurrent(t?parseInt(t,10):0))},_setPagination:function(){if("pageSize"in this._options&&this._options.pageSize!==void 0,"pageSize"in this._options&&this._options.pageSize!==void 0&&!this._pagination){this._pagination=document.createElement("nav"),this._pagination.className="ink-navigation",this._rootElement.parentNode.insertBefore(this._pagination,this._rootElement.nextSibling),this._pagination.appendChild(document.createElement("ul")).className="pagination";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(){this._getData(this._options.endpoint)},this)})}},_getData:function(e){Ink.requireModules(["Ink.Util.Url_1"],Ink.bind(function(t){var n=t.parseUrl(e),i="pageSize"in this._options&&this._options.pageSize!==void 0,o=this._pagination?this._pagination._current+1:1;if(n.query=n.query?n.query.split("&"):[],i){n.query.push("rows_per_page="+this._options.pageSize),n.query.push("page="+o);for(var r in this._sortableFields)if("none"!==this._sortableFields[r]){n.query.push("sortField="+this._originalFields[parseInt(r.replace("col_",""),10)]),n.query.push("sortOrder="+this._sortableFields[r]);break}this._getDataViaAjax(e+"?"+n.query.join("&"))}else this._getDataViaAjax(e)},this))},_getDataViaAjax:function(t){var n="pageSize"in this._options&&this._options.pageSize!==void 0;new e(t,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(e){if(200===e.status){var t=JSON.parse(e.responseText);0===this._headers.length&&(this._setHeaders(t.headers,t.rows),this._setHeadersHandlers()),this._setData(t.rows),n?this._totalRows&&parseInt(t.totalRows,10)!==parseInt(this._totalRows,10)?(this._totalRows=t.totalRows,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.totalRows:this._totalRows&&t.rows.length!==parseInt(this._totalRows,10)?(this._totalRows=t.rows.length,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.rows.length,this._setPagination()}},this)})}},l}); Ink.createModule("Ink.UI.Tabs","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(e.isDOMElement(t))this._element=t;else{if(t=o.select(t),0===t.length)throw new TypeError("1st argument must either be a DOM Element or a selector expression!");this._element=t[0]}this._options=Ink.extendObj({preventUrlChange:!1,active:void 0,disabled:[],onBeforeChange:void 0,onChange:void 0},i.data(t)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={tabClicked:Ink.bindEvent(this._onTabClicked,this),disabledTabClicked:Ink.bindEvent(this._onDisabledTabClicked,this),resize:Ink.bindEvent(this._onResize,this)},this._init()};return s.prototype={_init:function(){this._menu=o.select(".tabs-nav",this._element)[0],this._menuTabs=this._getChildElements(this._menu),this._contentTabs=o.select(".tabs-content",this._element),this._initializeDom(),this._observe(),this._setFirstActive(),this._changeTab(this._activeMenuLink),this._handlers.resize(),e.registerInstance(this,this._element,"tabs")},_initializeDom:function(){for(var e=0;this._contentTabs.length>e;e++)n.hide(this._contentTabs[e])},_observe:function(){r.each(this._menuTabs,Ink.bind(function(e){var t=o.select("a",e)[0];r.inArray(t.getAttribute("href"),this._options.disabled)?this.disable(t):this.enable(t)},this)),t.observe(window,"resize",this._handlers.resize)},_setFirstActive:function(){var e=window.location.hash;this._activeContentTab=o.select(e,this._element)[0]||o.select(this._hashify(this._options.active),this._element)[0]||o.select(".tabs-content",this._element)[0],this._activeMenuLink=this._findLinkByHref(this._activeContentTab.getAttribute("id")),this._activeMenuTab=this._activeMenuLink.parentNode},_changeTab:function(e,t){t&&this._options.onBeforeChange!==void 0&&this._options.onBeforeChange(this);var i=e.getAttribute("href");n.removeClassName(this._activeMenuTab,"active"),n.removeClassName(this._activeContentTab,"active"),n.addClassName(this._activeContentTab,"hide-all"),this._activeMenuLink=e,this._activeMenuTab=this._activeMenuLink.parentNode,this._activeContentTab=o.select(i.substr(i.indexOf("#")),this._element)[0],n.addClassName(this._activeMenuTab,"active"),n.addClassName(this._activeContentTab,"active"),n.removeClassName(this._activeContentTab,"hide-all"),n.show(this._activeContentTab),t&&this._options.onChange!==void 0&&this._options.onChange(this)},_onTabClicked:function(e){t.stop(e);var n=t.findElement(e,"A");"a"===n.nodeName.toLowerCase()&&("true"!=""+this._options.preventUrlChange&&(window.location.hash=n.getAttribute("href").substr(n.getAttribute("href").indexOf("#"))),n!==this._activeMenuLink&&this.changeTab(n))},_onDisabledTabClicked:function(e){t.stop(e)},_onResize:function(){var t=e.currentLayout();t!==this._lastLayout&&(t===e.Layouts.SMALL||t===e.Layouts.MEDIUM?(n.removeClassName(this._menu,"menu"),n.removeClassName(this._menu,"horizontal")):(n.addClassName(this._menu,"menu"),n.addClassName(this._menu,"horizontal")),this._lastLayout=t)},_hashify:function(e){return e?0===e.indexOf("#")?e:"#"+e:""},_findLinkByHref:function(e){e=this._hashify(e);var t;return r.each(this._menuTabs,Ink.bind(function(n){var i=o.select("a",n)[0];-1!==i.getAttribute("href").indexOf("#")&&i.getAttribute("href").substr(i.getAttribute("href").indexOf("#"))===e&&(t=i)},this)),t},_getChildElements:function(e){for(var t=[],n=e.children,i=0;n.length>i;i++)1===n[i].nodeType&&t.push(n[i]);return t},changeTab:function(e){var t=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));t&&!n.hasClassName(t,"ink-disabled")&&this._changeTab(t,!0)},disable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.tabClicked),t.observe(i,"click",this._handlers.disabledTabClicked),n.addClassName(i,"ink-disabled"))},enable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.disabledTabClicked),t.observe(i,"click",this._handlers.tabClicked),n.removeClassName(i,"ink-disabled"))},activeTab:function(){return this._activeContentTab.getAttribute("id")},activeMenuTab:function(){return this._activeMenuTab},activeMenuLink:function(){return this._activeMenuLink},activeContentTab:function(){return this._activeContentTab},destroy:e.destroyComponent},s}); Ink.createModule("Ink.UI.Toggle","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,i,o){"use strict";var r=function(e,t){if("string"!=typeof e&&"object"!=typeof e)throw"[Ink.UI.Toggle] Invalid CSS selector to determine the root element";if("string"==typeof e){if(this._rootElement=o.select(e),0>=this._rootElement.length)throw"[Ink.UI.Toggle] Root element not found";this._rootElement=this._rootElement[0]}else this._rootElement=e;if(this._options=Ink.extendObj({target:void 0,triggerEvent:"click",closeOnClick:!0},i.data(this._rootElement)),this._options=Ink.extendObj(this._options,t||{}),this._options.target===void 0)throw"[Ink.UI.Toggle] Target option not defined";this._childElement=o.select(this._options.target,this._rootElement),0>=this._childElement.length&&(0>=this._childElement.length&&(this._childElement=o.select(this._options.target,this._rootElement.parentNode)),0>=this._childElement.length&&(this._childElement=o.select(this._options.target)),0>=this._childElement.length)||(this._childElement=this._childElement[0],this._init())};return r.prototype={_init:function(){this._accordion=n.hasClassName(this._rootElement.parentNode,"accordion")||n.hasClassName(this._childElement.parentNode,"accordion"),t.observe(this._rootElement,this._options.triggerEvent,Ink.bindEvent(this._onTriggerEvent,this)),"true"==""+this._options.closeOnClick&&t.observe(document,"click",Ink.bindEvent(this._onClick,this))},_onTriggerEvent:function(e){if(t.stop(e),this._accordion){var r,s,a;for(a=n.hasClassName(this._childElement.parentNode,"accordion")?this._childElement.parentNode:this._childElement.parentNode.parentNode,r=o.select(".toggle",a),s=0;r.length>s;s+=1){var l=i.data(r[s]),c=o.select(l.target,a);c.length>0&&c[0]!==this._childElement&&(c[0].style.display="none")}}var u="none"===n.getStyle(this._childElement,"display")?"show-all":"hide-all",h="none"===n.getStyle(this._childElement,"display")?"block":"none";n.removeClassName(this._childElement,"show-all"),n.removeClassName(this._childElement,"hide-all"),n.addClassName(this._childElement,u),this._childElement.style.display=h},_onClick:function(e){var n=t.element(e);i.isAncestorOf(this._rootElement,n)||i.isAncestorOf(this._childElement,n)||this._dismiss(this._rootElement)},_dismiss:function(){"none"!==n.getStyle(this._childElement,"display")&&(n.removeClassName(this._childElement,"show-all"),n.addClassName(this._childElement,"hide-all"),this._childElement.style.display="none")}},r}); Ink.createModule("Ink.UI.SmoothScroller","1",["Ink.Dom.Event_1","Ink.Dom.Selector_1","Ink.Dom.Loaded_1"],function(e,t,n){"use strict";var i={speed:10,gy:function(e){var t;if(t=e.offsetTop,e.offsetParent)for(;e=e.offsetParent;)t+=e.offsetTop;return t},scrollTop:function(){var e=document.body,t=document.documentElement;return e&&e.scrollTop?e.scrollTop:t&&t.scrollTop?t.scrollTop:window.pageYOffset?window.pageYOffset:0},add:function(t,n,i){e.observe(t,n,i)},end:function(t){return window.event?(window.event.cancelBubble=!0,window.event.returnValue=!1,void 0):(e.stop(t),void 0)},scroll:function(e){var t=Ink.UI.SmoothScroller.scrollTop();t+=e>t?Math.ceil((e-t)/Ink.UI.SmoothScroller.speed):(e-t)/Ink.UI.SmoothScroller.speed,window.scrollTo(0,t),(t===e||Ink.UI.SmoothScroller.offsetTop===t)&&clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.offsetTop=t},init:function(){n.run(Ink.UI.SmoothScroller.render)},render:function(){var n=t.select("a.scrollableLink");Ink.UI.SmoothScroller.end(this);for(var i=0;n.length>i;i++){var o=n[i];!o.href||-1===o.href.indexOf("#")||o.pathname!==location.pathname&&"/"+o.pathname!==location.pathname||(Ink.UI.SmoothScroller.add(o,"click",Ink.UI.SmoothScroller.end),e.observe(o,"click",Ink.UI.SmoothScroller.clickScroll))}},clickScroll:function(){Ink.UI.SmoothScroller.end(this);var e=this.hash.substr(1),n=t.select('a[name="'+e+'"],#'+e);if(n[0]!==void 0){if(-1===this.parentNode.className.indexOf("active")){var i=this.parentNode.parentNode,o=i.firstChild;do if(o.tagName!==void 0&&"LI"===o.tagName.toUpperCase()&&-1!==o.className.indexOf("active")){o.className=o.className.replace("active","");break}while(o=o.nextSibling);this.parentNode.className+=" active"}clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.interval=setInterval("Ink.UI.SmoothScroller.scroll("+Ink.UI.SmoothScroller.gy(n[0])+")",10)}}};return i}); diff --git a/js/ink-ui.js b/js/ink-ui.js index d7d52566a..8cb18f4c6 100644 --- a/js/ink-ui.js +++ b/js/ink-ui.js @@ -1685,7 +1685,7 @@ Ink.createModule('Ink.UI.Sticky', '1', ['Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Do * @author inkdev AT sapo.pt * @version 1 */ -Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1'], function(Ajax, Aux, Event, Css, Element, Selector, InkArray ) { +Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom.Event_1','Ink.Dom.Css_1','Ink.Dom.Element_1','Ink.Dom.Selector_1','Ink.Util.Array_1','Ink.Util.String_1'], function(Ajax, Aux, Event, Css, Element, Selector, InkArray, InkString ) { 'use strict'; /** @@ -1850,6 +1850,7 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. /** * Set pagination if defined + * */ if( ("pageSize" in this._options) && (typeof this._options.pageSize !== 'undefined') ){ /** @@ -1913,17 +1914,17 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. for( var prop in this._sortableFields ){ if( prop !== ('col_' + index) ){ this._sortableFields[prop] = 'none'; - this._headers[prop.replace('col_','')].innerHTML = this._headers[prop.replace('col_','')].innerText; + this._headers[prop.replace('col_','')].innerHTML = InkString.stripTags(this._headers[prop.replace('col_','')].innerHTML); } } if( this._sortableFields['col_'+index] === 'asc' ) { this._sortableFields['col_'+index] = 'desc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } else { this._sortableFields['col_'+index] = 'asc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } @@ -1937,18 +1938,9 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. if( (this._sortableFields['col_'+index] === 'desc') && (this._options.allowResetSorting && (this._options.allowResetSorting.toString() === 'true')) ) { - this._headers[index].innerHTML = this._headers[index].innerText; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML); this._sortableFields['col_'+index] = 'none'; - // var found = false; - // for(var prop in this._sortableFields ){ - // if( this._sortableFields[prop] === 'asc' || this._sortableFields[prop] === 'desc' ){ - // found = true; - // this._sort(prop.replace('col_','')); - // break; - // } - // } - // if( !found ){ this._data = this._originalData.slice(0); // } @@ -1957,7 +1949,7 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. for( var prop in this._sortableFields ){ if( prop !== ('col_' + index) ){ this._sortableFields[prop] = 'none'; - this._headers[prop.replace('col_','')].innerHTML = this._headers[prop.replace('col_','')].innerText; + this._headers[prop.replace('col_','')].innerHTML = InkString.stripTags(this._headers[prop.replace('col_','')].innerHTML); } } @@ -1967,10 +1959,10 @@ Ink.createModule('Ink.UI.Table', '1', ['Ink.Net.Ajax_1','Ink.UI.Aux_1','Ink.Dom. { this._data.reverse(); this._sortableFields['col_'+index] = 'desc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } else { this._sortableFields['col_'+index] = 'asc'; - this._headers[index].innerHTML = this._headers[index].innerText + ''; + this._headers[index].innerHTML = InkString.stripTags(this._headers[index].innerHTML) + ''; } } diff --git a/js/ink-ui.min.js b/js/ink-ui.min.js index 52e8f8e12..ce826bc9c 100644 --- a/js/ink-ui.min.js +++ b/js/ink-ui.min.js @@ -4,7 +4,7 @@ Ink.createModule("Ink.UI.Pagination","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink. Ink.createModule("Ink.UI.SortableList","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,r,i,o){"use strict";var s=function(t,n){if(this._element=e.elOrSelector(t,"1st argument"),!e.isDOMElement(t)&&"string"!=typeof t)throw"[Ink.UI.SortableList] :: Invalid selector";if("string"==typeof t){if(this._element=Ink.Dom.Selector.select(t),1>this._element.length)throw"[Ink.UI.SortableList] :: Selector has returned no elements";this._element=this._element[0]}else this._element=t;if(this._options=Ink.extendObj({dragObject:"li"},Ink.Dom.Element.data(this._element)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={down:Ink.bindEvent(this._onDown,this),move:Ink.bindEvent(this._onMove,this),up:Ink.bindEvent(this._onUp,this)},this._model=[],this._index=void 0,this._isMoving=!1,this._options.model instanceof Array)this._model=this._options.model,this._createdFrom="JSON";else{if("ul"!==this._element.nodeName.toLowerCase())throw new TypeError("You must pass a selector expression/DOM element as 1st option or provide a model on 2nd argument!");this._createdFrom="DOM"}if(this._dragTriggers=i.select(this._options.dragObject,this._element),!this._dragTriggers)throw"[Ink.UI.SortableList] :: Drag object not found";this._init()};return s.prototype={_init:function(){"DOM"===this._createdFrom&&(this._extractModelFromDOM(),this._createdFrom="JSON");var n="ontouchstart"in document.documentElement;this._down=n?"touchstart":"mousedown",this._move=n?"touchmove":"mousemove",this._up=n?"touchend":"mouseup";var r=document.body;t.observe(r,this._move,this._handlers.move),t.observe(r,this._up,this._handlers.up),this._observe(),e.registerInstance(this,this._element,"sortableList")},_observe:function(){t.observe(this._element,this._down,this._handlers.down)},_extractModelFromDOM:function(){this._model=[];var e=this,t=i.select("> li",this._element);o.each(t,function(t){var n=t.innerHTML;e._model.push(n)})},_generateMarkup:function(){var e=document.createElement("ul");e.className="unstyled ink-sortable-list";var t=this;return o.each(this._model,function(n,r){var i=document.createElement("li");r===t._index&&(i.className="drag"),i.innerHTML=[n].join(""),e.appendChild(i)}),e},_getY:function(e){return 0===e.type.indexOf("touch")?e.changedTouches[0].pageY:"number"==typeof e.pageY?e.pageY:e.clientY},_refresh:function(t){var n=this._generateMarkup();this._element.parentNode.replaceChild(n,this._element),this._element=n,e.restoreIdAndClasses(this._element,this),this._dragTriggers=i.select(this._options.dragObject,this._element),t||this._observe()},_onDown:function(n){if(!this._isMoving){var r=t.element(n);if(!o.inArray(r,this._dragTriggers)){for(;!o.inArray(r,this._dragTriggers)&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;if("body"===r.nodeName.toLowerCase())return}t.stop(n);var i;if("li"!==r.nodeName.toLowerCase())for(;"li"!==r.nodeName.toLowerCase()&&"body"!==r.nodeName.toLowerCase();)r=r.parentNode;return i=r,this._index=e.childIndex(i),this._height=i.offsetHeight,this._startY=this._getY(n),this._isMoving=!0,document.body.style.cursor="move",this._refresh(!1),!1}},_onMove:function(e){if(this._isMoving){t.stop(e);var n=this._getY(e),r=n-this._startY,i=r>0?1:-1,o=i*Math.floor(Math.abs(r)/this._height);if(0!==o&&(o/=Math.abs(o),!(-1===o&&0===this._index||1===o&&this._index===this._model.length-1))){var s=o>0?this._index:this._index+o,a=0>o?this._index:this._index+o;this._model.splice(s,2,this._model[a],this._model[s]),this._index+=o,this._startY=n,this._refresh(!1)}}},_onUp:function(e){this._isMoving&&(t.stop(e),this._index=void 0,this._isMoving=!1,document.body.style.cursor="",this._refresh())},getModel:function(){return this._model.slice()},destroy:e.destroyComponent},s}); Ink.createModule("Ink.UI.Spy","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,r,i,o){"use strict";var s=function(t,n){this._rootElement=e.elOrSelector(t,"1st argument"),this._options=Ink.extendObj({target:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.target=e.elOrSelector(this._options.target,"Target"),this._scrollTimeout=null,this._init()};return s.prototype={_elements:[],_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),this._elements.push(this._rootElement)},_onScroll:function(){if(!(window.scrollYe;e++)if(this._elements[e].offsetTop<=window.scrollY&&this._elements[e]!==this._rootElement&&this._elements[e].offsetTop>this._rootElement.offsetTop)return;o.each(i.select("a",this._options.target),Ink.bind(function(e){var t="name"in this._rootElement&&this._rootElement.name?"#"+this._rootElement.name:"#"+this._rootElement.id;e.href.substr(e.href.indexOf("#"))===t?n.addClassName(r.findUpwardsByTag(e,"li"),"active"):n.removeClassName(r.findUpwardsByTag(e,"li"),"active")},this))}}},s}); Ink.createModule("Ink.UI.Sticky","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,r,i){"use strict";var o=function(t,n){if("object"!=typeof t&&"string"!=typeof t)throw"[Sticky] :: Invalid selector defined";if("object"==typeof t)this._rootElement=t;else{if(this._rootElement=i.select(t),0>=this._rootElement.length)throw"[Sticky] :: Can't find any element with the specified selector";this._rootElement=this._rootElement[0]}this._options=Ink.extendObj({offsetBottom:0,offsetTop:0,topElement:void 0,bottomElement:void 0},r.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._options.topElement=this._options.topElement!==void 0?e.elOrSelector(this._options.topElement,"Top Element"):e.elOrSelector("body","Top Element"),this._options.bottomElement=this._options.bottomElement!==void 0?e.elOrSelector(this._options.bottomElement,"Bottom Element"):e.elOrSelector("body","Top Element"),this._computedStyle=window.getComputedStyle?window.getComputedStyle(this._rootElement,null):this._rootElement.currentStyle,this._init()};return o.prototype={_init:function(){t.observe(document,"scroll",Ink.bindEvent(this._onScroll,this)),t.observe(window,"resize",Ink.bindEvent(this._onResize,this)),this._calculateOriginalSizes(),this._calculateOffsets()},_onScroll:function(){var e="CSS1Compat"===document.compatMode?document.documentElement:document.body;if(100*r.elementWidth(this._rootElement)/e.clientWidth>90)return r.hasAttribute(this._rootElement,"style")&&this._rootElement.removeAttribute("style"),void 0;if(r.hasAttribute(this._rootElement,"style"))window.scrollY<=this._options.offsetTop?this._rootElement.removeAttribute("style"):document.body.scrollHeight-(window.scrollY+parseInt(this._computedStyle.height,10))=this._options.offsetBottom&&(this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.top=this._options.originalOffsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px");else{if(window.scrollY<=this._options.offsetTop)return;this._rootElement.style.position="fixed",this._rootElement.style.bottom="auto",this._rootElement.style.top=this._options.offsetTop+"px",this._rootElement.style.width=this._options.originalWidth+"px"}},_onResize:function(){this._rootElement.removeAttribute("style"),this._calculateOriginalSizes(),this._calculateOffsets()},_calculateOffsets:function(){if(this._options.topElement!==void 0)if("body"!==this._options.topElement.nodeName.toLowerCase()){var e=r.elementHeight(this._options.topElement),t=r.elementTop(this._options.topElement);this._options.offsetTop=parseInt(e,10)+parseInt(t,10)+parseInt(this._options.originalOffsetTop,10)}else this._options.offsetTop=parseInt(this._options.originalOffsetTop,10);if(this._options.bottomElement!==void 0)if("body"!==this._options.bottomElement.nodeName.toLowerCase()){var n=r.elementHeight(this._options.bottomElement);this._options.offsetBottom=parseInt(n,10)+parseInt(this._options.originalOffsetBottom,10)}else this._options.offsetBottom=parseInt(this._options.originalOffsetBottom,10);this._onScroll()},_calculateOriginalSizes:function(){this._options.originalOffsetTop=parseInt(this._options.offsetTop,10),this._options.originalOffsetBottom=parseInt(this._options.offsetBottom,10),this._options.originalTop=parseInt(this._rootElement.offsetTop,10),this._options.originalWidth=parseInt(this._computedStyle.width,10)}},o}); -Ink.createModule("Ink.UI.Table","1",["Ink.Net.Ajax_1","Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r,s){"use strict";var a=function(e,n){if(this._rootElement=t.elOrSelector(e,"1st argument"),"table"!==this._rootElement.nodeName.toLowerCase())throw"[Ink.UI.Table] :: The element is not a table";this._options=Ink.extendObj({pageSize:void 0,endpoint:void 0,loadMode:"full",allowResetSorting:!1,visibleFields:void 0},o.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._markupMode=this._options.endpoint===void 0,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.split(",")),this._handlers={click:Ink.bindEvent(this._onClick,this)},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._headers=[],this._pagination=null,this._totalRows=0,this._init()};return a.prototype={_init:function(){if(this._markupMode){if(this._setHeadersHandlers(),s.each(r.select("tbody tr",this._rootElement),Ink.bind(function(e){this._data.push(e)},this)),this._originalData=this._data.slice(0),this._totalRows=this._data.length,"pageSize"in this._options&&this._options.pageSize!==void 0){for(this._pagination=this._rootElement.nextSibling;1!==this._pagination.nodeType;)this._pagination=this._pagination.nextSibling;if("nav"!==this._pagination.nodeName.toLowerCase())throw"[Ink.UI.Table] :: Missing the pagination markup or is mis-positioned";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(e){this._paginate(e._current+1)},this)}),this._paginate(1)}}else this._getData(this._options.endpoint,!0)},_onClick:function(e){n.stop(e);var i,a,l=n.element(e),u=o.data(l),c="pageSize"in this._options&&this._options.pageSize!==void 0;if("th"===l.nodeName.toLowerCase()&&"sortable"in u&&"true"==""+u.sortable){if(i=-1,s.inArray(l,this._headers))for(a=0;this._headers.length>a;a++)if(this._headers[a]===l){i=a;break}if(!this._markupMode&&c){for(var h in this._sortableFields)h!=="col_"+i&&(this._sortableFields[h]="none",this._headers[h.replace("col_","")].innerHTML=this._headers[h.replace("col_","")].innerText);"asc"===this._sortableFields["col_"+i]?(this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=this._headers[i].innerText+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=this._headers[i].innerText+''),this._pagination.setCurrent(this._pagination._current)}else{if(-1===i)return;if("desc"===this._sortableFields["col_"+i]&&this._options.allowResetSorting&&"true"==""+this._options.allowResetSorting)this._headers[i].innerHTML=this._headers[i].innerText,this._sortableFields["col_"+i]="none",this._data=this._originalData.slice(0);else{for(var h in this._sortableFields)h!=="col_"+i&&(this._sortableFields[h]="none",this._headers[h.replace("col_","")].innerHTML=this._headers[h.replace("col_","")].innerText);this._sort(i),"asc"===this._sortableFields["col_"+i]?(this._data.reverse(),this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=this._headers[i].innerText+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=this._headers[i].innerText+'')}var d=r.select("tbody",this._rootElement)[0];t.cleanChildren(d),s.each(this._data,function(e){d.appendChild(e)}),this._pagination.setCurrent(0),this._paginate(1)}}},_paginate:function(e){s.each(this._data,Ink.bind(function(t,n){n>=(e-1)*parseInt(this._options.pageSize,10)&&(e-1)*parseInt(this._options.pageSize,10)+parseInt(this._options.pageSize,10)>n?i.removeClassName(t,"hide-all"):i.addClassName(t,"hide-all")},this))},_sort:function(e){this._data.sort(Ink.bind(function(t,n){var i=r.select("td",t)[e].innerText,o=r.select("td",n)[e].innerText,s=RegExp(/\d/g);return!isNaN(i)&&s.test(i)?i=parseInt(i,10):isNaN(i)||(i=parseFloat(i)),!isNaN(o)&&s.test(o)?o=parseInt(o,10):isNaN(o)||(o=parseFloat(o)),i===o?0:i>o?1:-1},this))},_setHeaders:function(e,t){var n,i,o,s,a;if(0===(o=r.select("thead",this._rootElement)).length){o=this._rootElement.createTHead(),s=o.insertRow(0);for(n in e)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||(a=document.createElement("th"),i=e[n],"sortable"in i&&"true"==""+i.sortable&&a.setAttribute("data-sortable","true"),"label"in i&&(a.innerText=i.label),this._originalFields.push(n),s.appendChild(a))}else{var l=t[0];for(n in l)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||this._originalFields.push(n)}},_setHeadersHandlers:function(){n.observe(r.select("thead",this._rootElement)[0],"click",this._handlers.click),this._headers=r.select("thead tr th",this._rootElement),s.each(this._headers,Ink.bind(function(e,t){var n=o.data(e);"sortable"in n&&"true"==""+n.sortable&&(this._sortableFields["col_"+t]="none")},this))},_setData:function(e){var t,n,i,o,s,a;n=r.select("tbody",this._rootElement),0===n.length?(n=document.createElement("tbody"),this._rootElement.appendChild(n)):(n=n[0],n.innerHTML=""),this._data=[];for(s in e){i=document.createElement("tr"),n.appendChild(i),a=0;for(t in e[s])this._options.visibleFields&&-1===this._options.visibleFields.indexOf(t)||(o=i.insertCell(a++),o.innerHTML=e[s][t]);this._data.push(i)}this._originalData=this._data.slice(0)},setEndpoint:function(e,t){this._markupMode||(this._options.endpoint=e,this._pagination.setCurrent(t?parseInt(t,10):0))},_setPagination:function(){if("pageSize"in this._options&&this._options.pageSize!==void 0,"pageSize"in this._options&&this._options.pageSize!==void 0&&!this._pagination){this._pagination=document.createElement("nav"),this._pagination.className="ink-navigation",this._rootElement.parentNode.insertBefore(this._pagination,this._rootElement.nextSibling),this._pagination.appendChild(document.createElement("ul")).className="pagination";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(){this._getData(this._options.endpoint)},this)})}},_getData:function(e){Ink.requireModules(["Ink.Util.Url_1"],Ink.bind(function(t){var n=t.parseUrl(e),i="pageSize"in this._options&&this._options.pageSize!==void 0,o=this._pagination?this._pagination._current+1:1;if(n.query=n.query?n.query.split("&"):[],i){n.query.push("rows_per_page="+this._options.pageSize),n.query.push("page="+o);for(var r in this._sortableFields)if("none"!==this._sortableFields[r]){n.query.push("sortField="+this._originalFields[parseInt(r.replace("col_",""),10)]),n.query.push("sortOrder="+this._sortableFields[r]);break}this._getDataViaAjax(e+"?"+n.query.join("&"))}else this._getDataViaAjax(e)},this))},_getDataViaAjax:function(t){var n="pageSize"in this._options&&this._options.pageSize!==void 0;new e(t,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(e){if(200===e.status){var t=JSON.parse(e.responseText);0===this._headers.length&&(this._setHeaders(t.headers,t.rows),this._setHeadersHandlers()),this._setData(t.rows),n?this._totalRows&&parseInt(t.totalRows,10)!==parseInt(this._totalRows,10)?(this._totalRows=t.totalRows,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.totalRows:this._totalRows&&t.rows.length!==parseInt(this._totalRows,10)?(this._totalRows=t.rows.length,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.rows.length,this._setPagination()}},this)})}},a}); +Ink.createModule("Ink.UI.Table","1",["Ink.Net.Ajax_1","Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1","Ink.Util.String_1"],function(e,t,n,i,o,r,s,a){"use strict";var l=function(e,n){if(this._rootElement=t.elOrSelector(e,"1st argument"),"table"!==this._rootElement.nodeName.toLowerCase())throw"[Ink.UI.Table] :: The element is not a table";this._options=Ink.extendObj({pageSize:void 0,endpoint:void 0,loadMode:"full",allowResetSorting:!1,visibleFields:void 0},o.data(this._rootElement)),this._options=Ink.extendObj(this._options,n||{}),this._markupMode=this._options.endpoint===void 0,this._options.visibleFields&&(this._options.visibleFields=this._options.visibleFields.split(",")),this._handlers={click:Ink.bindEvent(this._onClick,this)},this._originalFields=[],this._sortableFields={},this._originalData=this._data=[],this._headers=[],this._pagination=null,this._totalRows=0,this._init()};return l.prototype={_init:function(){if(this._markupMode){if(this._setHeadersHandlers(),s.each(r.select("tbody tr",this._rootElement),Ink.bind(function(e){this._data.push(e)},this)),this._originalData=this._data.slice(0),this._totalRows=this._data.length,"pageSize"in this._options&&this._options.pageSize!==void 0){for(this._pagination=this._rootElement.nextSibling;1!==this._pagination.nodeType;)this._pagination=this._pagination.nextSibling;if("nav"!==this._pagination.nodeName.toLowerCase())throw"[Ink.UI.Table] :: Missing the pagination markup or is mis-positioned";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(e){this._paginate(e._current+1)},this)}),this._paginate(1)}}else this._getData(this._options.endpoint,!0)},_onClick:function(e){n.stop(e);var i,l,u=n.element(e),c=o.data(u),h="pageSize"in this._options&&this._options.pageSize!==void 0;if("th"===u.nodeName.toLowerCase()&&"sortable"in c&&"true"==""+c.sortable){if(i=-1,s.inArray(u,this._headers))for(l=0;this._headers.length>l;l++)if(this._headers[l]===u){i=l;break}if(!this._markupMode&&h){for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));"asc"===this._sortableFields["col_"+i]?(this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''),this._pagination.setCurrent(this._pagination._current)}else{if(-1===i)return;if("desc"===this._sortableFields["col_"+i]&&this._options.allowResetSorting&&"true"==""+this._options.allowResetSorting)this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML),this._sortableFields["col_"+i]="none",this._data=this._originalData.slice(0);else{for(var d in this._sortableFields)d!=="col_"+i&&(this._sortableFields[d]="none",this._headers[d.replace("col_","")].innerHTML=a.stripTags(this._headers[d.replace("col_","")].innerHTML));this._sort(i),"asc"===this._sortableFields["col_"+i]?(this._data.reverse(),this._sortableFields["col_"+i]="desc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+''):(this._sortableFields["col_"+i]="asc",this._headers[i].innerHTML=a.stripTags(this._headers[i].innerHTML)+'')}var p=r.select("tbody",this._rootElement)[0];t.cleanChildren(p),s.each(this._data,function(e){p.appendChild(e)}),this._pagination.setCurrent(0),this._paginate(1)}}},_paginate:function(e){s.each(this._data,Ink.bind(function(t,n){n>=(e-1)*parseInt(this._options.pageSize,10)&&(e-1)*parseInt(this._options.pageSize,10)+parseInt(this._options.pageSize,10)>n?i.removeClassName(t,"hide-all"):i.addClassName(t,"hide-all")},this))},_sort:function(e){this._data.sort(Ink.bind(function(t,n){var i=r.select("td",t)[e].innerText,o=r.select("td",n)[e].innerText,s=RegExp(/\d/g);return!isNaN(i)&&s.test(i)?i=parseInt(i,10):isNaN(i)||(i=parseFloat(i)),!isNaN(o)&&s.test(o)?o=parseInt(o,10):isNaN(o)||(o=parseFloat(o)),i===o?0:i>o?1:-1},this))},_setHeaders:function(e,t){var n,i,o,s,a;if(0===(o=r.select("thead",this._rootElement)).length){o=this._rootElement.createTHead(),s=o.insertRow(0);for(n in e)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||(a=document.createElement("th"),i=e[n],"sortable"in i&&"true"==""+i.sortable&&a.setAttribute("data-sortable","true"),"label"in i&&(a.innerText=i.label),this._originalFields.push(n),s.appendChild(a))}else{var l=t[0];for(n in l)this._options.visibleFields&&-1===this._options.visibleFields.indexOf(n)||this._originalFields.push(n)}},_setHeadersHandlers:function(){n.observe(r.select("thead",this._rootElement)[0],"click",this._handlers.click),this._headers=r.select("thead tr th",this._rootElement),s.each(this._headers,Ink.bind(function(e,t){var n=o.data(e);"sortable"in n&&"true"==""+n.sortable&&(this._sortableFields["col_"+t]="none")},this))},_setData:function(e){var t,n,i,o,s,a;n=r.select("tbody",this._rootElement),0===n.length?(n=document.createElement("tbody"),this._rootElement.appendChild(n)):(n=n[0],n.innerHTML=""),this._data=[];for(s in e){i=document.createElement("tr"),n.appendChild(i),a=0;for(t in e[s])this._options.visibleFields&&-1===this._options.visibleFields.indexOf(t)||(o=i.insertCell(a++),o.innerHTML=e[s][t]);this._data.push(i)}this._originalData=this._data.slice(0)},setEndpoint:function(e,t){this._markupMode||(this._options.endpoint=e,this._pagination.setCurrent(t?parseInt(t,10):0))},_setPagination:function(){if("pageSize"in this._options&&this._options.pageSize!==void 0,"pageSize"in this._options&&this._options.pageSize!==void 0&&!this._pagination){this._pagination=document.createElement("nav"),this._pagination.className="ink-navigation",this._rootElement.parentNode.insertBefore(this._pagination,this._rootElement.nextSibling),this._pagination.appendChild(document.createElement("ul")).className="pagination";var e=Ink.getModule("Ink.UI.Pagination",1);this._pagination=new e(this._pagination,{size:Math.ceil(this._totalRows/this._options.pageSize),onChange:Ink.bind(function(){this._getData(this._options.endpoint)},this)})}},_getData:function(e){Ink.requireModules(["Ink.Util.Url_1"],Ink.bind(function(t){var n=t.parseUrl(e),i="pageSize"in this._options&&this._options.pageSize!==void 0,o=this._pagination?this._pagination._current+1:1;if(n.query=n.query?n.query.split("&"):[],i){n.query.push("rows_per_page="+this._options.pageSize),n.query.push("page="+o);for(var r in this._sortableFields)if("none"!==this._sortableFields[r]){n.query.push("sortField="+this._originalFields[parseInt(r.replace("col_",""),10)]),n.query.push("sortOrder="+this._sortableFields[r]);break}this._getDataViaAjax(e+"?"+n.query.join("&"))}else this._getDataViaAjax(e)},this))},_getDataViaAjax:function(t){var n="pageSize"in this._options&&this._options.pageSize!==void 0;new e(t,{method:"GET",contentType:"application/json",sanitizeJSON:!0,onSuccess:Ink.bind(function(e){if(200===e.status){var t=JSON.parse(e.responseText);0===this._headers.length&&(this._setHeaders(t.headers,t.rows),this._setHeadersHandlers()),this._setData(t.rows),n?this._totalRows&&parseInt(t.totalRows,10)!==parseInt(this._totalRows,10)?(this._totalRows=t.totalRows,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.totalRows:this._totalRows&&t.rows.length!==parseInt(this._totalRows,10)?(this._totalRows=t.rows.length,this._pagination.setSize(Math.ceil(this._totalRows/this._options.pageSize))):this._totalRows=t.rows.length,this._setPagination()}},this)})}},l}); Ink.createModule("Ink.UI.Tabs","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1","Ink.Util.Array_1"],function(e,t,n,i,o,r){"use strict";var s=function(t,n){if(e.isDOMElement(t))this._element=t;else{if(t=o.select(t),0===t.length)throw new TypeError("1st argument must either be a DOM Element or a selector expression!");this._element=t[0]}this._options=Ink.extendObj({preventUrlChange:!1,active:void 0,disabled:[],onBeforeChange:void 0,onChange:void 0},i.data(t)),this._options=Ink.extendObj(this._options,n||{}),this._handlers={tabClicked:Ink.bindEvent(this._onTabClicked,this),disabledTabClicked:Ink.bindEvent(this._onDisabledTabClicked,this),resize:Ink.bindEvent(this._onResize,this)},this._init()};return s.prototype={_init:function(){this._menu=o.select(".tabs-nav",this._element)[0],this._menuTabs=this._getChildElements(this._menu),this._contentTabs=o.select(".tabs-content",this._element),this._initializeDom(),this._observe(),this._setFirstActive(),this._changeTab(this._activeMenuLink),this._handlers.resize(),e.registerInstance(this,this._element,"tabs")},_initializeDom:function(){for(var e=0;this._contentTabs.length>e;e++)n.hide(this._contentTabs[e])},_observe:function(){r.each(this._menuTabs,Ink.bind(function(e){var t=o.select("a",e)[0];r.inArray(t.getAttribute("href"),this._options.disabled)?this.disable(t):this.enable(t)},this)),t.observe(window,"resize",this._handlers.resize)},_setFirstActive:function(){var e=window.location.hash;this._activeContentTab=o.select(e,this._element)[0]||o.select(this._hashify(this._options.active),this._element)[0]||o.select(".tabs-content",this._element)[0],this._activeMenuLink=this._findLinkByHref(this._activeContentTab.getAttribute("id")),this._activeMenuTab=this._activeMenuLink.parentNode},_changeTab:function(e,t){t&&this._options.onBeforeChange!==void 0&&this._options.onBeforeChange(this);var i=e.getAttribute("href");n.removeClassName(this._activeMenuTab,"active"),n.removeClassName(this._activeContentTab,"active"),n.addClassName(this._activeContentTab,"hide-all"),this._activeMenuLink=e,this._activeMenuTab=this._activeMenuLink.parentNode,this._activeContentTab=o.select(i.substr(i.indexOf("#")),this._element)[0],n.addClassName(this._activeMenuTab,"active"),n.addClassName(this._activeContentTab,"active"),n.removeClassName(this._activeContentTab,"hide-all"),n.show(this._activeContentTab),t&&this._options.onChange!==void 0&&this._options.onChange(this)},_onTabClicked:function(e){t.stop(e);var n=t.findElement(e,"A");"a"===n.nodeName.toLowerCase()&&("true"!=""+this._options.preventUrlChange&&(window.location.hash=n.getAttribute("href").substr(n.getAttribute("href").indexOf("#"))),n!==this._activeMenuLink&&this.changeTab(n))},_onDisabledTabClicked:function(e){t.stop(e)},_onResize:function(){var t=e.currentLayout();t!==this._lastLayout&&(t===e.Layouts.SMALL||t===e.Layouts.MEDIUM?(n.removeClassName(this._menu,"menu"),n.removeClassName(this._menu,"horizontal")):(n.addClassName(this._menu,"menu"),n.addClassName(this._menu,"horizontal")),this._lastLayout=t)},_hashify:function(e){return e?0===e.indexOf("#")?e:"#"+e:""},_findLinkByHref:function(e){e=this._hashify(e);var t;return r.each(this._menuTabs,Ink.bind(function(n){var i=o.select("a",n)[0];-1!==i.getAttribute("href").indexOf("#")&&i.getAttribute("href").substr(i.getAttribute("href").indexOf("#"))===e&&(t=i)},this)),t},_getChildElements:function(e){for(var t=[],n=e.children,i=0;n.length>i;i++)1===n[i].nodeType&&t.push(n[i]);return t},changeTab:function(e){var t=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));t&&!n.hasClassName(t,"ink-disabled")&&this._changeTab(t,!0)},disable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.tabClicked),t.observe(i,"click",this._handlers.disabledTabClicked),n.addClassName(i,"ink-disabled"))},enable:function(e){var i=1===e.nodeType?e:this._findLinkByHref(this._hashify(e));i&&(t.stopObserving(i,"click",this._handlers.disabledTabClicked),t.observe(i,"click",this._handlers.tabClicked),n.removeClassName(i,"ink-disabled"))},activeTab:function(){return this._activeContentTab.getAttribute("id")},activeMenuTab:function(){return this._activeMenuTab},activeMenuLink:function(){return this._activeMenuLink},activeContentTab:function(){return this._activeContentTab},destroy:e.destroyComponent},s}); Ink.createModule("Ink.UI.Toggle","1",["Ink.UI.Aux_1","Ink.Dom.Event_1","Ink.Dom.Css_1","Ink.Dom.Element_1","Ink.Dom.Selector_1"],function(e,t,n,i,o){"use strict";var r=function(e,t){if("string"!=typeof e&&"object"!=typeof e)throw"[Ink.UI.Toggle] Invalid CSS selector to determine the root element";if("string"==typeof e){if(this._rootElement=o.select(e),0>=this._rootElement.length)throw"[Ink.UI.Toggle] Root element not found";this._rootElement=this._rootElement[0]}else this._rootElement=e;if(this._options=Ink.extendObj({target:void 0,triggerEvent:"click",closeOnClick:!0},i.data(this._rootElement)),this._options=Ink.extendObj(this._options,t||{}),this._options.target===void 0)throw"[Ink.UI.Toggle] Target option not defined";this._childElement=o.select(this._options.target,this._rootElement),0>=this._childElement.length&&(0>=this._childElement.length&&(this._childElement=o.select(this._options.target,this._rootElement.parentNode)),0>=this._childElement.length&&(this._childElement=o.select(this._options.target)),0>=this._childElement.length)||(this._childElement=this._childElement[0],this._init())};return r.prototype={_init:function(){this._accordion=n.hasClassName(this._rootElement.parentNode,"accordion")||n.hasClassName(this._childElement.parentNode,"accordion"),t.observe(this._rootElement,this._options.triggerEvent,Ink.bindEvent(this._onTriggerEvent,this)),"true"==""+this._options.closeOnClick&&t.observe(document,"click",Ink.bindEvent(this._onClick,this))},_onTriggerEvent:function(e){if(t.stop(e),this._accordion){var r,s,a;for(a=n.hasClassName(this._childElement.parentNode,"accordion")?this._childElement.parentNode:this._childElement.parentNode.parentNode,r=o.select(".toggle",a),s=0;r.length>s;s+=1){var l=i.data(r[s]),c=o.select(l.target,a);c.length>0&&c[0]!==this._childElement&&(c[0].style.display="none")}}var u="none"===n.getStyle(this._childElement,"display")?"show-all":"hide-all",h="none"===n.getStyle(this._childElement,"display")?"block":"none";n.removeClassName(this._childElement,"show-all"),n.removeClassName(this._childElement,"hide-all"),n.addClassName(this._childElement,u),this._childElement.style.display=h},_onClick:function(e){var n=t.element(e);i.isAncestorOf(this._rootElement,n)||i.isAncestorOf(this._childElement,n)||this._dismiss(this._rootElement)},_dismiss:function(){"none"!==n.getStyle(this._childElement,"display")&&(n.removeClassName(this._childElement,"show-all"),n.addClassName(this._childElement,"hide-all"),this._childElement.style.display="none")}},r}); Ink.createModule("Ink.UI.SmoothScroller","1",["Ink.Dom.Event_1","Ink.Dom.Selector_1","Ink.Dom.Loaded_1"],function(e,t,n){"use strict";var i={speed:10,gy:function(e){var t;if(t=e.offsetTop,e.offsetParent)for(;e=e.offsetParent;)t+=e.offsetTop;return t},scrollTop:function(){var e=document.body,t=document.documentElement;return e&&e.scrollTop?e.scrollTop:t&&t.scrollTop?t.scrollTop:window.pageYOffset?window.pageYOffset:0},add:function(t,n,i){e.observe(t,n,i)},end:function(t){return window.event?(window.event.cancelBubble=!0,window.event.returnValue=!1,void 0):(e.stop(t),void 0)},scroll:function(e){var t=Ink.UI.SmoothScroller.scrollTop();t+=e>t?Math.ceil((e-t)/Ink.UI.SmoothScroller.speed):(e-t)/Ink.UI.SmoothScroller.speed,window.scrollTo(0,t),(t===e||Ink.UI.SmoothScroller.offsetTop===t)&&clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.offsetTop=t},init:function(){n.run(Ink.UI.SmoothScroller.render)},render:function(){var n=t.select("a.scrollableLink");Ink.UI.SmoothScroller.end(this);for(var i=0;n.length>i;i++){var o=n[i];!o.href||-1===o.href.indexOf("#")||o.pathname!==location.pathname&&"/"+o.pathname!==location.pathname||(Ink.UI.SmoothScroller.add(o,"click",Ink.UI.SmoothScroller.end),e.observe(o,"click",Ink.UI.SmoothScroller.clickScroll))}},clickScroll:function(){Ink.UI.SmoothScroller.end(this);var e=this.hash.substr(1),n=t.select('a[name="'+e+'"],#'+e);if(n[0]!==void 0){if(-1===this.parentNode.className.indexOf("active")){var i=this.parentNode.parentNode,o=i.firstChild;do if(o.tagName!==void 0&&"LI"===o.tagName.toUpperCase()&&-1!==o.className.indexOf("active")){o.className=o.className.replace("active","");break}while(o=o.nextSibling);this.parentNode.className+=" active"}clearInterval(Ink.UI.SmoothScroller.interval),Ink.UI.SmoothScroller.interval=setInterval("Ink.UI.SmoothScroller.scroll("+Ink.UI.SmoothScroller.gy(n[0])+")",10)}}};return i});