← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16937: add support for apps start page, finished

 

------------------------------------------------------------
revno: 16937
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-02 18:00:17 +0700
message:
  add support for apps start page, finished
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/RedirectAction.java


--
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-commons/src/main/java/org/hisp/dhis/about/action/RedirectAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/RedirectAction.java	2014-10-02 09:58:38 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/about/action/RedirectAction.java	2014-10-02 11:00:17 +0000
@@ -28,13 +28,15 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_START_MODULE;
-
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.appmanager.App;
 import org.hisp.dhis.appmanager.AppManager;
 import org.hisp.dhis.setting.SystemSettingManager;
 import org.springframework.beans.factory.annotation.Autowired;
 
-import com.opensymphony.xwork2.Action;
+import java.util.List;
+
+import static org.hisp.dhis.setting.SystemSettingManager.KEY_START_MODULE;
 
 /**
  * @author Lars Helge Overland
@@ -49,7 +51,7 @@
     private AppManager appManager;
 
     private String redirectUrl;
-    
+
     public String getRedirectUrl()
     {
         return redirectUrl;
@@ -60,16 +62,31 @@
         throws Exception
     {
         String startModule = (String) systemSettingManager.getSystemSetting( KEY_START_MODULE );
-        
+
         if ( startModule != null )
         {
-            redirectUrl = "../" + startModule + "/index.action";
-        }
-        else
-        {
-            redirectUrl = "../dhis-web-dashboard-integration/index.action";
-        }
-        
+            if ( startModule.startsWith( "app:" ) )
+            {
+                List<App> apps = appManager.getApps();
+
+                for ( App app : apps )
+                {
+                    if ( app.getName().equals( startModule.substring( "app:".length() ) ) )
+                    {
+                        redirectUrl = app.getLaunchUrl();
+                        return SUCCESS;
+                    }
+                }
+            }
+            else
+            {
+                redirectUrl = "../" + startModule + "/index.action";
+                return SUCCESS;
+            }
+        }
+
+        redirectUrl = "../dhis-web-dashboard-integration/index.action";
+
         return SUCCESS;
-    }  
+    }
 }