dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14581
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4997: bugfix; findByCode was not working in ouwt
------------------------------------------------------------
revno: 4997
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-10-21 12:46:54 +0200
message:
bugfix; findByCode was not working in ouwt
modified:
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js
--
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/ouwt/ouwt.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-09-03 15:50:32 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/ouwt/ouwt.js 2011-10-21 10:46:54 +0000
@@ -81,7 +81,7 @@
$( "#ouwt_loader" ).hide();
}
-
+
function update_required( remoteVersion, remoteRoots )
{
var localVersion = localStorage[getTagId( "Version" )] ? localStorage[getTagId( "Version" )] : 0;
@@ -115,7 +115,7 @@
if ( data.indexOf( "<!DOCTYPE" ) != 0 )
{
data = JSON.parse( data );
- should_update = update_required( data.version, data.roots );
+ should_update = update_required( data.version, data.roots );
}
}, "text" ).complete(
function()
@@ -144,8 +144,15 @@
// server = true : sync from server
// server = false : sync to server
- this.sync = function( server )
+ this.sync = function( server, fn )
{
+ if ( fn === undefined )
+ {
+ fn = function()
+ {
+ };
+ }
+
if ( server )
{
sessionStorage.removeItem( getTagId( "Selected" ) );
@@ -203,7 +210,7 @@
$.post( organisationUnitTreePath + "addorgunit.action", {
id : item
} );
- } ).complete( this.responseReceived );
+ } ).complete( fn );
}
else
{
@@ -214,7 +221,7 @@
$.post( organisationUnitTreePath + "setorgunit.action", {
id : selected
- } ).complete( this.responseReceived );
+ } ).complete( fn );
}
}
} );
@@ -317,15 +324,15 @@
{
sessionStorage[getTagId( "Selected" )] = unitId;
- $.ajax({
- url: organisationUnitTreePath + "setorgunit.action",
- data: {
+ $.ajax( {
+ url : organisationUnitTreePath + "setorgunit.action",
+ data : {
id : unitId
},
- type: 'POST',
- timeout: 10000,
- complete: this.responseReceived
- });
+ type : 'POST',
+ timeout : 10000,
+ complete : this.responseReceived
+ } );
$( "#orgUnitTree" ).find( "a" ).removeClass( "selected" );
$linkTag.addClass( "selected" );
@@ -372,7 +379,8 @@
function getTagId( unitId )
{
return 'orgUnit' + unitId;
- };
+ }
+ ;
this.findByCode = function()
{
@@ -384,7 +392,7 @@
{
var value = organisationUnits[ou];
- if ( value.indexOf( "\"" + name + "\"" ) != -1 )
+ if ( value.n == name )
{
match = value;
}
@@ -403,9 +411,9 @@
sessionStorage[getTagId( "Selected" )] = match.id;
}
- selection.sync();
subtree.reloadTree();
- selection.responseReceived();
+ selection.sync( false, selection.responseReceived );
+ // selection.responseReceived();
}
else
{
@@ -542,7 +550,8 @@
var child = $parentTag.find( "ul" ).eq( 0 );
setVisible( child, false );
setToggle( $parentTag, false );
- };
+ }
+ ;
function processExpand( parent )
{
@@ -558,7 +567,8 @@
setVisible( $children.eq( 0 ), true );
setToggle( $parentTag, true );
}
- };
+ }
+ ;
function createChildren( parentTag, parent )
{
@@ -574,7 +584,8 @@
setToggle( parentTag, true );
$( parentTag ).append( $childrenTag );
- };
+ }
+ ;
function createTreeElementTag( ou )
{
@@ -604,7 +615,8 @@
$childTag.append( $linkTag );
return $childTag;
- };
+ }
+ ;
function setToggle( unitTag, expanded )
{
@@ -619,7 +631,8 @@
{
$toggleTag.append( toggleImg );
}
- };
+ }
+ ;
function setVisible( tag, visible )
{
@@ -631,35 +644,42 @@
{
$( tag ).hide();
}
- };
+ }
+ ;
function isVisible( tag )
{
return $( tag ).is( ":visible" );
- };
+ }
+ ;
function getTagId( unitId )
{
return 'orgUnit' + unitId;
- };
+ }
+ ;
function getToggleExpand()
{
return getToggleImage().attr( "src", "../images/colapse.png" ).attr( "alt", "[+]" );
- };
+ }
+ ;
function getToggleCollapse()
{
return getToggleImage().attr( "src", "../images/expand.png" ).attr( "alt", "[-]" );
- };
+ }
+ ;
function getToggleBlank()
{
return getToggleImage().attr( "src", "../images/transparent.gif" ).removeAttr( "alt" );
- };
+ }
+ ;
function getToggleImage()
{
return $( "<img/>" ).attr( "width", 9 ).attr( "height", 9 );
- };
+ }
+ ;
}