dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17689
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7136: added ui support for adding attribute values to organistion unit groups
------------------------------------------------------------
revno: 7136
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-06-01 15:05:54 +0200
message:
added ui support for adding attribute values to organistion unit groups
removed:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/PrepareUpdateGroupSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitGroupForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitGroupForm.js
added:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.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-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm 2012-06-01 12:17:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorForm.vm 2012-06-01 13:05:54 +0000
@@ -18,7 +18,6 @@
} );
</script>
-
<h3>$i18n.getString( "edit_indicator" )</h3>
<form id="updateIndicatorForm" action="updateIndicator.action" method="post" >
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm 2012-06-01 12:17:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateIndicatorGroupForm.vm 2012-06-01 13:05:54 +0000
@@ -39,7 +39,7 @@
<table>
<col width="200px" />
- <col width="260px" />
+ <col width="275px" />
<tr>
<th colspan="2">$i18n.getString( "details" )</th>
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java 2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/PrepareAddOrganisationUnitAction.java 1970-01-01 00:00:00 +0000
@@ -1,132 +0,0 @@
-package org.hisp.dhis.oum.action.organisationunit;
-
-/*
- * 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.ArrayList;
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.hisp.dhis.attribute.Attribute;
-import org.hisp.dhis.attribute.AttributeService;
-import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dataset.DataSet;
-import org.hisp.dhis.dataset.DataSetService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.period.Cal;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Nguyen Dang Quang
- * @version $Id$
- */
-public class PrepareAddOrganisationUnitAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private DataSetService dataSetService;
-
- public void setDataSetService( DataSetService dataSetService )
- {
- this.dataSetService = dataSetService;
- }
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- private AttributeService attributeService;
-
- public void setAttributeService( AttributeService attributeService )
- {
- this.attributeService = attributeService;
- }
-
- // -------------------------------------------------------------------------
- // Input & Output
- // -------------------------------------------------------------------------
-
- private Date defaultDate;
-
- public Date getDefaultDate()
- {
- return defaultDate;
- }
-
- private List<DataSet> dataSets;
-
- public List<DataSet> getDataSets()
- {
- return dataSets;
- }
-
- private List<OrganisationUnitGroupSet> groupSets;
-
- public List<OrganisationUnitGroupSet> getGroupSets()
- {
- return groupSets;
- }
-
- private List<Attribute> attributes;
-
- public List<Attribute> getAttributes()
- {
- return attributes;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- defaultDate = new Cal().set( 1900, 1, 1 ).time();
-
- dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
-
- groupSets = new ArrayList<OrganisationUnitGroupSet>(
- organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSetsWithMembers() );
-
- attributes = new ArrayList<Attribute>( attributeService.getOrganisationUnitAttributes() );
-
- Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
- Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
- Collections.sort( attributes, new AttributeSortOrderComparator() );
-
- return SUCCESS;
- }
-}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunit/ShowAddOrganisationUnitFormAction.java 2012-06-01 13:05:54 +0000
@@ -0,0 +1,129 @@
+package org.hisp.dhis.oum.action.organisationunit;
+
+/*
+ * 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 com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.period.Cal;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+
+/**
+ * @author Nguyen Dang Quang
+ */
+public class ShowAddOrganisationUnitFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private Date defaultDate;
+
+ public Date getDefaultDate()
+ {
+ return defaultDate;
+ }
+
+ private List<DataSet> dataSets;
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+
+ private List<OrganisationUnitGroupSet> groupSets;
+
+ public List<OrganisationUnitGroupSet> getGroupSets()
+ {
+ return groupSets;
+ }
+
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ defaultDate = new Cal().set( 1900, 1, 1 ).time();
+
+ dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
+
+ groupSets = new ArrayList<OrganisationUnitGroupSet>(
+ organisationUnitGroupService.getCompulsoryOrganisationUnitGroupSetsWithMembers() );
+
+ attributes = new ArrayList<Attribute>( attributeService.getOrganisationUnitAttributes() );
+
+ Collections.sort( dataSets, IdentifiableObjectNameComparator.INSTANCE );
+ Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
+ Collections.sort( attributes, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java 2012-02-01 10:50:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/GetOrganisationUnitGroupAction.java 2012-06-01 13:05:54 +0000
@@ -27,16 +27,19 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
+import com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
import org.hisp.dhis.oust.manager.SelectionTreeManager;
+import org.hisp.dhis.system.util.AttributeUtils;
-import com.opensymphony.xwork2.Action;
+import java.util.*;
/**
* @author Torgeir Lorange Ostby
- * @version $Id: GetOrganisationUnitGroupAction.java 1901 2006-09-22 14:42:40Z
- * torgeilo $
*/
public class GetOrganisationUnitGroupAction
implements Action
@@ -57,7 +60,14 @@
public void setSelectionTreeManager( SelectionTreeManager selectionTreeManager )
{
this.selectionTreeManager = selectionTreeManager;
- }
+ }
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
// -------------------------------------------------------------------------
// Input/output
@@ -84,6 +94,20 @@
return memberCount;
}
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ public Map<Integer, String> attributeValues = new HashMap<Integer, String>();
+
+ public Map<Integer, String> getAttributeValues()
+ {
+ return attributeValues;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -94,11 +118,17 @@
organisationUnitGroup = organisationUnitGroupService.getOrganisationUnitGroup( id );
memberCount = organisationUnitGroup.getMembers().size();
-
+
selectionTreeManager.clearSelectedOrganisationUnits();
selectionTreeManager.setSelectedOrganisationUnits( organisationUnitGroup.getMembers() );
+ attributes = new ArrayList<Attribute>( attributeService.getOrganisationUnitGroupAttributes() );
+
+ attributeValues = AttributeUtils.getAttributeValueMap( organisationUnitGroup.getAttributeValues() );
+
+ Collections.sort( attributes, IdentifiableObjectNameComparator.INSTANCE );
+
return SUCCESS;
}
}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroup/ShowAddOrganisationUnitGroupFormAction.java 2012-06-01 13:05:54 +0000
@@ -0,0 +1,75 @@
+package org.hisp.dhis.oum.action.organisationunitgroup;
+
+/*
+ * 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 com.opensymphony.xwork2.Action;
+import org.hisp.dhis.attribute.Attribute;
+import org.hisp.dhis.attribute.AttributeService;
+import org.hisp.dhis.attribute.comparator.AttributeSortOrderComparator;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class ShowAddOrganisationUnitGroupFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private AttributeService attributeService;
+
+ public void setAttributeService( AttributeService attributeService )
+ {
+ this.attributeService = attributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+ private List<Attribute> attributes;
+
+ public List<Attribute> getAttributes()
+ {
+ return attributes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ attributes = new ArrayList<Attribute>( attributeService.getOrganisationUnitGroupAttributes() );
+ Collections.sort( attributes, new AttributeSortOrderComparator() );
+
+ return SUCCESS;
+ }
+}
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/PrepareUpdateGroupSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/PrepareUpdateGroupSetAction.java 2012-02-01 10:50:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/PrepareUpdateGroupSetAction.java 1970-01-01 00:00:00 +0000
@@ -1,98 +0,0 @@
-package org.hisp.dhis.oum.action.organisationunitgroupset;
-
-/*
- * Copyright (c) 2004-2012, 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.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class PrepareUpdateGroupSetAction
- implements Action
-{
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
- // -------------------------------------------------------------------------
- // Input/output
- // -------------------------------------------------------------------------
-
- private Integer id;
-
- public void setId( Integer id )
- {
- this.id = id;
- }
-
- private OrganisationUnitGroupSet organisationUnitGroupSet;
-
- public OrganisationUnitGroupSet getOrganisationUnitGroupSet()
- {
- return organisationUnitGroupSet;
- }
-
- private List<OrganisationUnitGroup> selectedGroups;
-
- public List<OrganisationUnitGroup> getSelectedGroups()
- {
- return selectedGroups;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- throws Exception
- {
- organisationUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( id, true );
-
- selectedGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupSet.getOrganisationUnitGroups() );
-
- Collections.sort( selectedGroups, IdentifiableObjectNameComparator.INSTANCE );
-
- return SUCCESS;
- }
-}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/java/org/hisp/dhis/oum/action/organisationunitgroupset/ShowUpdateGroupSetFormAction.java 2012-06-01 13:05:54 +0000
@@ -0,0 +1,98 @@
+package org.hisp.dhis.oum.action.organisationunitgroupset;
+
+/*
+ * Copyright (c) 2004-2012, 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.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Lars Helge Overland
+ */
+public class ShowUpdateGroupSetFormAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private OrganisationUnitGroupSet organisationUnitGroupSet;
+
+ public OrganisationUnitGroupSet getOrganisationUnitGroupSet()
+ {
+ return organisationUnitGroupSet;
+ }
+
+ private List<OrganisationUnitGroup> selectedGroups;
+
+ public List<OrganisationUnitGroup> getSelectedGroups()
+ {
+ return selectedGroups;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ organisationUnitGroupSet = organisationUnitGroupService.getOrganisationUnitGroupSet( id, true );
+
+ selectedGroups = new ArrayList<OrganisationUnitGroup>( organisationUnitGroupSet.getOrganisationUnitGroups() );
+
+ Collections.sort( selectedGroups, IdentifiableObjectNameComparator.INSTANCE );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 11:35:55 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/META-INF/dhis/beans.xml 2012-06-01 13:05:54 +0000
@@ -96,7 +96,7 @@
</property>
</bean>
- <bean id="org.hisp.dhis.oum.action.organisationunit.PrepareAddOrganisationUnitAction" class="org.hisp.dhis.oum.action.organisationunit.PrepareAddOrganisationUnitAction"
+ <bean id="org.hisp.dhis.oum.action.organisationunit.ShowAddOrganisationUnitFormAction" class="org.hisp.dhis.oum.action.organisationunit.ShowAddOrganisationUnitFormAction"
scope="prototype">
<property name="dataSetService">
<ref bean="org.hisp.dhis.dataset.DataSetService" />
@@ -124,6 +124,10 @@
<!-- OrganisationUnitGroup -->
+ <bean id="org.hisp.dhis.oum.action.organisationunitgroup.ShowAddOrganisationUnitGroupFormAction" class="org.hisp.dhis.oum.action.organisationunitgroup.ShowAddOrganisationUnitGroupFormAction">
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ </bean>
+
<bean id="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupListAction" class="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupListAction"
scope="prototype">
<property name="organisationUnitGroupService">
@@ -139,6 +143,7 @@
<property name="selectionTreeManager">
<ref bean="org.hisp.dhis.oust.manager.SelectionTreeManager" />
</property>
+ <property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
</bean>
<bean id="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupMembersAction" class="org.hisp.dhis.oum.action.organisationunitgroup.GetOrganisationUnitGroupMembersAction"
@@ -231,7 +236,7 @@
</property>
</bean>
- <bean id="org.hisp.dhis.oum.action.organisationunitgroupset.PrepareUpdateGroupSetAction" class="org.hisp.dhis.oum.action.organisationunitgroupset.PrepareUpdateGroupSetAction"
+ <bean id="org.hisp.dhis.oum.action.organisationunitgroupset.ShowUpdateGroupSetFormAction" class="org.hisp.dhis.oum.action.organisationunitgroupset.ShowUpdateGroupSetFormAction"
scope="prototype">
<property name="organisationUnitGroupService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2012-02-22 15:04:08 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/struts.xml 2012-06-01 13:05:54 +0000
@@ -33,7 +33,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="showAddOrganisationUnitForm" class="org.hisp.dhis.oum.action.organisationunit.PrepareAddOrganisationUnitAction">
+ <action name="showAddOrganisationUnitForm" class="org.hisp.dhis.oum.action.organisationunit.ShowAddOrganisationUnitFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-organisationunit/addOrganisationUnitForm.vm</param>
<param name="javascripts">javascript/shortName.js,../dhis-web-commons/ouwt/ouwt.js</param>
@@ -115,7 +115,7 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="openAddOrganisationUnitGroup" class="org.hisp.dhis.oum.action.NoAction">
+ <action name="openAddOrganisationUnitGroup" class="org.hisp.dhis.oum.action.organisationunitgroup.ShowAddOrganisationUnitGroupFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm</param>
<param name="requiredAuthorities">F_ORGUNITGROUP_ADD</param>
@@ -188,7 +188,7 @@
<param name="requiredAuthorities">F_ORGUNITGROUPSET_ADD</param>
</action>
- <action name="showUpdateOrganisationUnitGroupSetForm" class="org.hisp.dhis.oum.action.organisationunitgroupset.PrepareUpdateGroupSetAction">
+ <action name="showUpdateOrganisationUnitGroupSetForm" class="org.hisp.dhis.oum.action.organisationunitgroupset.ShowUpdateGroupSetFormAction">
<result name="success" type="velocity">/main.vm</result>
<param name="page">/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm</param>
<param name="javascripts">javascript/organisationUnitGroupSet.js</param>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm 2011-10-06 07:36:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupForm.vm 2012-06-01 13:05:54 +0000
@@ -1,13 +1,36 @@
-<script type="text/javascript" src="javascript/addOrganisationUnitGroupForm.js"></script>
+<script type="text/javascript">
+jQuery( document ).ready( function()
+{
+ validation2( 'addOrganisationUnitGroupForm', function( form )
+ {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function()
+ {
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules' : getValidationRules( "organisationUnitGroup" )
+ } );
+
+ checkValueIsExist( "name", "validateOrganisationUnitGroup.action" );
+} );
+</script>
<h3>$i18n.getString( "crease_new_org_unit_group" ) #openHelp( "ou_groups_edit" )</h3>
<form name="addOrganisationUnitGroupForm" id="addOrganisationUnitGroupForm" action="addOrganisationUnitGroup.action" method="POST">
-<p>$i18n.getString( "name" )
- <em title="$i18n.getString( 'required' )" class="required">*</em>
- <input type="text" name="name" id="name" style="width:300px">
-</p>
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td style="width:200px"><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:240px;"/></td>
+ </tr>
+</table>
+
+#tblDynamicAttributes( { "attributes": $attributes } )
<table>
<tr>
@@ -15,9 +38,11 @@
#organisationUnitSelectionTree( true true false )
</td>
</tr>
-</table>
+</table>
+
<p>
<input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>
<input type="button" onclick="window.location.href='organisationUnitGroup.action'" value="$i18n.getString( 'cancel' )" style="width:10em"/>
-</p>
+</p>
+
</form>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitGroupForm.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/addOrganisationUnitGroupForm.js 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
-jQuery( document ).ready( function()
-{
- validation2( 'addOrganisationUnitGroupForm', function( form )
- {
- form.submit();
- }, {
- 'rules' : getValidationRules( "organisationUnitGroup" )
- } );
-
- checkValueIsExist( "name", "validateOrganisationUnitGroup.action" );
-} );
=== removed file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitGroupForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitGroupForm.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/updateOrganisationUnitGroupForm.js 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-jQuery( document ).ready( function()
-{
- validation2( 'updateOrganisationUnitGroupForm', function( form )
- {
- form.submit();
- }, {
- 'rules' : getValidationRules( "organisationUnitGroup" )
- } );
-} );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm 2012-04-03 10:52:58 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupForm.vm 2012-06-01 13:05:54 +0000
@@ -1,6 +1,16 @@
-<script type="text/javascript" src="javascript/updateOrganisationUnitGroupForm.js"></script>
<script type="text/javascript">
jQuery(document).ready(function() {
+ validation2( 'updateOrganisationUnitGroupForm', function( form )
+ {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function()
+ {
+ #tblDynamicAttributesJavascript()
+ },
+ 'rules' : getValidationRules( "organisationUnitGroup" )
+ } );
+
checkValueIsExist( "name", "validateOrganisationUnitGroup.action", {id:$!organisationUnitGroup.id} );
});
</script>
@@ -8,21 +18,31 @@
<h3>$i18n.getString( "edit_org_unit_group" ) #openHelp( "ou_groups_edit" )</h3>
<form id="updateOrganisationUnitGroupForm" action="updateOrganisationUnitGroup.action" method="post">
- <input type="hidden" name="id" id="id" style="width:300px" value="$!organisationUnitGroup.id"/>
+<input type="hidden" name="id" id="id" style="width:300px" value="$!organisationUnitGroup.id"/>
- <p>$i18n.getString( "name" )
- <em title="$i18n.getString( 'required' )" class="required">*</em>
- <input type="text" name="name" id="name" style="width:300px" value="$!organisationUnitGroup.name">
- </p>
- <table>
- <tr>
- <td>
- #organisationUnitSelectionTree( false, true, false )
- </td>
- </tr>
- </table>
- <p>
- <input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>
- <input type="button" onclick="window.location.href='organisationUnitGroup.action'" value="$i18n.getString( 'cancel' )" style="width:10em"/>
- </p>
+<table>
+ <tr>
+ <th colspan="2">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td style="width:200px"><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:240px;" value="$!organisationUnitGroup.name"/></td>
+ </tr>
+</table>
+
+#tblDynamicAttributes( { "attributes": $attributes, "attributeValues": $attributeValues } )
+
+<table>
+ <tr>
+ <td>
+ #organisationUnitSelectionTree( false, true, false )
+ </td>
+ </tr>
+</table>
+
+<p>
+ <input type="submit" name="save" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="button" onclick="window.location.href='organisationUnitGroup.action'" value="$i18n.getString( 'cancel' )" style="width:10em"/>
+</p>
+
</form>