summaryrefslogtreecommitdiff
path: root/framework/Web
diff options
context:
space:
mode:
Diffstat (limited to 'framework/Web')
-rw-r--r--framework/Web/Javascripts/extended/base.js136
-rw-r--r--framework/Web/Javascripts/extended/builder.js24
-rw-r--r--framework/Web/Javascripts/extended/date.js151
-rw-r--r--framework/Web/Javascripts/extended/event.js109
-rw-r--r--framework/Web/Javascripts/extended/string.js171
-rw-r--r--framework/Web/Javascripts/extra/behaviour.js68
-rw-r--r--framework/Web/Javascripts/extra/getElementsBySelector.js176
-rw-r--r--framework/Web/Javascripts/extra/json.js340
-rw-r--r--framework/Web/Javascripts/js/compressed/prado.js184
-rw-r--r--framework/Web/Javascripts/js/debug/colorpicker.js119
-rw-r--r--framework/Web/Javascripts/js/debug/prado.js1105
-rw-r--r--framework/Web/Javascripts/prado/activecontrols.js196
-rw-r--r--framework/Web/Javascripts/prado/ajax.js427
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/background.png (renamed from framework/Web/Javascripts/colorpicker/background.png)bin14501 -> 14501 bytes
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/button.gif (renamed from framework/Web/Javascripts/colorpicker/button.gif)bin58 -> 58 bytes
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/colorpicker.js (renamed from framework/Web/Javascripts/colorpicker/colorpicker.js)0
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/default.css (renamed from framework/Web/Javascripts/colorpicker/default.css)0
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/hue.gif (renamed from framework/Web/Javascripts/colorpicker/hue.gif)bin2793 -> 2793 bytes
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/slider.gif (renamed from framework/Web/Javascripts/colorpicker/slider.gif)bin81 -> 81 bytes
-rwxr-xr-xframework/Web/Javascripts/prado/colorpicker/spacer.gif (renamed from framework/Web/Javascripts/colorpicker/spacer.gif)bin43 -> 43 bytes
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/target_black.gif (renamed from framework/Web/Javascripts/colorpicker/target_black.gif)bin56 -> 56 bytes
-rw-r--r--framework/Web/Javascripts/prado/colorpicker/target_white.gif (renamed from framework/Web/Javascripts/colorpicker/target_white.gif)bin56 -> 56 bytes
-rw-r--r--framework/Web/Javascripts/prado/controls/controls.js (renamed from framework/Web/Javascripts/prado/controls.js)143
-rw-r--r--framework/Web/Javascripts/prado/datepicker/calendar.png (renamed from framework/Web/Javascripts/datepicker/calendar.png)bin775 -> 775 bytes
-rw-r--r--framework/Web/Javascripts/prado/datepicker/datepicker.js (renamed from framework/Web/Javascripts/datepicker/datepicker.js)0
-rw-r--r--framework/Web/Javascripts/prado/datepicker/default.css (renamed from framework/Web/Javascripts/datepicker/default.css)0
-rwxr-xr-xframework/Web/Javascripts/prado/datepicker/spacer.gif (renamed from framework/Web/Javascripts/datepicker/spacer.gif)bin43 -> 43 bytes
-rw-r--r--framework/Web/Javascripts/prado/element.js163
-rw-r--r--framework/Web/Javascripts/prado/form.js209
-rw-r--r--framework/Web/Javascripts/prado/logger/logger.js (renamed from framework/Web/Javascripts/extra/logger.js)0
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks.css (renamed from framework/Web/Javascripts/ratings/blocks.css)0
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks.png (renamed from framework/Web/Javascripts/ratings/blocks.png)bin29885 -> 29885 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks_blank.gif (renamed from framework/Web/Javascripts/ratings/blocks_blank.gif)bin72 -> 72 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks_half.gif (renamed from framework/Web/Javascripts/ratings/blocks_half.gif)bin94 -> 94 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks_hover.gif (renamed from framework/Web/Javascripts/ratings/blocks_hover.gif)bin75 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/blocks_selected.gif (renamed from framework/Web/Javascripts/ratings/blocks_selected.gif)bin75 -> 75 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/default.css (renamed from framework/Web/Javascripts/ratings/default.css)0
-rw-r--r--framework/Web/Javascripts/prado/ratings/default_blank.gif (renamed from framework/Web/Javascripts/ratings/default_blank.gif)bin271 -> 271 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/default_half.gif (renamed from framework/Web/Javascripts/ratings/default_half.gif)bin619 -> 619 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/default_hover.gif (renamed from framework/Web/Javascripts/ratings/default_hover.gif)bin618 -> 618 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/default_selected.gif (renamed from framework/Web/Javascripts/ratings/default_selected.gif)bin614 -> 614 bytes
-rw-r--r--framework/Web/Javascripts/prado/ratings/ratings.js (renamed from framework/Web/Javascripts/ratings/ratings.js)0
-rw-r--r--framework/Web/Javascripts/prado/ratings/stars1.png (renamed from framework/Web/Javascripts/ratings/stars1.png)bin53016 -> 53016 bytes
-rw-r--r--framework/Web/Javascripts/prado/scriptaculous-adapter.js811
-rw-r--r--framework/Web/Javascripts/prado/validator/validation3.js (renamed from framework/Web/Javascripts/prado/validation3.js)0
-rw-r--r--framework/Web/Javascripts/rico/colors.js242
-rw-r--r--framework/Web/Javascripts/rico/extension.js175
-rw-r--r--framework/Web/Javascripts/rico/rico.js3326
-rw-r--r--framework/Web/Javascripts/scriptaculous/CHANGELOG (renamed from framework/Web/Javascripts/effects/CHANGELOG)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/MIT-LICENSE (renamed from framework/Web/Javascripts/effects/MIT-LICENSE)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/README (renamed from framework/Web/Javascripts/effects/README)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/builder.js (renamed from framework/Web/Javascripts/effects/builder.js)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/controls.js (renamed from framework/Web/Javascripts/effects/controls.js)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/dragdrop.js (renamed from framework/Web/Javascripts/effects/dragdrop.js)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/effects.js (renamed from framework/Web/Javascripts/effects/effects.js)0
-rw-r--r--framework/Web/Javascripts/scriptaculous/slider.js (renamed from framework/Web/Javascripts/effects/slider.js)0
56 files changed, 1516 insertions, 6759 deletions
diff --git a/framework/Web/Javascripts/extended/base.js b/framework/Web/Javascripts/extended/base.js
deleted file mode 100644
index 251882cd..00000000
--- a/framework/Web/Javascripts/extended/base.js
+++ /dev/null
@@ -1,136 +0,0 @@
-
-/**
- * Similar to bindAsEventLister, but takes additional arguments.
- */
-Function.prototype.bindEvent = function()
-{
- var __method = this, args = $A(arguments), object = args.shift();
- return function(event)
- {
- return __method.apply(object, [event || window.event].concat(args));
- }
-}
-
-/**
- * Creates a new function by copying function definition from
- * the <tt>base</tt> and optional <tt>definition</tt>.
- * @param function a base function to copy from.
- * @param array additional definition
- * @param function return a new function with definition from both
- * <tt>base</tt> and <tt>definition</tt>.
- */
-Class.extend = function(base, definition)
-{
- var component = Class.create();
- Object.extend(component.prototype, base.prototype);
- if(definition)
- Object.extend(component.prototype, definition);
- return component;
-}
-
-/*
- Base, version 1.0.2
- Copyright 2006, Dean Edwards
- License: http://creativecommons.org/licenses/LGPL/2.1/
-*/
-
-var Base = function() {
- if (arguments.length) {
- if (this == window) { // cast an object to this class
- Base.prototype.extend.call(arguments[0], arguments.callee.prototype);
- } else {
- this.extend(arguments[0]);
- }
- }
-};
-
-Base.version = "1.0.2";
-
-Base.prototype = {
- extend: function(source, value) {
- var extend = Base.prototype.extend;
- if (arguments.length == 2) {
- var ancestor = this[source];
- // overriding?
- if ((ancestor instanceof Function) && (value instanceof Function) &&
- ancestor.valueOf() != value.valueOf() && /\bbase\b/.test(value)) {
- var method = value;
- // var _prototype = this.constructor.prototype;
- // var fromPrototype = !Base._prototyping && _prototype[source] == ancestor;
- value = function() {
- var previous = this.base;
- // this.base = fromPrototype ? _prototype[source] : ancestor;
- this.base = ancestor;
- var returnValue = method.apply(this, arguments);
- this.base = previous;
- return returnValue;
- };
- // point to the underlying method
- value.valueOf = function() {
- return method;
- };
- value.toString = function() {
- return String(method);
- };
- }
- return this[source] = value;
- } else if (source) {
- var _prototype = {toSource: null};
- // do the "toString" and other methods manually
- var _protected = ["toString", "valueOf"];
- // if we are prototyping then include the constructor
- if (Base._prototyping) _protected[2] = "constructor";
- for (var i = 0; (name = _protected[i]); i++) {
- if (source[name] != _prototype[name]) {
- extend.call(this, name, source[name]);
- }
- }
- // copy each of the source object's properties to this object
- for (var name in source) {
- if (!_prototype[name]) {
- extend.call(this, name, source[name]);
- }
- }
- }
- return this;
- },
-
- base: function() {
- // call this method from any other method to invoke that method's ancestor
- }
-};
-
-Base.extend = function(_instance, _static) {
- var extend = Base.prototype.extend;
- if (!_instance) _instance = {};
- // build the prototype
- Base._prototyping = true;
- var _prototype = new this;
- extend.call(_prototype, _instance);
- var constructor = _prototype.constructor;
- _prototype.constructor = this;
- delete Base._prototyping;
- // create the wrapper for the constructor function
- var klass = function() {
- if (!Base._prototyping) constructor.apply(this, arguments);
- this.constructor = klass;
- };
- klass.prototype = _prototype;
- // build the class interface
- klass.extend = this.extend;
- klass.implement = this.implement;
- klass.toString = function() {
- return String(constructor);
- };
- extend.call(klass, _static);
- // single instance
- var object = constructor ? klass : _prototype;
- // class initialisation
- if (object.init instanceof Function) object.init();
- return object;
-};
-
-Base.implement = function(_interface) {
- if (_interface instanceof Function) _interface = _interface.prototype;
- this.prototype.extend(_interface);
-};
diff --git a/framework/Web/Javascripts/extended/builder.js b/framework/Web/Javascripts/extended/builder.js
deleted file mode 100644
index c50fc6c6..00000000
--- a/framework/Web/Javascripts/extended/builder.js
+++ /dev/null
@@ -1,24 +0,0 @@
-
-Object.extend(Builder,
-{
- exportTags:function()
- {
- var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG", "CAPTION"];
- tags.each(function(tag)
- {
- window[tag]=function()
- {
- var args=$A(arguments);
- if(args.length==0)
- return Builder.node(tag,null);
- if(args.length==1)
- return Builder.node(tag,args[0]);
- if(args.length>1)
- return Builder.node(tag,args.shift(),args);
-
- };
- });
- }
-});
-
-Builder.exportTags();
diff --git a/framework/Web/Javascripts/extended/date.js b/framework/Web/Javascripts/extended/date.js
deleted file mode 100644
index b27f9da2..00000000
--- a/framework/Web/Javascripts/extended/date.js
+++ /dev/null
@@ -1,151 +0,0 @@
-
-Object.extend(Date.prototype,
-{
- SimpleFormat: function(format, data)
- {
- data = data || {};
- var bits = new Array();
- bits['d'] = this.getDate();
- bits['dd'] = String(this.getDate()).zerofill(2);
-
- bits['M'] = this.getMonth()+1;
- bits['MM'] = String(this.getMonth()+1).zerofill(2);
- if(data.AbbreviatedMonthNames)
- bits['MMM'] = data.AbbreviatedMonthNames[this.getMonth()];
- if(data.MonthNames)
- bits['MMMM'] = data.MonthNames[this.getMonth()];
- var yearStr = "" + this.getFullYear();
- yearStr = (yearStr.length == 2) ? '19' + yearStr: yearStr;
- bits['yyyy'] = yearStr;
- bits['yy'] = bits['yyyy'].toString().substr(2,2);
-
- // do some funky regexs to replace the format string
- // with the real values
- var frm = new String(format);
- for (var sect in bits)
- {
- var reg = new RegExp("\\b"+sect+"\\b" ,"g");
- frm = frm.replace(reg, bits[sect]);
- }
- return frm;
- },
-
- toISODate : function()
- {
- var y = this.getFullYear();
- var m = String(this.getMonth() + 1).zerofill(2);
- var d = String(this.getDate()).zerofill(2);
- return String(y) + String(m) + String(d);
- }
-});
-
-Object.extend(Date,
-{
- SimpleParse: function(value, format)
- {
- val=String(value);
- format=String(format);
-
- if(val.length <= 0) return null;
-
- if(format.length <= 0) return new Date(value);
-
- var isInteger = function (val)
- {
- var digits="1234567890";
- for (var i=0; i < val.length; i++)
- {
- if (digits.indexOf(val.charAt(i))==-1) { return false; }
- }
- return true;
- };
-
- var getInt = function(str,i,minlength,maxlength)
- {
- for (var x=maxlength; x>=minlength; x--)
- {
- var token=str.substring(i,i+x);
- if (token.length < minlength) { return null; }
- if (isInteger(token)) { return token; }
- }
- return null;
- };
-
- var i_val=0;
- var i_format=0;
- var c="";
- var token="";
- var token2="";
- var x,y;
- var now=new Date();
- var year=now.getFullYear();
- var month=now.getMonth()+1;
- var date=1;
-
- while (i_format < format.length)
- {
- // Get next token from format string
- c=format.charAt(i_format);
- token="";
- while ((format.charAt(i_format)==c) && (i_format < format.length))
- {
- token += format.charAt(i_format++);
- }
-
- // Extract contents of value based on format token
- if (token=="yyyy" || token=="yy" || token=="y")
- {
- if (token=="yyyy") { x=4;y=4; }
- if (token=="yy") { x=2;y=2; }
- if (token=="y") { x=2;y=4; }
- year=getInt(val,i_val,x,y);
- if (year==null) { return null; }
- i_val += year.length;
- if (year.length==2)
- {
- if (year > 70) { year=1900+(year-0); }
- else { year=2000+(year-0); }
- }
- }
-
- else if (token=="MM"||token=="M")
- {
- month=getInt(val,i_val,token.length,2);
- if(month==null||(month<1)||(month>12)){return null;}
- i_val+=month.length;
- }
- else if (token=="dd"||token=="d")
- {
- date=getInt(val,i_val,token.length,2);
- if(date==null||(date<1)||(date>31)){return null;}
- i_val+=date.length;
- }
- else
- {
- if (val.substring(i_val,i_val+token.length)!=token) {return null;}
- else {i_val+=token.length;}
- }
- }
-
- // If there are any trailing characters left in the value, it doesn't match
- if (i_val != val.length) { return null; }
-
- // Is date valid for month?
- if (month==2)
- {
- // Check for leap year
- if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
- if (date > 29){ return null; }
- }
- else { if (date > 28) { return null; } }
- }
-
- if ((month==4)||(month==6)||(month==9)||(month==11))
- {
- if (date > 30) { return null; }
- }
-
- var newdate=new Date(year,month-1,date, 0, 0, 0);
- return newdate;
- }
-}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
deleted file mode 100644
index e464fa94..00000000
--- a/framework/Web/Javascripts/extended/event.js
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * @class Event extensions.
- */
-Object.extend(Event,
-{
- /**
- * Register a function to be executed when the page is loaded.
- * Note that the page is only loaded if all resources (e.g. images)
- * are loaded.
- *
- * Example: Show an alert box with message "Page Loaded!" when the
- * page finished loading.
- * <code>
- * Event.OnLoad(function(){ alert("Page Loaded!"); });
- * </code>
- *
- * @param {Function} function to execute when page is loaded.
- */
- OnLoad : function (fn)
- {
- // opera onload is in document, not window
- var w = document.addEventListener &&
- !window.addEventListener ? document : window;
- Event.observe(w,'load',fn);
- },
-
- /**
- * @param {Event} a keyboard event
- * @return {Number} the Unicode character code generated by the key
- * that was struck.
- */
- keyCode : function(e)
- {
- return e.keyCode != null ? e.keyCode : e.charCode
- },
-
- /**
- * @param {String} event type or event name.
- * @return {Boolean} true if event type is of HTMLEvent, false
- * otherwise
- */
- isHTMLEvent : function(type)
- {
- var events = ['abort', 'blur', 'change', 'error', 'focus',
- 'load', 'reset', 'resize', 'scroll', 'select',
- 'submit', 'unload'];
- return events.include(type);
- },
-
- /**
- * @param {String} event type or event name
- * @return {Boolean} true if event type is of MouseEvent,
- * false otherwise
- */
- isMouseEvent : function(type)
- {
- var events = ['click', 'mousedown', 'mousemove', 'mouseout',
- 'mouseover', 'mouseup'];
- return events.include(type);
- },
-
- /**
- * Dispatch the DOM event of a given <tt>type</tt> on a DOM
- * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
- * dispatched, keyboard events or UIEvent can not be dispatch
- * via javascript consistently.
- * For the "submit" event the submit() method is called.
- * @param {Object} element id string or a DOM element.
- * @param {String} event type to dispatch.
- */
- fireEvent : function(element,type)
- {
- element = $(element);
- if(type == "submit")
- return element.submit();
- if(document.createEvent)
- {
- if(Event.isHTMLEvent(type))
- {
- var event = document.createEvent('HTMLEvents');
- event.initEvent(type, true, true);
- }
- else if(Event.isMouseEvent(type))
- {
- var event = document.createEvent('MouseEvents');
- if (event.initMouseEvent)
- {
- event.initMouseEvent(type,true,true,
- document.defaultView, 1, 0, 0, 0, 0, false,
- false, false, false, 0, null);
- }
- else
- {
- // Safari
- // TODO we should be initialising other mouse-event related attributes here
- event.initEvent(type, true, true);
- }
- }
- element.dispatchEvent(event);
- }
- else if(document.createEventObject)
- {
- var evObj = document.createEventObject();
- element.fireEvent('on'+type, evObj);
- }
- else if(typeof(element['on'+type]) == "function")
- element['on'+type]();
- }
-}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/extended/string.js b/framework/Web/Javascripts/extended/string.js
deleted file mode 100644
index 5cd1bd8e..00000000
--- a/framework/Web/Javascripts/extended/string.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * @class String extensions
- */
-Object.extend(String.prototype, {
- /**
- * @param {String} "left" to pad the string on the left, "right" to pad right.
- * @param {Number} minimum string length.
- * @param {String} character(s) to pad
- * @return {String} padded character(s) on the left or right to satisfy minimum string length
- */
-
- pad : function(side, len, chr) {
- if (!chr) chr = ' ';
- var s = this;
- var left = side.toLowerCase()=='left';
- while (s.length<len) s = left? chr + s : s + chr;
- return s;
- },
-
- /**
- * @param {Number} minimum string length.
- * @param {String} character(s) to pad
- * @return {String} padded character(s) on the left to satisfy minimum string length
- */
- padLeft : function(len, chr) {
- return this.pad('left',len,chr);
- },
-
- /**
- * @param {Number} minimum string length.
- * @param {String} character(s) to pad
- * @return {String} padded character(s) on the right to satisfy minimum string length
- */
- padRight : function(len, chr) {
- return this.pad('right',len,chr);
- },
-
- /**
- * @param {Number} minimum string length.
- * @return {String} append zeros to the left to satisfy minimum string length.
- */
- zerofill : function(len) {
- return this.padLeft(len,'0');
- },
-
- /**
- * @return {String} removed white spaces from both ends.
- */
- trim : function() {
- return this.replace(/^\s+|\s+$/g,'');
- },
-
- /**
- * @return {String} removed white spaces from the left end.
- */
- trimLeft : function() {
- return this.replace(/^\s+/,'');
- },
-
- /**
- * @return {String} removed white spaces from the right end.
- */
- trimRight : function() {
- return this.replace(/\s+$/,'');
- },
-
- /**
- * Convert period separated function names into a function reference.
- * e.g. "Prado.AJAX.Callback.Action.setValue".toFunction() will return
- * the actual function Prado.AJAX.Callback.Action.setValue()
- * @return {Function} the corresponding function represented by the string.
- */
- toFunction : function()
- {
- var commands = this.split(/\./);
- var command = window;
- commands.each(function(action)
- {
- if(command[new String(action)])
- command=command[new String(action)];
- });
- if(typeof(command) == "function")
- return command;
- else
- {
- if(typeof Logger != "undefined")
- Logger.error("Missing function", this);
-
- throw new Error ("Missing function '"+this+"'");
- }
- },
-
- /**
- * Convert a string into integer, returns null if not integer.
- * @return {Number} null if string does not represent an integer.
- */
- toInteger : function()
- {
- var exp = /^\s*[-\+]?\d+\s*$/;
- if (this.match(exp) == null)
- return null;
- var num = parseInt(this, 10);
- return (isNaN(num) ? null : num);
- },
-
- /**
- * Convert a string into a double/float value. <b>Internationalization
- * is not supported</b>
- * @param {String} the decimal character
- * @return {Double} null if string does not represent a float value
- */
- toDouble : function(decimalchar)
- {
- if(this.length <= 0) return null;
- decimalchar = decimalchar || ".";
- var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
- var m = this.match(exp);
-
- if (m == null)
- return null;
- m[1] = m[1] || "";
- m[2] = m[2] || "0";
- m[4] = m[4] || "0";
-
- var cleanInput = m[1] + (m[2].length>0 ? m[2] : "0") + "." + m[4];
- var num = parseFloat(cleanInput);
- return (isNaN(num) ? null : num);
- },
-
- /**
- * Convert strings that represent a currency value (e.g. a float with grouping
- * characters) to float. E.g. "10,000.50" will become "10000.50". The number
- * of dicimal digits, grouping and decimal characters can be specified.
- * <i>The currency input format is <b>very</b> strict, null will be returned if
- * the pattern does not match</i>.
- * @param {String} the grouping character, default is ","
- * @param {Number} number of decimal digits
- * @param {String} the decimal character, default is "."
- * @type {Double} the currency value as float.
- */
- toCurrency : function(groupchar, digits, decimalchar)
- {
- groupchar = groupchar || ",";
- decimalchar = decimalchar || ".";
- digits = typeof(digits) == "undefined" ? 2 : digits;
-
- var exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
- + ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
- + "\\s*$");
- var m = this.match(exp);
- if (m == null)
- return null;
- var intermed = m[2] + m[5] ;
- var cleanInput = m[1] + intermed.replace(
- new RegExp("(\\" + groupchar + ")", "g"), "")
- + ((digits > 0) ? "." + m[7] : "");
- var num = parseFloat(cleanInput);
- return (isNaN(num) ? null : num);
- },
-
- /**
- * Converts the string to a date by finding values that matches the
- * date format pattern.
- * @param string date format pattern, e.g. MM-dd-yyyy
- * @return {Date} the date extracted from the string
- */
- toDate : function(format)
- {
- return Date.SimpleParse(this, format);
- }
-}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/extra/behaviour.js b/framework/Web/Javascripts/extra/behaviour.js
deleted file mode 100644
index ac9adeda..00000000
--- a/framework/Web/Javascripts/extra/behaviour.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- Behaviour v1.1 by Ben Nolan, June 2005. Based largely on the work
- of Simon Willison (see comments by Simon below).
-
- Description:
-
- Uses css selectors to apply javascript behaviours to enable
- unobtrusive javascript in html documents.
-
- Usage:
-
- var myrules = {
- 'b.someclass' : function(element){
- element.onclick = function(){
- alert(this.innerHTML);
- }
- },
- '#someid u' : function(element){
- element.onmouseover = function(){
- this.innerHTML = "BLAH!";
- }
- }
- };
-
- Behaviour.register(myrules);
-
- // Call Behaviour.apply() to re-apply the rules (if you
- // update the dom, etc).
-
- License:
-
- This file is entirely BSD licensed.
-
- More information:
-
- http://ripcord.co.nz/behaviour/
-
-*/
-
-var Behaviour = {
- list : new Array,
-
- register : function(sheet){
- Behaviour.list.push(sheet);
- },
-
- start : function(){
- Event.OnLoad(Behaviour.apply);
- },
-
- apply : function(){
- for (h=0;sheet=Behaviour.list[h];h++){
- for (selector in sheet){
- list = document.getElementsBySelector(selector);
-
- if (!list){
- continue;
- }
-
- for (i=0;element=list[i];i++){
- sheet[selector](element);
- }
- }
- }
- }
-}
-
-Behaviour.start(); \ No newline at end of file
diff --git a/framework/Web/Javascripts/extra/getElementsBySelector.js b/framework/Web/Javascripts/extra/getElementsBySelector.js
deleted file mode 100644
index 592872fc..00000000
--- a/framework/Web/Javascripts/extra/getElementsBySelector.js
+++ /dev/null
@@ -1,176 +0,0 @@
-/** document.getElementsBySelector(selector)
- - returns an array of element objects from the current document
- matching the CSS selector. Selectors can contain element names,
- class names and ids and can be nested. For example:
-
- elements = document.getElementsBySelect('div#main p a.external')
-
- Will return an array of all 'a' elements with 'external' in their
- class attribute that are contained inside 'p' elements that are
- contained inside the 'div' element which has id="main"
-
- New in version 0.4: Support for CSS2 and CSS3 attribute selectors:
- See http://www.w3.org/TR/css3-selectors/#attribute-selectors
-
- Version 0.4 - Simon Willison, March 25th 2003
- -- Works in Phoenix 0.5, Mozilla 1.3, Opera 7, Internet Explorer 6, Internet Explorer 5 on Windows
- -- Opera 7 fails
-*/
-
-/**
- * Returns all children of element. Workaround required for IE5/Windo
- */
-function getAllChildren(e) {
- // Returns all children of element. Workaround required for IE5/Windows. Ugh.
- return e.all ? e.all : e.getElementsByTagName('*');
-}
-
-/**
- * returns an array of element objects from the current document
- matching the CSS selector. Selectors can contain element names,
- class names and ids and can be nested. For example:
-
- <pre><tt>elements = $CSS('div#main p a.external')</tt></pre>
-
- Will return an array of all 'a' elements with 'external' in their
- class attribute that are contained inside 'p' elements that are
- contained inside the 'div' element which has id="main"
- */
-$CSS = function(selector) {
- // Attempt to fail gracefully in lesser browsers
- if (!document.getElementsByTagName) {
- return new Array();
- }
- // Split selector in to tokens
- var tokens = selector.split(' ');
- var currentContext = new Array(document);
- for (var i = 0; i < tokens.length; i++) {
- token = tokens[i].replace(/^\s+/,'').replace(/\s+$/,'');;
- if (token.indexOf('#') > -1) {
- // Token is an ID selector
- var bits = token.split('#');
- var tagName = bits[0];
- var id = bits[1];
- var element = document.getElementById(id);
- if (tagName && element.nodeName.toLowerCase() != tagName) {
- // tag with that ID not found, return false
- return new Array();
- }
- // Set currentContext to contain just this element
- currentContext = new Array(element);
- continue; // Skip to next token
- }
- if (token.indexOf('.') > -1) {
- // Token contains a class selector
- var bits = token.split('.');
- var tagName = bits[0];
- var className = bits[1];
- if (!tagName) {
- tagName = '*';
- }
- // Get elements matching tag, filter them for class selector
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- elements = currentContext[h].getElementsByTagName(tagName);
- }
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (found[k].className && found[k].className.match(new RegExp('\\b'+className+'\\b'))) {
- currentContext[currentContextIndex++] = found[k];
- }
- }
- continue; // Skip to next token
- }
- // Code to deal with attribute selectors
- if (token.match(/^(\w*)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/)) {
- var tagName = RegExp.$1;
- var attrName = RegExp.$2;
- var attrOperator = RegExp.$3;
- var attrValue = RegExp.$4;
- if (!tagName) {
- tagName = '*';
- }
- // Grab all of the tagName elements within current context
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements;
- if (tagName == '*') {
- elements = getAllChildren(currentContext[h]);
- } else {
- elements = currentContext[h].getElementsByTagName(tagName);
- }
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- var checkFunction; // This function will be used to filter the elements
- switch (attrOperator) {
- case '=': // Equality
- checkFunction = function(e) { return (e.getAttribute(attrName) == attrValue); };
- break;
- case '~': // Match one of space seperated words
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('\\b'+attrValue+'\\b'))); };
- break;
- case '|': // Match start with value followed by optional hyphen
- checkFunction = function(e) { return (e.getAttribute(attrName).match(new RegExp('^'+attrValue+'-?'))); };
- break;
- case '^': // Match starts with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) == 0); };
- break;
- case '$': // Match ends with value - fails with "Warning" in Opera 7
- checkFunction = function(e) { return (e.getAttribute(attrName).lastIndexOf(attrValue) == e.getAttribute(attrName).length - attrValue.length); };
- break;
- case '*': // Match ends with value
- checkFunction = function(e) { return (e.getAttribute(attrName).indexOf(attrValue) > -1); };
- break;
- default :
- // Just test for existence of attribute
- checkFunction = function(e) { return e.getAttribute(attrName); };
- }
- currentContext = new Array;
- var currentContextIndex = 0;
- for (var k = 0; k < found.length; k++) {
- if (checkFunction(found[k])) {
- currentContext[currentContextIndex++] = found[k];
- }
- }
- // alert('Attribute Selector: '+tagName+' '+attrName+' '+attrOperator+' '+attrValue);
- continue; // Skip to next token
- }
- // If we get here, token is JUST an element (not a class or ID selector)
- tagName = token;
- var found = new Array;
- var foundCount = 0;
- for (var h = 0; h < currentContext.length; h++) {
- var elements = currentContext[h].getElementsByTagName(tagName);
- for (var j = 0; j < elements.length; j++) {
- found[foundCount++] = elements[j];
- }
- }
- currentContext = found;
- }
- return currentContext;
-}
-
-/* That revolting regular expression explained
-/^(\w+)\[(\w+)([=~\|\^\$\*]?)=?"?([^\]"]*)"?\]$/
- \---/ \---/\-------------/ \-------/
- | | | |
- | | | The value
- | | ~,|,^,$,* or =
- | Attribute
- Tag
-*/
diff --git a/framework/Web/Javascripts/extra/json.js b/framework/Web/Javascripts/extra/json.js
deleted file mode 100644
index 0981169d..00000000
--- a/framework/Web/Javascripts/extra/json.js
+++ /dev/null
@@ -1,340 +0,0 @@
-/*
-Copyright (c) 2005 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-*/
-
-Array.prototype.______array = '______array';
-
-Prado.AJAX.JSON = {
- org: 'http://www.JSON.org',
- copyright: '(c)2005 JSON.org',
- license: 'http://www.crockford.com/JSON/license.html',
-
- stringify: function (arg) {
- var c, i, l, s = '', v;
-
- switch (typeof arg) {
- case 'object':
- if (arg) {
- if (arg.______array == '______array') {
- for (i = 0; i < arg.length; ++i) {
- v = this.stringify(arg[i]);
- if (s) {
- s += ',';
- }
- s += v;
- }
- return '[' + s + ']';
- } else if (typeof arg.toString != 'undefined') {
- for (i in arg) {
- v = arg[i];
- if (typeof v != 'undefined' && typeof v != 'function') {
- v = this.stringify(v);
- if (s) {
- s += ',';
- }
- s += this.stringify(i) + ':' + v;
- }
- }
- return '{' + s + '}';
- }
- }
- return 'null';
- case 'number':
- return isFinite(arg) ? String(arg) : 'null';
- case 'string':
- l = arg.length;
- s = '"';
- for (i = 0; i < l; i += 1) {
- c = arg.charAt(i);
- if (c >= ' ') {
- if (c == '\\' || c == '"') {
- s += '\\';
- }
- s += c;
- } else {
- switch (c) {
- case '\b':
- s += '\\b';
- break;
- case '\f':
- s += '\\f';
- break;
- case '\n':
- s += '\\n';
- break;
- case '\r':
- s += '\\r';
- break;
- case '\t':
- s += '\\t';
- break;
- default:
- c = c.charCodeAt();
- s += '\\u00' + Math.floor(c / 16).toString(16) +
- (c % 16).toString(16);
- }
- }
- }
- return s + '"';
- case 'boolean':
- return String(arg);
- default:
- return 'null';
- }
- },
- parse: function (text) {
- var at = 0;
- var ch = ' ';
-
- function error(m) {
- throw {
- name: 'JSONError',
- message: m,
- at: at - 1,
- text: text
- };
- }
-
- function next() {
- ch = text.charAt(at);
- at += 1;
- return ch;
- }
-
- function white() {
- while (ch) {
- if (ch <= ' ') {
- next();
- } else if (ch == '/') {
- switch (next()) {
- case '/':
- while (next() && ch != '\n' && ch != '\r') {}
- break;
- case '*':
- next();
- for (;;) {
- if (ch) {
- if (ch == '*') {
- if (next() == '/') {
- next();
- break;
- }
- } else {
- next();
- }
- } else {
- error("Unterminated comment");
- }
- }
- break;
- default:
- error("Syntax error");
- }
- } else {
- break;
- }
- }
- }
-
- function string() {
- var i, s = '', t, u;
-
- if (ch == '"') {
-outer: while (next()) {
- if (ch == '"') {
- next();
- return s;
- } else if (ch == '\\') {
- switch (next()) {
- case 'b':
- s += '\b';
- break;
- case 'f':
- s += '\f';
- break;
- case 'n':
- s += '\n';
- break;
- case 'r':
- s += '\r';
- break;
- case 't':
- s += '\t';
- break;
- case 'u':
- u = 0;
- for (i = 0; i < 4; i += 1) {
- t = parseInt(next(), 16);
- if (!isFinite(t)) {
- break outer;
- }
- u = u * 16 + t;
- }
- s += String.fromCharCode(u);
- break;
- default:
- s += ch;
- }
- } else {
- s += ch;
- }
- }
- }
- error("Bad string");
- }
-
- function array() {
- var a = [];
-
- if (ch == '[') {
- next();
- white();
- if (ch == ']') {
- next();
- return a;
- }
- while (ch) {
- a.push(value());
- white();
- if (ch == ']') {
- next();
- return a;
- } else if (ch != ',') {
- break;
- }
- next();
- white();
- }
- }
- error("Bad array");
- }
-
- function object() {
- var k, o = {};
-
- if (ch == '{') {
- next();
- white();
- if (ch == '}') {
- next();
- return o;
- }
- while (ch) {
- k = string();
- white();
- if (ch != ':') {
- break;
- }
- next();
- o[k] = value();
- white();
- if (ch == '}') {
- next();
- return o;
- } else if (ch != ',') {
- break;
- }
- next();
- white();
- }
- }
- error("Bad object");
- }
-
- function number() {
- var n = '', v;
- if (ch == '-') {
- n = '-';
- next();
- }
- while (ch >= '0' && ch <= '9') {
- n += ch;
- next();
- }
- if (ch == '.') {
- n += '.';
- while (next() && ch >= '0' && ch <= '9') {
- n += ch;
- }
- }
- if (ch == 'e' || ch == 'E') {
- n += 'e';
- next();
- if (ch == '-' || ch == '+') {
- n += ch;
- next();
- }
- while (ch >= '0' && ch <= '9') {
- n += ch;
- next();
- }
- }
- v = +n;
- if (!isFinite(v)) {
- ////error("Bad number");
- } else {
- return v;
- }
- }
-
- function word() {
- switch (ch) {
- case 't':
- if (next() == 'r' && next() == 'u' && next() == 'e') {
- next();
- return true;
- }
- break;
- case 'f':
- if (next() == 'a' && next() == 'l' && next() == 's' &&
- next() == 'e') {
- next();
- return false;
- }
- break;
- case 'n':
- if (next() == 'u' && next() == 'l' && next() == 'l') {
- next();
- return null;
- }
- break;
- }
- error("Syntax error");
- }
-
- function value() {
- white();
- switch (ch) {
- case '{':
- return object();
- case '[':
- return array();
- case '"':
- return string();
- case '-':
- return number();
- default:
- return ch >= '0' && ch <= '9' ? number() : word();
- }
- }
-
- return value();
- }
-}; \ No newline at end of file
diff --git a/framework/Web/Javascripts/js/compressed/prado.js b/framework/Web/Javascripts/js/compressed/prado.js
index 6fadd8de..df87ac8f 100644
--- a/framework/Web/Javascripts/js/compressed/prado.js
+++ b/framework/Web/Javascripts/js/compressed/prado.js
@@ -250,7 +250,12 @@ if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));});}else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));}});}}
-Function.prototype.bindEvent=function()
+var Prado={Version:'3.0.0',Browser:function()
+{var info={Version:"1.0"};var is_major=parseInt(navigator.appVersion);info.nver=is_major;info.ver=navigator.appVersion;info.agent=navigator.userAgent;info.dom=document.getElementById?1:0;info.opera=window.opera?1:0;info.ie5=(info.ver.indexOf("MSIE 5")>-1&&info.dom&&!info.opera)?1:0;info.ie6=(info.ver.indexOf("MSIE 6")>-1&&info.dom&&!info.opera)?1:0;info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;info.ie=info.ie4||info.ie5||info.ie6;info.mac=info.agent.indexOf("Mac")>-1;info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;info.ie3=(info.ver.indexOf("MSIE")&&(is_major<4));info.hotjava=(info.agent.toLowerCase().indexOf('hotjava')!=-1)?1:0;info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);info.ver3=(info.hotjava||info.ie3);info.opera7=((info.agent.toLowerCase().indexOf('opera 7')>-1)||(info.agent.toLowerCase().indexOf('opera/7')>-1));info.operaOld=info.opera&&!info.opera7;return info;},ImportCss:function(doc,css_file)
+{if(Prado.Browser().ie)
+var styleSheet=doc.createStyleSheet(css_file);else
+{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))
+headArr[0].appendChild(elm);}}};Function.prototype.bindEvent=function()
{var __method=this,args=$A(arguments),object=args.shift();return function(event)
{return __method.apply(object,[event||window.event].concat(args));}}
Class.extend=function(base,definition)
@@ -259,7 +264,65 @@ Object.extend(component.prototype,definition);return component;}
var Base=function(){if(arguments.length){if(this==window){Base.prototype.extend.call(arguments[0],arguments.callee.prototype);}else{this.extend(arguments[0]);}}};Base.version="1.0.2";Base.prototype={extend:function(source,value){var extend=Base.prototype.extend;if(arguments.length==2){var ancestor=this[source];if((ancestor instanceof Function)&&(value instanceof Function)&&ancestor.valueOf()!=value.valueOf()&&/\bbase\b/.test(value)){var method=value;value=function(){var previous=this.base;this.base=ancestor;var returnValue=method.apply(this,arguments);this.base=previous;return returnValue;};value.valueOf=function(){return method;};value.toString=function(){return String(method);};}
return this[source]=value;}else if(source){var _prototype={toSource:null};var _protected=["toString","valueOf"];if(Base._prototyping)_protected[2]="constructor";for(var i=0;(name=_protected[i]);i++){if(source[name]!=_prototype[name]){extend.call(this,name,source[name]);}}
for(var name in source){if(!_prototype[name]){extend.call(this,name,source[name]);}}}
-return this;},base:function(){}};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;if(!_instance)_instance={};Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete Base._prototyping;var klass=function(){if(!Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;if(object.init instanceof Function)object.init();return object;};Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};Object.extend(String.prototype,{pad:function(side,len,chr){if(!chr)chr=' ';var s=this;var left=side.toLowerCase()=='left';while(s.length<len)s=left?chr+s:s+chr;return s;},padLeft:function(len,chr){return this.pad('left',len,chr);},padRight:function(len,chr){return this.pad('right',len,chr);},zerofill:function(len){return this.padLeft(len,'0');},trim:function(){return this.replace(/^\s+|\s+$/g,'');},trimLeft:function(){return this.replace(/^\s+/,'');},trimRight:function(){return this.replace(/\s+$/,'');},toFunction:function()
+return this;},base:function(){}};Base.extend=function(_instance,_static){var extend=Base.prototype.extend;if(!_instance)_instance={};Base._prototyping=true;var _prototype=new this;extend.call(_prototype,_instance);var constructor=_prototype.constructor;_prototype.constructor=this;delete Base._prototyping;var klass=function(){if(!Base._prototyping)constructor.apply(this,arguments);this.constructor=klass;};klass.prototype=_prototype;klass.extend=this.extend;klass.implement=this.implement;klass.toString=function(){return String(constructor);};extend.call(klass,_static);var object=constructor?klass:_prototype;if(object.init instanceof Function)object.init();return object;};Base.implement=function(_interface){if(_interface instanceof Function)_interface=_interface.prototype;this.prototype.extend(_interface);};Prado.PostBack=function(event,options)
+{var form=$(options['FormID']);var canSubmit=true;if(options['CausesValidation']&&typeof(Prado.Validation)!="undefined")
+{if(!Prado.Validation.validate(options['FormID'],options['ValidationGroup'],$(options['ID'])))
+return Event.stop(event);}
+if(options['PostBackUrl']&&options['PostBackUrl'].length>0)
+form.action=options['PostBackUrl'];if(options['TrackFocus'])
+{var lastFocus=$('PRADO_LASTFOCUS');if(lastFocus)
+{var active=document.activeElement;if(active)
+lastFocus.value=active.id;else
+lastFocus.value=options['EventTarget'];}}
+$('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAMETER').value=options['EventParameter'];Event.stop(event);Event.fireEvent(form,"submit");}
+Prado.Element={setValue:function(element,value)
+{var el=$(element);if(el&&typeof(el.value)!="undefined")
+el.value=value;},select:function(element,method,value)
+{var el=$(element);var isList=element.indexOf('[]')>-1;if(!el&&!isList)return;method=isList?'check'+method:el.tagName.toLowerCase()+method;var selection=Prado.Element.Selection;if(isFunction(selection[method]))
+selection[method](isList?element:el,value);},click:function(element)
+{var el=$(element);if(el)
+Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value)
+{var el=$(element);if(attribute=="disabled"&&value==false)
+el.removeAttribute(attribute);else
+el.setAttribute(attribute,value);},setOptions:function(element,options)
+{var el=$(element);if(el&&el.tagName.toLowerCase()=="select")
+{while(el.length>0)
+el.remove(0);for(var i=0;i<options.length;i++)
+el.options[el.options.length]=new Option(options[i][0],options[i][1]);}},focus:function(element)
+{var obj=$(element);if(typeof(obj)!="undefined"&&typeof(obj.focus)!="undefined")
+setTimeout(function(){obj.focus();},100);return false;}}
+Prado.Element.Selection={inputValue:function(el,value)
+{switch(el.type.toLowerCase())
+{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(el,value)
+{$A(el.options).each(function(option)
+{option.selected=option.value==value;});},selectIndex:function(el,index)
+{if(el.type=='select-one')
+el.selectedIndex=index;else
+{for(var i=0;i<el.length;i++)
+{if(i==index)
+el.options[i].selected=true;}}},selectClear:function(el)
+{el.selectedIndex=-1;},selectAll:function(el)
+{$A(el.options).each(function(option)
+{option.selected=true;Logger.warn(option.value);});},selectInvert:function(el)
+{$A(el.options).each(function(option)
+{option.selected=!option.selected;});},checkValue:function(name,value)
+{$A(document.getElementsByName(name)).each(function(el)
+{el.checked=el.value==value});},checkIndex:function(name,index)
+{var elements=$A(document.getElementsByName(name));for(var i=0;i<elements.length;i++)
+{if(i==index)
+elements[i].checked=true;}},checkClear:function(name)
+{$A(document.getElementsByName(name)).each(function(el)
+{el.checked=false;});},checkAll:function(name)
+{$A(document.getElementsByName(name)).each(function(el)
+{el.checked=true;});},checkInvert:function(name)
+{$A(document.getElementsByName(name)).each(function(el)
+{el.checked=!el.checked;});}};Object.extend(Builder,{exportTags:function()
+{var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];tags.each(function(tag)
+{window[tag]=function()
+{var args=$A(arguments);if(args.length==0)
+return Builder.node(tag,null);if(args.length==1)
+return Builder.node(tag,args[0]);if(args.length>1)
+return Builder.node(tag,args.shift(),args);};});}});Builder.exportTags();Object.extend(String.prototype,{pad:function(side,len,chr){if(!chr)chr=' ';var s=this;var left=side.toLowerCase()=='left';while(s.length<len)s=left?chr+s:s+chr;return s;},padLeft:function(len,chr){return this.pad('left',len,chr);},padRight:function(len,chr){return this.pad('right',len,chr);},zerofill:function(len){return this.padLeft(len,'0');},trim:function(){return this.replace(/^\s+|\s+$/g,'');},trimLeft:function(){return this.replace(/^\s+/,'');},trimRight:function(){return this.replace(/\s+$/,'');},toFunction:function()
{var commands=this.split(/\./);var command=window;commands.each(function(action)
{if(command[new String(action)])
command=command[new String(action)];});if(typeof(command)=="function")
@@ -333,75 +396,13 @@ if(month==2)
else{if(date>28){return null;}}}
if((month==4)||(month==6)||(month==9)||(month==11))
{if(date>30){return null;}}
-var newdate=new Date(year,month-1,date,0,0,0);return newdate;}});Object.extend(Builder,{exportTags:function()
-{var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG","CAPTION"];tags.each(function(tag)
-{window[tag]=function()
-{var args=$A(arguments);if(args.length==0)
-return Builder.node(tag,null);if(args.length==1)
-return Builder.node(tag,args[0]);if(args.length>1)
-return Builder.node(tag,args.shift(),args);};});}});Builder.exportTags();var Prado={Version:'3.0.0',Browser:function()
-{var info={Version:"1.0"};var is_major=parseInt(navigator.appVersion);info.nver=is_major;info.ver=navigator.appVersion;info.agent=navigator.userAgent;info.dom=document.getElementById?1:0;info.opera=window.opera?1:0;info.ie5=(info.ver.indexOf("MSIE 5")>-1&&info.dom&&!info.opera)?1:0;info.ie6=(info.ver.indexOf("MSIE 6")>-1&&info.dom&&!info.opera)?1:0;info.ie4=(document.all&&!info.dom&&!info.opera)?1:0;info.ie=info.ie4||info.ie5||info.ie6;info.mac=info.agent.indexOf("Mac")>-1;info.ns6=(info.dom&&parseInt(info.ver)>=5)?1:0;info.ie3=(info.ver.indexOf("MSIE")&&(is_major<4));info.hotjava=(info.agent.toLowerCase().indexOf('hotjava')!=-1)?1:0;info.ns4=(document.layers&&!info.dom&&!info.hotjava)?1:0;info.bw=(info.ie6||info.ie5||info.ie4||info.ns4||info.ns6||info.opera);info.ver3=(info.hotjava||info.ie3);info.opera7=((info.agent.toLowerCase().indexOf('opera 7')>-1)||(info.agent.toLowerCase().indexOf('opera/7')>-1));info.operaOld=info.opera&&!info.opera7;return info;},ImportCss:function(doc,css_file)
-{if(Prado.Browser().ie)
-var styleSheet=doc.createStyleSheet(css_file);else
-{var elm=doc.createElement("link");elm.rel="stylesheet";elm.href=css_file;if(headArr=doc.getElementsByTagName("head"))
-headArr[0].appendChild(elm);}}};Prado.PostBack=function(event,options)
-{var form=$(options['FormID']);var canSubmit=true;if(options['CausesValidation']&&typeof(Prado.Validation)!="undefined")
-{if(!Prado.Validation.validate(options['FormID'],options['ValidationGroup'],$(options['ID'])))
-return Event.stop(event);}
-if(options['PostBackUrl']&&options['PostBackUrl'].length>0)
-form.action=options['PostBackUrl'];if(options['TrackFocus'])
-{var lastFocus=$('PRADO_LASTFOCUS');if(lastFocus)
-{var active=document.activeElement;if(active)
-lastFocus.value=active.id;else
-lastFocus.value=options['EventTarget'];}}
-$('PRADO_POSTBACK_TARGET').value=options['EventTarget'];$('PRADO_POSTBACK_PARAMETER').value=options['EventParameter'];Event.stop(event);Event.fireEvent(form,"submit");}
-Prado.Element={setValue:function(element,value)
-{var el=$(element);if(el&&typeof(el.value)!="undefined")
-el.value=value;},select:function(element,method,value)
-{var el=$(element);var isList=element.indexOf('[]')>-1;if(!el&&!isList)return;method=isList?'check'+method:el.tagName.toLowerCase()+method;var selection=Prado.Element.Selection;if(isFunction(selection[method]))
-selection[method](isList?element:el,value);},click:function(element)
-{var el=$(element);if(el)
-Event.fireEvent(el,'click');},setAttribute:function(element,attribute,value)
-{var el=$(element);if(attribute=="disabled"&&value==false)
-el.removeAttribute(attribute);else
-el.setAttribute(attribute,value);},setOptions:function(element,options)
-{var el=$(element);if(el&&el.tagName.toLowerCase()=="select")
-{while(el.length>0)
-el.remove(0);for(var i=0;i<options.length;i++)
-el.options[el.options.length]=new Option(options[i][0],options[i][1]);}},focus:function(element)
-{var obj=$(element);if(typeof(obj)!="undefined"&&typeof(obj.focus)!="undefined")
-setTimeout(function(){obj.focus();},100);return false;}}
-Prado.Element.Selection={inputValue:function(el,value)
-{switch(el.type.toLowerCase())
-{case'checkbox':case'radio':return el.checked=value;}},selectValue:function(el,value)
-{$A(el.options).each(function(option)
-{option.selected=option.value==value;});},selectIndex:function(el,index)
-{if(el.type=='select-one')
-el.selectedIndex=index;else
-{for(var i=0;i<el.length;i++)
-{if(i==index)
-el.options[i].selected=true;}}},selectClear:function(el)
-{el.selectedIndex=-1;},selectAll:function(el)
-{$A(el.options).each(function(option)
-{option.selected=true;Logger.warn(option.value);});},selectInvert:function(el)
-{$A(el.options).each(function(option)
-{option.selected=!option.selected;});},checkValue:function(name,value)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=el.value==value});},checkIndex:function(name,index)
-{var elements=$A(document.getElementsByName(name));for(var i=0;i<elements.length;i++)
-{if(i==index)
-elements[i].checked=true;}},checkClear:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=false;});},checkAll:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=true;});},checkInvert:function(name)
-{$A(document.getElementsByName(name)).each(function(el)
-{el.checked=!el.checked;});}};Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={_elementOnClick:null,initialize:function(options)
-{this.element=$(options.ID);if(this.onInit)
-this.onInit(options);},onInit:function(options)
+var newdate=new Date(year,month-1,date,0,0,0);return newdate;}});Prado.WebUI=Class.create();Prado.WebUI.PostBackControl=Class.create();Prado.WebUI.PostBackControl.prototype={initialize:function(options)
+{this._elementOnClick=null,this.element=$(options.ID);if(this.element)
+{if(this.onInit)
+this.onInit(options);}},onInit:function(options)
{if(typeof(this.element.onclick)=="function")
{this._elementOnClick=this.element.onclick;this.element.onclick=null;}
-Event.observe(this.element,"click",this.onClick.bindEvent(this,options));},onClick:function(event,options)
+Event.observe(this.element,"click",this.elementClicked.bindEvent(this,options));},elementClicked:function(event,options)
{var src=Event.element(event);var doPostBack=true;var onclicked=null;if(this._elementOnClick)
{var onclicked=this._elementOnClick(event);if(typeof(onclicked)=="boolean")
doPostBack=onclicked;}
@@ -412,14 +413,28 @@ Event.stop(event);},onPostBack:function(event,options)
{if(!this.hasXYInput)
{this.addXYInput(event,options);this.hasXYInput=true;}
Prado.PostBack(event,options);},addXYInput:function(event,options)
-{var imagePos=Position.cumulativeOffset(this.element);var clickedPos=[event.clientX,event.clientY];var x=clickedPos[0]-imagePos[0]+1;var y=clickedPos[1]-imagePos[1]+1;var id=options['EventTarget'];var x_input=INPUT({type:'hidden',name:id+'_x',value:x});var y_input=INPUT({type:'hidden',name:id+'_y',value:y});this.element.parentNode.appendChild(x_input);this.element.parentNode.appendChild(y_input);}});Prado.WebUI.TRadioButton=Class.extend(Prado.WebUI.PostBackControl);Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(options)
-{this.element=$(options['ID']);if(!this.element.checked)
-this.onRadioButtonInitialize(options);}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options)
-{if(options['TextMode']!='MultiLine')
-Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,options));},handleReturnKey:function(e)
+{imagePos=Position.cumulativeOffset(this.element);clickedPos=[event.clientX,event.clientY];x=clickedPos[0]-imagePos[0]+1;y=clickedPos[1]-imagePos[1]+1;x=x<0?0:x;y=y<0?0:y;id=options['EventTarget'];x_input=$(id+"_x");y_input=$(id+"_y");if(x_input)
+{x_input.value=x;}
+else
+{x_input=INPUT({type:'hidden',name:id+'_x','id':id+'_x',value:x});this.element.parentNode.appendChild(x_input);}
+if(y_input)
+{y_input.value=y;}
+else
+{y_input=INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});this.element.parentNode.appendChild(y_input);}}});Prado.WebUI.TRadioButton=Class.extend(Prado.WebUI.PostBackControl);Prado.WebUI.TRadioButton.prototype.onRadioButtonInitialize=Prado.WebUI.TRadioButton.prototype.initialize;Object.extend(Prado.WebUI.TRadioButton.prototype,{initialize:function(options)
+{this.element=$(options['ID']);if(this.element)
+{if(!this.element.checked)
+this.onRadioButtonInitialize(options);}}});Prado.WebUI.TTextBox=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options)
+{this.options=options;if(options['TextMode']!='MultiLine')
+Event.observe(this.element,"keydown",this.handleReturnKey.bind(this));if(this.options['AutoPostBack']==true)
+Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,options));},handleReturnKey:function(e)
{if(Event.keyCode(e)==Event.KEY_RETURN)
{var target=Event.element(e);if(target)
-{Event.fireEvent(target,"change");Event.stop(e);}}}});Prado.WebUI.TListControl=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options)
+{if(this.options['AutoPostBack']==true)
+{Event.fireEvent(target,"change");Event.stop(e);}
+else
+{if(this.options['CausesValidation']&&typeof(Prado.Validation)!="undefined")
+{if(!Prado.Validation.validate(this.options['FormID'],this.options['ValidationGroup'],$(this.options['ID'])))
+return Event.stop(e);}}}}}});Prado.WebUI.TListControl=Class.extend(Prado.WebUI.PostBackControl,{onInit:function(options)
{Event.observe(this.element,"change",Prado.PostBack.bindEvent(this,options));}});Prado.WebUI.TListBox=Class.extend(Prado.WebUI.TListControl);Prado.WebUI.TDropDownList=Class.extend(Prado.WebUI.TListControl);Prado.WebUI.DefaultButton=Class.create();Prado.WebUI.DefaultButton.prototype={initialize:function(options)
{this.options=options;this._event=this.triggerEvent.bindEvent(this);Event.observe(options['Panel'],'keydown',this._event);},triggerEvent:function(ev,target)
{var enterPressed=Event.keyCode(ev)==Event.KEY_RETURN;var isTextArea=Event.element(ev).tagName.toLowerCase()=="textarea";if(enterPressed&&!isTextArea)
@@ -434,17 +449,8 @@ text+=node.nodeValue;}
if(text.length>0)
window.clipboardData.setData("Text",text);},hover:function(obj)
{obj.parentNode.className="copycode copycode_hover";},out:function(obj)
-{obj.parentNode.className="copycode";}});Prado.WebUI.TRatingList=Class.create();Prado.WebUI.TRatingList.prototype={selectedIndex:-1,initialize:function(options)
-{this.options=options;this.element=$(options['ID']);Element.addClassName(this.element,options.cssClass);this.radios=document.getElementsByName(options.field);for(var i=0;i<this.radios.length;i++)
-{Event.observe(this.radios[i].parentNode,"mouseover",this.hover.bindEvent(this,i));Event.observe(this.radios[i].parentNode,"mouseout",this.recover.bindEvent(this,i));Event.observe(this.radios[i].parentNode,"click",this.click.bindEvent(this,i));}
-this.caption=CAPTION();this.element.appendChild(this.caption);this.selectedIndex=options.selectedIndex;this.setRating(this.selectedIndex);},hover:function(ev,index)
-{for(var i=0;i<this.radios.length;i++)
-this.radios[i].parentNode.className=(i<=index)?"rating_hover":"";this.setCaption(index);},recover:function(ev,index)
-{for(var i=0;i<=index;i++)
-Element.removeClassName(this.radios[i].parentNode,"rating_hover");this.setRating(this.selectedIndex);},click:function(ev,index)
-{for(var i=0;i<this.radios.length;i++)
-this.radios[i].checked=(i==index);this.selectedIndex=index;this.setRating(index);if(isFunction(this.options.onChange))
-this.options.onChange(this,index);},setRating:function(index)
-{for(var i=0;i<=index;i++)
-this.radios[i].parentNode.className="rating_selected";this.setCaption(index);},setCaption:function(index)
-{this.caption.innerHTML=index>-1?this.radios[index].value:this.options.caption;}} \ No newline at end of file
+{obj.parentNode.className="copycode";}});Prado.WebUI.TCheckBoxList=Base.extend({constructor:function(options)
+{for(var i=0;i<options.ItemCount;i++)
+{var checkBoxOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TCheckBox(checkBoxOptions);}}});Prado.WebUI.TRadioButtonList=Base.extend({constructor:function(options)
+{for(var i=0;i<options.ItemCount;i++)
+{var radioButtonOptions=Object.extend({ID:options.ListID+"_c"+i,EventTarget:options.ListName+"$c"+i},options);new Prado.WebUI.TRadioButton(radioButtonOptions);}}}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/js/debug/colorpicker.js b/framework/Web/Javascripts/js/debug/colorpicker.js
index b1b2aae4..914c2d75 100644
--- a/framework/Web/Javascripts/js/debug/colorpicker.js
+++ b/framework/Web/Javascripts/js/debug/colorpicker.js
@@ -96,7 +96,7 @@ Rico.Color.createFromHex = function(hexCode) {
if ( hexCode.indexOf('#') == 0 )
hexCode = hexCode.substring(1);
-
+
var red = "ff", green = "ff", blue="ff";
if(hexCode.length > 4)
{
@@ -240,13 +240,14 @@ Rico.Color.RGBtoHSB = function(r, g, b) {
return { h : hue, s : saturation, b : brightness };
}
-
-
+
+
+
Prado.WebUI.TColorPicker = Class.create();
Object.extend(Prado.WebUI.TColorPicker,
{
- palettes:
+ palettes:
{
Small : [["fff", "fcc", "fc9", "ff9", "ffc", "9f9", "9ff", "cff", "ccf", "fcf"],
["ccc", "f66", "f96", "ff6", "ff3", "6f9", "3ff", "6ff", "99f", "f9f"],
@@ -261,7 +262,7 @@ Object.extend(Prado.WebUI.TColorPicker,
["808080"/*gray*/, "ff0000"/*red*/, "800080"/*purple*/, "000000"/*black*/]]
},
- UIImages :
+ UIImages :
{
'button.gif' : 'button.gif',
// 'target_black.gif' : 'target_black.gif',
@@ -272,11 +273,11 @@ Object.extend(Prado.WebUI.TColorPicker,
}
});
-Object.extend(Prado.WebUI.TColorPicker.prototype,
+Object.extend(Prado.WebUI.TColorPicker.prototype,
{
initialize : function(options)
{
- var basics =
+ var basics =
{
Palette : 'Small',
ClassName : 'TColorPicker',
@@ -285,7 +286,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
CancelButtonText : 'Cancel',
ShowColorPicker : true
}
-
+
this.element = null;
this.showing = false;
@@ -301,10 +302,10 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
updatePicker : function(e)
{
- var color = Rico.Color.createFromHex(this.input.value);
+ var color = Rico.Color.createFromHex(this.input.value);
this.button.style.backgroundColor = color.toString();
},
-
+
buttonOnClick : function(event)
{
var mode = this.options['Mode'];
@@ -328,7 +329,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.initializeFullPicker();
}
this.show(mode);
- },
+ },
show : function(type)
{
@@ -340,14 +341,14 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.element.style.top = (pos[1]-1) + "px";
this.element.style.left = pos[0] + "px";
this.element.style.display = "block";
-
+
this.ieHack(type);
//observe for clicks on the document body
this._documentClickEvent = this.hideOnClick.bindEvent(this, type);
this._documentKeyDownEvent = this.keyPressed.bindEvent(this, type);
Event.observe(document.body, "click", this._documentClickEvent);
- Event.observe(document,"keydown", this._documentKeyDownEvent);
+ Event.observe(document,"keydown", this._documentKeyDownEvent);
this.showing = true;
if(type == "Full")
@@ -359,7 +360,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
}
}
},
-
+
hide : function(event)
{
if(this.showing)
@@ -370,11 +371,11 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.element.style.display = "none";
this.showing = false;
Event.stopObserving(document.body, "click", this._documentClickEvent);
- Event.stopObserving(document,"keydown", this._documentKeyDownEvent);
-
+ Event.stopObserving(document,"keydown", this._documentKeyDownEvent);
+
if(this._observingMouseMove)
- {
- Event.stopObserving(document.body, "mousemove", this._onMouseMove);
+ {
+ Event.stopObserving(document.body, "mousemove", this._onMouseMove);
this._observingMouseMove = false;
}
}
@@ -396,16 +397,16 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
within = within || el == this.button;
within = within || el == this.input;
if(within) break;
- el = el.parentNode;
+ el = el.parentNode;
}
while(el);
if(!within) this.hide(ev);
},
- ieHack : function()
+ ieHack : function()
{
// IE hack
- if(this.iePopUp)
+ if(this.iePopUp)
{
this.iePopUp.style.display = "block";
this.iePopUp.style.top = (this.element.offsetTop) + "px";
@@ -448,7 +449,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
cellOnClick : function(e)
{
- var el = Event.element(e);
+ var el = Event.element(e);
if(el.tagName.toLowerCase() != "img")
return;
var color = Rico.Color.createColorFromBackground(el);
@@ -464,15 +465,15 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
},
getFullPickerContainer : function(pickerID)
- {
+ {
//create the 3 buttons
- this.buttons =
+ this.buttons =
{
//Less : INPUT({value:'Less Colors', className:'button', type:'button'}),
OK : INPUT({value:this.options.OKButtonText, className:'button', type:'button'}),
Cancel : INPUT({value:this.options.CancelButtonText, className:'button', type:'button'})
};
-
+
//create the 6 inputs
var inputs = {};
['H','S','V','R','G','B'].each(function(type)
@@ -483,13 +484,13 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
//create the HEX input
inputs['HEX'] = INPUT({className:'hex',type:'text',size:'6',maxlength:'6'});
this.inputs = inputs;
-
+
var images = Prado.WebUI.TColorPicker.UIImages;
this.inputs['currentColor'] = SPAN({className:'currentColor'});
this.inputs['oldColor'] = SPAN({className:'oldColor'});
- var inputsTable =
+ var inputsTable =
TABLE({className:'inputs'}, TBODY(null,
TR(null,
TD({className:'currentcolor',colSpan:2},
@@ -502,30 +503,30 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
TR(null,
TD(null,'S:'),
TD(null,this.inputs['S'], '%')),
-
- TR(null,
+
+ TR(null,
TD(null,'V:'),
TD(null,this.inputs['V'], '%')),
-
- TR(null,
+
+ TR(null,
TD({className:'gap'},'R:'),
TD({className:'gap'},this.inputs['R'])),
-
- TR(null,
+
+ TR(null,
TD(null,'G:'),
TD(null, this.inputs['G'])),
- TR(null,
+ TR(null,
TD(null,'B:'),
TD(null, this.inputs['B'])),
- TR(null,
+ TR(null,
TD({className:'gap'},'#'),
TD({className:'gap'},this.inputs['HEX']))
));
- var UIimages =
- {
+ var UIimages =
+ {
selector : SPAN({className:'selector'}),
background : SPAN({className:'colorpanel'}),
slider : SPAN({className:'slider'}),
@@ -538,23 +539,23 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var filter = "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader";
UIimages['background'] = SPAN({className:'colorpanel',style:filter+"(src='"+images['background.png']+"' sizingMethod=scale);"})
}
-
+
this.inputs = Object.extend(this.inputs, UIimages);
- var pickerTable =
+ var pickerTable =
TABLE(null,TBODY(null,
TR({className:'selection'},
TD({className:'colors'},UIimages['selector'],UIimages['background']),
TD({className:'hue'},UIimages['slider'],UIimages['hue']),
TD({className:'inputs'}, inputsTable)
),
- TR({className:'options'},
- TD({colSpan:3},
- this.buttons['OK'],
+ TR({className:'options'},
+ TD({colSpan:3},
+ this.buttons['OK'],
this.buttons['Cancel'])
)
));
-
+
return DIV({className:this.options['ClassName']+" FullColorPicker",
id:pickerID+"_picker"},pickerTable);
},
@@ -565,16 +566,16 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.inputs.oldColor.style.backgroundColor = color.asHex();
this.setColor(color,true);
- var i = 0;
+ var i = 0;
for(var type in this.inputs)
{
- Event.observe(this.inputs[type], "change",
+ Event.observe(this.inputs[type], "change",
this.onInputChanged.bindEvent(this,type));
i++;
if(i > 6) break;
}
-
+
this.isMouseDownOnColor = false;
this.isMouseDownOnHue = false;
@@ -587,9 +588,9 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
Event.observe(this.inputs.selector, "mousedown", this._onColorMouseDown);
Event.observe(this.inputs.hue, "mousedown", this._onHueMouseDown);
Event.observe(this.inputs.slider, "mousedown", this._onHueMouseDown);
-
+
Event.observe(document.body, "mouseup", this._onMouseUp);
-
+
this.observeMouseMovement();
Event.observe(this.buttons.Cancel, "click", this.hide.bindEvent(this,this.options['Mode']));
@@ -602,7 +603,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
{
Event.observe(document.body, "mousemove", this._onMouseMove);
this._observingMouseMove = true;
- }
+ }
},
onColorMouseDown : function(ev)
@@ -633,15 +634,15 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
if(this.isMouseDownOnHue)
this.changeH(ev);
Event.stop(ev);
- },
+ },
changeSV : function(ev)
{
var px = Event.pointerX(ev);
var py = Event.pointerY(ev);
var pos = Position.cumulativeOffset(this.inputs.background);
-
- var x = this.truncate(px - pos[0],0,255);
+
+ var x = this.truncate(px - pos[0],0,255);
var y = this.truncate(py - pos[1],0,255);
@@ -650,7 +651,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var current_s = parseInt(this.inputs.S.value);
var current_b = parseInt(this.inputs.V.value);
-
+
if(current_s == parseInt(s*100) && current_b == parseInt(b*100)) return;
var h = this.truncate(this.inputs.H.value,0,360)/360;
@@ -661,7 +662,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.inputs.selector.style.left = x+"px";
this.inputs.selector.style.top = y+"px";
-
+
this.inputs.currentColor.style.backgroundColor = color.asHex();
return this.setColor(color);
@@ -672,7 +673,7 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
var py = Event.pointerY(ev);
var pos = Position.cumulativeOffset(this.inputs.background);
var y = this.truncate(py - pos[1],0,255);
-
+
var h = (255-y)/255;
var current_h = this.truncate(this.inputs.H.value,0,360);
current_h = current_h == 0 ? 360 : current_h;
@@ -743,12 +744,12 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
this.inputs.G.value = color.rgb.g;
this.inputs.B.value = color.rgb.b;
this.inputs.HEX.value = color.asHex().substring(1).toUpperCase();
-
+
var images = Prado.WebUI.TColorPicker.UIImages;
var changeCss = color.isBright() ? 'removeClassName' : 'addClassName';
Element[changeCss](this.inputs.selector, 'target_white');
-
+
if(update)
this.updateSelectors(color);
},
@@ -757,11 +758,11 @@ Object.extend(Prado.WebUI.TColorPicker.prototype,
{
var hsb = color.asHSB();
var pos = [hsb.s*255, hsb.b*255, hsb.h*255];
-
+
this.inputs.selector.style.left = this.truncate(pos[0],0,255)+"px";
this.inputs.selector.style.top = this.truncate(255-pos[1],0,255)+"px";
this.inputs.slider.style.top = this.truncate(255-pos[2],0,255)+"px";
-
+
var hue = new Rico.Color(color.rgb.r,color.rgb.g,color.rgb.b);
hue.setSaturation(1); hue.setBrightness(1);
this.inputs.background.style.backgroundColor = hue.asHex();
diff --git a/framework/Web/Javascripts/js/debug/prado.js b/framework/Web/Javascripts/js/debug/prado.js
index b9ed0117..12d790e6 100644
--- a/framework/Web/Javascripts/js/debug/prado.js
+++ b/framework/Web/Javascripts/js/debug/prado.js
@@ -3349,6 +3349,63 @@ var Builder = {
+var Prado =
+{
+ Version: '3.0.0',
+
+ /**
+ * Returns browser information. Example
+ * <code>
+ * var browser = Prado.Browser();
+ * alert(browser.ie); //should ouput true if IE, false otherwise
+ * </code>
+ * @param ${parameter}
+ * @return ${return}
+ */
+ Browser : function()
+ {
+ var info = { Version : "1.0" };
+ var is_major = parseInt( navigator.appVersion );
+ info.nver = is_major;
+ info.ver = navigator.appVersion;
+ info.agent = navigator.userAgent;
+ info.dom = document.getElementById ? 1 : 0;
+ info.opera = window.opera ? 1 : 0;
+ info.ie5 = ( info.ver.indexOf( "MSIE 5" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
+ info.ie6 = ( info.ver.indexOf( "MSIE 6" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
+ info.ie4 = ( document.all && !info.dom && !info.opera ) ? 1 : 0;
+ info.ie = info.ie4 || info.ie5 || info.ie6;
+ info.mac = info.agent.indexOf( "Mac" ) > -1;
+ info.ns6 = ( info.dom && parseInt( info.ver ) >= 5 ) ? 1 : 0;
+ info.ie3 = ( info.ver.indexOf( "MSIE" ) && ( is_major < 4 ) );
+ info.hotjava = ( info.agent.toLowerCase().indexOf( 'hotjava' ) != -1 ) ? 1 : 0;
+ info.ns4 = ( document.layers && !info.dom && !info.hotjava ) ? 1 : 0;
+ info.bw = ( info.ie6 || info.ie5 || info.ie4 || info.ns4 || info.ns6 || info.opera );
+ info.ver3 = ( info.hotjava || info.ie3 );
+ info.opera7 = ( ( info.agent.toLowerCase().indexOf( 'opera 7' ) > -1 ) || ( info.agent.toLowerCase().indexOf( 'opera/7' ) > -1 ) );
+ info.operaOld = info.opera && !info.opera7;
+ return info;
+ },
+
+ ImportCss : function(doc, css_file)
+ {
+ if (Prado.Browser().ie)
+ var styleSheet = doc.createStyleSheet(css_file);
+ else
+ {
+ var elm = doc.createElement("link");
+
+ elm.rel = "stylesheet";
+ elm.href = css_file;
+
+ if (headArr = doc.getElementsByTagName("head"))
+ headArr[0].appendChild(elm);
+ }
+ }
+};
+
+
+
/**
* Similar to bindAsEventLister, but takes additional arguments.
*/
@@ -3484,8 +3541,247 @@ Base.implement = function(_interface) {
if (_interface instanceof Function) _interface = _interface.prototype;
this.prototype.extend(_interface);
};
-
-
+
+/**
+ * Performs a post-back using javascript
+ *
+ */
+Prado.PostBack = function(event,options)
+{
+ var form = $(options['FormID']);
+ var canSubmit = true;
+
+ if(options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+ {
+ if(!Prado.Validation.validate(options['FormID'], options['ValidationGroup'], $(options['ID'])))
+ return Event.stop(event);
+ }
+
+ if(options['PostBackUrl'] && options['PostBackUrl'].length > 0)
+ form.action = options['PostBackUrl'];
+
+ if(options['TrackFocus'])
+ {
+ var lastFocus = $('PRADO_LASTFOCUS');
+ if(lastFocus)
+ {
+ var active = document.activeElement; //where did this come from
+ if(active)
+ lastFocus.value = active.id;
+ else
+ lastFocus.value = options['EventTarget'];
+ }
+ }
+
+ $('PRADO_POSTBACK_TARGET').value = options['EventTarget'];
+ $('PRADO_POSTBACK_PARAMETER').value = options['EventParameter'];
+ /**
+ * Since google toolbar prevents browser default action,
+ * we will always disable default client-side browser action
+ */
+ /*if(options['StopEvent']) */
+ Event.stop(event);
+ Event.fireEvent(form,"submit");
+}
+
+/**
+ * Additional element utilities.
+ */
+Prado.Element =
+{
+ /**
+ * Set the value of a particular element.
+ * @param string element id
+ * @param string new element value.
+ */
+ setValue : function(element, value)
+ {
+ var el = $(element);
+ if(el && typeof(el.value) != "undefined")
+ el.value = value;
+ },
+
+ select : function(element, method, value)
+ {
+ var el = $(element);
+ var isList = element.indexOf('[]') > -1;
+ if(!el && !isList) return;
+ method = isList ? 'check'+method : el.tagName.toLowerCase()+method;
+ var selection = Prado.Element.Selection;
+ if(isFunction(selection[method]))
+ selection[method](isList ? element : el,value);
+ },
+
+ click : function(element)
+ {
+ var el = $(element);
+ if(el)
+ Event.fireEvent(el,'click');
+ },
+
+ setAttribute : function(element, attribute, value)
+ {
+ var el = $(element);
+ if(attribute == "disabled" && value==false)
+ el.removeAttribute(attribute);
+ else
+ el.setAttribute(attribute, value);
+ },
+
+ setOptions : function(element, options)
+ {
+ var el = $(element);
+ if(el && el.tagName.toLowerCase() == "select")
+ {
+ while(el.length > 0)
+ el.remove(0);
+ for(var i = 0; i<options.length; i++)
+ el.options[el.options.length] = new Option(options[i][0],options[i][1]);
+ }
+ },
+
+ /**
+ * A delayed focus on a particular element
+ * @param {element} element to apply focus()
+ */
+ focus : function(element)
+ {
+ var obj = $(element);
+ if(typeof(obj) != "undefined" && typeof(obj.focus) != "undefined")
+ setTimeout(function(){ obj.focus(); }, 100);
+ return false;
+ }
+}
+
+/**
+ * Selectable element utilities
+ */
+Prado.Element.Selection =
+{
+ inputValue : function(el, value)
+ {
+ switch(el.type.toLowerCase())
+ {
+ case 'checkbox':
+ case 'radio':
+ return el.checked = value;
+ }
+ },
+
+ selectValue : function(el, value)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = option.value == value;
+ });
+ },
+
+ selectIndex : function(el, index)
+ {
+ if(el.type == 'select-one')
+ el.selectedIndex = index;
+ else
+ {
+ for(var i = 0; i<el.length; i++)
+ {
+ if(i == index)
+ el.options[i].selected = true;
+ }
+ }
+ },
+
+ selectClear : function(el)
+ {
+ el.selectedIndex = -1;
+ },
+
+ selectAll : function(el)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = true;
+ Logger.warn(option.value);
+ });
+ },
+
+ selectInvert : function(el)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = !option.selected;
+ });
+ },
+
+ checkValue : function(name, value)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = el.value == value
+ });
+ },
+
+ checkIndex : function(name, index)
+ {
+ var elements = $A(document.getElementsByName(name));
+ for(var i = 0; i<elements.length; i++)
+ {
+ if(i == index)
+ elements[i].checked = true;
+ }
+ },
+
+ checkClear : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = false;
+ });
+ },
+
+ checkAll : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = true;
+ });
+ },
+ checkInvert : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = !el.checked;
+ });
+ }
+};
+
+
+/**
+ * Export scripaculous builder utilities as window[functions]
+ */
+Object.extend(Builder,
+{
+ exportTags:function()
+ {
+ var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG", "CAPTION"];
+ tags.each(function(tag)
+ {
+ window[tag]=function()
+ {
+ var args=$A(arguments);
+ if(args.length==0)
+ return Builder.node(tag,null);
+ if(args.length==1)
+ return Builder.node(tag,args[0]);
+ if(args.length>1)
+ return Builder.node(tag,args.shift(),args);
+
+ };
+ });
+ }
+});
+
+Builder.exportTags();
+
/**
* @class String extensions
*/
@@ -3493,7 +3789,7 @@ Object.extend(String.prototype, {
/**
* @param {String} "left" to pad the string on the left, "right" to pad right.
* @param {Number} minimum string length.
- * @param {String} character(s) to pad
+ * @param {String} character(s) to pad
* @return {String} padded character(s) on the left or right to satisfy minimum string length
*/
@@ -3507,7 +3803,7 @@ Object.extend(String.prototype, {
/**
* @param {Number} minimum string length.
- * @param {String} character(s) to pad
+ * @param {String} character(s) to pad
* @return {String} padded character(s) on the left to satisfy minimum string length
*/
padLeft : function(len, chr) {
@@ -3516,7 +3812,7 @@ Object.extend(String.prototype, {
/**
* @param {Number} minimum string length.
- * @param {String} character(s) to pad
+ * @param {String} character(s) to pad
* @return {String} padded character(s) on the right to satisfy minimum string length
*/
padRight : function(len, chr) {
@@ -3527,28 +3823,28 @@ Object.extend(String.prototype, {
* @param {Number} minimum string length.
* @return {String} append zeros to the left to satisfy minimum string length.
*/
- zerofill : function(len) {
+ zerofill : function(len) {
return this.padLeft(len,'0');
},
/**
* @return {String} removed white spaces from both ends.
*/
- trim : function() {
+ trim : function() {
return this.replace(/^\s+|\s+$/g,'');
},
/**
* @return {String} removed white spaces from the left end.
*/
- trimLeft : function() {
- return this.replace(/^\s+/,'');
+ trimLeft : function() {
+ return this.replace(/^\s+/,'');
},
/**
* @return {String} removed white spaces from the right end.
*/
- trimRight : function() {
+ trimRight : function() {
return this.replace(/\s+$/,'');
},
@@ -3563,9 +3859,9 @@ Object.extend(String.prototype, {
var commands = this.split(/\./);
var command = window;
commands.each(function(action)
- {
- if(command[new String(action)])
- command=command[new String(action)];
+ {
+ if(command[new String(action)])
+ command=command[new String(action)];
});
if(typeof(command) == "function")
return command;
@@ -3573,12 +3869,12 @@ Object.extend(String.prototype, {
{
if(typeof Logger != "undefined")
Logger.error("Missing function", this);
-
+
throw new Error ("Missing function '"+this+"'");
}
},
- /**
+ /**
* Convert a string into integer, returns null if not integer.
* @return {Number} null if string does not represent an integer.
*/
@@ -3591,8 +3887,8 @@ Object.extend(String.prototype, {
return (isNaN(num) ? null : num);
},
- /**
- * Convert a string into a double/float value. <b>Internationalization
+ /**
+ * Convert a string into a double/float value. <b>Internationalization
* is not supported</b>
* @param {String} the decimal character
* @return {Double} null if string does not represent a float value
@@ -3603,21 +3899,21 @@ Object.extend(String.prototype, {
decimalchar = decimalchar || ".";
var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
var m = this.match(exp);
-
- if (m == null)
+
+ if (m == null)
return null;
m[1] = m[1] || "";
m[2] = m[2] || "0";
m[4] = m[4] || "0";
-
+
var cleanInput = m[1] + (m[2].length>0 ? m[2] : "0") + "." + m[4];
var num = parseFloat(cleanInput);
return (isNaN(num) ? null : num);
},
/**
- * Convert strings that represent a currency value (e.g. a float with grouping
- * characters) to float. E.g. "10,000.50" will become "10000.50". The number
+ * Convert strings that represent a currency value (e.g. a float with grouping
+ * characters) to float. E.g. "10,000.50" will become "10000.50". The number
* of dicimal digits, grouping and decimal characters can be specified.
* <i>The currency input format is <b>very</b> strict, null will be returned if
* the pattern does not match</i>.
@@ -3640,14 +3936,14 @@ Object.extend(String.prototype, {
return null;
var intermed = m[2] + m[5] ;
var cleanInput = m[1] + intermed.replace(
- new RegExp("(\\" + groupchar + ")", "g"), "")
+ new RegExp("(\\" + groupchar + ")", "g"), "")
+ ((digits > 0) ? "." + m[7] : "");
var num = parseFloat(cleanInput);
return (isNaN(num) ? null : num);
},
/**
- * Converts the string to a date by finding values that matches the
+ * Converts the string to a date by finding values that matches the
* date format pattern.
* @param string date format pattern, e.g. MM-dd-yyyy
* @return {Date} the date extracted from the string
@@ -3656,19 +3952,19 @@ Object.extend(String.prototype, {
{
return Date.SimpleParse(this, format);
}
-});
-
+});
+
/**
* @class Event extensions.
*/
-Object.extend(Event,
+Object.extend(Event,
{
/**
- * Register a function to be executed when the page is loaded.
- * Note that the page is only loaded if all resources (e.g. images)
+ * Register a function to be executed when the page is loaded.
+ * Note that the page is only loaded if all resources (e.g. images)
* are loaded.
- *
- * Example: Show an alert box with message "Page Loaded!" when the
+ *
+ * Example: Show an alert box with message "Page Loaded!" when the
* page finished loading.
* <code>
* Event.OnLoad(function(){ alert("Page Loaded!"); });
@@ -3676,18 +3972,18 @@ Object.extend(Event,
*
* @param {Function} function to execute when page is loaded.
*/
- OnLoad : function (fn)
+ OnLoad : function (fn)
{
// opera onload is in document, not window
- var w = document.addEventListener &&
+ var w = document.addEventListener &&
!window.addEventListener ? document : window;
Event.observe(w,'load',fn);
},
/**
* @param {Event} a keyboard event
- * @return {Number} the Unicode character code generated by the key
- * that was struck.
+ * @return {Number} the Unicode character code generated by the key
+ * that was struck.
*/
keyCode : function(e)
{
@@ -3696,33 +3992,33 @@ Object.extend(Event,
/**
* @param {String} event type or event name.
- * @return {Boolean} true if event type is of HTMLEvent, false
+ * @return {Boolean} true if event type is of HTMLEvent, false
* otherwise
*/
isHTMLEvent : function(type)
{
- var events = ['abort', 'blur', 'change', 'error', 'focus',
- 'load', 'reset', 'resize', 'scroll', 'select',
+ var events = ['abort', 'blur', 'change', 'error', 'focus',
+ 'load', 'reset', 'resize', 'scroll', 'select',
'submit', 'unload'];
return events.include(type);
},
/**
* @param {String} event type or event name
- * @return {Boolean} true if event type is of MouseEvent,
+ * @return {Boolean} true if event type is of MouseEvent,
* false otherwise
*/
isMouseEvent : function(type)
{
- var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout',
'mouseover', 'mouseup'];
return events.include(type);
},
/**
- * Dispatch the DOM event of a given <tt>type</tt> on a DOM
- * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
- * dispatched, keyboard events or UIEvent can not be dispatch
+ * Dispatch the DOM event of a given <tt>type</tt> on a DOM
+ * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
+ * dispatched, keyboard events or UIEvent can not be dispatch
* via javascript consistently.
* For the "submit" event the submit() method is called.
* @param {Object} element id string or a DOM element.
@@ -3734,7 +4030,7 @@ Object.extend(Event,
if(type == "submit")
return element.submit();
if(document.createEvent)
- {
+ {
if(Event.isHTMLEvent(type))
{
var event = document.createEvent('HTMLEvents');
@@ -3742,11 +4038,11 @@ Object.extend(Event,
}
else if(Event.isMouseEvent(type))
{
- var event = document.createEvent('MouseEvents');
+ var event = document.createEvent('MouseEvents');
if (event.initMouseEvent)
{
event.initMouseEvent(type,true,true,
- document.defaultView, 1, 0, 0, 0, 0, false,
+ document.defaultView, 1, 0, 0, 0, 0, false,
false, false, false, 0, null);
}
else
@@ -3766,18 +4062,19 @@ Object.extend(Event,
else if(typeof(element['on'+type]) == "function")
element['on'+type]();
}
-});
-
+});
+
+
Object.extend(Date.prototype,
-{
+{
SimpleFormat: function(format, data)
{
data = data || {};
var bits = new Array();
bits['d'] = this.getDate();
bits['dd'] = String(this.getDate()).zerofill(2);
-
+
bits['M'] = this.getMonth()+1;
bits['MM'] = String(this.getMonth()+1).zerofill(2);
if(data.AbbreviatedMonthNames)
@@ -3788,11 +4085,11 @@ Object.extend(Date.prototype,
yearStr = (yearStr.length == 2) ? '19' + yearStr: yearStr;
bits['yyyy'] = yearStr;
bits['yy'] = bits['yyyy'].toString().substr(2,2);
-
+
// do some funky regexs to replace the format string
// with the real values
var frm = new String(format);
- for (var sect in bits)
+ for (var sect in bits)
{
var reg = new RegExp("\\b"+sect+"\\b" ,"g");
frm = frm.replace(reg, bits[sect]);
@@ -3809,30 +4106,30 @@ Object.extend(Date.prototype,
}
});
-Object.extend(Date,
+Object.extend(Date,
{
SimpleParse: function(value, format)
- {
+ {
val=String(value);
format=String(format);
-
+
if(val.length <= 0) return null;
-
+
if(format.length <= 0) return new Date(value);
-
- var isInteger = function (val)
+
+ var isInteger = function (val)
{
var digits="1234567890";
- for (var i=0; i < val.length; i++)
+ for (var i=0; i < val.length; i++)
{
if (digits.indexOf(val.charAt(i))==-1) { return false; }
}
return true;
};
-
- var getInt = function(str,i,minlength,maxlength)
+
+ var getInt = function(str,i,minlength,maxlength)
{
- for (var x=maxlength; x>=minlength; x--)
+ for (var x=maxlength; x>=minlength; x--)
{
var token=str.substring(i,i+x);
if (token.length < minlength) { return null; }
@@ -3840,7 +4137,7 @@ Object.extend(Date,
}
return null;
};
-
+
var i_val=0;
var i_format=0;
var c="";
@@ -3851,19 +4148,19 @@ Object.extend(Date,
var year=now.getFullYear();
var month=now.getMonth()+1;
var date=1;
-
- while (i_format < format.length)
+
+ while (i_format < format.length)
{
// Get next token from format string
c=format.charAt(i_format);
token="";
- while ((format.charAt(i_format)==c) && (i_format < format.length))
+ while ((format.charAt(i_format)==c) && (i_format < format.length))
{
token += format.charAt(i_format++);
}
-
+
// Extract contents of value based on format token
- if (token=="yyyy" || token=="yy" || token=="y")
+ if (token=="yyyy" || token=="yy" || token=="y")
{
if (token=="yyyy") { x=4;y=4; }
if (token=="yy") { x=2;y=2; }
@@ -3871,37 +4168,37 @@ Object.extend(Date,
year=getInt(val,i_val,x,y);
if (year==null) { return null; }
i_val += year.length;
- if (year.length==2)
+ if (year.length==2)
{
if (year > 70) { year=1900+(year-0); }
else { year=2000+(year-0); }
}
}
- else if (token=="MM"||token=="M")
+ else if (token=="MM"||token=="M")
{
month=getInt(val,i_val,token.length,2);
if(month==null||(month<1)||(month>12)){return null;}
i_val+=month.length;
}
- else if (token=="dd"||token=="d")
+ else if (token=="dd"||token=="d")
{
date=getInt(val,i_val,token.length,2);
if(date==null||(date<1)||(date>31)){return null;}
i_val+=date.length;
}
- else
+ else
{
if (val.substring(i_val,i_val+token.length)!=token) {return null;}
else {i_val+=token.length;}
}
}
-
+
// If there are any trailing characters left in the value, it doesn't match
if (i_val != val.length) { return null; }
-
+
// Is date valid for month?
- if (month==2)
+ if (month==2)
{
// Check for leap year
if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
@@ -3909,520 +4206,33 @@ Object.extend(Date,
}
else { if (date > 28) { return null; } }
}
-
- if ((month==4)||(month==6)||(month==9)||(month==11))
+
+ if ((month==4)||(month==6)||(month==9)||(month==11))
{
if (date > 30) { return null; }
}
-
+
var newdate=new Date(year,month-1,date, 0, 0, 0);
return newdate;
}
});
-
-Object.extend(Builder,
-{
- exportTags:function()
- {
- var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG", "CAPTION"];
- tags.each(function(tag)
- {
- window[tag]=function()
- {
- var args=$A(arguments);
- if(args.length==0)
- return Builder.node(tag,null);
- if(args.length==1)
- return Builder.node(tag,args[0]);
- if(args.length>1)
- return Builder.node(tag,args.shift(),args);
-
- };
- });
- }
-});
-
-Builder.exportTags();
-
-
-
-var Prado =
-{
- Version: '3.0.0',
-
- /**
- * Returns browser information. Example
- * <code>
- * var browser = Prado.Browser();
- * alert(browser.ie); //should ouput true if IE, false otherwise
- * </code>
- * @param ${parameter}
- * @return ${return}
- */
- Browser : function()
- {
- var info = { Version : "1.0" };
- var is_major = parseInt( navigator.appVersion );
- info.nver = is_major;
- info.ver = navigator.appVersion;
- info.agent = navigator.userAgent;
- info.dom = document.getElementById ? 1 : 0;
- info.opera = window.opera ? 1 : 0;
- info.ie5 = ( info.ver.indexOf( "MSIE 5" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
- info.ie6 = ( info.ver.indexOf( "MSIE 6" ) > -1 && info.dom && !info.opera ) ? 1 : 0;
- info.ie4 = ( document.all && !info.dom && !info.opera ) ? 1 : 0;
- info.ie = info.ie4 || info.ie5 || info.ie6;
- info.mac = info.agent.indexOf( "Mac" ) > -1;
- info.ns6 = ( info.dom && parseInt( info.ver ) >= 5 ) ? 1 : 0;
- info.ie3 = ( info.ver.indexOf( "MSIE" ) && ( is_major < 4 ) );
- info.hotjava = ( info.agent.toLowerCase().indexOf( 'hotjava' ) != -1 ) ? 1 : 0;
- info.ns4 = ( document.layers && !info.dom && !info.hotjava ) ? 1 : 0;
- info.bw = ( info.ie6 || info.ie5 || info.ie4 || info.ns4 || info.ns6 || info.opera );
- info.ver3 = ( info.hotjava || info.ie3 );
- info.opera7 = ( ( info.agent.toLowerCase().indexOf( 'opera 7' ) > -1 ) || ( info.agent.toLowerCase().indexOf( 'opera/7' ) > -1 ) );
- info.operaOld = info.opera && !info.opera7;
- return info;
- },
-
- ImportCss : function(doc, css_file)
- {
- if (Prado.Browser().ie)
- var styleSheet = doc.createStyleSheet(css_file);
- else
- {
- var elm = doc.createElement("link");
-
- elm.rel = "stylesheet";
- elm.href = css_file;
-
- if (headArr = doc.getElementsByTagName("head"))
- headArr[0].appendChild(elm);
- }
- }
-};
-
-
-/*Prado.Focus = Class.create();
-
-Prado.Focus.setFocus = function(id)
-{
- var target = document.getElementById ? document.getElementById(id) : document.all[id];
- if(target && !Prado.Focus.canFocusOn(target))
- {
- target = Prado.Focus.findTarget(target);
- }
- if(target)
- {
- try
- {
- target.focus();
- target.scrollIntoView(false);
- if (window.__smartNav)
- {
- window.__smartNav.ae = target.id;
- }
- }
- catch (e)
- {
- }
- }
-}
-
-Prado.Focus.canFocusOn = function(element)
-{
- if(!element || !(element.tagName))
- return false;
- var tagName = element.tagName.toLowerCase();
- return !element.disabled && (!element.type || element.type.toLowerCase() != "hidden") && Prado.Focus.isFocusableTag(tagName) && Prado.Focus.isVisible(element);
-}
-
-Prado.Focus.isFocusableTag = function(tagName)
-{
- return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a");
-}
-
-
-Prado.Focus.findTarget = function(element)
-{
- if(!element || !(element.tagName))
- {
- return null;
- }
- var tagName = element.tagName.toLowerCase();
- if (tagName == "undefined")
- {
- return null;
- }
- var children = element.childNodes;
- if (children)
- {
- for(var i=0;i<children.length;i++)
- {
- try
- {
- if(Prado.Focus.canFocusOn(children[i]))
- {
- return children[i];
- }
- else
- {
- var target = Prado.Focus.findTarget(children[i]);
- if(target)
- {
- return target;
- }
- }
- }
- catch (e)
- {
- }
- }
- }
- return null;
-}
-
-Prado.Focus.isVisible = function(element)
-{
- var current = element;
- while((typeof(current) != "undefined") && (current != null))
- {
- if(current.disabled || (typeof(current.style) != "undefined" && ((typeof(current.style.display) != "undefined" && current.style.display == "none") || (typeof(current.style.visibility) != "undefined" && current.style.visibility == "hidden") )))
- {
- return false;
- }
- if(typeof(current.parentNode) != "undefined" && current.parentNode != null && current.parentNode != current && current.parentNode.tagName.toLowerCase() != "body")
- {
- current = current.parentNode;
- }
- else
- {
- return true;
- }
- }
- return true;
-}
-*/
-
-
-Prado.PostBack = function(event,options)
-{
- var form = $(options['FormID']);
- var canSubmit = true;
-
- if(options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
- {
- if(!Prado.Validation.validate(options['FormID'], options['ValidationGroup'], $(options['ID'])))
- return Event.stop(event);
- }
-
- if(options['PostBackUrl'] && options['PostBackUrl'].length > 0)
- form.action = options['PostBackUrl'];
-
- if(options['TrackFocus'])
- {
- var lastFocus = $('PRADO_LASTFOCUS');
- if(lastFocus)
- {
- var active = document.activeElement; //where did this come from
- if(active)
- lastFocus.value = active.id;
- else
- lastFocus.value = options['EventTarget'];
- }
- }
-
- $('PRADO_POSTBACK_TARGET').value = options['EventTarget'];
- $('PRADO_POSTBACK_PARAMETER').value = options['EventParameter'];
- /**
- * Since google toolbar prevents browser default action,
- * we will always disable default client-side browser action
- */
- /*if(options['StopEvent']) */
- Event.stop(event);
- Event.fireEvent(form,"submit");
-}
-
-/*
-
-Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
-{
- if (typeof(performValidation) == 'undefined')
- {
- var performValidation = false;
- var validationGroup = '';
- var actionUrl = null;
- var trackFocus = false;
- var clientSubmit = true;
- }
- var theForm = document.getElementById ? document.getElementById(formID) : document.forms[formID];
- var canSubmit = true;
- if (performValidation)
- {
- //canSubmit = Prado.Validation.validate(validationGroup);
- * Prado.Validation.ActiveTarget = theForm;
- Prado.Validation.CurrentTargetGroup = null;
- Prado.Validation.IsGroupValidation = false;
- canSubmit = Prado.Validation.IsValid(theForm);
- Logger.debug(canSubmit);*
- canSubmit = Prado.Validation.IsValid(theForm);
- }
- if (canSubmit)
- {
- if (actionUrl != null && (actionUrl.length > 0))
- {
- theForm.action = actionUrl;
- }
- if (trackFocus)
- {
- var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
- if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
- {
- var active = document.activeElement;
- if (typeof(active) == 'undefined')
- {
- lastFocus.value = eventTarget;
- }
- else
- {
- if ((active != null) && (typeof(active.id) != 'undefined'))
- {
- if (active.id.length > 0)
- {
- lastFocus.value = active.id;
- }
- else if (typeof(active.name) != 'undefined')
- {
- lastFocus.value = active.name;
- }
- }
- }
- }
- }
- if (!clientSubmit)
- {
- canSubmit = false;
- }
- }
- if (canSubmit && (!theForm.onsubmit || theForm.onsubmit()))
- {
- theForm.PRADO_POSTBACK_TARGET.value = eventTarget;
- theForm.PRADO_POSTBACK_PARAMETER.value = eventParameter;
- theForm.submit();
- }
-}
-*/
-
-Prado.Element =
-{
- /**
- * Set the value of a particular element.
- * @param string element id
- * @param string new element value.
- */
- setValue : function(element, value)
- {
- var el = $(element);
- if(el && typeof(el.value) != "undefined")
- el.value = value;
- },
-
- select : function(element, method, value)
- {
- var el = $(element);
- var isList = element.indexOf('[]') > -1;
- if(!el && !isList) return;
- method = isList ? 'check'+method : el.tagName.toLowerCase()+method;
- var selection = Prado.Element.Selection;
- if(isFunction(selection[method]))
- selection[method](isList ? element : el,value);
- },
-
- click : function(element)
- {
- var el = $(element);
- if(el)
- Event.fireEvent(el,'click');
- },
-
- setAttribute : function(element, attribute, value)
- {
- var el = $(element);
- if(attribute == "disabled" && value==false)
- el.removeAttribute(attribute);
- else
- el.setAttribute(attribute, value);
- },
-
- setOptions : function(element, options)
- {
- var el = $(element);
- if(el && el.tagName.toLowerCase() == "select")
- {
- while(el.length > 0)
- el.remove(0);
- for(var i = 0; i<options.length; i++)
- el.options[el.options.length] = new Option(options[i][0],options[i][1]);
- }
- },
-
- /**
- * A delayed focus on a particular element
- * @param {element} element to apply focus()
- */
- focus : function(element)
- {
- var obj = $(element);
- if(typeof(obj) != "undefined" && typeof(obj.focus) != "undefined")
- setTimeout(function(){ obj.focus(); }, 100);
- return false;
- }
-}
-
-Prado.Element.Selection =
-{
- inputValue : function(el, value)
- {
- switch(el.type.toLowerCase())
- {
- case 'checkbox':
- case 'radio':
- return el.checked = value;
- }
- },
-
- selectValue : function(el, value)
- {
- $A(el.options).each(function(option)
- {
- option.selected = option.value == value;
- });
- },
-
- selectIndex : function(el, index)
- {
- if(el.type == 'select-one')
- el.selectedIndex = index;
- else
- {
- for(var i = 0; i<el.length; i++)
- {
- if(i == index)
- el.options[i].selected = true;
- }
- }
- },
-
- selectClear : function(el)
- {
- el.selectedIndex = -1;
- },
-
- selectAll : function(el)
- {
- $A(el.options).each(function(option)
- {
- option.selected = true;
- Logger.warn(option.value);
- });
- },
-
- selectInvert : function(el)
- {
- $A(el.options).each(function(option)
- {
- option.selected = !option.selected;
- });
- },
-
- checkValue : function(name, value)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = el.value == value
- });
- },
-
- checkIndex : function(name, index)
- {
- var elements = $A(document.getElementsByName(name));
- for(var i = 0; i<elements.length; i++)
- {
- if(i == index)
- elements[i].checked = true;
- }
- },
-
- checkClear : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = false;
- });
- },
-
- checkAll : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = true;
- });
- },
- checkInvert : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = !el.checked;
- });
- }
-};
-
Prado.WebUI = Class.create();
-//base postback-able controls
-/*Prado.WebUI.PostBackControl = Class.create();
-Prado.WebUI.PostBackControl.prototype =
-{
- initialize : function(options)
- {
- this.element = $(options['ID']);
-
-/* if(options.CausesValidation && typeof(Prado.Validation) != 'undefined')
- {
- Prado.Validation.registerTarget(options);
- }
-
- //TODO: what do the following options do?
- //options['PostBackUrl']
- //options['ClientSubmit']
-
- if(this.onInit)
- this.onInit(options);
- }
-};
-
-//short cut to create postback components
-Prado.WebUI.createPostBackComponent = function(definition)
-{
- var component = Class.create();
- Object.extend(component.prototype, Prado.WebUI.PostBackControl.prototype);
- if(definition) Object.extend(component.prototype, definition);
- return component;
-}
-
-Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent();
-*/
Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
{
- _elementOnClick : null, //capture the element's onclick function
-
initialize : function(options)
{
+ this._elementOnClick = null, //capture the element's onclick function
+
this.element = $(options.ID);
- if(this.onInit)
- this.onInit(options);
+ if(this.element)
+ {
+ if(this.onInit)
+ this.onInit(options);
+ }
},
onInit : function(options)
@@ -4432,10 +4242,10 @@ Prado.WebUI.PostBackControl.prototype =
this._elementOnClick = this.element.onclick;
this.element.onclick = null;
}
- Event.observe(this.element, "click", this.onClick.bindEvent(this,options));
+ Event.observe(this.element, "click", this.elementClicked.bindEvent(this,options));
},
- onClick : function(event, options)
+ elementClicked : function(event, options)
{
var src = Event.element(event);
var doPostBack = true;
@@ -4493,15 +4303,33 @@ Object.extend(Prado.WebUI.TImageButton.prototype,
*/
addXYInput : function(event,options)
{
- var imagePos = Position.cumulativeOffset(this.element);
- var clickedPos = [event.clientX, event.clientY];
- var x = clickedPos[0]-imagePos[0]+1;
- var y = clickedPos[1]-imagePos[1]+1;
- var id = options['EventTarget'];
- var x_input = INPUT({type:'hidden',name:id+'_x',value:x});
- var y_input = INPUT({type:'hidden',name:id+'_y',value:y});
- this.element.parentNode.appendChild(x_input);
- this.element.parentNode.appendChild(y_input);
+ imagePos = Position.cumulativeOffset(this.element);
+ clickedPos = [event.clientX, event.clientY];
+ x = clickedPos[0]-imagePos[0]+1;
+ y = clickedPos[1]-imagePos[1]+1;
+ x = x < 0 ? 0 : x;
+ y = y < 0 ? 0 : y;
+ id = options['EventTarget'];
+ x_input = $(id+"_x");
+ y_input = $(id+"_y");
+ if(x_input)
+ {
+ x_input.value = x;
+ }
+ else
+ {
+ x_input = INPUT({type:'hidden',name:id+'_x','id':id+'_x',value:x});
+ this.element.parentNode.appendChild(x_input);
+ }
+ if(y_input)
+ {
+ y_input.value = y;
+ }
+ else
+ {
+ y_input = INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});
+ this.element.parentNode.appendChild(y_input);
+ }
}
});
@@ -4516,8 +4344,11 @@ Object.extend(Prado.WebUI.TRadioButton.prototype,
initialize : function(options)
{
this.element = $(options['ID']);
- if(!this.element.checked)
- this.onRadioButtonInitialize(options);
+ if(this.element)
+ {
+ if(!this.element.checked)
+ this.onRadioButtonInitialize(options);
+ }
}
});
@@ -4526,9 +4357,11 @@ Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
{
onInit : function(options)
{
+ this.options=options;
if(options['TextMode'] != 'MultiLine')
Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
- Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
},
handleReturnKey : function(e)
@@ -4538,8 +4371,19 @@ Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
var target = Event.element(e);
if(target)
{
- Event.fireEvent(target, "change");
- Event.stop(e);
+ if(this.options['AutoPostBack']==true)
+ {
+ Event.fireEvent(target, "change");
+ Event.stop(e);
+ }
+ else
+ {
+ if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+ {
+ if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], $(this.options['ID'])))
+ return Event.stop(e);
+ }
+ }
}
}
}
@@ -4630,66 +4474,37 @@ Object.extend(Prado.WebUI.TTextHighlighter,
obj.parentNode.className = "copycode";
}
});
-
-
-Prado.WebUI.TRatingList = Class.create();
-Prado.WebUI.TRatingList.prototype =
-{
- selectedIndex : -1,
- initialize : function(options)
+
+Prado.WebUI.TCheckBoxList = Base.extend(
+{
+ constructor : function(options)
{
- this.options = options;
- this.element = $(options['ID']);
- Element.addClassName(this.element,options.cssClass);
- this.radios = document.getElementsByName(options.field);
- for(var i = 0; i<this.radios.length; i++)
+ for(var i = 0; i<options.ItemCount; i++)
{
- Event.observe(this.radios[i].parentNode, "mouseover", this.hover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode, "mouseout", this.recover.bindEvent(this,i));
- Event.observe(this.radios[i].parentNode, "click", this.click.bindEvent(this, i));
- }
- this.caption = CAPTION();
- this.element.appendChild(this.caption);
- this.selectedIndex = options.selectedIndex;
- this.setRating(this.selectedIndex);
- },
-
- hover : function(ev,index)
- {
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].parentNode.className = (i<=index) ? "rating_hover" : "";
- this.setCaption(index);
- },
-
- recover : function(ev,index)
- {
- for(var i = 0; i<=index; i++)
- Element.removeClassName(this.radios[i].parentNode, "rating_hover");
- this.setRating(this.selectedIndex);
- },
-
- click : function(ev, index)
- {
- for(var i = 0; i<this.radios.length; i++)
- this.radios[i].checked = (i == index);
- this.selectedIndex = index;
- this.setRating(index);
- if(isFunction(this.options.onChange))
- this.options.onChange(this,index);
- },
-
- setRating: function(index)
- {
- for(var i = 0; i<=index; i++)
- this.radios[i].parentNode.className = "rating_selected";
- this.setCaption(index);
- },
-
- setCaption : function(index)
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TRadioButtonList = Base.extend(
+{
+ constructor : function(options)
{
- this.caption.innerHTML = index > -1 ?
- this.radios[index].value : this.options.caption;
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var radioButtonOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TRadioButton(radioButtonOptions);
+ }
}
-}
+});
diff --git a/framework/Web/Javascripts/prado/activecontrols.js b/framework/Web/Javascripts/prado/activecontrols.js
deleted file mode 100644
index 72f97511..00000000
--- a/framework/Web/Javascripts/prado/activecontrols.js
+++ /dev/null
@@ -1,196 +0,0 @@
-/**
- * Auto complete textbox via AJAX.
- */
-Prado.AutoCompleter = Class.create();
-
-
-/**
- * Overrides parent implementation of updateElement by trimming the value.
- */
-Prado.AutoCompleter.Base = function(){};
-Prado.AutoCompleter.Base.prototype = Object.extend(Autocompleter.Base.prototype,
-{
- updateElement: function(selectedElement)
- {
- if (this.options.updateElement) {
- this.options.updateElement(selectedElement);
- return;
- }
-
- var value = Element.collectTextNodesIgnoreClass(selectedElement, 'informal');
- var lastTokenPos = this.findLastToken();
- if (lastTokenPos != -1) {
- var newValue = this.element.value.substr(0, lastTokenPos + 1);
- var whitespace = this.element.value.substr(lastTokenPos + 1).match(/^\s+/);
- if (whitespace)
- newValue += whitespace[0];
- this.element.value = (newValue + value).trim();
- } else {
- this.element.value = value.trim();
- }
- this.element.focus();
-
- if (this.options.afterUpdateElement)
- this.options.afterUpdateElement(this.element, selectedElement);
- }
-});
-
-/**
- * Based on the Prototype Autocompleter class.
- * This client-side component should be instantiated from a Prado component.
- * Usage: <t>new Prado.AutoCompleter('textboxID', 'updateDivID', {callbackID : '...'});
- */
-Prado.AutoCompleter.prototype = Object.extend(new Autocompleter.Base(),
-{
- /**
- * This component is initialized by
- * <code>new Prado.AutoCompleter(...)</code>
- * @param string the ID of the textbox element to observe
- * @param string the ID of the div to display the auto-complete options
- * @param array a hash of options, e.g. auto-completion token separator.
- */
- initialize : function(element, update, options)
- {
- this.baseInitialize(element, update, options);
- },
-
- /**
- * The callback function, i.e., function called on successful AJAX return.
- * Calls update choices in the Autocompleter.
- * @param string new auto-complete options for display
- */
- onUpdateReturn : function(result)
- {
- if(isString(result) && result.length > 0)
- this.updateChoices(result);
- },
-
- /**
- * Requesting new choices using Prado's client-side callback scheme.
- */
- getUpdatedChoices : function()
- {
- Prado.Callback(this.element.id, this.getToken(), this.onUpdateReturn.bind(this));
- }
-});
-
-/**
- * Prado TActivePanel client javascript. Usage
- * <code>
- * Prado.ActivePanel.register("id", options);
- * Prado.ActivePanel.update("id", "hello");
- * </code>
- */
-Prado.ActivePanel =
-{
- callbacks : {},
-
- register : function(id, options)
- {
- Prado.ActivePanel.callbacks[id] = options;
- },
-
- update : function(id, param)
- {
- var request = new Prado.ActivePanel.Request(id,
- Prado.ActivePanel.callbacks[id]);
- request.callback(param);
- }
-}
-
-/**
- * Client-script for TActivePanel. Uses Callback to notify the server
- * for updates, if update option is set, the innerHTML of the update ID
- * is set to the returned output.
- */
-Prado.ActivePanel.Request = Class.create();
-Prado.ActivePanel.Request.prototype =
-{
- initialize : function(element, options)
- {
- this.element = element;
- this.setOptions(options);
- },
-
- /**
- * Set some options.
- */
- setOptions : function(options)
- {
- this.options =
- {
- onSuccess : this.onSuccess.bind(this)
- }
- Object.extend(this.options, options || {});
- },
-
- /**
- * Make the callback request
- */
- callback : function(param)
- {
- this.options.params = [param];
- new Prado.AJAX.Callback(this.element, this.options);
- },
-
- /**
- * Callback onSuccess handler, update the element innerHTML if necessary
- */
- onSuccess : function(result, output)
- {
- if(this.options.update)
- {
- if (!this.options.evalScripts)
- output = output.stripScripts();
- Element.update(this.options.update, output);
- }
- }
-}
-
-/**
- * Drop container to accept draggable component drops.
- */
-Prado.DropContainer = Class.create();
-Prado.DropContainer.prototype = Object.extend(new Prado.ActivePanel.Request(),
-{
- initialize : function(element, options)
- {
- this.element = element;
- this.setOptions(options);
- Object.extend(this.options,
- {
- onDrop : this.onDrop.bind(this),
- evalScripts : true,
- onSuccess : options.onSuccess || this.onSuccess.bind(this)
- });
- Droppables.add(element, this.options);
- },
-
- onDrop : function(draggable, droppable)
- {
- this.callback(draggable.id)
- }
-});
-
-Prado.ActiveImageButton = Class.create();
-Prado.ActiveImageButton.prototype =
-{
- initialize : function(element, options)
- {
- this.element = $(element);
- this.options = options;
- Event.observe(this.element, "click", this.click.bind(this));
- },
-
- click : function(e)
- {
- var el = $('{$this->ClientID}');
- var imagePos = Position.cumulativeOffset(this.element);
- var clickedPos = [e.clientX, e.clientY];
- var param = (clickedPos[0]-imagePos[0]+1)+","+(clickedPos[1]-imagePos[1]+1);
- Prado.Callback(this.element, param, null, this.options);
- Event.stop(e);
- }
-}
-
-
diff --git a/framework/Web/Javascripts/prado/ajax.js b/framework/Web/Javascripts/prado/ajax.js
deleted file mode 100644
index 4f1c1ec9..00000000
--- a/framework/Web/Javascripts/prado/ajax.js
+++ /dev/null
@@ -1,427 +0,0 @@
-/**
- * Prado AJAX service. The default service provider is JPSpan.
- */
-Prado.AJAX = { Service : 'Prototype' };
-
-/**
- * Parse and execute javascript embedded in html.
- */
-Prado.AJAX.EvalScript = function(output)
-{
-
- var match = new RegExp(Ajax.Updater.ScriptFragment, 'img');
- var scripts = output.match(match);
- if (scripts)
- {
- match = new RegExp(Ajax.Updater.ScriptFragment, 'im');
- setTimeout((function()
- {
- for (var i = 0; i < scripts.length; i++)
- eval(scripts[i].match(match)[1]);
- }).bind(this), 50);
- }
-}
-
-
-/**
- * AJAX service request using Prototype's AJAX request class.
- */
-Prado.AJAX.Request = Class.create();
-Prado.AJAX.Request.prototype = Object.extend(Ajax.Request.prototype,
-{
- /**
- * Evaluate the respond JSON data, override parent implementing.
- * If default eval fails, try parsing the JSON data (slower).
- */
- evalJSON: function()
- {
- try
- {
- var json = this.transport.getResponseHeader('X-JSON'), object;
- object = eval(json);
- return object;
- }
- catch (e)
- {
- if(isString(json))
- {
- return Prado.AJAX.JSON.parse(json);
- }
- }
- },
-
- respondToReadyState: function(readyState) {
- var event = Ajax.Request.Events[readyState];
- var transport = this.transport, json = this.evalJSON();
-
-
- if(event == 'Complete' && transport.status)
- Ajax.Responders.dispatch('on' + transport.status, this, transport, json);
-
- (this.options['on' + event] || Prototype.emptyFunction)(transport, json);
- Ajax.Responders.dispatch('on' + event, this, transport, json);
-
- if (event == 'Complete')
- (this.options['on' + this.transport.status]
- || this.options['on' + (this.responseIsSuccess() ? 'Success' : 'Failure')]
- || Prototype.emptyFunction)(transport, json);
-
-
- /* Avoid memory leak in MSIE: clean up the oncomplete event handler */
- if (event == 'Complete')
- this.transport.onreadystatechange = Prototype.emptyFunction;
- }
-
-});
-
-Prado.AJAX.Error = function(e, code)
-{
- e.name = 'Prado.AJAX.Error';
- e.code = code;
- return e;
-}
-
-/**
- * Post data builder, serialize the data using JSON.
- */
-Prado.AJAX.RequestBuilder = Class.create();
-Prado.AJAX.RequestBuilder.prototype =
-{
- initialize : function()
- {
- this.body = '';
- this.data = [];
- },
- encode : function(data)
- {
- return Prado.AJAX.JSON.stringify(data);
- },
- build : function(data)
- {
- var sep = '';
- for ( var argName in data)
- {
- if(isFunction(data[argName])) continue;
- try
- {
- this.body += sep + argName + '=';
- this.body += encodeURIComponent(this.encode(data[argName]));
- } catch (e) {
- throw Prado.AJAX.Error(e, 1006);
- }
- sep = '&';
- }
- },
-
- getAll : function()
- {
- this.build(this.data);
- return this.body;
- }
-}
-
-
-Prado.AJAX.RemoteObject = function(){};
-
-/**
- * AJAX service request for Prado RemoteObjects
- */
-Prado.AJAX.RemoteObject.Request = Class.create();
-Prado.AJAX.RemoteObject.Request.prototype = Object.extend(Prado.AJAX.Request.prototype,
-{
- /**
- * Initialize the RemoteObject Request, overrides parent
- * implementation by delaying the request to invokeRemoteObject.
- */
- initialize : function(options)
- {
- this.transport = Ajax.getTransport();
- this.setOptions(options);
- this.post = new Prado.AJAX.RequestBuilder();
- },
-
- /**
- * Call the remote object,
- * @param string the remote server url
- * @param array additional arguments
- */
- invokeRemoteObject : function(url, args)
- {
- this.initParameters(args);
- this.options.postBody = this.post.getAll();
- this.request(url);
- },
-
- /**
- * Set the additional arguments as post data with key '__parameters'
- */
- initParameters : function(args)
- {
- this.post.data['__parameters'] = [];
- for(var i = 0; i<args.length; i++)
- this.post.data['__parameters'][i] = args[i];
- }
-});
-
-/**
- * Base proxy class for Prado RemoteObjects via AJAX.
- * e.g.
- * <code>
- * var TestObject1 = Class.create();
- * TestObject1.prototype = Object.extend(new Prado.AJAX.RemoteObject(),
- * {
- * initialize : function(handlers, options)
- * {
- * this.__serverurl = 'http://127.0.0.1/.....';
- * this.baseInitialize(handlers, options);
- * }
- *
- * method1 : function()
- * {
- * return this.__call(this.__serverurl, 'method1', arguments);
- * }
- * });
- *</code>
- * And client usage,
- * <code>
- * var test1 = new TestObject1(); //create new remote object
- * test1.method1(); //call the method, no onComplete hook
- *
- * var onComplete = { method1 : function(result){ alert(result) } };
- * //create new remote object with onComplete callback
- * var test2 = new TestObject1(onComplete);
- * test2.method1(); //call it, on success, onComplete's method1 is called.
- * </code>
- */
-Prado.AJAX.RemoteObject.prototype =
-{
- baseInitialize : function(handlers, options)
- {
- this.__handlers = handlers || {};
- this.__service = new Prado.AJAX.RemoteObject.Request(options);
- },
-
- __call : function(url, method, args)
- {
- this.__service.options.onSuccess = this.__onSuccess.bind(this);
- this.__callback = method;
- return this.__service.invokeRemoteObject(url+"/"+method, args);
- },
-
- __onSuccess : function(transport, json)
- {
- if(this.__handlers[this.__callback])
- this.__handlers[this.__callback](json, transport.responseText);
- }
-};
-
-/**
- * Respond to Prado AJAX request exceptions.
- */
-Prado.AJAX.Exception =
-{
- /**
- * Server returns 505 exception. Just log it.
- */
- "on505" : function(request, transport, e)
- {
- var msg = 'HTTP '+transport.status+" with response";
- Logger.error(msg, transport.responseText);
- Logger.exception(e);
- },
-
- onComplete : function(request, transport, e)
- {
- if(transport.status != 505)
- {
- var msg = 'HTTP '+transport.status+" with response : \n";
- msg += transport.responseText + "\n";
- msg += "Data : \n"+inspect(e);
- Logger.warn(msg);
- }
- },
-
- format : function(e)
- {
- var msg = e.type + " with message \""+e.message+"\"";
- msg += " in "+e.file+"("+e.line+")\n";
- msg += "Stack trace:\n";
- var trace = e.trace;
- for(var i = 0; i<trace.length; i++)
- {
- msg += " #"+i+" "+trace[i].file;
- msg += "("+trace[i].line+"): ";
- msg += trace[i]["class"]+"->"+trace[i]["function"]+"()"+"\n";
- }
- return msg;
- },
-
- logException : function(e)
- {
- var msg = Prado.AJAX.Exception.format(e);
- Logger.error("Server Error "+e.code, msg);
- }
-}
-
-//Add HTTP exception respones when logger is enabled.
-Event.OnLoad(function()
-{
- if(typeof Logger != "undefined")
- {
- Logger.exception = Prado.AJAX.Exception.logException;
- Ajax.Responders.register(Prado.AJAX.Exception);
- }
-});
-
-/**
- * Prado Callback service that provides component intergration,
- * viewstate (read only), and automatic form data serialization.
- * Usage: <code>new Prado.AJAX.Callback('MyPage.MyComponentID.raiseCallbackEvent', options)</code>
- * These classes should be called by the components developers.
- * For inline callback service, use <t>Prado.Callback(callbackID, params)</t>.
- */
-Prado.AJAX.Callback = Class.create();
-Prado.AJAX.Callback.prototype = Object.extend(new Prado.AJAX.RemoteObject(),
-{
-
- /**
- * Create and request a new Prado callback service.
- * @param string|element the callback ID, must be of the form, <t>ClassName.ComponentID.MethodName</t>
- * @param list options with list key onCallbackReturn, and more.
- *
- */
- initialize : function(ID, options)
- {
- if(!isString(ID) && typeof(ID.id) != "undefined")
- ID = ID.id;
- if(!isString(ID))
- throw new Error('A Control ID must be specified');
- this.baseInitialize(this, options);
- this.options = options || [];
- this.__service.post.data['__ID'] = ID;
- this.requestCallback();
- },
-
- /**
- * Get form data for components that implements IPostBackHandler.
- */
- collectPostData : function()
- {
- var IDs = Prado.AJAX.Callback.IDs;
- this.__service.post.data['__data'] = {};
- for(var i = 0; i<IDs.length; i++)
- {
- var id = IDs[i];
- if(id.indexOf("[]") > -1)
- this.__service.post.data['__data'][id] =
- this.collectArrayPostData(id);
- else if(isObject($(id)))
- this.__service.post.data['__data'][id] = $F(id);
- }
- },
-
- collectArrayPostData : function(name)
- {
- var elements = document.getElementsByName(name);
- var data = [];
- $A(elements).each(function(el)
- {
- if($F(el)) data.push($F(el));
- });
- return data;
- },
-
- /**
- * Prepares and calls the AJAX request.
- * Collects the data from components that implements IPostBackHandler
- * and the viewstate as part of the request payload.
- */
- requestCallback : function()
- {
- this.collectPostData();
- if(Prado.AJAX.Validate(this.options))
- return this.__call(Prado.AJAX.Callback.Server, 'handleCallback', this.options.params);
- },
-
- /**
- * On callback request return, call the onSuccess function.
- */
- handleCallback : function(result, output)
- {
- if(typeof(result) != "undefined" && !isNull(result))
- {
- this.options.onSuccess(result['data'], output);
- if(result['actions'])
- result.actions.each(Prado.AJAX.Callback.Action.__run);
- }
- }
-});
-
-/**
- * Prase and evaluate Callback clien-side actions.
- */
-Prado.AJAX.Callback.Action =
-{
- __run : function(command)
- {
- for(var name in command)
- {
- //first parameter must be a valid element or begins with '@'
- if(command[name][0] && ($(command[name][0]) || command[name][0].indexOf("[]") > -1))
- {
- name.toFunction().apply(this,command[name]);
- }
- }
- }
-};
-
-
-/**
- * Returns false if validation required and validates to false,
- * returns true otherwise.
- * @return boolean true if validation passes.
- */
-Prado.AJAX.Validate = function(options)
-{
- if(options.CausesValidation)
- {
- if(options.ValidatorGroup)
- return Prado.Validation.ValidateValidatorGroup(options.ValidatorGroup);
- else if(options.ValidationGroup)
- return Prado.Validation.ValidateValidationGroup(options.ValidationGroup);
- else
- return Prado.Validation.ValidateNonGroup(options.ValidationForm);
- }
- else
- return true;
-};
-
-
-//Available callback service
-Prado.AJAX.Callback.Server = '';
-
-//List of IDs that implements IPostBackHandler
-Prado.AJAX.Callback.IDs = [];
-
-/**
- * Simple AJAX callback interface, suitable for inline javascript.
- * e.g., <code><a href="..." onclick="Prado.Callback('..', 'Hello');">Click me</a></code>
- * @param {String} callback ID
- * @param {Array} parameters to pass to the callback service
- * @param {Function} on callback success handler method
- * @param {Object} additional callback options
- */
-Prado.Callback = function(ID, params, onSuccess, options)
-{
- var callback =
- {
- 'params' : [params] || [],
- 'onSuccess' : onSuccess || Prototype.emptyFunction,
- 'CausesValidation' : true
- };
-
- Object.extend(callback, options || {});
-
- new Prado.AJAX.Callback(ID, callback);
- return false;
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/colorpicker/background.png b/framework/Web/Javascripts/prado/colorpicker/background.png
index 91798cf5..91798cf5 100644
--- a/framework/Web/Javascripts/colorpicker/background.png
+++ b/framework/Web/Javascripts/prado/colorpicker/background.png
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/button.gif b/framework/Web/Javascripts/prado/colorpicker/button.gif
index 67f17975..67f17975 100644
--- a/framework/Web/Javascripts/colorpicker/button.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/button.gif
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/colorpicker.js b/framework/Web/Javascripts/prado/colorpicker/colorpicker.js
index acf5531c..acf5531c 100644
--- a/framework/Web/Javascripts/colorpicker/colorpicker.js
+++ b/framework/Web/Javascripts/prado/colorpicker/colorpicker.js
diff --git a/framework/Web/Javascripts/colorpicker/default.css b/framework/Web/Javascripts/prado/colorpicker/default.css
index 67235c08..67235c08 100644
--- a/framework/Web/Javascripts/colorpicker/default.css
+++ b/framework/Web/Javascripts/prado/colorpicker/default.css
diff --git a/framework/Web/Javascripts/colorpicker/hue.gif b/framework/Web/Javascripts/prado/colorpicker/hue.gif
index 901e409c..901e409c 100644
--- a/framework/Web/Javascripts/colorpicker/hue.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/hue.gif
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/slider.gif b/framework/Web/Javascripts/prado/colorpicker/slider.gif
index 92f9d744..92f9d744 100644
--- a/framework/Web/Javascripts/colorpicker/slider.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/slider.gif
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/spacer.gif b/framework/Web/Javascripts/prado/colorpicker/spacer.gif
index fc256098..fc256098 100755
--- a/framework/Web/Javascripts/colorpicker/spacer.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/spacer.gif
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/target_black.gif b/framework/Web/Javascripts/prado/colorpicker/target_black.gif
index ebb89f58..ebb89f58 100644
--- a/framework/Web/Javascripts/colorpicker/target_black.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/target_black.gif
Binary files differ
diff --git a/framework/Web/Javascripts/colorpicker/target_white.gif b/framework/Web/Javascripts/prado/colorpicker/target_white.gif
index c3527c86..c3527c86 100644
--- a/framework/Web/Javascripts/colorpicker/target_white.gif
+++ b/framework/Web/Javascripts/prado/colorpicker/target_white.gif
Binary files differ
diff --git a/framework/Web/Javascripts/prado/controls.js b/framework/Web/Javascripts/prado/controls/controls.js
index dac934f6..64fb1a30 100644
--- a/framework/Web/Javascripts/prado/controls.js
+++ b/framework/Web/Javascripts/prado/controls/controls.js
@@ -1,49 +1,19 @@
Prado.WebUI = Class.create();
-//base postback-able controls
-/*Prado.WebUI.PostBackControl = Class.create();
-Prado.WebUI.PostBackControl.prototype =
-{
- initialize : function(options)
- {
- this.element = $(options['ID']);
-
-/* if(options.CausesValidation && typeof(Prado.Validation) != 'undefined')
- {
- Prado.Validation.registerTarget(options);
- }
-
- //TODO: what do the following options do?
- //options['PostBackUrl']
- //options['ClientSubmit']
-
- if(this.onInit)
- this.onInit(options);
- }
-};
-
-//short cut to create postback components
-Prado.WebUI.createPostBackComponent = function(definition)
-{
- var component = Class.create();
- Object.extend(component.prototype, Prado.WebUI.PostBackControl.prototype);
- if(definition) Object.extend(component.prototype, definition);
- return component;
-}
-
-Prado.WebUI.TButton = Prado.WebUI.createPostBackComponent();
-*/
Prado.WebUI.PostBackControl = Class.create();
Prado.WebUI.PostBackControl.prototype =
{
- _elementOnClick : null, //capture the element's onclick function
-
initialize : function(options)
{
+ this._elementOnClick = null, //capture the element's onclick function
+
this.element = $(options.ID);
- if(this.onInit)
- this.onInit(options);
+ if(this.element)
+ {
+ if(this.onInit)
+ this.onInit(options);
+ }
},
onInit : function(options)
@@ -53,10 +23,10 @@ Prado.WebUI.PostBackControl.prototype =
this._elementOnClick = this.element.onclick;
this.element.onclick = null;
}
- Event.observe(this.element, "click", this.onClick.bindEvent(this,options));
+ Event.observe(this.element, "click", this.elementClicked.bindEvent(this,options));
},
- onClick : function(event, options)
+ elementClicked : function(event, options)
{
var src = Event.element(event);
var doPostBack = true;
@@ -114,15 +84,33 @@ Object.extend(Prado.WebUI.TImageButton.prototype,
*/
addXYInput : function(event,options)
{
- var imagePos = Position.cumulativeOffset(this.element);
- var clickedPos = [event.clientX, event.clientY];
- var x = clickedPos[0]-imagePos[0]+1;
- var y = clickedPos[1]-imagePos[1]+1;
- var id = options['EventTarget'];
- var x_input = INPUT({type:'hidden',name:id+'_x',value:x});
- var y_input = INPUT({type:'hidden',name:id+'_y',value:y});
- this.element.parentNode.appendChild(x_input);
- this.element.parentNode.appendChild(y_input);
+ imagePos = Position.cumulativeOffset(this.element);
+ clickedPos = [event.clientX, event.clientY];
+ x = clickedPos[0]-imagePos[0]+1;
+ y = clickedPos[1]-imagePos[1]+1;
+ x = x < 0 ? 0 : x;
+ y = y < 0 ? 0 : y;
+ id = options['EventTarget'];
+ x_input = $(id+"_x");
+ y_input = $(id+"_y");
+ if(x_input)
+ {
+ x_input.value = x;
+ }
+ else
+ {
+ x_input = INPUT({type:'hidden',name:id+'_x','id':id+'_x',value:x});
+ this.element.parentNode.appendChild(x_input);
+ }
+ if(y_input)
+ {
+ y_input.value = y;
+ }
+ else
+ {
+ y_input = INPUT({type:'hidden',name:id+'_y','id':id+'_y',value:y});
+ this.element.parentNode.appendChild(y_input);
+ }
}
});
@@ -137,8 +125,11 @@ Object.extend(Prado.WebUI.TRadioButton.prototype,
initialize : function(options)
{
this.element = $(options['ID']);
- if(!this.element.checked)
- this.onRadioButtonInitialize(options);
+ if(this.element)
+ {
+ if(!this.element.checked)
+ this.onRadioButtonInitialize(options);
+ }
}
});
@@ -147,9 +138,11 @@ Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
{
onInit : function(options)
{
+ this.options=options;
if(options['TextMode'] != 'MultiLine')
Event.observe(this.element, "keydown", this.handleReturnKey.bind(this));
- Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
+ if(this.options['AutoPostBack']==true)
+ Event.observe(this.element, "change", Prado.PostBack.bindEvent(this,options));
},
handleReturnKey : function(e)
@@ -159,8 +152,19 @@ Prado.WebUI.TTextBox = Class.extend(Prado.WebUI.PostBackControl,
var target = Event.element(e);
if(target)
{
- Event.fireEvent(target, "change");
- Event.stop(e);
+ if(this.options['AutoPostBack']==true)
+ {
+ Event.fireEvent(target, "change");
+ Event.stop(e);
+ }
+ else
+ {
+ if(this.options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+ {
+ if(!Prado.Validation.validate(this.options['FormID'], this.options['ValidationGroup'], $(this.options['ID'])))
+ return Event.stop(e);
+ }
+ }
}
}
}
@@ -251,3 +255,36 @@ Object.extend(Prado.WebUI.TTextHighlighter,
obj.parentNode.className = "copycode";
}
});
+
+
+Prado.WebUI.TCheckBoxList = Base.extend(
+{
+ constructor : function(options)
+ {
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var checkBoxOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TCheckBox(checkBoxOptions);
+ }
+ }
+});
+
+Prado.WebUI.TRadioButtonList = Base.extend(
+{
+ constructor : function(options)
+ {
+ for(var i = 0; i<options.ItemCount; i++)
+ {
+ var radioButtonOptions = Object.extend(
+ {
+ ID : options.ListID+"_c"+i,
+ EventTarget : options.ListName+"$c"+i
+ }, options);
+ new Prado.WebUI.TRadioButton(radioButtonOptions);
+ }
+ }
+}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/datepicker/calendar.png b/framework/Web/Javascripts/prado/datepicker/calendar.png
index c245f1b4..c245f1b4 100644
--- a/framework/Web/Javascripts/datepicker/calendar.png
+++ b/framework/Web/Javascripts/prado/datepicker/calendar.png
Binary files differ
diff --git a/framework/Web/Javascripts/datepicker/datepicker.js b/framework/Web/Javascripts/prado/datepicker/datepicker.js
index 2f1e8261..2f1e8261 100644
--- a/framework/Web/Javascripts/datepicker/datepicker.js
+++ b/framework/Web/Javascripts/prado/datepicker/datepicker.js
diff --git a/framework/Web/Javascripts/datepicker/default.css b/framework/Web/Javascripts/prado/datepicker/default.css
index 9532dad0..9532dad0 100644
--- a/framework/Web/Javascripts/datepicker/default.css
+++ b/framework/Web/Javascripts/prado/datepicker/default.css
diff --git a/framework/Web/Javascripts/datepicker/spacer.gif b/framework/Web/Javascripts/prado/datepicker/spacer.gif
index fc256098..fc256098 100755
--- a/framework/Web/Javascripts/datepicker/spacer.gif
+++ b/framework/Web/Javascripts/prado/datepicker/spacer.gif
Binary files differ
diff --git a/framework/Web/Javascripts/prado/element.js b/framework/Web/Javascripts/prado/element.js
deleted file mode 100644
index 0d9c74d1..00000000
--- a/framework/Web/Javascripts/prado/element.js
+++ /dev/null
@@ -1,163 +0,0 @@
-Prado.Element =
-{
- /**
- * Set the value of a particular element.
- * @param string element id
- * @param string new element value.
- */
- setValue : function(element, value)
- {
- var el = $(element);
- if(el && typeof(el.value) != "undefined")
- el.value = value;
- },
-
- select : function(element, method, value)
- {
- var el = $(element);
- var isList = element.indexOf('[]') > -1;
- if(!el && !isList) return;
- method = isList ? 'check'+method : el.tagName.toLowerCase()+method;
- var selection = Prado.Element.Selection;
- if(isFunction(selection[method]))
- selection[method](isList ? element : el,value);
- },
-
- click : function(element)
- {
- var el = $(element);
- if(el)
- Event.fireEvent(el,'click');
- },
-
- setAttribute : function(element, attribute, value)
- {
- var el = $(element);
- if(attribute == "disabled" && value==false)
- el.removeAttribute(attribute);
- else
- el.setAttribute(attribute, value);
- },
-
- setOptions : function(element, options)
- {
- var el = $(element);
- if(el && el.tagName.toLowerCase() == "select")
- {
- while(el.length > 0)
- el.remove(0);
- for(var i = 0; i<options.length; i++)
- el.options[el.options.length] = new Option(options[i][0],options[i][1]);
- }
- },
-
- /**
- * A delayed focus on a particular element
- * @param {element} element to apply focus()
- */
- focus : function(element)
- {
- var obj = $(element);
- if(typeof(obj) != "undefined" && typeof(obj.focus) != "undefined")
- setTimeout(function(){ obj.focus(); }, 100);
- return false;
- }
-}
-
-Prado.Element.Selection =
-{
- inputValue : function(el, value)
- {
- switch(el.type.toLowerCase())
- {
- case 'checkbox':
- case 'radio':
- return el.checked = value;
- }
- },
-
- selectValue : function(el, value)
- {
- $A(el.options).each(function(option)
- {
- option.selected = option.value == value;
- });
- },
-
- selectIndex : function(el, index)
- {
- if(el.type == 'select-one')
- el.selectedIndex = index;
- else
- {
- for(var i = 0; i<el.length; i++)
- {
- if(i == index)
- el.options[i].selected = true;
- }
- }
- },
-
- selectClear : function(el)
- {
- el.selectedIndex = -1;
- },
-
- selectAll : function(el)
- {
- $A(el.options).each(function(option)
- {
- option.selected = true;
- Logger.warn(option.value);
- });
- },
-
- selectInvert : function(el)
- {
- $A(el.options).each(function(option)
- {
- option.selected = !option.selected;
- });
- },
-
- checkValue : function(name, value)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = el.value == value
- });
- },
-
- checkIndex : function(name, index)
- {
- var elements = $A(document.getElementsByName(name));
- for(var i = 0; i<elements.length; i++)
- {
- if(i == index)
- elements[i].checked = true;
- }
- },
-
- checkClear : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = false;
- });
- },
-
- checkAll : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = true;
- });
- },
- checkInvert : function(name)
- {
- $A(document.getElementsByName(name)).each(function(el)
- {
- el.checked = !el.checked;
- });
- }
-}; \ No newline at end of file
diff --git a/framework/Web/Javascripts/prado/form.js b/framework/Web/Javascripts/prado/form.js
deleted file mode 100644
index beea9248..00000000
--- a/framework/Web/Javascripts/prado/form.js
+++ /dev/null
@@ -1,209 +0,0 @@
-/*Prado.Focus = Class.create();
-
-Prado.Focus.setFocus = function(id)
-{
- var target = document.getElementById ? document.getElementById(id) : document.all[id];
- if(target && !Prado.Focus.canFocusOn(target))
- {
- target = Prado.Focus.findTarget(target);
- }
- if(target)
- {
- try
- {
- target.focus();
- target.scrollIntoView(false);
- if (window.__smartNav)
- {
- window.__smartNav.ae = target.id;
- }
- }
- catch (e)
- {
- }
- }
-}
-
-Prado.Focus.canFocusOn = function(element)
-{
- if(!element || !(element.tagName))
- return false;
- var tagName = element.tagName.toLowerCase();
- return !element.disabled && (!element.type || element.type.toLowerCase() != "hidden") && Prado.Focus.isFocusableTag(tagName) && Prado.Focus.isVisible(element);
-}
-
-Prado.Focus.isFocusableTag = function(tagName)
-{
- return (tagName == "input" || tagName == "textarea" || tagName == "select" || tagName == "button" || tagName == "a");
-}
-
-
-Prado.Focus.findTarget = function(element)
-{
- if(!element || !(element.tagName))
- {
- return null;
- }
- var tagName = element.tagName.toLowerCase();
- if (tagName == "undefined")
- {
- return null;
- }
- var children = element.childNodes;
- if (children)
- {
- for(var i=0;i<children.length;i++)
- {
- try
- {
- if(Prado.Focus.canFocusOn(children[i]))
- {
- return children[i];
- }
- else
- {
- var target = Prado.Focus.findTarget(children[i]);
- if(target)
- {
- return target;
- }
- }
- }
- catch (e)
- {
- }
- }
- }
- return null;
-}
-
-Prado.Focus.isVisible = function(element)
-{
- var current = element;
- while((typeof(current) != "undefined") && (current != null))
- {
- if(current.disabled || (typeof(current.style) != "undefined" && ((typeof(current.style.display) != "undefined" && current.style.display == "none") || (typeof(current.style.visibility) != "undefined" && current.style.visibility == "hidden") )))
- {
- return false;
- }
- if(typeof(current.parentNode) != "undefined" && current.parentNode != null && current.parentNode != current && current.parentNode.tagName.toLowerCase() != "body")
- {
- current = current.parentNode;
- }
- else
- {
- return true;
- }
- }
- return true;
-}
-*/
-
-
-Prado.PostBack = function(event,options)
-{
- var form = $(options['FormID']);
- var canSubmit = true;
-
- if(options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
- {
- if(!Prado.Validation.validate(options['FormID'], options['ValidationGroup'], $(options['ID'])))
- return Event.stop(event);
- }
-
- if(options['PostBackUrl'] && options['PostBackUrl'].length > 0)
- form.action = options['PostBackUrl'];
-
- if(options['TrackFocus'])
- {
- var lastFocus = $('PRADO_LASTFOCUS');
- if(lastFocus)
- {
- var active = document.activeElement; //where did this come from
- if(active)
- lastFocus.value = active.id;
- else
- lastFocus.value = options['EventTarget'];
- }
- }
-
- $('PRADO_POSTBACK_TARGET').value = options['EventTarget'];
- $('PRADO_POSTBACK_PARAMETER').value = options['EventParameter'];
- /**
- * Since google toolbar prevents browser default action,
- * we will always disable default client-side browser action
- */
- /*if(options['StopEvent']) */
- Event.stop(event);
- Event.fireEvent(form,"submit");
-}
-
-/*
-
-Prado.doPostBack = function(formID, eventTarget, eventParameter, performValidation, validationGroup, actionUrl, trackFocus, clientSubmit)
-{
- if (typeof(performValidation) == 'undefined')
- {
- var performValidation = false;
- var validationGroup = '';
- var actionUrl = null;
- var trackFocus = false;
- var clientSubmit = true;
- }
- var theForm = document.getElementById ? document.getElementById(formID) : document.forms[formID];
- var canSubmit = true;
- if (performValidation)
- {
- //canSubmit = Prado.Validation.validate(validationGroup);
- * Prado.Validation.ActiveTarget = theForm;
- Prado.Validation.CurrentTargetGroup = null;
- Prado.Validation.IsGroupValidation = false;
- canSubmit = Prado.Validation.IsValid(theForm);
- Logger.debug(canSubmit);*
- canSubmit = Prado.Validation.IsValid(theForm);
- }
- if (canSubmit)
- {
- if (actionUrl != null && (actionUrl.length > 0))
- {
- theForm.action = actionUrl;
- }
- if (trackFocus)
- {
- var lastFocus = theForm.elements['PRADO_LASTFOCUS'];
- if ((typeof(lastFocus) != 'undefined') && (lastFocus != null))
- {
- var active = document.activeElement;
- if (typeof(active) == 'undefined')
- {
- lastFocus.value = eventTarget;
- }
- else
- {
- if ((active != null) && (typeof(active.id) != 'undefined'))
- {
- if (active.id.length > 0)
- {
- lastFocus.value = active.id;
- }
- else if (typeof(active.name) != 'undefined')
- {
- lastFocus.value = active.name;
- }
- }
- }
- }
- }
- if (!clientSubmit)
- {
- canSubmit = false;
- }
- }
- if (canSubmit && (!theForm.onsubmit || theForm.onsubmit()))
- {
- theForm.PRADO_POSTBACK_TARGET.value = eventTarget;
- theForm.PRADO_POSTBACK_PARAMETER.value = eventParameter;
- theForm.submit();
- }
-}
-*/ \ No newline at end of file
diff --git a/framework/Web/Javascripts/extra/logger.js b/framework/Web/Javascripts/prado/logger/logger.js
index b21df1ae..b21df1ae 100644
--- a/framework/Web/Javascripts/extra/logger.js
+++ b/framework/Web/Javascripts/prado/logger/logger.js
diff --git a/framework/Web/Javascripts/ratings/blocks.css b/framework/Web/Javascripts/prado/ratings/blocks.css
index 2bf2e904..2bf2e904 100644
--- a/framework/Web/Javascripts/ratings/blocks.css
+++ b/framework/Web/Javascripts/prado/ratings/blocks.css
diff --git a/framework/Web/Javascripts/ratings/blocks.png b/framework/Web/Javascripts/prado/ratings/blocks.png
index 16a2b249..16a2b249 100644
--- a/framework/Web/Javascripts/ratings/blocks.png
+++ b/framework/Web/Javascripts/prado/ratings/blocks.png
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_blank.gif b/framework/Web/Javascripts/prado/ratings/blocks_blank.gif
index a68d0e94..a68d0e94 100644
--- a/framework/Web/Javascripts/ratings/blocks_blank.gif
+++ b/framework/Web/Javascripts/prado/ratings/blocks_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_half.gif b/framework/Web/Javascripts/prado/ratings/blocks_half.gif
index 4cff0148..4cff0148 100644
--- a/framework/Web/Javascripts/ratings/blocks_half.gif
+++ b/framework/Web/Javascripts/prado/ratings/blocks_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_hover.gif b/framework/Web/Javascripts/prado/ratings/blocks_hover.gif
index 58ad7495..58ad7495 100644
--- a/framework/Web/Javascripts/ratings/blocks_hover.gif
+++ b/framework/Web/Javascripts/prado/ratings/blocks_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/blocks_selected.gif b/framework/Web/Javascripts/prado/ratings/blocks_selected.gif
index f91873e2..f91873e2 100644
--- a/framework/Web/Javascripts/ratings/blocks_selected.gif
+++ b/framework/Web/Javascripts/prado/ratings/blocks_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default.css b/framework/Web/Javascripts/prado/ratings/default.css
index c15a36bd..c15a36bd 100644
--- a/framework/Web/Javascripts/ratings/default.css
+++ b/framework/Web/Javascripts/prado/ratings/default.css
diff --git a/framework/Web/Javascripts/ratings/default_blank.gif b/framework/Web/Javascripts/prado/ratings/default_blank.gif
index 4e6fda3c..4e6fda3c 100644
--- a/framework/Web/Javascripts/ratings/default_blank.gif
+++ b/framework/Web/Javascripts/prado/ratings/default_blank.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_half.gif b/framework/Web/Javascripts/prado/ratings/default_half.gif
index 7cecf0ec..7cecf0ec 100644
--- a/framework/Web/Javascripts/ratings/default_half.gif
+++ b/framework/Web/Javascripts/prado/ratings/default_half.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_hover.gif b/framework/Web/Javascripts/prado/ratings/default_hover.gif
index ad0cd28a..ad0cd28a 100644
--- a/framework/Web/Javascripts/ratings/default_hover.gif
+++ b/framework/Web/Javascripts/prado/ratings/default_hover.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/default_selected.gif b/framework/Web/Javascripts/prado/ratings/default_selected.gif
index a19ab39f..a19ab39f 100644
--- a/framework/Web/Javascripts/ratings/default_selected.gif
+++ b/framework/Web/Javascripts/prado/ratings/default_selected.gif
Binary files differ
diff --git a/framework/Web/Javascripts/ratings/ratings.js b/framework/Web/Javascripts/prado/ratings/ratings.js
index e6fd97ba..e6fd97ba 100644
--- a/framework/Web/Javascripts/ratings/ratings.js
+++ b/framework/Web/Javascripts/prado/ratings/ratings.js
diff --git a/framework/Web/Javascripts/ratings/stars1.png b/framework/Web/Javascripts/prado/ratings/stars1.png
index e4dd3c25..e4dd3c25 100644
--- a/framework/Web/Javascripts/ratings/stars1.png
+++ b/framework/Web/Javascripts/prado/ratings/stars1.png
Binary files differ
diff --git a/framework/Web/Javascripts/prado/scriptaculous-adapter.js b/framework/Web/Javascripts/prado/scriptaculous-adapter.js
new file mode 100644
index 00000000..89e6710b
--- /dev/null
+++ b/framework/Web/Javascripts/prado/scriptaculous-adapter.js
@@ -0,0 +1,811 @@
+
+/**
+ * Similar to bindAsEventLister, but takes additional arguments.
+ */
+Function.prototype.bindEvent = function()
+{
+ var __method = this, args = $A(arguments), object = args.shift();
+ return function(event)
+ {
+ return __method.apply(object, [event || window.event].concat(args));
+ }
+}
+
+/**
+ * Creates a new function by copying function definition from
+ * the <tt>base</tt> and optional <tt>definition</tt>.
+ * @param function a base function to copy from.
+ * @param array additional definition
+ * @param function return a new function with definition from both
+ * <tt>base</tt> and <tt>definition</tt>.
+ */
+Class.extend = function(base, definition)
+{
+ var component = Class.create();
+ Object.extend(component.prototype, base.prototype);
+ if(definition)
+ Object.extend(component.prototype, definition);
+ return component;
+}
+
+/*
+ Base, version 1.0.2
+ Copyright 2006, Dean Edwards
+ License: http://creativecommons.org/licenses/LGPL/2.1/
+*/
+
+var Base = function() {
+ if (arguments.length) {
+ if (this == window) { // cast an object to this class
+ Base.prototype.extend.call(arguments[0], arguments.callee.prototype);
+ } else {
+ this.extend(arguments[0]);
+ }
+ }
+};
+
+Base.version = "1.0.2";
+
+Base.prototype = {
+ extend: function(source, value) {
+ var extend = Base.prototype.extend;
+ if (arguments.length == 2) {
+ var ancestor = this[source];
+ // overriding?
+ if ((ancestor instanceof Function) && (value instanceof Function) &&
+ ancestor.valueOf() != value.valueOf() && /\bbase\b/.test(value)) {
+ var method = value;
+ // var _prototype = this.constructor.prototype;
+ // var fromPrototype = !Base._prototyping && _prototype[source] == ancestor;
+ value = function() {
+ var previous = this.base;
+ // this.base = fromPrototype ? _prototype[source] : ancestor;
+ this.base = ancestor;
+ var returnValue = method.apply(this, arguments);
+ this.base = previous;
+ return returnValue;
+ };
+ // point to the underlying method
+ value.valueOf = function() {
+ return method;
+ };
+ value.toString = function() {
+ return String(method);
+ };
+ }
+ return this[source] = value;
+ } else if (source) {
+ var _prototype = {toSource: null};
+ // do the "toString" and other methods manually
+ var _protected = ["toString", "valueOf"];
+ // if we are prototyping then include the constructor
+ if (Base._prototyping) _protected[2] = "constructor";
+ for (var i = 0; (name = _protected[i]); i++) {
+ if (source[name] != _prototype[name]) {
+ extend.call(this, name, source[name]);
+ }
+ }
+ // copy each of the source object's properties to this object
+ for (var name in source) {
+ if (!_prototype[name]) {
+ extend.call(this, name, source[name]);
+ }
+ }
+ }
+ return this;
+ },
+
+ base: function() {
+ // call this method from any other method to invoke that method's ancestor
+ }
+};
+
+Base.extend = function(_instance, _static) {
+ var extend = Base.prototype.extend;
+ if (!_instance) _instance = {};
+ // build the prototype
+ Base._prototyping = true;
+ var _prototype = new this;
+ extend.call(_prototype, _instance);
+ var constructor = _prototype.constructor;
+ _prototype.constructor = this;
+ delete Base._prototyping;
+ // create the wrapper for the constructor function
+ var klass = function() {
+ if (!Base._prototyping) constructor.apply(this, arguments);
+ this.constructor = klass;
+ };
+ klass.prototype = _prototype;
+ // build the class interface
+ klass.extend = this.extend;
+ klass.implement = this.implement;
+ klass.toString = function() {
+ return String(constructor);
+ };
+ extend.call(klass, _static);
+ // single instance
+ var object = constructor ? klass : _prototype;
+ // class initialisation
+ if (object.init instanceof Function) object.init();
+ return object;
+};
+
+Base.implement = function(_interface) {
+ if (_interface instanceof Function) _interface = _interface.prototype;
+ this.prototype.extend(_interface);
+};
+
+/**
+ * Performs a post-back using javascript
+ *
+ */
+Prado.PostBack = function(event,options)
+{
+ var form = $(options['FormID']);
+ var canSubmit = true;
+
+ if(options['CausesValidation'] && typeof(Prado.Validation) != "undefined")
+ {
+ if(!Prado.Validation.validate(options['FormID'], options['ValidationGroup'], $(options['ID'])))
+ return Event.stop(event);
+ }
+
+ if(options['PostBackUrl'] && options['PostBackUrl'].length > 0)
+ form.action = options['PostBackUrl'];
+
+ if(options['TrackFocus'])
+ {
+ var lastFocus = $('PRADO_LASTFOCUS');
+ if(lastFocus)
+ {
+ var active = document.activeElement; //where did this come from
+ if(active)
+ lastFocus.value = active.id;
+ else
+ lastFocus.value = options['EventTarget'];
+ }
+ }
+
+ $('PRADO_POSTBACK_TARGET').value = options['EventTarget'];
+ $('PRADO_POSTBACK_PARAMETER').value = options['EventParameter'];
+ /**
+ * Since google toolbar prevents browser default action,
+ * we will always disable default client-side browser action
+ */
+ /*if(options['StopEvent']) */
+ Event.stop(event);
+ Event.fireEvent(form,"submit");
+}
+
+/**
+ * Additional element utilities.
+ */
+Prado.Element =
+{
+ /**
+ * Set the value of a particular element.
+ * @param string element id
+ * @param string new element value.
+ */
+ setValue : function(element, value)
+ {
+ var el = $(element);
+ if(el && typeof(el.value) != "undefined")
+ el.value = value;
+ },
+
+ select : function(element, method, value)
+ {
+ var el = $(element);
+ var isList = element.indexOf('[]') > -1;
+ if(!el && !isList) return;
+ method = isList ? 'check'+method : el.tagName.toLowerCase()+method;
+ var selection = Prado.Element.Selection;
+ if(isFunction(selection[method]))
+ selection[method](isList ? element : el,value);
+ },
+
+ click : function(element)
+ {
+ var el = $(element);
+ if(el)
+ Event.fireEvent(el,'click');
+ },
+
+ setAttribute : function(element, attribute, value)
+ {
+ var el = $(element);
+ if(attribute == "disabled" && value==false)
+ el.removeAttribute(attribute);
+ else
+ el.setAttribute(attribute, value);
+ },
+
+ setOptions : function(element, options)
+ {
+ var el = $(element);
+ if(el && el.tagName.toLowerCase() == "select")
+ {
+ while(el.length > 0)
+ el.remove(0);
+ for(var i = 0; i<options.length; i++)
+ el.options[el.options.length] = new Option(options[i][0],options[i][1]);
+ }
+ },
+
+ /**
+ * A delayed focus on a particular element
+ * @param {element} element to apply focus()
+ */
+ focus : function(element)
+ {
+ var obj = $(element);
+ if(typeof(obj) != "undefined" && typeof(obj.focus) != "undefined")
+ setTimeout(function(){ obj.focus(); }, 100);
+ return false;
+ }
+}
+
+/**
+ * Selectable element utilities
+ */
+Prado.Element.Selection =
+{
+ inputValue : function(el, value)
+ {
+ switch(el.type.toLowerCase())
+ {
+ case 'checkbox':
+ case 'radio':
+ return el.checked = value;
+ }
+ },
+
+ selectValue : function(el, value)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = option.value == value;
+ });
+ },
+
+ selectIndex : function(el, index)
+ {
+ if(el.type == 'select-one')
+ el.selectedIndex = index;
+ else
+ {
+ for(var i = 0; i<el.length; i++)
+ {
+ if(i == index)
+ el.options[i].selected = true;
+ }
+ }
+ },
+
+ selectClear : function(el)
+ {
+ el.selectedIndex = -1;
+ },
+
+ selectAll : function(el)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = true;
+ Logger.warn(option.value);
+ });
+ },
+
+ selectInvert : function(el)
+ {
+ $A(el.options).each(function(option)
+ {
+ option.selected = !option.selected;
+ });
+ },
+
+ checkValue : function(name, value)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = el.value == value
+ });
+ },
+
+ checkIndex : function(name, index)
+ {
+ var elements = $A(document.getElementsByName(name));
+ for(var i = 0; i<elements.length; i++)
+ {
+ if(i == index)
+ elements[i].checked = true;
+ }
+ },
+
+ checkClear : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = false;
+ });
+ },
+
+ checkAll : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = true;
+ });
+ },
+ checkInvert : function(name)
+ {
+ $A(document.getElementsByName(name)).each(function(el)
+ {
+ el.checked = !el.checked;
+ });
+ }
+};
+
+
+/**
+ * Export scripaculous builder utilities as window[functions]
+ */
+Object.extend(Builder,
+{
+ exportTags:function()
+ {
+ var tags=["BUTTON","TT","PRE","H1","H2","H3","BR","CANVAS","HR","LABEL","TEXTAREA","FORM","STRONG","SELECT","OPTION","OPTGROUP","LEGEND","FIELDSET","P","UL","OL","LI","TD","TR","THEAD","TBODY","TFOOT","TABLE","TH","INPUT","SPAN","A","DIV","IMG", "CAPTION"];
+ tags.each(function(tag)
+ {
+ window[tag]=function()
+ {
+ var args=$A(arguments);
+ if(args.length==0)
+ return Builder.node(tag,null);
+ if(args.length==1)
+ return Builder.node(tag,args[0]);
+ if(args.length>1)
+ return Builder.node(tag,args.shift(),args);
+
+ };
+ });
+ }
+});
+
+Builder.exportTags();
+
+/**
+ * @class String extensions
+ */
+Object.extend(String.prototype, {
+ /**
+ * @param {String} "left" to pad the string on the left, "right" to pad right.
+ * @param {Number} minimum string length.
+ * @param {String} character(s) to pad
+ * @return {String} padded character(s) on the left or right to satisfy minimum string length
+ */
+
+ pad : function(side, len, chr) {
+ if (!chr) chr = ' ';
+ var s = this;
+ var left = side.toLowerCase()=='left';
+ while (s.length<len) s = left? chr + s : s + chr;
+ return s;
+ },
+
+ /**
+ * @param {Number} minimum string length.
+ * @param {String} character(s) to pad
+ * @return {String} padded character(s) on the left to satisfy minimum string length
+ */
+ padLeft : function(len, chr) {
+ return this.pad('left',len,chr);
+ },
+
+ /**
+ * @param {Number} minimum string length.
+ * @param {String} character(s) to pad
+ * @return {String} padded character(s) on the right to satisfy minimum string length
+ */
+ padRight : function(len, chr) {
+ return this.pad('right',len,chr);
+ },
+
+ /**
+ * @param {Number} minimum string length.
+ * @return {String} append zeros to the left to satisfy minimum string length.
+ */
+ zerofill : function(len) {
+ return this.padLeft(len,'0');
+ },
+
+ /**
+ * @return {String} removed white spaces from both ends.
+ */
+ trim : function() {
+ return this.replace(/^\s+|\s+$/g,'');
+ },
+
+ /**
+ * @return {String} removed white spaces from the left end.
+ */
+ trimLeft : function() {
+ return this.replace(/^\s+/,'');
+ },
+
+ /**
+ * @return {String} removed white spaces from the right end.
+ */
+ trimRight : function() {
+ return this.replace(/\s+$/,'');
+ },
+
+ /**
+ * Convert period separated function names into a function reference.
+ * e.g. "Prado.AJAX.Callback.Action.setValue".toFunction() will return
+ * the actual function Prado.AJAX.Callback.Action.setValue()
+ * @return {Function} the corresponding function represented by the string.
+ */
+ toFunction : function()
+ {
+ var commands = this.split(/\./);
+ var command = window;
+ commands.each(function(action)
+ {
+ if(command[new String(action)])
+ command=command[new String(action)];
+ });
+ if(typeof(command) == "function")
+ return command;
+ else
+ {
+ if(typeof Logger != "undefined")
+ Logger.error("Missing function", this);
+
+ throw new Error ("Missing function '"+this+"'");
+ }
+ },
+
+ /**
+ * Convert a string into integer, returns null if not integer.
+ * @return {Number} null if string does not represent an integer.
+ */
+ toInteger : function()
+ {
+ var exp = /^\s*[-\+]?\d+\s*$/;
+ if (this.match(exp) == null)
+ return null;
+ var num = parseInt(this, 10);
+ return (isNaN(num) ? null : num);
+ },
+
+ /**
+ * Convert a string into a double/float value. <b>Internationalization
+ * is not supported</b>
+ * @param {String} the decimal character
+ * @return {Double} null if string does not represent a float value
+ */
+ toDouble : function(decimalchar)
+ {
+ if(this.length <= 0) return null;
+ decimalchar = decimalchar || ".";
+ var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
+ var m = this.match(exp);
+
+ if (m == null)
+ return null;
+ m[1] = m[1] || "";
+ m[2] = m[2] || "0";
+ m[4] = m[4] || "0";
+
+ var cleanInput = m[1] + (m[2].length>0 ? m[2] : "0") + "." + m[4];
+ var num = parseFloat(cleanInput);
+ return (isNaN(num) ? null : num);
+ },
+
+ /**
+ * Convert strings that represent a currency value (e.g. a float with grouping
+ * characters) to float. E.g. "10,000.50" will become "10000.50". The number
+ * of dicimal digits, grouping and decimal characters can be specified.
+ * <i>The currency input format is <b>very</b> strict, null will be returned if
+ * the pattern does not match</i>.
+ * @param {String} the grouping character, default is ","
+ * @param {Number} number of decimal digits
+ * @param {String} the decimal character, default is "."
+ * @type {Double} the currency value as float.
+ */
+ toCurrency : function(groupchar, digits, decimalchar)
+ {
+ groupchar = groupchar || ",";
+ decimalchar = decimalchar || ".";
+ digits = typeof(digits) == "undefined" ? 2 : digits;
+
+ var exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
+ + ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
+ + "\\s*$");
+ var m = this.match(exp);
+ if (m == null)
+ return null;
+ var intermed = m[2] + m[5] ;
+ var cleanInput = m[1] + intermed.replace(
+ new RegExp("(\\" + groupchar + ")", "g"), "")
+ + ((digits > 0) ? "." + m[7] : "");
+ var num = parseFloat(cleanInput);
+ return (isNaN(num) ? null : num);
+ },
+
+ /**
+ * Converts the string to a date by finding values that matches the
+ * date format pattern.
+ * @param string date format pattern, e.g. MM-dd-yyyy
+ * @return {Date} the date extracted from the string
+ */
+ toDate : function(format)
+ {
+ return Date.SimpleParse(this, format);
+ }
+});
+
+/**
+ * @class Event extensions.
+ */
+Object.extend(Event,
+{
+ /**
+ * Register a function to be executed when the page is loaded.
+ * Note that the page is only loaded if all resources (e.g. images)
+ * are loaded.
+ *
+ * Example: Show an alert box with message "Page Loaded!" when the
+ * page finished loading.
+ * <code>
+ * Event.OnLoad(function(){ alert("Page Loaded!"); });
+ * </code>
+ *
+ * @param {Function} function to execute when page is loaded.
+ */
+ OnLoad : function (fn)
+ {
+ // opera onload is in document, not window
+ var w = document.addEventListener &&
+ !window.addEventListener ? document : window;
+ Event.observe(w,'load',fn);
+ },
+
+ /**
+ * @param {Event} a keyboard event
+ * @return {Number} the Unicode character code generated by the key
+ * that was struck.
+ */
+ keyCode : function(e)
+ {
+ return e.keyCode != null ? e.keyCode : e.charCode
+ },
+
+ /**
+ * @param {String} event type or event name.
+ * @return {Boolean} true if event type is of HTMLEvent, false
+ * otherwise
+ */
+ isHTMLEvent : function(type)
+ {
+ var events = ['abort', 'blur', 'change', 'error', 'focus',
+ 'load', 'reset', 'resize', 'scroll', 'select',
+ 'submit', 'unload'];
+ return events.include(type);
+ },
+
+ /**
+ * @param {String} event type or event name
+ * @return {Boolean} true if event type is of MouseEvent,
+ * false otherwise
+ */
+ isMouseEvent : function(type)
+ {
+ var events = ['click', 'mousedown', 'mousemove', 'mouseout',
+ 'mouseover', 'mouseup'];
+ return events.include(type);
+ },
+
+ /**
+ * Dispatch the DOM event of a given <tt>type</tt> on a DOM
+ * <tt>element</tt>. Only HTMLEvent and MouseEvent can be
+ * dispatched, keyboard events or UIEvent can not be dispatch
+ * via javascript consistently.
+ * For the "submit" event the submit() method is called.
+ * @param {Object} element id string or a DOM element.
+ * @param {String} event type to dispatch.
+ */
+ fireEvent : function(element,type)
+ {
+ element = $(element);
+ if(type == "submit")
+ return element.submit();
+ if(document.createEvent)
+ {
+ if(Event.isHTMLEvent(type))
+ {
+ var event = document.createEvent('HTMLEvents');
+ event.initEvent(type, true, true);
+ }
+ else if(Event.isMouseEvent(type))
+ {
+ var event = document.createEvent('MouseEvents');
+ if (event.initMouseEvent)
+ {
+ event.initMouseEvent(type,true,true,
+ document.defaultView, 1, 0, 0, 0, 0, false,
+ false, false, false, 0, null);
+ }
+ else
+ {
+ // Safari
+ // TODO we should be initialising other mouse-event related attributes here
+ event.initEvent(type, true, true);
+ }
+ }
+ element.dispatchEvent(event);
+ }
+ else if(document.createEventObject)
+ {
+ var evObj = document.createEventObject();
+ element.fireEvent('on'+type, evObj);
+ }
+ else if(typeof(element['on'+type]) == "function")
+ element['on'+type]();
+ }
+});
+
+
+
+Object.extend(Date.prototype,
+{
+ SimpleFormat: function(format, data)
+ {
+ data = data || {};
+ var bits = new Array();
+ bits['d'] = this.getDate();
+ bits['dd'] = String(this.getDate()).zerofill(2);
+
+ bits['M'] = this.getMonth()+1;
+ bits['MM'] = String(this.getMonth()+1).zerofill(2);
+ if(data.AbbreviatedMonthNames)
+ bits['MMM'] = data.AbbreviatedMonthNames[this.getMonth()];
+ if(data.MonthNames)
+ bits['MMMM'] = data.MonthNames[this.getMonth()];
+ var yearStr = "" + this.getFullYear();
+ yearStr = (yearStr.length == 2) ? '19' + yearStr: yearStr;
+ bits['yyyy'] = yearStr;
+ bits['yy'] = bits['yyyy'].toString().substr(2,2);
+
+ // do some funky regexs to replace the format string
+ // with the real values
+ var frm = new String(format);
+ for (var sect in bits)
+ {
+ var reg = new RegExp("\\b"+sect+"\\b" ,"g");
+ frm = frm.replace(reg, bits[sect]);
+ }
+ return frm;
+ },
+
+ toISODate : function()
+ {
+ var y = this.getFullYear();
+ var m = String(this.getMonth() + 1).zerofill(2);
+ var d = String(this.getDate()).zerofill(2);
+ return String(y) + String(m) + String(d);
+ }
+});
+
+Object.extend(Date,
+{
+ SimpleParse: function(value, format)
+ {
+ val=String(value);
+ format=String(format);
+
+ if(val.length <= 0) return null;
+
+ if(format.length <= 0) return new Date(value);
+
+ var isInteger = function (val)
+ {
+ var digits="1234567890";
+ for (var i=0; i < val.length; i++)
+ {
+ if (digits.indexOf(val.charAt(i))==-1) { return false; }
+ }
+ return true;
+ };
+
+ var getInt = function(str,i,minlength,maxlength)
+ {
+ for (var x=maxlength; x>=minlength; x--)
+ {
+ var token=str.substring(i,i+x);
+ if (token.length < minlength) { return null; }
+ if (isInteger(token)) { return token; }
+ }
+ return null;
+ };
+
+ var i_val=0;
+ var i_format=0;
+ var c="";
+ var token="";
+ var token2="";
+ var x,y;
+ var now=new Date();
+ var year=now.getFullYear();
+ var month=now.getMonth()+1;
+ var date=1;
+
+ while (i_format < format.length)
+ {
+ // Get next token from format string
+ c=format.charAt(i_format);
+ token="";
+ while ((format.charAt(i_format)==c) && (i_format < format.length))
+ {
+ token += format.charAt(i_format++);
+ }
+
+ // Extract contents of value based on format token
+ if (token=="yyyy" || token=="yy" || token=="y")
+ {
+ if (token=="yyyy") { x=4;y=4; }
+ if (token=="yy") { x=2;y=2; }
+ if (token=="y") { x=2;y=4; }
+ year=getInt(val,i_val,x,y);
+ if (year==null) { return null; }
+ i_val += year.length;
+ if (year.length==2)
+ {
+ if (year > 70) { year=1900+(year-0); }
+ else { year=2000+(year-0); }
+ }
+ }
+
+ else if (token=="MM"||token=="M")
+ {
+ month=getInt(val,i_val,token.length,2);
+ if(month==null||(month<1)||(month>12)){return null;}
+ i_val+=month.length;
+ }
+ else if (token=="dd"||token=="d")
+ {
+ date=getInt(val,i_val,token.length,2);
+ if(date==null||(date<1)||(date>31)){return null;}
+ i_val+=date.length;
+ }
+ else
+ {
+ if (val.substring(i_val,i_val+token.length)!=token) {return null;}
+ else {i_val+=token.length;}
+ }
+ }
+
+ // If there are any trailing characters left in the value, it doesn't match
+ if (i_val != val.length) { return null; }
+
+ // Is date valid for month?
+ if (month==2)
+ {
+ // Check for leap year
+ if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
+ if (date > 29){ return null; }
+ }
+ else { if (date > 28) { return null; } }
+ }
+
+ if ((month==4)||(month==6)||(month==9)||(month==11))
+ {
+ if (date > 30) { return null; }
+ }
+
+ var newdate=new Date(year,month-1,date, 0, 0, 0);
+ return newdate;
+ }
+}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/prado/validation3.js b/framework/Web/Javascripts/prado/validator/validation3.js
index 714aa93f..714aa93f 100644
--- a/framework/Web/Javascripts/prado/validation3.js
+++ b/framework/Web/Javascripts/prado/validator/validation3.js
diff --git a/framework/Web/Javascripts/rico/colors.js b/framework/Web/Javascripts/rico/colors.js
deleted file mode 100644
index ce72302e..00000000
--- a/framework/Web/Javascripts/rico/colors.js
+++ /dev/null
@@ -1,242 +0,0 @@
-//-------------------- ricoColor.js
-if(typeof(Rico) == "undefined") Rico = {};
-
-Rico.Color = Class.create();
-
-Rico.Color.prototype = {
-
- initialize: function(red, green, blue) {
- this.rgb = { r: red, g : green, b : blue };
- },
-
- setRed: function(r) {
- this.rgb.r = r;
- },
-
- setGreen: function(g) {
- this.rgb.g = g;
- },
-
- setBlue: function(b) {
- this.rgb.b = b;
- },
-
- setHue: function(h) {
-
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.h = h;
-
- // convert back to RGB...
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
- },
-
- setSaturation: function(s) {
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.s = s;
-
- // convert back to RGB and set values...
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
- },
-
- setBrightness: function(b) {
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.b = b;
-
- // convert back to RGB and set values...
- this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
- },
-
- darken: function(percent) {
- var hsb = this.asHSB();
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
- },
-
- brighten: function(percent) {
- var hsb = this.asHSB();
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
- },
-
- blend: function(other) {
- this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2);
- this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2);
- this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2);
- },
-
- isBright: function() {
- var hsb = this.asHSB();
- return this.asHSB().b > 0.5;
- },
-
- isDark: function() {
- return ! this.isBright();
- },
-
- asRGB: function() {
- return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")";
- },
-
- asHex: function() {
- return "#" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart();
- },
-
- asHSB: function() {
- return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
- },
-
- toString: function() {
- return this.asHex();
- }
-
-};
-
-Rico.Color.createFromHex = function(hexCode) {
-
- if ( hexCode.indexOf('#') == 0 )
- hexCode = hexCode.substring(1);
-
- var red = "ff", green = "ff", blue="ff";
- if(hexCode.length > 4)
- {
- red = hexCode.substring(0,2);
- green = hexCode.substring(2,4);
- blue = hexCode.substring(4,6);
- }
- else if(hexCode.length > 0 & hexCode.length < 4)
- {
- var r = hexCode.substring(0,1);
- var g = hexCode.substring(1,2);
- var b = hexCode.substring(2);
- red = r+r;
- green = g+g;
- blue = b+b;
- }
- return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
-}
-
-/**
- * Factory method for creating a color from the background of
- * an HTML element.
- */
-Rico.Color.createColorFromBackground = function(elem) {
-
- var actualColor = Element.getStyle($(elem), "background-color");
- if ( actualColor == "transparent" && elem.parent )
- return Rico.Color.createColorFromBackground(elem.parent);
-
- if ( actualColor == null )
- return new Rico.Color(255,255,255);
-
- if ( actualColor.indexOf("rgb(") == 0 ) {
- var colors = actualColor.substring(4, actualColor.length - 1 );
- var colorArray = colors.split(",");
- return new Rico.Color( parseInt( colorArray[0] ),
- parseInt( colorArray[1] ),
- parseInt( colorArray[2] ) );
-
- }
- else if ( actualColor.indexOf("#") == 0 ) {
- return Rico.Color.createFromHex(actualColor);
- }
- else
- return new Rico.Color(255,255,255);
-}
-
-Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
-
- var red = 0;
- var green = 0;
- var blue = 0;
-
- if (saturation == 0) {
- red = parseInt(brightness * 255.0 + 0.5);
- green = red;
- blue = red;
- }
- else {
- var h = (hue - Math.floor(hue)) * 6.0;
- var f = h - Math.floor(h);
- var p = brightness * (1.0 - saturation);
- var q = brightness * (1.0 - saturation * f);
- var t = brightness * (1.0 - (saturation * (1.0 - f)));
-
- switch (parseInt(h)) {
- case 0:
- red = (brightness * 255.0 + 0.5);
- green = (t * 255.0 + 0.5);
- blue = (p * 255.0 + 0.5);
- break;
- case 1:
- red = (q * 255.0 + 0.5);
- green = (brightness * 255.0 + 0.5);
- blue = (p * 255.0 + 0.5);
- break;
- case 2:
- red = (p * 255.0 + 0.5);
- green = (brightness * 255.0 + 0.5);
- blue = (t * 255.0 + 0.5);
- break;
- case 3:
- red = (p * 255.0 + 0.5);
- green = (q * 255.0 + 0.5);
- blue = (brightness * 255.0 + 0.5);
- break;
- case 4:
- red = (t * 255.0 + 0.5);
- green = (p * 255.0 + 0.5);
- blue = (brightness * 255.0 + 0.5);
- break;
- case 5:
- red = (brightness * 255.0 + 0.5);
- green = (p * 255.0 + 0.5);
- blue = (q * 255.0 + 0.5);
- break;
- }
- }
-
- return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) };
-}
-
-Rico.Color.RGBtoHSB = function(r, g, b) {
-
- var hue;
- var saturaton;
- var brightness;
-
- var cmax = (r > g) ? r : g;
- if (b > cmax)
- cmax = b;
-
- var cmin = (r < g) ? r : g;
- if (b < cmin)
- cmin = b;
-
- brightness = cmax / 255.0;
- if (cmax != 0)
- saturation = (cmax - cmin)/cmax;
- else
- saturation = 0;
-
- if (saturation == 0)
- hue = 0;
- else {
- var redc = (cmax - r)/(cmax - cmin);
- var greenc = (cmax - g)/(cmax - cmin);
- var bluec = (cmax - b)/(cmax - cmin);
-
- if (r == cmax)
- hue = bluec - greenc;
- else if (g == cmax)
- hue = 2.0 + redc - bluec;
- else
- hue = 4.0 + greenc - redc;
-
- hue = hue / 6.0;
- if (hue < 0)
- hue = hue + 1.0;
- }
-
- return { h : hue, s : saturation, b : brightness };
-}
diff --git a/framework/Web/Javascripts/rico/extension.js b/framework/Web/Javascripts/rico/extension.js
deleted file mode 100644
index d3df3a9b..00000000
--- a/framework/Web/Javascripts/rico/extension.js
+++ /dev/null
@@ -1,175 +0,0 @@
-Prado.RicoLiveGrid = Class.create();
-Prado.RicoLiveGrid.prototype = Object.extend(Rico.LiveGrid.prototype,
-{
- initialize : function(tableId, options)
- {
- this.options = {
- tableClass: $(tableId).className || '',
- loadingClass: $(tableId).className || '',
- scrollerBorderRight: '1px solid #ababab',
- bufferTimeout: 20000,
- sortAscendImg: 'images/sort_asc.gif',
- sortDescendImg: 'images/sort_desc.gif',
- sortImageWidth: 9,
- sortImageHeight: 5,
- ajaxSortURLParms: [],
- onRefreshComplete: null,
- requestParameters: null,
- inlineStyles: true,
- visibleRows: 10,
- totalRows: 0,
- initialOffset: 0
- };
- Object.extend(this.options, options || {});
-
- //this.ajaxOptions = {parameters: null};
- //Object.extend(this.ajaxOptions, ajaxOptions || {});
-
- this.tableId = tableId;
- this.table = $(tableId);
-
- this.addLiveGridHtml();
-
- var columnCount = this.table.rows[0].cells.length;
- this.metaData = new Rico.LiveGridMetaData(this.options.visibleRows, this.options.totalRows, columnCount, options);
- this.buffer = new Rico.LiveGridBuffer(this.metaData);
-
- var rowCount = this.table.rows.length;
- this.viewPort = new Rico.GridViewPort(this.table,
- this.table.offsetHeight/rowCount,
- this.options.visibleRows,
- this.buffer, this);
- this.scroller = new Rico.LiveGridScroller(this,this.viewPort);
- this.options.sortHandler = this.sortHandler.bind(this);
-
- if ( $(tableId + '_header') )
- this.sort = new Rico.LiveGridSort(tableId + '_header', this.options)
-
- this.processingRequest = null;
- this.unprocessedRequest = null;
-
- //this.initAjax(url);
- if (this.options.initialOffset >= 0)
- {
- var offset = this.options.initialOffset;
- this.scroller.moveScroll(offset);
- this.viewPort.scrollTo(this.scroller.rowToPixel(offset));
- if (this.options.sortCol) {
- this.sortCol = options.sortCol;
- this.sortDir = options.sortDir;
- }
- var grid = this;
- setTimeout(function(){
- grid.requestContentRefresh(offset);
- },100);
- }
- },
-
- fetchBuffer: function(offset)
- {
- if ( this.buffer.isInRange(offset) &&
- !this.buffer.isNearingLimit(offset)) {
- return;
- }
- if (this.processingRequest) {
- this.unprocessedRequest = new Rico.LiveGridRequest(offset);
- return;
- }
- var bufferStartPos = this.buffer.getFetchOffset(offset);
- this.processingRequest = new Rico.LiveGridRequest(offset);
- this.processingRequest.bufferOffset = bufferStartPos;
- var fetchSize = this.buffer.getFetchSize(offset);
- var partialLoaded = false;
-
- // var queryString
- // if (this.options.requestParameters)
- // queryString = this._createQueryString(this.options.requestParameters, 0);
- var param =
- {
- 'page_size' : fetchSize,
- 'offset' : bufferStartPos
- };
- if(this.sortCol)
- {
- Object.extend(param,
- {
- 'sort_col': this.sortCol,
- 'sort_dir': this.sortDir
- });
- }
- /*queryString = (queryString == null) ? '' : queryString+'&';
- queryString = queryString+'id='+this.tableId+'&page_size='+fetchSize+'&offset='+bufferStartPos;
- if (this.sortCol)
- queryString = queryString+'&sort_col='+escape(this.sortCol)+'&sort_dir='+this.sortDir;
-
- this.ajaxOptions.parameters = queryString;
-
- ajaxEngine.sendRequest( this.tableId + '_request', this.ajaxOptions );
- */
- Prado.Callback(this.tableId, param, this.ajaxUpdate.bind(this), this.options);
- this.timeoutHandler = setTimeout( this.handleTimedOut.bind(this), this.options.bufferTimeout);
-
- },
-
- ajaxUpdate: function(result, output)
- {
- try {
- clearTimeout( this.timeoutHandler );
- this.buffer.update(result,this.processingRequest.bufferOffset);
- this.viewPort.bufferChanged();
- }
- catch(err) {}
- finally {this.processingRequest = null; }
- this.processQueuedRequest();
- }
-});
-
-Object.extend(Rico.LiveGridBuffer.prototype,
-{
- update: function(newRows, start)
- {
- if (this.rows.length == 0) { // initial load
- this.rows = newRows;
- this.size = this.rows.length;
- this.startPos = start;
- return;
- }
- if (start > this.startPos) { //appending
- if (this.startPos + this.rows.length < start) {
- this.rows = newRows;
- this.startPos = start;//
- } else {
- this.rows = this.rows.concat( newRows.slice(0, newRows.length));
- if (this.rows.length > this.maxBufferSize) {
- var fullSize = this.rows.length;
- this.rows = this.rows.slice(this.rows.length - this.maxBufferSize, this.rows.length)
- this.startPos = this.startPos + (fullSize - this.rows.length);
- }
- }
- } else { //prepending
- if (start + newRows.length < this.startPos) {
- this.rows = newRows;
- } else {
- this.rows = newRows.slice(0, this.startPos).concat(this.rows);
- if (this.rows.length > this.maxBufferSize)
- this.rows = this.rows.slice(0, this.maxBufferSize)
- }
- this.startPos = start;
- }
- this.size = this.rows.length;
- }
-});
-
-
-Object.extend(Rico.GridViewPort.prototype,
-{
- populateRow: function(htmlRow, row)
- {
- if(isdef(htmlRow))
- {
- for (var j=0; j < row.length; j++) {
- htmlRow.cells[j].innerHTML = row[j]
- }
- }
- }
-}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/rico/rico.js b/framework/Web/Javascripts/rico/rico.js
deleted file mode 100644
index d179b84f..00000000
--- a/framework/Web/Javascripts/rico/rico.js
+++ /dev/null
@@ -1,3326 +0,0 @@
-/**
- *
- * Copyright 2005 Sabre Airline Solutions
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
- * file except in compliance with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software distributed under the
- * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
- * either express or implied. See the License for the specific language governing permissions
- * and limitations under the License.
- **/
-
-
-//-------------------- rico.js
-var Rico = {
- Version: '1.1rc1',
- prototypeVersion: parseFloat(Prototype.Version.split(".")[0] + "." + Prototype.Version.split(".")[1])
-}
-
-/*
-if((typeof Prototype=='undefined') || Rico.prototypeVersion < 1.3)
- throw("Rico requires the Prototype JavaScript framework >= 1.3");
-*/
-Rico.ArrayExtensions = new Array();
-
-if (Object.prototype.extend) {
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend;
-}else{
- Object.prototype.extend = function(object) {
- return Object.extend.apply(this, [this, object]);
- }
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend;
-}
-
-if (Array.prototype.push) {
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.push;
-}
-
-if (!Array.prototype.remove) {
- Array.prototype.remove = function(dx) {
- if( isNaN(dx) || dx > this.length )
- return false;
- for( var i=0,n=0; i<this.length; i++ )
- if( i != dx )
- this[n++]=this[i];
- this.length-=1;
- };
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.remove;
-}
-
-if (!Array.prototype.removeItem) {
- Array.prototype.removeItem = function(item) {
- for ( var i = 0 ; i < this.length ; i++ )
- if ( this[i] == item ) {
- this.remove(i);
- break;
- }
- };
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.removeItem;
-}
-
-if (!Array.prototype.indices) {
- Array.prototype.indices = function() {
- var indexArray = new Array();
- for ( index in this ) {
- var ignoreThis = false;
- for ( var i = 0 ; i < Rico.ArrayExtensions.length ; i++ ) {
- if ( this[index] == Rico.ArrayExtensions[i] ) {
- ignoreThis = true;
- break;
- }
- }
- if ( !ignoreThis )
- indexArray[ indexArray.length ] = index;
- }
- return indexArray;
- }
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.indices;
-}
-
-// Create the loadXML method and xml getter for Mozilla
-if ( window.DOMParser &&
- window.XMLSerializer &&
- window.Node && Node.prototype && Node.prototype.__defineGetter__ ) {
-
- if (!Document.prototype.loadXML) {
- Document.prototype.loadXML = function (s) {
- var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
- while (this.hasChildNodes())
- this.removeChild(this.lastChild);
-
- for (var i = 0; i < doc2.childNodes.length; i++) {
- this.appendChild(this.importNode(doc2.childNodes[i], true));
- }
- };
- }
-
- Document.prototype.__defineGetter__( "xml",
- function () {
- return (new XMLSerializer()).serializeToString(this);
- }
- );
-}
-
-document.getElementsByTagAndClassName = function(tagName, className) {
- if ( tagName == null )
- tagName = '*';
-
- var children = document.getElementsByTagName(tagName) || document.all;
- var elements = new Array();
-
- if ( className == null )
- return children;
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var classNames = child.className.split(' ');
- for (var j = 0; j < classNames.length; j++) {
- if (classNames[j] == className) {
- elements.push(child);
- break;
- }
- }
- }
-
- return elements;
-}
-
-
-//-------------------- ricoAccordion.js
-Rico.Accordion = Class.create();
-
-Rico.Accordion.prototype = {
-
- initialize: function(container, options) {
- this.container = $(container);
- this.lastExpandedTab = null;
- this.accordionTabs = new Array();
- this.setOptions(options);
- this._attachBehaviors();
- if(!container) return;
-
- this.container.style.borderBottom = '1px solid ' + this.options.borderColor;
- // validate onloadShowTab
- if (this.options.onLoadShowTab >= this.accordionTabs.length)
- this.options.onLoadShowTab = 0;
-
- // set the initial visual state...
- for ( var i=0 ; i < this.accordionTabs.length ; i++ )
- {
- if (i != this.options.onLoadShowTab){
- this.accordionTabs[i].collapse();
- this.accordionTabs[i].content.style.display = 'none';
- }
- }
- this.lastExpandedTab = this.accordionTabs[this.options.onLoadShowTab];
- if (this.options.panelHeight == 'auto'){
- var tabToCheck = (this.options.onloadShowTab === 0)? 1 : 0;
- var titleBarSize = parseInt(RicoUtil.getElementsComputedStyle(this.accordionTabs[tabToCheck].titleBar, 'height'));
- if (isNaN(titleBarSize))
- titleBarSize = this.accordionTabs[tabToCheck].titleBar.offsetHeight;
-
- var totalTitleBarSize = this.accordionTabs.length * titleBarSize;
- var parentHeight = parseInt(RicoUtil.getElementsComputedStyle(this.container.parentNode, 'height'));
- if (isNaN(parentHeight))
- parentHeight = this.container.parentNode.offsetHeight;
-
- this.options.panelHeight = parentHeight - totalTitleBarSize-2;
- }
-
- this.lastExpandedTab.content.style.height = this.options.panelHeight + "px";
- this.lastExpandedTab.showExpanded();
- this.lastExpandedTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
-
- },
-
- setOptions: function(options) {
- this.options = {
- expandedBg : '#63699c',
- hoverBg : '#63699c',
- collapsedBg : '#6b79a5',
- expandedTextColor : '#ffffff',
- expandedFontWeight : 'bold',
- hoverTextColor : '#ffffff',
- collapsedTextColor : '#ced7ef',
- collapsedFontWeight : 'normal',
- hoverTextColor : '#ffffff',
- borderColor : '#1f669b',
- panelHeight : 200,
- onHideTab : null,
- onShowTab : null,
- onLoadShowTab : 0
- }
- Object.extend(this.options, options || {});
- },
-
- showTabByIndex: function( anIndex, animate ) {
- var doAnimate = arguments.length == 1 ? true : animate;
- this.showTab( this.accordionTabs[anIndex], doAnimate );
- },
-
- showTab: function( accordionTab, animate ) {
-
- var doAnimate = arguments.length == 1 ? true : animate;
-
- if ( this.options.onHideTab )
- this.options.onHideTab(this.lastExpandedTab);
-
- this.lastExpandedTab.showCollapsed();
- var accordion = this;
- var lastExpandedTab = this.lastExpandedTab;
-
- this.lastExpandedTab.content.style.height = (this.options.panelHeight - 1) + 'px';
- accordionTab.content.style.display = '';
-
- accordionTab.titleBar.style.fontWeight = this.options.expandedFontWeight;
-
- if ( doAnimate ) {
- new Effect.AccordionSize( this.lastExpandedTab.content,
- accordionTab.content,
- 1,
- this.options.panelHeight,
- 100, 10,
- { complete: function() {accordion.showTabDone(lastExpandedTab)} } );
- this.lastExpandedTab = accordionTab;
- }
- else {
- this.lastExpandedTab.content.style.height = "1px";
- accordionTab.content.style.height = this.options.panelHeight + "px";
- this.lastExpandedTab = accordionTab;
- this.showTabDone(lastExpandedTab);
- }
- },
-
- showTabDone: function(collapsedTab) {
- collapsedTab.content.style.display = 'none';
- this.lastExpandedTab.showExpanded();
- if ( this.options.onShowTab )
- this.options.onShowTab(this.lastExpandedTab);
- },
-
- _attachBehaviors: function() {
- var panels = this._getDirectChildrenByTag(this.container, 'DIV');
- for ( var i = 0 ; i < panels.length ; i++ ) {
-
- var tabChildren = this._getDirectChildrenByTag(panels[i],'DIV');
- if ( tabChildren.length != 2 )
- continue; // unexpected
-
- var tabTitleBar = tabChildren[0];
- var tabContentBox = tabChildren[1];
- this.accordionTabs.push( new Rico.Accordion.Tab(this,tabTitleBar,tabContentBox) );
- }
- },
-
- _getDirectChildrenByTag: function(e, tagName) {
- var kids = new Array();
- var allKids = e.childNodes;
- for( var i = 0 ; i < allKids.length ; i++ )
- if ( allKids[i] && allKids[i].tagName && allKids[i].tagName == tagName )
- kids.push(allKids[i]);
- return kids;
- }
-
-};
-
-Rico.Accordion.Tab = Class.create();
-
-Rico.Accordion.Tab.prototype = {
-
- initialize: function(accordion, titleBar, content) {
- this.accordion = accordion;
- this.titleBar = titleBar;
- this.content = content;
- this._attachBehaviors();
- },
-
- collapse: function() {
- this.showCollapsed();
- this.content.style.height = "1px";
- },
-
- showCollapsed: function() {
- this.expanded = false;
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- this.titleBar.style.fontWeight = this.accordion.options.collapsedFontWeight;
- this.content.style.overflow = "hidden";
- },
-
- showExpanded: function() {
- this.expanded = true;
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- this.content.style.overflow = "visible";
- },
-
- titleBarClicked: function(e) {
- if ( this.accordion.lastExpandedTab == this )
- return;
- this.accordion.showTab(this);
- },
-
- hover: function(e) {
- this.titleBar.style.backgroundColor = this.accordion.options.hoverBg;
- this.titleBar.style.color = this.accordion.options.hoverTextColor;
- },
-
- unhover: function(e) {
- if ( this.expanded ) {
- this.titleBar.style.backgroundColor = this.accordion.options.expandedBg;
- this.titleBar.style.color = this.accordion.options.expandedTextColor;
- }
- else {
- this.titleBar.style.backgroundColor = this.accordion.options.collapsedBg;
- this.titleBar.style.color = this.accordion.options.collapsedTextColor;
- }
- },
-
- _attachBehaviors: function() {
- this.content.style.border = "1px solid " + this.accordion.options.borderColor;
- this.content.style.borderTopWidth = "0px";
- this.content.style.borderBottomWidth = "0px";
- this.content.style.margin = "0px";
-
- this.titleBar.onclick = this.titleBarClicked.bindAsEventListener(this);
- this.titleBar.onmouseover = this.hover.bindAsEventListener(this);
- this.titleBar.onmouseout = this.unhover.bindAsEventListener(this);
- }
-
-};
-
-
-//-------------------- ricoAjaxEngine.js
-/*
-Rico.AjaxEngine = Class.create();
-
-Rico.AjaxEngine.prototype = {
-
- initialize: function() {
- this.ajaxElements = new Array();
- this.ajaxObjects = new Array();
- this.requestURLS = new Array();
- this.options = {};
- },
-
- registerAjaxElement: function( anId, anElement ) {
- if ( !anElement )
- anElement = $(anId);
- this.ajaxElements[anId] = anElement;
- },
-
- registerAjaxObject: function( anId, anObject ) {
- this.ajaxObjects[anId] = anObject;
- },
-
- registerRequest: function (requestLogicalName, requestURL) {
- this.requestURLS[requestLogicalName] = requestURL;
- },
-
- sendRequest: function(requestName, options) {
- // Allow for backwards Compatibility
- if ( arguments.length >= 2 )
- if (typeof arguments[1] == 'string')
- options = {parameters: this._createQueryString(arguments, 1)};
- this.sendRequestWithData(requestName, null, options);
- },
-
- sendRequestWithData: function(requestName, xmlDocument, options) {
- var requestURL = this.requestURLS[requestName];
- if ( requestURL == null )
- return;
-
- // Allow for backwards Compatibility
- if ( arguments.length >= 3 )
- if (typeof arguments[2] == 'string')
- options.parameters = this._createQueryString(arguments, 2);
-
- new Ajax.Request(requestURL, this._requestOptions(options,xmlDocument));
- },
-
- sendRequestAndUpdate: function(requestName,container,options) {
- // Allow for backwards Compatibility
- if ( arguments.length >= 3 )
- if (typeof arguments[2] == 'string')
- options.parameters = this._createQueryString(arguments, 2);
-
- this.sendRequestWithDataAndUpdate(requestName, null, container, options);
- },
-
- sendRequestWithDataAndUpdate: function(requestName,xmlDocument,container,options) {
- var requestURL = this.requestURLS[requestName];
- if ( requestURL == null )
- return;
-
- // Allow for backwards Compatibility
- if ( arguments.length >= 4 )
- if (typeof arguments[3] == 'string')
- options.parameters = this._createQueryString(arguments, 3);
-
- var updaterOptions = this._requestOptions(options,xmlDocument);
- // Turn off onComplete
- //updaterOptions.onComplete = null;
-
- new Ajax.Updater(container, requestURL, updaterOptions);
- },
-
- // Private -- not part of intended engine API --------------------------------------------------------------------
-
- _requestOptions: function(options,xmlDoc) {
- var requestHeaders = ['X-Rico-Version', Rico.Version ];
- var sendMethod = 'post';
- if ( xmlDoc == null )
- if (Rico.prototypeVersion < 1.4)
- requestHeaders.push( 'Content-type', 'text/xml' );
- else
- sendMethod = 'get';
- (!options) ? options = {} : '';
-
- // Check and keep any user onComplete functions
- if (options.onComplete)
- options.onRicoComplete = options.onComplete;
- // Fix onComplete
- if (options.overrideOnComplete)
- options.onComplete = options.overrideOnComplete;
- else
- options.onComplete = this._onRequestComplete.bind(this);
-
- // Set the default options and extend with any user options
- this.options = {
- requestHeaders: requestHeaders,
- parameters: options.parameters,
- postBody: xmlDoc,
- method: sendMethod,
- onComplete: options.onComplete
- };
- // Set any user options:
- Object.extend(this.options, options);
- return this.options;
- },
-
- _createQueryString: function( theArgs, offset ) {
- var queryString = ""
- for ( var i = offset ; i < theArgs.length ; i++ ) {
- if ( i != offset )
- queryString += "&";
-
- var anArg = theArgs[i];
-
- if ( anArg.name != undefined && anArg.value != undefined ) {
- queryString += anArg.name + "=" + escape(anArg.value);
- }
- else {
- var ePos = anArg.indexOf('=');
- var argName = anArg.substring( 0, ePos );
- var argValue = anArg.substring( ePos + 1 );
- queryString += argName + "=" + escape(argValue);
- }
- }
- return queryString;
- },
-
- _onRequestComplete : function(request) {
- if(!request)
- return;
- // User can set an onFailure option - which will be called by prototype
- if (request.status != 200)
- return;
-
- var response = request.responseXML.getElementsByTagName("ajax-response");
- if (response == null || response.length != 1)
- return;
- this._processAjaxResponse( response[0].childNodes );
-
- // Check if user has set a onComplete function
- var onRicoComplete = this.options.onRicoComplete;
- if (onRicoComplete != null)
- onRicoComplete();
- },
-
- _processAjaxResponse: function( xmlResponseElements ) {
- for ( var i = 0 ; i < xmlResponseElements.length ; i++ ) {
- var responseElement = xmlResponseElements[i];
-
- // only process nodes of type element.....
- if ( responseElement.nodeType != 1 )
- continue;
-
- var responseType = responseElement.getAttribute("type");
- var responseId = responseElement.getAttribute("id");
-
- if ( responseType == "object" )
- this._processAjaxObjectUpdate( this.ajaxObjects[ responseId ], responseElement );
- else if ( responseType == "element" )
- this._processAjaxElementUpdate( this.ajaxElements[ responseId ], responseElement );
- else
- alert('unrecognized AjaxResponse type : ' + responseType );
- }
- },
-
- _processAjaxObjectUpdate: function( ajaxObject, responseElement ) {
- ajaxObject.ajaxUpdate( responseElement );
- },
-
- _processAjaxElementUpdate: function( ajaxElement, responseElement ) {
- ajaxElement.innerHTML = RicoUtil.getContentAsString(responseElement);
- }
-
-}
-
-var ajaxEngine = new Rico.AjaxEngine();
-*/
-
-//-------------------- ricoColor.js
-/*Rico.Color = Class.create();
-
-Rico.Color.prototype = {
-
- initialize: function(red, green, blue) {
- this.rgb = { r: red, g : green, b : blue };
- },
-
- setRed: function(r) {
- this.rgb.r = r;
- },
-
- setGreen: function(g) {
- this.rgb.g = g;
- },
-
- setBlue: function(b) {
- this.rgb.b = b;
- },
-
- setHue: function(h) {
-
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.h = h;
-
- // convert back to RGB...
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
- },
-
- setSaturation: function(s) {
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.s = s;
-
- // convert back to RGB and set values...
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, hsb.b);
- },
-
- setBrightness: function(b) {
- // get an HSB model, and set the new hue...
- var hsb = this.asHSB();
- hsb.b = b;
-
- // convert back to RGB and set values...
- this.rgb = Rico.Color.HSBtoRGB( hsb.h, hsb.s, hsb.b );
- },
-
- darken: function(percent) {
- var hsb = this.asHSB();
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.max(hsb.b - percent,0));
- },
-
- brighten: function(percent) {
- var hsb = this.asHSB();
- this.rgb = Rico.Color.HSBtoRGB(hsb.h, hsb.s, Math.min(hsb.b + percent,1));
- },
-
- blend: function(other) {
- this.rgb.r = Math.floor((this.rgb.r + other.rgb.r)/2);
- this.rgb.g = Math.floor((this.rgb.g + other.rgb.g)/2);
- this.rgb.b = Math.floor((this.rgb.b + other.rgb.b)/2);
- },
-
- isBright: function() {
- var hsb = this.asHSB();
- return this.asHSB().b > 0.5;
- },
-
- isDark: function() {
- return ! this.isBright();
- },
-
- asRGB: function() {
- return "rgb(" + this.rgb.r + "," + this.rgb.g + "," + this.rgb.b + ")";
- },
-
- asHex: function() {
- return "#" + this.rgb.r.toColorPart() + this.rgb.g.toColorPart() + this.rgb.b.toColorPart();
- },
-
- asHSB: function() {
- return Rico.Color.RGBtoHSB(this.rgb.r, this.rgb.g, this.rgb.b);
- },
-
- toString: function() {
- return this.asHex();
- }
-
-};
-
-Rico.Color.createFromHex = function(hexCode) {
-
- if ( hexCode.indexOf('#') == 0 )
- hexCode = hexCode.substring(1);
- var red = hexCode.substring(0,2);
- var green = hexCode.substring(2,4);
- var blue = hexCode.substring(4,6);
- return new Rico.Color( parseInt(red,16), parseInt(green,16), parseInt(blue,16) );
-}
-
-/**
- * Factory method for creating a color from the background of
- * an HTML element.
- *
-Rico.Color.createColorFromBackground = function(elem) {
-
- var actualColor = RicoUtil.getElementsComputedStyle($(elem), "backgroundColor", "background-color");
-
- if ( actualColor == "transparent" && elem.parent )
- return Rico.Color.createColorFromBackground(elem.parent);
-
- if ( actualColor == null )
- return new Rico.Color(255,255,255);
-
- if ( actualColor.indexOf("rgb(") == 0 ) {
- var colors = actualColor.substring(4, actualColor.length - 1 );
- var colorArray = colors.split(",");
- return new Rico.Color( parseInt( colorArray[0] ),
- parseInt( colorArray[1] ),
- parseInt( colorArray[2] ) );
-
- }
- else if ( actualColor.indexOf("#") == 0 ) {
- var redPart = parseInt(actualColor.substring(1,3), 16);
- var greenPart = parseInt(actualColor.substring(3,5), 16);
- var bluePart = parseInt(actualColor.substring(5), 16);
- return new Rico.Color( redPart, greenPart, bluePart );
- }
- else
- return new Rico.Color(255,255,255);
-}
-
-Rico.Color.HSBtoRGB = function(hue, saturation, brightness) {
-
- var red = 0;
- var green = 0;
- var blue = 0;
-
- if (saturation == 0) {
- red = parseInt(brightness * 255.0 + 0.5);
- green = red;
- blue = red;
- }
- else {
- var h = (hue - Math.floor(hue)) * 6.0;
- var f = h - Math.floor(h);
- var p = brightness * (1.0 - saturation);
- var q = brightness * (1.0 - saturation * f);
- var t = brightness * (1.0 - (saturation * (1.0 - f)));
-
- switch (parseInt(h)) {
- case 0:
- red = (brightness * 255.0 + 0.5);
- green = (t * 255.0 + 0.5);
- blue = (p * 255.0 + 0.5);
- break;
- case 1:
- red = (q * 255.0 + 0.5);
- green = (brightness * 255.0 + 0.5);
- blue = (p * 255.0 + 0.5);
- break;
- case 2:
- red = (p * 255.0 + 0.5);
- green = (brightness * 255.0 + 0.5);
- blue = (t * 255.0 + 0.5);
- break;
- case 3:
- red = (p * 255.0 + 0.5);
- green = (q * 255.0 + 0.5);
- blue = (brightness * 255.0 + 0.5);
- break;
- case 4:
- red = (t * 255.0 + 0.5);
- green = (p * 255.0 + 0.5);
- blue = (brightness * 255.0 + 0.5);
- break;
- case 5:
- red = (brightness * 255.0 + 0.5);
- green = (p * 255.0 + 0.5);
- blue = (q * 255.0 + 0.5);
- break;
- }
- }
-
- return { r : parseInt(red), g : parseInt(green) , b : parseInt(blue) };
-}
-
-Rico.Color.RGBtoHSB = function(r, g, b) {
-
- var hue;
- var saturaton;
- var brightness;
-
- var cmax = (r > g) ? r : g;
- if (b > cmax)
- cmax = b;
-
- var cmin = (r < g) ? r : g;
- if (b < cmin)
- cmin = b;
-
- brightness = cmax / 255.0;
- if (cmax != 0)
- saturation = (cmax - cmin)/cmax;
- else
- saturation = 0;
-
- if (saturation == 0)
- hue = 0;
- else {
- var redc = (cmax - r)/(cmax - cmin);
- var greenc = (cmax - g)/(cmax - cmin);
- var bluec = (cmax - b)/(cmax - cmin);
-
- if (r == cmax)
- hue = bluec - greenc;
- else if (g == cmax)
- hue = 2.0 + redc - bluec;
- else
- hue = 4.0 + greenc - redc;
-
- hue = hue / 6.0;
- if (hue < 0)
- hue = hue + 1.0;
- }
-
- return { h : hue, s : saturation, b : brightness };
-}
-*/
-
-//-------------------- ricoCorner.js
-Rico.Corner = {
-
- round: function(e, options) {
- var e = $(e);
- this._setOptions(options);
-
- var color = this.options.color;
- if ( this.options.color == "fromElement" )
- color = this._background(e);
-
- var bgColor = this.options.bgColor;
- if ( this.options.bgColor == "fromParent" )
- bgColor = this._background(e.offsetParent);
-
- this._roundCornersImpl(e, color, bgColor);
- },
-
- _roundCornersImpl: function(e, color, bgColor) {
- if(this.options.border)
- this._renderBorder(e,bgColor);
- if(this._isTopRounded())
- this._roundTopCorners(e,color,bgColor);
- if(this._isBottomRounded())
- this._roundBottomCorners(e,color,bgColor);
- },
-
- _renderBorder: function(el,bgColor) {
- var borderValue = "1px solid " + this._borderColor(bgColor);
- var borderL = "border-left: " + borderValue;
- var borderR = "border-right: " + borderValue;
- var style = "style='" + borderL + ";" + borderR + "'";
- el.innerHTML = "<div " + style + ">" + el.innerHTML + "</div>"
- },
-
- _roundTopCorners: function(el, color, bgColor) {
- var corner = this._createCorner(bgColor);
- for(var i=0 ; i < this.options.numSlices ; i++ )
- corner.appendChild(this._createCornerSlice(color,bgColor,i,"top"));
- el.style.paddingTop = 0;
- el.insertBefore(corner,el.firstChild);
- },
-
- _roundBottomCorners: function(el, color, bgColor) {
- var corner = this._createCorner(bgColor);
- for(var i=(this.options.numSlices-1) ; i >= 0 ; i-- )
- corner.appendChild(this._createCornerSlice(color,bgColor,i,"bottom"));
- el.style.paddingBottom = 0;
- el.appendChild(corner);
- },
-
- _createCorner: function(bgColor) {
- var corner = document.createElement("div");
- corner.style.backgroundColor = (this._isTransparent() ? "transparent" : bgColor);
- return corner;
- },
-
- _createCornerSlice: function(color,bgColor, n, position) {
- var slice = document.createElement("span");
-
- var inStyle = slice.style;
- inStyle.backgroundColor = color;
- inStyle.display = "block";
- inStyle.height = "1px";
- inStyle.overflow = "hidden";
- inStyle.fontSize = "1px";
-
- var borderColor = this._borderColor(color,bgColor);
- if ( this.options.border && n == 0 ) {
- inStyle.borderTopStyle = "solid";
- inStyle.borderTopWidth = "1px";
- inStyle.borderLeftWidth = "0px";
- inStyle.borderRightWidth = "0px";
- inStyle.borderBottomWidth = "0px";
- inStyle.height = "0px"; // assumes css compliant box model
- inStyle.borderColor = borderColor;
- }
- else if(borderColor) {
- inStyle.borderColor = borderColor;
- inStyle.borderStyle = "solid";
- inStyle.borderWidth = "0px 1px";
- }
-
- if ( !this.options.compact && (n == (this.options.numSlices-1)) )
- inStyle.height = "2px";
-
- this._setMargin(slice, n, position);
- this._setBorder(slice, n, position);
- return slice;
- },
-
- _setOptions: function(options) {
- this.options = {
- corners : "all",
- color : "fromElement",
- bgColor : "fromParent",
- blend : true,
- border : false,
- compact : false
- }
- Object.extend(this.options, options || {});
-
- this.options.numSlices = this.options.compact ? 2 : 4;
- if ( this._isTransparent() )
- this.options.blend = false;
- },
-
- _whichSideTop: function() {
- if ( this._hasString(this.options.corners, "all", "top") )
- return "";
-
- if ( this.options.corners.indexOf("tl") >= 0 && this.options.corners.indexOf("tr") >= 0 )
- return "";
-
- if (this.options.corners.indexOf("tl") >= 0)
- return "left";
- else if (this.options.corners.indexOf("tr") >= 0)
- return "right";
- return "";
- },
-
- _whichSideBottom: function() {
- if ( this._hasString(this.options.corners, "all", "bottom") )
- return "";
-
- if ( this.options.corners.indexOf("bl")>=0 && this.options.corners.indexOf("br")>=0 )
- return "";
-
- if(this.options.corners.indexOf("bl") >=0)
- return "left";
- else if(this.options.corners.indexOf("br")>=0)
- return "right";
- return "";
- },
-
- _borderColor : function(color,bgColor) {
- if ( color == "transparent" )
- return bgColor;
- else if ( this.options.border )
- return this.options.border;
- else if ( this.options.blend )
- return this._blend( bgColor, color );
- else
- return "";
- },
-
-
- _setMargin: function(el, n, corners) {
- var marginSize = this._marginSize(n);
- var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
-
- if ( whichSide == "left" ) {
- el.style.marginLeft = marginSize + "px"; el.style.marginRight = "0px";
- }
- else if ( whichSide == "right" ) {
- el.style.marginRight = marginSize + "px"; el.style.marginLeft = "0px";
- }
- else {
- el.style.marginLeft = marginSize + "px"; el.style.marginRight = marginSize + "px";
- }
- },
-
- _setBorder: function(el,n,corners) {
- var borderSize = this._borderSize(n);
- var whichSide = corners == "top" ? this._whichSideTop() : this._whichSideBottom();
- if ( whichSide == "left" ) {
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = "0px";
- }
- else if ( whichSide == "right" ) {
- el.style.borderRightWidth = borderSize + "px"; el.style.borderLeftWidth = "0px";
- }
- else {
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
- }
- if (this.options.border != false)
- el.style.borderLeftWidth = borderSize + "px"; el.style.borderRightWidth = borderSize + "px";
- },
-
- _marginSize: function(n) {
- if ( this._isTransparent() )
- return 0;
-
- var marginSizes = [ 5, 3, 2, 1 ];
- var blendedMarginSizes = [ 3, 2, 1, 0 ];
- var compactMarginSizes = [ 2, 1 ];
- var smBlendedMarginSizes = [ 1, 0 ];
-
- if ( this.options.compact && this.options.blend )
- return smBlendedMarginSizes[n];
- else if ( this.options.compact )
- return compactMarginSizes[n];
- else if ( this.options.blend )
- return blendedMarginSizes[n];
- else
- return marginSizes[n];
- },
-
- _borderSize: function(n) {
- var transparentBorderSizes = [ 5, 3, 2, 1 ];
- var blendedBorderSizes = [ 2, 1, 1, 1 ];
- var compactBorderSizes = [ 1, 0 ];
- var actualBorderSizes = [ 0, 2, 0, 0 ];
-
- if ( this.options.compact && (this.options.blend || this._isTransparent()) )
- return 1;
- else if ( this.options.compact )
- return compactBorderSizes[n];
- else if ( this.options.blend )
- return blendedBorderSizes[n];
- else if ( this.options.border )
- return actualBorderSizes[n];
- else if ( this._isTransparent() )
- return transparentBorderSizes[n];
- return 0;
- },
-
- _hasString: function(str) { for(var i=1 ; i<arguments.length ; i++) if (str.indexOf(arguments[i]) >= 0) return true; return false; },
- _blend: function(c1, c2) { var cc1 = Rico.Color.createFromHex(c1); cc1.blend(Rico.Color.createFromHex(c2)); return cc1; },
- _background: function(el) { try { return Rico.Color.createColorFromBackground(el).asHex(); } catch(err) { return "#ffffff"; } },
- _isTransparent: function() { return this.options.color == "transparent"; },
- _isTopRounded: function() { return this._hasString(this.options.corners, "all", "top", "tl", "tr"); },
- _isBottomRounded: function() { return this._hasString(this.options.corners, "all", "bottom", "bl", "br"); },
- _hasSingleTextChild: function(el) { return el.childNodes.length == 1 && el.childNodes[0].nodeType == 3; }
-}
-
-
-//-------------------- ricoDragAndDrop.js
-/*
-Rico.DragAndDrop = Class.create();
-
-Rico.DragAndDrop.prototype = {
-
- initialize: function() {
- this.dropZones = new Array();
- this.draggables = new Array();
- this.currentDragObjects = new Array();
- this.dragElement = null;
- this.lastSelectedDraggable = null;
- this.currentDragObjectVisible = false;
- this.interestedInMotionEvents = false;
- this._mouseDown = this._mouseDownHandler.bindAsEventListener(this);
- this._mouseMove = this._mouseMoveHandler.bindAsEventListener(this);
- this._mouseUp = this._mouseUpHandler.bindAsEventListener(this);
- },
-
- registerDropZone: function(aDropZone) {
- this.dropZones[ this.dropZones.length ] = aDropZone;
- },
-
- deregisterDropZone: function(aDropZone) {
- var newDropZones = new Array();
- var j = 0;
- for ( var i = 0 ; i < this.dropZones.length ; i++ ) {
- if ( this.dropZones[i] != aDropZone )
- newDropZones[j++] = this.dropZones[i];
- }
-
- this.dropZones = newDropZones;
- },
-
- clearDropZones: function() {
- this.dropZones = new Array();
- },
-
- registerDraggable: function( aDraggable ) {
- this.draggables[ this.draggables.length ] = aDraggable;
- this._addMouseDownHandler( aDraggable );
- },
-
- clearSelection: function() {
- for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
- this.currentDragObjects[i].deselect();
- this.currentDragObjects = new Array();
- this.lastSelectedDraggable = null;
- },
-
- hasSelection: function() {
- return this.currentDragObjects.length > 0;
- },
-
- setStartDragFromElement: function( e, mouseDownElement ) {
- this.origPos = RicoUtil.toDocumentPosition(mouseDownElement);
- this.startx = e.screenX - this.origPos.x
- this.starty = e.screenY - this.origPos.y
- //this.startComponentX = e.layerX ? e.layerX : e.offsetX;
- //this.startComponentY = e.layerY ? e.layerY : e.offsetY;
- //this.adjustedForDraggableSize = false;
-
- this.interestedInMotionEvents = this.hasSelection();
- this._terminateEvent(e);
- },
-
- updateSelection: function( draggable, extendSelection ) {
- if ( ! extendSelection )
- this.clearSelection();
-
- if ( draggable.isSelected() ) {
- this.currentDragObjects.removeItem(draggable);
- draggable.deselect();
- if ( draggable == this.lastSelectedDraggable )
- this.lastSelectedDraggable = null;
- }
- else {
- this.currentDragObjects[ this.currentDragObjects.length ] = draggable;
- draggable.select();
- this.lastSelectedDraggable = draggable;
- }
- },
-
- _mouseDownHandler: function(e) {
- if ( arguments.length == 0 )
- e = event;
-
- // if not button 1 ignore it...
- var nsEvent = e.which != undefined;
- if ( (nsEvent && e.which != 1) || (!nsEvent && e.button != 1))
- return;
-
- var eventTarget = e.target ? e.target : e.srcElement;
- var draggableObject = eventTarget.draggable;
-
- var candidate = eventTarget;
- while (draggableObject == null && candidate.parentNode) {
- candidate = candidate.parentNode;
- draggableObject = candidate.draggable;
- }
-
- if ( draggableObject == null )
- return;
-
- this.updateSelection( draggableObject, e.ctrlKey );
-
- // clear the drop zones postion cache...
- if ( this.hasSelection() )
- for ( var i = 0 ; i < this.dropZones.length ; i++ )
- this.dropZones[i].clearPositionCache();
-
- this.setStartDragFromElement( e, draggableObject.getMouseDownHTMLElement() );
- },
-
-
- _mouseMoveHandler: function(e) {
- var nsEvent = e.which != undefined;
- if ( !this.interestedInMotionEvents ) {
- //this._terminateEvent(e);
- return;
- }
-
- if ( ! this.hasSelection() )
- return;
-
- if ( ! this.currentDragObjectVisible )
- this._startDrag(e);
-
- if ( !this.activatedDropZones )
- this._activateRegisteredDropZones();
-
- //if ( !this.adjustedForDraggableSize )
- // this._adjustForDraggableSize(e);
-
- this._updateDraggableLocation(e);
- this._updateDropZonesHover(e);
-
- this._terminateEvent(e);
- },
-
- _makeDraggableObjectVisible: function(e)
- {
- if ( !this.hasSelection() )
- return;
-
- var dragElement;
- if ( this.currentDragObjects.length > 1 )
- dragElement = this.currentDragObjects[0].getMultiObjectDragGUI(this.currentDragObjects);
- else
- dragElement = this.currentDragObjects[0].getSingleObjectDragGUI();
-
- // go ahead and absolute position it...
- if ( RicoUtil.getElementsComputedStyle(dragElement, "position") != "absolute" )
- dragElement.style.position = "absolute";
-
- // need to parent him into the document...
- if ( dragElement.parentNode == null || dragElement.parentNode.nodeType == 11 )
- document.body.appendChild(dragElement);
-
- this.dragElement = dragElement;
- this._updateDraggableLocation(e);
-
- this.currentDragObjectVisible = true;
- },
-
- /**
- _adjustForDraggableSize: function(e) {
- var dragElementWidth = this.dragElement.offsetWidth;
- var dragElementHeight = this.dragElement.offsetHeight;
- if ( this.startComponentX > dragElementWidth )
- this.startx -= this.startComponentX - dragElementWidth + 2;
- if ( e.offsetY ) {
- if ( this.startComponentY > dragElementHeight )
- this.starty -= this.startComponentY - dragElementHeight + 2;
- }
- this.adjustedForDraggableSize = true;
- },
- **/
-/*
- _updateDraggableLocation: function(e) {
- var dragObjectStyle = this.dragElement.style;
- dragObjectStyle.left = (e.screenX - this.startx) + "px"
- dragObjectStyle.top = (e.screenY - this.starty) + "px";
- },
-
- _updateDropZonesHover: function(e) {
- var n = this.dropZones.length;
- for ( var i = 0 ; i < n ; i++ ) {
- if ( ! this._mousePointInDropZone( e, this.dropZones[i] ) )
- this.dropZones[i].hideHover();
- }
-
- for ( var i = 0 ; i < n ; i++ ) {
- if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
- if ( this.dropZones[i].canAccept(this.currentDragObjects) )
- this.dropZones[i].showHover();
- }
- }
- },
-
- _startDrag: function(e) {
- for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
- this.currentDragObjects[i].startDrag();
-
- this._makeDraggableObjectVisible(e);
- },
-
- _mouseUpHandler: function(e) {
- if ( ! this.hasSelection() )
- return;
-
- var nsEvent = e.which != undefined;
- if ( (nsEvent && e.which != 1) || (!nsEvent && e.button != 1))
- return;
-
- this.interestedInMotionEvents = false;
-
- if ( this.dragElement == null ) {
- this._terminateEvent(e);
- return;
- }
-
- if ( this._placeDraggableInDropZone(e) )
- this._completeDropOperation(e);
- else {
- this._terminateEvent(e);
- new Effect.Position( this.dragElement,
- this.origPos.x,
- this.origPos.y,
- 200,
- 20,
- { complete : this._doCancelDragProcessing.bind(this) } );
- }
-
- Event.stopObserving(document.body, "mousemove", this._mouseMove);
- Event.stopObserving(document.body, "mouseup", this._mouseUp);
- },
-
- _retTrue: function () {
- return true;
- },
-
- _completeDropOperation: function(e) {
- if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() ) {
- if ( this.dragElement.parentNode != null )
- this.dragElement.parentNode.removeChild(this.dragElement);
- }
-
- this._deactivateRegisteredDropZones();
- this._endDrag();
- this.clearSelection();
- this.dragElement = null;
- this.currentDragObjectVisible = false;
- this._terminateEvent(e);
- },
-
- _doCancelDragProcessing: function() {
- this._cancelDrag();
-
- if ( this.dragElement != this.currentDragObjects[0].getMouseDownHTMLElement() && this.dragElement)
- if ( this.dragElement.parentNode != null )
- this.dragElement.parentNode.removeChild(this.dragElement);
-
-
- this._deactivateRegisteredDropZones();
- this.dragElement = null;
- this.currentDragObjectVisible = false;
- },
-
- _placeDraggableInDropZone: function(e) {
- var foundDropZone = false;
- var n = this.dropZones.length;
- for ( var i = 0 ; i < n ; i++ ) {
- if ( this._mousePointInDropZone( e, this.dropZones[i] ) ) {
- if ( this.dropZones[i].canAccept(this.currentDragObjects) ) {
- this.dropZones[i].hideHover();
- this.dropZones[i].accept(this.currentDragObjects);
- foundDropZone = true;
- break;
- }
- }
- }
-
- return foundDropZone;
- },
-
- _cancelDrag: function() {
- for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
- this.currentDragObjects[i].cancelDrag();
- },
-
- _endDrag: function() {
- for ( var i = 0 ; i < this.currentDragObjects.length ; i++ )
- this.currentDragObjects[i].endDrag();
- },
-
- _mousePointInDropZone: function( e, dropZone ) {
-
- var absoluteRect = dropZone.getAbsoluteRect();
-
- return e.clientX > absoluteRect.left &&
- e.clientX < absoluteRect.right &&
- e.clientY > absoluteRect.top &&
- e.clientY < absoluteRect.bottom;
- },
-
- _addMouseDownHandler: function( aDraggable )
- {
- htmlElement = aDraggable.getMouseDownHTMLElement();
- if ( htmlElement != null ) {
- htmlElement.draggable = aDraggable;
- Event.observe(htmlElement , "mousedown", this._onmousedown.bindAsEventListener(this));
- Event.observe(htmlElement, "mousedown", this._mouseDown);
- }
- },
-
- _activateRegisteredDropZones: function() {
- var n = this.dropZones.length;
- for ( var i = 0 ; i < n ; i++ ) {
- var dropZone = this.dropZones[i];
- if ( dropZone.canAccept(this.currentDragObjects) )
- dropZone.activate();
- }
-
- this.activatedDropZones = true;
- },
-
- _deactivateRegisteredDropZones: function() {
- var n = this.dropZones.length;
- for ( var i = 0 ; i < n ; i++ )
- this.dropZones[i].deactivate();
- this.activatedDropZones = false;
- },
-
- _onmousedown: function () {
- Event.observe(document.body, "mousemove", this._mouseMove);
- Event.observe(document.body, "mouseup", this._mouseUp);
- },
-
- _terminateEvent: function(e) {
- if ( e.stopPropagation != undefined )
- e.stopPropagation();
- else if ( e.cancelBubble != undefined )
- e.cancelBubble = true;
-
- if ( e.preventDefault != undefined )
- e.preventDefault();
- else
- e.returnValue = false;
- }
-
-}
-
-Rico.Draggable = Class.create();
-
-Rico.Draggable.prototype = {
-
- initialize: function( type, htmlElement ) {
- this.type = type;
- this.htmlElement = $(htmlElement);
- this.selected = false;
- },
-
- /**
- * Returns the HTML element that should have a mouse down event
- * added to it in order to initiate a drag operation
- *
- **//*
- getMouseDownHTMLElement: function() {
- return this.htmlElement;
- },
-
- select: function() {
- this.selected = true;
-
- if ( this.showingSelected )
- return;
-
- var htmlElement = this.getMouseDownHTMLElement();
-
- var color = Rico.Color.createColorFromBackground(htmlElement);
- color.isBright() ? color.darken(0.033) : color.brighten(0.033);
-
- this.saveBackground = RicoUtil.getElementsComputedStyle(htmlElement, "backgroundColor", "background-color");
- htmlElement.style.backgroundColor = color.asHex();
- this.showingSelected = true;
- },
-
- deselect: function() {
- this.selected = false;
- if ( !this.showingSelected )
- return;
-
- var htmlElement = this.getMouseDownHTMLElement();
-
- htmlElement.style.backgroundColor = this.saveBackground;
- this.showingSelected = false;
- },
-
- isSelected: function() {
- return this.selected;
- },
-
- startDrag: function() {
- },
-
- cancelDrag: function() {
- },
-
- endDrag: function() {
- },
-
- getSingleObjectDragGUI: function() {
- return this.htmlElement;
- },
-
- getMultiObjectDragGUI: function( draggables ) {
- return this.htmlElement;
- },
-
- getDroppedGUI: function() {
- return this.htmlElement;
- },
-
- toString: function() {
- return this.type + ":" + this.htmlElement + ":";
- }
-
-}
-
-Rico.Dropzone = Class.create();
-
-Rico.Dropzone.prototype = {
-
- initialize: function( htmlElement ) {
- this.htmlElement = $(htmlElement);
- this.absoluteRect = null;
- },
-
- getHTMLElement: function() {
- return this.htmlElement;
- },
-
- clearPositionCache: function() {
- this.absoluteRect = null;
- },
-
- getAbsoluteRect: function() {
- if ( this.absoluteRect == null ) {
- var htmlElement = this.getHTMLElement();
- var pos = RicoUtil.toViewportPosition(htmlElement);
-
- this.absoluteRect = {
- top: pos.y,
- left: pos.x,
- bottom: pos.y + htmlElement.offsetHeight,
- right: pos.x + htmlElement.offsetWidth
- };
- }
- return this.absoluteRect;
- },
-
- activate: function() {
- var htmlElement = this.getHTMLElement();
- if (htmlElement == null || this.showingActive)
- return;
-
- this.showingActive = true;
- this.saveBackgroundColor = htmlElement.style.backgroundColor;
-
- var fallbackColor = "#ffea84";
- var currentColor = Rico.Color.createColorFromBackground(htmlElement);
- if ( currentColor == null )
- htmlElement.style.backgroundColor = fallbackColor;
- else {
- currentColor.isBright() ? currentColor.darken(0.2) : currentColor.brighten(0.2);
- htmlElement.style.backgroundColor = currentColor.asHex();
- }
- },
-
- deactivate: function() {
- var htmlElement = this.getHTMLElement();
- if (htmlElement == null || !this.showingActive)
- return;
-
- htmlElement.style.backgroundColor = this.saveBackgroundColor;
- this.showingActive = false;
- this.saveBackgroundColor = null;
- },
-
- showHover: function() {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null || this.showingHover )
- return;
-
- this.saveBorderWidth = htmlElement.style.borderWidth;
- this.saveBorderStyle = htmlElement.style.borderStyle;
- this.saveBorderColor = htmlElement.style.borderColor;
-
- this.showingHover = true;
- htmlElement.style.borderWidth = "1px";
- htmlElement.style.borderStyle = "solid";
- //htmlElement.style.borderColor = "#ff9900";
- htmlElement.style.borderColor = "#ffff00";
- },
-
- hideHover: function() {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null || !this.showingHover )
- return;
-
- htmlElement.style.borderWidth = this.saveBorderWidth;
- htmlElement.style.borderStyle = this.saveBorderStyle;
- htmlElement.style.borderColor = this.saveBorderColor;
- this.showingHover = false;
- },
-
- canAccept: function(draggableObjects) {
- return true;
- },
-
- accept: function(draggableObjects) {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null )
- return;
-
- n = draggableObjects.length;
- for ( var i = 0 ; i < n ; i++ )
- {
- var theGUI = draggableObjects[i].getDroppedGUI();
- if ( RicoUtil.getElementsComputedStyle( theGUI, "position" ) == "absolute" )
- {
- theGUI.style.position = "static";
- theGUI.style.top = "";
- theGUI.style.top = "";
- }
- htmlElement.appendChild(theGUI);
- }
- }
-}
-
-var dndMgr = new Rico.DragAndDrop();
-
-
-
-//-------------------- ricoDraggable.js
-Rico.Draggable = Class.create();
-
-Rico.Draggable.prototype = {
-
- initialize: function( type, htmlElement ) {
- this.type = type;
- this.htmlElement = $(htmlElement);
- this.selected = false;
- },
-
- /**
- * Returns the HTML element that should have a mouse down event
- * added to it in order to initiate a drag operation
- *
- **//*
- getMouseDownHTMLElement: function() {
- return this.htmlElement;
- },
-
- select: function() {
- this.selected = true;
-
- if ( this.showingSelected )
- return;
-
- var htmlElement = this.getMouseDownHTMLElement();
-
- var color = Rico.Color.createColorFromBackground(htmlElement);
- color.isBright() ? color.darken(0.033) : color.brighten(0.033);
-
- this.saveBackground = RicoUtil.getElementsComputedStyle(htmlElement, "backgroundColor", "background-color");
- htmlElement.style.backgroundColor = color.asHex();
- this.showingSelected = true;
- },
-
- deselect: function() {
- this.selected = false;
- if ( !this.showingSelected )
- return;
-
- var htmlElement = this.getMouseDownHTMLElement();
-
- htmlElement.style.backgroundColor = this.saveBackground;
- this.showingSelected = false;
- },
-
- isSelected: function() {
- return this.selected;
- },
-
- startDrag: function() {
- },
-
- cancelDrag: function() {
- },
-
- endDrag: function() {
- },
-
- getSingleObjectDragGUI: function() {
- return this.htmlElement;
- },
-
- getMultiObjectDragGUI: function( draggables ) {
- return this.htmlElement;
- },
-
- getDroppedGUI: function() {
- return this.htmlElement;
- },
-
- toString: function() {
- return this.type + ":" + this.htmlElement + ":";
- }
-
-}
-
-
-//-------------------- ricoDropzone.js
-Rico.Dropzone = Class.create();
-
-Rico.Dropzone.prototype = {
-
- initialize: function( htmlElement ) {
- this.htmlElement = $(htmlElement);
- this.absoluteRect = null;
- },
-
- getHTMLElement: function() {
- return this.htmlElement;
- },
-
- clearPositionCache: function() {
- this.absoluteRect = null;
- },
-
- getAbsoluteRect: function() {
- if ( this.absoluteRect == null ) {
- var htmlElement = this.getHTMLElement();
- var pos = RicoUtil.toViewportPosition(htmlElement);
-
- this.absoluteRect = {
- top: pos.y,
- left: pos.x,
- bottom: pos.y + htmlElement.offsetHeight,
- right: pos.x + htmlElement.offsetWidth
- };
- }
- return this.absoluteRect;
- },
-
- activate: function() {
- var htmlElement = this.getHTMLElement();
- if (htmlElement == null || this.showingActive)
- return;
-
- this.showingActive = true;
- this.saveBackgroundColor = htmlElement.style.backgroundColor;
-
- var fallbackColor = "#ffea84";
- var currentColor = Rico.Color.createColorFromBackground(htmlElement);
- if ( currentColor == null )
- htmlElement.style.backgroundColor = fallbackColor;
- else {
- currentColor.isBright() ? currentColor.darken(0.2) : currentColor.brighten(0.2);
- htmlElement.style.backgroundColor = currentColor.asHex();
- }
- },
-
- deactivate: function() {
- var htmlElement = this.getHTMLElement();
- if (htmlElement == null || !this.showingActive)
- return;
-
- htmlElement.style.backgroundColor = this.saveBackgroundColor;
- this.showingActive = false;
- this.saveBackgroundColor = null;
- },
-
- showHover: function() {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null || this.showingHover )
- return;
-
- this.saveBorderWidth = htmlElement.style.borderWidth;
- this.saveBorderStyle = htmlElement.style.borderStyle;
- this.saveBorderColor = htmlElement.style.borderColor;
-
- this.showingHover = true;
- htmlElement.style.borderWidth = "1px";
- htmlElement.style.borderStyle = "solid";
- //htmlElement.style.borderColor = "#ff9900";
- htmlElement.style.borderColor = "#ffff00";
- },
-
- hideHover: function() {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null || !this.showingHover )
- return;
-
- htmlElement.style.borderWidth = this.saveBorderWidth;
- htmlElement.style.borderStyle = this.saveBorderStyle;
- htmlElement.style.borderColor = this.saveBorderColor;
- this.showingHover = false;
- },
-
- canAccept: function(draggableObjects) {
- return true;
- },
-
- accept: function(draggableObjects) {
- var htmlElement = this.getHTMLElement();
- if ( htmlElement == null )
- return;
-
- n = draggableObjects.length;
- for ( var i = 0 ; i < n ; i++ )
- {
- var theGUI = draggableObjects[i].getDroppedGUI();
- if ( RicoUtil.getElementsComputedStyle( theGUI, "position" ) == "absolute" )
- {
- theGUI.style.position = "static";
- theGUI.style.top = "";
- theGUI.style.top = "";
- }
- htmlElement.appendChild(theGUI);
- }
- }
-}
-*/
-
-
-//-------------------- ricoEffect.js
-
-/**
- * Use the Effect namespace for effects. If using scriptaculous effects
- * this will already be defined, otherwise we'll just create an empty
- * object for it...
- **/
-if ( window.Effect == undefined )
- Effect = {};
-
-Effect.SizeAndPosition = Class.create();
-Effect.SizeAndPosition.prototype = {
-
- initialize: function(element, x, y, w, h, duration, steps, options) {
- this.element = $(element);
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[7] || {};
-
- this.sizeAndPosition();
- },
-
- sizeAndPosition: function() {
- if (this.isFinished()) {
- if(this.options.complete) this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
-
- // Get original values: x,y = top left corner; w,h = width height
- var currentX = this.element.offsetLeft;
- var currentY = this.element.offsetTop;
- var currentW = this.element.offsetWidth;
- var currentH = this.element.offsetHeight;
-
- // If values not set, or zero, we do not modify them, and take original as final as well
- this.x = (this.x) ? this.x : currentX;
- this.y = (this.y) ? this.y : currentY;
- this.w = (this.w) ? this.w : currentW;
- this.h = (this.h) ? this.h : currentH;
-
- // how much do we need to modify our values for each step?
- var difX = this.steps > 0 ? (this.x - currentX)/this.steps : 0;
- var difY = this.steps > 0 ? (this.y - currentY)/this.steps : 0;
- var difW = this.steps > 0 ? (this.w - currentW)/this.steps : 0;
- var difH = this.steps > 0 ? (this.h - currentH)/this.steps : 0;
-
- this.moveBy(difX, difY);
- this.resizeBy(difW, difH);
-
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.sizeAndPosition.bind(this), stepDuration);
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- moveBy: function( difX, difY ) {
- var currentLeft = this.element.offsetLeft;
- var currentTop = this.element.offsetTop;
- var intDifX = parseInt(difX);
- var intDifY = parseInt(difY);
-
- var style = this.element.style;
- if ( intDifX != 0 )
- style.left = (currentLeft + intDifX) + "px";
- if ( intDifY != 0 )
- style.top = (currentTop + intDifY) + "px";
- },
-
- resizeBy: function( difW, difH ) {
- var currentWidth = this.element.offsetWidth;
- var currentHeight = this.element.offsetHeight;
- var intDifW = parseInt(difW);
- var intDifH = parseInt(difH);
-
- var style = this.element.style;
- if ( intDifW != 0 )
- style.width = (currentWidth + intDifW) + "px";
- if ( intDifH != 0 )
- style.height = (currentHeight + intDifH) + "px";
- }
-}
-
-Effect.Size = Class.create();
-Effect.Size.prototype = {
-
- initialize: function(element, w, h, duration, steps, options) {
- new Effect.SizeAndPosition(element, null, null, w, h, duration, steps, options);
- }
-}
-
-Effect.Position = Class.create();
-Effect.Position.prototype = {
-
- initialize: function(element, x, y, duration, steps, options) {
- new Effect.SizeAndPosition(element, x, y, null, null, duration, steps, options);
- }
-}
-
-Effect.Round = Class.create();
-Effect.Round.prototype = {
-
- initialize: function(tagName, className, options) {
- var elements = document.getElementsByTagAndClassName(tagName,className);
- for ( var i = 0 ; i < elements.length ; i++ )
- Rico.Corner.round( elements[i], options );
- }
-};
-
-Effect.FadeTo = Class.create();
-Effect.FadeTo.prototype = {
-
- initialize: function( element, opacity, duration, steps, options) {
- this.element = $(element);
- this.opacity = opacity;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[4] || {};
- this.fadeTo();
- },
-
- fadeTo: function() {
- if (this.isFinished()) {
- if(this.options.complete) this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
- var currentOpacity = this.getElementOpacity();
- var delta = this.steps > 0 ? (this.opacity - currentOpacity)/this.steps : 0;
-
- this.changeOpacityBy(delta);
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.fadeTo.bind(this), stepDuration);
- },
-
- changeOpacityBy: function(v) {
- var currentOpacity = this.getElementOpacity();
- var newOpacity = Math.max(0, Math.min(currentOpacity+v, 1));
- this.element.ricoOpacity = newOpacity;
-
- this.element.style.filter = "alpha(opacity:"+Math.round(newOpacity*100)+")";
- this.element.style.opacity = newOpacity; /*//*/;
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- getElementOpacity: function() {
- if ( this.element.ricoOpacity == undefined ) {
- var opacity = RicoUtil.getElementsComputedStyle(this.element, 'opacity');
- this.element.ricoOpacity = opacity != undefined ? opacity : 1.0;
- }
- return parseFloat(this.element.ricoOpacity);
- }
-}
-
-Effect.AccordionSize = Class.create();
-
-Effect.AccordionSize.prototype = {
-
- initialize: function(e1, e2, start, end, duration, steps, options) {
- this.e1 = $(e1);
- this.e2 = $(e2);
- this.start = start;
- this.end = end;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[6] || {};
-
- this.accordionSize();
- },
-
- accordionSize: function() {
-
- if (this.isFinished()) {
- // just in case there are round errors or such...
- this.e1.style.height = this.start + "px";
- this.e2.style.height = this.end + "px";
-
- if(this.options.complete)
- this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
-
- var diff = this.steps > 0 ? (parseInt(this.e1.offsetHeight) - this.start)/this.steps : 0;
- this.resizeBy(diff);
-
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.accordionSize.bind(this), stepDuration);
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- resizeBy: function(diff) {
- var h1Height = this.e1.offsetHeight;
- var h2Height = this.e2.offsetHeight;
- var intDiff = parseInt(diff);
- if ( diff != 0 ) {
- this.e1.style.height = (h1Height - intDiff) + "px";
- this.e2.style.height = (h2Height + intDiff) + "px";
- }
- }
-
-};
-
-
-//-------------------- ricoEffects.js
-
-/**
- * Use the Effect namespace for effects. If using scriptaculous effects
- * this will already be defined, otherwise we'll just create an empty
- * object for it...
- **/
-if ( window.Effect == undefined )
- Effect = {};
-
-Effect.SizeAndPosition = Class.create();
-Effect.SizeAndPosition.prototype = {
-
- initialize: function(element, x, y, w, h, duration, steps, options) {
- this.element = $(element);
- this.x = x;
- this.y = y;
- this.w = w;
- this.h = h;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[7] || {};
-
- this.sizeAndPosition();
- },
-
- sizeAndPosition: function() {
- if (this.isFinished()) {
- if(this.options.complete) this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
-
- // Get original values: x,y = top left corner; w,h = width height
- var currentX = this.element.offsetLeft;
- var currentY = this.element.offsetTop;
- var currentW = this.element.offsetWidth;
- var currentH = this.element.offsetHeight;
-
- // If values not set, or zero, we do not modify them, and take original as final as well
- this.x = (this.x) ? this.x : currentX;
- this.y = (this.y) ? this.y : currentY;
- this.w = (this.w) ? this.w : currentW;
- this.h = (this.h) ? this.h : currentH;
-
- // how much do we need to modify our values for each step?
- var difX = this.steps > 0 ? (this.x - currentX)/this.steps : 0;
- var difY = this.steps > 0 ? (this.y - currentY)/this.steps : 0;
- var difW = this.steps > 0 ? (this.w - currentW)/this.steps : 0;
- var difH = this.steps > 0 ? (this.h - currentH)/this.steps : 0;
-
- this.moveBy(difX, difY);
- this.resizeBy(difW, difH);
-
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.sizeAndPosition.bind(this), stepDuration);
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- moveBy: function( difX, difY ) {
- var currentLeft = this.element.offsetLeft;
- var currentTop = this.element.offsetTop;
- var intDifX = parseInt(difX);
- var intDifY = parseInt(difY);
-
- var style = this.element.style;
- if ( intDifX != 0 )
- style.left = (currentLeft + intDifX) + "px";
- if ( intDifY != 0 )
- style.top = (currentTop + intDifY) + "px";
- },
-
- resizeBy: function( difW, difH ) {
- var currentWidth = this.element.offsetWidth;
- var currentHeight = this.element.offsetHeight;
- var intDifW = parseInt(difW);
- var intDifH = parseInt(difH);
-
- var style = this.element.style;
- if ( intDifW != 0 )
- style.width = (currentWidth + intDifW) + "px";
- if ( intDifH != 0 )
- style.height = (currentHeight + intDifH) + "px";
- }
-}
-
-Effect.Size = Class.create();
-Effect.Size.prototype = {
-
- initialize: function(element, w, h, duration, steps, options) {
- new Effect.SizeAndPosition(element, null, null, w, h, duration, steps, options);
- }
-}
-
-Effect.Position = Class.create();
-Effect.Position.prototype = {
-
- initialize: function(element, x, y, duration, steps, options) {
- new Effect.SizeAndPosition(element, x, y, null, null, duration, steps, options);
- }
-}
-
-Effect.Round = Class.create();
-Effect.Round.prototype = {
-
- initialize: function(tagName, className, options) {
- var elements = document.getElementsByTagAndClassName(tagName,className);
- for ( var i = 0 ; i < elements.length ; i++ )
- Rico.Corner.round( elements[i], options );
- }
-};
-
-Effect.FadeTo = Class.create();
-Effect.FadeTo.prototype = {
-
- initialize: function( element, opacity, duration, steps, options) {
- this.element = $(element);
- this.opacity = opacity;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[4] || {};
- this.fadeTo();
- },
-
- fadeTo: function() {
- if (this.isFinished()) {
- if(this.options.complete) this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
- var currentOpacity = this.getElementOpacity();
- var delta = this.steps > 0 ? (this.opacity - currentOpacity)/this.steps : 0;
-
- this.changeOpacityBy(delta);
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.fadeTo.bind(this), stepDuration);
- },
-
- changeOpacityBy: function(v) {
- var currentOpacity = this.getElementOpacity();
- var newOpacity = Math.max(0, Math.min(currentOpacity+v, 1));
- this.element.ricoOpacity = newOpacity;
-
- this.element.style.filter = "alpha(opacity:"+Math.round(newOpacity*100)+")";
- this.element.style.opacity = newOpacity; /*//*/;
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- getElementOpacity: function() {
- if ( this.element.ricoOpacity == undefined ) {
- var opacity = RicoUtil.getElementsComputedStyle(this.element, 'opacity');
- this.element.ricoOpacity = opacity != undefined ? opacity : 1.0;
- }
- return parseFloat(this.element.ricoOpacity);
- }
-}
-
-Effect.AccordionSize = Class.create();
-
-Effect.AccordionSize.prototype = {
-
- initialize: function(e1, e2, start, end, duration, steps, options) {
- this.e1 = $(e1);
- this.e2 = $(e2);
- this.start = start;
- this.end = end;
- this.duration = duration;
- this.steps = steps;
- this.options = arguments[6] || {};
-
- this.accordionSize();
- },
-
- accordionSize: function() {
-
- if (this.isFinished()) {
- // just in case there are round errors or such...
- this.e1.style.height = this.start + "px";
- this.e2.style.height = this.end + "px";
-
- if(this.options.complete)
- this.options.complete(this);
- return;
- }
-
- if (this.timer)
- clearTimeout(this.timer);
-
- var stepDuration = Math.round(this.duration/this.steps) ;
-
- var diff = this.steps > 0 ? (parseInt(this.e1.offsetHeight) - this.start)/this.steps : 0;
- this.resizeBy(diff);
-
- this.duration -= stepDuration;
- this.steps--;
-
- this.timer = setTimeout(this.accordionSize.bind(this), stepDuration);
- },
-
- isFinished: function() {
- return this.steps <= 0;
- },
-
- resizeBy: function(diff) {
- var h1Height = this.e1.offsetHeight;
- var h2Height = this.e2.offsetHeight;
- var intDiff = parseInt(diff);
- if ( diff != 0 ) {
- this.e1.style.height = (h1Height - intDiff) + "px";
- this.e2.style.height = (h2Height + intDiff) + "px";
- }
- }
-
-};
-
-
-//-------------------- ricoLiveGrid.js
-// Rico.LiveGridMetaData -----------------------------------------------------
-
-Rico.LiveGridMetaData = Class.create();
-
-Rico.LiveGridMetaData.prototype = {
-
- initialize: function( pageSize, totalRows, columnCount, options ) {
- this.pageSize = pageSize;
- this.totalRows = totalRows;
- this.setOptions(options);
- this.ArrowHeight = 16;
- this.columnCount = columnCount;
- },
-
- setOptions: function(options) {
- this.options = {
- largeBufferSize : 7.0, // 7 pages
- nearLimitFactor : 0.2 // 20% of buffer
- };
- Object.extend(this.options, options || {});
- },
-
- getPageSize: function() {
- return this.pageSize;
- },
-
- getTotalRows: function() {
- return this.totalRows;
- },
-
- setTotalRows: function(n) {
- this.totalRows = n;
- },
-
- getLargeBufferSize: function() {
- return parseInt(this.options.largeBufferSize * this.pageSize);
- },
-
- getLimitTolerance: function() {
- return parseInt(this.getLargeBufferSize() * this.options.nearLimitFactor);
- }
-};
-
-// Rico.LiveGridScroller -----------------------------------------------------
-
-Rico.LiveGridScroller = Class.create();
-
-Rico.LiveGridScroller.prototype = {
-
- initialize: function(liveGrid, viewPort) {
- this.isIE = navigator.userAgent.toLowerCase().indexOf("msie") >= 0;
- this.liveGrid = liveGrid;
- this.metaData = liveGrid.metaData;
- this.createScrollBar();
- this.scrollTimeout = null;
- this.lastScrollPos = 0;
- this.viewPort = viewPort;
- this.rows = new Array();
- },
-
- isUnPlugged: function() {
- return this.scrollerDiv.onscroll == null;
- },
-
- plugin: function() {
- this.scrollerDiv.onscroll = this.handleScroll.bindAsEventListener(this);
- },
-
- unplug: function() {
- this.scrollerDiv.onscroll = null;
- },
-
- sizeIEHeaderHack: function() {
- if ( !this.isIE ) return;
- var headerTable = $(this.liveGrid.tableId + "_header");
- if ( headerTable )
- headerTable.rows[0].cells[0].style.width =
- (headerTable.rows[0].cells[0].offsetWidth + 1) + "px";
- },
-
- createScrollBar: function() {
- var visibleHeight = this.liveGrid.viewPort.visibleHeight();
- // create the outer div...
- this.scrollerDiv = document.createElement("div");
- var scrollerStyle = this.scrollerDiv.style;
- scrollerStyle.borderRight = this.liveGrid.options.scrollerBorderRight;
- scrollerStyle.position = "relative";
- scrollerStyle.left = this.isIE ? "-6px" : "-3px";
- scrollerStyle.width = "19px";
- scrollerStyle.height = visibleHeight + "px";
- scrollerStyle.overflow = "auto";
-
- // create the inner div...
- this.heightDiv = document.createElement("div");
- this.heightDiv.style.width = "1px";
-
- this.heightDiv.style.height = parseInt(visibleHeight *
- this.metaData.getTotalRows()/this.metaData.getPageSize()) + "px" ;
- this.scrollerDiv.appendChild(this.heightDiv);
- this.scrollerDiv.onscroll = this.handleScroll.bindAsEventListener(this);
-
- var table = this.liveGrid.table;
- table.parentNode.parentNode.insertBefore( this.scrollerDiv, table.parentNode.nextSibling );
- var eventName = this.isIE ? "mousewheel" : "DOMMouseScroll";
- Event.observe(table, eventName,
- function(evt) {
- if (evt.wheelDelta>=0 || evt.detail < 0) //wheel-up
- this.scrollerDiv.scrollTop -= (2*this.viewPort.rowHeight);
- else
- this.scrollerDiv.scrollTop += (2*this.viewPort.rowHeight);
- this.handleScroll(false);
- }.bindAsEventListener(this),
- false);
- },
-
- updateSize: function() {
- var table = this.liveGrid.table;
- var visibleHeight = this.viewPort.visibleHeight();
- this.heightDiv.style.height = parseInt(visibleHeight *
- this.metaData.getTotalRows()/this.metaData.getPageSize()) + "px";
- },
-
- rowToPixel: function(rowOffset) {
- return (rowOffset / this.metaData.getTotalRows()) * this.heightDiv.offsetHeight
- },
-
- moveScroll: function(rowOffset) {
- this.scrollerDiv.scrollTop = this.rowToPixel(rowOffset);
- if ( this.metaData.options.onscroll )
- this.metaData.options.onscroll( this.liveGrid, rowOffset );
- },
-
- handleScroll: function() {
- if ( this.scrollTimeout )
- clearTimeout( this.scrollTimeout );
-
- var scrollDiff = this.lastScrollPos-this.scrollerDiv.scrollTop;
- if (scrollDiff != 0.00) {
- var r = this.scrollerDiv.scrollTop % this.viewPort.rowHeight;
- if (r != 0) {
- this.unplug();
- if ( scrollDiff < 0 ) {
- this.scrollerDiv.scrollTop += (this.viewPort.rowHeight-r);
- } else {
- this.scrollerDiv.scrollTop -= r;
- }
- this.plugin();
- }
- }
- var contentOffset = parseInt(this.scrollerDiv.scrollTop / this.viewPort.rowHeight);
- this.liveGrid.requestContentRefresh(contentOffset);
- this.viewPort.scrollTo(this.scrollerDiv.scrollTop);
-
- if ( this.metaData.options.onscroll )
- this.metaData.options.onscroll( this.liveGrid, contentOffset );
-
- this.scrollTimeout = setTimeout(this.scrollIdle.bind(this), 1200 );
- this.lastScrollPos = this.scrollerDiv.scrollTop;
-
- },
-
- scrollIdle: function() {
- if ( this.metaData.options.onscrollidle )
- this.metaData.options.onscrollidle();
- }
-};
-
-// Rico.LiveGridBuffer -----------------------------------------------------
-
-Rico.LiveGridBuffer = Class.create();
-
-Rico.LiveGridBuffer.prototype = {
-
- initialize: function(metaData, viewPort) {
- this.startPos = 0;
- this.size = 0;
- this.metaData = metaData;
- this.rows = new Array();
- this.updateInProgress = false;
- this.viewPort = viewPort;
- this.maxBufferSize = metaData.getLargeBufferSize() * 2;
- this.maxFetchSize = metaData.getLargeBufferSize();
- this.lastOffset = 0;
- },
-
- getBlankRow: function() {
- if (!this.blankRow ) {
- this.blankRow = new Array();
- for ( var i=0; i < this.metaData.columnCount ; i++ )
- this.blankRow[i] = "&nbsp;";
- }
- return this.blankRow;
- },
-
- loadRows: function(ajaxResponse) {
- var rowsElement = ajaxResponse.getElementsByTagName('rows')[0];
- this.updateUI = rowsElement.getAttribute("update_ui") == "true"
- var newRows = new Array()
- var trs = rowsElement.getElementsByTagName("tr");
- for ( var i=0 ; i < trs.length; i++ ) {
- var row = newRows[i] = new Array();
- var cells = trs[i].getElementsByTagName("td");
- for ( var j=0; j < cells.length ; j++ ) {
- var cell = cells[j];
- var convertSpaces = cell.getAttribute("convert_spaces") == "true";
- var cellContent = RicoUtil.getContentAsString(cell);
- row[j] = convertSpaces ? this.convertSpaces(cellContent) : cellContent;
- if (!row[j])
- row[j] = '&nbsp;';
- }
- }
- return newRows;
- },
-
- update: function(ajaxResponse, start) {
- var newRows = this.loadRows(ajaxResponse);
- if (this.rows.length == 0) { // initial load
- this.rows = newRows;
- this.size = this.rows.length;
- this.startPos = start;
- return;
- }
- if (start > this.startPos) { //appending
- if (this.startPos + this.rows.length < start) {
- this.rows = newRows;
- this.startPos = start;//
- } else {
- this.rows = this.rows.concat( newRows.slice(0, newRows.length));
- if (this.rows.length > this.maxBufferSize) {
- var fullSize = this.rows.length;
- this.rows = this.rows.slice(this.rows.length - this.maxBufferSize, this.rows.length)
- this.startPos = this.startPos + (fullSize - this.rows.length);
- }
- }
- } else { //prepending
- if (start + newRows.length < this.startPos) {
- this.rows = newRows;
- } else {
- this.rows = newRows.slice(0, this.startPos).concat(this.rows);
- if (this.rows.length > this.maxBufferSize)
- this.rows = this.rows.slice(0, this.maxBufferSize)
- }
- this.startPos = start;
- }
- this.size = this.rows.length;
- },
-
- clear: function() {
- this.rows = new Array();
- this.startPos = 0;
- this.size = 0;
- },
-
- isOverlapping: function(start, size) {
- return ((start < this.endPos()) && (this.startPos < start + size)) || (this.endPos() == 0)
- },
-
- isInRange: function(position) {
- return (position >= this.startPos) && (position + this.metaData.getPageSize() <= this.endPos());
- //&& this.size() != 0;
- },
-
- isNearingTopLimit: function(position) {
- return position - this.startPos < this.metaData.getLimitTolerance();
- },
-
- endPos: function() {
- return this.startPos + this.rows.length;
- },
-
- isNearingBottomLimit: function(position) {
- return this.endPos() - (position + this.metaData.getPageSize()) < this.metaData.getLimitTolerance();
- },
-
- isAtTop: function() {
- return this.startPos == 0;
- },
-
- isAtBottom: function() {
- return this.endPos() == this.metaData.getTotalRows();
- },
-
- isNearingLimit: function(position) {
- return ( !this.isAtTop() && this.isNearingTopLimit(position)) ||
- ( !this.isAtBottom() && this.isNearingBottomLimit(position) )
- },
-
- getFetchSize: function(offset) {
- var adjustedOffset = this.getFetchOffset(offset);
- var adjustedSize = 0;
- if (adjustedOffset >= this.startPos) { //apending
- var endFetchOffset = this.maxFetchSize + adjustedOffset;
- if (endFetchOffset > this.metaData.totalRows)
- endFetchOffset = this.metaData.totalRows;
- adjustedSize = endFetchOffset - adjustedOffset;
- if(adjustedOffset == 0 && adjustedSize < this.maxFetchSize){
- adjustedSize = this.maxFetchSize;
- }
- } else {//prepending
- var adjustedSize = this.startPos - adjustedOffset;
- if (adjustedSize > this.maxFetchSize)
- adjustedSize = this.maxFetchSize;
- }
- return adjustedSize;
- },
-
- getFetchOffset: function(offset) {
- var adjustedOffset = offset;
- if (offset > this.startPos) //apending
- adjustedOffset = (offset > this.endPos()) ? offset : this.endPos();
- else { //prepending
- if (offset + this.maxFetchSize >= this.startPos) {
- var adjustedOffset = this.startPos - this.maxFetchSize;
- if (adjustedOffset < 0)
- adjustedOffset = 0;
- }
- }
- this.lastOffset = adjustedOffset;
- return adjustedOffset;
- },
-
- getRows: function(start, count) {
- var begPos = start - this.startPos
- var endPos = begPos + count
-
- // er? need more data...
- if ( endPos > this.size )
- endPos = this.size
-
- var results = new Array()
- var index = 0;
- for ( var i=begPos ; i < endPos; i++ ) {
- results[index++] = this.rows[i]
- }
- return results
- },
-
- convertSpaces: function(s) {
- return s.split(" ").join("&nbsp;");
- }
-
-};
-
-
-//Rico.GridViewPort --------------------------------------------------
-Rico.GridViewPort = Class.create();
-
-Rico.GridViewPort.prototype = {
-
- initialize: function(table, rowHeight, visibleRows, buffer, liveGrid) {
- this.lastDisplayedStartPos = 0;
- this.div = table.parentNode;
- this.table = table
- this.rowHeight = rowHeight;
- this.div.style.height = this.rowHeight * visibleRows;
- this.div.style.overflow = "hidden";
- this.buffer = buffer;
- this.liveGrid = liveGrid;
- this.visibleRows = visibleRows + 1;
- this.lastPixelOffset = 0;
- this.startPos = 0;
- },
-
- populateRow: function(htmlRow, row) {
- for (var j=0; j < row.length; j++) {
- htmlRow.cells[j].innerHTML = row[j]
- }
- },
-
- bufferChanged: function() {
- this.refreshContents( parseInt(this.lastPixelOffset / this.rowHeight));
- },
-
- clearRows: function() {
- if (!this.isBlank) {
- this.liveGrid.table.className = this.liveGrid.options.loadingClass;
- for (var i=0; i < this.visibleRows; i++)
- this.populateRow(this.table.rows[i], this.buffer.getBlankRow());
- this.isBlank = true;
- }
- },
-
- clearContents: function() {
- this.clearRows();
- this.scrollTo(0);
- this.startPos = 0;
- this.lastStartPos = -1;
- },
-
- refreshContents: function(startPos) {
- if (startPos == this.lastRowPos && !this.isPartialBlank && !this.isBlank) {
- return;
- }
- if ((startPos + this.visibleRows < this.buffer.startPos)
- || (this.buffer.startPos + this.buffer.size < startPos)
- || (this.buffer.size == 0)) {
- this.clearRows();
- return;
- }
- this.isBlank = false;
- var viewPrecedesBuffer = this.buffer.startPos > startPos
- var contentStartPos = viewPrecedesBuffer ? this.buffer.startPos: startPos;
- var contentEndPos = (this.buffer.startPos + this.buffer.size < startPos + this.visibleRows)
- ? this.buffer.startPos + this.buffer.size
- : startPos + this.visibleRows;
- var rowSize = contentEndPos - contentStartPos;
- var rows = this.buffer.getRows(contentStartPos, rowSize );
- var blankSize = this.visibleRows - rowSize;
- var blankOffset = viewPrecedesBuffer ? 0: rowSize;
- var contentOffset = viewPrecedesBuffer ? blankSize: 0;
-
- for (var i=0; i < rows.length; i++) {//initialize what we have
- this.populateRow(this.table.rows[i + contentOffset], rows[i]);
- }
- for (var i=0; i < blankSize; i++) {// blank out the rest
- this.populateRow(this.table.rows[i + blankOffset], this.buffer.getBlankRow());
- }
- this.isPartialBlank = blankSize > 0;
- this.lastRowPos = startPos;
-
- this.liveGrid.table.className = this.liveGrid.options.tableClass;
- // Check if user has set a onRefreshComplete function
- var onRefreshComplete = this.liveGrid.options.onRefreshComplete;
- if (onRefreshComplete != null)
- onRefreshComplete();
- },
-
- scrollTo: function(pixelOffset) {
- if (this.lastPixelOffset == pixelOffset)
- return;
-
- this.refreshContents(parseInt(pixelOffset / this.rowHeight))
- this.div.scrollTop = pixelOffset % this.rowHeight
-
- this.lastPixelOffset = pixelOffset;
- },
-
- visibleHeight: function() {
- return parseInt(RicoUtil.getElementsComputedStyle(this.div, 'height'));
- }
-
-};
-
-
-Rico.LiveGridRequest = Class.create();
-Rico.LiveGridRequest.prototype = {
- initialize: function( requestOffset, options ) {
- this.requestOffset = requestOffset;
- }
-};
-
-// Rico.LiveGrid -----------------------------------------------------
-
-Rico.LiveGrid = Class.create();
-
-Rico.LiveGrid.prototype = {
-
- initialize: function( tableId, visibleRows, totalRows, url, options, ajaxOptions ) {
-
- this.options = {
- tableClass: $(tableId).className,
- loadingClass: $(tableId).className,
- scrollerBorderRight: '1px solid #ababab',
- bufferTimeout: 20000,
- sortAscendImg: 'images/sort_asc.gif',
- sortDescendImg: 'images/sort_desc.gif',
- sortImageWidth: 9,
- sortImageHeight: 5,
- ajaxSortURLParms: [],
- onRefreshComplete: null,
- requestParameters: null,
- inlineStyles: true
- };
- Object.extend(this.options, options || {});
-
- this.ajaxOptions = {parameters: null};
- Object.extend(this.ajaxOptions, ajaxOptions || {});
-
- this.tableId = tableId;
- this.table = $(tableId);
-
- this.addLiveGridHtml();
-
- var columnCount = this.table.rows[0].cells.length;
- this.metaData = new Rico.LiveGridMetaData(visibleRows, totalRows, columnCount, options);
- this.buffer = new Rico.LiveGridBuffer(this.metaData);
-
- var rowCount = this.table.rows.length;
- this.viewPort = new Rico.GridViewPort(this.table,
- this.table.offsetHeight/rowCount,
- visibleRows,
- this.buffer, this);
- this.scroller = new Rico.LiveGridScroller(this,this.viewPort);
- this.options.sortHandler = this.sortHandler.bind(this);
-
- if ( $(tableId + '_header') )
- this.sort = new Rico.LiveGridSort(tableId + '_header', this.options)
-
- this.processingRequest = null;
- this.unprocessedRequest = null;
-
- this.initAjax(url);
- if ( this.options.prefetchBuffer || this.options.prefetchOffset > 0) {
- var offset = 0;
- if (this.options.offset ) {
- offset = this.options.offset;
- this.scroller.moveScroll(offset);
- this.viewPort.scrollTo(this.scroller.rowToPixel(offset));
- }
- if (this.options.sortCol) {
- this.sortCol = options.sortCol;
- this.sortDir = options.sortDir;
- }
- this.requestContentRefresh(offset);
- }
- },
-
- addLiveGridHtml: function() {
- // Check to see if need to create a header table.
- if (this.table.getElementsByTagName("thead").length > 0){
- // Create Table this.tableId+'_header'
- var tableHeader = this.table.cloneNode(true);
- tableHeader.setAttribute('id', this.tableId+'_header');
- tableHeader.setAttribute('class', this.table.className+'_header');
-
- // Clean up and insert
- for( var i = 0; i < tableHeader.tBodies.length; i++ )
- tableHeader.removeChild(tableHeader.tBodies[i]);
- this.table.deleteTHead();
- this.table.parentNode.insertBefore(tableHeader,this.table);
- }
-
- new Insertion.Before(this.table, "<div id='"+this.tableId+"_container'></div>");
- this.table.previousSibling.appendChild(this.table);
- new Insertion.Before(this.table,"<div id='"+this.tableId+"_viewport' style='float:left;'></div>");
- this.table.previousSibling.appendChild(this.table);
- },
-
- resetContents: function() {
- this.scroller.moveScroll(0);
- this.buffer.clear();
- this.viewPort.clearContents();
- },
-
- sortHandler: function(column) {
- this.sortCol = column.name;
- this.sortDir = column.currentSort;
-
- this.resetContents();
- this.requestContentRefresh(0)
- },
-
- setTotalRows: function( newTotalRows ) {
- this.resetContents();
- this.metaData.setTotalRows(newTotalRows);
- this.scroller.updateSize();
- },
-
- initAjax: function(url) {
- ajaxEngine.registerRequest( this.tableId + '_request', url );
- ajaxEngine.registerAjaxObject( this.tableId + '_updater', this );
- },
-
- invokeAjax: function() {
- },
-
- handleTimedOut: function() {
- //server did not respond in 4 seconds... assume that there could have been
- //an error or something, and allow requests to be processed again...
- this.processingRequest = null;
- this.processQueuedRequest();
- },
-
- fetchBuffer: function(offset) {
- if ( this.buffer.isInRange(offset) &&
- !this.buffer.isNearingLimit(offset)) {
- return;
- }
- if (this.processingRequest) {
- this.unprocessedRequest = new Rico.LiveGridRequest(offset);
- return;
- }
- var bufferStartPos = this.buffer.getFetchOffset(offset);
- this.processingRequest = new Rico.LiveGridRequest(offset);
- this.processingRequest.bufferOffset = bufferStartPos;
- var fetchSize = this.buffer.getFetchSize(offset);
- var partialLoaded = false;
-
- var queryString
- if (this.options.requestParameters)
- queryString = this._createQueryString(this.options.requestParameters, 0);
-
- queryString = (queryString == null) ? '' : queryString+'&';
- queryString = queryString+'id='+this.tableId+'&page_size='+fetchSize+'&offset='+bufferStartPos;
- if (this.sortCol)
- queryString = queryString+'&sort_col='+escape(this.sortCol)+'&sort_dir='+this.sortDir;
-
- this.ajaxOptions.parameters = queryString;
-
- ajaxEngine.sendRequest( this.tableId + '_request', this.ajaxOptions );
-
- this.timeoutHandler = setTimeout( this.handleTimedOut.bind(this), this.options.bufferTimeout);
-
- },
-
- setRequestParams: function() {
- this.options.requestParameters = [];
- for ( var i=0 ; i < arguments.length ; i++ )
- this.options.requestParameters[i] = arguments[i];
- },
-
- requestContentRefresh: function(contentOffset) {
- this.fetchBuffer(contentOffset);
- },
-
- ajaxUpdate: function(ajaxResponse) {
- try {
- clearTimeout( this.timeoutHandler );
- this.buffer.update(ajaxResponse,this.processingRequest.bufferOffset);
- this.viewPort.bufferChanged();
- }
- catch(err) {}
- finally {this.processingRequest = null; }
- this.processQueuedRequest();
- },
-
- _createQueryString: function( theArgs, offset ) {
- var queryString = ""
- if (!theArgs)
- return queryString;
-
- for ( var i = offset ; i < theArgs.length ; i++ ) {
- if ( i != offset )
- queryString += "&";
-
- var anArg = theArgs[i];
-
- if ( anArg.name != undefined && anArg.value != undefined ) {
- queryString += anArg.name + "=" + escape(anArg.value);
- }
- else {
- var ePos = anArg.indexOf('=');
- var argName = anArg.substring( 0, ePos );
- var argValue = anArg.substring( ePos + 1 );
- queryString += argName + "=" + escape(argValue);
- }
- }
- return queryString;
- },
-
- processQueuedRequest: function() {
- if (this.unprocessedRequest != null) {
- this.requestContentRefresh(this.unprocessedRequest.requestOffset);
- this.unprocessedRequest = null
- }
- }
-};
-
-
-//-------------------- ricoLiveGridSort.js
-Rico.LiveGridSort = Class.create();
-
-Rico.LiveGridSort.prototype = {
-
- initialize: function(headerTableId, options) {
- this.headerTableId = headerTableId;
- this.headerTable = $(headerTableId);
- this.options = options;
- this.setOptions();
- this.applySortBehavior();
-
- if ( this.options.sortCol ) {
- this.setSortUI( this.options.sortCol, this.options.sortDir );
- }
- },
-
- setSortUI: function( columnName, sortDirection ) {
- var cols = this.options.columns;
- for ( var i = 0 ; i < cols.length ; i++ ) {
- if ( cols[i].name == columnName ) {
- this.setColumnSort(i, sortDirection);
- break;
- }
- }
- },
-
- setOptions: function() {
- // preload the images...
- new Image().src = this.options.sortAscendImg;
- new Image().src = this.options.sortDescendImg;
-
- this.sort = this.options.sortHandler;
- if ( !this.options.columns )
- this.options.columns = this.introspectForColumnInfo();
- else {
- // allow client to pass { columns: [ ["a", true], ["b", false] ] }
- // and convert to an array of Rico.TableColumn objs...
- this.options.columns = this.convertToTableColumns(this.options.columns);
- }
- },
-
- applySortBehavior: function() {
- var headerRow = this.headerTable.rows[0];
- var headerCells = headerRow.cells;
- for ( var i = 0 ; i < headerCells.length ; i++ ) {
- this.addSortBehaviorToColumn( i, headerCells[i] );
- }
- },
-
- addSortBehaviorToColumn: function( n, cell ) {
- if ( this.options.columns[n].isSortable() ) {
- cell.id = this.headerTableId + '_' + n;
- cell.style.cursor = 'pointer';
- cell.onclick = this.headerCellClicked.bindAsEventListener(this);
- cell.innerHTML = cell.innerHTML + '<span id="' + this.headerTableId + '_img_' + n + '">'
- + '&nbsp;&nbsp;&nbsp;</span>';
- }
- },
-
- // event handler....
- headerCellClicked: function(evt) {
- var eventTarget = evt.target ? evt.target : evt.srcElement;
- var cellId = eventTarget.id;
- var columnNumber = parseInt(cellId.substring( cellId.lastIndexOf('_') + 1 ));
- var sortedColumnIndex = this.getSortedColumnIndex();
- if ( sortedColumnIndex != -1 ) {
- if ( sortedColumnIndex != columnNumber ) {
- this.removeColumnSort(sortedColumnIndex);
- this.setColumnSort(columnNumber, Rico.TableColumn.SORT_ASC);
- }
- else
- this.toggleColumnSort(sortedColumnIndex);
- }
- else
- this.setColumnSort(columnNumber, Rico.TableColumn.SORT_ASC);
-
- if (this.options.sortHandler) {
- this.options.sortHandler(this.options.columns[columnNumber]);
- }
- },
-
- removeColumnSort: function(n) {
- this.options.columns[n].setUnsorted();
- this.setSortImage(n);
- },
-
- setColumnSort: function(n, direction) {
- this.options.columns[n].setSorted(direction);
- this.setSortImage(n);
- },
-
- toggleColumnSort: function(n) {
- this.options.columns[n].toggleSort();
- this.setSortImage(n);
- },
-
- setSortImage: function(n) {
- var sortDirection = this.options.columns[n].getSortDirection();
-
- var sortImageSpan = $( this.headerTableId + '_img_' + n );
- if ( sortDirection == Rico.TableColumn.UNSORTED )
- sortImageSpan.innerHTML = '&nbsp;&nbsp;';
- else if ( sortDirection == Rico.TableColumn.SORT_ASC )
- sortImageSpan.innerHTML = '&nbsp;&nbsp;<img width="' + this.options.sortImageWidth + '" ' +
- 'height="'+ this.options.sortImageHeight + '" ' +
- 'src="' + this.options.sortAscendImg + '"/>';
- else if ( sortDirection == Rico.TableColumn.SORT_DESC )
- sortImageSpan.innerHTML = '&nbsp;&nbsp;<img width="' + this.options.sortImageWidth + '" ' +
- 'height="'+ this.options.sortImageHeight + '" ' +
- 'src="' + this.options.sortDescendImg + '"/>';
- },
-
- getSortedColumnIndex: function() {
- var cols = this.options.columns;
- for ( var i = 0 ; i < cols.length ; i++ ) {
- if ( cols[i].isSorted() )
- return i;
- }
-
- return -1;
- },
-
- introspectForColumnInfo: function() {
- var columns = new Array();
- var headerRow = this.headerTable.rows[0];
- var headerCells = headerRow.cells;
- for ( var i = 0 ; i < headerCells.length ; i++ )
- columns.push( new Rico.TableColumn( this.deriveColumnNameFromCell(headerCells[i],i), true ) );
- return columns;
- },
-
- convertToTableColumns: function(cols) {
- var columns = new Array();
- for ( var i = 0 ; i < cols.length ; i++ )
- columns.push( new Rico.TableColumn( cols[i][0], cols[i][1] ) );
- return columns;
- },
-
- deriveColumnNameFromCell: function(cell,columnNumber) {
- var cellContent = cell.innerText != undefined ? cell.innerText : cell.textContent;
- return cellContent ? cellContent.toLowerCase().split(' ').join('_') : "col_" + columnNumber;
- }
-};
-
-Rico.TableColumn = Class.create();
-
-Rico.TableColumn.UNSORTED = 0;
-Rico.TableColumn.SORT_ASC = "ASC";
-Rico.TableColumn.SORT_DESC = "DESC";
-
-Rico.TableColumn.prototype = {
- initialize: function(name, sortable) {
- this.name = name;
- this.sortable = sortable;
- this.currentSort = Rico.TableColumn.UNSORTED;
- },
-
- isSortable: function() {
- return this.sortable;
- },
-
- isSorted: function() {
- return this.currentSort != Rico.TableColumn.UNSORTED;
- },
-
- getSortDirection: function() {
- return this.currentSort;
- },
-
- toggleSort: function() {
- if ( this.currentSort == Rico.TableColumn.UNSORTED || this.currentSort == Rico.TableColumn.SORT_DESC )
- this.currentSort = Rico.TableColumn.SORT_ASC;
- else if ( this.currentSort == Rico.TableColumn.SORT_ASC )
- this.currentSort = Rico.TableColumn.SORT_DESC;
- },
-
- setUnsorted: function(direction) {
- this.setSorted(Rico.TableColumn.UNSORTED);
- },
-
- setSorted: function(direction) {
- // direction must by one of Rico.TableColumn.UNSORTED, .SORT_ASC, or .SORT_DESC...
- this.currentSort = direction;
- }
-
-};
-
-
-//-------------------- ricoUtil.js
-Rico.ArrayExtensions = new Array();
-
-if (Object.prototype.extend) {
- // in prototype.js...
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend;
-}else{
- Object.prototype.extend = function(object) {
- return Object.extend.apply(this, [this, object]);
- }
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Object.prototype.extend;
-}
-
-if (Array.prototype.push) {
- // in prototype.js...
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.push;
-}
-
-if (!Array.prototype.remove) {
- Array.prototype.remove = function(dx) {
- if( isNaN(dx) || dx > this.length )
- return false;
- for( var i=0,n=0; i<this.length; i++ )
- if( i != dx )
- this[n++]=this[i];
- this.length-=1;
- };
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.remove;
-}
-
-if (!Array.prototype.removeItem) {
- Array.prototype.removeItem = function(item) {
- for ( var i = 0 ; i < this.length ; i++ )
- if ( this[i] == item ) {
- this.remove(i);
- break;
- }
- };
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.removeItem;
-}
-
-if (!Array.prototype.indices) {
- Array.prototype.indices = function() {
- var indexArray = new Array();
- for ( index in this ) {
- var ignoreThis = false;
- for ( var i = 0 ; i < Rico.ArrayExtensions.length ; i++ ) {
- if ( this[index] == Rico.ArrayExtensions[i] ) {
- ignoreThis = true;
- break;
- }
- }
- if ( !ignoreThis )
- indexArray[ indexArray.length ] = index;
- }
- return indexArray;
- }
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.indices;
-}
-
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.unique;
- Rico.ArrayExtensions[ Rico.ArrayExtensions.length ] = Array.prototype.inArray;
-
-
-// Create the loadXML method and xml getter for Mozilla
-if ( window.DOMParser &&
- window.XMLSerializer &&
- window.Node && Node.prototype && Node.prototype.__defineGetter__ ) {
-
- if (!Document.prototype.loadXML) {
- Document.prototype.loadXML = function (s) {
- var doc2 = (new DOMParser()).parseFromString(s, "text/xml");
- while (this.hasChildNodes())
- this.removeChild(this.lastChild);
-
- for (var i = 0; i < doc2.childNodes.length; i++) {
- this.appendChild(this.importNode(doc2.childNodes[i], true));
- }
- };
- }
-
- Document.prototype.__defineGetter__( "xml",
- function () {
- return (new XMLSerializer()).serializeToString(this);
- }
- );
-}
-
-document.getElementsByTagAndClassName = function(tagName, className) {
- if ( tagName == null )
- tagName = '*';
-
- var children = document.getElementsByTagName(tagName) || document.all;
- var elements = new Array();
-
- if ( className == null )
- return children;
-
- for (var i = 0; i < children.length; i++) {
- var child = children[i];
- var classNames = child.className.split(' ');
- for (var j = 0; j < classNames.length; j++) {
- if (classNames[j] == className) {
- elements.push(child);
- break;
- }
- }
- }
-
- return elements;
-}
-
-var RicoUtil = {
-
- getElementsComputedStyle: function ( htmlElement, cssProperty, mozillaEquivalentCSS) {
- if ( arguments.length == 2 )
- mozillaEquivalentCSS = cssProperty;
-
- var el = $(htmlElement);
- if ( el.currentStyle )
- return el.currentStyle[cssProperty];
- else
- return document.defaultView.getComputedStyle(el, null).getPropertyValue(mozillaEquivalentCSS);
- },
-
- createXmlDocument : function() {
- if (document.implementation && document.implementation.createDocument) {
- var doc = document.implementation.createDocument("", "", null);
-
- if (doc.readyState == null) {
- doc.readyState = 1;
- doc.addEventListener("load", function () {
- doc.readyState = 4;
- if (typeof doc.onreadystatechange == "function")
- doc.onreadystatechange();
- }, false);
- }
-
- return doc;
- }
-
- if (window.ActiveXObject)
- return Try.these(
- function() { return new ActiveXObject('MSXML2.DomDocument') },
- function() { return new ActiveXObject('Microsoft.DomDocument')},
- function() { return new ActiveXObject('MSXML.DomDocument') },
- function() { return new ActiveXObject('MSXML3.DomDocument') }
- ) || false;
-
- return null;
- },
-
- getContentAsString: function( parentNode ) {
- return parentNode.xml != undefined ?
- this._getContentAsStringIE(parentNode) :
- this._getContentAsStringMozilla(parentNode);
- },
-
- _getContentAsStringIE: function(parentNode) {
- var contentStr = "";
- for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) {
- var n = parentNode.childNodes[i];
- if (n.nodeType == 4) {
- contentStr += n.nodeValue;
- }
- else {
- contentStr += n.xml;
- }
- }
- return contentStr;
- },
-
- _getContentAsStringMozilla: function(parentNode) {
- var xmlSerializer = new XMLSerializer();
- var contentStr = "";
- for ( var i = 0 ; i < parentNode.childNodes.length ; i++ ) {
- var n = parentNode.childNodes[i];
- if (n.nodeType == 4) { // CDATA node
- contentStr += n.nodeValue;
- }
- else {
- contentStr += xmlSerializer.serializeToString(n);
- }
- }
- return contentStr;
- },
-
- toViewportPosition: function(element) {
- return this._toAbsolute(element,true);
- },
-
- toDocumentPosition: function(element) {
- return this._toAbsolute(element,false);
- },
-
- /**
- * Compute the elements position in terms of the window viewport
- * so that it can be compared to the position of the mouse (dnd)
- * This is additions of all the offsetTop,offsetLeft values up the
- * offsetParent hierarchy, ...taking into account any scrollTop,
- * scrollLeft values along the way...
- *
- * IE has a bug reporting a correct offsetLeft of elements within a
- * a relatively positioned parent!!!
- **/
- _toAbsolute: function(element,accountForDocScroll) {
-
- if ( navigator.userAgent.toLowerCase().indexOf("msie") == -1 )
- return this._toAbsoluteMozilla(element,accountForDocScroll);
-
- var x = 0;
- var y = 0;
- var parent = element;
- while ( parent ) {
-
- var borderXOffset = 0;
- var borderYOffset = 0;
- if ( parent != element ) {
- var borderXOffset = parseInt(this.getElementsComputedStyle(parent, "borderLeftWidth" ));
- var borderYOffset = parseInt(this.getElementsComputedStyle(parent, "borderTopWidth" ));
- borderXOffset = isNaN(borderXOffset) ? 0 : borderXOffset;
- borderYOffset = isNaN(borderYOffset) ? 0 : borderYOffset;
- }
-
- x += parent.offsetLeft - parent.scrollLeft + borderXOffset;
- y += parent.offsetTop - parent.scrollTop + borderYOffset;
- parent = parent.offsetParent;
- }
-
- if ( accountForDocScroll ) {
- x -= this.docScrollLeft();
- y -= this.docScrollTop();
- }
-
- return { x:x, y:y };
- },
-
- /**
- * Mozilla did not report all of the parents up the hierarchy via the
- * offsetParent property that IE did. So for the calculation of the
- * offsets we use the offsetParent property, but for the calculation of
- * the scrollTop/scrollLeft adjustments we navigate up via the parentNode
- * property instead so as to get the scroll offsets...
- *
- **/
- _toAbsoluteMozilla: function(element,accountForDocScroll) {
- var x = 0;
- var y = 0;
- var parent = element;
- while ( parent ) {
- x += parent.offsetLeft;
- y += parent.offsetTop;
- parent = parent.offsetParent;
- }
-
- parent = element;
- while ( parent &&
- parent != document.body &&
- parent != document.documentElement ) {
- if ( parent.scrollLeft )
- x -= parent.scrollLeft;
- if ( parent.scrollTop )
- y -= parent.scrollTop;
- parent = parent.parentNode;
- }
-
- if ( accountForDocScroll ) {
- x -= this.docScrollLeft();
- y -= this.docScrollTop();
- }
-
- return { x:x, y:y };
- },
-
- docScrollLeft: function() {
- if ( window.pageXOffset )
- return window.pageXOffset;
- else if ( document.documentElement && document.documentElement.scrollLeft )
- return document.documentElement.scrollLeft;
- else if ( document.body )
- return document.body.scrollLeft;
- else
- return 0;
- },
-
- docScrollTop: function() {
- if ( window.pageYOffset )
- return window.pageYOffset;
- else if ( document.documentElement && document.documentElement.scrollTop )
- return document.documentElement.scrollTop;
- else if ( document.body )
- return document.body.scrollTop;
- else
- return 0;
- }
-
-}; \ No newline at end of file
diff --git a/framework/Web/Javascripts/effects/CHANGELOG b/framework/Web/Javascripts/scriptaculous/CHANGELOG
index 323ca859..323ca859 100644
--- a/framework/Web/Javascripts/effects/CHANGELOG
+++ b/framework/Web/Javascripts/scriptaculous/CHANGELOG
diff --git a/framework/Web/Javascripts/effects/MIT-LICENSE b/framework/Web/Javascripts/scriptaculous/MIT-LICENSE
index 30ff1248..30ff1248 100644
--- a/framework/Web/Javascripts/effects/MIT-LICENSE
+++ b/framework/Web/Javascripts/scriptaculous/MIT-LICENSE
diff --git a/framework/Web/Javascripts/effects/README b/framework/Web/Javascripts/scriptaculous/README
index 94ff1307..94ff1307 100644
--- a/framework/Web/Javascripts/effects/README
+++ b/framework/Web/Javascripts/scriptaculous/README
diff --git a/framework/Web/Javascripts/effects/builder.js b/framework/Web/Javascripts/scriptaculous/builder.js
index 199afc12..199afc12 100644
--- a/framework/Web/Javascripts/effects/builder.js
+++ b/framework/Web/Javascripts/scriptaculous/builder.js
diff --git a/framework/Web/Javascripts/effects/controls.js b/framework/Web/Javascripts/scriptaculous/controls.js
index 46f2cc18..46f2cc18 100644
--- a/framework/Web/Javascripts/effects/controls.js
+++ b/framework/Web/Javascripts/scriptaculous/controls.js
diff --git a/framework/Web/Javascripts/effects/dragdrop.js b/framework/Web/Javascripts/scriptaculous/dragdrop.js
index 32c91bc3..32c91bc3 100644
--- a/framework/Web/Javascripts/effects/dragdrop.js
+++ b/framework/Web/Javascripts/scriptaculous/dragdrop.js
diff --git a/framework/Web/Javascripts/effects/effects.js b/framework/Web/Javascripts/scriptaculous/effects.js
index 06f59b47..06f59b47 100644
--- a/framework/Web/Javascripts/effects/effects.js
+++ b/framework/Web/Javascripts/scriptaculous/effects.js
diff --git a/framework/Web/Javascripts/effects/slider.js b/framework/Web/Javascripts/scriptaculous/slider.js
index f24f2823..f24f2823 100644
--- a/framework/Web/Javascripts/effects/slider.js
+++ b/framework/Web/Javascripts/scriptaculous/slider.js