← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11475: Added user setting for display property in user modules

 

------------------------------------------------------------
revno: 11475
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-07-22 20:11:07 +0200
message:
  Added user setting for display property in user modules
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/GetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties


--
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/user/UserSettingService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2013-04-05 07:46:29 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/user/UserSettingService.java	2013-07-22 18:11:07 +0000
@@ -51,8 +51,10 @@
     final String KEY_MESSAGE_SMS_NOTIFICATION = "keyMessageSmsNotification";
     final String KEY_DB_LOCALE = "keyLocaleUserSetting";
     final String KEY_GENERATE_REPORT_INTERFACE = "keyGenerateReportInterface";
+    final String KEY_ANALYSIS_DISPLAY_PROPERTY = "keyAnalysisDisplayProperty";
     final String AUTO_SAVE_CASE_ENTRY_FORM = "autoSaveCaseEntryForm";
     final String AUTO_SAVE_PATIENT_REGISTRATION_ENTRY_FORM = "autoSavePatientRegistration";
+    final String DEFAULT_ANALYSIS_DISPLAY_PROPERTY = "name";
     
     final List<Integer> DASHBOARD_CHARTS_TO_DISPLAY = Arrays.asList( 4, 6, 8 );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm	2013-05-15 04:10:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/settings/userGeneralSettings.vm	2013-07-22 18:11:07 +0000
@@ -5,6 +5,7 @@
 				currentLocale: getFieldValue( 'currentLocale' ),
 				currentLocaleDb: getFieldValue( 'currentLocaleDb' ),
 				currentStyle: getFieldValue( 'currentStyle' ),
+				analysisDisplayProperty: getFieldValue( 'analysisDisplayProperty' ),
                 messageEmailNotification: jQuery( '#messageEmailNotification' ).is(':checked' ),
                 messageSmsNotification: jQuery( '#messageSmsNotification' ).is(':checked' )
 			}, function ( json ) {
@@ -56,6 +57,15 @@
 </select>
 </div>
 
+<div class="settingLabel">$i18n.getString( "property_to_display_in_analysis_modules" )</div>
+
+<div class="setting">
+<select id="analysisDisplayProperty" name="analysisDisplayProperty">
+<option value="name" #if( "name" == $analysisDisplayProperty )selected="selected"#end>$i18n.getString( "name" )</option>
+<option value="shortName" #if( "shortName" == $analysisDisplayProperty )selected="selected"#end>$i18n.getString( "short_name" )</option>
+</select>
+</div>
+
 <div class="setting">
 	<input type="checkbox" id="messageEmailNotification" name="messageEmailNotification" #if( $messageEmailNotification ) checked="checked"#end/>
 	<label for="messageEmailNotification">$i18n.getString( "enable_message_email_notifications" )</label>

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/GetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/GetGeneralSettingsAction.java	2013-07-02 15:58:13 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/GetGeneralSettingsAction.java	2013-07-22 18:11:07 +0000
@@ -27,9 +27,10 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.user.UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM;
 import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
 import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
+import static org.hisp.dhis.user.UserSettingService.KEY_ANALYSIS_DISPLAY_PROPERTY;
+import static org.hisp.dhis.user.UserSettingService.DEFAULT_ANALYSIS_DISPLAY_PROPERTY;
 
 import java.util.ArrayList;
 import java.util.Collections;
@@ -139,11 +140,11 @@
         return styles;
     }
 
-    private Boolean autoSave;
+    private String analysisDisplayProperty;
 
-    public Boolean getAutoSave()
+    public String getAnalysisDisplayProperty()
     {
-        return autoSave;
+        return analysisDisplayProperty;
     }
 
     private Boolean messageEmailNotification;
@@ -205,18 +206,14 @@
         currentLocaleDb = i18nService.getCurrentLocale();
         
         // ---------------------------------------------------------------------
-        // Get Auto-save data entry form
-        // ---------------------------------------------------------------------
-
-        autoSave = (Boolean) userSettingService.getUserSetting( AUTO_SAVE_DATA_ENTRY_FORM, false );
-
-        // ---------------------------------------------------------------------
         // Get styles
         // ---------------------------------------------------------------------
 
         styles = styleManager.getStyles();
 
         currentStyle = styleManager.getCurrentStyle();
+        
+        analysisDisplayProperty = (String) userSettingService.getUserSetting( KEY_ANALYSIS_DISPLAY_PROPERTY, DEFAULT_ANALYSIS_DISPLAY_PROPERTY );
 
         messageEmailNotification = (Boolean) userSettingService.getUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, false );
 

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java	2012-11-20 14:43:33 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/settings/user/action/SetGeneralSettingsAction.java	2013-07-22 18:11:07 +0000
@@ -27,7 +27,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-import static org.hisp.dhis.user.UserSettingService.KEY_DB_LOCALE;
+import static org.hisp.dhis.user.UserSettingService.*;
 import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_EMAIL_NOTIFICATION;
 import static org.hisp.dhis.user.UserSettingService.KEY_MESSAGE_SMS_NOTIFICATION;
 
@@ -98,6 +98,13 @@
         this.currentStyle = style;
     }
 
+    private String analysisDisplayProperty;
+
+    public void setAnalysisDisplayProperty( String analysisDisplayProperty )
+    {
+        this.analysisDisplayProperty = analysisDisplayProperty;
+    }
+
     private Boolean messageEmailNotification;
 
     public void setMessageEmailNotification( Boolean messageEmailNotification )
@@ -140,6 +147,8 @@
 
         styleManager.setUserStyle( currentStyle );
         
+        userSettingService.saveUserSetting( KEY_ANALYSIS_DISPLAY_PROPERTY, analysisDisplayProperty );
+        
         userSettingService.saveUserSetting( KEY_MESSAGE_EMAIL_NOTIFICATION, messageEmailNotification );
 
         userSettingService.saveUserSetting( KEY_MESSAGE_SMS_NOTIFICATION, messageSmsNotification );

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-07-12 09:21:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/i18n_global.properties	2013-07-22 18:11:07 +0000
@@ -372,6 +372,7 @@
 languages=Languages
 update_user_profile_success=Profile was updated
 settings=Settings
+property_to_display_in_analysis_modules=Property to display in analysis modules
 user_settings=User settings
 general=General
 message=Message