dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #31831
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16253: Removed Sort by scheduled days button in program stage management form.
------------------------------------------------------------
revno: 16253
committer: tran.hispvietnam@xxxxxxxxx
branch nick: dhis2
timestamp: Sun 2014-07-27 19:49:21 +0700
message:
Removed Sort by scheduled days button in program stage management form.
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/SaveProgramStageSortOrderAction.java
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.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/javascript/programStage.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java 2014-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/AddProgramStageAction.java 2014-07-27 12:49:21 +0000
@@ -29,6 +29,7 @@
*/
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -41,6 +42,7 @@
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.comparator.ProgramStageMinDaysComparator;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
@@ -376,11 +378,15 @@
reminders.add( reminder );
}
programStage.setReminders( reminders );
-
program.getProgramStages().add( programStage );
+ programStageService.saveProgramStage( programStage );
- programStageService.saveProgramStage( programStage );
-
+ List<ProgramStage> programStages = new ArrayList<ProgramStage>( program.getProgramStages() );
+ Collections.sort( programStages, new ProgramStageMinDaysComparator() );
+ program.getProgramStages().clear();
+ program.setProgramStages(programStages);
+ programService.updateProgram( program );
+
for ( int i = 0; i < this.selectedDataElementsValidator.size(); i++ )
{
DataElement dataElement = dataElementService.getDataElement( selectedDataElementsValidator.get( i ) );
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/SaveProgramStageSortOrderAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/SaveProgramStageSortOrderAction.java 2014-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/SaveProgramStageSortOrderAction.java 1970-01-01 00:00:00 +0000
@@ -1,90 +0,0 @@
-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.Collections;
-import java.util.List;
-
-import org.hisp.dhis.program.Program;
-import org.hisp.dhis.program.ProgramService;
-import org.hisp.dhis.program.ProgramStage;
-import org.hisp.dhis.program.comparator.ProgramStageMinDaysComparator;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Abyot Asalefew Gizaw
- * @version $Id$
- */
-public class SaveProgramStageSortOrderAction
- implements Action
-{
-
- // -------------------------------------------------------------------------
- // Dependency
- // -------------------------------------------------------------------------
-
- private ProgramService programService;
-
- public void setProgramService( ProgramService programService )
- {
- this.programService = programService;
- }
-
- // -------------------------------------------------------------------------
- // Input/Output
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- Program program = programService.getProgram( id );
-
- if ( program.getProgramStages() != null )
- {
- List<ProgramStage> programStages = new ArrayList<ProgramStage>( program.getProgramStages() );
- Collections.sort( programStages, new ProgramStageMinDaysComparator() );
- program.setProgramStages(programStages);
- programService.updateProgram( program );
- }
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java 2014-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/programstage/UpdateProgramStageAction.java 2014-07-27 12:49:21 +0000
@@ -29,19 +29,24 @@
*/
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import org.hisp.dhis.dataelement.DataElement;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.program.Program;
+import org.hisp.dhis.program.ProgramService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageService;
+import org.hisp.dhis.program.comparator.ProgramStageMinDaysComparator;
import org.hisp.dhis.trackedentity.TrackedEntityInstanceReminder;
import org.hisp.dhis.user.UserGroup;
import org.hisp.dhis.user.UserGroupService;
+import org.springframework.beans.factory.annotation.Autowired;
import com.opensymphony.xwork2.Action;
@@ -85,6 +90,9 @@
this.userGroupService = userGroupService;
}
+ @Autowired
+ private ProgramService programService;
+
// -------------------------------------------------------------------------
// Input/Output
// -------------------------------------------------------------------------
@@ -375,6 +383,13 @@
programStageService.updateProgramStage( programStage );
+ Program program = programStage.getProgram();
+ List<ProgramStage> programStages = new ArrayList<ProgramStage>( program.getProgramStages() );
+ Collections.sort( programStages, new ProgramStageMinDaysComparator() );
+ program.getProgramStages().clear();
+ program.setProgramStages(programStages);
+ programService.updateProgram( program );
+
Set<ProgramStageDataElement> programStageDataElements = new HashSet<ProgramStageDataElement>(
programStage.getProgramStageDataElements() );
=== 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-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/META-INF/dhis/beans.xml 2014-07-27 12:49:21 +0000
@@ -300,13 +300,6 @@
</bean>
<bean
- id="org.hisp.dhis.trackedentity.action.programstage.SaveProgramStageSortOrderAction"
- class="org.hisp.dhis.trackedentity.action.programstage.SaveProgramStageSortOrderAction"
- scope="prototype">
- <property name="programService" ref="org.hisp.dhis.program.ProgramService" />
- </bean>
-
- <bean
id="org.hisp.dhis.trackedentity.action.programstage.UpdateProgramStageAction"
class="org.hisp.dhis.trackedentity.action.programstage.UpdateProgramStageAction"
scope="prototype">
=== 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-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/resources/struts.xml 2014-07-27 12:49:21 +0000
@@ -362,13 +362,6 @@
<param name="requiredAuthorities">F_PROGRAMSTAGE_DELETE</param>
</action>
- <action name="saveProgramStageSortOder"
- class="org.hisp.dhis.trackedentity.action.programstage.SaveProgramStageSortOrderAction">
- <result name="success" type="velocity-json">
- /dhis-web-commons/ajax/jsonResponseSuccess.vm
- </result>
- </action>
-
<action name="programStageList"
class="org.hisp.dhis.trackedentity.action.programstage.GetProgramStageListAction">
<result name="success" type="velocity">/content.vm</result>
=== 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-06-21 09:56:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStage.js 2014-07-27 12:49:21 +0000
@@ -44,33 +44,6 @@
}
}
-function sortProgramStages()
-{
- var programId = getFieldValue('id');
- if( programId == "null" || programId == "" )
- {
- showWarningMessage( i18n_please_select_program );
- }
- else
- {
- jQuery.getJSON( 'saveProgramStageSortOder.action', { id: programId },
- function ( json ) {
- showSuccessMessage( i18n_success );
- loadProgramStageList( programId );
- });
- }
-}
-
-function loadProgramStageList( programId )
-{
- jQuery('#programStageListDiv').load('programStageList.action',{
- id: programId
- },
- function( html ){
- setInnerHTML('programStageListDiv', html );
- });
-}
-
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
=== 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-07-26 14:38:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programStage.vm 2014-07-27 12:49:21 +0000
@@ -21,7 +21,6 @@
<td style="text-align:right">
#if( $program.type=='1' )
<input type="button" value="$i18n.getString( 'add_new' )" onclick="javascript:addProgramStage()" style="width:150px"><br>
- <input type="button" value="$i18n.getString( 'sort_by_scheduled_days' )" onclick="javascript:sortProgramStages()" style="width:150px;"><br>
#end
<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='program.action'" style="width:150px">
</td>