← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3493: updated to ckeditor in patient module, also removed all editormanager files

 

------------------------------------------------------------
revno: 3493
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-04-29 12:05:04 +0200
message:
  updated to ckeditor in patient module, also removed all editormanager files
removed:
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/EditorManager.java
  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/FCKEditorManager.java
modified:
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
  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/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.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
=== removed directory 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor'
=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/EditorManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/EditorManager.java	2010-10-12 07:36:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/EditorManager.java	1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
-package org.hisp.dhis.editor;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-
-/**
- * @author Tran Thanh Tri
- * @version $Id: EditorManager
- */
-public interface EditorManager
-{
-
-    public void setValue( String value );
-
-    public String create( String name, String width, String height );
-}

=== removed file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/FCKEditorManager.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/FCKEditorManager.java	2010-10-12 07:36:49 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/editor/FCKEditorManager.java	1970-01-01 00:00:00 +0000
@@ -1,73 +0,0 @@
-package org.hisp.dhis.editor;
-
-/*
- * Copyright (c) 2004-2010, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- *   list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- *   this list of conditions and the following disclaimer in the documentation
- *   and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- *   be used to endorse or promote products derived from this software without
- *   specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-import net.fckeditor.FCKeditor;
-
-import org.apache.struts2.ServletActionContext;
-
-/**
- * @author Tran Thanh Tri
- * @version $Id: FCKEditorManager
- */
-public class FCKEditorManager
-    implements EditorManager
-{
-    private String value;
-
-    public void setValue( String value )
-    {
-        this.value = value;
-    }
-
-    private String basePath;
-
-    public void setBasePath( String basePath )
-    {
-        this.basePath = basePath;
-    }
-
-    private String skin;
-
-    public void setSkin( String skin )
-    {
-        this.skin = skin;
-    }
-
-    public String create( String name, String width, String height )
-    {
-        FCKeditor editor = new FCKeditor( ServletActionContext.getRequest(), name );
-        editor.setConfig( "SkinPath", "skins/" + skin + "/" );
-        editor.setBasePath( basePath );
-        editor.setWidth( width );
-        editor.setHeight( height );
-        editor.setValue( value );
-        return editor.createHtml();
-
-    }
-
-}

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-07 13:48:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml	2011-04-29 10:05:04 +0000
@@ -504,9 +504,4 @@
 		</property>
 	</bean>
 
-	<bean id="editorManager" class="org.hisp.dhis.editor.FCKEditorManager" scope="prototype">
-		<property name="basePath" value="/dhis-web-commons/fckeditor" />
-		<property name="skin" value="silver" />
-	</bean>
-
 </beans>

=== 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	2011-03-31 01:39:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/java/org/hisp/dhis/patient/action/dataentryform/ViewDataEntryFormAction.java	2011-04-29 10:05:04 +0000
@@ -35,7 +35,6 @@
 import org.hisp.dhis.dataelement.comparator.DataElementNameComparator;
 import org.hisp.dhis.dataentryform.DataEntryForm;
 import org.hisp.dhis.dataentryform.DataEntryFormService;
-import org.hisp.dhis.editor.EditorManager;
 import org.hisp.dhis.program.ProgramStage;
 import org.hisp.dhis.program.ProgramStageDataElementService;
 import org.hisp.dhis.program.ProgramStageService;
@@ -70,18 +69,6 @@
         this.programStageService = programStageService;
     }
 
-    private EditorManager editorManager;
-
-    public EditorManager getEditorManager()
-    {
-        return editorManager;
-    }
-
-    public void setEditorManager( EditorManager editorManager )
-    {
-        this.editorManager = editorManager;
-    }
-
     private ProgramStageDataElementService programStageDataElementService;
 
     public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
@@ -135,6 +122,13 @@
         return programStages;
     }
 
+    private String dataEntryValue;
+
+    public String getDataEntryValue()
+    {
+        return dataEntryValue;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
@@ -149,9 +143,15 @@
         // ---------------------------------------------------------------------
 
         dataEntryForm = programStage.getDataEntryForm();
-        
-        editorManager.setValue( dataEntryForm == null ? "" : dataEntryFormService.prepareDataEntryFormCode( dataEntryForm
-            .getHtmlCode() ) );
+
+        if ( dataEntryForm != null )
+        {
+            dataEntryValue = dataEntryFormService.prepareDataEntryFormCode( dataEntryForm.getHtmlCode() );
+        }
+        else
+        {
+            dataEntryValue = "";
+        }
         
         // ---------------------------------------------------------------------
         // Get existing Data Entry Forms

=== 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	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/META-INF/dhis/beans.xml	2011-04-29 10:05:04 +0000
@@ -817,7 +817,6 @@
 		<property name="programStageService">
 			<ref bean="org.hisp.dhis.program.ProgramStageService" />
 		</property>
-		<property name="editorManager" ref="editorManager" />
 		<property name="programStageDataElementService"
 			ref="org.hisp.dhis.program.ProgramStageDataElementService" />
 	</bean>

=== 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	2011-04-29 07:41:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/struts.xml	2011-04-29 10:05:04 +0000
@@ -832,7 +832,9 @@
 			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">javascript/viewDataEntryForm.js</param>		
+			<param name="javascripts">
+			      	../dhis-web-commons/ckeditor/ckeditor.js, ../dhis-web-commons/ckeditor/adapters/jquery.js, javascript/viewDataEntryForm.js
+			</param>		
 		</action>
 
 		<action name="saveDataEntryForm"

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2011-03-23 03:34:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js	2011-04-29 10:05:04 +0000
@@ -52,10 +52,11 @@
 	jQuery.post("showDataEntryForm.action",{
 		dataEntryFormId: getFieldValue( 'existedDataEntryId' )
 	}, function( html ){
-		FCKeditorAPI.GetInstance('designTextarea').SetHTML( html );
-		
+		jQuery("#designTextarea").ckeditorGet().setData( html );
+
 		var dataEntryFormField = byId('existedDataEntryId');
 		var optionField = dataEntryFormField.options[dataEntryFormField.selectedIndex];
+
 		setFieldValue('dataEntryFormId', optionField.value );
 		setFieldValue('name', optionField.text );
 		
@@ -91,7 +92,6 @@
 	}
 }
 
-
 function getOptionCombos( dataElement, target )
 {
 	var dataElement = JSON.parse( dataElement );
@@ -130,12 +130,13 @@
 function checkExisted( id )
 {	
 	var result = false;
-	var html = FCKeditorAPI.GetInstance('designTextarea').GetHTML();
+	var html = jQuery("#designTextarea").ckeditorGet().getData();
 	var input = jQuery( html ).find("select, :text");
+
 	input.each( function(i, item){		
 		if( id == item.id ) result = true;		
 	});
-	
+
 	return result;
 }
 
@@ -155,7 +156,6 @@
 	});	
 }
 
-
 function validateDataEntryForm( )
 {
 	$.postJSON(
@@ -178,94 +178,90 @@
     	);
 }
 
-
-	function insertDataElement( source, associationId )
-	{
-		var oEditor = FCKeditorAPI.GetInstance('designTextarea') ;
-
-		var dataElement = JSON.parse( jQuery( source + ' #dataElementIds').val() );
-		if( dataElement == null )
-		{
-			jQuery( source + " #message_").html( "<b>" + i18n_specify_dataelememt + "</b>" );
-			return;
-		}else{
-			jQuery( source + " #message_").html( "" );
-		}
-		var categoryOptionCombos = getSelectedValues( source + ' #optionComboIds' );
-
-		var dataElementId = dataElement.id;	
-		var dataElementName = dataElement.name;	
-		var dataElementType = dataElement.type;
-		var viewByValue = jQuery( source + ' #viewBySelector' ).val();	
-
-		var strPSDataEntryId   = "value["+ associationId +"].value:value["+ dataElementId +"].value";
-		var comboPSDataEntryId = "value["+ associationId +"].combo:value["+ dataElementId +"].combo";
-		var boolPSDataEntryId  = "value["+ associationId +"].boolean:value["+ dataElementId +"].boolean";
-		var datePSDataEntryId  = "value["+ associationId +"].date:value["+ dataElementId +"].date";
-
-		if(viewByValue == "deid") dispName = "[ " + dataElementId;
-		else if (viewByValue == "deshortname") dispName = "[ " + dataElement.shortName;
-		else dispName = "[ " + dataElementName;
-
-		viewByValue = "@@" + viewByValue + "@@";
-
-		var id = "";
-
-		var selectString = "";
-
-		if( dataElementType == "string" )
-		{
-			if( categoryOptionCombos[0].default == 'true' )
-			{			
-				strPSDataEntryId  = strPSDataEntryId + ":value["+ categoryOptionCombos[0].id +"].value";
-				selectString += "<input name=\"entryfield\" id=\""+strPSDataEntryId+"\" type=\"text\" value=\"\" onkeypress=\"return keyPress(event, this)\" >";			
-				id = strPSDataEntryId;
-			}else{			
-				selectString = "<select name=\"entryselect\" id=\"" + comboPSDataEntryId + "\" > <option value=\"\">i18n_select_value</option>";
-			
-				jQuery.each( categoryOptionCombos, function(i, item ){
-					selectString += "<option value=\""+ item.id +"\" id=\"combo[" + item.id + "].combo\" >(" + item.name + ")</option>";
-				});
-				
-				selectString += "</select>";
-				
-				id = comboPSDataEntryId;
-			}		
-			
-		}else if (dataElementType == "bool")
-		{
-			selectString = "<select name=\"entryselect\" id=\"" + boolPSDataEntryId + "\" > <option value=\"\">i18n_select_value</option>";
-			selectString += "<option value=\"true\" >i18n_yes</option>";
-			selectString += "<option value=\"false\" >i18n_no</option>";
+function insertDataElement( source, associationId )
+{
+	var oEditor = jQuery("#designTextarea").ckeditorGet();
+
+	var dataElement = JSON.parse( jQuery( source + ' #dataElementIds').val() );
+
+	if( dataElement == null )
+	{
+		jQuery( source + " #message_").html( "<b>" + i18n_specify_dataelememt + "</b>" );
+		return;
+	} else {
+		jQuery( source + " #message_").html( "" );
+	}
+
+	var categoryOptionCombos = getSelectedValues( source + ' #optionComboIds' );
+
+	var dataElementId = dataElement.id;	
+	var dataElementName = dataElement.name;	
+	var dataElementType = dataElement.type;
+	var viewByValue = jQuery( source + ' #viewBySelector' ).val();	
+
+	var strPSDataEntryId   = "value["+ associationId +"].value:value["+ dataElementId +"].value";
+	var comboPSDataEntryId = "value["+ associationId +"].combo:value["+ dataElementId +"].combo";
+	var boolPSDataEntryId  = "value["+ associationId +"].boolean:value["+ dataElementId +"].boolean";
+	var datePSDataEntryId  = "value["+ associationId +"].date:value["+ dataElementId +"].date";
+
+	if(viewByValue == "deid") dispName = "[ " + dataElementId;
+	else if (viewByValue == "deshortname") dispName = "[ " + dataElement.shortName;
+	else dispName = "[ " + dataElementName;
+
+	viewByValue = "@@" + viewByValue + "@@";
+
+	var id = "";
+
+	var selectString = "";
+
+	if( dataElementType == "string" )
+	{
+		if( categoryOptionCombos[0].default == 'true' )
+		{			
+			strPSDataEntryId  = strPSDataEntryId + ":value["+ categoryOptionCombos[0].id +"].value";
+			selectString += "<input name=\"entryfield\" id=\""+strPSDataEntryId+"\" type=\"text\" value=\"\" onkeypress=\"return keyPress(event, this)\" >";			
+			id = strPSDataEntryId;
+		}else{			
+			selectString = "<select name=\"entryselect\" id=\"" + comboPSDataEntryId + "\" > <option value=\"\">i18n_select_value</option>";
+		
+			jQuery.each( categoryOptionCombos, function(i, item ){
+				selectString += "<option value=\""+ item.id +"\" id=\"combo[" + item.id + "].combo\" >(" + item.name + ")</option>";
+			});
+			
 			selectString += "</select>";
 			
-			id = boolPSDataEntryId;
-		}else if (dataElementType == "date")
-		{
-			selectString = "<input type=\"text\" id=\"" + datePSDataEntryId + "\" name=\"entryfield\" value=\"\">";	
-			id = datePSDataEntryId;
-		} else if ( dataElementType == "int" )
-		{
-			jQuery.each( categoryOptionCombos, function(i, item ){
-				optionComboName = item.name;
-				optionComboId = item.id;
-				var titleValue = "-- " + dataElementId + ". "+ dataElementName+" " + optionComboId + ". " + optionComboName+" ("+dataElementType+") --";
-				var displayName = dispName + " - " + optionComboName + " ]";
-				var dataEntryId = "value[" + associationId + "].value:value[" + dataElementId + "].value:value[" + optionComboId + "].value";
-				selectString += "<input title=\"" + titleValue + "\" view=\""+viewByValue+"\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + dataEntryId + "\" style=\"width:10em;text-align:center\"/><br/>";
-				id = dataEntryId;
-			});
-		}
-		
-		if( checkExisted( id ) )
-		{		
-			jQuery( source + " #message_").html( "<b>" + i18n_dataelement_is_inserted + "</b>" );
-			return;
-		}else{
-			jQuery( source + " #message_").html("");
-		}
-
-		oEditor.InsertHtml( selectString );
-
-	}
-
+			id = comboPSDataEntryId;
+		}		
+		
+	} else if (dataElementType == "bool") {
+		selectString = "<select name=\"entryselect\" id=\"" + boolPSDataEntryId + "\" > <option value=\"\">i18n_select_value</option>";
+		selectString += "<option value=\"true\" >i18n_yes</option>";
+		selectString += "<option value=\"false\" >i18n_no</option>";
+		selectString += "</select>";
+		
+		id = boolPSDataEntryId;
+	} else if (dataElementType == "date") {
+		selectString = "<input type=\"text\" id=\"" + datePSDataEntryId + "\" name=\"entryfield\" value=\"\">";	
+		id = datePSDataEntryId;
+	} else if ( dataElementType == "int" ) {
+		jQuery.each( categoryOptionCombos, function(i, item ){
+			optionComboName = item.name;
+			optionComboId = item.id;
+			var titleValue = "-- " + dataElementId + ". "+ dataElementName+" " + optionComboId + ". " + optionComboName+" ("+dataElementType+") --";
+			var displayName = dispName + " - " + optionComboName + " ]";
+			var dataEntryId = "value[" + associationId + "].value:value[" + dataElementId + "].value:value[" + optionComboId + "].value";
+			selectString += "<input title=\"" + titleValue + "\" view=\""+viewByValue+"\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + dataEntryId + "\" style=\"width:10em;text-align:center\"/><br/>";
+			id = dataEntryId;
+		});
+	}
+	
+	if( checkExisted( id ) )
+	{		
+		jQuery( source + " #message_").html( "<b>" + i18n_dataelement_is_inserted + "</b>" );
+		return;
+	}else{
+		jQuery( source + " #message_").html("");
+	}
+
+	oEditor.insertHtml( selectString );
+}

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2011-03-31 05:38:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm	2011-04-29 10:05:04 +0000
@@ -1,6 +1,22 @@
-
-<style>
-
+<script type="text/javascript">   
+	jQuery(document).ready(	function()
+	{		
+		validation( 'saveDataEntryForm', function( form ){ validateDataEntryForm();});
+
+		jQuery('#designTextarea').ckeditor();
+		jQuery("#designTextarea").ckeditorGet().setData('$encoder.jsEscape( $dataEntryValue, "'" )');
+	});
+
+    var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
+	var i18n_specify_dataelememt = '$encoder.jsEscape( $i18n.getString( "specify_dataelememt" ) , "'" )';
+    var i18n_choose_existing_dataentry ='$encoder.jsEscape( $i18n.getString( "choose_existing_dataentry" ) , "'" )';
+	var i18n_dataelement = "$i18n.getString( 'dataelement' )";
+	var i18n_dataelement_of_orther_program_stage = "$i18n.getString( 'dataelement_of_orther_program_stage' )";
+	
+	var previousName = '';
+</script>
+
+<style type="text/css">
 #dataElementSelection,
 #existedDataEntry,
 #otherProgramStageDataElements{ 
@@ -70,12 +86,16 @@
 			</td>				
 		</tr>	
 	</table>  
-	<table width="100%">      
+	<table width="100%">
 		<tr>
 			<th>$i18n.getString( "design_dataentry_form" )</th>
 		</tr>
 		<tr>
-			<td>$editorManager.create( "designTextarea", "100%", "400" )</td>
+			<td>
+	        	<div>
+	        		<textarea id="designTextarea" name="designTextarea"></textarea>
+	        	</div>
+			</td>
 		</tr>
 	</table>
 </div>
@@ -184,20 +204,3 @@
 	</select>
 	<input type="button" value="$i18n.getString( 'load' )" style="float:left" onclick="loadExistedForm()"/>	
 </div>
-
-<script type="text/javascript">   
-    var i18n_dataelement_is_inserted = '$encoder.jsEscape( $i18n.getString( "dataelement_is_inserted" ) , "'" )';
-	var i18n_specify_dataelememt = '$encoder.jsEscape( $i18n.getString( "specify_dataelememt" ) , "'" )';
-    var i18n_choose_existing_dataentry ='$encoder.jsEscape( $i18n.getString( "choose_existing_dataentry" ) , "'" )';
-	var i18n_dataelement = "$i18n.getString( 'dataelement' )";
-	var i18n_dataelement_of_orther_program_stage = "$i18n.getString( 'dataelement_of_orther_program_stage' )";
-	
-	jQuery(document).ready(	function()
-	{		
-		validation( 'saveDataEntryForm', function( form ){ validateDataEntryForm();});
-	});
-	
-	var previousName = '';
-
-</script>
-     
\ No newline at end of file