------------------------------------------------------------ revno: 2316 committer: Tran Thanh Tri <Tran Thanh t...@compaq> branch nick: trunk timestamp: Tue 2010-10-05 13:53:19 +0700 message: fixed bug: text type data element is not saving values while data entry added: dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/DataSetCompletedReportFormAction.java dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewByPeriodFormAction.java dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/chart/drawJChartParams.vm modified: dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.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/main.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2010-09-17 16:11:27 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.vm 2010-10-05 06:53:19 +0000 @@ -19,6 +19,7 @@ <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.ext.js"></script> + <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/jquery-ui.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.metadata.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/ui/ui.datepicker.js"></script> <script type="text/javascript" src="../dhis-web-commons/javascripts/jQuery/jquery.tablesorter.js"></script> === modified file 'dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm' --- dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm 2010-09-27 10:40:07 +0000 +++ dhis-2/dhis-web/dhis-web-dataentry/src/main/webapp/dhis-web-dataentry/form.vm 2010-10-05 06:53:19 +0000 @@ -110,6 +110,7 @@ </script> #else #if( $dataElement.type == "string" ) + #set( $dataEntryId = "value[$dataElement.id].value:value[$optionComboId].value" ) #set( $coun = 0 ) #foreach($customValue in $customValues) #if($dataElement.id == $customValue.dataElement.id && $optionComboId == $customValue.optionCombo.id) @@ -126,7 +127,7 @@ #end </select> #else - <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $optionCombo.id, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionCombo.id, true )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end> + <input name="entryfield" id="$dataEntryId" type="text" value="$!encoder.htmlEncode( $dataValue.value )" #if( $auth.hasAccess( "dhis-web-dataentry", "saveValue") ) onchange="saveValue( $dataElement.id, $optionComboId, '$encoder.jsEncode( $dataElement.name )', $zeroValueSaveMode )" ondblclick="viewHistory( $dataElement.id, $optionComboId, true )" #else disabled="disabled" #end onkeypress="return keyPress(event, this)" style="width:100% #if( $minMaxError ) ;background-color:#ffcccc #end #if( $dataElement.type == "int" ) ;text-align:center #end" tabindex="$tabIndex" #if( $locked ) disabled="disabled"#end> #end #end === added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/DataSetCompletedReportFormAction.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/DataSetCompletedReportFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/DataSetCompletedReportFormAction.java 2010-10-05 06:53:19 +0000 @@ -0,0 +1,130 @@ +package org.hisp.dhis.reportexcel.datasetcompleted.action; + +/* + * Copyright (c) 2004-2010, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.dataset.comparator.DataSetNameComparator; +import org.hisp.dhis.reportexcel.Bookmark; +import org.hisp.dhis.reportexcel.BookmarkService; +import org.hisp.dhis.user.CurrentUserService; +import org.hisp.dhis.user.UserAuthorityGroup; +import org.hisp.dhis.user.UserCredentials; +import org.hisp.dhis.user.UserStore; + +import com.opensymphony.xwork2.Action; + +/** + * @author Tran Thanh Tri + * @version $Id$ + */ + +public class DataSetCompletedReportFormAction + implements Action +{ + // ------------------------------------------- + // Dependency + // ------------------------------------------- + + private BookmarkService bookmarkService; + + public void setBookmarkService( BookmarkService bookmarkService ) + { + this.bookmarkService = bookmarkService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private UserStore userStore; + + public void setUserStore( UserStore userStore ) + { + this.userStore = userStore; + } + + private CurrentUserService currentUserService; + + public void setCurrentUserService( CurrentUserService currentUserService ) + { + this.currentUserService = currentUserService; + } + + // ------------------------------------------- + // Output + // ------------------------------------------- + + private List<Bookmark> bookmarks; + + public List<Bookmark> getBookmarks() + { + return bookmarks; + } + + private List<DataSet> dataSets; + + public List<DataSet> getDataSets() + { + return dataSets; + } + + @Override + public String execute() + throws Exception + { + bookmarks = new ArrayList<Bookmark>( bookmarkService.getAllBookmark( Bookmark.COMPLETED_REPORT ) ); + + dataSets = new ArrayList<DataSet>(); + + if ( currentUserService.currentUserIsSuper() ) + { + dataSets.addAll( dataSetService.getAssignedDataSets() ); + } + else + { + UserCredentials userCredentials = userStore.getUserCredentials( currentUserService.getCurrentUser() ); + + for ( UserAuthorityGroup userAuthorityGroup : userCredentials.getUserAuthorityGroups() ) + { + dataSets.addAll( userAuthorityGroup.getDataSets() ); + } + } + + Collections.sort( dataSets, new DataSetNameComparator() ); + + return SUCCESS; + } + +} === added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewByPeriodFormAction.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewByPeriodFormAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewByPeriodFormAction.java 2010-10-05 06:53:19 +0000 @@ -0,0 +1,106 @@ +package org.hisp.dhis.reportexcel.datasetcompleted.action; + +/* + * Copyright (c) 2004-2010, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.oust.manager.SelectionTreeManager; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodService; +import org.hisp.dhis.period.comparator.PeriodComparator; + +import com.opensymphony.xwork2.Action; + +/** + * @author Tran Thanh Tri + * @version $Id$ + */ +public class ViewByPeriodFormAction + implements Action +{ + // ------------------------------------------------- + // Dependency + // ------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private PeriodService periodService; + + public void setPeriodService( PeriodService periodService ) + { + this.periodService = periodService; + } + + private SelectionTreeManager selectionTreeManager; + + public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) + { + this.selectionTreeManager = selectionTreeManager; + } + + // ------------------------------------------------- + // Input + // ------------------------------------------------- + + private Integer id; + + public void setId( Integer id ) + { + this.id = id; + } + + private List<Period> periods; + + public List<Period> getPeriods() + { + return periods; + } + + public String execute() + throws Exception + { + + DataSet dataSet = dataSetService.getDataSet( id ); + + selectionTreeManager.setSelectedOrganisationUnits( dataSet.getOrganisationUnis() ); + + periods = new ArrayList<Period>( periodService.getPeriodsByPeriodType( dataSet.getPeriodType() ) ); + + Collections.sort( periods, new PeriodComparator() ); + + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java 2010-09-07 11:43:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/java/org/hisp/dhis/reportexcel/datasetcompleted/action/ViewCompletedReportByPeriodsAction.java 2010-10-05 06:53:19 +0000 @@ -44,6 +44,7 @@ import org.hisp.dhis.datavalue.DataValueService; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.comparator.OrganisationUnitNameComparator; +import org.hisp.dhis.oust.manager.SelectionTreeManager; import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; import org.hisp.dhis.period.Period; import org.hisp.dhis.period.PeriodService; @@ -72,11 +73,11 @@ this.periodService = periodService; } - private OrganisationUnitSelectionManager organisationUnitSelectionManager; + private SelectionTreeManager selectionTreeManager; - public void setOrganisationUnitSelectionManager( OrganisationUnitSelectionManager organisationUnitSelectionManager ) + public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager ) { - this.organisationUnitSelectionManager = organisationUnitSelectionManager; + this.selectionTreeManager = selectionTreeManager; } private DataSetService dataSetService; @@ -157,8 +158,7 @@ { dataSet = dataSetService.getDataSet( id ); - organisationUnits = new ArrayList<OrganisationUnit>( organisationUnitSelectionManager - .getSelectedOrganisationUnit().getChildren() ); + organisationUnits = new ArrayList<OrganisationUnit>( selectionTreeManager.getSelectedOrganisationUnits() ); periods = new ArrayList<Period>(); === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-10-04 06:27:38 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/META-INF/dhis/beans.xml 2010-10-05 06:53:19 +0000 @@ -1338,7 +1338,7 @@ scope="prototype"> <property name="reportLocationManager" ref="org.hisp.dhis.reportexcel.ReportLocationManager" /> - </bean> + </bean> <bean id="org.hisp.dhis.reportexcel.action.SaveBookmarkAction" class="org.hisp.dhis.reportexcel.action.SaveBookmarkAction" scope="prototype"> @@ -1379,17 +1379,39 @@ ref="org.hisp.dhis.reportexcel.state.SelectionManager" /> </bean> + <!-- Data Set Completed Report --> + + <bean + id="org.hisp.dhis.reportexcel.datasetcompleted.action.DataSetCompletedReportFormAction" + class="org.hisp.dhis.reportexcel.datasetcompleted.action.DataSetCompletedReportFormAction" + scope="prototype"> + <property name="bookmarkService" ref="org.hisp.dhis.reportexcel.BookmarkService" /> + <property name="userStore" ref="org.hisp.dhis.user.UserStore" /> + <property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" /> + <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" /> + </bean> + + <bean + id="org.hisp.dhis.reportexcel.datasetcompleted.action.ViewByPeriodFormAction" + class="org.hisp.dhis.reportexcel.datasetcompleted.action.ViewByPeriodFormAction" + scope="prototype"> + <property name="selectionTreeManager" + ref="org.hisp.dhis.oust.manager.SelectionTreeManager" /> + <property name="periodService" ref="org.hisp.dhis.period.PeriodService" /> + <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" /> + </bean> + <!-- jChart --> - <bean id="org.hisp.dhis.jchart.data.JChartDataService" - class="org.hisp.dhis.jchart.data.DefaultJChartDataService"> + <bean id="org.hisp.dhis.jchart.data.JChartDataService" class="org.hisp.dhis.jchart.data.DefaultJChartDataService"> <property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" /> <property name="selectionTreeManager" ref="org.hisp.dhis.oust.manager.SelectionTreeManager" /> <property name="aggregationService" ref="org.hisp.dhis.aggregation.AggregationService" /> <property name="i18nManager" ref="org.hisp.dhis.i18n.I18nManager" /> <property name="statementManager" ref="statementManager" /> - <property name="periodDatabaseService" ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" /> + <property name="periodDatabaseService" + ref="org.hisp.dhis.reportexcel.period.db.PeriodDatabaseService" /> <property name="periodService" ref="org.hisp.dhis.period.PeriodService" /> </bean> @@ -1424,15 +1446,17 @@ scope="prototype"> <property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" /> </bean> - - <bean id="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleAction" + + <bean + id="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleAction" class="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleAction" scope="prototype"> <property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" /> <property name="userStore" ref="org.hisp.dhis.user.UserStore" /> </bean> - - <bean id="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleFormAction" + + <bean + id="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleFormAction" class="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleFormAction" scope="prototype"> <property name="jchartService" ref="org.hisp.dhis.jchart.JChartService" /> === modified file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2010-10-04 06:27:38 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/resources/struts.xml 2010-10-05 06:53:19 +0000 @@ -601,34 +601,19 @@ <!-- DATA SET COMPLETED REPORT ACTION --> - <action name="selectDataSetCompletedReport" - class="org.hisp.dhis.reportexcel.action.SetBookmarkTypeCompleteReportAction"> - <result name="success" type="chain">selectDataSetCompletedReportChain - </result> - </action> - - <action name="selectDataSetCompletedReportChain" - class="org.hisp.dhis.reportexcel.datasetcompleted.action.GetSelectedOrganisationUnitAction"> - <interceptor-ref name="organisationUnitTreeStack" /> + <action name="dataSetCompletedReports" + class="org.hisp.dhis.reportexcel.datasetcompleted.action.DataSetCompletedReportFormAction"> <result name="success" type="velocity">/main.vm</result> - <param name="page">/dhis-web-excel-reporting/dataSetCompleteReportSelect.vm</param> - <param name="menu">/dhis-web-excel-reporting/menuWithTree.vm</param> - <param name="menuTreeHeight">400</param> - <param name="javascripts"> - ../dhis-web-commons/ouwt/ouwt.js, - ../dhis-web-commons/util/jquery.jqprint.0.3.js, - ext/adapter/ext/ext-base.js, - ext/ext-all.js, - ext/ux/MultiSelect.js, - ext/ux/ItemSelector.js, - javascript/dataSetCompleted.js - </param> - <param name="stylesheets"> - ext/resources/css/ext-all.css, - ext/ux/css/MultiSelect.css, - style/dataSetCompleted.css - </param> - </action> + <param name="page">/dhis-web-excel-reporting/dataSetCompleteds.vm</param> + <param name="menu">/dhis-web-excel-reporting/menu.vm</param> + </action> + + <action name="viewByPeriodForm" + class="org.hisp.dhis.reportexcel.datasetcompleted.action.ViewByPeriodFormAction"> + <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonPeriods.vm</result> + <param name="onExceptionReturn">plainTextError</param> + </action> + <action name="viewCompleteReportByPeriod" class="org.hisp.dhis.reportexcel.datasetcompleted.action.ViewCompletedReportByPeriodsAction"> @@ -1498,14 +1483,9 @@ class="org.hisp.dhis.reportexcel.jchart.action.UpdateJChartUserRoleAction"> <result name="success" type="redirect">jcharts.action</result> <param name="requiredAuthorities">F_EXCEL_REPORT_ADMINISTRATION</param> - </action> + </action> <action name="viewJCharts" - class="org.hisp.dhis.reportexcel.datasetcompleted.action.GetSelectedOrganisationUnitAction"> - <result name="success" type="chain">viewJChartsChain</result> - </action> - - <action name="viewJChartsChain" class="org.hisp.dhis.reportexcel.jchart.action.GetALLJchartAction"> <result name="success" type="velocity">/main.vm</result> <param name="page">/dhis-web-excel-reporting/chart/viewJCharts.vm</param> === added file 'dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/chart/drawJChartParams.vm' --- dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/chart/drawJChartParams.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-excel-reporting/src/main/webapp/dhis-web-excel-reporting/chart/drawJChartParams.vm 2010-10-05 06:53:19 +0000 @@ -0,0 +1,170 @@ +<script> + jQuery(document).ready( function(){ + validation( 'drawJChart', function(){ drawJChart() }, function(){} ); + }); +</script> + +<h3>$encoder.htmlEncode( $jchart.title )</h3> +<form id="drawJChart"> +<input type="hidden" id="id" name="id" value="$jchart.id"/> +<table width="100%"> + <col width="610px"/> + <tr> + <th colspan="2">$i18n.getString('select_paramater_to_draw_chart')</th> + </tr> + <tr> + <td> + <div style="padding-top:20px;width:400px;"> + #organisationUnitSelectionTree( false, false, true ) + </div> + </td> + <td></td> + </tr> + #if( $jchart.isOrganisationUnitCategory() ) + <tr> + <th>$i18n.getString('period')</th> + <td></td> + </tr> + <tr> + <td><select id="selectedPeriod" style="width:600px;"/></td> + </tr> + #end +</table> +<p> +<input type="submit" value="$i18n.getString('draw_chart')" style="width:150px"/> +</p> +</form> + +<div id="container" style="width:800px;height:600px;position:fixed;display:none;"> + <div id="jchart" style="width:780px;height:600px;"></div> + <div class="close" onclick="closeJChart()"></div> +</div> + +<script> + jQuery( function(){ + #if( $jchart.isOrganisationUnitCategory() ) + loadPeriods(); + selectionTreeSelection.setMultipleSelectionAllowed( true ); + #end + }); + + function loadPeriods() + { + jQuery.postJSON('../dhis-web-commons-ajax-json/getPeriods.action',{ + name: '$jchart.periodType.name' + }, function( json ){ + jQuery.each( json.periods, function(i, item ){ + jQuery("#selectedPeriod").append('<option value="' + item.id + '">' + item.name + '</option>'); + }); + }); + } + + var chart = null; + + + + function drawJChart() + { + + var jchartParams = {id:$jchart.id, #if( $jchart.isOrganisationUnitCategory() ) periodId:getFieldValue('selectedPeriod') #end}; + + jQuery.postJSON("drawJChart.action" + ,jchartParams + ,function( json ){ + chart = new Highcharts.Chart({ + chart: { + renderTo: 'jchart', + marginRight: 50, + marginBottom: 100, + marginTop: 100 + }, + title: { + text: json.title, + x: -20 + }, + subtitle: { + text: json.subtitle, + x: -20 + }, + xAxis: { + categories: json.categories, + labels: { + rotation: -45, + y:10, + align:'right' + } + }, + yAxis: { + title: { + //text: 'Temperature (°C)' + }, + plotLines: [{ + value: 0, + width: 1, + color: '#808080' + }], + min: 0 + }, + tooltip: { + formatter: function() { + return '<b>'+ this.series.name +'</b><br/>'+ + this.x +': '+ this.y; + } + }, + legend: json.legend, + series: json.series, + plotOptions: { + line: { + dataLabels: { + enabled: true + }, + enableMouseTracking: true + }, + column: { + dataLabels: { + enabled: true, + rotation: 0 , + color: '#000000', + align: 'center', + formatter: function() { + return this.y; + }, + style: { + font: 'normal 13px Verdana, sans-serif' + } + } + }, + pie: { + allowPointSelect: true, + cursor: 'pointer', + dataLabels: { + enabled: true, + formatter: function() { + if (this.y > 5) return this.point.name; + }, + color: 'white', + style: { + font: '13px Trebuchet MS, Verdana, sans-serif' + } + } + } + + } + }); + + showPopupWindowById( 'container', 800, 600 ); + + }); + } + + function closeJChart() + { + unLockScreen(); + jQuery("#container").fadeOut( function(){ + if(chart!=null) chart.destroy (); + }); + + } + + +</script>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp