tapestry-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkuhn...@apache.org
Subject svn commit: r449122 [7/40] - in /tapestry/tapestry4/trunk/tapestry-framework/src: java/org/apache/tapestry/ java/org/apache/tapestry/dojo/ java/org/apache/tapestry/dojo/form/ java/org/apache/tapestry/dojo/html/ java/org/apache/tapestry/form/ java/org/a...
Date Fri, 22 Sep 2006 23:22:51 GMT
Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/FlatFile.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/FlatFile.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/FlatFile.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/FlatFile.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,153 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.data.old.provider.FlatFile");
+dojo.require("dojo.data.old.provider.Base");
+dojo.require("dojo.data.old.Item");
+dojo.require("dojo.data.old.Attribute");
+dojo.require("dojo.data.old.ResultSet");
+dojo.require("dojo.data.old.format.Json");
+dojo.require("dojo.data.old.format.Csv");
+dojo.require("dojo.lang.assert");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.old.provider.FlatFile = function(/* keywords */ keywordParameters) {
+	/**
+	 * summary:
+	 * A Json Data Provider knows how to read in simple JSON data
+	 * tables and make their contents accessable as Items.
+	 */
+	dojo.lang.assertType(keywordParameters, "pureobject", {optional: true});
+	dojo.data.old.provider.Base.call(this);
+	this._arrayOfItems = [];
+	this._resultSet = null;
+	this._dictionaryOfAttributes = {};
+
+	if (keywordParameters) {
+		var jsonObjects = keywordParameters["jsonObjects"];
+		var jsonString  = keywordParameters["jsonString"];
+		var fileUrl     = keywordParameters["url"];
+		if (jsonObjects) {
+			dojo.data.old.format.Json.loadDataProviderFromArrayOfJsonData(this, jsonObjects);
+		}
+		if (jsonString) {
+			dojo.data.old.format.Json.loadDataProviderFromFileContents(this, jsonString);
+		}
+		if (fileUrl) {
+			var arrayOfParts = fileUrl.split('.');
+			var lastPart = arrayOfParts[(arrayOfParts.length - 1)];
+			var formatParser = null;
+			if (lastPart == "json") {
+				formatParser = dojo.data.old.format.Json;
+			}
+			if (lastPart == "csv") {
+				formatParser = dojo.data.old.format.Csv;
+			}
+			if (formatParser) {
+				var fileContents = dojo.hostenv.getText(fileUrl);
+				formatParser.loadDataProviderFromFileContents(this, fileContents);
+			} else {
+				dojo.lang.assert(false, "new dojo.data.old.provider.FlatFile({url: }) was passed a file without a .csv or .json suffix");
+			}
+		}
+	}
+};
+dojo.inherits(dojo.data.old.provider.FlatFile, dojo.data.old.provider.Base);
+
+// -------------------------------------------------------------------
+// Public instance methods
+// -------------------------------------------------------------------
+dojo.data.old.provider.FlatFile.prototype.getProviderCapabilities = function(/* string */ keyword) {
+	dojo.lang.assertType(keyword, String, {optional: true});
+	if (!this._ourCapabilities) {
+		this._ourCapabilities = {
+			transactions: false,
+			undo: false,
+			login: false,
+			versioning: false,
+			anonymousRead: true,
+			anonymousWrite: false,
+			permissions: false,
+			queries: false,
+			strongTyping: false,
+			datatypes: [String, Date, Number]
+		};
+	}
+	if (keyword) {
+		return this._ourCapabilities[keyword];
+	} else {
+		return this._ourCapabilities;
+	}
+};
+
+dojo.data.old.provider.FlatFile.prototype.registerAttribute = function(/* string or dojo.data.old.Attribute */ attributeId) {
+	var registeredAttribute = this.getAttribute(attributeId);
+	if (!registeredAttribute) {
+		var newAttribute = new dojo.data.old.Attribute(this, attributeId);
+		this._dictionaryOfAttributes[attributeId] = newAttribute;
+		registeredAttribute = newAttribute;
+	}
+	return registeredAttribute; // dojo.data.old.Attribute
+};
+
+dojo.data.old.provider.FlatFile.prototype.getAttribute = function(/* string or dojo.data.old.Attribute */ attributeId) {
+	var attribute = (this._dictionaryOfAttributes[attributeId] || null);
+	return attribute; // dojo.data.old.Attribute or null
+};
+
+dojo.data.old.provider.FlatFile.prototype.getAttributes = function() {
+	var arrayOfAttributes = [];
+	for (var key in this._dictionaryOfAttributes) {
+		var attribute = this._dictionaryOfAttributes[key];
+		arrayOfAttributes.push(attribute);
+	}
+	return arrayOfAttributes; // Array
+};
+
+dojo.data.old.provider.FlatFile.prototype.fetchArray = function(query) {
+	/**
+	 * summary: Returns an Array containing all of the Items.
+	 */ 
+	return this._arrayOfItems; // Array
+};
+
+dojo.data.old.provider.FlatFile.prototype.fetchResultSet = function(query) {
+	/**
+	 * summary: Returns a ResultSet containing all of the Items.
+	 */ 
+	if (!this._resultSet) {
+		this._resultSet = new dojo.data.old.ResultSet(this, this.fetchArray(query));
+	}
+	return this._resultSet; // dojo.data.old.ResultSet
+};
+
+// -------------------------------------------------------------------
+// Private instance methods
+// -------------------------------------------------------------------
+dojo.data.old.provider.FlatFile.prototype._newItem = function() {
+	var item = new dojo.data.old.Item(this);
+	this._arrayOfItems.push(item);
+	return item; // dojo.data.old.Item
+};
+
+dojo.data.old.provider.FlatFile.prototype._newAttribute = function(/* String */ attributeId) {
+	dojo.lang.assertType(attributeId, String);
+	dojo.lang.assert(this.getAttribute(attributeId) === null);
+	var attribute = new dojo.data.old.Attribute(this, attributeId);
+	this._dictionaryOfAttributes[attributeId] = attribute;
+	return attribute; // dojo.data.old.Attribute
+};
+
+dojo.data.old.provider.Base.prototype._getResultSets = function() {
+	return [this._resultSet]; // Array
+};
+

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/FlatFile.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/JotSpot.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/JotSpot.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/JotSpot.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/JotSpot.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,27 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.data.old.provider.JotSpot");
+dojo.require("dojo.data.old.provider.Base");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.old.provider.JotSpot = function() {
+	/**
+	 * summary:
+	 * A JotSpot Data Provider knows how to read data from a JotSpot data 
+	 * store and make the contents accessable as dojo.data.old.Items.
+	 */
+	dojo.unimplemented('dojo.data.old.provider.JotSpot');
+};
+
+dojo.inherits(dojo.data.old.provider.JotSpot, dojo.data.old.provider.Base);
+

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/JotSpot.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/MySql.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/MySql.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/MySql.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/MySql.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,27 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.data.old.provider.MySql");
+dojo.require("dojo.data.old.provider.Base");
+
+// -------------------------------------------------------------------
+// Constructor
+// -------------------------------------------------------------------
+dojo.data.old.provider.MySql = function() {
+	/**
+	 * summary:
+	 * A MySql Data Provider knows how to connect to a MySQL database
+	 * on a server and and make the content records available as 
+	 * dojo.data.old.Items.
+	 */
+	dojo.unimplemented('dojo.data.old.provider.MySql');
+};
+
+dojo.inherits(dojo.data.old.provider.MySql, dojo.data.old.provider.Base);

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/provider/MySql.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/to_do.txt
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/to_do.txt?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/to_do.txt (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/to_do.txt Fri Sep 22 16:22:30 2006
@@ -0,0 +1,45 @@
+Existing Features
+ * can import data from .json or .csv format files
+ * can import data from del.icio.us
+ * can create and modify data programmatically
+ * can bind data to dojo.widget.Chart
+ * can bind data to dojo.widget.SortableTable
+ * can bind one data set to multiple widgets
+ * notifications: widgets are notified when data changes
+ * notification available per-item or per-resultSet
+ * can create ad-hoc attributes
+ * attributes can be loosely-typed 
+ * attributes can have meta-data like type and display name
+ * half-implemented support for sorting
+ * half-implemented support for export to .json
+ * API for getting data in simple arrays 
+ * API for getting ResultSets with iterators (precursor to support for something like the openrico.org live grid)
+ 
+~~~~~~~~~~~~~~~~~~~~~~~~
+To-Do List
+ * be able to import data from an html <table></table>
+ * think about being able to import data from some type of XML 
+ * think about integration with dojo.undo.Manager
+ * think more about how to represent the notion of different data types
+ * think about what problems we'll run into when we have a MySQL data provider
+ * in TableBindingHack, improve support for data types in the SortableTable binding
+ * deal with ids (including MySQL multi-field keys)
+ * add support for item-references:  employeeItem.set('department', departmentItem);
+ * deal with Attributes as instances of Items, not just subclasses of Items
+ * unit tests for compare/sort code
+ * unit tests for everything
+ * implement item.toString('json') and item.toString('xml')
+ * implement dataProvider.newItem({name: 'foo', age: 26})
+ * deal better with transactions
+ * add support for deleting items
+ * don't send out multiple notifications to the same observer
+ * deal with item versions
+ * prototype a Yahoo data provider -- http://developer.yahoo.net/common/json.html
+ * prototype a data provider that enforces strong typing
+ * prototype a data provider that prevents ad-hoc attributes
+ * prototype a data provider that enforces single-kind item
+ * prototype a data provider that allows for login/authentication
+ * have loosely typed result sets play nicely with widgets that expect strong typing
+ * prototype an example of spreadsheet-style formulas or derivation rules
+ * experiment with some sort of fetch() that returns only a subset of a data provider's items
+

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/data/old/to_do.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/common.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/common.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/common.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/common.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,493 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.date.common");
+
+
+/* Supplementary Date Functions
+ *******************************/
+
+dojo.date.setDayOfYear = function(/*Date*/dateObject, /*Number*/dayOfYear) {
+	dateObject.setMonth(0);
+	dateObject.setDate(dayOfYear);
+	return dateObject; // Date
+}
+
+dojo.date.getDayOfYear = function(/*Date*/dateObject) {
+	var fullYear = dateObject.getFullYear();
+	var lastDayOfPrevYear = new Date(fullYear-1, 11, 31);
+	return Math.floor((dateObject.getTime() -
+		lastDayOfPrevYear.getTime()) / 86400000); // Number
+}
+
+
+dojo.date.setWeekOfYear = function (dateObject, week, firstDay) {
+	if (arguments.length == 1) { firstDay = 0; } // Sunday
+	dojo.unimplemented("dojo.date.setWeekOfYear");
+}
+
+dojo.date.getWeekOfYear = function (dateObject, firstDay) {
+	if (arguments.length == 1) { firstDay = 0; } // Sunday
+
+	// work out the first day of the year corresponding to the week
+	var firstDayOfYear = new Date(dateObject.getFullYear(), 0, 1);
+	var day = firstDayOfYear.getDay();
+	firstDayOfYear.setDate(firstDayOfYear.getDate() -
+			day + firstDay - (day > firstDay ? 7 : 0));
+
+	return Math.floor((dateObject.getTime() -
+		firstDayOfYear.getTime()) / 604800000);
+}
+
+
+
+
+dojo.date.setIsoWeekOfYear = function (dateObject, week, firstDay) {
+	if (arguments.length == 1) { firstDay = 1; } // Monday
+	dojo.unimplemented("dojo.date.setIsoWeekOfYear");
+}
+
+dojo.date.getIsoWeekOfYear = function (dateObject, firstDay) {
+	if (arguments.length == 1) { firstDay = 1; } // Monday
+	dojo.unimplemented("dojo.date.getIsoWeekOfYear");
+}
+
+
+/* Informational Functions
+ **************************/
+
+//DEPRECATED: These timezone arrays will be deprecated in 0.5
+dojo.date.shortTimezones = ["IDLW", "BET", "HST", "MART", "AKST", "PST", "MST",
+	"CST", "EST", "AST", "NFT", "BST", "FST", "AT", "GMT", "CET", "EET", "MSK",
+	"IRT", "GST", "AFT", "AGTT", "IST", "NPT", "ALMT", "MMT", "JT", "AWST",
+	"JST", "ACST", "AEST", "LHST", "VUT", "NFT", "NZT", "CHAST", "PHOT",
+	"LINT"];
+dojo.date.timezoneOffsets = [-720, -660, -600, -570, -540, -480, -420, -360,
+	-300, -240, -210, -180, -120, -60, 0, 60, 120, 180, 210, 240, 270, 300,
+	330, 345, 360, 390, 420, 480, 540, 570, 600, 630, 660, 690, 720, 765, 780,
+	840];
+/*
+dojo.date.timezones = ["International Date Line West", "Bering Standard Time",
+	"Hawaiian Standard Time", "Marquesas Time", "Alaska Standard Time",
+	"Pacific Standard Time (USA)", "Mountain Standard Time",
+	"Central Standard Time (USA)", "Eastern Standard Time (USA)",
+	"Atlantic Standard Time", "Newfoundland Time", "Brazil Standard Time",
+	"Fernando de Noronha Standard Time (Brazil)", "Azores Time",
+	"Greenwich Mean Time", "Central Europe Time", "Eastern Europe Time",
+	"Moscow Time", "Iran Standard Time", "Gulf Standard Time",
+	"Afghanistan Time", "Aqtobe Time", "Indian Standard Time", "Nepal Time",
+	"Almaty Time", "Myanmar Time", "Java Time",
+	"Australian Western Standard Time", "Japan Standard Time",
+	"Australian Central Standard Time", "Lord Hove Standard Time (Australia)",
+	"Vanuata Time", "Norfolk Time (Australia)", "New Zealand Standard Time",
+	"Chatham Standard Time (New Zealand)", "Phoenix Islands Time (Kribati)",
+	"Line Islands Time (Kribati)"];
+*/
+
+dojo.date.getDaysInMonth = function(/*Date*/dateObject){
+	var month = dateObject.getMonth();
+	var days = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
+	if (month == 1 && dojo.date.isLeapYear(dateObject)) { return 29; }
+	else { return days[month]; }
+}
+
+dojo.date.isLeapYear = function(/*Date*/dateObject){
+// summary:
+//	Determines if the year of the dateObject is a leap year
+//
+// description:
+//	Leap years are years with an additional day YYYY-02-29, where the year
+//	number is a multiple of four with the following exception: If a year
+//	is a multiple of 100, then it is only a leap year if it is also a
+//	multiple of 400. For example, 1900 was not a leap year, but 2000 is one.
+
+	var year = dateObject.getFullYear();
+	return (year%400 == 0) ? true : (year%100 == 0) ? false : (year%4 == 0) ? true : false;
+}
+
+// FIXME: This is not localized
+dojo.date.getTimezoneName = function(/*Date*/dateObject){
+// summary:
+//	Get the user's time zone as provided by the browser
+//
+// dateObject: needed because the timezone may vary with time (daylight savings)
+//
+// description:
+//	Try to get time zone info from toString or toLocaleString
+//	method of the Date object -- UTC offset is not a time zone.
+//	See http://www.twinsun.com/tz/tz-link.htm
+//	Note: results may be inconsistent across browsers.
+
+	var str = dateObject.toString(); // Start looking in toString
+	var tz = ''; // The result -- return empty string if nothing found
+	var match;
+
+	// First look for something in parentheses -- fast lookup, no regex
+	var pos = str.indexOf('(');
+	if (pos > -1) {
+		pos++;
+		tz = str.substring(pos, str.indexOf(')'));
+	}
+	// If at first you don't succeed ...
+	else{
+		// If IE knows about the TZ, it appears before the year
+		// Capital letters or slash before a 4-digit year 
+		// at the end of string
+		var pat = /([A-Z\/]+) \d{4}$/;
+		if((match = str.match(pat))) {
+			tz = match[1];
+		}
+		// Some browsers (e.g. Safari) glue the TZ on the end
+		// of toLocaleString instead of putting it in toString
+		else{
+			str = dateObject.toLocaleString();
+			// Capital letters or slash -- end of string, 
+			// after space
+			pat = / ([A-Z\/]+)$/;
+			if((match = str.match(pat))) {
+				tz = match[1];
+			}
+		}
+	}
+
+	// Make sure it doesn't somehow end up return AM or PM
+	return tz == 'AM' || tz == 'PM' ? '' : tz; //String
+}
+
+
+//FIXME: not localized
+dojo.date.getOrdinal = function (dateObject) {
+	var date = dateObject.getDate();
+
+	if (date%100 != 11 && date%10 == 1) { return "st"; }
+	else if (date%100 != 12 && date%10 == 2) { return "nd"; }
+	else if (date%100 != 13 && date%10 == 3) { return "rd"; }
+	else { return "th"; }
+}
+
+
+/* compare and add
+ ******************/
+dojo.date.compareTypes={
+	// 	summary
+	//	bitmask for comparison operations.
+	DATE:1, TIME:2 
+};
+dojo.date.compare=function(/* Date */ dateA, /* Date */ dateB, /* dojo.date.compareTypes */ options){
+	//	summary
+	//	Compare two date objects by date, time, or both.  Returns 0 if equal, positive if a > b, else negative.
+	var dA=dateA;
+	var dB=dateB||new Date();
+	var now=new Date();
+	//FIXME: shorten this code
+	with(dojo.date.compareTypes){
+		var opt=options||(DATE|TIME);
+		var d1=new Date(
+			(opt&DATE)?dA.getFullYear():now.getFullYear(), 
+			(opt&DATE)?dA.getMonth():now.getMonth(),
+			(opt&DATE)?dA.getDate():now.getDate(),
+			(opt&TIME)?dA.getHours():0,
+			(opt&TIME)?dA.getMinutes():0,
+			(opt&TIME)?dA.getSeconds():0
+		);
+		var d2=new Date(
+			(opt&DATE)?dB.getFullYear():now.getFullYear(),
+			(opt&DATE)?dB.getMonth():now.getMonth(),
+			(opt&DATE)?dB.getDate():now.getDate(),
+			(opt&TIME)?dB.getHours():0,
+			(opt&TIME)?dB.getMinutes():0,
+			(opt&TIME)?dB.getSeconds():0
+		);
+	}
+	if(d1.valueOf()>d2.valueOf()){
+		return 1;	//	int
+	}
+	if(d1.valueOf()<d2.valueOf()){
+		return -1;	//	int
+	}
+	return 0;	//	int
+}
+
+dojo.date.dateParts={ 
+	//	summary
+	//	constants for use in dojo.date.add
+	YEAR:0, MONTH:1, DAY:2, HOUR:3, MINUTE:4, SECOND:5, MILLISECOND:6, QUARTER:7, WEEK:8, WEEKDAY:9
+};
+
+dojo.date.add = function(/* Date */ dt, /* dojo.date.dateParts */ interv, /* int */ incr){
+//	summary:
+//		Add to a Date in intervals of different size, from milliseconds to years
+//
+//	dt:
+//		A Javascript Date object to start with
+//
+//	interv:
+//		A constant representing the interval, e.g. YEAR, MONTH, DAY.  See dojo.date.dateParts.
+//
+//	incr:
+//		How much to add to the date
+
+	if(typeof dt == 'number'){dt = new Date(dt);} // Allow timestamps
+//FIXME: what's the reason behind this?	incr = incr || 1;
+
+	function fixOvershoot(){
+		if (sum.getDate() < dt.getDate()){
+			sum.setDate(0);
+		}
+	}
+	
+	var sum = new Date(dt);
+
+	with(dojo.date.dateParts){
+		switch(interv){
+			case YEAR:
+				sum.setFullYear(dt.getFullYear()+incr);
+				// Keep increment/decrement from 2/29 out of March
+				fixOvershoot();
+				break;
+			case QUARTER:
+				// Naive quarter is just three months
+				incr*=3;
+				// fallthrough...
+			case MONTH:
+				sum.setMonth(dt.getMonth()+incr);
+				// Reset to last day of month if you overshoot
+				fixOvershoot();
+				break;
+			case WEEK:
+				incr*=7;
+				// fallthrough...
+			case DAY:
+				sum.setDate(dt.getDate() + incr);
+				break;
+			case WEEKDAY:
+				//FIXME: assumes Saturday/Sunday weekend, but even this is not fixed.  There are CLDR entries to localize this.
+				var dat = dt.getDate();
+				var weeks = 0;
+				var days = 0;
+				var strt = 0;
+				var trgt = 0;
+				var adj = 0;
+				// Divide the increment time span into weekspans plus leftover days
+				// e.g., 8 days is one 5-day weekspan / and two leftover days
+				// Can't have zero leftover days, so numbers divisible by 5 get
+				// a days value of 5, and the remaining days make up the number of weeks
+				var mod = incr % 5;
+				if (mod == 0) {
+					days = (incr > 0) ? 5 : -5;
+					weeks = (incr > 0) ? ((incr-5)/5) : ((incr+5)/5);
+				}
+				else {
+					days = mod;
+					weeks = parseInt(incr/5);
+				}
+				// Get weekday value for orig date param
+				strt = dt.getDay();
+				// Orig date is Sat / positive incrementer
+				// Jump over Sun
+				if (strt == 6 && incr > 0) {
+					adj = 1;
+				}
+				// Orig date is Sun / negative incrementer
+				// Jump back over Sat
+				else if (strt == 0 && incr < 0) {
+					adj = -1;
+				}
+				// Get weekday val for the new date
+				trgt = (strt + days);
+				// New date is on Sat or Sun
+				if (trgt == 0 || trgt == 6) {
+					adj = (incr > 0) ? 2 : -2;
+				}
+				// Increment by number of weeks plus leftover days plus
+				// weekend adjustments
+				sum.setDate(dat + (7*weeks) + days + adj);
+				break;
+			case HOUR:
+				sum.setHours(sum.getHours()+incr);
+				break;
+			case MINUTE:
+				sum.setMinutes(sum.getMinutes()+incr);
+				break;
+			case SECOND:
+				sum.setSeconds(sum.getSeconds()+incr);
+				break;
+			case MILLISECOND:
+				sum.setMilliseconds(sum.getMilliseconds()+incr);
+				break;
+			default:
+				// Do nothing
+				break;
+		}
+	}
+
+	return sum; // Date
+};
+
+dojo.date.diff = function(/* Date */ dtA, /* Date */ dtB, /* dojo.date.dateParts */ interv){
+//	summary:
+//		Get the difference in a specific unit of time (e.g., number of months, weeks,
+//		days, etc.) between two dates.
+//
+//	dtA:
+//		A Javascript Date object
+//
+//	dtB:
+//		A Javascript Date object
+//
+//	interv:
+//		A constant representing the interval, e.g. YEAR, MONTH, DAY.  See dojo.date.dateParts.
+
+	// Accept timestamp input
+	if(typeof dtA == 'number'){dtA = new Date(dtA);}
+	if(typeof dtB == 'number'){dtB = new Date(dtB);}
+	var yeaDiff = dtB.getFullYear() - dtA.getFullYear();
+	var monDiff = (dtB.getMonth() - dtA.getMonth()) + (yeaDiff * 12);
+	var msDiff = dtB.getTime() - dtA.getTime(); // Millisecs
+	var secDiff = msDiff/1000;
+	var minDiff = secDiff/60;
+	var houDiff = minDiff/60;
+	var dayDiff = houDiff/24;
+	var weeDiff = dayDiff/7;
+	var delta = 0; // Integer return value
+
+	with(dojo.date.dateParts){
+		switch(interv){
+			case YEAR:
+				delta = yeaDiff;
+				break;
+			case QUARTER:
+				var mA = dtA.getMonth();
+				var mB = dtB.getMonth();
+				// Figure out which quarter the months are in
+				var qA = Math.floor(mA/3) + 1;
+				var qB = Math.floor(mB/3) + 1;
+				// Add quarters for any year difference between the dates
+				qB += (yeaDiff * 4);
+				delta = qB - qA;
+				break;
+			case MONTH:
+				delta = monDiff;
+				break;
+			case WEEK:
+				// Truncate instead of rounding
+				// Don't use Math.floor -- value may be negative
+				delta = parseInt(weeDiff);
+				break;
+			case DAY:
+				delta = dayDiff;
+				break;
+			case WEEKDAY:
+				var days = Math.round(dayDiff);
+				var weeks = parseInt(days/7);
+				var mod = days % 7;
+
+				// Even number of weeks
+				if (mod == 0) {
+					days = weeks*5;
+				}
+				// Weeks plus spare change (< 7 days)
+				else {
+					var adj = 0;
+					var aDay = dtA.getDay();
+					var bDay = dtB.getDay();
+	
+					weeks = parseInt(days/7);
+					mod = days % 7;
+					// Mark the date advanced by the number of
+					// round weeks (may be zero)
+					var dtMark = new Date(dtA);
+					dtMark.setDate(dtMark.getDate()+(weeks*7));
+					var dayMark = dtMark.getDay();
+					// Spare change days -- 6 or less
+					// ----------
+					// Positive diff
+					if (dayDiff > 0) {
+						switch (true) {
+							// Range starts on Sat
+							case aDay == 6:
+								adj = -1;
+								break;
+							// Range starts on Sun
+							case aDay == 0:
+								adj = 0;
+								break;
+							// Range ends on Sat
+							case bDay == 6:
+								adj = -1;
+								break;
+							// Range ends on Sun
+							case bDay == 0:
+								adj = -2;
+								break;
+							// Range contains weekend
+							case (dayMark + mod) > 5:
+								adj = -2;
+								break;
+							default:
+								// Do nothing
+								break;
+						}
+					}
+					// Negative diff
+					else if (dayDiff < 0) {
+						switch (true) {
+							// Range starts on Sat
+							case aDay == 6:
+								adj = 0;
+								break;
+							// Range starts on Sun
+							case aDay == 0:
+								adj = 1;
+								break;
+							// Range ends on Sat
+							case bDay == 6:
+								adj = 2;
+								break;
+							// Range ends on Sun
+							case bDay == 0:
+								adj = 1;
+								break;
+							// Range contains weekend
+							case (dayMark + mod) < 0:
+								adj = 2;
+								break;
+							default:
+								// Do nothing
+								break;
+						}
+					}
+					days += adj;
+					days -= (weeks*2);
+				}
+				delta = days;
+
+				break;
+			case HOUR:
+				delta = houDiff;
+				break;
+			case MINUTE:
+				delta = minDiff;
+				break;
+			case SECOND:
+				delta = secDiff;
+				break;
+			case MILLISECOND:
+				delta = msDiff;
+				break;
+			default:
+				// Do nothing
+				break;
+		}
+	}
+
+	// Round for fractional values and DST leaps
+	return Math.round(delta); // Number (integer)
+};

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/common.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/format.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/format.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/format.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/format.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,745 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.date.format");
+
+dojo.require("dojo.date.common");
+dojo.require("dojo.date.supplemental");
+dojo.require("dojo.lang.array");
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.func");
+dojo.require("dojo.string.common");
+dojo.require("dojo.i18n.common");
+
+// Load the bundles containing localization information for
+// names and formats
+dojo.requireLocalization("dojo.i18n.calendar", "gregorian");
+dojo.requireLocalization("dojo.i18n.calendar", "gregorianExtras");
+
+//NOTE: Everything in this module assumes Gregorian calendars.
+// Other calendars will be implemented in separate modules.
+
+(function(){
+dojo.date.format = function(/*Date*/dateObject, /*Object?*/options){
+//
+// summary:
+//		Format a Date object as a String, using locale-specific settings.
+//
+// description:
+//		Create a string from a Date object using a known localized pattern.
+//		By default, this method formats both date and time from dateObject.
+//		Formatting patterns are chosen appropriate to the locale.  Different
+//		formatting lengths may be chosen, with "full" used by default.
+//		Custom patterns may be used or registered with translations using
+//		the addCustomBundle method.
+//		Formatting patterns are implemented using the syntax described at
+//		http://www.unicode.org/reports/tr35/tr35-4.html#Date_Format_Patterns
+//
+// dateObject:
+//		the date and/or time to be formatted.  If a time only is formatted,
+//		the values in the year, month, and day fields are irrelevant.  The
+//		opposite is true when formatting only dates.
+//
+// options: object {selector: string, formatLength: string, datePattern: string, timePattern: string, locale: string}
+//		selector- choice of timeOnly,dateOnly (default: date and time)
+//		formatLength- choice of long, short, medium or full (plus any custom additions).  Defaults to 'full'
+//		datePattern,timePattern- override pattern with this string
+//		locale- override the locale used to determine formatting rules
+//
+
+	if(typeof options == "string"){
+		dojo.deprecated("dojo.date.format", "To format dates with POSIX-style strings, please use dojo.date.strftime instead", "0.5");
+		return dojo.date.strftime(dateObject, options);
+	}
+
+	// Format a pattern without literals
+	function formatPattern(dateObject, pattern) {
+		return pattern.replace(/[a-zA-Z]+/g, function(match){
+			var s;
+			var c = match.charAt(0);
+			var l = match.length;
+			var pad;
+			var widthList = ["abbr", "wide", "narrow"];
+			switch(c){
+				case 'G':
+					if(l>3){dojo.unimplemented("Era format not implemented");}
+					s = info.eras[dateObject.getFullYear() < 0 ? 1 : 0];
+					break;
+				case 'y':
+					s = dateObject.getFullYear();
+					switch(l){
+						case 1:
+							break;
+						case 2:
+							s = String(s).substr(-2);
+							break;
+						default:
+							pad = true;
+					}
+					break;
+				case 'Q':
+				case 'q':
+					s = Math.ceil((dateObject.getMonth()+1)/3);
+					switch(l){
+						case 1: case 2:
+							pad = true;
+							break;
+						case 3:
+						case 4:
+							dojo.unimplemented("Quarter format not implemented");
+					}
+					break;
+				case 'M':
+				case 'L':
+					var m = dateObject.getMonth();
+					var width;
+					switch(l){
+						case 1: case 2:
+							s = m+1; pad = true;
+							break;
+						case 3: case 4: case 5:
+							width = widthList[l-3];
+							break;
+					}
+					if(width){
+						var type = (c == "L") ? "standalone" : "format";
+						var prop = ["months",type,width].join("-");
+						s = info[prop][m];
+					}
+					break;
+				case 'w':
+					var firstDay = 0;
+					s = dojo.date.getWeekOfYear(dateObject, firstDay); pad = true;
+					break;
+				case 'd':
+					s = dateObject.getDate(); pad = true;
+					break;
+				case 'D':
+					s = dojo.date.getDayOfYear(dateObject); pad = true;
+					break;
+				case 'E':
+				case 'e':
+				case 'c': // REVIEW: don't see this in the spec?
+					var d = dateObject.getDay();
+					var width;
+					switch(l){
+						case 1: case 2:
+							if(c == 'e'){
+								var first = dojo.date.getFirstDayOfWeek(options.locale);
+								d = (d-first+7)%7;
+							}
+							if(c != 'c'){
+								s = d+1; pad = true;
+								break;
+							}
+							// else fallthrough...
+						case 3: case 4: case 5:
+							width = widthList[l-3];
+							break;
+					}
+					if(width){
+						var type = (c == "c") ? "standalone" : "format";
+						var prop = ["days",type,width].join("-");
+						s = info[prop][d];
+					}
+					break;
+				case 'a':
+					var timePeriod = (dateObject.getHours() < 12) ? 'am' : 'pm';
+					s = info[timePeriod];
+					break;
+				case 'h':
+				case 'H':
+				case 'K':
+				case 'k':
+					var h = dateObject.getHours();
+					// strange choices in the date format make it impossible to write this succinctly
+					switch (c) {
+						case 'h': // 1-12
+							s = (h % 12) || 12;
+							break;
+						case 'H': // 0-23
+							s = h;
+							break;
+						case 'K': // 0-11
+							s = (h % 12);
+							break;
+						case 'k': // 1-24
+							s = h || 24;
+							break;
+					}
+					pad = true;
+					break;
+				case 'm':
+					s = dateObject.getMinutes(); pad = true;
+					break;
+				case 's':
+					s = dateObject.getSeconds(); pad = true;
+					break;
+				case 'S':
+					s = Math.round(dateObject.getMilliseconds() * Math.pow(10, l-3));
+					break;
+				case 'v': // FIXME: don't know what this is. seems to be same as z?
+				case 'z':
+					// We only have one timezone to offer; the one from the browser
+					s = dojo.date.getTimezoneName(dateObject);
+					if(s){break;}
+					l=4;
+					// fallthrough... use GMT if tz not available
+				case 'Z':
+					var offset = dateObject.getTimezoneOffset();
+					var tz = [
+						(offset<=0 ? "+" : "-"),
+						dojo.string.pad(Math.floor(Math.abs(offset)/60), 2),
+						dojo.string.pad(Math.abs(offset)% 60, 2)
+					];
+					if(l==4){
+						tz.splice(0, 0, "GMT");
+						tz.splice(3, 0, ":");
+					}
+					s = tz.join("");
+					break;
+				case 'Y':
+				case 'u':
+				case 'W':
+				case 'F':
+				case 'g':
+				case 'A':
+					dojo.debug(match+" modifier not yet implemented");
+					s = "?";
+					break;
+				default:
+					dojo.raise("dojo.date.parse: invalid format: "+pattern);
+			}
+			if(pad){ s = dojo.string.pad(s, l); }
+			return s;
+		});
+	}
+
+	options = options || {};
+
+	var locale = dojo.hostenv.normalizeLocale(options.locale);
+	var formatLength = options.formatLength || 'full';
+	var info = dojo.date._getGregorianBundle(locale);
+	var str = [];
+	var sauce = dojo.lang.curry(this, formatPattern, dateObject);
+	if (options.selector != "timeOnly") {
+		var datePattern = options.datePattern || info["dateFormat-"+formatLength];
+		if(datePattern){str.push(_processPattern(datePattern, sauce));}
+	}
+	if (options.selector != "dateOnly") {
+		var timePattern = options.timePattern || info["timeFormat-"+formatLength];
+		if(timePattern){str.push(_processPattern(timePattern, sauce));}
+	}
+	var result = str.join(" "); //TODO: use locale-specific pattern to assemble date + time
+	return result; /*String*/
+};
+
+dojo.date.parse = function(/*String*/value, /*Object?*/options){
+//
+// summary:
+//		Convert a properly formatted string to a primitive Date object,
+//		using locale-specific settings.
+//
+// description:
+//		Create a Date object from a string using a known localized pattern.
+//		By default, this method parses looking for both date and time in the string.
+//		Formatting patterns are chosen appropriate to the locale.  Different
+//		formatting lengths may be chosen, with "full" used by default.
+//		Custom patterns may be used or registered with translations using
+//		the addCustomBundle method.
+//		Formatting patterns are implemented using the syntax described at
+//		http://www.unicode.org/reports/tr35/#Date_Format_Patterns
+//
+// value:
+//		A string representation of a date
+//
+// options: object {selector: string, formatLength: string, datePattern: string, timePattern: string, locale: string, strict: boolean}
+//		selector- choice of timeOnly,dateOnly (default: date and time)
+//		formatLength- choice of long, short, medium or full (plus any custom additions).  Defaults to 'full'
+//		datePattern,timePattern- override pattern with this string
+//		locale- override the locale used to determine formatting rules
+//		strict- strict parsing, off by default
+//
+
+	//TODO: this is still quite rough - it only implements a small portion of the parsing algorithm needed,
+	// and doesn't provide much flexibility in matching.
+	var locale = dojo.hostenv.normalizeLocale(options.locale);
+	var info = dojo.date._getGregorianBundle(locale);
+	var formatLength = options.formatLength || 'full';
+	if (options.selector != 'dateOnly'){ dojo.unimplemented("can only parse dates at this time"); }
+	var pattern = options.datePattern || info["dateFormat-"+formatLength];
+	var groups = [];
+
+	var dateREString = _processPattern(pattern, dojo.lang.curry(this, _buildDateTimeRE, groups));
+	//TODO: escape special regexp chars
+	//TODO: make whitespace flexible?
+	var dateRE = new RegExp("^" + dateREString + "$");
+
+	var match = dateRE.exec(value);
+	if(!match){return null;} // null
+
+	var result = new Date(2004,0);
+	for(var i=1; i<match.length; i++){
+		var grp=groups[i-1];
+		var l=grp.length;
+		var v=match[i];
+		switch(grp.charAt(0)){
+			case 'd':
+				result.setDate(v);
+				break;
+			case 'M':
+				result.setMonth(v-1);
+				break;
+			case 'y':
+				var century = 0;
+				if(l == 2){
+					if(v<100){
+						century = Math.floor(result.getFullYear()/100)*100;
+					} else if(options.strict){
+						return null; // null
+					}
+				}
+				result.setFullYear(century+Number(v));
+				break;
+			default:
+				dojo.unimplemented("incomplete parse algorithm");
+		}
+	}
+	return result; // Date
+};
+
+function _processPattern(pattern, applyPattern, applyLiteral, applyAll){
+	// Process a pattern with literals in it
+	// Break up on single quotes, treat every other one as a literal, except '' which becomes '
+	var identity = function(x){return x;};
+	applyPattern = applyPattern || identity;
+	applyLiteral = applyLiteral || identity;
+	applyAll = applyAll || identity;
+
+	var chunks = pattern.split('\'');
+	var literal = false;
+	for(var i=0; i<chunks.length; i++){
+		if(!chunks[i]){chunks[i]='\'';} //FIXME
+		else{
+			chunks[i]=(literal ? applyLiteral : applyPattern)(chunks[i]);
+			literal = !literal;
+		}
+	}
+
+	return applyAll(chunks.join(""));
+}
+
+function _buildDateTimeRE(groups, pattern) {
+	return pattern.replace(/[a-zA-Z]+/g, function(match){
+		var s;
+		var c = match.charAt(0);
+		var l = match.length;
+		switch(c){
+			case 'y':
+				s = "\\d" + ((l==2)?"{2,4}":"+");
+				break;
+			case 'M':
+				s = "\\d{1,2}"; //TODO make sure it conforms to month range...
+				break;
+			case 'd':
+				s = "\\d{1,2}"; //TODO
+				break;
+			case 'h': case 'H': case 'K': case 'k':
+				s = "\\d{2}"; //TODO
+				break;
+			case 'm':
+			case 's':
+				s = "\\d{2}"; //TODO
+				break;
+			case 'S':
+				s = "\\d+"; //TODO
+				break;
+			case 'a':
+				s = info.am + "|" + info.pm;
+				break;
+			default:
+				dojo.unimplemented("parse of date format, pattern="+pattern);
+		}
+		if(groups){ groups.push(match); }
+		return "("+s+")";
+	});
+};
+})();
+
+//TODO: try to common strftime and format code somehow?
+
+dojo.date.strftime = function (/*Date*/dateObject, /*String*/format, /*String?*/locale) {
+//
+// summary:
+//		Formats the date object using the specifications of the POSIX strftime function
+//
+// description:
+//		see <http://www.opengroup.org/onlinepubs/007908799/xsh/strftime.html>
+
+	// zero pad
+	var padChar = null;
+	function _(s, n) {
+		return dojo.string.pad(s, n || 2, padChar || "0");
+	}
+
+	var info = dojo.date._getGregorianBundle(locale);
+
+	function $ (property) {
+		switch (property) {
+			case "a": // abbreviated weekday name according to the current locale
+				return dojo.date.getDayShortName(dateObject, locale);
+
+			case "A": // full weekday name according to the current locale
+				return dojo.date.getDayName(dateObject, locale);
+
+			case "b":
+			case "h": // abbreviated month name according to the current locale
+				return dojo.date.getMonthShortName(dateObject, locale);
+				
+			case "B": // full month name according to the current locale
+				return dojo.date.getMonthName(dateObject, locale);
+				
+			case "c": // preferred date and time representation for the current
+				      // locale
+				return dojo.date.format(dateObject, {locale: locale});
+
+			case "C": // century number (the year divided by 100 and truncated
+				      // to an integer, range 00 to 99)
+				return _(Math.floor(dateObject.getFullYear()/100));
+				
+			case "d": // day of the month as a decimal number (range 01 to 31)
+				return _(dateObject.getDate());
+				
+			case "D": // same as %m/%d/%y
+				return $("m") + "/" + $("d") + "/" + $("y");
+					
+			case "e": // day of the month as a decimal number, a single digit is
+				      // preceded by a space (range ' 1' to '31')
+				if (padChar == null) { padChar = " "; }
+				return _(dateObject.getDate());
+			
+			case "f": // month as a decimal number, a single digit is
+							// preceded by a space (range ' 1' to '12')
+				if (padChar == null) { padChar = " "; }
+				return _(dateObject.getMonth()+1);				
+			
+			case "g": // like %G, but without the century.
+				break;
+			
+			case "G": // The 4-digit year corresponding to the ISO week number
+				      // (see %V).  This has the same format and value as %Y,
+				      // except that if the ISO week number belongs to the
+				      // previous or next year, that year is used instead.
+				dojo.unimplemented("unimplemented modifier 'G'");
+				break;
+			
+			case "F": // same as %Y-%m-%d
+				return $("Y") + "-" + $("m") + "-" + $("d");
+				
+			case "H": // hour as a decimal number using a 24-hour clock (range
+				      // 00 to 23)
+				return _(dateObject.getHours());
+				
+			case "I": // hour as a decimal number using a 12-hour clock (range
+				      // 01 to 12)
+				return _(dateObject.getHours() % 12 || 12);
+				
+			case "j": // day of the year as a decimal number (range 001 to 366)
+				return _(dojo.date.getDayOfYear(dateObject), 3);
+				
+			case "k": // Hour as a decimal number using a 24-hour clock (range
+					  // 0 to 23 (space-padded))
+				if (padChar == null) { padChar = " " };
+				return _(dateObject.getHours());
+
+			case "l": // Hour as a decimal number using a 12-hour clock (range
+					  // 1 to 12 (space-padded))
+				if (padChar == null) { padChar = " " };
+				return _(dateObject.getHours() % 12 || 12);
+			
+			case "m": // month as a decimal number (range 01 to 12)
+				return _(dateObject.getMonth() + 1);
+				
+			case "M": // minute as a decimal number
+				return _(dateObject.getMinutes());
+			
+			case "n":
+				return "\n";
+
+			case "p": // either `am' or `pm' according to the given time value,
+				      // or the corresponding strings for the current locale
+				return info[dateObject.getHours() < 12 ? "am" : "pm"];
+				
+			case "r": // time in a.m. and p.m. notation
+				return $("I") + ":" + $("M") + ":" + $("S") + " " + $("p");
+				
+			case "R": // time in 24 hour notation
+				return $("H") + ":" + $("M");
+				
+			case "S": // second as a decimal number
+				return _(dateObject.getSeconds());
+
+			case "t":
+				return "\t";
+
+			case "T": // current time, equal to %H:%M:%S
+				return $("H") + ":" + $("M") + ":" + $("S");
+				
+			case "u": // weekday as a decimal number [1,7], with 1 representing
+				      // Monday
+				return String(dateObject.getDay() || 7);
+				
+			case "U": // week number of the current year as a decimal number,
+				      // starting with the first Sunday as the first day of the
+				      // first week
+				return _(dojo.date.getWeekOfYear(dateObject));
+
+			case "V": // week number of the year (Monday as the first day of the
+				      // week) as a decimal number [01,53]. If the week containing
+				      // 1 January has four or more days in the new year, then it 
+				      // is considered week 1. Otherwise, it is the last week of 
+				      // the previous year, and the next week is week 1.
+				return _(dojo.date.getIsoWeekOfYear(dateObject));
+				
+			case "W": // week number of the current year as a decimal number,
+				      // starting with the first Monday as the first day of the
+				      // first week
+				return _(dojo.date.getWeekOfYear(dateObject, 1));
+				
+			case "w": // day of the week as a decimal, Sunday being 0
+				return String(dateObject.getDay());
+
+			case "x": // preferred date representation for the current locale
+				      // without the time
+				return dojo.date.format(dateObject, {selector:'dateOnly', locale:locale});
+
+			case "X": // preferred time representation for the current locale
+				      // without the date
+				return dojo.date.format(dateObject, {selector:'timeOnly', locale:locale});
+
+			case "y": // year as a decimal number without a century (range 00 to
+				      // 99)
+				return _(dateObject.getFullYear()%100);
+				
+			case "Y": // year as a decimal number including the century
+				return String(dateObject.getFullYear());
+			
+			case "z": // time zone or name or abbreviation
+				var timezoneOffset = dateObject.getTimezoneOffset();
+				return (timezoneOffset > 0 ? "-" : "+") + 
+					_(Math.floor(Math.abs(timezoneOffset)/60)) + ":" +
+					_(Math.abs(timezoneOffset)%60);
+
+			case "Z": // time zone or name or abbreviation
+				return dojo.date.getTimezoneName(dateObject);
+			
+			case "%":
+				return "%";
+		}
+	}
+
+	// parse the formatting string and construct the resulting string
+	var string = "";
+	var i = 0;
+	var index = 0;
+	var switchCase = null;
+	while ((index = format.indexOf("%", i)) != -1) {
+		string += format.substring(i, index++);
+		
+		// inspect modifier flag
+		switch (format.charAt(index++)) {
+			case "_": // Pad a numeric result string with spaces.
+				padChar = " "; break;
+			case "-": // Do not pad a numeric result string.
+				padChar = ""; break;
+			case "0": // Pad a numeric result string with zeros.
+				padChar = "0"; break;
+			case "^": // Convert characters in result string to uppercase.
+				switchCase = "upper"; break;
+			case "*": // Convert characters in result string to lowercase
+				switchCase = "lower"; break;
+			case "#": // Swap the case of the result string.
+				switchCase = "swap"; break;
+			default: // no modifier flag so decrement the index
+				padChar = null; index--; break;
+		}
+
+		// toggle case if a flag is set
+		var property = $(format.charAt(index++));
+		switch (switchCase) {
+			case "upper":
+			property = property.toUpperCase();
+				break;
+			case "lower":
+			property = property.toLowerCase();
+				break;
+			case "swap": // Upper to lower, and versey-vicea
+				var compareString = property.toLowerCase();
+				var swapString = '';
+				var j = 0;
+				var ch = '';
+				while (j < property.length) {
+					ch = property.charAt(j);
+					swapString += (ch == compareString.charAt(j)) ?
+						ch.toUpperCase() : ch.toLowerCase();
+					j++;
+				}
+				property = swapString;
+				break;
+			default:
+				break;
+		}
+		switchCase = null;
+		
+		string += property;
+		i = index;
+	}
+	string += format.substring(i);
+	
+	return string;
+};
+
+(function(){
+var _customFormats = [];
+dojo.date.addCustomFormats = function(packageName, bundleName){
+//
+// summary:
+//		Add a reference to a bundle containing localized custom formats to be
+//		used by date/time formatting and parsing routines.
+//
+// description:
+//		The user may add custom localized formats where the bundle has properties following the
+//		same naming convention used by dojo for the CLDR data: dateFormat-xxxx / timeFormat-xxxx
+//		The pattern string should match the format used by the CLDR.
+//		See dojo.date.format for details.
+//		The resources must be loaded by dojo.requireLocalization() prior to use
+
+	_customFormats.push({pkg:packageName,name:bundleName});
+};
+
+dojo.date._getGregorianBundle = function(locale){
+	var gregorian = {};
+	dojo.lang.forEach(_customFormats, function(desc){
+		var bundle = dojo.i18n.getLocalization(desc.pkg, desc.name, locale);
+		gregorian = dojo.lang.mixin(gregorian, bundle);
+	}, this);
+	return gregorian;
+};
+})();
+
+dojo.date.addCustomFormats("dojo.i18n.calendar","gregorian");
+dojo.date.addCustomFormats("dojo.i18n.calendar","gregorianExtras");
+
+//FIXME: return by value, not reference
+dojo.date.getNames = function(/*String*/item, /*String*/type, /*String?*/use, /*String?*/locale){
+//
+// summary:
+//		Used to get localized strings for day or month names.
+//
+// item: 'months' || 'days'
+// type: 'wide' || 'narrow' || 'abbr' (e.g. "Monday", "Mon", or "M" respectively, in English)
+// use: 'standAlone' || 'format' (default)
+// locale: override locale used to find the names
+
+	var label;
+	var lookup = dojo.date._getGregorianBundle(locale);
+	var props = [item, use, type];
+	if (use == 'standAlone') {
+		label = lookup[props.join('-')];
+	}
+	props[1] = 'format';
+	return label || lookup[props.join('-')]; /*Array*/
+};
+
+// Convenience methods
+
+dojo.date.getDayName = function(/*Date*/dateObject, /*String?*/locale){
+	return dojo.date.getNames('days', 'wide', 'format', locale)[dateObject.getDay()]; /*String*/
+};
+
+dojo.date.getDayShortName = function(/*Date*/dateObject, /*String?*/locale){
+	return dojo.date.getNames('days', 'abbr', 'format', locale)[dateObject.getDay()]; /*String*/
+};
+
+dojo.date.getMonthName = function(/*Date*/dateObject, /*String?*/locale){
+	return dojo.date.getNames('months', 'wide', 'format', locale)[dateObject.getMonth()]; /*String*/
+};
+
+dojo.date.getMonthShortName = function(/*Date*/dateObject, /*String?*/locale){
+	return dojo.date.getNames('months', 'abbr', 'format', locale)[dateObject.getMonth()]; /*String*/
+};
+
+/**
+ *
+ * Returns a string of the date relative to the current date.
+ *
+ * @param date The date object
+ *
+ * Example returns:
+ * - "1 minute ago"
+ * - "4 minutes ago"
+ * - "Yesterday"
+ * - "2 days ago"
+ */
+//FIXME: not localized
+dojo.date.toRelativeString = function(date) {
+	var now = new Date();
+	var diff = (now - date) / 1000;
+	var end = " ago";
+	var future = false;
+	if(diff < 0) {
+		future = true;
+		end = " from now";
+		diff = -diff;
+	}
+
+	if(diff < 60) {
+		diff = Math.round(diff);
+		return diff + " second" + (diff == 1 ? "" : "s") + end;
+	}
+	if(diff < 60*60) {
+		diff = Math.round(diff/60);
+		return diff + " minute" + (diff == 1 ? "" : "s") + end;
+	}
+	if(diff < 60*60*24) {
+		diff = Math.round(diff/3600);
+		return diff + " hour" + (diff == 1 ? "" : "s") + end;
+	}
+	if(diff < 60*60*24*7) {
+		diff = Math.round(diff/(3600*24));
+		if(diff == 1) {
+			return future ? "Tomorrow" : "Yesterday";
+		} else {
+			return diff + " days" + end;
+		}
+	}
+	return dojo.date.toShortDateString(date);
+}
+
+//FIXME: SQL methods can probably be moved to a different module without i18n deps
+
+/**
+ * Convert a Date to a SQL string, optionally ignoring the HH:MM:SS portion of the Date
+ */
+dojo.date.toSql = function(date, noTime) {
+	return dojo.date.strftime(date, "%F" + !noTime ? " %T" : "");
+}
+
+/**
+ * Convert a SQL date string to a JavaScript Date object
+ */
+dojo.date.fromSql = function(sqlDate) {
+	var parts = sqlDate.split(/[\- :]/g);
+	while(parts.length < 6) {
+		parts.push(0);
+	}
+	return new Date(parts[0], (parseInt(parts[1],10)-1), parts[2], parts[3], parts[4], parts[5]);
+}
+

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/format.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/serialize.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/serialize.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/serialize.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/serialize.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,172 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.date.serialize");
+
+dojo.require("dojo.string.common");
+
+/* ISO 8601 Functions
+ *********************/
+
+dojo.date.setIso8601 = function (dateObject, formattedString){
+	var comps = (formattedString.indexOf("T") == -1) ? formattedString.split(" ") : formattedString.split("T");
+	dateObject = dojo.date.setIso8601Date(dateObject, comps[0]);
+	if (comps.length == 2) { dateObject = dojo.date.setIso8601Time(dateObject, comps[1]); }
+	return dateObject; /* Date or null */
+};
+
+dojo.date.fromIso8601 = function (formattedString) {
+	return dojo.date.setIso8601(new Date(0, 0), formattedString);
+};
+
+
+dojo.date.setIso8601Date = function (dateObject, formattedString) {
+	var regexp = "^([0-9]{4})((-?([0-9]{2})(-?([0-9]{2}))?)|" +
+			"(-?([0-9]{3}))|(-?W([0-9]{2})(-?([1-7]))?))?$";
+	var d = formattedString.match(new RegExp(regexp));
+	if(!d) {
+		dojo.debug("invalid date string: " + formattedString);
+		return null;
+	}
+	var year = d[1];
+	var month = d[4];
+	var date = d[6];
+	var dayofyear = d[8];
+	var week = d[10];
+	var dayofweek = (d[12]) ? d[12] : 1;
+
+	dateObject.setFullYear(year);
+	
+	if (dayofyear) { 
+		dateObject.setMonth(0);
+		dateObject.setDate(Number(dayofyear));
+	}
+	else if (week) {
+		dateObject.setMonth(0);
+		dateObject.setDate(1);
+		var gd = dateObject.getDay();
+		var day =  (gd) ? gd : 7;
+		var offset = Number(dayofweek) + (7 * Number(week));
+		
+		if (day <= 4) { dateObject.setDate(offset + 1 - day); }
+		else { dateObject.setDate(offset + 8 - day); }
+	} else {
+		if (month) { 
+			dateObject.setDate(1);
+			dateObject.setMonth(month - 1); 
+		}
+		if (date) { dateObject.setDate(date); }
+	}
+	
+	return dateObject;
+};
+
+dojo.date.fromIso8601Date = function (formattedString) {
+	return dojo.date.setIso8601Date(new Date(0, 0), formattedString);
+};
+
+
+
+
+dojo.date.setIso8601Time = function (dateObject, formattedString) {
+	// first strip timezone info from the end
+	var timezone = "Z|(([-+])([0-9]{2})(:?([0-9]{2}))?)$";
+	var d = formattedString.match(new RegExp(timezone));
+
+	var offset = 0; // local time if no tz info
+	if (d) {
+		if (d[0] != 'Z') {
+			offset = (Number(d[3]) * 60) + Number(d[5]);
+			offset *= ((d[2] == '-') ? 1 : -1);
+		}
+		offset -= dateObject.getTimezoneOffset();
+		formattedString = formattedString.substr(0, formattedString.length - d[0].length);
+	}
+
+	// then work out the time
+	var regexp = "^([0-9]{2})(:?([0-9]{2})(:?([0-9]{2})(\.([0-9]+))?)?)?$";
+	d = formattedString.match(new RegExp(regexp));
+	if(!d) {
+		dojo.debug("invalid time string: " + formattedString);
+		return null;
+	}
+	var hours = d[1];
+	var mins = Number((d[3]) ? d[3] : 0);
+	var secs = (d[5]) ? d[5] : 0;
+	var ms = d[7] ? (Number("0." + d[7]) * 1000) : 0;
+
+	dateObject.setHours(hours);
+	dateObject.setMinutes(mins);
+	dateObject.setSeconds(secs);
+	dateObject.setMilliseconds(ms);
+
+	if (offset !== 0) {
+		dateObject.setTime(dateObject.getTime() + offset * 60000);
+	}	
+	return dateObject;
+};
+
+dojo.date.fromIso8601Time = function (formattedString) {
+	return dojo.date.setIso8601Time(new Date(0, 0), formattedString);
+};
+
+
+/* RFC-3339 Date Functions
+ *************************/
+
+dojo.date.toRfc3339 = function(/*Date?*/dateObject, /*String?*/selector) {
+//	summary:
+//		Format a JavaScript Date object as a string according to RFC 3339
+//
+//	dateObject:
+//		A JavaScript date, or the current date and time, by default
+//
+//	selector:
+//		"dateOnly" or "timeOnly" to format selected portions of the Date object.
+//		Date and time will be formatted by default.
+
+//FIXME: tolerate Number, string input?
+	if(!dateObject) {
+		dateObject = new Date();
+	}
+
+	var _ = dojo.string.pad;
+	var formattedDate = [];
+	if (selector != "timeOnly"){
+		var date = [_(dateObject.getFullYear(),4), _(dateObject.getMonth()+1,2), _(dateObject.getDate(),2)].join('-');
+		formattedDate.push(date);
+	}
+	if (selector != "dateOnly"){
+		var time = [_(dateObject.getHours(),2), _(dateObject.getMinutes(),2), _(dateObject.getSeconds(),2)].join(':');
+		var timezoneOffset = dateObject.getTimezoneOffset();
+		time += (timezoneOffset > 0 ? "-" : "+") + 
+					_(Math.floor(Math.abs(timezoneOffset)/60),2) + ":" +
+					_(Math.abs(timezoneOffset)%60,2);
+		formattedDate.push(time);
+	}
+	return formattedDate.join('T'); // String
+};
+
+dojo.date.fromRfc3339 = function(/*String*/rfcDate) {
+//	summary:
+//		Create a JavaScript Date object from a string formatted according to RFC 3339
+//
+//	rfcDate:
+//		A string such as 2005-06-30T08:05:00-07:00
+//		"any" is also supported in place of a time.
+
+	// backwards compatible support for use of "any" instead of just not 
+	// including the time
+	if(rfcDate.indexOf("Tany")!=-1) {
+		rfcDate = rfcDate.replace("Tany","");
+	}
+	var dateObject = new Date();
+	return dojo.date.setIso8601(dateObject, rfcDate); // Date or null
+};

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/serialize.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/supplemental.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/supplemental.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/supplemental.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/supplemental.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,73 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.date.supplemental");
+
+dojo.date.getFirstDayOfWeek = function(/*String?*/locale){
+// summary:
+//		Returns a zero-based index for first day of the week, as used by the local (Gregorian) calendar.
+//		e.g. Sunday (returns 0), or Monday (returns 1)
+
+	// from http://www.unicode.org/cldr/data/common/supplemental/supplementalData.xml:supplementalData/weekData/firstDay
+	var firstDay = {/*default is 1=Monday*/
+		mv:5,
+		ae:6,af:6,bh:6,dj:6,dz:6,eg:6,er:6,et:6,iq:6,ir:6,jo:6,ke:6,kw:6,lb:6,ly:6,ma:6,om:6,qa:6,sa:6,
+		sd:6,so:6,tn:6,ye:6,
+		as:0,au:0,az:0,bw:0,ca:0,cn:0,fo:0,ge:0,gl:0,gu:0,hk:0,ie:0,il:0,is:0,jm:0,jp:0,kg:0,kr:0,la:0,
+		mh:0,mo:0,mp:0,mt:0,nz:0,ph:0,pk:0,sg:0,th:0,tt:0,tw:0,um:0,us:0,uz:0,vi:0,za:0,zw:0,
+		et:0,mw:0,ng:0,tj:0,
+		gb:0,
+		sy:4
+	};
+
+	locale = dojo.hostenv.normalizeLocale(locale);
+	var country = locale.split("-")[1];
+	var dow = firstDay[country];
+	return (typeof dow == 'undefined') ? 1 : dow; /*Number*/
+};
+
+dojo.date.getWeekend = function(/*String?*/locale){
+// summary:
+//		Returns a hash containing the start and end of the weekend in the locale, or by default in the user's locale.
+//		e.g. {start:6, end:0}
+
+	// from http://www.unicode.org/cldr/data/common/supplemental/supplementalData.xml:supplementalData/weekData/weekend{Start,End}
+	var weekendStart = {/*default is 6=Saturday*/
+		eg:5,il:5,sy:5,
+		'in':0,
+		ae:4,bh:4,dz:4,iq:4,jo:4,kw:4,lb:4,ly:4,ma:4,om:4,qa:4,sa:4,sd:4,tn:4,ye:4		
+	};
+
+	var weekendEnd = {/*default is 0=Sunday*/
+		ae:5,bh:5,dz:5,iq:5,jo:5,kw:5,lb:5,ly:5,ma:5,om:5,qa:5,sa:5,sd:5,tn:5,ye:5,af:5,ir:5,
+		eg:6,il:6,sy:6
+	};
+
+	locale = dojo.hostenv.normalizeLocale(locale);
+	var country = locale.split("-")[1];
+	var start = weekendStart[country];
+	var end = weekendEnd[country];
+	if(typeof start == 'undefined'){start=6;}
+	if(typeof end == 'undefined'){end=0;}
+	return {start:start, end:end}; /*Object {start,end}*/
+};
+
+dojo.date.isWeekend = function(/*Date?*/dateObj, /*String?*/locale){
+// summary:
+//	Determines if the date falls on a weekend, according to local custom.
+
+	var weekend = dojo.date.getWeekend(locale);
+	var day = (dateObj || new Date()).getDay();
+	if(weekend.end<weekend.start){
+		weekend.end+=7;
+		if(day<weekend.start){ day+=7; }
+	}
+	return day >= weekend.start && day <= weekend.end; // Boolean
+};

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/date/supplemental.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,84 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+/**
+ * Produce a line of debug output. 
+ * Does nothing unless djConfig.isDebug is true.
+ * varargs, joined with ''.
+ * Caller should not supply a trailing "\n".
+ */
+dojo.debug = function(){
+	if (!djConfig.isDebug) { return; }
+	var args = arguments;
+	if(dj_undef("println", dojo.hostenv)){
+		dojo.raise("dojo.debug not available (yet?)");
+	}
+	var isJUM = dj_global["jum"] && !dj_global["jum"].isBrowser;
+	var s = [(isJUM ? "": "DEBUG: ")];
+	for(var i=0;i<args.length;++i){
+		if(!false && args[i] && args[i] instanceof Error){
+			var msg = "[" + args[i].name + ": " + dojo.errorToString(args[i]) +
+				(args[i].fileName ? ", file: " + args[i].fileName : "") +
+				(args[i].lineNumber ? ", line: " + args[i].lineNumber : "") + "]";
+		} else {
+			try {
+				var msg = String(args[i]);
+			} catch(e) {
+				if(dojo.render.html.ie) {
+					var msg = "[ActiveXObject]";
+				} else {
+					var msg = "[unknown]";
+				}
+			}
+		}
+		s.push(msg);
+	}
+	
+	dojo.hostenv.println(s.join(" "));
+}
+
+/**
+ * this is really hacky for now - just 
+ * display the properties of the object
+**/
+
+dojo.debugShallow = function(obj){
+	if (!djConfig.isDebug) { return; }
+	dojo.debug('------------------------------------------------------------');
+	dojo.debug('Object: '+obj);
+	var props = [];
+	for(var prop in obj){
+		try {
+			props.push(prop + ': ' + obj[prop]);
+		} catch(E) {
+			props.push(prop + ': ERROR - ' + E.message);
+		}
+	}
+	props.sort();
+	for(var i = 0; i < props.length; i++) {
+		dojo.debug(props[i]);
+	}
+	dojo.debug('------------------------------------------------------------');
+}
+
+dojo.debugDeep = function(obj){
+	if (!djConfig.isDebug) { return; }
+	if (!dojo.uri || !dojo.uri.dojoUri){ return dojo.debug("You'll need to load dojo.uri.* for deep debugging - sorry!"); }
+	if (!window.open){ return dojo.debug('Deep debugging is only supported in host environments with window.open'); }
+	var idx = dojo.debugDeep.debugVars.length;
+	dojo.debugDeep.debugVars.push(obj);
+	// dojo.undo.browser back and forward breaks relpaths
+	var url = new dojo.uri.Uri(location, dojo.uri.dojoUri("src/debug/deep.html?var="+idx)).toString();
+	var win = window.open(url, '_blank', 'width=600, height=400, resizable=yes, scrollbars=yes, status=yes');
+	try{
+		win.debugVar = obj;
+	}catch(e){}
+}
+dojo.debugDeep.debugVars = [];

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Firebug.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Firebug.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Firebug.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Firebug.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,19 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.debug.Firebug");
+
+if (dojo.render.html.moz) {
+	if (console && console.log) {
+		dojo.hostenv.println=console.log;
+	} else {
+		dojo.debug("dojo.debug.Firebug requires Firebug > 0.4");
+	}
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Firebug.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Opera.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Opera.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Opera.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Opera.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,19 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.provide("dojo.debug.Opera");
+
+if (dojo.render.html.opera) {
+	if (opera && opera.postError) {
+		dojo.hostenv.println=opera.postError;
+	} else {
+		dojo.debug("dojo.debug.Opera requires Opera > 8.0");
+	}
+}

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/Opera.js
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_hide.gif
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_hide.gif?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_hide.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_show.gif
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_show.gif?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/arrow_show.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/deep.html
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/deep.html?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/deep.html (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/deep.html Fri Sep 22 16:22:30 2006
@@ -0,0 +1,362 @@
+<html>
+<head>
+<title>Deep Debugger</title>
+<script>
+
+var tableRows = {};
+var tableCels = {};
+var tableObjs = {};
+var tablesBuilt = {};
+var tableShows = {};
+var tableHides = {};
+
+// IE: nodes w/id need to be redeclared or getElementById is b0rked
+var frame = null;
+
+window.onload = function(){
+	// if IE loads this page too quickly (instantly) then 
+	// window.debugVar might not have been set
+	window.setTimeout(startMeUp, 100);
+}
+
+function startMeUp(){
+	frame = document.getElementById('frame');
+	// GET string 
+	var index = location.search.split("=").pop();
+	var debugObj = window.opener.dojo.debugDeep;
+	var debugVar = debugObj.debugVars[index] || window.debugVar;
+	buildTable('root', frame, debugVar);
+}
+
+function buildTable(path, parent, obj){
+	var keys = [];
+	var vals = [];
+	for(var prop in obj){
+		keys.push(prop);
+		try {
+			vals[prop] = obj[prop];
+		} catch(E) {
+			vals[prop] = 'ERROR: ' + E.message;
+		}
+	}
+	keys.sort(keySorter);
+
+	if (!keys.length){
+
+		var div = document.createElement('div');
+		div.appendChild(document.createTextNode('Object has no properties.'));
+
+		parent.appendChild(div);
+		return;
+	}
+
+
+	var t = document.createElement('table');
+	t.border = "1";
+
+	var tb = document.createElement('tbody');
+	t.appendChild(tb);
+
+
+	for(var i = 0; i < keys.length; i++) {
+		buildTableRow(path+'-'+keys[i], tb, keys[i], vals[keys[i]]);
+	}
+
+	if (path == 'root'){
+		//t.style.width = '90%';
+	}
+	t.style.width = '100%';
+
+	parent.appendChild(t);
+
+	tablesBuilt[path] = true;
+}
+
+function buildTableRow(path, tb, name, value) {
+
+	var simpleType = typeof(value);
+	var createSubrow = (simpleType == 'object');
+	var complexType = simpleType;
+
+	if (simpleType == 'object'){
+		var cls = getConstructorClass(value);
+		if (cls){
+			if (cls == 'Object'){
+			}else if (cls == 'Array'){
+				complexType = 'array';
+			}else{
+				complexType += ' ('+cls+')';
+			}
+		}
+	}
+
+/*var tr1 = document.createElement('tr');
+	var td1 = document.createElement('td');
+	var td2 = document.createElement('td');
+	var td3 = document.createElement('td');
+	var td4 = document.createElement('td');*/
+
+	var row = tb.rows.length;
+	var tr1 = tb.insertRow(row++);
+	var td1 = tr1.insertCell(0);
+	var td2 = tr1.insertCell(1);
+	var td3 = tr1.insertCell(2);
+	var td4 = tr1.insertCell(3);
+	
+	tr1.style.verticalAlign = 'top';
+	td1.style.verticalAlign = 'middle';
+
+	td1.className = 'propPlus';
+	td2.className = 'propName';
+	td3.className = 'propType';
+	td4.className = 'propVal';
+
+	//tr1.appendChild(td1);
+	//tr1.appendChild(td2);
+	//tr1.appendChild(td3);
+	//tr1.appendChild(td4);
+
+	if (createSubrow){
+		var img1 = document.createElement('img');
+		img1.width = 9;
+		img1.height = 9;
+		img1.src = 'arrow_show.gif';
+		var a1 = document.createElement('a');
+		a1.appendChild(img1);
+		a1.href = '#';
+		a1.onclick = function(){ showTableRow(path); return false; };
+
+		var img2 = document.createElement('img');
+		img2.width = 9;
+		img2.height = 9;
+		img2.src = 'arrow_hide.gif';
+		var a2 = document.createElement('a');
+		a2.appendChild(img2);
+		a2.href = '#';
+		a2.onclick = function(){ hideTableRow(path); return false; };
+		a2.style.display = 'none';
+
+		tableShows[path] = a1;
+		tableHides[path] = a2;
+
+		td1.appendChild(a1);
+		td1.appendChild(a2);
+	}else{
+		var img = document.createElement('img');
+		img.width = 9;
+		img.height = 9;
+		img.src = 'spacer.gif';
+
+		td1.appendChild(img);
+	}
+
+	td2.appendChild(document.createTextNode(name));
+	td3.appendChild(document.createTextNode(complexType));
+	td4.appendChild(buildPreBlock(value));
+
+	//tb.appendChild(tr1);
+
+	if (createSubrow){
+		var tr2 = tb.insertRow(row++);
+		var td5 = tr2.insertCell(0);
+		var td6 = tr2.insertCell(1);
+		
+		//var tr2 = document.createElement('tr');
+		//var td5 = document.createElement('td');
+		//var td6 = document.createElement('td');
+
+		td5.innerHTML = '&nbsp;';
+		//td6.innerHTML = '&nbsp;';
+
+		td6.colSpan = '3';
+
+		tr2.appendChild(td5);
+		tr2.appendChild(td6);
+
+		tr2.style.display = 'none';
+
+		tb.appendChild(tr2);
+
+		tableRows[path] = tr2;
+		tableCels[path] = td6;
+		tableObjs[path] = value;
+	}
+}
+
+function showTableRow(path){
+
+	var tr = tableRows[path];
+	var td = tableCels[path];
+	var a1 = tableShows[path];
+	var a2 = tableHides[path];
+
+	if (!tablesBuilt[path]){
+
+		//alert('building table for '+path);
+		buildTable(path, td, tableObjs[path]);
+	}
+
+	tr.style.display = 'table-row';
+
+	a1.style.display = 'none';
+	a2.style.display = 'inline';
+}
+
+function hideTableRow(path){
+
+	var tr = tableRows[path];
+	var a1 = tableShows[path];
+	var a2 = tableHides[path];
+
+	tr.style.display = 'none';
+
+	a1.style.display = 'inline';
+	a2.style.display = 'none';
+}
+
+function buildPreBlock(value){
+
+	//
+	// how many lines ?
+	//
+
+	var s = ''+value;
+	s = s.replace("\r\n", "\n");
+	s = s.replace("\r", "");
+	var lines = s.split("\n");
+
+
+	if (lines.length < 2){
+
+		if (lines[0].length < 60){
+
+			var pre = document.createElement('pre');
+			pre.appendChild(document.createTextNode(s));
+			return pre;
+		}
+	}
+
+
+	//
+	// multiple lines :(
+	//
+
+	var preview = lines[0].substr(0, 60) + ' ...';
+
+	var pre1 = document.createElement('pre');
+	pre1.appendChild(document.createTextNode(preview));
+	pre1.className = 'clicky';
+
+	var pre2 = document.createElement('pre');
+	pre2.appendChild(document.createTextNode(s));
+	pre2.style.display = 'none';
+	pre2.className = 'clicky';
+
+	pre1.onclick = function(){
+		pre1.style.display = 'none';
+		pre2.style.display = 'block';
+	}
+
+	pre2.onclick = function(){
+		pre1.style.display = 'block';
+		pre2.style.display = 'none';
+	}
+
+	var pre = document.createElement('div');
+
+	pre.appendChild(pre1);
+	pre.appendChild(pre2);
+
+	return pre;
+}
+
+function getConstructorClass(obj){
+
+	if (!obj.constructor || !obj.constructor.toString) return;
+
+	var m = obj.constructor.toString().match(/function\s*(\w+)/);
+
+	if (m && m.length == 2) return m[1];
+
+	return null;
+}
+
+function keySorter(a, b){
+
+	if (a == parseInt(a) && b == parseInt(b)){
+
+		return (parseInt(a) > parseInt(b)) ? 1 : ((parseInt(a) < parseInt(b)) ? -1 : 0);
+	}
+
+	// sort by lowercase string
+
+	var a2 = String(a).toLowerCase();
+	var b2 = String(b).toLowerCase();
+
+	return (a2 > b2) ? 1 : ((a2 < b2) ? -1 : 0);
+}
+
+</script>
+<style>
+
+body {
+	font-family: arial, helvetica, sans-serif;
+}
+
+table {
+	border-width: 0px;
+	border-spacing: 1px;
+	border-collapse: separate;
+}
+
+td {
+	border-width: 0px;
+	padding: 2px;
+}
+
+img {
+	border: 0;
+}
+
+pre {
+	margin: 0;
+	padding: 0;
+	white-space: -moz-pre-wrap;  /* Mozilla, supported since 1999 */
+	white-space: -pre-wrap;      /* Opera 4 - 6 */
+	white-space: -o-pre-wrap;    /* Opera 7 */
+	white-space: pre-wrap;       /* CSS3 - Text module (Candidate Recommendation) http://www.w3.org/TR/css3-text/#white-space */
+	word-wrap: break-word;       /* IE 5.5+ */
+}
+
+pre.clicky {
+	cursor: hand;
+	cursor: pointer;
+}
+
+td.propPlus {
+	width: 9px;
+	background-color: #ddd;
+}
+
+td.propName {
+	background-color: #ddd;
+}
+
+td.propType {
+	background-color: #ddd;
+}
+
+td.propVal {
+	background-color: #ddd;
+}
+
+</style>
+</head>
+<body>
+
+<h2>Javascript Object Browser</h2>
+
+<div id="frame"></div>
+
+</body>
+</html>
\ No newline at end of file

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/deep.html
------------------------------------------------------------------------------
    svn:eol-style = native

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/spacer.gif
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/spacer.gif?view=auto&rev=449122
==============================================================================
Binary file - no diff available.

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/debug/spacer.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/dnd/DragAndDrop.js
URL: http://svn.apache.org/viewvc/tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/dnd/DragAndDrop.js?view=auto&rev=449122
==============================================================================
--- tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/dnd/DragAndDrop.js (added)
+++ tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/dnd/DragAndDrop.js Fri Sep 22 16:22:30 2006
@@ -0,0 +1,176 @@
+/*
+	Copyright (c) 2004-2006, The Dojo Foundation
+	All Rights Reserved.
+
+	Licensed under the Academic Free License version 2.1 or above OR the
+	modified BSD license. For more information on Dojo licensing, see:
+
+		http://dojotoolkit.org/community/licensing.shtml
+*/
+
+dojo.require("dojo.lang.common");
+dojo.require("dojo.lang.declare");
+dojo.provide("dojo.dnd.DragSource");
+dojo.provide("dojo.dnd.DropTarget");
+dojo.provide("dojo.dnd.DragObject");
+dojo.provide("dojo.dnd.DragAndDrop");
+
+dojo.declare("dojo.dnd.DragSource", null, {
+	type: "",
+
+	onDragEnd: function(){
+	},
+
+	onDragStart: function(){
+	},
+
+	/*
+	 * This function gets called when the DOM element was 
+	 * selected for dragging by the HtmlDragAndDropManager.
+	 */
+	onSelected: function(){
+	},
+
+	unregister: function(){
+		dojo.dnd.dragManager.unregisterDragSource(this);
+	},
+
+	reregister: function(){
+		dojo.dnd.dragManager.registerDragSource(this);
+	}
+}, function(){
+
+	//dojo.profile.start("DragSource");
+
+	var dm = dojo.dnd.dragManager;
+	if(dm["registerDragSource"]){ // side-effect prevention
+		dm.registerDragSource(this);
+	}
+
+	//dojo.profile.end("DragSource");
+
+});
+
+dojo.declare("dojo.dnd.DragObject", null, {
+	type: "",
+
+	onDragStart: function(){
+		// gets called directly after being created by the DragSource
+		// default action is to clone self as icon
+	},
+
+	onDragMove: function(){
+		// this changes the UI for the drag icon
+		//	"it moves itself"
+	},
+
+	onDragOver: function(){
+	},
+
+	onDragOut: function(){
+	},
+
+	onDragEnd: function(){
+	},
+
+	// normal aliases
+	onDragLeave: this.onDragOut,
+	onDragEnter: this.onDragOver,
+
+	// non-camel aliases
+	ondragout: this.onDragOut,
+	ondragover: this.onDragOver
+}, function(){
+	var dm = dojo.dnd.dragManager;
+	if(dm["registerDragObject"]){ // side-effect prevention
+		dm.registerDragObject(this);
+	}
+});
+
+dojo.declare("dojo.dnd.DropTarget", null, {
+
+	acceptsType: function(type){
+		if(!dojo.lang.inArray(this.acceptedTypes, "*")){ // wildcard
+			if(!dojo.lang.inArray(this.acceptedTypes, type)) { return false; }
+		}
+		return true;
+	},
+
+	accepts: function(dragObjects){
+		if(!dojo.lang.inArray(this.acceptedTypes, "*")){ // wildcard
+			for (var i = 0; i < dragObjects.length; i++) {
+				if (!dojo.lang.inArray(this.acceptedTypes,
+					dragObjects[i].type)) { return false; }
+			}
+		}
+		return true;
+	},
+
+	unregister: function(){
+		dojo.dnd.dragManager.unregisterDropTarget(this);
+	},
+
+	onDragOver: function(){
+	},
+
+	onDragOut: function(){
+	},
+
+	onDragMove: function(){
+	},
+
+	onDropStart: function(){
+	},
+
+	onDrop: function(){
+	},
+
+	onDropEnd: function(){
+	}
+}, function(){
+	if (this.constructor == dojo.dnd.DropTarget) { return; } // need to be subclassed
+	this.acceptedTypes = [];
+	dojo.dnd.dragManager.registerDropTarget(this);
+});
+
+// NOTE: this interface is defined here for the convenience of the DragManager
+// implementor. It is expected that in most cases it will be satisfied by
+// extending a native event (DOM event in HTML and SVG).
+dojo.dnd.DragEvent = function(){
+	this.dragSource = null;
+	this.dragObject = null;
+	this.target = null;
+	this.eventStatus = "success";
+	//
+	// can be one of:
+	//	[	"dropSuccess", "dropFailure", "dragMove",
+	//		"dragStart", "dragEnter", "dragLeave"]
+	//
+}
+/*
+ *	The DragManager handles listening for low-level events and dispatching
+ *	them to higher-level primitives like drag sources and drop targets. In
+ *	order to do this, it must keep a list of the items.
+ */
+dojo.declare("dojo.dnd.DragManager", null, {
+	selectedSources: [],
+	dragObjects: [],
+	dragSources: [],
+	registerDragSource: function(){},
+	dropTargets: [],
+	registerDropTarget: function(){},
+	lastDragTarget: null,
+	currentDragTarget: null,
+	onKeyDown: function(){},
+	onMouseOut: function(){},
+	onMouseMove: function(){},
+	onMouseUp: function(){}
+});
+
+// NOTE: despite the existance of the DragManager class, there will be a
+// singleton drag manager provided by the renderer-specific D&D support code.
+// It is therefore sane for us to assign instance variables to the DragManager
+// prototype
+
+// The renderer-specific file will define the following object:
+// dojo.dnd.dragManager = null;

Propchange: tapestry/tapestry4/trunk/tapestry-framework/src/js/dojo/src/dnd/DragAndDrop.js
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message