=== added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation' === added directory 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action' === added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretation.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretation.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretation.java 2014-05-19 07:34:54 +0000 @@ -0,0 +1,112 @@ +package org.hisp.dhis.light.interpretation.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.interpretation.Interpretation; +import org.hisp.dhis.interpretation.InterpretationService; + +import com.opensymphony.xwork2.Action; + +/** + * + * @author Paul Mark Castillo + * + */ +public class GetInterpretation + implements Action +{ + /** + * + */ + private static final Log log = LogFactory.getLog( GetInterpretations.class ); + + /** + * + */ + public GetInterpretation() + { + } + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + /** + * + */ + private InterpretationService interpretationService; + + /** + * @return the interpretationService + */ + public InterpretationService getInterpretationService() + { + return interpretationService; + } + + /** + * @param interpretationService the interpretationService to set + */ + public void setInterpretationService( InterpretationService interpretationService ) + { + this.interpretationService = interpretationService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + /** + * + */ + private int interpretationId; + + /** + * @return the interpretationId + */ + public int getInterpretationId() + { + return interpretationId; + } + + /** + * @param interpretationId the interpretationId to set + */ + public void setInterpretationId( int interpretationId ) + { + this.interpretationId = interpretationId; + } + + /** + * + */ + private Interpretation interpretation; + + /** + * @return the interpretation + */ + public Interpretation getInterpretation() + { + return interpretation; + } + + /** + * @param interpretation the interpretation to set + */ + public void setInterpretation( Interpretation interpretation ) + { + this.interpretation = interpretation; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + setInterpretation( interpretationService.getInterpretation( getInterpretationId() ) ); + return SUCCESS; + } +} === added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretations.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretations.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/GetInterpretations.java 2014-05-19 07:34:54 +0000 @@ -0,0 +1,135 @@ +package org.hisp.dhis.light.interpretation.action; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; +import java.util.Iterator; +import java.util.List; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.interpretation.Interpretation; +import org.hisp.dhis.interpretation.InterpretationService; + +import com.opensymphony.xwork2.Action; + +/** + * + * @author Paul Mark Castillo + * + */ +public class GetInterpretations + implements Action, Comparator +{ + /** + * + */ + private static final Log log = LogFactory.getLog( GetInterpretations.class ); + + /** + * + */ + public GetInterpretations() + { + } + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + /** + * + */ + private InterpretationService interpretationService; + + /** + * @return the interpretationService + */ + public InterpretationService getInterpretationService() + { + return interpretationService; + } + + /** + * @param interpretationService the interpretationService to set + */ + public void setInterpretationService( InterpretationService interpretationService ) + { + this.interpretationService = interpretationService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + /** + * + */ + List interpretations; + + /** + * @return the interpretations + */ + public List getInterpretations() + { + return interpretations; + } + + /** + * @param interpretations the interpretations to set + */ + public void setInterpretations( List interpretations ) + { + this.interpretations = interpretations; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + List tempInterpretations = interpretationService.getInterpretations(); + + List finalInterpretations = new ArrayList(); + + Iterator i = tempInterpretations.iterator(); + while ( i.hasNext() ) + { + Interpretation currentInterpretation = i.next(); + + if ( currentInterpretation.getType().equals( Interpretation.TYPE_CHART ) ) + { + finalInterpretations.add( currentInterpretation ); + } + } + + Collections.sort( finalInterpretations, this ); + + setInterpretations( finalInterpretations ); + + return SUCCESS; + } + + @Override + public int compare( Interpretation o1, Interpretation o2 ) + { + long time1 = o1.getCreated().getTime(); + long time2 = o2.getCreated().getTime(); + + if ( time1 > time2 ) + { + return -1; + } + else if ( time2 < time1 ) + { + return 1; + } + else + { + return 0; + } + } +} === added file 'dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/PostInterpretationComment.java' --- dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/PostInterpretationComment.java 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/java/org/hisp/dhis/light/interpretation/action/PostInterpretationComment.java 2014-05-19 07:34:54 +0000 @@ -0,0 +1,136 @@ +package org.hisp.dhis.light.interpretation.action; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.hisp.dhis.interpretation.Interpretation; +import org.hisp.dhis.interpretation.InterpretationService; + +import com.opensymphony.xwork2.Action; + +/** + * + * @author Paul Mark Castillo + * + */ +public class PostInterpretationComment + implements Action +{ + /** + * + */ + private static final Log log = LogFactory.getLog( GetInterpretations.class ); + + /** + * + */ + public PostInterpretationComment() + { + } + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + /** + * + */ + private InterpretationService interpretationService; + + /** + * @return the interpretationService + */ + public InterpretationService getInterpretationService() + { + return interpretationService; + } + + /** + * @param interpretationService the interpretationService to set + */ + public void setInterpretationService( InterpretationService interpretationService ) + { + this.interpretationService = interpretationService; + } + + // ------------------------------------------------------------------------- + // Input & Output + // ------------------------------------------------------------------------- + + /** + * + */ + private int interpretationId; + + /** + * @return the interpretationId + */ + public int getInterpretationId() + { + return interpretationId; + } + + /** + * @param interpretationId the interpretationId to set + */ + public void setInterpretationId( int interpretationId ) + { + this.interpretationId = interpretationId; + } + + /** + * + */ + private Interpretation interpretation; + + /** + * @return the interpretation + */ + public Interpretation getInterpretation() + { + return interpretation; + } + + /** + * @param interpretation the interpretation to set + */ + public void setInterpretation( Interpretation interpretation ) + { + this.interpretation = interpretation; + } + + /** + * + */ + private String comment; + + /** + * + * @return + */ + public String getComment() + { + return comment; + } + + /** + * + * @param comment + */ + public void setComment( String comment ) + { + this.comment = comment; + } + + // ------------------------------------------------------------------------- + // Action Implementation + // ------------------------------------------------------------------------- + + @Override + public String execute() + throws Exception + { + setInterpretation( interpretationService.getInterpretation( getInterpretationId() ) ); + interpretationService.addInterpretationComment( getInterpretation().getUid(), getComment() ); + return SUCCESS; + } +} === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml' --- dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2014-05-15 03:44:47 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/resources/META-INF/dhis/beans.xml 2014-05-19 07:34:54 +0000 @@ -527,6 +527,24 @@ + + + + + + + + + + + + + + + /dhis-web-light/messages.vm + + + + + /dhis-web-light/main.vm + /dhis-web-light/interpretation/interpretations.vm + + + + /dhis-web-light/main.vm + /dhis-web-light/interpretation/interpretation.vm + + + + /dhis-web-light/main.vm + /dhis-web-light/interpretation/interpretation.vm + + === added directory 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation' === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretation.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretation.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretation.vm 2014-05-19 07:34:54 +0000 @@ -0,0 +1,54 @@ +## ============================================================================ +

+ $i18n.getString( "Interpretation" ) +

+ +

+ #if($interpretation.getType() == "chart") +
+ #end +

+ + +## ============================================================================ +

+ $i18n.getString( "interpretation_comment" ) +

+ +

+ #foreach( $interpretationComment in $interpretation.getComments() ) +

  • + $interpretationComment.getText() +
  • + #end +

    + + +## ============================================================================ +

    $i18n.getString("interpretation_add_comment")

    + +
    + +
    +

    + + +

    +
    +
    + + +## ============================================================================ + === added file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretations.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretations.vm 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/interpretation/interpretations.vm 2014-05-19 07:34:54 +0000 @@ -0,0 +1,31 @@ + +

    + $i18n.getString( "interpretations" ) +

    + + +$i18n.getString( "interpretations_support" )
    + +

    + #foreach( $interpretation in $interpretations ) +

  • + + $interpretation.getText() + +
  • + #end +

    + + === modified file 'dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm' --- dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm 2014-03-04 07:06:42 +0000 +++ dhis-2/dhis-web/dhis-web-light/src/main/webapp/dhis-web-light/menu.vm 2014-05-19 07:34:54 +0000 @@ -29,6 +29,7 @@ #end
  • $i18n.getString( "messages" ) #if($unreadMessageConversationCount > 0)($unreadMessageConversationCount)#end
  • +
  • $i18n.getString( "interpretations" )
  • $i18n.getString( "reports" )
  • $i18n.getString( "settings" )