← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2357: fixed save data entry form in data set module

 

------------------------------------------------------------
revno: 2357
committer: Tri Tran Thanh <Tri Tran Thanh@compaq>
branch nick: trunk
timestamp: Wed 2010-10-13 11:45:23 +0700
message:
  fixed save data entry form in data set module
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml


--
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-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java	2010-10-12 07:36:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/ViewDataEntryFormAction.java	2010-10-13 04:45:23 +0000
@@ -137,8 +137,7 @@
     public List<DataElementOperand> getOperands()
     {
         return operands;
-    }   
-
+    }
 
     // -------------------------------------------------------------------------
     // Execute
@@ -150,12 +149,16 @@
 
         dataSet = dataSetService.getDataSet( dataSetId );
 
-        dataEntryForm = dataSet.getDataEntryForm();        
+        dataEntryForm = dataSet.getDataEntryForm();
 
         if ( dataEntryForm != null )
         {
             editorManager.setValue( prepareDataEntryFormCode( dataEntryForm.getHtmlCode() ) );
         }
+        else
+        {
+            editorManager.setValue( "" );
+        }
 
         autoSave = (Boolean) userSettingService.getUserSetting( UserSettingService.AUTO_SAVE_DATA_ENTRY_FORM, false );
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2010-10-12 07:36:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2010-10-13 04:45:23 +0000
@@ -111,7 +111,7 @@
       </tr>
       <tr>
         <td>
-			$editorManager.create( "fckeditor", "100%", "400" )
+			$editorManager.create( "designTextarea", "100%", "400" )
 		</td>
       </tr>
       <tr>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java	2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java	2010-10-13 04:45:23 +0000
@@ -35,6 +35,7 @@
 
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
+import org.hisp.dhis.editor.EditorManager;
 import org.hisp.dhis.patient.screen.DataEntryManager;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageService;
@@ -44,6 +45,7 @@
 /**
  * @author Bharath Kumar
  * @modify Viet Nguyen 3-11-2009
+ * @modify Tran Thanh Tri 13 Oct 2010
  * @version $Id$
  */
 public class ViewDataEntryFormAction
@@ -52,7 +54,7 @@
     // -------------------------------------------------------------------------
     // Dependencies
     // -------------------------------------------------------------------------
-    
+
     private DataEntryFormService dataEntryFormService;
 
     public void setDataEntryFormService( DataEntryFormService dataEntryFormService )
@@ -61,24 +63,39 @@
     }
 
     private ProgramStageService programStageService;
-    
-    public void setProgramStageService(ProgramStageService programStageService) {
-		this.programStageService = programStageService;
+
+    public void setProgramStageService( ProgramStageService programStageService )
+    {
+        this.programStageService = programStageService;
     }
-    
+
     private DataEntryManager dataEntryManager;
-    
+
     public void setDataEntryManager( DataEntryManager dataEntryManager )
     {
         this.dataEntryManager = dataEntryManager;
     }
+
+    private EditorManager editorManager;
+
+    public EditorManager getEditorManager()
+    {
+        return editorManager;
+    }
+
+    public void setEditorManager( EditorManager editorManager )
+    {
+        this.editorManager = editorManager;
+    }
+
     // -------------------------------------------------------------------------
     // Getters & Setters
     // -------------------------------------------------------------------------
-    
+
     private int associationId;
 
-    public void setAssociationId(int associationId) {
+    public void setAssociationId( int associationId )
+    {
         this.associationId = associationId;
     }
 
@@ -88,20 +105,21 @@
     {
         return dataEntryForm;
     }
-    
+
     private ProgramStage association;
 
-    public ProgramStage getAssociation() {
+    public ProgramStage getAssociation()
+    {
         return association;
     }
-    
+
     private String status;
 
     public String getStatus()
     {
         return status;
     }
-    
+
     private Collection<DataEntryForm> listDataEntryForm;
 
     public Collection<DataEntryForm> getListDataEntryForm()
@@ -112,28 +130,27 @@
     // -------------------------------------------------------------------------
     // Execute
     // -------------------------------------------------------------------------
-    
-   
+
     public String execute()
         throws Exception
     {
         association = programStageService.getProgramStage( associationId );
 
         dataEntryForm = association.getDataEntryForm();
-        
+
         ProgramStage programStage = programStageService.getProgramStage( associationId );
-        
-        if( programStage == null )
+
+        if ( programStage == null )
         {
             return SUCCESS;
         }
-        
+
         Set<ProgramStage> listProgramStage = programStage.getProgram().getProgramStages();
-        System.out.println("listProgramStages: "+listProgramStage);
+        System.out.println( "listProgramStages: " + listProgramStage );
         List<Integer> listAssociationIds = new ArrayList<Integer>();
-        
+
         Iterator<ProgramStage> itr = listProgramStage.iterator();
-        while( itr.hasNext() )
+        while ( itr.hasNext() )
         {
             int programStageId = itr.next().getId();
             listAssociationIds.add( programStageId );
@@ -148,11 +165,14 @@
         {
             status = "EDIT";
             listDataEntryForm.remove( dataEntryForm );
-            dataEntryForm.setHtmlCode( dataEntryManager.prepareDataEntryFormCode( dataEntryForm.getHtmlCode() ) );
+
+            String htmlCode = dataEntryManager.prepareDataEntryFormCode( dataEntryForm.getHtmlCode() );
+
+            dataEntryForm.setHtmlCode( htmlCode );
+            editorManager.setValue( htmlCode );
         }
 
         return SUCCESS;
     }
 
-    
 }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-10-01 05:46:30 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2010-10-13 04:45:23 +0000
@@ -748,7 +748,8 @@
 		</property>
 		<property name="dataEntryManager">
 			<ref bean="org.hisp.dhis.patient.screen.DataEntryManager" />
-		</property>
+		</property>		
+		<property name="editorManager" ref="editorManager"/>			
 	</bean>
 	
 	<bean id="org.hisp.dhis.patient.screen.DataEntryManager" class="org.hisp.dhis.patient.screen.DefaultDataEntryManager"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2010-10-05 12:11:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2010-10-13 04:45:23 +0000
@@ -421,3 +421,4 @@
 specify_dataelememt = Please specify a data elemement.
 processing = Processing ...
 done = Done
+dataentryform_management_for_program_stage	= Data entry form management for program stage

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2010-10-05 11:58:15 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2010-10-13 04:45:23 +0000
@@ -766,12 +766,7 @@
 			class="org.hisp.dhis.patient.action.dataentryform.ViewDataEntryFormAction">
 			<result name="success" type="velocity">/main.vm</result>
 			<param name="page">/dhis-web-maintenance-patient/viewDataEntryForm.vm</param>
-			<param name="javascripts">
-				../dhis-web-commons/javascripts/jquery-ui.js
-				,javascript/dataEntryForm.js
-				,javascript/FCK/fckeditor.js
-				,javascript/hashtable.js
-			</param>
+			<param name="javascripts">javascript/dataEntryForm.js,javascript/hashtable.js</param>
 		</action>
 
 		<action name="saveDataEntryForm"