=== modified file 'dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java' --- dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java 2012-06-07 11:28:12 +0000 +++ dhis-2/dhis-web/dhis-web-api/src/main/java/org/hisp/dhis/api/controller/ChartPluginController.java 2012-06-07 14:33:51 +0000 @@ -61,6 +61,7 @@ import javax.servlet.http.HttpServletResponse; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.List; import java.util.Set; @@ -114,9 +115,10 @@ @RequestParam( required = false ) Set dataSetIds, @RequestParam Set organisationUnitIds, @RequestParam( required = false ) boolean orgUnitIsParent, - @RequestParam( required = false ) Integer organisationUnitGroupSetId, + @RequestParam( required = false ) String organisationUnitGroupSetId, @RequestParam( required = false ) boolean userOrganisationUnit, @RequestParam( required = false ) boolean userOrganisationUnitChildren, + @RequestParam( required = false ) boolean periodIsFilter, RelativePeriods relativePeriods, Model model, HttpServletResponse response ) throws Exception { ChartPluginValue chartValue = new ChartPluginValue(); @@ -128,6 +130,11 @@ // --------------------------------------------------------------------- List periods = periodService.reloadPeriods( setNames( relativePeriods.getRelativePeriods(), format ) ); + + if ( periodIsFilter ) + { + periods = Arrays.asList( periods.get( 0 ) ); + } if ( periods.isEmpty() ) { === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElementGroups.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElementGroups.vm 2012-05-02 23:09:07 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElementGroups.vm 2012-06-05 14:53:54 +0000 @@ -1,2 +1,2 @@ #set( $size = $dataElementGroups.size() ) -{"dataElementGroups":[#foreach( $group in $dataElementGroups ){"id":$!{group.id},"name":"$!encoder.jsonEncode( ${group.displayName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +{"dataElementGroups":[#foreach( $group in $dataElementGroups ){"id":"$!{group.uid}","name":"$!encoder.jsonEncode( ${group.displayName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElements.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElements.vm 2012-05-02 23:09:07 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataElements.vm 2012-06-05 14:53:54 +0000 @@ -1,2 +1,2 @@ #set( $size = $dataElements.size() ) -{"dataElements":[#foreach( $dataElement in $dataElements ){"id":$!{dataElement.id},"name":"$!encoder.jsonEncode( ${dataElement.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +{"dataElements":[#foreach( $dataElement in $dataElements ){"id":"$!{dataElement.uid}","name":"$!encoder.jsonEncode( ${dataElement.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataSets.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataSets.vm 2012-03-07 00:40:28 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminDataSets.vm 2012-06-05 14:53:54 +0000 @@ -1,2 +1,2 @@ #set( $size = $dataSets.size() ) -{"dataSets":[#foreach( $dataSet in $dataSets ){"id":$!{dataSet.id},"name":"$!encoder.jsonEncode( ${dataSet.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +{"dataSets":[#foreach( $dataSet in $dataSets ){"id":"$!{dataSet.uid}","name":"$!encoder.jsonEncode( ${dataSet.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicatorGroups.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicatorGroups.vm 2012-01-22 11:28:12 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicatorGroups.vm 2012-06-05 14:53:54 +0000 @@ -1,2 +1,2 @@ #set( $size = $indicatorGroups.size() ) -{"indicatorGroups":[#foreach( $group in $indicatorGroups ){"id":$!{group.id},"name":"$!encoder.jsonEncode( ${group.displayName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +{"indicatorGroups":[#foreach( $group in $indicatorGroups ){"id":"$!{group.uid}","name":"$!encoder.jsonEncode( ${group.displayName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicators.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicators.vm 2012-03-02 12:32:03 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminIndicators.vm 2012-06-05 14:53:54 +0000 @@ -1,1 +1,1 @@ -#set( $size = $indicators.size() ){"indicators":[#foreach( $indicator in $indicators ){"id":$!{indicator.id},"name":"$!encoder.jsonEncode( ${indicator.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file +#set( $size = $indicators.size() ){"indicators":[#foreach( $indicator in $indicators ){"id":"$!{indicator.uid}","name":"$!encoder.jsonEncode( ${indicator.displayShortName} )"}#if( $velocityCount < $size ),#end#end]} \ No newline at end of file === added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminOrganisationUnitGroupSets.vm' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminOrganisationUnitGroupSets.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ajax/jsonminOrganisationUnitGroupSets.vm 2012-06-05 14:53:54 +0000 @@ -0,0 +1,2 @@ +#set( $size = $organisationUnitGroupSets.size() ) +{"organisationUnitGroupSets":[#foreach( $groupSet in $organisationUnitGroupSets ){"id":"$groupSet.uid","name":"$!encoder.jsonEncode( ${groupSet.displayName} )"}#if( $velocityCount < $size ),#end#end]#if( $usePaging ),"paging":#parse( "/dhis-web-commons/ajax/jsonPaging.vm" )#end} \ No newline at end of file === 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 2012-06-01 19:40:49 +0000 +++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2012-06-05 14:53:54 +0000 @@ -725,6 +725,13 @@ plainTextError + + + /dhis-web-commons/ajax/jsonminOrganisationUnitGroupSets.vm + + plainTextError + + /dhis-web-commons/ajax/jsonOrganisationUnits.vm === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java 2012-06-02 12:20:59 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java 2012-06-05 18:31:39 +0000 @@ -146,23 +146,23 @@ this.filter = filter; } - private List indicatorIds; + private List indicatorIds; - public void setIndicatorIds( List indicatorIds ) + public void setIndicatorIds( List indicatorIds ) { this.indicatorIds = indicatorIds; } - private List dataElementIds; + private List dataElementIds; - public void setDataElementIds( List dataElementIds ) + public void setDataElementIds( List dataElementIds ) { this.dataElementIds = dataElementIds; } - private List dataSetIds; + private List dataSetIds; - public void setDataSetIds( List dataSetIds ) + public void setDataSetIds( List dataSetIds ) { this.dataSetIds = dataSetIds; } @@ -230,9 +230,9 @@ this.last5Years = last5Years; } - private List organisationUnitIds; + private List organisationUnitIds; - public void setOrganisationUnitIds( List organisationUnitIds ) + public void setOrganisationUnitIds( List organisationUnitIds ) { this.organisationUnitIds = organisationUnitIds; } @@ -375,7 +375,7 @@ if ( indicatorIds != null ) { - for ( Integer id : indicatorIds ) + for ( String id : indicatorIds ) { chart.getIndicators().add( indicatorService.getIndicator( id ) ); } @@ -385,7 +385,7 @@ if ( dataElementIds != null ) { - for ( Integer id : dataElementIds ) + for ( String id : dataElementIds ) { chart.getDataElements().add( dataElementService.getDataElement( id ) ); } @@ -395,7 +395,7 @@ if ( dataSetIds != null ) { - for ( Integer id : dataSetIds ) + for ( String id : dataSetIds ) { chart.getDataSets().add( dataSetService.getDataSet( id ) ); } @@ -422,7 +422,7 @@ if ( organisationUnitIds != null ) { - for ( Integer id : organisationUnitIds ) + for ( String id : organisationUnitIds ) { chart.getOrganisationUnits().add( organisationUnitService.getOrganisationUnit( id ) ); } === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitChildrenAction.java' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitChildrenAction.java 2012-01-20 10:38:11 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetOrganisationUnitChildrenAction.java 2012-06-06 12:50:27 +0000 @@ -58,9 +58,9 @@ // Input // ------------------------------------------------------------------------- - private Integer node; + private String node; - public void setNode( Integer node ) + public void setNode( String node ) { this.node = node; } === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2012-06-04 13:08:06 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/org/hisp/dhis/visualizer/i18n_module.properties 2012-06-04 13:15:13 +0000 @@ -128,4 +128,4 @@ write_your_interpretation = Write your interpretation interpretation_was_shared = Interpretation was shared save_load_favorite_before_sharing = Please save or load a favorite before sharing -create_chart_before_datatable = Please create a chart before opening the datatable +create_chart_before_datatable = Please create a chart before showing the datatable === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-04 13:08:06 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2012-06-07 17:30:15 +0000 @@ -83,12 +83,6 @@ organisationunitchildren: [] } }; - for (var relative in r.p) { - obj.system.periods[relative] = []; - for (var i = 0; i < r.p[relative].length; i++) { - obj.system.periods[relative].push({id: r.p[relative][i][0], name: DV.conf.util.jsonEncode(r.p[relative][i][1])}); - } - } for (var i = 0; i < r.user.ouc.length; i++) { obj.user.organisationunitchildren.push({id: r.user.ouc[i][0], name: DV.conf.util.jsonEncode(r.user.ouc[i][1])}); } @@ -106,14 +100,15 @@ path_lib: '../../dhis-web-commons/javascripts/', initialize: 'initialize.action', redirect: 'redirect.action', - data_get: 'getAggregatedValues.action', - indicator_get: 'getIndicatorsMinified.action', - indicatorgroup_get: 'getIndicatorGroupsMinified.action', - dataelement_get: 'getDataElementsMinified.action', - dataelementgroup_get: 'getDataElementGroupsMinified.action', - dataelement_get: 'getDataElementsMinified.action', - dataset_get: 'getDataSetsMinified.action', - organisationunitgroupset_get: 'getOrganisationUnitGroupSets.action', + data_get: 'chartValues.json', + indicator_get: 'indicatorGroups/', + indicator_getall: 'indicators.json?paging=false&links=false', + indicatorgroup_get: 'indicatorGroups.json?paging=false&links=false', + dataelement_get: 'dataElementGroups/', + dataelement_getall: 'dataelements.json?paging=false&links=false', + dataelementgroup_get: 'dataElementGroups.json?paging=false&links=false', + dataset_get: 'dataSets.json?paging=false&links=false', + organisationunitgroupset_get: 'getOrganisationUnitGroupSetsMinified.action', organisationunitchildren_get: 'getOrganisationUnitChildren.action', favorite_addorupdate: 'addOrUpdateChart.action', favorite_addorupdatesystem: 'addOrUpdateSystemChart.action', @@ -188,6 +183,17 @@ urlparam: 'id' } }, + relativePeriodUnits: { + lastSixMonth: 1, + thisYear: 1, + lastYear: 1, + last5Years: 5, + last12Months: 12, + last4Quarters: 4, + last2SixMonths: 2, + lastMonth: 1, + lastQuarter: 1 + }, chart: { style: { inset: 30, @@ -241,6 +247,30 @@ } } }; + +DV.cmp = { + region: {}, + charttype: [], + settings: {}, + dimension: { + indicator: {}, + dataelement: {}, + dataset: {}, + period: { + checkbox: [] + }, + organisationunit: {} + }, + options: {}, + toolbar: { + menuitem: {} + }, + statusbar: {}, + favorite: { + rename: {} + }, + share: {} +}; Ext.Loader.setConfig({enabled: true}); Ext.Loader.setPath('Ext.ux', DV.conf.finals.ajax.path_lib + 'ext-ux'); @@ -263,30 +293,6 @@ DV.exe.execute(DV.init.cmd); }; - DV.cmp = { - region: {}, - charttype: [], - settings: {}, - dimension: { - indicator: {}, - dataelement: {}, - dataset: {}, - period: { - checkbox: [] - }, - organisationunit: {} - }, - options: {}, - toolbar: { - menuitem: {} - }, - statusbar: {}, - favorite: { - rename: {} - }, - share: {} - }; - DV.util = { getCmp: function(q) { return DV.viewport.query(q)[0]; @@ -364,6 +370,7 @@ unselectAll: function(a, s) { s.store.removeAll(); a.store.clearFilter(); + this.filterAvailable(a, s); }, filterAvailable: function(a, s) { a.store.filterBy( function(r) { @@ -502,17 +509,12 @@ } }, data: { - getNames: function(exception, isFilter) { - var obj = DV.c.data.objects, - a = []; - for (var i = 0; i < obj.length; i++) { - a.push(obj[i].name); - } - if (exception && isFilter && a.length > 1) { - DV.chart.warnings.push(DV.i18n.wm_multiple_filter_ind_de_ds + ' ' + DV.i18n.wm_first_filter_used); - } - return (isFilter && a.length > 1) ? a.slice(0,1) : a; - }, + getObjects: function() { + var objects = DV.c.indicator.objects; + objects = objects.concat(DV.c.dataelement.objects); + objects = objects.concat(DV.c.dataset.objects); + return objects; + }, getUrl: function(isFilter) { var obj = DV.c.indicator.objects, a = []; @@ -544,40 +546,27 @@ return a; }, getObjectsByRelativePeriods: function(rp) { - var relatives = [], - a = []; + var a = [], + count = 0; for (var r in rp) { if (rp[r]) { - relatives.push(r); - } - } - for (var i = 0; i < relatives.length; i++) { - var r = DV.init.system.periods[relatives[i]] || []; - for (var j = 0; j < r.length; j++) { - a.push({id: r[j].id, name: r[j].name}); - } - } - return a; - }, - getNames: function(exception, isFilter) { - var obj = DV.c.period.objects, - a = []; - for (var i = 0; i < obj.length; i++) { - a.push(obj[i].name); - } - if (exception && isFilter && a.length > 1) { - DV.chart.warnings.push(DV.i18n.wm_multiple_filter_period + ' ' + DV.i18n.wm_first_filter_used); - } - return (isFilter && a.length > 1) ? a.slice(0,1) : a; - }, + count += DV.conf.relativePeriodUnits[r]; + } + } + for (var i = 0; i < count; i++) { + a.push({}); + } + return a; + }, getUrl: function(isFilter) { - var obj = DV.c.period.objects, - a = []; - for (var i = 0; i < obj.length; i++) { - a.push('periodIds=' + obj[i].id); + var a = []; + for (var r in DV.c.period.rp) { + if (DV.c.period.rp[r]) { + a.push(r + '=true'); + } } - return (isFilter && a.length > 1) ? a.slice(0,1) : a; - }, + return a; + }, getIds: function() { var obj = DV.c.period.objects, a = []; @@ -624,64 +613,14 @@ }); return a; }, - getNames: function(exception, isFilter) { - var ou = DV.c.organisationunit, - a = []; - if (ou.groupsetid) { - var groups = DV.init.system.organisationunitgroupsets[ou.groupsetid]; - for (var i = 0; i < groups.length; i++) { - a.push(groups[i].name); - } - } - else { - if (DV.c.userorganisationunit || DV.c.userorganisationunitchildren) { - if (DV.c.userorganisationunit) { - a.push(DV.init.user.organisationunit.name); - DV.cmp.dimension.organisationunit.treepanel.addToStorage([DV.init.user.organisationunit]); - } - if (DV.c.userorganisationunitchildren) { - var ouc = DV.init.user.organisationunitchildren; - for (var i = 0; i < ouc.length; i++) { - a.push(ouc[i].name); - } - DV.cmp.dimension.organisationunit.treepanel.addToStorage(DV.init.user.organisationunitchildren); - } - } - else { - for (var i = 0; i < ou.objects.length; i++) { - a.push(ou.objects[i].name); - } - } - } - if (exception && isFilter && a.length > 1) { - DV.chart.warnings.push(DV.i18n.wm_multiple_filter_orgunit + ' ' + DV.i18n.wm_first_filter_used); - } - return (isFilter && a.length > 1) ? a.slice(0,1) : a; - }, getUrl: function(isFilter) { var ou = DV.c.organisationunit, a = []; - if (DV.c.userorganisationunit || DV.c.userorganisationunitchildren) { - if (DV.c.userorganisationunit) { - a.push('organisationUnitIds=' + DV.init.user.organisationunit.id); - } - if (DV.c.userorganisationunitchildren) { - var c = DV.init.user.organisationunitchildren; - for (var i = 0; i < c.length; i++) { - a.push('organisationUnitIds=' + c[i].id); - } - } - } - else { - for (var i = 0; i < ou.objects.length; i++) { - a.push('organisationUnitIds=' + ou.objects[i].id); - } - if ((isFilter || ou.groupsetid) && a.length > 1) { - a = a.slice(0,1); - } - } - if (ou.groupsetid) { - a.push('organisationUnitGroupSetId=' + ou.groupsetid); + for (var i = 0; i < ou.objects.length; i++) { + a.push('organisationUnitIds=' + ou.objects[i].id); + } + if (isFilter && a.length > 1) { + a = a.slice(0,1); } return a; }, @@ -1201,8 +1140,8 @@ toolbar: { separator: { xtype: 'tbseparator', - height: 18, - style: 'border-left: 1px solid #bbb; border-right: 1px solid #ececec' + height: 26, + style: 'border-left: 1px solid #d1d1d1; border-right: 1px solid #f1f1f1' } }, number: { @@ -1232,26 +1171,21 @@ } }, value: { - jsonfy: function(r) { - r = Ext.JSON.decode(r.responseText), - values = []; - for (var i = 0; i < r.length; i++) { - var t = r[i][1]; + jsonfy: function(values) { + var a = []; + for (var i = 0; i < values.length; i++) { var v = { - value: r[i][0], - type: t === 'in' ? DV.conf.finals.dimension.indicator.value : - t === 'de' ? DV.conf.finals.dimension.dataelement.value : - t === 'ds' ? DV.conf.finals.dimension.dataset.value : t, - dataid: r[i][2], - periodid: r[i][3], - organisationunitid: r[i][4] + value: parseFloat(values[i][0]), + data: values[i][1], + period: values[i][2], + organisationunit: values[i][3] }; - if (DV.util.variable.isNotEmpty(r[i][5])) { - v.organisationunitgroupid = r[i][5]; - } - values.push(v); + //if (DV.util.variable.isNotEmpty(r[i][5])) { + //v.organisationunitgroupid = r[i][5]; + //} + a.push(v); } - return values; + return a; } }, crud: { @@ -1352,7 +1286,7 @@ fields: ['id', 'name'], proxy: { type: 'ajax', - url: DV.conf.finals.ajax.path_commons + DV.conf.finals.ajax.indicator_get, + url: '', reader: { type: 'json', root: 'indicators' @@ -1364,7 +1298,7 @@ s.each( function(r) { r.data.name = DV.conf.util.jsonEncode(r.data.name); }); - DV.util.store.addToStorage(s); + DV.util.store.addToStorage(s); DV.util.multiselect.filterAvailable(DV.cmp.dimension.indicator.available, DV.cmp.dimension.indicator.selected); } } @@ -1379,7 +1313,7 @@ fields: ['id', 'name'], proxy: { type: 'ajax', - url: DV.conf.finals.ajax.path_commons + DV.conf.finals.ajax.dataelement_get, + url: DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.dataelement_get, reader: { type: 'json', root: 'dataElements' @@ -1391,7 +1325,7 @@ s.each( function(r) { r.data.name = DV.conf.util.jsonEncode(r.data.name); }); - DV.util.store.addToStorage(s); + DV.util.store.addToStorage(s); DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataelement.available, DV.cmp.dimension.dataelement.selected); } } @@ -1406,7 +1340,7 @@ fields: ['id', 'name'], proxy: { type: 'ajax', - url: DV.conf.finals.ajax.path_commons + DV.conf.finals.ajax.dataset_get, + url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.dataset_get, reader: { type: 'json', root: 'dataSets' @@ -1420,8 +1354,9 @@ s.each( function(r) { r.data.name = DV.conf.util.jsonEncode(r.data.name); }); - DV.util.store.addToStorage(s); + DV.util.store.addToStorage(s); DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataset.available, DV.cmp.dimension.dataset.selected); + s.sort('name', 'ASC'); } } }), @@ -1539,7 +1474,7 @@ if (id) { Ext.Ajax.request({ - url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.favorite_get + id + '.json?links=false', + url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.favorite_get + id + '.json?links=false&paging=false', scope: this, success: function(r) { if (!this.validation.response(r)) { @@ -1565,25 +1500,25 @@ if (f.indicators) { for (var i = 0; i < f.indicators.length; i++) { - DV.c.indicator.objects.push({id: f.indicators[i].internalId, name: DV.conf.util.jsonEncode(f.indicators[i].shortName)}); + DV.c.indicator.objects.push({id: f.indicators[i].id, name: DV.conf.util.jsonEncode(f.indicators[i].shortName)}); } } if (f.dataElements) { for (var i = 0; i < f.dataElements.length; i++) { - DV.c.dataelement.objects.push({id: f.dataElements[i].internalId, name: DV.conf.util.jsonEncode(f.dataElements[i].shortName)}); + DV.c.dataelement.objects.push({id: f.dataElements[i].id, name: DV.conf.util.jsonEncode(f.dataElements[i].shortName)}); } } if (f.dataSets) { for (var i = 0; i < f.dataSets.length; i++) { - DV.c.dataset.objects.push({id: f.dataSets[i].internalId, name: DV.conf.util.jsonEncode(f.dataSets[i].shortName)}); + DV.c.dataset.objects.push({id: f.dataSets[i].id, name: DV.conf.util.jsonEncode(f.dataSets[i].shortName)}); } } DV.c.period.rp = f.relativePeriods; for (var i = 0; i < f.organisationUnits.length; i++) { - DV.c.organisationunit.objects.push({id: f.organisationUnits[i].internalId, name: DV.conf.util.jsonEncode(f.organisationUnits[i].shortName)}); + DV.c.organisationunit.objects.push({id: f.organisationUnits[i].id, name: DV.conf.util.jsonEncode(f.organisationUnits[i].shortName)}); } - DV.c.organisationunit.groupsetid = f.organisationUnitGroupSet ? f.organisationUnitGroupSet.internalId : null; + DV.c.organisationunit.groupsetid = f.organisationUnitGroupSet ? f.organisationUnitGroupSet.id : null; DV.c.hidesubtitle = f.hideSubtitle; DV.c.hidelegend = f.hideLegend; @@ -1630,17 +1565,17 @@ } DV.c.data = {}; - DV.c.data.objects = []; - DV.c.data.objects = DV.c.data.objects.concat(DV.c.indicator.objects); - DV.c.data.objects = DV.c.data.objects.concat(DV.c.dataelement.objects); - DV.c.data.objects = DV.c.data.objects.concat(DV.c.dataset.objects); - + DV.c.data.objects = DV.util.dimension.data.getObjects(); DV.c.period.objects = DV.util.dimension.period.getObjectsByRelativePeriods(DV.c.period.rp); - if (!this.validation.objects()) { + if (!this.validation.objects.selection()) { return; } + this.validation.objects[DV.c.dimension.series](); + this.validation.objects[DV.c.dimension.category](); + this.validation.objects[DV.c.dimension.filter](true); + DV.c.series = DV.c[DV.c.dimension.series]; DV.c.category = DV.c[DV.c.dimension.category]; DV.c.filter = DV.c[DV.c.dimension.filter]; @@ -1649,10 +1584,6 @@ DV.c.category.dimension = DV.conf.finals.chart.category; DV.c.filter.dimension = DV.conf.finals.chart.filter; - DV.c.series.names = DV.util.dimension[DV.c.dimension.series].getNames(true); - DV.c.category.names = DV.util.dimension[DV.c.dimension.category].getNames(true); - DV.c.filter.names = DV.util.dimension[DV.c.dimension.filter].getNames(true, true); - DV.c.series.url = DV.util.dimension[DV.c.dimension.series].getUrl(); DV.c.category.url = DV.util.dimension[DV.c.dimension.category].getUrl(); DV.c.filter.url = DV.util.dimension[DV.c.dimension.filter].getUrl(true); @@ -1783,8 +1714,6 @@ DV.util.checkbox.setRelativePeriods(DV.c.period.rp); - DV.cmp.dimension.organisationunit.treepanel.addToStorage(DV.c.organisationunit.objects); - if (DV.c.organisationunit.groupsetid) { if (DV.store.groupset.isloaded) { DV.cmp.dimension.organisationunit.panel.groupsets.setValue(DV.c.organisationunit.groupsetid); @@ -1809,23 +1738,48 @@ } return true; }, - objects: function() { - if (!DV.c.data.objects.length) { - DV.util.notification.error(DV.i18n.et_no_indicators_dataelements_datasets, DV.i18n.em_no_indicators_dataelements_datasets); - return false; - } - if (!DV.c.period.objects.length) { - DV.util.notification.error(DV.i18n.et_no_periods, DV.i18n.em_no_periods); - return false; - } - if (!DV.c.organisationunit.objects.length) { - DV.util.notification.error(DV.i18n.et_no_orgunits, DV.i18n.em_no_orgunits); - return false; - } - return true; + objects: { + selection: function() { + if (!DV.c.data.objects.length) { + DV.util.notification.error(DV.i18n.et_no_indicators_dataelements_datasets, DV.i18n.em_no_indicators_dataelements_datasets); + return false; + } + if (!DV.c.period.objects.length) { + DV.util.notification.error(DV.i18n.et_no_periods, DV.i18n.em_no_periods); + return false; + } + if (!DV.c.organisationunit.objects.length) { + DV.util.notification.error(DV.i18n.et_no_orgunits, DV.i18n.em_no_orgunits); + return false; + } + return true; + }, + data: function(isFilter) { + if (isFilter && DV.c.data.objects.length > 1) { + DV.chart.warnings.push(DV.i18n.wm_multiple_filter_ind_de_ds + ' ' + DV.i18n.wm_first_filter_used); + DV.c.data.objects = DV.c.data.objects.slice(0,1); + } + }, + period: function(isFilter) { + if (isFilter && DV.c.period.objects.length > 1) { + DV.chart.warnings.push(DV.i18n.wm_multiple_filter_period + ' ' + DV.i18n.wm_first_filter_used); + DV.c.period.objects = DV.c.period.objects.slice(0,1); + } + }, + organisationunit: function(isFilter) { + if (isFilter) { + if (DV.c.organisationunit.objects.length > 1) { + DV.chart.warnings.push(DV.i18n.wm_multiple_filter_orgunit + ' ' + DV.i18n.wm_first_filter_used); + } + else if (DV.c.organisationunit.groupsetid) { + DV.chart.warnings.push(DV.i18n.wm_multiple_filter_groups + ' ' + DV.i18n.wm_first_filter_used); + } + DV.c.organisationunit.objects = DV.c.organisationunit.objects.slice(0,1); + } + } }, categories: function() { - if (DV.c.category.names.length < 2 && (DV.c.type === DV.conf.finals.chart.line || DV.c.type === DV.conf.finals.chart.area)) { + if (DV.c.category.objects.length < 2 && (DV.c.type === DV.conf.finals.chart.line || DV.c.type === DV.conf.finals.chart.area)) { DV.util.notification.error(DV.i18n.et_line_area_categories, DV.i18n.em_line_area_categories); return false; } @@ -1843,7 +1797,7 @@ DV.c.trendline = false; } - if (DV.c.category.names.length < 2) { + if (DV.c.category.objects.length < 2) { reasons.push(DV.i18n.wm_required_categories); DV.c.trendline = false; } @@ -1871,7 +1825,7 @@ DV.c.targetlinevalue = null; } - if (DV.c.category.names.length < 2) { + if (DV.c.category.objects.length < 2) { reasons.push(DV.i18n.wm_required_categories); DV.c.targetlinevalue = null; } @@ -1899,7 +1853,7 @@ DV.c.baselinevalue = null; } - if (DV.c.category.names.length < 2) { + if (DV.c.category.objects.length < 2) { reasons.push(DV.i18n.wm_required_categories); DV.c.baselinevalue = null; } @@ -1958,32 +1912,35 @@ params = params.concat(DV.c.period.url); params = params.concat(DV.c.organisationunit.url); - var baseurl = DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.data_get; + var baseurl = DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.data_get; Ext.Array.each(params, function(item) { baseurl = Ext.String.urlAppend(baseurl, item); }); + params = { + periodIsFilter: (DV.c.dimension.filter === DV.conf.finals.dimension.period.value), + userOrganisationUnit: DV.c.userorganisationunit, + userOrganisationUnitChildren: DV.c.userorganisationunitchildren + }; + if (DV.c.organisationunit.groupsetid) { + params.organisationUnitGroupSetId = DV.c.organisationunit.groupsetid; + } + Ext.Ajax.request({ url: baseurl, + method: 'GET', + params: params, disableCaching: false, success: function(r) { - DV.value.values = DV.util.value.jsonfy(r); + r = Ext.JSON.decode(r.responseText); + DV.value.values = DV.util.value.jsonfy(r.v); if (!DV.state.validation.value()) { return; } - Ext.Array.each(DV.value.values, function(item) { - item[DV.conf.finals.dimension.data.value] = DV.store[item.type].available.storage[item.dataid].name; - item[DV.conf.finals.dimension.period.value] = DV.util.dimension.period.getNameById(item.periodid); - item[DV.conf.finals.dimension.organisationunit.value] = DV.cmp.dimension.organisationunit.treepanel.findNameById(item.organisationunitid); - - if (item.organisationunitgroupid) { - item[DV.conf.finals.dimension.organisationunit.value] = DV.util.dimension.organisationunit.getGroupNameByGroupId(item.organisationunitgroupid); - item.organisationunitid = item.organisationunitgroupid; - } - - item.value = parseFloat(item.value); - }); + DV.c.data.names = r.d; + DV.c.period.names = r.p; + DV.c.organisationunit.names = r.o; if (exe) { DV.chart.getData(true); @@ -2398,8 +2355,9 @@ items: [ { xtype: 'toolbar', + cls: 'dv-toolbar-2', height: 45, - style: 'padding-top:1px; border-style:none', + style: 'padding-top:0px; border-style:none', defaults: { height: 40, toggleGroup: 'chartsettings', @@ -2601,7 +2559,7 @@ fields: ['id', 'name', 'index'], proxy: { type: 'ajax', - url: DV.conf.finals.ajax.path_commons + DV.conf.finals.ajax.indicatorgroup_get, + url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.indicatorgroup_get, reader: { type: 'json', root: 'indicatorGroups' @@ -2610,7 +2568,10 @@ listeners: { load: function(s) { s.add({id: 0, name: DV.i18n.all_indicator_groups, index: -1}); - s.sort('index', 'ASC'); + s.sort([ + { property: 'index', direction: 'ASC' }, + { property: 'name', direction: 'ASC' } + ]); } } }), @@ -2624,7 +2585,14 @@ DV.util.multiselect.filterAvailable(DV.cmp.dimension.indicator.available, DV.cmp.dimension.indicator.selected); } else { - store.load({params: {id: cb.getValue()}}); + if (cb.getValue() === 0) { + store.proxy.url = DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.indicator_getall; + store.load(); + } + else { + store.proxy.url = DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.indicator_get + cb.getValue() + '.json'; + store.load(); + } } } } @@ -2762,7 +2730,7 @@ fields: ['id', 'name', 'index'], proxy: { type: 'ajax', - url: DV.conf.finals.ajax.path_commons + DV.conf.finals.ajax.dataelementgroup_get, + url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.dataelementgroup_get, reader: { type: 'json', root: 'dataElementGroups' @@ -2771,7 +2739,10 @@ listeners: { load: function(s) { s.add({id: 0, name: '[ All data element groups ]', index: -1}); - s.sort('index', 'ASC'); + s.sort([ + { property: 'index', direction: 'ASC' }, + { property: 'name', direction: 'ASC' } + ]); } } }), @@ -2785,7 +2756,14 @@ DV.util.multiselect.filterAvailable(DV.cmp.dimension.dataelement.available, DV.cmp.dimension.dataelement.selected); } else { - store.load({params: {id: cb.getValue()}}); + if (cb.getValue() === 0) { + store.proxy.url = DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.dataelement_getall; + store.load(); + } + else { + store.proxy.url = DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.dataelement_get + cb.getValue() + '.json'; + store.load(); + } } } } @@ -3216,12 +3194,6 @@ autoScroll: true, multiSelect: true, rendered: false, - storage: {}, - addToStorage: function(objects) { - for (var i = 0; i < objects.length; i++) { - this.storage[objects[i].id] = objects[i]; - } - }, selectRoot: function() { if (this.rendered) { if (!this.getSelectionModel().getSelection().length) { @@ -3229,17 +3201,6 @@ } } }, - findNameById: function(id) { - var name = this.store.getNodeById(id) ? this.store.getNodeById(id).data.text : null; - if (!name) { - for (var k in this.storage) { - if (k == id) { - name = this.storage[k].name; - } - } - } - return name; - }, store: Ext.create('Ext.data.TreeStore', { proxy: { type: 'ajax', @@ -3580,10 +3541,10 @@ bodyStyle: 'padding-top:5px', tbar: { xtype: 'toolbar', - cls: 'dv-toolbar', + cls: 'dv-toolbar-1', height: DV.conf.layout.center_tbar_height, defaults: { - height: 26 + height: 30 }, items: [ { @@ -3615,7 +3576,6 @@ DV.exe.execute(); } }, - ' ', DV.util.toolbar.separator, ' ', { xtype: 'button', cls: 'dv-toolbar-btn-2', @@ -3623,7 +3583,6 @@ listeners: { afterrender: function(b) { this.menu = Ext.create('Ext.menu.Menu', { - margin: '2 0 0 0', shadow: false, showSeparator: false, items: [ @@ -3720,7 +3679,7 @@ store: DV.store.favorite, tbar: { id: 'favorite_t', - cls: 'dv-toolbar', + cls: 'dv-toolbar-2', height: 30, defaults: { height: 24 @@ -3736,10 +3695,11 @@ afterrender: function(b) { this.addCls('dv-menu-togglegroup'); this.menu = Ext.create('Ext.menu.Menu', { - shadowOffset: 1, + margin: '2 0 0 0', + shadow: false, showSeparator: false, width: 109, - height: 70, + height: 67, items: [ { xtype: 'radiogroup', @@ -3833,53 +3793,56 @@ } } ], - bbar: [ - { - xtype: 'label', - style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%', - listeners: { - added: function() { - DV.cmp.favorite.rename.label = this; + bbar: { + cls: 'dv-toolbar-2', + items: [ + { + xtype: 'label', + style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:50%', + listeners: { + added: function() { + DV.cmp.favorite.rename.label = this; + } + } + }, + '->', + { + text: DV.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + { + text: DV.i18n.rename, + disabled: true, + xable: function() { + var value = this.up('window').cmp.name.getValue(); + if (value) { + if (DV.store.favorite.findExact('name', value) == -1) { + this.enable(); + DV.cmp.favorite.rename.label.setText(''); + return; + } + else { + DV.cmp.favorite.rename.label.setText(DV.i18n.name_already_in_use); + } + } + this.disable(); + }, + handler: function() { + DV.util.crud.favorite.updateName(this.up('window').cmp.name.getValue()); + }, + listeners: { + afterrender: function() { + this.up('window').cmp.rename = this; + }, + change: function() { + this.xable(); + } } } - }, - '->', - { - text: DV.i18n.cancel, - handler: function() { - this.up('window').close(); - } - }, - { - text: DV.i18n.rename, - disabled: true, - xable: function() { - var value = this.up('window').cmp.name.getValue(); - if (value) { - if (DV.store.favorite.findExact('name', value) == -1) { - this.enable(); - DV.cmp.favorite.rename.label.setText(''); - return; - } - else { - DV.cmp.favorite.rename.label.setText(DV.i18n.name_already_in_use); - } - } - this.disable(); - }, - handler: function() { - DV.util.crud.favorite.updateName(this.up('window').cmp.name.getValue()); - }, - listeners: { - afterrender: function() { - this.up('window').cmp.rename = this; - }, - change: function() { - this.xable(); - } - } - } - ], + ] + }, listeners: { afterrender: function() { DV.cmp.favorite.rename.window = this; @@ -3930,25 +3893,28 @@ cls: 'dv-window-confirm-list' } ], - bbar: [ - { - text: DV.i18n.cancel, - handler: function() { - this.up('window').close(); - } - }, - '->', - { - text: DV.i18n.delete_object, - handler: function() { - this.up('window').close(); - DV.util.crud.favorite.del(function() { - DV.cmp.favorite.name.setValue(''); - DV.cmp.favorite.window.down('grid').setHeightInWindow(DV.store.favorite); - }); - } - } - ] + bbar: { + cls: 'dv-toolbar-2', + items: [ + { + text: DV.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + '->', + { + text: DV.i18n.delete_object, + handler: function() { + this.up('window').close(); + DV.util.crud.favorite.del(function() { + DV.cmp.favorite.name.setValue(''); + DV.cmp.favorite.window.down('grid').setHeightInWindow(DV.store.favorite); + }); + } + } + ] + } }); w.setPosition((screen.width/2)-(DV.conf.layout.window_confirm_width/2), DV.conf.layout.window_favorite_ypos + 100, true); w.show(); @@ -3980,113 +3946,116 @@ } } ], - bbar: [ - { - xtype: 'label', - style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:70%', - listeners: { - added: function() { - DV.cmp.favorite.label = this; - } - } - }, - '->', - { - text: DV.i18n.save, - disabled: true, - xable: function() { - if (DV.c.rendered) { - if (DV.cmp.favorite.name.getValue()) { - var index = DV.store.favorite.findExact('name', DV.cmp.favorite.name.getValue()); - if (index != -1) { - if (DV.store.favorite.getAt(index).data.userId || DV.init.user.isadmin) { - this.enable(); - DV.cmp.favorite.label.setText(''); - return true; - } - else { - DV.cmp.favorite.label.setText(DV.i18n.system_favorite_overwrite_not_allowed); - } - } - else { - this.enable(); - DV.cmp.favorite.label.setText(''); - return true; - } - } - else { - DV.cmp.favorite.label.setText(''); - } - } - else { - if (DV.cmp.favorite.name.getValue()) { - DV.cmp.favorite.label.setText(DV.i18n.example_chart_cannot_be_saved); - } - else { - DV.cmp.favorite.label.setText(''); - } - } - this.disable(); - return false; - }, - handler: function() { - if (this.xable()) { - var value = DV.cmp.favorite.name.getValue(); - if (DV.store.favorite.findExact('name', value) != -1) { - var item = value.length > 40 ? (value.substr(0,40) + '...') : value; - var w = Ext.create('Ext.window.Window', { - title: DV.i18n.save_favorite, - width: DV.conf.layout.window_confirm_width, - bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center', - modal: true, - items: [ - { - html: DV.i18n.are_you_sure, - bodyStyle: 'border-style:none' - }, - { - html: '
' + item, - cls: 'dv-window-confirm-list' - } - ], - bbar: [ - { - text: DV.i18n.cancel, - handler: function() { - this.up('window').close(); - } - }, - '->', - { - text: DV.i18n.overwrite, - handler: function() { - this.up('window').close(); - DV.util.crud.favorite.update(function() { - DV.cmp.favorite.window.resetForm(); - }); - - } - } - ] - }); - w.setPosition((screen.width/2)-(DV.conf.layout.window_confirm_width/2), DV.conf.layout.window_favorite_ypos + 100, true); - w.show(); - } - else { - DV.util.crud.favorite.create(function() { - DV.cmp.favorite.window.resetForm(); - DV.cmp.favorite.window.down('grid').setHeightInWindow(DV.store.favorite); - }); - } - } - }, - listeners: { - added: function() { - DV.cmp.favorite.save = this; - } - } - } - ], + bbar: { + cls: 'dv-toolbar-2', + items: [ + { + xtype: 'label', + style: 'padding-left:2px; line-height:22px; font-size:10px; color:#666; width:70%', + listeners: { + added: function() { + DV.cmp.favorite.label = this; + } + } + }, + '->', + { + text: DV.i18n.save, + disabled: true, + xable: function() { + if (DV.c.rendered) { + if (DV.cmp.favorite.name.getValue()) { + var index = DV.store.favorite.findExact('name', DV.cmp.favorite.name.getValue()); + if (index != -1) { + if (DV.store.favorite.getAt(index).data.userId || DV.init.user.isadmin) { + this.enable(); + DV.cmp.favorite.label.setText(''); + return true; + } + else { + DV.cmp.favorite.label.setText(DV.i18n.system_favorite_overwrite_not_allowed); + } + } + else { + this.enable(); + DV.cmp.favorite.label.setText(''); + return true; + } + } + else { + DV.cmp.favorite.label.setText(''); + } + } + else { + if (DV.cmp.favorite.name.getValue()) { + DV.cmp.favorite.label.setText(DV.i18n.example_chart_cannot_be_saved); + } + else { + DV.cmp.favorite.label.setText(''); + } + } + this.disable(); + return false; + }, + handler: function() { + if (this.xable()) { + var value = DV.cmp.favorite.name.getValue(); + if (DV.store.favorite.findExact('name', value) != -1) { + var item = value.length > 40 ? (value.substr(0,40) + '...') : value; + var w = Ext.create('Ext.window.Window', { + title: DV.i18n.save_favorite, + width: DV.conf.layout.window_confirm_width, + bodyStyle: 'padding:10px 5px; background-color:#fff; text-align:center', + modal: true, + items: [ + { + html: DV.i18n.are_you_sure, + bodyStyle: 'border-style:none' + }, + { + html: '
' + item, + cls: 'dv-window-confirm-list' + } + ], + bbar: [ + { + text: DV.i18n.cancel, + handler: function() { + this.up('window').close(); + } + }, + '->', + { + text: DV.i18n.overwrite, + handler: function() { + this.up('window').close(); + DV.util.crud.favorite.update(function() { + DV.cmp.favorite.window.resetForm(); + }); + + } + } + ] + }); + w.setPosition((screen.width/2)-(DV.conf.layout.window_confirm_width/2), DV.conf.layout.window_favorite_ypos + 100, true); + w.show(); + } + else { + DV.util.crud.favorite.create(function() { + DV.cmp.favorite.window.resetForm(); + DV.cmp.favorite.window.down('grid').setHeightInWindow(DV.store.favorite); + }); + } + } + }, + listeners: { + added: function() { + DV.cmp.favorite.save = this; + } + } + } + ] + }, listeners: { show: function() { DV.cmp.favorite.save.xable(); @@ -4108,7 +4077,11 @@ } } }, - '-', + { + xtype: 'menuseparator', + height: 1, + style: 'margin:1px 0; border-color:#dadada' + }, { xtype: 'grid', cls: 'dv-menugrid', @@ -4132,7 +4105,7 @@ } ], setHeightInMenu: function(store) { - var h = store.getCount() * 26, + var h = store.getCount() * 24, sh = DV.util.viewport.getSize().y * 0.6; this.setHeight(h > sh ? sh : h); this.doLayout(); @@ -4215,42 +4188,45 @@ } } ], - bbar: [ - '->', - { - text: DV.i18n.share, - disabled: true, - xable: function() { - if (DV.cmp.share.textarea.getValue()) { - this.enable(); - } - else { - this.disable(); - } - }, - handler: function() { - if (DV.cmp.share.textarea.getValue() && DV.c.currentFavorite) { - Ext.Ajax.request({ - url: DV.conf.finals.ajax.path_api + 'interpretations/chart/' + DV.c.currentFavorite.id, - method: 'POST', - params: DV.cmp.share.textarea.getValue(), - headers: {'Content-Type': 'text/html'}, - success: function() { - DV.cmp.share.textarea.reset(); - DV.cmp.share.button.disable(); - DV.cmp.share.window.hide(); - DV.util.notification.interpretation(DV.i18n.interpretation_was_shared + '.'); - } - }); - } - }, - listeners: { - added: function() { - DV.cmp.share.button = this; + bbar: { + cls: 'dv-toolbar-2', + items: [ + '->', + { + text: DV.i18n.share, + disabled: true, + xable: function() { + if (DV.cmp.share.textarea.getValue()) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + if (DV.cmp.share.textarea.getValue() && DV.c.currentFavorite) { + Ext.Ajax.request({ + url: DV.conf.finals.ajax.path_api + 'interpretations/chart/' + DV.c.currentFavorite.id, + method: 'POST', + params: DV.cmp.share.textarea.getValue(), + headers: {'Content-Type': 'text/html'}, + success: function() { + DV.cmp.share.textarea.reset(); + DV.cmp.share.button.disable(); + DV.cmp.share.window.hide(); + DV.util.notification.interpretation(DV.i18n.interpretation_was_shared + '.'); + } + }); + } + }, + listeners: { + added: function() { + DV.cmp.share.button = this; + } } } - } - ] + ] + } }).show(); } }, @@ -4289,7 +4265,7 @@ listeners: { afterrender: function(b) { this.menu = Ext.create('Ext.menu.Menu', { - margin: '2 0 0 0', + cls: 'dv-menu', shadow: false, showSeparator: false, items: [ === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2012-06-04 13:08:06 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2012-06-07 17:26:10 +0000 @@ -33,11 +33,6 @@ /* Combobox border-radius */ .dv-combo input { - -moz-border-radius: 2px 0px 0px 0px; - -webkit-border-radius: 2px 0px 0px 0px; - -o-border-radius: 2px 0px 0px 0px; - -ms-border-radius: 2px 0px 0px 0px; - -khtml-border-radius: 2px 0px 0px 0px; border-radius: 2px 0px 0px 0px; } @@ -60,12 +55,7 @@ /* Fieldset border */ .x-fieldset { border: 1px solid #ddd; - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; padding-top: 8px; padding-bottom: 4px; } @@ -124,71 +114,40 @@ } .x-grid-row-over .x-grid-cell-first, .x-grid-row-selected .x-grid-cell-first { - -moz-border-radius: 2px 0 0 2px; - -webkit-border-radius: 2px 0 0 2px; - -o-border-radius: 2px 0 0 2px; - -ms-border-radius: 2px 0 0 2px; - -khtml-border-radius: 2px 0 0 2px; border-radius: 2px 0 0 2px; } .x-grid-row-over .x-grid-cell-last, .x-grid-row-selected .x-grid-cell-last { - -moz-border-radius: 0 2px 2px 0; - -webkit-border-radius: 0 2px 2px 0; - -o-border-radius: 0 2px 2px 0; - -ms-border-radius: 0 2px 2px 0; - -khtml-border-radius: 0 2px 2px 0; border-radius: 0 2px 2px 0; } /* DV menu grid */ .dv-menugrid .x-grid-row .x-grid-cell, .dv-menugrid .x-grid-row-selected .x-grid-cell { border: 0 none; - border-top: 1px solid transparent; - border-bottom: 1px solid transparent; background: #f1f1f1; } -.dv-menugrid .x-grid-row .x-grid-cell-first, .dv-menugrid .x-grid-row-selected .x-grid-cell-first { - border: 1px solid transparent; - border-right: 0 none; -} -.dv-menugrid .x-grid-row .x-grid-cell-last, .dv-menugrid .x-grid-row-selected .x-grid-cell-last { - border: 1px solid transparent; - border-left: 0 none; +.dv-menugrid .x-grid-row .x-grid-cell-first, +.dv-menugrid .x-grid-row-selected .x-grid-cell-first, +.dv-menugrid .x-grid-row .x-grid-cell-last, +.dv-menugrid .x-grid-row-selected .x-grid-cell-last { + border: 0 none; } .dv-menugrid .x-grid-row-over .x-grid-cell { border: 0 none; - border-top: 1px solid #9d9d9d; - border-bottom: 1px solid #9d9d9d; + background-color: #e1e1e1; background-image: none; - background-color: #E6E6E6; - background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #eeeeee), color-stop(100%, #dcdcdc)); - background-image: -webkit-linear-gradient(top, #eeeeee,#dcdcdc); - background-image: -moz-linear-gradient(top, #eeeeee,#dcdcdc); - background-image: -o-linear-gradient(top, #eeeeee,#dcdcdc); - background-image: -ms-linear-gradient(top, #eeeeee,#dcdcdc); - background-image: linear-gradient(top, #eeeeee,#dcdcdc); -} -.dv-menugrid .x-grid-row-over .x-grid-cell-first { - border: 1px solid #9d9d9d; - border-right: 0 none; - -moz-border-radius: 3px 0 0 3px; - -webkit-border-radius: 3px 0 0 3px; - -o-border-radius: 3px 0 0 3px; - -ms-border-radius: 3px 0 0 3px; - -khtml-border-radius: 3px 0 0 3px; - border-radius: 3px 0 0 3px; -} +} +.dv-menugrid .x-grid-row-over .x-grid-cell-first, .dv-menugrid .x-grid-row-over .x-grid-cell-last { - border: 1px solid #9d9d9d; - border-left: 0 none; - -moz-border-radius: 0 3px 3px 0; - -webkit-border-radius: 0 3px 3px 0; - -o-border-radius: 0 3px 3px 0; - -ms-border-radius: 0 3px 3px 0; - -khtml-border-radius: 0 3px 3px 0; - border-radius: 0 3px 3px 0; + border: 0 none; +} + +.dv-menugrid .x-grid-row-focused .x-grid-cell-inner { + background-color: #f1f1f1; +} +.dv-menugrid .x-grid-row-focused .x-grid-cell { + border-color: #f1f1f1; } /* Tree panel node height */ @@ -197,23 +156,14 @@ } /* Tree panel selected row background */ -.dv-tree .x-grid-row-selected .x-grid-cell, .dv-tree .x-grid-row-selected .x-grid-rowwrap-div { +.dv-tree .x-grid-row-selected .x-grid-cell, +.dv-tree .x-grid-row-selected .x-grid-rowwrap-div { background-color: #e0e0e0; - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; border-radius: 2px 2px 2px 2px; } /* Tree panel hover row background */ .dv-tree .x-grid-cell { - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; border-radius: 2px 2px 2px 2px; } @@ -235,8 +185,8 @@ border: 1px solid transparent; } .x-boundlist-item-over { - background-color: #f1f1f1; - border-color: #f1f1f1; + background-color: #e1e1e1; + border-color: #e1e1e1; } .x-boundlist-selected { background-color: #d3d3d3; @@ -262,24 +212,29 @@ background-image: url('../images/checkbox.gif'); } +/* DV toolbar */ +.dv-toolbar-1 { + padding: 0; +} + /* DV toolbar checkbox */ -.dv-toolbar .x-form-cb-wrap { +.dv-toolbar-1 .x-form-cb-wrap { padding-top: 5px; } -.dv-toolbar .x-form-cb-label-after { +.dv-toolbar-1 .x-form-cb-label-after { margin-left: 3px; color: #333; } /* Button dv-toolbar font size */ -.dv-toolbar * { +.dv-toolbar-1 * { font-size: 11px; } -.dv-toolbar .dv-toolbar-btn-1 * { +.dv-toolbar-1 .dv-toolbar-btn-1 * { color: #111; font-weight: bold; } -.dv-toolbar .dv-toolbar-btn-2 * { +.dv-toolbar-1 .dv-toolbar-btn-2 * { color: #444; } @@ -296,23 +251,55 @@ } /* Button border */ -.x-btn-default-toolbar-small, .x-btn-default-toolbar-small-over, .x-btn-default-toolbar-small-pressed { - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; +.x-btn-default-toolbar-small, +.x-btn-default-toolbar-small-over, +.x-btn-default-toolbar-small-pressed { + border-radius: 0px; border: 1px solid transparent; } +.dv-toolbar-2 .x-btn-default-toolbar-small, +.dv-toolbar-2 .x-btn-default-toolbar-small-over, +.dv-toolbar-2 .x-btn-default-toolbar-small-pressed, +.dv-toolbar-multiselect-left .x-btn-default-toolbar-small, +.dv-toolbar-multiselect-left .x-btn-default-toolbar-small-over, +.dv-toolbar-multiselect-right .x-btn-default-toolbar-small, +.dv-toolbar-multiselect-right .x-btn-default-toolbar-small-over { + border-radius: 2px; +} .x-btn-default-toolbar-small-over { - border-color: #ccc; + border-color: #e1e1e1; + background-color: #e1e1e1; + background-image: none; +} +.dv-toolbar-2 .x-btn-default-toolbar-small-over, +.dv-toolbar-multiselect-left .x-btn-default-toolbar-small-over, +.dv-toolbar-multiselect-right .x-btn-default-toolbar-small-over { + border-color: #ccc; + background-image: none; + background-color: #f3f3f3; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #fbfbfb), color-stop(100%, #e9e9e9)); + background-image: -webkit-linear-gradient(top, #fbfbfb,#e9e9e9); + background-image: -moz-linear-gradient(top, #fbfbfb,#e9e9e9); + background-image: -o-linear-gradient(top, #fbfbfb,#e9e9e9); + background-image: -ms-linear-gradient(top, #fbfbfb,#e9e9e9); + background-image: linear-gradient(top, #fbfbfb,#e9e9e9); } -.x-btn-default-toolbar-small-pressed { - border-color: #aaa; +.dv-toolbar-2 .x-btn-default-toolbar-small-pressed, +.dv-toolbar-multiselect-left .x-btn-default-toolbar-small-pressed, +.dv-toolbar-multiselect-right .x-btn-default-toolbar-small-pressed { + border-color: #aaa; + background-image: none; + background-color: #d6d6d6; + background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #c7c7c7), color-stop(100%, #e0e0e0)); + background-image: -webkit-linear-gradient(top, #c7c7c7,#e0e0e0); + background-image: -moz-linear-gradient(top, #c7c7c7,#e0e0e0); + background-image: -o-linear-gradient(top, #c7c7c7,#e0e0e0); + background-image: -ms-linear-gradient(top, #c7c7c7,#e0e0e0); + background-image: linear-gradient(top, #c7c7c7,#e0e0e0); } + /* Toolbar separator */ .x-toolbar .x-toolbar-separator-horizontal { @@ -335,12 +322,7 @@ /* Tooltip */ .x-tip { - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; padding: 3px 4px; border: 1px solid #444; background-color: #444; @@ -396,30 +378,15 @@ /* Toolbar favorites */ #favorite_t { border-bottom-width: 1px !important; - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; } /* Multiselect dock border radius */ -.dv-toolbar-multiselect-left .x-docked-top { - -o-border-top-left-radius: 2px; - -icab-border-top-left-radius: 2px; - -khtml-border-top-left-radius: 2px; - -moz-border-radius-topleft: 2px; - -webkit-border-top-left-radius: 2px; +.dv-toolbar-multiselect-left .x-docked-top { border-top-left-radius: 2px; } -.dv-toolbar-multiselect-right .x-docked-top { - -o-border-top-right-radius: 2px; - -icab-border-top-right-radius: 2px; - -khtml-border-top-right-radius: 2px; - -moz-border-radius-topright: 2px; - -webkit-border-top-right-radius: 2px; +.dv-toolbar-multiselect-right .x-docked-top { border-top-right-radius: 2px; } @@ -455,22 +422,12 @@ /* Menu */ .x-menu-body { border-color: #bbb; - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; } /* Treepanel contextmenu */ #treepanel-contextmenu { - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; border-width: 1px; border-style: solid; border-color: #aaa; @@ -507,12 +464,7 @@ /* Chart tips */ .dv-chart-tips, .dv-chart-tips-pie { - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; padding: 3px 4px 2px; border: 2px solid #777; background-color: #f1f1f1; @@ -572,30 +524,24 @@ /* Menu item icon */ .dv-menu-item-png { background-image:url('../images/png.png'); + padding-left: 18px; } .dv-menu-item-pdf { background-image:url('../images/pdf.png'); -} - -.dv-menu-item-datatable { - background-image:url('../images/datatable.png'); + padding-left: 18px; } .dv-menu-item-edit { background-image:url('../images/edit.png'); + padding-left: 18px; } /* Textfield */ .dv-textfield .x-form-field, .dv-textfield-alt1 .x-form-field { height: 26px; padding-left: 4px; - -moz-border-radius: 2px 2px 2px 2px; - -webkit-border-radius: 2px 2px 2px 2px; - -o-border-radius: 2px 2px 2px 2px; - -ms-border-radius: 2px 2px 2px 2px; - -khtml-border-radius: 2px 2px 2px 2px; - border-radius: 2px 2px 2px 2px; + border-radius: 2px; font-size: 11px; color: #333; } @@ -621,7 +567,7 @@ } .dv-radiogroup .x-form-cb-label-after { padding-left: 2px; - font-size: 11px; + font-size: 10px; color: #444; } .dv-radiogroup .x-form-radio-group { @@ -630,7 +576,7 @@ /* DV menu grid icon/text position aligned with menuitem */ .dv-menugrid .x-grid-cell-inner { - padding: 4px 3px; + padding: 4px 3px 4px 5px; font-size: 10px; color: #444; line-height: 16px; @@ -669,17 +615,7 @@ padding: 6px 5px 4px 8px; border: 0 none; cursor: pointer; - -o-border-top-left-radius: 1px; - -icab-border-top-left-radius: 1px; - -khtml-border-top-left-radius: 1px; - -moz-border-radius-topleft: 1px; - -webkit-border-top-left-radius: 1px; border-top-left-radius: 1px; - -o-border-top-right-radius: 1px; - -icab-border-top-right-radius: 1px; - -khtml-border-top-right-radius: 1px; - -moz-border-radius-topright: 1px; - -webkit-border-top-right-radius: 1px; border-top-right-radius: 1px; } .dv-accordion .x-accordion-item .x-accordion-hd { /* accordion title dock, default */ @@ -707,17 +643,7 @@ } .dv-accordion .x-accordion-item, .dv-accordion-options .x-accordion-item { /* accordion title dock outer, shared */ - -o-border-top-left-radius: 2px; - -icab-border-top-left-radius: 2px; - -khtml-border-top-left-radius: 2px; - -moz-border-radius-topleft: 2px; - -webkit-border-top-left-radius: 2px; border-top-left-radius: 2px; - -o-border-top-right-radius: 2px; - -icab-border-top-right-radius: 2px; - -khtml-border-top-right-radius: 2px; - -moz-border-radius-topright: 2px; - -webkit-border-top-right-radius: 2px; border-top-right-radius: 2px; } .dv-accordion .x-accordion-item { /* accordion title dock outer, default */ @@ -761,3 +687,14 @@ .dv-textarea .x-form-field { font-size: 11px; } + +/* Ext menu */ +.x-menu-item-active .x-menu-item-link { + border-radius: 0; + border-color: #e1e1e1; + background-color: #e1e1e1; + background-image: none; +} +.x-menu-body { + padding: 0; +} === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/ok.png' Binary files dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/ok.png 2012-02-22 02:15:06 +0000 and dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/images/ok.png 2012-06-07 17:07:58 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2012-06-02 14:11:13 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2012-06-05 17:42:28 +0000 @@ -1,1 +1,1 @@ -{"user":{"id":"$!currentUser.id","isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" ),"ou":["$!currentUser.organisationUnit.id","$!encoder.jsonEncode(${currentUser.organisationUnit.name})"],"ouc":[#foreach($ou in $!currentUser.organisationUnit.getSortedChildren())["$!{ou.id}","$!encoder.jsonEncode(${ou.name})"]#if($velocityCount<$currentUser.organisationUnit.getSortedChildren().size()),#end#end]},"rn":["$!{rootNode.id}","$!encoder.jsonEncode(${rootNode.name})"],"p":{"lastMonth":[#foreach($p in $lastMonth)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastMonth.size()),#end#end],"last12Months":[#foreach($p in $last12Months)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$last12Months.size()),#end#end],"lastQuarter":[#foreach($p in $lastQuarter)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastQuarter.size()),#end#end],"last4Quarters":[#foreach($p in $last4Quarters)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$last4Quarters.size()),#end#end],"lastSixMonth":[#foreach($p in $lastSixMonth)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastSixMonth.size()),#end#end],"last2SixMonths":[#foreach($p in $last2SixMonths)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$last2SixMonths.size()),#end#end],"lastYear":[#foreach($p in $lastYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$lastYear.size()),#end#end],"thisYear":[#foreach($p in $thisYear)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$thisYear.size()),#end#end],"last5Years":[#foreach($p in $last5Years)["$!{p.id}","$!encoder.jsonEncode(${p.name})"]#if($velocityCount<$last5Years.size()),#end#end]},"ougs":{#foreach($ougs in $organisationUnitGroupSets)"$!{ougs.id}":[#foreach($oug in $ougs.getSortedGroups()){"id":"$!{oug.id}","name":"$!encoder.jsonEncode($!{oug.name})"}#if($velocityCount<$ougs.getSortedGroups().size()),#end#end]#if($velocityCount<$organisationUnitGroupSets.size()),#end#end}} \ No newline at end of file +{"user":{"id":"$!currentUser.id","isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" ),"ou":["$!currentUser.organisationUnit.uid","$!encoder.jsonEncode(${currentUser.organisationUnit.name})"],"ouc":[#foreach($ou in $!currentUser.organisationUnit.getSortedChildren())["$!{ou.uid}","$!encoder.jsonEncode(${ou.name})"]#if($velocityCount<$currentUser.organisationUnit.getSortedChildren().size()),#end#end]},"rn":["$!{rootNode.uid}","$!encoder.jsonEncode(${rootNode.name})"],"ougs":{#foreach($ougs in $organisationUnitGroupSets)"$!{ougs.uid}":[#foreach($oug in $ougs.getSortedGroups()){"id":"$!{oug.uid}","name":"$!encoder.jsonEncode($!{oug.name})"}#if($velocityCount<$ougs.getSortedGroups().size()),#end#end]#if($velocityCount<$organisationUnitGroupSets.size()),#end#end}} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm 2011-10-27 12:35:27 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminOrganisationUnitChildren.vm 2012-06-06 12:50:27 +0000 @@ -1,1 +1,1 @@ -#set($size = $units.size())[#foreach($unit in $units){"id":${unit.id},"level":${unit.level},"text":"$encoder.jsonEncode(${unit.name})"#if(!$unit.hasChild()),"leaf":true#end}#if($velocityCount < $size),#end#end] \ No newline at end of file +#set($size = $units.size())[#foreach($unit in $units){"id":"${unit.uid}","level":${unit.level},"text":"$encoder.jsonEncode(${unit.name})"#if(!$unit.hasChild()),"leaf":true#end}#if($velocityCount < $size),#end#end] \ No newline at end of file