dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17058
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6669: local/in CCEM work in progress
------------------------------------------------------------
revno: 6669
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Sat 2012-04-21 15:53:39 +0530
message:
local/in CCEM work in progress
added:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeAttributeComparator.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogTypeAttributeDetailsAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeOptionAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUpdateCatalogTypeAttributeFormAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ValidateCatalogTypeAttributeAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogType.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogTypeList.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addCatalogTypeAttributeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateCatalogTypeAttributeForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonCatalogTypeAttribute.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeAttibuteForm.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOption.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionStore.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeOptionService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeService.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeOptionStore.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeStore.java
local/in/dhis-web-coldchain/pom.xml
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetColdChainCatalogTypeAttributeListAction.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/resources/struts.xml
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalogTypeAttribute.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.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-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOption.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOption.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOption.java 2012-04-21 10:23:39 +0000
@@ -4,7 +4,11 @@
public class CatalogTypeAttributeOption implements Serializable
{
-
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+ private static final long serialVersionUID = 9052641474847384010L;
+
private int id;
private String name;
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionService.java 2012-04-21 10:23:39 +0000
@@ -11,7 +11,15 @@
void updateCatalogTypeAttributeOption( CatalogTypeAttributeOption catalogTypeAttributeOption );
void deleteCatalogTypeAttributeOption( CatalogTypeAttributeOption catalogTypeAttributeOption );
+
+ CatalogTypeAttributeOption getCatalogTypeAttributeOption( int id );
+
+ int countByCatalogTypeAttributeoption( CatalogTypeAttributeOption catalogTypeAttributeOption );
+ Collection<CatalogTypeAttributeOption> getCatalogTypeAttributeOptions( CatalogTypeAttribute catalogTypeAttribute );
+
+ CatalogTypeAttributeOption getCatalogTypeAttributeOptionName( CatalogTypeAttribute catalogTypeAttribute, String name );
+
Collection<CatalogTypeAttributeOption> getAllCatalogTypeAttributeOptions();
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeOptionStore.java 2012-04-21 10:23:39 +0000
@@ -11,7 +11,15 @@
void updateCatalogTypeAttributeOption( CatalogTypeAttributeOption catalogTypeAttributeOption );
void deleteCatalogTypeAttributeOption( CatalogTypeAttributeOption catalogTypeAttributeOption );
-
+
+ CatalogTypeAttributeOption getCatalogTypeAttributeOption( int id );
+
+ int countByCatalogTypeAttributeoption( CatalogTypeAttributeOption catalogTypeAttributeOption );
+
+ Collection<CatalogTypeAttributeOption> getCatalogTypeAttributeOptions( CatalogTypeAttribute catalogTypeAttribute );
+
+ CatalogTypeAttributeOption getCatalogTypeAttributeOptionName( CatalogTypeAttribute catalogTypeAttribute, String name );
+
Collection<CatalogTypeAttributeOption> getAllCatalogTypeAttributeOptions();
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeService.java 2012-04-21 10:23:39 +0000
@@ -11,7 +11,13 @@
void updateCatalogTypeAttribute( CatalogTypeAttribute catalogTypeAttribute );
void deleteCatalogTypeAttribute( CatalogTypeAttribute catalogTypeAttribute );
+
+ CatalogTypeAttribute getCatalogTypeAttribute( int id );
+
+ CatalogTypeAttribute getCatalogTypeAttributeByName( String name );
Collection<CatalogTypeAttribute> getAllCatalogTypeAttributes();
+
+
}
=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogTypeAttributeStore.java 2012-04-21 10:23:39 +0000
@@ -11,7 +11,11 @@
void updateCatalogTypeAttribute( CatalogTypeAttribute catalogTypeAttribute );
void deleteCatalogTypeAttribute( CatalogTypeAttribute catalogTypeAttribute );
-
+
+ CatalogTypeAttribute getCatalogTypeAttribute( int id );
+
+ CatalogTypeAttribute getCatalogTypeAttributeByName( String name );
+
Collection<CatalogTypeAttribute> getAllCatalogTypeAttributes();
}
=== added directory 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator'
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeAttributeComparator.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeAttributeComparator.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/comparator/CatalogTypeAttributeComparator.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,14 @@
+package org.hisp.dhis.coldchain.catalog.comparator;
+
+import java.util.Comparator;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+
+public class CatalogTypeAttributeComparator
+ implements Comparator<CatalogTypeAttribute>
+{
+ public int compare( CatalogTypeAttribute catalogTypeAttribute0, CatalogTypeAttribute catalogTypeAttribute1 )
+ {
+ return catalogTypeAttribute0.getName().compareToIgnoreCase( catalogTypeAttribute1.getName() );
+ }
+}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeOptionService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeOptionService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeOptionService.java 2012-04-21 10:23:39 +0000
@@ -2,6 +2,8 @@
import java.util.Collection;
+import org.hisp.dhis.patient.PatientAttribute;
+import org.hisp.dhis.patient.PatientAttributeOption;
import org.springframework.transaction.annotation.Transactional;
public class DefaultCatalogTypeAttributeOptionService implements CatalogTypeAttributeOptionService
@@ -48,5 +50,32 @@
{
catalogTypeAttributeOptionStore.updateCatalogTypeAttributeOption( catalogTypeAttributeOption );
}
-
+
+ @Transactional
+ @Override
+ public CatalogTypeAttributeOption getCatalogTypeAttributeOption( int id )
+ {
+ return catalogTypeAttributeOptionStore.getCatalogTypeAttributeOption( id );
+ }
+
+ @Transactional
+ @Override
+ public int countByCatalogTypeAttributeoption( CatalogTypeAttributeOption catalogTypeAttributeOption )
+ {
+ return catalogTypeAttributeOptionStore.countByCatalogTypeAttributeoption( catalogTypeAttributeOption );
+ }
+
+ @Transactional
+ @Override
+ public Collection<CatalogTypeAttributeOption> getCatalogTypeAttributeOptions( CatalogTypeAttribute catalogTypeAttribute )
+ {
+ return catalogTypeAttributeOptionStore.getCatalogTypeAttributeOptions( catalogTypeAttribute );
+ }
+
+ @Transactional
+ @Override
+ public CatalogTypeAttributeOption getCatalogTypeAttributeOptionName( CatalogTypeAttribute catalogTypeAttribute, String name )
+ {
+ return catalogTypeAttributeOptionStore.getCatalogTypeAttributeOptionName( catalogTypeAttribute, name );
+ }
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeAttributeService.java 2012-04-21 10:23:39 +0000
@@ -47,5 +47,19 @@
{
catalogTypeAttributeStore.updateCatalogTypeAttribute( catalogTypeAttribute );
}
-
+
+ @Transactional
+ @Override
+ public CatalogTypeAttribute getCatalogTypeAttribute( int id )
+ {
+ return catalogTypeAttributeStore.getCatalogTypeAttribute( id );
+ }
+
+ @Transactional
+ @Override
+ public CatalogTypeAttribute getCatalogTypeAttributeByName( String name )
+ {
+ return catalogTypeAttributeStore.getCatalogTypeAttributeByName( name );
+
+ }
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeService.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeService.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/DefaultCatalogTypeService.java 2012-04-21 10:23:39 +0000
@@ -48,5 +48,4 @@
{
catalogTypeStore.updateCatalogType( catalogType );
}
-
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeOptionStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeOptionStore.java 2012-04-17 10:41:26 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeOptionStore.java 2012-04-21 10:23:39 +0000
@@ -2,10 +2,16 @@
import java.util.Collection;
+import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Projections;
+import org.hibernate.criterion.Restrictions;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOption;
import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionStore;
+import org.hisp.dhis.hibernate.HibernateGenericStore;
+import org.hisp.dhis.reports.Report_in;
public class HibernateCatalogTypeAttributeOptionStore implements CatalogTypeAttributeOptionStore
{
@@ -56,5 +62,54 @@
session.update( catalogTypeAttributeOption );
}
-
+ @Override
+ public CatalogTypeAttributeOption getCatalogTypeAttributeOption( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return (CatalogTypeAttributeOption) session.get( CatalogTypeAttributeOption.class, id );
+ }
+
+ public int countByCatalogTypeAttributeoption( CatalogTypeAttributeOption catalogTypeAttributeOption )
+ {
+
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( CatalogTypeAttributeOption.class );
+ Number rs = (Number)criteria.add( Restrictions.eq( "catalogTypeAttributeOption", catalogTypeAttributeOption ) ).setProjection( Projections.rowCount() ).uniqueResult();
+ return rs != null ? rs.intValue() : 0;
+
+ /*
+ Number rs = (Number) getCriteria( Restrictions.eq( "catalogTypeAttributeOption", catalogTypeAttributeOption ) ).setProjection(
+ Projections.rowCount() ).uniqueResult();
+ return rs != null ? rs.intValue() : 0;
+ */
+ }
+
+ @SuppressWarnings( "unchecked" )
+ public Collection<CatalogTypeAttributeOption> getCatalogTypeAttributeOptions( CatalogTypeAttribute catalogTypeAttribute )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( CatalogTypeAttributeOption.class );
+ return criteria.add( Restrictions.eq( "catalogTypeAttribute", catalogTypeAttribute ) ).list();
+ //return getCriteria( Restrictions.eq( "catalogTypeAttribute", catalogTypeAttribute ) ).list();
+ }
+
+ public CatalogTypeAttributeOption getCatalogTypeAttributeOptionName( CatalogTypeAttribute catalogTypeAttribute, String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+ Criteria criteria = session.createCriteria( CatalogTypeAttributeOption.class );
+
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ criteria.add( Restrictions.eq( "catalogTypeAttribute", catalogTypeAttribute ) );
+
+ return (CatalogTypeAttributeOption) criteria.uniqueResult();
+
+ /*
+ return (CatalogTypeAttributeOption) getCriteria( Restrictions.eq( "name", name ),
+ Restrictions.eq( "catalogTypeAttribute", catalogTypeAttribute ) ).uniqueResult();
+ */
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeStore.java'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeStore.java 2012-04-16 11:29:53 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/hibernate/HibernateCatalogTypeAttributeStore.java 2012-04-21 10:23:39 +0000
@@ -2,10 +2,13 @@
import java.util.Collection;
+import org.hibernate.Criteria;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
+import org.hibernate.criterion.Restrictions;
import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeStore;
+import org.hisp.dhis.reports.Report_in;
public class HibernateCatalogTypeAttributeStore implements CatalogTypeAttributeStore
{
@@ -55,5 +58,24 @@
session.update( catalogTypeAttribute );
}
+ @Override
+ public CatalogTypeAttribute getCatalogTypeAttribute( int id )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ return (CatalogTypeAttribute) session.get( CatalogTypeAttribute.class, id );
+ }
+
+ @Override
+ public CatalogTypeAttribute getCatalogTypeAttributeByName( String name )
+ {
+ Session session = sessionFactory.getCurrentSession();
+
+ Criteria criteria = session.createCriteria( CatalogTypeAttribute.class );
+ criteria.add( Restrictions.eq( "name", name ) );
+
+ return (CatalogTypeAttribute) criteria.uniqueResult();
+
+ }
}
=== modified file 'local/in/dhis-web-coldchain/pom.xml'
--- local/in/dhis-web-coldchain/pom.xml 2012-04-17 11:59:19 +0000
+++ local/in/dhis-web-coldchain/pom.xml 2012-04-21 10:23:39 +0000
@@ -18,7 +18,11 @@
</build>
<dependencies>
-
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </dependency>
<!-- DHIS -->
<dependency>
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogTypeAttributeAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,112 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.util.List;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOption;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+import org.hisp.dhis.patient.PatientAttribute;
+
+import com.opensymphony.xwork2.Action;
+
+public class AddCatalogTypeAttributeAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+ private CatalogTypeAttributeOptionService catalogTypeAttributeOptionService;
+
+ public void setCatalogTypeAttributeOptionService( CatalogTypeAttributeOptionService catalogTypeAttributeOptionService )
+ {
+ this.catalogTypeAttributeOptionService = catalogTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private boolean mandatory;
+
+ public void setMandatory( boolean mandatory )
+ {
+ this.mandatory = mandatory;
+ }
+
+ private Integer noChars;
+
+ public void setNoChars( Integer noChars )
+ {
+ this.noChars = noChars;
+ }
+
+ private List<String> attrOptions;
+
+ public void setAttrOptions( List<String> attrOptions )
+ {
+ this.attrOptions = attrOptions;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute() throws Exception
+ {
+ CatalogTypeAttribute catalogTypeAttribute = new CatalogTypeAttribute();
+
+ catalogTypeAttribute.setName( name );
+ catalogTypeAttribute.setDescription( description );
+ catalogTypeAttribute.setValueType( valueType );
+ catalogTypeAttribute.setMandatory( mandatory );
+ catalogTypeAttribute.setNoChars( noChars );
+
+ catalogTypeAttributeService.addCatalogTypeAttribute( catalogTypeAttribute );
+
+ if ( CatalogTypeAttribute.TYPE_COMBO.equalsIgnoreCase( valueType ) )
+ {
+ CatalogTypeAttributeOption option = null;
+ for ( String optionName : attrOptions )
+ {
+ option = new CatalogTypeAttributeOption();
+ option.setName( optionName );
+ option.setCatalogTypeAttribute( catalogTypeAttribute );
+
+ catalogTypeAttributeOptionService.addCatalogTypeAttributeOption( option );
+ }
+ }
+
+ return SUCCESS;
+ }
+
+
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/CatalogTypeListAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.paging.ActionPagingSupport;
+
+public class CatalogTypeListAction
+extends ActionPagingSupport<DataSet>
+{
+
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeService catalogTypeService;
+
+ public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+ {
+ this.catalogTypeService = catalogTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters & Setters
+ // -------------------------------------------------------------------------
+
+ private List<CatalogType> catalogTypes;
+
+ public List<CatalogType> getCatalogTypes()
+ {
+ return catalogTypes;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+
+
+ private String key;
+
+ public String getKey()
+ {
+ return key;
+ }
+
+ public void setKey( String key )
+ {
+ this.key = key;
+ }
+
+ // -------------------------------------------------------------------------
+ // Execute
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+
+ catalogTypes = new ArrayList<CatalogType>( catalogTypeService.getAllCatalogTypes());
+
+ /*
+ if ( isNotBlank( key ) ) // Filter on key only if set
+ {
+ this.paging = createPaging( dataSetService.getDataSetCountByName( key ) );
+
+
+
+ dataSets = new ArrayList<DataSet>( dataSetService.getDataSetsBetweenByName( key, paging.getStartPos(),
+ paging.getPageSize() ) );
+ }
+ else
+ {
+ this.paging = createPaging( dataSetService.getDataSetCount() );
+
+ dataSets = new ArrayList<DataSet>( dataSetService.getDataSetsBetween( paging.getStartPos(), paging
+ .getPageSize() ) );
+ }
+ */
+ //Collections.sort( catalogTypes, new IdentifiableObjectNameComparator() );
+
+ return SUCCESS;
+ }
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogTypeAttributeDetailsAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogTypeAttributeDetailsAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetCatalogTypeAttributeDetailsAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,50 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetCatalogTypeAttributeDetailsAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private CatalogTypeAttribute catalogTypeAttribute;
+
+ public CatalogTypeAttribute getCatalogTypeAttribute()
+ {
+ return catalogTypeAttribute;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ catalogTypeAttribute = catalogTypeAttributeService.getCatalogTypeAttribute( id );
+ return SUCCESS;
+ }
+}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetColdChainCatalogTypeAttributeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetColdChainCatalogTypeAttributeListAction.java 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/GetColdChainCatalogTypeAttributeListAction.java 2012-04-21 10:23:39 +0000
@@ -1,5 +1,13 @@
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.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+import org.hisp.dhis.coldchain.catalog.comparator.CatalogTypeAttributeComparator;
+
import com.opensymphony.xwork2.Action;
public class GetColdChainCatalogTypeAttributeListAction implements Action
@@ -8,12 +16,23 @@
// Dependency
// -------------------------------------------------------------------------
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
+ private List<CatalogTypeAttribute> catalogTypeAttributes = new ArrayList<CatalogTypeAttribute>();
+ public List<CatalogTypeAttribute> getCatalogTypeAttributes()
+ {
+ return catalogTypeAttributes;
+ }
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -21,6 +40,9 @@
public String execute() throws Exception
{
+ catalogTypeAttributes = new ArrayList<CatalogTypeAttribute>(catalogTypeAttributeService.getAllCatalogTypeAttributes());
+ Collections.sort( catalogTypeAttributes, new CatalogTypeAttributeComparator() );
+
return SUCCESS;
}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,73 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+import org.hisp.dhis.common.DeleteNotAllowedException;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveCatalogTypeAttributeAction
+implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ try
+ {
+ CatalogTypeAttribute catalogTypeAttribute = catalogTypeAttributeService.getCatalogTypeAttribute( id );
+
+ catalogTypeAttributeService.deleteCatalogTypeAttribute( catalogTypeAttribute );
+ }
+ catch ( DeleteNotAllowedException ex )
+ {
+ if ( ex.getErrorCode().equals( DeleteNotAllowedException.ERROR_ASSOCIATED_BY_OTHER_OBJECTS ) )
+ {
+ message = i18n.getString( "object_not_deleted_associated_by_objects" ) + " " + ex.getMessage();
+ }
+
+ return ERROR;
+ }
+
+ return SUCCESS;
+ }
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeOptionAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeOptionAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/RemoveCatalogTypeAttributeOptionAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,89 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOption;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class RemoveCatalogTypeAttributeOptionAction
+implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeOptionService catalogTypeAttributeOptionService;
+
+ public void setCatalogTypeAttributeOptionService( CatalogTypeAttributeOptionService catalogTypeAttributeOptionService )
+ {
+ this.catalogTypeAttributeOptionService = catalogTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ private String message;
+
+ private I18n i18n;
+
+ // -------------------------------------------------------------------------
+ // Getter && Setter
+ // -------------------------------------------------------------------------
+
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ CatalogTypeAttributeOption catalogTypeAttributeOption = catalogTypeAttributeOptionService.getCatalogTypeAttributeOption( id );
+
+
+ if ( catalogTypeAttributeOption != null )
+ {
+ /*
+ int count = catalogTypeAttributeOptionService.countByCatalogTypeAttributeoption( catalogTypeAttributeOption );
+ if ( count > 0 )
+ {
+ message = i18n.getString( "warning_delete_catalogType_attribute_option" );
+ return INPUT;
+ }
+ */
+ //else
+ //{
+ catalogTypeAttributeOptionService.deleteCatalogTypeAttributeOption( catalogTypeAttributeOption );
+ message = i18n.getString( "success_delete_ctalogType_attribute_option" );
+ return SUCCESS;
+ //}
+ }
+ else
+ {
+ message = i18n.getString( "error_delete_catalogType_attribute_option" );
+ return ERROR;
+ }
+
+ }
+
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUpdateCatalogTypeAttributeFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUpdateCatalogTypeAttributeFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUpdateCatalogTypeAttributeFormAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,52 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUpdateCatalogTypeAttributeFormAction
+implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private CatalogTypeAttribute catalogTypeAttribute;
+
+ public CatalogTypeAttribute getCatalogTypeAttribute()
+ {
+ return catalogTypeAttribute;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ catalogTypeAttribute = catalogTypeAttributeService.getCatalogTypeAttribute( id );
+
+ return SUCCESS;
+ }
+}
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogTypeAttributeAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,154 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.util.Collection;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOption;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateCatalogTypeAttributeAction implements Action
+{
+ public static final String PREFIX_ATTRIBUTE_OPTION = "attrOption";
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+ private CatalogTypeAttributeOptionService catalogTypeAttributeOptionService;
+
+ public void setCatalogTypeAttributeOptionService( CatalogTypeAttributeOptionService catalogTypeAttributeOptionService )
+ {
+ this.catalogTypeAttributeOptionService = catalogTypeAttributeOptionService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private int id;
+
+ public void setId( int id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String description;
+
+ public void setDescription( String description )
+ {
+ this.description = description;
+ }
+
+ private String valueType;
+
+ public void setValueType( String valueType )
+ {
+ this.valueType = valueType;
+ }
+
+ private boolean mandatory;
+
+ public void setMandatory( boolean mandatory )
+ {
+ this.mandatory = mandatory;
+ }
+
+
+
+ private List<String> attrOptions;
+
+ public void setAttrOptions( List<String> attrOptions )
+ {
+ this.attrOptions = attrOptions;
+ }
+
+ private Integer noChars;
+
+ public void setNoChars( Integer noChars )
+ {
+ this.noChars = noChars;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+
+ CatalogTypeAttribute catalogTypeAttribute = catalogTypeAttributeService.getCatalogTypeAttribute( id );
+
+ catalogTypeAttribute.setName( name );
+ catalogTypeAttribute.setDescription( description );
+ catalogTypeAttribute.setValueType( valueType );
+ catalogTypeAttribute.setMandatory( mandatory );
+
+ catalogTypeAttribute.setNoChars( noChars );
+
+ HttpServletRequest request = ServletActionContext.getRequest();
+
+ Collection<CatalogTypeAttributeOption> attributeOptions = catalogTypeAttributeOptionService.getCatalogTypeAttributeOptions( catalogTypeAttribute );
+
+ if ( attributeOptions != null && attributeOptions.size() > 0 )
+ {
+ String value = null;
+ for ( CatalogTypeAttributeOption option : attributeOptions )
+ {
+ value = request.getParameter( PREFIX_ATTRIBUTE_OPTION + option.getId() );
+ if ( StringUtils.isNotBlank( value ) )
+ {
+ option.setName( value.trim() );
+
+ catalogTypeAttributeOptionService.updateCatalogTypeAttributeOption( option );
+ }
+ }
+ }
+
+ if ( attrOptions != null )
+ {
+ CatalogTypeAttributeOption option = null;
+ for ( String optionName : attrOptions )
+ {
+
+ option = catalogTypeAttributeOptionService.getCatalogTypeAttributeOptionName( catalogTypeAttribute, optionName );
+ if ( option == null )
+ {
+ option = new CatalogTypeAttributeOption();
+ option.setName( optionName );
+ option.setCatalogTypeAttribute( catalogTypeAttribute );
+
+ catalogTypeAttributeOptionService.addCatalogTypeAttributeOption( option );
+ }
+ }
+ }
+
+ catalogTypeAttributeService.updateCatalogTypeAttribute( catalogTypeAttribute );
+
+ return SUCCESS;
+ }
+}
+
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ValidateCatalogTypeAttributeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ValidateCatalogTypeAttributeAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ValidateCatalogTypeAttributeAction.java 2012-04-21 10:23:39 +0000
@@ -0,0 +1,78 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttribute;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService;
+import org.hisp.dhis.i18n.I18n;
+
+import com.opensymphony.xwork2.Action;
+
+public class ValidateCatalogTypeAttributeAction
+implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private CatalogTypeAttributeService catalogTypeAttributeService;
+
+ public void setCatalogTypeAttributeService( CatalogTypeAttributeService catalogTypeAttributeService )
+ {
+ this.catalogTypeAttributeService = catalogTypeAttributeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ name = name.trim();
+
+ CatalogTypeAttribute match = catalogTypeAttributeService.getCatalogTypeAttributeByName( name );
+
+ if ( match != null && (id == null || match.getId() != id.intValue()) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return INPUT;
+ }
+
+ message = i18n.getString( "everything_is_ok" );
+
+ return SUCCESS;
+ }
+}
=== 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-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-04-21 10:23:39 +0000
@@ -10,16 +10,88 @@
scope="prototype">
</bean>
-<!-- catalog -->
-
+<!-- catalog Type Attribute -->
+
+ <!-- Catalog Type Attribute List -->
<bean id="org.hisp.dhis.coldchain.catalog.action.GetColdChainCatalogTypeAttributeListAction"
- class="org.hisp.dhis.coldchain.catalog.action.GetColdChainCatalogTypeAttributeListAction"
- scope="prototype">
- </bean>
-
+ class="org.hisp.dhis.coldchain.catalog.action.GetColdChainCatalogTypeAttributeListAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ </bean>
+
+ <!-- Add Form -->
<bean id="org.hisp.dhis.coldchain.catalog.action.AddColdChainCatalogTypeAttributeForm"
- class="org.hisp.dhis.coldchain.catalog.action.AddColdChainCatalogTypeAttributeForm"
- scope="prototype">
- </bean>
-
+ class="org.hisp.dhis.coldchain.catalog.action.AddColdChainCatalogTypeAttributeForm"
+ scope="prototype">
+ </bean>
+
+ <!-- Add -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.AddCatalogTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.catalog.action.AddCatalogTypeAttributeAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ <property name="catalogTypeAttributeOptionService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService" />
+ </bean>
+
+ <!-- show details -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.GetCatalogTypeAttributeDetailsAction"
+ class="org.hisp.dhis.coldchain.catalog.action.GetCatalogTypeAttributeDetailsAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ </bean>
+ <!-- Remove/Delete -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ </bean>
+
+ <!-- Remove/Delete Attrobute Option -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeOptionAction"
+ class="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeOptionAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeOptionService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService" />
+ </bean>
+
+ <!-- Update Form -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.ShowUpdateCatalogTypeAttributeFormAction"
+ class="org.hisp.dhis.coldchain.catalog.action.ShowUpdateCatalogTypeAttributeFormAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ </bean>
+
+ <!-- Update -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.UpdateCatalogTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.catalog.action.UpdateCatalogTypeAttributeAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ <property name="catalogTypeAttributeOptionService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeOptionService" />
+ </bean>
+
+ <!-- Validation -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.ValidateCatalogTypeAttributeAction"
+ class="org.hisp.dhis.coldchain.catalog.action.ValidateCatalogTypeAttributeAction"
+ scope="prototype">
+ <property name="catalogTypeAttributeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeAttributeService" />
+ </bean>
+
+<!-- Catalog Type -->
+
+ <!-- Catalog Type List -->
+ <bean id="org.hisp.dhis.coldchain.catalog.action.CatalogTypeListAction"
+ class="org.hisp.dhis.coldchain.catalog.action.CatalogTypeListAction"
+ scope="prototype">
+ <property name="catalogTypeService"
+ ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+ </bean>
</beans>
\ No newline at end of file
=== 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-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-04-21 10:23:39 +0000
@@ -13,4 +13,16 @@
attribute_options = Attribute options
add_more_option = Add Option
at_least_2_option = Please add at least two attribute options
-remove_option = Remove Option
\ No newline at end of file
+remove_option = Remove Option
+confirm_delete_catalogType_attribute = Are you sure you want to delete catalog type attribute?
+warning_delete_catalogType_attribute_option = This option has relationship with CatalogTypeAttributeValue. You must not delete it.
+success_delete_ctalogType_attribute_option = Delete catalog type attribute option successfully.
+error_delete_ctalogType_attribute_option = Can not find catalog type attribute option to delete.
+edit_catalogType_attribute = Edit catalog type attribute
+catalogType_attribute_details = Catalog Type attribute details
+error_delete_catalogType_attribute_option = Can not find Catalog Type attribute option to delete.
+name_in_use = Name in use
+everything_is_ok = Everything is OK
+catalogType = Catalog Type
+confirm_delete = Are you sure you want to delete this catalog type?
+catalogType_management = Catalog Type management
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/resources/struts.xml'
--- local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-04-21 10:23:39 +0000
@@ -5,33 +5,87 @@
<struts>
<include file="dhis-web-commons.xml"/>
- <package name="dhis-web-coldchain" extends="dhis-web-commons" namespace="/dhis-web-coldchain">
+<package name="dhis-web-coldchain" extends="dhis-web-commons" namespace="/dhis-web-coldchain">
<!-- Home page -->
- <action name="index" class="org.hisp.dhis.coldchain.action.NoAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-coldchain/welcome.vm</param>
- <param name="menu">/dhis-web-coldchain/menu.vm</param>
- </action>
-
-
-<!-- catalog -->
- <action name="coldChainCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.GetColdChainCatalogTypeAttributeListAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm</param>
- <param name="menu">/dhis-web-coldchain/menu.vm</param>
- <param name="javascripts">javascript/catalogTypeAttribute.js</param>
-
- </action>
-
- <action name="showAddColdChainCatalogTypeAttributeForm" class="org.hisp.dhis.coldchain.catalog.action.AddColdChainCatalogTypeAttributeForm">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm</param>
- <param name="javascripts">javascript/catalogTypeAttribute.js</param>
- <param name="stylesheets">css/style.css</param>
- </action>
-
-
-
- </package>
+ <action name="index" class="org.hisp.dhis.coldchain.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/welcome.vm</param>
+ <param name="menu">/dhis-web-coldchain/menu.vm</param>
+ </action>
+
+
+<!-- catalog Type Attribute -->
+
+ <!-- Catalog Type Attribute List -->
+ <action name="coldChainCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.GetColdChainCatalogTypeAttributeListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm</param>
+ <param name="menu">/dhis-web-coldchain/menu.vm</param>
+ <param name="javascripts">javascript/catalogTypeAttribute.js</param>
+ </action>
+
+ <!-- Add Form -->
+ <action name="showAddColdChainCatalogTypeAttributeForm" class="org.hisp.dhis.coldchain.catalog.action.AddColdChainCatalogTypeAttributeForm">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm</param>
+ <param name="javascripts">javascript/catalogTypeAttribute.js</param>
+ <param name="stylesheets">css/style.css</param>
+ </action>
+
+ <!-- Add -->
+ <action name="addCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.AddCatalogTypeAttributeAction">
+ <result name="success" type="redirect">coldChainCatalogTypeAttribute.action</result>
+ </action>
+
+ <!-- show details -->
+ <action name="getCatalogTypeAttributeDetails" class="org.hisp.dhis.coldchain.catalog.action.GetCatalogTypeAttributeDetailsAction">
+ <result name="success" type="velocity-json">/dhis-web-coldchain/jsonCatalogTypeAttribute.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <!-- Remove/Delete -->
+ <action name="removeCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeAction">
+ <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>
+ </action>
+
+ <!-- Remove/Delete Attrobute Option -->
+ <action name="removeCatalogTypeAttributeOption" class="org.hisp.dhis.coldchain.catalog.action.RemoveCatalogTypeAttributeOptionAction">
+ <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>
+ <result name="input" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ </action>
+
+ <!-- Update Form -->
+ <action name="showUpdateCatalogTypeAttributeForm" class="org.hisp.dhis.coldchain.catalog.action.ShowUpdateCatalogTypeAttributeFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/updateCatalogTypeAttibuteForm.vm</param>
+ <param name="javascripts">javascript/catalogTypeAttribute.js</param>
+ <param name="stylesheets">css/style.css</param>
+ </action>
+
+ <!-- Update -->
+ <action name="updateCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.UpdateCatalogTypeAttributeAction">
+ <result name="success" type="redirect">coldChainCatalogTypeAttribute.action</result>
+ </action>
+
+ <!-- Validation -->
+ <action name="validateCatalogTypeAttribute" class="org.hisp.dhis.coldchain.catalog.action.ValidateCatalogTypeAttributeAction">
+ <result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">/dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ </action>
+
+<!-- catalog Type -->
+
+ <!-- Catalog Type List -->
+ <action name="catalogType" class="org.hisp.dhis.coldchain.catalog.action.CatalogTypeListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/catalogTypeList.vm</param>
+ <param name="menu">/dhis-web-coldchain/menu.vm</param>
+ <param name="javascripts">javascript/catalogType.js</param>
+ </action>
+
+</package>
</struts>
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addColdChainCatalogTypeAttributeForm.vm 2012-04-21 10:23:39 +0000
@@ -1,5 +1,7 @@
+<script type="text/javascript" src="javascript/addCatalogTypeAttributeForm.js"></script>
+
<h3>$i18n.getString( "create_new_catalog_type_attribute" )</h3>
-<form id="addCatalogTypeAttributeForm" action="addcatalogTypeAttribute.action" method="post" >
+<form id="addCatalogTypeAttributeForm" action="addCatalogTypeAttribute.action" method="post" >
<table id="attrTable">
<thead>
@@ -30,7 +32,7 @@
<td></td>
</tr>
- <tr>
+ <tr id="attributeNoCharRow">
<td><label for="noChar">$i18n.getString( "no_of_char" )</label></td>
<td>
<input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" />
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogType.js'
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogTypeList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogTypeList.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogTypeList.vm 2012-04-21 10:23:39 +0000
@@ -0,0 +1,71 @@
+<script type="text/javascript">
+ jQuery(document).ready(function(){
+ tableSorter( 'listTable' );
+ leftBar.showAnimated();
+ });
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete" ) , "'" )';
+
+</script>
+
+<h3>$i18n.getString( "catalogType_management" ) ##openHelp( "dataSet" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table width="100%">
+ <tr>
+ <td>#filterDiv( "catalogType" )</td>
+ <td colspan="9" style="text-align:right">
+ <input type="button" value="$i18n.getString( 'add_new' )" onclick="window.location.href='addCatalogTypeForm.action'" style="width:80px"/></a>
+ </td>
+ </tr>
+ </table>
+ <table class="listTable" id="listTable">
+ <col/>
+ <col width="200"/>
+ <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( $catalogType in $catalogTypes )
+ <tr id="tr${catalogType.id}">
+ <td onclick="showCalatogTypeDetails( $catalogType.id )">$encoder.htmlEncode( $catalogType.name )</td>
+ <td style="text-align:right">
+ <a href="editCatalogTypeForm.action?catalogTypeId=$catalogType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:removeCatalogType( '$catalogType.id', '$encoder.jsEncode( $catalogType.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showCalatogTypeDetails( $catalogType.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( "description" ):</label><br/><span id="descriptionField"></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>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/coldChainCatalogTypeAttribute.vm 2012-04-21 10:23:39 +0000
@@ -23,27 +23,27 @@
<th colspan="3">$i18n.getString( "operations" )</th>
</tr>
</thead>
- <tbody id="list"><!--
- #foreach( $patientAttribute in $patientAttributes )
- <tr id="tr${patientAttribute.id}">
+ <tbody id="list">
+ #foreach( $catalogTypeAttribute in $catalogTypeAttributes )
+ <tr id="tr${catalogTypeAttribute.id}">
- <td>$encoder.htmlEncode( $patientAttribute.name )</td>
+ <td>$encoder.htmlEncode( $catalogTypeAttribute.name )</td>
- <td style="text-align:center">
- <a href="showUpdatePatientAttributeForm.action?id=$patientAttribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+ <td style="text-align:center">
+ <a href="showUpdateCatalogTypeAttributeForm.action?id=$catalogTypeAttribute.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
</td>
<td style="text-align:center">
- <a href="javascript:removePatientAttribute( '$patientAttribute.id', '$encoder.jsEncode( $patientAttribute.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- </td>
+ <a href="javascript:removeCatalogTypeAttribute( '$catalogTypeAttribute.id', '$encoder.jsEncode( $catalogTypeAttribute.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )" ></a>
+ </td>
<td style="text-align:center">
- <a href="javascript:showPatientAttributeDetails( $patientAttribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
+ <a href="javascript:showCatalogTypeAttributeDetails( $catalogTypeAttribute.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+ </td>
- </tr>
+ </tr>
#end
- -->
+
</tbody>
</table>
@@ -57,13 +57,25 @@
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
<p><label class="bold">$i18n.getString( "description" ):</label><br><span id="descriptionField"></span></p>
+ <p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
<p><label class="bold">$i18n.getString( "mandatory" ):</label><br><span id="mandatoryField"></span></p>
- <p><label class="bold">$i18n.getString( "inheritable" ):</label><br><span id="inheritableField"></span></p>
- <p><label class="bold">$i18n.getString( "value_type" ):</label><br><span id="valueTypeField"></span></p>
- <p><label class="bold">$i18n.getString( "program" ):</label><br><span id="programField"></span></p>
</div>
</td>
</tr>
</table>
+<script type="text/javascript">
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_catalogType_attribute" ) , "'" )';
+ var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+ var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
+ var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
+ var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
+ var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
+ var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
+ var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
+ var i18n_all = '$encoder.jsEscape( $i18n.getString( "all" ) , "'")';
+</script>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addCatalogTypeAttributeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addCatalogTypeAttributeForm.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/addCatalogTypeAttributeForm.js 2012-04-21 10:23:39 +0000
@@ -0,0 +1,21 @@
+jQuery(document).ready( function(){
+ validation( 'addCatalogTypeAttributeForm', function(form){
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
+ }
+ }, function(){
+ isSubmit = true;
+
+ var fields = jQuery("#addCatalogTypeAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
+ });
+
+ jQuery("#attributeComboRow").hide();
+
+ checkValueIsExist( "name", "validateCatalogTypeAttribute.action");
+ });
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalogTypeAttribute.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalogTypeAttribute.js 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/catalogTypeAttribute.js 2012-04-21 10:23:39 +0000
@@ -1,5 +1,28 @@
-
-
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showCatalogTypeAttributeDetails( catalogTypeAttributeId )
+{
+ jQuery.getJSON( 'getCatalogTypeAttributeDetails.action', { id: catalogTypeAttributeId },
+ function ( json ) {
+ setInnerHTML( 'nameField', json.catalogTypeAttribute.name );
+ setInnerHTML( 'descriptionField', json.catalogTypeAttribute.description );
+ setInnerHTML( 'valueTypeField', json.catalogTypeAttribute.valueType );
+
+ var mandatory = ( json.catalogTypeAttribute.mandatory == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML( 'mandatoryField', mandatory );
+
+ showDetails();
+ });
+}
+//-----------------------------------------------------------------------------
+//Remove Patient Attribute
+//-----------------------------------------------------------------------------
+function removeCatalogTypeAttribute( catalogTypeAttributeId, name )
+{
+ removeItem( catalogTypeAttributeId, name, i18n_confirm_delete, 'removeCatalogTypeAttribute.action' );
+}
ATTRIBUTE_OPTION =
{
selectValueType : function (this_)
@@ -7,12 +30,17 @@
if ( jQuery(this_).val() == "COMBO" )
{
jQuery("#attributeComboRow").show();
+ jQuery("#attributeNoCharRow").hide();
if( jQuery("#attrOptionContainer").find("input").length ==0 )
{
ATTRIBUTE_OPTION.addOption();
ATTRIBUTE_OPTION.addOption();
}
+ }else if ( jQuery(this_).val() == "DATE" )
+ {
+ jQuery("#attributeNoCharRow").hide();
}else {
+ jQuery("#attributeNoCharRow").show();
jQuery("#attributeComboRow").hide();
}
},
@@ -43,7 +71,7 @@
if( jQuery(this_).siblings("input").attr("name") != "attrOptions")
{
- jQuery.get("removePatientAttributeOption.action?id="+optionId,function(data){
+ jQuery.get("removeCatalogTypeAttributeOption.action?id="+optionId,function(data){
if( data.response == "success")
{
jQuery(this_).parent().parent().remove();
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateCatalogTypeAttributeForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateCatalogTypeAttributeForm.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateCatalogTypeAttributeForm.js 2012-04-21 10:23:39 +0000
@@ -0,0 +1,19 @@
+jQuery(document).ready( function(){
+ validation( 'updateCatalogTypeAttributeForm', function(form){
+ if( isSubmit && ATTRIBUTE_OPTION.checkOnSubmit() ) {
+ form.submit(i18n_field_is_required);
+ }
+ }, function(){
+ isSubmit = true;
+
+ var fields = $("#updateCatalogTypeAttributeForm").serializeArray();
+ jQuery.each(fields, function(i, field) {
+ if( field.name.match("^attrOption")=='attrOption' && field.value == ""){
+ setInnerHTML("attrMessage", i18n_field_is_required);
+ isSubmit = false;
+ }
+ });
+ });
+
+ checkValueIsExist( "name", "validateCatalogTypeAttribute.action", {id:getFieldValue('id')});
+});
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonCatalogTypeAttribute.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonCatalogTypeAttribute.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonCatalogTypeAttribute.vm 2012-04-21 10:23:39 +0000
@@ -0,0 +1,9 @@
+{ "catalogTypeAttribute":
+ {
+ "id": "${catalogTypeAttribute.id}",
+ "name": "$!encoder.jsonEncode( ${catalogTypeAttribute.name} )",
+ "description": "$!encoder.jsonEncode( ${catalogTypeAttribute.description} )",
+ "valueType": "$!encoder.jsonEncode( ${catalogTypeAttribute.valueType} )",
+ "mandatory": "$!{catalogTypeAttribute.mandatory}"
+ }
+}
\ No newline at end of file
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-04-18 09:24:36 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/menu.vm 2012-04-21 10:23:39 +0000
@@ -2,5 +2,6 @@
<h2>$i18n.getString( "coldchain" )</h2>
<ul>
<li><a href="coldChainCatalogTypeAttribute.action">$i18n.getString( "catalogType_attribute" )</a></li>
+ <li><a href="catalogType.action">$i18n.getString( "catalogType" )</a></li>
</ul>
\ No newline at end of file
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeAttibuteForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeAttibuteForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeAttibuteForm.vm 2012-04-21 10:23:39 +0000
@@ -0,0 +1,96 @@
+<script type="text/javascript" src="javascript/updateCatalogTypeAttributeForm.js"></script>
+
+<h3>$i18n.getString( "edit_catalogType_attribute" )</h3>
+
+<form id="updateCatalogTypeAttributeForm" name="updateCatalogTypeAttributeForm" action="updateCatalogTypeAttribute.action" method="post" >
+
+<div style="display:inline">
+ <input type="hidden" id="id" name="id" value="$catalogTypeAttribute.id">
+</div>
+
+ <table id="detailsList">
+ <thead>
+ <tr>
+ <th colspan="2">$i18n.getString( "catalogType_attribute_details" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>$i18n.getString( "name" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $catalogTypeAttribute.name )" class="{validate:{required:true,rangelength:[2,160]}}"></td>
+ </tr>
+ <tr>
+ <td>$i18n.getString( "description" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td><input type="text" id="description" name="description" value="$encoder.htmlEncode( $catalogTypeAttribute.description )" class="{validate:{required:true,minlength:2}}"></td>
+ </tr>
+
+ <tr>
+ <td><label for="mandatory">$i18n.getString( "mandatory" )<em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td>
+ <select id="mandatory" name="mandatory">
+ <option value="true" #if( $catalogTypeAttribute.mandatory ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( !$catalogTypeAttribute.mandatory ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ </td>
+ <td></td>
+ </tr>
+ <tr>
+ <td><label for="noChar">$i18n.getString( "no_of_char" )</label></td>
+ <td>
+ <input type="text" name="noChars" id="noChars" class="{validate:{required:false, number:true}}" value="$!catalogTypeAttribute.noChars">
+ </td>
+ <td></td>
+ </tr>
+
+ <tr>
+ <td>$i18n.getString( "value_type" ) <em title="$i18n.getString( "required" )" class="required">*</em></td>
+ <td>
+ <select id="valueType" name="valueType" onchange="ATTRIBUTE_OPTION.selectValueType(this);">
+ <option value="NUMBER" #if( $catalogTypeAttribute.valueType == 'NUMBER' ) selected="selected" #end>$i18n.getString( "number" )</option>
+ <option value="TEXT" #if( $catalogTypeAttribute.valueType == 'TEXT' ) selected="selected" #end>$i18n.getString( "text" )</option>
+ <option value="YES/NO" #if( $catalogTypeAttribute.valueType == 'YES/NO' ) selected="selected" #end>$i18n.getString( "yes_no" )</option>
+ <option value="DATE" #if( $catalogTypeAttribute.valueType == 'DATE' ) selected="selected" #end>$i18n.getString( "date" )</option>
+ <option value="COMBO" #if( $catalogTypeAttribute.valueType == 'COMBO' ) selected="selected" #end>$i18n.getString( "attribute_combo_type" )</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr id="attributeComboRow">
+ <td><label>$i18n.getString( "attribute_options" ) <em title="$i18n.getString( "required" )" class="required">*</em></label></td>
+ <td >
+ <table id="attrOptionContainer">
+ #foreach($option in $catalogTypeAttribute.attributeOptions)
+ <tr><td>
+ <input type='text' name='attrOption$option.id' value="$option.name" style="width:28em;"/><a href='#' style='text-decoration: none; margin-left:0.5em;' title='$i18n.getString( "remove_option" )' onClick='ATTRIBUTE_OPTION.remove(this,$option.id)'>[ - ]</a>
+ </td>
+ </tr>
+ #end
+ </table><a href="#" style="text-decoration: none;margin-top: 0.5em" onclick="ATTRIBUTE_OPTION.addOption()">[ $i18n.getString( "add_more_option" ) ]</a></td>
+ <td><span id="attrMessage" name="attrMessage" style="color:red;"></span></td>
+ </tr>
+ </tbody>
+
+ <tr>
+ <td></td>
+ <td>
+ <input type="submit" value="$i18n.getString( 'update' )">
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='coldChainCatalogTypeAttribute.action'">
+ </td>
+ </tr>
+ </table>
+</form>
+
+<script>
+ if( jQuery('#valueType').val() == "COMBO")
+ {
+ jQuery("#attributeComboRow").show();
+ }else
+ {
+ jQuery("#attributeComboRow").hide();
+ }
+
+ var i18n_remove_option = '$encoder.jsEscape( $i18n.getString( "remove_option" ) , "'") ';
+ var i118_at_least_2_option = '$encoder.jsEscape( $i18n.getString( "at_least_2_option" ) , "'") ';
+ var i18n_field_is_required = '$encoder.jsEscape( $i18n.getString( "field_is_required" ) , "'") ';
+ var isSubmit = true;
+</script>