← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 194: Reverting incomplete previous commit on dataElementGroupEditor.js

 

------------------------------------------------------------
revno: 194
author: Saptarshi
committer: sunbiz <sunbiz@hispindia>
branch nick: trunk
timestamp: Sun 2009-04-19 17:47:40 +0530
message:
  Reverting incomplete previous commit on dataElementGroupEditor.js
modified:
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	2009-04-17 23:13:07 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditor.js	2009-04-19 12:17:40 +0000
@@ -1,95 +1,118 @@
-function initAllList() {
+
+function initAllList()
+{
+    var list = document.getElementById( 'dataElementGroups' );
     var id;
 
-    for ( id in dataElementGroups ) {
-        $('#dataElementGroups').append('<option>'+dataElementGroups[id]+'</option>');
+    for ( id in dataElementGroups )
+    {
+        list.add( new Option( dataElementGroups[id], id ), null );
     }
 
     list = document.getElementById( 'availableDataElements' );
 
-    for ( id in availableDataElements ) {
-        $('#availableDataElements').append('<option>'+availableDataElements[id]+'</option>');
+    for ( id in availableDataElements )
+    {
+        list.add( new Option( availableDataElements[id], id ), null );
     }
 
-    if(list.selectedIndex==-1) {
+    if(list.selectedIndex==-1)
+    {
         list.disabled = true;
     }
 }
 
-function addSelectedDataElements() {
+function addSelectedDataElements()
+{
     var list = document.getElementById( 'availableDataElements' );
 
-    while ( list.selectedIndex != -1 ) {
+    while ( list.selectedIndex != -1 )
+    {
         var id = list.options[list.selectedIndex].value;
+
         list.options[list.selectedIndex].selected = false;
+
         selectedDataElements[id] = availableDataElements[id];
+
     }
 
     filterSelectedDataElements();
     filterAvailableDataElements();
 }
 
-function removeSelectedDataElements() {
+function removeSelectedDataElements()
+{
     var list = document.getElementById( 'selectedDataElements' );
 
-    while ( list.selectedIndex != -1 ) {
+    while ( list.selectedIndex != -1 )
+    {
         var id = list.options[list.selectedIndex].value;
+
         list.options[list.selectedIndex].selected = false;
+
         //availableDataElements[id] = selectedDataElements[id];
+
         delete selectedDataElements[id];
     }
 
     filterSelectedDataElements();
     filterAvailableDataElements();
 }
-
-function filterDataElementGroups()
 {
     var filter = document.getElementById( 'dataElementGroupsFilter' ).value;
     var list = document.getElementById( 'dataElementGroups' );
 
     list.options.length = 0;
 
-    for ( var id in dataElementGroups ) {
+    for ( var id in dataElementGroups )
+    {
         var value = dataElementGroups[id];
 
-        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 ) {
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
             list.add( new Option( value, id ), null );
         }
     }
 }
 
-function filterAvailableDataElements() {
+function filterAvailableDataElements()
+{
     var filter = document.getElementById( 'availableDataElementsFilter' ).value;
     var list = document.getElementById( 'availableDataElements' );
 
     list.options.length = 0;
 
-    for ( var id in availableDataElements ) {
+    for ( var id in availableDataElements )
+    {
         var value = availableDataElements[id];
 
-        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 ) {
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
             list.add( new Option( value, id ), null );
         }
     }
 }
 
-function filterSelectedDataElements() {
+function filterSelectedDataElements()
+{
     var filter = document.getElementById( 'selecteDataElementsFilter' ).value;
     var list = document.getElementById( 'selectedDataElements' );
 
     list.options.length = 0;
 
-    for ( var id in selectedDataElements ) {
+    for ( var id in selectedDataElements )
+    {
         var value = selectedDataElements[id];
 
-        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 ) {
+        if ( value.toLowerCase().indexOf( filter.toLowerCase() ) != -1 )
+        {
             list.add( new Option( value, id ), null );
         }
     }
 }
 
-function getDataElementGroup( dataElementGroupList ) {
+function getDataElementGroup( dataElementGroupList )
+{
     selectedDataElements = new Object();
     var id = dataElementGroupList.options[ dataElementGroupList.selectedIndex ].value;
     var request = new Request();
@@ -98,13 +121,15 @@
     request.send( 'getDataElementGroupEditor.action?id=' + id );
 }
 
-function getDataElementGroupCompleted( xmlObject ) {
+function getDataElementGroupCompleted( xmlObject )
+{
     var selectedList = document.getElementById( 'selectedDataElements' );
     selectedList.length = 0;
     name = xmlObject.getElementsByTagName('name')[0].firstChild.nodeValue;
     var dataElementList = xmlObject.getElementsByTagName('dataElement');
 
-    for ( var i = 0; i < dataElementList.length; i++ ) {
+    for ( var i = 0; i < dataElementList.length; i++ )
+    {
         dataElement = dataElementList.item(i);
         var id = dataElement.getAttribute('id');
         var value = dataElement.firstChild.nodeValue;
@@ -116,16 +141,21 @@
     document.getElementById('availableDataElements').disabled=false;
 }
 
-function updateDataElementGroupMembers() {
+function updateDataElementGroupMembers()
+{
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
     var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
 
     var request = new Request();
+
     var requestString = 'updateDataElementGroupEditor.action';
+
     var params = "id=" + id;
+
     var selectedDataElementMembers = document.getElementById( 'selectedDataElements' );
 
-    for ( var i = 0; i < selectedDataElementMembers.options.length; ++i) {
+    for ( var i = 0; i < selectedDataElementMembers.options.length; ++i)
+    {
         params += '&groupMembers=' + selectedDataElementMembers.options[i].value;
     }
     request.sendAsPost( params );
@@ -134,16 +164,19 @@
     request.send( requestString );
 }
 
-function updateDataElementGroupMembersReceived( xmlObject ) {
+function updateDataElementGroupMembersReceived( xmlObject )
+{
     dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
     document.getElementById('message').style.display='block';
     document.getElementById('message').innerHTML = i18n_update_success + " : " + dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
 }
 
-function deleteDataElementGroup() {
+function deleteDataElementGroup()
+{
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
 
-    try {
+    try
+    {
         var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
         var name =  dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
         if( window.confirm( i18n_confirm_delete + '\n\n' + name ) )
@@ -154,40 +187,46 @@
             request.send( 'deleteDataElemenGroupEditor.action?id=' + id );
         }
     }
-    catch(e) {
+    catch(e)
+    {
         alert( i18n_select_dataelement_group );
     }
 }
 
-function deleteDataElementGroupReceived( xmlObject ) {
+function deleteDataElementGroupReceived( xmlObject )
+{
     var type = xmlObject.getAttribute( 'type' );
 
-    if ( type=='success' ) {
+    if ( type=='success' )
+    {
         var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
         dataElementGroupsSelect.remove( dataElementGroupsSelect.selectedIndex );
         document.getElementById( 'groupNameView' ).innerHTML = "";
         selectedDataElements = new Object();
-        filterSelectedDataElements();
     }
 }
 
-function showRenameDataElementGroupForm() {
+function showRenameDataElementGroupForm()
+{
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
 
-    try {
+    try
+    {
         var name = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].text;
         document.getElementById( 'addRenameGroupButton' ).onclick=validateRenameDataElementGroup;
         setPositionCenter( 'addDataElementGroupForm' );
-        showById('addDataElementGroupForm');
-        document.getElementById( 'groupName' ).value = name;
+		showById('addDataElementGroupForm');
+		document.getElementById( 'groupName' ).value = name;
         showDivEffect();
     }
-    catch(e) {
+    catch(e)
+    {
         alert(i18n_select_dataelement_group);
     }
 }
 
-function validateRenameDataElementGroup() {
+function validateRenameDataElementGroup()
+{
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
     var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
     var name = document.getElementById( 'groupName' ).value;
@@ -197,18 +236,22 @@
     request.send( 'validateDataElementGroup.action?id=' + id + '&name=' + name );
 }
 
-function validateRenameDataElementGroupReceived( xmlObject ) {
+function validateRenameDataElementGroupReceived( xmlObject )
+{
     var type = xmlObject.getAttribute( 'type' );
 
-    if ( type=='input' ) {
+    if ( type=='input' )
+    {
         alert(xmlObject.firstChild.nodeValue);
     }
-    if ( type=='success' ) {
+    if ( type=='success' )
+    {
         renameDataElementGroup();
     }
 }
 
-function renameDataElementGroup() {
+function renameDataElementGroup()
+{
     var dataElementGroupsSelect = document.getElementById( 'dataElementGroups' );
     var id = dataElementGroupsSelect.options[ dataElementGroupsSelect.selectedIndex ].value;
     var name = document.getElementById( 'groupName' ).value;
@@ -219,7 +262,8 @@
 
 }
 
-function renameDataElementGroupReceived( xmlObject ) {
+function renameDataElementGroupReceived( xmlObject )
+{
     var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
     var list = document.getElementById( 'dataElementGroups' );
     list.options[ list.selectedIndex ].text = name;
@@ -228,15 +272,17 @@
     deleteDivEffect();
 }
 
-function showAddDataElementGroupForm() {
+function showAddDataElementGroupForm()
+{
     document.getElementById( 'groupName' ).value='';
     document.getElementById( 'addRenameGroupButton' ).onclick=validateAddDataElementGroup;
     setPositionCenter( 'addDataElementGroupForm' );
-    showById('addDataElementGroupForm');
+	showById('addDataElementGroupForm');
     showDivEffect();
 }
 
-function validateAddDataElementGroup() {
+function validateAddDataElementGroup()
+{
     var name = document.getElementById( 'groupName' ).value;
     var request = new Request();
     request.setResponseTypeXML( 'xmlObject' );
@@ -244,18 +290,22 @@
     request.send( 'validateDataElementGroup.action?name=' + name );
 }
 
-function validateAddDataElementGroupReceived( xmlObject ) {
+function validateAddDataElementGroupReceived( xmlObject )
+{
     var type = xmlObject.getAttribute( 'type' );
 
-    if ( type=='input' ) {
+    if ( type=='input' )
+    {
         alert(xmlObject.firstChild.nodeValue);
     }
-    if ( type=='success' ) {
+    if ( type=='success' )
+    {
         createNewGroup();
     }
 }
 
-function createNewGroup() {
+function createNewGroup()
+{
     var name = document.getElementById( 'groupName' ).value;
     var request = new Request();
     request.setResponseTypeXML( 'xmlObject' );
@@ -263,7 +313,8 @@
     request.send( 'addDataElementGroupEditor.action?name=' + name );
 }
 
-function createNewGroupReceived( xmlObject ) {
+function createNewGroupReceived( xmlObject )
+{
     var id = xmlObject.getElementsByTagName( "id" )[0].firstChild.nodeValue;
     var name = xmlObject.getElementsByTagName( "name" )[0].firstChild.nodeValue;
     var list = document.getElementById( 'dataElementGroups' );



--
Trunk
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.