Tuesday, October 26, 2010

Date Picker for Eclipse BIRT

This would be helpful to Eclipse Birt users who would want to have a date-picker calender .
Below are the steps to follow;
download the zip file from the link below

Dynarch.com

Unzip the downloaded file to a staging location.

copy the content of src folder to your application root folder.

edit  birt2.6.0\webcontent\birt\pages\parameter\TextBoxParameterFragment.jsp to include the following lines just after the definition of input type=text/password. As of the current BIRT version 2.6.0 input type definition looks like this;
<INPUT 
 TYPE="<%= parameterBean.isValueConcealed( )?
"PASSWORD" : "TEXT" %>"
NAME="<%= encodedParameterName %>"
 ID="<%= encodedParameterName %>" 
 TITLE="<%= parameterBean.getToolTip( ) %>"
 VALUE="<%= ParameterAccessor.htmlEncode( 
( parameterBean.getDisplayText( )== 
null )? "" : parameterBean.getDisplayText( ) ) %>" 
 <%= ( !parameterBean.isRequired( ) && parameterBean.getValue( )
== null )? "DISABLED='true'" : "" %>
 <%= parameterBean.isRequired( ) ? "aria-required='true'" : "" %>
 >
Find the above definition and add the following code just below it.
<%
if (parameterBean.getParameter().getDataType()==7|| 
parameterBean.getParameter().getDataType()==4) {
%>
<img ="" id="<%=parameterBean.getName()
%>_img" style="border: 0px none; cursor: pointer;" >
 title="Date selector"
 onmouseover="this.style.background='gray';"
 height="18"
 src="/birt/images/calendar.gif"
 width="19"
 align="center"
 onmouseout="this.style.background=''" />


 <%
 }
 %>

Edit  birt2.6.0\webcontent\birt\pages\layoutFramesetFragment.jsp by adding the above lines of code within the head tag
<link href="/birt2.6.0/css/jscal2.css" rel="stylesheet" 
type="text/css"></link >
 <link href="/birt2.6.0/css/border-radius.css" rel="stylesheet"
type="text/css"></link>
 <link href="/birt2.6.0/css/gold/gold.css" rel="stylesheet"
type="text/css"></link>
 <script src="/birt2.6.0/js/jscal2.js" type="text/javascript">
</script>
<script src="/birt2.6.0/js/lang/en.js" type="text/javascript">
</script>
Make sure that you edit your file path within FramesetFragment.jsp to match your application path
Lastly,
Add calender icon to \birt2.6.0\webcontent\birt\images. Make sure that it is named calender.gif.