← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14355: Move template reminder message to separate screen and include in context menu.

 

------------------------------------------------------------
revno: 14355
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-03-24 16:02:13 +0700
message:
  Move template reminder message to separate screen and include in context menu.
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/GetProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/RemoveProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/ShowAddProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStage.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.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
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/ShowAddProgramStageFormAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,154 @@
+package org.hisp.dhis.trackedentity.action.programstage;
+
+/*
+ * Copyright (c) 2004-2014, 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 java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
+import org.hisp.dhis.relationship.RelationshipType;
+import org.hisp.dhis.relationship.RelationshipTypeService;
+import org.hisp.dhis.trackedentity.TrackedEntity;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.trackedentity.TrackedEntityAttributeService;
+import org.hisp.dhis.trackedentity.TrackedEntityService;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+import org.springframework.beans.factory.annotation.Autowired;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Abyot Asalefew Gizaw
+ * @version $Id$
+ */
+public class ShowAddProgramStageFormAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ProgramService programService;
+
+    public void setProgramService( ProgramService programService )
+    {
+        this.programService = programService;
+    }
+
+    private TrackedEntityAttributeService attributeService;
+
+    public void setAttributeService( TrackedEntityAttributeService attributeService )
+    {
+        this.attributeService = attributeService;
+    }
+
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+
+    private RelationshipTypeService relationshipTypeService;
+
+    public void setRelationshipTypeService( RelationshipTypeService relationshipTypeService )
+    {
+        this.relationshipTypeService = relationshipTypeService;
+    }
+
+    @Autowired
+    private TrackedEntityService trackedEntityService;
+
+    // -------------------------------------------------------------------------
+    // Output
+    // -------------------------------------------------------------------------
+
+    private Collection<TrackedEntityAttribute> availableAttributes;
+
+    public Collection<TrackedEntityAttribute> getAvailableAttributes()
+    {
+        return availableAttributes;
+    }
+
+    private List<UserGroup> userGroups;
+
+    public List<UserGroup> getUserGroups()
+    {
+        return userGroups;
+    }
+
+    private List<RelationshipType> relationshipTypes;
+
+    public List<RelationshipType> getRelationshipTypes()
+    {
+        return relationshipTypes;
+    }
+
+    private List<Program> programs;
+
+    public List<Program> getPrograms()
+    {
+        return programs;
+    }
+
+    private List<TrackedEntity> trackedEntities;
+
+    public List<TrackedEntity> getTrackedEntities()
+    {
+        return trackedEntities;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+    {
+        programs = new ArrayList<Program>( programService.getAllPrograms() );
+        programs.removeAll( programService.getPrograms( Program.SINGLE_EVENT_WITHOUT_REGISTRATION ) );
+        Collections.sort( programs, IdentifiableObjectNameComparator.INSTANCE );
+
+        availableAttributes = attributeService.getAllTrackedEntityAttributes();
+
+        userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+
+        relationshipTypes = new ArrayList<RelationshipType>( relationshipTypeService.getAllRelationshipTypes() );
+        Collections.sort( relationshipTypes, IdentifiableObjectNameComparator.INSTANCE );
+
+        trackedEntities = new ArrayList<TrackedEntity>(trackedEntityService.getAllTrackedEntity());
+        Collections.sort( trackedEntities, IdentifiableObjectNameComparator.INSTANCE );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java	2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramReminderAction.java	2014-03-24 09:02:13 +0000
@@ -143,8 +143,7 @@
     {
         Program program = programService.getProgram( programId );
 
-        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( "", daysAllowedSendMessage, templateMessage );
-        reminder.setName( name );
+        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( name, daysAllowedSendMessage, templateMessage );
         reminder.setDateToCompare( datesToCompare );
         reminder.setSendTo( sendTo );
         reminder.setWhenToSend( whenToSend );

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/AddProgramStageReminderAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,168 @@
+package org.hisp.dhis.trackedentity.action.trackedentityinstancereminder;
+
+/*
+ * Copyright (c) 2004-2014, 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.ProgramStage;
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ AddProgramStageReminderAction.java Jan 5, 2014 10:59:10 PM $
+ */
+public class AddProgramStageReminderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private int programStageId;
+
+    public void setProgramStageId( int programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    public int getProgramStageId()
+    {
+        return programStageId;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private Integer daysAllowedSendMessage;
+
+    public void setDaysAllowedSendMessage( Integer daysAllowedSendMessage )
+    {
+        this.daysAllowedSendMessage = daysAllowedSendMessage;
+    }
+
+    private String templateMessage;
+
+    public void setTemplateMessage( String templateMessage )
+    {
+        this.templateMessage = templateMessage;
+    }
+
+    private String datesToCompare;
+
+    public void setDatesToCompare( String datesToCompare )
+    {
+        this.datesToCompare = datesToCompare;
+    }
+
+    private Integer sendTo;
+
+    public void setSendTo( Integer sendTo )
+    {
+        this.sendTo = sendTo;
+    }
+
+    private Integer whenToSend;
+
+    public void setWhenToSend( Integer whenToSend )
+    {
+        this.whenToSend = whenToSend;
+    }
+
+    private Integer messageType;
+
+    public void setMessageType( Integer messageType )
+    {
+        this.messageType = messageType;
+    }
+
+    private Integer userGroup;
+
+    public void setUserGroup( Integer userGroup )
+    {
+        this.userGroup = userGroup;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+        TrackedEntityInstanceReminder reminder = new TrackedEntityInstanceReminder( name, daysAllowedSendMessage,
+            templateMessage );
+        reminder.setDateToCompare( datesToCompare );
+        reminder.setSendTo( sendTo );
+        reminder.setWhenToSend( whenToSend );
+        reminder.setMessageType( messageType );
+
+        if ( reminder.getSendTo() == TrackedEntityInstanceReminder.SEND_TO_USER_GROUP )
+        {
+            UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup );
+            reminder.setUserGroup( selectedUserGroup );
+        }
+        else
+        {
+            reminder.setUserGroup( null );
+        }
+
+        programStage.getReminders().add( reminder );
+        programStageService.updateProgramStage( programStage );
+
+        return SUCCESS;
+    }
+}
\ No newline at end of file

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/GetProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/GetProgramStageReminderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/GetProgramStageReminderAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,141 @@
+package org.hisp.dhis.trackedentity.action.trackedentityinstancereminder;
+
+/*
+ * Copyright (c) 2004-2014, 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 java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.program.ProgramStage;
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ GetProgramStageReminderAction.java Jan 6, 2014 9:32:56 AM $
+ */
+public class GetProgramStageReminderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private TrackedEntityInstanceReminderService reminderService;
+
+    public void setReminderService( TrackedEntityInstanceReminderService reminderService )
+    {
+        this.reminderService = reminderService;
+    }
+
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private int programStageId;
+
+    public void setProgramStageId( int programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    private ProgramStage programStage;
+
+    public ProgramStage getProgramStage()
+    {
+        return programStage;
+    }
+
+    private TrackedEntityInstanceReminder reminder;
+
+    public TrackedEntityInstanceReminder getReminder()
+    {
+        return reminder;
+    }
+
+    private List<UserGroup> userGroups;
+
+    public List<UserGroup> getUserGroups()
+    {
+        return userGroups;
+    }
+
+    public List<TrackedEntityAttribute> attributes;
+
+    public List<TrackedEntityAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        reminder = reminderService.getReminder( id );
+
+        programStage = programStageService.getProgramStage( programStageId );
+
+        userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+
+        attributes = new ArrayList<TrackedEntityAttribute>( programStage.getProgram().getTrackedEntityAttributes() );
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/RemoveProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/RemoveProgramStageReminderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/RemoveProgramStageReminderAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,104 @@
+package org.hisp.dhis.trackedentity.action.trackedentityinstancereminder;
+
+/*
+ * Copyright (c) 2004-2014, 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.ProgramStage;
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ RemoveProgramReminderAction.java Jan 6, 2014 9:20:31 AM $
+ */
+public class RemoveProgramStageReminderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private TrackedEntityInstanceReminderService reminderService;
+
+    public void setReminderService( TrackedEntityInstanceReminderService reminderService )
+    {
+        this.reminderService = reminderService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input && Output
+    // -------------------------------------------------------------------------
+
+    private int programStageId;
+
+    public void setProgramStageId( int programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    private int reminderId;
+
+    public void setReminderId( int reminderId )
+    {
+        this.reminderId = reminderId;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    @Override
+    public String execute()
+        throws Exception
+    {
+        ProgramStage programStage = programStageService.getProgramStage( programStageId );
+        TrackedEntityInstanceReminder reminder = reminderService.getReminder( reminderId );
+
+        programStage.getReminders().remove( reminder );
+        programStageService.updateProgramStage( programStage );
+
+        return SUCCESS;
+    }
+
+    public static void main( String[] args )
+    {
+        Stage
+    }
+
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/ShowAddProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/ShowAddProgramStageReminderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/ShowAddProgramStageReminderAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,111 @@
+package org.hisp.dhis.trackedentity.action.trackedentityinstancereminder;
+
+/*
+ * Copyright (c) 2004-2014, 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 java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.trackedentity.TrackedEntityAttribute;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ ShowAddProgramStageReminderAction.java Jan 6, 2014 7:51:48 PM
+ *          $
+ */
+public class ShowAddProgramStageReminderAction
+    implements Action
+{
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private org.hisp.dhis.program.ProgramStage programStage;
+
+    public org.hisp.dhis.program.ProgramStage getProgramStage()
+    {
+        return programStage;
+    }
+
+    private List<UserGroup> userGroups;
+
+    public List<UserGroup> getUserGroups()
+    {
+        return userGroups;
+    }
+
+    public List<TrackedEntityAttribute> attributes;
+
+    public List<TrackedEntityAttribute> getAttributes()
+    {
+        return attributes;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        programStage = programStageService.getProgramStage( id );
+
+        userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );
+
+        attributes = programStage.getProgram().getTrackedEntityAttributes();
+
+        return SUCCESS;
+    }
+}

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityinstancereminder/UpdateProgramStageReminderAction.java	2014-03-24 09:02:13 +0000
@@ -0,0 +1,184 @@
+package org.hisp.dhis.trackedentity.action.trackedentityinstancereminder;
+
+/*
+ * Copyright (c) 2004-2014, 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.ProgramStage;
+import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
+import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService;
+import org.hisp.dhis.user.UserGroup;
+import org.hisp.dhis.user.UserGroupService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * 
+ * @version $ UpdateProgramReminderAction.java Jan 5, 2014 11:05:21 PM $
+ */
+public class UpdateProgramStageReminderAction
+    implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependency
+    // -------------------------------------------------------------------------
+
+    private ProgramStageService programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
+    }
+
+    private TrackedEntityInstanceReminderService reminderService;
+
+    public void setReminderService( TrackedEntityInstanceReminderService reminderService )
+    {
+        this.reminderService = reminderService;
+    }
+
+    private UserGroupService userGroupService;
+
+    public void setUserGroupService( UserGroupService userGroupService )
+    {
+        this.userGroupService = userGroupService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private int programStageId;
+
+    public void setProgramStageId( int programStageId )
+    {
+        this.programStageId = programStageId;
+    }
+
+    public int getProgramStageId()
+    {
+        return programStageId;
+    }
+
+    private String name;
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    private Integer daysAllowedSendMessage;
+
+    public void setDaysAllowedSendMessage( Integer daysAllowedSendMessage )
+    {
+        this.daysAllowedSendMessage = daysAllowedSendMessage;
+    }
+
+    private String templateMessage;
+
+    public void setTemplateMessage( String templateMessage )
+    {
+        this.templateMessage = templateMessage;
+    }
+
+    private String datesToCompare;
+
+    public void setDatesToCompare( String datesToCompare )
+    {
+        this.datesToCompare = datesToCompare;
+    }
+
+    private Integer sendTo;
+
+    public void setSendTo( Integer sendTo )
+    {
+        this.sendTo = sendTo;
+    }
+
+    private Integer whenToSend;
+
+    public void setWhenToSend( Integer whenToSend )
+    {
+        this.whenToSend = whenToSend;
+    }
+
+    private Integer messageType;
+
+    public void setMessageType( Integer messageType )
+    {
+        this.messageType = messageType;
+    }
+
+    private Integer userGroup;
+
+    public void setUserGroup( Integer userGroup )
+    {
+        this.userGroup = userGroup;
+    }
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute()
+        throws Exception
+    {
+        ProgramStage programStage = programStageService.getProgramStage( programStageId );
+
+        TrackedEntityInstanceReminder reminder = reminderService.getReminder( id );
+        reminder.setName( name );
+        reminder.setDaysAllowedSendMessage( daysAllowedSendMessage );
+        reminder.setTemplateMessage( templateMessage );
+        reminder.setDateToCompare( datesToCompare );
+        reminder.setSendTo( sendTo );
+        reminder.setWhenToSend( whenToSend );
+        reminder.setMessageType( messageType );
+
+        if ( reminder.getSendTo() == TrackedEntityInstanceReminder.SEND_TO_USER_GROUP )
+        {
+            UserGroup selectedUserGroup = userGroupService.getUserGroup( userGroup );
+            reminder.setUserGroup( selectedUserGroup );
+        }
+        else
+        {
+            reminder.setUserGroup( null );
+        }
+
+        programStageService.updateProgramStage( programStage );
+
+        return SUCCESS;
+    }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2014-03-19 06:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml	2014-03-24 09:02:13 +0000
@@ -125,7 +125,7 @@
 		scope="prototype">
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowUpdateAttributeAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowUpdateAttributeAction"
@@ -135,7 +135,7 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="periodService" ref="org.hisp.dhis.period.PeriodService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowAttributeVisitScheduleFormAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowAttributeVisitScheduleFormAction"
@@ -151,7 +151,7 @@
 		<property name="attributeService"
 			ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeService" />
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowAttributeInListNoProgramAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowAttributeInListNoProgramAction"
@@ -171,7 +171,8 @@
 	<!-- Program -->
 
 	<bean id="org.hisp.dhis.trackedentity.action.program.AddProgramAction"
-		class="org.hisp.dhis.trackedentity.action.program.AddProgramAction" scope="prototype">
+		class="org.hisp.dhis.trackedentity.action.program.AddProgramAction"
+		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
 		<property name="programInstanceService" ref="org.hisp.dhis.program.ProgramInstanceService" />
@@ -196,7 +197,8 @@
 	</bean>
 
 	<bean id="org.hisp.dhis.trackedentity.action.program.GetProgramAction"
-		class="org.hisp.dhis.trackedentity.action.program.GetProgramAction" scope="prototype">
+		class="org.hisp.dhis.trackedentity.action.program.GetProgramAction"
+		scope="prototype">
 		<property name="organisationUnitGroupService"
 			ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
@@ -211,7 +213,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.trackedentity.action.program.ShowAddProgramFormAction"
+	<bean
+		id="org.hisp.dhis.trackedentity.action.program.ShowAddProgramFormAction"
 		class="org.hisp.dhis.trackedentity.action.program.ShowAddProgramFormAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
@@ -244,7 +247,8 @@
 			ref="org.hisp.dhis.relationship.RelationshipTypeService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.trackedentity.action.program.ValidateProgramAction"
+	<bean
+		id="org.hisp.dhis.trackedentity.action.program.ValidateProgramAction"
 		class="org.hisp.dhis.trackedentity.action.program.ValidateProgramAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
@@ -281,7 +285,8 @@
 
 	<!-- ProgramStage -->
 
-	<bean id="org.hisp.dhis.trackedentity.action.programstage.AddProgramStageAction"
+	<bean
+		id="org.hisp.dhis.trackedentity.action.programstage.AddProgramStageAction"
 		class="org.hisp.dhis.trackedentity.action.programstage.AddProgramStageAction"
 		scope="prototype">
 		<property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
@@ -299,7 +304,8 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 	</bean>
 
-	<bean id="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageAction"
+	<bean
+		id="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageAction"
 		class="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageAction"
 		scope="prototype">
 		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
@@ -377,7 +383,8 @@
 		class="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageSectionAction"
 		scope="prototype">
 		<property name="programStageService" ref="org.hisp.dhis.program.ProgramStageService" />
-		<property name="programStageSectionService" ref="org.hisp.dhis.program.ProgramStageSectionService" />
+		<property name="programStageSectionService"
+			ref="org.hisp.dhis.program.ProgramStageSectionService" />
 	</bean>
 
 	<bean
@@ -659,7 +666,7 @@
 		<property name="attributeGroupService"
 			ref="org.hisp.dhis.trackedentity.TrackedEntityAttributeGroupService" />
 	</bean>
-	
+
 	<!-- Case Aggregation Mapping -->
 
 	<bean
@@ -955,7 +962,8 @@
 
 	<!-- Scheduling -->
 
-	<bean id="org.hisp.dhis.trackedentity.action.schedule.GetScheduleParamsAction"
+	<bean
+		id="org.hisp.dhis.trackedentity.action.schedule.GetScheduleParamsAction"
 		class="org.hisp.dhis.trackedentity.action.schedule.GetScheduleParamsAction"
 		scope="prototype">
 		<property name="systemSettingManager" ref="org.hisp.dhis.setting.SystemSettingManager" />
@@ -1082,7 +1090,8 @@
 		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.UpdateProgramReminderAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="reminderService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
 		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
 
@@ -1091,7 +1100,8 @@
 		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.RemoveProgramReminderAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="reminderService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
 	</bean>
 
 	<bean
@@ -1099,7 +1109,8 @@
 		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.GetInstanceReminderAction"
 		scope="prototype">
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
-		<property name="reminderService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
 		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
 
@@ -1107,7 +1118,8 @@
 		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ValidateProgramReminderAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ValidateProgramReminderAction"
 		scope="prototype">
-		<property name="reminderService" ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
 	</bean>
 
 	<bean
@@ -1117,43 +1129,95 @@
 		<property name="programService" ref="org.hisp.dhis.program.ProgramService" />
 		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
 	</bean>
-	
+
+	<!-- ProgramStage reminder -->
+
+	<bean
+		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.AddProgramStageReminderAction"
+		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.AddProgramStageReminderAction"
+		scope="prototype">
+		<property name="programStageService"
+			ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.UpdateProgramStageReminderAction"
+		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.UpdateProgramStageReminderAction"
+		scope="prototype">
+		<property name="programStageService"
+			ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.RemoveProgramStageReminderAction"
+		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.RemoveProgramStageReminderAction"
+		scope="prototype">
+		<property name="programStageService"
+			ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.GetProgramStageReminderAction"
+		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.GetProgramStageReminderAction"
+		scope="prototype">
+		<property name="programStageService"
+			ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="reminderService"
+			ref="org.hisp.dhis.trackedentity.TrackedEntityInstanceReminderService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+	</bean>
+
+	<bean
+		id="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ShowAddProgramStageReminderAction"
+		class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ShowAddProgramStageReminderAction"
+		scope="prototype">
+		<property name="programStageService"
+			ref="org.hisp.dhis.program.ProgramStageService" />
+		<property name="userGroupService" ref="org.hisp.dhis.user.UserGroupService" />
+	</bean>
+
 	<!-- TrackedEntity -->
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.AddTrackedEntityAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.AddTrackedEntityAction"
 		scope="prototype">
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.GetTrackedEntityAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.GetTrackedEntityAction"
 		scope="prototype">
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.GetTrackedEntityListAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.GetTrackedEntityListAction"
 		scope="prototype">
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.RemoveTrackedEntityAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.RemoveTrackedEntityAction"
 		scope="prototype">
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.UpdateTrackedEntityAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.UpdateTrackedEntityAction"
 		scope="prototype">
 	</bean>
-	
+
 	<bean
 		id="org.hisp.dhis.trackedentity.action.trackedentity.ValidateTrackedEntityAction"
 		class="org.hisp.dhis.trackedentity.action.trackedentity.ValidateTrackedEntityAction"
 		scope="prototype">
 	</bean>
-	
+
 </beans>
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml	2014-03-19 06:44:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml	2014-03-24 09:02:13 +0000
@@ -193,7 +193,7 @@
 			<result name="success" type="redirect">index.action</result>
 			<param name="requiredAuthorities">F_TRACKED_ENTITY_ATTRIBUTE_ADD</param>
 		</action>
-		
+
 		<action name="attributeInListNoProgram"
 			class="org.hisp.dhis.trackedentity.action.trackedentityattribute.ShowAttributeInListNoProgramAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -210,7 +210,7 @@
 			<result name="success" type="redirect">index.action</result>
 			<param name="requiredAuthorities">F_TRACKED_ENTITY_ATTRIBUTE_ADD</param>
 		</action>
-		
+
 		<!-- Program -->
 
 		<action name="program"
@@ -712,7 +712,7 @@
 			<result name="success" type="redirect">attributeGroup.action
 			</result>
 		</action>
-		
+
 		<!-- Case Aggregation Condition -->
 
 		<action name="caseAggregation"
@@ -1093,7 +1093,7 @@
 			</result>
 		</action>
 
-		<!-- Tracked entity instance reminder -->
+		<!-- Program reminder -->
 
 		<action name="programReminder"
 			class="org.hisp.dhis.trackedentity.action.program.GetProgramAction">
@@ -1150,18 +1150,75 @@
 			<param name="onExceptionReturn">plainTextError</param>
 		</action>
 
-		<action name="validateProgramReminder"
+		<action name="validateReminder"
 			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ValidateProgramReminderAction">
-			<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>
-		</action>
-		
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm
+			</result>
+		</action>
+
+		<!-- Program Stage reminder -->
+
+		<action name="programStageReminder"
+			class="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-program/programStageReminder.vm</param>
+			<param name="menu">/dhis-web-maintenance-program/menu.vm</param>
+			<param name="javascripts">javascript/programStageReminder.js</param>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="showAddProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.ShowAddProgramStageReminderAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-program/addProgramStageReminder.vm</param>
+			<param name="javascripts">javascript/commons.js,javascript/programStageReminder.js</param>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="addProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.AddProgramStageReminderAction">
+			<result name="success" type="redirect">programStageReminder.action?id=${programStageId}
+			</result>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="showUpdateProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.GetProgramStageReminderAction">
+			<result name="success" type="velocity">/main.vm</result>
+			<param name="page">/dhis-web-maintenance-program/updateProgramStageReminder.vm</param>
+			<param name="javascripts">javascript/commons.js,javascript/programStageReminder.js</param>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="updateProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.UpdateProgramStageReminderAction">
+			<result name="success" type="redirect">programStageReminder.action?id=${programStageId}
+			</result>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="removeProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.RemoveProgramStageReminderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonResponseSuccess.vm
+			</result>
+			<param name="requiredAuthorities">F_TRACKED_ENTITY_INSTANCE_REMINDER_MANAGEMENT</param>
+		</action>
+
+		<action name="getProgramStageReminder"
+			class="org.hisp.dhis.trackedentity.action.trackedentityinstancereminder.GetProgramStageReminderAction">
+			<result name="success" type="velocity-json">
+				/dhis-web-commons/ajax/jsonTrackedEntityInstanceReminder.vm
+			</result>
+			<param name="onExceptionReturn">plainTextError</param>
+		</action>
+
 		<!-- TrackedEntity -->
-	
+
 		<action name="trackedEntity"
 			class="org.hisp.dhis.trackedentity.action.trackedentity.GetTrackedEntityListAction">
 			<result name="success" type="velocity">/main.vm</result>
@@ -1171,8 +1228,7 @@
 			<param name="requiredAuthorities">F_TRACKED_ENTITY_MANAGEMENT</param>
 		</action>
 
-		<action name="showAddTrackedEntityForm"
-			class="org.hisp.dhis.trackedentity.action.NoAction">
+		<action name="showAddTrackedEntityForm" class="org.hisp.dhis.trackedentity.action.NoAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-program/addTrackedEntity.vm</param>
 			<param name="javascripts">javascript/trackedEntity.js</param>
@@ -1226,6 +1282,6 @@
 				/dhis-web-commons/ajax/jsonResponseError.vm
 			</result>
 		</action>
-		
+
 	</package>
 </struts>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm	2014-02-26 15:09:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm	2014-03-24 09:02:13 +0000
@@ -8,7 +8,7 @@
 		}, function(){
 			enable('messageType');
 		});
-		checkValueIsExist( "name", "validateProgramReminder.action" );
+		checkValueIsExist( "name", "validateReminder.action" );
 	});
 
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageForm.vm	2014-03-24 09:02:13 +0000
@@ -14,12 +14,6 @@
 <form id="addProgramStageForm" name="addProgramStageForm" action="addProgramStage.action" method="get" class="inputForm">
 	<input type="hidden" id="programId" name="programId" value="$program.id"/>
 	<input type='hidden' id="id" name="id" value="$program.id"/>
-	<select id='daysAllowedSendMessages' name="daysAllowedSendMessages" multiple="multiple" class="hidden"></select>
-	<select id='templateMessages' name="templateMessages" multiple="multiple" class="hidden"></select>
-	<select id='sendTo' name="sendTo" multiple="multiple" class="hidden"></select>
-	<select id='whenToSend' name="whenToSend" multiple="multiple" class="hidden"></select>
-	<select id='messageType' name="messageType" multiple="multiple" class="hidden"></select>
-	<select id='userGroup' name="userGroup" multiple="multiple" class="hidden"></select>
 <table>
 	<thead>
 		<tr><th colspan="2">$i18n.getString( "program_stage_details" )</th></tr>
@@ -212,20 +206,6 @@
         </td>  
 		</tr>
     </tbody>
-	<tr>
-		<th colspan='3'>$i18n.getString("template_reminder_message")</th>
-	</tr>
-</table>
-
-<table>
-	<tbody id='programStageMessage'>
-	</tbody>
-	<tr>
-		<td></td>
-		<td>
-			<input type="button" value="$i18n.getString('add_more')" onclick='generateTemplateMessageForm();'>
-		</td>
-	</tr>
 </table>
 
 <p>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramStageReminder.vm	2014-03-24 09:02:13 +0000
@@ -0,0 +1,160 @@
+<script>
+	jQuery( document ).ready( function()
+	{
+		showHideUserGroup();
+		
+		validation( 'addReminderForm', function( form ){
+			form.submit();
+		}, function(){
+			enable('messageType');
+		});
+		checkValueIsExist( "name", "validateReminder.action" );
+	});
+
+</script>
+
+<h3>$i18n.getString( "create_new_template_reminder_message" )</h3>
+<h5>$programStage.displayName</h5>
+
+<form id="addReminderForm" name="addReminderForm" action="addProgramStageReminder.action" method="post" onsubmit="selectAllById('selectedPropertyIds');" class="inputForm">
+  
+  <input type="hidden" id="programStageId" name="programStageId" value="$programStage.id">
+  <table>
+    <thead>
+      <tr>
+        <th colspan="2" style="width: 590px;">$i18n.getString( "template_reminder_message_details" )</th>
+      </tr>
+    </thead>
+    <tbody>
+		<tr>
+			<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input style="width: 330px;" type="text" id="name" name="name" class="{validate:{required:true,minlength:4}}"></td>
+			<td></td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "send_base_on" )</label></td>
+			<td>
+				<select type="text" id="whenToSend" name="whenToSend" onchange='whenToSendOnChange()'>
+					<option value="" >$i18n.getString("days_scheduled")</option>
+					<option value="2" >$i18n.getString("complete_event")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "send_message" )</label></td>
+			<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" 
+				class="{validate:{required:true,number:true}}"
+				onkeyup='setRealDays();' style="width:100px;"
+				realvalue="$!reminder.daysAllowedSendMessage" />
+				$i18n.getString('days')
+				<select id='time' name='time' onchange='setRealDays();' style="width:100px;">
+					<option value='1' >$i18n.getString('before')</option>
+					<option value='-1' >$i18n.getString('after')</option>
+				</select>
+				$i18n.getString('scheduled_date')
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "recipients" )</label></td>
+			<td>
+				<select type="text" id="sendTo" name="sendTo" class="{validate:{required:true,number:true}}" onchange="onchangeUserGroup(  )">
+					<option value="1" >$i18n.getString("tracked_entity_sms_only")</option>
+					<option value="3" >$i18n.getString("orgunit_phone_number_sms_only")</option>
+					<option value="2" >$i18n.getString("attribute_users")</option>
+					<option value="4" >$i18n.getString("all_users_in_orgunit_registered")</option>
+					<option value="5" >$i18n.getString("user_group")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "user_group" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td>
+				<select type="text" id="userGroup" name="userGroup" disabled class="{validate:{required:true}}">
+					<option value="">[$i18n.getString("please_select")]</option>
+					#foreach($eachGroup in $userGroups)
+						<option value="$eachGroup.id">$i18n.getString($eachGroup.name)</option>
+					#end	
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "message_type" )</label></td>
+			<td>
+				<select type="text" id="messageType" name="messageType" disabled class="messageType {validate:{required:true,number:true}}" >
+					<option value="1">$i18n.getString("direct_sms")</option>
+					<option value="2">$i18n.getString("message")</option>
+					<option value="3">$i18n.getString("both")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td>$i18n.getString( "params" )</td>
+			<td>
+				<select multiple size='4' ondblclick="insertParams(this.value);">
+					<option value="{program-name}">$i18n.getString("program_name")</option>
+					<option value="{program-stage-name}">$i18n.getString("program_stage_name")</option>
+					<option value="{due-date}">$i18n.getString("due_date")</option>'
+					<option value="{days-since-due-date}">$i18n.getString("days_since_due_date")</option>'
+					<option value="{orgunit-name}">$i18n.getString("orgunit_name")</option>
+					#foreach($attribute in $attributes)
+						<option value={attributeid=$attribute.uid}>$attribute.displayName</option>
+					#end
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "message" )</label></td>
+			<td><textarea onkeyup="getMessageLength()" id="templateMessage" name="templateMessage" style="width:320px" class="templateMessage {validate:{required:true}}"></textarea></td>
+		</tr>
+		<tr>
+			<td></td>
+			<td id='messageLengthTD'></td>
+			<script></script>
+		</tr>
+	
+	<tbody>
+	 <tr>
+		<td></td>
+      	<td>
+			<input type="submit" value="$i18n.getString( 'add' )" style="width:10em" >
+			<input type="button" value="$i18n.getString( 'cancel' )" style="width:10em" onclick="window.location.href='programStageReminder.action?id=$programStage.id'">
+		</td>
+      </tr>
+  </table>
+</form>
+	
+<script>
+	var i18n_reminder = '$encoder.jsEscape( $i18n.getString( "reminder" ) , "'")';   
+	var i18n_remove_reminder = '$encoder.jsEscape( $i18n.getString( "remove_reminder" ) , "'")';   
+	var i18n_days_before_after_comparison_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_comparison_date" ) , "'")';   
+	var i18n_params = '$encoder.jsEscape( $i18n.getString( "params" ) , "'")';   
+	var i18n_program_name = '$encoder.jsEscape( $i18n.getString( "program_name" ) , "'")';   
+	var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'")';   
+	var i18n_days_since_incident_date = '$encoder.jsEscape( $i18n.getString( "days_since_incident_date" ) , "'")';   
+	var i18n_orgunit_name = '$encoder.jsEscape( $i18n.getString( "orgunit_name" ) , "'")';   
+	var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
+	var i18n_days_since_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_since_enrollment_date" ) , "'")';   
+	var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
+	var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")'; 
+	var i18n_recipients = '$encoder.jsEscape( $i18n.getString( "recipients" ) , "'")'; 
+	var i18n_tracked_entity_sms_only = '$encoder.jsEscape( $i18n.getString( "tracked_entity_sms_only" ) , "'")'; 
+	var i18n_attribute_users = '$encoder.jsEscape( $i18n.getString( "attribute_users" ) , "'")'; 
+	var i18n_orgunit_phone_number_sms_only = '$encoder.jsEscape( $i18n.getString( "orgunit_phone_number_sms_only" ) , "'")'; 
+	var i18n_all_users_at_orgunit = '$encoder.jsEscape( $i18n.getString( "all_users_at_orgunit" ) , "'")'; 
+	var i18n_send_when_to = '$encoder.jsEscape( $i18n.getString( "send_base_on" ) , "'")';
+	var i18n_days_scheduled = '$encoder.jsEscape( $i18n.getString( "days_scheduled" ) , "'")';
+	var i18n_complete_program = '$encoder.jsEscape( $i18n.getString( "complete_program" ) , "'")';
+	var i18n_program_enrollment = '$encoder.jsEscape( $i18n.getString( "program_enrollment" ) , "'")';
+	var i18n_user_group = '$encoder.jsEscape( $i18n.getString( "user_group" ) , "'")';
+	var i18n_characters_without_params = '$encoder.jsEscape( $i18n.getString( "characters_without_params" ) , "'")';
+	var i18n_days = '$encoder.jsEscape( $i18n.getString( "days" ) , "'")';
+	var i18n_before = '$encoder.jsEscape( $i18n.getString( "before" ) , "'")';
+	var i18n_after = '$encoder.jsEscape( $i18n.getString( "after" ) , "'")';
+	var i18n_scheduled_date = '$encoder.jsEscape( $i18n.getString( "scheduled_date" ) , "'")';
+	var i18n_message_type = '$encoder.jsEscape( $i18n.getString( "message_type" ) , "'")';
+	var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")';
+	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
+    var i18n_send_message = '$encoder.jsEscape( $i18n.getString( "send_message" ) , "'")';
+	var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")';
+</script>
+

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStage.js	2014-03-24 05:48:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStage.js	2014-03-24 09:02:13 +0000
@@ -5,6 +5,10 @@
   });
 });
 
+function programStageReminder(context){
+	 location.href = 'programStageReminder.action?id=' + context.id;
+}
+
 function removeProgramStage( context ) {
   removeItem( context.id, context.name, i18n_confirm_delete , 'removeProgramStage.action' );
 }
@@ -117,17 +121,6 @@
 		
 		setInnerHTML( 'reportDateToUseField', json.programStage.reportDateToUse );   	
 		
-		var templateMessage = "";
-		for(var i in json.programStage.reminders){
-			var index = eval(i) + 1;
-			templateMessage += "<p class='bold'>" + i18n_template_reminder_message + " " + index + "</p>";
-			templateMessage += "<p class='bold'>" + i18n_send_message + ":</p>" ;
-			templateMessage	+= "<p>" + json.programStage.reminders[i].daysAllowedSendMessage + "</p>";
-			templateMessage	+= "<p class='bold'>" + i18n_message + ":</p>";
-			templateMessage	+= "<p>" + json.programStage.reminders[i].templateMessage + "</p>";
-		}
-		setInnerHTML('templateMessageField', templateMessage);
-		
 		showDetails();
 	});
 }
@@ -305,12 +298,6 @@
 	}
 }
 
-function insertParams( paramValue, rowId )
-{
-	var templateMessage = paramValue;
-	insertTextCommon('templateMessage' + rowId, templateMessage);
-}
-
 // --------------------------------------------------------------------
 // Generate template message form
 // --------------------------------------------------------------------

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js	2014-03-24 09:02:13 +0000
@@ -0,0 +1,170 @@
+$(function() {
+  dhis2.contextmenu.makeContextMenu({
+    menuId: 'contextMenu',
+    menuItemActiveClass: 'contextMenuItemActive'
+  });
+});
+
+function showUpdateProgramStageReminder( context ) {
+  location.href = 'showUpdateProgramStageReminder.action?programStageId=' + getFieldValue('programStageId') + "&id=" + context.id;
+}
+
+function removeProgramStageReminder( context ) {
+	var result = window.confirm( i18n_confirm_delete + "\n\n" + context.name );
+    
+    if ( result )
+    {
+    	setHeaderWaitMessage( i18n_deleting );
+    	
+    	$.postJSON("removeProgramStageReminder.action",
+    	    {
+    	        programStageId: getFieldValue('programStageId'),
+				reminderId: context.id		
+    	    },
+    	    function( json )
+    	    { 
+    	    	if ( json.response == "success" )
+    	    	{
+					jQuery( "tr#tr" + context.id ).remove();
+	                
+					jQuery( "table.listTable tbody tr" ).removeClass( "listRow listAlternateRow" );
+	                jQuery( "table.listTable tbody tr:odd" ).addClass( "listAlternateRow" );
+	                jQuery( "table.listTable tbody tr:even" ).addClass( "listRow" );
+					jQuery( "table.listTable tbody" ).trigger("update");
+  
+					setHeaderDelayMessage( i18n_delete_success );
+    	    	}
+    	    	else if ( json.response == "error" )
+    	    	{ 
+					setHeaderMessage( json.message );
+    	    	}
+    	    }
+    	);
+    }
+}
+
+function showReminderDetails( context ) {
+ 
+  jQuery.getJSON("getProgramStageReminder.action", {
+    id: context.id,
+	programStageId: getFieldValue('programStageId')
+  }, function( json ) {
+    setInnerHTML('nameField', json.reminder.name);
+    setInnerHTML('daysAllowedSendMessageField', json.reminder.daysAllowedSendMessage);
+    setInnerHTML('templateMessageField', json.reminder.templateMessage);
+    setInnerHTML('dateToCompareField', json.reminder.dateToCompare);
+	
+	var map = sendToMap();
+	setInnerHTML( 'sendToField', map[json.reminder.sendTo] ); 
+	
+	var whenToSend = i18n_days_scheduled;
+	if( json.reminder.whenToSend=='3'){
+		whenToSend = i18n_complete_programStage;
+	}
+	else if( json.reminder.whenToSend=='1'){
+		whenToSend = i18n_programStage_enrollment;
+	}
+	setInnerHTML('whenToSendField', whenToSend);
+    
+	var type = i18n_direct_sms;
+	if( json.reminder.messageType=='2'){
+		whenToSend = i18n_message;
+	}
+	else if( json.reminder.whenToSend=='3'){
+		whenToSend = i18n_both;
+	}
+    setInnerHTML('messageTypeField', json.reminder.messageType);
+	
+    setInnerHTML('userGroupField', json.reminder.userGroup);
+    showDetails();
+  });
+}
+
+function sendToMap()
+{
+	var typeMap = [];
+	typeMap['1'] = i18n_tracked_entity_sms_only;
+	typeMap['2'] = i18n_orgunit_phone_number_sms_only;
+	typeMap['3'] = i18n_attribute_users;
+	typeMap['4'] = i18n_all_users_in_orgunit_registered;
+	typeMap['5'] = i18n_user_group;
+	return typeMap;
+}
+
+function showHideUserGroup() {
+  jQuery(".sendTo").each(function( i, item ) {
+    var numb = i + 1;
+    if( item.value == 5 ) {
+      showById('tr' + numb);
+    }
+    else
+      hideById('tr' + numb);
+  });
+}
+
+function insertParams( paramValue ) {
+  var templateMessage = paramValue;
+  insertTextCommon('templateMessage', templateMessage);
+  getMessageLength();
+}
+
+function whenToSendOnChange(  ) {
+  var whenToSend = getFieldValue('whenToSend' );
+  if( whenToSend == "" ) {
+    enable('dateToCompare');
+    enable('daysAllowedSendMessage' );
+    enable('time');
+  }
+  else {
+    disable('dateToCompare');
+    disable('daysAllowedSendMessage');
+    disable('time');
+  }
+}
+
+function getMessageLength( ) {
+  var message = getFieldValue('templateMessage' );
+  var length = 0;
+  var idx = message.indexOf('{');
+  while( idx >= 0 ) {
+    length += message.substr(0, idx).length;
+    var end = message.indexOf('}');
+    if( end >= 0 ) {
+      message = message.substr(end + 1, message.length);
+      idx = message.indexOf('{');
+    }
+  }
+  length += message.length;
+  setInnerHTML('messageLengthTD' , length + " " + i18n_characters_without_params);
+  if( length >= 160 ) {
+    jQuery('#templateMessage').attr('maxlength', 160);
+  }
+  else {
+    jQuery('#templateMessage').removeAttr('maxlength');
+  }
+}
+
+function setRealDays( ) {
+  var daysAllowedSendMessage = jQuery("#daysAllowedSendMessage");
+  var time = jQuery("#time option:selected ").val();
+  daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
+}
+
+function onchangeUserGroup() {
+  var value = document.getElementById('sendTo').value;
+  
+  if( value == "1" || value == "3" ) {
+    setFieldValue('messageType', '1');
+    disable('messageType');
+  }
+  else {
+    enable('messageType');
+  }
+  
+  if( value == "5" ){
+	enable('userGroup');
+  }
+  else{
+	disable('userGroup');
+  }
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm	2014-03-24 09:02:13 +0000
@@ -31,10 +31,10 @@
 			</thead>
 			<tbody id="list">
           #foreach( $reminder in $program.reminders )
-            <tr id="tr${reminders.id}" 
-				data-id="$!reminders.id" 
-				data-type="reminders" 
-				data-name="$encoder.htmlEncode( $!reminders.name )">
+            <tr id="tr${reminder.id}" 
+				data-id="$!reminder.id" 
+				data-type="reminder" 
+				data-name="$encoder.htmlEncode( $!reminder.name )">
                 <td>$encoder.htmlEncode( $!reminders.name )</td>
             </tr>
           #end

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm	2014-03-24 05:48:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm	2014-03-24 09:02:13 +0000
@@ -4,6 +4,7 @@
 
 <div id="contextMenu" class="contextMenu">
   <ul id="contextMenuItems" class="contextMenuItems">
+    <li data-enabled="canManageTemplateMessage"><a data-target-fn="programStageReminder"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "view_template_reminder_message" )</a></li>
     <li><a data-target-fn="showUpdateProgramStageForm"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
     <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i>&nbsp;&nbsp;$i18n.getString( "translation_translate" )</a></li>
     <li data-enabled="canRemove"><a data-target-fn="removeProgramStage"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
@@ -43,6 +44,7 @@
 						    data-can-manage="$security.canManage( $association )"
 						    data-can-update="$security.canUpdate( $association )"
 						    data-can-delete="$security.canDelete( $association )"
+							data-can-manage-template-message="#if($association.program.type!=3)true#{else}false#end"
 						    data-can-remove="#if( $program.type=='1' )true#{else}false#end">
 						    <td>$encoder.htmlEncode( $!association.displayName )</td>
 						    <td>$encoder.htmlEncode( $!association.description )</td>
@@ -74,7 +76,6 @@
 				<p><label class="bold">$i18n.getString( "open_data_entry_form_after_enrolment" ):</label><br><span id="openAfterEnrollmentField"></span></p>
 				<p><label class="bold">$i18n.getString( "report_date_to_use" ):</label><br><span id="reportDateToUseField"></span></p>
 				<p><label class="bold">$i18n.getString( "no_of_dataelements" ):</label><br><span id="dataElementCountField"></span></p>		
-				<p><span id="templateMessageField"></span></p>
 			</div>
 		</td>
 	</tr>

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStageReminder.vm	2014-03-24 09:02:13 +0000
@@ -0,0 +1,88 @@
+
+<h3>$i18n.getString( "template_reminder_message" )</h3>
+<h5>$programStage.displayName</h5>
+
+<div id="contextMenu" class="contextMenu">
+  <ul id="contextMenuItems" class="contextMenuItems">
+    <li><a data-target-fn="showUpdateProgramStageReminder"><i class="fa fa-edit"></i>&nbsp;&nbsp;$i18n.getString( "edit" )</a></li>
+    <li><a data-target-fn="removeProgramStageReminder"><i class="fa fa-trash-o"></i>&nbsp;&nbsp;$i18n.getString( "remove" )</a></li>
+    <li><a data-target-fn="showReminderDetails"><i class="fa fa-info-circle"></i>&nbsp;&nbsp;$i18n.getString( "show_details" )</a></li>
+  </ul>
+</div>
+
+<table class="mainPageTable">
+  <input type="hidden" id="programStageId" name="programStageId" value="$programStage.id">
+  <tr>
+		<td align="right">
+			<input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddProgramStageReminder.action?id=$programStage.id'" style="width:70px"><br>
+    		<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='programStage.action?id=$programStage.program.id'" style="width:70px">
+		</td>
+  </tr>
+
+  <tr>
+    <td style="vertical-align:top">
+    	
+		<table class="listTable">
+			<col>
+			<thead>
+			  <tr>            
+				<th>$i18n.getString( "name" )</th>
+			  </tr>
+			</thead>
+			<tbody id="list">
+          #foreach( $reminder in $programStage.reminders )
+            <tr id="tr${reminder.id}" 
+				data-id="$!reminder.id" 
+				data-name="$encoder.htmlEncode( $!reminder.name )">
+                <td>$encoder.htmlEncode( $!reminder.name )</td>
+            </tr>
+          #end
+      </tbody>
+      </table>
+    </td>
+
+		<td id="detailsData">
+      <div id="detailsArea">
+        <div id="hideDetailsArea">
+          <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
+				</div>
+        <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+        <p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="daysAllowedSendMessageField"></span> $i18n.getString("days_before")</p>
+        <p><label class="bold">$i18n.getString( "message" ):</label><br><span id="templateMessageField"></span></p>
+        <p><label class="bold">$i18n.getString( "date_to_compare" ):</label><br><span id="dateToCompareField"></span></p>
+		<p><label class="bold">$i18n.getString( "recipients" ):</label><br><span id="sendToField"></span></p>
+		<p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="whenToSendField"></span></p>
+		<p><label class="bold">$i18n.getString( "message_type" ):</label><br><span id="messageTypeField"></span></p>
+		<p><label class="bold">$i18n.getString( "user_group" ):</label><br><span id="userGroupField"></span></p>
+		</div>
+
+		</td>
+  </tr>
+</table>
+
+<script type="text/javascript">
+	var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_template_reminder_message" ) , "'" )';
+	var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';	
+    var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+    var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+    var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+    var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
+    var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
+    var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
+    var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
+	var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
+	var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
+	var i18n_all = '$encoder.jsEscape( $i18n.getString( "all" ) , "'")';
+	var i18n_yes_only = '$encoder.jsEscape( $i18n.getString( "yes_only" ) , "'")';
+	var i18n_tracked_entity_sms_only = '$encoder.jsEscape( $i18n.getString( "tracked_entity_sms_only" ) , "'")';
+	var i18n_orgunit_phone_number_sms_only = '$encoder.jsEscape( $i18n.getString( "orgunit_phone_number_sms_only" ) , "'")';
+	var i18n_attribute_users = '$encoder.jsEscape( $i18n.getString( "attribute_users" ) , "'")';
+	var i18n_all_users_in_orgunit_registered = '$encoder.jsEscape( $i18n.getString( "all_users_in_orgunit_registered" ) , "'")';
+	var i18n_user_group = '$encoder.jsEscape( $i18n.getString( "user_group" ) , "'")';
+	var i18n_days_scheduled = '$encoder.jsEscape( $i18n.getString( "days_scheduled" ) , "'")';
+	var i18n_complete_programStage = '$encoder.jsEscape( $i18n.getString( "complete_programStage" ) , "'")';
+	var i18n_programStage_enrollment = '$encoder.jsEscape( $i18n.getString( "programStage_enrollment" ) , "'")';
+	var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")';
+	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
+	var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")';
+</script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm	2014-02-26 15:09:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm	2014-03-24 09:02:13 +0000
@@ -41,7 +41,7 @@
 		}, function(){
 			enable('messageType');
 		});
-		checkValueIsExist( "name", "validateProgramReminder.action",{id:getFieldValue('id')} );
+		checkValueIsExist( "name", "validateReminder.action",{id:getFieldValue('id')} );
 	});
 
 </script>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm	2014-02-07 20:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageForm.vm	2014-03-24 09:02:13 +0000
@@ -233,121 +233,8 @@
 		</tr>
 		</tbody>
 		
-		#if($programStage.program.type!=3)
-			<tr><th colspan='3'>$i18n.getString("template_reminder_message")</th></tr>
-		#end
 	</table>
 	
-	#if($programStage.program.type!=3)
-	<table>
-		<tbody id='programStageMessage'>
-			#set($index = 0)
-			#foreach($reminder in $programStage.reminders)
-				#set($index = $index + 1)
-				<tr name="tr$index" class="listAlternateRow" >
-					<td colspan='2'>
-						$i18n.getString( "reminder" ) $index
-						<span style="align:right"><a href='javascript:removeTemplateMessageForm($index)'> ( $i18n.getString("remove_reminder") )</a>
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td><label>$i18n.getString( "send_base_on" )</label></td>
-					<td>
-						<select type="text" id="whenToSend$index" name="whenToSend$index" class="whenToSend" onchange='whenToSendOnChange($index)' >
-							<option value="" >$i18n.getString("days_scheduled")</option>
-							<option value="2" #if($!reminder.whenToSend==2) selected #end >$i18n.getString("complete_event")</option>
-						</select>
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td><label>$i18n.getString( "send_message" )</label></td>
-					<td>
-						#set($value=$!reminder.daysAllowedSendMessage)
-						#set($time = '1')
-						#if($!value && $value<0)
-							#set($time = '-1')
-							#set($value=-1 * $value)
-						#end
-						<input type="text" id="daysAllowedSendMessage$index" name="daysAllowedSendMessage$index" 
-						class="daysAllowedSendMessage {validate:{required:true,number:true}}" value="$!value"
-						#if($!reminder.whenToSend==2) disabled #end onkeyup='setRealDays($index);' style="width:100px;"  />
-						$i18n.getString('days')
-						<select id='time$index' name='time$index' onchange='setRealDays($index);' style="width:100px;"
-							#if($!reminder.whenToSend==2) disabled #end >
-							<option value='1' #if($time=='1') selected #end >$i18n.getString('before')</option>
-							<option value='-1' #if($time=='-1') selected #end  >$i18n.getString('after')</option>
-						</select>
-						$i18n.getString('scheduled_date')
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td><label>$i18n.getString( "recipients" )</label></td>
-					<td>
-						<select type="text" id="sendTo$index" name="sendTo$index" class="sendTo {validate:{required:true,number:true}}" onchange="onchangeUserGroup( $index )">
-							<option value="1" #if($!reminder.sendTo==1) selected #end >$i18n.getString("tracked_entity_sms_only")</option>
-							<option value="3" #if($!reminder.sendTo==3) selected #end >$i18n.getString("orgunit_phone_number_sms_only")</option>
-							<option value="2" #if($!reminder.sendTo==2) selected #end >$i18n.getString("attribute_users")</option>
-							<option value="4" #if($!reminder.sendTo==4) selected #end >$i18n.getString("all_users_at_orgunit")</option>
-							<option value="5" #if($!reminder.sendTo==5) selected #end >$i18n.getString("user_group")</option>
-						</select>
-					</td>
-				</tr>
-				<tr name="tr$index" id="tr$index">
-					<td><label>$i18n.getString( "user_group" )</label></td>
-					<td>
-						<select type="text" id="userGroup$index" name="userGroup$index" class="userGroup">
-						#foreach($eachGroup in $userGroups)
-							<option value="$eachGroup.id" #if($!reminder.userGroup.id==$eachGroup.id) selected #end>$i18n.getString($eachGroup.name)</option>
-						#end	
-						</select>
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td><label>$i18n.getString( "message_type" )</label></td>
-					<td>
-						<select type="text" id="messageType$index" name="messageType$index" #if($!reminder.sendTo==1 || $!reminder.sendTo==3) disabled #end  class="messageType {validate:{required:true,number:true}}" >
-							<option value="1" #if($!reminder.messageType==1) selected #end >$i18n.getString("direct_sms")</option>
-							<option value="2" #if($!reminder.messageType==2) selected #end >$i18n.getString("message")</option>
-							<option value="3" #if($!reminder.messageType==3) selected #end >$i18n.getString("both")</option>
-						</select>
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td>$i18n.getString( "params" )</td>
-					<td>
-						<select multiple size='4' ondblclick="insertParams(this.value, $index);">
-							<option value="{program-name}">$i18n.getString("program_name")</option>
-							<option value="{program-stage-name}">$i18n.getString("program_stage_name")</option>
-							<option value="{due-date}">$i18n.getString("due_date")</option>
-							<option value="{days-since-due-date}">$i18n.getString("days_since_due_date")</option>
-							<option value="{orgunit-name}">$i18n.getString("orgunit_name")</option>
-							#foreach($programAttribute in $program.programAttributes)
-								<option value={attributeid=$programAttribute.attribute.uid}>$programAttribute.attribute.displayName</option>
-							#end
-						</select>
-					</td>
-				</tr>
-				<tr name="tr$index">
-					<td><label>$i18n.getString( "message" )</label></td>
-					<td><textarea id="templateMessage$index" onkeyup="getMessageLength($index)" name="templateMessage$index" style="width:320px" class="templateMessage {validate:{required:true}}">$reminder.templateMessage</textarea></td>
-				</tr>
-				<tr>
-					<td></td>
-					<td id='messageLengthTD$index'></td>
-					<script>getMessageLength($index)</script>
-				</tr>
-			#end
-		</tbody>
-		
-		<tr>
-			<td></td>
-			<td>
-				<input type="button" value="$i18n.getString('add_more')" onclick='generateTemplateMessageForm();'>
-			</td>
-		</tr>
-	</table>
-	#end
-		
 	<p>
 		<input type="submit" value="$i18n.getString( 'update' )" />
 		<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='programStage.action?id=$programStage.program.id'" />

=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramStageReminder.vm	2014-03-24 09:02:13 +0000
@@ -0,0 +1,163 @@
+<script>
+	var i18n_reminder = '$encoder.jsEscape( $i18n.getString( "reminder" ) , "'")';   
+	var i18n_remove_reminder = '$encoder.jsEscape( $i18n.getString( "remove_reminder" ) , "'")';   
+	var i18n_days_before_after_comparison_date = '$encoder.jsEscape( $i18n.getString( "days_before_after_comparison_date" ) , "'")';   
+	var i18n_params = '$encoder.jsEscape( $i18n.getString( "params" ) , "'")';   
+	var i18n_incident_date = '$encoder.jsEscape( $i18n.getString( "incident_date" ) , "'")';   
+	var i18n_days_since_incident_date = '$encoder.jsEscape( $i18n.getString( "days_since_incident_date" ) , "'")';   
+	var i18n_orgunit_name = '$encoder.jsEscape( $i18n.getString( "orgunit_name" ) , "'")';   
+	var i18n_enrollment_date = '$encoder.jsEscape( $i18n.getString( "enrollement_date" ) , "'")';   
+	var i18n_days_since_enrollment_date = '$encoder.jsEscape( $i18n.getString( "days_since_enrollment_date" ) , "'")';   
+	var i18n_name_exists = '$encoder.jsEscape( $i18n.getString( "name_exists" ) , "'")';
+	var i18n_date_to_compare = '$encoder.jsEscape( $i18n.getString( "date_to_compare" ) , "'")'; 
+	var i18n_recipients = '$encoder.jsEscape( $i18n.getString( "recipients" ) , "'")'; 
+	var i18n_tracked_entity_sms_only = '$encoder.jsEscape( $i18n.getString( "tracked_entity_sms_only" ) , "'")'; 
+	var i18n_attribute_users = '$encoder.jsEscape( $i18n.getString( "attribute_users" ) , "'")'; 
+	var i18n_orgunit_phone_number_sms_only = '$encoder.jsEscape( $i18n.getString( "orgunit_phone_number_sms_only" ) , "'")'; 
+	var i18n_all_users_at_orgunit = '$encoder.jsEscape( $i18n.getString( "all_users_at_orgunit" ) , "'")'; 
+	var i18n_send_when_to = '$encoder.jsEscape( $i18n.getString( "send_base_on" ) , "'")';
+	var i18n_days_scheduled = '$encoder.jsEscape( $i18n.getString( "days_scheduled" ) , "'")';
+	var i18n_complete_program = '$encoder.jsEscape( $i18n.getString( "complete_program" ) , "'")';
+	var i18n_program_enrollment = '$encoder.jsEscape( $i18n.getString( "program_enrollment" ) , "'")';
+	var i18n_user_group = '$encoder.jsEscape( $i18n.getString( "user_group" ) , "'")';
+	var i18n_characters_without_params = '$encoder.jsEscape( $i18n.getString( "characters_without_params" ) , "'")';
+	var i18n_days = '$encoder.jsEscape( $i18n.getString( "days" ) , "'")';
+	var i18n_before = '$encoder.jsEscape( $i18n.getString( "before" ) , "'")';
+	var i18n_after = '$encoder.jsEscape( $i18n.getString( "after" ) , "'")';
+	var i18n_scheduled_date = '$encoder.jsEscape( $i18n.getString( "scheduled_date" ) , "'")';
+	var i18n_message_type = '$encoder.jsEscape( $i18n.getString( "message_type" ) , "'")';
+	var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")';
+	var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
+    var i18n_send_message = '$encoder.jsEscape( $i18n.getString( "send_message" ) , "'")';
+	var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")';
+
+	jQuery( document ).ready( function()
+	{
+		showHideUserGroup();
+		
+		validation( 'updateReminderForm', function( form ){
+			form.submit();
+		});
+		checkValueIsExist( "name", "validateReminder.action",{id:getFieldValue('id')} );
+	});
+
+</script>
+
+<h3>$i18n.getString( "edit_template_reminder_message" )</h3>
+<h5>$programStage.displayName</h5>
+
+<form id="updateReminderForm" name="updateReminderForm" action="updateProgramStageReminder.action" method="get" onsubmit="selectAllById('selectedPropertyIds');" class="inputForm">
+
+  <input type="hidden" id="programStageId" name="programStageId" value="$programStage.id">
+  <input type="hidden" id="id" name="id" value="$reminder.id">
+  <table>
+    <thead>
+      <tr>
+        <th colspan="2" style="width: 590px;">$i18n.getString( "template_reminder_message_details" )</th>
+      </tr>
+    </thead>
+    <tbody>
+		<tr>
+			<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td><input style="width: 330px;" type="text" id="name" name="name" value="$encoder.htmlEncode( $reminder.name )" class="{validate:{required:true,minlength:4}}"></td>
+			<td></td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "send_base_on" )</label></td>
+			<td>
+				<select type="text" id="whenToSend" name="whenToSend" onchange='whenToSendOnChange()'>
+					<option value="" >$i18n.getString("days_scheduled")</option>
+					<option value="2" #if($!reminder.whenToSend==2) selected #end >$i18n.getString("complete_event")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			#set($value=$!reminder.daysAllowedSendMessage)
+			#set($time = '1')
+			#if($!value && $value<0)
+				#set($time = '-1')
+				#set($value=-1 * $value)
+			#end
+			<td><label>$i18n.getString( "send_message" )</label></td>
+			<td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage" 
+				class="{validate:{required:true,number:true}}" value="$!value"
+				onkeyup='setRealDays();' style="width:100px;"
+				#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end 
+				realvalue="$!reminder.daysAllowedSendMessage" />
+				$i18n.getString('days')
+				<select id='time' name='time' onchange='setRealDays();' style="width:100px;"
+					#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end  >
+					<option value='1' #if($time=='1') selected #end >$i18n.getString('before')</option>
+					<option value='-1' #if($time=='-1') selected #end  >$i18n.getString('after')</option>
+				</select>
+				$i18n.getString('scheduled_date')
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "recipients" )</label></td>
+			<td>
+				<select type="text" id="sendTo" name="sendTo" class="{validate:{required:true,number:true}}" onchange="onchangeUserGroup()">
+					<option value="1" #if($!reminder.sendTo==1) selected #end >$i18n.getString("tracked_entity_sms_only")</option>
+					<option value="3" #if($!reminder.sendTo==3) selected #end >$i18n.getString("orgunit_phone_number_sms_only")</option>
+					<option value="2" #if($!reminder.sendTo==2) selected #end >$i18n.getString("attribute_users")</option>
+					<option value="4" #if($!reminder.sendTo==4) selected #end >$i18n.getString("all_users_in_orgunit_registered")</option>
+					<option value="5" #if($!reminder.sendTo==5) selected #end >$i18n.getString("user_group")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "user_group" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+			<td>
+				<select type="text" id="userGroup" name="userGroup" #if($!reminder.sendTo!=5) disabled #end class="{validate:{required:true}}" >
+					<option value="">[$i18n.getString("please_select")]</option>
+					#foreach($eachGroup in $userGroups)
+					<option value="$eachGroup.id" #if($!reminder.userGroup.id==$eachGroup.id) selected #end>$i18n.getString($eachGroup.name)</option>
+					#end	
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "message_type" )</label></td>
+			<td>
+				<select type="text" id="messageType" name="messageType" #if($!reminder.sendTo==1 || $!reminder.sendTo==3) disabled #end class="messageType {validate:{required:true,number:true}}" >
+					<option value="1" #if($!reminder.messageType==1) selected #end >$i18n.getString("direct_sms")</option>
+					<option value="2" #if($!reminder.messageType==2) selected #end >$i18n.getString("message")</option>
+					<option value="3" #if($!reminder.messageType==3) selected #end >$i18n.getString("both")</option>
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td>$i18n.getString( "params" )</td>
+			<td>
+				<select multiple size='4' ondblclick="insertParams(this.value);">
+					<option value="{program-name}">$i18n.getString("program_name")</option>
+					<option value="{program-stage-name}">$i18n.getString("program_stage_name")</option>
+					<option value="{due-date}">$i18n.getString("due_date")</option>'
+					<option value="{days-since-due-date}">$i18n.getString("days_since_due_date")</option>'
+					<option value="{orgunit-name}">$i18n.getString("orgunit_name")</option>
+					#foreach($attribute in $attributes)
+						<option value={attributeid=$attribute.uid}>$attribute.displayName</option>
+					#end
+				</select>
+			</td>
+		</tr>
+		<tr>
+			<td><label>$i18n.getString( "message" )</label></td>
+			<td><textarea onkeyup="getMessageLength()" id="templateMessage" name="templateMessage" style="width:320px" class="templateMessage {validate:{required:true}}">$reminder.templateMessage</textarea></td>
+		</tr>
+		<tr>
+			<td></td>
+			<td id='messageLengthTD'></td>
+			<script>getMessageLength()</script>
+		</tr>
+		<tr>
+			<td></td>
+			<td>
+				<input type="submit" value="$i18n.getString( 'update' )" style="width:10em" >
+				<input type="button" value="$i18n.getString( 'cancel' )" style="width:10em" onclick="window.location.href='programStageReminder.action?id=$programStage.id'">
+			</td>
+		 </tr>
+  </table>
+</form>
+
+