dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07685
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2233: Fix bug: Cannot validation, remove and translation for Program function into Patient module.
------------------------------------------------------------
revno: 2233
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: trunk
timestamp: Sat 2010-09-25 17:03:31 +0700
message:
Fix bug: Cannot validation, remove and translation for Program function into Patient module.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ValidateProgramAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.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-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2010-03-05 06:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/AddProgramAction.java 2010-09-25 10:03:31 +0000
@@ -54,11 +54,11 @@
// Input/Output
// -------------------------------------------------------------------------
- private String nameField;
+ private String name;
- public void setNameField( String nameField )
+ public void setName( String name )
{
- this.nameField = nameField;
+ this.name = name;
}
private String description;
@@ -100,7 +100,7 @@
Program program = new Program();
- program.setName( nameField );
+ program.setName( name );
program.setDescription( description );
program.setDateOfEnrollmentDescription( dateOfEnrollmentDescription );
program.setDateOfIncidentDescription( dateOfIncidentDescription );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java 2009-10-11 17:27:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/GetProgramAction.java 2010-09-25 10:03:31 +0000
@@ -27,17 +27,15 @@
package org.hisp.dhis.patient.action.program;
-import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
-import org.hisp.dhis.organisationunit.comparator.OrganisationUnitGroupNameComparator;
+import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
import com.opensymphony.xwork2.Action;
@@ -58,21 +56,14 @@
{
this.programService = programService;
}
-
- private OrganisationUnitService organisationUnitService;
-
- public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
- {
- this.organisationUnitService = organisationUnitService;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
+
+ private SelectionTreeManager selectionTreeManager;
+
+ public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
+ {
+ this.selectionTreeManager = selectionTreeManager;
+ }
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -142,13 +133,9 @@
throws Exception
{
program = programService.getProgram( id );
-
- levels = organisationUnitService.getOrganisationUnitLevels();
-
- groups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupService.getAllOrganisationUnitGroups() );
-
- Collections.sort( groups, new OrganisationUnitGroupNameComparator() );
-
+
+ selectionTreeManager.setSelectedOrganisationUnits( program.getOrganisationUnits() );
+
return SUCCESS;
}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java 2010-09-23 04:50:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/SetupAssociationsTreeAction.java 1970-01-01 00:00:00 +0000
@@ -1,88 +0,0 @@
-package org.hisp.dhis.patient.action.program;
-
-/*
- * Copyright (c) 2004-2010, 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 org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Kristian
- * @version $Id: SetupAssociationsTreeAction.java 5652 2008-09-06 13:24:34Z larshelg $
- */
-public class SetupAssociationsTreeAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private ProgramService programService;
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- // -------------------------------------------------------------------------
- // Getters & Setters
- // -------------------------------------------------------------------------
-
- private int id;
-
- public int getProgramId()
- {
- return id;
- }
-
- public void setId( int id )
- {
- this.id = id;
- }
-
- private Program program;
-
- public Program getProgram()
- {
- return program;
- }
-
- // -------------------------------------------------------------------------
- // Execute
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- program = programService.getProgram( id );
-
- return SUCCESS;
- }
-
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2010-03-05 06:24:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/UpdateProgramAction.java 2010-09-25 10:03:31 +0000
@@ -61,11 +61,11 @@
this.id = id;
}
- private String nameField;
+ private String name;
- public void setNameField( String nameField )
+ public void setName( String name )
{
- this.nameField = nameField;
+ this.name = name;
}
private String description;
@@ -105,7 +105,7 @@
{
Program program = programService.getProgram( id );
- program.setName( nameField );
+ program.setName( name );
program.setDescription( description );
program.setDateOfEnrollmentDescription( dateOfEnrollmentDescription );
program.setDateOfIncidentDescription( dateOfIncidentDescription );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ValidateProgramAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ValidateProgramAction.java 2009-11-24 15:39:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/program/ValidateProgramAction.java 2010-09-25 10:03:31 +0000
@@ -65,20 +65,13 @@
this.id = id;
}
- private String nameField;
-
- public void setNameField( String nameField )
- {
- this.nameField = nameField;
- }
-
- private String description;
-
- public void setDescription( String description )
- {
- this.description = description;
- }
-
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
private String message;
public String getMessage()
@@ -100,57 +93,16 @@
public String execute()
throws Exception
{
-
- if ( nameField == null )
- {
- message = i18n.getString( "please_specify_a_name" );
-
- return INPUT;
- }
-
- else
- {
- nameField = nameField.trim();
-
- if ( nameField.length() == 0 )
- {
- message = i18n.getString( "please_specify_a_name" );
-
- return INPUT;
- }
-
- Program match = programService.getProgramByName( nameField );
-
- if ( match != null && (id == null || match.getId() != id) )
- {
- message = i18n.getString( "duplicate_names" );
-
- return INPUT;
- }
- }
-
- if ( description == null )
- {
- message = i18n.getString( "please_specify_a_description" );
-
- return INPUT;
- }
-
- else
- {
- description = description.trim();
-
- if ( description.length() == 0 )
- {
- message = i18n.getString( "please_specify_a_description" );
-
- return INPUT;
- }
- }
-
- // ---------------------------------------------------------------------
- // Validation success
- // ---------------------------------------------------------------------
+ name = name.trim();
+
+ Program match = programService.getProgramByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "duplicate_names" );
+
+ return ERROR;
+ }
message = i18n.getString( "everything_is_ok" );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-09-23 04:50:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml 2010-09-25 10:03:31 +0000
@@ -574,10 +574,8 @@
<bean id="org.hisp.dhis.patient.action.program.GetProgramAction"
class="org.hisp.dhis.patient.action.program.GetProgramAction" scope="prototype">
<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- <property name="organisationUnitService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ <property name="selectionTreeManager"
+ ref="org.hisp.dhis.oust.manager.SelectionTreeManager" />
</bean>
<bean id="org.hisp.dhis.patient.action.program.RemoveProgramAction"
@@ -605,13 +603,6 @@
</bean>
<!-- Program_OrganisationUnit Association -->
-
- <bean
- id="org.hisp.dhis.patient.action.program.SetupAssociationsTreeAction"
- class="org.hisp.dhis.patient.action.program.SetupAssociationsTreeAction"
- scope="prototype">
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- </bean>
<bean
id="org.hisp.dhis.patient.action.program.DefineProgramAssociationsAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-09-25 07:53:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2010-09-25 10:03:31 +0000
@@ -399,4 +399,15 @@
operator_less_then = <
operator_equal_to = =
operator_greater_then = >
-program_is_invalid = Program is invalid
\ No newline at end of file
+program_is_invalid = Program is invalid
+validation_associations = Validation association
+define_validation_associations = Define validation associations
+define_validationDE_associations = Define validation Data Element Associations
+validationDE_associations = Validation Data Element Associations
+left_side = Left side
+right_side = Right side
+validation = Validation
+available_criteria = Available criteria
+selected_criteria = Selected criteria
+programstage_dataelement_validation = Programstage Dataelement Validation
+dataentryform_management_for_program_stage = Data Entry Form Form ProgramStage
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-09-25 07:53:17 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml 2010-09-25 10:03:31 +0000
@@ -544,10 +544,6 @@
<param name="menu">/dhis-web-maintenance-patient/menuWithTree.vm</param>
<param name="menuTreeHeight">321</param>
<param name="page">/dhis-web-maintenance-patient/programEnrollmentForm.vm</param>
- <!--
- <param
- name="javascripts">../dhis-web-commons/ouwt/ouwt.js,javascript/patient.js</param>
- -->
<param name="javascripts">
../dhis-web-commons/ouwt/ouwt.js,
../dhis-web-commons/javascripts/date.js,
@@ -586,8 +582,7 @@
<action name="removeProgram"
class="org.hisp.dhis.patient.action.program.RemoveProgramAction">
- <result name="success" type="redirect">program.action
- </result>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<param name="requiredAuthorities">F_PROGRAM_DELETE</param>
</action>
@@ -625,25 +620,15 @@
<action name="validateProgram"
class="org.hisp.dhis.patient.action.program.ValidateProgramAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <result name="error" type="velocity-xml">
- /dhis-web-maintenance-patient/responseError.vm</result>
- <result name="input" type="velocity-xml">
- /dhis-web-maintenance-patient/responseInput.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
<!-- Program_OrganisationUnit Association -->
-
+
<action name="defineProgramAssociationsForm"
- class="org.hisp.dhis.patient.action.program.SetupAssociationsTreeAction">
- <result name="success" type="chain">getProgramAssociationOptions
- </result>
- <param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
- </action>
-
- <action name="getProgramAssociationOptions"
class="org.hisp.dhis.patient.action.program.GetProgramAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-patient/programAssociations.vm</param>
@@ -652,8 +637,7 @@
<action name="defineProgramAssociations"
class="org.hisp.dhis.patient.action.program.DefineProgramAssociationsAction">
- <result name="success" type="redirect">program.action
- </result>
+ <result name="success" type="redirect">program.action</result>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
</action>
@@ -695,6 +679,7 @@
/dhis-web-maintenance-patient/responseSuccess.vm</result>
<param name="requiredAuthorities">F_PROGRAM_UPDATE</param>
</action>
+
<!-- ProgramStage -->
<action name="programStage"
@@ -1000,10 +985,10 @@
<action name="removePatientIdentifierType"
class="org.hisp.dhis.patient.action.patientidentifiertype.RemovePatientIdentifierTypeAction">
- <result name="success" type="velocity-xml">
- /dhis-web-maintenance-patient/responseSuccess.vm</result>
- <result name="error" type="velocity-xml">
- /dhis-web-maintenance-patient/responseError.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
<param name="requiredAuthorities">F_PATIENTIDENTIFIERTYPE_DELETE</param>
</action>
@@ -1121,7 +1106,7 @@
<action name="removeValidationCriteria"
class="org.hisp.dhis.patient.action.validation.RemoveValidationCriteriaAction">
<result name="success" type="velocity-json">
- ../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
<param name="requiredAuthorities">F_VALIDATIONCRITERIA_DELETE</param>
</action>
@@ -1168,7 +1153,7 @@
<action name="removeProgramStageDEValidation"
class="org.hisp.dhis.patient.action.validation.RemoveProgramStageDEValidationAction">
<result name="success" type="velocity-json">
- ../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
</action>
</package>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2010-08-17 07:26:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/addProgramForm.vm 2010-09-25 10:03:31 +0000
@@ -1,6 +1,10 @@
<script>
jQuery(document).ready( function(){
- validation( 'addProgramForm', validateAddProgram );
+ validation( 'addProgramForm', function( form ){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateProgram.action");
});
</script>
@@ -11,7 +15,7 @@
<table>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="nameField" name="nameField" maxlength="30" style="width:30em" class="{validate:{required:true,rangelength:[4,35]}}"></td>
+ <td><input type="text" id="name" name="name" style="width:30em" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
</tr>
@@ -40,6 +44,4 @@
<input type="button" value="$i18n.getString( "cancel" )" onclick="window.location.href='program.action'" style="width:10em">
</p>
-</form>
-
-<span id="message"></span>
+</form>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2010-09-25 10:03:31 +0000
@@ -55,88 +55,6 @@
}
// -----------------------------------------------------------------------------
-// Add Program
-// -----------------------------------------------------------------------------
-
-function validateAddProgram()
-{
-
- var url = 'validateProgram.action?' +
- 'nameField=' + getFieldValue( 'nameField' ) +
- '&description=' + getFieldValue( 'description' );
-
-
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( addValidationCompleted );
- request.send( url );
-
- return false;
-}
-
-function addValidationCompleted( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == 'success' )
- {
- var form = document.getElementById( 'addProgramForm' );
- form.submit();
- }
- else if ( type == 'error' )
- {
- window.alert( i18n_adding_program_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- document.getElementById( 'message' ).innerHTML = message;
- document.getElementById( 'message' ).style.display = 'block';
- }
-}
-// -----------------------------------------------------------------------------
-// Update Program
-// -----------------------------------------------------------------------------
-
-function validateUpdateProgram()
-{
-
- var url = 'validateProgram.action?' +
- 'id=' + getFieldValue( 'id' ) +
- '&nameField=' + getFieldValue( 'nameField' ) +
- '&description=' + getFieldValue( 'description' );
-
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( updateValidationCompleted );
-
- request.send( url );
-
- return false;
-}
-
-function updateValidationCompleted( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == 'success' )
- {
- var form = document.getElementById( 'updateProgramForm' );
- form.submit();
- }
- else if ( type == 'error' )
- {
- window.alert( i18n_saving_program_failed + ':' + '\n' + message );
- }
- else if ( type == 'input' )
- {
- document.getElementById( 'message' ).innerHTML = message;
- document.getElementById( 'message' ).style.display = 'block';
- }
-}
-
-// -----------------------------------------------------------------------------
// Criteria association
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2010-07-13 16:35:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2010-09-25 10:03:31 +0000
@@ -35,11 +35,11 @@
</td>
<td style="text-align:center" #alternate( $mark )>
- <a href="defineValidationCriteriaAssociationsForm.action?id=$program.id" title="$i18n.getString( "define_validation_criteria_associations" )"><img src="../images/assign_a.png" alt="$i18n.getString( "assign_criteria" )"></a>
+ <a href="defineValidationCriteriaAssociationsForm.action?id=$program.id" title="$i18n.getString( "validation_associations" )"><img src="../images/assign_a.png" alt="$i18n.getString( "validation_associations" )"></a>
</td>
<td style="text-align:center" #alternate( $mark )>
- <a href="defineValidationDEAssociationsForm.action?id=$program.id" title="$i18n.getString( "define_validation_associations" )"><img src="../images/assign_b.png" alt="$i18n.getString( "assign_criteria" )"></a>
+ <a href="defineValidationDEAssociationsForm.action?id=$program.id" title="$i18n.getString( "validationDE_associations" )"><img src="../images/assign_b.png" alt="$i18n.getString( "validationDE_associations" )"></a>
</td>
<td style="text-align:center" #alternate( $mark )>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2010-08-17 07:26:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/updateProgramForm.vm 2010-09-25 10:03:31 +0000
@@ -1,13 +1,18 @@
<script>
jQuery(document).ready( function(){
- validation( 'updateProgramForm', validateUpdateProgram );
+
+ validation( 'updateProgramForm', function( form ){
+ form.submit();
+ });
+
+ checkValueIsExist( "name", "validateProgram.action", {id:getFieldValue('id')});
+
});
</script>
<h3>$i18n.getString( "update_program" )</h3>
-
<form id="updateProgramForm" name="updateProgramForm" action="updateProgram.action" method="post" >
<div style="display:inline">
<input type="hidden" id="id" name="id" value="$program.id">
@@ -22,22 +27,22 @@
<tbody>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="nameField" name="nameField" value="$encoder.htmlEncode( $program.name )" style="width:30em" class="{validate:{required:true,rangelength:[2,35]}}"></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $program.name )" style="width:30em" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
</tr>
<tr>
<td><label>$i18n.getString( "description" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $program.description )" style="width:30em" class="{validate:{required:true,minlength:2}}"></td>
+ <td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $program.description )" style="width:30em" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
</tr>
<tr>
<td><label>$i18n.getString( "dateOfEnrollmentDescription" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="dateOfEnrollmentDescription" name="dateOfEnrollmentDescription" value="$encoder.htmlEncode( $program.dateOfEnrollmentDescription )" style="width:30em" class="{validate:{required:true,minlength:2}}"></td>
+ <td><input type="text" id="dateOfEnrollmentDescription" name="dateOfEnrollmentDescription" value="$!program.dateOfEnrollmentDescription" style="width:30em" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
</tr>
<tr>
<td><label>$i18n.getString( "dateOfIncidentDescription" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
- <td><input type="text" id="dateOfIncidentDescription" name="dateOfIncidentDescription" value="$encoder.htmlEncode( $program.dateOfIncidentDescription )" style="width:30em" class="{validate:{required:true,minlength:2}}"></td>
+ <td><input type="text" id="dateOfIncidentDescription" name="dateOfIncidentDescription" value="$!program.dateOfIncidentDescription" style="width:30em" class="{validate:{required:true,minlength:4}}"></td>
<td></td>
</tr>
<tr>