dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15385
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5561: Reporting module chart settings integrated in data visualizer.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5561 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-12-22 22:00:22 +0100
message:
Reporting module chart settings integrated in data visualizer.
added:
dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAllChartsAction.java
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminCharts.vm
modified:
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/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml
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/css/style.css
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm
--
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-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 2011-12-22 13:09:43 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/AddOrUpdateChartAction.java 2011-12-22 20:42:30 +0000
@@ -211,12 +211,68 @@
this.organisationUnitIds = organisationUnitIds;
}
- private boolean system;
+ private Boolean system;
- public void setSystem( boolean system )
+ public void setSystem( Boolean system )
{
this.system = system;
}
+
+ private Boolean trendLine;
+
+ public void setTrendLine( Boolean trendLine )
+ {
+ this.trendLine = trendLine;
+ }
+
+ private Boolean hideSubtitle;
+
+ public void setHideSubtitle( Boolean hideSubtitle )
+ {
+ this.hideSubtitle = hideSubtitle;
+ }
+
+ private Boolean hideLegend;
+
+ public void setHideLegend( Boolean hideLegend )
+ {
+ this.hideLegend = hideLegend;
+ }
+
+ private Boolean userOrganisationUnit;
+
+ public void setUserOrganisationUnit( Boolean userOrganisationUnit )
+ {
+ this.userOrganisationUnit = userOrganisationUnit;
+ }
+
+ private String xAxisLabel;
+
+ public void setXAxisLabel( String xAxisLabel )
+ {
+ this.xAxisLabel = xAxisLabel;
+ }
+
+ private String yAxisLabel;
+
+ public void setYAxisLabel( String yAxisLabel )
+ {
+ this.yAxisLabel = yAxisLabel;
+ }
+
+ private Double targetLineValue;
+
+ public void setTargetLineValue( Double targetLineValue )
+ {
+ this.targetLineValue = targetLineValue;
+ }
+
+ private String targetLineLabel;
+
+ public void setTargetLineLabel( String targetLineLabel )
+ {
+ this.targetLineLabel = targetLineLabel;
+ }
// -------------------------------------------------------------------------
// Action implementation
@@ -293,10 +349,50 @@
.getOrganisationUnits( organisationUnitIds ) ) );
}
- if ( !system )
+ if ( system == null )
{
chart.setUser( currentUserService.getCurrentUser() );
}
+
+ if ( trendLine != null )
+ {
+ chart.setRegression( trendLine );
+ }
+
+ if ( hideSubtitle != null )
+ {
+ chart.setHideSubtitle( hideSubtitle );
+ }
+
+ if ( hideLegend != null )
+ {
+ chart.setHideLegend( hideLegend );
+ }
+
+ if ( userOrganisationUnit != null )
+ {
+ chart.setUserOrganisationUnit( userOrganisationUnit );
+ }
+
+ if ( xAxisLabel != null )
+ {
+ chart.setDomainAxisLabel( xAxisLabel );
+ }
+
+ if ( yAxisLabel != null )
+ {
+ chart.setRangeAxisLabel( yAxisLabel );
+ }
+
+ if ( targetLineValue != null )
+ {
+ chart.setTargetLineValue( targetLineValue );
+ }
+
+ if ( targetLineLabel != null )
+ {
+ chart.setTargetLineLabel( targetLineLabel );
+ }
chartService.saveOrUpdate( chart );
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAllChartsAction.java'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAllChartsAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/java/org/hisp/dhis/visualizer/action/GetAllChartsAction.java 2011-12-22 14:36:02 +0000
@@ -0,0 +1,76 @@
+package org.hisp.dhis.visualizer.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.Collection;
+
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ */
+public class GetAllChartsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private Collection<Chart> object;
+
+ public Collection<Chart> getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = chartService.getAllCharts();
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2011-12-22 13:43:32 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/META-INF/dhis/beans.xml 2011-12-22 14:36:02 +0000
@@ -60,6 +60,13 @@
<property name="currentUserService" ref="org.hisp.dhis.user.CurrentUserService" />
</bean>
+ <bean id="org.hisp.dhis.visualizer.action.GetAllChartsAction"
+ class="org.hisp.dhis.visualizer.action.GetAllChartsAction"
+ scope="prototype">
+ <property name="chartService"
+ ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
<bean id="org.hisp.dhis.visualizer.action.DeleteChartsAction"
class="org.hisp.dhis.visualizer.action.DeleteChartsAction"
scope="prototype">
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2011-12-22 12:01:45 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/resources/struts.xml 2011-12-22 14:36:02 +0000
@@ -65,6 +65,12 @@
/dhis-web-visualizer/void.vm</result>
</action>
+ <action name="getAllCharts"
+ class="org.hisp.dhis.visualizer.action.GetAllChartsAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-visualizer/jsonminCharts.vm</result>
+ </action>
+
<action name="deleteCharts"
class="org.hisp.dhis.visualizer.action.DeleteChartsAction">
<result name="success" type="velocity-json">
=== 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 2011-12-22 13:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/app.js 2011-12-22 20:57:42 +0000
@@ -8,7 +8,7 @@
],
jsonfy: function(r) {
r = Ext.JSON.decode(r.responseText);
- var obj = {system: {rootNode: {id: r.rn[0], name: r.rn[1], level: 1}, periods: {}, isAdmin: r.isAdmin}};
+ var obj = {system: {rootNode: {id: r.rn[0], name: r.rn[1], level: 1}, periods: {}, user: {id: r.user.id, isAdmin: r.user.isAdmin}}};
for (var relative in r.p) {
obj.system.periods[relative] = [];
for (var i = 0; i < r.p[relative].length; i++) {
@@ -36,7 +36,7 @@
favorite_addorupdate: 'addOrUpdateChart.action',
favorite_addorupdatesystem: 'addOrUpdateSystemChart.action',
favorite_get: 'charts/',
- favorite_getall: 'charts.json?paging=false&links=false',
+ favorite_getall: 'getAllCharts.action',
favorite_delete: 'deleteCharts.action'
},
dimension: {
@@ -91,7 +91,7 @@
center_tbar_height: 31,
east_tbar_height: 31,
east_gridcolumn_height: 30,
- form_label_width: 45,
+ form_label_width: 55,
window_favorite_ypos: 100,
window_confirm_width: 250,
grid_favorite_width: 420
@@ -238,6 +238,9 @@
toggleOrganisationUnit: function() {
DV.cmp.fieldset.organisationunit.toggle();
},
+ toggleOptions: function() {
+ DV.cmp.fieldset.options.toggle();
+ },
collapseFieldsets: function(fieldsets) {
for (var i = 0; i < fieldsets.length; i++) {
fieldsets[i].collapse();
@@ -702,6 +705,17 @@
DV.util.mask.setMask(DV.cmp.favorite.window, 'Saving...');
var params = DV.state.getParams();
params.name = DV.cmp.favorite.name.getValue();
+ params.trendLine = DV.cmp.favorite.trendline.getValue();
+ params.hideSubtitle = DV.cmp.favorite.hidesubtitle.getValue();
+ params.hideLegend = DV.cmp.favorite.hidelegend.getValue();
+ params.userOrganisationUnit = DV.cmp.favorite.userorganisationunit.getValue();
+ params.xAxisLabel = DV.cmp.favorite.xaxislabel.getValue();
+ params.yAxisLabel = DV.cmp.favorite.yaxislabel.getValue();
+ params.targetLineValue = DV.cmp.favorite.targetlinevalue.getValue();
+ if (params.targetLineValue && !DV.cmp.favorite.targetlinelabel.isDisabled()) {
+ params.targetLineLabel = DV.cmp.favorite.targetlinelabel.getValue();
+ }
+
if (isUpdate) {
var store = DV.store.favorite;
params.uid = store.getAt(store.findExact('name', params.name)).data.id;
@@ -891,10 +905,10 @@
}
},
favorite: Ext.create('Ext.data.Store', {
- fields: ['id', 'name', 'lastUpdated'],
+ fields: ['id', 'name', 'lastUpdated', 'userId'],
proxy: {
type: 'ajax',
- url: DV.conf.finals.ajax.path_api + DV.conf.finals.ajax.favorite_getall,
+ url: DV.conf.finals.ajax.path_visualizer + DV.conf.finals.ajax.favorite_getall,
reader: {
type: 'json',
root: 'charts'
@@ -905,11 +919,24 @@
field: 'lastUpdated',
direction: 'DESC'
},
+ sortStore: function() {
+ this.sort(this.sorting.field, this.sorting.direction);
+ },
listeners: {
load: function(s) {
- s.sort(this.sorting.field, this.sorting.direction);
+ s.filterBy(function(r) {
+ if (r.data.userId == DV.init.system.user.id) {
+ return true;
+ }
+ if (!r.data.userId && DV.init.system.user.isAdmin) {
+ return true;
+ }
+ return false;
+ });
+
+ s.sortStore();
s.each(function(r) {
- r.data.lastUpdated = r.data.lastUpdated.substr(0,16).replace('T',' ');
+ r.data.lastUpdated = r.data.lastUpdated.substr(0,16);
r.data.icon = '<img src="images/favorite.png" />';
r.commit();
});
@@ -1073,6 +1100,16 @@
this.category.names = f.names[this.category.dimension];
this.filter.names = f.names[this.filter.dimension];
+ DV.cmp.favorite.trendline.setValue(f.regression);
+ DV.cmp.favorite.hidesubtitle.setValue(f.hideSubtitle);
+ DV.cmp.favorite.hidelegend.setValue(f.hideLegend);
+ DV.cmp.favorite.userorganisationunit.setValue(f.userOrganisationUnit);
+ DV.cmp.favorite.xaxislabel.setValue(f.domainAxisLabel);
+ DV.cmp.favorite.yaxislabel.setValue(f.rangeAxisLabel);
+ DV.cmp.favorite.targetlinevalue.setValue(f.targetLineValue);
+ DV.cmp.favorite.targetlinelabel.setValue(f.targetLineLabel);
+ DV.cmp.favorite.targetlinelabel.xable();
+
this.isRendered = true;
if (exe) {
@@ -1127,7 +1164,7 @@
Ext.Array.each(DV.value.values, function(item) {
item[DV.conf.finals.dimension.data.value] = DV.util.string.getEncodedString(storage[item.d].name);
item[DV.conf.finals.dimension.period.value] = DV.util.string.getEncodedString(DV.util.dimension.period.getNameById(item.p));
- item[DV.conf.finals.dimension.organisationunit.value] = DV.cmp.dimension.organisationunit.treepanel.findNameById(item.o);
+ item[DV.conf.finals.dimension.organisationunit.value] = DV.util.string.getEncodedString(DV.cmp.dimension.organisationunit.treepanel.findNameById(item.o));
item.v = parseFloat(item.v);
});
@@ -1641,7 +1678,7 @@
items: [
{
xtype: 'fieldset',
- id: 'indicator_fs',
+ cls: 'dv-fieldset',
name: DV.conf.finals.dimension.indicator.value,
title: '<a href="javascript:DV.util.fieldset.toggleIndicator();" class="dv-fieldset-title-link">Indicators</a>',
collapsible: true,
@@ -1797,13 +1834,13 @@
DV.cmp.fieldset.indicator = this;
},
expand: function() {
- DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.dataelement, DV.cmp.fieldset.period, DV.cmp.fieldset.organisationunit]);
+ DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.dataelement, DV.cmp.fieldset.period, DV.cmp.fieldset.organisationunit, DV.cmp.fieldset.options]);
}
}
},
{
xtype: 'fieldset',
- id: 'dataelement_fs',
+ cls: 'dv-fieldset',
name: DV.conf.finals.dimension.dataelement.value,
title: '<a href="javascript:DV.util.fieldset.toggleDataElement();" class="dv-fieldset-title-link">Data elements</a>',
collapsed: true,
@@ -1958,13 +1995,13 @@
DV.cmp.fieldset.dataelement = this;
},
expand: function() {
- DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.period, DV.cmp.fieldset.organisationunit]);
+ DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.period, DV.cmp.fieldset.organisationunit, DV.cmp.fieldset.options]);
}
}
},
{
xtype: 'fieldset',
- id: 'period_fs',
+ cls: 'dv-fieldset',
name: DV.conf.finals.dimension.period.value,
title: '<a href="javascript:DV.util.fieldset.togglePeriod();" class="dv-fieldset-title-link">Periods</a>',
collapsed: true,
@@ -2120,13 +2157,13 @@
DV.cmp.fieldset.period = this;
},
expand: function() {
- DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.dataelement, DV.cmp.fieldset.organisationunit]);
+ DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.dataelement, DV.cmp.fieldset.organisationunit, DV.cmp.fieldset.options]);
}
}
- },
+ },
{
xtype: 'fieldset',
- id: 'organisationunit_fs',
+ cls: 'dv-fieldset',
name: DV.conf.finals.dimension.organisationunit.value,
title: '<a href="javascript:DV.util.fieldset.toggleOrganisationUnit();" class="dv-fieldset-title-link">Organisation units</a>',
collapsed: true,
@@ -2208,7 +2245,7 @@
DV.cmp.fieldset.organisationunit = this;
},
expand: function(fs) {
- DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.dataelement, DV.cmp.fieldset.period]);
+ DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.dataelement, DV.cmp.fieldset.period, DV.cmp.fieldset.options]);
var tp = DV.cmp.dimension.organisationunit.treepanel;
if (!tp.isRendered) {
tp.isRendered = true;
@@ -2217,6 +2254,173 @@
}
}
}
+ },
+ {
+ xtype: 'fieldset',
+ cls: 'dv-fieldset',
+ name: 'options',
+ title: '<a href="javascript:DV.util.fieldset.toggleOptions();" class="dv-fieldset-title-link-alt1">Chart options</a>',
+ collapsed: true,
+ collapsible: true,
+ items: [
+ {
+ html: 'NB! These fields are for the PNG version only',
+ bodyStyle: 'border:0 none; color:#555; font-style:italic; padding-bottom:10px'
+ },
+ {
+ xtype: 'panel',
+ layout: 'column',
+ bodyStyle: 'border-style:none; padding-bottom:10px',
+ items: [
+ {
+ xtype: 'checkbox',
+ cls: 'dv-checkbox-alt1',
+ style: 'margin-right:26px',
+ boxLabel: 'Trend line',
+ labelWidth: DV.conf.layout.form_label_width,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.trendline = this;
+ }
+ }
+ },
+ {
+ xtype: 'checkbox',
+ cls: 'dv-checkbox-alt1',
+ style: 'margin-right:26px',
+ boxLabel: 'Hide subtitle',
+ labelWidth: DV.conf.layout.form_label_width,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.hidesubtitle = this;
+ }
+ }
+ },
+ {
+ xtype: 'checkbox',
+ cls: 'dv-checkbox-alt1',
+ style: 'margin-right:26px',
+ boxLabel: 'Hide legend',
+ labelWidth: DV.conf.layout.form_label_width,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.hidelegend = this;
+ }
+ }
+ },
+ {
+ xtype: 'checkbox',
+ cls: 'dv-checkbox-alt1',
+ boxLabel: 'User orgunit',
+ labelWidth: DV.conf.layout.form_label_width,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.userorganisationunit = this;
+ }
+ }
+ }
+ ]
+ },
+ {
+ xtype: 'panel',
+ layout: 'column',
+ bodyStyle: 'border:0 none; padding-bottom:8px',
+ items: [
+ {
+ xtype: 'textfield',
+ cls: 'dv-textfield-alt1',
+ style: 'margin-right:4px',
+ fieldLabel: 'X axis label',
+ labelAlign: 'top',
+ labelSeparator: '',
+ maxLength: 100,
+ enforceMaxLength: true,
+ labelWidth: DV.conf.layout.form_label_width,
+ width: 188,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.xaxislabel = this;
+ }
+ }
+ },
+ {
+ xtype: 'textfield',
+ cls: 'dv-textfield-alt1',
+ fieldLabel: 'Y axis label',
+ labelAlign: 'top',
+ labelSeparator: '',
+ maxLength: 100,
+ enforceMaxLength: true,
+ labelWidth: DV.conf.layout.form_label_width,
+ width: 187,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.yaxislabel = this;
+ }
+ }
+ }
+ ]
+ },
+ {
+ xtype: 'panel',
+ layout: 'column',
+ bodyStyle: 'border:0 none',
+ items: [
+ {
+ xtype: 'numberfield',
+ cls: 'dv-textfield-alt1',
+ style: 'margin-right:4px',
+ hideTrigger: true,
+ fieldLabel: 'Target line value',
+ labelAlign: 'top',
+ labelSeparator: '',
+ maxLength: 100,
+ enforceMaxLength: true,
+ width: 188,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.targetlinevalue = this;
+ },
+ change: function() {
+ DV.cmp.favorite.targetlinelabel.xable();
+ }
+ }
+ },
+ {
+ xtype: 'textfield',
+ cls: 'dv-textfield-alt1',
+ fieldLabel: 'Target line label',
+ labelAlign: 'top',
+ labelSeparator: '',
+ maxLength: 100,
+ enforceMaxLength: true,
+ width: 187,
+ disabled: true,
+ xable: function() {
+ if (DV.cmp.favorite.targetlinevalue.getValue()) {
+ this.enable();
+ }
+ else {
+ this.disable();
+ }
+ },
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.targetlinelabel = this;
+ }
+ }
+ }
+ ]
+ }
+ ],
+ listeners: {
+ afterrender: function() {
+ DV.cmp.fieldset.options = this;
+ },
+ expand: function() {
+ DV.util.fieldset.collapseFieldsets([DV.cmp.fieldset.indicator, DV.cmp.fieldset.dataelement, DV.cmp.fieldset.period, DV.cmp.fieldset.organisationunit]);
+ }
+ }
}
]
}
@@ -2302,6 +2506,10 @@
width: DV.conf.layout.grid_favorite_width,
closeAction: 'hide',
modal: true,
+ resetForm: function() {
+ DV.cmp.favorite.name.setValue('');
+ DV.cmp.favorite.system.setValue(false);
+ },
items: [
{
xtype: 'form',
@@ -2310,9 +2518,9 @@
{
xtype: 'textfield',
cls: 'dv-textfield',
+ fieldLabel: 'Name',
maxLength: 160,
enforceMaxLength: true,
- fieldLabel: 'Name',
labelWidth: DV.conf.layout.form_label_width,
width: DV.conf.layout.grid_favorite_width - 28,
listeners: {
@@ -2323,6 +2531,19 @@
DV.cmp.favorite.save.xable();
}
}
+ },
+ {
+ xtype: 'checkbox',
+ cls: 'dv-checkbox',
+ style: 'padding-bottom:2px',
+ fieldLabel: 'System',
+ labelWidth: DV.conf.layout.form_label_width,
+ disabled: !DV.init.system.user.isAdmin,
+ listeners: {
+ added: function() {
+ DV.cmp.favorite.system = this;
+ }
+ }
}
]
},
@@ -2344,7 +2565,7 @@
}
],
setHeightInWindow: function(store) {
- var h = (store.getTotalCount() * 23) + 30,
+ var h = (store.getCount() * 23) + 30,
sh = DV.util.viewport.getSize().y * 0.8;
this.setHeight(h > sh ? sh : h);
this.doLayout();
@@ -2362,9 +2583,6 @@
{
text: 'Sort by..',
cls: 'dv-toolbar-btn-2',
- handler: function() {
-
- },
listeners: {
added: function() {
DV.cmp.favorite.sortby = this;
@@ -2391,7 +2609,20 @@
var store = DV.store.favorite;
store.sorting.field = 'name';
store.sorting.direction = 'ASC';
- store.sort(store.sorting.field, store.sorting.direction);
+ store.sortStore();
+ this.up('menu').hide();
+ }
+ }
+ },
+ {
+ boxLabel: 'System',
+ name: 'sortby',
+ handler: function() {
+ if (this.getValue()) {
+ var store = DV.store.favorite;
+ store.sorting.field = 'userId';
+ store.sorting.direction = 'ASC';
+ store.sortStore();
this.up('menu').hide();
}
}
@@ -2405,7 +2636,7 @@
var store = DV.store.favorite;
store.sorting.field = 'lastUpdated';
store.sorting.direction = 'DESC';
- store.sort(store.sorting.field, store.sorting.direction);
+ store.sortStore();
this.up('menu').hide();
}
}
@@ -2576,7 +2807,8 @@
DV.cmp.favorite.grid = this;
},
itemclick: function(g, r) {
- DV.cmp.favorite.name.setValue(r.get('name'));
+ DV.cmp.favorite.name.setValue(r.data.name);
+ DV.cmp.favorite.system.setValue(r.data.userId ? false : true);
DV.cmp.favorite.rename.button.xable();
DV.cmp.favorite.del.xable();
},
@@ -2593,18 +2825,6 @@
height: 24
},
items: [
- ' ',
- {
- xtype: 'checkbox',
- boxLabel: 'System',
- disabled: !DV.init.system.isAdmin,
- disabledCls: 'dv-invisible',
- listeners: {
- added: function() {
- DV.cmp.favorite.system = this;
- }
- }
- },
'->',
{
text: 'Save',
@@ -2641,7 +2861,7 @@
{
text: 'Cancel',
handler: function() {
- this.up('window').close();
+ DV.cmp.favorite.window.close();
}
},
'->',
@@ -2650,7 +2870,7 @@
handler: function() {
this.up('window').close();
DV.util.crud.favorite.update(function() {
- DV.cmp.favorite.name.setValue('');
+ DV.cmp.favorite.window.resetForm();
});
}
@@ -2662,7 +2882,7 @@
}
else {
DV.util.crud.favorite.create(function() {
- DV.cmp.favorite.name.setValue('');
+ DV.cmp.favorite.window.resetForm();
DV.cmp.favorite.window.down('grid').setHeightInWindow(DV.store.favorite);
});
}
@@ -2718,7 +2938,7 @@
}
],
setHeightInMenu: function(store) {
- var h = store.getTotalCount() * 26,
+ var h = store.getCount() * 26,
sh = DV.util.viewport.getSize().y * 0.8;
this.setHeight(h > sh ? sh : h);
this.doLayout();
@@ -2806,7 +3026,7 @@
return;
}
- document.getElementById('titleField').value = DV.state.filter.names[0];
+ document.getElementById('titleField').value = DV.state.filter.names[0] || 'Example chart';
document.getElementById('svgField').value = svg[0].parentNode.innerHTML;
document.getElementById('typeField').value = type;
=== 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 2011-12-22 13:11:13 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/css/style.css 2011-12-22 20:05:38 +0000
@@ -75,7 +75,7 @@
}
/* Fieldset trigger icons */
-#indicator_fs .x-tool img, #dataelement_fs .x-tool img, #period_fs .x-tool img, #organisationunit_fs .x-tool img {
+.dv-fieldset .x-tool img {
background-image: url('../images/tool-sprites.gif');
width: 25px;
}
@@ -239,17 +239,25 @@
border-color: #d3d3d3;
}
+/* Checkbox box label */
+.x-form-cb-label-after {
+ padding-left: 1px;
+ font-size: 11px;
+}
+/* DV checkbox */
+.dv-checkbox .x-form-item-label {
+ padding-left: 5px;
+}
+.dv-checkbox .x-form-cb-label-after {
+ margin-left: 3px;
+ font-size: 11px;
+}
+
/* Checkbox icons */
.x-form-checkbox {
background-image: url('../images/checkbox.gif');
}
-/* Checkbox box label */
-.x-form-cb-label-after {
- padding-left: 1px;
- font-size: 11px;
-}
-
/* DV toolbar checkbox */
.dv-toolbar .x-form-cb-wrap {
padding-top: 5px;
@@ -468,7 +476,13 @@
color:#000;
font-size: 11px;
font-weight: bold;
- text-decoration:none;
+ text-decoration: none;
+}
+.dv-fieldset-title-link-alt1 {
+ color:#555;
+ font-size: 11px;
+ font-weight: bold;
+ text-decoration: none;
}
/* Multiselect */
@@ -529,7 +543,7 @@
}
/* Textfield */
-.dv-textfield .x-form-field {
+.dv-textfield .x-form-field, .dv-textfield-alt1 .x-form-field {
height: 26px;
padding-left: 4px;
-moz-border-radius: 2px 2px 2px 2px;
@@ -545,6 +559,10 @@
padding-left: 5px;
line-height: 20px;
}
+.dv-textfield-alt1 .x-form-item-label {
+ padding-left: 5px;
+ line-height: 8px;
+}
/* DV window confirm list */
.dv-window-confirm-list .x-panel-body {
=== 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 2011-12-22 12:01:45 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonInitialize.vm 2011-12-22 15:30:18 +0000
@@ -1,1 +1,1 @@
-{"isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" ),"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],"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]}}
\ No newline at end of file
+{"user":{"id":"$!currentUser.id","isAdmin":$auth.hasAccess( "dhis-web-visualizer", "addOrUpdateSystemChart" )},"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],"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]}}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminCharts.vm'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminCharts.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/jsonminCharts.vm 2011-12-22 15:30:18 +0000
@@ -0,0 +1,1 @@
+#set( $size = $object.size() ){"charts":[#foreach( $chart in $object ){"id":"$!{chart.uid}","name":"$!encoder.jsonEncode(${chart.name})","lastUpdated":"$!{chart.lastUpdated}","userId":"$!{chart.user.id}"}#if( $velocityCount < $size ),#end#end]}
\ No newline at end of file