dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31178
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15862: Impl system settings for specifying URLs to custom logos for login page and top menu
------------------------------------------------------------
revno: 15862
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-06-26 16:38:54 +0200
message:
Impl system settings for specifying URLs to custom logos for login page and top menu
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetAppearanceSettingsAction.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/systemAppearanceSettings.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-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java 2014-06-24 19:25:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java 2014-06-26 14:38:54 +0000
@@ -95,6 +95,8 @@
final String KEY_ONLY_MANAGE_WITHIN_USER_GROUPS = "keyOnlyManageWithinUserGroups";
final String KEY_HIDE_UNAPPROVED_DATA_IN_ANALYTICS = "keyHideUnapprovedDataInAnalytics";
final String KEY_ANALYTICS_MAX_LIMIT = "keyAnalyticsMaxLimit";
+ final String KEY_CUSTOM_LOGIN_PAGE_LOGO = "keyCustomLoginPageLogo";
+ final String KEY_CUSTOM_TOP_MENU_LOGO = "keyCustomTopMenuLogo";
final String DEFAULT_SCHEDULE_AGGREGATE_QUERY_BUILDER_TASK_STRATEGY = "lastMonth";
final String DEFAULT_FLAG = "dhis2";
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2014-03-05 05:52:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/security/login.vm 2014-06-26 14:38:54 +0000
@@ -30,7 +30,13 @@
</div>
#end
<div id="loginField">
- <div id="bannerArea"><a href="http://www.dhis2.org"><img src="logo_front.png" style="border:none"></a></div>
+ <div id="bannerArea">
+ #if ( $keyCustomLoginPageLogo )
+ <img src="../../external-static/logo_front.png"></a>
+ #else
+ <a href="http://www.dhis2.org"><img src="logo_front.png" style="border:none"></a>
+ #end
+ </div>
<form id="loginForm" action="../../dhis-web-commons-security/login.action" method="post">
<div>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-06-04 14:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2014-06-26 14:38:54 +0000
@@ -99,11 +99,17 @@
</script>
</head>
+ #if ( $keyCustomLoginPageLogo )
+ #set( $logoBanner = "../external-static/logo_banner.png" )
+ #else
+ #set( $logoBanner = "../dhis-web-commons/css/${stylesheetDirectory}/logo_banner.png" )
+ #end
+
<body>
#parse( "macros.vm" )
<div id="header">
- <img id="headerBanner" src="../dhis-web-commons/css/${stylesheetDirectory}/logo_banner.png"
- onclick="window.location.href='../${startModule}/index.action'" style="cursor:pointer" title="$i18n.getString( 'view_home_page' )">
+ <img id="headerBanner" src="${logoBanner}" onclick="window.location.href='../${startModule}/index.action'"
+ style="cursor:pointer" title="$i18n.getString( 'view_home_page' )">
<span id="headerText" onclick="window.location.href='../${startModule}/index.action'" style="cursor:pointer" title="$i18n.getString( 'view_home_page' )">
$encoder.htmlEncode( $applicationTitle )
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java 2014-05-15 13:16:11 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java 2014-06-26 14:38:54 +0000
@@ -48,6 +48,8 @@
public class SystemSettingInterceptor
implements Interceptor
{
+ private static final String DATE_FORMAT = "dateFormat";
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
@@ -88,7 +90,7 @@
map.put( KEY_CALENDAR, systemSettingManager.getSystemSetting( KEY_CALENDAR, DEFAULT_CALENDAR ) );
map.put( KEY_DATE_FORMAT, systemSettingManager.getSystemSetting( KEY_DATE_FORMAT, DEFAULT_DATE_FORMAT ) );
- map.put( "dateFormat", calendarService.getSystemDateFormat() );
+ map.put( DATE_FORMAT, calendarService.getSystemDateFormat() );
map.put( KEY_CACHE_STRATEGY, systemSettingManager.getSystemSetting( KEY_CACHE_STRATEGY, DEFAULT_CACHE_STRATEGY ) );
map.put( KEY_ANALYTICS_MAX_LIMIT, systemSettingManager.getSystemSetting( KEY_ANALYTICS_MAX_LIMIT, DEFAULT_ANALYTICS_MAX_LIMIT ) );
map.put( KEY_APPLICATION_TITLE, systemSettingManager.getSystemSetting( KEY_APPLICATION_TITLE, DEFAULT_APPLICATION_TITLE ) );
@@ -113,7 +115,8 @@
map.put( KEY_OPENID_PROVIDER_LABEL, systemSettingManager.getSystemSetting( KEY_OPENID_PROVIDER_LABEL ) );
map.put( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, systemSettingManager.getSystemSetting( KEY_CAN_GRANT_OWN_USER_AUTHORITY_GROUPS, false ) );
map.put( KEY_ONLY_MANAGE_WITHIN_USER_GROUPS, systemSettingManager.getSystemSetting( KEY_ONLY_MANAGE_WITHIN_USER_GROUPS, false ) );
-
+ map.put( KEY_CUSTOM_LOGIN_PAGE_LOGO, systemSettingManager.getSystemSetting( KEY_CUSTOM_LOGIN_PAGE_LOGO, false ) );
+ map.put( KEY_CUSTOM_TOP_MENU_LOGO, systemSettingManager.getSystemSetting( KEY_CUSTOM_TOP_MENU_LOGO, false ) );
map.put( SYSPROP_PORTAL, defaultIfEmpty( System.getProperty( SYSPROP_PORTAL ), String.valueOf( false ) ) );
invocation.getStack().push( map );
=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2014-04-23 10:19:42 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/security.xml 2014-06-26 14:38:54 +0000
@@ -23,6 +23,7 @@
<sec:http pattern="/dhis-web-commons/css/**" security="none" />
<sec:http pattern="/dhis-web-commons/flags/**" security="none" />
<sec:http pattern="/dhis-web-commons/fonts/**" security="none" />
+ <sec:http pattern="/external-static/**" security="none" />
<sec:http pattern="/favicon.ico" security="none" />
<sec:http access-decision-manager-ref="accessDecisionManager" use-expressions="true" realm="DHIS2">
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetAppearanceSettingsAction.java 2014-06-26 14:38:54 +0000
@@ -122,30 +122,14 @@
return availableLocales;
}
-// private Locale currentLocale;
-//
-// public Locale getCurrentLocale()
-// {
-// return currentLocale;
-// }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute()
{
- // ---------------------------------------------------------------------
- // Get available UI locales
- // ---------------------------------------------------------------------
availableLocales = localeManager.getAvailableLocales();
- //currentLocale = localeManager.getCurrentLocale();
-
- // ---------------------------------------------------------------------
- // Others
- // ---------------------------------------------------------------------
-
styles = styleManager.getStyles();
currentStyle = styleManager.getSystemStyle();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetAppearanceSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetAppearanceSettingsAction.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetAppearanceSettingsAction.java 2014-06-26 14:38:54 +0000
@@ -33,7 +33,7 @@
import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_NOTIFICATION;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_FOOTER;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_FLAG;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_START_MODULE;
+import static org.hisp.dhis.setting.SystemSettingManager.*;
import org.apache.commons.lang.StringUtils;
import org.hisp.dhis.i18n.I18n;
@@ -141,6 +141,20 @@
this.localeSelect = localeSelect;
}
+ private boolean customLoginPageLogo;
+
+ public void setCustomLoginPageLogo( boolean customLoginPageLogo )
+ {
+ this.customLoginPageLogo = customLoginPageLogo;
+ }
+
+ private boolean customTopMenuLogo;
+
+ public void setCustomTopMenuLogo( boolean customTopMenuLogo )
+ {
+ this.customTopMenuLogo = customTopMenuLogo;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -168,6 +182,8 @@
systemSettingManager.saveSystemSetting( KEY_APPLICATION_FOOTER + localeSelect, applicationFooter );
systemSettingManager.saveSystemSetting( KEY_FLAG, flag );
systemSettingManager.saveSystemSetting( KEY_START_MODULE, startModule );
+ systemSettingManager.saveSystemSetting( KEY_CUSTOM_LOGIN_PAGE_LOGO, customLoginPageLogo );
+ systemSettingManager.saveSystemSetting( KEY_CUSTOM_TOP_MENU_LOGO, customTopMenuLogo );
styleManager.setSystemStyle( currentStyle );
message = i18n.getString( "settings_updated" );
=== 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-06-20 15:48:37 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2014-06-26 14:38:54 +0000
@@ -102,4 +102,7 @@
users_must_belong_to_a_group_controlled_by_the_user_manager=Users must belong to a group controlled by the user manager
object_not_deleted_associated_by_objects=Object not deleted because it is associated by objects of type
analytics_max_limit=Maximum number of analytics records
-unlimited=Unlimited
\ No newline at end of file
+unlimited=Unlimited
+uses_image_from=will use image from
+custom_login_page_logo=Custom login page logo
+custom_top_menu_logo=Custom top menu logo
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettings.vm 2013-10-09 13:47:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemAppearanceSettings.vm 2014-06-26 14:38:54 +0000
@@ -7,8 +7,10 @@
applicationNotification: getFieldValue( 'applicationNotification' ),
applicationFooter: getFieldValue( 'applicationFooter' ),
currentStyle: getFieldValue( 'currentStyle' ),
+ startModule: getFieldValue( 'startModule' ),
flag: getFieldValue( 'flag' ),
- startModule: getFieldValue( 'startModule' ),
+ customLoginPageLogo: $( '#customLoginPageLogo' ).is( ':checked' ),
+ customTopMenuLogo: $( '#customTopMenuLogo' ).is( ':checked' ),
localeSelect: getFieldValue( 'localeSelect' )
}, function( json ) {
if ( json.response == "success" ) {
@@ -58,6 +60,17 @@
</select>
</div>
+<div class="settingLabel">$i18n.getString( "start_page" )</div>
+
+<div class="setting">
+<select id="startModule" name="startModule">
+ <option value="NO_START_PAGE">$i18n.getString( "system_overview" )</option>
+ #foreach ( $module in $modules )
+ <option value="$module.name" #if( $module.name == $startModule )selected="selected"#end>$i18n.getString( "$module.name" )</option>
+ #end
+</select>
+</div>
+
<div class="settingLabel">$i18n.getString( "flag" )</div>
<div class="setting">
@@ -69,15 +82,16 @@
</select>
</div>
-<div class="settingLabel">$i18n.getString( "start_page" )</div>
+<div class="setting">
+ <input type="checkbox" id="customLoginPageLogo" name="customLoginPageLogo" value="true"#if( $!keyCustomLoginPageLogo ) checked="checked"#end>
+ <label for="customLoginPageLogo">$i18n.getString( "custom_login_page_logo" )</label> <span class="tipText">(88x24) - $i18n.getString( "uses_image_from" ):</span><br>
+ <span class="tipText"><base url>/external-static/logo_front.png</span>
+</div>
<div class="setting">
-<select id="startModule" name="startModule">
- <option value="NO_START_PAGE">$i18n.getString( "system_overview" )</option>
- #foreach ( $module in $modules )
- <option value="$module.name" #if( $module.name == $startModule )selected="selected"#end>$i18n.getString( "$module.name" )</option>
- #end
-</select>
+ <input type="checkbox" id="customTopMenuLogo" name="customTopMenuLogo" value="true"#if( $!keyCustomTopMenuLogo ) checked="checked"#end>
+ <label for="customTopMenuLogo">$i18n.getString( "custom_top_menu_logo" )</label> <span class="tipText">(64x17) - $i18n.getString( "uses_image_from" ):</span><br>
+ <span class="tipText"><base url>/external-static/logo_banner.png</span>
</div>
<div class="setting"><input type="button" value="$i18n.getString( 'save' )" style="width:10em"/></div>