← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13495: Hide Approve/Unapprove buttons on data set report when user doesn't have authority

 

------------------------------------------------------------
revno: 13495
committer: Jim Grace <jimgrace@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2013-12-30 11:04:54 -0500
message:
  Hide Approve/Unapprove buttons on data set report when user doesn't have authority
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.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-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2013-12-30 14:07:06 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2013-12-30 16:04:54 +0000
@@ -335,10 +335,10 @@
 	var attributesSelected = dhis2.dsr.attributesSelected( dataSetReport );
 
 	$( "#approvalNotification" ).hide();
-	
+    $( "#approvalDiv" ).hide();
+
 	if ( !approval || !attributesSelected ) {
-		$( "#approvalDiv" ).hide();
-		return false;
+		return;
 	}
 	
 	var url = dhis2.dsr.getDataApprovalUrl( dataSetReport );
@@ -348,11 +348,11 @@
 			return;
 		}
 		
-		var state = json.state;		
+		var state = json.state;
 		if ( "READY_FOR_APPROVAL" == state ) {
 			$( "#approvalNotification" ).show().html( i18n_ready_for_approval );
 			
-			if ( json.mayApprove ) {
+			if ( json.mayApprove == "true" ) {
 				$( "#approvalDiv" ).show();
 				$( "#approveButton" ).prop( "disabled", false );
 				$( "#unapproveButton" ).prop( "disabled", true );
@@ -361,7 +361,7 @@
 		else if ( "APPROVED" == state ) {
 			$( "#approvalNotification" ).show().html( i18n_approved );
 			
-			if ( json.mayUnapprove ) {
+			if ( json.mayUnapprove == "true") {
 				$( "#approvalDiv" ).show();
 				$( "#approveButton" ).prop( "disabled", true );
 				$( "#unapproveButton" ).prop( "disabled", false );
@@ -369,7 +369,6 @@
 		}
 		else if ( "WAITING_FOR_LOWER_LEVEL_APPROVAL" == state ) {
 			$( "#approvalNotification" ).show().html( i18n_waiting_for_lower_level_approval );	
-			$( "#approvalDiv" ).hide();	
 		}
 	} );
 }