dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #20100
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 9052: added system setting for enabling/disabling multiorgunitforms
------------------------------------------------------------
revno: 9052
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-11-15 15:32:59 +0100
message:
added system setting for enabling/disabling multiorgunitforms
added:
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMultiOrgSettingAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMultiOrgForms.vm
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm
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-11-13 08:20:17 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/setting/SystemSettingManager.java 2012-11-15 14:32:59 +0000
@@ -73,6 +73,7 @@
final String KEY_SEND_MESSAGE_SCHEDULED_TASKS = "sendMessageScheduled";
final String KEY_SCHEDULE_MESSAGE_TASKS = "scheduleMessage";
final String KEY_PHONE_NUMBER_AREA_CODE = "phoneNumberAreaCode";
+ final String KEY_MULTI_ORGANISATION_UNIT_FORMS = "multiOrganisationUnitForms";
final String KEY_SCHEDULE_AGGREGATE_QUERY_BUILDER_TASKS = "scheduleAggregateQueryBuilder";
final String KEY_AGGREGATE_QUERY_BUILDER_ORGUNITGROUPSET_AGG_LEVEL = "aggQueryBuilderorgUnitGroupSetAggregationLevel";
final String KEY_CONFIGURATION = "keyConfig";
=== 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-11-13 08:20:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/interceptor/SystemSettingInterceptor.java 2012-11-15 14:32:59 +0000
@@ -27,23 +27,6 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_COMPLETENESS_OFFSET;
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_FACTOR_OF_DEVIATION;
-import static org.hisp.dhis.setting.SystemSettingManager.DEFAULT_START_MODULE;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_TITLE;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_INTRO;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_APPLICATION_NOTIFICATION;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_CACHE_STRATEGY;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_COMPLETENESS_OFFSET;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_FACTOR_OF_DEVIATION;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_FLAG;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_FLAG_IMAGE;
-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_PHONE_NUMBER_AREA_CODE;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_CONFIGURATION;
-import static org.hisp.dhis.setting.SystemSettingManager.KEY_ACCOUNT_RECOVERY;
-
import java.util.HashMap;
import java.util.Map;
@@ -53,6 +36,8 @@
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;
+import static org.hisp.dhis.setting.SystemSettingManager.*;
+
/**
* @author Lars Helge Overland
*/
@@ -105,6 +90,7 @@
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( KEY_PHONE_NUMBER_AREA_CODE, systemSettingManager.getSystemSetting( KEY_PHONE_NUMBER_AREA_CODE, "" ) );
+ map.put( KEY_MULTI_ORGANISATION_UNIT_FORMS, systemSettingManager.getSystemSetting( KEY_MULTI_ORGANISATION_UNIT_FORMS, false ) );
map.put( KEY_ACCOUNT_RECOVERY, systemSettingManager.getSystemSetting( KEY_ACCOUNT_RECOVERY, false ) );
map.put( KEY_CONFIGURATION, configurationService.getConfiguration() );
=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMultiOrgSettingAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMultiOrgSettingAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/GetMultiOrgSettingAction.java 2012-11-15 14:32:59 +0000
@@ -0,0 +1,72 @@
+package org.hisp.dhis.de.action;
+
+/*
+ * Copyright (c) 2004-2012, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.setting.SystemSettingManager;
+
+/**
+ * @author Morten Olav Hansen <mortenoh@xxxxxxxxx>
+ */
+public class GetMultiOrgSettingAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SystemSettingManager systemSettingManager;
+
+ public void setSystemSettingManager( SystemSettingManager systemSettingManager )
+ {
+ this.systemSettingManager = systemSettingManager;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Boolean multiOrganisationUnitForms = false;
+
+ public Boolean getMultiOrganisationUnitForms()
+ {
+ return multiOrganisationUnitForms;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action Implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute() throws Exception
+ {
+ multiOrganisationUnitForms = (Boolean) systemSettingManager.getSystemSetting( SystemSettingManager.KEY_MULTI_ORGANISATION_UNIT_FORMS );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2012-11-09 12:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/LoadFormAction.java 2012-11-15 14:32:59 +0000
@@ -39,6 +39,8 @@
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.setting.SystemSetting;
+import org.hisp.dhis.setting.SystemSettingManager;
import java.util.*;
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 2012-11-09 21:52:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 2012-11-15 14:32:59 +0000
@@ -47,14 +47,6 @@
this.selectionManager = selectionManager;
}
- // we might refactor this into a system property, hard-coding to true for now
- private boolean multiOrganisationUnit = true;
-
- public boolean isMultiOrganisationUnit()
- {
- return multiOrganisationUnit;
- }
-
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2012-11-09 12:16:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/META-INF/dhis/beans.xml 2012-11-15 14:32:59 +0000
@@ -15,6 +15,10 @@
<property name="selectionManager" ref="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
</bean>
+ <bean id="org.hisp.dhis.de.action.GetMultiOrgSettingAction" class="org.hisp.dhis.de.action.GetMultiOrgSettingAction" scope="prototype">
+ <property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
+ </bean>
+
<bean id="org.hisp.dhis.de.action.GetMetaDataAction" class="org.hisp.dhis.de.action.GetMetaDataAction"
scope="prototype">
<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2012-11-15 13:27:58 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/struts.xml 2012-11-15 14:32:59 +0000
@@ -15,13 +15,17 @@
<param name="menu">/dhis-web-dataentry/menu.vm</param>
<param name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/form.js,javascript/entry.js,javascript/history.js</param>
<param name="stylesheets">style/dhis-web-dataentry.css</param>
- <param name="offline">true</param>
+ <!-- <param name="offline">true</param> -->
</action>
<action name="getMetaData" class="org.hisp.dhis.de.action.GetMetaDataAction">
<result name="success" type="velocity-json">/dhis-web-dataentry/responseMetaData.vm</result>
</action>
+ <action name="getMultiOrgUnitForms" class="org.hisp.dhis.de.action.GetMultiOrgSettingAction">
+ <result name="success" type="velocity-json">/dhis-web-dataentry/responseMultiOrgForms.vm</result>
+ </action>
+
<action name="getDataValues" class="org.hisp.dhis.de.action.GetDataValuesForDataSetAction">
<result name="success" type="velocity-json">/dhis-web-dataentry/responseDataValues.vm</result>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm 2012-11-09 21:52:42 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/menu.vm 2012-11-15 14:32:59 +0000
@@ -2,9 +2,14 @@
jQuery(document).ready(function() {
selection.setListenerFunction( organisationUnitSelected );
- #if( $multiOrganisationUnit )
- selection.setIncludeChildren( true );
- #end
+ $.ajax({
+ url: 'getMultiOrgUnitForms.action',
+ dataType: 'json',
+ async: false,
+ success: function(data) {
+ selection.setIncludeChildren( data.enabled );
+ }
+ });
});
</script>
=== added file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMultiOrgForms.vm'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMultiOrgForms.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/responseMultiOrgForms.vm 2012-11-15 14:32:59 +0000
@@ -0,0 +1,1 @@
+{ "enabled": $multiOrganisationUnitForms }
\ No newline at end of file
=== 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-10-23 08:01:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/SetGeneralSettingsAction.java 2012-11-15 14:32:59 +0000
@@ -160,6 +160,13 @@
this.phoneNumberAreaCode = phoneNumberAreaCode;
}
+ private boolean multiOrganisationUnitForms;
+
+ public void setMultiOrganisationUnitForms( boolean multiOrganisationUnitForms )
+ {
+ this.multiOrganisationUnitForms = multiOrganisationUnitForms;
+ }
+
private String message;
public String getMessage()
@@ -186,6 +193,7 @@
systemSettingManager.saveSystemSetting( KEY_FACTOR_OF_DEVIATION, factorDeviation );
systemSettingManager.saveSystemSetting( KEY_COMPLETENESS_OFFSET, completenessOffset );
systemSettingManager.saveSystemSetting( KEY_PHONE_NUMBER_AREA_CODE, phoneNumberAreaCode );
+ systemSettingManager.saveSystemSetting( KEY_MULTI_ORGANISATION_UNIT_FORMS, multiOrganisationUnitForms );
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 2012-11-13 14:54:11 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/org/hisp/dhis/settings/i18n_module.properties 2012-11-15 14:32:59 +0000
@@ -115,3 +115,4 @@
enable_user_account_recovery=Enable user account recovery
select_organisation_unit=Select organisation unit
application_notification=Application notification
+multi_organisation_unit_forms=Enable multi organisation unit forms
=== 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-10-29 20:17:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/webapp/dhis-web-maintenance-settings/systemGeneralSettings.vm 2012-11-15 14:32:59 +0000
@@ -10,7 +10,8 @@
omitIndicatorsZeroNumeratorDataMart: jQuery( '#omitIndicatorsZeroNumeratorDataMart' ).is( ':checked' ),
factorDeviation: getFieldValue( 'factorDeviation' ),
completenessOffset: getFieldValue( 'completenessOffset' ),
- phoneNumberAreaCode: getFieldValue( 'phoneNumberAreaCode' )
+ phoneNumberAreaCode: getFieldValue( 'phoneNumberAreaCode' ),
+ multiOrganisationUnitForms: getFieldValue( 'multiOrganisationUnitForms' )
}, function( json ) {
if ( json.response == "success" ) {
setHeaderDelayMessage( json.message );
@@ -93,6 +94,15 @@
<input type="text" id="phoneNumberAreaCode" name="phoneNumberAreaCode" value="$!phoneNumberAreaCode"/>
</div>
+<div class="settingLabel">$i18n.getString( "multi_organisation_unit_forms" )</div>
+
+<div class="setting">
+ <select id="multiOrganisationUnitForms" name="multiOrganisationUnitForms">
+ <option value="true" #if( $multiOrganisationUnitForms == true)selected="selected"#end>True</option>
+ <option value="false" #if( $multiOrganisationUnitForms == false)selected="selected"#end>False</option>
+ </select>
+</div>
+
<div class="setting">
<input type="checkbox" id="omitIndicatorsZeroNumeratorDataMart" name="omitIndicatorsZeroNumeratorDataMart" #if( $omitIndicatorsZeroNumeratorDataMart )checked="checked"#end>
<label for="omitIndicatorsZeroNumeratorDataMart">$i18n.getString( "omit_indicators_zero_numerator_data_mart" )</label>