← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-india/dhis2/dhis2-in] Rev 850: bug fixed while adding linelisting group

 

Are we going to continue with the previous approach to linelisting??

Don't we want to use the patient module for linelisting as well, with deaths
being just attribute to a person and cause of death and associated program
for enrollment?? Just thinking out loud??

---
Regards,
Saptarshi PURKAYASTHA
Director R & D, HISP India
Health Information Systems Programme

My Tech Blog:  http://sunnytalkstech.blogspot.com
You Live by CHOICE, Not by CHANCE


On 11 March 2010 10:17, <noreply@xxxxxxxxxxxxx> wrote:

> ------------------------------------------------------------
> revno: 850
> committer: HISP <HISP@HISP-PC>
> branch nick: dhis2-in
> timestamp: Thu 2010-03-11 14:45:13 +0530
> message:
>  bug fixed while adding linelisting group
> added:
>
>  local/in/dhis-web-linelisting-in/src/main/java/org/hisp/dhis/ll/action/llgroup/ValidateLineListGroupAddAction.java
> modified:
>  dhis-2/dhis-web/dhis-web-portal/pom.xml
>
>  local/in/dhis-web-linelisting-in/src/main/resources/META-INF/dhis/beans.xml
>  local/in/dhis-web-linelisting-in/src/main/resources/struts.xml
>
>  local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/css/dhis-web-dataentry-national.css
>
>  local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/lineListGroup.js
>
>  local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/linelistagg.js
>
>  local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/select.vm
>
>
> --
> lp:~dhis2-devs-india/dhis2/dhis2-in
> https://code.launchpad.net/~dhis2-devs-india/dhis2/dhis2-in
>
> You are subscribed to branch lp:~dhis2-devs-india/dhis2/dhis2-in.
> To unsubscribe from this branch go to
> https://code.launchpad.net/~dhis2-devs-india/dhis2/dhis2-in/+edit-subscription
> .
>
> === modified file 'dhis-2/dhis-web/dhis-web-portal/pom.xml'
> --- dhis-2/dhis-web/dhis-web-portal/pom.xml     2010-02-09 11:36:50 +0000
> +++ dhis-2/dhis-web/dhis-web-portal/pom.xml     2010-03-11 09:15:13 +0000
> @@ -167,14 +167,14 @@
>       <type>war</type>
>     </dependency>
>        -->
> -<!--
> +
>     <dependency>
>       <groupId>org.hisp.dhis</groupId>
>       <artifactId>dhis-web-linelisting-in</artifactId>
>       <version>${version}</version>
>       <type>war</type>
>     </dependency>
> -       -->
> +
>  <!--
>     <dependency>
>       <groupId>org.hisp.dhis</groupId>
>
> === added file
> 'local/in/dhis-web-linelisting-in/src/main/java/org/hisp/dhis/ll/action/llgroup/ValidateLineListGroupAddAction.java'
> ---
> local/in/dhis-web-linelisting-in/src/main/java/org/hisp/dhis/ll/action/llgroup/ValidateLineListGroupAddAction.java
>  1970-01-01 00:00:00 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/java/org/hisp/dhis/ll/action/llgroup/ValidateLineListGroupAddAction.java
>  2010-03-11 09:15:13 +0000
> @@ -0,0 +1,225 @@
> +package org.hisp.dhis.ll.action.llgroup;
> +
> +/*
> + * Copyright (c) 2004-2007, University of Oslo
> + * All rights reserved.
> + *
> + * Redistribution and use in source and binary forms, with or without
> + * modification, are permitted provided that the following conditions are
> met:
> + * * Redistributions of source code must retain the above copyright
> notice, this
> + *   list of conditions and the following disclaimer.
> + * * Redistributions in binary form must reproduce the above copyright
> notice,
> + *   this list of conditions and the following disclaimer in the
> documentation
> + *   and/or other materials provided with the distribution.
> + * * Neither the name of the HISP project nor the names of its
> contributors may
> + *   be used to endorse or promote products derived from this software
> without
> + *   specific prior written permission.
> + *
> + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
> IS" AND
> + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
> IMPLIED
> + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
> LIABLE FOR
> + * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
> DAMAGES
> + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> SERVICES;
> + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
> AND ON
> + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
> + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> OF THIS
> + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
> + */
> +
> +import org.hisp.dhis.i18n.I18n;
> +import org.hisp.dhis.linelisting.LineListGroup;
> +import org.hisp.dhis.linelisting.LineListService;
> +
> +import com.opensymphony.xwork2.Action;
> +import java.util.ArrayList;
> +import java.util.Collection;
> +import java.util.List;
> +import org.hisp.dhis.dbmanager.DataBaseManagerInterface;
> +import org.hisp.dhis.linelisting.LineListElement;
> +
> +public class ValidateLineListGroupAddAction
> +    implements Action
> +{
> +    //
> -------------------------------------------------------------------------
> +    // Dependencies
> +    //
> -------------------------------------------------------------------------
> +
> +    private LineListService lineListService;
> +
> +    public void setLineListService( LineListService lineListService )
> +    {
> +        this.lineListService = lineListService;
> +    }
> +
> +    private I18n i18n;
> +
> +    public void setI18n( I18n i18n )
> +    {
> +        this.i18n = i18n;
> +    }
> +
> +    private DataBaseManagerInterface dataBaseManagerInterface;
> +
> +    public void setDataBaseManagerInterface( DataBaseManagerInterface
> dataBaseManagerInterface )
> +    {
> +        this.dataBaseManagerInterface = dataBaseManagerInterface;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Input
> +    //
> -------------------------------------------------------------------------
> +    private Integer id;
> +
> +    public void setId( Integer id )
> +    {
> +        this.id = id;
> +    }
> +
> +    private String name;
> +
> +    public void setName( String name )
> +    {
> +        this.name = name;
> +    }
> +
> +    private String shortName;
> +
> +    public void setShortName( String shortName )
> +    {
> +        this.shortName = shortName;
> +    }
> +
> +    private String selectedList;
> +
> +    public void setSelectedList( String selectedList )
> +    {
> +        this.selectedList = selectedList;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Output
> +    //
> -------------------------------------------------------------------------
> +    private String message;
> +
> +    public String getMessage()
> +    {
> +        return message;
> +    }
> +
> +    //
> -------------------------------------------------------------------------
> +    // Action implementation
> +    //
> -------------------------------------------------------------------------
> +    public String execute()
> +    {
> +        //
> ---------------------------------------------------------------------
> +        // Validating LineList fields
> +        //
> ----------------------------------------------------------------------
> +        if ( name == null )
> +        {
> +            message = i18n.getString( "specify_name" );
> +
> +            return INPUT;
> +        } else
> +        {
> +            name = name.trim();
> +
> +            if ( name.length() == 0 )
> +            {
> +                message = i18n.getString( "specify_name" );
> +
> +                return INPUT;
> +            }
> +            /*
> +             * if(lineListService == null) {
> +             * System.out.println("Linelist Service is null");
> lineListService =
> +             * new DefaultLineListService(); }
> +             */
> +            LineListGroup match = lineListService.getLineListGroupByName(
> name );
> +
> +            if ( match != null && ( id == null || match.getId() != id ) )
> +            {
> +                message = i18n.getString( "name_in_use" );
> +
> +                return INPUT;
> +            }
> +        }
> +
> +        if ( shortName == null )
> +        {
> +            message = i18n.getString( "specify_short_name" );
> +
> +            return INPUT;
> +        } else
> +        {
> +            shortName = shortName.trim();
> +
> +            if ( shortName.length() == 0 )
> +            {
> +                message = i18n.getString( "specify_short_name" );
> +
> +                return INPUT;
> +            }
> +
> +            if ( shortName.length() > 25 )
> +            {
> +                message = "Short name too long, please give 25 characters
> ";
> +
> +                return INPUT;
> +            }
> +
> +            LineListGroup match =
> lineListService.getLineListGroupByShortName( shortName );
> +
> +            if ( match != null && ( id == null || match.getId() != id ) )
> +            {
> +                message = i18n.getString( "short_name_in_use" );
> +
> +                return INPUT;
> +            }
> +        }
> +
> +               /*
> +        LineListGroup lineListGroup = lineListService.getLineListGroup( id
> );
> +        List<LineListElement> oldElements = new
> ArrayList<LineListElement>( lineListGroup.getLineListElements() );
> +        Collection<LineListElement> updatedDataElementList = new
> ArrayList<LineListElement>();
> +
> +        if ( selectedList == null )
> +        {
> +            System.out.println( "selectedList is null" + selectedList );
> +        } else
> +        {
> +            String[] selectedElementIDs = selectedList.split( "," );
> +            for ( String str : selectedElementIDs )
> +            {
> +                if ( str != null && !str.equals( "" ) )
> +                {
> +                    LineListElement element =
> lineListService.getLineListElement( Integer.parseInt( str ) );
> +                    updatedDataElementList.add( element );
> +                }
> +            }
> +
> +            for ( int i = 0; i < oldElements.size(); i++ )
> +            {
> +                if ( !( updatedDataElementList.contains( oldElements.get(
> i ) ) ) )
> +                {
> +                    boolean doNotDelete =
> dataBaseManagerInterface.checkDataFromTable( lineListGroup.getShortName(),
> oldElements.get( i ) );
> +                    if ( doNotDelete )
> +                    {
> +                        message = "\"" + oldElements.get( i ).getName() +
> "\"cannot delete, its having data";
> +                        return INPUT;
> +                    }
> +                }
> +            }
> +        }
> +       */
> +        //
> ---------------------------------------------------------------------
> +        // Validation success
> +        //
> ---------------------------------------------------------------------
> +
> +        message = i18n.getString( "everything_is_ok" );
> +
> +        // System.out.println(message);
> +
> +        return SUCCESS;
> +    }
> +}
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/resources/META-INF/dhis/beans.xml'
> ---
> local/in/dhis-web-linelisting-in/src/main/resources/META-INF/dhis/beans.xml
> 2010-03-09 13:57:08 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/resources/META-INF/dhis/beans.xml
> 2010-03-11 09:15:13 +0000
> @@ -225,6 +225,16 @@
>         </property>
>     </bean>
>
> +           <bean
> id="org.hisp.dhis.ll.action.llgroup.ValidateLineListGroupAddAction"
> +    class="org.hisp.dhis.ll.action.llgroup.ValidateLineListGroupAddAction"
> scope="prototype">
> +        <property name="lineListService">
> +            <ref bean="org.hisp.dhis.linelisting.LineListService"/>
> +        </property>
> +        <property name="dataBaseManagerInterface">
> +            <ref bean="org.hisp.dhis.dbmanager.DataBaseManagerInterface"/>
> +        </property>
> +    </bean>
> +
>     <bean
> id="org.hisp.dhis.ll.action.llgroup.LineListGroupElementListAction"
>     class="org.hisp.dhis.ll.action.llgroup.LineListGroupElementListAction"
> scope="prototype">
>         <property name="lineListService">
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/resources/struts.xml'
> --- local/in/dhis-web-linelisting-in/src/main/resources/struts.xml
>  2010-03-09 13:57:08 +0000
> +++ local/in/dhis-web-linelisting-in/src/main/resources/struts.xml
>  2010-03-11 09:15:13 +0000
> @@ -241,7 +241,15 @@
>             <result name="input"
> type="velocity-xml">/dhis-web-linelisting-in/responseInput.vm</result>
>             <param name="onExceptionReturn">plainTextError</param>
>         </action>
> -
> +
> +        <action name="validateLineListGroupAdd"
> +
> class="org.hisp.dhis.ll.action.llgroup.ValidateLineListGroupAddAction">
> +            <result name="success"
> type="velocity-xml">/dhis-web-linelisting-in/responseSuccess.vm</result>
> +            <result name="error"
> type="velocity-xml">/dhis-web-linelisting-in/responseError.vm</result>
> +            <result name="input"
> type="velocity-xml">/dhis-web-linelisting-in/responseInput.vm</result>
> +            <param name="onExceptionReturn">plainTextError</param>
> +        </action>
> +
>          <!-- LLGroup association -->
>
>         <action name="defineLLGroupAssociationsForm"
> @@ -305,7 +313,7 @@
>             <param name="page">/dhis-web-linelisting-in/select.vm</param>
>             <param
> name="menu">/dhis-web-linelisting-in/menuForLLDataEntry.vm</param>
>             <param
> name="javascripts">../dhis-web-commons/calendar/calendar.js,../dhis-web-commons/calendar/calendar-lang.js,../dhis-web-commons/calendar/calendar-setup.js,../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js</param>
> -            <param
> name="stylesheets">style/dhis-web-dataentry-national.css</param>
> +            <param
> name="stylesheets">css/dhis-web-dataentry-national.css</param>
>         </action>
>
>         <action name="nextPeriods"
> class="org.hisp.dhis.ll.action.lldataentry.NextPeriodsAction">
> @@ -322,7 +330,7 @@
>             <param name="page">/dhis-web-linelisting-in/form.vm</param>
>             <param
> name="menu">/dhis-web-linelisting-in/menuForLLDataEntry.vm</param>
>             <param
> name="javascripts">../dhis-web-commons/calendar/calendar.js,../dhis-web-commons/calendar/calendar-lang.js,../dhis-web-commons/calendar/calendar-setup.js,../dhis-web-commons/ouwt/ouwt.js,javascript/general.js,javascript/form.js</param>
> -            <param
> name="stylesheets">style/dhis-web-dataentry-national.css</param>
> +            <param
> name="stylesheets">css/dhis-web-dataentry-national.css</param>
>         </action>
>
>         <action name="saveValueAction"
> class="org.hisp.dhis.ll.action.lldataentry.SaveValueAction">
> @@ -357,7 +365,7 @@
>             <param
> name="page">/dhis-web-linelisting-in/addValidationRuleForm.vm</param>
>             <param name="menu">/dhis-web-linelisting-in/menu.vm</param>
>             <param
> name="javascripts">javascript/general.js,javascript/validationForm.js,javascript/expression.js</param>
> -            <param name="stylesheets">style/validationStyle.css</param>
> +            <param name="stylesheets">css/validationStyle.css</param>
>             <param name="requiredAuthorities">F_VALIDATIONRULE_ADD</param>
>         </action>
>
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/css/dhis-web-dataentry-national.css'
> ---
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/css/dhis-web-dataentry-national.css
>        2009-09-07 11:25:40 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/css/dhis-web-dataentry-national.css
>        2010-03-11 09:15:13 +0000
> @@ -1,13 +1,20 @@
> -#currentSelection {
> +
> +#currentSelection
> +{
> +
> +  color: black;
> +  padding: 5px;
> +  background-color: #D5FFC5;
> +  border: 1px solid black;
> +  font-size: 14px;
> +  text-align: right;
> +
>   position: fixed;
>   top: 95px;
> -  right: 0;
> -  color: black;
> -  background-color: yellow;
> -  border: 1px solid black;
> -  font-size: 1.3em;
> -  font-weight: bold;
> +
>  }
> +
> +
>  #selectForm {
>   padding-top: 32px;
>  }
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/lineListGroup.js'
> ---
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/lineListGroup.js
>        2010-03-09 13:57:08 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/lineListGroup.js
>        2010-03-11 09:15:13 +0000
> @@ -45,7 +45,7 @@
>     var request = new Request();
>     request.setResponseTypeXML( 'message' );
>     request.setCallbackSuccess( addValidationCompleted );
> -    request.send( 'validateLineListGroup.action?name=' + getFieldValue(
> 'name' ) +
> +    request.send( 'validateLineListGroupAdd.action?name=' + getFieldValue(
> 'name' ) +
>         '&shortName=' + htmlEncode( getFieldValue( 'shortName' ) ) +
>         '&periodTypeSelect=' + htmlEncode( getFieldValue(
> 'periodTypeSelect' ) ) );
>
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/linelistagg.js'
> ---
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/linelistagg.js
>  2010-03-08 13:38:35 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/javascript/linelistagg.js
>  2010-03-11 09:15:13 +0000
> @@ -234,15 +234,9 @@
>  {
>        var linelistGroupDE = document.getElementById( 'linelistGroupDE' );
>
> -       var holdFocusId = holdFocus.id;
> -       //var position = $("#holdFocusId").data("pos");
> -       //var data = jQuery.metadata.get(holdFocusId);
> -       var data = $(holdFocusId).metadata().pos;
> +       var data = jQuery(holdFocus).metadata({type:"attr",name:"data"});
>
> -       alert( holdFocusId + " : " + data );
> -       //if( data.pos == "left" )
> -       /*
> -       if( jQuery("input[id='left']") )
> +       if( data.pos == "left" )
>        {
>                holdFocus.value += linelistGroupDE.options[
> linelistGroupDE.selectedIndex ].value;
>        }
> @@ -250,7 +244,6 @@
>        {
>                holdFocus.value = "klkjk";
>        }
> -       */
>  }
>
>  //-----------------------------------------------------------------
>
> === modified file
> 'local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/select.vm'
> ---
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/select.vm
>  2009-09-07 11:25:40 +0000
> +++
> local/in/dhis-web-linelisting-in/src/main/webapp/dhis-web-linelisting-in/select.vm
>  2010-03-11 09:15:13 +0000
> @@ -1,4 +1,4 @@
> -<div id="currentSelection" text-align:right>
> +<div id="currentSelection">
>        #if ( $organisationUnit ) $encoder.htmlEncode(
> $organisationUnit.name )#else
> $i18n.getString("no_organisationunit_selected") #end -
>        #set( $period = $selectedStateManager.getSelectedPeriod() )
>        #if ( $period ) $format.formatPeriod( $period ) #else
> $i18n.getString("no_period_selected") #end <br>
> @@ -11,12 +11,13 @@
>
>  <br>
>
> +<!--
>  <label>$i18n.getString( "use_default_form" )</label>
>        <input type="checkbox" id="useDefaultForm" name="useDefaultForm"
> #if( $useDefaultForm ) checked="checked" #end #if(
> !$customDataEntryFormExists ) disabled="disabled" #end
> onchange="document.getElementById( 'selectForm' ).submit();">
> -
> -
> -<br><br><br>
> -<input type="button" value="SAVE" onclick="saveLineListingAggData()" #if(
> $isLineListing.equals("no") ) disabled="disabled" #end>
> +-->
> +
> +<br><br>
> +<input type="button" value="Save Aggregated Data"
> onclick="saveLineListingAggData()" #if( $isLineListing.equals("no") )
> disabled="disabled" #end>
>  </div>
>
>  <table>
>
>
>

Follow ups