dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #33052
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16826: skipOffline fix for data entry
------------------------------------------------------------
revno: 16826
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-09-26 13:56:04 +0700
message:
skipOffline fix for data entry
modified:
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/acl/DefaultAclService.java
dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.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-services/dhis-service-core/src/main/java/org/hisp/dhis/acl/DefaultAclService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/acl/DefaultAclService.java 2014-09-16 05:18:47 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/acl/DefaultAclService.java 2014-09-26 06:56:04 +0000
@@ -213,6 +213,11 @@
{
Schema schema = schemaService.getSchema( klass );
+ if ( schema == null )
+ {
+ return false;
+ }
+
if ( !schema.isShareable() )
{
return canAccess( user, schema.getAuthorityByType( AuthorityType.CREATE ) );
=== 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 2014-09-19 17:13:55 +0000
+++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/javascript/form.js 2014-09-26 06:56:04 +0000
@@ -597,7 +597,27 @@
loadDataValues();
dhis2.de.insertOptionSets();
} );
- }
+ } else {
+ dhis2.de.storageManager.formExistsRemotely( dataSetId ).done( function( value ) {
+ console.log( 'Loading form remotely: ' + dataSetId );
+
+ dhis2.de.storageManager.getForm( dataSetId ).done( function( html )
+ {
+ $( '#contentDiv' ).html( html );
+
+ if ( dhis2.de.dataSets[dataSetId].renderAsTabs )
+ {
+ $( "#tabs" ).tabs();
+ }
+
+ enableSectionFilter();
+ $( document ).trigger( dhis2.de.event.formLoaded, dhis2.de.currentDataSetId );
+
+ loadDataValues();
+ dhis2.de.insertOptionSets();
+ } );
+ });
+ }
} );
}
else
@@ -2126,6 +2146,29 @@
};
/**
+ * Indicates whether a form exists remotely.
+ *
+ * @param dataSetId the identifier of the data set of the form.
+ * @return true if a form exists, false otherwise.
+ */
+ this.formExistsRemotely = function( dataSetId )
+ {
+ var def = $.Deferred();
+
+ $.ajax({
+ url: '../api/dataSets/' + dataSetId,
+ accept: 'application/json',
+ type: 'GET'
+ }).done(function() {
+ def.resolve( true );
+ }).fail(function() {
+ def.resolve( false );
+ });
+
+ return def.promise();
+ };
+
+ /**
* Loads a form directly from the server, does not try to save it in the
* browser (so that it doesn't interfere with any current downloads).
*