dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19138
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8233: Define area code of phone number in system setting and put it into phone number field in Add/Upda...
------------------------------------------------------------
revno: 8233
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-09-24 22:52:15 +0700
message:
Define area code of phone number in system setting and put it into phone number field in Add/Update patient form.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
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 2012-09-14 08:13:33 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java 2012-09-24 15:52:15 +0000
@@ -73,6 +73,7 @@
final String KEY_SEND_MESSAGE_SCHEDULED_TASKS = "sendMessageScheduled";
final String KEY_SCHEDULE_MESSAGE_TASKS = "scheduleMessage";
final String KEY_SEND_MESSAGE_GATEWAY = "keySendMessageGateway";
+ final String PHONE_NUMBER_AREA_CODE = "phoneNumberAreaCode";
final int DEFAULT_MAX_NUMBER_OF_ATTEMPTS = 20;
final int DEFAULT_TIMEFRAME_MINUTES = 1;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-24 06:21:49 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/patientForm.vm 2012-09-24 15:52:15 +0000
@@ -60,7 +60,7 @@
<tr>
<td class='text-column'><label for="phoneNumber">$i18n.getString( "phone_number" )</label></td>
<td class="input-column">
- <input type="text" id="phoneNumber" name="phoneNumber" value="$!patient.phoneNumber" class="{validate:{phone:true}}"/>
+ <input type="text" id="phoneNumber" name="phoneNumber" value="$!phoneNumberAreaCode$!patient.phoneNumber" class="{validate:{phone:true}}"/>
</td>
</tr>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2012-09-24 06:21:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/jQuery/jquery.validate.ext.js 2012-09-24 15:52:15 +0000
@@ -294,7 +294,7 @@
jQuery.validator.addMethod("phone", function(value, element) {
- return this.optional(element) || (/^(\+)\d+$/.test(value));
+ return this.optional(element) || (/^(\+)?\d+$/.test(value));
}, "Please enter valid phone number");
// TODO check if value starts with <, otherwise don't try stripping anything
=== 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 2012-09-11 01:58:59 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java 2012-09-24 15:52:15 +0000
@@ -40,6 +40,7 @@
import static org.hisp.dhis.setting.SystemSettingManager.KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_START_MODULE;
import static org.hisp.dhis.setting.SystemSettingManager.KEY_SYSTEM_IDENTIFIER;
+import static org.hisp.dhis.setting.SystemSettingManager.PHONE_NUMBER_AREA_CODE;
import java.util.HashMap;
import java.util.Map;
@@ -94,7 +95,7 @@
map.put( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, systemSettingManager.getSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, false ) );
map.put( KEY_FACTOR_OF_DEVIATION, systemSettingManager.getSystemSetting( KEY_FACTOR_OF_DEVIATION, DEFAULT_FACTOR_OF_DEVIATION ) );
map.put( KEY_COMPLETENESS_OFFSET, systemSettingManager.getSystemSetting( KEY_COMPLETENESS_OFFSET, DEFAULT_COMPLETENESS_OFFSET ) );
-
+ map.put( PHONE_NUMBER_AREA_CODE, systemSettingManager.getSystemSetting( PHONE_NUMBER_AREA_CODE, "" ) );
invocation.getStack().push( map );
return invocation.invoke();
=== 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 2012-09-24 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java 2012-09-24 15:52:15 +0000
@@ -160,6 +160,13 @@
this.completenessOffset = completenessOffset;
}
+ private String phoneNumberAreaCode;
+
+ public void setPhoneNumberAreaCode( String phoneNumberAreaCode )
+ {
+ this.phoneNumberAreaCode = phoneNumberAreaCode;
+ }
+
private String message;
public String getMessage()
@@ -181,11 +188,14 @@
public String execute()
{
systemSettingManager.saveSystemSetting( KEY_CACHE_STRATEGY, cacheStrategy );
- systemSettingManager.saveSystemSetting( KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART, omitIndicatorsZeroNumeratorDataMart );
- systemSettingManager.saveSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, disableDataEntryWhenCompleted );
+ systemSettingManager.saveSystemSetting( KEY_OMIT_INDICATORS_ZERO_NUMERATOR_DATAMART,
+ omitIndicatorsZeroNumeratorDataMart );
+ systemSettingManager
+ .saveSystemSetting( KEY_DISABLE_DATAENTRYFORM_WHEN_COMPLETED, disableDataEntryWhenCompleted );
systemSettingManager.saveSystemSetting( KEY_FACTOR_OF_DEVIATION, factorDeviation );
systemSettingManager.saveSystemSetting( KEY_COMPLETENESS_OFFSET, completenessOffset );
-
+ systemSettingManager.saveSystemSetting( PHONE_NUMBER_AREA_CODE, phoneNumberAreaCode );
+
Configuration configuration = configurationService.getConfiguration();
if ( feedbackRecipients != null )
@@ -195,9 +205,11 @@
if ( offlineOrganisationUnitLevel != null )
{
- configuration.setOfflineOrganisationUnitLevel( organisationUnitService.getOrganisationUnitLevel( offlineOrganisationUnitLevel ) );
+ configuration.setOfflineOrganisationUnitLevel( organisationUnitService
+ .getOrganisationUnitLevel( offlineOrganisationUnitLevel ) );
- // if the level is changed, we need to make sure that the version is also changed.
+ // if the level is changed, we need to make sure that the version is
+ // also changed.
organisationUnitService.updateVersion();
}
=== 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 2012-09-12 15:41:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2012-09-24 15:52:15 +0000
@@ -103,4 +103,5 @@
no_cache=No cache
cache_until_6am_tomorrow=Cache until 6 AM tomorrow
cache_for_two_weeks=Cache for two weeks
-max_levels_to_offline=Maximum offline organisation unit levels
\ No newline at end of file
+max_levels_to_offline=Maximum offline organisation unit levels
+phone_number_area_code = Phone number area code
\ 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 2012-09-24 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm 2012-09-24 15:52:15 +0000
@@ -10,7 +10,8 @@
omitIndicatorsZeroNumeratorDataMart: jQuery( '#omitIndicatorsZeroNumeratorDataMart' ).is( ':checked' ),
disableDataEntryWhenCompleted: jQuery( '#disableDataEntryWhenCompleted' ).is( ':checked' ),
factorDeviation: getFieldValue( 'factorDeviation' ),
- completenessOffset: getFieldValue( 'completenessOffset' )
+ completenessOffset: getFieldValue( 'completenessOffset' ),
+ phoneNumberAreaCode: getFieldValue( 'phoneNumberAreaCode' )
}, function( json ) {
if ( json.response == "success" )
setHeaderDelayMessage( json.message );
@@ -108,4 +109,12 @@
<input type="text" id="completenessOffset" name="completenessOffset" value="$!completenessOffset"/>
</p>
+
+<!-- area code -->
+<h4>$i18n.getString( "phone_number_area_code" )</h4>
+
+<p>
+ <input type="text" id="phoneNumberAreaCode" name="phoneNumberAreaCode" value="$!phoneNumberAreaCode"/>
+</p>
+
<p><input type="button" value="$i18n.getString( 'save' )" style="width:10em"/></p>
\ No newline at end of file