dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17484
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6970: CCEM work in progress
------------------------------------------------------------
revno: 6970
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-05-17 13:03:28 +0530
message:
CCEM work in progress
added:
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetDataSetListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowInventoryTypeDataSetFormAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeDataSetAction.java
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/dataset.png
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeDataSetForm.vm
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeDataSetForm.js
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonDataSetList.vm
modified:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java
local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml
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/inventory/action/GetInventoryTypeAttributeListAction.java
local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.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/images/Thumbs.db
local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.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/inventory/InventoryType.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java 2012-05-16 07:06:15 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/coldchain/inventory/InventoryType.java 2012-05-17 07:33:28 +0000
@@ -1,11 +1,14 @@
package org.hisp.dhis.coldchain.inventory;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import org.hisp.dhis.coldchain.catalog.CatalogType;
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.dataentryform.DataEntryForm;
+import org.hisp.dhis.dataset.DataSet;
//public class InventoryType implements Serializable
public class InventoryType extends BaseNameableObject
@@ -31,6 +34,12 @@
private List<InventoryTypeAttribute> inventoryTypeAttributes = new ArrayList<InventoryTypeAttribute>();
+ /**
+ * All DataSets associated with this InventoryType.
+ */
+ private Set<DataSet> dataSets = new HashSet<DataSet>();
+
+
private DataEntryForm dataEntryForm;
@@ -161,4 +170,13 @@
this.dataEntryForm = dataEntryForm;
}
+ public Set<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+ public void setDataSets( Set<DataSet> dataSets )
+ {
+ this.dataSets = dataSets;
+ }
+
}
=== modified file 'local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml'
--- local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml 2012-05-16 07:06:15 +0000
+++ local/in/dhis-in-services/dhis-in-service-coldchain/src/main/resources/org/hisp/dhis/coldchain/hibernate/InventoryType.hbm.xml 2012-05-17 07:33:28 +0000
@@ -17,7 +17,16 @@
foreign-key="fk_inventorytype_catalogypeid" />
<property name="tracking" column="tracking" />
+
+
+ <set name="dataSets" table="inventorytype_datasets">
+ <key column="inventorytypeid" foreign-key="fk_inventorytype_datasets_inventorytypeid" />
+ <many-to-many class="org.hisp.dhis.dataset.DataSet" column="datasetid"
+ foreign-key="inventorytype_datasets_datasetid" />
+ </set>
+
+
<!--
<set name="inventoryTypeAttributes" table="inventorytype_attributes">
<key column="inventorytypeid" foreign-key="fk_inventorytype_attributes_inventorytypeid" />
=== modified 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 2012-04-21 10:23:39 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/catalog/action/AddCatalogTypeAttributeAction.java 2012-05-17 07:33:28 +0000
@@ -6,7 +6,6 @@
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;
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetDataSetListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetDataSetListAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetDataSetListAction.java 2012-05-17 07:33:28 +0000
@@ -0,0 +1,59 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+
+import com.opensymphony.xwork2.Action;
+
+public class GetDataSetListAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependency
+ // -------------------------------------------------------------------------
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input & Output
+ // -------------------------------------------------------------------------
+ private List<DataSet> dataSets;
+
+ public List<DataSet> getDataSets()
+ {
+ return dataSets;
+ }
+
+
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ dataSets = new ArrayList<DataSet>( dataSetService.getAllDataSets() );
+ Collections.sort( dataSets, new IdentifiableObjectNameComparator() );
+
+ /*
+ for( DataSet dataSet : dataSets )
+ {
+ System.out.println( "ID---" + dataSet.getId() );
+ System.out.println( "Name---" + dataSet.getName());
+ System.out.println( "Discription---" + dataSet.getDescription() );
+ System.out.println( "code---" + dataSet.getCode() );
+ }
+ */
+ return SUCCESS;
+ }
+
+}
+
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java 2012-05-10 05:39:14 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/GetInventoryTypeAttributeListAction.java 2012-05-17 07:33:28 +0000
@@ -6,7 +6,6 @@
import java.util.Collections;
import java.util.List;
-import org.hisp.dhis.coldchain.inventory.InventoryType;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttribute;
import org.hisp.dhis.coldchain.inventory.InventoryTypeAttributeService;
import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowInventoryTypeDataSetFormAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowInventoryTypeDataSetFormAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/ShowInventoryTypeDataSetFormAction.java 2012-05-17 07:33:28 +0000
@@ -0,0 +1,60 @@
+package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.dataset.DataSet;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowInventoryTypeDataSetFormAction implements Action
+{
+
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ private InventoryType inventoryType;
+
+ public InventoryType getInventoryType()
+ {
+ return inventoryType;
+ }
+
+ private List<DataSet> selInventoryTypeDataSets;
+
+ public List<DataSet> getSelInventoryTypeDataSets()
+ {
+ return selInventoryTypeDataSets;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+ inventoryType = inventoryTypeService.getInventoryType( Integer.parseInt( id ) );
+
+ selInventoryTypeDataSets = new ArrayList<DataSet>( inventoryType.getDataSets() );
+
+ return SUCCESS;
+ }
+}
=== modified file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 2012-05-14 09:25:17 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeAction.java 2012-05-17 07:33:28 +0000
@@ -106,7 +106,7 @@
//Set<InventoryTypeAttribute> inventoryTypeSet = new HashSet<InventoryTypeAttribute>();
- List<InventoryTypeAttribute> inventoryTypeSet = new ArrayList<InventoryTypeAttribute>( );
+ List<InventoryTypeAttribute> inventoryTypeList = new ArrayList<InventoryTypeAttribute>( );
if ( selectedInventoryTypeAttributeList != null && selectedInventoryTypeAttributeList.size() > 0 )
{
@@ -119,7 +119,7 @@
System.out.println( "Name---" + inventoryTypeAttribute.getName());
System.out.println( "ValueType---" + inventoryTypeAttribute.getValueType() );
*/
- inventoryTypeSet.add( inventoryTypeAttribute );
+ inventoryTypeList.add( inventoryTypeAttribute );
//inventoryTypeSet.add( inventoryTypeAttributeService.getInventoryTypeAttribute( selectedInventoryTypeAttributeList.get( i ) ) );
}
@@ -130,7 +130,7 @@
}
*/
}
- inventoryType.setInventoryTypeAttributes( inventoryTypeSet );
+ inventoryType.setInventoryTypeAttributes( inventoryTypeList );
inventoryTypeService.updateInventoryType( inventoryType );
return SUCCESS;
=== added file 'local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeDataSetAction.java'
--- local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeDataSetAction.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/java/org/hisp/dhis/coldchain/inventory/action/UpdateInventoryTypeDataSetAction.java 2012-05-17 07:33:28 +0000
@@ -0,0 +1,100 @@
+ package org.hisp.dhis.coldchain.inventory.action;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.hisp.dhis.coldchain.inventory.InventoryType;
+import org.hisp.dhis.coldchain.inventory.InventoryTypeService;
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.dataset.DataSetService;
+
+import com.opensymphony.xwork2.Action;
+
+public class UpdateInventoryTypeDataSetAction implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private InventoryTypeService inventoryTypeService;
+
+ public void setInventoryTypeService( InventoryTypeService inventoryTypeService )
+ {
+ this.inventoryTypeService = inventoryTypeService;
+ }
+
+ private DataSetService dataSetService;
+
+ public void setDataSetService( DataSetService dataSetService )
+ {
+ this.dataSetService = dataSetService;
+ }
+
+
+ // -------------------------------------------------------------------------
+ // 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 List<Integer> selectedInventoryTypeDataSetList = new ArrayList<Integer>();
+
+ public void setSelectedInventoryTypeDataSetList( List<Integer> selectedInventoryTypeDataSetList )
+ {
+ this.selectedInventoryTypeDataSetList = selectedInventoryTypeDataSetList;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+ public String execute() throws Exception
+ {
+
+ InventoryType inventoryType = inventoryTypeService.getInventoryType( id );
+
+ inventoryType.setName( name );
+
+
+ Set<DataSet> inventoryTypeDataSet = new HashSet<DataSet>();
+
+ if ( selectedInventoryTypeDataSetList != null && selectedInventoryTypeDataSetList.size() > 0 )
+ {
+ for ( int i = 0; i < this.selectedInventoryTypeDataSetList.size(); i++ )
+ {
+ DataSet dataSet = dataSetService.getDataSet( selectedInventoryTypeDataSetList.get( i ) );
+
+ /*
+ System.out.println( "ID---" + dataSet.getId() );
+ System.out.println( "Name---" + dataSet.getName());
+ System.out.println( "Display Name---" + dataSet.getDisplayName() );
+ */
+ inventoryTypeDataSet.add( dataSet );
+
+ }
+ }
+
+ inventoryType.setDataSets( inventoryTypeDataSet );
+
+ inventoryTypeService.updateInventoryType( inventoryType );
+
+
+ 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-15 10:33:46 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/META-INF/dhis/beans.xml 2012-05-17 07:33:28 +0000
@@ -359,6 +359,29 @@
<property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
</bean>
+
+
+
+ <bean id="org.hisp.dhis.coldchain.inventory.action.ShowInventoryTypeDataSetFormAction"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowInventoryTypeDataSetFormAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.coldchain.inventory.action.GetDataSetListAction"
+ class="org.hisp.dhis.coldchain.inventory.action.GetDataSetListAction"
+ scope="prototype">
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeDataSetAction"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeDataSetAction"
+ scope="prototype">
+ <property name="inventoryTypeService" ref="org.hisp.dhis.coldchain.inventory.InventoryTypeService" />
+ <property name="dataSetService" ref="org.hisp.dhis.dataset.DataSetService" />
+ </bean>
+
+
<!-- EquipmentDetails -->
<bean id="org.hisp.dhis.coldchain.equipment.action.EquipmentSelectAction"
=== 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-16 07:06:15 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/org/hisp/dhis/coldchain/i18n_module.properties 2012-05-17 07:33:28 +0000
@@ -97,4 +97,7 @@
stored_by = Stored by
confirm_delete_equipment = Are you sure you want to delete equipment?
equipment_details = Equipment details
-display = For display
\ No newline at end of file
+display = For display
+available_datasets = Available datasets
+selected_datasets = Selected datasets
+dataset_inventorytype = Dataset inventorytype
\ 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-10 05:39:14 +0000
+++ local/in/dhis-web-coldchain/src/main/resources/struts.xml 2012-05-17 07:33:28 +0000
@@ -341,6 +341,34 @@
<result name="success" type="redirect">inventoryTypeList.action</result>
<param name="requiredAuthorities">F_INVENTORYTYPE_UPDATE</param>
</action>
+
+
+ <action name="showInventoryTypeDataSetForm"
+ class="org.hisp.dhis.coldchain.inventory.action.ShowInventoryTypeDataSetFormAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-coldchain/inventoryTypeDataSetForm.vm</param>
+ <param name="javascripts">javascript/inventoryType.js,../dhis-web-commons/javascripts/jQuery/ui/jquery.cluetip.min.js</param>
+ <param name="stylesheets">css/basic.css</param>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_DATASET</param>
+ </action>
+
+
+
+ <action name="dataSetList"
+ class="org.hisp.dhis.coldchain.inventory.action.GetDataSetListAction">
+ <result name="success" type="velocity-json">/dhis-web-coldchain/jsonDataSetList.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+
+ <action name="updateInventoryTypeDataSetForm"
+ class="org.hisp.dhis.coldchain.inventory.action.UpdateInventoryTypeDataSetAction">
+ <result name="success" type="redirect">inventoryTypeList.action</result>
+ <param name="requiredAuthorities">F_INVENTORYTYPE_DATASET</param>
+ </action>
+
+
+
<action name="removeInventoryType"
class="org.hisp.dhis.coldchain.inventory.action.RemoveInventoryTypeAction">
<result name="success" type="velocity-json">/dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/Thumbs.db'
Binary files local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/Thumbs.db 2012-04-17 10:41:26 +0000 and local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/Thumbs.db 2012-05-17 07:33:28 +0000 differ
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/dataset.png'
Binary files local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/dataset.png 1970-01-01 00:00:00 +0000 and local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/images/dataset.png 2012-05-17 07:33:28 +0000 differ
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeDataSetForm.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeDataSetForm.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeDataSetForm.vm 2012-05-17 07:33:28 +0000
@@ -0,0 +1,80 @@
+<script type="text/javascript" src="javascript/updateInventoryTypeDataSetForm.js"></script>
+<script type="text/javascript">
+</script>
+<h3>$i18n.getString( "dataset_inventorytype" )</h3>
+<form id="updateInventoryTypeDataSetForm" action="updateInventoryTypeDataSetForm.action" method="post" >
+
+<input type="hidden" id="id" name="id" value="$inventoryType.id"/>
+
+<table id="attrTable">
+ <thead>
+ <tr><th colspan="2">$i18n.getString( "inventorytype_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( $inventoryType.name )" class="{validate:{required:true,rangelength:[2,160]}}"/></td>
+ <td></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( $inventoryType.description )" class="{validate:{required:true,minlength:2}}"/></td>
+ <td></td>
+ </tr>
+ -->
+
+ </tbody>
+ </table>
+
+ <br/>
+
+ <table id="dataElementSelectionArea">
+ <col style="width: 450px"/>
+ <col/>
+ <col style="width: 450px"/>
+ <thead>
+ <tr>
+ <th>$i18n.getString( "available_datasets" )</th>
+ <th>$i18n.getString( "filter" )</th>
+ <th>$i18n.getString( "selected_datasets" )</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>
+ <select id="availableDataSetList" name="availableDataSetList" multiple="multiple" style="height: 200px; width: 100%;" ondblclick="moveSelectedById( 'availableDataSetList', 'selectedInventoryTypeDataSetList' )"></select></td>
+ <td>
+ <input type="button" value=">" title="$i18n.getString( 'move_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'availableDataSetList' );"/><br/>
+ <input type="button" value="<" title="$i18n.getString( 'remove_selected' )" style="width:50px" onclick="dhisAjaxSelect_moveAllSelected( 'selectedInventoryTypeDataSetList' );"/><br/>
+ <input type="button" value=">>" title="$i18n.getString('move_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'availableDataSetList' );"/><br/>
+ <input type="button" value="<<" title="$i18n.getString('remove_all')" style="width:50px" onclick="dhisAjaxSelect_moveAll( 'selectedInventoryTypeDataSetList' );"/>
+ </td>
+ <td>
+ <select id="selectedInventoryTypeDataSetList" name="selectedInventoryTypeDataSetList" multiple="multiple" style="height: 200px; width: 100%" ondblclick="moveSelectedById( 'selectedInventoryTypeDataSetList', 'availableDataSetList' )">
+ #foreach( $dataSet in $selInventoryTypeDataSets )
+ <option value="$dataSet.id">$dataSet.name</option>
+ #end
+ </select>
+ </td>
+
+ </tr>
+
+ <tr>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'save' )" />
+ <input type="button" value="$i18n.getString( 'cancel' )" onclick="window.location.href='inventoryTypeList.action'" />
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+
+
+<span id='message'></span>
+
+</form>
+
+<script type="text/javascript">
+</script>
=== modified file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm 2012-05-09 07:02:15 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/inventoryTypeList.vm 2012-05-17 07:33:28 +0000
@@ -24,11 +24,12 @@
<col>
<col width="20">
<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">
@@ -38,6 +39,10 @@
<td>$encoder.htmlEncode( $inventoryType.name )</td>
<td style="text-align:center">
+ <a href="showInventoryTypeDataSetForm.action?id=$inventoryType.id" title="$i18n.getString( 'dataset' )"><img src="images/dataset.png" alt="$i18n.getString( 'dataset' )"></a>
+ </td>
+
+ <td style="text-align:center">
<a href="showUpdateInventoryTypeForm.action?id=$inventoryType.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
</td>
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeDataSetForm.js'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeDataSetForm.js 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/javascript/updateInventoryTypeDataSetForm.js 2012-05-17 07:33:28 +0000
@@ -0,0 +1,27 @@
+jQuery(document).ready(function() {
+ validation2('updateInventoryTypeDataSetForm', function(form) {
+ form.submit();
+ }, {
+ 'beforeValidateHandler' : function() {
+ $("#selectedInventoryTypeDataSetList").find("option").attr("selected", "selected");
+ },
+ });
+
+ checkValueIsExist( "name", "validateInventoryType.action", {id:getFieldValue('id')});
+
+
+ jQuery("#availableDataSetList").dhisAjaxSelect({
+ source: "dataSetList.action",
+ iterator: "dataSets",
+ connectedTo: 'selectedInventoryTypeDataSetList',
+ handler: function(item) {
+ var option = jQuery("<option />");
+ option.text( item.name );
+ option.attr( "value", item.id );
+
+ return option;
+
+ }
+ });
+
+});
=== added file 'local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonDataSetList.vm'
--- local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonDataSetList.vm 1970-01-01 00:00:00 +0000
+++ local/in/dhis-web-coldchain/src/main/webapp/dhis-web-coldchain/jsonDataSetList.vm 2012-05-17 07:33:28 +0000
@@ -0,0 +1,12 @@
+#set( $size = $dataSets.size() )
+{ "dataSets": [
+#foreach( $dataSet in $dataSets )
+{
+ "id": ${dataSet.id},
+ "name": "$!encoder.jsonEncode( ${dataSet.name} )",
+ "description": "$!encoder.jsonEncode( ${dataSet.description} )",
+ "code": "$!encoder.jsonEncode( ${dataSet.code} )"
+}#if( $velocityCount < $size ),#end
+#end
+]
+}
\ No newline at end of file