← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 12981: Generate special characters for SMS commands

 

------------------------------------------------------------
revno: 12981
committer: Lai <lai.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-11-20 11:03:42 +0700
message:
  Generate special characters for SMS commands
added:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSSpecialCharacter.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSSpecialCharacter.hbm.xml
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java
  dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java
  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-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommand.java	2013-11-20 04:03:42 +0000
@@ -28,6 +28,7 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.Map;
 import java.util.Set;
 
 import org.hisp.dhis.dataset.DataSet;
@@ -57,10 +58,29 @@
     private String receivedMessage;
     
     private UserGroup userGroup;
-
+    
+    private Set<SMSSpecialCharacter> specialCharacters;
+    
     private boolean currentPeriodUsedForReporting = false; // default is prev
 
     public SMSCommand( String name, String parser, ParserType parserType, String separator, DataSet dataset,
+        Set<SMSCode> codes, String codeSeparator, String defaultMessage, UserGroup userGroup, String receivedMessage, Set<SMSSpecialCharacter> specialCharacters )
+    {
+        super();
+        this.name = name;
+        this.parser = parser;
+        this.parserType = parserType;
+        this.separator = separator;
+        this.dataset = dataset;
+        this.codes = codes;
+        this.codeSeparator = codeSeparator;
+        this.defaultMessage = defaultMessage;
+        this.userGroup = userGroup;
+        this.receivedMessage = receivedMessage;
+        this.specialCharacters = specialCharacters;
+    }
+    
+    public SMSCommand( String name, String parser, ParserType parserType, String separator, DataSet dataset,
         Set<SMSCode> codes, String codeSeparator, String defaultMessage, UserGroup userGroup, String receivedMessage )
     {
         super();
@@ -266,4 +286,15 @@
     {
         this.receivedMessage = receivedMessage;
     }
+
+    public Set<SMSSpecialCharacter> getSpecialCharacters()
+    {
+        return specialCharacters;
+    }
+
+    public void setSpecialCharacters( Set<SMSSpecialCharacter> specialCharacters )
+    {
+        this.specialCharacters = specialCharacters;
+    }
+    
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java	2013-11-20 04:03:42 +0000
@@ -50,4 +50,6 @@
     Collection<SMSCommand> getJ2MESMSCommands();
     
     SMSCommand getSMSCommand( String commandName, ParserType parserType );
+    
+    void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java	2013-08-23 15:56:19 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java	2013-11-20 04:03:42 +0000
@@ -48,4 +48,6 @@
     Collection<SMSCommand> getJ2MESMSCommands();
     
     SMSCommand getSMSCommand( String commandName, ParserType parserType );
+    
+    void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters );
 }

=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSSpecialCharacter.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSSpecialCharacter.java	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSSpecialCharacter.java	2013-11-20 04:03:42 +0000
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004-2012, 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.
+ */
+package org.hisp.dhis.smscommand;
+
+ /**
+ * @author Nguyen Kim Lai
+ *
+ * @version SMSSpecialCharacter.java 1:57:35 PM Nov 18, 2013 $
+ */
+public class SMSSpecialCharacter
+{
+    private int id;
+    
+    private String name;
+    
+    private String value;
+
+    public SMSSpecialCharacter()
+    {
+        
+    }
+    
+    public SMSSpecialCharacter( String name, String value )
+    {
+        this.name = name;
+        this.value = value;
+    }
+
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    public String getValue()
+    {
+        return value;
+    }
+
+    public void setValue( String value )
+    {
+        this.value = value;
+    }
+}

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java	2013-08-29 17:04:34 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java	2013-11-20 04:03:42 +0000
@@ -40,6 +40,7 @@
 import org.hisp.dhis.smscommand.SMSCode;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandStore;
+import org.hisp.dhis.smscommand.SMSSpecialCharacter;
 import org.springframework.beans.factory.annotation.Required;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -105,6 +106,11 @@
             session.delete( x );
         }
         
+        for ( SMSSpecialCharacter x : cmd.getSpecialCharacters() )
+        {
+            session.delete( x );
+        }
+        
         session.delete( cmd );
     }
 
@@ -131,4 +137,15 @@
 
         return null;
     }
+
+    @Override
+    public void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters )
+    {
+        Session session = sessionFactory.getCurrentSession();
+        
+        for ( SMSSpecialCharacter x : specialCharacters )
+        {
+            session.saveOrUpdate( x );
+        }
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java	2013-11-20 04:03:42 +0000
@@ -86,4 +86,10 @@
     {
         return smsCommandStore.getSMSCommand( commandName, parserType );
     }
+
+    @Override
+    public void saveSpecialCharacterSet( Set<SMSSpecialCharacter> specialCharacters )
+    {
+        smsCommandStore.saveSpecialCharacterSet( specialCharacters );
+    }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml	2013-08-29 18:09:46 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSCommand.hbm.xml	2013-11-20 04:03:42 +0000
@@ -34,6 +34,11 @@
       <many-to-many class="org.hisp.dhis.smscommand.SMSCode" column="codeid" unique="true" />
     </set>
     
+    <set name="specialCharacters" table="smscommandspecialcharacters">
+      <key column="smscommandid" />
+      <many-to-many class="org.hisp.dhis.smscommand.SMSSpecialCharacter" column="specialcharacterid" unique="true" />
+    </set>
+    
     <many-to-one name="userGroup" class="org.hisp.dhis.user.UserGroup" column="usergroupid" foreign-key="fk_smscommand_usergroup"/>
 
   </class>

=== added file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSSpecialCharacter.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSSpecialCharacter.hbm.xml	1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/sms/hibernate/SMSSpecialCharacter.hbm.xml	2013-11-20 04:03:42 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE hibernate-mapping PUBLIC
+    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
+    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd";
+    [<!ENTITY identifiableProperties SYSTEM "classpath://org/hisp/dhis/common/identifiableProperties.hbm">]
+    >
+<hibernate-mapping package="org.hisp.dhis.smscommand">
+	<class name="SMSSpecialCharacter" table="smsspecialcharacter">
+
+		<id name="id" column="specialcharacterid">
+			<generator class="increment" />
+		</id>
+
+		<property name="name" type="text" />
+		<property name="value" type="text" />
+	</class>
+</hibernate-mapping>

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/CreateSMSCommandForm.java	2013-11-20 04:03:42 +0000
@@ -28,11 +28,16 @@
  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+import java.util.HashSet;
+import java.util.Set;
+
 import org.hisp.dhis.dataset.DataSet;
 import org.hisp.dhis.dataset.DataSetService;
 import org.hisp.dhis.sms.parse.ParserType;
+import org.hisp.dhis.smscommand.SMSCode;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandService;
+import org.hisp.dhis.smscommand.SMSSpecialCharacter;
 import org.hisp.dhis.user.UserGroup;
 import org.hisp.dhis.user.UserGroupService;
 
@@ -121,7 +126,14 @@
             userGroup = userGroupService.getUserGroup( userGroupID );
             command.setUserGroup( userGroup );
         }
-
+        /*Set<SMSSpecialCharacter> specialCharacterSet = new HashSet<SMSSpecialCharacter>();
+        SMSSpecialCharacter smsSpecialCharacter1 = new SMSSpecialCharacter( "lai", "cool" );
+        SMSSpecialCharacter smsSpecialCharacter2 = new SMSSpecialCharacter( "trinh", "sexy" );
+        specialCharacterSet.add( smsSpecialCharacter1 );
+        specialCharacterSet.add( smsSpecialCharacter2 );
+        smsCommandService.saveSpecialCharacterSet( specialCharacterSet );
+        command.setSpecialCharacters( specialCharacterSet );*/
+        
         smsCommandService.save( command );
         return SUCCESS;
     }

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java	2013-11-20 04:03:42 +0000
@@ -43,6 +43,7 @@
 import org.hisp.dhis.smscommand.SMSCode;
 import org.hisp.dhis.smscommand.SMSCommand;
 import org.hisp.dhis.smscommand.SMSCommandService;
+import org.hisp.dhis.smscommand.SMSSpecialCharacter;
 import org.hisp.dhis.user.UserGroupService;
 
 import com.opensymphony.xwork2.Action;
@@ -92,6 +93,8 @@
     private Integer userGroupID;
 
     private String codeDataelementOption;
+    
+    private String specialCharactersInfo;
 
     private String separator;
 
@@ -125,6 +128,18 @@
             c.setOptionId( x.getInt( "optionId" ) );
             codeSet.add( c );
         }
+        
+        @SuppressWarnings( "unchecked" )
+        List<JSONObject> jsonSpecialCharacters = (List<JSONObject>) JSONObject.fromObject( specialCharactersInfo ).get( "specialCharacters" );
+        Set<SMSSpecialCharacter> specialCharacterSet = new HashSet<SMSSpecialCharacter>();
+        for ( JSONObject x : jsonSpecialCharacters )
+        {
+            String name = x.getString( "name" );
+            String value = x.getString( "value" );
+            SMSSpecialCharacter smsSpecialCharacter = new SMSSpecialCharacter( name, value );
+            specialCharacterSet.add( smsSpecialCharacter );
+        }
+        smsCommandService.saveSpecialCharacterSet( specialCharacterSet );
 
         if ( codeSet.size() > 0 )
         {
@@ -144,6 +159,8 @@
             {
                 c.setUserGroup( userGroupService.getUserGroup( userGroupID ) );
             }
+            c.getSpecialCharacters().removeAll( c.getSpecialCharacters() );
+            c.setSpecialCharacters( specialCharacterSet );
             smsCommandService.save( c );
         }
 
@@ -267,4 +284,15 @@
     {
         this.receivedMessage = receivedMessage;
     }
+
+    public String getSpecialCharactersInfo()
+    {
+        return specialCharactersInfo;
+    }
+
+    public void setSpecialCharactersInfo( String specialCharactersInfo )
+    {
+        this.specialCharactersInfo = specialCharactersInfo;
+    }
+    
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2013-08-23 16:05:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/SMSCommandAction.java	2013-11-20 04:03:42 +0000
@@ -142,7 +142,6 @@
                 codes.put( "" + x.getDataElement().getId() + x.getOptionId(), x.getCode() );
             }
         }
-        
         userGroupList = new ArrayList<UserGroup>(userGroupService.getAllUserGroups());
         return SUCCESS;
     }

=== 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-10-02 12:48:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml	2013-11-20 04:03:42 +0000
@@ -178,7 +178,7 @@
       <result name="success" type="velocity">/main.vm</result>
       <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</param>
+      <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/command.js</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-06-10 11:42:40 +0000
+++ 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
@@ -15,3 +15,21 @@
 	 hideById( "dataSetParser" ); 
 	 hideById( "alertParser" );
 }
+
+function generateSpecialCharactersForm()
+{
+	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"/>'
+				+   	'<input type="button" value="remove" onclick="removeSpecialCharactersForm('+rowId+')"/></td>'
+				+ '</tr>';
+	jQuery('#specialCharacters').append( contend );
+
+}
+
+function removeSpecialCharactersForm( rowId )
+{
+	jQuery("[name=trSpecialCharacter" + rowId + "]").remove();
+}

=== 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-09-05 09:10:23 +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-20 04:03:42 +0000
@@ -17,12 +17,20 @@
             $(this).attr('name',''); // avoid error in struts 
       });
       selectedDataOptions += ']}';
-     
       $("#codeDataelementOption").val(selectedDataOptions);
-      $("#updateSMSCommand").submit(); 
+	  
+	  var specialCharactersInfo = '{"specialCharacters":[';
+		for (var i=1; i<=jQuery('.trSpecialCharacter').length; i++)
+		{ 
+			specialCharactersInfo += '{"name" :"'+document.getElementById('name'+i).value+'",';
+			specialCharactersInfo += '"value" :"'+document.getElementById('value'+i).value+'"},';	
+		}
+	  specialCharactersInfo += ']}';
+	  $("#specialCharactersInfo").val(specialCharactersInfo);
+	  
+      $("#updateSMSCommand").submit();
 
-    }
-  
+    };
     
 </script>
 
@@ -94,9 +102,7 @@
 	</br>
 	#if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' )
     <table id="codes">
-		<col style="width: 450px"/>
-    <col/>
-    <col style="width: 450px"/>
+	<col style="width:450px"/><col/>
     <thead>
       <tr>
         <th>$i18n.getString( "data_element_category_combination")</th>
@@ -124,10 +130,33 @@
             #end  
          #end
     </table>
+	<table border="0">
+	<col style="width:320px"/><col/>
+    <thead>
+      <tr>
+        <th>$i18n.getString( "special_characters" )</th>
+		<th>$i18n.getString( "value" )</th>
+      </tr>
+    </thead>
+	<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" value="$specialCharacters.name"/></td>
+				<td>
+					<input type="text" id="value$velocityCount" name="value$velocityCount" value="$specialCharacters.value"/><input type="button" value="remove" onclick="removeSpecialCharactersForm($velocityCount)"/>
+				</td>
+			</tr>
+		#end
+	</tbody>
+	<tr>
+		<td col="2"><input type="button" value="$i18n.getString('add_more')" onclick="generateSpecialCharactersForm()"/><td>
+	</tr>
+	</table>
     #end
 
 	<br/>	
     <input type="hidden" name="codeDataelementOption" id="codeDataelementOption" />
+	<input type="hidden" name="specialCharactersInfo" id="specialCharactersInfo" />
     <input  type="button" style="width: 100px" onclick="prepSubmit()" value="$i18n.getString( "save" )" />
     <input type="button" id ="btnBack" name ="btnBack" value="Back" style="width:8em" onclick="window.location.href='SMSCommands.action'"/>
 </form>
\ No newline at end of file