dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13340
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4253: Added validation for messages
Merge authors:
Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 4253 [merge]
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-08-03 14:14:53 +0200
message:
Added validation for messages
modified:
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendFeedback.vm
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.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-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2011-06-14 19:13:54 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/org/hisp/dhis/dashboard/i18n_module.properties 2011-08-03 12:14:53 +0000
@@ -31,4 +31,7 @@
read = Read
confirm_delete_message = Are you sure you want to delete the message?
unread_messages = unread messages
-unread_message = unread message
\ No newline at end of file
+unread_message = unread message
+discard = Discard
+enter_subject = Please enter a subject
+enter_text = Please enter text
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js 2011-06-22 18:29:52 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js 2011-08-03 12:14:53 +0000
@@ -1,3 +1,11 @@
+
+var selectedOrganisationUnits = [];
+
+function selectOrganisationUnit__( units )
+{
+ selectedOrganisationUnits = units;
+}
+
function removeMessage( id )
{
removeItem( id, "", i18n_confirm_delete_message, "removeMessage.action" );
@@ -7,3 +15,23 @@
{
window.location.href = "readMessage.action?id=" + id;
}
+
+function validateMessage()
+{
+ var subject = $( '#subject' ).val();
+ var text = $( '#text' ).val();
+
+ if ( subject == null || subject.trim() == '' )
+ {
+ setHeaderMessage( i18n_enter_subject );
+ return false;
+ }
+
+ if ( text == null || text.trim() == '' )
+ {
+ setHeaderMessage( i18n_enter_text );
+ return false;
+ }
+
+ return true;
+}
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm 2011-08-03 10:05:08 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm 2011-08-03 11:03:01 +0000
@@ -1,17 +1,4 @@
-<div style="border-bottom: 1px solid #c0c0c0; margin-bottom:15px; padding-bottom:15px; width:50%;">
-<input type="button" value="$i18n.getString( 'mark_unread' )" onclick="window.location.href='unreadMessage.action?id=${message.id}'" style="width:120px">
-<input type="button" value="$i18n.getString( 'remove' )" onclick="window.location.href='removeMessageRedirect.action?id=${message.id}'" style="width:120px">
-<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='message.action'" style="width:120px">
-</div>
-
-<h3>$encoder.htmlEncode( $message.message.subject )</h3>
-
-<div class="messageDiv"><span class="bold" style="cursor:pointer" onclick="showSenderInfo( ${message.message.sender.id} )">$encoder.htmlEncode( $message.message.sender.name )</span>
-<span style="color:#606060">$format.formatDate( $message.messageDate )</span></div>
-
-<div style="margin-bottom:20px; width:50%;">$encoder.htmlEncode( $message.message.text )</div>
-
<div id="senderInfo" style="display:none" class="page">
<h3>$message.message.sender.name</h3>
<table>
@@ -29,3 +16,17 @@
</tr>
</table>
</div>
+
+<div style="border-bottom: 1px solid #cccccc; margin-bottom:15px; padding-bottom:15px; width:50%;">
+<input type="button" value="$i18n.getString( 'mark_unread' )" onclick="window.location.href='unreadMessage.action?id=${message.id}'" style="width:120px">
+<input type="button" value="$i18n.getString( 'remove' )" onclick="window.location.href='removeMessageRedirect.action?id=${message.id}'" style="width:120px">
+<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='message.action'" style="width:120px">
+</div>
+
+<h3>$encoder.htmlEncode( $message.message.subject )</h3>
+
+<div class="messageDiv"><span class="bold" style="cursor:pointer" onclick="showSenderInfo( ${message.message.sender.id} )">$encoder.htmlEncode( $message.message.sender.name )</span>
+<span style="color:#606060">$format.formatDate( $message.messageDate )</span></div>
+
+<div style="border-bottom: 1px solid #cccccc; margin-bottom:15px; padding-bottom:15px; width:50%;">$encoder.htmlEncode( $message.message.text )</div>
+
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendFeedback.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendFeedback.vm 2011-06-14 19:13:54 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendFeedback.vm 2011-08-03 12:14:53 +0000
@@ -1,24 +1,28 @@
+<script type="text/javascript">
+var i18n_enter_subject = '$encoder.jsEscape( $i18n.getString( "enter_subject" ), "'")';
+var i18n_enter_text = '$encoder.jsEscape( $i18n.getString( "enter_text" ), "'")';
+</script>
<h3>$i18n.getString( "write_new_feedback" )</h3>
-<form action="sendFeedback.action" method="post">
+<form action="sendFeedback.action" method="post" onsubmit="return validateMessage()">
<table>
<tr>
<td>$i18n.getString( "subject" )</td>
-<td><input type="text" name="subject" style="width:495px"></td>
+<td><input type="text" id="subject" name="subject" style="width:495px"></td>
</tr>
<tr>
<td>$i18n.getString( "text" )</td>
-<td><textarea name="text" style="width:495px;height:200px"></textarea></td>
+<td><textarea id="text" name="text" style="width:495px;height:200px"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="$i18n.getString( 'send' )" style="width:120px">
-<input type="button" value="$i18n.getString( 'cancel' )" style="width:120px" onclick="window.location.href='message.action'"></td>
+<input type="button" value="$i18n.getString( 'discard' )" style="width:120px" onclick="window.location.href='message.action'"></td>
</tr>
</table>
=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm 2011-06-14 19:13:54 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm 2011-08-03 12:14:53 +0000
@@ -1,7 +1,11 @@
+<script type="text/javascript">
+var i18n_enter_subject = '$encoder.jsEscape( $i18n.getString( "enter_subject" ), "'")';
+var i18n_enter_text = '$encoder.jsEscape( $i18n.getString( "enter_text" ), "'")';
+</script>
<h3>$i18n.getString( "write_new_message" )</h3>
-<form action="sendMessage.action" method="post">
+<form action="sendMessage.action" method="post" onsubmit="return validateMessage()">
<table>
@@ -14,18 +18,18 @@
<tr>
<td>$i18n.getString( "subject" )</td>
-<td><input type="text" name="subject" style="width:495px"></td>
+<td><input type="text" id="subject" name="subject" style="width:495px"></td>
</tr>
<tr>
<td>$i18n.getString( "text" )</td>
-<td><textarea name="text" style="width:495px;height:200px"></textarea></td>
+<td><textarea id="text" name="text" style="width:495px;height:200px"></textarea></td>
</tr>
<tr>
<td></td>
<td><input type="submit" value="$i18n.getString( 'send' )" style="width:120px">
-<input type="button" value="$i18n.getString( 'cancel' )" style="width:120px" onclick="window.location.href='message.action'"></td>
+<input type="button" value="$i18n.getString( 'discard' )" style="width:120px" onclick="window.location.href='message.action'"></td>
</tr>
</table>