← Back to team overview

dhis2-devs team mailing list archive

Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 193: Easy help implementation. This implementation will bring up popup with content related to particu...

 

Hi Murod,

thanks for working on this.

I have a few questions:

- Where are the "localization lang properties files" supposed to be located?

- How are these properties supposed to be loaded in the HelpService object?

- There is a typo in your reponseSuccess.vm file name.

- The view help action class defines a result for ERROR to be
responseError.vm. This file does not exist and the action class does not
have this result.

- The HelpService looks to me more of a POJO as there is no logic in there.
If it is we could rename it to HelpContent. If it is a service it should
have an interface.


cheers

Lars


HelpContent content = new HelpConent(

On Sat, Apr 18, 2009 at 4:44 PM, <noreply@xxxxxxxxxxxxx> wrote:

> ------------------------------------------------------------
> revno: 193
> committer: Miri <murodlatifov@xxxxxxxxx>
> branch nick: trunk
> timestamp: Sat 2009-04-18 16:42:14 +0200
> message:
>  Easy help implementation. This implementation will bring up popup with
> content related to particular control. In order to add 'easy help' to any
> control or menu link the following tag should be placed next to it:
>  <a href="javascript:leftBar.openHelpForm('datasetsecmanfilter');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a>
>   'datasetsecmanfilter' should be different for each tag inserted.
> 'datasetsecmanfilter' is short for 'data set section management filter'.
> When help icon clicked for this control (available on Maintenance Datasets)
> two localized strings will be displayed for user on popup:
>  help.datasetsecmanfilter
>  help.datasetsecmanfilter.content
>  These two properties should be placed in localization lang.properties file
> and relative text provided. After adding these two strings you can see it in
> action by clicking help icon next to control again.
> added:
>
>  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help/
>
>  dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help/HelpService.java
>
>  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/help/reponseSuccess.vm
>
>  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/help_blue.gif
>  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/
>  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action/
>
>  dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action/PopupHelpAction.java
> modified:
>  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js
>
>  dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
>  dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm
>
>  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm
>
> === added directory
> 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help'
> === added file
> 'dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help/HelpService.java'
> ---
> dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help/HelpService.java
>    1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-support/dhis-support-system/src/main/java/org/hisp/dhis/system/help/HelpService.java
>    2009-04-18 14:42:14 +0000
> @@ -0,0 +1,52 @@
> +package org.hisp.dhis.system.help;
> +
> +/*
> + * Copyright (c) 2004-2009, 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.
> + */
> +
> +/**
> + * @author Murodillo Latifov Abdusamadovich
> + * @version $Id: PopupHelpAction.java 08-04-2009 $
> + */
> +
> +public class HelpService {
> +
> +       private String header;
> +       private String content;
> +       public String getHeader() {
> +               return header;
> +       }
> +       public void setHeader(String header) {
> +               this.header = header;
> +       }
> +       public String getContent() {
> +               return content;
> +       }
> +       public void setContent(String content) {
> +               this.content = content;
> +       }
> +
> +}
>
> === added file
> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/help/reponseSuccess.vm'
> ---
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/help/reponseSuccess.vm
>  1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/help/reponseSuccess.vm
>  2009-04-18 14:42:14 +0000
> @@ -0,0 +1,2 @@
> +<p>$i18n.getString( $helpService.getHeader() )</p>
> +<p>$i18n.getString( $helpService.getContent() )</p>
> \ No newline at end of file
>
> === added file
> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/help_blue.gif'
> Binary files
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/help_blue.gif
>    1970-01-01 00:00:00 +0000 and
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/help_blue.gif
>   2009-04-18 14:42:14 +0000 differ
> === modified file
> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js'
> --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js
>  2009-04-17 23:13:07 +0000
> +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/main.js
>  2009-04-18 14:42:14 +0000
> @@ -70,4 +70,9 @@
>         var request = new Request();
>         request.send( '../dhis-web-commons/menu/setMenuHidden.action' );
>     }
> +
> +    this.openHelpForm = function( id )
> +    {
> +               window.open
> ("../dhis-web-commons/help/viewDynamicHelp.action?id=" + id,"Help",
> 'width=800,height=600,scrollbars=yes');
> +    }
>  }
>
> === added directory
> 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help'
> === added directory
> 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action'
> === added file
> 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action/PopupHelpAction.java'
> ---
> dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action/PopupHelpAction.java
>       1970-01-01 00:00:00 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/help/action/PopupHelpAction.java
>       2009-04-18 14:42:14 +0000
> @@ -0,0 +1,78 @@
> +package org.hisp.dhis.help.action;
> +
> +/*
> + * Copyright (c) 2004-2009, 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.system.help.HelpService;
> +
> +import com.opensymphony.xwork.Action;
> +
> +
> +/**
> + * @author Murodillo Latifov Abdusamadovich
> + * @version $Id: PopupHelpAction.java 08-04-2009 $
> + */
> +
> +public class PopupHelpAction
> +implements Action
> +{
> +    //
> -------------------------------------------------------------------------
> +    // Dependencies
> +    //
> -------------------------------------------------------------------------
> +
> +    private HelpService helpService;
> +
> +    private String id;
> +
> +
> +    public String getId() {
> +               return id;
> +       }
> +
> +       public void setId(String id) {
> +               this.id = id;
> +       }
> +
> +       public void setHelpService( HelpService helpService )
> +    {
> +        this.helpService = helpService;
> +    }
> +
> +    public HelpService getHelpService() {
> +               return helpService;
> +       }
> +
> +
> +       public String execute()
> +        throws Exception
> +    {
> +       helpService.setHeader("help."+id);
> +       helpService.setContent("help."+id+".content");
> +
> +        return SUCCESS;
> +    }
> +}
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml'
> ---
> dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
> 2009-03-03 16:46:36 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml
> 2009-04-18 14:42:14 +0000
> @@ -554,7 +554,14 @@
>     <property name="currentUserService"
>       ref="org.hisp.dhis.user.CurrentUserService"/>
>   </bean>
> -
> +
> +<!-- Dynamic Help bean MLA -->
> +       <bean id="org.hisp.dhis.help.action.PopupHelpAction"
> +               class="org.hisp.dhis.help.action.PopupHelpAction"
> +               scope="prototype">
> +               <property name="helpService"
> ref="org.hisp.dhis.system.help.HelpService" />
> +       </bean>
> +
>   <!-- Common actions -->
>
>   <bean id="org.hisp.dhis.commons.action.GetDataElementsAction"
> @@ -603,5 +610,8 @@
>
>   <bean id="org.hisp.dhis.commons.action.NoAction"
>     class="org.hisp.dhis.commons.action.NoAction"/>
> -
> +
> +   <bean id="org.hisp.dhis.system.help.HelpService"
> +    class="org.hisp.dhis.system.help.HelpService"/>
> +
>  </beans>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml'
> ---
> dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
>  2009-03-03 16:46:36 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml
>  2009-04-18 14:42:14 +0000
> @@ -178,7 +178,20 @@
>     </action>
>
>   </package>
> +
> +  <!-- Help -->
>
> +  <package name="dhis-web-commons-help" extends="dhis-web-commons"
> namespace="/dhis-web-commons/help">
> +
> +<!-- Dynamic Help Action MLA-->
> +               <action name="viewDynamicHelp"
> +                       class="org.hisp.dhis.help.action.PopupHelpAction">
> +                       <result name="success"
> type="velocity">/dhis-web-commons/help/reponseSuccess.vm</result>
> +                       <result name="error"
> type="velocity">/dhis-web-commons/help/reponseError.vm</result>
> +               </action>
> +
> +  </package>
> +
>   <!-- Security -->
>
>   <package name="dhis-web-commons-security" extends="dhis-web-commons"
> namespace="/dhis-web-commons-security">
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm
>       2009-03-23 19:20:18 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/dataSetList.vm
>       2009-04-18 14:42:14 +0000
> @@ -15,10 +15,11 @@
>                  <col width="20">
>
>                  <tr>
> -                       <td>$i18n.getString( "filter_by_name" ): <form
> style="display:inline" action="none" onsubmit="return false"><div
> style="inline"><input type="text" onkeyup="filterValues( this.value
> )"></div></form></td>
> +                       <td>$i18n.getString( "filter_by_name" ):&nbsp;<a
> href="javascript:leftBar.openHelpForm('datasetsecmanfilter');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a>
> +       <form style="display:inline" action="none" onsubmit="return
> false"><div style="inline"><input type="text" onkeyup="filterValues(
> this.value )"></div></form></td>
>                        <td colspan="7" style="text-align:right">
> -                               <input type="button"
> value="$i18n.getString( "sort" )"
> onclick="window.location.href='showSortDataSetForm.action'"
> style="width:80px">
> -                               <input type="button"
> value="$i18n.getString( "add_new" )"
> onclick="window.location.href='addDataSetForm.action'" style="width:80px">
> +                               <input type="button"
> value="$i18n.getString( "sort" )"
> onclick="window.location.href='showSortDataSetForm.action'"
> style="width:70px"><a
> href="javascript:leftBar.openHelpForm('datasetsecmansort');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a>
> +                               <input type="button"
> value="$i18n.getString( "add_new" )"
> onclick="window.location.href='addDataSetForm.action'" style="width:70px"><a
> href="javascript:leftBar.openHelpForm('datasetsecmanaddnew');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a>
>                        </td>
>                  </tr>
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm
>      2009-03-03 16:46:36 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/menu.vm
>      2009-04-18 14:42:14 +0000
> @@ -1,6 +1,7 @@
>
>  <h2>$i18n.getString( "dataset" )&nbsp;</h2>
>  <ul>
> -       <li><a href="index.action">$i18n.getString( "dataset_management"
> )&nbsp;</a></li>
> -       <li><a href="section.action">$i18n.getString( "section_management"
> )&nbsp;</a></li>
> +       <li><a href="index.action">$i18n.getString( "dataset_management"
> )&nbsp;</a>&nbsp;
> +       <a href="javascript:leftBar.openHelpForm('datasetsecmanfilter');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a></li>
> +       <li><a href="section.action">$i18n.getString( "section_management"
> )&nbsp;</a><a href="javascript:leftBar.openHelpForm('datasetsecmanfilter');"
> title="$i18n.getString( 'help' )"><img src="../images/help_blue.gif"
> width="16" height="16" alt="$i18n.getString( 'help' )"></a></li>
>  </ul>
> \ No newline at end of file
>
>
>
> --
> Trunk
> https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk<https://code.launchpad.net/%7Edhis2-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<https://code.launchpad.net/%7Edhis2-devs-core/dhis2/trunk/+edit-subscription>
> .
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs<https://launchpad.net/%7Edhis2-devs>
> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs<https://launchpad.net/%7Edhis2-devs>
> More help   : https://help.launchpad.net/ListHelp
>

Follow ups

References