← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7103: CCEM work in progress

 

------------------------------------------------------------
revno: 7103
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2012-05-30 16:16:26 +0530
message:
  CCEM work in progress
added:
  local/in/dhis-web-coldchain/cataLogImage
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowCatalogTypeImageAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowImageAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogImageFormAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogTypeImageFormAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogImageAction.java
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogTypeImageAction.java
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload.png
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload11111.jpg
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogImageForm.js
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogTypeImageForm.js
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodCatalogTypeImageStatus.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodImageStatus.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogImageForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogTypeImageForm.vm
modified:
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/Catalog.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogType.java
  local/in/dhis-in-api/src/main/java/org/hisp/dhis/config/Configuration_IN.java
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/Catalog.hbm.xml
  local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/CatalogType.hbm.xml
  local/in/dhis-web-coldchain/pom.xml
  local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowAddCatalogFormAction.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/resources/struts.xml
  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/catalogTypeList.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showAddCatalogForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm
  local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeForm.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/Catalog.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/Catalog.java	2012-05-09 07:02:15 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/Catalog.java	2012-05-30 10:46:26 +0000
@@ -1,5 +1,8 @@
 package org.hisp.dhis.coldchain.catalog;
 
+import java.io.File;
+import java.sql.Blob;
+
 import org.hisp.dhis.common.BaseNameableObject;
 //public class Catalog implements Serializable
 public class Catalog extends BaseNameableObject
@@ -8,15 +11,26 @@
      * Determines if a de-serialized file is compatible with this class.
      */
     private static final long serialVersionUID = -6551567526188061690L;
-
+    
+    public static final String DEFAULT_CCEMFOLDER = "CCEMIMAGES";
+    
     private int id;
     
     private String name;
     
     private String description;
+    
+    private String catalogImage;
+    
+    //private Blob image;
 
     private CatalogType catalogType;
     
+   // private File image;
+    
+    //private byte[] image;
+    
+
     // -------------------------------------------------------------------------
     // Contructors
     // -------------------------------------------------------------------------
@@ -37,11 +51,26 @@
         this.description = description;
         this.catalogType = catalogType;
     }
+    
+    /*
+    public Catalog( Blob image ) 
+    {
+        this.image = image;
+    }
+    
+   
+    public Catalog( byte[] image ) 
+    {
+        this.image = image;
+    }
+    */
 
     // -------------------------------------------------------------------------
     // hashCode and equals
     // -------------------------------------------------------------------------
 
+
+
     @Override
     public int hashCode()
     {
@@ -115,4 +144,59 @@
         this.catalogType = catalogType;
     }
     
+    public String getCatalogImage()
+    {
+        return catalogImage;
+    }
+
+    public void setCatalogImage( String catalogImage )
+    {
+        this.catalogImage = catalogImage;
+    }
+    /*
+    public File getImage()
+    {
+        return image;
+    }
+
+    public void setImage( File image )
+    {
+        this.image = image;
+    }
+    
+    public void setBinaryStream( Blob image )
+    {
+        this.image = image;
+    }
+    
+    public Blob getBinaryStream()
+    {
+        return image;
+    }
+    
+    public Blob getImage()
+    {
+        return image;
+    }
+
+    public void setImage( Blob image )
+    {
+        this.image = image;
+    }
+    
+    
+    public byte[] getImage()
+    {
+        return image;
+    }
+
+    public void setImage( byte[] image )
+    {
+        this.image = image;
+    }
+    */
+
+    
+    
+    
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogType.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogType.java	2012-05-14 09:25:17 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/catalog/CatalogType.java	2012-05-30 10:46:26 +0000
@@ -24,6 +24,8 @@
 	
     private DataEntryForm dataEntryForm;
     
+    private String catalogTypeImage;
+ 
     // -------------------------------------------------------------------------
     // Contructors
     // -------------------------------------------------------------------------
@@ -121,4 +123,12 @@
         this.catalogTypeAttributes = catalogTypeAttributes;
     }
     
+    public String getCatalogTypeImage()
+    {
+        return catalogTypeImage;
+    }
+    public void setCatalogTypeImage( String catalogTypeImage )
+    {
+        this.catalogTypeImage = catalogTypeImage;
+    }
 }

=== modified file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/config/Configuration_IN.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/config/Configuration_IN.java	2011-06-28 10:02:15 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/config/Configuration_IN.java	2012-05-30 10:46:26 +0000
@@ -39,7 +39,7 @@
     public static final String DEFAULT_REPORTFOLDER = "ra_national";
     
     public static final String DEFAULT_TEMPFOLDER = "temp";
-
+    
     private int id;
     
     private String key;

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/Catalog.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/Catalog.hbm.xml	2012-04-17 11:59:19 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/Catalog.hbm.xml	2012-05-30 10:46:26 +0000
@@ -12,6 +12,15 @@
     <property name="name" not-null="true" unique="true" length="160"/>
     
     <property name="description" not-null="false" length="250"/>
+	  
+	<property name="catalogImage" not-null="false" column="imageName" length="160"/>
+	  
+	  
+	<!--<property name="image" type="binary" column="IMAGE" />-->
+	  
+	<!--<property name="image" column="IMAGE" />-->
+	
+	<!--<property name="image" type="blob" column="IMAGE" />-->     
 
     <many-to-one name="catalogType" class="org.hisp.dhis.coldchain.catalog.CatalogType" 
         column="catalogtypeid" not-null="true" foreign-key="fk_coldchain_catalog_catalogtypeid"/>

=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/CatalogType.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/CatalogType.hbm.xml	2012-05-09 12:08:52 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/CatalogType.hbm.xml	2012-05-30 10:46:26 +0000
@@ -13,6 +13,7 @@
     
     <property name="description" not-null="false" length="250"/>
 	
+	<property name="catalogTypeImage" not-null="false" column="imageName" length="160"/>   
 	<!--
 	<set name="catalogTypeAttributes" table="catalogtype_attributes">
       <key column="catalogtypeid" foreign-key="fk_catalogtype_attributes_catalogtypeid" />

=== added file 'local/in/dhis-web-coldchain/cataLogImage'
Binary files local/in/dhis-web-coldchain/cataLogImage	1970-01-01 00:00:00 +0000 and local/in/dhis-web-coldchain/cataLogImage	2012-05-30 10:46:26 +0000 differ
=== modified file 'local/in/dhis-web-coldchain/pom.xml'
--- local/in/dhis-web-coldchain/pom.xml	2012-05-10 12:05:02 +0000
+++ local/in/dhis-web-coldchain/pom.xml	2012-05-30 10:46:26 +0000
@@ -68,7 +68,6 @@
             <artifactId>dhis-in-service-coldchain</artifactId>
             <version>${project.version}</version>
         </dependency>
-			
 		<!-- Other -->
 		<dependency>
 			<groupId>net.sourceforge.jexcelapi</groupId>

=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowAddCatalogFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowAddCatalogFormAction.java	2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowAddCatalogFormAction.java	2012-05-30 10:46:26 +0000
@@ -49,14 +49,20 @@
         return catalogTypeAttributes;
     }
     
+    private CatalogType catalogType;
+    
+    public CatalogType getCatalogType()
+    {
+        return catalogType;
+    }
+
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
 
     public String execute()
     {
-        
-        CatalogType catalogType = catalogTypeService.getCatalogType( catalogTypeId );
+        catalogType = catalogTypeService.getCatalogType( catalogTypeId );
         
         //catalogTypeAttributes =  catalogType.getCatalogTypeAttributes();
         

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowCatalogTypeImageAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowCatalogTypeImageAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowCatalogTypeImageAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,109 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowCatalogTypeImageAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private CatalogTypeService catalogTypeService;
+    
+    public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+    {
+        this.catalogTypeService = catalogTypeService;
+    }
+    
+    
+    
+    // -------------------------------------------------------------------------
+    // Input/Output and Getter / Setter
+    // -------------------------------------------------------------------------
+
+    private int id;
+    
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+    
+    
+    private byte[] bimage;
+    
+    public byte[] getBimage()
+    {
+        return bimage;
+    }
+    
+    String cataLogImage = null;
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+    
+    public String execute() throws Exception
+    {
+        
+        CatalogType catalogType = catalogTypeService.getCatalogType( id );
+        
+        if ( catalogType.getCatalogTypeImage() != null )
+        {
+            cataLogImage = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + catalogType.getCatalogTypeImage();
+        }
+        
+        else
+        {
+            
+        }
+       
+        File file = new File( cataLogImage );
+        bimage = new byte[(int) file.length()];
+        
+        try 
+        {
+            FileInputStream fileInputStream = new FileInputStream( file );
+            //convert file into array of bytes
+            fileInputStream.read( bimage );
+            fileInputStream.close();
+       } 
+       catch (Exception e) 
+       {
+            //e.printStackTrace();
+       }
+        
+       try 
+       {
+           HttpServletResponse response = ServletActionContext.getResponse();
+           response.reset();
+           response.setContentType("multipart/form-data"); 
+
+           OutputStream out = response.getOutputStream();
+           out.write( bimage );
+           out.flush();
+           out.close();
+       }
+        
+       catch (IOException e) 
+       {
+           //e.printStackTrace();
+       }
+        
+        return SUCCESS;
+    }
+    
+}
+
+

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowImageAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowImageAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowImageAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,131 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.struts2.ServletActionContext;
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowImageAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private CatalogService catalogService;
+    
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
+    
+    
+    
+    // -------------------------------------------------------------------------
+    // Input/Output and Getter / Setter
+    // -------------------------------------------------------------------------
+
+    private int id;
+    
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+    
+    
+    private byte[] bimage;
+    
+    public byte[] getBimage()
+    {
+        return bimage;
+    }
+    
+    String cataLogImage = null;
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+    
+    public String execute() throws Exception
+    {
+        
+        Catalog catalog = catalogService.getCatalog( id );
+        
+        if ( catalog.getCatalogImage() != null )
+        {
+            cataLogImage = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + catalog.getCatalogImage();
+        }
+        
+        else if ( catalog.getCatalogType().getCatalogTypeImage() != null )
+        {
+            cataLogImage = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + catalog.getCatalogType().getCatalogTypeImage();
+        }
+       
+        else
+        {
+            
+        }
+        //System.out.println( "cataLog Image is  : " + cataLogImage );
+        
+        /*
+        HttpServletResponse response = ServletActionContext.getResponse();
+        response.reset();
+        response.setContentType("multipart/form-data"); 
+
+        bimage = catalog.getImage();
+
+        OutputStream out = response.getOutputStream();
+        out.write( bimage );
+        out.flush();
+        out.close();
+        */
+        
+        
+        File file = new File( cataLogImage );
+        bimage = new byte[(int) file.length()];
+        
+        try 
+        {
+            FileInputStream fileInputStream = new FileInputStream( file );
+            //convert file into array of bytes
+            fileInputStream.read( bimage );
+            fileInputStream.close();
+       } 
+       catch (Exception e) 
+       {
+            //e.printStackTrace();
+       }
+        
+       try 
+       {
+           HttpServletResponse response = ServletActionContext.getResponse();
+           response.reset();
+           response.setContentType("multipart/form-data"); 
+
+           OutputStream out = response.getOutputStream();
+           out.write( bimage );
+           out.flush();
+           out.close();
+       }
+        
+       catch (IOException e) 
+       {
+           //e.printStackTrace();
+       }
+        
+        
+        
+        
+        
+        
+        
+        return SUCCESS;
+    }
+    
+}

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogImageFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogImageFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogImageFormAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,56 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUploadCatalogImageFormAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private CatalogService catalogService;
+    
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
+    
+
+    // -------------------------------------------------------------------------
+    // Input/Output and Getter / Setter
+    // -------------------------------------------------------------------------
+
+    private int id;
+    
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private Catalog catalog;
+    
+    public Catalog getCatalog()
+    {
+        return catalog;
+    }
+    
+    
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        
+        catalog = catalogService.getCatalog( id );
+        
+
+        return SUCCESS;
+
+    }
+
+}
+

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogTypeImageFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogTypeImageFormAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/ShowUploadCatalogTypeImageFormAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,56 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUploadCatalogTypeImageFormAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private CatalogTypeService catalogTypeService;
+    
+    public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+    {
+        this.catalogTypeService = catalogTypeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public int getId()
+    {
+        return id;
+    }
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private CatalogType catalogType;
+
+    public CatalogType getCatalogType()
+    {
+        return catalogType;
+    }
+
+
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        //System.out.println( id );
+        catalogType = catalogTypeService.getCatalogType( id );
+        
+        return SUCCESS;
+    }
+}

=== 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-05-09 12:08:52 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UpdateCatalogFormAction.java	2012-05-30 10:46:26 +0000
@@ -1,7 +1,10 @@
 package org.hisp.dhis.coldchain.catalog.action;
 
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.OutputStream;
+import java.net.URL;
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -13,7 +16,6 @@
 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;
 
@@ -58,7 +60,6 @@
         this.id = id;
     }
 
-
     private Catalog catalog;
     
 
@@ -96,10 +97,48 @@
         return catalogTypeAttributes;
     }
     
+    private String cataLogImage;
+    
+    
+    private byte[] bimage;
+    
+    public byte[] getBimage()
+    {
+        return bimage;
+    }
+    
+    private OutputStream outPutStream;
+    
+    public OutputStream getOutPutStream()
+    {
+        return outPutStream;
+    }
+    
+    private BufferedImage bufferedImage;
+    
+    public BufferedImage getBufferedImage()
+    {
+        return bufferedImage;
+    }
+    
+    private URL url;
+    
+    public URL getUrl()
+    {
+        return url;
+    }
+
+
+ 
+    public String getCataLogImage()
+    {
+        return cataLogImage;
+    }
+    
     // -------------------------------------------------------------------------
     // Action implementation
     // -------------------------------------------------------------------------
-
+    
     public String execute() throws Exception
     {
         
@@ -107,7 +146,97 @@
         
         catalogTypes = new ArrayList<CatalogType>( catalogTypeService.getAllCatalogTypes());
         
- 
+        
+        cataLogImage = catalog.getCatalogImage();
+        
+        //String outputFilePath = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + cataLogImage;
+        
+        System.out.println( "Catalog Image Name is   :" + cataLogImage );
+        
+        cataLogImage = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + cataLogImage;
+        
+        System.out.println( "Complete Path of Image  is   :" + cataLogImage );
+        
+        
+        /*
+        HttpServletResponse response = ServletActionContext.getResponse();
+        response.reset();
+        response.setContentType("multipart/form-data"); 
+
+        
+        bimage = catalog.getImage();
+
+        OutputStream out = response.getOutputStream();
+        out.write( bimage );
+        out.flush();
+        out.close();
+        */
+        
+        /*
+        bimage = catalog.getImage();
+        System.out.println( " Image  is   :" + bimage );
+        System.out.println( " lenght is     :" + bimage.length );
+        System.out.println( " String is     :" + bimage.toString() );
+        try
+        {
+            
+            int len = bimage.toString().length();
+            byte [] rb = new byte[len];
+            //InputStream readImg = rs.getBinaryStream(1);
+            //int index=readImg.read(rb, 0, len);  
+            outPutStream.write( rb,0,len );
+            
+            
+            
+            //outPutStream
+            //FileOutputStream fos = new FileOutputStream("cataLogImage"); 
+           // outPutStream = new FileOutputStream( cataLogImage ); 
+            //outPutStream.write( bimage );
+            //outPutStream.close();
+        }
+        catch(Exception e)
+        {
+            //e.printStackTrace();
+        }
+        
+        */
+        
+        
+        
+        /*
+        String filePath = cataLogImage;
+        File f1 = new File( filePath );
+
+        ImageInputStream imgStream1 = ImageIO.createImageInputStream( f1 );
+        long size = imgStream1.length();
+
+        
+        //bufferedImage = ImageIO.read( f1 );
+        
+        BufferedImage bufferedImage1 = ImageIO.read( f1 );
+        //boolean success = ImageIO.write( bufferedImage1,"gif",socket.getOutputStream());
+        
+        
+        try 
+        {
+            url = new URL( getCodeBase(), cataLogImage );
+            
+            bufferedImage = ImageIO.read( url );
+         } 
+        catch (IOException e) 
+        {
+            
+        }
+        
+        System.out.println( "IMAGE  is   :" + bufferedImage );
+        System.out.println( "URL is   :" + url );
+        
+       
+        //outPutStream.w.write( bufferedImage1 );
+        
+        */
+        
+        
         // -------------------------------------------------------------------------
         // Get catalog attribute values
         // -------------------------------------------------------------------------
@@ -150,6 +279,21 @@
         return SUCCESS;
 
     }
-
+/*
+    private URL getCodeBase()
+    {
+        //URL url = null;
+        try 
+        {
+            url = new URL( "catalog.getCatalogImage()" );
+        } 
+        catch (IOException e) 
+        {
+            
+        }
+        System.out.println( "URL in method is   :" + url );
+        return url;
+    }
+*/
 }
 

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogImageAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogImageAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogImageAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,359 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.sql.Blob;
+
+import org.hibernate.Hibernate;
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogService;
+import org.hisp.dhis.system.util.StreamUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class UploadCatalogImageAction implements Action
+{
+
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+    
+    private CatalogService catalogService;
+    
+    public void setCatalogService( CatalogService catalogService )
+    {
+        this.catalogService = catalogService;
+    }
+    
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+    
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setMessage( String message )
+    {
+        this.message = message;
+    }
+    
+    private int catalogID;
+    
+    public void setCatalogID( int catalogID )
+    {
+        this.catalogID = catalogID;
+    }
+
+    private String name;
+    
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+    
+    
+    
+    /*
+    private File file;
+    
+    public File getFile()
+    {
+        return file;
+    }
+
+    public void setFile( File file )
+    {
+        this.file = file;
+    }
+    
+    private String fileName;
+    
+    public String getFileName()
+    {
+        return fileName;
+    }
+
+    public void setFileName( String fileName )
+    {
+        this.fileName = fileName;
+    }
+    
+    
+    private File file;
+
+    public void setUpload( File file )
+    {
+        this.file = file;
+    }
+    
+    private File upload;
+
+    public File getUpload()
+    {
+        return upload;
+    }
+    
+    
+    private String fileName;
+    
+    public void setUploadFileName( String fileName )
+    {
+        this.fileName = fileName;
+    }
+    /*
+     * 
+     * 
+     * 
+     */
+    /*
+    private String tempFileName;
+    
+    public void setTempFileName( String tempFileName )
+    {
+        this.tempFileName = tempFileName;
+    }
+
+    private File upload;
+    
+    public void setUpload( File upload )
+    {
+        this.upload = upload;
+    }
+    
+    private File file;
+
+    public void setUpload( File file )
+    {
+        this.file = file;
+    }
+    */
+    private String fileName;
+
+    private File upload;
+    
+    public void setUploadFileName( String fileName )
+    {
+        this.fileName = fileName;
+    }
+    
+   
+    public void setUpload( File upload )
+    {
+        this.upload = upload;
+    }
+    
+    private File outputFile;
+    
+    String imageName = "";
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+
+    public String execute() throws Exception
+    {
+        outputFile = null;
+        
+        Catalog catalog = catalogService.getCatalog( catalogID );
+        
+        
+        //File directory = null;
+        
+        String fileType = fileName.substring(fileName.indexOf( '.' )+1, fileName.length());
+        
+        
+        System.out.println( "File Name is : " + fileName +" File Type is : " +  fileType );
+        
+        System.out.println( "UPLOAD is  : " + upload );
+        
+        
+        
+        if ( ! ( fileType.equalsIgnoreCase( "jpg" ) || fileType.equalsIgnoreCase( "png" ) || fileType.equalsIgnoreCase( "gif" ) ||  fileType.equalsIgnoreCase( "jpeg" ) ||  fileType.equalsIgnoreCase( "tiff" ) || fileType.equalsIgnoreCase( "bmp" ) ) )
+        //if ( !fileType.equalsIgnoreCase( "jpg" ) || !fileType.equalsIgnoreCase( "png" ) || !fileType.equalsIgnoreCase( "gif" ) || !fileType.equalsIgnoreCase( "bmp" ) )
+        {
+            message = "The file you are trying to import is not an image file";
+            
+            return SUCCESS;
+        }
+        
+        imageName = catalog.getName()+"."+ fileType;
+        
+        catalog.setCatalogImage( imageName );
+        //catalog.setCatalogImage( fileName );
+        catalogService.updateCatalog( catalog );
+        
+        
+       
+        
+        String outputFilePath = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER;
+        
+        File newdir = new File( outputFilePath );
+        if( !newdir.exists() )
+        {
+            newdir.mkdirs();
+        }
+        
+        outputFile = new File( newdir, imageName );
+        try
+        {        
+            StreamUtils.write( upload, outputFile );
+            
+            message = "Image successfully uploaded";
+        }
+        
+        catch( Exception e )
+        {
+            /*
+            e.printStackTrace();
+            message += "<br><font color=red><strong>Some problem occured while Importing the file : "+ upload.getName() + "<br>Error Message: "+e.getMessage()+"</font></strong>";
+            */
+        } 
+
+        //String  cataLogImage = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + catalog.getCatalogImage();
+        
+
+        //FileInputStream fis;
+        
+        /*
+        
+        File file = new File( cataLogImage );
+        byte[] bFile = new byte[(int) file.length()];
+      
+        
+        try 
+        {
+            FileInputStream fileInputStream = new FileInputStream(file);
+            //convert file into array of bytes
+            fileInputStream.read(bFile);
+            fileInputStream.close();
+       } 
+       catch (Exception e) 
+       {
+            e.printStackTrace();
+       }
+       
+       catalog.setImage( bFile );
+       
+       catalogService.updateCatalog( catalog ); 
+      
+      */ 
+        
+        //fis = new FileInputStream(image);
+        
+        
+       // catalog.setImage(  image );
+        
+        /*
+        catalog.setBinaryStream( image );
+        
+        catalog.setBinaryStream(InputStream)fis, (int)(image.length()));
+         */
+        
+        
+        
+        
+        //System.out.println( "File Name is : " + upload.getName() );
+        
+        
+        
+        //outputFile = new File( directory, (Math.random() * 1000) + fileName );
+        
+        //String outputFilePathTest = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER + File.separator + tempFileName;
+        
+       
+       /*
+       File newdir = new File( outputFilePath );
+        if( !newdir.exists() )
+        {
+            newdir.mkdirs();
+        }
+        */
+       
+        //outputFile = new File( directory, (Math.random() * 1000) + fileName );
+        
+       // file.renameTo( outputFile );
+        
+        /*
+        File output = null;
+        output = new File( outputFilePath, outputFilePathTest );
+        */
+        //InputStream inputStream = null;
+        
+        //inputStream = new BufferedInputStream( new FileInputStream( file ) );
+        
+        //outputFile = new File( newdir, (Math.random() * 1000) + fileName );
+        
+        //outputFile = new File( newdir, fileName );
+        
+       /* outputFile = new File( newdir, imageName );*/
+        /*try
+        {  */      
+            //outputFile = new File( outputFilePathTest );
+            
+            //outputFile = new File( newdir, fileName );
+            
+            //outputFile = new File( newdir, (Math.random() * 1000) + fileName );
+            
+            
+          /*  StreamUtils.write( upload, outputFile ); */
+            
+            //System.out.println( " outputFile : " + outputFile );
+            
+           // System.out.println( "File Name is : " + upload.getName() );
+            
+            //StreamUtils.write( upload, outputFile );
+            
+            
+            //System.out.println( "File Name is : " + file.getPath() );
+          //  System.out.println( "File Name is : " + fileName );
+            
+            //System.out.println( "File Name is : " + tempFileName );
+            
+            //String fileType = fileName.substring(fileName.indexOf( '.' )+1, fileName.length());
+            
+            //String fileType = fileName.substring(fileName.indexOf( '.' )+1, upload.getName().length());
+            
+           // System.out.println( "File Name is : " + fileName +" File Type is : " +  fileType );
+            
+           /*
+           message = "Image successfully uploaded";
+        }
+        */
+        /*
+       catch( Exception e )
+        {
+            
+            e.printStackTrace();
+            message += "<br><font color=red><strong>Some problem occured while Importing the file : "+ upload.getName() + "<br>Error Message: "+e.getMessage()+"</font></strong>";
+            
+        } 
+        */
+        
+        /*
+        String filePath = c:\images\+ "button1.gif";
+        File f1 = new File(filePath);
+
+        ImageInputStream imgStream1 = ImageIO.createImageInputStream(f1);
+        long size = imgStream1.length();
+
+        BufferedImage bufferedImage1 = ImageIO.read(f1);
+        boolean success = ImageIO.write(bufferedImage1,"gif",socket.getOutputStream());
+
+        socketWriter.close();
+        socketReader.close();
+        socket.close();
+        socket = null;
+        */
+        
+        
+        
+        
+        return SUCCESS;
+    }
+  
+
+}

=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogTypeImageAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogTypeImageAction.java	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/UploadCatalogTypeImageAction.java	2012-05-30 10:46:26 +0000
@@ -0,0 +1,121 @@
+package org.hisp.dhis.coldchain.catalog.action;
+
+import java.io.File;
+
+import org.hisp.dhis.coldchain.catalog.Catalog;
+import org.hisp.dhis.coldchain.catalog.CatalogType;
+import org.hisp.dhis.coldchain.catalog.CatalogTypeService;
+import org.hisp.dhis.system.util.StreamUtils;
+
+import com.opensymphony.xwork2.Action;
+
+public class UploadCatalogTypeImageAction implements Action
+{
+    // -------------------------------------------------------------------------
+    // Dependencies
+    // -------------------------------------------------------------------------
+
+    private CatalogTypeService catalogTypeService;
+    
+    public void setCatalogTypeService( CatalogTypeService catalogTypeService )
+    {
+        this.catalogTypeService = catalogTypeService;
+    }
+
+    // -------------------------------------------------------------------------
+    // Input/Output
+    // -------------------------------------------------------------------------
+
+    private int id;
+
+    public void setId( int id )
+    {
+        this.id = id;
+    }
+
+    private String fileName;
+
+    private File upload;
+    
+    public void setUploadFileName( String fileName )
+    {
+        this.fileName = fileName;
+    }
+    
+   
+    public void setUpload( File upload )
+    {
+        this.upload = upload;
+    }
+    
+    private String message;
+
+    public String getMessage()
+    {
+        return message;
+    }
+
+    public void setMessage( String message )
+    {
+        this.message = message;
+    }
+    
+    String imageName = "";
+    
+    private File outputFile;
+    // -------------------------------------------------------------------------
+    // Action implementation
+    // -------------------------------------------------------------------------
+
+    public String execute() throws Exception
+    {
+        outputFile = null;
+        
+        CatalogType catalogType = catalogTypeService.getCatalogType( id );
+        
+        String fileType = fileName.substring(fileName.indexOf( '.' )+1, fileName.length());
+        
+        if ( ! ( fileType.equalsIgnoreCase( "jpg" ) || fileType.equalsIgnoreCase( "png" ) || fileType.equalsIgnoreCase( "gif" ) ||  fileType.equalsIgnoreCase( "jpeg" ) ||  fileType.equalsIgnoreCase( "tiff" ) || fileType.equalsIgnoreCase( "bmp" ) ) )
+            //if ( !fileType.equalsIgnoreCase( "jpg" ) || !fileType.equalsIgnoreCase( "png" ) || !fileType.equalsIgnoreCase( "gif" ) || !fileType.equalsIgnoreCase( "bmp" ) )
+            {
+                message = "The file you are trying to import is not an image file";
+                
+                return SUCCESS;
+            }
+        
+        imageName = catalogType.getName()+"."+ fileType;
+        
+        catalogType.setCatalogTypeImage( imageName );    
+        
+        catalogTypeService.updateCatalogType( catalogType );
+        
+
+        String outputFilePath = System.getenv( "DHIS2_HOME" ) + File.separator +  Catalog.DEFAULT_CCEMFOLDER;
+        
+        File newdir = new File( outputFilePath );
+        if( !newdir.exists() )
+        {
+            newdir.mkdirs();
+        }
+        
+        outputFile = new File( newdir, imageName );
+        try
+        {        
+            StreamUtils.write( upload, outputFile );
+            
+            message = "Image successfully uploaded";
+        }
+        
+        catch( Exception e )
+        {
+           
+            e.printStackTrace();
+            message += "<br><font color=red><strong>Some problem occured while Importing the file : "+ fileName + "<br>Error Message: "+e.getMessage()+"</font></strong>";
+            
+        }         
+        
+
+        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-05-23 06:35:17 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml	2012-05-30 10:46:26 +0000
@@ -497,5 +497,46 @@
 	  </bean>
 	
 		
-				
+	<!-- Upload Image Form Catalog-->
+	<bean id="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogImageFormAction"
+		class="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogImageFormAction"
+		scope="prototype">
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+	</bean>
+	
+	<bean id="org.hisp.dhis.coldchain.catalog.action.UploadCatalogImageAction"
+		class="org.hisp.dhis.coldchain.catalog.action.UploadCatalogImageAction"
+		scope="prototype">
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+	</bean>	
+
+	
+	<bean id="org.hisp.dhis.coldchain.catalog.action.ShowImageAction"
+		class="org.hisp.dhis.coldchain.catalog.action.ShowImageAction"
+		scope="prototype">
+		<property name="catalogService" ref="org.hisp.dhis.coldchain.catalog.CatalogService" />
+	</bean>	
+		
+	<!-- Upload Image Form Catalog Type-->
+	<bean id="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogTypeImageFormAction"
+		class="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogTypeImageFormAction"
+		scope="prototype">
+		<property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+	</bean>	
+		
+
+	<bean id="org.hisp.dhis.coldchain.catalog.action.UploadCatalogTypeImageAction"
+		class="org.hisp.dhis.coldchain.catalog.action.UploadCatalogTypeImageAction"
+		scope="prototype">
+		<property name="catalogTypeService" ref="org.hisp.dhis.coldchain.catalog.CatalogTypeService" />
+	</bean>			
+			
+	
+	<bean id="org.hisp.dhis.coldchain.catalog.action.ShowCatalogTypeImageAction"
+		class="org.hisp.dhis.coldchain.catalog.action.ShowCatalogTypeImageAction"
+		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-05-24 06:15:24 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties	2012-05-30 10:46:26 +0000
@@ -113,4 +113,6 @@
 
 ccem_setup = CCEM Setup
 ccem_entry = CCEM Entry
-ccem_reports = CCEM Reports
\ No newline at end of file
+ccem_reports = CCEM Reports
+upload_image = Upload image
+upload_catalog_image = Upload catalog image
\ 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-05-23 06:35:17 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml	2012-05-30 10:46:26 +0000
@@ -499,7 +499,50 @@
 		<result name="success" type="redirect">enquipmentSelect.action</result>
 		<param name="requiredAuthorities">F_EQUIPMENT_DATAENTRY</param>
 	</action>	
-			
-	
-</package>		
+
+
+	<!-- Upload Image Form -->
+	<action name="showUploadImageForm" class="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogImageFormAction">
+		<result name="success" type="velocity">/main.vm</result>
+		<param name="page">/dhis-web-coldchain/uploadCatalogImageForm.vm</param>
+		<param name="stylesheets">css/style.css</param>
+		<param name="requiredAuthorities">F_CATALOG_UPDATE</param>
+	</action>	
+		
+	<action name="uploadCatalogImage" class="org.hisp.dhis.coldchain.catalog.action.UploadCatalogImageAction">
+		<result name="success" type="velocity">/main.vm</result>
+		<param name="menu">/dhis-web-coldchain/menu.vm</param>
+		<param name="page">/dhis-web-coldchain/responseUplodImageStatus.vm</param>
+		<interceptor-ref name="fileUploadStack" />
+	</action>				
+
+	
+	
+	<action name="showImage" class="org.hisp.dhis.coldchain.catalog.action.ShowImageAction">
+		<result name="success" type="velocity">/content.vm</result>
+	</action>	
+
+	<!-- Upload Image Form Catalog Type-->
+	<action name="showUploadCatalogTypeImageForm" class="org.hisp.dhis.coldchain.catalog.action.ShowUploadCatalogTypeImageFormAction">
+		<result name="success" type="velocity">/main.vm</result>
+		<param name="page">/dhis-web-coldchain/uploadCatalogTypeImageForm.vm</param>
+		<param name="stylesheets">css/style.css</param>
+		<param name="requiredAuthorities">F_CATALOG_UPDATE</param>
+	</action>	
+	
+
+	<action name="uploadCatalogTypeImage" class="org.hisp.dhis.coldchain.catalog.action.UploadCatalogTypeImageAction">
+		<result name="success" type="velocity">/main.vm</result>
+		<param name="menu">/dhis-web-coldchain/menu.vm</param>
+		<param name="page">/dhis-web-coldchain/responseUplodCatalogTypeImageStatus.vm</param>
+		<interceptor-ref name="fileUploadStack" />
+	</action>	
+			
+
+	
+	<action name="showCatalogTypeImage" class="org.hisp.dhis.coldchain.catalog.action.ShowCatalogTypeImageAction">
+		<result name="success" type="velocity">/content.vm</result>
+	</action>	
+			
+</package>
 </struts>
\ No newline at end of file

=== 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-05-05 11:16:25 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/addCatalogForm.vm	2012-05-30 10:46:26 +0000
@@ -25,10 +25,10 @@
                 		<option value="$catalogType.id">$encoder.htmlEncode( $catalogType.name )</option>
 	                #end
             </select>
-        </td>		
+        </td>
 	</tr>
     <tr><td>&nbsp;</td><td>&nbsp;</td></tr>
-</table>   
+</table>  
 
 <div id='addCatalogFormDiv'></div> <!-- Add Catalog Form -->  	  	
 

=== 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-05-09 07:02:15 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogList.vm	2012-05-30 10:46:26 +0000
@@ -32,12 +32,13 @@
 		<table class="listTable" id="listTable">
 			<col>          
 			<col width="20">
+			<col width="20">	
 			<col width="20">
 			<col width="20">          		  
 			<thead>
 			  <tr>
 				<th>$i18n.getString( "name" )</th>
-				<th colspan="3">$i18n.getString( "operations" )</th>
+				<th colspan="4">$i18n.getString( "operations" )</th>
 			  </tr>
 			</thead>
 			<tbody id="list">
@@ -46,6 +47,12 @@
               
                 <!--<td>$encoder.htmlEncode( $catalog.name )</td>-->             
                 <td onclick="showCatalogDetails( $catalog.id )">$encoder.htmlEncode( $catalog.name )</td>
+               	
+               <td style="text-align:center">
+                  <a href="showUploadImageForm.action?id=$catalog.id" title="$i18n.getString( 'upload_image' )"><img src="images/upload.png" alt="$i18n.getString( 'upload_image' )"></a>
+                </td>               	
+               	
+               	
                	<td style="text-align:center">
                   <!--<a href="javascript:showUpdateCatalogForm( '$catalog.id' )" title='$i18n.getString( "edit" )'><img src="../images/edit.png" alt='$i18n.getString( "edit_profile" )'></a>-->
                   <a href="showUpdateCatalogForm.action?id=$catalog.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>

=== modified 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	2012-05-09 12:08:52 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/catalogTypeList.vm	2012-05-30 10:46:26 +0000
@@ -36,6 +36,7 @@
               <tr id="tr${catalogType.id}">
                 <td onclick="showCalatogTypeDetails( $catalogType.id )">$encoder.htmlEncode( $catalogType.name )</td>
                 <td style="text-align:right">
+                  <a href="showUploadCatalogTypeImageForm.action?id=$catalogType.id" title="$i18n.getString( 'upload_image' )"><img src="images/upload.png" alt="$i18n.getString( 'upload_image' )"></a>		
                   <a href="editCatalogTypeForm.action?id=$catalogType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
                   <a href="javascript:removeItem( '$catalogType.id', '$encoder.jsEncode( $catalogType.name )', i18n_confirm_delete , 'removeCatalogType.action' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( "remove" )"></a>
 				  <a href="viewCatalogTypeDataEntryForm.action?catalogTypeId=$catalogType.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( "design_data_entry_form" )"></a>					

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload.png'
Binary files local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload.png	1970-01-01 00:00:00 +0000 and local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload.png	2012-05-30 10:46:26 +0000 differ
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload11111.jpg'
Binary files local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload11111.jpg	1970-01-01 00:00:00 +0000 and local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/upload11111.jpg	2012-05-30 10:46:26 +0000 differ
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogImageForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogImageForm.js	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogImageForm.js	2012-05-30 10:46:26 +0000
@@ -0,0 +1,36 @@
+jQuery(document).ready(	function(){
+	
+	validation( 'uploadCatalogImageForm', function(form){
+		//tempFileName = $('#upload').val();alert( tempFileName );
+		form.submit();
+	}, function(){
+		isSubmit = true;
+		
+	});
+	
+	checkValueIsExist( "name", "validateCatalog.action", {id:getFieldValue('id')});
+});
+
+
+/*
+<script type="text/javascript" language="javascript">
+$(document).ready(function () {
+    $('#formUpload').submit(function (e) {
+        var filePath = $('#file').val();
+        $.getJSON('@Url.Action("CheckIfFileExists")', { path: filePath },
+            function (exists) {
+                if (exists) {
+                    var cancel = confirm('File "' + filePath + '" has already been uploaded. Overwrite?');
+                    if (cancel) {
+                        e.preventDefault();
+                        return false;
+                    }
+                }
+
+                return true;
+            }
+        );
+    });
+});
+</script>
+*/
\ No newline at end of file

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogTypeImageForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogTypeImageForm.js	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/uploadCatalogTypeImageForm.js	2012-05-30 10:46:26 +0000
@@ -0,0 +1,11 @@
+jQuery(document).ready(	function(){
+	
+	validation( 'uploadCatalogTypeImageForm', function(form){
+		form.submit();
+	}, function(){
+		isSubmit = true;
+		
+	});
+	
+	checkValueIsExist( "name", "validateCatalogType.action", {id:getFieldValue('id')});	
+});

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodCatalogTypeImageStatus.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodCatalogTypeImageStatus.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodCatalogTypeImageStatus.vm	2012-05-30 10:46:26 +0000
@@ -0,0 +1,5 @@
+<span id="message" style="display:block">$encoder.xmlEncode( $message )</span>
+
+<br/><br/>
+
+<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='catalogType.action'" />

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodImageStatus.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodImageStatus.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/responseUplodImageStatus.vm	2012-05-30 10:46:26 +0000
@@ -0,0 +1,5 @@
+<span id="message" style="display:block">$encoder.xmlEncode( $message )</span>
+
+<br/><br/>
+
+<input type="button" value="$i18n.getString( 'back' )" onclick="window.location.href='catalog.action'" />

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showAddCatalogForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showAddCatalogForm.vm	2012-05-09 07:02:15 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/showAddCatalogForm.vm	2012-05-30 10:46:26 +0000
@@ -11,6 +11,10 @@
 </script>
 <!-- ATTRIBUTES -->
 <table>
+<td>
+<td>
+
+<table>
 <tr><td>&nbsp;</td></tr>
 #if ( $catalogTypeAttributes.size() > 0) 	
 	<tr><th colspan="2" class="heading-column">$i18n.getString( "catalogType_details" )</th></tr>
@@ -55,4 +59,11 @@
 		
 	#end
 #end
+</table>
+</td>
+<td>&nbsp;</td>
+<td><!--<img src="$outPutStream" alt="Catalog Image" width="100" height="100"/>-->
+	<img src="showCatalogTypeImage.action?id=$catalogType.id" style="width:200px;height:200px;">
+</td>
+</tr>
 </table>
\ No newline at end of file

=== 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-05-05 11:16:25 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogForm.vm	2012-05-30 10:46:26 +0000
@@ -18,6 +18,9 @@
 	<input type="hidden" id="catalogTypeID" name="id" value="$catalog.catalogType.id">
 </div>
 <table>
+<td>
+<td>
+<table>
 <!--<tr>
 		<th colspan="2" class="heading-column">$i18n.getString( "catalog__details" )</th>
 	</tr>
@@ -86,10 +89,20 @@
 		#end
 	#end
 </table>
-
+</td>
+<td>&nbsp;</td>
+<td><!--<img src="$outPutStream" alt="Catalog Image" width="100" height="100"/>-->
+	<img src="showImage.action?id=$catalog.id" style="width:200px;height:200px;">
+</td>
+<!--<td><img src="$url" alt="Catalog Image" width="100" height="100" />$bufferedImage $catalog.image.png
+<div class="inputCriteria" style="width:600px;height:150px;">
+</td>-->
+</tr>
+</table>
 <p>
 	<input type="submit" class='button' value="$i18n.getString( 'update' )" >
 	<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='catalog.action'" />
 </p>
 
-</form> 	
+</form>	
+<!-- <img src="pulpit.jpg" alt="Pulpit rock" width="304" height="228" />  -->
\ No newline at end of file

=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeForm.vm	2012-04-30 11:24:11 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/updateCatalogTypeForm.vm	2012-05-30 10:46:26 +0000
@@ -4,7 +4,9 @@
 
 <form id="updateCatalogTypeForm" name="updateCatalogTypeForm" action="updateCatalogType.action" method="post">
 	<input type="hidden" id="id" name="id" value="$catalogType.id"/>
-	  
+<table>
+<td>
+<td>	  
 	<table id="detailsList">
 		<thead>
 			<tr><th colspan="2">$i18n.getString( "catalog_type_details" )</th></tr>
@@ -23,7 +25,13 @@
 		  
 		</tbody>
 	</table>
-
+</td>
+<td>&nbsp;</td>
+<td><!--<img src="$outPutStream" alt="Catalog Image" width="100" height="100"/><img src="test.do?id=1&name=mike" >-->
+	<img src="showCatalogTypeImage.action?id=$catalogType.id" style="width:200px;height:200px;">
+</td>
+</tr>
+</table>
 	<table id="catalogTypeMembersArea">
 		<thead>
 			<tr>

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogImageForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogImageForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogImageForm.vm	2012-05-30 10:46:26 +0000
@@ -0,0 +1,43 @@
+
+<script type="text/javascript" src="javascript/uploadCatalogImageForm.js"></script>
+
+<h3>$i18n.getString( "upload_catalog_image" )</h3>
+<p>
+<form id="uploadCatalogImageForm" name="uploadCatalogImageForm" action="uploadCatalogImage.action" method="post" enctype="multipart/form-data">
+<div>
+	<input type="hidden" id="id" name="id" value="$catalog.id">
+	<input type="hidden" id="catalogID" name="catalogID" value="$catalog.id">
+	<input type="hidden" id="catalogTypeID" name="id" value="$catalog.catalogType.id">
+	<input type="hidden" id="tempFileName" name="tempFileName">
+</div>
+<table>
+	<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, 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, minlength:4}}"></td>
+	</tr>
+	<tr>
+		<td class='text-column'><label for="catalogType">$i18n.getString( "catalogType" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td class="input-column" ><input type="text" id="catalogType" name="catalogType" value="$!catalog.catalogType.name" class="{validate:{required:true}}"></td>
+	</tr>
+
+	<tr>
+		<td class='text-column'><label for="uploadImage">$i18n.getString( "upload_image" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+		<td class="input-column" ><input type="file" id="upload" name="upload" size="50" class="{validate:{required:true}}"></td>
+	</tr>
+	<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
+	
+	<tr>
+		<td>&nbsp;</td>
+		<td><input type="submit" class='button' value="$i18n.getString( 'upload_image' )" >&nbsp;
+		<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='catalog.action'" /></td>
+
+	</tr>
+</table>
+
+
+
+</form> 	

=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogTypeImageForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogTypeImageForm.vm	1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/uploadCatalogTypeImageForm.vm	2012-05-30 10:46:26 +0000
@@ -0,0 +1,38 @@
+<script type="text/javascript" src="javascript/uploadCatalogTypeImageForm.js"></script>
+
+<h3>$i18n.getString( "edit_catalogType" )</h3>
+
+<form id="uploadCatalogTypeImageForm" name="uploadCatalogTypeImageForm" action="uploadCatalogTypeImage.action" method="post" enctype="multipart/form-data">
+	<input type="hidden" id="id" name="id" value="$catalogType.id"/>
+	  
+	<table id="detailsList">
+		<thead>
+			<tr><th colspan="2">$i18n.getString( "catalog_type_details" )</th></tr>
+		</thead>
+		<tbody>
+			<tr>
+				<td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+				<td><input type="text" id="name" name="name" value="$encoder.htmlEncode( $catalogType.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" value="$encoder.htmlEncode( $catalogType.description )" class="{validate:{required:true,minlength:4}}"/></td>
+			</tr>  
+			
+		<tr>
+			<td class='text-column'><label for="uploadImage">$i18n.getString( "upload_image" )<em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+			<td class="input-column" ><input type="file" id="upload" name="upload" size="50" class="{validate:{required:true}}"></td>
+		</tr>
+		<tr><td>&nbsp;</td></tr>		     
+		<tr>
+			<td>&nbsp;</td>
+			<td><input type="submit" class='button' value="$i18n.getString( 'upload_image' )" >&nbsp;
+			<input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='catalogType.action'" /></td>
+
+		</tr>
+	  
+		</tbody>
+	</table>
+
+</form>