dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #40784
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 20750: Added displayName to Module
------------------------------------------------------------
revno: 20750
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2015-10-16 19:47:31 +0200
message:
Added displayName to Module
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonModules.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/DefaultModuleManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.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-resources/src/main/webapp/dhis-web-commons/ajax/jsonModules.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonModules.vm 2014-01-17 11:42:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonModules.vm 2015-10-16 17:47:31 +0000
@@ -5,6 +5,7 @@
"name":"$!encoder.jsonEncode( $module.name )",
"namespace":"$!encoder.jsonEncode( $module.namespace )",
"defaultAction":"$!encoder.jsonEncode( $module.defaultAction )",
+"displayName":"$!encoder.jsonEncode( $module.displayName )",
"icon":"$!encoder.jsonEncode( $module.iconFallback )",
"description":"$!encoder.jsonEncode( $module.description )"
}#if( $velocityCount < $size ),#end
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/DefaultModuleManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/DefaultModuleManager.java 2015-09-14 10:09:19 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/DefaultModuleManager.java 2015-10-16 17:47:31 +0000
@@ -44,6 +44,8 @@
import org.apache.struts2.dispatcher.Dispatcher;
import org.hisp.dhis.appmanager.App;
import org.hisp.dhis.appmanager.AppManager;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.i18n.I18nManager;
import org.hisp.dhis.security.ActionAccessResolver;
import org.springframework.beans.factory.annotation.Autowired;
@@ -75,6 +77,9 @@
@Autowired
private AppManager appManager;
+
+ @Autowired
+ private I18nManager i18nManager;
private ActionAccessResolver actionAccessResolver;
@@ -187,11 +192,14 @@
{
return;
}
+
+ I18n i18n = i18nManager.getI18n();
for ( PackageConfig packageConfig : getPackageConfigs() )
{
String name = packageConfig.getName();
String namespace = packageConfig.getNamespace();
+ String displayName = i18n.getString( name );
log.debug( "Package config: " + name + ", " + namespace );
@@ -221,6 +229,7 @@
}
Module module = new Module( name, namespace );
+ module.setDisplayName( displayName );
modulesByName.put( name, module );
modulesByNamespace.put( namespace, module );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java 2015-06-15 13:44:20 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/webportal/module/Module.java 2015-10-16 17:47:31 +0000
@@ -1,8 +1,5 @@
package org.hisp.dhis.webportal.module;
-import org.hisp.dhis.appmanager.App;
-import org.hisp.dhis.commons.util.TextUtils;
-
/*
* Copyright (c) 2004-2015, University of Oslo
* All rights reserved.
@@ -31,6 +28,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import org.hisp.dhis.appmanager.App;
+import org.hisp.dhis.commons.util.TextUtils;
+
/**
* @author Torgeir Lorange Ostby
* @version $Id: Module.java 2869 2007-02-20 14:26:09Z andegje $
@@ -43,6 +43,8 @@
private String defaultAction;
+ private String displayName;
+
// Apps only
private String icon;
@@ -135,6 +137,16 @@
this.defaultAction = defaultAction;
}
+ public String getDisplayName()
+ {
+ return displayName;
+ }
+
+ public void setDisplayName( String displayName )
+ {
+ this.displayName = displayName;
+ }
+
public String getIcon()
{
return icon;
@@ -195,6 +207,5 @@
public String toString()
{
return "[Name: " + name + ", namespace: " + namespace + ", default action: " + defaultAction + "]";
- }
-
+ }
}