dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #07311
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2066: Implemented blueprint locate orgunit in web tree
------------------------------------------------------------
revno: 2066
committer: Lars <larshelg@larshelg-laptop>
branch nick: trunk
timestamp: Mon 2010-09-06 06:44:47 +0200
message:
Implemented blueprint locate orgunit in web tree
removed:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm
modified:
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/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java
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
--
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-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-09-04 08:21:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/css/widgets.css 2010-09-06 04:44:47 +0000
@@ -4,11 +4,10 @@
.searchOrgunit
{
- display:none;
- position:absolute;
- width: 15.5em;
- margin-left:1em;
- margin-top:-1.5em;
+ display: none;
+ position: absolute;
+ width: 200px;
+ margin-left: 22px;
z-index: 9999;
}
=== 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 2010-09-04 07:26:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/orgunittree.vm 2010-09-06 04:44:47 +0000
@@ -1,16 +1,16 @@
<script>
$(document).ready(function(){
- $("#searchDiv").click(function(){
- $("#key").slideToggle("fast");
- $("#key").focus();
+ $("#searchIcon").click(function(){
+ $("#searchSpan").toggle();
+ $("#searchSpan").focus();
});
});
</script>
-<span><img id='searchDiv' src='../images/search.png' style='cursor: pointer' title="$i18n.getString( 'locate_organisation_unit_by_code' )">
-<input type='text' id='key' name='key' onchange='getOrgunitByCode(this.value);' class='searchOrgunit'></span>
+<img id="searchIcon" src="../images/search.png" style="cursor: pointer" title="$i18n.getString( 'locate_organisation_unit_by_code' )">
+<span id="searchSpan" style="display:none"><input type="text" id="searchField" name="key" style="width:130px"><input type="button" value="Find" onclick="getOrgunitByCode()"></span>
#macro( parseNode $node )
#if( $node.hasChildren )
@@ -48,4 +48,4 @@
#end
</ul>
</div>
-#end
+#end
\ No newline at end of file
=== 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-09-03 04:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2010-09-06 04:44:47 +0000
@@ -41,7 +41,7 @@
this.select = function( unitId )
{
- var unitTag = document.getElementById( getTagId( unitId ));
+ var unitTag = document.getElementById( getTagId( unitId ) );
var linkTags = unitTag.getElementsByTagName( 'a' );
if ( linkTags[0].className == 'selected' )
@@ -344,13 +344,12 @@
}
function getOrgunitByCode(code)
-{
- $.post(organisationUnitTreePath + "setOrgunitByCode.action",{
- orgunitcode:code
- }, function (data){
- data = data.getElementsByTagName( "message" );;
- if ( data.length == 0 ){
- window.location.reload();
- }
- },'xml');
+{
+ $.getJSON(organisationUnitTreePath + 'getOrganisationUnitByCode.action?code=' + $( '#searchField' ).val(), function (data){
+ if ( data.response == "success" ) {
+ window.location.reload();
+ } else {
+ $( '#searchField' ).css( "background-color", "#ffc5c5" );
+ }
+ } );
}
=== removed 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 2010-09-03 04:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/responseInput.vm 1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<message type="input">$encoder.xmlEncode( $!message )</message>
=== modified 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 2010-09-03 04:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/java/org/hisp/dhis/ouwt/action/GetOrganisationUnitByCodeAction.java 2010-09-06 04:44:47 +0000
@@ -45,29 +45,29 @@
// 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;
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private OrganisationUnitSelectionManager selectionManager;
+
+ public void setSelectionManager( OrganisationUnitSelectionManager selectionManager )
+ {
+ this.selectionManager = selectionManager;
+ }
+
+ // --------------------------------------------------------------------------
+ // Input
+ // --------------------------------------------------------------------------
+
+ private String code;
+
+ public void setCode( String code )
+ {
+ this.code = code;
}
// --------------------------------------------------------------------------
@@ -78,16 +78,15 @@
public String execute()
throws Exception
{
- OrganisationUnit orgunit = orguitService.getOrganisationUnitByCode( orgunitcode );
-
- if ( orgunit != null )
+ OrganisationUnit unit = organisationUnitService.getOrganisationUnitByCode( code );
+
+ if ( unit != null )
{
- orgunitSelectionManager.setSelectedOrganisationUnit( orgunit );
+ selectionManager.setSelectedOrganisationUnit( unit );
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-03 04:31:57 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/META-INF/dhis/beans.xml 2010-09-06 04:44:47 +0000
@@ -190,12 +190,12 @@
<bean id="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction"
class="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction" scope="prototype">
- <property name="orguitService">
+ <property name="organisationUnitService">
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</property>
- <property name="orgunitSelectionManager">
- <ref bean="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
- </property>
+ <property name="selectionManager">
+ <ref local="org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager" />
+ </property>
</bean>
<!-- Organisation Unit Selection Tree -->
=== 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-04 08:21:14 +0000
+++ dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml 2010-09-06 04:44:47 +0000
@@ -211,13 +211,12 @@
<param name="onExceptionReturn">plainTextError</param>
</action>
- <action name="setOrgunitByCode"
+ <action name="getOrganisationUnitByCode"
class="org.hisp.dhis.ouwt.action.GetOrganisationUnitByCodeAction">
- <result name="success" type="velocity-xml">
- /dhis-web-commons/ouwt/responseSuccess.vm</result>
- <result name="input" type="velocity-xml">
- /dhis-web-commons/ouwt/responseInput.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseInput.vm</result>
</action>
</package>