=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogFormAction.java' --- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogFormAction.java 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogFormAction.java 2012-05-04 09:05:30 +0000 @@ -1,10 +1,12 @@ package org.hisp.dhis.coldchain.catalog.action; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.hisp.dhis.coldchain.catalog.CatalogType; import org.hisp.dhis.coldchain.catalog.CatalogTypeService; +import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeComparator; import com.opensymphony.xwork2.Action; @@ -40,6 +42,8 @@ { catalogTypes = new ArrayList( catalogTypeService.getAllCatalogTypes()); + Collections.sort( catalogTypes, new CatalogTypeComparator() ); + return SUCCESS; } } === modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogListAction.java' --- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogListAction.java 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogListAction.java 2012-05-04 09:05:30 +0000 @@ -6,7 +6,10 @@ import org.hisp.dhis.coldchain.catalog.Catalog; import org.hisp.dhis.coldchain.catalog.CatalogService; +import org.hisp.dhis.coldchain.catalog.CatalogType; +import org.hisp.dhis.coldchain.catalog.CatalogTypeService; import org.hisp.dhis.coldchain.catalog.comparator.CatalogComparator; +import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeComparator; import com.opensymphony.xwork2.Action; @@ -22,7 +25,13 @@ { this.catalogService = catalogService; } - + + private CatalogTypeService catalogTypeService; + + public void setCatalogTypeService( CatalogTypeService catalogTypeService ) + { + this.catalogTypeService = catalogTypeService; + } // ------------------------------------------------------------------------- // Output @@ -35,17 +44,55 @@ return catalogs; } + private Integer id; + + public Integer getId() + { + return id; + } + + public void setId( Integer id ) + { + this.id = id; + } + + private List catalogTypes; + + public List getCatalogTypes() + { + return catalogTypes; + } + + private CatalogType catalogType; + + public CatalogType getCatalogType() + { + return catalogType; + } + // ------------------------------------------------------------------------- // Action implementation // ------------------------------------------------------------------------- public String execute() throws Exception { - catalogs = new ArrayList( catalogService.getAllCatalogs() ); - - Collections.sort( catalogs, new CatalogComparator() ); - - + catalogTypes = new ArrayList( catalogTypeService.getAllCatalogTypes()); + Collections.sort( catalogTypes, new CatalogTypeComparator() ); + + if ( id != null ) + { + catalogType = catalogTypeService.getCatalogType( id ); + + catalogs = new ArrayList( catalogService.getCatalogs( catalogType ) ); + Collections.sort( catalogs, new CatalogComparator() ); + } + else + { + catalogs = new ArrayList( catalogService.getAllCatalogs() ); + + Collections.sort( catalogs, new CatalogComparator() ); + } + return SUCCESS; } === modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java' --- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogDetailsAction.java 2012-05-04 09:05:30 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.coldchain.catalog.action; import java.util.ArrayList; -import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -12,6 +12,7 @@ import org.hisp.dhis.coldchain.catalog.CatalogService; import org.hisp.dhis.coldchain.catalog.CatalogType; import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute; +import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeAttributeComparator; import com.opensymphony.xwork2.Action; @@ -67,13 +68,20 @@ { return catalogType; } - + /* private Collection catalogTypeAttributes; public Collection getCatalogTypeAttributes() { return catalogTypeAttributes; } + */ + private List catalogTypeAttributes = new ArrayList(); + + public List getCatalogTypeAttributes() + { + return catalogTypeAttributes; + } private Map catalogTypeAttributeValueMap = new HashMap(); @@ -94,7 +102,11 @@ catalogType = catalog.getCatalogType(); - catalogTypeAttributes = catalogType.getCatalogTypeAttributes(); + //catalogTypeAttributes = catalogType.getCatalogTypeAttributes(); + + + catalogTypeAttributes = new ArrayList ( catalogType.getCatalogTypeAttributes()); + Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() ); List catalogDataValues = new ArrayList( catalogDataValueService.getAllCatalogDataValuesByCatalog( catalogService.getCatalog( id )) ); === modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogFormAction.java' --- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogFormAction.java 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogFormAction.java 2012-05-04 09:05:30 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.coldchain.catalog.action; import java.util.ArrayList; -import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -13,6 +13,7 @@ import org.hisp.dhis.coldchain.catalog.CatalogType; import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute; import org.hisp.dhis.coldchain.catalog.CatalogTypeService; +import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeAttributeComparator; import com.opensymphony.xwork2.Action; @@ -79,13 +80,21 @@ { return catalogTypes; } - + /* private Collection catalogTypeAttributes; public Collection getCatalogTypeAttributes() { return catalogTypeAttributes; } + */ + + private List catalogTypeAttributes = new ArrayList(); + + public List getCatalogTypeAttributes() + { + return catalogTypeAttributes; + } // ------------------------------------------------------------------------- // Action implementation @@ -107,7 +116,12 @@ CatalogType catalogType = catalogTypeService.getCatalogType( tempCatalog.getCatalogType().getId() ); - catalogTypeAttributes = catalogType.getCatalogTypeAttributes(); + //catalogTypeAttributes = catalogType.getCatalogTypeAttributes(); + + catalogTypeAttributes = new ArrayList ( catalogType.getCatalogTypeAttributes()); + Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() ); + + List catalogDataValues = new ArrayList( catalogDataValueService.getAllCatalogDataValuesByCatalog( catalogService.getCatalog( id )) ); === modified file 'local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml' --- local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-04 07:42:28 +0000 +++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-04 09:05:30 +0000 @@ -169,7 +169,9 @@ class="org.hisp.dhis.coldchain.catalog.action.CatalogListAction" scope="prototype"> + ref="org.hisp.dhis.coldchain.catalog.CatalogService" /> + === modified file 'local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties' --- local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-03 11:07:19 +0000 +++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-04 09:05:30 +0000 @@ -45,7 +45,7 @@ edit_catalog = Edit catalog catalog__details = Details of catalog attributes = Attributes - +select_catalogType = Select catalogype inventorytype_attribute_management = Inventorytype attribute management === modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogForm.vm' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogForm.vm 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogForm.vm 2012-05-04 09:05:30 +0000 @@ -8,12 +8,12 @@ - + - + === modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogList.vm' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogList.vm 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogList.vm 2012-05-04 09:05:30 +0000 @@ -7,6 +7,14 @@ === modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalog.js' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalog.js 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalog.js 2012-05-04 09:05:30 +0000 @@ -36,6 +36,15 @@ } //----------------------------------------------------------------------------- +//View catalog by catalog type change +//----------------------------------------------------------------------------- +function getCatalogByCatalogType( catalogTypeId ) +{ + window.location.href = "catalog.action?id=" + catalogTypeId; +} + + +//----------------------------------------------------------------------------- //View details //----------------------------------------------------------------------------- === modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm' --- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm 2012-04-30 11:24:11 +0000 +++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm 2012-05-04 09:05:30 +0000 @@ -23,11 +23,11 @@ - + - +
$i18n.getString( "filter_by_name" ): +    + +