← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4265: Method for determining whether the DHIS server is accessible

 

------------------------------------------------------------
revno: 4265
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2011-08-08 20:21:36 +0200
message:
  Method for determining whether the DHIS server is accessible
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml


--
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-07-21 20:49:52 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js	2011-08-08 18:21:36 +0000
@@ -8,6 +8,23 @@
 var _loading_circle_html = "<img src='../images/ajax-loader-circle.gif'>";
 
 /**
+ * Determines whether the DHIS server can be accessed, ie. if the server
+ * is running (in the context of a remote server also if the network is up).
+ */
+function serverIsAccessible()
+{
+	$.ajax( {
+		url: "../dhis-web-commons-stream/ping.action",
+		success: function( data, textStatus, jqXHR ) {
+			return true;
+		},
+		error: function( jqXHR, textStatus, errorThrown ) {
+			return false;
+		}
+	} );
+}
+
+/**
  * Go back using the document.referrer.
  * 
  * @param defaultUrl if there is not document.referrer, use this url

=== modified file 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
--- dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-08-08 15:09:46 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml	2011-08-08 18:21:36 +0000
@@ -735,6 +735,10 @@
     <action name="loadDocument" class="org.hisp.dhis.commons.action.LoadDocumentAction">
       <result name="success" type="outputStreamResult" />
     </action>
+	
+	<action name="ping" class="org.hisp.dhis.commons.action.NoAction">
+		<result name="success" type="outputStreamResult" />
+	</action>
 
   </package>