← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16511: Help Page Link override in general settings implementation

 

------------------------------------------------------------
revno: 16511
committer: James Chang <jamesbchang@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-08-26 14:05:04 +0700
message:
  Help Page Link override in general settings implementation
added:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonHelpPageLinkModule.vm
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/about/functions.vm
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js
  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/dhis-web-commons.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.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/systemGeneralSettings.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-08-25 11:42:12 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java	2014-08-26 07:05:04 +0000
@@ -102,6 +102,7 @@
     final String KEY_LAST_SUCCESSFUL_DATA_SYNC = "keyLastSuccessfulDataSynch";
     final String KEY_LAST_SUCCESSFUL_ANALYTICS_TABLES_UPDATE = "keyLastSuccessfulAnalyticsTablesUpdate";
     final String KEY_LAST_SUCCESSFUL_RESOURCE_TABLES_UPDATE = "keyLastSuccessfulResourceTablesUpdate";
+    final String KEY_HELP_PAGE_LINK = "helpPageLink";
 
     final String DEFAULT_SCHEDULE_AGGREGATE_QUERY_BUILDER_TASK_STRATEGY = "lastMonth";
     final String DEFAULT_FLAG = "dhis2";
@@ -120,7 +121,8 @@
     final String DEFAULT_CACHE_STRATEGY = "CACHE_6AM_TOMORROW";
     final int DEFAULT_ANALYTICS_MAX_LIMIT = 50000;
     final int DEFAULT_DATABASE_SERVER_CPUS = 0; // Detect automatically
-
+    final String DEFAULT_HELP_PAGE_LINK = "../dhis-web-commons-about/help.action";
+	
     final Map<String, Serializable> DEFAULT_SETTINGS_VALUES = new HashMap<String, Serializable>()
     {
         {

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/functions.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/functions.vm	2013-09-26 14:59:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/about/functions.vm	2014-08-26 07:05:04 +0000
@@ -1,5 +1,5 @@
 <ul class="moduleList">
-	#introListImgItem( "../dhis-web-commons-about/help.action", "help_center", "function-help-center" )
+    #introListImgItem( "$!helpPageLink", "help_center", "function-help-center" )
     #introListImgItem( "../dhis-web-commons-about/software.action", "supportive_software", "function-supportive-software" )
     #introListImgItem( "../dhis-web-commons-about/modules.action", "system_overview", "function-system-overview" )
     #introListImgItem( "../api", "web_api", "function-web-api" )

=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonHelpPageLinkModule.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonHelpPageLinkModule.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonHelpPageLinkModule.vm	2014-08-26 07:05:04 +0000
@@ -0,0 +1,3 @@
+{
+	"defaultAction":"$!encoder.jsonEncode( $!helpPageLink )"
+}

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js	2014-06-18 11:14:28 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.menu.ui.js	2014-08-26 07:05:04 +0000
@@ -942,6 +942,17 @@
 (function () {
     dhis2.menu.ui.initMenu = function () {
         try {
+		var helpPageLink = "";
+		$.ajax({
+			type : "GET",
+			url : "../dhis-web-commons/menu/getHelpPageLinkModule.action",
+			dataType : "json",
+			async : false,
+			success : function(json) {
+				helpPageLink = json;
+			}
+		});
+			
             dhis2.menu.ui.createMenu("profile", [
                 {
                     name: "settings",
@@ -967,7 +978,7 @@
                 {
                     name: "help",
                     namespace: "/dhis-web-commons-about",
-                    defaultAction: "../dhis-web-commons-about/help.action",
+                    defaultAction: helpPageLink.defaultAction,
                     icon: "../icons/function-account.png",
                     description: ""
                 },

=== 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-08-25 11:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java	2014-08-26 07:05:04 +0000
@@ -119,6 +119,7 @@
         map.put( KEY_CUSTOM_TOP_MENU_LOGO, systemSettingManager.getSystemSetting( KEY_CUSTOM_TOP_MENU_LOGO, false ) );
         map.put( KEY_ANALYTICS_MAINTENANCE_MODE, systemSettingManager.getSystemSetting( KEY_ANALYTICS_MAINTENANCE_MODE, false ) );
         map.put( KEY_DATABASE_SERVER_CPUS, systemSettingManager.getSystemSetting( KEY_DATABASE_SERVER_CPUS, DEFAULT_DATABASE_SERVER_CPUS ) );
+        map.put( KEY_HELP_PAGE_LINK, systemSettingManager.getSystemSetting( KEY_HELP_PAGE_LINK, DEFAULT_HELP_PAGE_LINK ) );
         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/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2014-06-22 12:36:40 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2014-08-26 07:05:04 +0000
@@ -299,6 +299,11 @@
       <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonModules.vm</result>
       <param name="onExceptionReturn">plainTextError</param>
     </action>
+    
+    <action name="getHelpPageLinkModule" class="org.hisp.dhis.commons.action.NoAction">
+      <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonHelpPageLinkModule.vm</result>
+      <param name="onExceptionReturn">plainTextError</param>
+    </action>
 
   </package>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2014-08-25 11:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java	2014-08-26 07:05:04 +0000
@@ -203,6 +203,13 @@
         this.dateFormat = dateFormat;
     }
 
+    private String helpPageLink;
+    
+    public void setHelpPageLink( String helpPageLink )
+    {
+        this.helpPageLink = helpPageLink;
+    }
+
     private String message;
 
     public String getMessage()
@@ -234,6 +241,13 @@
         systemSettingManager.saveSystemSetting( KEY_CALENDAR, calendar );
         systemSettingManager.saveSystemSetting( KEY_DATE_FORMAT, dateFormat );
         systemSettingManager.saveSystemSetting( KEY_ANALYTICS_MAINTENANCE_MODE, analyticsMaintenanceMode );
+        
+        if( helpPageLink.isEmpty() )
+        {
+            helpPageLink = (String) systemSettingManager.getSystemSetting( KEY_HELP_PAGE_LINK, DEFAULT_HELP_PAGE_LINK );
+        }
+        
+        systemSettingManager.saveSystemSetting( KEY_HELP_PAGE_LINK, helpPageLink );
 
         Configuration configuration = configurationService.getConfiguration();
 

=== 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-08-25 11:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties	2014-08-26 07:05:04 +0000
@@ -119,4 +119,5 @@
 hidden=Hidden
 no_of_database_server_cpus=Number of database server CPUs
 automatic=Automatic
-detect_based_on_web_server=detect based on web server
\ No newline at end of file
+detect_based_on_web_server=detect based on web server
+help_page_link = Help page link
\ 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/systemGeneralSettings.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2014-08-25 11:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm	2014-08-26 07:05:04 +0000
@@ -14,7 +14,8 @@
         phoneNumberAreaCode: getFieldValue('phoneNumberAreaCode'),
         googleAnalyticsUA: getFieldValue('googleAnalyticsUA'),
         multiOrganisationUnitForms: jQuery('#multiOrganisationUnitForms').is(':checked'),
-        analyticsMaintenanceMode: jQuery('#analyticsMaintenanceMode').is(':checked')
+        analyticsMaintenanceMode: jQuery('#analyticsMaintenanceMode').is(':checked'),
+        helpPageLink: getFieldValue('helpPageLink')
       }, function( json ) {
         if( json.response == "success" ) {
           setHeaderDelayMessage(json.message);
@@ -115,6 +116,12 @@
 	<input type="text" id="phoneNumberAreaCode" name="phoneNumberAreaCode" value="$!phoneNumberAreaCode"/>
 </div>
 
+<div class="settingLabel">$i18n.getString( "help_page_link" )</div>
+
+<div class="setting">
+	<input type="text" id="helpPageLink" name="helpPageLink" value="$!helpPageLink"/>
+</div>
+
 <div class="settingLabel">$i18n.getString( "google_analytics_ua_key" )</div>
 
 <div class="setting">