← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8510: Fixed bug with validation of new messages

 

Merge authors:
  Lars Helge Øverland (larshelge)
------------------------------------------------------------
revno: 8510 [merge]
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-10-12 16:52:37 +0200
message:
  Fixed bug with validation of new messages
modified:
  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
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.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-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	2012-10-11 19:54:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2012-10-12 14:51:51 +0000
@@ -1,9 +1,7 @@
 
-var selectedOrganisationUnits = [];
-
-function selectOrganisationUnit__( units )
+function submitMessage()
 {
-	selectedOrganisationUnits = units;
+	$( "#messageForm" ).submit();
 }
 
 function removeMessage( id )
@@ -21,19 +19,22 @@
 	var subject = $( "#subject" ).val();
 	var text = $( "#text" ).val();
 
-    if( $( "#selectionTree" ).find( ".selected" ).length == 0 && $( "#recipients" ).val().length == 0 )
-    {
-        setHeaderMessage( i18n_select_one_or_more_recipients );
-        return false;
-    }
+	if ( isDefined( selectionTreeSelection ) && $( "#recipients" ).length )
+	{
+	    if ( !( selectionTreeSelection.isSelected() || $( "#recipients" ).val().length ) )
+	    {
+	        setHeaderMessage( i18n_select_one_or_more_recipients );
+	        return false;
+	    }
+	}
 
-	if ( subject == null || subject.trim() == '' )
+	if ( subject == null || subject.trim().length == 0 )
 	{
 		setHeaderMessage( i18n_enter_subject );
 		return false;
 	}
 	
-	if ( text == null || text.trim() == '' )
+	if ( text == null || text.trim().length == 0 )
 	{
 		setHeaderMessage( i18n_enter_text );
 		return false;

=== 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	2012-10-12 14:20:49 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/readMessage.vm	2012-10-12 14:35:37 +0000
@@ -49,7 +49,7 @@
 
 <input type="hidden" id="conversationId" value="${conversation.id}"/>
 
-<div class="messageDiv horizontalMenu" style="padding:10px 0 40px 0">
+<div class="messageDiv horizontalMenu">
 <ul>
 <li><a class="greyButtonLink" href="unreadMessage.action?id=${conversation.id}">$i18n.getString( 'mark_unread' )</a></li>
 <li><a class="greyButtonLink" href="removeMessageRedirect.action?id=${conversation.id}">$i18n.getString( 'remove' )</a></li>

=== 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	2012-10-08 12:47:00 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendFeedback.vm	2012-10-12 14:51:51 +0000
@@ -5,7 +5,7 @@
 
 <h3>$i18n.getString( "write_new_feedback" )</h3>
 
-<form action="sendFeedback.action" method="post" onsubmit="return validateMessage()">
+<form id="messageForm" action="sendFeedback.action" method="post" onsubmit="return validateMessage()">
 
 <table>
 
@@ -20,9 +20,13 @@
 </tr>
 
 <tr>
+<td colspan="2" style="height:10px"></td>
+</tr>
+
+<tr>
 <td></td>
-<td><input type="submit" value="$i18n.getString( 'send' )" style="width:120px">
-<input type="button" value="$i18n.getString( 'discard' )"  style="width:120px" onclick="window.location.href='message.action'"></td>
+<td><a class="blueButtonLink" href="javascript:submitMessage()">$i18n.getString( 'send' )</a>
+<a class="greyButtonLink" href="message.action">$i18n.getString( 'discard' )</a></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	2012-10-11 19:54:10 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/sendMessage.vm	2012-10-12 14:51:51 +0000
@@ -34,7 +34,7 @@
 
 <h3>$i18n.getString( "write_new_message" )#if( ${recipient} ) $i18n.getString( "to" ) $encoder.htmlEncode( ${recipient.name} )#end </h3>
 
-<form action="sendMessage.action" method="post" onsubmit="return validateMessage()">
+<form id="messageForm" action="sendMessage.action" method="post" onsubmit="return validateMessage()">
 
 <table>
 
@@ -64,9 +64,13 @@
 </tr>
 
 <tr>
+<td colspan="2" style="height:10px"></td>
+</tr>
+
+<tr>
 <td></td>
-<td><input type="submit" value="$i18n.getString( 'send' )" style="width: 120px;">
-<input type="button" value="$i18n.getString( 'discard' )"  style="width: 120px;" onclick="window.location.href='message.action'"></td>
+<td><a class="blueButtonLink" href="javascript:submitMessage()">$i18n.getString( 'send' )</a>
+<a class="greyButtonLink" href="message.action">$i18n.getString( 'discard' )</a></td>
 </tr>
 
 </table>

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-10-12 14:30:56 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/style/dashboard.css	2012-10-12 14:35:37 +0000
@@ -254,8 +254,8 @@
 {
   width: 700px;
   border-bottom: 1px solid #cccccc; 
-  margin-bottom: 15px;
-  padding-bottom: 15px;
+  padding-top: 10px;
+  padding-bottom: 35px;
 }
 
 .messageBottomDiv
@@ -263,7 +263,7 @@
   width: 700px;
   border-top: 1px solid #cccccc; 
   margin-top: 20px;
-  padding-top: 15px;
+  padding-top: 18px;
   margin-bottom: 20px;
   padding-bottom: 15px;
 }