← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13061: fix bugs when edit SMS commands

 

------------------------------------------------------------
revno: 13061
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-11-29 15:05:25 +0700
message:
  fix bugs when edit  SMS commands
added:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/dhis-web-maintenance-mobile.css
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.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-mobile/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml	2013-11-20 04:03:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml	2013-11-29 08:05:25 +0000
@@ -179,6 +179,7 @@
       <param name="page">/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm</param>
       <param name="menu">/dhis-web-maintenance-mobile/menu.vm</param>
       <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/command.js</param>
+      <param name="stylesheets">style/dhis-web-maintenance-mobile.css</param>
       <param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
     </action>
 

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js	2013-11-20 04:03:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js	2013-11-29 08:05:25 +0000
@@ -21,8 +21,8 @@
 	var rowId = jQuery('.trSpecialCharacter').length + 1;
 
 	var contend = '<tr id="trSpecialCharacter'+rowId+'" name="trSpecialCharacter'+rowId+'" class="trSpecialCharacter">'
-				+	'<td><input id="name'+rowId+'" name="name'+rowId+'" type="text"/></td>'
-				+	'<td><input id="value'+rowId+'" name="value'+rowId+'" type="text"/>'
+				+	'<td><input id="name'+rowId+'" name="name'+rowId+'" type="text" class="name {validate:{required:true}}"/></td>'
+				+	'<td><input id="value'+rowId+'" name="value'+rowId+'" type="text" class="value {validate:{required:true}}"/>'
 				+   	'<input type="button" value="remove" onclick="removeSpecialCharactersForm('+rowId+')"/></td>'
 				+ '</tr>';
 	jQuery('#specialCharacters').append( contend );

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2013-11-29 03:19:49 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm	2013-11-29 08:05:25 +0000
@@ -16,11 +16,24 @@
 		selectedDataOptions += ']}';
 		$("#codeDataelementOption").val(selectedDataOptions);
 
+		//get special characters' data
+		var speCharName = jQuery("#speCharName");
+		speCharName.empty();
+		jQuery(".name").each( function( i, item ){
+			speCharName.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+		});
+		
+		var speCharValue = jQuery("#speCharValue");
+		speCharValue.empty();
+		jQuery(".value").each( function( i, item ){
+			speCharValue.append( "<option value='" + item.value + "' selected='true'>" + item.value + "</option>" );
+		});
+
 		var specialCharactersInfo = '{"specialCharacters":[';
-		for (var i=1; i<=jQuery('.trSpecialCharacter').length; i++)
+		for (var i=0; i<jQuery('.trSpecialCharacter').length; i++)
 		{ 
-			specialCharactersInfo += '{"name" :"'+document.getElementById('name'+i).value+'",';
-			specialCharactersInfo += '"value" :"'+document.getElementById('value'+i).value+'"},';	
+			specialCharactersInfo += '{"name" :"'+document.getElementById("speCharName").options[i].value+'",';
+			specialCharactersInfo += '"value" :"'+document.getElementById("speCharValue").options[i].value+'"},';	
 		}
 		specialCharactersInfo += ']}';
 		$("#specialCharactersInfo").val(specialCharactersInfo);
@@ -29,6 +42,7 @@
 	
 	function checkDuplicatedCode( value, index )
 	{
+		
 		for (var i=1; i<=jQuery('.trDataElementCode').length; i++ )
 		{
 			if ( i != index )
@@ -52,6 +66,8 @@
 <h3>$i18n.getString( "edit_command" )</h3>
 
 <form id="updateSMSCommandForm" name="updateSMSCommandForm" action="saveEditSMSCommandForm.action" method="post">
+	<select id='speCharName' name="speCharName" multiple="multiple" class="hidden"></select>
+	<select id='speCharValue' name="speCharValue" multiple="multiple" class="hidden"></select>
 	<table>
 	<thead>
       <tr>
@@ -162,9 +178,9 @@
 	<tbody id="specialCharacters">
 		#foreach( $specialCharacters in $smsCommand.specialCharacters )
 			<tr id="trSpecialCharacter$velocityCount" name="trSpecialCharacter$velocityCount" class="trSpecialCharacter">
-				<td><input type="text" id="name$velocityCount" name="name$velocityCount" class="{validate:{required:true}}" value="$specialCharacters.name"/></td>
+				<td><input type="text" id="name$velocityCount" name="name$velocityCount" class="name {validate:{required:true}}" value="$specialCharacters.name"/></td>
 				<td>
-					<input type="text" id="value$velocityCount" name="value$velocityCount" class="{validate:{required:true}}" value="$specialCharacters.value"/><input type="button" value="remove" onclick="removeSpecialCharactersForm($velocityCount)"/>
+					<input type="text" id="value$velocityCount" name="value$velocityCount" class="value {validate:{required:true}}" value="$specialCharacters.value"/><input type="button" value="remove" onclick="removeSpecialCharactersForm($velocityCount)"/>
 				</td>
 			</tr>
 		#end

=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/dhis-web-maintenance-mobile.css'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/dhis-web-maintenance-mobile.css	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/dhis-web-maintenance-mobile.css	2013-11-29 08:05:25 +0000
@@ -0,0 +1,5 @@
+.hidden 
+{
+  display: none;
+}
+