← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14731: Fix moving DataApprovalLevels up and down in the UI

 

------------------------------------------------------------
revno: 14731
committer: Jim Grace <jimgrace@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-07 11:26:07 -0400
message:
  Fix moving DataApprovalLevels up and down in the UI
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelDownAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelUpAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemApprovalSettings.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemApprovalSettings.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-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelDownAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelDownAction.java	2014-03-28 10:13:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelDownAction.java	2014-04-07 15:26:07 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelService;
 
 import com.opensymphony.xwork2.Action;
@@ -54,11 +55,11 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private int level;
+    private int id;
 
-    public void setLevel( int level )
+    public void setLevel( int id )
     {
-        this.level = level;
+        this.id = id;
     }
 
     // -------------------------------------------------------------------------
@@ -67,7 +68,9 @@
 
     public String execute()
     {
-        dataApprovalLevelService.moveDataApprovalLevelDown( level );
+        DataApprovalLevel approvalLevel = dataApprovalLevelService.getDataApprovalLevel( id );
+
+        dataApprovalLevelService.moveDataApprovalLevelDown( approvalLevel.getLevel() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelUpAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelUpAction.java	2014-03-28 10:13:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/MoveApprovalLevelUpAction.java	2014-04-07 15:26:07 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelService;
 
 import com.opensymphony.xwork2.Action;
@@ -53,11 +54,11 @@
     // Input
     // -------------------------------------------------------------------------
 
-    private int level;
+    private int id;
 
-    public void setLevel( int level )
+    public void setLevel( int id )
     {
-        this.level = level;
+        this.id = id;
     }
 
     // -------------------------------------------------------------------------
@@ -66,7 +67,9 @@
 
     public String execute()
     {
-        dataApprovalLevelService.moveDataApprovalLevelUp( level );
+        DataApprovalLevel approvalLevel = dataApprovalLevelService.getDataApprovalLevel( id );
+
+        dataApprovalLevelService.moveDataApprovalLevelUp( approvalLevel.getLevel() );
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemApprovalSettings.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemApprovalSettings.js	2014-04-04 14:42:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemApprovalSettings.js	2014-04-07 15:26:07 +0000
@@ -10,9 +10,9 @@
 }
 
 function moveApprovalLevelUp( context ) {
-    location.href = 'moveApprovalLevelUp.action?level=' + context.id;
+    location.href = 'moveApprovalLevelUp.action?id=' + context.id;
 }
 
 function moveApprovalLevelDown( context ) {
-    location.href = 'moveApprovalLevelDown.action?level=' + context.id;
+    location.href = 'moveApprovalLevelDown.action?id=' + context.id;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemApprovalSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemApprovalSettings.vm	2014-04-07 10:20:56 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemApprovalSettings.vm	2014-04-07 15:26:07 +0000
@@ -48,8 +48,8 @@
                 <tbody id="list">
                     #foreach( $level in $dataApprovalLevels )
                     <tr id="tr${level.id}" data-id="$!level.id" data-uid="$!level.uid" data-type="DataApprovalLevel" data-name="$encoder.htmlEncode( $!level.displayName )"
-                            data-can-move-up="$approvalLevelService.canMoveUp( $level.level )"
-                            data-can-move-down="$approvalLevelService.canMoveDown( $level.level )"
+                            data-can-move-up="$approvalLevelService.canDataApprovalLevelMoveUp( $level.level )"
+                            data-can-move-down="$approvalLevelService.canDataApprovalLevelMoveDown( $level.level )"
                             data-can-manage="$security.canManage( $level )">
                         <td>$encoder.htmlEncode( $!level.orgUnitLevelName )</td>
                         <td>$encoder.htmlEncode( $!level.getCategoryOptionGroupSetName() )</td>