← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8039: CDE, moved some javascript from template to js file, makes it possible to cache it

 

------------------------------------------------------------
revno: 8039
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-09-11 16:07:52 +0200
message:
  CDE, moved some javascript from template to js file, makes it possible to cache it
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/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
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js	2012-06-04 16:20:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/viewDataEntryForm.js	2012-09-11 14:07:52 +0000
@@ -113,7 +113,64 @@
 		text: false
 	}).click(function() {
 		filterSelectList( 'indicatorSelector', $("#indicatorsFilterInput").val() );
-	});
+	});	
+
+	$("#dataElementSelector").dhisAjaxSelect({
+		source: "../dhis-web-commons-ajax-json/getDataElementOperands.action",
+		iterator: "operands",
+		handler: function(item) {
+			var option = jQuery("<option />");
+			option.text( item.operandName );
+			option.data( "dataelement-id", item.dataElement.id );
+			option.data( "dataelement-name", item.dataElement.name );
+			option.data( "dataelement-type", item.dataElement.type );
+			option.data( "optioncombo-id", item.categoryOptionCombo.id );
+			option.data( "optioncombo-name", item.categoryOptionCombo.name );
+			option.dblclick(insertDataElement);
+
+			return option;
+		},
+		params: {
+			dataSetId: dataSetId
+		}
+	});
+
+	$("#totalSelector").dhisAjaxSelect({
+		source: "../dhis-web-commons-ajax-json/getDataElements.action",
+		iterator: "dataElements",
+		handler: function(item) {
+			var option = jQuery("<option />");
+			option.text( item.name );
+			option.data( "id", item.id );
+			option.dblclick(insertTotal);
+
+			return option;
+		},
+		params: {
+			dataSetId: dataSetId
+		}
+	});
+
+	$("#indicatorSelector").dhisAjaxSelect({
+		source: "../dhis-web-commons-ajax-json/getIndicators.action",
+		iterator: "indicators",
+		handler: function(item) {
+			var option = jQuery("<option />");
+			option.text( item.name );
+			option.data("id", item.id);
+			option.dblclick(insertIndicator);
+
+			return option;
+		},
+		params: {
+			dataSetId: dataSetId
+		}
+	});
+			
+	if( autoSave == 'true' )
+	{
+		window.setTimeout( "validateDataEntryFormTimeout( false );", 60000 );
+	}
 });
 
 function showDataElements() {

=== 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	2012-06-06 09:11:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/viewDataEntryForm.vm	2012-09-11 14:07:52 +0000
@@ -5,68 +5,13 @@
 		jQuery('#designTextarea').ckeditor();
 		jQuery("#designTextarea").ckeditorGet().setData('$encoder.jsEscape( $dataEntryValue, "'" )');
 
-		jQuery("#dataElementSelector").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElementOperands.action",
-			iterator: "operands",
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.operandName );
-				option.data( "dataelement-id", item.dataElement.id );
-				option.data( "dataelement-name", item.dataElement.name );
-				option.data( "dataelement-type", item.dataElement.type );
-				option.data( "optioncombo-id", item.categoryOptionCombo.id );
-				option.data( "optioncombo-name", item.categoryOptionCombo.name );
-				option.dblclick(insertDataElement);
-
-				return option;
-			},
-			params: {
-				dataSetId: ${dataSet.id}
-			}
-		});
-
-		jQuery("#totalSelector").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getDataElements.action",
-			iterator: "dataElements",
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.data( "id", item.id );
-				option.dblclick(insertTotal);
-
-				return option;
-			},
-			params: {
-				dataSetId: ${dataSet.id}
-			}
-		});
-
-		jQuery("#indicatorSelector").dhisAjaxSelect({
-			source: "../dhis-web-commons-ajax-json/getIndicators.action",
-			iterator: "indicators",
-			handler: function(item) {
-				var option = jQuery("<option />");
-				option.text( item.name );
-				option.data("id", item.id);
-				option.dblclick(insertIndicator);
-
-				return option;
-			},
-			params: {
-				dataSetId: ${dataSet.id}
-			}
-		});
-				
-		if( '${autoSave}' == 'true' )
-		{
-			window.setTimeout( "validateDataEntryFormTimeout( false );", 60000 );
-		}		
 	});
 
     var stat = "ADD";
     var dataEntryFormId = -1;
-	var selected = null;
-	var autoSave = ${autoSave};
+    var selected = null;
+    var autoSave = ${autoSave};
+    var dataSetId = ${dataSet.id};
 
 	#if( $dataEntryForm )
     stat = "EDIT";