Browse files

Gallery Build Tag: gallery-2010.05.26-19-47

  • Loading branch information...
1 parent 857f112 commit 7701608c0a46c0b29028fb9ac000073f8055d25a YUI Builder committed May 26, 2010
View
71 build/gallery-checkboxgroups/gallery-checkboxgroups-debug.js
@@ -1,17 +1,24 @@
YUI.add('gallery-checkboxgroups', function(Y) {
-/**********************************************************************
- * <p>Base class for enforcing constraints on groups of checkboxes.</p>
- *
- * <p>Derived classes must override enforceConstraints.</p>
- */
+"use strict";
var Direction =
{
SLIDE_UP: 0,
SLIDE_DOWN: 1
};
+/**********************************************************************
+ * <p>Base class for enforcing constraints on groups of checkboxes.</p>
+ *
+ * <p>Derived classes must override <code>enforceConstraints()</code>.</p>
+ *
+ * @module gallery-checkboxgroups
+ * @class CheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
+ */
+
function CheckboxGroup(
/* string/object/array */ cb_list)
{
@@ -37,11 +44,22 @@ function checkboxChanged(
CheckboxGroup.prototype =
{
+ /**
+ * @return {Array} List of managed checkboxes
+ */
getCheckboxList: function()
{
return this.cb_list;
},
+ /**
+ * Same functionality as <code>Array.splice()</code>. Operates on the
+ * list of managed checkboxes.
+ *
+ * @param start {Int} Insertion index
+ * @param delete_count {Int} Number of items to remove, starting from <code>start</code>
+ * @param cb_list {String|Object|Array} The list of checkboxes to insert at <code>start</code>
+ */
splice: function(
/* int */ start,
/* int */ delete_count,
@@ -64,8 +82,7 @@ CheckboxGroup.prototype =
cb_list);
}
- if (cb_list instanceof Array ||
- (cb_list && cb_list.length))
+ if (cb_list && Y.Lang.isNumber(cb_list.length))
{
for (i=0; i<cb_list.length; i++)
{
@@ -101,18 +118,27 @@ CheckboxGroup.prototype =
}
},
+ /**
+ * Derived classes must override this function to implement the desired behavior.
+ *
+ * @param cb_list {String|Object|Array} The list of checkboxes
+ * @param index {Int} The index of the checkbox that changed
+ */
enforceConstraints: function(
/* array */ cb_list,
/* int */ index)
{
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are checked
+ */
allChecked: function()
{
var count = this.cb_list.length;
for (var i=0; i<count; i++)
{
- if (!this.cb_list[i].get('checked'))
+ if (!this.cb_list[i].get('disabled') && !this.cb_list[i].get('checked'))
{
return false;
}
@@ -121,6 +147,9 @@ CheckboxGroup.prototype =
return true;
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are unchecked
+ */
allUnchecked: function()
{
var count = this.cb_list.length;
@@ -135,6 +164,9 @@ CheckboxGroup.prototype =
return true;
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are disabled
+ */
allDisabled: function()
{
var count = this.cb_list.length;
@@ -156,6 +188,11 @@ Y.CheckboxGroup = CheckboxGroup;
* the active, adjacent one is turned on. The exact algorithm is explained
* in "Tog on Interface". The checkboxes are assumed to be ordered in the
* order they were added.
+ *
+ * @module gallery-checkboxgroups
+ * @class AtLeastOneCheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function AtLeastOneCheckboxGroup(
@@ -231,6 +268,11 @@ Y.AtLeastOneCheckboxGroup = AtLeastOneCheckboxGroup;
/**********************************************************************
* At most one checkbox can be selected. If one is turned on, the active
* one is turned off.
+ *
+ * @module gallery-checkboxgroups
+ * @class AtMostOneCheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function AtMostOneCheckboxGroup(
@@ -266,6 +308,12 @@ Y.AtMostOneCheckboxGroup = AtMostOneCheckboxGroup;
* All checkboxes can be selected and a select-all checkbox is available
* to check all. This check-all box is automatically changed if any other
* checkbox changes state.
+ *
+ * @module gallery-checkboxgroups
+ * @class SelectAllCheckboxGroup
+ * @constructor
+ * @param select_all_cb {String|Object} The checkbox that triggers "select all"
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function SelectAllCheckboxGroup(
@@ -290,7 +338,10 @@ Y.extend(SelectAllCheckboxGroup, CheckboxGroup,
var checked = this.select_all_cb.get('checked');
for (var i=0; i<this.cb_list.length; i++)
{
- this.cb_list[i].set('checked', checked);
+ if (!this.cb_list[i].get('disabled'))
+ {
+ this.cb_list[i].set('checked', checked);
+ }
}
},
@@ -305,4 +356,4 @@ Y.extend(SelectAllCheckboxGroup, CheckboxGroup,
Y.SelectAllCheckboxGroup = SelectAllCheckboxGroup;
-}, 'gallery-2009.12.08-22' ,{requires:['node-base']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['node-base']});
View
2 build/gallery-checkboxgroups/gallery-checkboxgroups-min.js
@@ -1 +1 @@
-YUI.add("gallery-checkboxgroups",function(F){var E={SLIDE_UP:0,SLIDE_DOWN:1};function H(I){if(arguments.length===0){return;}this.cb_list=[];this.ev_list=[];this.splice(0,0,I);this.direction=E.SLIDE_UP;this.ignore_change=false;}function C(J,I){this.checkboxChanged(J.target);}H.prototype={getCheckboxList:function(){return this.cb_list;},splice:function(O,N,J){for(var L=O;L<N;L++){this.ev_list[L].detach();}if(F.Lang.isString(J)){var M=F.all(J);J=[];M.each(function(P){this.push(P);},J);}if(J instanceof Array||(J&&J.length)){for(L=0;L<J.length;L++){var K=O+L,I=(L===0?N:0);this.cb_list.splice(K,I,F.one(J[L]));this.ev_list.splice(K,I,this.cb_list[K].on("click",C,this));}}else{this.cb_list.splice(O,N);this.ev_list.splice(O,N);}},checkboxChanged:function(I){if(this.ignore_change||!this.cb_list.length||this.allDisabled()){return;}I=F.one(I);var K=this.cb_list.length;for(var J=0;J<K;J++){if(I==this.cb_list[J]){this.enforceConstraints(this.cb_list,J);}}},enforceConstraints:function(I,J){},allChecked:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(!this.cb_list[I].get("checked")){return false;}}return true;},allUnchecked:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(this.cb_list[I].get("checked")){return false;}}return true;},allDisabled:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(!this.cb_list[I].get("disabled")){return false;}}return true;}};F.CheckboxGroup=H;function B(I){B.superclass.constructor.call(this,I);}function G(J,K){if(J.length<2){return K;}var I=K;do{if(I===0){this.direction=E.SLIDE_DOWN;}else{if(I==J.length-1){this.direction=E.SLIDE_UP;}}if(this.direction==E.SLIDE_UP){I=Math.max(0,I-1);}else{I=Math.min(J.length-1,I+1);}}while(J[I].get("disabled"));return I;}F.extend(B,H,{enforceConstraints:function(J,K){if(J[K].get("checked")||!this.allUnchecked()){this.direction=E.SLIDE_UP;return;}var I=G.call(this,J,K);if(I==K){I=G.call(this,J,K);}this.ignore_change=true;J[I].set("checked",true);this.ignore_change=false;}});F.AtLeastOneCheckboxGroup=B;function D(I){D.superclass.constructor.call(this,I);}F.extend(D,H,{enforceConstraints:function(I,J){if(!I[J].get("checked")){return;}var L=I.length;for(var K=0;K<L;K++){if(K!=J){I[K].set("checked",false);}}}});F.AtMostOneCheckboxGroup=D;function A(J,I){this.select_all_cb=F.one(J);this.select_all_cb.on("click",this.toggleSelectAll,this);A.superclass.constructor.call(this,I);}F.extend(A,H,{getSelectAllCheckbox:function(){return this.select_all_cb;},toggleSelectAll:function(){var J=this.select_all_cb.get("checked");for(var I=0;I<this.cb_list.length;I++){this.cb_list[I].set("checked",J);}},enforceConstraints:function(I,J){this.select_all_cb.set("checked",this.allChecked());}});F.SelectAllCheckboxGroup=A;},"gallery-2009.12.08-22",{requires:["node-base"]});
+YUI.add("gallery-checkboxgroups",function(F){var E={SLIDE_UP:0,SLIDE_DOWN:1};function H(I){if(arguments.length===0){return;}this.cb_list=[];this.ev_list=[];this.splice(0,0,I);this.direction=E.SLIDE_UP;this.ignore_change=false;}function C(J,I){this.checkboxChanged(J.target);}H.prototype={getCheckboxList:function(){return this.cb_list;},splice:function(O,N,J){for(var L=O;L<N;L++){this.ev_list[L].detach();}if(F.Lang.isString(J)){var M=F.all(J);J=[];M.each(function(P){this.push(P);},J);}if(J&&F.Lang.isNumber(J.length)){for(L=0;L<J.length;L++){var K=O+L,I=(L===0?N:0);this.cb_list.splice(K,I,F.one(J[L]));this.ev_list.splice(K,I,this.cb_list[K].on("click",C,this));}}else{this.cb_list.splice(O,N);this.ev_list.splice(O,N);}},checkboxChanged:function(I){if(this.ignore_change||!this.cb_list.length||this.allDisabled()){return;}I=F.one(I);var K=this.cb_list.length;for(var J=0;J<K;J++){if(I==this.cb_list[J]){this.enforceConstraints(this.cb_list,J);}}},enforceConstraints:function(I,J){},allChecked:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(!this.cb_list[I].get("disabled")&&!this.cb_list[I].get("checked")){return false;}}return true;},allUnchecked:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(this.cb_list[I].get("checked")){return false;}}return true;},allDisabled:function(){var J=this.cb_list.length;for(var I=0;I<J;I++){if(!this.cb_list[I].get("disabled")){return false;}}return true;}};F.CheckboxGroup=H;function B(I){B.superclass.constructor.call(this,I);}function G(J,K){if(J.length<2){return K;}var I=K;do{if(I===0){this.direction=E.SLIDE_DOWN;}else{if(I==J.length-1){this.direction=E.SLIDE_UP;}}if(this.direction==E.SLIDE_UP){I=Math.max(0,I-1);}else{I=Math.min(J.length-1,I+1);}}while(J[I].get("disabled"));return I;}F.extend(B,H,{enforceConstraints:function(J,K){if(J[K].get("checked")||!this.allUnchecked()){this.direction=E.SLIDE_UP;return;}var I=G.call(this,J,K);if(I==K){I=G.call(this,J,K);}this.ignore_change=true;J[I].set("checked",true);this.ignore_change=false;}});F.AtLeastOneCheckboxGroup=B;function D(I){D.superclass.constructor.call(this,I);}F.extend(D,H,{enforceConstraints:function(I,J){if(!I[J].get("checked")){return;}var L=I.length;for(var K=0;K<L;K++){if(K!=J){I[K].set("checked",false);}}}});F.AtMostOneCheckboxGroup=D;function A(J,I){this.select_all_cb=F.one(J);this.select_all_cb.on("click",this.toggleSelectAll,this);A.superclass.constructor.call(this,I);}F.extend(A,H,{getSelectAllCheckbox:function(){return this.select_all_cb;},toggleSelectAll:function(){var J=this.select_all_cb.get("checked");for(var I=0;I<this.cb_list.length;I++){if(!this.cb_list[I].get("disabled")){this.cb_list[I].set("checked",J);}}},enforceConstraints:function(I,J){this.select_all_cb.set("checked",this.allChecked());}});F.SelectAllCheckboxGroup=A;},"gallery-2010.05.26-19-47",{requires:["node-base"]});
View
71 build/gallery-checkboxgroups/gallery-checkboxgroups.js
@@ -1,17 +1,24 @@
YUI.add('gallery-checkboxgroups', function(Y) {
-/**********************************************************************
- * <p>Base class for enforcing constraints on groups of checkboxes.</p>
- *
- * <p>Derived classes must override enforceConstraints.</p>
- */
+"use strict";
var Direction =
{
SLIDE_UP: 0,
SLIDE_DOWN: 1
};
+/**********************************************************************
+ * <p>Base class for enforcing constraints on groups of checkboxes.</p>
+ *
+ * <p>Derived classes must override <code>enforceConstraints()</code>.</p>
+ *
+ * @module gallery-checkboxgroups
+ * @class CheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
+ */
+
function CheckboxGroup(
/* string/object/array */ cb_list)
{
@@ -37,11 +44,22 @@ function checkboxChanged(
CheckboxGroup.prototype =
{
+ /**
+ * @return {Array} List of managed checkboxes
+ */
getCheckboxList: function()
{
return this.cb_list;
},
+ /**
+ * Same functionality as <code>Array.splice()</code>. Operates on the
+ * list of managed checkboxes.
+ *
+ * @param start {Int} Insertion index
+ * @param delete_count {Int} Number of items to remove, starting from <code>start</code>
+ * @param cb_list {String|Object|Array} The list of checkboxes to insert at <code>start</code>
+ */
splice: function(
/* int */ start,
/* int */ delete_count,
@@ -64,8 +82,7 @@ CheckboxGroup.prototype =
cb_list);
}
- if (cb_list instanceof Array ||
- (cb_list && cb_list.length))
+ if (cb_list && Y.Lang.isNumber(cb_list.length))
{
for (i=0; i<cb_list.length; i++)
{
@@ -101,18 +118,27 @@ CheckboxGroup.prototype =
}
},
+ /**
+ * Derived classes must override this function to implement the desired behavior.
+ *
+ * @param cb_list {String|Object|Array} The list of checkboxes
+ * @param index {Int} The index of the checkbox that changed
+ */
enforceConstraints: function(
/* array */ cb_list,
/* int */ index)
{
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are checked
+ */
allChecked: function()
{
var count = this.cb_list.length;
for (var i=0; i<count; i++)
{
- if (!this.cb_list[i].get('checked'))
+ if (!this.cb_list[i].get('disabled') && !this.cb_list[i].get('checked'))
{
return false;
}
@@ -121,6 +147,9 @@ CheckboxGroup.prototype =
return true;
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are unchecked
+ */
allUnchecked: function()
{
var count = this.cb_list.length;
@@ -135,6 +164,9 @@ CheckboxGroup.prototype =
return true;
},
+ /**
+ * @return {boolean} <code>true</code> if all checkboxes are disabled
+ */
allDisabled: function()
{
var count = this.cb_list.length;
@@ -156,6 +188,11 @@ Y.CheckboxGroup = CheckboxGroup;
* the active, adjacent one is turned on. The exact algorithm is explained
* in "Tog on Interface". The checkboxes are assumed to be ordered in the
* order they were added.
+ *
+ * @module gallery-checkboxgroups
+ * @class AtLeastOneCheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function AtLeastOneCheckboxGroup(
@@ -231,6 +268,11 @@ Y.AtLeastOneCheckboxGroup = AtLeastOneCheckboxGroup;
/**********************************************************************
* At most one checkbox can be selected. If one is turned on, the active
* one is turned off.
+ *
+ * @module gallery-checkboxgroups
+ * @class AtMostOneCheckboxGroup
+ * @constructor
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function AtMostOneCheckboxGroup(
@@ -266,6 +308,12 @@ Y.AtMostOneCheckboxGroup = AtMostOneCheckboxGroup;
* All checkboxes can be selected and a select-all checkbox is available
* to check all. This check-all box is automatically changed if any other
* checkbox changes state.
+ *
+ * @module gallery-checkboxgroups
+ * @class SelectAllCheckboxGroup
+ * @constructor
+ * @param select_all_cb {String|Object} The checkbox that triggers "select all"
+ * @param cb_list {String|Object|Array} The list of checkboxes to manage
*/
function SelectAllCheckboxGroup(
@@ -290,7 +338,10 @@ Y.extend(SelectAllCheckboxGroup, CheckboxGroup,
var checked = this.select_all_cb.get('checked');
for (var i=0; i<this.cb_list.length; i++)
{
- this.cb_list[i].set('checked', checked);
+ if (!this.cb_list[i].get('disabled'))
+ {
+ this.cb_list[i].set('checked', checked);
+ }
}
},
@@ -305,4 +356,4 @@ Y.extend(SelectAllCheckboxGroup, CheckboxGroup,
Y.SelectAllCheckboxGroup = SelectAllCheckboxGroup;
-}, 'gallery-2009.12.08-22' ,{requires:['node-base']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['node-base']});
View
55 build/gallery-formvalidator/gallery-formvalidator-debug.js
@@ -731,6 +731,7 @@ YUI.add('gallery-formvalidator', function(Y) {
function _BaseInputField(){
_BaseInputField.superclass.constructor.apply(this,arguments);
this.publish(_BaseInputField.CE_ONCHANGE);
+ this.checkPrompt();
}
Y.augment(_BaseInputField, Y.EventTarget);
_BaseInputField.staticVariables = {
@@ -927,6 +928,36 @@ YUI.add('gallery-formvalidator', function(Y) {
*/
optional:{
value:false
+ },
+ /**
+ * This must provide a function and an html element. A scope may be optionally provided. <br />
+ * &#123;fn: function(el, field) {}, scope: this, el: 'validation-prompt'&#124;
+ * @property validationPrompt
+ * @type HTMLElement
+ */
+ validationPrompt: {
+ value: null,
+ setter: function(val) {
+ if (!YL.isObject(val)) {
+ return null;
+ }
+ else if (!val.el) {
+ return null;
+ }
+ else if (!val.fn) {
+ val.fn = function(el, field) {
+ if (!field.isValid() && !field.isEmpty()) {
+ el.style.display = '';
+ }
+ else {
+ el.style.display = 'none';
+ }
+ }
+ }
+ val.el = _BaseInputField.staticFunctions.standardElSetter(val.el);
+ val.el.style.display = 'none'; // start off as hidden.
+ return val;
+ }
}
};
_BaseInputField.NAME = 'BaseInputField';
@@ -1029,7 +1060,26 @@ YUI.add('gallery-formvalidator', function(Y) {
* that the input is valid or invalid.
* @method checkIndicators
*/
- checkIndicators:function(){},
+ checkIndicators: function () {},
+ /**
+ * This will ensure the validation prompt function gets called and the
+ * proper validation tip gets displayed.
+ * @method checkPrompt
+ */
+ checkPrompt: function () {
+ var prompt = this.get('validationPrompt'), scope, fn;
+ if (!prompt) {
+ return;
+ }
+ // if the input is not on, then hide the validation prompt
+ if (!this.inputIsOn()) {
+ prompt.el.style.display = 'none';
+ return;
+ }
+ scope = prompt.scope || {};
+ fn = prompt.fn || function() {};
+ fn.call(scope, prompt.el, this);
+ },
/**
* This will be overriden by subclasses, but this will hide the incorrect
* indicator and show the correct indicator if there is one. It will also
@@ -1117,6 +1167,7 @@ YUI.add('gallery-formvalidator', function(Y) {
* @method _evtOnChange
*/
_evtOnChange:function(e){
+ this.checkPrompt();
this.checkIndicators();
this.fire(_BaseInputField.CE_ONCHANGE);
},
@@ -2922,4 +2973,4 @@ YUI.add('gallery-formvalidator', function(Y) {
Y.SelectField = _SelectField;
-}, 'gallery-2009.11.19-20' ,{requires:['node', 'event', 'dom', 'base']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['node', 'event', 'dom', 'base']});
View
8 build/gallery-formvalidator/gallery-formvalidator-min.js
@@ -1,5 +1,5 @@
YUI.add("gallery-formvalidator",function(A){var K=A.Lang,C=function(){return(((1+Math.random())*65536)|0).toString(16).substring(1);},L=function(){return(C()+C()+"-"+C()+"-"+C()+"-"+C()+"-"+C()+C()+C());},D=function(W){var V=[],U,T;if((W.tagName!==null&&W.tagName!==undefined)&&(W.tagName.toLowerCase()=="input")&&(W.type=="submit")){return[W];}U=W.children;if(U===null||U===undefined){U=W.childNodes;}for(T=0;T<U.length;++T){V=V.concat(D(U[T]));}return V;},G=function(U){var T;if(U.getAttribute===null||U.getAttribute===undefined){return false;}T=U.getAttribute("formvalidator:Form");if(T===null||T===undefined){return false;}T=T.toLowerCase();return(T=="yes")||(T=="true");},M=function(X){var W=[],Z=false,V=null,U=0,T,Y;if(X.getAttribute!==null&&X.getAttribute!==undefined){T=X.getAttribute("formvalidator:FormField");Y=X.getAttribute("formvalidator:FormGroup");if((T!==null&&T!==undefined)&&((T.toLowerCase()=="true")||(T.toLowerCase()=="yes"))){W[0]=X;}if((Y!==null&&Y!==undefined)&&((Y.toLowerCase()=="true")||(Y.toLowerCase()=="yes"))){Z=true;}}V=X.children;if(V===null||V===undefined){V=X.childNodes;}for(U=0;U<V.length;++U){if(!G(V[U])){W=W.concat(M(V[U]));}}if(Z){return[{isGroup:true,groupDOM:X,members:W}];}else{return W;}};function O(T){O.superclass.constructor.apply(this,arguments);this._initializeEvents();this.initializeInputs();this.initializeButtons();this.checkFormValues();this.on("inputfield:onchanged",this.onFormValueChanged);if(this.get("checkOnSubmit")){this.enableButtons();}this.publish(O.CE_ONSUBMIT);}O.staticFunctions={BOOLEANSETTER:function(T){if(K.isBoolean(T)){return T;}else{if(K.isString(T)){return T.toLowerCase()=="true";}else{return T!==null&&T!==undefined;}}}};A.augment(O,A.EventTarget);O.ATTRS={customGlobal:{value:{}},form:{setter:function(U){var T=U;if(K.isString(U)){T=A.DOM.byId(U);}if(T===null||T===undefined){throw"Invalid form: Form with id "+U+" does not exist";}return T;},value:null},checkOnSubmit:{value:false,setter:O.staticFunctions.BOOLEANSETTER},onSubmit:{value:null},onSubmitScope:{value:null},createIncorrectIndicator:{value:false},createCorrectIndicator:{value:false},defaultIndicatorDomType:{value:"SPAN"},defaultIncorrectIndicatorCss:{value:""},defaultCorrectIndicatorCss:{value:""},correctIndicatorText:{value:"&nbsp;"},incorrectIndicatorText:{value:"&nbsp;"},fieldJSON:{value:[]},buttonJSON:{value:[]},inputFields:{value:[]},buttons:{value:[]},excludedButtons:{value:[]}};O.NAME="Validator";O.CE_ONSUBMIT="form:onsubmit";A.extend(O,A.Base,{initializeInputs:function(){var T=this.get("fieldJSON"),V,W,U;for(V=0;V<T.length;++V){W=new T[V].type(T[V].atts,false);U=W.getInputDOM();if(U!==null&&U!==undefined){W.synchronize(U);}this.addInput(W);}this.initializeInlineInputs();},getInput:function(W){if(W===null||W===undefined){return null;}var V=this.get("inputFields"),T,U;for(T=0;T<V.length;++T){if(V[T].getId()==W){return V[T];}if(V[T].isGroup()){U=V[T].getInput(W);if(U!==null&&U!==undefined){return U;}}}return null;},clear:function(T){var V=this.get("inputFields"),U;for(U=0;U<V.length;++U){V[U].clear(T);}},setupInput:function(T){T.set("createIncorrectIndicator",this.get("createIncorrectIndicator"));T.set("createCorrectIndicator",this.get("createCorrectIndicator"));this.checkAttribute(T,"defaultIncorrectIndicatorCss","incorrectIndicatorCss");this.checkAttribute(T,"defaultCorrectIndicatorCss","correctIndicatorCss");this.checkAttribute(T,"defaultIndicatorDomType","indicatorType");this.checkAttribute(T,"correctIndicatorText","correctIndicatorText");this.checkAttribute(T,"incorrectIndicatorText","incorrectIndicatorText");T.initializeInput(this);if(!this.get("checkOnSubmit")){T.initializeEvents();}T.addTarget(this);},addInput:function(U){this.setupInput(U);var T=this.get("inputFields");T[T.length]=U;},initializeInlineInputs:function(){var T=M(this.get("form")),U;for(U=0;U<T.length;++U){this.addInlineInput(T[U]);}},constructInlineGroup:function(Z){var Y=Z.members,U=this.getInput(Z.groupDOM.id),V=false,W,T,X,a;if(U===null||U===undefined){V=true;U=new A.GroupBaseField({groupDOM:Z.groupDOM},false);U.synchronize(Z.groupDOM);}for(W=0;W<Y.length;++W){T=this.getInput(Y[W].id);if(Y[W].isGroup){U.addInput(this.constructInlineGroup(Y[W]));}else{if(T===null||T===undefined){X=A[Y[W].getAttribute("formvalidator:type")];a=new X({inputDOM:Y[W]},false);this.setupInput(a);U.addInput(a,this);a.synchronize(Y[W]);}}}if(V){this.setupInput(U);}return U;},addInlineInput:function(V){var W=null,T,U;if(V.isGroup){W=this.constructInlineGroup(V);this.addInput(W);}else{T=this.getInput(V.id);if(T!==null&&T!==undefined){V.id="formvalidator:"+L();}U=A[V.getAttribute("formvalidator:type")];W=new U({inputDOM:V},false);this.addInput(W);W.synchronize(V);}},checkAttribute:function(U,V,T){var W=U.get(T);if(W===null||W===undefined){U.set(T,this.get(V));}},initializeButtons:function(){var a=this.get("buttonJSON"),Y=this.get("buttons"),U=this.get("excludedButtons"),W,V,X,Z,T;for(W=0;W<a.length;++W){Y[W]=new A.Button(a[W]);T=Y[W].get("buttonEl");if(T.type=="button"){A.Event.attach("click",this.submitForm,T,this,true);}}X=D(this.get("form"));for(W=0;W<X.length;++W){Z=false;for(V=0;V<U.length;++V){if(U[V]==X[W].id){Z=true;break;}}if(!Z){Y[Y.length]=new A.Button({buttonEl:X[W]});}}},submitForm:function(){var T=this.get("form");if(T.submit!==null&&T.submit!==undefined){T.submit();}},_initializeEvents:function(){A.Event.attach("submit",this._onFormSubmit,this.get("form"),this,true);A.Event.attach("reset",this._onFormReset,this.get("form"),this,true);},_onFormSubmit:function(V){var U=this.get("onSubmit"),W=this.get("onSubmitScope"),T=true;if(U!==null&&U!==undefined){if(W!==null&&W!==undefined){W.anonymousCall=U;T=W.anonymousCall();W.anonymousCall=null;}else{T=U();}}if(!this.checkFormValues()){V.preventDefault();return;}else{if(!T){V.preventDefault();}}this.fire(O.CE_ONSUBMIT);},_onFormReset:function(U){var T=this;setTimeout(function(){T.checkFormValues();},100);this.checkFormValues();},onFormValueChanged:function(){var V=this.get("inputFields"),U=true,T;
-for(T=0;T<V.length;++T){U=U&&V[T].isValid();}if(U){this.enableButtons();}else{this.disableButtons();}return U;},checkFormValues:function(){var V=this.get("inputFields"),U=true,T;for(T=0;T<V.length;++T){U=V[T].checkIndicators()&&U;}if(U){this.enableButtons();}else{this.disableButtons();}return U;},disableButtons:function(){if(this.get("checkOnSubmit")){return;}var U=this.get("buttons"),T;for(T=0;T<U.length;++T){U[T].disable();}},enableButtons:function(){var U=this.get("buttons"),T;for(T=0;T<U.length;++T){U[T].enable();}}});A.Validator=O;function F(T){F.superclass.constructor.apply(this,arguments);}F.ATTRS={buttonEl:{value:null,setter:function(U){var T=U;if(K.isString(U)){T=A.DOM.byId(U);}if(T===null||T===undefined){throw"Invalid button: Button with id "+U+" does not exist";}return T;}}};F.NAME="Button";A.extend(F,A.Base,{enable:function(){this.get("buttonEl").disabled=false;},disable:function(){this.get("buttonEl").disabled=true;}});A.Button=F;function E(){E.superclass.constructor.apply(this,arguments);this.publish(E.CE_ONCHANGE);}A.augment(E,A.EventTarget);E.staticVariables={MAX_INTEGER:2147483647,INTEGERREGEX:/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/,DOUBLEREGEX:/(^-?\d\d*\.\d+$)|(^-?\d\d*$)|(^-?\.\d\d*$)/,EMAILREGEX:/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/};E.staticFunctions={standardRegexSetter:function(U){if(K.isString(U)){var T=U;if(T.indexOf("/")===0){T=T.substring(1);}if(T.charAt(T.length-1)=="/"){T=T.substring(0,T.length-1);}return new RegExp(T);}else{return U;}},standardElSetter:function(U){if(U===null||U===undefined){return null;}var T=U;if(K.isString(U)){T=A.DOM.byId(U);}if(T===null||T===undefined){return U;}else{return T;}},BOOLEANSETTER:function(T){if(K.isBoolean(T)){return T;}else{if(K.isString(T)){return T.toLowerCase()=="true";}else{return T!==null&&T!==undefined;}}}};E.ATTRS={createIncorrectIndicator:{value:false},createCorrectIndicator:{value:false},indicatorType:{value:null},correctIndicatorCss:{value:null},incorrectIndicatorCss:{value:null},correctIndicator:{value:null,setter:E.staticFunctions.standardElSetter},incorrectIndicatorText:{value:null},correctIndicatorText:{value:null},incorrectIndicator:{value:null,setter:E.staticFunctions.standardElSetter},correctCss:{value:null},incorrectCss:{value:null},disabled:{value:false},isOn:{value:true},optional:{value:false}};E.NAME="BaseInputField";E.CE_ONCHANGE="inputfield:onchanged";A.extend(E,A.Base,{initializeInput:function(T){},getInputDOM:function(){return null;},inputIsOn:function(){return this.get("isOn");},clear:function(T){},isGroup:function(){return false;},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},synchronize:function(V){var T=this.getAttrs(false),W,U;for(U in T){if(true){W=V.getAttribute("formvalidator:"+U);if(W!==null&&W!==undefined){this.set(U,W);}}}},isValid:function(){throw"Plesae override the isValid function";},turnOff:function(){this.set("isOn",false);this._evtOnChange();},turnOn:function(){this.set("isOn",true);this._evtOnChange();},checkIndicators:function(){},showCorrectIndicator:function(){},showIncorrectIndicator:function(){},showNoIndicators:function(){},setupIndicators:function(){var U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(this.get("createCorrectIndicator")){this.set("correctIndicator",this.setupDomItem(U,this.get("correctIndicatorText"),this.get("correctIndicatorCss")));}if(this.get("createIncorrectIndicator")){this.set("incorrectIndicator",this.setupDomItem(T,this.get("incorrectIndicatorText"),this.get("incorrectIndicatorCss")));}},setupDomItem:function(W,U,V){var T=W;if((T===null||T===undefined)||K.isString(T)){T=document.createElement(this.get("indicatorType"));if(W!==null&&W!==undefined){T.id=W;}this.insertBeside(T);T.innerHTML=U;}if((T.className===""||T.className===null||T.className===undefined)&&(V!==null&&V!==undefined)){T.className=V;}return T;},getId:function(){return null;},isEmpty:function(){throw"Plesae override the isEmpty function";},initializeEvents:function(T){},_evtOnChange:function(T){this.checkIndicators();this.fire(E.CE_ONCHANGE);},insertBeside:function(T){},initializer:function(){},destructor:function(){}});A.BaseInputField=E;function Q(U,T){Q.superclass.constructor.apply(this,arguments);if(T){this.initializeInput();}this.get("textType");}Q.ATTRS={maxLength:{value:255,setter:function(T){if(T<0){return 255;}else{return T;}}},formatter:{value:null,setter:function(T){if(T===null||T===undefined){return null;}if(K.isFunction(T)){return T;}else{if(K.isObject(T)){if(T.format===null||T===undefined){throw"Formatter object must have a formatter function";}return T;}else{throw"Formatter must be an object or a function";}}}},regex:{value:null,setter:A.BaseInputField.staticFunctions.standardRegexSetter},textType:{lazy:false,value:null,setter:function(T){if(T===null||T===undefined){return null;}else{if(T.toLowerCase()=="email"){this.set("regex",A.BaseInputField.staticVariables.EMAILREGEX);}else{if(T.toLowerCase()=="phone"){this.set("regex",/^([(]?[2-9]\d{2}[)]?)[ ]*-?[ ]*(\d{3})[ ]*-?[ ]*(\d{4})$/);}else{if(T.toLowerCase()=="creditcard"){this.set("regex",/[0-9]{4} {0,1}[0-9]{4} {0,1}[0-9]{4} {0,1}[0-9]{4}/);}else{if(T.toLowerCase()=="zipcode"){this.set("regex",/^(\d{5})([\s]*-[\s]*\d{4})?$/);}else{if(T.toLowerCase()=="postalcode"){this.set("regex",/^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}[\s]*[0-9]{1}[a-zA-Z]{1}[0-9]{1}$/);}}}}}}return T;}},inputDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter}};Q.NAME="TextBaseField";A.extend(Q,A.BaseInputField,{initializeInput:function(){this.setupIndicators();},clear:function(T){this.get("inputDOM").value="";if(T!==true){this._evtOnChange();}},getInputDOM:function(){return this.get("inputDOM");},disable:function(){Q.superclass.disable.call(this);this.get("inputDOM").disabled=true;},enable:function(){Q.superclass.enable.call(this);this.get("inputDOM").disabled=false;},isValid:function(){if(!this.get("isOn")){return true;}if(this.get("optional")&&this.isEmpty()){return true;
-}var T=this.get("regex"),U=this.get("inputDOM").value;if((T!==null&&T!==undefined)&&(!T.test(U))){return false;}return !this.isEmpty()&&U.length<=this.get("maxLength");},getId:function(){return this.get("inputDOM").id;},isEmpty:function(){return(this.get("inputDOM").value==="");},checkFormat:function(){if(!this.isValid()){return;}if(!this.inputIsOn()){return;}var T=this.get("formatter"),U;if(T===null||T===undefined){return;}U=this.get("inputDOM");if(K.isFunction(T)){U.value=T(U.value);}else{U.value=T.format(U.value);}},checkIndicators:function(){if(!this.inputIsOn()){this.showNoIndicators();return true;}else{if(this.get("optional")&&this.isEmpty()){this.showNoIndicators();return true;}else{if(this.isValid()){this.showCorrectIndicator();this.checkFormat();return true;}else{this.showIncorrectIndicator();return false;}}}},showCorrectIndicator:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");this.checkFormat();A.DOM.removeClass(T,this.get("incorrectCss"));A.DOM.addClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="";}if(U!==null&&U!==undefined){U.style.display="none";}},showIncorrectIndicator:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");A.DOM.addClass(T,this.get("incorrectCss"));A.DOM.removeClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="none";}if(U!==null&&U!==undefined){U.style.display="";}},showNoIndicators:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");A.DOM.removeClass(T,this.get("incorrectCss"));A.DOM.removeClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="none";}if(U!==null&&U!==undefined){U.style.display="none";}},insertBeside:function(T){A.DOM.insertAfter(T,this.get("inputDOM"));},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("keyup",T._evtOnChange,this.get("inputDOM"),T,true);A.Event.attach("blur",T._evtOnChange,this.get("inputDOM"),T,true);}});A.TextBaseField=Q;function N(T){N.superclass.constructor.apply(this,arguments);}N.ATTRS={inputDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},validWhenChecked:{value:true}};N.NAME="CheckboxField";A.extend(N,A.BaseInputField,{initializeInput:function(){this.setupIndicators();},getInputDOM:function(){return this.get("inputDOM");},clear:function(T){this.get("inputDOM").checked=!this.get("validWhenChecked");if(T!==true){this._evtOnChange();}},disable:function(){N.superclass.disable.call(this);this.get("inputDOM").disabled=true;},enable:function(){N.superclass.enable.call(this);this.get("inputDOM").disabled=false;},isValid:function(){if(!this.get("isOn")){return true;}var U=this.get("validWhenChecked"),T=this.get("inputDOM").checked;return(U&&T)||(!U&&!T);},getId:function(){return this.get("inputDOM").id;},isEmpty:function(){return !this.isValid();},showNoIndicators:function(){var V=this.get("inputDOM"),U=this.get("correctIndicator"),T=this.get("incorrectIndicator");A.DOM.removeClass(V,this.get("incorrectCss"));A.DOM.removeClass(V,this.get("correctCss"));if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="none";}},checkIndicators:function(){var V=this.get("inputDOM"),U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(!this.get("isOn")){this.showNoIndicators();return this.isValid();}else{if(this.isValid()){if(V!==null&&V!==undefined){A.DOM.removeClass(V,this.get("incorrectCss"));A.DOM.addClass(V,this.get("correctCss"));}if(U!==null&&U!==undefined){U.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}return true;}else{if(V!==null&&V!==undefined){A.DOM.addClass(V,this.get("incorrectCss"));A.DOM.removeClass(V,this.get("correctCss"));}if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}return false;}}},insertBeside:function(T){},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("click",T._evtOnChange,this.get("inputDOM"),T,true);}});A.CheckboxField=N;function P(T){P.superclass.constructor.apply(this,arguments);}P.ATTRS={validatorObject:{setter:function(U){if(U===null||U===undefined){throw"You must provide a validator object to the custom input";}var T=null;if(K.isString(U)){T=validatorGlobal[U];}else{if(K.isFunction(U)){T=U();}else{if(K.isObject(U)){T=U;}}}if(T===null||T===undefined){throw"Your validator object must be a object";}else{return T;}}},id:{value:null}};P.NAME="CustomField";A.extend(P,A.BaseInputField,{checkIndicators:function(){var U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(this.isValid()){if(U!==null&&U!==undefined){U.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}return true;}else{if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}return false;}},getId:function(){var T=this.get("id");if(T===null||T===undefined){T=this.executeFunction("getId",null);}return T;},executeFunction:function(U,T){var V=this.get("validatorObject");if(K.isFunction(V[U])){return V[U]();}return T;},executeVoidFunction:function(T){var U=this.get("validatorObject");if(K.isFunction(U[T])){U[T]();}},disable:function(){P.superclass.disable.call(this);this.executeVoidFunction("disable");},enable:function(){P.superclass.enable.call(this);this.executeVoidFunction("enable");},turnOff:function(){P.superclass.turnOff.call(this);this.executeVoidFunction("turnOff");},turnOn:function(){P.superclass.turnOn.call(this);this.executeVoidFunction("turnOn");},clear:function(T){var U=this.get("validatorObject");if(K.isFunction(U.clear)){U.clear(T);}if(T!==true){this._evtOnChange();}},isEmpty:function(){return this.executeFunction("isEmpty",false);},isValid:function(){return this.executeFunction("isValid",false);},insertBeside:function(T){var U=this.get("validatorObject");if(K.isFunction(U.insertBeside)){U.insertBeside(T);}}});
-A.CustomField=P;function B(T){B.superclass.constructor.apply(this,arguments);this.set("regex",A.BaseInputField.staticVariables.DOUBLEREGEX);}B.ATTRS={minInclusive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER},maxInclusive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER},min:{value:0,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseFloat(T);}if(!K.isNumber(T)){throw"Invalid value given for min: "+U;}if(T<(-1)*A.BaseInputField.staticVariables.MAX_INTEGER){return(-1)*A.BaseInputField.staticVariables.MAX_INTEGER;}return T;}},max:{value:A.BaseInputField.staticVariables.MAX_INTEGER,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseFloat(T);}if(!K.isNumber(T)){throw"Invalid value given for max: "+U;}if(T>A.BaseInputField.staticVariables.MAX_INTEGER){return A.BaseInputField.staticVariables.MAX_INTEGER;}return T;}},maxDecimalPlaces:{value:-1,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseInt(T,10);}if(!K.isNumber(T)){throw"Invalid value given for decimal places: "+U;}else{return U;}}}};B.NAME="DoubleField";A.extend(B,A.TextBaseField,{isValid:function(){if(!B.superclass.isValid.call(this)){return false;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var a=this.get("inputDOM").value,W=0,b,V,X,Z,U,T=this.get("maxDecimalPlaces");if((T!=-1)&&(a.indexOf(".")!=-1)){U=a.split(".")[1];if(U.length>T){return false;}}try{W=parseFloat(a,10);}catch(Y){return false;}if(W.toString()===null||W.toString()===undefined){return false;}if(W.toString().toLowerCase()=="nan"){return false;}b=this.get("minInclusive");V=this.get("maxInclusive");X=this.get("min");Z=this.get("max");if(b&&(X>W)){return false;}else{if(!b&&(X>=W)){return false;}else{if(V&&(Z<W)){return false;}else{if(!V&&(Z<=W)){return false;}else{return true;}}}}}});A.DoubleField=B;function R(T){R.superclass.constructor.apply(this,arguments);this.set("regex",A.BaseInputField.staticVariables.INTEGERREGEX);}R.ATTRS={};R.NAME="IntegerField";A.extend(R,A.DoubleField,{isValid:function(){if(!R.superclass.isValid.call(this)){return false;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var U=this.get("inputDOM").value,T=0;if(U.indexOf(".")!=-1){return false;}try{T=parseInt(U,10);}catch(V){return false;}if(T.toString().toLowerCase()=="nan"){return false;}else{return true;}}});A.IntegerField=R;function J(T){J.superclass.constructor.apply(this,arguments);}J.ATTRS={groupDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},membersJSON:{value:[]},members:{value:[],setter:function(T){if(K.isArray(T)){return T;}else{throw"The members property of a group must be an array";}}},minValid:{value:null,setter:function(V){if(V===null||V===undefined){return null;}var U=V,T;if(!K.isNumber(U)){U=parseInt(U,10);}if(U<1){throw"The minimum must be greater than 1";}T=this.get("maxValid");if((T!==null&&T!==undefined)&&(U>T)){throw"Minimum must be less than or equal to maximum";}else{return U;}}},maxValid:{value:null,setter:function(U){if(U===null||U===undefined){return null;}if(U<1){throw"The maximum must be greater than 1";}var T=this.get("minValid");if((T!==null&&T!==undefined)&&(U<T)){throw"Maximum must be greater than or equal to minimum";}else{return U;}}},id:{value:null}};J.NAME="GroupBaseField";A.extend(J,A.BaseInputField,{isGroup:function(){return true;},getInputDOM:function(){return this.get("groupDOM");},getInput:function(W){var T=this.get("members"),V,U;for(U=0;U<T.length;++U){if(T[U].getId()==W){return T[U];}if(T[U].isGroup()){V=T[U].getInput(W);if(V!==null&&V!==undefined){return V;}}}return null;},clear:function(U){var T=this.get("members"),V;for(V=0;V<T.length;++V){T[V].clear(true);}if(U!==true){this._evtOnChange();}},disable:function(){J.superclass.disable.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].disable();}},enable:function(){J.superclass.enable.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].enable();}},turnOn:function(){J.superclass.turnOn.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].turnOn();}this.checkIndicators();},turnOff:function(){J.superclass.turnOff.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].turnOff();}},initializeInput:function(V){var W=this.get("membersJSON"),T=this.get("members"),X,U;for(U=0;U<W.length;++U){X=new W[U].type(W[U].atts,false);V.setupInput(X);T[T.length]=X;}this.setupIndicators();this.checkIndicators();},addInput:function(U){var T=this.get("members");T[T.length]=U;},isValid:function(){if(this.get("optional")&&this.isEmpty()){return true;}var V=this.get("members"),U=0,Z=this.get("isOn"),a=true,X,T,b,Y,W;for(W=0;W<V.length;++W){X=V[W].isEmpty();T=V[W].isValid();if(!X&&T){U++;}else{if(!X){return !Z;}}}if(Z){b=this.get("minValid");Y=this.get("maxValid");if(b!==null&&b!==undefined){a=b<=U;}if(Y!==null&&Y!==undefined){a=(Y>=U)&&a;}}return a;},getId:function(){var U=this.get("id"),T;if(U!==null&&U!==undefined){return U;}T=this.get("groupDOM");if(T!==null&&T!==undefined){return T.id;}else{return null;}},isEmpty:function(){var T=this.get("members"),U;for(U=0;U<T.length;++U){if(!T[U].isEmpty()){return false;}}return true;},showCorrectIndicator:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(U!==null&&U!==undefined){A.DOM.removeClass(U,this.get("incorrectCss"));A.DOM.addClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}},showIncorrectIndicator:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(U!==null&&U!==undefined){A.DOM.addClass(U,this.get("incorrectCss"));A.DOM.removeClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}},showNoIndicators:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(U!==null&&U!==undefined){A.DOM.removeClass(U,this.get("incorrectCss"));
-A.DOM.removeClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="none";}if(T!==null&&T!==undefined){T.style.display="none";}},checkIndicators:function(){var W=this.get("members"),U=0,V=false,a=this.get("isOn"),Y,X,T,b=true,c,Z;for(X=0;X<W.length;++X){Y=W[X].isEmpty();T=W[X].isValid();if(!a){W[X].showNoIndicators();}else{if(this.get("optional")&&this.isEmpty()){W[X].showNoIndicators();}else{if(!Y&&T){U++;W[X].showCorrectIndicator();}else{if(!Y){W[X].showIncorrectIndicator();V=true;}else{W[X].showNoIndicators();}}}}}if(!V){c=this.get("minValid");Z=this.get("maxValid");if(c!==null&&c!==undefined){b=c<=U;}if(Z!==null&&Z!==undefined){b=(Z>=U)&&b;}}else{b=false;}if(!a){this.showNoIndicators();return true;}else{if(this.get("optional")&&this.isEmpty()){this.showNoIndicators();return true;}else{if(b){this.showCorrectIndicator();return true;}else{this.showIncorrectIndicator();return false;}}}},insertBeside:function(T){},initializeEvents:function(W){var V=W,T=this.get("members"),U;if(V===null||V===undefined){V=this;}for(U=0;U<T.length;++U){T[U].initializeEvents(V);}}});A.GroupBaseField=J;function S(T){S.superclass.constructor.apply(this,arguments);}S.staticVariables={StrongPassword:/^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$/,MediumPassword:/^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$/,MinimumPassword:/(?=.{6,}).*/};S.ATTRS={requiredLevel:{value:2,setter:function(T){if(T===null||T===undefined){return"med";}if(K.isNumber(T)){return T;}else{if(K.isString(T)){if(T!="min"&&T!="med"&&T!="max"){throw"Invalid level requirement, please use min, med or max";}if(T=="min"){return 1;}else{if(T=="med"){return 2;}else{if(T=="max"){return 3;}else{return 2;}}}}}throw"Invalid level requirement, please use min, med or max";}},minIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},medIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},maxIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},min:{value:S.staticVariables.MinimumPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter},med:{value:S.staticVariables.MediumPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter},max:{value:S.staticVariables.StrongPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter}};S.NAME="PasswordField";A.extend(S,A.TextBaseField,{isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var U=this.get("requiredLevel"),T=this.getMatchedLevel();return U<=T;},getMatchedLevel:function(){var T=this.get("inputDOM").value;if(this.get("max").test(T)){return 3;}else{if(this.get("med").test(T)){return 2;}else{if(this.get("min").test(T)){return 1;}else{return 0;}}}},showPasswordIndicator:function(){var T=this.get("maxIndicator"),W=this.get("medIndicator"),V=this.get("minIndicator"),U=this.getMatchedLevel();if(T!==null&&T!==undefined){T.style.display="none";}if(W!==null&&W!==undefined){W.style.display="none";}if(V!==null&&V!==undefined){V.style.display="none";}if(!this.get("isOn")){return;}else{if(this.get("optional")&&this.isEmpty()){return;}}if((U==3)&&(T!==null&&T!==undefined)){T.style.display="";}else{if((U==2)&&(W!==null&&W!==undefined)){W.style.display="";}else{if((U==1)&&(V!==null&&V!==undefined)){V.style.display="";}}}},checkIndicators:function(){var T=S.superclass.checkIndicators.call(this);this.showPasswordIndicator();return T;},showCorrectIndicator:function(){S.superclass.showCorrectIndicator.call(this);this.showPasswordIndicator();},showIncorrectIndicator:function(){S.superclass.showIncorrectIndicator.call(this);this.showPasswordIndicator();},showNoIndicators:function(){S.superclass.showNoIndicators.call(this);this.showPasswordIndicator();}});A.PasswordField=S;function I(T){I.superclass.constructor.apply(this,arguments);}I.ATTRS={matchDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},caseSensitive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER}};I.NAME="MatchField";A.extend(I,A.TextBaseField,{isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var T=this.get("matchDOM"),U=this.get("inputDOM");if(this.isEmpty()){return false;}if(this.get("caseSensitive")){return T.value==U.value;}else{return T.value.toLowerCase()==U.value.toLowerCase();}}});A.MatchField=I;function H(T){H.superclass.constructor.apply(this,arguments);}H.ATTRS={emptyValue:{value:"",setter:function(T){if(T===null||T===undefined){return"";}else{return T;}}}};H.NAME="SelectField";A.extend(H,A.TextBaseField,{isEmpty:function(){var T=this.get("inputDOM").value;return T==this.get("emptyValue");},clear:function(T){this.get("inputDOM").value=this.get("emptyValue");if(T!==true){this._evtOnChange();}},isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var T=this.get("inputDOM").value;return T!=this.get("emptyValue");},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("change",T._evtOnChange,this.get("inputDOM"),T,true);}});A.SelectField=H;},"gallery-2009.11.19-20",{requires:["node","event","dom","base"]});
+for(T=0;T<V.length;++T){U=U&&V[T].isValid();}if(U){this.enableButtons();}else{this.disableButtons();}return U;},checkFormValues:function(){var V=this.get("inputFields"),U=true,T;for(T=0;T<V.length;++T){U=V[T].checkIndicators()&&U;}if(U){this.enableButtons();}else{this.disableButtons();}return U;},disableButtons:function(){if(this.get("checkOnSubmit")){return;}var U=this.get("buttons"),T;for(T=0;T<U.length;++T){U[T].disable();}},enableButtons:function(){var U=this.get("buttons"),T;for(T=0;T<U.length;++T){U[T].enable();}}});A.Validator=O;function F(T){F.superclass.constructor.apply(this,arguments);}F.ATTRS={buttonEl:{value:null,setter:function(U){var T=U;if(K.isString(U)){T=A.DOM.byId(U);}if(T===null||T===undefined){throw"Invalid button: Button with id "+U+" does not exist";}return T;}}};F.NAME="Button";A.extend(F,A.Base,{enable:function(){this.get("buttonEl").disabled=false;},disable:function(){this.get("buttonEl").disabled=true;}});A.Button=F;function E(){E.superclass.constructor.apply(this,arguments);this.publish(E.CE_ONCHANGE);this.checkPrompt();}A.augment(E,A.EventTarget);E.staticVariables={MAX_INTEGER:2147483647,INTEGERREGEX:/(^-?\d\d*\.\d*$)|(^-?\d\d*$)|(^-?\.\d\d*$)/,DOUBLEREGEX:/(^-?\d\d*\.\d+$)|(^-?\d\d*$)|(^-?\.\d\d*$)/,EMAILREGEX:/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/};E.staticFunctions={standardRegexSetter:function(U){if(K.isString(U)){var T=U;if(T.indexOf("/")===0){T=T.substring(1);}if(T.charAt(T.length-1)=="/"){T=T.substring(0,T.length-1);}return new RegExp(T);}else{return U;}},standardElSetter:function(U){if(U===null||U===undefined){return null;}var T=U;if(K.isString(U)){T=A.DOM.byId(U);}if(T===null||T===undefined){return U;}else{return T;}},BOOLEANSETTER:function(T){if(K.isBoolean(T)){return T;}else{if(K.isString(T)){return T.toLowerCase()=="true";}else{return T!==null&&T!==undefined;}}}};E.ATTRS={createIncorrectIndicator:{value:false},createCorrectIndicator:{value:false},indicatorType:{value:null},correctIndicatorCss:{value:null},incorrectIndicatorCss:{value:null},correctIndicator:{value:null,setter:E.staticFunctions.standardElSetter},incorrectIndicatorText:{value:null},correctIndicatorText:{value:null},incorrectIndicator:{value:null,setter:E.staticFunctions.standardElSetter},correctCss:{value:null},incorrectCss:{value:null},disabled:{value:false},isOn:{value:true},optional:{value:false},validationPrompt:{value:null,setter:function(T){if(!K.isObject(T)){return null;}else{if(!T.el){return null;}else{if(!T.fn){T.fn=function(U,V){if(!V.isValid()&&!V.isEmpty()){U.style.display="";}else{U.style.display="none";}};}}}T.el=E.staticFunctions.standardElSetter(T.el);T.el.style.display="none";return T;}}};E.NAME="BaseInputField";E.CE_ONCHANGE="inputfield:onchanged";A.extend(E,A.Base,{initializeInput:function(T){},getInputDOM:function(){return null;},inputIsOn:function(){return this.get("isOn");},clear:function(T){},isGroup:function(){return false;},enable:function(){this.set("disabled",false);},disable:function(){this.set("disabled",true);},synchronize:function(V){var T=this.getAttrs(false),W,U;for(U in T){if(true){W=V.getAttribute("formvalidator:"+U);if(W!==null&&W!==undefined){this.set(U,W);}}}},isValid:function(){throw"Plesae override the isValid function";},turnOff:function(){this.set("isOn",false);this._evtOnChange();},turnOn:function(){this.set("isOn",true);this._evtOnChange();},checkIndicators:function(){},checkPrompt:function(){var T=this.get("validationPrompt"),V,U;if(!T){return;}if(!this.inputIsOn()){T.el.style.display="none";return;}V=T.scope||{};U=T.fn||function(){};U.call(V,T.el,this);},showCorrectIndicator:function(){},showIncorrectIndicator:function(){},showNoIndicators:function(){},setupIndicators:function(){var U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(this.get("createCorrectIndicator")){this.set("correctIndicator",this.setupDomItem(U,this.get("correctIndicatorText"),this.get("correctIndicatorCss")));}if(this.get("createIncorrectIndicator")){this.set("incorrectIndicator",this.setupDomItem(T,this.get("incorrectIndicatorText"),this.get("incorrectIndicatorCss")));}},setupDomItem:function(W,U,V){var T=W;if((T===null||T===undefined)||K.isString(T)){T=document.createElement(this.get("indicatorType"));if(W!==null&&W!==undefined){T.id=W;}this.insertBeside(T);T.innerHTML=U;}if((T.className===""||T.className===null||T.className===undefined)&&(V!==null&&V!==undefined)){T.className=V;}return T;},getId:function(){return null;},isEmpty:function(){throw"Plesae override the isEmpty function";},initializeEvents:function(T){},_evtOnChange:function(T){this.checkPrompt();this.checkIndicators();this.fire(E.CE_ONCHANGE);},insertBeside:function(T){},initializer:function(){},destructor:function(){}});A.BaseInputField=E;function Q(U,T){Q.superclass.constructor.apply(this,arguments);if(T){this.initializeInput();}this.get("textType");}Q.ATTRS={maxLength:{value:255,setter:function(T){if(T<0){return 255;}else{return T;}}},formatter:{value:null,setter:function(T){if(T===null||T===undefined){return null;}if(K.isFunction(T)){return T;}else{if(K.isObject(T)){if(T.format===null||T===undefined){throw"Formatter object must have a formatter function";}return T;}else{throw"Formatter must be an object or a function";}}}},regex:{value:null,setter:A.BaseInputField.staticFunctions.standardRegexSetter},textType:{lazy:false,value:null,setter:function(T){if(T===null||T===undefined){return null;}else{if(T.toLowerCase()=="email"){this.set("regex",A.BaseInputField.staticVariables.EMAILREGEX);}else{if(T.toLowerCase()=="phone"){this.set("regex",/^([(]?[2-9]\d{2}[)]?)[ ]*-?[ ]*(\d{3})[ ]*-?[ ]*(\d{4})$/);}else{if(T.toLowerCase()=="creditcard"){this.set("regex",/[0-9]{4} {0,1}[0-9]{4} {0,1}[0-9]{4} {0,1}[0-9]{4}/);}else{if(T.toLowerCase()=="zipcode"){this.set("regex",/^(\d{5})([\s]*-[\s]*\d{4})?$/);}else{if(T.toLowerCase()=="postalcode"){this.set("regex",/^[a-zA-Z]{1}[0-9]{1}[a-zA-Z]{1}[\s]*[0-9]{1}[a-zA-Z]{1}[0-9]{1}$/);}}}}}}return T;}},inputDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter}};
+Q.NAME="TextBaseField";A.extend(Q,A.BaseInputField,{initializeInput:function(){this.setupIndicators();},clear:function(T){this.get("inputDOM").value="";if(T!==true){this._evtOnChange();}},getInputDOM:function(){return this.get("inputDOM");},disable:function(){Q.superclass.disable.call(this);this.get("inputDOM").disabled=true;},enable:function(){Q.superclass.enable.call(this);this.get("inputDOM").disabled=false;},isValid:function(){if(!this.get("isOn")){return true;}if(this.get("optional")&&this.isEmpty()){return true;}var T=this.get("regex"),U=this.get("inputDOM").value;if((T!==null&&T!==undefined)&&(!T.test(U))){return false;}return !this.isEmpty()&&U.length<=this.get("maxLength");},getId:function(){return this.get("inputDOM").id;},isEmpty:function(){return(this.get("inputDOM").value==="");},checkFormat:function(){if(!this.isValid()){return;}if(!this.inputIsOn()){return;}var T=this.get("formatter"),U;if(T===null||T===undefined){return;}U=this.get("inputDOM");if(K.isFunction(T)){U.value=T(U.value);}else{U.value=T.format(U.value);}},checkIndicators:function(){if(!this.inputIsOn()){this.showNoIndicators();return true;}else{if(this.get("optional")&&this.isEmpty()){this.showNoIndicators();return true;}else{if(this.isValid()){this.showCorrectIndicator();this.checkFormat();return true;}else{this.showIncorrectIndicator();return false;}}}},showCorrectIndicator:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");this.checkFormat();A.DOM.removeClass(T,this.get("incorrectCss"));A.DOM.addClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="";}if(U!==null&&U!==undefined){U.style.display="none";}},showIncorrectIndicator:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");A.DOM.addClass(T,this.get("incorrectCss"));A.DOM.removeClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="none";}if(U!==null&&U!==undefined){U.style.display="";}},showNoIndicators:function(){var T=this.get("inputDOM"),V=this.get("correctIndicator"),U=this.get("incorrectIndicator");A.DOM.removeClass(T,this.get("incorrectCss"));A.DOM.removeClass(T,this.get("correctCss"));if(V!==null&&V!==undefined){V.style.display="none";}if(U!==null&&U!==undefined){U.style.display="none";}},insertBeside:function(T){A.DOM.insertAfter(T,this.get("inputDOM"));},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("keyup",T._evtOnChange,this.get("inputDOM"),T,true);A.Event.attach("blur",T._evtOnChange,this.get("inputDOM"),T,true);}});A.TextBaseField=Q;function N(T){N.superclass.constructor.apply(this,arguments);}N.ATTRS={inputDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},validWhenChecked:{value:true}};N.NAME="CheckboxField";A.extend(N,A.BaseInputField,{initializeInput:function(){this.setupIndicators();},getInputDOM:function(){return this.get("inputDOM");},clear:function(T){this.get("inputDOM").checked=!this.get("validWhenChecked");if(T!==true){this._evtOnChange();}},disable:function(){N.superclass.disable.call(this);this.get("inputDOM").disabled=true;},enable:function(){N.superclass.enable.call(this);this.get("inputDOM").disabled=false;},isValid:function(){if(!this.get("isOn")){return true;}var U=this.get("validWhenChecked"),T=this.get("inputDOM").checked;return(U&&T)||(!U&&!T);},getId:function(){return this.get("inputDOM").id;},isEmpty:function(){return !this.isValid();},showNoIndicators:function(){var V=this.get("inputDOM"),U=this.get("correctIndicator"),T=this.get("incorrectIndicator");A.DOM.removeClass(V,this.get("incorrectCss"));A.DOM.removeClass(V,this.get("correctCss"));if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="none";}},checkIndicators:function(){var V=this.get("inputDOM"),U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(!this.get("isOn")){this.showNoIndicators();return this.isValid();}else{if(this.isValid()){if(V!==null&&V!==undefined){A.DOM.removeClass(V,this.get("incorrectCss"));A.DOM.addClass(V,this.get("correctCss"));}if(U!==null&&U!==undefined){U.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}return true;}else{if(V!==null&&V!==undefined){A.DOM.addClass(V,this.get("incorrectCss"));A.DOM.removeClass(V,this.get("correctCss"));}if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}return false;}}},insertBeside:function(T){},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("click",T._evtOnChange,this.get("inputDOM"),T,true);}});A.CheckboxField=N;function P(T){P.superclass.constructor.apply(this,arguments);}P.ATTRS={validatorObject:{setter:function(U){if(U===null||U===undefined){throw"You must provide a validator object to the custom input";}var T=null;if(K.isString(U)){T=validatorGlobal[U];}else{if(K.isFunction(U)){T=U();}else{if(K.isObject(U)){T=U;}}}if(T===null||T===undefined){throw"Your validator object must be a object";}else{return T;}}},id:{value:null}};P.NAME="CustomField";A.extend(P,A.BaseInputField,{checkIndicators:function(){var U=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(this.isValid()){if(U!==null&&U!==undefined){U.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}return true;}else{if(U!==null&&U!==undefined){U.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}return false;}},getId:function(){var T=this.get("id");if(T===null||T===undefined){T=this.executeFunction("getId",null);}return T;},executeFunction:function(U,T){var V=this.get("validatorObject");if(K.isFunction(V[U])){return V[U]();}return T;},executeVoidFunction:function(T){var U=this.get("validatorObject");if(K.isFunction(U[T])){U[T]();}},disable:function(){P.superclass.disable.call(this);this.executeVoidFunction("disable");},enable:function(){P.superclass.enable.call(this);this.executeVoidFunction("enable");},turnOff:function(){P.superclass.turnOff.call(this);
+this.executeVoidFunction("turnOff");},turnOn:function(){P.superclass.turnOn.call(this);this.executeVoidFunction("turnOn");},clear:function(T){var U=this.get("validatorObject");if(K.isFunction(U.clear)){U.clear(T);}if(T!==true){this._evtOnChange();}},isEmpty:function(){return this.executeFunction("isEmpty",false);},isValid:function(){return this.executeFunction("isValid",false);},insertBeside:function(T){var U=this.get("validatorObject");if(K.isFunction(U.insertBeside)){U.insertBeside(T);}}});A.CustomField=P;function B(T){B.superclass.constructor.apply(this,arguments);this.set("regex",A.BaseInputField.staticVariables.DOUBLEREGEX);}B.ATTRS={minInclusive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER},maxInclusive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER},min:{value:0,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseFloat(T);}if(!K.isNumber(T)){throw"Invalid value given for min: "+U;}if(T<(-1)*A.BaseInputField.staticVariables.MAX_INTEGER){return(-1)*A.BaseInputField.staticVariables.MAX_INTEGER;}return T;}},max:{value:A.BaseInputField.staticVariables.MAX_INTEGER,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseFloat(T);}if(!K.isNumber(T)){throw"Invalid value given for max: "+U;}if(T>A.BaseInputField.staticVariables.MAX_INTEGER){return A.BaseInputField.staticVariables.MAX_INTEGER;}return T;}},maxDecimalPlaces:{value:-1,setter:function(U){var T=U;if(!K.isNumber(T)){T=parseInt(T,10);}if(!K.isNumber(T)){throw"Invalid value given for decimal places: "+U;}else{return U;}}}};B.NAME="DoubleField";A.extend(B,A.TextBaseField,{isValid:function(){if(!B.superclass.isValid.call(this)){return false;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var a=this.get("inputDOM").value,W=0,b,V,X,Z,U,T=this.get("maxDecimalPlaces");if((T!=-1)&&(a.indexOf(".")!=-1)){U=a.split(".")[1];if(U.length>T){return false;}}try{W=parseFloat(a,10);}catch(Y){return false;}if(W.toString()===null||W.toString()===undefined){return false;}if(W.toString().toLowerCase()=="nan"){return false;}b=this.get("minInclusive");V=this.get("maxInclusive");X=this.get("min");Z=this.get("max");if(b&&(X>W)){return false;}else{if(!b&&(X>=W)){return false;}else{if(V&&(Z<W)){return false;}else{if(!V&&(Z<=W)){return false;}else{return true;}}}}}});A.DoubleField=B;function R(T){R.superclass.constructor.apply(this,arguments);this.set("regex",A.BaseInputField.staticVariables.INTEGERREGEX);}R.ATTRS={};R.NAME="IntegerField";A.extend(R,A.DoubleField,{isValid:function(){if(!R.superclass.isValid.call(this)){return false;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var U=this.get("inputDOM").value,T=0;if(U.indexOf(".")!=-1){return false;}try{T=parseInt(U,10);}catch(V){return false;}if(T.toString().toLowerCase()=="nan"){return false;}else{return true;}}});A.IntegerField=R;function J(T){J.superclass.constructor.apply(this,arguments);}J.ATTRS={groupDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},membersJSON:{value:[]},members:{value:[],setter:function(T){if(K.isArray(T)){return T;}else{throw"The members property of a group must be an array";}}},minValid:{value:null,setter:function(V){if(V===null||V===undefined){return null;}var U=V,T;if(!K.isNumber(U)){U=parseInt(U,10);}if(U<1){throw"The minimum must be greater than 1";}T=this.get("maxValid");if((T!==null&&T!==undefined)&&(U>T)){throw"Minimum must be less than or equal to maximum";}else{return U;}}},maxValid:{value:null,setter:function(U){if(U===null||U===undefined){return null;}if(U<1){throw"The maximum must be greater than 1";}var T=this.get("minValid");if((T!==null&&T!==undefined)&&(U<T)){throw"Maximum must be greater than or equal to minimum";}else{return U;}}},id:{value:null}};J.NAME="GroupBaseField";A.extend(J,A.BaseInputField,{isGroup:function(){return true;},getInputDOM:function(){return this.get("groupDOM");},getInput:function(W){var T=this.get("members"),V,U;for(U=0;U<T.length;++U){if(T[U].getId()==W){return T[U];}if(T[U].isGroup()){V=T[U].getInput(W);if(V!==null&&V!==undefined){return V;}}}return null;},clear:function(U){var T=this.get("members"),V;for(V=0;V<T.length;++V){T[V].clear(true);}if(U!==true){this._evtOnChange();}},disable:function(){J.superclass.disable.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].disable();}},enable:function(){J.superclass.enable.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].enable();}},turnOn:function(){J.superclass.turnOn.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].turnOn();}this.checkIndicators();},turnOff:function(){J.superclass.turnOff.call(this);var T=this.get("members"),U;for(U=0;U<T.length;++U){T[U].turnOff();}},initializeInput:function(V){var W=this.get("membersJSON"),T=this.get("members"),X,U;for(U=0;U<W.length;++U){X=new W[U].type(W[U].atts,false);V.setupInput(X);T[T.length]=X;}this.setupIndicators();this.checkIndicators();},addInput:function(U){var T=this.get("members");T[T.length]=U;},isValid:function(){if(this.get("optional")&&this.isEmpty()){return true;}var V=this.get("members"),U=0,Z=this.get("isOn"),a=true,X,T,b,Y,W;for(W=0;W<V.length;++W){X=V[W].isEmpty();T=V[W].isValid();if(!X&&T){U++;}else{if(!X){return !Z;}}}if(Z){b=this.get("minValid");Y=this.get("maxValid");if(b!==null&&b!==undefined){a=b<=U;}if(Y!==null&&Y!==undefined){a=(Y>=U)&&a;}}return a;},getId:function(){var U=this.get("id"),T;if(U!==null&&U!==undefined){return U;}T=this.get("groupDOM");if(T!==null&&T!==undefined){return T.id;}else{return null;}},isEmpty:function(){var T=this.get("members"),U;for(U=0;U<T.length;++U){if(!T[U].isEmpty()){return false;}}return true;},showCorrectIndicator:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(U!==null&&U!==undefined){A.DOM.removeClass(U,this.get("incorrectCss"));A.DOM.addClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="";}if(T!==null&&T!==undefined){T.style.display="none";}},showIncorrectIndicator:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");
+if(U!==null&&U!==undefined){A.DOM.addClass(U,this.get("incorrectCss"));A.DOM.removeClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="none";}if(T!==null&&T!==undefined){T.style.display="";}},showNoIndicators:function(){var U=this.get("groupDOM"),V=this.get("correctIndicator"),T=this.get("incorrectIndicator");if(U!==null&&U!==undefined){A.DOM.removeClass(U,this.get("incorrectCss"));A.DOM.removeClass(U,this.get("correctCss"));}if(V!==null&&V!==undefined){V.style.display="none";}if(T!==null&&T!==undefined){T.style.display="none";}},checkIndicators:function(){var W=this.get("members"),U=0,V=false,a=this.get("isOn"),Y,X,T,b=true,c,Z;for(X=0;X<W.length;++X){Y=W[X].isEmpty();T=W[X].isValid();if(!a){W[X].showNoIndicators();}else{if(this.get("optional")&&this.isEmpty()){W[X].showNoIndicators();}else{if(!Y&&T){U++;W[X].showCorrectIndicator();}else{if(!Y){W[X].showIncorrectIndicator();V=true;}else{W[X].showNoIndicators();}}}}}if(!V){c=this.get("minValid");Z=this.get("maxValid");if(c!==null&&c!==undefined){b=c<=U;}if(Z!==null&&Z!==undefined){b=(Z>=U)&&b;}}else{b=false;}if(!a){this.showNoIndicators();return true;}else{if(this.get("optional")&&this.isEmpty()){this.showNoIndicators();return true;}else{if(b){this.showCorrectIndicator();return true;}else{this.showIncorrectIndicator();return false;}}}},insertBeside:function(T){},initializeEvents:function(W){var V=W,T=this.get("members"),U;if(V===null||V===undefined){V=this;}for(U=0;U<T.length;++U){T[U].initializeEvents(V);}}});A.GroupBaseField=J;function S(T){S.superclass.constructor.apply(this,arguments);}S.staticVariables={StrongPassword:/^(?=.{8,})(?=.*[A-Z])(?=.*[a-z])(?=.*[0-9])(?=.*\W).*$/,MediumPassword:/^(?=.{7,})(((?=.*[A-Z])(?=.*[a-z]))|((?=.*[A-Z])(?=.*[0-9]))|((?=.*[a-z])(?=.*[0-9]))).*$/,MinimumPassword:/(?=.{6,}).*/};S.ATTRS={requiredLevel:{value:2,setter:function(T){if(T===null||T===undefined){return"med";}if(K.isNumber(T)){return T;}else{if(K.isString(T)){if(T!="min"&&T!="med"&&T!="max"){throw"Invalid level requirement, please use min, med or max";}if(T=="min"){return 1;}else{if(T=="med"){return 2;}else{if(T=="max"){return 3;}else{return 2;}}}}}throw"Invalid level requirement, please use min, med or max";}},minIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},medIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},maxIndicator:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},min:{value:S.staticVariables.MinimumPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter},med:{value:S.staticVariables.MediumPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter},max:{value:S.staticVariables.StrongPassword,setter:A.BaseInputField.staticFunctions.standardRegexSetter}};S.NAME="PasswordField";A.extend(S,A.TextBaseField,{isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var U=this.get("requiredLevel"),T=this.getMatchedLevel();return U<=T;},getMatchedLevel:function(){var T=this.get("inputDOM").value;if(this.get("max").test(T)){return 3;}else{if(this.get("med").test(T)){return 2;}else{if(this.get("min").test(T)){return 1;}else{return 0;}}}},showPasswordIndicator:function(){var T=this.get("maxIndicator"),W=this.get("medIndicator"),V=this.get("minIndicator"),U=this.getMatchedLevel();if(T!==null&&T!==undefined){T.style.display="none";}if(W!==null&&W!==undefined){W.style.display="none";}if(V!==null&&V!==undefined){V.style.display="none";}if(!this.get("isOn")){return;}else{if(this.get("optional")&&this.isEmpty()){return;}}if((U==3)&&(T!==null&&T!==undefined)){T.style.display="";}else{if((U==2)&&(W!==null&&W!==undefined)){W.style.display="";}else{if((U==1)&&(V!==null&&V!==undefined)){V.style.display="";}}}},checkIndicators:function(){var T=S.superclass.checkIndicators.call(this);this.showPasswordIndicator();return T;},showCorrectIndicator:function(){S.superclass.showCorrectIndicator.call(this);this.showPasswordIndicator();},showIncorrectIndicator:function(){S.superclass.showIncorrectIndicator.call(this);this.showPasswordIndicator();},showNoIndicators:function(){S.superclass.showNoIndicators.call(this);this.showPasswordIndicator();}});A.PasswordField=S;function I(T){I.superclass.constructor.apply(this,arguments);}I.ATTRS={matchDOM:{value:null,setter:A.BaseInputField.staticFunctions.standardElSetter},caseSensitive:{value:true,setter:A.BaseInputField.staticFunctions.BOOLEANSETTER}};I.NAME="MatchField";A.extend(I,A.TextBaseField,{isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var T=this.get("matchDOM"),U=this.get("inputDOM");if(this.isEmpty()){return false;}if(this.get("caseSensitive")){return T.value==U.value;}else{return T.value.toLowerCase()==U.value.toLowerCase();}}});A.MatchField=I;function H(T){H.superclass.constructor.apply(this,arguments);}H.ATTRS={emptyValue:{value:"",setter:function(T){if(T===null||T===undefined){return"";}else{return T;}}}};H.NAME="SelectField";A.extend(H,A.TextBaseField,{isEmpty:function(){var T=this.get("inputDOM").value;return T==this.get("emptyValue");},clear:function(T){this.get("inputDOM").value=this.get("emptyValue");if(T!==true){this._evtOnChange();}},isValid:function(){if(!this.get("isOn")){return true;}else{if(this.get("optional")&&this.isEmpty()){return true;}}var T=this.get("inputDOM").value;return T!=this.get("emptyValue");},initializeEvents:function(U){var T=U;if(T===null||T===undefined){T=this;}A.Event.attach("change",T._evtOnChange,this.get("inputDOM"),T,true);}});A.SelectField=H;},"gallery-2010.05.26-19-47",{requires:["node","event","dom","base"]});
View
55 build/gallery-formvalidator/gallery-formvalidator.js
@@ -731,6 +731,7 @@ YUI.add('gallery-formvalidator', function(Y) {
function _BaseInputField(){
_BaseInputField.superclass.constructor.apply(this,arguments);
this.publish(_BaseInputField.CE_ONCHANGE);
+ this.checkPrompt();
}
Y.augment(_BaseInputField, Y.EventTarget);
_BaseInputField.staticVariables = {
@@ -927,6 +928,36 @@ YUI.add('gallery-formvalidator', function(Y) {
*/
optional:{
value:false
+ },
+ /**
+ * This must provide a function and an html element. A scope may be optionally provided. <br />
+ * &#123;fn: function(el, field) {}, scope: this, el: 'validation-prompt'&#124;
+ * @property validationPrompt
+ * @type HTMLElement
+ */
+ validationPrompt: {
+ value: null,
+ setter: function(val) {
+ if (!YL.isObject(val)) {
+ return null;
+ }
+ else if (!val.el) {
+ return null;
+ }
+ else if (!val.fn) {
+ val.fn = function(el, field) {
+ if (!field.isValid() && !field.isEmpty()) {
+ el.style.display = '';
+ }
+ else {
+ el.style.display = 'none';
+ }
+ }
+ }
+ val.el = _BaseInputField.staticFunctions.standardElSetter(val.el);
+ val.el.style.display = 'none'; // start off as hidden.
+ return val;
+ }
}
};
_BaseInputField.NAME = 'BaseInputField';
@@ -1029,7 +1060,26 @@ YUI.add('gallery-formvalidator', function(Y) {
* that the input is valid or invalid.
* @method checkIndicators
*/
- checkIndicators:function(){},
+ checkIndicators: function () {},
+ /**
+ * This will ensure the validation prompt function gets called and the
+ * proper validation tip gets displayed.
+ * @method checkPrompt
+ */
+ checkPrompt: function () {
+ var prompt = this.get('validationPrompt'), scope, fn;
+ if (!prompt) {
+ return;
+ }
+ // if the input is not on, then hide the validation prompt
+ if (!this.inputIsOn()) {
+ prompt.el.style.display = 'none';
+ return;
+ }
+ scope = prompt.scope || {};
+ fn = prompt.fn || function() {};
+ fn.call(scope, prompt.el, this);
+ },
/**
* This will be overriden by subclasses, but this will hide the incorrect
* indicator and show the correct indicator if there is one. It will also
@@ -1117,6 +1167,7 @@ YUI.add('gallery-formvalidator', function(Y) {
* @method _evtOnChange
*/
_evtOnChange:function(e){
+ this.checkPrompt();
this.checkIndicators();
this.fire(_BaseInputField.CE_ONCHANGE);
},
@@ -2922,4 +2973,4 @@ YUI.add('gallery-formvalidator', function(Y) {
Y.SelectField = _SelectField;
-}, 'gallery-2009.11.19-20' ,{requires:['node', 'event', 'dom', 'base']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['node', 'event', 'dom', 'base']});
View
84 build/gallery-overlay-extras/gallery-overlay-extras-debug.js
@@ -20,6 +20,7 @@ YUI.add('gallery-overlay-extras', function(Y) {
CHANGE = 'Change',
+ isBoolean = Y.Lang.isBoolean,
getCN = Y.ClassNameManager.getClassName,
supportsPosFixed = (function(){
@@ -61,16 +62,14 @@ YUI.add('gallery-overlay-extras', function(Y) {
OverlayAutohide,
OVERLAY_AUTOHIDE = 'overlayAutohide',
- AUTOHIDE = 'autohide';
+ AUTOHIDE = 'autohide',
+ CLICKED_OUTSIDE = 'clickedOutside',
+ FOCUSED_OUTSIDE = 'focusedOutside',
+ PRESSED_ESCAPE = 'pressedEscape';
// *** OverlayModal *** //
- OverlayModal = function (config) {
-
- OverlayModal.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayModal, Y.Plugin.Base, {
+ OverlayModal = Y.Base.create(OVERLAY_MODAL, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -219,8 +218,8 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_MODAL,
NS : MODAL,
+
ATTRS : {
maskNode : {
@@ -229,18 +228,14 @@ YUI.add('gallery-overlay-extras', function(Y) {
}
},
+
CLASSES : MODAL_CLASSES
});
// *** OverlayKeepaligned *** //
- OverlayKeepaligned = function (config) {
-
- OverlayKeepaligned.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayKeepaligned, Y.Plugin.Base, {
+ OverlayKeepaligned = Y.Base.create(OVERLAY_KEEPALIGNED, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -294,7 +289,7 @@ YUI.add('gallery-overlay-extras', function(Y) {
this._uiHandles = [
Y.on('windowresize', syncAlign),
- Y.one('win').on('scroll', syncAlign)
+ Y.on('scroll', syncAlign)
];
},
@@ -315,19 +310,13 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_KEEPALIGNED,
- NS : KEEPALIGNED
+ NS : KEEPALIGNED
});
// *** OverlayAutohide *** //
- OverlayAutohide = function (config) {
-
- OverlayAutohide.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayAutohide, Y.Plugin.Base, {
+ OverlayAutohide = Y.Base.create(OVERLAY_AUTOHIDE, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -378,12 +367,27 @@ YUI.add('gallery-overlay-extras', function(Y) {
var host = this.get(HOST),
bb = host.get(BOUNDING_BOX),
- hide = Y.bind(host.hide, host);
+ hide = Y.bind(host.hide, host),
+ uiHandles = [];
- this._uiHandles = [
- bb.on('clickoutside', hide),
- bb.on('focusoutside', hide)
- ];
+ if (this.get(CLICKED_OUTSIDE)) {
+ uiHandles.push(bb.on('clickoutside', hide));
+ }
+
+ if (this.get(FOCUSED_OUTSIDE)) {
+ uiHandles.push(bb.on('focusoutside', hide));
+ }
+
+ if (this.get(PRESSED_ESCAPE)) {
+// uiHandles.push(bb.on('key', hide, 'down:27')); // doesn't work because of event-key metadata issue
+ uiHandles.push(bb.on('keydown', function(e){
+ if (e.keyCode === 27) {
+ hide();
+ }
+ }));
+ }
+
+ this._uiHandles = uiHandles;
},
_detachUIHandles : function () {
@@ -403,8 +407,26 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_AUTOHIDE,
- NS : AUTOHIDE
+ NS : AUTOHIDE,
+
+ ATTRS : {
+
+ clickedOutside : {
+ value : true,
+ validator : isBoolean
+ },
+
+ focusedOutside : {
+ value : true,
+ validator : isBoolean
+ },
+
+ pressedEscape : {
+ value : true,
+ validator : isBoolean
+ }
+
+ }
});
@@ -415,4 +437,4 @@ YUI.add('gallery-overlay-extras', function(Y) {
Y.Plugin.OverlayAutohide = OverlayAutohide;
-}, 'gallery-2010.05.12-19-08' ,{supersedes:['gallery-overlay-modal'], requires:['overlay','plugin','event-resize','gallery-outside-events']});
+}, 'gallery-2010.05.26-19-47' ,{supersedes:['gallery-overlay-modal'], requires:['overlay','plugin','event-resize','gallery-outside-events']});
View
6 build/gallery-overlay-extras/gallery-overlay-extras-min.js
@@ -6,7 +6,7 @@ YUI.add("gallery-overlay-extras",function(Y){
* Copyright (c) 2009-2010 Eric Ferraiuolo - http://eric.ferraiuolo.name
* YUI BSD License - http://developer.yahoo.com/yui/license.html
*/
-var OVERLAY="overlay",HOST="host",RENDER_UI="renderUI",BIND_UI="bindUI",SYNC_UI="syncUI",RENDERED="rendered",BOUNDING_BOX="boundingBox",VISIBLE="visible",Z_INDEX="zIndex",CHANGE="Change",getCN=Y.ClassNameManager.getClassName,supportsPosFixed=(function(){
+var OVERLAY="overlay",HOST="host",RENDER_UI="renderUI",BIND_UI="bindUI",SYNC_UI="syncUI",RENDERED="rendered",BOUNDING_BOX="boundingBox",VISIBLE="visible",Z_INDEX="zIndex",CHANGE="Change",isBoolean=Y.Lang.isBoolean,getCN=Y.ClassNameManager.getClassName,supportsPosFixed=(function(){
/* IS_POSITION_FIXED_SUPPORTED - Juriy Zaytsev (kangax) - http://yura.thinkweb2.com/cft/ */
-var isSupported=null,el,root;if(document.createElement){el=document.createElement("div");if(el&&el.style){el.style.position="fixed";el.style.top="10px";root=document.body;if(root&&root.appendChild&&root.removeChild){root.appendChild(el);isSupported=(el.offsetTop===10);root.removeChild(el);}}}return isSupported;}()),OverlayModal,OVERLAY_MODAL="overlayModal",MODAL="modal",MASK="mask",MODAL_CLASSES={modal:getCN(OVERLAY,MODAL),mask:getCN(OVERLAY,MASK)},OverlayKeepaligned,OVERLAY_KEEPALIGNED="overlayKeepaligned",KEEPALIGNED="keepalgined",OverlayAutohide,OVERLAY_AUTOHIDE="overlayAutohide",AUTOHIDE="autohide";OverlayModal=function(config){OverlayModal.superclass.constructor.apply(this,arguments);};Y.extend(OverlayModal,Y.Plugin.Base,{_maskNode:null,_uiHandles:null,initializer:function(config){this.afterHostMethod(RENDER_UI,this.renderUI);this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.renderUI();this.bindUI();this.syncUI();}},destructor:function(){if(this._maskNode){this._maskNode.remove(true);}this._detachUIHandles();this.get(HOST).get(BOUNDING_BOX).removeClass(MODAL_CLASSES.modal);},renderUI:function(){var bb=this.get(HOST).get(BOUNDING_BOX),bbParent=bb.get("parentNode")||Y.one("body");this._maskNode=Y.Node.create("<div></div>");this._maskNode.addClass(MODAL_CLASSES.mask);this._maskNode.setStyles({position:supportsPosFixed?"fixed":"absolute",width:"100%",height:"100%",top:"0",left:"0",display:"none"});bbParent.insert(this._maskNode,bbParent.get("firstChild"));bb.addClass(MODAL_CLASSES.modal);},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);this.afterHostEvent(Z_INDEX+CHANGE,this._afterHostZIndexChange);},syncUI:function(){var host=this.get(HOST);this._uiSetHostVisible(host.get(VISIBLE));this._uiSetHostZIndex(host.get(Z_INDEX));},_focus:function(){var host=this.get(HOST),bb=host.get(BOUNDING_BOX),oldTI=bb.get("tabIndex");bb.set("tabIndex",oldTI>=0?oldTI:0);host.focus();bb.set("tabIndex",oldTI);},_blur:function(){this.get(HOST).blur();},_getMaskNode:function(){return this._maskNode;},_uiSetHostVisible:function(visible){if(visible){Y.later(1,this,"_attachUIHandles");this._maskNode.setStyle("display","block");this._focus();}else{this._detachUIHandles();this._maskNode.setStyle("display","none");this._blur();}},_uiSetHostZIndex:function(zIndex){this._maskNode.setStyle(Z_INDEX,zIndex||0);},_attachUIHandles:function(modal){if(this._uiHandles){return;}var host=this.get(HOST),bb=host.get(BOUNDING_BOX);this._uiHandles=[bb.on("clickoutside",Y.bind(this._focus,this)),bb.on("focusoutside",Y.bind(this._focus,this))];if(!supportsPosFixed){this._uiHandles.push(Y.one("win").on("scroll",Y.bind(function(e){var maskNode=this._maskNode;maskNode.setStyle("top",maskNode.get("docScrollY"));},this)));}},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);},_afterHostZIndexChange:function(e){this._uiSetHostZIndex(e.newVal);}},{NAME:OVERLAY_MODAL,NS:MODAL,ATTRS:{maskNode:{getter:"_getMastNode",readOnly:true}},CLASSES:MODAL_CLASSES});OverlayKeepaligned=function(config){OverlayKeepaligned.superclass.constructor.apply(this,arguments);};Y.extend(OverlayKeepaligned,Y.Plugin.Base,{_uiHandles:null,initializer:function(config){this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.bindUI();this.syncUI();}},destructor:function(){this._detachUIHandles();},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);},syncUI:function(){this._uiSetHostVisible(this.get(HOST).get(VISIBLE));},_uiSetHostVisible:function(visible){if(visible){this._attachUIHandles();}else{this._detachUIHandles();}},_attachUIHandles:function(){if(this._uiHandles){return;}var host=this.get(HOST),syncAlign=Y.bind(host._syncUIPosAlgin,host);this._uiHandles=[Y.on("windowresize",syncAlign),Y.one("win").on("scroll",syncAlign)];},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);}},{NAME:OVERLAY_KEEPALIGNED,NS:KEEPALIGNED});OverlayAutohide=function(config){OverlayAutohide.superclass.constructor.apply(this,arguments);};Y.extend(OverlayAutohide,Y.Plugin.Base,{_uiHandles:null,initializer:function(config){this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.bindUI();this.syncUI();}},destructor:function(){this._detachUIHandles();},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);},syncUI:function(){this._uiSetHostVisible(this.get(HOST).get(VISIBLE));},_uiSetHostVisible:function(visible){if(visible){Y.later(1,this,"_attachUIHandles");}else{this._detachUIHandles();}},_attachUIHandles:function(){if(this._uiHandles){return;}var host=this.get(HOST),bb=host.get(BOUNDING_BOX),hide=Y.bind(host.hide,host);this._uiHandles=[bb.on("clickoutside",hide),bb.on("focusoutside",hide)];},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);}},{NAME:OVERLAY_AUTOHIDE,NS:AUTOHIDE});Y.Plugin.OverlayModal=OverlayModal;Y.Plugin.OverlayKeepaligned=OverlayKeepaligned;Y.Plugin.OverlayAutohide=OverlayAutohide;
-},"gallery-2010.05.12-19-08",{supersedes:["gallery-overlay-modal"],requires:["overlay","plugin","event-resize","gallery-outside-events"]});
+var isSupported=null,el,root;if(document.createElement){el=document.createElement("div");if(el&&el.style){el.style.position="fixed";el.style.top="10px";root=document.body;if(root&&root.appendChild&&root.removeChild){root.appendChild(el);isSupported=(el.offsetTop===10);root.removeChild(el);}}}return isSupported;}()),OverlayModal,OVERLAY_MODAL="overlayModal",MODAL="modal",MASK="mask",MODAL_CLASSES={modal:getCN(OVERLAY,MODAL),mask:getCN(OVERLAY,MASK)},OverlayKeepaligned,OVERLAY_KEEPALIGNED="overlayKeepaligned",KEEPALIGNED="keepalgined",OverlayAutohide,OVERLAY_AUTOHIDE="overlayAutohide",AUTOHIDE="autohide",CLICKED_OUTSIDE="clickedOutside",FOCUSED_OUTSIDE="focusedOutside",PRESSED_ESCAPE="pressedEscape";OverlayModal=Y.Base.create(OVERLAY_MODAL,Y.Plugin.Base,[],{_maskNode:null,_uiHandles:null,initializer:function(config){this.afterHostMethod(RENDER_UI,this.renderUI);this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.renderUI();this.bindUI();this.syncUI();}},destructor:function(){if(this._maskNode){this._maskNode.remove(true);}this._detachUIHandles();this.get(HOST).get(BOUNDING_BOX).removeClass(MODAL_CLASSES.modal);},renderUI:function(){var bb=this.get(HOST).get(BOUNDING_BOX),bbParent=bb.get("parentNode")||Y.one("body");this._maskNode=Y.Node.create("<div></div>");this._maskNode.addClass(MODAL_CLASSES.mask);this._maskNode.setStyles({position:supportsPosFixed?"fixed":"absolute",width:"100%",height:"100%",top:"0",left:"0",display:"none"});bbParent.insert(this._maskNode,bbParent.get("firstChild"));bb.addClass(MODAL_CLASSES.modal);},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);this.afterHostEvent(Z_INDEX+CHANGE,this._afterHostZIndexChange);},syncUI:function(){var host=this.get(HOST);this._uiSetHostVisible(host.get(VISIBLE));this._uiSetHostZIndex(host.get(Z_INDEX));},_focus:function(){var host=this.get(HOST),bb=host.get(BOUNDING_BOX),oldTI=bb.get("tabIndex");bb.set("tabIndex",oldTI>=0?oldTI:0);host.focus();bb.set("tabIndex",oldTI);},_blur:function(){this.get(HOST).blur();},_getMaskNode:function(){return this._maskNode;},_uiSetHostVisible:function(visible){if(visible){Y.later(1,this,"_attachUIHandles");this._maskNode.setStyle("display","block");this._focus();}else{this._detachUIHandles();this._maskNode.setStyle("display","none");this._blur();}},_uiSetHostZIndex:function(zIndex){this._maskNode.setStyle(Z_INDEX,zIndex||0);},_attachUIHandles:function(modal){if(this._uiHandles){return;}var host=this.get(HOST),bb=host.get(BOUNDING_BOX);this._uiHandles=[bb.on("clickoutside",Y.bind(this._focus,this)),bb.on("focusoutside",Y.bind(this._focus,this))];if(!supportsPosFixed){this._uiHandles.push(Y.one("win").on("scroll",Y.bind(function(e){var maskNode=this._maskNode;maskNode.setStyle("top",maskNode.get("docScrollY"));},this)));}},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);},_afterHostZIndexChange:function(e){this._uiSetHostZIndex(e.newVal);}},{NS:MODAL,ATTRS:{maskNode:{getter:"_getMastNode",readOnly:true}},CLASSES:MODAL_CLASSES});OverlayKeepaligned=Y.Base.create(OVERLAY_KEEPALIGNED,Y.Plugin.Base,[],{_uiHandles:null,initializer:function(config){this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.bindUI();this.syncUI();}},destructor:function(){this._detachUIHandles();},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);},syncUI:function(){this._uiSetHostVisible(this.get(HOST).get(VISIBLE));},_uiSetHostVisible:function(visible){if(visible){this._attachUIHandles();}else{this._detachUIHandles();}},_attachUIHandles:function(){if(this._uiHandles){return;}var host=this.get(HOST),syncAlign=Y.bind(host._syncUIPosAlgin,host);this._uiHandles=[Y.on("windowresize",syncAlign),Y.on("scroll",syncAlign)];},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);}},{NS:KEEPALIGNED});OverlayAutohide=Y.Base.create(OVERLAY_AUTOHIDE,Y.Plugin.Base,[],{_uiHandles:null,initializer:function(config){this.afterHostMethod(BIND_UI,this.bindUI);this.afterHostMethod(SYNC_UI,this.syncUI);if(this.get(HOST).get(RENDERED)){this.bindUI();this.syncUI();}},destructor:function(){this._detachUIHandles();},bindUI:function(){this.afterHostEvent(VISIBLE+CHANGE,this._afterHostVisibleChange);},syncUI:function(){this._uiSetHostVisible(this.get(HOST).get(VISIBLE));},_uiSetHostVisible:function(visible){if(visible){Y.later(1,this,"_attachUIHandles");}else{this._detachUIHandles();}},_attachUIHandles:function(){if(this._uiHandles){return;}var host=this.get(HOST),bb=host.get(BOUNDING_BOX),hide=Y.bind(host.hide,host),uiHandles=[];if(this.get(CLICKED_OUTSIDE)){uiHandles.push(bb.on("clickoutside",hide));}if(this.get(FOCUSED_OUTSIDE)){uiHandles.push(bb.on("focusoutside",hide));}if(this.get(PRESSED_ESCAPE)){uiHandles.push(bb.on("keydown",function(e){if(e.keyCode===27){hide();}}));}this._uiHandles=uiHandles;},_detachUIHandles:function(){Y.each(this._uiHandles,function(h){h.detach();});this._uiHandles=null;},_afterHostVisibleChange:function(e){this._uiSetHostVisible(e.newVal);}},{NS:AUTOHIDE,ATTRS:{clickedOutside:{value:true,validator:isBoolean},focusedOutside:{value:true,validator:isBoolean},pressedEscape:{value:true,validator:isBoolean}}});
+Y.Plugin.OverlayModal=OverlayModal;Y.Plugin.OverlayKeepaligned=OverlayKeepaligned;Y.Plugin.OverlayAutohide=OverlayAutohide;},"gallery-2010.05.26-19-47",{supersedes:["gallery-overlay-modal"],requires:["overlay","plugin","event-resize","gallery-outside-events"]});
View
84 build/gallery-overlay-extras/gallery-overlay-extras.js
@@ -20,6 +20,7 @@ YUI.add('gallery-overlay-extras', function(Y) {
CHANGE = 'Change',
+ isBoolean = Y.Lang.isBoolean,
getCN = Y.ClassNameManager.getClassName,
supportsPosFixed = (function(){
@@ -61,16 +62,14 @@ YUI.add('gallery-overlay-extras', function(Y) {
OverlayAutohide,
OVERLAY_AUTOHIDE = 'overlayAutohide',
- AUTOHIDE = 'autohide';
+ AUTOHIDE = 'autohide',
+ CLICKED_OUTSIDE = 'clickedOutside',
+ FOCUSED_OUTSIDE = 'focusedOutside',
+ PRESSED_ESCAPE = 'pressedEscape';
// *** OverlayModal *** //
- OverlayModal = function (config) {
-
- OverlayModal.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayModal, Y.Plugin.Base, {
+ OverlayModal = Y.Base.create(OVERLAY_MODAL, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -219,8 +218,8 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_MODAL,
NS : MODAL,
+
ATTRS : {
maskNode : {
@@ -229,18 +228,14 @@ YUI.add('gallery-overlay-extras', function(Y) {
}
},
+
CLASSES : MODAL_CLASSES
});
// *** OverlayKeepaligned *** //
- OverlayKeepaligned = function (config) {
-
- OverlayKeepaligned.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayKeepaligned, Y.Plugin.Base, {
+ OverlayKeepaligned = Y.Base.create(OVERLAY_KEEPALIGNED, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -294,7 +289,7 @@ YUI.add('gallery-overlay-extras', function(Y) {
this._uiHandles = [
Y.on('windowresize', syncAlign),
- Y.one('win').on('scroll', syncAlign)
+ Y.on('scroll', syncAlign)
];
},
@@ -315,19 +310,13 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_KEEPALIGNED,
- NS : KEEPALIGNED
+ NS : KEEPALIGNED
});
// *** OverlayAutohide *** //
- OverlayAutohide = function (config) {
-
- OverlayAutohide.superclass.constructor.apply(this, arguments);
- };
-
- Y.extend(OverlayAutohide, Y.Plugin.Base, {
+ OverlayAutohide = Y.Base.create(OVERLAY_AUTOHIDE, Y.Plugin.Base, [], {
// *** Instance Members *** //
@@ -378,12 +367,27 @@ YUI.add('gallery-overlay-extras', function(Y) {
var host = this.get(HOST),
bb = host.get(BOUNDING_BOX),
- hide = Y.bind(host.hide, host);
+ hide = Y.bind(host.hide, host),
+ uiHandles = [];
- this._uiHandles = [
- bb.on('clickoutside', hide),
- bb.on('focusoutside', hide)
- ];
+ if (this.get(CLICKED_OUTSIDE)) {
+ uiHandles.push(bb.on('clickoutside', hide));
+ }
+
+ if (this.get(FOCUSED_OUTSIDE)) {
+ uiHandles.push(bb.on('focusoutside', hide));
+ }
+
+ if (this.get(PRESSED_ESCAPE)) {
+// uiHandles.push(bb.on('key', hide, 'down:27')); // doesn't work because of event-key metadata issue
+ uiHandles.push(bb.on('keydown', function(e){
+ if (e.keyCode === 27) {
+ hide();
+ }
+ }));
+ }
+
+ this._uiHandles = uiHandles;
},
_detachUIHandles : function () {
@@ -403,8 +407,26 @@ YUI.add('gallery-overlay-extras', function(Y) {
// *** Static *** //
- NAME : OVERLAY_AUTOHIDE,
- NS : AUTOHIDE
+ NS : AUTOHIDE,
+
+ ATTRS : {
+
+ clickedOutside : {
+ value : true,
+ validator : isBoolean
+ },
+
+ focusedOutside : {
+ value : true,
+ validator : isBoolean
+ },
+
+ pressedEscape : {
+ value : true,
+ validator : isBoolean
+ }
+
+ }
});
@@ -415,4 +437,4 @@ YUI.add('gallery-overlay-extras', function(Y) {
Y.Plugin.OverlayAutohide = OverlayAutohide;
-}, 'gallery-2010.05.12-19-08' ,{supersedes:['gallery-overlay-modal'], requires:['overlay','plugin','event-resize','gallery-outside-events']});
+}, 'gallery-2010.05.26-19-47' ,{supersedes:['gallery-overlay-modal'], requires:['overlay','plugin','event-resize','gallery-outside-events']});
View
41 build/gallery-paginator/gallery-paginator-debug.js
@@ -1,15 +1,5 @@
YUI.add('gallery-paginator', function(Y) {
-/*
-Copyright (c) 2009, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-*/
-
-Y.Node.DOM_EVENTS.key =
-{
- on: Y.Env.evt.plugins.key.on
-};
"use strict";
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
@@ -1431,6 +1421,9 @@ Paginator.ui.ItemRangeDropdown.prototype =
this.page_count = this.span.one('span.yui-item-count');
+ this.prev_page_count = -1;
+ this.prev_page_size = -1;
+ this.prev_rec_count = -1;
this.update();
return this.span;
@@ -1451,22 +1444,32 @@ Paginator.ui.ItemRangeDropdown.prototype =
var page = this.paginator.getCurrentPage();
var count = this.paginator.getTotalPages();
- var options = Y.Node.getDOMNode(this.menu).options;
+ var size = this.paginator.getRowsPerPage();
+ var recs = this.paginator.getTotalRecords();
- options.length = 0;
- for (var i=1; i<=count; i++)
+ if (count != this.prev_page_count ||
+ size != this.prev_page_size ||
+ recs != this.prev_rec_count)
{
- var range = this.paginator.getPageRecords(i);
+ var options = Y.Node.getDOMNode(this.menu).options;
+ options.length = 0;
- options[i-1] = new Option((range[0]+1) + ' - ' + (range[1]+1), i);
- if (i == page)
+ for (var i=1; i<=count; i++)
{
- this.menu.set('selectedIndex', i-1);
+ var range = this.paginator.getPageRecords(i);
+
+ options[i-1] = new Option((range[0]+1) + ' - ' + (range[1]+1), i);
}
+
+ this.page_count.set('innerHTML', recs);
+
+ this.prev_page_count = count;
+ this.prev_page_size = size;
+ this.prev_rec_count = recs;
}
this.span.set('className', this.paginator.get('itemRangeDropdownClass'));
- this.page_count.set('innerHTML', this.paginator.getTotalRecords());
+ this.menu.set('selectedIndex', page-1);
},
_onChange: function(e)
@@ -2436,4 +2439,4 @@ Paginator.ui.RowsPerPageDropdown.prototype = {
};
-}, 'gallery-2010.05.21-18-16' ,{requires:['widget','event-key','substitute']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['widget','event-key','substitute']});
View
6 build/gallery-paginator/gallery-paginator-min.js
@@ -1,4 +1,4 @@
-YUI.add("gallery-paginator",function(A){A.Node.DOM_EVENTS.key={on:A.Env.evt.plugins.key.on};"use strict";function B(C){B.superclass.constructor.call(this,C);}A.mix(B,{NAME:"paginator",id:0,ID_BASE:"yui-pg-",VALUE_UNLIMITED:-1,TEMPLATE_DEFAULT:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",TEMPLATE_ROWS_PER_PAGE:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}",ui:{},isNumeric:function(C){return isFinite(+C);},toNumber:function(C){return isFinite(+C)?+C:null;}},true);B.ATTRS={rowsPerPage:{value:0,validator:B.isNumeric,setter:B.toNumber},totalRecords:{value:0,validator:B.isNumeric,setter:B.toNumber},recordOffset:{value:0,validator:function(D){var C=this.get("totalRecords");if(B.isNumeric(D)){D=+D;return C===B.VALUE_UNLIMITED||C>D||(C===0&&D===0);}return false;},setter:B.toNumber},initialPage:{value:1,validator:B.isNumeric,setter:B.toNumber},template:{value:B.TEMPLATE_DEFAULT,validator:A.Lang.isString},alwaysVisible:{value:true,validator:A.Lang.isBoolean},updateOnChange:{value:false,validator:A.Lang.isBoolean},id:{value:B.id++,readOnly:true}};A.extend(B,A.Widget,{_batch:false,_pageChanged:false,_state:null,initializer:function(F){var H=B.VALUE_UNLIMITED,C,D,E,G;this._selfSubscribe();C=this.get("initialPage");D=this.get("totalRecords");E=this.get("rowsPerPage");if(C>1&&E!==H){G=(C-1)*E;if(D===H||G<D){this.set("recordOffset",G);}}},_selfSubscribe:function(){this.after("totalRecordsChange",this.updateVisibility,this);this.after("alwaysVisibleChange",this.updateVisibility,this);this.after("totalRecordsChange",this._handleStateChange,this);this.after("recordOffsetChange",this._handleStateChange,this);this.after("rowsPerPageChange",this._handleStateChange,this);this.after("totalRecordsChange",this._syncRecordOffset,this);},renderUI:function(){this._renderTemplate(this.get("contentBox"),this.get("template"),B.ID_BASE+this.get("id"),true);this.updateVisibility();},_renderTemplate:function(C,G,F,D){if(!C){return;}C.setStyle("display","none");C.addClass(this.getClassName());var E=this.getClassName("ui");C.set("innerHTML",G.replace(/\{([a-z0-9_ \-]+)\}/gi,'<span class="'+E+" "+E+'-$1"></span>'));C.all("span."+E).each(function(H){this.renderUIComponent(H,F);},this);if(!D){C.setStyle("display","");}},renderUIComponent:function(C,I){var H=C.get("parentNode"),G=this.getClassName("ui"),F=new RegExp(G+"-(\\w+)").exec(C.get("className")),E=F&&B.ui[F[1]],D;if(A.Lang.isFunction(E)){D=new E(this);if(A.Lang.isFunction(D.render)){H.replaceChild(D.render(I),C);}}},updateVisibility:function(H){var D=this.get("alwaysVisible"),J,I,F,G,E,C;if(!H||H.type==="alwaysVisibleChange"||!D){J=this.get("totalRecords");I=true;F=this.get("rowsPerPage");G=this.get("rowsPerPageOptions");if(A.Lang.isArray(G)){for(E=0,C=G.length;E<C;++E){F=Math.min(F,G[E]);}}if(J!==B.VALUE_UNLIMITED&&J<=F){I=false;}I=I||D;this.get("contentBox").setStyle("display",I?"":"none");}},getTotalPages:function(){var C=this.get("totalRecords"),D=this.get("rowsPerPage");if(!D){return null;}if(C===B.VALUE_UNLIMITED){return B.VALUE_UNLIMITED;}return Math.ceil(C/D);},hasPage:function(D){if(!A.Lang.isNumber(D)||D<1){return false;}var C=this.getTotalPages();return(C===B.VALUE_UNLIMITED||C>=D);},getCurrentPage:function(){var C=this.get("rowsPerPage");if(!C||!this.get("totalRecords")){return 0;}return Math.floor(this.get("recordOffset")/C)+1;},hasNextPage:function(){var C=this.getCurrentPage(),D=this.getTotalPages();return C&&(D===B.VALUE_UNLIMITED||C<D);},getNextPage:function(){return this.hasNextPage()?this.getCurrentPage()+1:null;},hasPreviousPage:function(){return(this.getCurrentPage()>1);},getPreviousPage:function(){return(this.hasPreviousPage()?this.getCurrentPage()-1:1);},getPageRecords:function(F){if(!A.Lang.isNumber(F)){F=this.getCurrentPage();}var E=this.get("rowsPerPage"),D=this.get("totalRecords"),G,C;if(!F||!E){return null;}G=(F-1)*E;if(D!==B.VALUE_UNLIMITED){if(G>=D){return null;}C=Math.min(G+E,D)-1;}else{C=G+E-1;}return[G,C];},setPage:function(D,C){if(this.hasPage(D)&&D!==this.getCurrentPage()){if(this.get("updateOnChange")||C){this.set("recordOffset",(D-1)*this.get("rowsPerPage"));}else{this.fire("changeRequest",this.getState({"page":D}));}}},getRowsPerPage:function(){return this.get("rowsPerPage");},setRowsPerPage:function(D,C){if(B.isNumeric(D)&&+D>0&&+D!==this.get("rowsPerPage")){if(this.get("updateOnChange")||C){this.set("rowsPerPage",D);}else{this.fire("changeRequest",this.getState({"rowsPerPage":+D}));}}},getTotalRecords:function(){return this.get("totalRecords");},setTotalRecords:function(D,C){if(B.isNumeric(D)&&+D>=0&&+D!==this.get("totalRecords")){if(this.get("updateOnChange")||C){this.set("totalRecords",D);}else{this.fire("changeRequest",this.getState({"totalRecords":+D}));}}},getStartIndex:function(){return this.get("recordOffset");},setStartIndex:function(D,C){if(B.isNumeric(D)&&+D>=0&&+D!==this.get("recordOffset")){if(this.get("updateOnChange")||C){this.set("recordOffset",D);}else{this.fire("changeRequest",this.getState({"recordOffset":+D}));}}},getState:function(I){var K=B.VALUE_UNLIMITED,G=Math,H=G.max,J=G.ceil,E,C,F;function D(N,L,M){if(N<=0||L===0){return 0;}if(L===K||L>N){return N-(N%M);}return L-(L%M||M);}E={paginator:this,totalRecords:this.get("totalRecords"),rowsPerPage:this.get("rowsPerPage"),records:this.getPageRecords()};E.recordOffset=D(this.get("recordOffset"),E.totalRecords,E.rowsPerPage);E.page=J(E.recordOffset/E.rowsPerPage)+1;if(!I){return E;}C={paginator:this,before:E,rowsPerPage:I.rowsPerPage||E.rowsPerPage,totalRecords:(B.isNumeric(I.totalRecords)?H(I.totalRecords,K):+E.totalRecords)};if(C.totalRecords===0){C.recordOffset=C.page=0;}else{F=B.isNumeric(I.page)?(I.page-1)*C.rowsPerPage:B.isNumeric(I.recordOffset)?+I.recordOffset:E.recordOffset;C.recordOffset=D(F,C.totalRecords,C.rowsPerPage);C.page=J(C.recordOffset/C.rowsPerPage)+1;}C.records=[C.recordOffset,C.recordOffset+C.rowsPerPage-1];if(C.totalRecords!==K&&C.recordOffset<C.totalRecords&&C.records&&C.records[1]>C.totalRecords-1){C.records[1]=C.totalRecords-1;
+YUI.add("gallery-paginator",function(A){function B(C){B.superclass.constructor.call(this,C);}A.mix(B,{NAME:"paginator",id:0,ID_BASE:"yui-pg-",VALUE_UNLIMITED:-1,TEMPLATE_DEFAULT:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",TEMPLATE_ROWS_PER_PAGE:"{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}",ui:{},isNumeric:function(C){return isFinite(+C);},toNumber:function(C){return isFinite(+C)?+C:null;}},true);B.ATTRS={rowsPerPage:{value:0,validator:B.isNumeric,setter:B.toNumber},totalRecords:{value:0,validator:B.isNumeric,setter:B.toNumber},recordOffset:{value:0,validator:function(D){var C=this.get("totalRecords");if(B.isNumeric(D)){D=+D;return C===B.VALUE_UNLIMITED||C>D||(C===0&&D===0);}return false;},setter:B.toNumber},initialPage:{value:1,validator:B.isNumeric,setter:B.toNumber},template:{value:B.TEMPLATE_DEFAULT,validator:A.Lang.isString},alwaysVisible:{value:true,validator:A.Lang.isBoolean},updateOnChange:{value:false,validator:A.Lang.isBoolean},id:{value:B.id++,readOnly:true}};A.extend(B,A.Widget,{_batch:false,_pageChanged:false,_state:null,initializer:function(F){var H=B.VALUE_UNLIMITED,C,D,E,G;this._selfSubscribe();C=this.get("initialPage");D=this.get("totalRecords");E=this.get("rowsPerPage");if(C>1&&E!==H){G=(C-1)*E;if(D===H||G<D){this.set("recordOffset",G);}}},_selfSubscribe:function(){this.after("totalRecordsChange",this.updateVisibility,this);this.after("alwaysVisibleChange",this.updateVisibility,this);this.after("totalRecordsChange",this._handleStateChange,this);this.after("recordOffsetChange",this._handleStateChange,this);this.after("rowsPerPageChange",this._handleStateChange,this);this.after("totalRecordsChange",this._syncRecordOffset,this);},renderUI:function(){this._renderTemplate(this.get("contentBox"),this.get("template"),B.ID_BASE+this.get("id"),true);this.updateVisibility();},_renderTemplate:function(C,G,F,D){if(!C){return;}C.setStyle("display","none");C.addClass(this.getClassName());var E=this.getClassName("ui");C.set("innerHTML",G.replace(/\{([a-z0-9_ \-]+)\}/gi,'<span class="'+E+" "+E+'-$1"></span>'));C.all("span."+E).each(function(H){this.renderUIComponent(H,F);},this);if(!D){C.setStyle("display","");}},renderUIComponent:function(C,I){var H=C.get("parentNode"),G=this.getClassName("ui"),F=new RegExp(G+"-(\\w+)").exec(C.get("className")),E=F&&B.ui[F[1]],D;if(A.Lang.isFunction(E)){D=new E(this);if(A.Lang.isFunction(D.render)){H.replaceChild(D.render(I),C);}}},updateVisibility:function(H){var D=this.get("alwaysVisible"),J,I,F,G,E,C;if(!H||H.type==="alwaysVisibleChange"||!D){J=this.get("totalRecords");I=true;F=this.get("rowsPerPage");G=this.get("rowsPerPageOptions");if(A.Lang.isArray(G)){for(E=0,C=G.length;E<C;++E){F=Math.min(F,G[E]);}}if(J!==B.VALUE_UNLIMITED&&J<=F){I=false;}I=I||D;this.get("contentBox").setStyle("display",I?"":"none");}},getTotalPages:function(){var C=this.get("totalRecords"),D=this.get("rowsPerPage");if(!D){return null;}if(C===B.VALUE_UNLIMITED){return B.VALUE_UNLIMITED;}return Math.ceil(C/D);},hasPage:function(D){if(!A.Lang.isNumber(D)||D<1){return false;}var C=this.getTotalPages();return(C===B.VALUE_UNLIMITED||C>=D);},getCurrentPage:function(){var C=this.get("rowsPerPage");if(!C||!this.get("totalRecords")){return 0;}return Math.floor(this.get("recordOffset")/C)+1;},hasNextPage:function(){var C=this.getCurrentPage(),D=this.getTotalPages();return C&&(D===B.VALUE_UNLIMITED||C<D);},getNextPage:function(){return this.hasNextPage()?this.getCurrentPage()+1:null;},hasPreviousPage:function(){return(this.getCurrentPage()>1);},getPreviousPage:function(){return(this.hasPreviousPage()?this.getCurrentPage()-1:1);},getPageRecords:function(F){if(!A.Lang.isNumber(F)){F=this.getCurrentPage();}var E=this.get("rowsPerPage"),D=this.get("totalRecords"),G,C;if(!F||!E){return null;}G=(F-1)*E;if(D!==B.VALUE_UNLIMITED){if(G>=D){return null;}C=Math.min(G+E,D)-1;}else{C=G+E-1;}return[G,C];},setPage:function(D,C){if(this.hasPage(D)&&D!==this.getCurrentPage()){if(this.get("updateOnChange")||C){this.set("recordOffset",(D-1)*this.get("rowsPerPage"));}else{this.fire("changeRequest",this.getState({"page":D}));}}},getRowsPerPage:function(){return this.get("rowsPerPage");},setRowsPerPage:function(D,C){if(B.isNumeric(D)&&+D>0&&+D!==this.get("rowsPerPage")){if(this.get("updateOnChange")||C){this.set("rowsPerPage",D);}else{this.fire("changeRequest",this.getState({"rowsPerPage":+D}));}}},getTotalRecords:function(){return this.get("totalRecords");},setTotalRecords:function(D,C){if(B.isNumeric(D)&&+D>=0&&+D!==this.get("totalRecords")){if(this.get("updateOnChange")||C){this.set("totalRecords",D);}else{this.fire("changeRequest",this.getState({"totalRecords":+D}));}}},getStartIndex:function(){return this.get("recordOffset");},setStartIndex:function(D,C){if(B.isNumeric(D)&&+D>=0&&+D!==this.get("recordOffset")){if(this.get("updateOnChange")||C){this.set("recordOffset",D);}else{this.fire("changeRequest",this.getState({"recordOffset":+D}));}}},getState:function(I){var K=B.VALUE_UNLIMITED,G=Math,H=G.max,J=G.ceil,E,C,F;function D(N,L,M){if(N<=0||L===0){return 0;}if(L===K||L>N){return N-(N%M);}return L-(L%M||M);}E={paginator:this,totalRecords:this.get("totalRecords"),rowsPerPage:this.get("rowsPerPage"),records:this.getPageRecords()};E.recordOffset=D(this.get("recordOffset"),E.totalRecords,E.rowsPerPage);E.page=J(E.recordOffset/E.rowsPerPage)+1;if(!I){return E;}C={paginator:this,before:E,rowsPerPage:I.rowsPerPage||E.rowsPerPage,totalRecords:(B.isNumeric(I.totalRecords)?H(I.totalRecords,K):+E.totalRecords)};if(C.totalRecords===0){C.recordOffset=C.page=0;}else{F=B.isNumeric(I.page)?(I.page-1)*C.rowsPerPage:B.isNumeric(I.recordOffset)?+I.recordOffset:E.recordOffset;C.recordOffset=D(F,C.totalRecords,C.rowsPerPage);C.page=J(C.recordOffset/C.rowsPerPage)+1;}C.records=[C.recordOffset,C.recordOffset+C.rowsPerPage-1];if(C.totalRecords!==K&&C.recordOffset<C.totalRecords&&C.records&&C.records[1]>C.totalRecords-1){C.records[1]=C.totalRecords-1;
}return C;},setState:function(D){if(A.Lang.isObject(D)){this._state=this.getState({});D={page:D.page,rowsPerPage:D.rowsPerPage,totalRecords:D.totalRecords,recordOffset:D.recordOffset};if(D.page&&D.recordOffset===undefined){D.recordOffset=(D.page-1)*(D.rowsPerPage||this.get("rowsPerPage"));}this._batch=true;this._pageChanged=false;for(var C in D){if(D.hasOwnProperty(C)&&this._configs.hasOwnProperty(C)){this.set(C,D[C]);}}this._batch=false;if(this._pageChanged){this._pageChanged=false;this._firePageChange(this.getState(this._state));}}},_syncRecordOffset:function(F){var C=F.newValue,E,D;if(F.prevValue!==C){if(C!==B.VALUE_UNLIMITED){E=this.get("rowsPerPage");if(E&&this.get("recordOffset")>=C){D=this.getState({totalRecords:F.prevValue,recordOffset:this.get("recordOffset")});this.set("recordOffset",D.before.recordOffset);this._firePageChange(D);}}}},_handleStateChange:function(D){if(D.prevValue!==D.newValue){var E=this._state||{},C;E[D.type.replace(/Change$/,"")]=D.prevValue;C=this.getState(E);if(C.page!==C.before.page){if(this._batch){this._pageChanged=true;}else{this._firePageChange(C);}}}},_firePageChange:function(C){if(A.Lang.isObject(C)){var D=C.before;delete C.before;this.fire("pageChange",{type:"pageChange",prevValue:C.page,newValue:D.page,prevState:C,newState:D});}}});A.Paginator=B;B.ui.CurrentPageInput=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("pageInputClassChange",this.update,this);};B.ATTRS.pageInputClass={value:A.ClassNameManager.getClassName(B.NAME,"page-input"),validator:A.Lang.isString};B.ATTRS.pageInputTemplate={value:"{currentPage} of {totalPages}",validator:A.Lang.isString};B.ui.CurrentPageInput.prototype={destroy:function(){this.span.remove(true);this.span=null;this.input=null;this.page_count=null;},render:function(C){this.span=A.Node.create('<span id="'+C+'-page-input">'+A.substitute(this.paginator.get("pageInputTemplate"),{currentPage:'<input class="yui-page-input"></input>',totalPages:'<span class="yui-page-count"></span>'})+"</span>");this.span.set("className",this.paginator.get("pageInputClass"));this.input=this.span.one("input");this.input.on("change",this._onChange,this);this.input.on("key",this._onReturnKey,"down:13",this);this.page_count=this.span.one("span.yui-page-count");this.update();return this.span;},update:function(C){if(C&&C.prevVal===C.newVal){return;}this.span.set("className",this.paginator.get("pageInputClass"));this.input.set("value",this.paginator.getCurrentPage());this.page_count.set("innerHTML",this.paginator.getTotalPages());},_onChange:function(C){this.paginator.setPage(parseInt(this.input.get("value"),10));},_onReturnKey:function(C){C.halt(true);this.paginator.setPage(parseInt(this.input.get("value"),10));}};B.ui.CurrentPageReport=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("pageReportClassChange",this.update,this);C.after("pageReportTemplateChange",this.update,this);};B.ATTRS.pageReportClass={value:A.ClassNameManager.getClassName(B.NAME,"current"),validator:A.Lang.isString};B.ATTRS.pageReportTemplate={value:"({currentPage} of {totalPages})",validator:A.Lang.isString};B.ATTRS.pageReportValueGenerator={value:function(E){var D=E.getCurrentPage(),C=E.getPageRecords();return{"currentPage":C?D:0,"totalPages":E.getTotalPages(),"startIndex":C?C[0]:0,"endIndex":C?C[1]:0,"startRecord":C?C[0]+1:0,"endRecord":C?C[1]+1:0,"totalRecords":E.get("totalRecords")};},validator:A.Lang.isFunction};B.ui.CurrentPageReport.sprintf=function(D,C){return D.replace(/\{([\w\s\-]+)\}/g,function(E,F){return(F in C)?C[F]:"";});};B.ui.CurrentPageReport.prototype={span:null,destroy:function(){this.span.remove(true);this.span=null;},render:function(C){this.span=A.Node.create('<span id="'+C+'-page-report"></span>');this.span.set("className",this.paginator.get("pageReportClass"));this.update();return this.span;},update:function(C){if(C&&C.prevVal===C.newVal){return;}this.span.set("className",this.paginator.get("pageReportClass"));this.span.set("innerHTML",B.ui.CurrentPageReport.sprintf(this.paginator.get("pageReportTemplate"),this.paginator.get("pageReportValueGenerator")(this.paginator)));}};B.ui.FirstPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("firstPageLinkLabelChange",this.rebuild,this);C.after("firstPageLinkClassChange",this.rebuild,this);};B.ATTRS.firstPageLinkLabel={value:"&lt;&lt; first",validator:A.Lang.isString};B.ATTRS.firstPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"first"),validator:A.Lang.isString};B.ui.FirstPageLink.prototype={current:null,link:null,span:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.current=this.link=this.span=null;},render:function(D){var E=this.paginator,F=E.get("firstPageLinkClass"),C=E.get("firstPageLinkLabel");this.link=A.Node.create('<a href="#" id="'+D+'-first-link">'+C+"</a>");this.link.set("className",F);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-first-span">'+C+"</span>");this.span.set("className",F);this.current=E.getCurrentPage()>1?this.link:this.span;return this.current;},update:function(D){if(D&&D.prevVal===D.newVal){return;}var C=this.current?this.current.get("parentNode"):null;if(this.paginator.getCurrentPage()>1){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(C&&this.current===this.link){C.replaceChild(this.span,this.current);this.current=this.span;}}},rebuild:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator,F=D.get("firstPageLinkClass"),C=D.get("firstPageLinkLabel");this.link.set("className",F);
-this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(1);}};B.ui.ItemRangeDropdown=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("itemRangeDropdownClassChange",this.update,this);};B.ATTRS.itemRangeDropdownClass={value:A.ClassNameManager.getClassName(B.NAME,"ir-dropdown"),validator:A.Lang.isString};B.ATTRS.itemRangeDropdownTemplate={value:"{currentRange} of {totalItems}",validator:A.Lang.isString};B.ui.ItemRangeDropdown.prototype={destroy:function(){this.span.remove(true);this.span=null;this.menu=null;this.page_count=null;},render:function(C){this.span=A.Node.create('<span id="'+C+'-item-range">'+A.substitute(this.paginator.get("itemRangeDropdownTemplate"),{currentRange:'<select class="yui-current-item-range"></select>',totalItems:'<span class="yui-item-count"></span>'})+"</span>");this.span.set("className",this.paginator.get("itemRangeDropdownClass"));this.menu=this.span.one("select");this.menu.on("change",this._onChange,this);this.page_count=this.span.one("span.yui-item-count");this.update();return this.span;},update:function(H){if(H&&H.prevVal===H.newVal){return;}var G=this.paginator.getCurrentPage();var F=this.paginator.getTotalPages();var D=A.Node.getDOMNode(this.menu).options;D.length=0;for(var E=1;E<=F;E++){var C=this.paginator.getPageRecords(E);D[E-1]=new Option((C[0]+1)+" - "+(C[1]+1),E);if(E==G){this.menu.set("selectedIndex",E-1);}}this.span.set("className",this.paginator.get("itemRangeDropdownClass"));this.page_count.set("innerHTML",this.paginator.getTotalRecords());},_onChange:function(C){this.paginator.setPage(parseInt(this.menu.get("value"),10));}};B.ui.LastPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("lastPageLinkClassChange",this.rebuild,this);C.after("lastPageLinkLabelChange",this.rebuild,this);};B.ATTRS.lastPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"last"),validator:A.Lang.isString};B.ATTRS.lastPageLinkLabel={value:"last &gt;&gt;",validator:A.Lang.isString};B.ui.LastPageLink.prototype={current:null,link:null,span:null,na:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.na.remove(true);this.current=this.link=this.span=this.na=null;},render:function(D){var F=this.paginator,G=F.get("lastPageLinkClass"),C=F.get("lastPageLinkLabel"),E=F.getTotalPages();this.link=A.Node.create('<a href="#" id="'+D+'-last-link">'+C+"</a>");this.link.set("className",G);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-last-span">'+C+"</span>");this.span.set("className",G);this.na=A.Node.create('<span id="'+D+'-last-na"></span>');switch(E){case B.VALUE_UNLIMITED:this.current=this.na;break;case F.getCurrentPage():this.current=this.span;break;default:this.current=this.link;}return this.current;},update:function(D){if(D&&D.prevVal===D.newVal){return;}var C=this.current?this.current.get("parentNode"):null,E=this.link;if(C){switch(this.paginator.getTotalPages()){case B.VALUE_UNLIMITED:E=this.na;break;case this.paginator.getCurrentPage():E=this.span;break;}if(this.current!==E){C.replaceChild(E,this.current);this.current=E;}}},rebuild:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator,F=D.get("lastPageLinkClass"),C=D.get("lastPageLinkLabel");this.link.set("className",F);this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getTotalPages());}};B.ui.NextPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("nextPageLinkClassChange",this.rebuild,this);C.after("nextPageLinkLabelChange",this.rebuild,this);};B.ATTRS.nextPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"next"),validator:A.Lang.isString};B.ATTRS.nextPageLinkLabel={value:"next &gt;",validator:A.Lang.isString};B.ui.NextPageLink.prototype={current:null,link:null,span:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.current=this.link=this.span=null;},render:function(D){var F=this.paginator,G=F.get("nextPageLinkClass"),C=F.get("nextPageLinkLabel"),E=F.getTotalPages();this.link=A.Node.create('<a href="#" id="'+D+'-next-link">'+C+"</a>");this.link.set("className",G);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-next-span">'+C+"</span>");this.span.set("className",G);this.current=F.getCurrentPage()===E?this.span:this.link;return this.current;},update:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator.getTotalPages(),C=this.current?this.current.get("parentNode"):null;if(this.paginator.getCurrentPage()!==D){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(this.current===this.link){if(C){C.replaceChild(this.span,this.current);this.current=this.span;}}}},rebuild:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator,F=D.get("nextPageLinkClass"),C=D.get("nextPageLinkLabel");this.link.set("className",F);this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getNextPage());}};B.ui.PageLinks=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("pageLinksContainerClassChange",this.rebuild,this);C.after("pageLinkClassChange",this.rebuild,this);C.after("currentPageClassChange",this.rebuild,this);
-C.after("pageLinksChange",this.rebuild,this);};B.ATTRS.pageLinksContainerClass={value:A.ClassNameManager.getClassName(B.NAME,"pages"),validator:A.Lang.isString};B.ATTRS.pageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"page"),validator:A.Lang.isString};B.ATTRS.currentPageClass={value:A.ClassNameManager.getClassName(B.NAME,"current-page"),validator:A.Lang.isString};B.ATTRS.pageLinks={value:10,validator:B.isNumeric};B.ATTRS.pageLabelBuilder={value:function(C,D){return C;},validator:A.Lang.isFunction};B.ui.PageLinks.calculateRange=function(E,F,D){var I=B.VALUE_UNLIMITED,H,C,G;if(!E||D===0||F===0||(F===I&&D===I)){return[0,-1];}if(F!==I){D=D===I?F:Math.min(D,F);}H=Math.max(1,Math.ceil(E-(D/2)));if(F===I){C=H+D-1;}else{C=Math.min(F,H+D-1);}G=D-(C-H+1);H=Math.max(1,H-G);return[H,C];};B.ui.PageLinks.prototype={current:0,container:null,destroy:function(){this.container.remove(true);this.container=null;},render:function(C){this.container=A.Node.create('<span id="'+C+'-pages"></span>');this.container.on("click",this.onClick,this);this.update({newVal:null,rebuild:true});return this.container;},update:function(J){if(J&&J.prevVal===J.newVal){return;}var E=this.paginator,I=E.getCurrentPage();if(this.current!==I||!I||J.rebuild){var L=E.get("pageLabelBuilder"),H=B.ui.PageLinks.calculateRange(I,E.getTotalPages(),E.get("pageLinks")),D=H[0],F=H[1],K="",C,G;C='<a href="#" class="'+E.get("pageLinkClass")+'" page="';for(G=D;G<=F;++G){if(G===I){K+='<span class="'+E.get("currentPageClass")+" "+E.get("pageLinkClass")+'">'+L(G,E)+"</span>";}else{K+=C+G+'">'+L(G,E)+"</a>";}}this.container.set("className",E.get("pageLinksContainerClass"));this.container.set("innerHTML",K);}},rebuild:function(C){C.rebuild=true;this.update(C);},onClick:function(D){var C=D.target;if(C&&C.hasClass(this.paginator.get("pageLinkClass"))){D.halt();this.paginator.setPage(parseInt(C.getAttribute("page"),10));}}};B.ui.PreviousPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("previousPageLinkLabelChange",this.update,this);C.after("previousPageLinkClassChange",this.update,this);};B.ATTRS.previousPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"previous"),validator:A.Lang.isString};B.ATTRS.previousPageLinkLabel={value:"&lt; prev",validator:A.Lang.isString};B.ui.PreviousPageLink.prototype={current:null,link:null,span:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.current=this.link=this.span=null;},render:function(D){var E=this.paginator,F=E.get("previousPageLinkClass"),C=E.get("previousPageLinkLabel");this.link=A.Node.create('<a href="#" id="'+D+'-prev-link">'+C+"</a>");this.link.set("className",F);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-prev-span">'+C+"</span>");this.span.set("className",F);this.current=E.getCurrentPage()>1?this.link:this.span;return this.current;},update:function(D){if(D&&D.prevVal===D.newVal){return;}var C=this.current?this.current.get("parentNode"):null;if(this.paginator.getCurrentPage()>1){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(C&&this.current===this.link){C.replaceChild(this.span,this.current);this.current=this.span;}}},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getPreviousPage());}};B.ui.RowsPerPageDropdown=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this._handleTotalRecordsChange,this);C.after("rowsPerPageDropdownClassChange",this.rebuild,this);C.after("rowsPerPageDropdownTitleChange",this.rebuild,this);C.after("rowsPerPageOptionsChange",this.rebuild,this);};B.ATTRS.rowsPerPageDropdownClass={value:A.ClassNameManager.getClassName(B.NAME,"rpp-options"),validator:A.Lang.isString};B.ATTRS.rowsPerPageDropdownTitle={value:"Rows per page",validator:A.Lang.isString};B.ATTRS.rowsPerPageOptions={value:[],validator:A.Lang.isArray};B.ui.RowsPerPageDropdown.prototype={select:null,all:null,destroy:function(){this.select.remove(true);this.all=this.select=null;},render:function(C){this.select=A.Node.create('<select id="'+C+'-rpp"></select>');this.select.on("change",this.onChange,this);this.rebuild();return this.select;},rebuild:function(K){var D=this.paginator,F=this.select,L=D.get("rowsPerPageOptions"),C=A.Node.getDOMNode(F).options,E,J,G,H,I;this.all=null;F.set("className",this.paginator.get("rowsPerPageDropdownClass"));F.set("title",this.paginator.get("rowsPerPageDropdownTitle"));for(H=0,I=L.length;H<I;++H){J=L[H];E=C[H]||F.appendChild(A.Node.create("<option/>"));G=A.Lang.isValue(J.value)?J.value:J;E.set("innerHTML",A.Lang.isValue(J.text)?J.text:J);if(A.Lang.isString(G)&&G.toLowerCase()==="all"){this.all=E;E.set("value",D.get("totalRecords"));}else{E.set("value",G);}}while(C.length>L.length){F.get("lastChild").remove();}this.update();},update:function(G){if(G&&G.prevVal===G.newVal){return;}var F=this.paginator.get("rowsPerPage")+"",D=A.Node.getDOMNode(this.select).options,E,C;for(E=0,C=D.length;E<C;++E){if(D[E].value===F){D[E].selected=true;break;}}},onChange:function(C){this.paginator.setRowsPerPage(parseInt(A.Node.getDOMNode(this.select).options[this.select.get("selectedIndex")].value,10));},_handleTotalRecordsChange:function(C){if(!this.all||(C&&C.prevVal===C.newVal)){return;}this.all.set("value",C.newVal);if(this.all.get("selected")){this.paginator.set("rowsPerPage",C.newVal);}}};},"gallery-2010.05.21-18-16",{requires:["widget","event-key","substitute"]});
+this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(1);}};B.ui.ItemRangeDropdown=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("itemRangeDropdownClassChange",this.update,this);};B.ATTRS.itemRangeDropdownClass={value:A.ClassNameManager.getClassName(B.NAME,"ir-dropdown"),validator:A.Lang.isString};B.ATTRS.itemRangeDropdownTemplate={value:"{currentRange} of {totalItems}",validator:A.Lang.isString};B.ui.ItemRangeDropdown.prototype={destroy:function(){this.span.remove(true);this.span=null;this.menu=null;this.page_count=null;},render:function(C){this.span=A.Node.create('<span id="'+C+'-item-range">'+A.substitute(this.paginator.get("itemRangeDropdownTemplate"),{currentRange:'<select class="yui-current-item-range"></select>',totalItems:'<span class="yui-item-count"></span>'})+"</span>");this.span.set("className",this.paginator.get("itemRangeDropdownClass"));this.menu=this.span.one("select");this.menu.on("change",this._onChange,this);this.page_count=this.span.one("span.yui-item-count");this.prev_page_count=-1;this.prev_page_size=-1;this.prev_rec_count=-1;this.update();return this.span;},update:function(J){if(J&&J.prevVal===J.newVal){return;}var I=this.paginator.getCurrentPage();var G=this.paginator.getTotalPages();var F=this.paginator.getRowsPerPage();var H=this.paginator.getTotalRecords();if(G!=this.prev_page_count||F!=this.prev_page_size||H!=this.prev_rec_count){var D=A.Node.getDOMNode(this.menu).options;D.length=0;for(var E=1;E<=G;E++){var C=this.paginator.getPageRecords(E);D[E-1]=new Option((C[0]+1)+" - "+(C[1]+1),E);}this.page_count.set("innerHTML",H);this.prev_page_count=G;this.prev_page_size=F;this.prev_rec_count=H;}this.span.set("className",this.paginator.get("itemRangeDropdownClass"));this.menu.set("selectedIndex",I-1);},_onChange:function(C){this.paginator.setPage(parseInt(this.menu.get("value"),10));}};B.ui.LastPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("lastPageLinkClassChange",this.rebuild,this);C.after("lastPageLinkLabelChange",this.rebuild,this);};B.ATTRS.lastPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"last"),validator:A.Lang.isString};B.ATTRS.lastPageLinkLabel={value:"last &gt;&gt;",validator:A.Lang.isString};B.ui.LastPageLink.prototype={current:null,link:null,span:null,na:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.na.remove(true);this.current=this.link=this.span=this.na=null;},render:function(D){var F=this.paginator,G=F.get("lastPageLinkClass"),C=F.get("lastPageLinkLabel"),E=F.getTotalPages();this.link=A.Node.create('<a href="#" id="'+D+'-last-link">'+C+"</a>");this.link.set("className",G);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-last-span">'+C+"</span>");this.span.set("className",G);this.na=A.Node.create('<span id="'+D+'-last-na"></span>');switch(E){case B.VALUE_UNLIMITED:this.current=this.na;break;case F.getCurrentPage():this.current=this.span;break;default:this.current=this.link;}return this.current;},update:function(D){if(D&&D.prevVal===D.newVal){return;}var C=this.current?this.current.get("parentNode"):null,E=this.link;if(C){switch(this.paginator.getTotalPages()){case B.VALUE_UNLIMITED:E=this.na;break;case this.paginator.getCurrentPage():E=this.span;break;}if(this.current!==E){C.replaceChild(E,this.current);this.current=E;}}},rebuild:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator,F=D.get("lastPageLinkClass"),C=D.get("lastPageLinkLabel");this.link.set("className",F);this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getTotalPages());}};B.ui.NextPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("nextPageLinkClassChange",this.rebuild,this);C.after("nextPageLinkLabelChange",this.rebuild,this);};B.ATTRS.nextPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"next"),validator:A.Lang.isString};B.ATTRS.nextPageLinkLabel={value:"next &gt;",validator:A.Lang.isString};B.ui.NextPageLink.prototype={current:null,link:null,span:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.current=this.link=this.span=null;},render:function(D){var F=this.paginator,G=F.get("nextPageLinkClass"),C=F.get("nextPageLinkLabel"),E=F.getTotalPages();this.link=A.Node.create('<a href="#" id="'+D+'-next-link">'+C+"</a>");this.link.set("className",G);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-next-span">'+C+"</span>");this.span.set("className",G);this.current=F.getCurrentPage()===E?this.span:this.link;return this.current;},update:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator.getTotalPages(),C=this.current?this.current.get("parentNode"):null;if(this.paginator.getCurrentPage()!==D){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(this.current===this.link){if(C){C.replaceChild(this.span,this.current);this.current=this.span;}}}},rebuild:function(E){if(E&&E.prevVal===E.newVal){return;}var D=this.paginator,F=D.get("nextPageLinkClass"),C=D.get("nextPageLinkLabel");this.link.set("className",F);this.link.set("innerHTML",C);this.span.set("className",F);this.span.set("innerHTML",C);},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getNextPage());}};B.ui.PageLinks=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);
+C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("pageLinksContainerClassChange",this.rebuild,this);C.after("pageLinkClassChange",this.rebuild,this);C.after("currentPageClassChange",this.rebuild,this);C.after("pageLinksChange",this.rebuild,this);};B.ATTRS.pageLinksContainerClass={value:A.ClassNameManager.getClassName(B.NAME,"pages"),validator:A.Lang.isString};B.ATTRS.pageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"page"),validator:A.Lang.isString};B.ATTRS.currentPageClass={value:A.ClassNameManager.getClassName(B.NAME,"current-page"),validator:A.Lang.isString};B.ATTRS.pageLinks={value:10,validator:B.isNumeric};B.ATTRS.pageLabelBuilder={value:function(C,D){return C;},validator:A.Lang.isFunction};B.ui.PageLinks.calculateRange=function(E,F,D){var I=B.VALUE_UNLIMITED,H,C,G;if(!E||D===0||F===0||(F===I&&D===I)){return[0,-1];}if(F!==I){D=D===I?F:Math.min(D,F);}H=Math.max(1,Math.ceil(E-(D/2)));if(F===I){C=H+D-1;}else{C=Math.min(F,H+D-1);}G=D-(C-H+1);H=Math.max(1,H-G);return[H,C];};B.ui.PageLinks.prototype={current:0,container:null,destroy:function(){this.container.remove(true);this.container=null;},render:function(C){this.container=A.Node.create('<span id="'+C+'-pages"></span>');this.container.on("click",this.onClick,this);this.update({newVal:null,rebuild:true});return this.container;},update:function(J){if(J&&J.prevVal===J.newVal){return;}var E=this.paginator,I=E.getCurrentPage();if(this.current!==I||!I||J.rebuild){var L=E.get("pageLabelBuilder"),H=B.ui.PageLinks.calculateRange(I,E.getTotalPages(),E.get("pageLinks")),D=H[0],F=H[1],K="",C,G;C='<a href="#" class="'+E.get("pageLinkClass")+'" page="';for(G=D;G<=F;++G){if(G===I){K+='<span class="'+E.get("currentPageClass")+" "+E.get("pageLinkClass")+'">'+L(G,E)+"</span>";}else{K+=C+G+'">'+L(G,E)+"</a>";}}this.container.set("className",E.get("pageLinksContainerClass"));this.container.set("innerHTML",K);}},rebuild:function(C){C.rebuild=true;this.update(C);},onClick:function(D){var C=D.target;if(C&&C.hasClass(this.paginator.get("pageLinkClass"))){D.halt();this.paginator.setPage(parseInt(C.getAttribute("page"),10));}}};B.ui.PreviousPageLink=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("recordOffsetChange",this.update,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this.update,this);C.after("previousPageLinkLabelChange",this.update,this);C.after("previousPageLinkClassChange",this.update,this);};B.ATTRS.previousPageLinkClass={value:A.ClassNameManager.getClassName(B.NAME,"previous"),validator:A.Lang.isString};B.ATTRS.previousPageLinkLabel={value:"&lt; prev",validator:A.Lang.isString};B.ui.PreviousPageLink.prototype={current:null,link:null,span:null,destroy:function(){this.link.remove(true);this.span.remove(true);this.current=this.link=this.span=null;},render:function(D){var E=this.paginator,F=E.get("previousPageLinkClass"),C=E.get("previousPageLinkLabel");this.link=A.Node.create('<a href="#" id="'+D+'-prev-link">'+C+"</a>");this.link.set("className",F);this.link.on("click",this.onClick,this);this.span=A.Node.create('<span id="'+D+'-prev-span">'+C+"</span>");this.span.set("className",F);this.current=E.getCurrentPage()>1?this.link:this.span;return this.current;},update:function(D){if(D&&D.prevVal===D.newVal){return;}var C=this.current?this.current.get("parentNode"):null;if(this.paginator.getCurrentPage()>1){if(C&&this.current===this.span){C.replaceChild(this.link,this.current);this.current=this.link;}}else{if(C&&this.current===this.link){C.replaceChild(this.span,this.current);this.current=this.span;}}},onClick:function(C){C.halt();this.paginator.setPage(this.paginator.getPreviousPage());}};B.ui.RowsPerPageDropdown=function(C){this.paginator=C;C.on("destroy",this.destroy,this);C.after("rowsPerPageChange",this.update,this);C.after("totalRecordsChange",this._handleTotalRecordsChange,this);C.after("rowsPerPageDropdownClassChange",this.rebuild,this);C.after("rowsPerPageDropdownTitleChange",this.rebuild,this);C.after("rowsPerPageOptionsChange",this.rebuild,this);};B.ATTRS.rowsPerPageDropdownClass={value:A.ClassNameManager.getClassName(B.NAME,"rpp-options"),validator:A.Lang.isString};B.ATTRS.rowsPerPageDropdownTitle={value:"Rows per page",validator:A.Lang.isString};B.ATTRS.rowsPerPageOptions={value:[],validator:A.Lang.isArray};B.ui.RowsPerPageDropdown.prototype={select:null,all:null,destroy:function(){this.select.remove(true);this.all=this.select=null;},render:function(C){this.select=A.Node.create('<select id="'+C+'-rpp"></select>');this.select.on("change",this.onChange,this);this.rebuild();return this.select;},rebuild:function(K){var D=this.paginator,F=this.select,L=D.get("rowsPerPageOptions"),C=A.Node.getDOMNode(F).options,E,J,G,H,I;this.all=null;F.set("className",this.paginator.get("rowsPerPageDropdownClass"));F.set("title",this.paginator.get("rowsPerPageDropdownTitle"));for(H=0,I=L.length;H<I;++H){J=L[H];E=C[H]||F.appendChild(A.Node.create("<option/>"));G=A.Lang.isValue(J.value)?J.value:J;E.set("innerHTML",A.Lang.isValue(J.text)?J.text:J);if(A.Lang.isString(G)&&G.toLowerCase()==="all"){this.all=E;E.set("value",D.get("totalRecords"));}else{E.set("value",G);}}while(C.length>L.length){F.get("lastChild").remove();}this.update();},update:function(G){if(G&&G.prevVal===G.newVal){return;}var F=this.paginator.get("rowsPerPage")+"",D=A.Node.getDOMNode(this.select).options,E,C;for(E=0,C=D.length;E<C;++E){if(D[E].value===F){D[E].selected=true;break;}}},onChange:function(C){this.paginator.setRowsPerPage(parseInt(A.Node.getDOMNode(this.select).options[this.select.get("selectedIndex")].value,10));},_handleTotalRecordsChange:function(C){if(!this.all||(C&&C.prevVal===C.newVal)){return;}this.all.set("value",C.newVal);if(this.all.get("selected")){this.paginator.set("rowsPerPage",C.newVal);}}};},"gallery-2010.05.26-19-47",{requires:["widget","event-key","substitute"]});
View
41 build/gallery-paginator/gallery-paginator.js
@@ -1,15 +1,5 @@
YUI.add('gallery-paginator', function(Y) {
-/*
-Copyright (c) 2009, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.net/yui/license.txt
-*/
-
-Y.Node.DOM_EVENTS.key =
-{
- on: Y.Env.evt.plugins.key.on
-};
"use strict";
/*
Copyright (c) 2009, Yahoo! Inc. All rights reserved.
@@ -1431,6 +1421,9 @@ Paginator.ui.ItemRangeDropdown.prototype =
this.page_count = this.span.one('span.yui-item-count');
+ this.prev_page_count = -1;
+ this.prev_page_size = -1;
+ this.prev_rec_count = -1;
this.update();
return this.span;
@@ -1451,22 +1444,32 @@ Paginator.ui.ItemRangeDropdown.prototype =
var page = this.paginator.getCurrentPage();
var count = this.paginator.getTotalPages();
- var options = Y.Node.getDOMNode(this.menu).options;
+ var size = this.paginator.getRowsPerPage();
+ var recs = this.paginator.getTotalRecords();
- options.length = 0;
- for (var i=1; i<=count; i++)
+ if (count != this.prev_page_count ||
+ size != this.prev_page_size ||
+ recs != this.prev_rec_count)
{
- var range = this.paginator.getPageRecords(i);
+ var options = Y.Node.getDOMNode(this.menu).options;
+ options.length = 0;
- options[i-1] = new Option((range[0]+1) + ' - ' + (range[1]+1), i);
- if (i == page)
+ for (var i=1; i<=count; i++)
{
- this.menu.set('selectedIndex', i-1);
+ var range = this.paginator.getPageRecords(i);
+
+ options[i-1] = new Option((range[0]+1) + ' - ' + (range[1]+1), i);
}
+
+ this.page_count.set('innerHTML', recs);
+
+ this.prev_page_count = count;
+ this.prev_page_size = size;
+ this.prev_rec_count = recs;
}
this.span.set('className', this.paginator.get('itemRangeDropdownClass'));
- this.page_count.set('innerHTML', this.paginator.getTotalRecords());
+ this.menu.set('selectedIndex', page-1);
},
_onChange: function(e)
@@ -2436,4 +2439,4 @@ Paginator.ui.RowsPerPageDropdown.prototype = {
};
-}, 'gallery-2010.05.21-18-16' ,{requires:['widget','event-key','substitute']});
+}, 'gallery-2010.05.26-19-47' ,{requires:['widget','event-key','substitute']});

0 comments on commit 7701608

Please sign in to comment.