dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33159
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16899: Formatting consistency
------------------------------------------------------------
revno: 16899
committer: Halvdan Hoem Grelland <halvdanhg@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-10-01 12:11:08 +0200
message:
Formatting consistency
modified:
dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js
--
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 2014-10-01 09:58:24 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js 2014-10-01 10:11:08 +0000
@@ -1,4 +1,3 @@
-
function submitMessage()
{
$( "#messageForm" ).submit();
@@ -18,29 +17,29 @@
var confirmed = window.confirm( i18n_confirm_delete_all_selected_messages );
- if ( confirmed )
+ if( confirmed )
{
setHeaderWaitMessage( i18n_deleting );
$.ajax(
- {
- url: "../api/messageConversations?" + $.param( { mc: messages }, true ),
- contentType: "application/json",
- dataType: "json",
- type: "DELETE",
- success: function( response )
{
- for( var i = 0 ; i < response.removed.length ; i++ )
- {
- $( "#messages" ).find( "[name='" + response.removed[i] + "']" ).remove();
+ url: "../api/messageConversations?" + $.param( { mc: messages }, true ),
+ contentType: "application/json",
+ dataType: "json",
+ type: "DELETE",
+ success: function( response )
+ {
+ for( var i = 0; i < response.removed.length; i++ )
+ {
+ $( "#messages" ).find( "[name='" + response.removed[i] + "']" ).remove();
+ }
+ setHeaderDelayMessage( i18n_messages_were_deleted );
+ },
+ error: function( response )
+ {
+ showErrorMessage( response.message, 3 );
}
- setHeaderDelayMessage( i18n_messages_were_deleted );
- },
- error: function( response )
- {
- showErrorMessage( response.message, 3 );
- }
- });
+ } );
}
}
@@ -52,21 +51,21 @@
}
$.ajax(
- {
- url: "../api/messageConversations/read",
- type: "POST",
- data: JSON.stringify( messages ),
- contentType: "application/json",
- dataType: "json",
- success: function( response )
- {
- toggleMessagesRead( response.markedRead );
- },
- error: function( response )
- {
- showErrorMessage( response.message, 3 );
- }
- });
+ {
+ url: "../api/messageConversations/read",
+ type: "POST",
+ data: JSON.stringify( messages ),
+ contentType: "application/json",
+ dataType: "json",
+ success: function( response )
+ {
+ toggleMessagesRead( response.markedRead );
+ },
+ error: function( response )
+ {
+ showErrorMessage( response.message, 3 );
+ }
+ } );
}
function markMessagesUnread( messages )
@@ -77,28 +76,28 @@
}
$.ajax(
- {
- url: "../api/messageConversations/unread",
- type: "POST",
- data: JSON.stringify( messages ),
- contentType: "application/json",
- dataType: "json",
- success: function( response )
- {
- toggleMessagesRead( response.markedUnread );
- },
- error: function( response )
- {
- showErrorMessage( response.message, 3 );
- }
- });
+ {
+ url: "../api/messageConversations/unread",
+ type: "POST",
+ data: JSON.stringify( messages ),
+ contentType: "application/json",
+ dataType: "json",
+ success: function( response )
+ {
+ toggleMessagesRead( response.markedUnread );
+ },
+ error: function( response )
+ {
+ showErrorMessage( response.message, 3 );
+ }
+ } );
}
function toggleMessagesRead( messageUids )
{
var messages = $( "#messages" );
- for( var i = 0 ; i < messageUids.length ; i++ )
+ for( var i = 0; i < messageUids.length; i++ )
{
messages.find( "[name='" + messageUids[i] + "']" ).toggleClass( "unread bold" );
messages.find( "input:checkbox" ).removeAttr( "checked" );
@@ -112,80 +111,80 @@
function validateMessage()
{
- var subject = $( "#subject" ).val();
- var text = $( "#text" ).val();
-
- 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().length == 0 )
- {
- setHeaderMessage( i18n_enter_subject );
- return false;
- }
-
- if ( text == null || text.trim().length == 0 )
- {
- setHeaderMessage( i18n_enter_text );
- return false;
- }
-
- return true;
+ var subject = $( "#subject" ).val();
+ var text = $( "#text" ).val();
+
+ 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().length == 0 )
+ {
+ setHeaderMessage( i18n_enter_subject );
+ return false;
+ }
+
+ if( text == null || text.trim().length == 0 )
+ {
+ setHeaderMessage( i18n_enter_text );
+ return false;
+ }
+
+ return true;
}
function toggleMetaData( id )
{
- $( "#metaData" + id ).toggle();
+ $( "#metaData" + id ).toggle();
}
function sendReply()
{
- var id = $( "#conversationId" ).val();
- var text = $( "#text" ).val();
-
- if ( text == null || text.trim() == '' )
- {
- setHeaderMessage( i18n_enter_text );
- return false;
- }
-
- $( "#replyButton" ).attr( "disabled", "disabled" );
-
- setHeaderWaitMessage( i18n_sending_message );
-
- $.postUTF8( "sendReply.action", { id:id, text:text }, function()
- {
- window.location.href = "readMessage.action?id=" + id;
- } );
+ var id = $( "#conversationId" ).val();
+ var text = $( "#text" ).val();
+
+ if( text == null || text.trim() == '' )
+ {
+ setHeaderMessage( i18n_enter_text );
+ return false;
+ }
+
+ $( "#replyButton" ).attr( "disabled", "disabled" );
+
+ setHeaderWaitMessage( i18n_sending_message );
+
+ $.postUTF8( "sendReply.action", { id: id, text: text }, function()
+ {
+ window.location.href = "readMessage.action?id=" + id;
+ } );
}
function toggleFollowUp( id, followUp )
{
- var imageId = "followUp" + id;
-
- var url = "toggleFollowUp.action?id=" + id;
-
- $.getJSON( url, function( json )
- {
- var imageSrc = json.message == "true" ? "../images/marked.png" : "../images/unmarked.png";
-
- $( "#" + imageId ).attr( "src", imageSrc );
- } );
+ var imageId = "followUp" + id;
+
+ var url = "toggleFollowUp.action?id=" + id;
+
+ $.getJSON( url, function( json )
+ {
+ var imageSrc = json.message == "true" ? "../images/marked.png" : "../images/unmarked.png";
+
+ $( "#" + imageId ).attr( "src", imageSrc );
+ } );
}
function formatItem( item )
{
- if ( item.id && item.id.indexOf("u:") != -1 )
+ if( item.id && item.id.indexOf( "u:" ) != -1 )
{
return '<img src="../icons/glyphicons_003_user.png" style="width: 12px; height: 12px; padding-right: 5px;"/>' + item.text;
}
- else if ( item.id && item.id.indexOf('ug:') != -1 )
+ else if( item.id && item.id.indexOf( 'ug:' ) != -1 )
{
return '<img src="../icons/glyphicons_043_group.png" style="width: 12px; height: 12px; padding-right: 5px;"/>' + item.text;
}