← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3988: minor changes

 

------------------------------------------------------------
revno: 3988
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-22 21:29:52 +0300
message:
  minor changes
modified:
  dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js
  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/readMessage.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.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/dropdown.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2011-06-17 17:53:38 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/dropdown.js	2011-06-22 18:29:52 +0000
@@ -1,4 +1,3 @@
-
 function setAreaItem( area, item )
 {
     $.get( "setAreaItem.action", {
@@ -29,8 +28,8 @@
     $( "#chartView" ).dialog( {
         autoOpen : true,
         modal : true,
-        height : height + 35,
-        width : width,
+        height : height + 65,
+        width : width + 45,
         resizable : false,
         title : "Viewing Chart"
     } );

=== 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	2011-06-17 13:22:05 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/message.js	2011-06-22 18:29:52 +0000
@@ -1,4 +1,3 @@
-
 function removeMessage( id )
 {
     removeItem( id, "", i18n_confirm_delete_message, "removeMessage.action" );
@@ -6,5 +5,5 @@
 
 function read( id )
 {
-	window.location.href = "readMessage.action?id=" + id;
+    window.location.href = "readMessage.action?id=" + id;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/readMessage.js'
--- dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/readMessage.js	2011-06-17 17:37:34 +0000
+++ dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/webapp/dhis-web-dashboard-integration/javascript/readMessage.js	2011-06-22 18:29:52 +0000
@@ -1,17 +1,18 @@
-
 var dialog = null;
 
-$( document ).ready( function() {
-	
-	dialog = $( "#senderInfo" ).dialog( {
-		modal: true,
-		autoOpen: false,
-		width: 300,
-		height: 250,
-		title: "Sender" } );
+$( document ).ready( function()
+{
+
+    dialog = $( "#senderInfo" ).dialog( {
+        modal : true,
+        autoOpen : false,
+        width : 300,
+        height : 250,
+        title : "Sender"
+    } );
 } );
 
 function showSenderInfo( id )
 {
-	dialog.dialog( "open" );
+    dialog.dialog( "open" );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-14 08:01:50 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js	2011-06-22 18:29:52 +0000
@@ -6,19 +6,16 @@
 {
     var width = size === 'wide' ? 1000 : 700;
     var height = size === 'tall' ? 800 : 500;
-    
-    width += 20;
-    height += 20;
-    
-    $('#chartImage').attr('src', url);
-    $('#chartView').dialog({
-       autoOpen: true,
-       modal: true,
-       height: height + 35,
-       width: width,
-       resizable: false,
-       title: 'Viewing Chart'
-    });
+
+    $( '#chartImage' ).attr( 'src', url );
+    $( '#chartView' ).dialog( {
+        autoOpen : true,
+        modal : true,
+        height : height + 65,
+        width : width + 45,
+        resizable : false,
+        title : 'Viewing Chart'
+    } );
 }
 
 // -----------------------------------------------------------------------------
@@ -27,7 +24,7 @@
 
 function removeChart( chartId, chartTitle )
 {
-    removeItem(chartId, chartTitle, i18n_confirm_delete, "removeChart.action");
+    removeItem( chartId, chartTitle, i18n_confirm_delete, "removeChart.action" );
 }
 
 // -----------------------------------------------------------------------------
@@ -37,33 +34,35 @@
 function showChartDetails( chartId )
 {
     var request = new Request();
-    request.setResponseTypeXML('chart');
-    request.setCallbackSuccess(chartReceived);
-    request.send('getChart.action?id=' + chartId);
+    request.setResponseTypeXML( 'chart' );
+    request.setCallbackSuccess( chartReceived );
+    request.send( 'getChart.action?id=' + chartId );
 }
 
 function chartReceived( xmlObject )
 {
-    var indicators = parseInt( getElementValue(xmlObject, 'indicators') );
-    var dataElements = parseInt( getElementValue(xmlObject, 'dataElements') );
-
-    setInnerHTML('titleField', getElementValue(xmlObject, 'title'));
-    setInnerHTML('dimensionField', getElementValue(xmlObject, 'dimension'));
-
-    if( dataElements === 0) {
-        $('#dataElementsView').hide();
-        $('#indicatorsView').show();
-
-        $('#indicatorsField').text( indicators );
-    } else {
-        $('#dataElementsView').show();
-        $('#indicatorsView').hide();
-
-        $('#dataElementsField').text( dataElements );
+    var indicators = parseInt( getElementValue( xmlObject, 'indicators' ) );
+    var dataElements = parseInt( getElementValue( xmlObject, 'dataElements' ) );
+
+    setInnerHTML( 'titleField', getElementValue( xmlObject, 'title' ) );
+    setInnerHTML( 'dimensionField', getElementValue( xmlObject, 'dimension' ) );
+
+    if ( dataElements === 0 )
+    {
+        $( '#dataElementsView' ).hide();
+        $( '#indicatorsView' ).show();
+
+        $( '#indicatorsField' ).text( indicators );
+    } else
+    {
+        $( '#dataElementsView' ).show();
+        $( '#indicatorsView' ).hide();
+
+        $( '#dataElementsField' ).text( dataElements );
     }
 
-    setInnerHTML('periodsField', getElementValue(xmlObject, 'periods'));
-    setInnerHTML('organisationUnitsField', getElementValue(xmlObject, 'organisationUnits'));
+    setInnerHTML( 'periodsField', getElementValue( xmlObject, 'periods' ) );
+    setInnerHTML( 'organisationUnitsField', getElementValue( xmlObject, 'organisationUnits' ) );
 
     showDetails();
 }
@@ -74,83 +73,82 @@
 
 function saveChart()
 {
-    if (validateTargetLine() && validateCollections())
+    if ( validateTargetLine() && validateCollections() )
     {
-        var url = "validateChart.action?id=" + getFieldValue("id") + "&title=" + getFieldValue("title");
+        var url = "validateChart.action?id=" + getFieldValue( "id" ) + "&title=" + getFieldValue( "title" );
 
         var request = new Request();
-        request.setResponseTypeXML('message');
-        request.setCallbackSuccess(saveChartReceived);
-        request.send(url);
+        request.setResponseTypeXML( 'message' );
+        request.setCallbackSuccess( saveChartReceived );
+        request.send( url );
     }
 }
 
 function saveChartReceived( messageElement )
 {
-    var type = messageElement.getAttribute('type');
+    var type = messageElement.getAttribute( 'type' );
     var message = messageElement.firstChild.nodeValue;
-    var dimension = document.getElementById("dimension").value;
+    var dimension = document.getElementById( "dimension" ).value;
 
-    if (type == "input")
+    if ( type == "input" )
     {
-        setMessage(message);
+        setMessage( message );
 
         return false;
-    } 
-    else if (type == "success")
+    } else if ( type == "success" )
     {
-        if ($("#selectedIndicators").attr('multiple') !== undefined)
-        {
-            $("#selectedIndicators").children().attr("selected", true);
-        }
-
-        if ($("#selectedDataElements").attr('multiple') !== undefined)
-        {
-            $("#selectedDataElements").children().attr("selected", true);
-        }
-
-        if ($("#selectedPeriods").attr('multiple') !== undefined)
-        {
-            $("#selectedPeriods").children().attr("selected", true);
-        }
-
-        if ($("#selectedOrganisationUnits").attr('multiple') !== undefined)
-        {
-            $("#selectedOrganisationUnits").children().attr("selected", true);
-        }
-
-        $('#chartForm').submit();
+        if ( $( "#selectedIndicators" ).attr( 'multiple' ) !== undefined )
+        {
+            $( "#selectedIndicators" ).children().attr( "selected", true );
+        }
+
+        if ( $( "#selectedDataElements" ).attr( 'multiple' ) !== undefined )
+        {
+            $( "#selectedDataElements" ).children().attr( "selected", true );
+        }
+
+        if ( $( "#selectedPeriods" ).attr( 'multiple' ) !== undefined )
+        {
+            $( "#selectedPeriods" ).children().attr( "selected", true );
+        }
+
+        if ( $( "#selectedOrganisationUnits" ).attr( 'multiple' ) !== undefined )
+        {
+            $( "#selectedOrganisationUnits" ).children().attr( "selected", true );
+        }
+
+        $( '#chartForm' ).submit();
     }
 }
 
 function selectedChartType()
 {
-    return $("#type").val();
+    return $( "#type" ).val();
 }
 
 function selectedIndicatorsCount()
 {
-    return $("#selectedIndicators option").length;
+    return $( "#selectedIndicators option" ).length;
 }
 
 function validateTargetLine()
 {
-    var targetLine = $("#targetLine").attr("checked");
+    var targetLine = $( "#targetLine" ).attr( "checked" );
 
-    if (targetLine)
+    if ( targetLine )
     {
-        var targetLineValue = $("#targetLineValue").val();
+        var targetLineValue = $( "#targetLineValue" ).val();
 
-        if (targetLineValue.length == 0)
+        if ( targetLineValue.length == 0 )
         {
-            setMessage(i18n_target_line_value_must_be_provided);
+            setMessage( i18n_target_line_value_must_be_provided );
 
             return false;
         }
 
-        if (isNaN(targetLineValue))
+        if ( isNaN( targetLineValue ) )
         {
-            setMessage(i18n_target_line_value_must_be_number);
+            setMessage( i18n_target_line_value_must_be_number );
 
             return false;
         }
@@ -161,23 +159,23 @@
 
 function validateCollections()
 {
-    if (!hasElements("selectedIndicators") && !hasElements("selectedDataElements"))
-    {
-        setMessage(i18n_must_select_at_least_one_indicator);
-
-        return false;
-    }
-
-    if (!hasElements("selectedOrganisationUnits") && !isChecked("userOrganisationUnit"))
-    {
-        setMessage(i18n_must_select_at_least_one_unit);
-
-        return false;
-    }
-
-    if (!hasElements("selectedPeriods") && !relativePeriodsChecked())
-    {
-        setMessage(i18n_must_select_at_least_one_period);
+    if ( !hasElements( "selectedIndicators" ) && !hasElements( "selectedDataElements" ) )
+    {
+        setMessage( i18n_must_select_at_least_one_indicator );
+
+        return false;
+    }
+
+    if ( !hasElements( "selectedOrganisationUnits" ) && !isChecked( "userOrganisationUnit" ) )
+    {
+        setMessage( i18n_must_select_at_least_one_unit );
+
+        return false;
+    }
+
+    if ( !hasElements( "selectedPeriods" ) && !relativePeriodsChecked() )
+    {
+        setMessage( i18n_must_select_at_least_one_period );
 
         return false;
     }