dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09515
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2543: Fixed bug <697979> Excel report express not well form. And fixed code style.
------------------------------------------------------------
revno: 2543
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-01-12 15:57:11 +0700
message:
Fixed bug <697979> Excel report express not well form. And fixed code style.
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/manager/DefaultInitializePOIStylesManager.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/addReportExcelItemForm.vm
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/updateReportExcelItemForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-01-12 07:26:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-01-12 08:57:11 +0000
@@ -1052,12 +1052,12 @@
*/
function addValidatorRulesById( inputId, rules )
{
- addValidatorRules(jQuery("#" + inputId), rules);
+ addValidatorRules( jQuery("#" + inputId), rules );
}
function addValidatorRules( input, rules )
{
- jQuery(input).rules("add",rules );
+ jQuery(input).rules( "add", rules );
}
/**
@@ -1068,12 +1068,12 @@
*/
function removeValidatorRulesById( inputId, rules )
{
- removeValidatorRules( jQuery("#" + inputId) );
+ removeValidatorRules( jQuery("#" + inputId), rules );
}
function removeValidatorRules( input, rules )
{
- jQuery(input).rules("remove", rules );
+ jQuery(input).rules( "remove", rules );
}
function listValidator( validatorId, selectedListId )
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2010-12-21 05:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/export/action/GenerateReportSupport.java 2011-01-12 08:57:11 +0000
@@ -93,7 +93,8 @@
public abstract class GenerateReportSupport
implements Action
{
-
+ private static final String NULL_REPLACEMENT = "0";
+
protected static final short CELLSTYLE_ALIGN_LEFT = CellStyle.ALIGN_LEFT;
protected static final short CELLSTYLE_ALIGN_CENTER = CellStyle.ALIGN_CENTER;
@@ -106,8 +107,6 @@
protected static final short CELLSTYLE_BORDER_COLOR = IndexedColors.DARK_BLUE.getIndex();
- private static final String NULL_REPLACEMENT = "0";
-
protected static final String[] chappter = { "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI",
"XII", "XIII", "XIV", "XV", "XVI", "XVII", "XVIII", "XIX", "XX", "XXI", "XXII", "XXIII", "XXIV", "XXV", "XXVI",
"XXVII", "XXVIII", "XXIX", "XXX" };
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java 2011-01-07 11:38:55 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/item/action/AddReportExcelItemAction.java 2011-01-12 08:57:11 +0000
@@ -118,7 +118,6 @@
public String execute()
throws Exception
{
-
ReportExcelItem reportItem = new ReportExcelItem();
reportItem.setName( name );
reportItem.setItemType( itemType );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/manager/DefaultInitializePOIStylesManager.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/manager/DefaultInitializePOIStylesManager.java 2010-04-13 05:48:31 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/preview/manager/DefaultInitializePOIStylesManager.java 2011-01-12 08:57:11 +0000
@@ -40,10 +40,10 @@
public class DefaultInitializePOIStylesManager
implements InitializePOIStylesManager
{
+ // -------------------------------------------------------------------------
+ // Variables
+ // -------------------------------------------------------------------------
- /** ************************************************** */
- /** Variables */
- /** ************************************************** */
private static final String STYLE_DEFAULT_TITLE_CENTER = "Center Header";
private static final String STYLE_DEFAULT_TITLE_LEFT = "Left Header";
@@ -67,9 +67,9 @@
private static final short STYLE_DEFAULT_BORDER_COLOR = IndexedColors.LIGHT_ORANGE.getIndex();
- /***************************************************************************
- * Default Methods - Using for XLS Extension
- **************************************************************************/
+ // -------------------------------------------------------------------------
+ // Default Methods - Using for XLS Extension
+ // -------------------------------------------------------------------------
@SuppressWarnings( "static-access" )
public void initDefaultHeader( HSSFHeader poi_header )
@@ -77,7 +77,7 @@
poi_header.setCenter( this.STYLE_DEFAULT_TITLE_CENTER );
poi_header.setLeft( this.STYLE_DEFAULT_TITLE_LEFT );
poi_header.setRight( this.STYLE_DEFAULT_TITLE_RIGHT );
-
+
}
@SuppressWarnings( "static-access" )
@@ -87,7 +87,7 @@
poi_font.setFontHeightInPoints( this.STYLE_DEFAULT_FONT_HEIGHT );
poi_font.setBoldweight( this.STYLE_DEFAULT_FONT_WEIGHT );
poi_font.setColor( this.STYLE_DEFAULT_FONT_COLOR );
-
+
}
@SuppressWarnings( "static-access" )
@@ -108,10 +108,10 @@
}
- /** ************************************************** */
- /** Customized Methods - Using for XLS Extension */
- /** ************************************************** */
-
+ // -------------------------------------------------------------------------
+ // Customized Methods - Using for XLS Extension
+ // -------------------------------------------------------------------------
+
public void initHeader( HSSFHeader poi_header, String center, String left, String right )
{
@@ -124,7 +124,7 @@
public void initFont( Font poi_font, String fontName, short fontHeightInPoints, short boldWeight, short fontColor )
{
- poi_font.setFontName( fontName );
+ poi_font.setFontName( fontName );
poi_font.setFontHeightInPoints( fontHeightInPoints );
poi_font.setBoldweight( boldWeight );
poi_font.setColor( fontColor );
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2010-12-16 04:49:14 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/reportItem.js 2011-01-12 08:57:11 +0000
@@ -3,52 +3,30 @@
value = getFieldValue( 'itemType' );
enable( 'expression-button' );
+ setFieldValue( 'reportItem input[id=expression]', getFieldValue( 'reportItem input[id=currentExpression]') );
+
if( value == 'dataelement' ){
byId('expression-button' ).onclick = deExpressionBuilderForm;
}else if( value == 'indicator' ){
- byId('expression-button' ).onclick = inExpressionBuilderForm ;
+ byId('expression-button' ).onclick = inExpressionBuilderForm ;
}else if( value == 'formulaexcel' ){
- byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
+ byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
}else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name' ){
disable( 'expression-button' );
- setFieldValue( 'expression', value );
- }
-}
-
-function cleanFormula()
-{
- setFieldValue( 'formula','');
+ setFieldValue( 'reportItem input[id=expression]', value );
+ removeValidatorRulesById( 'reportItem input[id=expression]' );
+ removeValidatorRulesById( 'dataelement textarea[id=formula]' );
+ }
}
function insertOperation( value ) {
byId('formula').value += value;
-}
-
-function changeItemType()
-{
- value = getFieldValue( 'itemType' );
- enable( 'expression-button' );
-
- if( value == 'dataelement' ){
- byId('expression-button' ).onclick = deExpressionBuilderForm;
- }else if( value == 'indicator' ){
- byId('expression-button' ).onclick = inExpressionBuilderForm ;
- }else if( value == 'formulaexcel' ){
- byId('expression-button' ).onclick = excelFormulaExpressionBuilderForm ;
- }else if( value == 'organisation' || value == 'serial' || value == 'dataelement_code' || value == 'dataelement_name'){
- disable( 'expression-button' );
- setFieldValue( 'expression', value );
- }
}
function cleanFormula()
{
setFieldValue( 'formula','');
setInnerHTML( 'expression-description', '');
-}
-
-function insertOperation( value ) {
- byId('formula').value += value;
}
function insertExpression()
@@ -61,7 +39,7 @@
}
function getExpression()
-{
+{
jQuery.postJSON( '../dhis-web-commons-ajax-json/getExpressionText.action',
{ expression: getFieldValue('formula')}, function( json ){
if(json.response == 'success'){
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/addReportExcelItemForm.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/addReportExcelItemForm.vm 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/addReportExcelItemForm.vm 2011-01-12 08:57:11 +0000
@@ -1,9 +1,8 @@
<script>
jQuery(document).ready(function(){
- validation( 'reportItem', function( form ){
- validateAddReportExcelItem( form );
- });
- changeItemType();
+ validation( 'reportItem', function( form ){
+ validateAddReportExcelItem( form );
+ });
});
var category = $reportExcel.isCategory();
@@ -60,13 +59,13 @@
<td><label>$i18n.getString('expression')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
<input type="button" id="expression-button" value="$i18n.getString('expression')" style="width:20em"/>
- <input type="hidden" id="expression" name="expression" style="width:15em" class="{validate:{required:true}}"/>
+ <input type="text" id="expression" name="expression" style="width:15em" class="{validate:{required:true}}"/>
</td>
</tr>
<tr>
<td><label>$i18n.getString('sheet_no')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="sheetNo" name="sheetNo" style="width:20em" class="{validate:{required:true,number:true}}"/></td>
+ <td><input type="text" id="sheetNo" name="sheetNo" style="width:20em" class="{validate:{required:true,number:true}}"/></td>
</tr>
<tr>
<td><label>$i18n.getString('row')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2011-01-07 11:38:55 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/dataelementExpressionBuilderForm.vm 2011-01-12 08:57:11 +0000
@@ -1,16 +1,17 @@
<script>
var deExpressionValidator = null;
- jQuery(document).ready(function(){
- deExpressionValidator = validation( 'dataelement-form', function(){
+ jQuery(document).ready(function(){
+ deExpressionValidator = validation( 'dataelement-form', function(){
updateDeExpression();
- });
- #if(!$reportExcel.isCategory())
- remoteValidate( jQuery( "#dataelement textarea[id=formula]"), '../dhis-web-commons-ajax-json/getExpressionText.action' );
+ });
+
+ #if( !$reportExcel.isCategory() )
+ remoteValidate( jQuery( "#dataelement textarea[id=formula]" ), '../dhis-web-commons-ajax-json/getExpressionText.action' );
#end
-
- });
-
+
+ changeItemType();
+ });
</script>
@@ -33,7 +34,7 @@
</td>
<td>
#if(!$reportExcel.isCategory())
- <select id="groupSelect" style="width:500px"onchange="getDataElements(this.value, '#dataelement select[id=elementSelect]')"></select>
+ <select id="groupSelect" style="width:500px" onchange="getDataElements(this.value, '#dataelement select[id=elementSelect]')"></select>
#end
<select id="elementSelect" size="15" style="width:500px;" ondblclick="insertExpression()"></select>
</td>
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/updateReportExcelItemForm.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/updateReportExcelItemForm.vm 2010-09-08 10:40:26 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/report/updateReportExcelItemForm.vm 2011-01-12 08:57:11 +0000
@@ -2,9 +2,7 @@
jQuery(document).ready(function(){
validation( 'reportItem', function( form ){
validateUpdateReportExcelItem( form );
- });
- changeItemType();
-
+ });
});
var category = $reportExcel.isCategory();
@@ -16,6 +14,7 @@
<form id="reportItem" name="reportItem" method="post" action="updateReportExcelItem.action">
<input type="hidden" id="reportId" name="reportId" value="$reportExcel.id"/>
<input type="hidden" id="id" name="id" value="$reportExcelItem.id"/>
+ <input type="hidden" id="currentExpression" name="currentExpression" value="$reportExcelItem.expression"/>
<table>
<tr>
<th colspan="2">$i18n.getString( 'report_excel' )</th>