dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #30604
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15552: Fixed bug - The Days when to send message isn't save if this values is nagetive in program remind...
------------------------------------------------------------
revno: 15552
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-06-04 19:38:43 +0800
message:
Fixed bug - The Days when to send message isn't save if this values is nagetive in program reminder message template.
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programReminder.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.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-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm 2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addProgramReminder.vm 2014-06-04 11:38:43 +0000
@@ -51,17 +51,17 @@
</td>
</tr>
<tr>
- <td><label for="daysAllowedSendMessage">$i18n.getString( "send_message" )</label></td>
- <td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage"
+ <td><label for="days">$i18n.getString( "send_message" )</label></td>
+ <td><input type="text" id="days" name="days"
class="{validate:{required:true,number:true}}"
- onkeyup='setRealDays();' style="width:100px;"
- realvalue="$!reminder.daysAllowedSendMessage" />
+ onkeyup='setRealDays();' style="width:100px;" />
$i18n.getString('days')
<select id='time' name='time' onchange='setRealDays();' style="width:100px;">
<option value='1' >$i18n.getString('before')</option>
<option value='-1' >$i18n.getString('after')</option>
</select>
$i18n.getString('scheduled_date')
+ <input type="hidden" id="daysAllowedSendMessage" name="daysAllowedSendMessage" />
</td>
</tr>
<tr>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programReminder.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programReminder.js 2014-04-04 12:59:24 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programReminder.js 2014-06-04 11:38:43 +0000
@@ -50,11 +50,19 @@
programId: getFieldValue('programId')
}, function( json ) {
setInnerHTML('nameField', json.reminder.name);
- setInnerHTML('daysAllowedSendMessageField', json.reminder.daysAllowedSendMessage);
+
+ var days = json.reminder.daysAllowedSendMessage;
+ if( eval(days)>=0 ){
+ setInnerHTML('daysAllowedSendMessageField', days + " " + i18n_days_before);
+ }
+ else{
+ setInnerHTML('daysAllowedSendMessageField', -1 * eval(days) + " " + i18n_days_after);
+ }
+
setInnerHTML('templateMessageField', json.reminder.templateMessage);
setInnerHTML('dateToCompareField', json.reminder.dateToCompare);
- var map = sendToMap();
+ var map = recipientsMap();
setInnerHTML( 'sendToField', map[json.reminder.sendTo] );
var whenToSend = i18n_days_scheduled;
@@ -73,14 +81,16 @@
else if( json.reminder.whenToSend=='3'){
whenToSend = i18n_both;
}
- setInnerHTML('messageTypeField', json.reminder.messageType);
+
+ map = messageTypeMap();
+ setInnerHTML('messageTypeField', map[json.reminder.messageType]);
setInnerHTML('userGroupField', json.reminder.userGroup);
showDetails();
});
}
-function sendToMap()
+function recipientsMap()
{
var typeMap = [];
typeMap['1'] = i18n_tracked_entity_sms_only;
@@ -91,6 +101,15 @@
return typeMap;
}
+function messageTypeMap()
+{
+ var typeMap = [];
+ typeMap['1'] = i18n_direct_sms;
+ typeMap['2'] = i18n_message;
+ typeMap['3'] = i18n_both;
+ return typeMap;
+}
+
function showHideUserGroup() {
jQuery(".sendTo").each(function( i, item ) {
var numb = i + 1;
@@ -145,9 +164,9 @@
}
function setRealDays( ) {
- var daysAllowedSendMessage = jQuery("#daysAllowedSendMessage");
+ var days = jQuery("#days");
var time = jQuery("#time option:selected ").val();
- daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
+ jQuery("#daysAllowedSendMessage").val(time * eval(days).val());
}
function onchangeUserGroup() {
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js 2014-06-04 11:14:18 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/programStageReminder.js 2014-06-04 11:38:43 +0000
@@ -108,6 +108,7 @@
typeMap['3'] = i18n_both;
return typeMap;
}
+
function showHideUserGroup() {
jQuery(".sendTo").each(function( i, item ) {
var numb = i + 1;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm 2014-05-30 08:04:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/programReminder.vm 2014-06-04 11:38:43 +0000
@@ -48,7 +48,7 @@
<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="daysAllowedSendMessageField"></span> $i18n.getString("days_before")</p>
+ <p><label class="bold">$i18n.getString( "send_message" ):</label><br><span id="daysAllowedSendMessageField"></span></p>
<p><label class="bold">$i18n.getString( "message" ):</label><br><span id="templateMessageField"></span></p>
<p><label class="bold">$i18n.getString( "date_to_compare" ):</label><br><span id="dateToCompareField"></span></p>
<p><label class="bold">$i18n.getString( "recipients" ):</label><br><span id="sendToField"></span></p>
@@ -86,4 +86,6 @@
var i18n_direct_sms = '$encoder.jsEscape( $i18n.getString( "direct_sms" ) , "'")';
var i18n_message = '$encoder.jsEscape( $i18n.getString( "message" ) , "'")';
var i18n_both = '$encoder.jsEscape( $i18n.getString( "both" ) , "'")';
+ var i18n_days_before = '$encoder.jsEscape( $i18n.getString( "days_before" ) , "'")';
+ var i18n_days_after = '$encoder.jsEscape( $i18n.getString( "days_after" ) , "'")';
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm 2014-06-02 02:07:05 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateProgramReminder.vm 2014-06-04 11:38:43 +0000
@@ -90,12 +90,11 @@
#set($time = '-1')
#set($value=-1 * $value)
#end
- <td><label for="daysAllowedSendMessage">$i18n.getString( "send_message" )</label></td>
- <td><input type="text" id="daysAllowedSendMessage" name="daysAllowedSendMessage"
+ <td><label for="days">$i18n.getString( "send_message" )</label></td>
+ <td><input type="text" id="days" name="days"
class="{validate:{required:true,number:true}}" value="$!value"
onkeyup='setRealDays();' style="width:100px;"
- #if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end
- realvalue="$!reminder.daysAllowedSendMessage" />
+ #if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end />
$i18n.getString('days')
<select id='time' name='time' onchange='setRealDays();' style="width:100px;"
#if($!reminder.whenToSend==1 || $!reminder.whenToSend==3 ) disabled #end >
@@ -103,6 +102,7 @@
<option value='-1' #if($time=='-1') selected #end >$i18n.getString('after')</option>
</select>
$i18n.getString('scheduled_date')
+ <input type="hidden" id="daysAllowedSendMessage" name="daysAllowedSendMessage" value="$!reminder.daysAllowedSendMessage" />
</td>
</tr>
<tr>