Merge branch 'master' into 8-merge

Conflicts:
	docs/gotcha.txt
	lib/WebGUI.pm
	lib/WebGUI/Asset.pm
	lib/WebGUI/Asset/File/GalleryFile/Photo.pm
	lib/WebGUI/Asset/Post.pm
	lib/WebGUI/Asset/Story.pm
	lib/WebGUI/Asset/Template.pm
	lib/WebGUI/Asset/Wobject/Calendar.pm
	lib/WebGUI/Asset/Wobject/GalleryAlbum.pm
	lib/WebGUI/Asset/Wobject/Navigation.pm
	lib/WebGUI/AssetLineage.pm
	lib/WebGUI/AssetTrash.pm
	lib/WebGUI/Config.pm
	lib/WebGUI/Form/Template.pm
	lib/WebGUI/Group.pm
	lib/WebGUI/Inbox.pm
	lib/WebGUI/Workflow/Activity/DeleteExpiredSessions.pm
	lib/WebGUI/Workflow/Activity/TrashExpiredEvents.pm
	sbin/testEnvironment.pl
	t/AdSpace.t
	t/AdSpace/Ad.t
	t/Asset/Asset.t
	t/Asset/AssetExportHtml.t
	t/Asset/AssetLineage.t
	t/Asset/EMSSubmissionForm.t
	t/Asset/Event.t
	t/Asset/File/GalleryFile/Photo/00base.t
	t/Asset/File/GalleryFile/Photo/comment.t
	t/Asset/File/GalleryFile/Photo/download.t
	t/Asset/File/GalleryFile/Photo/edit.t
	t/Asset/File/GalleryFile/Photo/exif.t
	t/Asset/File/GalleryFile/Photo/makeResolutions.t
	t/Asset/File/GalleryFile/Photo/makeShortcut.t
	t/Asset/File/Image/setfile.t
	t/Asset/File/setfile.t
	t/Asset/Post.t
	t/Asset/Post/Thread/getAdjacentThread.t
	t/Asset/Sku.t
	t/Asset/Sku/ProductCollateral.t
	t/Asset/Story.t
	t/Asset/Template.t
	t/Asset/Template/HTMLTemplateExpr.t
	t/Asset/Wobject/Gallery/00base.t
	t/Asset/Wobject/GalleryAlbum/00base.t
	t/Asset/Wobject/GalleryAlbum/ajax.t
	t/Asset/Wobject/GalleryAlbum/delete.t
	t/Asset/Wobject/Matrix.t
	t/Asset/Wobject/StoryArchive.t
	t/Asset/Wobject/Survey/ExpressionEngine.t
	t/Asset/Wobject/Survey/Reports.t
	t/AssetAspect/RssFeed.t
	t/Auth/mech.t
	t/Config.t
	t/Group.t
	t/Help/isa.t
	t/International.t
	t/Mail/Send.t
	t/Operation/AdSpace.t
	t/Operation/Auth.t
	t/Pluggable.t
	t/Session.t
	t/Session/DateTime.t
	t/Session/ErrorHandler.t
	t/Session/Scratch.t
	t/Session/Stow.t
	t/Shop/Cart.t
	t/Shop/Pay.t
	t/Shop/PayDriver/ITransact.t
	t/Shop/PayDriver/PayPalStd.t
	t/Shop/Ship.t
	t/Shop/ShipDriver.t
	t/Shop/TaxDriver/EU.t
	t/Shop/TaxDriver/Generic.t
	t/Shop/Transaction.t
	t/Shop/Vendor.t
	t/VersionTag.t
	t/Workflow/Activity/ArchiveOldStories.t
	t/Workflow/Activity/ExpireIncompleteSurveyResponses.t
	t/lib/WebGUI/Test.pm
This commit is contained in:
Doug Bell 2010-07-09 11:48:30 -05:00
commit babfa74209
238 changed files with 4557 additions and 1287 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

View file

@ -0,0 +1,219 @@
// Initialize namespace
if (typeof WebGUI == "undefined") {
var WebGUI = {};
}
if (typeof WebGUI.Form == "undefined") {
WebGUI.Form = {};
}
/****************************************************************************
* WebGUI.Form.JsonTable( fieldName, tableId, columns )
* Create a JsonTable object.
*
* fieldName holds the current JSON-encoded array of hashrefs of values.
*
* tableId is where to put the rows and add all the events.
*
* columns is an array of hashes of column data with the following keys:
* type -- The type of column, one of "text", "select",
* "id", "hidden", "readonly"
* name -- The name of the column
* label -- The label of the column
* options -- select only. An array of name, label of options.
*
*/
WebGUI.Form.JsonTable
= function ( fieldName, tableId, columns ) {
this.fieldName = fieldName;
this.tableId = tableId;
this.columns = columns;
this.table = document.getElementById( this.tableId );
this.tbody = this.table.getElementsByTagName( "tbody" )[0];
// Find the form
this.form = this.table;
while ( this.form.nodeName != "FORM" ) {
this.form = this.form.parentNode;
}
this.field = this.form.elements[ this.fieldName ];
this.json = this.field.value;
this.newRow = YAHOO.util.Dom.getElementsByClassName( "new_row", "tr", this.table )[0];
try {
this.data = YAHOO.lang.JSON.parse( this.json );
}
catch (err) {
this.data = [];
}
// Add submit listener to update JSON
YAHOO.util.Event.addListener( this.form, "submit", this.update, this, true );
this.addButton = this.table.getElementsByTagName( "button" )[0];
YAHOO.util.Event.addListener( this.addButton, "click",
function(e) {
this.addRow();
e.preventDefault();
return false;
},
this, true
);
this.init();
return this;
};
/****************************************************************************
* addActions( row )
* Add the row actions to the given row
*/
WebGUI.Form.JsonTable.prototype.addActions
= function (row) {
// Add row actions
var buttonCell = row.lastChild;
var deleteButton = document.createElement('input');
deleteButton.type = "button";
deleteButton.value = "Delete";
YAHOO.util.Event.addListener( deleteButton, "click",
function (e) {
this.deleteRow( row );
},
this, true
);
buttonCell.appendChild( deleteButton );
var moveUpButton = document.createElement('input');
moveUpButton.type = "button";
moveUpButton.value = "Up";
YAHOO.util.Event.addListener( moveUpButton, "click",
function (e) {
this.moveRowUp( row );
},
this, true
);
buttonCell.appendChild( moveUpButton );
var moveDownButton = document.createElement('input');
moveDownButton.type = "button";
moveDownButton.value = "Down";
YAHOO.util.Event.addListener( moveDownButton, "click",
function (e) {
this.moveRowDown( row );
},
this, true
);
buttonCell.appendChild( moveDownButton );
};
/****************************************************************************
* addRow ( )
* Add a new row to the bottom of the table
*/
WebGUI.Form.JsonTable.prototype.addRow
= function () {
var newRow = this.newRow.cloneNode(true);
this.tbody.appendChild( newRow );
newRow.className = "";
newRow.style.display = "table-row";
this.addActions( newRow );
return newRow;
};
/****************************************************************************
* deleteRow( row )
* Delete the row from the table
*/
WebGUI.Form.JsonTable.prototype.deleteRow
= function ( row ) {
row.parentNode.removeChild( row );
};
/****************************************************************************
* init ( )
* Initialize the JsonTable by adding rows for every datum
*/
WebGUI.Form.JsonTable.prototype.init
= function () {
for ( var row in this.data ) {
// Copy new_row
var newRow = this.addRow();
// Fill in values based on field type
var cells = newRow.getElementsByTagName( "td" );
for ( var i = 0; i < this.columns.length - 1; i++ ) { // Last cell is for buttons
var cell = cells[i];
var column = this.columns[i];
var field = cell.childNodes[0];
var value = this.data[row][column.name] || '';
if ( column.type == "text" || column.type == "id"
|| column.type == "hidden" ) {
field.value = value;
}
else if ( column.type == "select" ) {
for ( var x = 0; x < field.options.length; x++ ) {
if ( field.options[x].value == value ) {
field.options[x].selected = true;
}
}
}
else { // "readonly" or unknown
cell.appendChild( document.createTextNode( value ) );
}
}
}
};
/****************************************************************************
* moveRowDown( row )
* Move the row down in the table
*/
WebGUI.Form.JsonTable.prototype.moveRowDown
= function ( row ) {
var after = row.nextSibling;
if ( after ) {
row.parentNode.insertBefore( after, row );
}
};
/****************************************************************************
* moveRowUp( row )
* Move the row up in the table
*/
WebGUI.Form.JsonTable.prototype.moveRowUp
= function ( row ) {
var before = row.previousSibling;
if ( before && before.className != "new_row" ) {
row.parentNode.insertBefore( row, before );
}
};
/****************************************************************************
* update ( )
* Update the value in our field with the correct JSON
*/
WebGUI.Form.JsonTable.prototype.update
= function (e) {
var rows = this.tbody.getElementsByTagName( 'tr' );
var data = [];
for ( var i = 1; i < rows.length; i++ ) {
var cells = rows[i].getElementsByTagName( 'td' );
var rowData = {};
for ( var x = 0; x < this.columns.length; x++ ) {
var cell = cells[x];
var column = this.columns[x];
var field = cell.childNodes[0];
if ( field.nodeName == "INPUT" ) {
rowData[ column.name ] = field.value;
}
else if ( field.nodeName == "SELECT" ) {
var value = field.options[ field.selectedIndex ].value;
rowData[ column.name ] = field.value;
}
}
data.push( rowData );
}
this.field.value = YAHOO.lang.JSON.stringify( data );
};

View file

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 470 B

After

Width:  |  Height:  |  Size: 470 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 529 B

After

Width:  |  Height:  |  Size: 529 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 408 B

After

Width:  |  Height:  |  Size: 408 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 332 B

After

Width:  |  Height:  |  Size: 332 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 410 B

After

Width:  |  Height:  |  Size: 410 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 338 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 465 B

After

Width:  |  Height:  |  Size: 465 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 446 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 206 B

After

Width:  |  Height:  |  Size: 206 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 431 B

After

Width:  |  Height:  |  Size: 431 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 202 B

After

Width:  |  Height:  |  Size: 202 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 444 B

After

Width:  |  Height:  |  Size: 444 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 2.1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 450 B

After

Width:  |  Height:  |  Size: 450 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 451 B

After

Width:  |  Height:  |  Size: 451 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1 KiB

After

Width:  |  Height:  |  Size: 1 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 195 B

After

Width:  |  Height:  |  Size: 195 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 327 B

After

Width:  |  Height:  |  Size: 327 B

Before After
Before After

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Before After
Before After