← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14765: Show approval level numbers in approval settings.

 

------------------------------------------------------------
revno: 14765
committer: Jim Grace <jimgrace@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-04-09 21:28:07 -0400
message:
  Show approval level numbers in approval settings.
modified:
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java
  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/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties
  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-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-04-07 11:28:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/dataapproval/DefaultDataApprovalLevelService.java	2014-04-10 01:28:07 +0000
@@ -100,7 +100,7 @@
 
             if ( ouLevel != null )
             {
-                ouLevelName = ouLevelNumber + " " + ouLevel.getName();
+                ouLevelName = ouLevel.getName();
             }
             else
             {

=== 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-04-07 15:26:07 +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-10 01:28:07 +0000
@@ -57,7 +57,7 @@
 
     private int id;
 
-    public void setLevel( int id )
+    public void setId( int id )
     {
         this.id = id;
     }

=== 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-04-07 15:26:07 +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-10 01:28:07 +0000
@@ -56,7 +56,7 @@
 
     private int id;
 
-    public void setLevel( int id )
+    public void setId( int id )
     {
         this.id = id;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java	2014-04-07 10:18:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/RemoveApprovalLevelAction.java	2014-04-10 01:28:07 +0000
@@ -28,10 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import org.apache.commons.io.IOUtils;
+import org.hisp.dhis.api.utils.ContextUtils;
+import org.hisp.dhis.common.DeleteNotAllowedException;
 import org.hisp.dhis.dataapproval.DataApprovalLevel;
 import org.hisp.dhis.dataapproval.DataApprovalLevelService;
 
 import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.document.DocumentService;
+import org.hisp.dhis.external.location.LocationManagerException;
 
 /**
  * @author Jim Grace
@@ -63,14 +68,34 @@
     }
 
     // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
         DataApprovalLevel approvalLevel = dataApprovalLevelService.getDataApprovalLevel( id );
-        
-        dataApprovalLevelService.deleteDataApprovalLevel( approvalLevel );
+
+        try
+        {
+            dataApprovalLevelService.deleteDataApprovalLevel( approvalLevel );
+        }
+        catch ( DeleteNotAllowedException ex )
+        {
+            message = ex.getMessage();
+
+            return ERROR;
+        }
 
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2014-04-09 04:27:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2014-04-10 01:28:07 +0000
@@ -34,6 +34,7 @@
 message=Message
 hide_unapproved_data_in_analytics=Hide unapproved data in analytics
 data_approval_levels=Data approval levels
+approval_level=Approval level
 organisation_unit_level=Organisation unit level
 select_level=Select level
 select_set=Select set

=== 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-07 15:26:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/javascripts/systemApprovalSettings.js	2014-04-10 01:28:07 +0000
@@ -5,8 +5,14 @@
   });
 });
 
+function renumberApprovalLevels( ) {
+    $( ".levelNumber" ).text( function( i ) {
+        return ( i + 1 );
+    });
+}
+
 function removeApprovalLevel( context ) {
-    removeItem( context.id, context.name, i18n_confirm_delete_data_approval_level, 'removeApprovalLevel.action' );
+    removeItem( context.id, context.name, i18n_confirm_delete_data_approval_level, 'removeApprovalLevel.action', renumberApprovalLevels );
 }
 
 function moveApprovalLevelUp( context ) {

=== 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-09 04:27:35 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemApprovalSettings.vm	2014-04-10 01:28:07 +0000
@@ -61,16 +61,18 @@
                 <col width="120px">
                 <thead>
                 <tr>
+                    <th class="{sorter: false}">$i18n.getString( "approval_level" )</th>
                     <th class="{sorter: false}">$i18n.getString( "organisation_unit_level" )</th>
                     <th class="{sorter: false}">$i18n.getString( "category_option_group_set" )</th>
                 </tr>
                 </thead>
                 <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 )"
+                    <tr id="tr${level.id}" data-id="$!level.id" data-uid="$!level.uid" data-level="$level.level" data-type="DataApprovalLevel" data-name="$encoder.htmlEncode( $!level.displayName )"
                             data-can-move-up="$approvalLevelService.canDataApprovalLevelMoveUp( $level.level )"
                             data-can-move-down="$approvalLevelService.canDataApprovalLevelMoveDown( $level.level )"
                             data-can-manage="$security.canManage( $level )">
+                        <td class="levelNumber">$encoder.htmlEncode( $!level.level )</td>
                         <td>$encoder.htmlEncode( $!level.orgUnitLevelName )</td>
                         <td>$encoder.htmlEncode( $!level.getCategoryOptionGroupSetName() )</td>
                     </tr>