dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #13203
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4177: ChartGroup - Applied GUI.
------------------------------------------------------------
revno: 4177
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-07-21 13:51:02 +0700
message:
ChartGroup - Applied GUI.
added:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartGroupNameComparator.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/AddChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupListAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/UpdateChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ValidateChartGroupAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartGroupForm.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/chartGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/addChartGroupForm.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/updateChartGroupForm.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-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
=== added file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartGroupNameComparator.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartGroupNameComparator.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/chart/comparator/ChartGroupNameComparator.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,45 @@
+package org.hisp.dhis.chart.comparator;
+
+/*
+ * 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.Comparator;
+
+import org.hisp.dhis.chart.ChartGroup;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class ChartGroupNameComparator
+ implements Comparator<ChartGroup>
+{
+ public int compare( ChartGroup group1, ChartGroup group2 )
+ {
+ return group1.getName().compareToIgnoreCase( group2.getName() );
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-06-30 07:55:55 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/validationRules.js 2011-07-21 06:51:02 +0000
@@ -370,5 +370,26 @@
"value" : {
"required" : true
}
+ },
+ "chartGroup" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 3, 230 ],
+ "alphanumericwithbasicpuncspaces" : true
+ }
+ },
+ "reportGroup" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 3, 230 ],
+ "alphanumericwithbasicpuncspaces" : true
+ }
+ },
+ "reportTableGroup" : {
+ "name" : {
+ "required" : true,
+ "rangelength" : [ 3, 230 ],
+ "alphanumericwithbasicpuncspaces" : true
+ }
}
}
=== added directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup'
=== added directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action'
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/AddChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/AddChartGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/AddChartGroupAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,98 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class AddChartGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Set<String> groupMembers = new HashSet<String>();
+
+ public void setGroupMembers( Set<String> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ private ChartGroup chartGroup;
+
+ public ChartGroup getChartGroup()
+ {
+ return chartGroup;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ chartGroup = new ChartGroup( name );
+
+ for ( String id : groupMembers )
+ {
+ chartGroup.addChart( chartService.getChart( Integer.parseInt( id ) ) );
+ }
+
+ chartService.addChartGroup( chartGroup );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,90 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetChartGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private ChartGroup chartGroup;
+
+ public ChartGroup getChartGroup()
+ {
+ return chartGroup;
+ }
+
+// private int memberCount;
+//
+// public int getMemberCount()
+// {
+// return memberCount;
+// }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ chartGroup = chartService.getChartGroup( id );
+
+ //memberCount = chartGroup.getMembers().size();
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupListAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/GetChartGroupListAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,110 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 static org.apache.commons.lang.StringUtils.isNotBlank;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+import org.hisp.dhis.chart.comparator.ChartGroupNameComparator;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class GetChartGroupListAction
+ extends ActionPagingSupport<ChartGroup>
+{
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+ private static final long serialVersionUID = -1L;
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<ChartGroup> chartGroups;
+
+ public List<ChartGroup> getChartGroups()
+ {
+ return chartGroups;
+ }
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( chartService.getChartGroupCountByName( key ) );
+
+ chartGroups = new ArrayList<ChartGroup>( chartService.getChartGroupsBetweenByName( key, paging.getStartPos(), paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( chartService.getChartGroupCount() );
+
+ chartGroups = new ArrayList<ChartGroup>( chartService.getChartGroupsBetween( paging.getStartPos(), paging.getPageSize() ) );
+ }
+
+ Collections.sort( chartGroups, new ChartGroupNameComparator() );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/RemoveChartGroupAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,112 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+public class RemoveChartGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // I18n
+ // -------------------------------------------------------------------------
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ try
+ {
+ chartService.deleteChartGroup( chartService.getChartGroup( id ) );
+
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getClassName();
+
+ return ERROR;
+ }
+ }
+
+ message = i18n.getString( "item_deleted_successfully" );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ShowUpdateChartGroupFormAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2004-2011, 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.
+ */
+
+package org.hisp.dhis.reporting.chartgroup.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class ShowUpdateChartGroupFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Comparator
+ // -------------------------------------------------------------------------
+
+ private Comparator<Chart> chartComparator;
+
+ public void setChartComparator( Comparator<Chart> chartComparator )
+ {
+ this.chartComparator = chartComparator;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private ChartGroup chartGroup;
+
+ public ChartGroup getChartGroup()
+ {
+ return chartGroup;
+ }
+
+ private List<Chart> groupMembers = new ArrayList<Chart>();
+
+ public List<Chart> getGroupMembers()
+ {
+ return groupMembers;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ chartGroup = chartService.getChartGroup( id );
+
+ groupMembers = new ArrayList<Chart>( chartGroup.getMembers() );
+
+ Collections.sort( groupMembers, chartComparator );
+
+ return SUCCESS;
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/UpdateChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/UpdateChartGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/UpdateChartGroupAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,116 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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.HashSet;
+import java.util.Set;
+
+import org.hisp.dhis.chart.Chart;
+import org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class UpdateChartGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private Set<String> groupMembers = new HashSet<String>();
+
+ public void setGroupMembers( Set<String> groupMembers )
+ {
+ this.groupMembers = groupMembers;
+ }
+
+ private ChartGroup chartGroup;
+
+ public ChartGroup getChartGroup()
+ {
+ return chartGroup;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ chartGroup = chartService.getChartGroup( id );
+
+ if ( name != null && name.trim().length() > 0 )
+ {
+ chartGroup.setName( name );
+ }
+
+ Set<Chart> members = new HashSet<Chart>();
+
+ for ( String memberId : groupMembers )
+ {
+ members.add( chartService.getChart( Integer.parseInt( memberId ) ) );
+ }
+
+ chartGroup.updateCharts( members );
+
+ chartService.updateChartGroup( chartGroup );
+
+ return SUCCESS;
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ValidateChartGroupAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ValidateChartGroupAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/chartgroup/action/ValidateChartGroupAction.java 2011-07-21 06:51:02 +0000
@@ -0,0 +1,113 @@
+package org.hisp.dhis.reporting.chartgroup.action;
+
+/*
+ * Copyright (c) 2004-2011, 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 org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.chart.ChartGroup;
+import org.hisp.dhis.chart.ChartService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Dang Duy Hieu
+ * @version $Id$
+ */
+
+public class ValidateChartGroupAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private ChartService chartService;
+
+ public void setChartService( ChartService chartService )
+ {
+ this.chartService = chartService;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( name != null )
+ {
+ ChartGroup match = chartService.getChartGroupByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return ERROR;
+ }
+ }
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-07-12 12:15:23 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2011-07-21 06:51:02 +0000
@@ -93,7 +93,44 @@
<bean id="org.hisp.dhis.reporting.chart.action.ValidateChartAction" class="org.hisp.dhis.reporting.chart.action.ValidateChartAction"
scope="prototype">
<property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
- </bean>
+ </bean>
+
+ <!-- ChartGroups -->
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupAction" class="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupListAction" class="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupListAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.ValidateChartGroupAction" class="org.hisp.dhis.reporting.chartgroup.action.ValidateChartGroupAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.AddChartGroupAction" class="org.hisp.dhis.reporting.chartgroup.action.AddChartGroupAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.ShowUpdateChartGroupFormAction" class="org.hisp.dhis.reporting.chartgroup.action.ShowUpdateChartGroupFormAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.UpdateChartGroupAction" class="org.hisp.dhis.reporting.chartgroup.action.UpdateChartGroupAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.reporting.chartgroup.action.RemoveChartGroupAction" class="org.hisp.dhis.reporting.chartgroup.action.RemoveChartGroupAction"
+ scope="prototype">
+ <property name="chartService" ref="org.hisp.dhis.chart.ChartService" />
+ </bean>
<!-- TableCreator -->
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-06-24 22:42:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-07-21 06:51:02 +0000
@@ -96,13 +96,75 @@
<result name="success" type="velocity-xml">/dhis-web-reporting/responseChart.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
-
+
+ <action name="getCharts" class="org.hisp.dhis.reporting.chart.action.GetAllChartsAction">
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonCharts.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<action name="validateChart" class="org.hisp.dhis.reporting.chart.action.ValidateChartAction">
<result name="success" type="velocity-xml">/dhis-web-reporting/responseSuccess.vm</result>
<result name="input" type="velocity-xml">/dhis-web-reporting/responseInput.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <!-- ReportGroup -->
+
+ <action name="chartGroup" class="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-reporting/chartGroup.vm</param>
+ <param name="menu">/dhis-web-reporting/menu.vm</param>
+ <param name="javascripts">javascript/chartGroup.js</param>
+ <param name="stylesheets">../dhis-web-commons/paging/paging.css</param>
+ </action>
+
+ <action name="removeChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.RemoveChartGroupAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ <param name="requiredAuthorities">F_INDICATORGROUP_DELETE</param>
+ </action>
+
+ <action name="showAddChartGroupForm" class="org.hisp.dhis.reporting.chart.action.GetAllChartsAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-reporting/addChartGroupForm.vm</param>
+ <param name="javascripts">javascript/chartGroup.js</param>
+ <param name="requiredAuthorities">F_INDICATORGROUP_ADD</param>
+ </action>
+
+ <action name="addChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.AddChartGroupAction">
+ <result name="success" type="redirect">chartGroup.action</result>
+ <param name="requiredAuthorities">F_INDICATORGROUP_ADD</param>
+ </action>
+
+ <action name="showUpdateChartGroupForm" class="org.hisp.dhis.reporting.chartgroup.action.ShowUpdateChartGroupFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-reporting/updateChartGroupForm.vm</param>
+ <param name="javascripts">javascript/chartGroup.js</param>
+ <param name="requiredAuthorities">F_INDICATORGROUP_UPDATE</param>
+ </action>
+
+ <action name="updateChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.UpdateChartGroupAction">
+ <result name="success" type="redirect">chartGroup.action
+ </result>
+ <param name="requiredAuthorities">F_INDICATORGROUP_UPDATE</param>
+ </action>
+
+ <action name="getChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupAction">
+ <result name="success" type="velocity-xml">/dhis-web-reporting/responseChartGroup.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <action name="validateChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.ValidateChartGroupAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
<!-- Report -->
<action name="displayAddReportForm" class="org.hisp.dhis.reporting.reportviewer.action.GetReportOptionsAction">
@@ -151,7 +213,7 @@
<action name="getReportDesign" class="org.hisp.dhis.reporting.reportviewer.action.GetReportDesignAction">
<result name="success" type="outputStreamResult" />
</action>
-
+
<!-- ReportTable -->
<action name="displayManageTableForm" class="org.hisp.dhis.reporting.tablecreator.action.GetAllTablesAction">
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartGroupForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/addChartGroupForm.vm 2011-07-21 06:51:02 +0000
@@ -0,0 +1,72 @@
+<script type="text/javascript" src="javascript/addChartGroupForm.js"></script>
+<script type="text/javascript">
+ jQuery(function() {
+ jQuery("#availableChartsList").dhisAjaxSelect({
+ source: "getCharts.action",
+ iterator: "charts",
+ connectedTo: 'groupMembers',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+ });
+</script>
+
+<h3>$i18n.getString( "create_new_chart_group" )</h3>
+
+<form id="addChartGroupForm" action="addChartGroup.action" method="post" >
+
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" style="width:20em"/></td>
+ </tr>
+ <tr>
+ <td colspan="2" height="15px"></td>
+ </tr>
+</table>
+
+<table>
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+
+ <tr>
+ <th>$i18n.getString( "available_charts" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )
+ <select id="memberValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
+ </tr>
+
+ <tr>
+ <td>
+ <select id="availableChartsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableChartsList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableChartsList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;"></select>
+ </td>
+ </tr>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='chartGroup.action'" style="width:10em"/>
+</p>
+
+</form>
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/chartGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/chartGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/chartGroup.vm 2011-07-21 06:51:02 +0000
@@ -0,0 +1,64 @@
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
+
+ jQuery(document).ready(function() {
+ tableSorter( 'listTable' );
+ });
+</script>
+
+<h3>$i18n.getString( "chart_group_management" ) #openHelp( "chart_group" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "chartGroup" )</td>
+ <td colspan="9" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='showAddChartGroupForm.action'" style="width:80px"/></a>
+ </td>
+ </tr>
+ </table>
+ <table class="listTable" id="listTable">
+ <col/>
+ <col width="100"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th style="text-align:center" class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $chartGroup in $chartGroups )
+ <tr id="tr${chartGroup.id}">
+ <td onclick="showChartGroupDetails( $chartGroup.id )">$encoder.htmlEncode( $chartGroup.name )</td>
+ <td style="text-align:center">
+ <a href="showUpdateChartGroupForm.action?id=$chartGroup.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:removeChartGroup( '$chartGroup.id', '$encoder.jsEncode( $chartGroup.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showChartGroupDetails( $chartGroup.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ <p></p>
+ #parse( "/dhis-web-commons/paging/paging.vm" )
+ </td>
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "number_of_members" ):</label><br/><span id="memberCountField"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/addChartGroupForm.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/addChartGroupForm.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/addChartGroupForm.js 2011-07-21 06:51:02 +0000
@@ -0,0 +1,19 @@
+jQuery( document ).ready( function()
+{
+ validation2( 'addChartGroupForm', function( form )
+ {
+ form.submit()
+ }, {
+ 'beforeValidateHandler' : function()
+ {
+ listValidator( 'memberValidator', 'groupMembers' );
+ },
+ 'rules' : getValidationRules( "chartGroup" )
+ } );
+
+ checkValueIsExist( "name", "validateChartGroup.action" );
+
+ var nameField = document.getElementById( 'name' );
+ nameField.select();
+ nameField.focus();
+} );
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js 2011-07-21 06:51:02 +0000
@@ -0,0 +1,24 @@
+function showChartGroupDetails( chartGroupId )
+{
+ var request = new Request();
+ request.setResponseTypeXML( 'chartGroup' );
+ request.setCallbackSuccess( chartGroupReceived );
+ request.send( 'getChartGroup.action?id=' + chartGroupId );
+}
+
+function chartGroupReceived( chartGroupElement )
+{
+ setInnerHTML( 'nameField', getElementValue( chartGroupElement, 'name' ) );
+ setInnerHTML( 'memberCountField', getElementValue( chartGroupElement, 'memberCount' ) );
+
+ showDetails();
+}
+
+// -----------------------------------------------------------------------------
+// Remove chart group
+// -----------------------------------------------------------------------------
+
+function removeChartGroup( chartGroupId, chartGroupName )
+{
+ removeItem( chartGroupId, chartGroupName, i18n_confirm_delete, 'removeChartGroup.action' );
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/updateChartGroupForm.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/updateChartGroupForm.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/updateChartGroupForm.js 2011-07-21 06:51:02 +0000
@@ -0,0 +1,16 @@
+jQuery( document ).ready( function()
+{
+ validation2( 'updateChartGroupForm', function( form )
+ {
+ form.submit()
+ }, {
+ 'beforeValidateHandler' : function()
+ {
+ listValidator( 'memberValidator', 'groupMembers' );
+ },
+ 'rules' : getValidationRules( "chartGroup" )
+ } );
+
+ checkValueIsExist( "name", "validateChartGroup.action", {id: $chartGroup.id});
+
+} );
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonCharts.vm 2011-07-21 06:51:02 +0000
@@ -0,0 +1,20 @@
+#set( $size = $charts.size() )
+{ "charts": [
+#foreach( $chart in $charts )
+#set( $groups = $chart.groups )
+ {
+ "id": $!{chart.id},
+ "name": "$!encoder.jsonEncode( ${chart.title} )",
+ "dimension": "$!encoder.jsonEncode( ${chart.dimension} )",
+ "indicators": "$!encoder.jsonEncode( ${chart.indicators.size()} )",
+ "dataElements": "$!encoder.jsonEncode( ${chart.dataElements.size()} )",
+ "periods": "${chart.periods.size()}",
+ "organisationUnits": $!{chart.organisationUnits.size()},
+ "groups": [ #foreach( $group in $groups )${group.id}#if( $velocityCount < $groups.size() ),#end#end ]
+ }#if( $velocityCount < $size ),#end
+#end
+]
+#if( $usePaging ),
+ "paging":#parse( "/dhis-web-commons/ajax/jsonPaging.vm" )
+#end
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm 2011-07-21 06:51:02 +0000
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<chartGroup>
+ <id>$chartGroup.id</id>
+ <name>$!encoder.xmlEncode( $chartGroup.name )</name>
+ <memberCount>$chartGroup.getMembers().size()</memberCount>
+</chartGroup>
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/updateChartGroupForm.vm 2011-07-21 06:51:02 +0000
@@ -0,0 +1,81 @@
+<script type="text/javascript" src="javascript/updateChartGroupForm.js"></script>
+<script type="text/javascript">
+ jQuery(document).ready( function(){
+ jQuery("#availableChartsList").dhisAjaxSelect({
+ source: "getCharts.action",
+ iterator: "charts",
+ connectedTo: 'groupMembers',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+ }
+ });
+ });
+</script>
+
+<h3>$i18n.getString( "edit_chart_group" )</h3>
+
+<form id="updateChartGroupForm" action="updateChartGroup.action" method="post" >
+
+<div>
+ <input type="hidden" id="id" name="id" value="$chartGroup.id"/>
+</div>
+
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label for="name">$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $chartGroup.name )" style="width:20em"/></td>
+ </tr>
+ <tr>
+ <td colspan="2" height="15px"></td>
+ </tr>
+</table>
+
+<table>
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+
+ <tr>
+ <th>$i18n.getString( "available_charts" )</th>
+ <th></th>
+ <th>$i18n.getString( "group_members" )
+ <select id="memberValidator" class="{validate:{required:true}}" style="display:none"/>
+ </th>
+ </tr>
+
+ <tr>
+ <td>
+ <select id="availableChartsList" multiple="multiple" style="height: 200px; width: 100%;"></select>
+ </td>
+
+ <td style="text-align:center">
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableChartsList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'groupMembers' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableChartsList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'groupMembers' );"/>
+ </td>
+
+ <td>
+ <select id="groupMembers" name="groupMembers" multiple="multiple" style="height: 200px; width: 100%; margin-top: 22px;">
+ #foreach( $chart in $groupMembers )
+ <option value="$chart.id">$encoder.htmlEncode( $chart.name )</option>
+ #end
+ </select>
+ </td>
+
+ </tr>
+</table>
+
+<p>
+ <input type="submit" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='chartGroup.action'" style="width:10em"/>
+</p>
+
+</form>