dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08387
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2008: Organisation Unit Pruning - Improved GUI and deactived the deletion on tables such as: mapfile, f...
------------------------------------------------------------
revno: 2008
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-11-08 16:21:24 +0700
message:
Organisation Unit Pruning - Improved GUI and deactived the deletion on tables such as: mapfile, feature, map, patientidentifier.
Because MapFile and Feature are nonexistent AND column organisationunitid does not exist in MAP and PatientIdentifier.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataprune/PruneOrganisationUnitAction.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/org/hisp/dhis/dataadmin/i18n_module_vi_VN.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/pruneOrganisationUnit.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/pruneOrganisationUnitForm.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/dataprune/PruneOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataprune/PruneOrganisationUnitAction.java 2010-04-21 14:32:54 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/dataprune/PruneOrganisationUnitAction.java 2010-11-08 09:21:24 +0000
@@ -31,7 +31,7 @@
import org.apache.commons.logging.LogFactory;
import org.hisp.dhis.dataprune.DataPruneService;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
import com.opensymphony.xwork2.ActionSupport;
@@ -56,37 +56,35 @@
this.dataPruneService = dataPruneService;
}
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer organisationUnitSelected;
-
- public void setOrganisationUnitSelected( Integer organisationUnitSelected )
- {
- this.organisationUnitSelected = organisationUnitSelected;
- }
-
+ private SelectionTreeManager selectionTreeManager;
+
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+ {
+ this.selectionTreeManager = selectionTreeManager;
+ }
+
+ // -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
{
- OrganisationUnit kept = organisationUnitService.getOrganisationUnit( organisationUnitSelected );
+ OrganisationUnit kept = selectionTreeManager.getSelectedOrganisationUnit();
log.info( "Pruning Organisation Unit, " + kept + " is kept" );
+ if ( kept.getParent() == null )
+ {
+ log.info( "Pruning is interrupted" );
+
+ return ERROR;
+ }
+
dataPruneService.pruneOrganisationUnit( kept );
log.info( "Pruning complete" );
return SUCCESS;
}
+
}
=== 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 2010-10-29 12:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2010-11-08 09:21:24 +0000
@@ -168,8 +168,7 @@
class="org.hisp.dhis.dataadmin.action.dataprune.PruneOrganisationUnitAction"
scope="prototype">
<property name="dataPruneService" ref="org.hisp.dhis.dataprune.DataPruneService" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager"/>
</bean>
<!-- Duplicate data elimination -->
=== 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 2010-10-30 11:54:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2010-11-08 09:21:24 +0000
@@ -179,7 +179,7 @@
unarchiving = Unarchiving
done_number_of_values = done. Number of archived values is now
prune = Prune
-prune_organisation_unit_confirmation = Are you sure you want to prune?
+prune_organisation_unit_confirmation = WARNING: If 'YES' then whole of organisation units, which are not belong to this selected unit, will be pruned.\nAre you sure you want to prune ?
pruning = Pruning
pruning_done = Pruning done
browser = Browser
@@ -298,12 +298,11 @@
lock_all_in_group = Lock all in group
unlock_all_in_group = Unlock all in group
process_started = Checking...
-sqlview_process_canceled_interrupted = WARNING: This query could retrieve a large amount of data from database.\n\nDo you want to save it...? =======
+sqlview_process_canceled_interrupted = WARNING: This query could retrieve a large amount of data from database.\n\nDo you want to save it...? =======
generate_values_success = Generate values successfully
-organisation_not_selected = WARNING: There is no organisation unit selected
+organisation_not_selected = WARNING: There is no organisation unit selected
selected_periods = Selected Periods
selected_datasets = Selected Datasets
-organisation_not_selected = WARNING: There is no organisation unit selected
child_tree = Child Tree
navigation = Navigation
start = Start
@@ -317,4 +316,5 @@
data_element_group_list = Data Element Group list
orgunit_group_list = Organisation Unit Group list
patient_data_archive = Beneficiary Data Archive
-intro__patient_data_archive = Archive beneficiary data which is not currently relevant to your system in order to improve performance. Data can also be unarchived.
\ No newline at end of file
+intro__patient_data_archive = Archive beneficiary data which is not currently relevant to your system in order to improve performance. Data can also be unarchived.
+pruning_interrupted = You must choose the organisation unit has parent to prune. Please try again!
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties 2010-10-21 05:41:06 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module_vi_VN.properties 2010-11-08 09:21:24 +0000
@@ -188,9 +188,9 @@
prune_organisation_unit = T\u1ec9a x\u00e9n \u0111\u01a1n v\u1ecb
prune = T\u1ec9a x\u00e9n
select_the_org_unit_to_be_kept = Ch\u1ecdn c\u00e1c \u0111\u01a1n v\u1ecb c\u1ea7n gi\u1eef
-prune_organisation_unit_confirmation = B\u1ea1n c\u00f3 ch\u1eafc mu\u1ed1n c\u1eaft b\u1ecf \u0111\u01a1n v\u1ecb n\u00e0y
+prune_organisation_unit_confirmation = C\u1ea2NH B\u00c1O: N\u1ebfu '\u0110\u1ed3ng \u00fd' to\u00e0n b\u1ed9 c\u00e1c \u0111\u01a1n v\u1ecb kh\u00f4ng thu\u1ed9c \u0111\u01a1n v\u1ecb b\u1ea1n ch\u1ecdn s\u1ebd b\u1ecb c\u1eaft b\u1ecf ho\u00e0n to\u00e0n.\nB\u1ea1n c\u00f3 mu\u1ed1n ti\u1ebfp t\u1ee5c?
pruning = \u0110ang c\u1eaft x\u00e9n
-pruning_done = C\u1eaft x\u00e9n ho\u00e0n t\u1ea5t!
+pruning_done = C\u1eaft x\u00e9n ho\u00e0n t\u1ea5t !
drilldown_export = K\u1ebft qu\u1ea3
drilldown_choose_period_type = H\u00e3y ch\u1ecdn ki\u1ec3u th\u1eddi \u0111i\u1ec3m
drilldown_formdate_invalid = Ng\u00e0y b\u1eaft \u0111\u1ea7u kh\u00f4ng h\u1ee3p l\u1ec7
@@ -270,8 +270,8 @@
lock_all_in_group = Kh\u00f3a to\u00e0n b\u1ed9 theo nh\u00f3m
unlock_all_in_group = M\u1edf kh\u00f3a to\u00e0n b\u1ed9 theo nh\u00f3m
process_started = \u0110ang ki\u1ec3m tra...
-sqlview_process_canceled_interrupted = C\u1ea2NH B\u00c1O: C\u00e2u truy v\u1ea5n n\u00e0y c\u00f3 th\u1ec3 s\u1ebd l\u1ea5y ra m\u1ed9t l\u01b0\u1ee3ng d\u1eef li\u1ec7u kh\u00e1 l\u1edbn trong CSDL.\n\nB\u1ea1n c\u00f3 mu\u1ed1n ti\u1ebfp t\u1ee5c...?
-organisation_not_selected = C\u1ea2NH B\u00c1O: Kh\u00f4ng c\u00f3 \u0111\u01a1n v\u1ecb n\u00e0o \u0111\u01b0\u1ee3c ch\u1ecdn
+sqlview_process_canceled_interrupted = C\u1ea2NH B\u00c1O: C\u00e2u truy v\u1ea5n n\u00e0y c\u00f3 th\u1ec3 s\u1ebd l\u1ea5y ra m\u1ed9t l\u01b0\u1ee3ng d\u1eef li\u1ec7u kh\u00e1 l\u1edbn trong CSDL.\n\nB\u1ea1n c\u00f3 mu\u1ed1n ti\u1ebfp t\u1ee5c...?
+organisation_not_selected = C\u1ea2NH B\u00c1O: Kh\u00f4ng c\u00f3 \u0111\u01a1n v\u1ecb n\u00e0o \u0111\u01b0\u1ee3c ch\u1ecdn
selected_periods = Th\u1eddi \u0111i\u1ec3m \u0111\u01b0\u1ee3c ch\u1ecdn
selected_datasets = T\u1eadp d\u1eef li\u1ec7u \u0111\u01b0\u1ee3c ch\u1ecdn
child_tree = Duy\u1ec7t c\u1ea3 \u0111\u01a1n v\u1ecb con
@@ -285,4 +285,7 @@
data_element_group_list = Danh s\u00e1ch Nh\u00f3m ph\u1ea7n t\u1eed d\u1eef li\u1ec7u
orgunit_group_list = Danh s\u00e1ch Nh\u00f3m \u0111\u01a1n v\u1ecb
landscape = Landscape
-portrait = Portrait
\ No newline at end of file
+portrait = Portrait
+data_browser = Tr\u00ecnh duy\u1ec7t d\u1eef li\u1ec7u
+organisation_unit_pruning = T\u1ec9a x\u00e9n C\u00e2y \u0111\u01a1n v\u1ecb
+pruning_interrupted = B\u1ea1n ph\u1ea3i ch\u1ecdn \u0111\u01a1n v\u1ecb c\u00f3 cha \u0111\u1ec3 ti\u1ebfn h\u00e0nh c\u1eaft x\u00e9n. H\u00e3y th\u1eed l\u1ea1i!
\ No newline at end of file
=== 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 2010-10-24 15:41:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2010-11-08 09:21:24 +0000
@@ -145,8 +145,10 @@
<action name="pruneOrganisationUnit"
class="org.hisp.dhis.dataadmin.action.dataprune.PruneOrganisationUnitAction">
- <result name="success" type="redirect">
- displayPruneOrganisationUnitForm.action</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
</action>
<!-- Statistics -->
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/pruneOrganisationUnit.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/pruneOrganisationUnit.js 2010-10-01 07:03:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/pruneOrganisationUnit.js 2010-11-08 09:21:24 +0000
@@ -14,29 +14,43 @@
},
function( json )
{
- document.getElementById( "keepNameField" ).innerHTML = json.organisationUnit.name;
- document.getElementById( "pruneButton" ).disabled = false;
- hideById('message');
+ setInnerHTML( 'keepNameField', json.organisationUnit.name );
+ enable( 'pruneButton' );
+ hideHeaderMessage( 'message' );
}
);
}
+ else
+ {
+ setInnerHTML( 'keepNameField', i18n_not_selected );
+ disable( 'pruneButton' );
+ }
}
function pruneOrganisationUnit()
{
var result = window.confirm(i18n_confirmation);
- if (result) {
- setWaitMessage(i18n_pruning + "...");
+ if ( result ) {
+
+ setHeaderWaitMessage( i18n_pruning + "..." );
- $.ajax( {
- "url" : "pruneOrganisationUnit.action",
- "data" : {
- "organisationUnitSelected" : organisationUnitSelected
- },
- "success" : function() {
- setMessage(i18n_pruning_done);
+ $.getJSON(
+ "pruneOrganisationUnit.action", {},
+ function( json )
+ {
+ hideHeaderMessage( 'message' );
+
+ if ( json.response == "success" )
+ {
+ showSuccessMessage( i18n_pruning_done );
+ setTimeout( "window.location.href='displayPruneOrganisationUnitForm.action'", 2500);
+ }
+ else
+ {
+ showErrorMessage( i18n_pruning_interrupted );
+ }
}
- });
+ );
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/pruneOrganisationUnitForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/pruneOrganisationUnitForm.vm 2010-09-21 06:16:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/pruneOrganisationUnitForm.vm 2010-11-08 09:21:24 +0000
@@ -1,17 +1,16 @@
+<script type="text/javascript">
+ jQuery(document).ready( function(){
+ // Override the listener after tree loaded succesfully
+ selectionTreeSelection.setListenerFunction( treeSelected );
+ });
+</script>
<h3>$i18n.getString( "organisation_unit_pruning" )</h3>
-<div id="selectionTree" style="width:500px; height:200px"></div>
-
-<script type="text/javascript">
- selectionTreeSelection.setMultipleSelectionAllowed( false );
- selectionTreeSelection.setListenerFunction( treeSelected );
- selectionTree.clearSelectedOrganisationUnits();
- selectionTree.buildSelectionTree();
-</script>
-
+<table>
+ <tr><td>#organisationUnitSelectionTree( true, false, false )</td></tr>
+</table>
<br/>
-
<table>
<col style="width:2em"/>
<col/>
@@ -23,7 +22,7 @@
<td><span id="keepNameField">[$i18n.getString( "not_selected" )]</span></td>
</tr>
<tr>
- <td><input id="pruneButton" type="button" value="$i18n.getString( 'prune' )" onclick="pruneOrganisationUnit()" style="width:10em" disabled="disabled"/></td>
+ <td><input id="pruneButton" type="button" value="$i18n.getString( 'prune' )" onclick="pruneOrganisationUnit()" style="width:10em" disabled="disabled" /></td>
</tr>
</table>
@@ -32,5 +31,7 @@
<script type="text/javascript">
var i18n_confirmation = '$encoder.jsEscape( $i18n.getString( "prune_organisation_unit_confirmation" ), "'" )';
var i18n_pruning = '$encoder.jsEscape( $i18n.getString( "pruning" ), "'" )';
+ var i18n_not_selected = '$encoder.jsEscape( $i18n.getString( "not_selected" ), "'" )';
var i18n_pruning_done = '$encoder.jsEscape( $i18n.getString( "pruning_done" ), "'" )';
+ var i18n_pruning_interrupted = '$encoder.jsEscape( $i18n.getString( "pruning_interrupted" ), "'" )';
</script>