dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07309
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2064: update excel reporting module
------------------------------------------------------------
revno: 2064
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Mon 2010-09-06 10:18:03 +0700
message:
update excel reporting module
added:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/UpdateExcelItemFormAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/listDataElementGroupByExcelItemGroup.vm
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/updateExcelItem.vm
modified:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js
--
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
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/UpdateExcelItemFormAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/UpdateExcelItemFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/excelitem/action/UpdateExcelItemFormAction.java 2010-09-06 03:18:03 +0000
@@ -0,0 +1,126 @@
+package org.hisp.dhis.reportexcel.excelitem.action;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.dataelement.DataElement;
+import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.dataelement.DataElementOperand;
+import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.expression.ExpressionService;
+import org.hisp.dhis.reportexcel.excelitem.ExcelItem;
+import org.hisp.dhis.reportexcel.excelitem.ExcelItemService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id$
+ */
+public class UpdateExcelItemFormAction
+ implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private ExcelItemService excelItemService;
+
+ public void setExcelItemService( ExcelItemService excelItemService )
+ {
+ this.excelItemService = excelItemService;
+ }
+
+ private ExpressionService expressionService;
+
+ public void setExpressionService( ExpressionService expressionService )
+ {
+ this.expressionService = expressionService;
+ }
+
+ private DataElementService dataElementService;
+
+ public void setDataElementService( DataElementService dataElementService )
+ {
+ this.dataElementService = dataElementService;
+ }
+
+ private DataElementCategoryService categoryService;
+
+ public void setCategoryService( DataElementCategoryService categoryService )
+ {
+ this.categoryService = categoryService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input && Output
+ // -------------------------------------------------------------------------
+
+ private Integer excelItemId;
+
+ public void setExcelItemId( Integer excelItemId )
+ {
+ this.excelItemId = excelItemId;
+ }
+
+ private ExcelItem excelItem;
+
+ public ExcelItem getExcelItem()
+ {
+ return excelItem;
+ }
+
+ private DataElementOperand dataElementOperand;
+
+ public DataElementOperand getDataElementOperand()
+ {
+ return dataElementOperand;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ excelItem = excelItemService.getExcelItem( excelItemId );
+
+ DataElementOperand operand = expressionService.getOperandsInExpression( excelItem.getExpression() ).iterator()
+ .next();
+
+ DataElement dataElement = dataElementService.getDataElement( operand.getDataElementId() );
+
+ DataElementCategoryOptionCombo optionCombo = categoryService.getDataElementCategoryOptionCombo( operand.getOptionComboId() );
+
+ dataElementOperand = new DataElementOperand( dataElement, optionCombo );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/listDataElementGroupByExcelItemGroup.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/listDataElementGroupByExcelItemGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/listDataElementGroupByExcelItemGroup.vm 2010-09-06 03:18:03 +0000
@@ -0,0 +1,105 @@
+<h3>$i18n.getString('dataelement_groups')</h3>
+<div id="tooltip"></div>
+<h4><font color="green">$!encoder.htmlEncode($!excelItemGroup.name)</font></h4>
+<p></p>
+<table width="800px">
+ <tr>
+ <td colspan=2>
+ <input type="button" onclick="openAddDataElementGroupOrder()" value="$i18n.getString('add')" style="width:100px"/>
+ <input type="button" value="$i18n.getString( "cancel" )" onclick="window.location='listAllExcelItemGroup.action'" style="width:100px">
+ </td>
+ <td width="100px">
+ <input type="button" value="$i18n.getString( "update_order" )" onclick="updateDataElementGroupOrder()" style="width:150px">
+ </td>
+ </tr>
+ <tr>
+ <th>$i18n.getString('name')</th>
+ <th width="100px">$i18n.getString('code')</th>
+ <th width="100px">$i18n.getString('operations')</th>
+ </tr>
+</table>
+
+
+<ul id="sortable">
+#foreach($group in $excelItemGroup.dataElementOrders)
+ <li class="ui-state-default" name="dataElementGroupOrder" value="$group.id" title="$i18n.getString( 'sort_order_help' )">
+ <table cellspacing="0" cellpadding="0" width="100%">
+ <tr>
+ <td>$encoder.htmlEncode( $group.name )</td>
+ <td width="100px">$encoder.htmlEncode( $group.code )</td>
+ <td width="100px">
+ <a href="javascript:deleteDataElementGroupOrder('$group.id');" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+ <a href="javascript:openUpdateDataElementOrder( '$group.id' );" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <a href="openSortDataElementForCategory.action?id=$group.id" title="$i18n.getString( 'sort_dataelement' )"><img src="../images/sort.png" border="1px"/></a>
+ </td>
+ </tr>
+ </table>
+
+ </li>
+#end
+</ul>
+
+<form name="dataElementGroups" method="post">
+<input type="hidden" name="id" id="id" value="$excelItemGroup.id"/>
+<input type="hidden" name="dataElementGroupOrderId" id="dataElementGroupOrderId"/>
+<div id="dataElementGroups" style="position:fixed;display:none;width:680px;z-index:10001;background-color: white;border: medium solid silver;height:280px;padding:20px;">
+ <div id="close" style="position:absolute;top:2px;right:2px;cursor: pointer;color:red;" onclick="hideById('dataElementGroups');deleteDivEffect();">[x]</div>
+ <table>
+ <tr>
+ <td>$i18n.getString('name')</td>
+ <td><input type="text" style="width:350px" id="name" name="name" /></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString('code')</td>
+ <td><input type="text" style="width:350px" id="code" name="code"/></td>
+ </tr>
+ </table>
+
+ <br/>
+ <div style="width:100%;overflow:auto">
+ <table width="100%">
+ <tr>
+ <td colspan="3">
+ <select id="availableDataElementGroups" onchange="getDataElementsByGroup(this.value)" style="width:400px"></select>
+ </td>
+ </tr>
+ <tr>
+ <td width="31%">
+ <select id="availableDataElements" multiple size=10 style="width:300px" onMouseOut="javascript: hideToolTip();" ondblclick="moveSelectedById('availableDataElements','dataElementIds'); showText('dataElementIds')"></select>
+ </td>
+ <td width="5%" align="center">
+ <input type="button" value=">" onclick="moveSelectedById('availableDataElements','dataElementIds');" style="width:50px"/><br>
+ <input type="button" value="<" onclick="moveSelectedById('dataElementIds' , 'availableDataElements' );" style="width:50px"/><br>
+ <input type="button" value=">>" onclick="moveAllById('availableDataElements' , 'dataElementIds' );" style="width:50px"/><br>
+ <input type="button" value="<<" onclick="moveAllById('dataElementIds' , 'availableDataElements' );" style="width:50px"/>
+ </td>
+ <td width="64%">
+ <select id="dataElementIds" name="dataElementIds" onMouseOut="javascript: hideToolTip();" multiple size=10 style="width:300px" ondblclick="moveSelectedById('dataElementIds' , 'availableDataElements' ); ; showText('availableDataElements')" ></select>
+ </td>
+ </tr>
+ </table>
+ </div>
+
+ <p align=center>
+ <input type="button" value="$i18n.getString( 'save' )" style="width:130px" onclick="submitDataElementGroupOrder()">
+ </p>
+</div>
+</form>
+
+<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="javascript:hideById(this.id);"></span>
+
+
+<script>
+ var i18n_confirm_delete = '$encoder.jsEscape($i18n.getString( 'confirm_delete' ) , "'")';
+ var i18n_name_is_null = '$encoder.jsEscape($i18n.getString( 'i18n_name_is_null' ) , "'")';
+ var excelItemGroupId = $excelItemGroup.id;
+ $(function() {
+ $("#sortable").sortable({
+ placeholder: 'ui-state-highlight'
+ });
+ $("#sortable").disableSelection();
+
+ });
+</script>
+
+
=== added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/updateExcelItem.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/updateExcelItem.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/import/updateExcelItem.vm 2010-09-06 03:18:03 +0000
@@ -0,0 +1,110 @@
+<script>
+ jQuery(document).ready(function(){
+ validation( 'addExcelItem', function( form ){
+ form.submit();
+ });
+ checkValueIsExist( "name", "validateExcelItem.action", {
+ excelItemGroupId: getFieldValue( 'excelItemGroupId' ),
+ id: getFieldValue( 'excelItemId' )
+ } );
+
+ checkValueIsExist( "row", "validateExcelItem.action", {
+ excelItemGroupId: getFieldValue( 'excelItemGroupId' ),
+ sheetNo: function(){ return getFieldValue( 'sheetNo' )},
+ row: function(){ return getFieldValue( 'row' )},
+ column: function(){ return getFieldValue( 'column' )},
+ id: getFieldValue( 'excelItemId' )
+ } );
+
+ checkValueIsExist( "sheetNo", "validateExcelItem.action", {
+ excelItemGroupId: getFieldValue( 'excelItemGroupId' ),
+ sheetNo: function(){ return getFieldValue( 'sheetNo' )},
+ row: function(){ return getFieldValue( 'row' )},
+ column: function(){ return getFieldValue( 'column' )},
+ id: getFieldValue( 'excelItemId' )
+ } );
+
+ checkValueIsExist( "column", "validateExcelItem.action", {
+ excelItemGroupId: getFieldValue( 'excelItemGroupId' ),
+ sheetNo: function(){ return getFieldValue( 'sheetNo' )},
+ row: function(){ return getFieldValue( 'row' )},
+ column: function(){ return getFieldValue( 'column' )},
+ id: getFieldValue( 'excelItemId' )
+ } );
+
+ loadDataElementGroups("select[id=groupSelect]") ;
+ });
+</script>
+
+<h3>$i18n.getString('import_item') : $i18n.getString('add')</h3>
+
+<form name="addExcelItem" id="addExcelItem" method="POST" action="updateExcelItem.action">
+ <input type="hidden" id="excelItemGroupId" name="excelItemGroupId" value="$!excelItemGroup.id"/>
+ <input type="hidden" id="excelItemId" name="id" value="$!excelItem.id"/>
+ <table>
+ <tr>
+ <th colspan='2'>$i18n.getString('excel_importing')</th>
+ </tr>
+ <tr>
+ <td>$i18n.getString('name'): </td>
+ <td>$encoder.htmlEncode( $excelItemGroup.name )</td>
+ </tr>
+ <tr>
+ <td>$i18n.getString('import_type'): </td>
+ <td>$excelItemGroup.type</td>
+ </tr>
+ <tr>
+ <td colspan="2" height="20px"></td>
+ </tr>
+ <tr>
+ <th colspan='2'>$i18n.getString('import_item')</th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString('name')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $excelItem.name )" style="width:20em" class="{validate:{required:true}}"/></td>
+ </tr>
+ <tr>
+ <td rowspan=2><label>$i18n.getString('dataelement')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td>
+ <select id="groupSelect" style="width:500px"onchange="getOperandsByDataElementGroup(this.value)"></select>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <select id="elementSelect" style="width:500px;" name="expression" class="{validate:{required:true}}">
+ <option value="[$dataElementOperand.getPersistedId()]">$encoder.htmlEncode( $dataElementOperand.getPersistedName() )</option>
+ </select>
+ </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" value="$excelItem.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>
+ <td><input type="text" id="row" name="row" value="$excelItem.row" style="width:20em" class="{validate:{required:true,number:true}}"/></td>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString('column')<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="column" name="column" value="$excelItem.column" style="width:20em" class="{validate:{required:true,number:true}}"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString('save')" style="width:10em"/>
+ <input type="button" value="$i18n.getString('cancel')" onclick="window.location='listExcelItems.action?excelItemGroupId=$excelItemGroup.id'" style="width:10em"/>
+ </td>
+ </tr>
+</table>
+
+</form>
+
+<script>
+ function getOperandsByDataElementGroup( value )
+ {
+ loadOperands( "#elementSelect", {id: value});
+ }
+</script>
+
+
+
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js 2010-03-08 04:35:44 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/imports.js 2010-09-06 03:18:03 +0000
@@ -36,7 +36,7 @@
function importDataCompleted( xmlObject ){
- setMessage(xmlObject.firstChild.nodeValue);
+ showSuccessMessage(xmlObject.firstChild.nodeValue);
}
// -----------------------------------------------------------------------------