dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34064
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17478: partner List added
------------------------------------------------------------
revno: 17478
committer: itsganesh1238@xxxxxxxxx
branch nick: dhis2
timestamp: Sat 2014-11-15 16:54:03 +0530
message:
partner List added
modified:
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java
local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java
local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml
local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm
local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java 2014-11-15 09:02:15 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerService.java 2014-11-15 11:24:03 +0000
@@ -27,7 +27,7 @@
Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataSet dataSet );
- Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataElement dataElement );
+ Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId );
Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java 2014-11-15 10:43:45 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/api/PartnerStore.java 2014-11-15 11:24:03 +0000
@@ -28,7 +28,7 @@
Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataSet dataSet );
- Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataElement dataElement );
+ Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId );
Map<String, Integer> getOrgUnitCountFromPartner( Integer dataSetId, Integer dataElementId, Integer optionId, String startDate, String endDate );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java'
--- local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java 2014-11-15 10:43:45 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/java/org/hisp/dhis/rbf/impl/HibernatePartnerStore.java 2014-11-15 11:24:03 +0000
@@ -1,10 +1,7 @@
package org.hisp.dhis.rbf.impl;
import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
import org.hibernate.Criteria;
import org.hibernate.Session;
@@ -16,6 +13,7 @@
import org.hisp.dhis.organisationunit.OrganisationUnit;
import org.hisp.dhis.rbf.api.Partner;
import org.hisp.dhis.rbf.api.PartnerStore;
+import org.jfree.data.general.Dataset;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;
import org.springframework.transaction.annotation.Transactional;
@@ -114,16 +112,36 @@
@SuppressWarnings( "unchecked" )
@Override
- public Collection<Partner> getPartner( OrganisationUnit organisationUnit, DataElement dataElement )
+ public Collection<String> getStartAndEndDate( Integer dataSetId, Integer dataElementId, Integer optionId )
{
- Session session = sessionFactory.getCurrentSession();
-
- Criteria criteria = session.createCriteria( Partner.class );
- criteria.add( Restrictions.eq( "organisationUnit", organisationUnit ) );
- criteria.add( Restrictions.eq( "dataElement", dataElement ) );
- criteria.addOrder(Order.asc("dataSet"));
-
- return criteria.list();
+ List<String> dateList = new ArrayList<String>();
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
+
+ try
+ {
+ String query = "SELECT startdate, enddate FROM (" +
+ " SELECT Distinct (startdate , enddate),startdate , enddate FROM partner WHERE" +
+ " datasetid = " + dataSetId + " AND " +
+ " dataelementid = " + dataElementId + " AND " +
+ " optionid = " + optionId +") asd" ;
+
+ SqlRowSet rs = jdbcTemplate.queryForRowSet( query );
+ while ( rs.next() )
+ {
+ String startDate = simpleDateFormat.format( rs.getDate( 1 ) );
+ String endDate = simpleDateFormat.format(rs.getDate(2));
+
+ String date = startDate+":"+endDate;
+
+ dateList.add(date);
+ }
+ }
+ catch (Exception ex){
+ System.out.println(" In Partner Data Exception :"+ ex.getMessage() );
+ ex.printStackTrace();
+ }
+ return dateList;
+
}
@@ -166,6 +184,7 @@
catch( Exception e )
{
System.out.println(" In Partner Data Exception :"+ e.getMessage() );
+ e.printStackTrace();
}
return partnerOrgUnitCountMap;
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-11-14 10:26:48 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/META-INF/dhis/beans.xml 2014-11-15 11:24:03 +0000
@@ -807,6 +807,10 @@
scope="prototype">
</bean>
+ <bean id="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
+ class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction"
+ scope="prototype">
+ </bean>
<bean id="org.hisp.dhis.rbf.partner.action.PartnerFormAction"
class="org.hisp.dhis.rbf.partner.action.PartnerFormAction"
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml'
--- local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-11-14 10:26:48 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/resources/struts.xml 2014-11-15 11:24:03 +0000
@@ -653,6 +653,11 @@
<result name="success" type="velocity">/content.vm</result>
<param name="page">/dhis-web-maintenance-rbf/partnerForm.vm</param>
</action>
+
+ <action name="partnerDataList" class="org.hisp.dhis.rbf.partner.action.PartnerDataListAction">
+ <result name="success" type="velocity">/content.vm</result>
+ <param name="page">/dhis-web-maintenance-rbf/partnerDataList.vm</param>
+ </action>
<action name="partnerFundManagementForm" class="org.hisp.dhis.rbf.partner.action.PartnerFundManagement">
<result name="success" type="velocity">/main.vm</result>
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm 2014-10-24 11:05:35 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/loadTariffData.vm 2014-11-15 11:24:03 +0000
@@ -5,9 +5,6 @@
jQuery('#addTariff').dialog({autoOpen: false});
}
-
-
-
Ext.Loader.setConfig({
enabled: true
});
@@ -273,9 +270,6 @@
$( "#addTariff" ).dialog( "close" );
}
-
-
-
function dialogWindowClose()
{
//$( "#addTariff" ).dialog( "close" );
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm 2014-11-15 09:02:15 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerForm.vm 2014-11-15 11:24:03 +0000
@@ -3,19 +3,7 @@
function formValidations()
{
- //alert("validation");
-
/*
- var startPeriodList = document.getElementById("dataSetId");
- var startPeriodIndex = startPeriodList.selectedIndex;
-
- if( startPeriodList.options[startPeriodIndex].value == null || startPeriodList.options[startPeriodIndex].value== "-1" )
- {
- showWarningMessage( "Please Select Period" );
- //alert("Please Select Period");
- return false;
- }
-
var dataSetId = $( '#dataSetId' ).val();
var optionSetId = $( '#optionSetId' ).val();
@@ -41,39 +29,32 @@
return false;
}
*/
-
- /*
- else if( $("#startDate").val() == "" )
+ if( $("#startDate").val() == null || $("#startDate").val().equals("") )
{
showWarningMessage( "Please Select Start Date" );
return false;
}
- else if( $("#endDate").val() == "" )
+ else if( $("#endDate").val() == null || $("#endDate").val().equals("") )
{
showWarningMessage( "Please Select End Date" );
return false;
}
- */
- /* else if( periodId == "-1" )
- {
- showWarningMessage( "Please Select Period" );
- return false;
- }
- */
return true;
}
+ function dialogWindowClose()
+ {
+ jQuery('#addNewPeriod').dialog('destroy').remove();
+ }
</script>
-
<h3>$i18n.getString( "partner_management" )</h3>
<form id="partnerForm" name="partnerForm" action="partnerFormResult.action" method="post" onsubmit="return formValidations()" >
-
<table>
<tr>
<td><label for="dataSetId">$i18n.getString( "dataSet" )</label></td>
@@ -146,7 +127,8 @@
</tr>
<tr>
<td>
- <input type="submit" id="saveButton" value="$i18n.getString( 'save' )" style="width:10em"/>
+ <input type="submit" id="saveButton" value="$i18n.getString( 'save' )" onclick="formValidations();" style="width:10em"/>
+ <input type="button" id="cancelButton" value="$i18n.getString( 'cancel' )" onclick="dialogWindowClose();" style="width:10em"/>
</td>
</tr>
</table>
=== modified file 'local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm'
--- local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm 2014-11-15 09:02:15 +0000
+++ local/in/dhis-web-maintenance-rbf/src/main/webapp/dhis-web-maintenance-rbf/partnerFundManagement.vm 2014-11-15 11:24:03 +0000
@@ -2,17 +2,17 @@
window.onload=function(){
- jQuery('#addPeriod').dialog({autoOpen: false});
+ jQuery('#addNewPeriod').dialog({autoOpen: false});
}
function showAddParentForm()
{
- jQuery('#addPeriod').dialog('destroy').remove();
+ // jQuery('#addNewPeriod').dialog('destroy').remove();
var dataSetId = $( "#dataSetId" ).val();
var optionSetId = $( "#optionSetId" ).val();
var dataElementId = $( "#dataElementId" ).val();
-
+
if ( dataSetId == "-1" )
{
showWarningMessage( "Please Select DataSet" );
@@ -46,11 +46,21 @@
}
+ function showParentList(){
+ jQuery('#showList' ).load( 'partnerDataList.action?dataSetId='+ dataSetId + "&optionSetId=" + optionSetId + "&dataElementId=" + dataElementId).dialog({
+ title: 'Add New Period',
+ maximize: true,
+ closable: true,
+ modal:true,
+ overlay:{background:'#000000', opacity:0.1},
+ width: 600,
+ height: 500
+ });
+ }
+
</script>
-
-
<h3>$i18n.getString( "partner_management" )</h3>
<form id="partnerFundForm" name="partnerFundForm" action="partnerFormResult.action" method="post" onsubmit="return formValidations()" >
@@ -93,7 +103,11 @@
</div>
<br/><br/>
- <div style="width:100%;" id="periodTable">
+
+
+ <div id="showList"></div>
+
+ <!-- <div style="width:100%;" id="periodTable">
<table id="periodDetails" name="periodDetails" class="mainPageTable">
<thead >
@@ -117,7 +131,6 @@
<div style="width:100%">
<input type="submit" value="Save" style="float:right;" id="save" />
<input type="button" value="Cancel" style="float:right;" id="cancel" />
- </div>
-
- <br/><br/>
+ </div> -->
+
</form>
\ No newline at end of file