dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #08599
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2092: Work in Progress for Bangladesh Manpower Module
------------------------------------------------------------
revno: 2092
committer: Neeraj <neeraj.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2010-11-17 19:26:10 +0530
message:
Work in Progress for Bangladesh Manpower Module
added:
local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ShowUpdateEmployeePostFormAction.java
local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm
modified:
local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/employee/ShowUpdateEmployeeFormAction.java
local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ValidateEmployeeExistAction.java
local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml
local/bd/dhis-web-linelisting-manpower/src/main/resources/struts.xml
local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm
local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm
local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/javascript/form.js
local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/DataBaseManagerInterface.java
local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java
--
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/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/employee/ShowUpdateEmployeeFormAction.java'
--- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/employee/ShowUpdateEmployeeFormAction.java 2010-10-28 11:40:15 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/employee/ShowUpdateEmployeeFormAction.java 2010-11-17 13:56:10 +0000
@@ -5,62 +5,61 @@
import com.opensymphony.xwork2.Action;
-
-
-public class ShowUpdateEmployeeFormAction
- implements Action
-{
-
+public class ShowUpdateEmployeeFormAction
+ implements Action
+{
+
// -------------------------------------------------------------------------
// Dependencies
// -------------------------------------------------------------------------
- private EmployeeService employeeService;
-
- public void setEmployeeService(EmployeeService employeeService)
- {
- this.employeeService = employeeService;
- }
+ private EmployeeService employeeService;
+
+ public void setEmployeeService( EmployeeService employeeService )
+ {
+ this.employeeService = employeeService;
+ }
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
- private String id;
-
- public void setId(String id)
- {
- this.id = id;
- }
-
- public String getId()
- {
- return id;
- }
-
- private Employee employee;
-
- public Employee getEmployee()
- {
- return employee;
- }
-
- private Integer lprPeriod;
-
- public Integer getLprPeriod()
- {
- return lprPeriod;
- }
- // -------------------------------------------------------------------------
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ public String getId()
+ {
+ return id;
+ }
+
+ private Employee employee;
+
+ public Employee getEmployee()
+ {
+ return employee;
+ }
+
+ private Integer lprPeriod;
+
+ public Integer getLprPeriod()
+ {
+ return lprPeriod;
+ }
+
+ // -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
- public String execute()
- {
- employee = employeeService.getEmployeeByPDSCode( id );
-
- lprPeriod = Employee.LPR_PERIOD;
-
- return SUCCESS;
- }
+ public String execute()
+ {
+ employee = employeeService.getEmployeeByPDSCode( id );
+
+ lprPeriod = Employee.LPR_PERIOD;
+
+ return SUCCESS;
+ }
}
=== added file 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ShowUpdateEmployeePostFormAction.java'
--- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ShowUpdateEmployeePostFormAction.java 1970-01-01 00:00:00 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ShowUpdateEmployeePostFormAction.java 2010-11-17 13:56:10 +0000
@@ -0,0 +1,95 @@
+package org.hisp.dhis.ll.action.lldataentry;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.hisp.dhis.dbmanager.DataBaseManagerInterface;
+import org.hisp.dhis.linelisting.LineListDataValue;
+import org.hisp.dhis.linelisting.LineListElement;
+import org.hisp.dhis.linelisting.LineListGroup;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+
+import com.opensymphony.xwork2.Action;
+
+public class ShowUpdateEmployeePostFormAction
+implements Action
+{
+ //--------------------------------------------------------------------------
+ // Dependencies
+ //--------------------------------------------------------------------------
+
+ private SelectedStateManager selectedStateManager;
+
+ public void setSelectedStateManager( SelectedStateManager selectedStateManager )
+ {
+ this.selectedStateManager = selectedStateManager;
+ }
+
+ private DataBaseManagerInterface dataBaseManagerInterface;
+
+ public void setDataBaseManagerInterface( DataBaseManagerInterface dataBaseManagerInterface )
+ {
+ this.dataBaseManagerInterface = dataBaseManagerInterface;
+ }
+
+ //--------------------------------------------------------------------------
+ // Input/Output
+ //--------------------------------------------------------------------------
+
+ private String id;
+
+ public void setId( String id )
+ {
+ this.id = id;
+ }
+
+ private Map<String, String> llDataValuesMap;
+
+ public Map<String, String> getLlDataValuesMap()
+ {
+ return llDataValuesMap;
+ }
+
+ private List<LineListElement> lineListElements;
+
+ public List<LineListElement> getLineListElements()
+ {
+ return lineListElements;
+ }
+
+ //--------------------------------------------------------------------------
+ // Action Implementation
+ //--------------------------------------------------------------------------
+
+ public String execute()
+ {
+ System.out.println("Inside UPDATE EMPLOYEE POST FORM:::::::");
+ OrganisationUnit orgUnit = selectedStateManager.getSelectedOrganisationUnit();
+ LineListGroup llGroup = selectedStateManager.getSelectedLineListGroup();
+ lineListElements = new ArrayList<LineListElement>( llGroup.getLineListElements() );
+ List<LineListDataValue> llDataValuesList = new ArrayList<LineListDataValue>();
+
+ Map<String, String> llDataValueMap = new HashMap<String, String>();
+
+ // HardCoding Columan name
+ String pdsCodeColName = "pdscode";
+ String lastWorkingDateColumnName = "lastworkingdate";
+
+ llDataValueMap.put( pdsCodeColName, id );
+ llDataValueMap.put( lastWorkingDateColumnName, "null" );
+
+ llDataValuesList = dataBaseManagerInterface.getLLValuesFilterByLLElements( llGroup.getShortName(), llDataValueMap, orgUnit );
+
+ if ( llDataValuesList != null)
+ {
+ LineListDataValue llDataValue;
+ llDataValue = llDataValuesList.get( 0 );
+ llDataValuesMap = llDataValue.getLineListValues();
+ }
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ValidateEmployeeExistAction.java'
--- local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ValidateEmployeeExistAction.java 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/java/org/hisp/dhis/ll/action/lldataentry/ValidateEmployeeExistAction.java 2010-11-17 13:56:10 +0000
@@ -77,7 +77,6 @@
OrganisationUnit organisationUnit = selectedStateManager.getSelectedOrganisationUnit();
LineListGroup lineListGroup = selectedStateManager.getSelectedLineListGroup();
- LineListOption lineListOption = selectedStateManager.getSelectedLineListOption();
String departmentLineListName = lineListGroup.getName();
String pdsCodeColumnName = "pdscode";
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml'
--- local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/resources/META-INF/dhis/beans.xml 2010-11-17 13:56:10 +0000
@@ -560,6 +560,19 @@
</property>
</bean>
+
+ <bean id="org.hisp.dhis.ll.action.lldataentry.ShowUpdateEmployeePostFormAction"
+ class="org.hisp.dhis.ll.action.lldataentry.ShowUpdateEmployeePostFormAction" scope="prototype">
+ <property name="selectedStateManager">
+ <ref bean="org.hisp.dhis.ll.action.lldataentry.SelectedStateManager"/>
+ </property>
+ <property name="dataBaseManagerInterface">
+ <ref bean="org.hisp.dhis.dbmanager.DataBaseManagerInterface"/>
+ </property>
+ </bean>
+
+
+
<!-- 15/10/2010 Start -->
<bean id="org.hisp.dhis.ll.action.llValidation.GetLineListElementsAction"
class="org.hisp.dhis.ll.action.llValidation.GetLineListElementsAction" scope="prototype">
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/resources/struts.xml'
--- local/bd/dhis-web-linelisting-manpower/src/main/resources/struts.xml 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/resources/struts.xml 2010-11-17 13:56:10 +0000
@@ -436,6 +436,14 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
+ <action name="showEditEmployeePostForm"
+ class="org.hisp.dhis.ll.action.lldataentry.ShowUpdateEmployeePostFormAction">
+ <result name="success" type="velocity">/dhis-web-linelisting-mp/updateEmployeePostForm.vm</result>
+ </action>
+
+
+
+
<!-- Org unit -->
<action name="getOrgUnitDetails"
class="org.hisp.dhis.ll.action.lldataentry.GetOrgUnitsAction">
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/employeePost.vm 2010-11-17 13:56:10 +0000
@@ -19,10 +19,10 @@
<td>
<input type="hidden" name="groupid" id="groupid" value="$linelistGroupId">
<input type="hidden" name="reportingDate" id="reportingDate" value="$reportingDate">
- <input type="text" name="dataValue" id="dataValue" value="$dataValue">
+ <input type="hidden" name="dataValue" id="dataValue" value="$dataValue">
</td>
<td>
- <input type="text" name="dataValueMapKey" id="dataValueMapKey" value="$dataValueMapKey">
+ <input type="hidden" name="dataValueMapKey" id="dataValueMapKey" value="$dataValueMapKey">
</td>
</tr>
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/form.vm 2010-11-17 13:56:10 +0000
@@ -59,7 +59,7 @@
#foreach( $employee in $employeeList )
<tr id="tr${employee.pdsCode}">
<td#alternate( $mark )>$encoder.htmlEncode( $employee.name ) - $encoder.htmlEncode( $employee.pdsCode )</td>
- <td style="text-align:center"#alternate( $mark )><a href="showUpdateEmployeePostForm.action?id=$employee.pdsCode" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a></td>
+ <td style="text-align:center"#alternate( $mark )><a href="javascript:showUpdateEmployeePostForm( '$employee.pdsCode' )" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( "edit" )"></a></td>
<td style="text-align:center"#alternate( $mark )><a href="javascript:showEmployeePostDetails( '$employee.pdsCode' )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( "show_details" )"></a></td>
#end
@@ -163,6 +163,23 @@
}
return true;
}
-}
+
+ function showUpdateEmployeePostForm( pdsCode )
+ {
+ var url = 'showEmployeePostForm.action?id=' + pdsCode;
+ //var url = 'showEmployeePostForm.action';
+ $('#contentDataRecord1').dialog('destroy').remove();
+ $('<div id="contentDataRecord1" style="z-index: 1;">' ).load(url).dialog({
+ title: 'Edit Employee Post Detail',
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 420,
+ height: 380
+ });
+ }
+
+
</script>
\ No newline at end of file
=== modified file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/javascript/form.js'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/javascript/form.js 2010-11-17 10:49:09 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/javascript/form.js 2010-11-17 13:56:10 +0000
@@ -175,4 +175,5 @@
width: 420,
height: 380
});
+
}
\ No newline at end of file
=== added file 'local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm'
--- local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm 1970-01-01 00:00:00 +0000
+++ local/bd/dhis-web-linelisting-manpower/src/main/webapp/dhis-web-linelisting-mp/updateEmployeePostForm.vm 2010-11-17 13:56:10 +0000
@@ -0,0 +1,53 @@
+
+<script type="text/javascript" src="../"></script>
+
+<form id="employeePostForm" action="saveEmployeePost.action" method="post" >
+ <table align="centre">
+ <tr>
+ <td><label for="department"><Strong>Department</Strong> </label></td>
+ <td>
+ <input id="department" name="department" type="text" readonly="readonly" value="$linelistGroupName" style="min-width:200px">
+ </td>
+ </tr>
+
+ <tr>
+ <td><label for="post"><Strong>Post</Strong> </label></td>
+ <td>
+ <input id="post" name="post" type="text" readonly="readonly" value="$linelistOptionName" style="min-width:200px">
+ </td>
+ </tr>
+ #set( $count = 0 )
+ #foreach( $lineListElement in $lineListElements )
+ <tr>
+ <td><label>$lineListElement.name</label></td>
+ #if($lineListElement.PresentationType == 'text')
+ <td>
+ <input type="text" name="$lineListElement.shortName" id = "$lineListElement.shortName" style="width:10em" #if($count==0) readonly="readonly" #end onkeypress="return keyPress(event, this)" value=$llDataValuesMap.get($lineListElement.shortName)>
+ </td>
+ #elseif($lineListElement.PresentationType == 'combobox')
+ <td>
+ <select name="$element" id="$element" onkeypress="return keyPress(event, this)">
+ <option name="SelectOption" value="" selected>--Select--</option>
+ ##set($lineListOptions = $llElementOptionsMap.get($lineListElement.shortName))
+ #set($lineListOptions = $lineListElement.lineListElementOptions)
+ #foreach( $lineListOption in $lineListOptions )
+ <option name="$lineListOption.name" value="$lineListOption.name" #if($lineListOption.name == $llElementValuesMap.get($element)) selected #end>$lineListOption.name</option>
+ #end
+ </select>
+ </td>
+ #elseif($lineListElement.PresentationType == 'calender')
+ #set($fordate = $lineListElement.shortName)
+
+ <td>
+ <input type="text" id="$fordate" name="$fordate" style="width:10em" onkeypress="return keyPress(event, this)">
+ <script>datePickerValid( '$fordate', false );</script>
+ </td>
+ #end
+ </tr>
+ #set ($count=$count+1)
+ #end
+
+
+
+ </table>
+</form>
\ No newline at end of file
=== modified file 'local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/DataBaseManagerInterface.java'
--- local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/DataBaseManagerInterface.java 2010-11-17 10:49:09 +0000
+++ local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/DataBaseManagerInterface.java 2010-11-17 13:56:10 +0000
@@ -38,6 +38,8 @@
public int getLLValueCountByLLElements( String tablename, Map<String,String> llElementValueMap, Source source );
public List<LineListDataValue> getLLValuesFilterByLLElements( String tableName, Map<String,String> llElementValueMap, Source source, Period period );
+
+ public List<LineListDataValue> getLLValuesFilterByLLElements( String tableName, Map<String,String> llElementValueMap, Source source );
public List<LineListDataValue> getLLValuesByLLElementValue( String tableName, String llElementName, String llElementValue, Source source, Period period );
=== modified file 'local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java'
--- local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java 2010-11-17 10:49:09 +0000
+++ local/in/dhis-in-services/dhis-in-service-dbmanager/src/main/java/org/hisp/dhis/dbmanager/mysql/MySQLDataBaseManager.java 2010-11-17 13:56:10 +0000
@@ -669,6 +669,130 @@
return llDataValues;
}
+
+ public List<LineListDataValue> getLLValuesFilterByLLElements( String tableName, Map<String, String> llElementValueMap, Source source )
+ {
+ String columnDefinition = "";
+
+ //Statement statement = null;
+
+ // creating map of element and its values
+ //Map<String, String> llElementValuesMap = new HashMap<String, String>();
+
+ List<LineListDataValue> llDataValues = new ArrayList<LineListDataValue>();
+ // LineListDataValue llDataValue = new LineListDataValue();
+ if ( source != null )
+ {
+ columnDefinition += "select * from " + tableName + " where sourceid = " + source.getId();
+
+ List<String> llElementNames = new ArrayList<String>( llElementValueMap.keySet() );
+ Iterator<String> llENamesIterator = llElementNames.iterator();
+ while ( llENamesIterator.hasNext() )
+ {
+ String lleName = llENamesIterator.next();
+
+ String lleValue = llElementValueMap.get( lleName );
+
+ if ( lleValue.equalsIgnoreCase( "notnull" ) )
+ {
+ columnDefinition += " and " + lleName + " IS NOT NULL";
+ } else
+ {
+ if ( lleValue.equalsIgnoreCase( "null" ) )
+ {
+ columnDefinition += " and " + lleName + " IS NULL";
+ } else
+ {
+ columnDefinition += " and " + lleName + " LIKE '" + lleValue + "'";
+ }
+ }
+ }
+
+
+ columnDefinition += " order by recordnumber";
+
+ System.out.println( columnDefinition );
+
+ Collection<LineListElement> elementsCollection = new ArrayList<LineListElement>();
+
+ elementsCollection = lineListService.getLineListGroupByShortName( tableName ).getLineListElements();
+
+ LineListElement element;
+ String name = "";
+
+ try
+ {
+ //Connection connection = jdbcTemplate.getDataSource().getConnection();
+ //statement = connection.createStatement( ResultSet.TYPE_SCROLL_SENSITIVE, ResultSet.CONCUR_UPDATABLE );
+ //ResultSet result = statement.executeQuery( columnDefinition );
+ SqlRowSet result = jdbcTemplate.queryForRowSet( columnDefinition );
+ //System.out.println(columnDefinition);
+
+ if ( result != null )
+ {
+ result.beforeFirst();
+
+ while ( result.next() )
+ {
+ LineListDataValue llDataValue = new LineListDataValue();
+ Map<String, String> llElementValuesMap = new HashMap<String, String>();
+ llDataValue.setRecordNumber( result.getInt( "recordnumber" ) );
+ Iterator it1 = elementsCollection.iterator();
+ while ( it1.hasNext() )
+ {
+ element = (LineListElement) it1.next();
+ //name = element.getShortName() + ":" + result.getInt( "recordnumber" );
+ name = element.getShortName();
+ if ( element.getDataType().equalsIgnoreCase( "string" ) )
+ {
+ String tempString = result.getString( element.getShortName() );
+ if ( tempString == null )
+ {
+ tempString = "";
+ }
+ llElementValuesMap.put( name, tempString );
+ } else
+ {
+ if ( element.getDataType().equalsIgnoreCase( "date" ) )
+ {
+ Date tempDate = result.getDate( element.getShortName() );
+ String tempStr = "";
+ if ( tempDate != null )
+ {
+ tempStr = tempDate.toString();
+ }
+ llElementValuesMap.put( name, tempStr );
+ } else
+ {
+ if ( element.getDataType().equalsIgnoreCase( "int" ) )
+ {
+ String tempStr = "";
+ Integer tempInt = result.getInt( element.getShortName() );
+ if ( tempInt != null )
+ {
+ tempStr = Integer.toString( tempInt );
+ }
+ llElementValuesMap.put( name, tempStr );
+ }
+ }
+ }
+ }
+
+ llDataValue.setLineListValues( llElementValuesMap );
+ llDataValue.setSource( source );
+ llDataValues.add( llDataValue );
+ }
+
+ }
+
+ } catch ( Exception e )
+ {
+ e.printStackTrace();
+ }
+ }
+ return llDataValues;
+
+ }
public int getLLValueCountByLLElements( String tableName, Map<String, String> llElementValueMap, Source source )
{