dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07244
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2043: Applied patch from Tran on locating orgunit in tree by searching on code. Good work
------------------------------------------------------------
revno: 2043
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Fri 2010-09-03 06:31:57 +0200
message:
Applied patch from Tran on locating orgunit in tree by searching on code. Good work
added:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/search.png
dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java
modified:
dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml
dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/orgunittree.vm
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.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/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.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 'dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/META-INF/dhis/beans.xml 2010-09-03 04:31:57 +0000
@@ -1057,7 +1057,6 @@
<property name="propertyNames">
<list>
<value>name</value>
- <value>title</value>
</list>
</property>
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataset/hibernate/DataSet.hbm.xml 2010-09-03 04:31:57 +0000
@@ -44,8 +44,8 @@
<property name="locked"/>
<property name="sortOrder"/>
-
+
<many-to-one name="dataEntryForm" class="org.hisp.dhis.dataentryform.DataEntryForm" foreign-key="fk_dataset_dataentryform" cascade="all" />
-
+
</class>
</hibernate-mapping>
=== modified file 'dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml 2010-06-01 12:03:19 +0000
+++ dhis-2/dhis-support/dhis-support-external/src/main/resources/META-INF/dhis/beans.xml 2010-09-03 04:31:57 +0000
@@ -6,8 +6,7 @@
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd"
- default-autowire="byName">
+ http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
<context:component-scan base-package="org.hisp.dhis"/>
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2010-08-25 09:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2010-09-03 04:31:57 +0000
@@ -1,3 +1,17 @@
+/*----------------------------------------------------------------------------*/
+/* Search button for orgunit */
+/*----------------------------------------------------------------------------*/
+
+.searchOrgunit
+{
+ display:none;
+ position:absolute;
+ position:absolute;
+ width: 15.5em;
+ margin-left:1em;
+ margin-top:-1.5em;
+ z-index: 9999;
+}
/*----------------------------------------------------------------------------*/
/* Right bar */
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/orgunittree.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/orgunittree.vm 2009-10-22 17:22:15 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/orgunittree.vm 2010-09-03 04:31:57 +0000
@@ -1,3 +1,16 @@
+<script>
+
+$(document).ready(function(){
+ $("#searchDiv").click(function(){
+ $("#key").slideToggle("fast");
+ $("#key").focus();
+ });
+});
+
+</script>
+
+<span><img id='searchDiv' src='../images/search.png' style='cursor: pointer'>
+<input type='text' id='key' name='key' onchange='getOrgunitByCode(this.value);' class='searchOrgunit'></span>
#macro( parseNode $node )
#if( $node.hasChildren )
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2010-07-23 07:04:03 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2010-09-03 04:31:57 +0000
@@ -41,7 +41,6 @@
this.select = function( unitId )
{
-
var unitTag = document.getElementById( getTagId( unitId ));
var linkTags = unitTag.getElementsByTagName( 'a' );
@@ -343,3 +342,15 @@
return imgTag;
}
}
+
+function getOrgunitByCode(code)
+{
+ $.post(organisationUnitTreePath + "setOrgunitByCode.action",{
+ orgunitcode:code
+ }, function (data){
+ data = data.getElementsByTagName( "message" );;
+ if ( data.length == 0 ){
+ window.location.reload();
+ }
+ },'xml');
+}
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm 2010-09-03 04:31:57 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<message type="input">$encoder.xmlEncode( $!message )</message>
=== added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/search.png'
Binary files dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/search.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/images/search.png 2010-09-03 04:31:57 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java'
--- dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java 2010-09-03 04:31:57 +0000
@@ -0,0 +1,93 @@
+package org.hisp.dhis.ouwt.action;
+
+/*
+ * Copyright (c) 2004-2010, 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.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ * @version $Id: GetOrganisationUnitByNameAction.java 5282 2010-08-31 18:41:06Z
+ * $
+ */
+public class GetOrganisationUnitByCodeAction
+ implements Action
+{
+ // --------------------------------------------------------------------------
+ // Dependencies
+ // --------------------------------------------------------------------------
+
+ private OrganisationUnitService orguitService;
+
+ public void setOrguitService( OrganisationUnitService orguitService )
+ {
+ this.orguitService = orguitService;
+ }
+
+ private OrganisationUnitSelectionManager orgunitSelectionManager;
+
+ public void setOrgunitSelectionManager( OrganisationUnitSelectionManager orgunitSelectionManager )
+ {
+ this.orgunitSelectionManager = orgunitSelectionManager;
+ }
+
+ // --------------------------------------------------------------------------
+ // Setter
+ // --------------------------------------------------------------------------
+
+ private String orgunitcode;
+
+ public void setOrgunitcode( String orgunitcode )
+ {
+ this.orgunitcode = orgunitcode;
+ }
+
+ // --------------------------------------------------------------------------
+ // Implementation Action
+ // --------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OrganisationUnit orgunit = orguitService.getOrganisationUnitByCode( orgunitcode );
+
+ if ( orgunit != null )
+ {
+ orgunitSelectionManager.setSelectedOrganisationUnit( orgunit );
+
+ return SUCCESS;
+ }
+
+ return INPUT;
+ }
+
+}
=== 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 2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-09-03 04:31:57 +0000
@@ -187,7 +187,17 @@
<ref local="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
</property>
</bean>
-
+
+ <bean id="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction"
+ class="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction" scope="prototype">
+ <property name="orguitService">
+ <ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </property>
+ <property name="orgunitSelectionManager">
+ <ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ </property>
+ </bean>
+
<!-- Organisation Unit Selection Tree -->
<bean id="org.hisp.dhis.oust.manager.SelectionTreeManager" class="org.hisp.dhis.oust.manager.DefaultSelectionTreeManager">
=== 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 2010-09-01 16:55:23 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2010-09-03 04:31:57 +0000
@@ -210,6 +210,15 @@
/dhis-web-commons/ouwt/responseSelect.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
+
+ <action name="setOrgunitByCode"
+ class="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction">
+ <result name="success" type="velocity-xml">
+ /dhis-web-commons/ouwt/responseSelect.vm</result>
+ <result name="input" type="velocity-xml">
+ /dhis-web-commons/ouwt/responseInput.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
</package>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java 2010-08-31 14:34:31 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/java/org/hisp/dhis/dataset/action/dataentryform/AutoSaveDataEntryFormAction.java 2010-09-03 04:31:57 +0000
@@ -90,14 +90,14 @@
public String execute()
throws Exception
- {
+ {
DataSet dataset = dataSetService.getDataSet( dataSetIdField );
DataEntryForm dataEntryForm = dataset.getDataEntryForm();
if ( dataEntryForm == null )
{
- dataEntryForm = new DataEntryForm( nameField, designTextarea );
+ dataEntryForm = new DataEntryForm( nameField, dataEntryFormService.prepareDataEntryFormCode( designTextarea ) );
dataEntryFormService.addDataEntryForm( dataEntryForm );
dataset.setDataEntryForm(dataEntryForm);
@@ -106,11 +106,11 @@
else
{
dataEntryForm.setName( nameField );
- dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormCode(designTextarea ));
+ dataEntryForm.setHtmlCode( dataEntryFormService.prepareDataEntryFormCode( designTextarea ) );
dataEntryFormService.updateDataEntryForm( dataEntryForm );
}
return SUCCESS;
}
-
+
}