=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataDictionaryForm.js 2011-06-22 18:53:24 +0000 @@ -1,13 +1,16 @@ -jQuery(document).ready(function() { - validation2('addDataDictionaryForm', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : function() { - listValidator('memberValidator', 'selectedDataElements'); - listValidator('memberValidatorIn', 'selectedIndicators'); - }, - 'rules' : getValidationRules("dataDictionary") - }); +jQuery( document ).ready( function() +{ + validation2( 'addDataDictionaryForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'selectedDataElements' ); + listValidator( 'memberValidatorIn', 'selectedIndicators' ); + }, + 'rules' : getValidationRules( "dataDictionary" ) + } ); - checkValueIsExist("name", "validateDataDictionary.action"); -}); + checkValueIsExist( "name", "validateDataDictionary.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupForm.js 2011-06-22 18:53:24 +0000 @@ -1,10 +1,12 @@ -jQuery(document).ready(function() { - validation2('addDataElementGroupForm', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : beforeSubmit, - 'rules' : getValidationRules("dataElementGroup") - }); +jQuery( document ).ready( function() +{ + validation2( 'addDataElementGroupForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : beforeSubmit, + 'rules' : getValidationRules( "dataElementGroup" ) + } ); - checkValueIsExist("name", "validateDataElementGroup.action"); -}); + checkValueIsExist( "name", "validateDataElementGroup.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addDataElementGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,10 +1,12 @@ -jQuery(document).ready(function() { - validation2('addDataElementGroupSet', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : beforeSubmit, - 'rules' : getValidationRules("dataElementGroupSet") - }); +jQuery( document ).ready( function() +{ + validation2( 'addDataElementGroupSet', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : beforeSubmit, + 'rules' : getValidationRules( "dataElementGroupSet" ) + } ); - checkValueIsExist("name", "validateDataElementGroupSet.action"); -}); + checkValueIsExist( "name", "validateDataElementGroupSet.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorForm.js 2011-06-22 18:53:24 +0000 @@ -1,12 +1,14 @@ -jQuery(document).ready(function() { - validation2('addIndicatorForm', function(form) { - form.submit(); - }, { - 'rules' : getValidationRules("indicator") - }); +jQuery( document ).ready( function() +{ + validation2( 'addIndicatorForm', function( form ) + { + form.submit(); + }, { + 'rules' : getValidationRules( "indicator" ) + } ); - checkValueIsExist("name", "validateIndicator.action"); - checkValueIsExist("shortName", "validateIndicator.action"); - checkValueIsExist("alternativeName", "validateIndicator.action"); - checkValueIsExist("code", "validateIndicator.action"); -}); + checkValueIsExist( "name", "validateIndicator.action" ); + checkValueIsExist( "shortName", "validateIndicator.action" ); + checkValueIsExist( "alternativeName", "validateIndicator.action" ); + checkValueIsExist( "code", "validateIndicator.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupForm.js 2011-06-22 18:53:24 +0000 @@ -1,16 +1,19 @@ -jQuery(document).ready(function() { - validation2('addIndicatorGroupForm', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : function() { - listValidator('memberValidator', 'groupMembers'); - }, - 'rules' : getValidationRules("indicatorGroup") - }); - - checkValueIsExist("name", "validateIndicatorGroup.action"); - - var nameField = document.getElementById('name'); - nameField.select(); - nameField.focus(); -}); +jQuery( document ).ready( function() +{ + validation2( 'addIndicatorGroupForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'groupMembers' ); + }, + 'rules' : getValidationRules( "indicatorGroup" ) + } ); + + checkValueIsExist( "name", "validateIndicatorGroup.action" ); + + var nameField = document.getElementById( 'name' ); + nameField.select(); + nameField.focus(); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,12 +1,15 @@ -jQuery(document).ready(function() { - validation2('addIndicatorGroupSet', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : function() { - listValidator('memberValidator', 'groupMembers'); - }, - 'rules' : getValidationRules("indicatorGroupSet") - }); +jQuery( document ).ready( function() +{ + validation2( 'addIndicatorGroupSet', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'groupMembers' ); + }, + 'rules' : getValidationRules( "indicatorGroupSet" ) + } ); - checkValueIsExist("name", "validateIndicatorGroupSet.action"); -}); + checkValueIsExist( "name", "validateIndicatorGroupSet.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/addIndicatorTypeForm.js 2011-06-22 18:53:24 +0000 @@ -1,9 +1,11 @@ -jQuery(document).ready(function() { - validation2('addIndicatorTypeForm', function(form) { - form.submit() - }, { - 'rules' : getValidationRules("indicatorType") - }); +jQuery( document ).ready( function() +{ + validation2( 'addIndicatorTypeForm', function( form ) + { + form.submit() + }, { + 'rules' : getValidationRules( "indicatorType" ) + } ); - checkValueIsExist("name", "validateIndicatorType.action"); -}); + checkValueIsExist( "name", "validateIndicatorType.action" ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js 2011-05-26 03:35:47 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js 2011-06-22 18:53:24 +0000 @@ -1,4 +1,3 @@ - function showDataElementCategoryComboDetails( categoryComboId ) { var request = new Request(); @@ -10,8 +9,9 @@ function dataElementCategoryComboReceived( dataElementCategoryComboElement ) { setInnerHTML( 'nameField', getElementValue( dataElementCategoryComboElement, 'name' ) ); - setInnerHTML( 'dataElementCategoryCountField', getElementValue( dataElementCategoryComboElement, 'dataElementCategoryCount' ) ); - + setInnerHTML( 'dataElementCategoryCountField', getElementValue( dataElementCategoryComboElement, + 'dataElementCategoryCount' ) ); + showDetails(); } @@ -21,7 +21,7 @@ function removeDataElementCategoryCombo( categoryComboId, categoryComboName ) { - removeItem( categoryComboId, categoryComboName, i18n_confirm_delete, 'removeDataElementCategoryCombo.action' ); + removeItem( categoryComboId, categoryComboName, i18n_confirm_delete, 'removeDataElementCategoryCombo.action' ); } // ---------------------------------------------------------------------- @@ -30,16 +30,16 @@ function validateSelectedCategories( form ) { - var url = "validateDataElementCategoryCombo.action?"; - url += getParamString( "selectedList", "selectedCategories" ); - - jQuery.postJSON( url,{}, function( json ) - { - if( json.response == 'success' ) - { - form.submit(); - } - else markInvalid( 'selectedCategories', json.message ); - }); - + var url = "validateDataElementCategoryCombo.action?"; + url += getParamString( "selectedList", "selectedCategories" ); + + jQuery.postJSON( url, {}, function( json ) + { + if ( json.response == 'success' ) + { + form.submit(); + } else + markInvalid( 'selectedCategories', json.message ); + } ); + } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/concept.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/concept.js 2010-09-04 07:26:32 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/concept.js 2011-06-22 18:53:24 +0000 @@ -1,4 +1,3 @@ - // ----------------------------------------------------------------------------- // View details // ----------------------------------------------------------------------------- @@ -33,28 +32,24 @@ function validateAddUpdateConcept( mode ) { - var name = $("#name").val(); + var name = $( "#name" ).val(); - $.getJSON( - "validateAddUpdateConcept.action", - { - "name": name, - "mode": mode - }, - function( json ) - { - if ( json.response == "success" ) - { - if ( mode == "add" ) - { - byId("addConceptForm").submit(); return; - } - byId("updateConceptForm").submit(); - } - else if ( json.response == "input" ) - { - setHeaderDelayMessage( json.message ); - } - } - ); + $.getJSON( "validateAddUpdateConcept.action", { + "name" : name, + "mode" : mode + }, function( json ) + { + if ( json.response == "success" ) + { + if ( mode == "add" ) + { + byId( "addConceptForm" ).submit(); + return; + } + byId( "updateConceptForm" ).submit(); + } else if ( json.response == "input" ) + { + setHeaderDelayMessage( json.message ); + } + } ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataDictionary.js 2011-06-22 18:53:24 +0000 @@ -1,4 +1,3 @@ - // ----------------------------------------------------------------------------- // View details // ----------------------------------------------------------------------------- @@ -14,13 +13,13 @@ function dataDictionaryReceived( dataDictionaryElement ) { setInnerHTML( 'nameField', getElementValue( dataDictionaryElement, 'name' ) ); - + var description = getElementValue( dataDictionaryElement, 'description' ); setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' ); - + var region = getElementValue( dataDictionaryElement, 'region' ); setInnerHTML( 'regionField', region ? region : '[' + i18n_none + ']' ); - + showDetails(); } @@ -29,12 +28,12 @@ // ----------------------------------------------------------------------------- function dataDictionaryChanged( list ) -{ - var id = list.options[list.selectedIndex].value; - - var url = "setCurrentDataDictionary.action?id=" + id; - - window.location.href = url; +{ + var id = list.options[list.selectedIndex].value; + + var url = "setCurrentDataDictionary.action?id=" + id; + + window.location.href = url; } // ----------------------------------------------------------------------------- @@ -43,5 +42,5 @@ function removeDataDictionary( dataDictionaryId, dataDictionaryName ) { - removeItem( dataDictionaryId, dataDictionaryName, i18n_confirm_delete, 'removeDataDictionary.action' ); + removeItem( dataDictionaryId, dataDictionaryName, i18n_confirm_delete, 'removeDataDictionary.action' ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2011-04-24 15:50:02 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2011-06-22 18:53:24 +0000 @@ -1,22 +1,25 @@ function changeValueType( value ) { - if( value == 'int' ){ - enable( 'zeroIsSignificant' ); - }else{ - disable( 'zeroIsSignificant' ); - } - - updateAggreationOperation( value ); + if ( value == 'int' ) + { + enable( 'zeroIsSignificant' ); + } else + { + disable( 'zeroIsSignificant' ); + } + + updateAggreationOperation( value ); } function updateAggreationOperation( value ) { - if( value== 'string' || value== 'date') - { - hideById("aggregationOperator"); - }else{ - showById("aggregationOperator"); - } + if ( value == 'string' || value == 'date' ) + { + hideById( "aggregationOperator" ); + } else + { + showById( "aggregationOperator" ); + } } // ----------------------------------------------------------------------------- @@ -26,9 +29,9 @@ function criteriaChanged() { var dataDictionaryId = getListValue( "dataDictionaryList" ); - + var url = "dataElement.action?&dataDictionaryId=" + dataDictionaryId; - + window.location.href = url; } @@ -51,48 +54,47 @@ var alternativeName = getElementValue( dataElementElement, 'alternativeName' ); setInnerHTML( 'alternativeNameField', alternativeName ? alternativeName : '[' + i18n_none + ']' ); - + var description = getElementValue( dataElementElement, 'description' ); setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' ); var active = getElementValue( dataElementElement, 'active' ); setInnerHTML( 'activeField', active == 'true' ? i18n_yes : i18n_no ); - - var typeMap = { - 'int':i18n_number, - 'bool':i18n_yes_no, - 'string':i18n_text + + var typeMap = { + 'int' : i18n_number, + 'bool' : i18n_yes_no, + 'string' : i18n_text }; var type = getElementValue( dataElementElement, 'valueType' ); setInnerHTML( 'typeField', typeMap[type] ); - + var domainTypeMap = { - 'aggregate':i18n_aggregate, - 'patient':i18n_patient + 'aggregate' : i18n_aggregate, + 'patient' : i18n_patient }; var domainType = getElementValue( dataElementElement, 'domainType' ); setInnerHTML( 'domainTypeField', domainTypeMap[domainType] ); - + var aggregationOperator = getElementValue( dataElementElement, 'aggregationOperator' ); var aggregationOperatorText = i18n_none; if ( aggregationOperator == 'sum' ) { aggregationOperatorText = i18n_sum; - } - else if ( aggregationOperator == 'average' ) + } else if ( aggregationOperator == 'average' ) { aggregationOperatorText = i18n_average; } - setInnerHTML( 'aggregationOperatorField', aggregationOperatorText ); - + setInnerHTML( 'aggregationOperatorField', aggregationOperatorText ); + setInnerHTML( 'categoryComboField', getElementValue( dataElementElement, 'categoryCombo' ) ); - + var url = getElementValue( dataElementElement, 'url' ); setInnerHTML( 'urlField', url ? '' + url + '' : '[' + i18n_none + ']' ); - + var lastUpdated = getElementValue( dataElementElement, 'lastUpdated' ); setInnerHTML( 'lastUpdatedField', lastUpdated ? lastUpdated : '[' + i18n_none + ']' ); - + showDetails(); } @@ -109,7 +111,7 @@ { url += "dataElementGroupId=" + dataElementGroupId; } - + if ( type != null ) { url += "&type=" + type @@ -127,18 +129,18 @@ } function getDataElementsReceived( xmlObject ) -{ +{ var availableDataElements = document.getElementById( "availableDataElements" ); - + clearList( availableDataElements ); - + var operands = xmlObject.getElementsByTagName( "operand" ); - + for ( var i = 0; i < operands.length; i++ ) { - var id = operands[ i ].getElementsByTagName( "operandId" )[0].firstChild.nodeValue; - var dataElementName = operands[ i ].getElementsByTagName( "operandName" )[0].firstChild.nodeValue; - + var id = operands[i].getElementsByTagName( "operandId" )[0].firstChild.nodeValue; + var dataElementName = operands[i].getElementsByTagName( "operandName" )[0].firstChild.nodeValue; + var option = document.createElement( "option" ); option.value = id; option.text = dataElementName; === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementCategoryList.js 2011-06-22 18:53:24 +0000 @@ -1,94 +1,110 @@ - var selectedList; var availableList; -function move( listId ) -{ - var fromList = document.getElementById(listId); - - if ( fromList.selectedIndex == -1 ) { return; } - - if ( ! availableList ) - { - availableList = document.getElementById('availableList'); - } - - if ( ! selectedList ) - { - selectedList = document.getElementById('selectedList'); - } - - var toList = ( fromList == availableList ? selectedList : availableList ); - - while ( fromList.selectedIndex > -1 ) - { - option = fromList.options.item(fromList.selectedIndex); - fromList.remove(fromList.selectedIndex); - toList.add(option, null); - } -} - -function moveUp( listId ) { - - var withInList = document.getElementById( listId ); - - var index = withInList.selectedIndex; - - if ( index == -1 ) { return; } - - if( index - 1 < 0 ) { return; }//window.alert( 'Item cant be moved up'); - - var option = new Option( withInList.options[index].text, withInList.options[index].value); - var temp = new Option( withInList.options[index-1].text, withInList.options[index-1].value); - - withInList.options[index-1] = option; - withInList.options[index-1].selected = true; - withInList.options[index] = temp; - -} - -function moveDown( listId ) { - - var withInList = document.getElementById( listId ); - - var index = withInList.selectedIndex; - - if ( index == -1 ) { return; } - - if( index + 1 == withInList.options.length ) { return; }//window.alert( 'Item cant be moved down'); - - var option = new Option( withInList.options[index].text, withInList.options[index].value); - var temp = new Option( withInList.options[index+1].text, withInList.options[index+1].value); - - withInList.options[index+1] = option; - withInList.options[index+1].selected = true; - withInList.options[index] = temp; - -} - -function submitForm() -{ - if ( ! availableList ) - { - availableList = document.getElementById('availableList'); - } - - if ( ! selectedList ) - { - selectedList = document.getElementById('selectedList'); - } - - // selectAll(availableList); - selectAll(selectedList); - - return false; - -} - -function selectAll(list) -{ - for ( var i = 0, option; option = list.options.item(i); i++ ) - { - option.selected = true; - } +function move( listId ) +{ + var fromList = document.getElementById( listId ); + + if ( fromList.selectedIndex == -1 ) + { + return; + } + + if ( !availableList ) + { + availableList = document.getElementById( 'availableList' ); + } + + if ( !selectedList ) + { + selectedList = document.getElementById( 'selectedList' ); + } + + var toList = ( fromList == availableList ? selectedList : availableList ); + + while ( fromList.selectedIndex > -1 ) + { + option = fromList.options.item( fromList.selectedIndex ); + fromList.remove( fromList.selectedIndex ); + toList.add( option, null ); + } +} + +function moveUp( listId ) +{ + + var withInList = document.getElementById( listId ); + + var index = withInList.selectedIndex; + + if ( index == -1 ) + { + return; + } + + if ( index - 1 < 0 ) + { + return; + }// window.alert( 'Item cant be moved up'); + + var option = new Option( withInList.options[index].text, withInList.options[index].value ); + var temp = new Option( withInList.options[index - 1].text, withInList.options[index - 1].value ); + + withInList.options[index - 1] = option; + withInList.options[index - 1].selected = true; + withInList.options[index] = temp; + +} + +function moveDown( listId ) +{ + + var withInList = document.getElementById( listId ); + + var index = withInList.selectedIndex; + + if ( index == -1 ) + { + return; + } + + if ( index + 1 == withInList.options.length ) + { + return; + }// window.alert( 'Item cant be moved down'); + + var option = new Option( withInList.options[index].text, withInList.options[index].value ); + var temp = new Option( withInList.options[index + 1].text, withInList.options[index + 1].value ); + + withInList.options[index + 1] = option; + withInList.options[index + 1].selected = true; + withInList.options[index] = temp; + +} + +function submitForm() +{ + if ( !availableList ) + { + availableList = document.getElementById( 'availableList' ); + } + + if ( !selectedList ) + { + selectedList = document.getElementById( 'selectedList' ); + } + + // selectAll(availableList); + selectAll( selectedList ); + + return false; + +} + +function selectAll( list ) +{ + for ( var i = 0, option; option = list.options.item( i ); i++ ) + { + option.selected = true; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroup.js 2011-06-22 18:53:24 +0000 @@ -1,12 +1,13 @@ function beforeSubmit() { - memberValidator = jQuery( "#memberValidator"); - memberValidator.children().remove(); - - jQuery.each( jQuery( "#groupMembers" ).children(), function(i, item){ - item.selected = 'selected'; - memberValidator.append( ''); - }); + memberValidator = jQuery( "#memberValidator" ); + memberValidator.children().remove(); + + jQuery.each( jQuery( "#groupMembers" ).children(), function( i, item ) + { + item.selected = 'selected'; + memberValidator.append( '' ); + } ); } // ----------------------------------------------------------------------------- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-06-22 18:53:24 +0000 @@ -1,316 +1,382 @@ -jQuery(document).ready(function() { - loadAvailableGroups(); - getDataElementsByGroup(); - getAssignedDataElementGroups(); - - jQuery( "#addDataElementGroupForm" ).dialog({autoOpen:false, modal:true}); - jQuery("#tabs").tabs(); -}); +jQuery( document ).ready( function() +{ + loadAvailableGroups(); + getDataElementsByGroup(); + getAssignedDataElementGroups(); + + jQuery( "#addDataElementGroupForm" ).dialog( { + autoOpen : false, + modal : true + } ); + jQuery( "#tabs" ).tabs(); +} ); function loadAvailableDataElements() { - var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val(); - var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val(); - var list_1 = jQuery( "#view_1 #availableDataElements" ); - var list_2 = jQuery( "#view_2 #availableDataElements2" ); - list_1.empty(); - list_2.empty(); - - for( var id in availableDataElements) - { - var text = availableDataElements[id]; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - list_2.append('' ); - } - } - list_1.find(":first").attr("selected", "selected"); - list_2.find(":first").attr("selected", "selected"); - -} + var filter_1 = jQuery( '#view_1 #availableDataElementsFilter' ).val(); + var filter_2 = jQuery( '#view_2 #availableDataElementsFilter' ).val(); + var list_1 = jQuery( "#view_1 #availableDataElements" ); + var list_2 = jQuery( "#view_2 #availableDataElements2" ); + list_1.empty(); + list_2.empty(); + + for ( var id in availableDataElements ) + { + var text = availableDataElements[id]; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + list_2.append( '' ); + } + } + list_1.find( ":first" ).attr( "selected", "selected" ); + list_2.find( ":first" ).attr( "selected", "selected" ); + +} function loadAvailableGroups() { - var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val(); - var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val(); - var list_1 = jQuery( "#view_1 #dataElementGroups" ); - var list_2 = jQuery( "#view_2 #availableGroups" ); - list_1.empty(); - list_2.empty(); - for( var id in dataElementGroups) - { - var text = dataElementGroups[id]; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - list_2.append('' ); - } - } - sortList( 'dataElementGroups', 'ASC' ); - sortList( 'availableGroups', 'ASC' ); - list_1.find(":first").attr("selected", "selected"); - list_2.find(":first").attr("selected", "selected"); - - var list_3 = jQuery( "#view_2 #assignedGroups").children(); - list_2.children().each( function(i, item ){ - list_3.each( function(k, it ){ - if( it.value == item.value ){ - jQuery( item ).remove(); - } - }); - }); + var filter_1 = jQuery( '#view_1 #dataElementGroupsFilter' ).val(); + var filter_2 = jQuery( '#view_2 #dataElementGroupsFilter' ).val(); + var list_1 = jQuery( "#view_1 #dataElementGroups" ); + var list_2 = jQuery( "#view_2 #availableGroups" ); + list_1.empty(); + list_2.empty(); + for ( var id in dataElementGroups ) + { + var text = dataElementGroups[id]; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + list_2.append( '' ); + } + } + sortList( 'dataElementGroups', 'ASC' ); + sortList( 'availableGroups', 'ASC' ); + list_1.find( ":first" ).attr( "selected", "selected" ); + list_2.find( ":first" ).attr( "selected", "selected" ); + + var list_3 = jQuery( "#view_2 #assignedGroups" ).children(); + list_2.children().each( function( i, item ) + { + list_3.each( function( k, it ) + { + if ( it.value == item.value ) + { + jQuery( item ).remove(); + } + } ); + } ); } function getDataElementsByGroup() { - - loadAvailableDataElements(); - - var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val(); - var list_1 = jQuery( "#view_1 #selectedDataElements" ); - list_1.empty(); - - jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", { - id: jQuery( '#view_1 #dataElementGroups' ).val() - }, function( json ){ - jQuery.each( json.dataElements, function(i, item){ - var text = item.name; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - } - jQuery( "#view_1 #availableDataElements" ).children().each( function(k, it){ - if( item.id == it.value ) - { - jQuery(it).remove(); - } - }); - }); - }); + + loadAvailableDataElements(); + + var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val(); + var list_1 = jQuery( "#view_1 #selectedDataElements" ); + list_1.empty(); + + jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", { + id : jQuery( '#view_1 #dataElementGroups' ).val() + }, function( json ) + { + jQuery.each( json.dataElements, function( i, item ) + { + var text = item.name; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + } + jQuery( "#view_1 #availableDataElements" ).children().each( function( k, it ) + { + if ( item.id == it.value ) + { + jQuery( it ).remove(); + } + } ); + } ); + } ); } function showAddGroup() { - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new); - jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - jQuery.postJSON( "validateDataElementGroup.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "addDataElementGroupEditor.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; - loadAvailableGroups(); - loadAvailableDataElements(); - jQuery( "#view_1 #selectedDataElements" ).empty(); - jQuery( '#addDataElementGroupForm' ).dialog('close'); - } ); - }else{ - markInvalid( "addDataElementGroupForm #name", json.message ); - } - }); - } - }]); - - jQuery( '#addDataElementGroupForm' ).dialog('open'); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'title', i18n_new ); + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + jQuery.postJSON( "validateDataElementGroup.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "addDataElementGroupEditor.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; + loadAvailableGroups(); + loadAvailableDataElements(); + jQuery( "#view_1 #selectedDataElements" ).empty(); + jQuery( '#addDataElementGroupForm' ).dialog( 'close' ); + } ); + } else + { + markInvalid( "addDataElementGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addDataElementGroupForm' ).dialog( 'open' ); } function showAddGroupView2() { - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_new); - jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - jQuery.postJSON( "validateDataElementGroup.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "addDataElementGroupEditor.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; - loadAvailableGroups(); - jQuery( '#addDataElementGroupForm' ).dialog('close'); - } ); - }else{ - markInvalid( "addDataElementGroupForm #name", json.message ); - } - }); - } - }]); - jQuery( '#addDataElementGroupForm' ).dialog('open'); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'title', i18n_new ); + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + jQuery.postJSON( "validateDataElementGroup.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "addDataElementGroupEditor.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; + loadAvailableGroups(); + jQuery( '#addDataElementGroupForm' ).dialog( 'close' ); + } ); + } else + { + markInvalid( "addDataElementGroupForm #name", json.message ); + } + } ); + } + } ] ); + jQuery( '#addDataElementGroupForm' ).dialog( 'open' ); } function showUpdateGroup() { - var id = jQuery( "#view_1 #dataElementGroups" ).val(); - var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text(); - jQuery( '#addDataElementGroupForm #name' ).val( text ); - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - - jQuery.postJSON( "validateDataElementGroup.action", { - id: id, - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "renameDataElementGroupEditor.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }, - id: id - }, function( json ){ - dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; - loadAvailableGroups(); - jQuery( '#addDataElementGroupForm' ).dialog('close'); - showSuccessMessage( i18n_update_success ); - } ); - }else{ - markInvalid( "addDataElementGroupForm #name", json.message ); - } - }); - } - }]); - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename); - jQuery( '#addDataElementGroupForm' ).dialog('open'); + var id = jQuery( "#view_1 #dataElementGroups" ).val(); + var text = jQuery( "#view_1 #dataElementGroups option[value=" + id + "]" ).text(); + jQuery( '#addDataElementGroupForm #name' ).val( text ); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + + jQuery.postJSON( "validateDataElementGroup.action", { + id : id, + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "renameDataElementGroupEditor.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + }, + id : id + }, function( json ) + { + dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; + loadAvailableGroups(); + jQuery( '#addDataElementGroupForm' ).dialog( 'close' ); + showSuccessMessage( i18n_update_success ); + } ); + } else + { + markInvalid( "addDataElementGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'title', i18n_rename ); + jQuery( '#addDataElementGroupForm' ).dialog( 'open' ); } function showUpdateGroup2() { - var id = jQuery( "#view_2 #availableGroups" ).val(); - var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); - jQuery( '#addDataElementGroupForm #name' ).val( text ); - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - - jQuery.postJSON( "validateDataElementGroup.action", { - id: id, - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "renameDataElementGroupEditor.action", { - name: function(){ return jQuery( '#addDataElementGroupForm #name' ).val(); }, - id: id - }, function( json ){ - dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; - loadAvailableGroups(); - jQuery( '#addDataElementGroupForm' ).dialog('close'); - showSuccessMessage( i18n_update_success ); - } ); - }else{ - markInvalid( "addDataElementGroupForm #name", json.message ); - } - }); - } - }]); - - jQuery( '#addDataElementGroupForm' ).dialog('option', 'title', i18n_rename); - jQuery( '#addDataElementGroupForm' ).dialog('open'); + var id = jQuery( "#view_2 #availableGroups" ).val(); + var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); + jQuery( '#addDataElementGroupForm #name' ).val( text ); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + + jQuery.postJSON( "validateDataElementGroup.action", { + id : id, + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "renameDataElementGroupEditor.action", { + name : function() + { + return jQuery( '#addDataElementGroupForm #name' ).val(); + }, + id : id + }, function( json ) + { + dataElementGroups[json.dataElementGroup.id] = json.dataElementGroup.name; + loadAvailableGroups(); + jQuery( '#addDataElementGroupForm' ).dialog( 'close' ); + showSuccessMessage( i18n_update_success ); + } ); + } else + { + markInvalid( "addDataElementGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'title', i18n_rename ); + jQuery( '#addDataElementGroupForm' ).dialog( 'open' ); } function deleteDataElemenGroup() { - if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) + if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) { - var id = jQuery( "#view_1 #dataElementGroups" ).val(); - - jQuery.postJSON( "deleteDataElemenGroupEditor.action",{ - id: id - }, function( json ){ - if( json.response == 'success'){ - dataElementGroups.splice(id, 1); - loadAvailableGroups(); - showSuccessMessage( json.message ); - }else{ - showErrorMessage( json.message ); - } - }); - } + var id = jQuery( "#view_1 #dataElementGroups" ).val(); + + jQuery.postJSON( "deleteDataElemenGroupEditor.action", { + id : id + }, function( json ) + { + if ( json.response == 'success' ) + { + dataElementGroups.splice( id, 1 ); + loadAvailableGroups(); + showSuccessMessage( json.message ); + } else + { + showErrorMessage( json.message ); + } + } ); + } } function deleteDataElemenGroupView2() { - if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) + if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) { - var id = jQuery( "#view_2 #availableGroups" ).val()[0]; - - jQuery.postJSON( "deleteDataElemenGroupEditor.action",{ - id: id - }, function( json ){ - if( json.response == 'success'){ - dataElementGroups.splice(id, 1); - loadAvailableGroups(); - showSuccessMessage( json.message ); - }else{ - showErrorMessage( json.message ); - } - }); - } + var id = jQuery( "#view_2 #availableGroups" ).val()[0]; + + jQuery.postJSON( "deleteDataElemenGroupEditor.action", { + id : id + }, function( json ) + { + if ( json.response == 'success' ) + { + dataElementGroups.splice( id, 1 ); + loadAvailableGroups(); + showSuccessMessage( json.message ); + } else + { + showErrorMessage( json.message ); + } + } ); + } } function updateGroupMembers() { - var id = jQuery( "#view_1 #dataElementGroups" ).val(); - - jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ), - function( json ){ - showSuccessMessage( i18n_update_success ); - }); + var id = jQuery( "#view_1 #dataElementGroups" ).val(); + + jQuery.getJSON( "updateDataElementGroupEditor.action?id=" + id + "&" + + toQueryString( '#view_1 #selectedDataElements', 'groupMembers' ), function( json ) + { + showSuccessMessage( i18n_update_success ); + } ); } function toQueryString( jQueryString, paramName ) { - var p = ""; - jQuery( jQueryString ).children().each(function(i, item ){ - item.selected = "selected"; - p += paramName + "=" + item.value + "&"; - }); - return p; + var p = ""; + jQuery( jQueryString ).children().each( function( i, item ) + { + item.selected = "selected"; + p += paramName + "=" + item.value + "&"; + } ); + return p; } // View 2 function getAssignedDataElementGroups() -{ - loadAvailableGroups(); - - var id = jQuery( "#view_2 #availableDataElements2" ).val(); - var list_2 = jQuery( "#view_2 #assignedGroups" ); - list_2.empty(); - - jQuery.postJSON( "getAssignedDataElementGroups.action", { - dataElementId: id - }, function( json ){ - jQuery.each(json.dataElementGroups, function(i, item ){ - list_2.append('' ); - - jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){ - if( item.id == it.value ) - { - jQuery(it).remove(); - } - }); - - }); - - }); +{ + loadAvailableGroups(); + + var id = jQuery( "#view_2 #availableDataElements2" ).val(); + var list_2 = jQuery( "#view_2 #assignedGroups" ); + list_2.empty(); + + jQuery.postJSON( "getAssignedDataElementGroups.action", { + dataElementId : id + }, function( json ) + { + jQuery.each( json.dataElementGroups, function( i, item ) + { + list_2.append( '' ); + + jQuery( "#view_2 #availableGroups" ).children().each( function( k, it ) + { + if ( item.id == it.value ) + { + jQuery( it ).remove(); + } + } ); + + } ); + + } ); } function assignGroupsForDataElement() { - var dataElementId = jQuery("#view_2 #availableDataElements2").val(); - - jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ), - function( json ){ - showSuccessMessage( i18n_update_success ); - }); + var dataElementId = jQuery( "#view_2 #availableDataElements2" ).val(); + + jQuery.getJSON( "asignGroupsForDataElement.action?dataElementId=" + dataElementId + "&" + + toQueryString( '#view_2 #assignedGroups', 'dataElementGroups' ), function( json ) + { + showSuccessMessage( i18n_update_success ); + } ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.js 2010-11-20 08:23:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,12 +1,13 @@ function beforeSubmit() { - memberValidator = jQuery( "#memberValidator"); - memberValidator.children().remove(); - - jQuery.each( jQuery( "#groupMembers" ).children(), function(i, item){ - item.selected = 'selected'; - memberValidator.append( ''); - }); + memberValidator = jQuery( "#memberValidator" ); + memberValidator.children().remove(); + + jQuery.each( jQuery( "#groupMembers" ).children(), function( i, item ) + { + item.selected = 'selected'; + memberValidator.append( '' ); + } ); } // ----------------------------------------------------------------------------- @@ -14,26 +15,25 @@ // ----------------------------------------------------------------------------- function validateAddDataElementGroupSet() -{ +{ var request = new Request(); request.setResponseTypeXML( 'message' ); - request.setCallbackSuccess( validateAddDataElementGroupSetCompleted ); - request.sendAsPost( "name=" + getFieldValue( "name" ) ); - request.send( "validateDataElementGroupSet.action"); + request.setCallbackSuccess( validateAddDataElementGroupSetCompleted ); + request.sendAsPost( "name=" + getFieldValue( "name" ) ); + request.send( "validateDataElementGroupSet.action" ); } function validateAddDataElementGroupSetCompleted( message ) { - var type = message.getAttribute("type"); - - if( type == "success" ) + var type = message.getAttribute( "type" ); + + if ( type == "success" ) { selectAllById( "groupMembers" ); - document.forms[ 'addDataElementGroupSet' ].submit(); - } - else + document.forms['addDataElementGroupSet'].submit(); + } else { - setMessage(message.firstChild.nodeValue); + setMessage( message.firstChild.nodeValue ); } } @@ -41,8 +41,9 @@ // Delete Data Element Group // ----------------------------------------------------------------------------- -function deleteDataElementGroupSet( groupSetId, groupSetName ){ - +function deleteDataElementGroupSet( groupSetId, groupSetName ) +{ + removeItem( groupSetId, groupSetName, i18n_confirm_delete, "deleteDataElementGroupSet.action" ); } @@ -50,15 +51,17 @@ // Show Data Element Group Set details // ----------------------------------------------------------------------------- -function showDataElementGroupSetDetails( id ){ +function showDataElementGroupSetDetails( id ) +{ var request = new Request(); request.setResponseTypeXML( 'dataElementGroupSet' ); request.setCallbackSuccess( showDetailsCompleted ); - request.send( "../dhis-web-commons-ajax/getDataElementGroupSet.action?id=" + id); + request.send( "../dhis-web-commons-ajax/getDataElementGroupSet.action?id=" + id ); } -function showDetailsCompleted( dataElementGroupSet ){ +function showDetailsCompleted( dataElementGroupSet ) +{ setInnerHTML( 'nameField', getElementValue( dataElementGroupSet, 'name' ) ); setInnerHTML( 'memberCountField', getElementValue( dataElementGroupSet, 'memberCount' ) ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2011-05-13 01:26:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicator.js 2011-06-22 18:53:24 +0000 @@ -1,23 +1,20 @@ - function indicatorTypeChanged() { - var type = byId('indicatorTypeId').options[byId('indicatorTypeId').selectedIndex].getAttribute('number'); - byId('denominatorButton').disabled = eval(type); - if( eval(type) ) - { - setFieldValue('denominator','1'); - } - else - { - if(getFieldValue('denominatorFormula') == undefined ) - { - setFieldValue('denominator',''); - } - else - { - setFieldValue('denominator',getFieldValue('denominatorFormula')); - } - } + var type = byId( 'indicatorTypeId' ).options[byId( 'indicatorTypeId' ).selectedIndex].getAttribute( 'number' ); + byId( 'denominatorButton' ).disabled = eval( type ); + if ( eval( type ) ) + { + setFieldValue( 'denominator', '1' ); + } else + { + if ( getFieldValue( 'denominatorFormula' ) == undefined ) + { + setFieldValue( 'denominator', '' ); + } else + { + setFieldValue( 'denominator', getFieldValue( 'denominatorFormula' ) ); + } + } } // ----------------------------------------------------------------------------- @@ -27,9 +24,9 @@ function criteriaChanged() { var dataDictionaryId = getListValue( "dataDictionaryList" ); - + var url = "indicator.action?&dataDictionaryId=" + dataDictionaryId; - + window.location.href = url; } @@ -48,32 +45,33 @@ function indicatorReceived( indicatorElement ) { setInnerHTML( 'nameField', getElementValue( indicatorElement, 'name' ) ); - + setInnerHTML( 'shortNameField', getElementValue( indicatorElement, 'shortName' ) ); - + var alternativeName = getElementValue( indicatorElement, 'alternativeName' ); setInnerHTML( 'alternativeNameField', alternativeName ? alternativeName : '[' + i18n_none + ']' ); - + var description = getElementValue( indicatorElement, 'description' ); setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' ); - + var annualized = getElementValue( indicatorElement, 'annualized' ); setInnerHTML( 'annualizedField', annualized == "true" ? i18n_yes : i18n_no ); - + setInnerHTML( 'indicatorTypeNameField', getElementValue( indicatorElement, 'indicatorTypeName' ) ); - + var numeratorDescription = getElementValue( indicatorElement, 'numeratorDescription' ); setInnerHTML( 'numeratorDescriptionField', numeratorDescription ? numeratorDescription : '[' + i18n_none + ']' ); var denominatorDescription = getElementValue( indicatorElement, 'denominatorDescription' ); - setInnerHTML( 'denominatorDescriptionField', denominatorDescription ? denominatorDescription : '[' + i18n_none + ']' ); + setInnerHTML( 'denominatorDescriptionField', denominatorDescription ? denominatorDescription : '[' + i18n_none + + ']' ); var url = getElementValue( indicatorElement, 'url' ); setInnerHTML( 'urlField', url ? '' + url + '' : '[' + i18n_none + ']' ); - + var lastUpdated = getElementValue( indicatorElement, 'lastUpdated' ); setInnerHTML( 'lastUpdatedField', lastUpdated ? lastUpdated : '[' + i18n_none + ']' ); - + showDetails(); } @@ -83,5 +81,5 @@ function removeIndicator( indicatorId, indicatorName ) { - removeItem( indicatorId, indicatorName, i18n_confirm_delete, 'removeIndicator.action' ); + removeItem( indicatorId, indicatorName, i18n_confirm_delete, 'removeIndicator.action' ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroup.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroup.js 2010-11-20 08:23:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroup.js 2011-06-22 18:53:24 +0000 @@ -1,4 +1,3 @@ - function showIndicatorGroupDetails( indicatorGroupId ) { var request = new Request(); @@ -21,5 +20,5 @@ function removeIndicatorGroup( indicatorGroupId, indicatorGroupName ) { - removeItem( indicatorGroupId, indicatorGroupName, i18n_confirm_delete, 'removeIndicatorGroup.action' ); + removeItem( indicatorGroupId, indicatorGroupName, i18n_confirm_delete, 'removeIndicatorGroup.action' ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-05-30 09:25:50 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-06-22 18:53:24 +0000 @@ -1,328 +1,395 @@ -jQuery(document).ready(function() { - loadAvailableGroups(); - getIndicatorsByGroup(); - getAssignedIndicatorGroups(); - jQuery( "#addIndicatorGroupForm" ).dialog({autoOpen:false, modal:true}); - jQuery("#tabs").tabs(); -}); +jQuery( document ).ready( function() +{ + loadAvailableGroups(); + getIndicatorsByGroup(); + getAssignedIndicatorGroups(); + jQuery( "#addIndicatorGroupForm" ).dialog( { + autoOpen : false, + modal : true + } ); + jQuery( "#tabs" ).tabs(); +} ); function loadAvailableIndicators() { - var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val(); - var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val(); - var list_1 = jQuery( "#view_1 #availableIndicators" ); - var list_2 = jQuery( "#view_2 #availableIndicators2" ); - list_1.empty(); - list_2.empty(); - - for( var id in availableIndicators) - { - var text = availableIndicators[id]; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - list_2.append('' ); - } - } - - list_1.find(":first").attr("selected", "selected"); - list_2.find(":first").attr("selected", "selected"); - + var filter_1 = jQuery( '#view_1 #availableIndicatorsFilter' ).val(); + var filter_2 = jQuery( '#view_2 #availableIndicatorsFilter' ).val(); + var list_1 = jQuery( "#view_1 #availableIndicators" ); + var list_2 = jQuery( "#view_2 #availableIndicators2" ); + list_1.empty(); + list_2.empty(); + + for ( var id in availableIndicators ) + { + var text = availableIndicators[id]; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + list_2.append( '' ); + } + } + + list_1.find( ":first" ).attr( "selected", "selected" ); + list_2.find( ":first" ).attr( "selected", "selected" ); + } function loadAvailableGroups() { - var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val(); - var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val(); - var list_1 = jQuery( "#view_1 #indicatorGroups" ); - var list_2 = jQuery( "#view_2 #availableGroups" ); - list_1.empty(); - list_2.empty(); - for( var id in indicatorGroups) - { - var text = indicatorGroups[id]; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - list_2.append('' ); - } - } - - sortList( 'indicatorGroups', 'ASC' ); - sortList( 'availableGroups', 'ASC' ); - list_1.find(":first").attr("selected", "selected"); - list_2.find(":first").attr("selected", "selected"); - - var list_3 = jQuery( "#view_2 #assignedGroups").children(); - list_2.children().each( function(i, item ){ - list_3.each( function(k, it ){ - if( it.value == item.value ){ - jQuery( item ).remove(); - } - }); - }); + var filter_1 = jQuery( '#view_1 #indicatorGroupsFilter' ).val(); + var filter_2 = jQuery( '#view_2 #indicatorGroupsFilter' ).val(); + var list_1 = jQuery( "#view_1 #indicatorGroups" ); + var list_2 = jQuery( "#view_2 #availableGroups" ); + list_1.empty(); + list_2.empty(); + for ( var id in indicatorGroups ) + { + var text = indicatorGroups[id]; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + list_2.append( '' ); + } + } + + sortList( 'indicatorGroups', 'ASC' ); + sortList( 'availableGroups', 'ASC' ); + list_1.find( ":first" ).attr( "selected", "selected" ); + list_2.find( ":first" ).attr( "selected", "selected" ); + + var list_3 = jQuery( "#view_2 #assignedGroups" ).children(); + list_2.children().each( function( i, item ) + { + list_3.each( function( k, it ) + { + if ( it.value == item.value ) + { + jQuery( item ).remove(); + } + } ); + } ); } function getIndicatorsByGroup() { - - loadAvailableIndicators(); - - var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val(); - var list_1 = jQuery( "#view_1 #selectedIndicators" ); - list_1.empty(); - - jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", { - id: jQuery( '#view_1 #indicatorGroups' ).val() - }, function( json ){ - jQuery.each( json.indicators, function(i, item){ - var text = item.name; - if( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1) - { - list_1.append('' ); - } - jQuery( "#view_1 #availableIndicators" ).children().each( function(k, it){ - if( item.id == it.value ) - { - jQuery(it).remove(); - } - }); - }); - }); + + loadAvailableIndicators(); + + var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val(); + var list_1 = jQuery( "#view_1 #selectedIndicators" ); + list_1.empty(); + + jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", { + id : jQuery( '#view_1 #indicatorGroups' ).val() + }, function( json ) + { + jQuery.each( json.indicators, function( i, item ) + { + var text = item.name; + if ( text.toLowerCase().indexOf( filter_1.toLowerCase() ) != -1 ) + { + list_1.append( '' ); + } + jQuery( "#view_1 #availableIndicators" ).children().each( function( k, it ) + { + if ( item.id == it.value ) + { + jQuery( it ).remove(); + } + } ); + } ); + } ); } function showAddGroup() { - - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new); - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - jQuery.postJSON( "validateIndicatorGroup.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "addIndicatorGroupEditor.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name; - loadAvailableGroups(); - loadAvailableIndicators(); - - jQuery( "#view_1 #selectedIndicators" ).empty(); - jQuery( '#addIndicatorGroupForm' ).dialog('close'); - } ); - }else{ - markInvalid( "addIndicatorGroupForm #name", json.message ); - } - }); - } - }]); - jQuery( '#addIndicatorGroupForm' ).dialog('open'); - + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'title', i18n_new ); + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + jQuery.postJSON( "validateIndicatorGroup.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "addIndicatorGroupEditor.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name; + loadAvailableGroups(); + loadAvailableIndicators(); + + jQuery( "#view_1 #selectedIndicators" ).empty(); + jQuery( '#addIndicatorGroupForm' ).dialog( 'close' ); + } ); + } else + { + markInvalid( "addIndicatorGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addIndicatorGroupForm' ).dialog( 'open' ); + } function showUpdateGroup() { - var id = jQuery( "#view_1 #indicatorGroups" ).val(); - var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text(); - jQuery( '#addIndicatorGroupForm #name' ).val( text ); - - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - - jQuery.postJSON( "validateIndicatorGroup.action", { - id: id, - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "renameIndicatorGroupEditor.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }, - id: id - }, function( json ){ - indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val(); - loadAvailableGroups(); - jQuery( '#addIndicatorGroupForm' ).dialog('close'); - showSuccessMessage( i18n_update_success ); - } ); - }else{ - markInvalid( "addIndicatorGroupForm #name", json.message ); - } - }); - } - }]); - - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename); - jQuery( '#addIndicatorGroupForm' ).dialog('open'); - + var id = jQuery( "#view_1 #indicatorGroups" ).val(); + var text = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text(); + jQuery( '#addIndicatorGroupForm #name' ).val( text ); + + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + + jQuery.postJSON( "validateIndicatorGroup.action", { + id : id, + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "renameIndicatorGroupEditor.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + }, + id : id + }, function( json ) + { + indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val(); + loadAvailableGroups(); + jQuery( '#addIndicatorGroupForm' ).dialog( 'close' ); + showSuccessMessage( i18n_update_success ); + } ); + } else + { + markInvalid( "addIndicatorGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'title', i18n_rename ); + jQuery( '#addIndicatorGroupForm' ).dialog( 'open' ); + } function deleteIndicatorGroup() { - var id = jQuery( "#view_1 #indicatorGroups" ).val(); - var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text(); - - if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) + var id = jQuery( "#view_1 #indicatorGroups" ).val(); + var name = jQuery( "#view_1 #indicatorGroups option[value=" + id + "]" ).text(); + + if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) { - - jQuery.postJSON( "deleteIndicatorGroupEditor.action",{ - id: id - }, function( json ){ - if( json.response == 'success'){ - indicatorGroups.splice(id, 1); - loadAvailableGroups(); - showSuccessMessage( json.message ); - }else{ - showErrorMessage( json.message ); - } - }); - } + + jQuery.postJSON( "deleteIndicatorGroupEditor.action", { + id : id + }, function( json ) + { + if ( json.response == 'success' ) + { + indicatorGroups.splice( id, 1 ); + loadAvailableGroups(); + showSuccessMessage( json.message ); + } else + { + showErrorMessage( json.message ); + } + } ); + } } function updateGroupMembers() { - var id = jQuery( "#view_1 #indicatorGroups" ).val(); - - jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ), - function( json ){ - showSuccessMessage( i18n_update_success ); - }); + var id = jQuery( "#view_1 #indicatorGroups" ).val(); + + jQuery.getJSON( "updateIndicatorGroupEditor.action?id=" + id + "&" + + toQueryString( '#view_1 #selectedIndicators', 'groupMembers' ), function( json ) + { + showSuccessMessage( i18n_update_success ); + } ); } function toQueryString( jQueryString, paramName ) { - var p = ""; - jQuery( jQueryString ).children().each(function(i, item ){ - item.selected = "selected"; - p += paramName + "=" + item.value + "&"; - }); - return p; + var p = ""; + jQuery( jQueryString ).children().each( function( i, item ) + { + item.selected = "selected"; + p += paramName + "=" + item.value + "&"; + } ); + return p; } // View2 function getAssignedIndicatorGroups() { - loadAvailableGroups(); - - var id = jQuery( "#view_2 #availableIndicators2" ).val(); - var list_2 = jQuery( "#view_2 #assignedGroups" ); - list_2.empty(); - - jQuery.postJSON( "getAssignedIndicatorGroups.action", { - indicatorId: id - }, function( json ){ - - var availabelGroups_2 = jQuery( "#view_2 #availableGroups" ); - availabelGroups_2.empty(); - for(var index in indicatorGroups) - { - availabelGroups_2.append( ''); - } - - jQuery.each(json.indicatorGroups, function(i, item ){ - list_2.append('' ); - - jQuery( "#view_2 #availableGroups" ).children().each( function(k, it){ - if( item.id == it.value ) - { - jQuery(it).remove(); - } - }); - - }); - - }); + loadAvailableGroups(); + + var id = jQuery( "#view_2 #availableIndicators2" ).val(); + var list_2 = jQuery( "#view_2 #assignedGroups" ); + list_2.empty(); + + jQuery.postJSON( "getAssignedIndicatorGroups.action", { + indicatorId : id + }, function( json ) + { + + var availabelGroups_2 = jQuery( "#view_2 #availableGroups" ); + availabelGroups_2.empty(); + for ( var index in indicatorGroups ) + { + availabelGroups_2.append( '' ); + } + + jQuery.each( json.indicatorGroups, function( i, item ) + { + list_2.append( '' ); + + jQuery( "#view_2 #availableGroups" ).children().each( function( k, it ) + { + if ( item.id == it.value ) + { + jQuery( it ).remove(); + } + } ); + + } ); + + } ); } function showAddGroup2() { - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_new); - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - jQuery.postJSON( "validateIndicatorGroup.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "addIndicatorGroupEditor.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name; - loadAvailableGroups(); - jQuery( '#addIndicatorGroupForm' ).dialog('close'); - } ); - }else{ - markInvalid( "addIndicatorGroupForm #name", json.message ); - } - }); - } - }]); - jQuery( '#addIndicatorGroupForm' ).dialog('open'); + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'title', i18n_new ); + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + jQuery.postJSON( "validateIndicatorGroup.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "addIndicatorGroupEditor.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + indicatorGroups[json.indicatorGroup.id] = json.indicatorGroup.name; + loadAvailableGroups(); + jQuery( '#addIndicatorGroupForm' ).dialog( 'close' ); + } ); + } else + { + markInvalid( "addIndicatorGroupForm #name", json.message ); + } + } ); + } + } ] ); + jQuery( '#addIndicatorGroupForm' ).dialog( 'open' ); } function showUpdateGroup2() { - var id = jQuery( "#view_2 #availableGroups" ).val()[0]; - var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); - jQuery( '#addIndicatorGroupForm #name' ).val( text ); - - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'buttons', [{ - text: i18n_save, - click: function(){ - jQuery.postJSON( "validateIndicatorGroup.action", { - id: id, - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); } - }, function( json ){ - if( json.response == 'success' ){ - jQuery.postJSON( "renameIndicatorGroupEditor.action", { - name: function(){ return jQuery( '#addIndicatorGroupForm #name' ).val(); }, - id: id - }, function( json ){ - indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val(); - loadAvailableGroups(); - jQuery( '#addIndicatorGroupForm' ).dialog('close'); - showSuccessMessage( i18n_update_success ); - } ); - }else{ - markInvalid( "addIndicatorGroupForm #name", json.message ); - } - }); - } - }]); - - jQuery( '#addIndicatorGroupForm' ).dialog('option', 'title', i18n_rename); - jQuery( '#addIndicatorGroupForm' ).dialog('open'); + var id = jQuery( "#view_2 #availableGroups" ).val()[0]; + var text = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); + jQuery( '#addIndicatorGroupForm #name' ).val( text ); + + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'buttons', [ { + text : i18n_save, + click : function() + { + jQuery.postJSON( "validateIndicatorGroup.action", { + id : id, + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + } + }, function( json ) + { + if ( json.response == 'success' ) + { + jQuery.postJSON( "renameIndicatorGroupEditor.action", { + name : function() + { + return jQuery( '#addIndicatorGroupForm #name' ).val(); + }, + id : id + }, function( json ) + { + indicatorGroups[id] = jQuery( '#addIndicatorGroupForm #name' ).val(); + loadAvailableGroups(); + jQuery( '#addIndicatorGroupForm' ).dialog( 'close' ); + showSuccessMessage( i18n_update_success ); + } ); + } else + { + markInvalid( "addIndicatorGroupForm #name", json.message ); + } + } ); + } + } ] ); + + jQuery( '#addIndicatorGroupForm' ).dialog( 'option', 'title', i18n_rename ); + jQuery( '#addIndicatorGroupForm' ).dialog( 'open' ); } function deleteIndicatorGroup2() { - var id = jQuery( "#view_2 #availableGroups" ).val()[0]; - var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); - - if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) + var id = jQuery( "#view_2 #availableGroups" ).val()[0]; + var name = jQuery( "#view_2 #availableGroups option[value=" + id + "]" ).text(); + + if ( window.confirm( i18n_confirm_delete + '\n\n' + name ) ) { - - jQuery.postJSON( "deleteIndicatorGroupEditor.action",{ - id: id - }, function( json ){ - if( json.response == 'success'){ - indicatorGroups.splice(id, 1); - loadAvailableGroups(); - showSuccessMessage( json.message ); - }else{ - showErrorMessage( json.message ); - } - }); - } + + jQuery.postJSON( "deleteIndicatorGroupEditor.action", { + id : id + }, function( json ) + { + if ( json.response == 'success' ) + { + indicatorGroups.splice( id, 1 ); + loadAvailableGroups(); + showSuccessMessage( json.message ); + } else + { + showErrorMessage( json.message ); + } + } ); + } } function assignGroupsForIndicator() { - var id = jQuery( "#view_2 #availableIndicators2" ).val(); - - jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ), - function( json ){ - showSuccessMessage( i18n_update_success ); - }); + var id = jQuery( "#view_2 #availableIndicators2" ).val(); + + jQuery.getJSON( "asignGroupsForIndicator.action?indicatorId=" + id + "&" + + toQueryString( '#view_2 #assignedGroups', 'indicatorGroups' ), function( json ) + { + showSuccessMessage( i18n_update_success ); + } ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupSet.js 2010-11-20 08:23:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,20 +1,19 @@ - // ----------------------------------------------------------------------------- // Show Data Element Group Set details // ----------------------------------------------------------------------------- -function showIndicatorGroupSetDetails( id ){ - - var request = new Request(); +function showIndicatorGroupSetDetails( id ) +{ + var request = new Request(); request.setResponseTypeXML( 'indicatorGroupSet' ); request.setCallbackSuccess( showDetailsCompleted ); - request.sendAsPost( "id=" + id ); - request.send( "../dhis-web-commons-ajax/getIndicatorGroupSet.action" ); + request.sendAsPost( "id=" + id ); + request.send( "../dhis-web-commons-ajax/getIndicatorGroupSet.action" ); } -function showDetailsCompleted( indicatorGroupSet ){ - - setInnerHTML( 'nameField', getElementValue( indicatorGroupSet, 'name' ) ); +function showDetailsCompleted( indicatorGroupSet ) +{ + setInnerHTML( 'nameField', getElementValue( indicatorGroupSet, 'name' ) ); setInnerHTML( 'memberCountField', getElementValue( indicatorGroupSet, 'memberCount' ) ); showDetails(); @@ -24,7 +23,7 @@ // Delete Indicator Group Set // ----------------------------------------------------------------------------- -function deleteIndicatorGroupSet( groupSetId, groupSetName ){ - - removeItem( groupSetId, groupSetName, i18n_confirm_delete, "deleteIndicatorGroupSet.action" ); +function deleteIndicatorGroupSet( groupSetId, groupSetName ) +{ + removeItem( groupSetId, groupSetName, i18n_confirm_delete, "deleteIndicatorGroupSet.action" ); } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/optionCombinationList.js 2011-06-22 18:53:24 +0000 @@ -1,50 +1,57 @@ var selectedList; var availableList; -function move(listId) { - - var fromList = document.getElementById(listId); - - if (fromList.selectedIndex == -1) { - return; - } - - if (!availableList) { - availableList = document.getElementById('availableList'); - } - - if (!selectedList) { - selectedList = document.getElementById('selectedList'); - } - - var toList = (fromList == availableList ? selectedList : availableList); - - while (fromList.selectedIndex > -1) { - option = fromList.options.item(fromList.selectedIndex); - fromList.remove(fromList.selectedIndex); - toList.add(option, null); - } -} - -function submitForm() { - - if (!availableList) { - availableList = document.getElementById('availableList'); - } - - if (!selectedList) { - selectedList = document.getElementById('selectedList'); - } - - // selectAll(availableList); - selectAll(selectedList); - - return false; -} - -function selectAll(list) { - - for ( var i = 0, option; option = list.options.item(i); i++) { - option.selected = true; - } +function move( listId ) +{ + var fromList = document.getElementById( listId ); + + if ( fromList.selectedIndex == -1 ) + { + return; + } + + if ( !availableList ) + { + availableList = document.getElementById( 'availableList' ); + } + + if ( !selectedList ) + { + selectedList = document.getElementById( 'selectedList' ); + } + + var toList = ( fromList == availableList ? selectedList : availableList ); + + while ( fromList.selectedIndex > -1 ) + { + option = fromList.options.item( fromList.selectedIndex ); + fromList.remove( fromList.selectedIndex ); + toList.add( option, null ); + } +} + +function submitForm() +{ + if ( !availableList ) + { + availableList = document.getElementById( 'availableList' ); + } + + if ( !selectedList ) + { + selectedList = document.getElementById( 'selectedList' ); + } + + // selectAll(availableList); + selectAll( selectedList ); + + return false; +} + +function selectAll( list ) +{ + for ( var i = 0, option; option = list.options.item( i ); i++ ) + { + option.selected = true; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/selectedOptionList.js 2011-06-22 18:53:24 +0000 @@ -1,28 +1,33 @@ var selectedList; -function addToSelectedList(srcListId) { - - selectedList = document.getElementById('selectedList'); - srcList = document.getElementById(srcListId); - - option = srcList.options.item(srcList.selectedIndex); - selectedList.add(option, null); -} - -function submitForm() { - - if (!selectedList) { - selectedList = document.getElementById('selectedList'); - } - - // selectAll(availableList); - selectAll(selectedList); - - return false; -} - -function selectAll(list) { - for ( var i = 0, option; option = list.options.item(i); i++) { - option.selected = true; - } +function addToSelectedList( srcListId ) +{ + + selectedList = document.getElementById( 'selectedList' ); + srcList = document.getElementById( srcListId ); + + option = srcList.options.item( srcList.selectedIndex ); + selectedList.add( option, null ); +} + +function submitForm() +{ + + if ( !selectedList ) + { + selectedList = document.getElementById( 'selectedList' ); + } + + // selectAll(availableList); + selectAll( selectedList ); + + return false; +} + +function selectAll( list ) +{ + for ( var i = 0, option; option = list.options.item( i ); i++ ) + { + option.selected = true; + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/shortName.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/shortName.js 2009-03-03 16:46:36 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/shortName.js 2011-06-22 18:53:24 +0000 @@ -1,4 +1,3 @@ - // ----------------------------------------------------------------------------- // $Id: shortName.js 1251 2006-01-31 06:43:27Z torgeilo $ // ----------------------------------------------------------------------------- @@ -8,14 +7,12 @@ var nameField = document.getElementById( 'name' ); var shortNameField = document.getElementById( 'shortName' ); var maxLength = parseInt( shortNameField.maxLength ); - - if ( previousName != nameField.value - && nameField.value.length <= maxLength - && ( shortNameField.value == previousName - || shortNameField.value.length == 0 )) + + if ( previousName != nameField.value && nameField.value.length <= maxLength + && ( shortNameField.value == previousName || shortNameField.value.length == 0 ) ) { - shortNameField.value = nameField.value; + shortNameField.value = nameField.value; } - + previousName = nameField.value; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataDictionaryForm.js 2011-06-22 18:53:24 +0000 @@ -1,9 +1,14 @@ -jQuery(document).ready( function(){ - validation2( 'updateDataDictionaryForm', function( form ){ form.submit()}, { - 'beforeValidateHandler': function(){ - listValidator( 'memberValidator', 'selectedDataElements' ); - listValidator( 'memberValidatorIn', 'selectedIndicators' ); - }, - 'rules': getValidationRules("dataDictionary") - }); -}); +jQuery( document ).ready( function() +{ + validation2( 'updateDataDictionaryForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'selectedDataElements' ); + listValidator( 'memberValidatorIn', 'selectedIndicators' ); + }, + 'rules' : getValidationRules( "dataDictionary" ) + } ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupForm.js 2011-06-22 18:53:24 +0000 @@ -1,12 +1,14 @@ -jQuery(document).ready(function() { - validation2('updateDataElementGroupForm', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : beforeSubmit, - 'rules' : getValidationRules("dataElementGroup") - }); +jQuery( document ).ready( function() +{ + validation2( 'updateDataElementGroupForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : beforeSubmit, + 'rules' : getValidationRules( "dataElementGroup" ) + } ); - checkValueIsExist("name", "validateDataElementGroup.action", { - id : getFieldValue('id') - }); -}); + checkValueIsExist( "name", "validateDataElementGroup.action", { + id : getFieldValue( 'id' ) + } ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateDataElementGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,16 +1,18 @@ -jQuery(document).ready(function() { - validation2('updateDataElementGroupSet', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : beforeSubmit, - 'rules' : getValidationRules("dataElementGroupSet") - }); - - checkValueIsExist("name", "validateDataElementGroupSet.action", { - id : getFieldValue('id') - }); - - var nameField = document.getElementById('name'); - nameField.select(); - nameField.focus(); -}); +jQuery( document ).ready( function() +{ + validation2( 'updateDataElementGroupSet', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : beforeSubmit, + 'rules' : getValidationRules( "dataElementGroupSet" ) + } ); + + checkValueIsExist( "name", "validateDataElementGroupSet.action", { + id : getFieldValue( 'id' ) + } ); + + var nameField = document.getElementById( 'name' ); + nameField.select(); + nameField.focus(); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorForm.js 2011-06-22 18:53:24 +0000 @@ -1,20 +1,22 @@ -jQuery(document).ready(function() { - validation2('updateIndicatorForm', function(form) { - form.submit(); - }, { - 'rules' : getValidationRules("indicator") - }); +jQuery( document ).ready( function() +{ + validation2( 'updateIndicatorForm', function( form ) + { + form.submit(); + }, { + 'rules' : getValidationRules( "indicator" ) + } ); - checkValueIsExist("name", "validateIndicator.action", { - id : getFieldValue('id') - }); - checkValueIsExist("shortName", "validateIndicator.action", { - id : getFieldValue('id') - }); - checkValueIsExist("alternativeName", "validateIndicator.action", { - id : getFieldValue('id') - }); - checkValueIsExist("code", "validateIndicator.action", { - id : getFieldValue('id') - }); -}); + checkValueIsExist( "name", "validateIndicator.action", { + id : getFieldValue( 'id' ) + } ); + checkValueIsExist( "shortName", "validateIndicator.action", { + id : getFieldValue( 'id' ) + } ); + checkValueIsExist( "alternativeName", "validateIndicator.action", { + id : getFieldValue( 'id' ) + } ); + checkValueIsExist( "code", "validateIndicator.action", { + id : getFieldValue( 'id' ) + } ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupForm.js 2011-06-22 18:53:24 +0000 @@ -1,10 +1,13 @@ -jQuery(document).ready(function() { - validation2('updateIndicatorGroupForm', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : function() { - listValidator('memberValidator', 'groupMembers'); - }, - 'rules' : getValidationRules("indicatorGroup") - }); -}); +jQuery( document ).ready( function() +{ + validation2( 'updateIndicatorGroupForm', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'groupMembers' ); + }, + 'rules' : getValidationRules( "indicatorGroup" ) + } ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorGroupSet.js 2011-06-22 18:53:24 +0000 @@ -1,10 +1,13 @@ -jQuery(document).ready(function() { - validation2('updateIndicatorGroupSet', function(form) { - form.submit() - }, { - 'beforeValidateHandler' : function() { - listValidator('memberValidator', 'groupMembers'); - }, - 'rules' : getValidationRules("indicatorGroupSet") - }); -}); +jQuery( document ).ready( function() +{ + validation2( 'updateIndicatorGroupSet', function( form ) + { + form.submit() + }, { + 'beforeValidateHandler' : function() + { + listValidator( 'memberValidator', 'groupMembers' ); + }, + 'rules' : getValidationRules( "indicatorGroupSet" ) + } ); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js 2011-04-11 13:46:07 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateIndicatorTypeForm.js 2011-06-22 18:53:24 +0000 @@ -1,11 +1,13 @@ -jQuery(document).ready(function() { - validation2('updateIndicatorTypeForm', function(form) { - form.submit() - }, { - 'rules' : getValidationRules("indicatorType") - }); +jQuery( document ).ready( function() +{ + validation2( 'updateIndicatorTypeForm', function( form ) + { + form.submit() + }, { + 'rules' : getValidationRules( "indicatorType" ) + } ); - var nameField = document.getElementById('name'); - nameField.select(); - nameField.focus(); -}); + var nameField = document.getElementById( 'name' ); + nameField.select(); + nameField.focus(); +} ); === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js 2009-12-04 14:09:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/updateLoad.js 2011-06-22 18:53:24 +0000 @@ -1,14 +1,13 @@ +window.onload = function() +{ + var container = byId( 'selectedDataElements' ); -window.onload = function () -{ - var container = byId('selectedDataElements'); - - if ( container != null ) - { - var buttons = container.getElementsByTagName('button'); - for ( var i = 0, button; button = buttons[i]; i++ ) - { - button.onclick = removeCDEDataElement; - } - } + if ( container != null ) + { + var buttons = container.getElementsByTagName( 'button' ); + for ( var i = 0, button; button = buttons[i]; i++ ) + { + button.onclick = removeCDEDataElement; + } + } } \ No newline at end of file