=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/comparator/SectionOrderComparator.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/comparator/SectionOrderComparator.java 2010-04-12 21:23:33 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataset/comparator/SectionOrderComparator.java 2010-11-29 16:43:07 +0000 @@ -36,6 +36,6 @@ { public int compare( Section o1, Section o2 ) { - return o1.getSortOrder() - o2.getSortOrder(); + return o2.getSortOrder() - o1.getSortOrder(); } } === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionListSortOrderAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionListSortOrderAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/GetSectionListSortOrderAction.java 2010-11-29 16:43:07 +0000 @@ -0,0 +1,79 @@ +package org.hisp.dhis.dataset.action.section; + +/* + * Copyright (c) 2004-2010, University of Oslo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the HISP project nor the names of its contributors may + * be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.dataset.Section; +import org.hisp.dhis.dataset.comparator.SectionOrderComparator; + +import com.opensymphony.xwork2.Action; + +/** + * @author Lars Helge Overland + * @version $Id$ + */ +public class GetSectionListSortOrderAction + implements Action +{ + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private Integer dataSetId; + + public void setDataSetId( Integer dataSetId ) + { + this.dataSetId = dataSetId; + } + + private List
sections; + + public List
getSections() + { + return sections; + } + + public String execute() + { + DataSet dataSet = dataSetService.getDataSet( dataSetId ); + + sections = new ArrayList
( dataSet.getSections() ); + + Collections.sort( sections, new SectionOrderComparator() ); + + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SaveSectionSortOrderAction.java 2010-11-29 16:43:07 +0000 @@ -0,0 +1,75 @@ +package org.hisp.dhis.dataset.action.section; + +/* + * 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.List; + +import org.hisp.dhis.dataset.Section; +import org.hisp.dhis.dataset.SectionService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Lars Helge Overland + * @version $Id$ + */ +public class SaveSectionSortOrderAction + implements Action +{ + private SectionService sectionService; + + public void setSectionService( SectionService sectionService ) + { + this.sectionService = sectionService; + } + + private List sections; + + public void setSections( List sections ) + { + this.sections = sections; + } + + @Override + public String execute() + throws Exception + { + int sortOrder = 1; + + for ( String id : sections ) + { + Section section = sectionService.getSection( Integer.parseInt( id ) ); + + section.setSortOrder( sortOrder++ ); + + sectionService.updateSection( section ); + } + + return SUCCESS; + } +} === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SortOrderSection.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SortOrderSection.java 2010-07-07 10:22:14 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/section/SortOrderSection.java 1970-01-01 00:00:00 +0000 @@ -1,134 +0,0 @@ -package org.hisp.dhis.dataset.action.section; - -/* - * Copyright (c) 2004-2010, University of Oslo - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * * Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * * Neither the name of the HISP project nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.hisp.dhis.dataset.DataSet; -import org.hisp.dhis.dataset.DataSetService; -import org.hisp.dhis.dataset.Section; -import org.hisp.dhis.dataset.SectionService; - -import com.opensymphony.xwork2.Action; - -public class SortOrderSection - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private SectionService sectionService; - - private DataSetService dataSetService; - - public void setDataSetService( DataSetService dataSetService ) - { - this.dataSetService = dataSetService; - } - - public void setSectionService( SectionService sectionService ) - { - this.sectionService = sectionService; - } - - // ------------------------------------------------------------------------- - // Input & output - // ------------------------------------------------------------------------- - - private Integer dataSetId; - - private List selectedList = new ArrayList();; - - private DataSet dataSet; - - private Set
sections = new HashSet
(); - - public Set
getSections() - { - return sections; - } - - public DataSet getDataSet() - { - return dataSet; - } - - public Integer getDataSetId() - { - return dataSetId; - } - - public void setDataSetId( Integer dataSetId ) - { - this.dataSetId = dataSetId; - } - - public void setSelectedList( List selectedList ) - { - this.selectedList = selectedList; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - throws Exception - { - - if ( dataSetId != null ) - { - dataSet = dataSetService.getDataSet( dataSetId.intValue() ); - sections = dataSet.getSections(); - - return INPUT; - } - - - if ( selectedList.size() == 0 ) - { - return INPUT; - } - - int i = 0; - - for ( String id : selectedList ) - { - Section temp = sectionService.getSection( Integer.parseInt( id ) ); - temp.setSortOrder( i++ ); - - sectionService.updateSection( temp ); - } - - return SUCCESS; - } -} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-11-29 16:21:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/META-INF/dhis/beans.xml 2010-11-29 16:43:07 +0000 @@ -141,6 +141,22 @@ + + + + + + + + + + + + ../dhis-web-commons/ajax/jsonResponseError.vm plainTextError - - - /main.vm - /dhis-web-maintenance-dataset/sortOrderSection.vm - /dhis-web-maintenance-dataset/menu.vm - section - javascript/dataSet.js - - + /dhis-web-maintenance-dataset/responseSectionObject.vm @@ -106,6 +98,19 @@ status.vm plainTextError + + + /main.vm + /dhis-web-maintenance-dataset/sortSectionForm.vm + /dhis-web-maintenance-dataset/menu.vm + javascript/dataSet.js,javascript/section.js + + + + section.action + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-11-29 16:21:11 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/javascript/section.js 2010-11-29 16:43:07 +0000 @@ -26,7 +26,7 @@ if( datasetId == "null" ) { window.alert( i18n_please_select_dataset ); } else { - window.location = "sortOrderSection.action?dataSetId=" + datasetId; + window.location = "showSortSectionForm.action?dataSetId=" + datasetId; } } === removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortOrderSection.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortOrderSection.vm 2010-09-21 06:16:05 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortOrderSection.vm 1970-01-01 00:00:00 +0000 @@ -1,67 +0,0 @@ - -

$i18n.getString( "add_section" )

- -
- - ## Labels - ## Input - - - - - - - - - - - - - -
$i18n.getString( "sort_section" )
  
- - - ## Selected DataElements - ## Actions - ## Available DataElements - - - - - - - - - - - - - - - - - - - - - - -
$i18n.getString( "available_sections" )$i18n.getString( "selected_sections" )
- - - -
- -
- -
- -
-
-
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortSectionForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortSectionForm.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/sortSectionForm.vm 2010-11-29 16:43:07 +0000 @@ -0,0 +1,34 @@ + +

$i18n.getString( "section_sort_order" )

+ +
+ +

+ +

+ +

+ +

+ +

+ +

+ +
+ +