Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js
------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtExportReportDialog.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js?rev=831503&view=auto ============================================================================== --- ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js (added) +++ ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js Sat Oct 31 01:22:47 2009 @@ -0,0 +1,1767 @@ +/****************************************************************************** + * 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. + *****************************************************************************/ + +/** + * BirtParameterDialog + * ... + */ +BirtParameterDialog = Class.create( ); + +BirtParameterDialog.prototype = Object.extend( new AbstractParameterDialog( ), +{ + /** + * Parameter dialog working state. Whether embedded inside + * designer dialog. + */ + __mode : Constants.SERVLET_FRAMESET, + + /** + * Identify the parameter is null. + */ + __isnull : '__isnull', + + /** + * Prefix that identify the parameter is to set Display Text for "select" parameter + */ + __isdisplay : '__isdisplay__', + + /** + * identify the parameter value is a locale string + */ + __islocale : '__islocale', + + /** + * Prefix that identify the parameter value is a locale string + */ + __prefix_islocale : '__islocale__', + + /** + * Event handler closures. + */ + __neh_change_cascade_text_closure : null, + __neh_mouseover_select_closure : null, + __neh_mouseout_select_closurre : null, + + /** + * Check if parameter is required or not. + */ + __is_parameter_required : null, + + /** + * Check if allow parameter blank or not. + */ + __is_parameter_allowblank : null, + + /* + * Clear the sub cascading parameters + */ + __clearSubCascadingParameter : null, + + /** + * Mutex: counts the pending calls to __E_CASCADING_PARAMETER + * + * >0 if a cascading value has just been changed. + * Used to defer the ok button clicks until + * a response has been received. + */ + __pendingCascadingCalls : 0, + + /** + * Function to call after the dialog data has been updated. + * Use to defer the click to ok whenever + * an onchange event is still pending. + */ + __onDataChanged : null, + + /** + * Cancels the next onchange event. + * Used for an IE select box behaviour workaround where pressing + * a key fires onchange events. It makes the select box + * behaviour similar to the one of FireFox. + */ + __cancelOnChange : false, + + /** + * Cancels the show operation. + * This flag is used when the user clicked the cancel button and + * wants to close the dialog box, and there are pending server requests. + * The bind() method of the base class will call the __l_show() method + * after receiving the response, which would popup the dialog again. + * This flag will prevent this to happen. + */ + __cancelShow : false, + + /** + * Stores the selected index from the focused select box. (IE only) + */ + __currentSelectedIndex : null, + + + MIN_MULTILINES : 5, + MAX_MULTLIINES : 10, + + /** + * if previous is visible. + */ + preVisible: null, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id, mode ) + { + this.__mode = mode || Constants.request.servletPath; + this.preVisible = false; + + this._hint = document.getElementById( "birt_hint" ); + + // Change event for parameter text field + this.__neh_change_cascade_text_closure = this.__neh_change_cascade_text.bindAsEventListener( this ); + this.__neh_change_select_closure = this.__neh_change_select.bindAsEventListener( this ); + this.__neh_change_cascade_select_closure = this.__neh_change_cascade_select.bindAsEventListener( this ); + + if ( BrowserUtility.isIE6 ) + { + // Mouse over event for Select field + this.__neh_mouseover_select_closure = this.__neh_mouseover_select.bindAsEventListener( this ); + this.__neh_mouseout_select_closure = this.__neh_mouseout_select.bindAsEventListener( this ); + } + + if ( BrowserUtility.isIE ) + { + // Focus events + this.__neh_focus_select_closure = this.__neh_focus_select.bindAsEventListener( this ); + this.__neh_blur_select_closure = this.__neh_blur_select.bindAsEventListener( this ); + } + + this.initializeBase( id ); + + if ( this.__mode == Constants.SERVLET_PARAMETER ) + { + // Hide dialog title bar if embedded in designer. + this.__setTitleBarVisibile(false); + } + + this.__local_installEventHandlers_extend( id ); + }, + + /** + * Install native/birt event handlers. + * + * @id, toolbar id (optional since there is only one toolbar) + * @return, void + */ + __local_installEventHandlers_extend : function( id ) + { + // Observe "keydown" event + this.keydown_closure = this.__neh_keydown.bindAsEventListener( this ); + Event.observe( $(id), 'keydown', this.keydown_closure, false ); + + var oSC = document.getElementById( "parameter_table" ).getElementsByTagName( "select" ); + for( var i = 0; i < oSC.length; i++ ) + { + var element = oSC[i]; + Event.observe( element, 'change', this.__neh_change_select_closure, false ); + + if ( BrowserUtility.isIE6 ) + { + Event.observe( element, 'mouseover', this.__neh_mouseover_select_closure, false ); + Event.observe( element, 'mouseout', this.__neh_mouseout_select_closure, false ); + } + if ( BrowserUtility.isIE ) + { + Event.observe( element, 'focus', this.__neh_focus_select_closure, false ); + Event.observe( element, 'blur', this.__neh_blur_select_closure, false ); + } + + // Set initial hint + if ( element.selectedIndex >= 0 ) + { + element.title = element.options[element.selectedIndex].text; + } + + // Set size for multi-value parameter + if( element.multiple ) + { + var len = oSC[i].options.length; + if( len < this.MIN_MULTILINES ) + { + len = this.MIN_MULTILINES; + } + else if( len > this.MAX_MULTLIINES ) + { + len = this.MAX_MULTLIINES; + } + + element.size = len; + } + } + }, + + /** + * 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 cascadeParamObj = data.getElementsByTagName( 'CascadeParameter' ); + var confirmObj = data.getElementsByTagName( 'Confirmation' ); + if ( cascadeParamObj.length > 0 ) + { + this.__propogateCascadeParameter( data ); + } + else if ( confirmObj.length > 0 ) + { + this.__close( ); + } + + // call the internal onDataChanged event handler + if ( this.__pendingCascadingCalls > 0 ) + { + this.__pendingCascadingCalls--; + } + + if ( this.__pendingCascadingCalls == 0 && this.__onDataChanged ) + { + this.__pendingCascadingCalls = 0; + var callback = this.__onDataChanged; + this.__onDataChanged = null; + // add the handler in the browser's event queue + window.setTimeout( callback, 0 ); + } + }, + + /** + * Install the event handlers for cascade parameter. + * + * @table_param, container table object. + * @counter, index of possible cascade parameter. + * @return, void + */ + __install_cascade_parameter_event_handler : function( table_param, counter ) + { + var oSC = table_param.getElementsByTagName( "select" ); + var matrix = new Array( ); + var m = 0; + + var oTRC = table_param.getElementsByTagName( "TR" ); + for( var i = 0; i < oTRC.length; i++ ) + { + var oSelect = oTRC[i].getElementsByTagName( "select" ); + var oInput = oTRC[i].getElementsByTagName( "input" ); + var oCascadeFlag = ""; + + if ( oInput && oInput.length > 0 ) + { + var oLastInput = oInput[oInput.length - 1]; + if ( oLastInput.id == "isCascade" ) + oCascadeFlag = oLastInput.value; + } + + // find select items to install event listener + if( oSelect.length > 0 && oCascadeFlag == "true" ) + { + if ( i < oTRC.length - 1 ) + { + Event.observe( oSelect[0], 'change', this.__neh_change_cascade_select_closure, false ); + + // find text item to install event listener + var oText; + for( var j = 0; j < oInput.length; j++ ) + { + if( oInput[j].type == "text" ) + { + oText = oInput[j]; + break; + } + } + if( oText ) + { + Event.observe( oText, 'change', this.__neh_change_cascade_text_closure, false ); + } + } + + if( !matrix[m] ) + { + matrix[m] = {}; + } + + var name = oSelect[0].id.substr( 0, oSelect[0].id.length - 10 ) + var value = oSelect[0].value; + if ( value == Constants.nullValue ) + { + matrix[m].name = this.__isnull; + matrix[m++].value = name; + } + else + { + matrix[m].name = name; + matrix[m++].value = oSelect[0].value; + } + } + } + + this.__cascadingParameter[counter] = matrix; + }, + + /** + * Collect parameters, Support ComboBox/Listbox,Hidden,Radio,TextBox,Checkbox. + * + * @return, void + */ + collect_parameter : function( ) + { + // Clear parameter array + this.__parameter = new Array( ); + + var k = 0; + //oTRC[i] is <tr></tr> section + var oTRC = document.getElementById( "parameter_table" ).getElementsByTagName( "TR" ); + for( var i = 0; i < oTRC.length; i++ ) + { + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + + //input element collection + var oIEC = oTRC[i].getElementsByTagName( "input" ); + //select element collection + var oSEC = oTRC[i].getElementsByTagName( "select" ); + //avoid group parameter + var oTable = oTRC[i].getElementsByTagName( "table" ); + if( oTable.length > 0 || ( oSEC.length == 0 && oIEC.length == 0 ) || ( oIEC.length == 1 && oIEC[0].type == 'submit' ) ) + { + continue; + } + + // control type + var oType = oIEC[0].value; + + // deal with "hidden" parameter + if( oType == 'hidden' ) + { + var temp = oIEC[1]; + this.__parameter[k].name = temp.name; + this.__parameter[k].value = temp.value; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = oIEC[2].value; + k++; + + continue; + } + + // deal with "checkbox" parameter + if( oType == 'checkbox' ) + { + var temp = oIEC[2]; + this.__parameter[k].name = temp.value; + temp.checked?this.__parameter[k].value = 'true':this.__parameter[k].value = 'false'; + k++; + continue; + } + + // deal with "text" parameter + if( oType == 'text' ) + { + // data type of current parameter + var dataType = oIEC[1].value; + + // allow null + if( oIEC[2] && oIEC[2].type == 'radio' ) + { + if( oIEC[2].checked ) + { + var paramName = oIEC[3].name; + var paramValue = oIEC[4].value; + var displayText = oIEC[5].value; + + if( displayText != oIEC[3].value ) + { + // change the text field value,regard as a locale string + paramValue = oIEC[3].value; + + // set isLocale flag + this.__parameter[k].name = this.__islocale; + this.__parameter[k].value = paramName; + k++; + } + + // check if required + if( this.__is_parameter_required( oIEC ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[3].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterRequired, paramName ) ); + return false; + } + + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[3].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + return false; + } + + // set parameter value + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = paramName; + this.__parameter[k].value = paramValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = oIEC[3].value; + k++; + } + else + { + // select null value + this.__parameter[k].name = this.__isnull; + this.__parameter[k].value = oIEC[2].value; + k++; + } + } + // not allow null + else + { + var paramName = oIEC[2].name; + var fieldValue = oIEC[2].value; + var paramValue = oIEC[3].value; + var displayText = oIEC[4].value; + + // convert spaces to non-breakable spaces if data type is a number + if ( this.__is_parameter_number( dataType ) ) + { + fieldValue = this.__convert_spaces_to_nbsp( fieldValue ); + } + + if( displayText != fieldValue ) + { + // change the text field value,regard as a locale string + paramValue = fieldValue; + + // set isLocale flag + this.__parameter[k].name = this.__islocale; + this.__parameter[k].value = paramName; + k++; + } + + // check if required + if( this.__is_parameter_required( oIEC ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[2].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterRequired, paramName ) ); + return false; + } + + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[2].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + return false; + } + + // set parameter value + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = paramName; + this.__parameter[k].value = paramValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = fieldValue; + k++; + } + + continue; + } + + // deal with "radio" parameter + if( oType == 'radio' ) + { + var dataType = oIEC[1].value; + + if( oIEC.length > 2 ) + { + for( var j = 2; j < oIEC.length; j++ ) + { + // deal with radio + if( oIEC[j].type == 'radio' && oIEC[j].checked ) + { + // null value + if( oIEC[j].id == oIEC[j].name + "_null" ) + { + this.__parameter[k].name = this.__isnull; + this.__parameter[k].value = oIEC[j].name; + k++; + } + else + { + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( oIEC[j].value ) == '' && this.visible ) + { + oIEC[j].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, oIEC[j].name ) ); + return false; + } + + // common radio value + this.__parameter[k].name = oIEC[j].name; + this.__parameter[k].value = oIEC[j].value; + k++; + + // set display text for the "radio" parameter + var displayLabel = document.getElementById( oIEC[j].id + "_label" ); + if( displayLabel ) + { + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = displayLabel.title; + k++; + } + } + + break; + } + } + } + + continue; + } + + // deal with "select" parameter + if( oType == 'select' && oSEC.length == 1 ) + { + var dataType = oIEC[1].value; + var paramName = oIEC[2].name; + + var flag = true; + if( oIEC[3] && oIEC[3].type == 'radio' && !oIEC[3].checked ) + { + flag = false; + } + + // check select + if( flag ) + { + if ( oSEC[0].selectedIndex < 0 && this.visible ) + { + oSEC[0].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotSelected, paramName ) ); + return false; + } + + if( oSEC[0].multiple ) + { + var options = oSEC[0].options; + for( var l = 0; l < options.length; l++ ) + { + if( !options[l].selected ) + continue; + + var tempText = options[l].text; + var tempValue = options[l].value; + + // check if isRequired + if( this.__is_parameter_required( oIEC ) + && birtUtility.trim( tempValue ) == '' && this.visible ) + { + oSEC[0].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterRequired, paramName ) ); + return false; + } + + if( tempValue == Constants.nullValue ) + continue; + + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( tempValue ) == '' && this.visible ) + { + oSEC[0].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + return false; + } + } + } + else + { + var tempText = oSEC[0].options[oSEC[0].selectedIndex].text; + var tempValue = oSEC[0].options[oSEC[0].selectedIndex].value; + + // check if isRequired + if ( this.__is_parameter_required( oIEC ) + && birtUtility.trim( tempValue ) == '' && this.visible ) + { + oSEC[0].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterRequired, paramName ) ); + return false; + } + + // Check if select 'Null Value' option for single parameter + if( tempValue == Constants.nullValue ) + { + this.__parameter[k].name = this.__isnull; + this.__parameter[k].value = paramName; + k++; + continue; + } + + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( tempValue ) == '' && this.visible ) + { + oSEC[0].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + return false; + } + } + } + + // allow new value + if( oIEC[3] && oIEC[3].type == 'radio' ) + { + if( oIEC[3].checked ) + { + // select value + var tempText = oSEC[0].options[oSEC[0].selectedIndex].text; + var tempValue = oSEC[0].options[oSEC[0].selectedIndex].value; + + // set value + this.__parameter[k].name = paramName; + this.__parameter[k].value = tempValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = tempText; + k++; + } + else + { + var inputValue = oIEC[5].value; + var paramValue = oIEC[2].value; + var displayText = oIEC[6].value; + + // if change the text field value or input text field isn't focus default,regard as a locale string + if( displayText != inputValue || oIEC[5].name.length <= 0 ) + { + paramValue = inputValue; + + // set isLocale flag + this.__parameter[k].name = this.__islocale; + this.__parameter[k].value = paramName; + k++; + } + + // check if isRequired + if ( this.__is_parameter_required( oIEC ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[5].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterRequired, paramName ) ); + return false; + } + + // check if allow blank + if( !this.__is_parameter_allowblank( dataType ) + && birtUtility.trim( paramValue ) == '' && this.visible ) + { + oIEC[5].focus( ); + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + return false; + } + + // set value + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = paramName; + this.__parameter[k].value = paramValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = inputValue; + k++; + } + } + else + { + // don't allow new value + if( oSEC[0].multiple ) + { + // allow multi value + var options = oSEC[0].options; + for( var l = 0; l < options.length; l++ ) + { + if( !options[l].selected ) + continue; + + var tempText = options[l].text; + var tempValue = options[l].value; + + // Check if select 'Null Value' option + if( tempValue == Constants.nullValue ) + { + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + + this.__parameter[k].name = this.__isnull; + this.__parameter[k].value = paramName; + k++; + continue; + } + + // set value + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = paramName; + this.__parameter[k].value = tempValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = tempText; + k++; + } + } + else + { + // allow single value + var tempText = oSEC[0].options[oSEC[0].selectedIndex].text; + var tempValue = oSEC[0].options[oSEC[0].selectedIndex].value; + + // set value + this.__parameter[k].name = paramName; + this.__parameter[k].value = tempValue; + k++; + + // set display text + if( !this.__parameter[k] ) + { + this.__parameter[k] = { }; + } + this.__parameter[k].name = this.__isdisplay + this.__parameter[k-1].name; + this.__parameter[k].value = tempText; + k++; + } + } + + continue; + } + } + + return true; + }, + + /** + * Check if current parameter is required or not. + * + * @oInputs, Input control collection + * @return, true or false + */ + __is_parameter_required : function( oInputs ) + { + if( !oInputs || oInputs.length <= 0 ) + return false; + + var flag = false; + for( var i = 0; i< oInputs.length; i++ ) + { + // if find defined input control + if( oInputs[i].id == 'isRequired' && oInputs[i].value == 'true' ) + { + flag = true; + break; + } + } + + return flag; + }, + + /** + * Check if current parameter allows blank value. + * Currently, only any and string data type parameter can allow blank value. + * + * @dataType, data type for parameter + * @return, true or false + */ + __is_parameter_allowblank : function( dataType ) + { + if( !dataType ) + return false; + + if( dataType == Constants.TYPE_ANY ) + return true; + + if( dataType == Constants.TYPE_STRING ) + return true; + + return false; + }, + + /** + * Check if current parameter is a number. + * + * @dataType data type for parameter + * @return true or false + */ + __is_parameter_number : function( dataType ) + { + if( !dataType ) + return false; + + return ( dataType == Constants.TYPE_FLOAT + || dataType == Constants.TYPE_DECIMAL + || dataType == Constants.TYPE_INTEGER ); + }, + + /** + * Converts the spaces to non-breakable spaces (unicode 0x00a0). + * This is mandatory for numbers which use a space separator, + * because the server-side parser expects it. + * @param value formatted string to process + * @return processed string + */ + __convert_spaces_to_nbsp : function( aValue ) + { + var value = aValue; + var startIndex = value.search(/\d/); + if ( startIndex < 0 ) + { + return value; + } + + var endIndex = value.search(/\d\D*$/); + if ( endIndex < 0 ) + { + endIndex = value.length; + } + + var prefix = value.substring(0, startIndex); + var suffix = value.substr(endIndex + 1); + var number = value.substring(startIndex, endIndex + 1).replace(/ /g,"\u00a0"); + + + return prefix + number + suffix; + }, + + /** + * Handle mouseover event on select. + * + * @event, incoming browser native event + * @return, void + */ + __neh_mouseover_select : function( event ) + { + var oSC = Event.element( event ); + var tempText; + if( oSC.selectedIndex >=0 ) + tempText = oSC.options[oSC.selectedIndex].text; + + if( tempText && this._hint ) + { + this._hint.innerHTML = tempText; + this._hint.style.display = "block"; + this._hint.style.left = ( event.clientX - parseInt( this.__instance.style.left ) ) + "px"; + this._hint.style.top = ( 15 + event.clientY - parseInt( this.__instance.style.top ) ) + "px"; + } + }, + + /** + * Handle mouseout event on select. + * + * @event, incoming browser native event + * @return, void + */ + __neh_mouseout_select : function( event ) + { + if( this._hint ) + { + this._hint.style.display = "none"; + } + }, + + /** + * Handle focus event on select elements. + * + * @event, incoming browser native event + * @return, void + */ + + __neh_focus_select : function( event ) + { + var el = Event.element( event ); + if ( el ) + { + this.__currentSelectedIndex = el.selectedIndex; + } + else + { + this.__currentSelectedIndex = -2; + } + }, + + /** + * Handle blur event on select elements. + * + * @event, incoming browser native event + * @return, void + */ + __neh_blur_select : function( event ) + { + var el = Event.element( event ); + + // prevents firing onchange twice, if the previous onchange has + // already updated the current selected index + if ( el && el.selectedIndex != this.__currentSelectedIndex) + { + this.__neh_change_cascade_select( event ); + } + this.__currentSelectedIndex = -2; + }, + + /** + * Handle change event when clicking on select. + * + * @event, incoming browser native event + * @return, void + */ + __neh_change_select : function( event ) + { + var element = Event.element( event ); + if ( element.selectedIndex >= 0 ) + { + element.title = element.options[element.selectedIndex].text; + } + else + { + element.title = ""; + } + }, + + + /** + * Handle change event when clicking on cascading select. + * + * @event incoming browser native event + * @return + */ + __neh_change_cascade_select : function( event ) + { + if ( this.__cancelOnChange ) + { + /** + * Cancel event because of keyboard selection. + * Event will be fired later when the element loses focus (like in Firefox) + */ + this.__cancelOnChange = false; + return; + } + + var element = Event.element( event ); + this.__currentSelectedIndex = element.selectedIndex; + this.__refresh_cascade_select(element); + }, + + /** + * Refreshes the cascading elements following the given element. + */ + __refresh_cascade_select : function( element ) + { + var matrix = new Array( ); + var m = 0; + for( var i = 0; i < this.__cascadingParameter.length; i++ ) + { + for( var j = 0; j < this.__cascadingParameter[i].length; j++ ) + { + var paramName = this.__cascadingParameter[i][j].name; + if( paramName == this.__isnull ) + paramName = this.__cascadingParameter[i][j].value; + + if( paramName == element.id.substr( 0, element.id.length - 10 ) ) + { + var tempText = element.options[element.selectedIndex].text; + var tempValue = element.options[element.selectedIndex].value; + + // Null Value Parameter + if ( tempValue == Constants.nullValue ) + { + this.__cascadingParameter[i][j].name = this.__isnull; + this.__cascadingParameter[i][j].value = paramName; + } + else if( tempValue == '' ) + { + if( tempText == "" ) + { + var target = element; + target = target.parentNode; + var oInputs = target.getElementsByTagName( "input" ); + if( oInputs.length >0 && oInputs[1].value != Constants.TYPE_STRING ) + { + // Only String parameter allows blank value + alert( birtUtility.formatMessage( Constants.error.parameterNotAllowBlank, paramName ) ); + this.__clearSubCascadingParameter( this.__cascadingParameter[i], j ); + return; + } + else + { + // Blank Value + this.__cascadingParameter[i][j].name = paramName; + this.__cascadingParameter[i][j].value = tempValue; + } + } + else + { + // Blank Value + this.__cascadingParameter[i][j].name = paramName; + this.__cascadingParameter[i][j].value = tempValue; + } + } + else + { + this.__cascadingParameter[i][j].name = paramName; + this.__cascadingParameter[i][j].value = tempValue; + } + + for( var m = 0; m <= j; m++ ) + { + if( !matrix[m] ) + { + matrix[m] = {}; + } + matrix[m].name = this.__cascadingParameter[i][m].name; + matrix[m].value = this.__cascadingParameter[i][m].value; + } + this.__pendingCascadingCalls++; + birtEventDispatcher.broadcastEvent( birtEvent.__E_CASCADING_PARAMETER, matrix ); + } + } + } + }, + + /** + * Clear the sub cascading parameter for the elements + * following the given element + * @param element element + */ + __clearSubCascadingParameterByName: function(parameterName) + { + for( var i = 0; i < this.__cascadingParameter.length; i++ ) + { + for( var j = 0; j < this.__cascadingParameter[i].length; j++ ) + { + var paramName = this.__cascadingParameter[i][j].name; + if( paramName == parameterName ) + { + this.__clearSubCascadingParameter( this.__cascadingParameter[i], j ); + } + } + } + }, + + /** + * Clear the sub cascading parameter. + * + * @cascadingParameterGroup + * @index + * @return, void + */ + __clearSubCascadingParameter : function( cascadingParameterGroup, index ) + { + for( var i = index + 1; i < cascadingParameterGroup.length; i++ ) + { + var param_name = cascadingParameterGroup[i].name; + if( param_name == this.__isnull ) + param_name = cascadingParameterGroup[i].value; + + var selection = document.getElementById( param_name + "_selection" ); + var len = selection.options.length; + + // Clear our selection list. + for( var j = 0; j < len; j++ ) + { + selection.remove( 0 ); + } + } + }, + + /** + * Handle clicking on radio. + * + * @event, incoming browser native event + * @return, void + */ + __neh_click_radio : function( event ) + { + var temp = Event.element( event ); + var oInput = temp.parentNode.getElementsByTagName( "input" ); + var oSelect = temp.parentNode.getElementsByTagName( "select" ); + + // check if current parameter is cascading parameter + var oCascadeFlag = false; + if ( oInput && oInput.length > 0 ) + { + var oLastInput = oInput[oInput.length - 1]; + if ( oLastInput.id == "isCascade" ) + oCascadeFlag = ( oLastInput.value == "true" ); + } + + var oSelectElement = oSelect[0]; + + for( var i = 0; i < oInput.length; i++ ) + { + if( oInput[i].id == temp.id ) + { + var element = oInput[i+1]; + //enable the next component + oInput[i].checked = true; + if( element && ( element.type == "text" || element.type == "password" ) ) + { + element.disabled = false; + element.focus( ); + if ( oCascadeFlag ) + { + // refresh cascading elements (remove the "_input" suffix) + this.__clearSubCascadingParameterByName(element.id.substr(0, element.id.length - 6)); + } + } + else if( oSelectElement ) + { + oSelectElement.selectedIndex = 0; + oSelectElement.disabled = false; + oSelectElement.focus( ); + if ( oCascadeFlag ) + { + // refresh cascading elements (remove the "_selection" suffix) + this.__clearSubCascadingParameterByName(oSelectElement.id.substr(0, oSelectElement.id.length - 10)); + } + } + } + // if i points to the element that must be disabled + else if( oInput[i].type == "radio" && oInput[i].id != temp.id ) + { + var element = oInput[i+1]; + //disable the next component and clear the radio + oInput[i].checked = false; + if( element && ( element.type == "text" || element.type == "password" ) ) + { + element.disabled = true; + // if cascading parameter, clear value + if ( oCascadeFlag ) + { + element.value = ""; + } + } + else if( oSelectElement ) + { + oSelectElement.disabled = true; + // if cascading parameter, clear value + if ( oCascadeFlag ) + { + oSelectElement.selectedIndex = -1; + oSelectElement.title = ""; + } + } + } + } + }, + + /** + * Check whether obj is the last select control + */ + __ifLastSelect : function( obj ) + { + if( obj ) + { + var oTABLE = obj.parentNode.parentNode.parentNode; + if( oTABLE ) + { + var oSelect = oTABLE.getElementsByTagName( "select" ); + if( oSelect && oSelect.length > 0 && oSelect[oSelect.length - 1].id == obj.id ) + { + return true; + } + } + } + return false; + }, + + /** + * Handle changing on cascading parameter text field. + * + * @event, incoming browser native event + * @return, void + */ + __neh_change_cascade_text : function( event ) + { + var temp = Event.element( event ); + this.__refresh_cascade_text(temp); + }, + + /** + * Refresh cascade elements from a text box. + */ + __refresh_cascade_text : function( element ) + { + // trim the "_text" suffix from the parameter name + var paramName = element.id.substr( 0, element.id.length - 6 ); + var matrix = new Array( ); + var m = 0; + for( var i = 0; i < this.__cascadingParameter.length; i++ ) + { + for( var j = 0; j < this.__cascadingParameter[i].length; j++ ) + { + if( this.__cascadingParameter[i][j].name == paramName ) + { + this.__cascadingParameter[i][j].value = element.value; + for( var m = 0; m <= j; m++ ) + { + if( !matrix[m] ) + { + matrix[m] = {}; + } + matrix[m].name = this.__prefix_islocale + this.__cascadingParameter[i][m].name; + matrix[m].value = this.__cascadingParameter[i][m].value; + } + this.__pendingCascadingCalls++; + birtEventDispatcher.broadcastEvent( birtEvent.__E_CASCADING_PARAMETER, matrix ); + } + } + } + }, + + /** + * Handle press "Enter" key. + * + * @event, incoming browser native event + * @return, void + */ + __neh_keydown: function( event ) + { + // If press 'Enter' key + if( event.keyCode == 13 ) + { + var target = Event.element( event ); + + // Focus on INPUT and SELECT controls + if ( target.tagName == "INPUT" || target.tagName == "SELECT" ) + { + // (exclude 'button' type for non-Safari browsers) + if ( target.type != "button" ) + { + // blur the focus to force the onchange/onselect events + target.blur(); + // defer okPress to let those events run first + window.setTimeout( this.__okPress.bindAsEventListener(this), 0 ); + } + // Safari needs explicit click + else if ( BrowserUtility.isSafari || BrowserUtility.isKHTML ) + { + target.click(); + // prevent browser "beep" + Event.stop( event ); + } + } + + } + // in IE, when a key is pressed on a select box, cancel the onchange event + else if ( BrowserUtility.isIE && event.keyCode != 9 && Event.element( event ).tagName == "SELECT" ) + { + this.__cancelOnChange = true; + } + }, + + /** + * Handle clicking on okRun. + * + * @event, incoming browser native event + * @return, void + */ + __okPress : function( ) + { + // if a cascading parameter just changed + if ( this.__pendingCascadingCalls > 0 ) + { + debug("defer okPress call"); + // defer the call to the okPress function until the data has been updated + this.__onDataChanged = this.__okPress.bindAsEventListener(this); + return; + } + + if( birtParameterDialog.collect_parameter( ) ) + { + // workaround for Bugzilla Bug 146566. + // If change parameter and re-generate docuemnt file, close TOC panel. + if ( this.__mode == Constants.SERVLET_FRAMESET ) + { + var oToc = $( 'display0' ); + var oDoc = $( 'Document' ); + if( oToc && oDoc ) + { + oDoc.style.width = BirtPosition.viewportWidth( ) + "px"; + oToc.style.display="none"; + oToc.query = '0'; + } + } + + var action = soapURL.toLowerCase( ); + + if ( this.__mode == Constants.SERVLET_PARAMETER ) + { + // check whether set __nocache setting in URL + if ( this.__ifCache( action ) ) + birtEventDispatcher.broadcastEvent( birtEvent.__E_CACHE_PARAMETER ); + else + this.__doSubmitWithPattern( ); + } + else if ( this.__ifSubmit( this.__mode, action ) ) + { + this.__doSubmit( ); + } + else + { + if( this.__mode == Constants.SERVLET_FRAMESET ) + { + var targetPage = "1"; + var bookmark = birtUtility.getURLParameter(soapURL, "bookmark"); + // if a bookmark is defined, reset the target page + // to force the server-side to use it + if ( bookmark && bookmark.length > 0 ) + { + targetPage = ""; + } + + var oPageNumber = $( 'pageNumber' ); + if ( oPageNumber ) + { + oPageNumber.innerHTML = targetPage; + } + + birtEventDispatcher.broadcastEvent( birtEvent.__E_CHANGE_PARAMETER ); + } + else + { + // if 'run' mode, fire GetPageAll event + this.__init_page_all( ); + } + + this.__l_hide( ); + } + } + }, + + /** + * Override cancel button click. + */ + __neh_cancel : function( ) + { + // if cascading parameter calls are pending + if ( this.__pendingCascadingCalls > 0 ) + { + // prevent the response to popup the dialog again + this.__cancelShow = true; + + // reset the counter for the next time the dialog is needed + this.__pendingCascadingCalls = 0; + } + + if ( this.__mode == Constants.SERVLET_PARAMETER ) + { + this.__cancel(); + } + else + { + this.__l_hide( ); + } + }, + + /** + * Handle submit form with defined servlet pattern and current parameters. + * + * @return, void + */ + __doSubmitWithPattern : function( ) + { + var url = soapURL; + + // parse pattern + var reg = new RegExp( "[&|?]{1}__pattern\s*=([^&|^#]*)", "gi" ); + var arr = url.match( reg ); + var pattern; + if( arr && arr.length > 0 ) + pattern = RegExp.$1; + else + pattern = "frameset"; + + // parse target + reg = new RegExp( "[&|?]{1}__target\s*=([^&|^#]*)", "gi" ); + arr = url.match( reg ); + var target; + if( arr && arr.length > 0 ) + target = RegExp.$1; + + reg = new RegExp( "[^/|^?]*[?]{1}", "gi" ); + if( url.search( reg ) > -1 ) + url = url.replace( reg, pattern + "?" ); + + this.__doSubmit( url, target ); + }, + + /** + * Handle submit form with current parameters. + * + * @param, url + * @param, target + * @return, void + */ + __doSubmit : function( url, target ) + { + var action = url; + if( !action ) + action = soapURL; + + var divObj = document.createElement( "DIV" ); + document.body.appendChild( divObj ); + divObj.style.display = "none"; + + var formObj = document.createElement( "FORM" ); + divObj.appendChild( formObj ); + + if ( this.__parameter != null ) + { + for( var i = 0; i < this.__parameter.length; i++ ) + { + var param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = this.__parameter[i].name; + param.value = this.__parameter[i].value; + + //replace the URL parameter + var reg = new RegExp( "&" + param.name + "[^&]*&*", "g" ); + action = action.replace( reg, "&" ); + } + } + + if ( Constants.viewingSessionId ) + { + // append sub session in the POST part + birtUtility.addHiddenFormField(formObj, Constants.PARAM_SESSION_ID, Constants.viewingSessionId); + action = birtUtility.deleteURLParameter(action, Constants.PARAM_SESSION_ID); + } + + // replace __parameterpage setting + var reg = new RegExp( "([&|?]{1})(__parameterpage\s*=[^&|^#]*)","gi" ); + if ( action.search( reg ) > -1 ) + { + action = action.replace( reg, "$1" ); + } + + // set target window + if( target ) + formObj.target = target; + + formObj.action = action; + formObj.method = "post"; + + // if don't set target, hide the parameter dialog + if( !target ) + this.__l_hide( ); + + formObj.submit( ); + }, + + /** + * Caching parameters success, close window. + * + * @return, void + */ + __close : function( ) + { + if ( BrowserUtility.__isIE( ) ) + { + window.opener = null; + window.close( ); + } + else + { + window.status = "close"; + } + }, + + /** + * Click 'Cancel', close window. + * + * @return, void + */ + __cancel : function( ) + { + window.status = "cancel"; + }, + + /** + 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 ); + + // set preVisible + this.preVisible = this.visible; + }, + + /** + * Override the dialog's show method. + */ + __l_show: function() + { + if ( !this.__cancelShow ) + { + // call to superclass method + AbstractParameterDialog.prototype.__l_show.call( this ); + } + this.__cancelShow = false; + }, + + /** + Called after element is shown + */ + __postShow: function() + { + // if previous is visible, return directly + if( this.preVisible ) + return; + + // focus on the first input text/password or select or button control + this.__init_focus( ); + }, + + /** + * Try to focus on the first control. + * Input text/password, select and button. + */ + __init_focus: function( ) + { + var oFirstITC; + var oFirstIBT; + var oFirstST; + + var oITCs = this.__instance.getElementsByTagName( "input" ); + for( var i = 0; i < oITCs.length; i++ ) + { + // get the first input text/password control + if( oITCs[i].type == "text" + || oITCs[i].type == "password" ) + { + if( !oITCs[i].disabled && !oFirstITC ) + { + oFirstITC = oITCs[i]; + } + continue; + } + + // get the first input button control + if( !oFirstIBT && oITCs[i].type == "button" && !oITCs[i].disabled ) + { + oFirstIBT = oITCs[i]; + } + } + + // get the first select control + var oSTs = this.__instance.getElementsByTagName( "select" ); + for( var i = 0; i < oSTs.length; i++ ) + { + if( !oSTs[i].disabled ) + { + oFirstST = oSTs[i]; + break; + } + } + + if( oFirstITC && !oFirstST ) + { + // if exist input text/password, no select control + oFirstITC.focus( ); + } + else if( !oFirstITC && oFirstST ) + { + // if exist select control, no input text/password + oFirstST.focus( ); + } + else if( oFirstITC && oFirstST ) + { + // exist select control and input text/password + // compare the parent div offsetTop + if( oFirstITC.parentNode && oFirstST.parentNode ) + { + // Bugzilla 265615: need to use cumulative offset for special cases + // where one element is inside a group container + var offsetITC = Position.cumulativeOffset( oFirstITC ); + var offsetST = Position.cumulativeOffset( oFirstST ); + + if( offsetITC > offsetST ) + { + oFirstST.focus( ); + } + else + { + oFirstITC.focus( ); + } + } + else + { + // default to focus on input control + oFirstITC.focus( ); + } + } + else + { + // focus on button control + oFirstIBT.focus( ); + } + }, + + /** + Called before element is hidden + */ + __preHide: function( ) + { + // enable the toolbar buttons + birtUtility.setButtonsDisabled ( "toolbar", false ); + + // enable the Navigation Bar buttons + birtUtility.setButtonsDisabled ( "navigationBar", false ); + }, + + /** + * Retrieve all pages + */ + __init_page_all: function( ) + { + if( birtParameterDialog.collect_parameter( ) ) + { + birtEventDispatcher.broadcastEvent( birtEvent.__E_GETPAGE_ALL ); + } + }, + + /** + * Check if cache parameter, default to true + * + * @param url + * @return, true or false + */ + __ifCache: function( url ) + { + if( url ) + url = url.toLowerCase( ); + else + url = ""; + + // if don't set __nocache, default is true + var reg = new RegExp( "[&|?]{1}__nocache[^&|^#]*", "gi" ); + if( url.search( reg ) < 0 ) + return true; + else + return false; + + return true; + }, + + /** + * Check if submit request + * @param mode + * @param url + * @return, true or false + */ + __ifSubmit: function( mode, url ) + { + // if use '/preview' pattern, submit anyway + if( mode == 'preview' ) + return true; + + if( url ) + url = url.toLowerCase( ); + else + url = ""; + + // if use '/frameset' or '/run', check format. + // if format is not HTML, submit request. + if( mode == 'run' || mode == 'frameset' ) + { + var format = Constants.request.format; + return !( format == "htm" || format == "html" ); + } + + return false; + } +} +); Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtParameterDialog.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js?rev=831503&view=auto ============================================================================== --- ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js (added) +++ ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js Sat Oct 31 01:22:47 2009 @@ -0,0 +1,402 @@ +/****************************************************************************** + * 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 print report dialog. + */ +BirtPrintReportDialog = Class.create( ); + +BirtPrintReportDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + /** + * Print window instance. + */ + __printWindow : null, + + /** + * Timer instance control the popup print dialog. + */ + __timer : null, + + __printFormat : 'html', + __neh_formatradio_click_closure : null, + __neh_pageradio_click_closure : null, + + /** + * PDF page fit setting + */ + FIT_TO_ACTUAL : '0', + FIT_TO_WHOLE : '1', + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__z_index = 200; + + this.__initLayout( ); + + // Binding + this.__neh_formatradio_click_closure = this.__neh_formatradio_click.bindAsEventListener( this ); + this.__neh_pageradio_click_closure = this.__neh_pageradio_click.bindAsEventListener( this ); + + this.__installEventHandlers( id ); + }, + + /** + * Initilize dialog layout + * + * @return, void + */ + __initLayout : function( ) + { + + }, + + /** + * Install native/birt event handlers. + * + * @id, toolbar id (optional since there is only one toolbar) + * @return, void + */ + __installEventHandlers : function( id ) + { + // switch print format + var oInputs = $( 'printFormatSetting' ).getElementsByTagName( 'input' ); + for( var i=0; i<oInputs.length; i++ ) + { + if( oInputs[i].type == 'radio' ) + Event.observe( oInputs[i], 'click', this.__neh_formatradio_click_closure,false ); + } + + // page setting + var oInputs = $( 'printPageSetting' ).getElementsByTagName( 'input' ); + for( var i=0; i<oInputs.length; i++ ) + { + if( oInputs[i].type == 'radio' ) + Event.observe( oInputs[i], 'click', this.__neh_pageradio_click_closure,false ); + } + }, + + /** + * Handle clicking on ok. + * + * @return, void + */ + __okPress : function( ) + { + if ( this.__printAction( ) ) + { + this.__l_hide( ); + } + }, + + /** + * Handle print report action + * + * @return, true or false + */ + __printAction : function( ) + { + var docObj = document.getElementById( "Document" ); + if ( !docObj || birtUtility.trim( docObj.innerHTML ).length <= 0) + { + alert ( Constants.error.generateReportFirst ); + return false; + } + else + { + var divObj = document.createElement( "DIV" ); + document.body.appendChild( divObj ); + divObj.style.display = "none"; + + var formObj = document.createElement( "FORM" ); + divObj.appendChild( formObj ); + + // Replace format in URL with selected print format + var action = soapURL; + var reg = new RegExp( "([&|?]{1}" + Constants.PARAM_FORMAT + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_FORMAT + "=" + this.__printFormat; + } + else + { + action = action.replace( reg, "$1=" + this.__printFormat ); + } + + // Delete page, pagerange and parameterpage settings in url if existed + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGERANGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PARAMETERPAGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_EMITTER_ID ); + + if( $( 'printPageCurrent' ).checked ) + { + // Set page setting + var currentPage = birtUtility.trim( $( 'pageNumber' ).innerHTML ); + action = action + "&" + Constants.PARAM_PAGE + "=" + currentPage; + } + else if( $( 'printPageRange' ).checked ) + { + // Set page range setting + var pageRange = birtUtility.trim( $( 'printPageRange_input' ).value ); + if ( !birtUtility.checkPageRange( pageRange ) ) + { + alert( Constants.error.invalidPageRange ); + return false; + } + action = action + "&" + Constants.PARAM_PAGERANGE + "=" + pageRange; + } + + var oSelect = this.__instance.getElementsByTagName( 'select' )[0]; + var pageOverflow = 0; + //var pagebreakonly = "false"; + + // + if( oSelect.selectedIndex >=0 ) + pageOverflow = oSelect.value; + + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_PAGE_OVERFLOW + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_PAGE_OVERFLOW + "=" + pageOverflow; + } + else + { + action = action.replace( reg, "$1=" + pageOverflow ); + } + + /* + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_PAGEBREAKONLY + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_PAGEBREAKONLY + "=" + pagebreakonly; + } + else + { + action = action.replace( reg, "$1=" + pagebreakonly ); + } + */ + + if ( Constants.viewingSessionId ) + { + // append sub session in the POST part + birtUtility.addHiddenFormField(formObj, Constants.PARAM_SESSION_ID, Constants.viewingSessionId); + action = birtUtility.deleteURLParameter(action, Constants.PARAM_SESSION_ID); + } + + // Force "__overwrite" as false + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_OVERWRITE + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_OVERWRITE + "=false"; + } + else + { + action = action.replace( reg, "$1=false" ); + } + + // Replace servlet pattern as output + action = action.replace( /[\/][a-zA-Z]+[?]/, "/"+Constants.SERVLET_OUTPUT+"?" ); + + var previewExists = false; + // retrieve previous window instance + var previousPrintWindow = window.open( '', Constants.WINDOW_PRINT_PREVIEW, 'location=no,scrollbars=yes,dependent=yes' ); + try + { + // if the window didn't exist, then window.open() has opened an empty window + var previousBodyElement = previousPrintWindow.document.getElementsByTagName("body")[0]; + if ( previousBodyElement && birtUtility.trim( previousBodyElement.innerHTML ).length > 0 ) + { + previewExists = true; + } + } + catch ( e ) + { + // access denied is thrown if the previous preview window contains a PDF content + previewExists = true; + } + + if ( previewExists ) + { + // workaround for Bugzilla Bug 227937 + window.setTimeout( function () { alert( Constants.error.printPreviewAlreadyOpen ) }, 0 ); + return false; + } + else + { + // use the created window as current window + this.__printWindow = previousPrintWindow; + } + + if ( !BrowserUtility.__isIE() ) + { + // use onload event for the callback when page is loaded + Event.observe( this.__printWindow, 'load', this.__cb_print.bindAsEventListener( this ), false ); + } + + formObj.action = action; + formObj.method = "post"; + formObj.target = Constants.WINDOW_PRINT_PREVIEW; + formObj.submit( ); + + // Launch the browser's print dialog (IE/Safari workaround) + // Note: calling the print dialog for PDF in IE doesn't work (permission denied) + if ( ( BrowserUtility.__isIE() && this.__printFormat != 'pdf' ) || BrowserUtility.__isSafari() ) + { + this.__timer = window.setTimeout( this.__cb_waitPreviewLoaded.bindAsEventListener( this ), 1000 ); + } + } + + return true; + }, + + /** + * Waits until the print preview is loaded (IE only) + */ + __cb_waitPreviewLoaded : function( ) + { + window.clearTimeout( this.__timer ); + + try + { + if ( !this.__printWindow || this.__printWindow.closed ) + { + return; + } + + if ( !this.__printWindow.document || this.__printWindow.document.readyState != "complete" ) + { + // wait a little longer + this.__timer = window.setTimeout( this.__cb_waitPreviewLoaded.bindAsEventListener( this ), 1000 ); + } + else + { + this.__cb_print(); + } + } + catch ( error ) + { + // IE throws a permission denied exception if the user closes + // the window too early. In this case ignore the exception. + } + }, + + /** + * Control the browser's popup print dialog. + * + * Below are the implemented functions for the given browsers and output formats. + * Function IE Mozilla/Safari + * window.print() HTML HTML,PDF(delay) + * + */ + __cb_print : function( ) + { + try + { + if ( !this.__printWindow || this.__printWindow.closed ) + { + return; + } + + var err = this.__printWindow.document.getElementById( "birt_errorPage" ); + if( err && err.innerHTML != '' ) + { + return; + } + + // Call the browser's print dialog (async) + if ( this.__printFormat == 'pdf' ) // Mozilla only + { + // Mozilla needs some delay after loading PDF + this.__printWindow.setTimeout( "window.print();", 1000 ); + } + else + { + // defer call to let the window draw its content + // (Firefox Bugzilla bug 213666) + this.__printWindow.setTimeout( "window.print();", 0 ); + } + } + catch ( error ) + { + // IE throws a permission denied exception if the user closes + // the window too early. In this case ignore the exception. + } + }, + + /** + * Native event handler for print format radio control. + */ + __neh_formatradio_click : function( event ) + { + var oSC = Event.element( event ); + var oSelect = this.__instance.getElementsByTagName( 'select' )[0]; + if( oSC.checked && oSC.id == 'printAsPDF' ) + { + this.__printFormat = 'pdf'; + oSelect.disabled = false; + oSelect.focus(); + } + else + { + this.__printFormat = 'html'; + oSelect.disabled = true; + } + }, + + /** + * Native event handler for page radio control. + */ + __neh_pageradio_click : function( event ) + { + var oSC = Event.element( event ); + var oInput = $( 'printPageRange_input' ); + if( oSC.checked && oSC.id == 'printPageRange' ) + { + oInput.disabled = false; + oInput.focus( ); + } + else + { + oInput.disabled = true; + oInput.value = ""; + } + }, + + /** + 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/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportDialog.js ------------------------------------------------------------------------------ svn:mime-type = text/plain Added: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js URL: http://svn.apache.org/viewvc/ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js?rev=831503&view=auto ============================================================================== --- ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js (added) +++ ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js Sat Oct 31 01:22:47 2009 @@ -0,0 +1,662 @@ +/****************************************************************************** + * 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 print report on the server dialog. + */ +BirtPrintReportServerDialog = Class.create( ); + +BirtPrintReportServerDialog.prototype = Object.extend( new AbstractBaseDialog( ), +{ + __neh_select_change_closure : null, + __neh_printserver_click_closure : null, + __neh_pageradio_click_closure : null, + + __enable : false, + __printer : null, + + /** + * Initialization routine required by "ProtoType" lib. + * @return, void + */ + initialize : function( id ) + { + this.__initBase( id ); + this.__z_index = 200; + + this.__initLayout( ); + + // Binding + this.__neh_select_change_closure = this.__neh_select_change.bindAsEventListener( this ); + this.__neh_printserver_click_closure = this.__neh_printserver_click.bindAsEventListener( this ); + this.__neh_pageradio_click_closure = this.__neh_pageradio_click.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_select_change_closure, false ); + + var oInputs = this.__instance.getElementsByTagName( 'input' ); + Event.observe( oInputs[0], 'click', this.__neh_printserver_click_closure, false ); + + var oInputs = $( 'printServerPageSetting' ).getElementsByTagName( 'input' ); + for( var i=0; i<oInputs.length; i++ ) + { + if( oInputs[i].type == 'radio' ) + Event.observe( oInputs[i], 'click', this.__neh_pageradio_click_closure,false ); + } + }, + + /** + * Handle clicking on ok. + * + * @return, void + */ + __okPress : function( ) + { + var flag = false; + if( this.__enable ) + { + this.__collectPrinter( ); + flag = this.__printAction( ); + + if ( flag ) + { + birtConfirmationDialog.__cb_bind( ); + } + } + + // don't hide if there was an error + if ( !( this.__enable && !flag ) ) + { + this.__l_hide( ); + } + + }, + + /** + * Collect printer information + * + * @return, void + * + */ + __collectPrinter : function( ) + { + if( !this.__printer ) + return; + + var oCopies = $( 'printer_copies' ); + if( !oCopies.disabled ) + this.__printer.setCopies( oCopies.value ); + + var oCollate = $( 'printer_collate' ); + if( !oCollate.disabled ) + { + if( oCollate.checked ) + this.__printer.setCollate( true ); + else + this.__printer.setCollate( false ); + } + + var oDuplex = $( 'printer_duplexSimplex' ); + if( !oDuplex.disabled && oDuplex.checked ) + { + this.__printer.setDuplex( this.__printer.DUPLEX_SIMPLEX ); + } + oDuplex = $( 'printer_duplexHorz' ); + if( !oDuplex.disabled && oDuplex.checked ) + { + this.__printer.setDuplex( this.__printer.DUPLEX_HORIZONTAL ); + } + oDuplex = $( 'printer_duplexVert' ); + if( !oDuplex.disabled && oDuplex.checked ) + { + this.__printer.setDuplex( this.__printer.DUPLEX_VERTICAL ); + } + + var oMode = $( 'printer_modeBW' ); + if( !oMode.disabled && oMode.checked ) + { + this.__printer.setMode( this.__printer.MODE_MONOCHROME ); + } + oMode = $( 'printer_modeColor' ); + if( !oMode.disabled && oMode.checked ) + { + this.__printer.setMode( this.__printer.MODE_COLOR ); + } + + var oMediaSize = $( 'printer_mediasize' ); + if( !oMediaSize.disabled ) + this.__printer.setMediaSize( oMediaSize.value ); + + }, + + /** + * Handle print report action + * + * @return, true or false + */ + __printAction : function( ) + { + if( !this.__printer ) + return false; + + var docObj = document.getElementById( "Document" ); + if ( !docObj || birtUtility.trim( docObj.innerHTML ).length <= 0) + { + alert ( Constants.error.generateReportFirst ); + return false; + } + 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 selected output format + var action = soapURL; + var reg = new RegExp( "([&|?]{1}" + Constants.PARAM_FORMAT + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_FORMAT + "=" + Constants.FORMAT_POSTSCRIPT; + } + else + { + action = action.replace( reg, "$1=" + Constants.FORMAT_POSTSCRIPT ); + } + + // Delete page, pagerange and parameterpage settings in url if existed + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PAGERANGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_PARAMETERPAGE ); + action = birtUtility.deleteURLParameter( action, Constants.PARAM_EMITTER_ID ); + + if( $( 'printServerPageCurrent' ).checked ) + { + // Set page setting + var currentPage = birtUtility.trim( $( 'pageNumber' ).innerHTML ); + action = action + "&" + Constants.PARAM_PAGE + "=" + currentPage; + } + else if( $( 'printServerPageRange' ).checked ) + { + // Set page range setting + var pageRange = birtUtility.trim( $( 'printServerPageRange_input' ).value ); + if ( !birtUtility.checkPageRange( pageRange ) ) + { + alert( Constants.error.invalidPageRange ); + return false; + } + action = action + "&" + Constants.PARAM_PAGERANGE + "=" + pageRange; + } + + // auto + var pageOverflow = 0; + //var pagebreakonly = "true"; + + // fit to actual size + if( $( 'printServerFitToActual' ).checked ) + { + pageOverflow = 1; + } + //fit to whole page + else if( $( 'printServerFitToWhole' ).checked ) + { + pageOverflow = 2; + } + + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_PAGE_OVERFLOW + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_PAGE_OVERFLOW + "=" + pageOverflow; + } + else + { + action = action.replace( reg, "$1=" + pageOverflow ); + } + + /* + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_PAGEBREAKONLY + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_PAGEBREAKONLY + "=" + pagebreakonly; + } + else + { + action = action.replace( reg, "$1=" + pagebreakonly ); + } + */ + + // Force "__overwrite" as false + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_OVERWRITE + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_OVERWRITE + "=false"; + } + else + { + action = action.replace( reg, "$1=false" ); + } + + // Set action as print + reg = new RegExp( "([&|?]{1}" + Constants.PARAM_ACTION + "\s*)=([^&|^#]*)", "gi" ); + if( action.search( reg ) < 0 ) + { + action = action + "&" + Constants.PARAM_ACTION + "=" + Constants.ACTION_PRINT; + } + else + { + action = action.replace( reg, "$1=" + Constants.ACTION_PRINT ); + } + + // Post printer settings + var curPrinter = this.__findPrinter( this.__printer.getName( ) ); + if( curPrinter ) + { + var param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_NAME; + param.value = this.__printer.getName( ); + + if( curPrinter.isCopiesSupported( ) ) + { + param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_COPIES; + param.value = this.__printer.getCopies( ); + } + + if( curPrinter.isCollateSupported( ) ) + { + param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_COLLATE; + param.value = new String( this.__printer.isCollate( ) ); + } + + if( curPrinter.isDuplexSupported( ) ) + { + param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_DUPLEX; + param.value = this.__printer.getDuplex( ); + } + + if( curPrinter.isModeSupported( ) ) + { + param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_MODE; + param.value = this.__printer.getMode( ); + } + + if( curPrinter.isMediaSupported( ) ) + { + param = document.createElement( "INPUT" ); + formObj.appendChild( param ); + param.TYPE = "HIDDEN"; + param.name = Constants.PARAM_PRINTER_MEDIASIZE; + param.value = this.__printer.getMediaSize( ); + } + } + + formObj.action = action; + formObj.method = "post"; + formObj.target = "birt_confirmation_iframe"; + formObj.submit( ); + } + + return true; + }, + + /** + * Native event handler for select control. + * + * @param event + * @return, void + */ + __neh_select_change : function( event ) + { + this.__updateInfo( ); + }, + + /** + * Native event handler for click 'Print On Server' control. + * + * @param event + * @return, void + */ + __neh_printserver_click : function( event ) + { + var oCtl = Event.element( event ); + + if( oCtl.checked ) + { + this.__enable = true; + $( 'printer' ).disabled = false; + } + else + { + this.__enable = false; + $( 'printer' ).disabled = true; + } + + // Update info + this.__updateInfo( ); + }, + + /** + * Check whether focus on input control + * + * @param oSC + * @return, void + */ + __checkPageRadio : function( oSC ) + { + if( !oSC || oSC.type != 'radio' ) + return; + + var oInput = $( 'printServerPageRange_input' ); + if( oSC.checked && oSC.id == 'printServerPageRange' ) + { + oInput.disabled = false; + oInput.focus( ); + } + else + { + oInput.disabled = true; + oInput.value = ""; + } + }, + + /** + * Native event handler for page radio control. + */ + __neh_pageradio_click : function( event ) + { + var oSC = Event.element( event ); + this.__checkPageRadio( oSC ); + }, + + /** + * Initilize dialog layout + * + * @return, void + */ + __initLayout : function( ) + { + var oSelect = $( 'printer' ); + if( !oSelect ) + return; + + oSelect.disabled = true; + for( var i=0; i<printers.length; i++ ) + { + var oOption = document.createElement( "OPTION" ); + oOption.text = printers[i].name; + oOption.value = printers[i].value.getName( ); + oSelect.options[oSelect.options.length] = oOption; + } + + // Update info + this.__updateInfo( ); + }, + + /** + * Insert HTML in a control + * + * @param id + * @param text + * @return, void + */ + __insertHTML : function( id,text ) + { + var oControl = $( id ); + if( oControl ) + { + oControl.innerHTML = text; + } + }, + + /** + * 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; + } + }, + + /** + * Find certain printer object by name + * + * @param name + * @return, void + */ + __findPrinter : function( name ) + { + var curPrinter; + for( var i=0; i<printers.length; i++ ) + { + if( name == printers[i].name ) + { + curPrinter = printers[i].value; + break; + } + } + + return curPrinter; + }, + + /** + * Update generate information + * + * @return, void + */ + __updateInfo : function( ) + { + var printerName = $( 'printer' ).value; + var curPrinter = this.__findPrinter( printerName ); + if( !curPrinter ) + { + this.__enable = false; + this.__setDisabled( 'printer_config',true ); + this.__setDisabled( 'printServerPageSetting',true ); + this.__setDisabled( 'printServerFitSetting',true ); + return; + } + + this.__printer = curPrinter; + + // Generate info + this.__insertHTML( 'printer_status', curPrinter.getStatus( ) ); + this.__insertHTML( 'printer_model', curPrinter.getModel( ) ); + this.__insertHTML( 'printer_info', curPrinter.getInfo( ) ); + + // Print settings + if( this.__enable ) + { + this.__setDisabled( 'printer_config',false ); + this.__setDisabled( 'printServerPageSetting',false ); + this.__setDisabled( 'printServerFitSetting',false ); + var oInputs = $( 'printServerPageSetting' ).getElementsByTagName( 'input' ); + for( var i=0; i<oInputs.length; i++ ) + this.__checkPageRadio( oInputs[i] ); + } + else + { + this.__setDisabled( 'printer_config',true ); + this.__setDisabled( 'printServerPageSetting',true ); + this.__setDisabled( 'printServerFitSetting',true ); + } + + if( curPrinter.isCopiesSupported( ) ) + { + $( 'printer_copies' ).value = curPrinter.getCopies( ); + } + else + { + $( 'printer_copies' ).disabled = true; + } + + if( curPrinter.isCollateSupported( ) ) + { + if( curPrinter.isCollate( ) ) + $( 'printer_collate' ).checked = true; + else + $( 'printer_collate' ).checked = false; + } + else + { + $( 'printer_collate' ).disabled = true; + $( 'printer_collate' ).checked = false; + } + + if( curPrinter.isDuplexSupported( ) ) + { + var duplex = curPrinter.getDuplex( ); + switch( duplex ) + { + case curPrinter.DUPLEX_SIMPLEX: + $( 'printer_duplexSimplex' ).checked = true; + break; + case curPrinter.DUPLEX_HORIZONTAL: + $( 'printer_duplexHorz' ).checked = true; + break; + case curPrinter.DUPLEX_VERTICAL: + $( 'printer_duplexVert' ).checked = true; + break; + default: + $( 'printer_duplexSimplex' ).checked = true; + } + } + else + { + $( 'printer_duplexSimplex' ).disabled = true; + $( 'printer_duplexSimplex' ).checked = false; + + $( 'printer_duplexHorz' ).disabled = true; + $( 'printer_duplexHorz' ).checked = false; + + $( 'printer_duplexVert' ).disabled = true; + $( 'printer_duplexVert' ).checked = false; + } + + if( curPrinter.isModeSupported( ) ) + { + var mode = curPrinter.getMode( ); + switch( mode ) + { + case curPrinter.MODE_MONOCHROME: + $( 'printer_modeBW' ).checked = true; + break; + case curPrinter.MODE_COLOR: + $( 'printer_modeColor' ).checked = true; + break; + default: + $( 'printer_modeBW' ).checked = true; + } + } + else + { + $( 'printer_modeBW' ).disabled = true; + $( 'printer_modeBW' ).checked = false; + + $( 'printer_modeColor' ).disabled = true; + $( 'printer_modeColor' ).checked = false; + } + + if( curPrinter.isMediaSupported( ) ) + { + var mediaSize = curPrinter.getMediaSize( ); + var mediaSizeNames = curPrinter.getMediaSizeNames( ); + var oSize = $( 'printer_mediasize' ); + oSize.length = 0; + for( var i=0; i<mediaSizeNames.length; i++ ) + { + var oOption = document.createElement( "OPTION" ); + var oLabel = document.createElement( "LABEL" ); + oLabel.innerHTML = mediaSizeNames[i].name; + oOption.text = oLabel.innerHTML; + oOption.value = mediaSizeNames[i].value; + + if( mediaSizeNames[i].value == mediaSize ) + oOption.selected = true; + + oSize.options[oSize.options.length] = oOption; + } + } + else + { + $( 'printer_mediasize' ).length = 0; + $( 'printer_mediasize' ).disabled = true; + } + }, + + /** + 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/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js ------------------------------------------------------------------------------ svn:keywords = "Date Rev Author URL Id" Propchange: ofbiz/branches/addbirt/framework/birt/webapp/birt/webcontent/birt/ajax/ui/dialog/BirtPrintReportServerDialog.js ------------------------------------------------------------------------------ svn:mime-type = text/plain |
Free forum by Nabble | Edit this page |