You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2014/03/19 20:16:31 UTC

svn commit: r1579359 [5/8] - in /ofbiz/trunk/specialpurpose/birt: src/org/ofbiz/birt/report/servlet/ webapp/birt/webcontent/ webapp/birt/webcontent/birt/ webapp/birt/webcontent/birt/ajax/ webapp/birt/webcontent/birt/ajax/core/ webapp/birt/webcontent/bi...

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,573 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	Birt export data dialog.
+ */
+BirtSimpleExportDataDialog = Class.create( );
+
+BirtSimpleExportDataDialog.prototype = Object.extend( new AbstractBaseDialog( ),
+{
+	__neh_select_change_closure : null,
+	__neh_switchResultSet_closure : null,
+		
+	availableResultSets : [],
+	selectedColumns : [],
+
+	/**
+	 *	Initialization routine required by "ProtoType" lib.
+	 *	@return, void
+	 */
+	initialize : function( id )
+	{
+		this.__initBase( id );
+		this.__z_index = 200;
+		
+		// Closures
+		this.__neh_switchResultSet_closure = this.__neh_switchResultSet.bindAsEventListener( this );
+		this.__neh_click_exchange_closure = this.__neh_click_exchange.bindAsEventListener( this );
+		this.__neh_dblclick_src_closure = this.__neh_dblclick_src.bindAsEventListener( this );
+		this.__neh_dblclick_dest_closure = this.__neh_dblclick_dest.bindAsEventListener( this );
+		this.__neh_click_src_closure = this.__neh_click_src.bindAsEventListener( this );
+		this.__neh_click_dest_closure = this.__neh_click_dest.bindAsEventListener( this );
+		
+		this.__installEventHandlers( id );
+	},
+	
+	/**
+	 *	Install native/birt event handlers.
+	 *
+	 *	@id, toolbar id (optional since there is only one toolbar)
+	 *	@return, void
+	 */
+	__installEventHandlers : function( id )
+	{
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		Event.observe( oSelects[0], 'change', this.__neh_switchResultSet_closure, false );
+		
+		// Initialize exchange buttons
+		var oInputs = this.__instance.getElementsByTagName( 'input' );
+		for ( var i = 0; i < oInputs.length ; i++ )
+		{
+			Event.observe( oInputs[i], 'click', this.__neh_click_exchange_closure, false );
+		}
+		
+		// Initialize exchange selects
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		if( oSelects.length > 2 )
+		{
+			Event.observe( oSelects[1], 'dblclick', this.__neh_dblclick_src_closure, false );
+			Event.observe( oSelects[2], 'dblclick', this.__neh_dblclick_dest_closure, false );
+			Event.observe( oSelects[1], 'change', this.__neh_click_src_closure, false );
+			Event.observe( oSelects[2], 'change', this.__neh_click_dest_closure, false );
+		}
+	},
+	
+	/**
+	 *	Native event handler for selection item movement.
+	 */
+	__neh_click_exchange : function( event )
+	{	
+		var oSC = Event.element( event );
+		if( oSC.id == 'exportDataEncoding_other' )
+		{
+			this.__updateButtons( );
+			$( 'exportDataOtherEncoding_input' ).focus( );
+		}
+		else
+		{	
+			var oInputs = this.__instance.getElementsByTagName( 'input' );
+			var oSelects = this.__instance.getElementsByTagName( 'select' );
+			
+			switch ( Event.element( event ).name )
+			{
+				case 'Addall':
+				{
+					if ( oSelects[1].options.length  > 0 )
+					{
+						this.moveAllItems( oSelects[1], oSelects[2] );
+					}
+					break;
+				}
+				case 'Add':
+				{
+					if ( oSelects[1].options.length  > 0 )
+					{
+						this.moveSingleItem( oSelects[1], oSelects[2] );
+					}
+					break;
+				}
+				case 'Remove':
+				{
+					if ( oSelects[2].options.length  > 0 )
+					{
+						this.moveSingleItem( oSelects[2], oSelects[1] );
+					}
+					break;
+				}
+				case 'Removeall':
+				{
+					if ( oSelects[2].options.length  > 0 )
+					{
+						this.moveAllItems( oSelects[2], oSelects[1] );
+					}
+					break;
+				}
+				case 'Up':
+				{
+					birtUtility.moveSelectedItemsUp( oSelects[2] );
+					break;
+				}
+				case 'Down':
+				{
+					birtUtility.moveSelectedItemsDown( oSelects[2] );
+					break;
+				}
+			}
+			
+			this.__updateButtons( );
+		}				
+	},
+
+	/**
+	 *	Native event handler for double click source select element.
+	 */
+	__neh_dblclick_src : function( event )
+	{
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		
+		if ( oSelects[1].options.length  > 0 )
+		{
+			this.moveSingleItem( oSelects[1], oSelects[2] );
+		}
+		
+		this.__updateButtons( );
+	},
+
+	/**
+	 *	Native event handler for double click dest select element.
+	 */
+	__neh_dblclick_dest : function( event )
+	{
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		
+		if ( oSelects[2].options.length  > 0 )
+		{
+			this.moveSingleItem( oSelects[2], oSelects[1] );
+		}
+		
+		this.__updateButtons( );
+	},
+	
+	/**
+	 *	Native event handler for click source select element.
+	 */
+	__neh_click_src : function( event )
+	{
+		this.__updateButtons( );
+	},
+
+	/**
+	 *	Native event handler for click dest select element.
+	 */
+	__neh_click_dest : function( event )
+	{
+		this.__updateButtons( );
+	},
+		
+	/**
+	 *	Update button status.
+	 */
+	__updateButtons : function( )
+	{
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		var canExport = oSelects[0].options.length > 0;
+		var canAdd = oSelects[1].options.length > 0;
+		var canRemove = oSelects[2].options.length  > 0;
+		var srcSelectedIndex = oSelects[1].selectedIndex;
+		var destSelectedIndex = oSelects[2].selectedIndex;
+
+		var oInputs = this.__instance.getElementsByTagName( 'input' );
+		
+		if( !rtl )
+		{
+			oInputs[0].src = canAdd ? "birt/images/AddAll.gif" : "birt/images/AddAll_disabled.gif";
+		}
+		else
+		{
+			oInputs[0].src = canAdd ? "birt/images/AddAll_rtl.gif" : "birt/images/AddAll_disabled_rtl.gif";
+		}
+		oInputs[0].style.cursor = canAdd ? "pointer" : "default";
+		
+		if( !rtl )
+		{
+			oInputs[1].src = canAdd && srcSelectedIndex >= 0 ? "birt/images/Add.gif" : "birt/images/Add_disabled.gif";
+		}
+		else
+		{
+			oInputs[1].src = canAdd && srcSelectedIndex >= 0 ? "birt/images/Add_rtl.gif" : "birt/images/Add_disabled_rtl.gif";
+		}	
+		oInputs[1].style.cursor = canAdd ? "pointer" : "default";
+		
+		if( !rtl )
+		{ 
+			oInputs[2].src = canRemove && destSelectedIndex >= 0 ? "birt/images/Remove.gif" : "birt/images/Remove_disabled.gif";
+		}
+		else
+		{
+			oInputs[2].src = canRemove && destSelectedIndex >= 0 ? "birt/images/Remove_rtl.gif" : "birt/images/Remove_disabled_rtl.gif";
+		}	
+		oInputs[2].style.cursor = canRemove ? "pointer" : "default";
+
+		if( !rtl )
+		{
+			oInputs[3].src = canRemove ? "birt/images/RemoveAll.gif" : "birt/images/RemoveAll_disabled.gif";
+		}
+		else
+		{
+			oInputs[3].src = canRemove ? "birt/images/RemoveAll_rtl.gif" : "birt/images/RemoveAll_disabled_rtl.gif";
+		}
+		oInputs[3].style.cursor = canRemove ? "pointer" : "default";
+
+		oInputs[4].src = canRemove && destSelectedIndex >= 0 ? "birt/images/Up.gif" : "birt/images/Up_disabled.gif";
+		oInputs[4].style.cursor = canRemove ? "pointer" : "default";
+
+		oInputs[5].src = canRemove && destSelectedIndex >= 0 ? "birt/images/Down.gif" : "birt/images/Down_disabled.gif";
+		oInputs[5].style.cursor = canRemove ? "pointer" : "default";
+		
+		if( canExport )
+		{
+			this.__setDisabled( 'exportDataEncodingSetting', false );
+			$( 'exportDataCSVSeparator' ).disabled = false;
+			
+			var oEnc = $( 'exportDataEncoding_other' );
+			var oEncInput = $( 'exportDataOtherEncoding_input' );
+			if( oEnc && oEnc.checked )
+			{				
+				oEncInput.disabled = false;
+			}
+			else
+			{
+				oEncInput.disabled = true;
+			}
+		}
+		else
+		{
+			this.__setDisabled( 'exportDataEncodingSetting', true );
+			$( 'exportDataCSVSeparator' ).disabled = true;
+		}
+	},
+
+	/**
+	 * Set disabled status for all controls in container 
+	 * 
+	 * @param id
+	 * @param flag
+	 * @return, void
+	 */
+	__setDisabled : function( id, flag )
+	{
+		var oContainer = $( id );
+		if( !oContainer )
+			return;
+		
+		var oSelects = oContainer.getElementsByTagName( "select" );
+		if( oSelects )
+		{
+			for( var i=0; i<oSelects.length; i++ )
+				oSelects[i].disabled = flag;
+		}
+		
+		var oInputs = oContainer.getElementsByTagName( "input" );
+		if( oInputs )
+		{
+			for( var i=0; i<oInputs.length; i++ )
+				oInputs[i].disabled = flag;
+		}		
+	},
+		
+	/**
+	 *	Move single selection item.
+	 */
+	moveSingleItem : function( sel_source, sel_dest )
+	{
+		if ( sel_source.selectedIndex == -1 )
+		{
+			return;
+		}
+		
+		for ( var i=0; i<sel_source.options.length; i++ )
+		{
+			if ( sel_source.options[i].selected )
+			{
+				var selectedItem = sel_source.options[i];
+				sel_dest.options[sel_dest.options.length] = new Option( selectedItem.text, selectedItem.value );
+				sel_source.remove( i );
+				i = i - 1;
+			}							
+		}
+		
+		sel_source.selectedIndex = 0;
+	},
+	
+	/**
+	 *	Move all selection items.
+	 */
+	moveAllItems : function( sel_source, sel_dest )
+	{
+   		for ( var i = 0; i < sel_source.length; i++ )
+   		{
+     		var SelectedText = sel_source.options[i].text;
+     		var SelectedValue = sel_source.options[i].value;
+	   		var newOption = new Option( SelectedText );
+			newOption.value = SelectedValue;
+     		sel_dest.options[sel_dest.options.length] = newOption;
+   		}
+   		
+   		sel_dest.selectedIndex = 0;
+   		sel_source.length = 0;
+	},	
+
+	/**
+	 *	Binding data to the dialog UI. Data includes zoom scaling factor.
+	 *
+	 *	@data, data DOM tree (schema TBD)
+	 *	@return, void
+	 */
+	 __bind : function( data )
+	 {
+	 	if ( !data )
+	 	{
+	 		return;
+	 	}
+	 	
+	 	var oSelects = this.__instance.getElementsByTagName( 'select' );
+		oSelects[0].options.length = 0;
+		oSelects[1].options.length = 0;
+		oSelects[2].options.length = 0;
+		
+		this.availableResultSets = [];
+	 	
+	 	var resultSets = data.getElementsByTagName( 'ResultSet' );
+	 	for ( var k = 0; k < resultSets.length; k++ )
+	 	{
+	 		var resultSet = resultSets[k];
+	 		
+		 	var queryNames = resultSet.getElementsByTagName( 'QueryName' );
+			oSelects[0].options[oSelects[0].options.length] = new Option(queryNames[0].firstChild.data);
+				 	
+			this.availableResultSets[k] = {};
+			
+		 	var columns = resultSet.getElementsByTagName( 'Column' );
+		 	for( var i = 0; i < columns.length; i++ )
+		 	{
+		 		var column = columns[i];
+		 		
+		 		var columnName = column.getElementsByTagName( 'Name' );
+		 		var label = column.getElementsByTagName( 'Label' );
+				this.availableResultSets[k][label[0].firstChild.data] = columnName[0].firstChild.data;
+		 	}
+		}
+		
+		this.__neh_switchResultSet( );
+	 },
+	 
+	 /**
+	  *	switch result set.
+	  */
+	 __neh_switchResultSet : function( )
+	 {
+	 	var oSelects = this.__instance.getElementsByTagName( 'select' );
+		oSelects[1].options.length = 0;
+		oSelects[2].options.length = 0;	
+	 	
+	 	var columns = this.availableResultSets[oSelects[0].selectedIndex];
+	 	for( var label in columns )
+	 	{
+	 		var colName = columns[label];
+			var option = new Option( label );
+			option.value = colName;
+			oSelects[1].options[oSelects[1].options.length] = option;
+	 	}
+	 	
+		this.__updateButtons( );
+	 },
+
+	/**
+	 *	Handle clicking on ok.
+	 *
+	 *	@return, void
+	 */
+	__okPress : function( )
+	{
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		this.__l_hide( );
+		if ( oSelects[2].options.length > 0 )
+		{
+			for( var i = 0; i < oSelects[2].options.length; i++ )
+			{
+				this.selectedColumns[i] = oSelects[2].options[i].value;
+			}
+			
+			this.__constructForm( );
+		}
+	},
+	
+	/**
+	 *	Construct extract data form. Post it to server.
+	 */
+	__constructForm : function( )
+	{
+		var dialogContent = $( 'simpleExportDialogBody' );
+		var hiddenDiv = document.createElement( 'div' );
+		hiddenDiv.style.display = 'none';
+
+		var hiddenForm = document.createElement( 'form' );
+		hiddenForm.method = 'post';
+		hiddenForm.target = '_self';
+		var url = soapURL;
+		url = url.replace( /[\/][a-zA-Z]+[?]/, '/' + Constants.SERVLET_EXTRACT + '?' );
+		
+		// delete some URL parameters
+		url = birtUtility.deleteURLParameter( url, Constants.PARAM_BOOKMARK );
+		url = birtUtility.deleteURLParameter( url, Constants.PARAM_INSTANCE_ID );
+		hiddenForm.action = url;
+		
+		// Pass over current element's iid.
+		var queryNameInput = document.createElement( 'input' );
+		queryNameInput.type = 'hidden';
+		queryNameInput.name = Constants.PARAM_RESULTSETNAME;
+		var oSelects = this.__instance.getElementsByTagName( 'select' );
+		queryNameInput.value = oSelects[0].options[oSelects[0].selectedIndex].text;
+		hiddenForm.appendChild( queryNameInput );
+
+		// Total # of selected columns.
+		if ( this.selectedColumns.length > 0 )
+		{
+			var hiddenSelectedColumnNumber = document.createElement( 'input' );
+			hiddenSelectedColumnNumber.type = 'hidden';
+			hiddenSelectedColumnNumber.name = Constants.PARAM_SELECTEDCOLUMNNUMBER;
+			hiddenSelectedColumnNumber.value = this.selectedColumns.length;
+			hiddenForm.appendChild( hiddenSelectedColumnNumber );
+
+			// data of selected columns.
+			for( var i = 0; i < this.selectedColumns.length; i++ )
+			{
+				var hiddenSelectedColumns = document.createElement( 'input' );
+				hiddenSelectedColumns.type = 'hidden';
+				hiddenSelectedColumns.name = Constants.PARAM_SELECTEDCOLUMN + i;
+				hiddenSelectedColumns.value = this.selectedColumns[i];
+				hiddenForm.appendChild( hiddenSelectedColumns );
+			}
+		}
+		
+		this.selectedColumns = [];
+		
+		// CSV separator
+		var oExtension = $( 'exportDataExtension' );
+		if( oExtension && oExtension.value != '' )
+		{
+			var hiddenExtension = document.createElement( 'input' );
+			hiddenExtension.type = 'hidden';
+			hiddenExtension.name = Constants.PARAM_DATA_EXTRACT_EXTENSION;
+			hiddenExtension.value = oExtension.value;
+			hiddenForm.appendChild( hiddenExtension );			
+		}
+		
+		// Pass the export data encoding		
+		var oUTF8 = $( 'exportDataEncoding_UTF8' );
+		var hiddenEnc = document.createElement( 'input' );
+		hiddenEnc.type = 'hidden';
+		hiddenEnc.name = Constants.PARAM_EXPORT_ENCODING;
+		if( oUTF8 && oUTF8.checked )
+		{
+			hiddenEnc.value = oUTF8.value;
+		}
+		else
+		{
+			hiddenEnc.value = $('exportDataOtherEncoding_input').value;
+		}
+		hiddenForm.appendChild( hiddenEnc );
+		
+		// CSV separator
+		var oSep = $( 'exportDataCSVSeparator' );
+		if( oSep && oSep.value != '' )
+		{
+			var hiddenSep = document.createElement( 'input' );
+			hiddenSep.type = 'hidden';
+			hiddenSep.name = Constants.PARAM_SEP;
+			hiddenSep.value = oSep.value;
+			hiddenForm.appendChild( hiddenSep );			
+		}
+
+		var hiddenAsAttachment = document.createElement( 'input' );
+		hiddenAsAttachment.type = 'hidden';
+		hiddenAsAttachment.name = Constants.PARAM_ASATTACHMENT;
+		hiddenAsAttachment.value = "true";
+		hiddenForm.appendChild( hiddenAsAttachment );			
+		
+		// Whether exports column's data type
+		var oType = $( 'exportColumnDataType' );
+		var hiddenType = document.createElement( 'input' );
+		hiddenType.type = 'hidden';
+		hiddenType.name = Constants.PARAM_EXPORT_DATATYPE;
+		if( oType && oType.checked )
+			hiddenType.value = "true";
+		else
+			hiddenType.value = "false";
+		hiddenForm.appendChild( hiddenType );
+		
+		// Whether exports column as locale neutral
+		var oLocaleNeutral = $( 'exportColumnLocaleNeutral' );
+		var hiddenLocaleNeutral = document.createElement( 'input' );
+		hiddenLocaleNeutral.type = 'hidden';
+		hiddenLocaleNeutral.name = Constants.PARAM_LOCALENEUTRAL;
+		if( oLocaleNeutral && oLocaleNeutral.checked )
+			hiddenLocaleNeutral.value = "true";
+		else
+			hiddenLocaleNeutral.value = "false";
+		hiddenForm.appendChild( hiddenLocaleNeutral );		
+		
+		var tmpSubmit = document.createElement( 'input' );
+		tmpSubmit.type = 'submit';
+		tmpSubmit.value = 'TmpSubmit';
+		hiddenForm.appendChild( tmpSubmit );
+		
+		hiddenDiv.appendChild( hiddenForm );
+		dialogContent.appendChild( hiddenDiv );
+		tmpSubmit.click( );
+		dialogContent.removeChild( hiddenDiv );
+	},
+
+	/**
+	Called right before element is shown
+	*/
+	__preShow: function()
+	{
+		// disable the toolbar buttons
+		birtUtility.setButtonsDisabled ( "toolbar", true );
+		
+		// disable the Navigation Bar buttons
+		birtUtility.setButtonsDisabled ( "navigationBar", true );
+	},
+	
+	/**
+	Called before element is hidden
+	*/
+	__preHide: function()
+	{
+		// enable the toolbar buttons
+		birtUtility.setButtonsDisabled ( "toolbar", false );
+		
+		// enable the Navigation Bar buttons
+		birtUtility.setButtonsDisabled ( "navigationBar", false );		
+	}	
+} );
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtSimpleExportDataDialog.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,135 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	BirtTabedDialogBase
+ *	...
+ */
+BirtTabedDialogBase = Class.create( );
+
+BirtTabedDialogBase.prototype = Object.extend( new AbstractBaseDialog( ),
+{
+	/**
+	 *	Current tabs
+	 */
+	__tabs_caption : { },
+	
+	/**
+	 *	Current sections
+	 */
+	__tabs_content : { },
+	
+	/**
+	 *	Current tabs
+	 */
+	__current_tab : null,
+	
+	__neh_switchTab_closure : null,
+	__neh_hoverTab_closure : null,
+	
+	/**
+	 *	Initialization routine required by "ProtoType" lib.
+	 *
+	 *	@return, void
+	 */
+	initialize : function( id )
+	{
+		this.__initBase(id);
+		this.__z_index = 300;
+		
+		// TODO: need a better way to identify the dialog layout.
+		var oTabs = $( 'tabs' );
+		var oDivs = $( 'aaacontent' );
+		if ( oTabs && oDivs )
+		{
+			var oCells = oTabs.getElementsByTagName( 'td' );
+			var oTables = oDivs.getElementsByTagName( 'div' );
+			
+			for ( var i = 0; i < oCells.length; i++ )
+			{
+				this.__tabs_caption[ oCells[i].firstChild.data ] = oCells[i];
+				this.__tabs_content[ oCells[i].firstChild.data ] = oTables[i];
+			}
+			
+			this.__current_tab = oCells[0].firstChild.data;
+		}
+
+		// Closures
+		this.__neh_switchTab_closure = this.__neh_switchTab.bindAsEventListener( this );
+		this.__neh_hoverTab_closure = this.__neh_hoverTab.bindAsEventListener( this );
+		
+		this.__initialize( id );
+	},
+
+	/**
+	 *	Install native/birt event handlers.
+	 *
+	 *	@id, toolbar id (optional since there is only one toolbar)
+	 *	@return, void
+	 */
+	__tabBase_installEventHandlers : function( id )
+	{
+		// Tabs
+		if ( this.__tabs_caption )
+		{
+			for ( var i in this.__tabs_caption )
+			{
+				Event.observe( this.__tabs_caption[ i ], 'click', this.__neh_switchTab_closure, false );
+				Event.observe( this.__tabs_caption[ i ], 'mouseover', this.__neh_hoverTab_closure, false );
+				Event.observe( this.__tabs_caption[ i ], 'mouseout', this.__neh_hoverTab_closure, false );
+			}
+		}
+		
+		this.__installEventHandlers( id );
+	},
+	
+	/**
+	 *	Handle native event 'click'.
+	 *
+	 *	@event, incoming browser native event
+	 *	@return, void
+	 */
+	__neh_hoverTab : function( event )
+	{
+		var oCell = Event.element( event );
+		if ( this.__current_tab != oCell.firstChild.data )
+		{
+			this.__tabs_caption[oCell.firstChild.data].style.backgroundColor = ( event.type == 'mouseover' )? "#4682b4" : "#dbe4ee";
+			this.__tabs_caption[oCell.firstChild.data].style.color = ( event.type == 'mouseover' )? "white" : "black";
+		}
+	},
+
+	/**
+	 *	Handle native event 'click'.
+	 *
+	 *	@event, incoming browser native event
+	 *	@return, void
+	 */
+	__neh_switchTab : function( event )
+	{
+		var oCell = Event.element( event );
+		if ( this.__current_tab != oCell.firstChild.data )
+		{
+			this.__tabs_caption[this.__current_tab].style.borderStyle = "outset";
+			this.__tabs_caption[this.__current_tab].style.cursor = "hand";
+			
+			this.__tabs_caption[oCell.firstChild.data].style.borderStyle = "inset";
+			this.__tabs_caption[oCell.firstChild.data].style.cursor = "default";
+			this.__tabs_caption[oCell.firstChild.data].style.backgroundColor = "#dbe4ee";
+			this.__tabs_caption[oCell.firstChild.data].style.color = "black";
+			
+			this.__tabs_content[this.__current_tab].style.display = "none";
+			this.__tabs_content[oCell.firstChild.data].style.display = "block";
+	
+			this.__current_tab = oCell.firstChild.data;
+		}
+	}
+});
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtTabedDialogBase.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,372 @@
+/******************************************************************************
+ *	Copyright (c) 2004-2008 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	AbstractBaseDocument
+ *	...
+ */
+AbstractBaseReportDocument = function( ) { };
+
+AbstractBaseReportDocument.prototype = Object.extend( new AbstractReportComponent( ),
+{
+	__instance : null,
+	__has_svg_support : false,
+	__tocElement : null,
+	
+	/**
+	 *	Event handler closures.
+	 */
+	__neh_resize_closure : null,
+	__neh_select_closure : null,
+	__beh_toc_closure : null,
+	__beh_getPage_closure : null,
+	__beh_changeParameter_closure : null,
+	__rtl : null,
+		
+	__cb_bind : function( data )
+	{
+		// set rtl only the first time
+		if ( this.__rtl == null )
+		{
+			this.__rtl = false;
+			var oRtlElement = data.getElementsByTagName( 'rtl' );
+			if ( oRtlElement && oRtlElement[0] && oRtlElement[0].firstChild )
+			{
+				this.__rtl = ( "true" == oRtlElement[0].firstChild.data );
+			}
+		}
+		
+		var documentViewElement = $("documentView");
+		documentViewElement.style.direction = this.__rtl?"rtl":"ltr";
+		var docObj = document.getElementById( "Document" );
+		if ( docObj && BrowserUtility.isMozilla && !BrowserUtility.isFirefox3 )
+		{
+			docObj.scrollLeft = this.__rtl?(docObj.offsetWidth + "px"):"0px";
+		}
+	},
+	
+	/**
+	 *	Local version of __cb_installEventHandlers.
+	 */
+	__local_installEventHandlers : function( id, children, bookmark )
+	{
+		// jump to bookmark.
+		if ( bookmark )
+		{
+			var obj = $( bookmark );
+			if ( obj && obj.scrollIntoView )
+			{
+				obj.scrollIntoView( true );
+			}
+		}
+	},
+	
+	/**
+	 *	Unregister any birt event handlers.
+	 *
+	 *	@id, object id
+	 *	@return, void
+	 */
+	__local_disposeEventHandlers : function( id )
+	{
+	},
+
+	/**
+	 *	Handle native event 'click'.
+	 *
+	 *	@event, incoming browser native event
+	 *	@return, void
+	 */
+	__neh_resize : function( event )
+	{
+		if ( !this.__updateContainerSize_closure )
+		{
+			this.__updateContainerSize_closure = this.__updateContainerSize.bind( this );
+		}
+		
+		if ( BrowserUtility.isIE6 || BrowserUtility.isIE7 )
+		{
+			// delay resizing operation to the event queue
+			// else IE might override our changes with its calculated ones
+			setTimeout( this.__updateContainerSize_closure, 0);
+		}
+		else
+		{
+			this.__updateContainerSize();
+		}
+	},
+	
+	/**
+	 * Updates the container size according to the window size.
+	 */
+	__updateContainerSize : function()
+	{
+		var tocWidth = 0;
+		if ( this.__tocElement && this.__tocElement.__instance )
+		{
+			tocWidth = this.__tocElement.getWidth();
+		}
+		
+		var width = BirtPosition.viewportWidth( ) - tocWidth - (BrowserUtility.isFirefox?6:4);
+
+		// in IE, the width contains the border, unlike in other browsers
+		if ( BrowserUtility.isIE6 || BrowserUtility.isIE7 || 
+				BrowserUtility.isOpera || BrowserUtility.isKHTML || BrowserUtility.isSafari )
+		{
+			var containerLeft = 0;
+			// if viewer in rtl mode
+			if ( Constants.request.rtl )
+			{
+				// if report in rtl mode
+				if ( birtReportDocument && birtReportDocument.__rtl )
+				{
+					if ( BrowserUtility.isKHTML || BrowserUtility.isSafari )
+					{
+						containerLeft = 0;
+					}
+					else
+					{
+						containerLeft = -tocWidth;
+					}
+				}
+				else
+				{
+					containerLeft = tocWidth;
+				}
+				
+				this.__instance.style.left = containerLeft + "px";
+			}
+			else
+			{
+				this.__instance.style.left = "0px";
+			}
+		}
+		if( width > 0 )
+			this.__instance.style.width = width + "px";
+			
+		var height = BirtPosition.viewportHeight( ) - this.__instance.offsetTop - 2;
+		if( height > 0 )
+			this.__instance.style.height = height + "px";		
+		
+		this.__instance.style.left = containerLeft + "px";
+
+		if (BrowserUtility.isIE) {
+			var reportContainer = this.__instance.firstChild;
+
+			if (reportContainer != null) {
+				var scrollBarWidth = BrowserUtility._getScrollBarWidth(reportContainer, width, height);
+				var containerWidth = "100%";
+
+				if (height < reportContainer.offsetHeight && width > scrollBarWidth) {
+					containerWidth = (width - scrollBarWidth) + "px";
+				}
+				reportContainer.style.overflowX = "visible";
+				reportContainer.style.overflowY = "visible";
+				reportContainer.style.position = "relative";
+				reportContainer.style.width = containerWidth;
+			}
+		}
+	},
+	
+	/**
+	 *	Birt event handler for "getpage" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_parameter : function( id )
+	{
+		birtParameterDialog.__cb_bind( );
+	},
+
+	/**
+	 *	Birt event handler for "change parameter" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_changeParameter : function( id )
+	{
+		// set task id
+		var taskid = birtUtility.setTaskId( );
+		
+		if ( birtParameterDialog.__parameter > 0 )
+		{
+	        birtParameterDialog.__parameter.length = birtParameterDialog.__parameter.length - 1;
+		}
+		
+		// Get current page number
+		var pageNum = birtUtility.getPageNumber( );
+		
+		if( pageNum > 0 )
+		{		
+	        birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+	        							  "ChangeParameter", null, birtParameterDialog.__parameter,
+										  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+										  { name : Constants.PARAM_PAGE, value : pageNum },
+										  { name : Constants.PARAM_TASKID, value : taskid } );
+		}
+		else
+		{
+	        birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+	        							  "ChangeParameter", null, birtParameterDialog.__parameter,
+										  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+										  { name : Constants.PARAM_TASKID, value : taskid } );			
+		}
+		birtSoapRequest.setURL( soapURL );
+		birtProgressBar.setRedirect( true );
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		return true;
+	},
+	
+	/**
+	 *	Handle change cascade parameter.
+	 */
+	__beh_cascadingParameter : function( id, object )
+	{
+		// set task id
+		var taskid = birtUtility.setTaskId( );
+		
+	    birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+	    							 "GetCascadingParameter", null, object,
+	    							 { name : Constants.PARAM_TASKID, value : taskid } );
+		birtSoapRequest.setURL( soapURL );
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		return true;
+	},
+
+	/**
+	 *	Handle native event 'click'.
+	 *
+	 *	@event, incoming browser native event
+	 *	@return, void
+	 */
+	__beh_toc : function( id )
+	{
+		// resize document window
+		this.__neh_resize();
+	},
+
+	/**
+	 *	Birt event handler for "getpage" event.
+	 *
+	 *	@param id, document id (optional since there's only one document instance)
+	 *  @param object, pass some settings, for example: page,bookmark...
+	 *	@return, true indicating server call
+	 */
+	__beh_getPage : function( id, object )
+	{
+		// set task id
+		var taskid = birtUtility.setTaskId( );
+		
+		var url = soapURL;
+		// if set bookmark, delete the bookmark parameter in URL
+		if( object && object.name && object.name == Constants.PARAM_BOOKMARK )
+		{
+			url = birtUtility.deleteURLParameter( url, Constants.PARAM_BOOKMARK );
+			url = birtUtility.deleteURLParameter( url, Constants.PARAM_ISTOC );
+		}
+		
+		birtSoapRequest.setURL( url );
+		if ( object )
+		{
+			birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+										  "GetPage", null,
+										  object,
+										  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+										  { name : Constants.PARAM_TASKID, value : taskid } );
+		}
+		else
+		{
+			birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+										  "GetPage", null,
+										  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+										  { name : Constants.PARAM_TASKID, value : taskid } );
+		}
+
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		birtProgressBar.setRedirect( true );
+		return true;
+	},
+
+	/**
+	 *	Birt event handler for "getpage" event with collected parameters.
+	 *
+	 *	@param id, document id (optional since there's only one document instance)
+	 *  @param object, pass some settings, for example: page...
+	 *	@return, true indicating server call
+	 */
+	__beh_getPageInit : function( id, object )
+	{
+		// set task id
+		var taskid = birtUtility.setTaskId( );
+		
+		// Get current page number
+		var pageNum = birtUtility.getPageNumber( );
+		
+		birtSoapRequest.setURL( soapURL );
+		if ( object )
+		{
+			if( pageNum > 0 )
+			{
+				birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+											  "GetPage", null, birtParameterDialog.__parameter,
+											  object,
+											  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+											  { name : Constants.PARAM_PAGE, value : pageNum },
+											  { name : Constants.PARAM_TASKID, value : taskid } );
+			}
+			else
+			{
+				birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+											  "GetPage", null, birtParameterDialog.__parameter,
+											  object,
+											  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+											  { name : Constants.PARAM_TASKID, value : taskid } );				
+			}
+		}
+		else
+		{
+			if( pageNum > 0 )
+			{
+				birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+											  "GetPage", null, birtParameterDialog.__parameter,
+											  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+											  { name : Constants.PARAM_PAGE, value : pageNum },
+											  { name : Constants.PARAM_TASKID, value : taskid } );				
+			}
+			else
+			{
+				birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+											  "GetPage", null, birtParameterDialog.__parameter,
+											  { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+											  { name : Constants.PARAM_TASKID, value : taskid } );
+			}
+		}
+
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		birtProgressBar.setRedirect( true );
+		return true;
+	},
+	
+	/**
+	 *	Birt event handler for "print" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_export : function( id )
+	{
+		birtSoapRequest.setURL( soapURL);
+		birtSoapRequest.addOperation( "Document", Constants.Document, "QueryExport", null );
+		return true;
+	}
+});

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractBaseReportDocument.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,209 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	AbstractReportComponent.
+ *		Base class for all UI components.
+ */
+AbstractReportComponent = function( ) { };
+
+AbstractReportComponent.prototype =
+{
+	/**
+	 *	UI component html instance.
+	 */
+	__instance : null,
+	
+	/**
+	 *	Re-render ui object with new content.
+	 *
+	 *	@id, ui object id
+	 *	@content, new html UI content
+	 *	@return, void
+	 */
+	__cb_render : function( id, content )
+	{
+		var oDiv = $( id );
+		
+		while( oDiv.childNodes.length > 0)
+		{
+			oDiv.removeChild(oDiv.firstChild);
+		}
+				
+		// workaround for IE. If content starts with script, 
+		// append a hidden line to avoid ignore these scripts.
+		// Delete script attribute "defer" to avoid exec javascript twice
+		if( BrowserUtility.__isIE( ) )
+		{
+			content = '<span style="display: none">&nbsp;</span>' + content;
+			content = content.replace(/<script(.*)defer([^\s|^>]*)([^>]*)>/gi,'<script$1$3>');
+		}
+				
+		var container = document.createElement( "div" );
+		
+		container.innerHTML = content;
+		
+		// FIXME: Mozilla 1.7.12 produces an exception on the following line
+		// because the "content" variable contains some unrecognized parts
+		// see Bugzilla Bug 199998
+		try
+		{
+			oDiv.appendChild( container );
+		}
+		catch ( error )
+		{
+			// ignore exception
+		}		
+		
+		var scripts = container.getElementsByTagName( "script" );
+		for( var i = 0; i < scripts.length; i++ )
+		{
+		    if( scripts[i].src )
+		    {		
+		    	// workaround for IE, need append these scripts in head    			    					
+				if( BrowserUtility.__isIE( ) )
+				{
+				   	var scriptObj = document.createElement( "script" );
+					scriptObj.setAttribute( "type", "text/javascript" );
+					scriptObj.setAttribute( "src", scripts[i].src );
+				
+					var head = document.getElementsByTagName( "head" )[0];	
+					if( head )
+						head.appendChild( scriptObj );
+				}	
+		    }
+		    else if ( scripts[i].innerHTML )
+		    {	    	
+			    //  Internet Explorer has a funky execScript method that makes this easy
+			    if ( window.execScript )
+			    {
+			        window.execScript( scripts[i].innerHTML );
+			    }
+			    else if ( window.eval )
+			    {
+			    	with( window )
+			    	{
+			    		window.eval( scripts[i].innerHTML );
+			    	}
+			    }
+		    }
+		}
+
+		if ( BrowserUtility.__isSafari() || BrowserUtility.__isKHTML() )
+		{
+			// add the styles explicitly into the head
+			var styles = container.getElementsByTagName("style");
+			for ( var i = 0; i < styles.length; i++ )
+			{
+				var style = styles[i];
+				var styleContent = style.innerHTML;
+				if ( styleContent )
+				{
+					birtUtility.addStyleSheet( styleContent );
+				}
+			}
+		}
+		
+		// workaround for bug 165750, overflow-x and overflow-y only used in IE
+		if( BrowserUtility.__isIE( ) )
+		{
+			container.style.overflowX = "visible";
+			container.style.overflowY = "visible";
+		}
+		
+		this.__postRender(id);
+	},
+	
+	/**
+	 *	Called after the component content is rendered.	 
+	 *
+	 *	@id, ui object id
+	 *	@return, void
+	 */	
+	__postRender : function( id )
+	{
+		//implementation is left to extending class
+	},
+		
+	/**
+	 *	Install native/birt event handlers.
+	 *
+	 *	@id, table object id
+	 *	@return, void
+	 */
+	__cb_installEventHandlers : function( id, children, bookmark, type )
+	{
+		if ( this.__local_installEventHandlers )
+		{
+			this.__local_installEventHandlers( id, children, bookmark, type );
+		}
+		
+		var container = $( id );
+
+		container[ Constants.reportBase ] = ( type != 'Group' && type != 'ColumnInfo');
+		container[ Constants.activeIds ] = [ ]; // Need to remember active children
+		container[ Constants.activeIdTypes ] = [ ]; // Need to remember active children types
+		
+		if ( !children )
+		{
+			return;
+		}
+
+		// Also need to take care the active children.
+		for( var i = 0; i < children.length; i++ )
+		{
+			var oElementIds = children[i].getElementsByTagName( 'Id' );
+			var oElementTypes = children[i].getElementsByTagName( 'Type' );
+
+			var birtObj = ReportComponentIdRegistry.getObjectForType( oElementTypes[0].firstChild.data );
+			
+			if ( !birtObj || !birtObj.__cb_installEventHandlers )
+			{
+				continue;
+			}
+			
+			container[ Constants.activeIds ].push( oElementIds[0].firstChild.data );
+			container[ Constants.activeIdTypes ].push( oElementTypes[0].firstChild.data );
+
+			birtObj.__cb_installEventHandlers( oElementIds[0].firstChild.data, null, null, oElementTypes[0].firstChild.data );
+		}
+	},
+	
+	/**
+	 *	Unregister any birt event handlers.
+	 *	Remove local event listeners
+	 *
+	 *	@id, object id
+	 *	@return, void
+	 */
+	__cb_disposeEventHandlers : function( id, type )
+	{
+		if ( this.__local_disposeEventHandlers )
+		{
+			this.__local_disposeEventHandlers( id, type );
+		}
+
+		var container = $( id );
+		
+		var id = null;
+		while( container[ Constants.activeIds ].length > 0 )
+		{
+			var id = container[ Constants.activeIds ].shift( )
+			var type = container[ Constants.activeIdTypes ].shift( );
+			var birtObj = ReportComponentIdRegistry.getObjectForType( type );
+			if ( !birtObj || !birtObj.__cb_disposeEventHandlers )
+			{
+				continue;
+			}
+			birtObj.__cb_disposeEventHandlers( id, type );
+		}
+	}
+}
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/AbstractReportComponent.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,239 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	BirtReportDocument
+ *	...
+ */
+BirtReportDocument = Class.create( );
+
+BirtReportDocument.prototype = Object.extend( new AbstractBaseReportDocument( ),
+{
+	/**
+	 *	Initialization routine required by "ProtoType" lib.
+	 *
+	 *	@return, void
+	 */
+	initialize : function( id, tocElement )
+	{
+		this.__instance = $( id );
+		this.__tocElement = tocElement;
+		this.__neh_resize( );
+		this.__has_svg_support = hasSVGSupport;
+		
+		//	Prepare closures.
+		this.__neh_resize_closure = this.__neh_resize.bindAsEventListener( this );
+		this.__beh_getPage_closure = this.__beh_getPage.bind( this );
+		this.__beh_getPageInit_closure = this.__beh_getPageInit.bind( this );
+		this.__beh_changeParameter_closure = this.__beh_changeParameter.bind( this );
+		this.__beh_toc_closure = this.__beh_toc.bindAsEventListener( this );
+		this.__beh_cacheParameter_closure = this.__beh_cacheParameter.bind( this );
+		this.__beh_printServer_closure = this.__beh_printServer.bind( this );
+		this.__beh_print_closure = this.__beh_print.bind( this );
+		this.__beh_pdf_closure = this.__beh_pdf.bind( this );
+		this.__beh_cancelTask_closure = this.__beh_cancelTask.bind( this );
+		this.__beh_getPageAll_closure = this.__beh_getPageAll.bind( this );
+		this.__beh_exportReport_closure = this.__beh_exportReport.bind( this );
+				
+		Event.observe( window, 'resize', this.__neh_resize_closure, false );
+		
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_GETPAGE, this.__instance.id, this.__beh_getPage_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_GETPAGE_INIT, this.__instance.id, this.__beh_getPageInit_closure );		
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_PARAMETER, this.__instance.id, this.__beh_parameter );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_CHANGE_PARAMETER, this.__instance.id, this.__beh_changeParameter_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_CASCADING_PARAMETER, this.__instance.id, this.__beh_cascadingParameter );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_TOC, this.__instance.id, this.__beh_toc_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_QUERY_EXPORT, this.__instance.id, this.__beh_export );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_CACHE_PARAMETER, this.__instance.id, this.__beh_cacheParameter_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_PRINT, this.__instance.id, this.__beh_print_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_PRINT_SERVER, this.__instance.id, this.__beh_printServer_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_PDF, this.__instance.id, this.__beh_pdf_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_CANCEL_TASK, this.__instance.id, this.__beh_cancelTask_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_GETPAGE_ALL, this.__instance.id, this.__beh_getPageAll_closure );
+		birtEventDispatcher.registerEventHandler( birtEvent.__E_EXPORT_REPORT, this.__instance.id, this.__beh_exportReport_closure );
+						
+  		birtGetUpdatedObjectsResponseHandler.addAssociation( "Docum", this );
+  		
+		// TODO: rename it to birt event
+		this.__cb_installEventHandlers( id );
+	},
+
+	/**
+	 *	Birt event handler for "cache parameter" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_cacheParameter : function( id )
+	{
+		if ( birtParameterDialog.__parameter > 0 )
+		{
+	        birtParameterDialog.__parameter.length = birtParameterDialog.__parameter.length - 1;
+		}
+        birtSoapRequest.addOperation( Constants.documentId, Constants.Document,
+        							  "CacheParameter", null, birtParameterDialog.__parameter );
+		birtSoapRequest.setURL( soapURL );
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		return true;
+	},
+
+	/**
+	 *	Birt event handler for "PrintServer" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_printServer : function( id )
+	{
+		birtPrintReportServerDialog.__cb_bind( );
+	},
+
+	/**
+	 *	Birt event handler for "print" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_print : function( id )
+	{
+		birtPrintReportDialog.__cb_bind( );
+	},
+	
+	/**
+	 *	Birt event handler for "pdf" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_pdf : function( id )
+	{	
+		var docObj = document.getElementById( "Document" );
+		if ( !docObj || birtUtility.trim( docObj.innerHTML ).length <= 0)
+		{
+			alert ( Constants.error.generateReportFirst );	
+			return;
+		}	
+		else
+		{	
+			var divObj = document.createElement( "DIV" );
+			document.body.appendChild( divObj );
+			divObj.style.display = "none";
+		
+			var formObj = document.createElement( "FORM" );
+			divObj.appendChild( formObj );
+
+			// Replace "html" to "pdf"
+			var action = soapURL;
+			var reg = new RegExp( "([&|?]{1}__format\s*)=([^&|^#]*)", "gi" );
+			if( action.search( reg ) < 0 )
+			{
+				action = action + "&__format=pdf";
+			}
+			else
+			{
+				action = action.replace( reg, "$1=pdf" );
+			}
+			
+			// Force "__overwrite" as false
+			reg = new RegExp( "([&|?]{1}__overwrite\s*)=([^&|^#]*)", "gi" );
+			if( action.search( reg ) < 0 )
+			{
+				action = action + "&__overwrite=false";
+			}
+			else
+			{
+				action = action.replace( reg, "$1=false" );
+			}
+						
+			formObj.action = action;
+			formObj.method = "post";			
+			formObj.submit( );
+		}
+	},
+
+	/**
+	 *	Birt event handler for "CancelTask" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_cancelTask : function( id, object )
+	{	
+        birtSoapRequest.addOperation( Constants.documentId, Constants.Document, "CancelTask", null, object );
+		birtSoapRequest.setURL( soapURL );
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		return true;
+	},
+	
+	/**
+	 *	Birt event handler for "GetPageAll" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_getPageAll : function( id, object )
+	{	
+		// set task id
+		var taskid = birtUtility.setTaskId( );
+		
+		if( object )
+		{
+	        birtSoapRequest.addOperation( Constants.documentId, Constants.Document, "GetPageAll",
+	        							   null, birtParameterDialog.__parameter, object,
+	        							   { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+	        							   { name : Constants.PARAM_TASKID, value : taskid } );
+		}
+		else
+		{
+	        birtSoapRequest.addOperation( Constants.documentId, Constants.Document, "GetPageAll",
+	        							   null, birtParameterDialog.__parameter,
+        							       { name : Constants.PARAM_SVG, value : this.__has_svg_support? "true" : "false" },
+	        							   { name : Constants.PARAM_TASKID, value : taskid } );			
+		}
+		birtSoapRequest.setURL( soapURL );
+		birtEventDispatcher.setFocusId( null );	// Clear out current focusid.
+		birtProgressBar.setRedirect( true );
+		return true;
+	},
+
+	/**
+	 *	Birt event handler for "ExportReport" event.
+	 *
+	 *	@id, document id (optional since there's only one document instance)
+	 *	@return, true indicating server call
+	 */
+	__beh_exportReport : function( id )
+	{
+		birtExportReportDialog.__cb_bind( );
+	},
+	
+	/**
+	 *	Called after the component content is rendered.	 
+	 *
+	 *	@id, ui object id
+	 *	@return, void
+	 */	
+	__postRender : function( id )
+	{
+		// ensures that the rendered component is the report document
+		if ( id == "Document" )
+		{
+			var docObj = document.getElementById( id );
+			if ( docObj )
+			{
+				// set document scrollbar position to the top
+				docObj.scrollTop = "0px";				
+				this.__neh_resize();
+			}
+		}
+	}
+	
+});
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/BirtReportDocument.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,128 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+
+/** 
+ * Class ReportComponentIdRegistry 
+ */
+ReportComponentIdRegistry =
+{
+	types:
+	{
+		DOCUMENT : null,
+		TABLE : null,
+		LABEL : null,
+		CHART : null,
+		TABLE_T : null,
+		LABEL_T : null,
+		CHART_T : null
+	},
+	
+	ids: {},
+	
+	getDocumentType : function( )
+	{
+		return 'DOCUMENT';
+	},
+	
+	getTableType : function( )
+	{
+		return 'TABLE';
+	},
+	
+	getLabelType : function( )
+	{
+		return 'LABEL';
+	},
+	
+	getChartType : function( )
+	{
+		return 'CHART';
+	},
+	
+	getTemplateTableType : function( )
+	{
+		return 'TABLE_T';
+	},
+	
+	getTemplateLabelType : function( )
+	{
+		return 'LABEL_T';
+	},
+	
+	getTemplateChartType : function( )
+	{
+		return 'CHART_T';
+	},
+	
+	getTypeForId : function( id )
+	{
+		if ( this.ids[id] )
+		{
+			return this.ids[id];
+		}
+		return null;
+	},
+
+	setHandlerObjectForType : function( object, type )
+	{
+		for ( var i in this.types )
+		{
+			if ( i == type )
+			{
+				this.types[i] = object;
+				return;
+			}
+		}
+	},
+	
+	getObjectForId : function( id )
+	{
+		var type = this.getTypeForId( id );
+		if ( type )
+		{
+			return this.types[type];
+		}
+		return null;
+	},
+	
+	getObjectForType : function( type )
+	{
+		if ( type )
+		{
+			if ( type.toUpperCase( ) == 'Group'.toUpperCase( )
+					|| type.toUpperCase( ) == 'ColumnInfo'.toUpperCase( ) )
+			{
+				return this.types['TABLE'];
+			}
+			else
+			{
+				return this.types[type.toUpperCase( )];
+			}
+		}
+		
+		return null;
+		
+	},
+
+	addId : function( id, type )
+	{
+		this.ids[id] = type;
+	},
+	
+	removeId : function( id )
+	{
+		if ( this.ids[id] )
+		{
+			this.ids[id] = null;
+			delete this.ids[id];
+		}
+	}	
+};

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/ui/report/ReportComponentIdRegistry.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,56 @@
+/******************************************************************************
+ *	Copyright (c) 2004 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+ 
+/**
+ *	BirtPosition.
+ *	We could extend Position from Ruby.
+ */
+var BirtPosition =
+{
+	viewportHeight: function( )
+	{
+		if (window.innerHeight!=window.undefined) return window.innerHeight;
+		if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
+		if (document.body) return document.body.clientHeight; 
+		return window.undefined; 
+	},
+	
+	viewportWidth: function( )
+	{
+		if (window.innerWidth!=window.undefined) return window.innerWidth; 
+		if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth; 
+		if (document.body) return document.body.clientWidth; 
+		return window.undefined; 
+	},
+	
+	center: function( )
+	{
+      	var element = $( arguments[0] );
+      	if ( !element ) return;
+      	
+		var scTop = parseInt( document.documentElement.scrollTop, 10 );
+		var scLeft = parseInt( document.documentElement.scrollLeft, 10 );
+
+		element.style.top = ( scTop + ( ( this.viewportHeight( ) - element.offsetHeight ) / 2 ) ) + "px";
+		element.style.left =  ( scLeft + ( ( this.viewportWidth( ) - element.offsetWidth ) / 2 ) ) + "px";
+    },
+
+	move: function( element, x, y )
+	{
+      	if ( !element ) return;
+      	
+		var scTop = parseInt( document.documentElement.scrollTop, 10 );
+		var scLeft = parseInt( document.documentElement.scrollLeft, 10 );
+
+		element.style.top = scTop + y + "px";
+		element.style.left = scLeft + x + "px";
+    }
+}
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtPosition.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,854 @@
+/******************************************************************************
+ *	Copyright (c) 2004-2008 Actuate Corporation and others.
+ *	All rights reserved. This program and the accompanying materials 
+ *	are made available under the terms of the Eclipse Public License v1.0
+ *	which accompanies this distribution, and is available at
+ *		http://www.eclipse.org/legal/epl-v10.html
+ *	
+ *	Contributors:
+ *		Actuate Corporation - Initial implementation.
+ *****************************************************************************/
+
+/**
+ * All shared utility functions should be put here.
+ */
+
+BirtUtility = function( ) { };
+
+BirtUtility.prototype =
+{
+	/**
+	 * The input control to save 'taskid'
+	 */
+	__task_id : 'taskid',
+	
+	/**
+	 * URL parameter to indicate the client DPI setting
+	 */
+	__PARAM_DPI : '__dpi',
+
+	/**
+	 * @returns true if left button was pressed
+	 */
+	isLeftButton : function( event )
+	{
+		return Event.isLeftClick( event ); //prototype library function	
+	},
+	
+	/**
+	 * Recursively removes all element child nodes
+	 * @param element DOM element
+	 */
+	removeChildren : function( element )
+	{
+		while( element.childNodes.length > 0 )
+		{
+			if( element.firstChild.childNodes.length > 0 )
+			{
+				this.removeChildren( element.firstChild );
+			}
+			element.removeChild( element.firstChild );
+		}
+	},
+
+	haveTagName : function( domTree, tag )
+	{
+		return ( ( domTree.getElementsByTagName( tag ).length == 0 ) ? false : true );
+	},
+
+	/**
+	 * It returns the data value of a single DOM leaf node
+	 */
+	getDataReponseLeaf : function( leaf )
+	{
+		return( leaf[0].firstChild.data );
+	},
+	
+	/**
+	 * It is constructor function for creating object based on the leaf node of SOAP response DOM tree 
+	 * The idea is from the Element function of WRScrollLayout.js
+	 * @param it - leaf node of SOAP response DOM tree
+	 * @returns object that consists of content of the input "item"
+	 */	
+	extractResponseLeaf : function( item, newObject )
+	{
+		var children = item.childNodes;
+		var size = children.length;
+		for( var i = 0; i < size; i++ )
+		{	
+			if( children[i].nodeType == "1" )
+			{
+				var childi = children[i];
+				var nName = children[i].nodeName;
+				var nData = null;
+				if( children[i].firstChild && children[i].firstChild.data )
+				{
+					nData = children[i].firstChild.data;					
+				}
+				newObject[ nName ] = nData;			
+			}	
+		}		
+	},
+
+	/**
+	 * It is recursive function to find all text contents under a DOM node.
+	 * @param node - root node of the DOM tree. We traverse recursively from here.
+	 * @param resultArray - The result are stored in this array during tree traversal.
+	 * @returns void
+	 */	
+	findAllTextchild : function( node, resultArray )
+	{
+		if ( node.nodeType == 3 )
+		{
+			// Text node
+			resultArray[ resultArray.length ] = node.data;
+		}
+		else
+		{
+			// Recursively traverse the tree
+			var kids = node.childNodes;
+			for ( var i = 0; i < node.childNodes.length; i++ )
+			{
+				this.findAllTextchild( kids[i], resultArray );
+			}
+		}
+	},
+	
+	setTextContent : function( node, textString )
+	{
+
+		if ( node.textContent != undefined )
+		{
+			// For example, Firefox.
+			node.textContent = textString;
+		}
+		else if ( node.innerText != undefined )
+		{
+			// For example, IE.
+			node.innerText = textString;
+		}
+	},
+	
+	/**
+	 * Fire a simulated mouse event on an html element
+	 * @param element html element to fire event on
+	 * @param eventName - name of mouse event such as 'click' or 'mousedown'
+	 * @param ctrlKey - optional,if present, event will be fired with control key pressed	
+	 */
+	fireMouseEvent : function( element, eventName, ctrlKey )
+	{
+		var evt;
+		var ctrl = ctrlKey || false;
+		if( element.fireEvent )
+		{
+			evt = document.createEventObject( );
+			evt.ctrlKey = ctrl;
+			evt.button = 1;
+			element.fireEvent( "on" + eventName, evt );
+		}
+		else if( element.dispatchEvent )
+		{
+			evt = document.createEvent( "MouseEvents" );
+			evt.initMouseEvent( eventName, false, 
+				true, undefined, undefined,
+				0, 0, 0, 0,
+				ctrl,
+				false,
+				false, false, 1,
+				undefined );
+			element.dispatchEvent( evt );
+		}
+		else
+		{
+			return null;
+		}
+		return evt;
+	},
+
+	/**
+	@returns boolean true if checked, false otherwise
+	*/
+	setCheckBoxChecked : function( checkbox, checked )
+	{
+		// Both IE and Firefox have defaultChecked property. But they use it differently.
+		// On Firefox, the GUI box is checked when checkbox.checked is true.
+		// It is not true for IE. On IE, we also need to set checkbox.defaultChecked.
+		// I guess when the checkbox is FIRST shown, IE uses checkbox.defaultChecked to determine the GUI.
+		checkbox.defaultChecked = checked;
+		checkbox.checked = checked;
+		return checked;
+	},
+
+	/**
+	 * Get a parameter specified in the URL. For example, if a URL is
+	 * http://localhost:8080/iportal/wr?__report=/16.webrptdesign&iPortalID=YPTDAGCNPOYSOS
+	 * getURLParameter(iPortalID) will return &iPortalID=YPTDAGCNPOYSOS
+	 */
+	getURLParameter: function ( url, parameterName )
+	{
+		var paramString = "";
+		var paramStartIndex = url.indexOf( parameterName );
+		var equalSign = url.charAt(paramStartIndex + parameterName.length);
+		
+		if ( paramStartIndex >= 0 && ( equalSign == "=" || equalSign == "&" ) )
+		{
+			var paramEndIndex = url.indexOf( "&", paramStartIndex );
+			if ( paramEndIndex >= 0 )
+			{
+				paramString = "&" + url.substring( paramStartIndex, paramEndIndex );
+			}
+			else
+			{
+				paramString = "&" + url.substring( paramStartIndex ); // get the substring till the end.					
+			}
+		}
+		return paramString;
+	},
+	
+	/**
+	 * Adds a parameter to a given URL.
+	 */
+	addURLParameter : function ( url, parameterName, parameterValue )
+	{
+		var paramPart = encodeURI(parameterName) + "=" + encodeURI(parameterValue)
+		var lastChar = url.charAt(url.length - 1); 
+		if ( lastChar != "&" && lastChar != "?" )
+		{
+			if ( url.indexOf("?") > 0 )
+			{
+				paramPart = "&" + paramPart;
+			}
+			else
+			{
+				paramPart += "?" + paramPart;
+			}		
+		}
+		
+		var anchorPos = url.lastIndexOf("#");
+		if ( anchorPos >= 0 )
+		{
+			// insert the param part before the anchor
+			url = url.substr(url, anchorPos - 1) + paramPart + url.substr(anchorPos);
+		}
+		else
+		{
+			url += paramPart;
+		}
+		return url;
+	},
+	
+	/**
+	 * Deletes a parameter specified in the given URL.
+	 * If for example the given URL is the following http://localhost/myUrl?param1=2&param2=3&param3=4
+	 * and the value of parameterName is "param2", the resulting URL will be:
+	 * http://localhost/myUrl?param1=2&param3=4
+	 * @param url url to process
+	 * @param parameterName parameter to remove
+	 * @return processed url
+	 */
+	deleteURLParameter : function(url, parameterName )
+	{
+		var reg = new RegExp( "([&|?]{1})" + escape(encodeURIComponent(parameterName)) + "\s*=[^&|^#]*", "gi" );
+		return url.replace( reg, "$1");		
+	},
+	
+	/**
+	 * Removes the URL anchor.
+	 */
+	deleteURLAnchor : function(url)
+	{
+		return url.replace( /#[a-zA-Z0-9\-_\$]*$/, "" );
+	},
+	
+	/**
+	 * Creates a hidden input form field.
+	 * @param formObj form object
+	 * @param paramName parameter name
+	 * @param paramValue parameter value
+	 * @return the newly created input element
+	 */
+	addHiddenFormField : function(formObj, paramName, paramValue)
+	{
+		var param = document.createElement( "INPUT" );
+		formObj.appendChild( param );
+		param.TYPE = "HIDDEN";
+		param.name = paramName;
+		param.value = paramValue;
+		return param;
+	},
+	
+	/**
+	 * Insert a string into the cursor position of a textarea.<b> 
+	 * textarea: DOM element of textarea to be inserted.
+	 * string: string to be inserted into the textarea.
+	 */	
+	insertStringCursorPosTextarea: function( textarea, string )
+	{
+		if ( textarea.selectionStart != undefined )
+		{
+			// Firefox
+			var startPos = textarea.selectionStart;
+			var endPos = textarea.selectionEnd;
+			textarea.value = textarea.value.substring( 0, startPos )+ string + textarea.value.substring( endPos, textarea.value.length );			
+		}
+		else
+		{
+			// IE
+			textarea.focus();
+			var range = document.selection.createRange();
+			range.text = string;
+		}
+	},
+
+	/**
+	 * Insert a string into the specified position of a textarea.<b> 
+	 * textarea: DOM element of textarea to be inserted.
+	 * pos: For Firefox, it is an integer. For IE, it is an TextRange object.
+	 * string: string to be inserted into the textarea.
+	 */	
+	insertStringTextarea: function( textarea, pos, string )
+	{
+		if ( textarea.selectionStart != undefined )
+		{
+			// Firefox
+			
+			if ( pos == undefined || pos == null )
+				pos = 0;
+				
+			textarea.value = textarea.value.substring( 0, pos )+ string + textarea.value.substring( pos, textarea.value.length );		
+		}
+		else
+		{
+			// IE
+			
+			textarea.focus( );
+			
+			if (pos == undefined || pos == null )
+				pos = document.selection.createRange();
+			
+			pos.text = string;	
+		}
+	},
+	
+	// get the cursor position of the textarea
+	getCursorPosTextarea: function( textarea )
+	{
+		if ( textarea.selectionStart != undefined )
+		{
+			// Firefox
+			return( textarea.selectionEnd );		
+		}
+		else
+		{
+			// IE
+			textarea.focus( );
+			return( document.selection.createRange( ) );
+		}
+	},	
+	
+	// IE and Firefox behave so differently to insert a string into cursor position of text area.
+	// So, we create this preferred method. This method subsequently call other methods of string insertion based on browser type.
+	preferredInsertStringTextarea: function( textarea, pos, string )
+	{
+		if ( textarea.selectionStart != undefined )
+		{
+			// Firefox
+			this.insertStringCursorPosTextarea( textarea, string );		
+		}
+		else
+		{
+			// IE
+			this.insertStringTextarea( textarea, pos, string );			
+		}		
+	},
+	
+	// id: tableId
+	getSelectedTableColumns: function( id )
+	{
+ 		var handlerObject = ReportComponentIdRegistry.getObjectForId(id);
+ 		var tableInstance = handlerObject.selectionManager.getTableInstanceById(id);
+ 		var table = $( id );
+ 		var iid = table.iid;
+ 		
+ 		//check that there is at least one column selected		
+ 		var selectedColumns = tableInstance.getRLOrderedSelectedColumns();
+ 		if( !selectedColumns )
+ 		{
+ 			// #IV TODO integrate with IV error handling
+ 			throw new WRError("WRReportTable", "Must have one or more columns to apply format");
+ 		}
+ 		
+ 		return selectedColumns;
+ 	},
+ 	
+	// trim left blanks
+	ltrim: function ( str )
+	{
+		return str.replace( /^\s*/, '');
+	},
+	
+	// trim right blanks
+	rtrim: function ( str )
+	{
+		return str.replace( /\s*$/, ''); 
+	},
+
+	// trim left and right blanks
+	trim: function ( str )
+	{
+		return this.rtrim( this.ltrim( str ) );
+	},
+	
+	// set button if disabled
+	setButtonsDisabled: function ( target, flag )
+	{
+		if ( !target )
+			return;
+			
+		var oTarget = $( target );
+		var oIEC;
+		
+		if ( oTarget )
+			oIEC = oTarget.getElementsByTagName( "INPUT" );
+			
+		if ( oIEC )
+		{
+			for( var i = 0; i < oIEC.length; i++ )
+			{
+				oIEC[i].disabled = flag;
+			}		
+		}
+	},
+	
+	// set current task id
+	setTaskId: function( id )
+	{
+		var taskid;
+		if( id )
+		{
+			// if pass id
+			taskid = id;
+		}
+		else
+		{
+			// use time stamp
+			var d = new Date( );
+			taskid = d.getFullYear( );
+			taskid += "-" + d.getMonth( );
+			taskid += "-" + d.getDate( );
+			taskid += "-" + d.getHours( );
+			taskid += "-" + d.getMinutes( );
+			taskid += "-" + d.getSeconds( );
+			taskid += "-" + d.getMilliseconds();
+		}
+		
+		// find taskid input control
+		var oTaskId = $( this.__task_id );
+		if( oTaskId )
+			oTaskId.value = taskid;
+		
+		return taskid;
+	},
+	
+	// get current task id
+	getTaskId: function( )
+	{
+		// find taskid input control
+		var oTaskId = $( this.__task_id );
+		if( oTaskId )
+			return this.trim( oTaskId.value );
+			
+		return "";	
+	},
+
+	// clear current task id
+	clearTaskId: function( )
+	{
+		// find taskid input control
+		var oTaskId = $( this.__task_id );
+		if( oTaskId )
+			oTaskId.value = '';			
+	},
+	
+	// get current page number
+	getPageNumber: function( )
+	{
+		var oPage = $( 'pageNumber' );
+		var pageNum = 0;
+		if( oPage )
+			pageNum = parseInt( this.trim( oPage.innerHTML ) );
+			
+		return pageNum;
+	},
+
+	// get total page number
+	getTotalPageNumber: function( )
+	{
+		var pageNum = 0;
+		var oPage = $( 'totalPage' );
+		if ( oPage )
+		{
+			pageNum = ( oPage.firstChild.data == '+' )? '+' : parseInt( oPage.firstChild.data );		
+		}
+			
+		return pageNum;
+	},
+	
+	/**
+	 * Checks the given page range syntax is valid, and if the page exist.
+	 * @param range in the format "1-4,6,7"
+	 * @return true if the range is correct 
+	 */
+	checkPageRange: function( range )
+	{
+		if ( !range )
+		{
+			return false;
+		}
+		var myRange = birtUtility.trim(range);
+
+		// check if the range format is correct
+		if ( !myRange.match( /^[0-9]+\s*(-\s*[0-9]+)?(\s*,\s*[0-9]+(-[0-9]+)?)*$/ ) )
+		{
+			return false;
+		}	
+		
+		var lastPage = this.getTotalPageNumber();
+		
+		// split the range parts
+		var parts = myRange.split(",");
+		for ( i = 0; i < parts.length; i++ )
+		{
+			var part = parts[i];			
+			var boundaries = part.split("-");
+
+			// page range
+			if ( boundaries.length == 2 )
+			{
+				var pageStart = parseInt( boundaries[0] );
+				var pageEnd = parseInt( boundaries[1] );
+				if ( isNaN( pageStart ) || isNaN( pageEnd ) 
+					|| pageEnd <= pageStart || pageStart < 1 || pageEnd < 1
+					|| pageStart > lastPage || pageEnd > lastPage )
+				{
+					return false;
+				}
+			}
+			// single page number
+			else if ( boundaries.length == 1 )
+			{
+				var pageNum = parseInt( boundaries[0] ); 
+				if ( isNaN( pageNum ) || pageNum < 1 || pageNum > lastPage )
+				{
+					return false;
+				}
+			}
+			// invalid format
+			else
+			{
+				return false;
+			}			
+		}
+		return true;
+	},
+	
+	/**
+	 * Adds the current session id to the given url and returns it.
+	 * If a session id already exists in the url, does nothing.
+	 * @return processed url
+	 */
+	initSessionId : function( url )
+	{
+		// remove existing session id from the URL
+		url = birtUtility.deleteURLParameter(url, Constants.PARAM_SESSION_ID);
+		
+		// add session id in SOAP URL
+		if ( Constants.viewingSessionId )
+		{
+			url = birtUtility.addURLParameter( url, Constants.PARAM_SESSION_ID, Constants.viewingSessionId);
+		}
+		return url;
+	},
+	
+	/**
+	 * Initialize the client DPI setting
+	 * 
+	 * @param, url
+	 * @return, string
+	 */
+	initDPI : function( url )
+	{
+		var href;
+		
+		try
+		{
+			if( url )
+			{
+				href = url;
+			}
+			else
+			{
+				href = document.location.href;
+			}
+			
+			var dpi;
+			if( screen.deviceXDPI )
+				dpi = screen.deviceXDPI;
+			
+			if( dpi )
+			{
+				var reg = new RegExp( "([&|?]{1}" + this.__PARAM_DPI + "\s*)=([^&|^#]*)", "gi" );
+				if( href.search( reg ) < 0 )
+					href = href + "&" + this.__PARAM_DPI + "=" + dpi;
+			}			
+		}
+		catch(e)
+		{}
+		
+		return href;		
+	},
+	
+	/**
+	 * Move selected items up
+	 */
+	moveSelectedItemsUp : function( list )
+	{
+		if( !list || list.selectedIndex < 0 )
+			return;
+		
+		var i = 0; 
+		var value = ""; 
+		var text = ""; 
+		for( i=0; i<(list.options.length-1); i++ ) 
+		{ 
+			if (!list.options[i].selected && list.options[i+1].selected) 
+			{ 
+				value = list.options[i].value; 
+				text = list.options[i].text; 
+				list.options[i] = new Option(list.options[i+1].text, list.options[i+1].value); 
+				list.options[i].selected = true; 
+				list.options[i+1] = new Option(text, value); 
+			} 
+		}			
+	},
+	
+	/**
+	 * Move selected items down
+	 */
+	moveSelectedItemsDown : function( list )
+	{
+		if( !list || list.selectedIndex < 0 )
+			return;
+		
+		var i = 0; 
+		var value = ""; 
+		var text = ""; 
+		for( i=list.options.length-1; i>0; i-- ) 
+		{
+			if (!list.options[i].selected && list.options[i-1].selected) 
+			{
+				value = list.options[i].value; 
+				text = list.options[i].text; 
+				list.options[i] = new Option(list.options[i-1].text, list.options[i-1].value); 
+				list.options[i].selected = true; 
+				list.options[i-1] = new Option(text, value); 
+			} 
+		} 	
+	},
+	
+	/**
+	 * Formats the given messages by putting the given values in
+	 * the placeholders. The placeholder format is {0}, {1}, ...
+	 * @param message template text containing placeholders
+	 * @param params an array of values to put into the placeholders, 
+	 * or a single string
+	 * @return formatted text 
+	 */
+	formatMessage : function( message, params )
+	{
+		if ( !message )
+		{
+			return;
+		}
+		
+		if ( !params )
+		{
+			return message;
+		}
+
+		if ( !(params.constructor == Array) )
+		{
+			params = new Array(params);
+		}		
+
+		for ( i = 0; i < params.length; i++ )
+		{
+			var pattern = new RegExp("\\\{" + i + "\\\}","g");
+			message = message.replace(pattern, params[i]);
+		}
+		return message;
+	},
+	
+	/**
+	 *  This method is a workaround for a Mozilla/Firefox bug which prevents some HTML 
+	 * elements to be resized properly when a contained element's "display" style has
+	 * been changed.
+	 * The refresh is done by moving the element back and forth one pixel.
+	 */
+	refreshElement : function( htmlElement )
+	{
+		var currentLeft = parseInt(htmlElement.style.left);
+		var currentTop = parseInt(htmlElement.style.top);
+		// shake it!
+		htmlElement.style.left = (currentLeft - 1) + "px";
+		htmlElement.style.top = (currentTop - 1) + "px";
+		htmlElement.style.left = currentLeft + "px";
+		htmlElement.style.top = currentTop + "px";
+	},
+	
+	/**
+	 * Do html decode for input string
+	 * 
+	 */
+	htmlDecode : function( str )
+	{
+		if( !str )
+			return null;
+		
+		// Replaces all HTML encoded string with original character. 
+		str = str.replace( /&#09;/g, "\t" );
+		str = str.replace( /<br>/g, "\n" );
+		str = str.replace( /&#13;/g, "\r" );
+		str = str.replace( /&#32;/g, " " );
+		str = str.replace( /&#34;/g, "\"" );
+		str = str.replace( /&#39;/g, "'" );
+		str = str.replace( /&#60;/g, "<" );
+		str = str.replace( /&#62;/g, ">" );
+		str = str.replace( /&#96;/g, "`" );
+		str = str.replace( /&#38;/g, "&" );
+		str = str.replace( /&#92;/g, "\\" );
+		str = str.replace( /&#47;/g, "/" );
+
+		return str;
+	},
+
+	_TABBABLE_TAGS : new Array("A","BUTTON","TEXTAREA","INPUT","IFRAME", "SELECT"),
+	
+	/**
+	 * Disables the tab indexs for all the tabbable elements
+	 * which are children of the given element.
+	 * @param element element
+	 */
+	disableTabIndexes : function(element)
+	{
+		for (var j = 0; j < this._TABBABLE_TAGS.length; j++)
+		{
+			var tagElements = element.getElementsByTagName(this._TABBABLE_TAGS[j]);
+			for (var k = 0 ; k < tagElements.length; k++)
+			{
+				var el = tagElements[k];
+				el._tabIndexSaved = el.tabIndex;
+				el.tabIndex="-1";
+			}
+		}
+	},
+
+	/**
+	 * Restores the tab indexs for all the tabbable elements
+	 * which are children of the given element.
+	 * @param element element
+	 */
+	restoreTabIndexes : function(element) {
+		for (var j = 0; j < this._TABBABLE_TAGS.length; j++)
+		{
+			var tagElements = element.getElementsByTagName(this._TABBABLE_TAGS[j]);
+			for (var k = 0 ; k < tagElements.length; k++)
+			{
+				var el = tagElements[k]; 
+				if ( el._tabIndexSaved )
+				{
+					el.tabIndex = el._tabIndexSaved;
+					el._tabIndexSaved = null;
+				}
+				else
+				{
+					el.tabIndex = null;
+				}
+			}
+		}
+	},
+
+
+	/**
+ 	 * Returns the HEAD element of the page.
+	 */
+	getHeadElement : function()
+	{
+		if ( !this._headElement )
+		{
+			this._headElement = document.getElementsByTagName("head")[0];
+		}
+		return this._headElement;
+	},
+
+	/**
+	* Adds a style sheet into the managed document.
+	* @param styleContent style sheet content
+	*/
+	addStyleSheet : function( styleContent )
+	{
+
+
+		var element = document.createElement("style");
+		element.type = "text/css";
+		if ( element.styleSheet )
+		{
+			element.styleSheet.cssText = styleContent;
+		}
+		else
+		{
+			element.appendChild( document.createTextNode( styleContent ) );
+		}			
+		this.getHeadElement().appendChild( element );
+	},
+	
+	noComma : "" //just to avoid javascript syntax errors
+}
+
+var birtUtility = new BirtUtility( );
+
+/**
+ *	Extend prototype's Event.
+ *	TODO: probably need a prototype extension.
+ */
+Event.prototype = Object.extend( Event,
+{
+	/**
+	 *	Extension to prototype 'Event' since Event.stop(event) isn't
+	 *	stopping in ie
+	 */
+	stop: function( event )
+	{
+		event.cancelBubble = true;
+		
+		if ( event.preventDefault )
+		{ 
+			event.preventDefault( );
+			event.stopPropagation( );
+	    }
+	    else
+	    {
+			event.returnValue = false;
+	    }
+	},
+	
+	/**
+	 *	Stops click from propigating without using .bindAsEventListener
+	 */
+	colClickStop: function( e )
+	{
+ 		if (!e) var e = $("Document").contentWindow.event;
+		debug( e.type);
+		Event.stop( e );
+	}
+});
\ No newline at end of file

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BirtUtility.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js
URL: http://svn.apache.org/viewvc/ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js?rev=1579359&view=auto
==============================================================================
--- ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js (added)
+++ ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js Wed Mar 19 19:16:28 2014
@@ -0,0 +1,172 @@
+// Copyright 1994-2008, Actuate Software Corp., All rights reserved.
+
+BrowserUtility = Class.create();
+
+BrowserUtility.prototype = {
+	
+	initialize: function()
+	{
+		this.isIE = this.__isIE();
+		if ( this.isIE )
+		{
+			this.isIE6 = false;
+			this.isIE7 = false;
+			this.isIE8 = false;
+			if (document.documentMode) {
+				if (document.documentMode >= 8) {
+					this.isIE8 = true;
+				} else if (document.documentMode >= 7) {
+					this.isIE7 = true;
+				} else {
+					this.isIE6 = true;
+				}
+			}
+			else if ( window.XMLHttpRequest )
+			{
+				this.isIE7 = true;
+			}
+			else
+			{
+				this.isIE6 = true;
+			}
+		}
+
+		this.isMozilla = this.__isMozilla();
+		this.isFirefox = this.__isFirefox();
+		this.isGecko = this.__isGecko();
+		this.isSafari = this.__isSafari();
+		this.isKHTML = this.__isKHTML();
+		this.isOpera = this.__isOpera();
+		
+		if ( this.isFirefox )
+		{
+			var firefoxVersion = this._getAgentVersion("Firefox");
+			if ( firefoxVersion && firefoxVersion.length > 0 )
+			{
+				if ( firefoxVersion[0] == 2 )
+				{
+					this.isFirefox2 = true;
+				}
+				else if ( firefoxVersion[0] == 3 )
+				{
+					this.isFirefox3 = true;
+				}				
+			}
+		}
+	},
+	
+	_getAgentVersion : function( agentName )
+	{
+		var re = new RegExp(agentName + "\/([^\s])", "i");
+		var agentVersion = re.exec( navigator.userAgent );
+		if ( agentVersion && agentVersion[1] )
+		{
+			return this._getVersionComponents( agentVersion[1] );
+		}
+		else
+		{
+			return null;
+		}
+	},
+	
+	_getVersionComponents : function( versionString )
+	{
+		if ( !versionString )
+		{
+			return null;
+		}
+		return versionString.split(".");
+	},
+		
+	__isSafari: function()
+	{
+		return navigator.appVersion.match(/Safari/) != null;		
+	},
+
+	__isKHTML: function()
+	{
+		return navigator.appVersion.match(/KHTML/) != null;		
+	},
+
+	__isOpera: function()
+	{
+		return navigator.appName.match(/Opera/) != null;
+	},
+	
+	__isIE: function()
+	{
+		var userAgent = navigator.userAgent.toLowerCase();
+		var useIFrame;
+		if(userAgent.indexOf('msie') > -1)
+		{
+			//Internet Explorer
+			return true;
+			
+		}
+		else 
+		{
+			return false;
+		}
+	},
+	
+	__isMozilla : function()
+	{
+		var userAgent = navigator.userAgent.toLowerCase();
+		return (userAgent.indexOf('mozilla') > -1);
+	},
+	
+	__isFirefox : function()
+	{
+		var userAgent = navigator.userAgent.toLowerCase();
+		return (userAgent.indexOf('firefox') > -1);
+	},
+
+	__isGecko : function()
+	{
+		var userAgent = navigator.userAgent.toLowerCase();
+		return (userAgent.indexOf('gecko') > -1);
+	},
+	
+	useIFrame: function()
+	{
+		return this.isIE;
+	},
+	
+	_getScrollBarWidth : function(container, viewportWidth, viewportHeight)
+	{
+		var defaultWidth = 20;
+		
+		if (this.scrollBarWidth) {
+			return this.scrollBarWidth;
+		}
+		else if (container != null && viewportWidth > 0 && viewportHeight < container.offsetHeight)
+		{
+			var oldWidth = container.style.width;
+			var oldHeight = container.style.height;
+			var oldOverflowX = container.style.overflowX;
+			var oldOverflowY = container.style.overflowY;
+			var oldPosition = container.style.position;
+			
+			// Sets report container's styles to calculate scroll bar's width.
+			container.style.width = "";
+			container.style.height = "";
+			container.style.overflowX = "scroll";
+			container.style.overflowY = "hidden";
+			container.style.position = "relative";
+
+			this.scrollBarWidth = viewportWidth - container.offsetWidth;
+			if (this.scrollBarWidth <= 0){
+				this.scrollBarWidth = defaultWidth;
+			}
+
+			// Restors report container's old styles.
+			container.style.width = oldWidth;
+			container.style.height = oldHeight;
+			container.style.overflowX = oldOverflowX;
+			container.style.overflowY = oldOverflowY;
+			container.style.position = oldPosition;
+			return this.scrollBarWidth;
+		}
+		return defaultWidth;
+	}
+}

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js
------------------------------------------------------------------------------
    svn:keywords = Date Rev Author URL Id

Propchange: ofbiz/trunk/specialpurpose/birt/webapp/birt/webcontent/birt/ajax/utility/BrowserUtility.js
------------------------------------------------------------------------------
    svn:mime-type = text/plain