← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8133: Small fix

 

------------------------------------------------------------
revno: 8133
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-09-19 16:01:12 +0700
message:
  Small fix
modified:
  dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/MenuAction.java
  dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.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-light/src/main/java/org/hisp/dhis/light/action/MenuAction.java'
--- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/MenuAction.java	2012-09-19 07:48:54 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/action/MenuAction.java	2012-09-19 09:01:12 +0000
@@ -153,18 +153,11 @@
         return complete;
     }
     
-    public boolean trackingAuthority;
-    
-    public boolean isTrackingAuthority()
-    {
-        return trackingAuthority;
-    }
-
-    public boolean aggregateAuthority;
-    
-    public boolean isAggregateAuthority()
-    {
-        return aggregateAuthority;
+    private User user;
+    
+    public User getUser()
+    {
+        return user;
     }
 
     // -------------------------------------------------------------------------
@@ -174,32 +167,7 @@
     @Override
     public String execute()
     {
-        User user = currentUserService.getCurrentUser();
-        
-        trackingAuthority = false;
-        
-        aggregateAuthority = false;
-
-        for (String each: user.getUserCredentials().getAllAuthorities())
-        {
-            if ( each.equals( "ALL" ))
-            {
-                trackingAuthority = true;
-                
-                aggregateAuthority = true;
-            }
-            else
-            {
-                if ( each.equals( "M_dhis-web-maintenance-patient" ) )
-                {
-                    trackingAuthority = true;
-                }
-                if ( each.equals( "M_dhis-web-dataentry" ))
-                {
-                    aggregateAuthority = true;
-                }
-            }
-        }
+        this.user = currentUserService.getCurrentUser();       
         
         if ( complete )
         {

=== modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm'
--- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm	2012-09-14 08:40:13 +0000
+++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm	2012-09-19 09:01:12 +0000
@@ -20,12 +20,23 @@
 
 <p>
 <ul>
-    #if( $aggregateAuthority == true )
-		<li><a href="selectOrganisationUnit.action">$i18n.getString( "agregate_reporting" )</a></li>
-	#end
-    #if( $trackingAuthority == true )
-		<li><a href="trackingMenu.action">$i18n.getString( "tracking" )</a></li>
-	#end	
+	#foreach( $each in $user.getUserCredentials().getAllAuthorities() )
+		#if ( $each == 'ALL' )
+            <li><a href="selectOrganisationUnit.action">$i18n.getString( "agregate_reporting" )</a></li>
+            <li><a href="trackingMenu.action">$i18n.getString( "tracking" )</a></li>
+			#break
+        #else
+            
+            #if ( $each == 'M_dhis-web-maintenance-patient' )         
+				<li><a href="trackingMenu.action">$i18n.getString( "tracking" )</a></li>                
+			#end
+				
+			#if ( $each == 'M_dhis-web-dataentry' )              
+                <li><a href="selectOrganisationUnit.action">$i18n.getString( "agregate_reporting" )</a></li> 
+			#end
+            
+		#end
+	#end			
     <li><a href="messages.action">$i18n.getString( "messages" ) #if($unreadMessageConversationCount > 0)($unreadMessageConversationCount)#end</a></li>
     <li><a href="reports.action">$i18n.getString( "reports" )</a></li>
     <li><a href="settings.action">$i18n.getString( "settings" )</a></li>