dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #03876
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 1292: Data Loking will retain user selection after cliking on save button, But use 'Done' button after ...
------------------------------------------------------------
revno: 1292
committer: brajesh <brajesh@brajesh-PC>
branch nick: trunk
timestamp: Tue 2009-12-29 12:44:28 +0530
message:
Data Loking will retain user selection after cliking on save button, But use 'Done' button after finishing all locking works, which will put users on Data Administration Index page. :)
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.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-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/DefineLockOnDataSetOrgunitAndPeriod.java 2009-12-29 07:14:28 +0000
@@ -26,8 +26,6 @@
*/
package org.hisp.dhis.dataadmin.action.lock;
-import java.util.ArrayList;
-import java.util.Collection;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
@@ -94,30 +92,6 @@
// Input/output
// -------------------------------------------------------------------------
- private Integer lockedDataSets;
-
- public void setLockedDataSets( Integer lockedDataSets )
- {
- this.lockedDataSets = lockedDataSets;
- }
-
- public Integer getLockedDataSets()
- {
- return lockedDataSets;
- }
-
- private Collection<String> unlockedDataSets = new ArrayList<String>();
-
- public void setUnlockedDataSets( Collection<String> unlockedDataSets )
- {
- this.unlockedDataSets = unlockedDataSets;
- }
-
- public Collection<String> getUnlockedDataSets()
- {
- return unlockedDataSets;
- }
-
private Integer selectedLockedDataSetId;
public void setSelectedLockedDataSetId( Integer selectedLockedDataSetId )
@@ -162,63 +136,44 @@
public String execute() throws Exception{
- Period period = new Period();
+ Period period = new Period();
- if( periodId != null ){
+ if( periodId != null ){
- period = periodService.getPeriod( periodId.intValue() );
- }
-
- else{
- return SUCCESS;
- }
-
- period = periodService.getPeriod( periodId.intValue() );
- storedBy = currentUserService.getCurrentUsername();
-
- // -------------------------------------------------------------------------------
- // For data set movement from locked to unlocked data set list box and
- // vice versa according to lock status
- // -------------------------------------------------------------------------------
-
- for ( String id : unlockedDataSets ){
- DataSet dataSet = dataSetService.getDataSet( Integer.parseInt( id ) );
- DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
-
- if ( dataSetLock != null ){
- dataSet.setLocked( false );
- dataSetService.updateDataSet( dataSet );
- dataSetLock.getSources().removeAll( dataSetLock.getSources() );
- dataSetLockService.deleteDataSetLock( dataSetLock );
- }
- }
-
- // ----------------------------------------------------------------------------------------
- // Data sets lock for specific selected period, and selected
- // organization unit ( or units )
- // ----------------------------------------------------------------------------------------
-
- if ( lockedDataSets != null ){
- DataSet dataSet = dataSetService.getDataSet( lockedDataSets.intValue() );
- Set<Source> organisationUnitsSelectedForLocking = new HashSet<Source>( selectionTreeManager
+ period = periodService.getPeriod( periodId.intValue() );
+ }
+
+ else{
+ return SUCCESS;
+ }
+
+ period = periodService.getPeriod( periodId.intValue() );
+ storedBy = currentUserService.getCurrentUsername();
+
+ // ----------------------------------------------------------------------------------------
+ // Data sets lock for specific selected period, and selected
+ // organization unit ( or units )
+ // ----------------------------------------------------------------------------------------
+
+ DataSet dataSet = dataSetService.getDataSet( selectedLockedDataSetId.intValue() );
+ Set<Source> organisationUnitsSelectedForLocking = new HashSet<Source>( selectionTreeManager
.getLockOnSelectedOrganisationUnits() );
- DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
-
- if ( organisationUnitsSelectedForLocking.size() < 1 ){
- dataSet.setLocked( false );
- dataSetService.updateDataSet( dataSet );
- dataSetLock.getSources().removeAll( dataSetLock.getSources() );
- dataSetLockService.deleteDataSetLock( dataSetLock );
- return SUCCESS;
- }
-
- dataSetLock.getSources().removeAll( dataSetLock.getSources() );
- dataSetLock.getSources().addAll( organisationUnitsSelectedForLocking );
- dataSetLock.setTimestamp( new Date() );
- dataSetLock.setStoredBy( storedBy );
- dataSetLockService.updateDataSetLock( dataSetLock );
+ DataSetLock dataSetLock = dataSetLockService.getDataSetLockByDataSetAndPeriod( dataSet, period );
+
+ if ( organisationUnitsSelectedForLocking.size() < 1 ){
+ dataSet.setLocked( false );
+ dataSetService.updateDataSet( dataSet );
+ dataSetLock.getSources().removeAll( dataSetLock.getSources() );
+ dataSetLockService.deleteDataSetLock( dataSetLock );
+ return SUCCESS;
}
+ dataSetLock.getSources().removeAll( dataSetLock.getSources() );
+ dataSetLock.getSources().addAll( organisationUnitsSelectedForLocking );
+ dataSetLock.setTimestamp( new Date() );
+ dataSetLock.setStoredBy( storedBy );
+ dataSetLockService.updateDataSetLock( dataSetLock );
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/lock/GetDataSetsForLockAction.java 2009-12-29 07:14:28 +0000
@@ -117,7 +117,7 @@
dataSet.setLocked( false );
dataSetService.updateDataSet( dataSet );
dataSets.add( dataSet );
- System.out.println("unlocked data sets in outer loop :" + dataSets.toString());
+ //System.out.println("unlocked data sets in outer loop :" + dataSets.toString());
}
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2009-12-29 07:14:28 +0000
@@ -61,6 +61,20 @@
<ref bean="org.hisp.dhis.user.CurrentUserService"/>
</property>
</bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.lock.UpdateLockedDataSets"
+ class="org.hisp.dhis.dataadmin.action.lock.UpdateLockedDataSets"
+ scope="prototype">
+ <property name="dataSetService">
+ <ref bean="org.hisp.dhis.dataset.DataSetService"/>
+ </property>
+ <property name="periodService">
+ <ref bean="org.hisp.dhis.period.PeriodService"/>
+ </property>
+ <property name="dataSetLockService">
+ <ref bean="org.hisp.dhis.datalock.DataSetLockService"/>
+ </property>
+ </bean>
<bean id="org.hisp.dhis.dataadmin.action.lock.SelectAllAction"
class="org.hisp.dhis.dataadmin.action.lock.SelectAllAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2009-12-17 09:22:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2009-12-29 07:14:28 +0000
@@ -9,6 +9,7 @@
organisation_units_lock = Organization Units [ Black = Unassigned ][ Orange = Assigned,Unlocked ][ Green = Assigned,Locked ]
save = Save
cancel = Cancel
+done =Done
noaction = Please Sellect Only Assigned or Locked Organisation Unit.
loading = Loading, please wait...
data_administration = Data Administration
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2009-12-29 07:14:28 +0000
@@ -55,10 +55,17 @@
../dhis-web-commons/util/jquery.js,
../dhis-web-commons/css/${stylesheetDirectory}/dom.js</param>
</action>
+
+ <action name="updateLockedDataSets"
+ class="org.hisp.dhis.dataadmin.action.lock.UpdateLockedDataSets">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/index.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ </action>
<action name="defineLockOnDataSetOrgunitAndPeriod"
class="org.hisp.dhis.dataadmin.action.lock.DefineLockOnDataSetOrgunitAndPeriod">
- <result name="success" type="redirect">displayLockingForm.action</result>
+ <result name="success" type="chain">getLockSelectionTree</result>
</action>
<action name="selectLevel"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/associations.js 2009-12-29 07:14:28 +0000
@@ -32,7 +32,7 @@
else{
numberOfSelects++;
setMessage( i18n_loading );
- parent.document.getElementById( "submitButton" ).disabled = true;
+ parent.document.getElementById( "button10" ).disabled = true;
}
}
@@ -44,6 +44,6 @@
{
hideMessage();
- parent.document.getElementById( "submitButton" ).disabled = false;
+ parent.document.getElementById( "button10" ).disabled = false;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/locking.js 2009-12-29 07:14:28 +0000
@@ -111,7 +111,8 @@
enableParent( "button8" );
enableParent( "button9" );
enableParent( "levelList" );
- enableParent( "submitButton" );
+ enableParent( "button10" );
+ enableParent( "button11" );
}
function desableLockComponents(){
@@ -127,9 +128,9 @@
disableParent( "button6" );
disableParent( "button7" );
disableParent( "button8" );
- //disableParent( "button9" );
+ disableParent( "button11" );
disableParent( "levelList" );
- disableParent( "submitButton" );
+ disableParent( "button10" );
}
function LoadOrgUnitTree(){
@@ -180,7 +181,19 @@
iframeForOUTree.location.href = 'unselectLevel.action?level=' + level + '&selectedLockedDataSetId=' + selectedLockedDataSetId + '&periodId=' + periodId;
}
-function updateDataSetsOrgunitwise(){
+function saveUpdate(){
+ desableLockComponents();
+ var periodList = document.getElementById( "periodId" );
+ var periodId = periodList.options[ periodList.selectedIndex ].value;
+ var list = document.getElementById( 'levelList' );
+ var level = list.options[ list.selectedIndex ].value;
+ var lockedDataSetList = document.getElementById('lockedDataSets');
+
+ var selectedLockedDataSetId = lockedDataSetList.options[ lockedDataSetList.selectedIndex ].value;
+ iframeForOUTree.location.href = 'defineLockOnDataSetOrgunitAndPeriod.action?level=' + level + '&selectedLockedDataSetId=' + selectedLockedDataSetId + '&periodId=' + periodId;
+}
+
+function updateLockedDataSets(){
if ( validateLocking() ) {
selectAllById( "unlockedDataSets" );
document.getElementById( "lockingForm" ).submit();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm 2009-12-24 10:42:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/lockingForm.vm 2009-12-29 07:14:28 +0000
@@ -2,7 +2,7 @@
<span id="message"></span>
-<form id="lockingForm" name="lockingForm" action="defineLockOnDataSetOrgunitAndPeriod.action" method="post">
+<form id="lockingForm" name="lockingForm" action="updateLockedDataSets.action" method="post">
<table width="730">
@@ -93,8 +93,9 @@
</tr>
<tr>
<td>
- <input type="button" id="submitButton" value="$i18n.getString( 'save' )" style="width:30em" onclick="updateDataSetsOrgunitwise()" disabled="true">
- <input type="button" id="button9" value="$i18n.getString( 'cancel' )" style="width:30em" onclick="cancilSelection()" disabled="true">
+ <input type="button" id="button10" value="$i18n.getString( "save" )" style="width:20em" onclick="saveUpdate()" disabled="true">
+ <input type="button" id="button11" value="$i18n.getString( "done" )" style="width:20em" onclick="updateLockedDataSets()" disabled="true">
+ <input type="button" id="button9" value="$i18n.getString( "cancel" )" style="width:20em" onclick="cancilSelection()" disabled="true">
</td>
</tr>
<tr>