dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03626
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1209: change GUI for sort data element in report excel
------------------------------------------------------------
revno: 1209
committer: Tran Thanh Tri <Tran Thanh Tri@compaq>
branch nick: trunk
timestamp: Fri 2009-12-11 11:27:39 +0700
message:
change GUI for sort data element in report excel
modified:
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/GetReportExcelAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/GetDataElementGroupOrderAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateSortedDataElementAction.java
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js
dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/sortDataElements.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-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/GetReportExcelAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/GetReportExcelAction.java 2009-11-13 10:28:52 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/action/GetReportExcelAction.java 2009-12-11 04:27:39 +0000
@@ -27,9 +27,9 @@
package org.hisp.dhis.reportexcel.action;
-
import org.hisp.dhis.reportexcel.ReportExcel;
import org.hisp.dhis.reportexcel.ReportExcelService;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
/**
* @author Tran Thanh Tri
@@ -44,6 +44,8 @@
private ReportExcelService reportService;
+ private SelectionManager selectionManager;
+
// -------------------------------------------
// Input & Output
// -------------------------------------------
@@ -61,6 +63,11 @@
this.reportService = reportService;
}
+ public void setSelectionManager( SelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
public ReportExcelService getReportService()
{
return reportService;
@@ -95,13 +102,15 @@
{
if ( id != null )
{
+ selectionManager.setSelectedReportId( id );
+
report = reportService.getReportExcel( id );
}
else
{
return ERROR;
}
-
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/GetDataElementGroupOrderAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/GetDataElementGroupOrderAction.java 2009-09-14 15:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/GetDataElementGroupOrderAction.java 2009-12-11 04:27:39 +0000
@@ -75,6 +75,8 @@
throws Exception
{
dataElementGroupOrder = reportService.getDataElementGroupOrder( id );
+
+
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateSortedDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateSortedDataElementAction.java 2009-09-14 12:56:14 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/category/action/UpdateSortedDataElementAction.java 2009-12-11 04:27:39 +0000
@@ -35,6 +35,7 @@
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.reportexcel.DataElementGroupOrder;
import org.hisp.dhis.reportexcel.ReportExcelService;
+import org.hisp.dhis.reportexcel.state.SelectionManager;
import com.opensymphony.xwork2.Action;
@@ -53,12 +54,16 @@
private DataElementService dataElementService;
+ private SelectionManager selectionManager;
+
// -------------------------------------------
// Input & Output
// -------------------------------------------
private Integer id;
+ private Integer reportId;
+
private List<String> dataElementIds = new ArrayList<String>();
public String message;
@@ -74,6 +79,16 @@
return message;
}
+ public Integer getReportId()
+ {
+ return reportId;
+ }
+
+ public void setSelectionManager( SelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
public void setReportService( ReportExcelService reportService )
{
this.reportService = reportService;
@@ -89,6 +104,11 @@
this.id = id;
}
+ public Integer getId()
+ {
+ return id;
+ }
+
public void setDataElementIds( List<String> dataElementIds )
{
this.dataElementIds = dataElementIds;
@@ -119,6 +139,8 @@
this.message = i18n.getString( "update_sort_dataelement_success" );
reportService.updateDataElementGroupOrder( dataElementGroupOrder );
+
+ reportId = selectionManager.getSelectedReportId();
return SUCCESS;
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-12-09 08:57:51 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2009-12-11 04:27:39 +0000
@@ -124,6 +124,7 @@
<bean id="org.hisp.dhis.reportexcel.action.GetReportExcelAction"
class="org.hisp.dhis.reportexcel.action.GetReportExcelAction" scope="prototype">
<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
+ <property name="selectionManager" ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
</bean>
<bean id="org.hisp.dhis.reportexcel.action.GetReportExcelGroupsAction"
@@ -268,6 +269,7 @@
scope="prototype">
<property name="reportService" ref="org.hisp.dhis.reportexcel.ReportExcelService" />
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
+ <property name="selectionManager" ref="org.hisp.dhis.reportexcel.state.SelectionManager" />
</bean>
<bean
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-12-04 06:39:28 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module.properties 2009-12-11 04:27:39 +0000
@@ -175,3 +175,5 @@
choose_dataelement = Not choose dataelement yet
warning_upload_is_null = Please choose your excel file to upload !
list_of_excel_items = List of excel items
+selected_dataelements = Selected Data Elements
+available_dataelements = Available Data Elements
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-12-04 05:00:32 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/org/hisp/dhis/reportexcel/i18n_module_vi_VN.properties 2009-12-11 04:27:39 +0000
@@ -174,4 +174,6 @@
import_data = Import d\u1eef li\u1ec7u
select_report = [Ch\u1ecdn b\u00e1o c\u00e1o]
warning_upload_is_null = Xin vui l\u00f2ng ch\u1ecdn file excel c\u1ea7n upload !
-list_of_excel_items = Danh s\u00e1ch c\u00e1c excel item
\ No newline at end of file
+list_of_excel_items = Danh s\u00e1ch c\u00e1c excel item
+selected_dataelements = Ph\u1ea7n t\u1eed c\u00f3 s\u1eb5n
+available_dataelements = Ph\u1ea7n t\u1eed \u0111\u01b0\u1ee3c ch\u1ecdn
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-12-09 08:57:51 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2009-12-11 04:27:39 +0000
@@ -231,8 +231,8 @@
<action name="updateSortedDataElements"
class="org.hisp.dhis.reportexcel.category.action.UpdateSortedDataElementAction">
- <result name="success" type="velocity-xml">
- /dhis-web-excel-reporting/responseSuccess.vm</result>
+ <result name="success" type="redirect">
+ listDataElementGroupOrder.action?id=${reportId}</result>
</action>
<action name="updateSortDataElementGroupOrder"
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js 2009-12-09 10:26:46 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/javascript/dataElementGroup.js 2009-12-11 04:27:39 +0000
@@ -1,13 +1,12 @@
/*
- * Open Add Data Element Group Order
- */
-function openAddDataElementGroupOrder() {
-
+* Open Add Data Element Group Order
+*/
+function openAddDataElementGroupOrder(){
getALLDataElementGroups();
document.forms['dataElementGroups'].action = "addDataElementGroupOrder.action";
}
-function getALLDataElementGroups() {
+function getALLDataElementGroups(){
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
@@ -19,27 +18,23 @@
}
-function getALLDataElementGroupsReceived( xmlObject ) {
+function getALLDataElementGroupsReceived(xmlObject){
- var availableDataElementGroups = document.getElementById( 'availableDataElementGroups' );
+ var availableDataElementGroups = document.getElementById('availableDataElementGroups');
availableDataElementGroups.options.length = 0;
- var dataElementGroups = xmlObject.getElementsByTagName( 'dataElementGroup' );
-
+ var dataElementGroups = xmlObject.getElementsByTagName('dataElementGroup');
availableDataElementGroups.options.add(new Option("ALL", null));
-
- for( var i = 0 ; i < dataElementGroups.length ; i++ ) {
-
+ for(var i=0;i<dataElementGroups.length;i++){
var id = dataElementGroups.item(i).getElementsByTagName('id')[0].firstChild.nodeValue;
var name = dataElementGroups.item(i).getElementsByTagName('name')[0].firstChild.nodeValue;
availableDataElementGroups.options.add(new Option(name, id));
}
-
- getDataElementsByGroup( byId("availableDataElementGroups").value );
+ getDataElementsByGroup(byId("availableDataElementGroups").value);
}
/*
* Get Data Elements By Data Element Group
*/
-function getDataElementsByGroup( id ) {
+function getDataElementsByGroup( id ){
var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + id;
@@ -49,12 +44,10 @@
request.send( url );
}
-function getDataElementsByGroupReceived( datalement ) {
-
+function getDataElementsByGroupReceived( datalement ){
var dataElements = datalement.getElementsByTagName( "dataElement" );
- var listDataElement = document.getElementById( 'availableDataElements' );
+ var listDataElement = document.getElementById('availableDataElements');
listDataElement.options.length = 0;
-
for ( var i = 0; i < dataElements.length; i++ )
{
var id = dataElements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
@@ -62,33 +55,25 @@
listDataElement.options.add(new Option(name, id));
}
- var availableDataElements = document.getElementById( 'availableDataElements' );
- var selectedDataElements = document.getElementById( 'selectedDataElements' );
-
- for( var i = 0 ; i < availableDataElements.options.length ; i++ ) {
-
- for(var j = 0 ; j < selectedDataElements.options.length ; j++ ) {
-
- if ( availableDataElements.options[i].value == selectedDataElements.options[j].value )
- {
+ var availableDataElements = document.getElementById('availableDataElements');
+ var selectedDataElements = document.getElementById('selectedDataElements');
+ for(var i=0;i<availableDataElements.options.length;i++){
+ for(var j=0;j<selectedDataElements.options.length;j++){
+ if(availableDataElements.options[i].value==selectedDataElements.options[j].value){
availableDataElements.options[i].style.display='none';
}
}
- }
+ }
- $( "#dataElementGroups" ).showAtCenter( true );
+ $("#dataElementGroups").showAtCenter( true );
}
/*
* Add Data Element Group Order
*/
-function submitDataElementGroupOrder() {
-
- if ( byId("name").value == '' )
- {
- setMessage(i18n_name_is_null);
- }
- else {
- selectAllById( 'selectedDataElements' );
+function submitDataElementGroupOrder(){
+ if(byId("name").value =='') setMessage(i18n_name_is_null);
+ else{
+ selectAllById('selectedDataElements');
document.forms['dataElementGroups'].submit();
}
}
@@ -97,22 +82,19 @@
* Delete Data Element Order
*/
-function deleteDataElementOrder( id ) {
-
- if ( window.confirm(i18n_confirm_delete) ) {
+function deleteDataElementOrder( id ){
+ if(window.confirm(i18n_confirm_delete)){
var request = new Request();
request.setResponseTypeXML( 'datalement' );
request.setCallbackSuccess( deleteDataElementOrderReceived );
-
var url = "deleteDataElementGroupOrder.action?id=" + id;
request.send( url );
}
}
-function deleteDataElementOrderReceived( datalement ) {
-
+function deleteDataElementOrderReceived(datalement){
window.location.reload();
}
@@ -120,33 +102,27 @@
* Open Update Data Element Order
*/
-function openUpdateDataElementOrder( id ) {
+function openUpdateDataElementOrder( id ){
- byId( "dataElementGroupOrderId" ).value = id;
+ byId("dataElementGroupOrderId").value = id;
var request = new Request();
request.setResponseTypeXML( 'xmlObject' );
request.setCallbackSuccess( openUpdateDataElementOrderReceived );
-
var url = "getDataElementGroupOrder.action?id=" + id;
request.send(url);
}
-function openUpdateDataElementOrderReceived( xmlObject ) {
-
+function openUpdateDataElementOrderReceived(xmlObject)
+{
var listDataElement = document.getElementById('selectedDataElements');
listDataElement.options.length = 0;
-
byId("name").value = xmlObject.getElementsByTagName('name')[0].firstChild.nodeValue;
byId("code").value = xmlObject.getElementsByTagName('code')[0].firstChild.nodeValue;
-
- var dataElements = xmlObject.getElementsByTagName('dataElements')[0].getElementsByTagName( 'dataElement' );
-
- for(var i = 0 ; i < dataElements.length ; i++ ) {
-
+ var dataElements = xmlObject.getElementsByTagName('dataElements')[0].getElementsByTagName('dataElement');
+ for(var i=0;i<dataElements.length;i++){
var name = dataElements[i].getElementsByTagName('name')[0].firstChild.nodeValue;
var id = dataElements[i].getElementsByTagName('id')[0].firstChild.nodeValue;
-
listDataElement.options.add(new Option(name, id));
}
@@ -156,42 +132,24 @@
/*
* Update Sorted Data Element
*/
-function updateSortedDataElement() {
-
- var dataElements = document.getElementsByName('dataElement');
- var paramDataElementIds = '';
-
- for ( var i = 0 ; i < dataElements.length ; i++ ) {
-
- paramDataElementIds += "&dataElementIds=" + dataElements.item(i).value;
- }
-
- var request = new Request();
- request.setResponseTypeXML( 'xmlObject' );
- request.setCallbackSuccess( updateSortedDataElementReceived );
-
- var url = "updateSortedDataElements.action?id=" + id + paramDataElementIds;
- request.send(url);
-}
-
-function updateSortedDataElementReceived() {
-
- history.go( -1 );
+function updateSortedDataElement(){
+
+ moveAllById( 'availableList', 'selectedList' );
+ selectAllById('selectedList');
+ document.forms[0].submit();
+
}
/*
* Update data element group order
*/
-function updateDataElementGroupOrder() {
-
+function updateDataElementGroupOrder(){
var dataElements = document.getElementsByName('dataElementGroupOrder');
var url = "updateSortDataElementGroupOrder.action?reportId=" + reportId;
-
- for ( var i=0 ; i < dataElements.length ; i++ ) {
-
+ for(var i=0;i<dataElements.length;i++){
url += "&dataElementGroupOrderId=" + dataElements.item(i).value;
}
-
window.location = url;
+
}
=== modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/sortDataElements.vm'
--- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/sortDataElements.vm 2009-09-14 15:29:21 +0000
+++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/sortDataElements.vm 2009-12-11 04:27:39 +0000
@@ -1,9 +1,48 @@
<h2>$i18n.getString( "sort_dataelement" )</h2>
+<form action="updateSortedDataElements.action" method="POST">
+<input type="hidden" value="$dataElementGroupOrder.id" name="id"/>
+<table>
+ <tr>
+ <th>$i18n.getString( "available_dataelements" )</th>
+ <td></td>
+ <th>$i18n.getString( "selected_dataelements" )</th>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td>
+ <select multiple size="30" id="availableList" name="availableList" style="min-width:300px;" ondblclick="moveSelectedById( 'availableList', 'selectedList' )">
+ #foreach( $dataElement in $dataElementGroupOrder.dataElements)
+ <option value="$dataElement.id">$dataElement.name</option>
+ #end
+ </select>
+ </td>
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString('move_selected')" style="width:50px" onclick="moveSelectedById( 'availableList', 'selectedList' )"><br>
+ <input type="button" value="<" title="$i18n.getString('move_all')" style="width:50px" onclick="moveSelectedById( 'selectedList', 'availableList' )"><br>
+ <input type="button" value=">>" title="$i18n.getString('remove_selected')" style="width:50px" onclick="moveAllById( 'availableList', 'selectedList' )"><br>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="moveAllById( 'selectedList', 'availableList' )">
+ </td>
+ <td>
+ <select type="text" multiple size=30" id="selectedList" name="dataElementIds" style="min-width:300px;" ondblclick="moveSelectedById('selectedList','availableList')">
+
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveSelectedOptionToTop( 'selectedList' );"><img align="absmiddle" src="../images/move_top.png" style="cursor:pointer;width:20px;"></a><br><br>
+ <a href="javascript:moveUpSelectedOption( 'selectedList' );"><img align="absmiddle" src="../images/move_up.png" style="cursor:pointer;width:20px;"></a><br><br>
+ <a href="javascript:moveDownSelectedOption( 'selectedList' );"><img align="absmiddle" src="../images/move_down.png" style="cursor:pointer;width:20px;"></a><br><br>
+ <a href="javascript:moveSelectedOptionToBottom( 'selectedList' );"><img align="absmiddle" src="../images/move_bottom.png" style="cursor:pointer;width:20px;"></a>
+ </td>
+ </tr>
+</table>
<p>
-<input type="button" value="$i18n.getString( "update_sorted_dataelement" )" onclick="updateSortedDataElement()"/>
-<input type="button" value="$i18n.getString( "cancel" )" onclick="history.go(-1);"/>
+ <input type="button" value="$i18n.getString( 'ok' )" onclick="updateSortedDataElement()"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="history.go(-1);"/>
</p>
+
+<!--
<ul id="sortable1" class="connectedSortable">
#foreach( $dataElement in $dataElementGroupOrder.dataElements)
<li class='ui-state-default' name='dataElement' value='$dataElement.id'><span class='ui-icon ui-icon-arrowthick-2-n-s'></span>$dataElement.name</li>
@@ -26,7 +65,7 @@
}).disableSelection();
});
</script>
-
+-->
<span id="message" style="top:100px;right:5px;position:fixed;width:200px;z-index:10002" onclick="javascript:hideById(this.id);"></span>