dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33691
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17246: Add context menu for Command management form in Mobile Configuration; add label tag for Add comma...
------------------------------------------------------------
revno: 17246
committer: Tran Chau<tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-10-23 23:38:54 +0700
message:
Add context menu for Command management form in Mobile Configuration; add label tag for Add command; Add checking duplicate name for commands.
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/ValidateSMSCommandAction.java
modified:
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-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/DeleteSMSCommandAction.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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties
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
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/sms-commands.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/style/dhis-web-maintenance-mobile.css
--
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/SMSCommandService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandService.java 2014-10-23 16:38:54 +0000
@@ -59,4 +59,6 @@
void deleteCodeSet( Set<SMSCode> codes );
int countDataSetSmsCommands( DataSet dataSet );
+
+ SMSCommand getSMSCommand( String name );
}
=== 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 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/smscommand/SMSCommandStore.java 2014-10-23 16:38:54 +0000
@@ -57,4 +57,6 @@
void deleteCodeSet( Set<SMSCode> codes );
int countDataSetSmsCommands( DataSet dataSet );
+
+ SMSCommand getSMSCommand( String name );
}
=== 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 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/sms/hibernate/HibernateSMSCommandStore.java 2014-10-23 16:38:54 +0000
@@ -102,6 +102,20 @@
}
@Override
+ public SMSCommand getSMSCommand( String name )
+ {
+ Criteria criteria = sessionFactory.getCurrentSession().createCriteria( SMSCommand.class );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ if ( criteria.list() != null && criteria.list().size() > 0 )
+ {
+ return (SMSCommand) criteria.list().get( 0 );
+ }
+
+ return null;
+ }
+
+ @Override
@Transactional
public void delete( SMSCommand cmd )
{
=== 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 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/smscommand/DefaultSMSCommandService.java 2014-10-23 16:38:54 +0000
@@ -69,6 +69,12 @@
}
@Override
+ public SMSCommand getSMSCommand( String name )
+ {
+ return smsCommandStore.getSMSCommand( name );
+ }
+
+ @Override
public void save( Set<SMSCode> codes )
{
smsCommandStore.save( codes );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/DeleteSMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/DeleteSMSCommandAction.java 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/DeleteSMSCommandAction.java 2014-10-23 16:38:54 +0000
@@ -35,35 +35,38 @@
public class DeleteSMSCommandAction
implements Action
{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
private SMSCommandService smsCommandService;
- private int deleteCommandId;
+ public void setSmsCommandService( SMSCommandService smsCommandService )
+ {
+ this.smsCommandService = smsCommandService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
@Override
public String execute()
throws Exception
{
- smsCommandService.delete( smsCommandService.getSMSCommand( deleteCommandId ) );
+ smsCommandService.delete( smsCommandService.getSMSCommand( id ) );
+
return SUCCESS;
}
- public int getDeleteCommandId()
- {
- return deleteCommandId;
- }
-
- public void setDeleteCommandId( int deleteCommandId )
- {
- this.deleteCommandId = deleteCommandId;
- }
-
- public SMSCommandService getSmsCommandService()
- {
- return smsCommandService;
- }
-
- public void setSmsCommandService( SMSCommandService smsCommandService )
- {
- this.smsCommandService = smsCommandService;
- }
}
=== 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 2014-10-16 06:17:19 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/EditSMSCommandForm.java 2014-10-23 16:38:54 +0000
@@ -56,6 +56,7 @@
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
+
private SMSCommandService smsCommandService;
public void setSmsCommandService( SMSCommandService smsCommandService )
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/ValidateSMSCommandAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/ValidateSMSCommandAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/java/org/hisp/dhis/mobile/action/smscommand/ValidateSMSCommandAction.java 2014-10-23 16:38:54 +0000
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2004-2014, 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.mobile.action.smscommand;
+
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.smscommand.SMSCommand;
+import org.hisp.dhis.smscommand.SMSCommandService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ ValidateSMSCommandAction.java Oct 23, 2014 11:05:06 PM $
+ */
+public class ValidateSMSCommandAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private SMSCommandService smsCommandService;
+
+ public void setSmsCommandService( SMSCommandService smsCommandService )
+ {
+ this.smsCommandService = smsCommandService;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ {
+ if ( name != null )
+ {
+ SMSCommand match = smsCommandService.getSMSCommand( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_used" );
+
+ return ERROR;
+ }
+ }
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-10-23 11:57:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/META-INF/dhis/beans.xml 2014-10-23 16:38:54 +0000
@@ -145,5 +145,11 @@
<bean id="org.hisp.dhis.mobile.action.incoming.ProcessingSendQuickSMSAction"
class="org.hisp.dhis.mobile.action.incoming.ProcessingSendQuickSMSAction"
scope="prototype"/>
-
+
+ <bean id="org.hisp.dhis.mobile.action.smscommand.ValidateSMSCommandAction"
+ class="org.hisp.dhis.mobile.action.smscommand.ValidateSMSCommandAction"
+ scope="prototype">
+ <property name="smsCommandService" ref="smsCommandService" />
+ </bean>
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2014-10-23 13:32:39 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/org/hisp/dhis/mobile/i18n_module.properties 2014-10-23 16:38:54 +0000
@@ -114,14 +114,12 @@
data_element_category_combination=Data Element Category Combination
sms_command_validation_alert=Fix validation problems before you save
command_management=Command management
-code=Code
-name=Name:
-dataset=Data set:
-parser=Parser:
-userGroup= User Group:
+dataset=Data set
+parser=Parser
+userGroup=User Group
selected_dataset=Selected data set
code_value_separator=Code and value Separator
-no_codes_message=Reply message if no codes are sent (only the command):
+no_codes_message=Reply message if no codes are sent (only the command)
validation_error_space=*White space not allowed
key_value_parser=Key Value Parser
j2me_parser=J2ME Parser
@@ -145,4 +143,9 @@
receive_at_least_one_datavalue=Receive at least one data value
do_not_mark_complete=Do not mark as complete
receive_all_datavalue=Receive all data value
-success_message=Success Message
\ No newline at end of file
+success_message=Success Message
+confirm_delete_command=Are you sure you want to delete this command?
+confirm_message=Confirm Message
+TRACKED_ENTITY_REGISTRATION_PARSER=Tracked entity registration parser
+tracked_entity_attribute=Tracked entity attribute
+name_in_used=Name is in use
\ No newline at end of file
=== 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 2014-10-23 11:57:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/resources/struts.xml 2014-10-23 16:38:54 +0000
@@ -157,6 +157,7 @@
<param name="page">/dhis-web-maintenance-mobile/smscommand/new-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>
@@ -180,9 +181,18 @@
</action>
<action name="deleteSMSCommand" class="org.hisp.dhis.mobile.action.smscommand.DeleteSMSCommandAction">
- <result name="success" type="redirect">SMSCommands.action</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm
+ </result>
<param name="requiredAuthorities">F_MOBILE_SENDSMS</param>
</action>
+
+ <action name="validateSMSCommand"
+ class="org.hisp.dhis.mobile.action.smscommand.ValidateSMSCommandAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">/dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
<!-- J2ME Client Update -->
=== 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 2014-09-10 04:36:51 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/javascript/command.js 2014-10-23 16:38:54 +0000
@@ -4,32 +4,43 @@
hideAll();
if ( value == 'KEY_VALUE_PARSER' || value == 'J2ME_PARSER') {
showById( "dataSetParser" );
+ enable("selectedDataSetID");
} else if ( value == 'ALERT_PARSER' || value == 'UNREGISTERED_PARSER' ) {
showById( "alertParser" );
+ enable("userGroupID");
} else if (value == 'ANONYMOUS_PROGRAM_PARSER') {
showById( "anonymousProgramParser" );
+ enable("programId");
} else if (value == 'TRACKED_ENTITY_REGISTRATION_PARSER') {
showById( "registrationParser" );
+ enable("selectedProgramId");
}
currentType = value;
}
function hideAll()
{
- hideById( "dataSetParser" );
- hideById( "alertParser" );
- hideById( "anonymousProgramParser" );
- hideById( "registrationParser" );
+ hideById( "dataSetParser" );
+ disable( "selectedDataSetID" );
+
+ hideById( "alertParser" );
+ disable( "userGroupID" );
+
+ hideById( "anonymousProgramParser" );
+ disable( "programId" );
+
+ hideById( "registrationParser" );
+ disable( "selectedProgramId" );
}
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" class="name {validate:{required:true}}" onblur="checkDuplicatedSpeCharName(this.value,'+rowId+')"/></td>'
- + '<td><input id="value'+rowId+'" name="value'+rowId+'" type="text" class="value {validate:{required:true}}" onblur="checkDuplicatedSpeCharValue(this.value, '+rowId+')"/>'
- + '<input type="button" value="remove" onclick="removeSpecialCharactersForm('+rowId+')"/></td>'
+ var contend = '<tr id="trSpecialCharacter' + rowId + '" name="trSpecialCharacter' + rowId + '" class="trSpecialCharacter">'
+ + '<td><input id="name' + rowId + '" name="name' + rowId + '" type="text" class="name {validate:{required:true}}" onblur="checkDuplicatedSpeCharName(this.value,' + rowId + ')" placeholder="' + i18_special_characters + '" )/></td>'
+ + '<td><input id="value' + rowId + '" name="value' + rowId + '" type="text" class="value {validate:{required:true}}" onblur="checkDuplicatedSpeCharValue(this.value, ' + rowId + ')" placeholder="' + i18_value + '"/>'
+ + '<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 2014-07-30 04:28:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/edit-sms-command.vm 2014-10-23 16:38:54 +0000
@@ -111,7 +111,14 @@
}
}
};
-
+ var i18_special_characters = '$encoder.jsEscape( $i18n.getString( "special_characters" ) , "'" )';
+ var i18_value = '$encoder.jsEscape( $i18n.getString( "value" ) , "'" )';
+
+ jQuery(document).ready(function() {
+ changeParserType( getFieldValue( 'parserType' ) );
+ validation( "updateSMSCommandForm" );
+ checkValueIsExist( "name", "validateSMSCommand.action", {id:"$selectedCommandID"});
+ });
</script>
<h3>$i18n.getString( "edit_command" )</h3>
@@ -120,32 +127,34 @@
<select id='speCharName' name="speCharName" multiple="multiple" class="hidden"></select>
<select id='speCharValue' name="speCharValue" multiple="multiple" class="hidden"></select>
<table>
- <thead>
- <tr>
- <th colspan="2">$i18n.getString( "command_details" )</th>
- </tr>
- </thead>
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "command_details" )</th>
+ </tr>
+ </thead>
<tr>
+ <td></td>
<td>
<input type="hidden" value="$selectedCommandID" name="selectedCommandID" />
</td>
</tr>
<tr>
- <td>$i18n.getString( "name" )</td>
- <td><input type="text" name="name" id="name" value="$smsCommand.name" style="width:20em" class="{validate:{required:true}}" /></td>
+ <td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" name="name" id="name" value="$smsCommand.name" class="{validate:{required:true}}" /></td>
</tr>
<tr>
- <td>$i18n.getString( "parser" )</td>
- <td>#if($smsCommand.parserType) $smsCommand.parserType #end</td>
+ <td><label for="parser">$i18n.getString( "parser" )</label></td>
+ <td>#if($smsCommand.parserType) $i18n.getString( "$smsCommand.parserType" ) #end</td>
</tr>
#if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' )
+ <tbody id="codes">
<tr>
- <td>$i18n.getString( "dataset" )</td>
+ <td><label for="dataset">$i18n.getString( "dataset" )</label></td>
<td>#if($smsCommand.dataset.name) $smsCommand.dataset.name #end</td>
</tr>
<tr>
- <td>$i18n.getString( "completeness_method" )</td>
+ <td><label for="completenessMethod">$i18n.getString( "completeness_method" )</label></td>
<td>
<select id="completenessMethod" name="completenessMethod">
<option value="1" #if($smsCommand.completenessMethod == 1) selected #end>$i18n.getString( "receive_all_datavalue" )</option>
@@ -155,45 +164,45 @@
</td>
</tr>
<tr>
- <td>Use current period for reporting</td>
- <td><input type="checkbox" name="currentPeriodUsedForReporting" #if($smsCommand.currentPeriodUsedForReporting) checked #end /></td>
+ <td><label for="currentPeriodUsedForReporting">Use current period for reporting</label></td>
+ <td><input type="checkbox" id='currentPeriodUsedForReporting' name="currentPeriodUsedForReporting" #if($smsCommand.currentPeriodUsedForReporting) checked #end /></td>
</tr>
<tr>
- <td>$i18n.getString( "code_value_separator" )</td>
+ <td><label for="separator">$i18n.getString( "code_value_separator" )</label></td>
<td>
- <input type="text" #if($smsCommand.separator) value="$smsCommand.separator" #end name="separator" style="width:20em" class="validate" />
+ <input type="text" #if($smsCommand.separator) value="$smsCommand.separator" #end id="separator" name="separator" class="validate" />
</td>
</tr>
<tr>
- <td style="width:130px">$i18n.getString( "no_codes_message" )</td>
- <td><textarea cols="35" type="text" name="defaultMessage">#if($smsCommand.defaultMessage)$smsCommand.defaultMessage#end</textarea></td>
- </tr>
- <tr>
- <td style="width:130px">$i18n.getString( "wrong_format_message" )</td>
- <td><textarea cols="35" type="text" name="wrongFormatMessage">#if($smsCommand.wrongFormatMessage)$smsCommand.wrongFormatMessage#end</textarea></td>
- </tr>
- <tr>
- <td style="width:130px">$i18n.getString( "no_user_message" )</td>
+ <td><label for="defaultMessage">$i18n.getString( "no_codes_message" )</label></td>
+ <td><textarea cols="35" type="text" id="defaultMessage" name="defaultMessage">#if($smsCommand.defaultMessage)$smsCommand.defaultMessage#end</textarea></td>
+ </tr>
+ <tr>
+ <td><label for="wrongFormatMessage">$i18n.getString( "wrong_format_message" )</label></td>
+ <td><textarea cols="35" type="text" id="wrongFormatMessage" name="wrongFormatMessage">#if($smsCommand.wrongFormatMessage)$smsCommand.wrongFormatMessage#end</textarea></td>
+ </tr>
+ <tr>
+ <td><label for="noUserMessage">$i18n.getString( "no_user_message" )</label></td>
<td><textarea cols="35" type="text" name="noUserMessage">#if($smsCommand.noUserMessage)$smsCommand.noUserMessage#end</textarea></td>
</tr>
<tr>
- <td style="width:130px">$i18n.getString( "more_than_one_orgunit_message" )</td>
- <td><textarea cols="35" type="text" name="moreThanOneOrgUnitMessage">#if($smsCommand.moreThanOneOrgUnitMessage)$smsCommand.moreThanOneOrgUnitMessage#end</textarea></td>
+ <td><label for="moreThanOneOrgUnitMessage">$i18n.getString( "more_than_one_orgunit_message" )</label></td>
+ <td><textarea cols="35" type="text" id="moreThanOneOrgUnitMessage" name="moreThanOneOrgUnitMessage">#if($smsCommand.moreThanOneOrgUnitMessage)$smsCommand.moreThanOneOrgUnitMessage#end</textarea></td>
</tr>
<tr>
- <td style="width:130px">$i18n.getString( "success_message" )</td>
- <td><textarea cols="35" type="text" name="successMessage">#if($smsCommand.successMessage)$smsCommand.successMessage#end</textarea></td>
+ <td><label for="successMessage">$i18n.getString( "success_message" )</label></td>
+ <td><textarea cols="35" type="text" id="successMessage" name="successMessage">#if($smsCommand.successMessage)$smsCommand.successMessage#end</textarea></td>
</tr>
#elseif( $smsCommand.parserType == 'ALERT_PARSER' || $smsCommand.parserType == 'UNREGISTERED_PARSER' )
<tr>
- <td>$i18n.getString( "userGroup" )</td>
+ <td><label for="userGroupID">$i18n.getString( "userGroup" )</label></td>
<td>
- <select name="userGroupID" >
+ <select id="userGroupID" name="userGroupID" >
#foreach( $userGroup in $userGroupList )
<option value="$userGroup.id" #if($smsCommand.userGroup == $userGroup) selected #end>$userGroup.name</option>
#end
@@ -201,25 +210,15 @@
</td>
</tr>
<tr>
- <td style="width:130px">Confirm Message: </td>
- <td><textarea cols="35" type="text" name="receivedMessage">#if($smsCommand.receivedMessage)$smsCommand.receivedMessage#end</textarea></td>
+ <td><label for="receivedMessage">$i18n.getString("confirm_message")</label></td>
+ <td><textarea cols="35" type="text" id="receivedMessage" name="receivedMessage">#if($smsCommand.receivedMessage)$smsCommand.receivedMessage#end</textarea></td>
</tr>
#end
- </table>
-
-
- </br>
- </br>
#if( $smsCommand.parserType == 'KEY_VALUE_PARSER' || $smsCommand.parserType == 'J2ME_PARSER' )
- <table id="codes">
- <col style="width:350px"/><col/>
- <thead>
- <tr>
- <th>$i18n.getString( "data_element_category_combination")</th>
- <th>$i18n.getString( "code" )</th>
- </tr>
- </thead>
+ <tr>
+ <th colspan='2'>$i18n.getString( "data_element_category_combination")</th>
+ </tr>
#set($index = 0)
#foreach( $dataElement in $dataElements)
#set($index = $index + 1)
@@ -230,8 +229,7 @@
#set ($str = ""+$dataElement.id+""+$x.id)
<tr class="trDataElementCode">
- <td>
- $dataElement.name $x.name
+ <td><label for="codeId$index">$dataElement.name $x.name</label>
</td>
<td>
<input type="hidden" id="codeId$index" name="codeId$index" value="$dataElement.id.$x.id"/>
@@ -241,42 +239,33 @@
#end
#else
<tr class="dataElementCode">
- <td>$dataElement.name</td>
- <td><input type="text" name="$dataElement.id"></td>
+ <td><label for="$dataElement.id">$dataElement.name</label></td>
+ <td><input type="text" id="$dataElement.id" name="$dataElement.id"></td>
</tr>
#end
#end
- </table>
- <table border="0">
- <col style="width:350px"/><col/>
- <thead>
- <tr>
- <th>$i18n.getString( "special_characters" )</th>
- <th>$i18n.getString( "value" )</th>
+ </tbody>
+ <tr>
+ <th colspan='2'>$i18n.getString( "special_characters" )</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" class="name {validate:{required:true}}" value="$specialCharacters.name" onblur="checkDuplicatedSpeCharName(this.value, $velocityCount)"/></td>
- <td><input type="text" id="value$velocityCount" name="value$velocityCount" class="value {validate:{required:true}}" value="$specialCharacters.value" onblur="checkDuplicatedSpeCharValue(this.value, $velocityCount)"/></td>
+ <td><input type="text" id="name$velocityCount" name="name$velocityCount" class="name {validate:{required:true}}" value="$specialCharacters.name" onblur="checkDuplicatedSpeCharName(this.value, $velocityCount)" placeholder='$i18n.getString( "special_characters" )'/></td>
+ <td><input type="text" id="value$velocityCount" name="value$velocityCount" class="value {validate:{required:true}}" value="$specialCharacters.value" onblur="checkDuplicatedSpeCharValue(this.value, $velocityCount)" placeholder='$i18n.getString( "value" )'/></td>
<td><input type="button" value="remove" onclick="removeSpecialCharactersForm($velocityCount)"/></input>
</tr>
#end
</tbody>
<tr>
<td col="2"><input type="button" value="$i18n.getString('add_more')" onclick="generateSpecialCharactersForm()"/><td>
- </tr>
- </table>
- #end
+ </tr> #end
#if( $smsCommand.parserType == 'TRACKED_ENTITY_REGISTRATION_PARSER' )
- <table id="codes">
- <col style="width:350px"/><col/>
- <thead>
+ <tbody id="codes">
<tr>
- <th>$i18n.getString( "tracked_entity_attribute")</th>
- <th>$i18n.getString( "code" )</th>
+ <th colspan='2'>$i18n.getString( "tracked_entity_attribute")</th>
</tr>
</thead>
#set($index = 0)
@@ -285,18 +274,21 @@
#set ($index = $index + 1)
<tr class="trackedEntityAttribute">
- <td>$attribute.name <input type="hidden" id="attId$index" name="attId$index" value="$attribute.id"/></td>
+ <td>
+ <label for="attCode$index">$attribute.name</label>
+ <input type="hidden" id="attId$index" name="attId$index" value="$attribute.id"/>
+ </td>
<td><input type="text" name="attCode$index" id="attCode$index" class="{validate:{required:true}}" value='$!codes["$attribute.id"]'></td>
</tr>
- #end
- </table>
+ #end
#end
+</table>
<br/>
<input type="hidden" name="codeDataelementOption" id="codeDataelementOption" />
<input type="hidden" name="specialCharactersInfo" id="specialCharactersInfo" />
<input type="hidden" name="trackedEntityAttributeCodes" id="trackedEntityAttributeCodes" />
<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'"/>
+ <input type="button" id="btnBack" name="btnBack" value="$i18n.getString('cancel')" style="width:8em" onclick="window.location.href='SMSCommands.action'"/>
</form>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm 2014-07-30 04:28:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/new-sms-command.vm 2014-10-23 16:38:54 +0000
@@ -4,6 +4,7 @@
jQuery(document).ready(function() {
changeParserType( getFieldValue( 'parserType' ) );
validation( "newSMSCommandForm" );
+ checkValueIsExist( "name", "validateSMSCommand.action");
});
</script>
<h3>Add command</h3>
@@ -16,15 +17,15 @@
<tr><th colspan="2">$i18n.getString( "command_details" )</th></tr>
</thead>
<tr>
- <td>$i18n.getString( "name" )</td>
+ <td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <input type="text" value="" id="name" name="name" style="width:20em" class="{validate:{required:true}}"/>
+ <input type="text" id="name" name="name" class="{validate:{required:true}}"/>
</td>
</tr>
<tr>
- <td>$i18n.getString( "parser" )</td>
+ <td><label for="parserType">$i18n.getString( "parser" )</label></td>
<td>
- <select id="parserType" name="parserType" style="width:100%;" onchange="changeParserType( this.value )">
+ <select id="parserType" name="parserType" onchange="changeParserType( this.value )">
#foreach( $type in $parserType )
<option value="$type">$i18n.getString( "$type" )</option>
#end
@@ -33,9 +34,9 @@
</tr>
<tbody id="dataSetParser">
<tr>
- <td>$i18n.getString( "dataset" )</td>
+ <td><label for="selectedDataSetID">$i18n.getString( "dataset" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select name="selectedDataSetID" >
+ <select id="selectedDataSetID" name="selectedDataSetID" class="{validate:{required:true}}">
#foreach( $dataSet in $dataSets )
<option value="$dataSet.id" #if ($SMSCommand.dataset.id == $dataSet.id) selected #end >$dataSet.displayName</option>
#end
@@ -46,9 +47,9 @@
<tbody id="alertParser">
<tr>
- <td>$i18n.getString( "userGroup" )</td>
+ <td><label for="userGroupID">$i18n.getString( "userGroup" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select name="userGroupID" >
+ <select id="userGroupID" name="userGroupID" class="{validate:{required:true}}" disabled >
#foreach( $userGroup in $userGroupList )
<option value="$userGroup.id">$userGroup.name</option>
#end
@@ -59,9 +60,9 @@
<tbody id="anonymousProgramParser">
<tr>
- <td>$i18n.getString( "program" )</td>
+ <td><label for="programId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select name="programId" >
+ <select id="programId" name="programId" class="{validate:{required:true}}" disabled >
#foreach( $anonymousProgram in $anonymousProgramList )
<option value="$userGroup.id">$anonymousProgram.name</option>
#end
@@ -72,9 +73,9 @@
<tbody id="registrationParser">
<tr>
- <td>$i18n.getString( "program" )</td>
+ <td><label for="selectedProgramId">$i18n.getString( "program" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select name="selectedProgramId" >
+ <select id="selectedProgramId" name="selectedProgramId" class="{validate:{required:true}}" disabled >
#foreach( $program in $programList )
<option value="$program.id">$program.name</option>
#end
@@ -82,11 +83,12 @@
</td>
</tr>
</tbody>
-
+ <tr><td> </td></tr>
<tr>
- <td colspan="2">
- <input id="save" type="submit" style="width: 100px" value="$i18n.getString( "save" )" />
- <input type="button" id ="btnBack" name ="btnBack" value="Back" style="width:8em" onclick="window.location.href='SMSCommands.action'"/>
+ <td></td>
+ <td>
+ <input id="save" type="submit" style="width: 100px" value="$i18n.getString( 'save' )" />
+ <input type="button" id ="btnBack" name ="btnBack" value="$i18n.getString( 'cancel' )" style="width:8em" onclick="window.location.href='SMSCommands.action'"/>
</td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/sms-commands.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/sms-commands.vm 2013-08-16 19:33:48 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-mobile/src/main/webapp/dhis-web-maintenance-mobile/smscommand/sms-commands.vm 2014-10-23 16:38:54 +0000
@@ -1,29 +1,49 @@
+<script>
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_command" ) , "'" )';
+ function showUpdateCommandForm( context ) {
+ location.href = 'editSMSCommand.action?selectedCommandID=' + context.id;
+ }
+
+ function removeCommand( context ) {
+ removeItem( context.id, context.name, i18n_confirm_delete, 'deleteSMSCommand.action' );
+ }
+ $(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+ });
+</script>
+
<h3>$i18n.getString( "command_management" )</h3>
+
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li data-enabled="canUpdate"><a data-target-fn="showUpdateCommandForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li data-enabled="canDelete"><a data-target-fn="removeCommand"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
-<tr>
- <td style="vertical-align:top">
- <table width="100%">
<tr>
<td >
- <input type="button" value="New command" onclick="window.location.href='newSMSCommand.action'" style="width:100px"/></a>
+ <input type="button" value="$i18n.getString('add_new')" onclick="window.location.href='newSMSCommand.action'" style="width:100px"/></a>
</td>
</tr>
</table>
<table class="listTable" id="listTable">
<thead>
<tr>
- <th>Name</th>
- <th>Edit</th>
- <th>Delete</th>
+ <th>$i18n.getString('name')</th>
</tr>
</thead>
<tbody id="list">
- #foreach( $command in $SMSCommands )
- <tr>
- <td height="35">$command.name </td>
- <td><a href="editSMSCommand.action?selectedCommandID=$command.id">Edit</a></td>
- <td><a href="deleteSMSCommand.action?deleteCommandId=$command.id">Delete</a></td>
- </tr>
+ #foreach( $command in $SMSCommands )
+ <tr id="tr${command.id}" data-id="$!command.id" data-name="$encoder.htmlEncode( $!command.name )"
+ data-can-update="$security.canUpdate( $command )"
+ data-can-delete="$security.canDelete( $command )">
+ <td>$encoder.htmlEncode( $!command.name )</td>
+ </tr>
#end
=== modified 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 2013-11-29 08:05:25 +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 2014-10-23 16:38:54 +0000
@@ -3,3 +3,7 @@
display: none;
}
+input[type='text'], select, textarea
+{
+ width:300px;
+}
\ No newline at end of file