dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17335
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6853: CCEM work in progress
------------------------------------------------------------
revno: 6853
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-05-04 14:35:30 +0530
message:
CCEM work in progress
modified:
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/CatalogListAction.java
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/UpdateCatalogFormAction.java
local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogList.vm
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/updateCatalogForm.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 '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<CatalogType>( 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<CatalogType> catalogTypes;
+
+ public List<CatalogType> getCatalogTypes()
+ {
+ return catalogTypes;
+ }
+
+ private CatalogType catalogType;
+
+ public CatalogType getCatalogType()
+ {
+ return catalogType;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
public String execute() throws Exception
{
- catalogs = new ArrayList<Catalog>( catalogService.getAllCatalogs() );
-
- Collections.sort( catalogs, new CatalogComparator() );
-
-
+ catalogTypes = new ArrayList<CatalogType>( catalogTypeService.getAllCatalogTypes());
+ Collections.sort( catalogTypes, new CatalogTypeComparator() );
+
+ if ( id != null )
+ {
+ catalogType = catalogTypeService.getCatalogType( id );
+
+ catalogs = new ArrayList<Catalog>( catalogService.getCatalogs( catalogType ) );
+ Collections.sort( catalogs, new CatalogComparator() );
+ }
+ else
+ {
+ catalogs = new ArrayList<Catalog>( 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<CatalogTypeAttribute> catalogTypeAttributes;
public Collection<CatalogTypeAttribute> getCatalogTypeAttributes()
{
return catalogTypeAttributes;
}
+ */
+ private List<CatalogTypeAttribute> catalogTypeAttributes = new ArrayList<CatalogTypeAttribute>();
+
+ public List<CatalogTypeAttribute> getCatalogTypeAttributes()
+ {
+ return catalogTypeAttributes;
+ }
private Map<Integer, String> catalogTypeAttributeValueMap = new HashMap<Integer, String>();
@@ -94,7 +102,11 @@
catalogType = catalog.getCatalogType();
- catalogTypeAttributes = catalogType.getCatalogTypeAttributes();
+ //catalogTypeAttributes = catalogType.getCatalogTypeAttributes();
+
+
+ catalogTypeAttributes = new ArrayList<CatalogTypeAttribute> ( catalogType.getCatalogTypeAttributes());
+ Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
List<CatalogDataValue> catalogDataValues = new ArrayList<CatalogDataValue>( 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<CatalogTypeAttribute> catalogTypeAttributes;
public Collection<CatalogTypeAttribute> getCatalogTypeAttributes()
{
return catalogTypeAttributes;
}
+ */
+
+ private List<CatalogTypeAttribute> catalogTypeAttributes = new ArrayList<CatalogTypeAttribute>();
+
+ public List<CatalogTypeAttribute> 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<CatalogTypeAttribute> ( catalogType.getCatalogTypeAttributes());
+ Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
+
+
List<CatalogDataValue> catalogDataValues = new ArrayList<CatalogDataValue>( 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">
<property name="catalogService"
- ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+ ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+ <property name="catalogTypeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
</bean>
<!-- Add Catalog Form -->
=== 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 @@
<table>
<tr>
<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="name" name="name" class="{validate:{required:true, unicodechars:true, rangelength:[4,160]}}"/></td>
+ <td><input type="text" id="name" name="name" class="{validate:{required:true, rangelength:[4,160]}}"/></td>
</tr>
<tr>
<td><label>$i18n.getString( "description" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td><input type="text" id="description" name="description" class="{validate:{required:true,unicodechars:true, minlength:4}}"/></td>
+ <td><input type="text" id="description" name="description" class="{validate:{required:true, minlength:4}}"/></td>
</tr>
<tr>
=== 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 @@
<tr>
<td>
$i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
+
+ <label>$i18n.getString( "select_catalogType" )</label>
+ <select id="id" name="id" style="min-width:20em" onchange="getCatalogByCatalogType( this.value )">
+ <option value="" selected="selected" >[ $i18n.getString( "all" ) ]</option>
+ #foreach( $catalogType in $catalogTypes )
+ <option value="$catalogType.id" #if($id==$catalogType.id) selected="selected" #end>$catalogType.name</option>
+ #end
+ </select>
</td>
<td colspan="3" style="text-align:right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='addCatalogForm.action'" style="width:70px"></td>
</tr>
=== 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 @@
</tr>
<tr>
<td class='text-column'><label for="name">$i18n.getString( "name" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td class="input-column" ><input type="text" id="name" name="name" value="$!catalog.name" class="{validate:{required:true, unicodechars:true, rangelength:[4,50]}}"></td>
+ <td class="input-column" ><input type="text" id="name" name="name" value="$!catalog.name" class="{validate:{required:true, rangelength:[4,50]}}"></td>
</tr>
<tr>
<td class='text-column'><label for="description">$i18n.getString( "description" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
- <td class="input-column" ><input type="text" id="description" name="description" value="$!catalog.description" class="{validate:{required:true, unicodechars:true, minlength:4}}"></td>
+ <td class="input-column" ><input type="text" id="description" name="description" value="$!catalog.description" class="{validate:{required:true, minlength:4}}"></td>
</tr>
<tr>