summaryrefslogtreecommitdiff
path: root/framework
diff options
context:
space:
mode:
authorwei <>2006-01-16 02:43:30 +0000
committerwei <>2006-01-16 02:43:30 +0000
commitca47a8c7fd5eb9f34ac00a2f1a843859d6123dd8 (patch)
tree436215c674c4ef68335bf9b3cfe1387236d762ff /framework
parent2d6584b56f0c52686f868c4c7dafc44db0f7c5cf (diff)
Diffstat (limited to 'framework')
-rw-r--r--framework/Web/Javascripts/base/controls.js194
-rw-r--r--framework/Web/Javascripts/base/date.js147
-rw-r--r--framework/Web/Javascripts/base/effects.js22
-rw-r--r--framework/Web/Javascripts/base/json.js340
-rw-r--r--framework/Web/Javascripts/base/postback.js66
-rw-r--r--framework/Web/Javascripts/base/prado.js2
-rw-r--r--framework/Web/Javascripts/base/rico.js175
-rw-r--r--framework/Web/Javascripts/base/scroll.js0
-rw-r--r--framework/Web/Javascripts/base/util.js92
-rw-r--r--framework/Web/Javascripts/extended/array.js465
-rw-r--r--framework/Web/Javascripts/extended/base.js12
-rw-r--r--framework/Web/Javascripts/extended/event.js23
-rw-r--r--framework/Web/Javascripts/extended/functional.js171
-rw-r--r--framework/Web/Javascripts/extended/util.js95
-rw-r--r--framework/Web/Javascripts/extra/tp_template.js315
-rw-r--r--framework/Web/Javascripts/prado/ajax.js (renamed from framework/Web/Javascripts/base/ajax.js)0
-rw-r--r--framework/Web/Javascripts/prado/controls.js (renamed from framework/Web/Javascripts/base/focus.js)68
-rw-r--r--framework/Web/Javascripts/prado/datepicker.js (renamed from framework/Web/Javascripts/base/datepicker.js)0
-rw-r--r--framework/Web/Javascripts/prado/prado.js51
-rw-r--r--framework/Web/Javascripts/prado/validation.js (renamed from framework/Web/Javascripts/base/validation.js)0
-rw-r--r--framework/Web/Javascripts/prado/validators.js (renamed from framework/Web/Javascripts/base/validators.js)0
21 files changed, 247 insertions, 1991 deletions
diff --git a/framework/Web/Javascripts/base/controls.js b/framework/Web/Javascripts/base/controls.js
deleted file mode 100644
index ad5b8abe..00000000
--- a/framework/Web/Javascripts/base/controls.js
+++ /dev/null
@@ -1,194 +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);
- }
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/base/date.js b/framework/Web/Javascripts/base/date.js
deleted file mode 100644
index 375c59df..00000000
--- a/framework/Web/Javascripts/base/date.js
+++ /dev/null
@@ -1,147 +0,0 @@
-
-Object.extend(Date.prototype,
-{
- SimpleFormat: function(format)
- {
- var bits = new Array();
- bits['d'] = this.getDate();
- bits['dd'] = Prado.Util.pad(this.getDate(),2);
-
- bits['M'] = this.getMonth()+1;
- bits['MM'] = Prado.Util.pad(this.getMonth()+1,2);
-
- 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 = Prado.Util.pad(this.getMonth() + 1);
- var d = Prado.Util.pad(this.getDate());
- 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/base/effects.js b/framework/Web/Javascripts/base/effects.js
deleted file mode 100644
index cc31d00e..00000000
--- a/framework/Web/Javascripts/base/effects.js
+++ /dev/null
@@ -1,22 +0,0 @@
-Prado.Effect =
-{
- Highlight : function(element, duration)
- {
- new Effect.Highlight(element, {'duration':duration});
- },
-
- Scale : function(element, percent)
- {
- new Effect.Scale(element, percent);
- },
-
- MoveBy : function(element, toTop, toLeft)
- {
- new Effect.MoveBy(element, toTop, toLeft);
- },
-
- ScrollTo : function(element, duration)
- {
- new Effect.ScrollTo(element, {'duration':duration});
- }
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/base/json.js b/framework/Web/Javascripts/base/json.js
deleted file mode 100644
index 0981169d..00000000
--- a/framework/Web/Javascripts/base/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/base/postback.js b/framework/Web/Javascripts/base/postback.js
deleted file mode 100644
index 186495cc..00000000
--- a/framework/Web/Javascripts/base/postback.js
+++ /dev/null
@@ -1,66 +0,0 @@
-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/base/prado.js b/framework/Web/Javascripts/base/prado.js
deleted file mode 100644
index 95600f09..00000000
--- a/framework/Web/Javascripts/base/prado.js
+++ /dev/null
@@ -1,2 +0,0 @@
-var Prado = { Version: 2.0 };
-
diff --git a/framework/Web/Javascripts/base/rico.js b/framework/Web/Javascripts/base/rico.js
deleted file mode 100644
index d3df3a9b..00000000
--- a/framework/Web/Javascripts/base/rico.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/base/scroll.js b/framework/Web/Javascripts/base/scroll.js
deleted file mode 100644
index e69de29b..00000000
--- a/framework/Web/Javascripts/base/scroll.js
+++ /dev/null
diff --git a/framework/Web/Javascripts/base/util.js b/framework/Web/Javascripts/base/util.js
deleted file mode 100644
index 61b7d646..00000000
--- a/framework/Web/Javascripts/base/util.js
+++ /dev/null
@@ -1,92 +0,0 @@
-Prado.Util = {}
-
-/**
- * Pad a number with zeros from the left.
- * @param integer number
- * @param integer total string length
- * @return string zero padded number
- */
-Prado.Util.pad = function(number, X)
-{
- X = (!X ? 2 : X);
- number = ""+number;
- while (number.length < X)
- number = "0" + number;
- return number;
-}
-
-/**
- * Convert a string into integer, returns null if not integer.
- * @param {string} the string to convert to integer
- * @type {integer|null} null if string does not represent an integer.
- */
-Prado.Util.toInteger = function(value)
-{
- var exp = /^\s*[-\+]?\d+\s*$/;
- if (value.match(exp) == null)
- return null;
- var num = parseInt(value, 10);
- return (isNaN(num) ? null : num);
-}
-
-/**
- * Convert a string into a double/float value. <b>Internationalization
- * is not supported</b>
- * @param {string} the string to convert to double/float
- * @param {string} the decimal character
- * @return {float|null} null if string does not represent a float value
- */
-Prado.Util.toDouble = function(value, decimalchar)
-{
- decimalchar = undef(decimalchar) ? "." : decimalchar;
- var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
- var m = value.match(exp);
- if (m == null)
- return null;
- 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 currency value
- * @param {string} the grouping character, default is ","
- * @param {int} number of decimal digits
- * @param {string} the decimal character, default is "."
- * @type {float|null} the currency value as float.
- */
-Prado.Util.toCurrency = function(value, groupchar, digits, decimalchar)
-{
- groupchar = undef(groupchar) ? "," : groupchar;
- decimalchar = undef(decimalchar) ? "." : decimalchar;
- digits = undef(digits) ? 2 : digits;
-
- var exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
- + ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
- + "\\s*$");
- var m = value.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);
-}
-
-/**
- * Trim the value, if the value is undefined, empty string is return.
- * @param {string} string to be trimmed.
- * @type {string} trimmed string.
- */
-Prado.Util.trim = function(value)
-{
- if(!isString(value)) return "";
- return value.replace(/^\s+|\s+$/g, "");
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/extended/array.js b/framework/Web/Javascripts/extended/array.js
deleted file mode 100644
index 2aeb9084..00000000
--- a/framework/Web/Javascripts/extended/array.js
+++ /dev/null
@@ -1,465 +0,0 @@
-/**
-ARRAY EXTENSIONS
-by Caio Chassot (http://v2studio.com/k/code/)
-*/
-
-//function v2studio_com_code()
-//{
-
-
-/**
- * Searches Array for <b>value</b>.
- * returns the index of the first item
- * which matches <b>value</b>, or -1 if not found.
- * searching starts at index 0, or at <b>start</b>, if specified.
- *
- * Here are the rules for an item to match <b>value</b>
- * if strict is false or not specified (default):
- * if <b>value</b> is a:
- * # <b>function</b> -> <b>value(item)</b> must be true
- * # <b>RegExp</b> -> <b>value.test(item)</b> must be true
- * # anything else -> <b>item == value</b> must be true
- * @param value the value (function, regexp) to search
- * @param start where to start the search
- * @param strict use strict comparison (===) for everything
- */
-Array.prototype.indexOf = function(value, start, strict) {
- start = start || 0;
- for (var i=start; i<this.length; i++) {
- var item = this[i];
- if (strict ? item === value :
- isRegexp(value) ? value.test(item) :
- isFunction(value) ? value(item) :
- item == value)
- return i;
- }
- return -1;
-}
-
-/**
- * searches Array for <b>value</b> returns the first matched item, or null if not found
- * Parameters work the same as indexOf
- * @see #indexOf
- */
-Array.prototype.find = function(value, start, strict) {
- var i = this.indexOf(value, start, strict);
- if (i != -1) return this[i];
- return null
-}
-
-
-
-/* A.contains(value [, strict])
-/**
- * aliases: has, include
- * returns true if <b>value</b> is found in Array, otherwise false;
- * relies on indexOf, see its doc for details on <b>value</b> and <b>strict</b>
- * @see #indexOf
- */
-Array.prototype.contains = function(value,strict) {
- return this.indexOf(value,0,strict) !== -1;
-}
-
-
-Array.prototype.has = Array.prototype.contains;
-
-Array.prototype.include = Array.prototype.contains;
-
-
-/**
- * counts occurences of <b>value</b> in Array
- * relies on indexOf, see its doc for details on <b>value</b> and <b>strict</b>
- * @see #indexOf
- */
-Array.prototype.count = function(value, strict) {
- var pos, start = 0, count = 0;
- while ((pos = this.indexOf(value, start, strict)) !== -1) {
- start = pos + 1;
- count++;
- }
- return count;
-}
-
-
-/**
- * if <b>all</b> is false or not provied:
- * removes first occurence of <b>value</b> from Array
- * if <b>all</b> is provided and true:
- * removes all occurences of <b>value</b> from Array
- * returns the array
- * relies on indexOf, see its doc for details on <b>value</b> and <b>strict</b>
- * @see #indexOf
- */
-Array.prototype.remove = function(value,all,strict) {
- while (this.contains(value,strict)) {
- this.splice(this.indexOf(value,0,strict),1);
- if (!all) break
- }
- return this;
-}
-
-
-
-/* A.merge(a [, a]*)
- Append the contents of provided arrays into the current
- takes: one or more arrays
- returns: current array (modified)
-*/
-Array.prototype.merge = function() {
- var a = [];
- for (var i=0; i<arguments.length; i++)
- for (var j=0; j<arguments[i].length; j++)
- a.push(arguments[i][j]);
- for (var i=0; i<a.length; i++) this.push(a[i]);
- return this
-}
-
-
-
-/* A.min()
- returns the smallest item in array by comparing them with >
-*/
-Array.prototype.min = function() {
- if (!this.length) return;
- var n = this[0];
- for (var i=1; i<this.length; i++) if (n>this[i]) n=this[i];
- return n;
-}
-
-
-
-/* A.min()
- returns the graetest item in array by comparing them with <
-*/
-Array.prototype.max = function() {
- if (!this.length) return;
- var n = this[0];
- for (var i=1; i<this.length; i++) if (n<this[i]) n=this[i];
- return n;
-}
-
-
-
-/* A.first()
- returns first element of Array
-*/
-Array.prototype.first = function() { return this[0] }
-
-
-
-/* A.last()
- returns last element of Array
-*/
-Array.prototype.last = function() { return this[this.length-1] }
-
-
-
-/* A.sjoin()
- Shorthand for A.join(' ')
-*/
-Array.prototype.sjoin = function() { return this.join(' ') }
-
-
-
-/* A.njoin()
- Shorthand for A.join('\n')
-*/
-Array.prototype.njoin = function() { return this.join('\n') }
-
-
-
-/* A.cjoin()
- Shorthand for A.join(', ')
-*/
-Array.prototype.cjoin = function() { return this.join(', ') }
-
-
-
-/* A.equals(a [, strict])
- true if all elements of array are equal to all elements of `a` in the same
- order. if strict is specified and true, all elements must be equal and of
- the same type.
-*/
-Array.prototype.equals = function(a, strict){
- if (this==a) return true;
- if (a.length != this.length) return false;
- return this.map(function(item,idx){
- return strict? item === a[idx] : item == a[idx]
- }).all();
-}
-
-
-
-/* A.all([fn])
- Returns true if fn returns true for all elements in array
- if fn is not specified, returns true if all elements in array evaluate to
- true
-*/
-Array.prototype.all = function(fn) {
- return filter(this, fn).length == this.length;
-}
-
-
-
-/* A.any([fn])
- Returns true if fn returns true for any elements in array
- if fn is not specified, returns true if at least one element in array
- evaluates to true
-*/
-Array.prototype.any = function(fn) {
- return filter(this, fn).length > 0;
-}
-
-
-
-/* A.each(fn)
- method form of each function
-*/
-Array.prototype.each = function(fn) { return each(this, fn) }
-
-
-
-/* A.map([fn])
- method form of map function
-*/
-Array.prototype.map = function(fn) { return map(this, fn) }
-
-
-
-/* A.filter([fn])
- method form of filter function
-*/
-Array.prototype.filter = function(fn) { return filter(this, fn) }
-
-
-Array.prototype.select = Array.prototype.filter
-
-
-/* A.reduce([initial,] fn)
- method form of filter function
-*/
-Array.prototype.reduce = function() {
- var args = map(arguments);
- fn = args.pop();
- d = args.pop();
- return reduce(this, d, fn);
-}
-
-
-Array.prototype.inject = Array.prototype.reduce
-
-
-
-/* A.reject(fn)
- deletes items in A *in place* for which fn(item) is true
- returns a
-*/
-Array.prototype.reject = function(fn) {
- if (typeof(fn)=='string') fn = __strfn('item,idx,list', fn);
- var self = this;
- var itemsToRemove = [];
- fn = fn || function(v) {return v};
- map(self, function(item,idx,list) { if (fn(item,idx,list)) itemsToRemove.push(idx) } );
- itemsToRemove.reverse().each(function(idx) { self.splice(idx,1) });
- return self;
-}
-
-
-
-/* __strfn(args, fn)
- this is used internally by each, map, combine, filter and reduce to accept
- strings as functions.
-
- takes:
- `args` -> a string of comma separated names of the function arguments
- `fn` -> the function body
-
- if `fn` does not contain a return statement, a return keyword will be added
- before the last statement. the last statement is determined by removing the
- trailing semicolon (';') (if it exists) and then searching for the last
- semicolon, hence, caveats may apply (i.e. if the last statement has a
- string or regex containing the ';' character things will go wrong)
-*/
-function __strfn(args, fn) {
- function quote(s) { return '"' + s.replace(/"/g,'\\"') + '"' }
- if (!/\breturn\b/.test(fn)) {
- fn = fn.replace(/;\s*$/, '');
- fn = fn.insert(fn.lastIndexOf(';')+1, ' return ');
- }
- return eval('new Function('
- + map(args.split(/\s*,\s*/), quote).join()
- + ','
- + quote(fn)
- + ')'
- );
-}
-
-
-
-/* each(list, fn)
- traverses `list`, applying `fn` to each item of `list`
- takes:
- `list` -> anything that can be indexed and has a `length` property.
- usually an array.
- `fn` -> either a function, or a string containing a function body,
- in which case the name of the paremeters passed to it will be
- 'item', 'idx' and 'list'.
- se doc for `__strfn` for peculiarities about passing strings
- for `fn`
-
- `each` provides a safe way for traversing only an array's indexed items,
- ignoring its other properties. (as opposed to how for-in works)
-*/
-function each(list, fn) {
- if (typeof(fn)=='string') return each(list, __strfn('item,idx,list', fn));
- for (var i=0; i < list.length; i++) fn(list[i], i, list);
-}
-
-
-/* map(list [, fn])
- traverses `list`, applying `fn` to each item of `list`, returning an array
- of values returned by `fn`
-
- parameters work the same as for `each`, same `__strfn` caveats apply
-
- if `fn` is not provided, the list item is returned itself. this is an easy
- way to transform fake arrays (e.g. the arguments object of a function or
- nodeList objects) into real javascript arrays.
- e.g.: args = map(arguments)
-
- If you don't care about map's return value, you should use `each`
-
- this is a simplified version of python's map. parameter order is different,
- only a single list (array) is accepted, and the parameters passed to [fn]
- are different:
- [fn] takes the current item, then, optionally, the current index and a
- reference to the list (so that [fn] can modify list)
- see `combine` if you want to pass multiple lists
-*/
-function map(list, fn) {
- if (typeof(fn)=='string') return map(list, __strfn('item,idx,list', fn));
-
- var result = [];
- fn = fn || function(v) {return v};
- for (var i=0; i < list.length; i++) result.push(fn(list[i], i, list));
- return result;
-}
-
-
-/* combine(list [, list]* [, fn])
-
- takes:
- `list`s -> one or more lists (see `each` for definition of a list)
- `fn` -> Similar s `each` or `map`, a function or a string containing
- a function body.
- if a string is used, the name of parameters passed to the
- created function will be the lowercase alphabet letters, in
- order: a,b,c...
- same `__strfn` caveats apply
-
- combine will traverse all lists concurrently, passing each row if items as
- parameters to `fn`
- if `fn` is not provided, a function that returns a list containing each
- item in the row is used.
- if a list is smaller than the other, `null` is used in place of its missing
- items
-
- returns:
- an array of the values returned by calling `fn` for each row of items
-*/
-function combine() {
- var args = map(arguments);
- var lists = map(args.slice(0,-1),'map(item)');
- var fn = args.last();
- var toplen = map(lists, "item.length").max();
- var vals = [];
-
- if (!fn) fn = function(){return map(arguments)};
- if (typeof fn == 'string') {
- if (lists.length > 26) throw 'string functions can take at most 26 lists';
- var a = 'a'.charCodeAt(0);
- fn = __strfn(map(range(a, a+lists.length),'String.fromCharCode(item)').join(','), fn);
- }
-
- map(lists, function(li) {
- while (li.length < toplen) li.push(null);
- map(li, function(item,ix){
- if (ix < vals.length) vals[ix].push(item);
- else vals.push([item]);
- });
- });
-
- return map(vals, function(val) { return fn.apply(fn, val) });
-}
-
-
-
-/* filter(list [, fn])
- returns an array of items in `list` for which `fn(item)` is true
-
- parameters work the same as for `each`, same `__strfn` caveats apply
-
- if `fn` is not specified the items are evaluated themselves, that is,
- filter will return an array of the items in `list` which evaluate to true
-
- this is a similar to python's filter, but parameter order is inverted
-*/
-function filter(list, fn) {
- if (typeof(fn)=='string') return filter(list, __strfn('item,idx,list', fn));
-
- var result = [];
- fn = fn || function(v) {return v};
- map(list, function(item,idx,list) { if (fn(item,idx,list)) result.push(item) } );
- return result;
-}
-
-
-
-/* reduce(list [, initial], fn)
- similar to python's reduce. paremeter onder inverted...
-
- TODO: document this properly
-
- takes:
- `list` -> see doc for `each` to learn more about it
- `inirial -> TODO: doc`
- `fn` -> similar to `each` too, but in the case where it's a string,
- the name of the paremeters passed to it will be 'a' and 'b'
- same `__strfn` caveats apply
-
-*/
-function reduce(list, initial, fn) {
- if (undef(fn)) {
- fn = initial;
- initial = window.undefined; // explicit `window` object so browsers that do not have an `undefined` keyword will evaluate to the (hopefully) undefined parameter `undefined` of `window`
- }
- if (typeof(fn)=='string') return reduce(list, initial, __strfn('a,b', fn));
- if (isdef(initial)) list.splice(0,0,initial);
- if (list.length===0) return false;
- if (list.length===1) return list[0];
- var result = list[0];
- var i = 1;
- while(i<list.length) result = fn(result,list[i++]);
- return result;
-}
-
-/* range(start, stop, step)
- identical to python's range.
- range(stop)
- range(start,stop)
- range(start,stop,step)
-
- Return a list containing an arithmetic progression of integers.
- range(i, j) returns [i, i+1, i+2, ..., j-1]; start (!) defaults to 0.
- When step is given, it specifies the increment (or decrement).
- For example, range(4) returns [0, 1, 2, 3]. The end point is omitted!
- [from python's range's docstring]
-*/
-function range(start,stop,step) {
- if (isUndefined(stop)) return range(0,start,step);
- if (isUndefined(step)) step = 1;
- var ss = (step/Math.abs(step)); // step sign
- var r = [];
- for (i=start; i*ss<stop*ss; i=i+step) r.push(i);
- return r;
-} \ No newline at end of file
diff --git a/framework/Web/Javascripts/extended/base.js b/framework/Web/Javascripts/extended/base.js
index 145b003f..59a3c3a0 100644
--- a/framework/Web/Javascripts/extended/base.js
+++ b/framework/Web/Javascripts/extended/base.js
@@ -21,4 +21,14 @@ function $(n,d) {
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=DOM.find(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
-} \ No newline at end of file
+}
+
+/**
+ * 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.call(object, [event || window.event].concat(args));
+ }
+}
diff --git a/framework/Web/Javascripts/extended/event.js b/framework/Web/Javascripts/extended/event.js
index a7f58fae..4a35ba78 100644
--- a/framework/Web/Javascripts/extended/event.js
+++ b/framework/Web/Javascripts/extended/event.js
@@ -20,5 +20,26 @@ Object.extend(Event, {
name = 'keydown';
this._observeAndCache(element, name, observer, useCapture);
- }
+ },
+ keyCode : function(e)
+ {
+ return e.keyCode != null ? e.keyCode : e.charCode
+ },
+
+ fireEvent : function(el,type)
+ {
+ if(document.createEvent)
+ {
+ var evt = document.createEvent('HTMLEvents');
+ evt.initEvent(type, true, true);
+ el.dispatchEvent(evt);
+ }
+ else if(el.fireEvent)
+ {
+ el.fireEvent('on'+type);
+ el[type]();
+ }
+ else
+ el[type]();
+ }
}); \ No newline at end of file
diff --git a/framework/Web/Javascripts/extended/functional.js b/framework/Web/Javascripts/extended/functional.js
deleted file mode 100644
index 2ff0f4a3..00000000
--- a/framework/Web/Javascripts/extended/functional.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
-FUNCTIONAL
-by Caio Chassot (http://v2studio.com/k/code/)
-*/
-
-/**
- * this is used internally by each, map, combine, filter and reduce to accept
- * strings as functions.
- *
- * if <b>fn</b> does not contain a return statement, a return keyword will be added
- * before the last statement. the last statement is determined by removing the
- * trailing semicolon (';') (if it exists) and then searching for the last
- * semicolon, hence, caveats may apply (i.e. if the last statement has a
- * string or regex containing the ';' character things will go wrong)
- * @param args a string of comma separated names of the function arguments
- * @param fn the function body
- */
-function __strfn(args, fn) {
- /**
- * Internal function. Do not call it directly.
- */
- function quote(s) { return '"' + s.replace(/"/g,'\\"') + '"' }
- if (!/\breturn\b/.test(fn)) {
- fn = fn.replace(/;\s*$/, '');
- fn = fn.insert(fn.lastIndexOf(';')+1, ' return ');
- }
- return eval('new Function('
- + map(args.split(/\s*,\s*/), quote).join()
- + ','
- + quote(fn)
- + ')'
- );
-}
-
-
-/**
- * traverses <b>list</b>, applying <b>fn</b> to each item of <b>list</b>.
- * see doc for <b>__strfn</b> for peculiarities about passing strings for <b>fn</b>
- *
- * <b>each</b> provides a safe way for traversing only an array's indexed items,
- * ignoring its other properties. (as opposed to how for-in works)
- * @param list anything that can be indexed and has a <b>length</b> property. usually an array.
- * @param fn either a function, or a string containing a function body,
- * in which case the name of the paremeters passed to it will be
- * 'item', 'idx' and 'list'.
- * @see #__strfn
- */
-function each(list, fn) {
- if (typeof(fn)=='string') return each(list, __strfn('item,idx,list', fn));
- for (var i=0; i < list.length; i++) fn(list[i], i, list);
-}
-
-
-/**
- * traverses <b>list</b>, applying <b>fn</b> to each item of <b>list</b>, returning an array
- of values returned by <b>fn</b>
-
- parameters work the same as for <b>each</b>, same <b>__strfn</b> caveats apply
-
- if <b>fn</b> is not provided, the list item is returned itself. this is an easy
- way to transform fake arrays (e.g. the arguments object of a function or
- nodeList objects) into real javascript arrays.
- e.g.: args = map(arguments)
-
- If you don't care about map's return value, you should use <b>each</b>
-
- this is a simplified version of python's map. parameter order is different,
- only a single list (array) is accepted, and the parameters passed to [fn]
- are different:
- [fn] takes the current item, then, optionally, the current index and a
- reference to the list (so that [fn] can modify list)
- see <b>combine</b> if you want to pass multiple lists
- */
-function map(list, fn) {
- if (typeof(fn)=='string') return map(list, __strfn('item,idx,list', fn));
-
- var result = [];
- fn = fn || function(v) {return v};
- for (var i=0; i < list.length; i++) result.push(fn(list[i], i, list));
- return result;
-}
-
-
-/**
- * combine will traverse all lists concurrently, passing each row if items as
- parameters to <b>fn</b>
- if <b>fn</b> is not provided, a function that returns a list containing each
- item in the row is used.
- if a list is smaller than the other, <b>null</b> is used in place of its missing
- items
- * @param list one or more lists (see <b>each</b> for definition of a list)
- * @param fn Similar s <b>each</b> or <b>map</b>, a function or a string containing
- a function body.
- if a string is used, the name of parameters passed to the
- created function will be the lowercase alphabet letters, in
- order: a,b,c...
- same <b>__strfn</b> caveats apply
- * @see #each
- * @see #__strfn
- * @return an array of the values returned by calling <b>fn</b> for each row of items
- *//*
-function combine() {
- var args = map(arguments);
- var lists = map(args.slice(0,-1),'map(item)');
- var fn = args.last();
- var toplen = map(lists, "item.length").max();
- var vals = [];
-
- if (!fn) fn = function(){return map(arguments)};
- if (typeof fn == 'string') {
- if (lists.length > 26) throw 'string functions can take at most 26 lists';
- var a = 'a'.charCodeAt(0);
- fn = __strfn(map(range(a, a+lists.length),'String.fromCharCode(item)').join(','), fn);
- }
-
- map(lists, function(li) {
- while (li.length < toplen) li.push(null);
- map(li, function(item,ix){
- if (ix < vals.length) vals[ix].push(item);
- else vals.push([item]);
- });
- });
-
- return map(vals, function(val) { return fn.apply(fn, val) });
-}
-
-/**
- * returns an array of items in <b>list</b> for which <b>fn(item)</b> is true
-
- parameters work the same as for <b>each</b>, same <b>__strfn</b> caveats apply
-
- if <b>fn</b> is not specified the items are evaluated themselves, that is,
- filter will return an array of the items in <b>list</b> which evaluate to true
-
- this is a similar to python's filter, but parameter order is inverted
- *//*
-function filter(list, fn) {
- if (typeof(fn)=='string') return filter(list, __strfn('item,idx,list', fn));
-
- var result = [];
- fn = fn || function(v) {return v};
- map(list, function(item,idx,list) { if (fn(item,idx,list)) result.push(item) } );
- return result;
-}
-
-/**
- * similar to python's reduce. paremeter order inverted...
- * @param list see doc for <b>each</b> to learn more about it
- * @param initial TODO
- * @param fn similar to <b>each</b> too, but in the case where it's a string,
- the name of the paremeters passed to it will be 'a' and 'b'
- same <b>__strfn</b> caveats apply
- *//*
-function reduce(list, initial, fn) {
- if (undef(fn)) {
- fn = initial;
- // explicit <b>window</b> object so browsers that do not have an <b>undefined</b>
- //keyword will evaluate to the (hopefully) undefined parameter
- //<b>undefined</b> of <b>window</b>
- initial = window.undefined;
- }
- if (typeof(fn)=='string') return reduce(list, initial, __strfn('a,b', fn));
- if (isdef(initial)) list.splice(0,0,initial);
- if (list.length===0) return false;
- if (list.length===1) return list[0];
- var result = list[0];
- var i = 1;
- while(i<list.length) result = fn(result,list[i++]);
- return result;
-}*/
-
diff --git a/framework/Web/Javascripts/extended/util.js b/framework/Web/Javascripts/extended/util.js
index 1e1fad69..7cc836f4 100644
--- a/framework/Web/Javascripts/extended/util.js
+++ b/framework/Web/Javascripts/extended/util.js
@@ -88,3 +88,98 @@ function isElement(o, strict) {
*/
function isList(o) { return o && isObject(o) && (isArray(o) || o.item) }
+
+if(!Prado) var Prado = {};
+
+Prado.Util = {}
+
+/**
+ * Pad a number with zeros from the left.
+ * @param integer number
+ * @param integer total string length
+ * @return string zero padded number
+ */
+Prado.Util.pad = function(number, X)
+{
+ X = (!X ? 2 : X);
+ number = ""+number;
+ while (number.length < X)
+ number = "0" + number;
+ return number;
+}
+
+/**
+ * Convert a string into integer, returns null if not integer.
+ * @param {string} the string to convert to integer
+ * @type {integer|null} null if string does not represent an integer.
+ */
+Prado.Util.toInteger = function(value)
+{
+ var exp = /^\s*[-\+]?\d+\s*$/;
+ if (value.match(exp) == null)
+ return null;
+ var num = parseInt(value, 10);
+ return (isNaN(num) ? null : num);
+}
+
+/**
+ * Convert a string into a double/float value. <b>Internationalization
+ * is not supported</b>
+ * @param {string} the string to convert to double/float
+ * @param {string} the decimal character
+ * @return {float|null} null if string does not represent a float value
+ */
+Prado.Util.toDouble = function(value, decimalchar)
+{
+ decimalchar = undef(decimalchar) ? "." : decimalchar;
+ var exp = new RegExp("^\\s*([-\\+])?(\\d+)?(\\" + decimalchar + "(\\d+))?\\s*$");
+ var m = value.match(exp);
+ if (m == null)
+ return null;
+ 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 currency value
+ * @param {string} the grouping character, default is ","
+ * @param {int} number of decimal digits
+ * @param {string} the decimal character, default is "."
+ * @type {float|null} the currency value as float.
+ */
+Prado.Util.toCurrency = function(value, groupchar, digits, decimalchar)
+{
+ groupchar = undef(groupchar) ? "," : groupchar;
+ decimalchar = undef(decimalchar) ? "." : decimalchar;
+ digits = undef(digits) ? 2 : digits;
+
+ var exp = new RegExp("^\\s*([-\\+])?(((\\d+)\\" + groupchar + ")*)(\\d+)"
+ + ((digits > 0) ? "(\\" + decimalchar + "(\\d{1," + digits + "}))?" : "")
+ + "\\s*$");
+ var m = value.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);
+}
+
+/**
+ * Trim the value, if the value is undefined, empty string is return.
+ * @param {string} string to be trimmed.
+ * @type {string} trimmed string.
+ */
+Prado.Util.trim = function(value)
+{
+ if(!isString(value)) return "";
+ return value.replace(/^\s+|\s+$/g, "");
+}
diff --git a/framework/Web/Javascripts/extra/tp_template.js b/framework/Web/Javascripts/extra/tp_template.js
deleted file mode 100644
index 6015034c..00000000
--- a/framework/Web/Javascripts/extra/tp_template.js
+++ /dev/null
@@ -1,315 +0,0 @@
-/**
- * TrimPath Template. Release 1.0.16.
- * Copyright (C) 2004, 2005 Metaha.
- *
- * TrimPath Template is licensed under the GNU General Public License
- * and the Apache License, Version 2.0, as follows:
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed WITHOUT ANY WARRANTY; without even the
- * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
- * See the GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
- *
- * 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.
- */
-var TrimPath;
-
-// TODO: Debugging mode vs stop-on-error mode - runtime flag.
-// TODO: Handle || (or) characters and backslashes.
-// TODO: Add more modifiers.
-
-(function() { // Using a closure to keep global namespace clean.
- var theEval = eval; // Security, to ensure eval cleanliness.
- if (TrimPath == null)
- TrimPath = new Object();
- if (TrimPath.evalEx == null)
- TrimPath.evalEx = function(src) { return theEval(src); };
-
- TrimPath.parseTemplate = function(tmplContent, optTmplName, optEtc) {
- if (optEtc == null)
- optEtc = TrimPath.parseTemplate_etc;
- var funcSrc = parse(tmplContent, optTmplName, optEtc);
- var func = TrimPath.evalEx(funcSrc, optTmplName, 1);
- if (func != null)
- return new optEtc.Template(optTmplName, tmplContent, funcSrc, func, optEtc);
- return null;
- }
-
- try {
- String.prototype.process = function(context, optFlags) {
- var template = TrimPath.parseTemplate(this, null);
- if (template != null)
- return template.process(context, optFlags);
- return this;
- }
- } catch (e) { // Swallow exception, such as when String.prototype is sealed.
- }
-
- TrimPath.parseTemplate_etc = {}; // Exposed for extensibility.
- TrimPath.parseTemplate_etc.statementTag = "forelse|for|if|elseif|else|var|macro";
- TrimPath.parseTemplate_etc.statementDef = { // Lookup table for statement tags.
- "if" : { delta: 1, prefix: "if (", suffix: ") {", paramMin: 1 },
- "else" : { delta: 0, prefix: "} else {" },
- "elseif" : { delta: 0, prefix: "} else { if (", suffix: ") {", paramDefault: "true" },
- "/if" : { delta: -1, prefix: "}" },
- "for" : { delta: 1, paramMin: 3,
- prefixFunc : function(stmtParts, state, tmplName, etc) {
- if (stmtParts[2] != "in")
- throw new etc.ParseError(tmplName, state.line, "bad for loop statement: " + stmtParts.join(' '));
- var iterVar = stmtParts[1];
- var listVar = "__LIST__" + iterVar;
- return [ "var ", listVar, " = ", stmtParts[3], ";",
- "if ((", listVar, ") != null && (", listVar, ").length > 0) { for (var ",
- iterVar, "_index in ", listVar, ") { var ",
- iterVar, " = ", listVar, "[", iterVar, "_index];" ].join("");
- } },
- "forelse" : { delta: 0, prefix: "} } else { if (", suffix: ") {", paramDefault: "true" },
- "/for" : { delta: -1, prefix: "} }" },
- "var" : { delta: 0, prefix: "var ", suffix: ";" },
- "macro" : { delta: 1, prefix: "function ", suffix: "{ var _OUT_arr = []; var _OUT = { write: function(m) { if (m) _OUT_arr.push(m); }, }; " },
- "/macro" : { delta: -1, prefix: " return _OUT_arr.join(''); }" }
- }
- TrimPath.parseTemplate_etc.modifierDef = {
- "eat" : function(v) { return ""; },
- "escape" : function(s) { return String(s).replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;"); },
- "capitalize" : function(s) { return String(s).toUpperCase(); },
- "default" : function(s, d) { return s != null ? s : d; }
- }
- TrimPath.parseTemplate_etc.modifierDef.h = TrimPath.parseTemplate_etc.modifierDef.escape;
-
- TrimPath.parseTemplate_etc.Template = function(tmplName, tmplContent, funcSrc, func, etc) {
- this.process = function(context, flags) {
- if (context == null)
- context = {};
- if (context._MODIFIERS == null)
- context._MODIFIERS = {};
- for (var k in etc.modifierDef) {
- if (context._MODIFIERS[k] == null)
- context._MODIFIERS[k] = etc.modifierDef[k];
- }
- if (flags == null)
- flags = {};
- var resultArr = [];
- var resultOut = { write: function(m) { if (m) resultArr.push(m); } };
- try {
- func(resultOut, context, flags);
- } catch (e) {
- if (flags.throwExceptions == true)
- throw e;
- var result = new String(resultArr.join("") + "[ERROR: " + e.toString() + "]");
- result["exception"] = e;
- return result;
- }
- return resultArr.join("");
- }
- this.name = tmplName;
- this.source = tmplContent;
- this.sourceFunc = funcSrc;
- this.toString = function() { return "TrimPath.Template [" + tmplName + "]"; }
- }
- TrimPath.parseTemplate_etc.ParseError = function(name, line, message) {
- this.name = name;
- this.line = line;
- this.message = message;
- }
- TrimPath.parseTemplate_etc.ParseError.prototype.toString = function() {
- return ("TrimPath template ParseError in " + this.name + ": line " + this.line + ", " + this.msg);
- }
-
- var parse = function(body, tmplName, etc) {
- body = cleanWhiteSpace(body);
- var funcText = [ "var TrimPath_Template_TEMP = function(_OUT, _CONTEXT, _FLAGS) { with (_CONTEXT) {" ];
- var state = { stack: [], line: 1 }; // TODO: Fix line number counting.
- var endStmtPrev = -1;
- while (endStmtPrev + 1 < body.length) {
- var begStmt = endStmtPrev;
- // Scan until we find some statement markup.
- begStmt = body.indexOf("{", begStmt + 1);
- while (begStmt >= 0) {
- if (body.charAt(begStmt - 1) != '$' && // Not an expression or backslashed,
- body.charAt(begStmt - 1) != '\\') { // so we assume it must be a statement tag.
- var offset = (body.charAt(begStmt + 1) == '/' ? 2 : 1); // Close tags offset of 2 skips '/'.
- // 10 is larger than maximum statement tag length.
- if (body.substring(begStmt + offset, begStmt + 10 + offset).search(TrimPath.parseTemplate_etc.statementTag) == 0)
- break; // Found a match.
- }
- begStmt = body.indexOf("{", begStmt + 1);
- }
- if (begStmt < 0) // In "a{for}c", begStmt will be 1.
- break;
- var endStmt = body.indexOf("}", begStmt + 1); // In "a{for}c", endStmt will be 5.
- if (endStmt < 0)
- break;
- emitSectionText(body.substring(endStmtPrev + 1, begStmt), funcText);
- emitStatement(body.substring(begStmt, endStmt +1), state, funcText, tmplName, etc);
- endStmtPrev = endStmt;
- }
- emitSectionText(body.substring(endStmtPrev + 1), funcText);
- if (state.stack.length != 0)
- throw new etc.ParseError(tmplName, state.line, "unclosed, unmatched statement(s): " + state.stack.join(","));
- funcText.push("}}; TrimPath_Template_TEMP");
- return funcText.join("");
- }
-
- var emitStatement = function(stmtStr, state, funcText, tmplName, etc) {
- var parts = stmtStr.slice(1, -1).split(' ');
- var stmt = etc.statementDef[parts[0]]; // Here, parts[0] == for/if/else/...
- if (stmt == null) { // Not a real statement.
- emitSectionText(stmtStr, funcText);
- return;
- }
- if (stmt.delta < 0) {
- if (state.stack.length <= 0)
- throw new etc.ParseError(tmplName, state.line, "close tag does not match any previous statement: " + stmtStr);
- state.stack.pop();
- }
- if (stmt.delta > 0)
- state.stack.push(stmtStr);
-
- if (stmt.paramMin != null &&
- stmt.paramMin >= parts.length)
- throw new etc.ParseError(tmplName, state.line, "statement needs more parameters: " + stmtStr);
- if (stmt.prefixFunc != null)
- funcText.push(stmt.prefixFunc(parts, state, tmplName, etc));
- else
- funcText.push(stmt.prefix);
- if (stmt.suffix != null) {
- if (parts.length <= 1) {
- if (stmt.paramDefault != null)
- funcText.push(stmt.paramDefault);
- } else {
- for (var i = 1; i < parts.length; i++) {
- if (i > 1)
- funcText.push(' ');
- funcText.push(parts[i]);
- }
- }
- funcText.push(stmt.suffix);
- }
- }
-
- var emitSectionText = function(text, funcText) {
- if (text.length <= 0)
- return;
- var nlPrefix = 0; // Index to first non-newline in prefix.
- var nlSuffix = text.length - 1; // Index to first non-space/tab in suffix.
- while (nlPrefix < text.length && (text.charAt(nlPrefix) == '\n'))
- nlPrefix++;
- while (nlSuffix >= 0 && (text.charAt(nlSuffix) == ' ' || text.charAt(nlSuffix) == '\t'))
- nlSuffix--;
- if (nlSuffix < nlPrefix)
- nlSuffix = nlPrefix;
- if (nlPrefix > 0) {
- funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
- funcText.push(text.substring(0, nlPrefix).replace('\n', '\\n'));
- funcText.push('");');
- }
- var lines = text.substring(nlPrefix, nlSuffix + 1).split('\n');
- for (var i = 0; i < lines.length; i++) {
- emitSectionTextLine(lines[i], funcText);
- if (i < lines.length - 1)
- funcText.push('_OUT.write("\\n");\n');
- }
- if (nlSuffix + 1 < text.length) {
- funcText.push('if (_FLAGS.keepWhitespace == true) _OUT.write("');
- funcText.push(text.substring(nlSuffix + 1).replace('\n', '\\n'));
- funcText.push('");');
- }
- }
-
- var emitSectionTextLine = function(line, funcText) {
- var endExprPrev = -1;
- while (endExprPrev + 1 < line.length) {
- var begExpr = line.indexOf("${", endExprPrev + 1); // In "a${b}c", begExpr == 1
- if (begExpr < 0)
- break;
- var endExpr = line.indexOf("}", begExpr + 2); // In "a${b}c", endExpr == 4; 2 == "${".length
- if (endExpr < 0)
- break;
- emitText(line.substring(endExprPrev + 1, begExpr), funcText);
- // Example: exprs == 'firstName|default:"John Doe"|capitalize'.split('|')
- var exprArr = line.substring(begExpr + 2, endExpr).replace(/\|\|/g, "#@@#").split('|');
- for (var k in exprArr)
- exprArr[k] = exprArr[k].replace(/#@@#/g, '||');
- funcText.push('_OUT.write(');
- emitExpression(exprArr, exprArr.length - 1, funcText);
- funcText.push(');');
- endExprPrev = endExpr;
- }
- emitText(line.substring(endExprPrev + 1), funcText);
- }
-
- var emitText = function(text, funcText) {
- if (text == null ||
- text.length <= 0)
- return;
- text = text.replace(/\\/g, '\\\\');
- text = text.replace(/"/g, '\\"');
- funcText.push('_OUT.write("');
- funcText.push(text);
- funcText.push('");');
- }
-
- var emitExpression = function(exprArr, index, funcText) {
- // Ex: foo|a:x|b:y1,y2|c:z1,z2 is emitted as c(b(a(foo,x),y1,y2),z1,z2)
- var expr = exprArr[index]; // Ex: exprArr == [firstName,capitalize,default:"John Doe"]
- if (index <= 0) { // Ex: expr == 'default:"John Doe"'
- funcText.push(expr);
- return;
- }
- var parts = expr.split(':');
- funcText.push('_MODIFIERS["');
- funcText.push(parts[0]); // The parts[0] is a modifier function name, like capitalize.
- funcText.push('"](');
- emitExpression(exprArr, index - 1, funcText);
- if (parts.length > 1) {
- funcText.push(',');
- funcText.push(parts[1]);
- }
- funcText.push(')');
- }
-
- var cleanWhiteSpace = function(result) {
- result = result.replace(/\t/g, " ");
- result = result.replace(/\r\n/g, "\n");
- result = result.replace(/\r/g, "\n");
- result = result.replace(/^(.*\S)[ \t]+$/gm, "$1"); // Right trim.
- return result;
- }
-
- // The DOM helper functions depend on DOM/DHTML, so they only work in a browser.
- // However, these are not considered core to the engine.
- //
- TrimPath.parseDOMTemplate = function(elementId, optDocument, optEtc) {
- if (optDocument == null)
- optDocument = document;
- var element = optDocument.getElementById(elementId);
- var content = element.value; // Like textarea.value.
- if (content == null)
- content = element.innerHTML; // Like textarea.innerHTML.
- content = content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
- return TrimPath.parseTemplate(content, elementId, optEtc);
- }
-
- TrimPath.processDOMTemplate = function(elementId, context, optFlags, optDocument, optEtc) {
- return TrimPath.parseDOMTemplate(elementId, optDocument, optEtc).process(context, optFlags);
- }
-}) ();
diff --git a/framework/Web/Javascripts/base/ajax.js b/framework/Web/Javascripts/prado/ajax.js
index 06c3d741..06c3d741 100644
--- a/framework/Web/Javascripts/base/ajax.js
+++ b/framework/Web/Javascripts/prado/ajax.js
diff --git a/framework/Web/Javascripts/base/focus.js b/framework/Web/Javascripts/prado/controls.js
index 6c1359cd..bc902178 100644
--- a/framework/Web/Javascripts/base/focus.js
+++ b/framework/Web/Javascripts/prado/controls.js
@@ -97,3 +97,71 @@ Prado.Focus.isVisible = function(element)
}
return true;
}
+
+
+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/base/datepicker.js b/framework/Web/Javascripts/prado/datepicker.js
index 68e63168..68e63168 100644
--- a/framework/Web/Javascripts/base/datepicker.js
+++ b/framework/Web/Javascripts/prado/datepicker.js
diff --git a/framework/Web/Javascripts/prado/prado.js b/framework/Web/Javascripts/prado/prado.js
new file mode 100644
index 00000000..52bf2b89
--- /dev/null
+++ b/framework/Web/Javascripts/prado/prado.js
@@ -0,0 +1,51 @@
+var Prado = { Version: '3.0a' };
+
+Prado.Button = Class.create();
+
+/**
+ * Usage: Event.observe("panelID", "keypress", Prado.fireButton.bindEvent($("panelID"), "targetButtonID"));
+ */
+Object.extend(Prado.Button,
+{
+ buttonFired : false,
+ fireButton : function(e, target)
+ {
+ var eventFired = !this.buttonFired && Event.keyCode(e) == Event.KEY_RETURN;
+ var isTextArea = Event.element(e).targName.toLowerCase() == "textarea";
+ if (eventFired && !isTextArea)
+ {
+ var defaultButton = $(target);
+ if (defaultButton)
+ {
+ Prado.Button.buttonFired = true;
+ Event.fireEvent(defaultButton,"click");
+ Event.stop(e);
+ return false;
+ }
+ }
+ return true;
+ }
+});
+
+Prado.TextBox = Class.create();
+
+/**
+ * Usage: Event.observe("textboxID", "keypress", Prado.fireButton.bindEvent($("textboxID")));
+ */
+Object.extend(Prado.TextBox,
+{
+ handleReturnKey = function(e)
+ {
+ if(Event.keyCode(e) == Event.KEY_RETURN)
+ {
+ var target = Event.element(e);
+ if(target)
+ {
+ Event.fireEvent(target, "change");
+ Event.stop(e);
+ return false;
+ }
+ }
+ return true;
+ }
+});
diff --git a/framework/Web/Javascripts/base/validation.js b/framework/Web/Javascripts/prado/validation.js
index 33d5411d..33d5411d 100644
--- a/framework/Web/Javascripts/base/validation.js
+++ b/framework/Web/Javascripts/prado/validation.js
diff --git a/framework/Web/Javascripts/base/validators.js b/framework/Web/Javascripts/prado/validators.js
index 427b46fc..427b46fc 100644
--- a/framework/Web/Javascripts/base/validators.js
+++ b/framework/Web/Javascripts/prado/validators.js