dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13531
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4360: Moved logic for displaying user messages from data entry to commons
------------------------------------------------------------
revno: 4360
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-08-18 19:28:45 +0200
message:
Moved logic for displaying user messages from data entry to commons
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java
--
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-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-08-17 15:05:47 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-08-18 17:28:45 +0000
@@ -500,22 +500,11 @@
function setHeaderMessage( message )
{
$( 'div#headerMessage' ).html( message );
- $( 'div#headerMessage' ).slideDown( 'fast' );
-}
-
-function getHeaderMessage()
-{
- return $( 'div#headerMessage' ).html();
-}
-
-/**
- * Updates the text in the header message div with the message.
- *
- * @param message the message.
- */
-function updateHeaderMessage( message )
-{
- $( 'div#headerMessage' ).html( message );
+
+ if ( isHeaderMessageHidden() )
+ {
+ $( 'div#headerMessage' ).slideDown( 'fast' );
+ }
}
/**
@@ -527,17 +516,11 @@
function setHeaderWaitMessage( message )
{
$( 'div#headerMessage' ).html( message + " " + _loading_bar_html );
- $( 'div#headerMessage' ).slideDown( 'fast' );
-}
-
-/**
- * Updates the text in the header message div with the message.
- *
- * @param message the message.
- */
-function updateHeaderWaitMessage( message )
-{
- $( 'div#headerMessage' ).html( message + " " + _loading_bar_html );
+
+ if ( isHeaderMessageHidden() )
+ {
+ $( 'div#headerMessage' ).slideDown( 'fast' );
+ }
}
/**
@@ -549,7 +532,7 @@
window.clearTimeout( headerMessageTimeout ); // Clear waiting invocations
- headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", 3000 );
+ headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", 5000 );
}
/**
@@ -561,21 +544,7 @@
window.clearTimeout( headerMessageTimeout ); // Clear waiting invocations
- headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", 3000 );
-}
-
-/**
- * Sets the header message and hides it after the given seconds, default as 3s.
- */
-function setHeaderTimeDelayMessage( message, timing )
-{
- if ( timing == undefined ) { setHeaderDelayMessage( message ); return;}
-
- setHeaderMessage( message );
-
- window.clearTimeout( headerMessageTimeout ); // Clear waiting invocations
-
- headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", timing );
+ headerMessageTimeout = window.setTimeout( "hideHeaderMessage();", 5000 );
}
/**
@@ -587,9 +556,7 @@
}
/**
- * Is header message visible.
- *
- * @returns true if visible, false is hidden
+ * Indicates whether the header message is visible.
*/
function isHeaderMessageVisible()
{
@@ -597,9 +564,7 @@
}
/**
- * Is header message hidden.
- *
- * @returns true if hidden, false is visible
+ * Indicates whether the header message is not visible.
*/
function isHeaderMessageHidden()
{
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2011-08-18 12:59:54 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/org/hisp/dhis/de/i18n_module.properties 2011-08-18 17:28:45 +0000
@@ -125,12 +125,12 @@
to = to
on = On
value = Value
-no_response_from_server = No response from server. Please check connectivity and try again.
+no_response_from_server = No response from server, please check connectivity and try again
save_comment = Save comment
operation_not_available_offline = This operation is not available in off-line mode
online_notification = You are online
-offline_notification = You are offline - data will be stored locally
-need_to_sync_notification = There is data stored locally, please sync with server
-sync_now = Sync
+offline_notification = You are offline, data will be stored locally
+need_to_sync_notification = There is data stored locally, please upload to server
+sync_now = Upload
uploading_data_notification = Uploading locally stored data to the server
-ajax_login_failed = Login failed, check your username and password and try again.
\ No newline at end of file
+ajax_login_failed = Login failed, check your username and password and try again
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-18 16:40:36 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2011-08-18 17:28:45 +0000
@@ -69,43 +69,23 @@
if ( storageManager.hasLocalData() ) {
var message = i18n_need_to_sync_notification + '<button id="sync_button" type="button">' + i18n_sync_now + '</button>';
- if ( isHeaderMessageVisible() )
- {
- updateHeaderMessage( message );
- }
- else
- {
- setHeaderMessage( message );
- }
+ setHeaderMessage( message );
$( '#sync_button' ).bind( 'click', uploadLocalData );
}
- else if ( isHeaderMessageVisible() )
- {
- updateHeaderMessage( i18n_online_notification );
- }
else
{
setHeaderMessage( i18n_online_notification );
}
}
else {
- if ( isHeaderMessageVisible() ) {
- updateHeaderMessage( '<form style="display: inline;"><label for="username">Username</label><input name="username" id="username" type="text" size="10"/><label for="password">Password</label><input name="password" id="password" type="password" size="10"/><button id="login_button" type="button">Login</button></form>' );
- ajax_login();
- } else {
- setHeaderMessage( '<form style="display: inline;"><label for="username">Username</label><input name="username" id="username" type="text" size="10"/><label for="password">Password</label><input name="password" id="password" type="password" size="10"/><button id="login_button" type="button">Login</button></form>' );
- ajax_login();
- }
+ setHeaderMessage( '<form style="display:inline;"><label for="username">Username</label><input name="username" id="username" type="text" size="10"/><label for="password">Password</label><input name="password" id="password" type="password" size="10"/><button id="login_button" type="button">Login</button></form>' );
+ ajax_login();
}
} );
$( document ).bind( 'dhis2.offline', function() {
- if ( isHeaderMessageVisible() ) {
- updateHeaderMessage( i18n_offline_notification );
- } else {
- setHeaderMessage( i18n_offline_notification );
- }
+ setHeaderMessage( i18n_offline_notification );
} );
dhis2.availability.startAvailabilityCheck();
@@ -193,14 +173,7 @@
if ( array.length < 1 )
{
- if ( isHeaderMessageVisible() )
- {
- updateHeaderMessage(i18n_online_notification);
- }
- else
- {
- setHeaderMessage(i18n_online_notification);
- }
+ setHeaderMessage( i18n_online_notification );
}
}
});
@@ -209,14 +182,7 @@
(function pushDataValues( array ) {
if ( array.length < 1 )
{
- if ( isHeaderMessageVisible() )
- {
- updateHeaderMessage(i18n_online_notification);
- }
- else
- {
- setHeaderMessage(i18n_online_notification);
- }
+ setHeaderMessage( i18n_online_notification );
pushCompleteDataSets(completeDataSetsArray);
@@ -243,14 +209,7 @@
}
else
{
- if ( isHeaderMessageVisible() )
- {
- updateHeaderMessage(i18n_online_notification);
- }
- else
- {
- setHeaderMessage(i18n_online_notification);
- }
+ setHeaderMessage( i18n_online_notification );
}
}
} );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java 2011-06-10 11:47:41 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/java/org/hisp/dhis/settings/action/system/GetSystemSettingsAction.java 2011-08-18 17:28:45 +0000
@@ -37,6 +37,7 @@
import org.hisp.dhis.configuration.ConfigurationService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.dataelement.comparator.DataElementGroupNameComparator;
import org.hisp.dhis.options.SystemSettingManager;
import org.hisp.dhis.options.style.StyleManager;
import org.hisp.dhis.period.PeriodService;
@@ -210,6 +211,8 @@
dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
+ Collections.sort( dataElementGroups, new DataElementGroupNameComparator() );
+
periodTypes = new ArrayList<PeriodType>( periodService.getAllPeriodTypes() );
userGroups = new ArrayList<UserGroup>( userGroupService.getAllUserGroups() );