=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm 2013-06-29 14:16:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregation.vm 2013-12-06 11:18:39 +0000 @@ -1,5 +1,23 @@ + +

$i18n.getString( 'patient_aggregation_query_builder_management' ) #openHelp( "patient_aggregation_query_builder" )

+
+ +
+ - - +
@@ -17,8 +35,8 @@
$i18n.getString( "filter_by_name" ) + $i18n.getString( "filter_by_name" ) @@ -29,33 +47,29 @@ - - #parse( "/dhis-web-maintenance-patient/caseAggregationList.vm" ) - -
$i18n.getString( "name" )$i18n.getString( "operations" )
+
+ - -
-
+
+
$i18n.getString( 'hide_details' )
-


-


-


+


+


+



-


-


+


+


- === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationList.vm 2013-07-05 07:05:20 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/caseAggregationList.vm 2013-12-06 11:18:39 +0000 @@ -1,13 +1,10 @@ -#set($mark=false) + #foreach( $aggregationCondition in $aggregationConditions ) - - $encoder.htmlEncode( $aggregationCondition.displayName ) - - $i18n.getString( 'edit' ) - $i18n.getString( 'translation_translate' ) - $i18n.getString( 'remove' ) - $i18n.getString( 'show_details' ) - + + $encoder.htmlEncode( $!aggregationCondition.displayName ) - #set($mark=!$mark) -#end \ No newline at end of file +#end === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-10-18 07:49:40 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/caseaggregation.js 2013-12-06 11:18:39 +0000 @@ -1,552 +1,502 @@ - //------------------------------------------------------------------------------ // Get dataelements by dataset //------------------------------------------------------------------------------ -function getDataElementsByDataset() -{ - var dataSets = document.getElementById( 'dataSets' ); - var dataSetId = dataSets.options[ dataSets.selectedIndex ].value; - setFieldValue('aggregationDataElementId',''); - setFieldValue('aggregationDataElementInput',''); - - if( dataSetId == "" ){ - disable( 'dataElementsButton' ); - setFieldValue( 'aggregationDataElementInput',''); - return; - } - autoCompletedField(); +function getDataElementsByDataset() { + var dataSets = document.getElementById('dataSets'); + var dataSetId = dataSets.options[ dataSets.selectedIndex ].value; + setFieldValue('aggregationDataElementId', ''); + setFieldValue('aggregationDataElementInput', ''); + + if( dataSetId == "" ) { + disable('dataElementsButton'); + setFieldValue('aggregationDataElementInput', ''); + return; + } + autoCompletedField(); } -function autoCompletedField() -{ - $( "#dataElementsButton" ).unbind('click'); - enable( 'dataElementsButton' ); - - var input = jQuery( "#aggregationDataElementInput" ) - .autocomplete({ - delay: 0, - minLength: 0, - source: function( request, response ){ - $.ajax({ - url: "getDataElementsByDataset.action?id=" + getFieldValue('dataSets') + "&query=" + input.val(), - dataType: "json", - success: function(data) { - response($.map(data.dataElements, function(item) { - return { - label: item.name, - id: item.id - }; - })); - } - }); - }, - select: function( event, ui ) { - input.val(ui.item.value); - setFieldValue('aggregationDataElementId',ui.item.id); - input.autocomplete( "close" ); - }, - change: function( event, ui ) { - if ( !ui.item ) { - var matcher = new RegExp( "^" + $.ui.autocomplete.escapeRegex( $(this).val() ) + "$", "i" ), - valid = false; - select.children( "option" ).each(function() { - if ( $( this ).text().match( matcher ) ) { - this.selected = valid = true; - return false; - } - }); - if ( !valid ) { - // remove invalid value, as it didn't match anything - $( this ).val( "" ); - select.val( "" ); - input.data( "autocomplete" ).term = ""; - return false; - } - } - } - }).addClass( "ui-widget" ); - - input.data( "autocomplete" )._renderItem = function( ul, item ) { - return $( "
  • " ) - .data( "item.autocomplete", item ) - .append( "" + item.label + "" ) - .appendTo( ul ); - }; - - var wrapper = this.wrapper = $( "" ) - .addClass( "ui-combobox" ) - .insertAfter( input ); - - var button = $( "#dataElementsButton" ) - .attr( "tabIndex", -1 ) - .attr( "title", i18n_show_all_items ) - .appendTo( wrapper ) - .button({ - icons: { - primary: "ui-icon-triangle-1-s" - }, - text: false - }) - .click(function() { - // close if already visible - if ( input.autocomplete( "widget" ).is( ":visible" ) ) { - input.autocomplete( "close" ); - return; - } - // work around a bug (likely same cause as #5265) - $( this ).blur(); - // pass empty string as value to search for, displaying all results - input.autocomplete( "search", "" ); - input.focus(); - }); +function autoCompletedField() { + $("#dataElementsButton").unbind('click'); + enable('dataElementsButton'); + + var input = jQuery("#aggregationDataElementInput") + .autocomplete({ + delay: 0, + minLength: 0, + source: function( request, response ) { + $.ajax({ + url: "getDataElementsByDataset.action?id=" + getFieldValue('dataSets') + "&query=" + input.val(), + dataType: "json", + success: function( data ) { + response($.map(data.dataElements, function( item ) { + return { + label: item.name, + id: item.id + }; + })); + } + }); + }, + select: function( event, ui ) { + input.val(ui.item.value); + setFieldValue('aggregationDataElementId', ui.item.id); + input.autocomplete("close"); + }, + change: function( event, ui ) { + if( !ui.item ) { + var matcher = new RegExp("^" + $.ui.autocomplete.escapeRegex($(this).val()) + "$", "i"), + valid = false; + select.children("option").each(function() { + if( $(this).text().match(matcher) ) { + this.selected = valid = true; + return false; + } + }); + if( !valid ) { + // remove invalid value, as it didn't match anything + $(this).val(""); + select.val(""); + input.data("autocomplete").term = ""; + return false; + } + } + } + }).addClass("ui-widget"); + + input.data("autocomplete")._renderItem = function( ul, item ) { + return $("
  • ") + .data("item.autocomplete", item) + .append("" + item.label + "") + .appendTo(ul); + }; + + var wrapper = this.wrapper = $("") + .addClass("ui-combobox") + .insertAfter(input); + + var button = $("#dataElementsButton") + .attr("tabIndex", -1) + .attr("title", i18n_show_all_items) + .appendTo(wrapper) + .button({ + icons: { + primary: "ui-icon-triangle-1-s" + }, + text: false + }) + .click(function() { + // close if already visible + if( input.autocomplete("widget").is(":visible") ) { + input.autocomplete("close"); + return; + } + // work around a bug (likely same cause as #5265) + $(this).blur(); + // pass empty string as value to search for, displaying all results + input.autocomplete("search", ""); + input.focus(); + }); } //------------------------------------------------------------------------------ // Get Program Stages //------------------------------------------------------------------------------ -function getParams() -{ - clearListById( 'programStageId' ); - clearListById( 'dataElements' ); - clearListById('caseProperty'); - var programId = getFieldValue( 'programId' ); - if( programId == ''){ - var caseProperty = jQuery( '#caseProperty' ); - caseProperty.append( '' ); - caseProperty.append( '' ); - caseProperty.append( '' ); - caseProperty.append( '' ); - - disable('programProperty'); - disable('programStageProperty'); - } - - if(jQuery('#programId option:selected').attr('programType')==3){ - jQuery("[name=multiProgram]").remove(); - if( jQuery("[value=times]").attr('checked')!=undefined - && jQuery("[value=times]").attr('checked')!='true' ) - { - jQuery("[value=times]").attr('checked',true); - } - } - - jQuery.getJSON( 'getParamsByProgram.action',{ programId:programId } - ,function( json ) - { - enable('programProperty'); - var programstage = jQuery('#programStageId'); - - for ( i in json.programStages ) - { - var id = json.programStages[i].id; - var formularId = "[PS:" + id + "]"; - var name = json.programStages[i].name; - - programstage.append( "" ); - } - - if( json.programStages.length > 1 ) - { - programstage.prepend( "" ); - } - byId('programStageId').options[0].selected = true; - getPatientDataElements(); - - clearListById( 'caseProperty' ); - var type = jQuery('#programId option:selected').attr('programType'); - if( type!='3') - { - var caseProperty = jQuery( '#caseProperty' ); - for ( i in json.fixedAttributes ) - { - var id = json.fixedAttributes[i].id; - var name = json.fixedAttributes[i].name; - - caseProperty.append( "" ); - } - - for ( i in json.patientAttributes ) - { - var id = json.patientAttributes[i].id; - var name = json.patientAttributes[i].name; - var suggested = json.patientAttributes[i].suggested; - - caseProperty.append( "" ); - } - } - }); +function getParams() { + clearListById('programStageId'); + clearListById('dataElements'); + clearListById('caseProperty'); + var programId = getFieldValue('programId'); + if( programId == '' ) { + var caseProperty = jQuery('#caseProperty'); + caseProperty.append(''); + caseProperty.append(''); + caseProperty.append(''); + caseProperty.append(''); + + disable('programProperty'); + disable('programStageProperty'); + } + + if( jQuery('#programId option:selected').attr('programType') == 3 ) { + jQuery("[name=multiProgram]").remove(); + if( jQuery("[value=times]").attr('checked') != undefined + && jQuery("[value=times]").attr('checked') != 'true' ) { + jQuery("[value=times]").attr('checked', true); + } + } + + jQuery.getJSON('getParamsByProgram.action', { programId: programId } + , function( json ) { + enable('programProperty'); + var programstage = jQuery('#programStageId'); + + for( i in json.programStages ) { + var id = json.programStages[i].id; + var formularId = "[PS:" + id + "]"; + var name = json.programStages[i].name; + + programstage.append(""); + } + + if( json.programStages.length > 1 ) { + programstage.prepend(""); + } + byId('programStageId').options[0].selected = true; + getPatientDataElements(); + + clearListById('caseProperty'); + var type = jQuery('#programId option:selected').attr('programType'); + if( type != '3' ) { + var caseProperty = jQuery('#caseProperty'); + for( i in json.fixedAttributes ) { + var id = json.fixedAttributes[i].id; + var name = json.fixedAttributes[i].name; + + caseProperty.append(""); + } + + for( i in json.patientAttributes ) { + var id = json.patientAttributes[i].id; + var name = json.patientAttributes[i].name; + var suggested = json.patientAttributes[i].suggested; + + caseProperty.append(""); + } + } + }); } -function getProgramStages() -{ - var programId = getFieldValue( 'orgunitProgramId' ); - if(programId=='') return; - - clearListById( 'orgunitProgramStageId' ); - - jQuery.getJSON( 'getProgramStages.action',{ id:programId } - ,function( json ) - { - enable('programProperty'); - var programstage = jQuery('#orgunitProgramStageId'); - - for ( i in json.programStages ) - { - var id = json.programStages[i].id; - var formularId = "[PSIC:" + id + "]"; - var name = json.programStages[i].name; - - programstage.append( "" ); - } - }); +function getProgramStages() { + var programId = getFieldValue('orgunitProgramId'); + if( programId == '' ) return; + + clearListById('orgunitProgramStageId'); + + jQuery.getJSON('getProgramStages.action', { id: programId } + , function( json ) { + enable('programProperty'); + var programstage = jQuery('#orgunitProgramStageId'); + + for( i in json.programStages ) { + var id = json.programStages[i].id; + var formularId = "[PSIC:" + id + "]"; + var name = json.programStages[i].name; + + programstage.append(""); + } + }); } //------------------------------------------------------------------------------ // Get DataElements of Program-Stage //------------------------------------------------------------------------------ -function getPatientDataElements() -{ - clearListById( 'dataElements' ); - clearListById( 'dataElementBackups' ); - clearListById( 'deSumId' ); - var programStageId = getFieldValue('programStageId'); - - jQuery.getJSON( 'getPatientDataElements.action', - { - programId:getFieldValue( 'programId' ), - programStageId:programStageId - } - ,function( json ) - { - if( programStageId!='' ){ - enable('programStageProperty'); - } - else{ - disable('programStageProperty'); - } - - var dataElements = jQuery('#dataElements'); - var dataElementBackups = jQuery('#dataElementBackups'); - clearListById( 'dataElements' ); - clearListById( 'dataElementBackups' ); - var deSumId = jQuery('#deSumId'); - deSumId.append( "" ); - for ( i in json.dataElements ) - { - dataElements.append( "" ); - dataElementBackups.append( "" ); - if( json.dataElements[i].type=='int') - { - deSumId.append( "" ); - } - } - - }); +function getPatientDataElements() { + clearListById('dataElements'); + clearListById('dataElementBackups'); + clearListById('deSumId'); + var programStageId = getFieldValue('programStageId'); + + jQuery.getJSON('getPatientDataElements.action', + { + programId: getFieldValue('programId'), + programStageId: programStageId + } + , function( json ) { + if( programStageId != '' ) { + enable('programStageProperty'); + } + else { + disable('programStageProperty'); + } + + var dataElements = jQuery('#dataElements'); + var dataElementBackups = jQuery('#dataElementBackups'); + clearListById('dataElements'); + clearListById('dataElementBackups'); + var deSumId = jQuery('#deSumId'); + deSumId.append(""); + for( i in json.dataElements ) { + dataElements.append(""); + dataElementBackups.append(""); + if( json.dataElements[i].type == 'int' ) { + deSumId.append(""); + } + } + + }); } //----------------------------------------------------------------- // Insert items into Condition //----------------------------------------------------------------- -function insertDataElement( element ) -{ - var progamId = getFieldValue('programId'); - var programStageId = getFieldValue('programStageId'); - programStageId = ( programStageId == "" ) ? "*" : programStageId; - var dataElementId = element.options[element.selectedIndex].value; - - insertTextCommon( 'aggregationCondition', "[DE:" + progamId + "." + programStageId + "." + dataElementId + "]" ); - getConditionDescription(); -} - -function insertInfo( element, isProgramStageProperty ) -{ - var id = ""; - if( isProgramStageProperty ) - { - id = getFieldValue('programStageId'); - } - else - { - id = getFieldValue('programId'); - } - - value = element.options[element.selectedIndex].value.replace( '*', id ); - insertTextCommon('aggregationCondition', value ); - getConditionDescription(); -} - -function insertOperator( value ) -{ - insertTextCommon('aggregationCondition', ' ' + value + ' ' ); - getConditionDescription(); -} - -function insertBoolValue( value ) -{ - insertTextCommon("aggregationCondition", " ='" + value + "' " ); - getConditionDescription(); +function insertDataElement( element ) { + var progamId = getFieldValue('programId'); + var programStageId = getFieldValue('programStageId'); + programStageId = ( programStageId == "" ) ? "*" : programStageId; + var dataElementId = element.options[element.selectedIndex].value; + + insertTextCommon('aggregationCondition', "[DE:" + progamId + "." + programStageId + "." + dataElementId + "]"); + getConditionDescription(); +} + +function insertInfo( element, isProgramStageProperty ) { + var id = ""; + if( isProgramStageProperty ) { + id = getFieldValue('programStageId'); + } + else { + id = getFieldValue('programId'); + } + + value = element.options[element.selectedIndex].value.replace('*', id); + insertTextCommon('aggregationCondition', value); + getConditionDescription(); +} + +function insertOperator( value ) { + insertTextCommon('aggregationCondition', ' ' + value + ' '); + getConditionDescription(); +} + +function insertBoolValue( value ) { + insertTextCommon("aggregationCondition", " ='" + value + "' "); + getConditionDescription(); } // ----------------------------------------------------------------------------- // Remove Case Aggregation Condition // ----------------------------------------------------------------------------- -function removeCaseAggregation( caseAggregationId, caseAggregationName ) -{ - removeItem( caseAggregationId, caseAggregationName, i18n_confirm_delete, 'removeCaseAggregation.action' ); -} - -// ----------------------------------------------------------------------------- -// View details -// ----------------------------------------------------------------------------- - -function showCaseAggregationDetails( caseAggregationId ) -{ - jQuery.getJSON( 'getCaseAggregation.action', { id:caseAggregationId }, function ( json ) - { - setInnerHTML( 'nameField', json.caseAggregation.name ); - setInnerHTML( 'operatorField', json.caseAggregation.operator ); - setInnerHTML( 'aggregationDataElementField', json.caseAggregation.aggregationDataElement ); - setInnerHTML( 'optionComboField', json.caseAggregation.optionCombo ); - setInnerHTML( 'aggregationExpressionField', json.caseAggregation.aggregationExpression ); - setInnerHTML( 'deSumField', json.caseAggregation.deSum ); - showDetails(); - }); -} - -// ----------------------------------------------------------------------------- -// View details -// ----------------------------------------------------------------------------- - -function getConditionDescription() -{ - $.postUTF8( 'getCaseAggregationDescription.action', - { - condition:getFieldValue('aggregationCondition') - },function (data) - { - byId('aggregationDescription').innerHTML = data; - },'html'); +function removeCaseAggregation( context ) { + removeItem(context.id, context.name, i18n_confirm_delete, 'removeCaseAggregation.action'); +} + +// ----------------------------------------------------------------------------- +// View details +// ----------------------------------------------------------------------------- + +function showUpdateCaseAggregationForm( context ) { + location.href = 'showUpdateCaseAggregationForm.action?id=' + context.id; +} + +function showCaseAggregationDetails( context ) { + jQuery.getJSON('getCaseAggregation.action', { id: context.id }, function( json ) { + setInnerHTML('nameField', json.caseAggregation.name); + setInnerHTML('operatorField', json.caseAggregation.operator); + setInnerHTML('aggregationDataElementField', json.caseAggregation.aggregationDataElement); + setInnerHTML('optionComboField', json.caseAggregation.optionCombo); + setInnerHTML('aggregationExpressionField', json.caseAggregation.aggregationExpression); + setInnerHTML('deSumField', json.caseAggregation.deSum); + showDetails(); + }); +} + +// ----------------------------------------------------------------------------- +// View details +// ----------------------------------------------------------------------------- + +function getConditionDescription() { + $.postUTF8('getCaseAggregationDescription.action', + { + condition: getFieldValue('aggregationCondition') + }, function( data ) { + byId('aggregationDescription').innerHTML = data; + }, 'html'); } // ----------------------------------------------------------------------------- // Test condition // ----------------------------------------------------------------------------- -function testCaseAggregationCondition() -{ - var operator = jQuery('[name=operator]:checked').val(); - $.postUTF8( 'testCaseAggregationCondition.action', - { - condition: getFieldValue('aggregationCondition'), - deSumId: getFieldValue('deSumId'), - operator: operator - },function (json) - { - var type = json.response; - - if ( type == "input" ) - { - showWarningMessage( i18n_run_fail ); - } - else - { - showSuccessMessage( i18n_run_success ); - } - }); -} - -function getSuggestedValues( sourceId, targetId ) -{ - clearListById( targetId ); - - var suggestedValues = jQuery('select[id=' + sourceId + '] option:selected').attr('suggested'); - if( suggestedValues ) - { - var arrValues = new Array(); - arrValues = suggestedValues.replace(/[//[]+/g,'').replace(/]/g, '').split(', '); - - var suggestedValueSelector = byId( targetId ); - for( var i=0; i< arrValues.length; i++ ) - { - var option = document.createElement("option"); - var value = jQuery.trim( arrValues[i] ); - option.value = "'" + value + "'"; - option.text = value; - option.title = value; - - suggestedValueSelector.add(option, null); - } - } -} - -function insertSingleValue( elementId ) -{ - var element = byId( elementId ); - insertTextCommon('aggregationCondition', "=" + element.options[element.selectedIndex].value ); - getConditionDescription(); -} - -function insertMultiValues( elementId ) -{ - var list = jQuery('select[id=' + elementId + '] option:selected') - if( list.length == 0 ) - { - return; - } - if( list.length > 1 ) - { - var selectedValues = ""; - list.each(function(){ - selectedValues += jQuery(this).val() + ", "; - }); - selectedValues = " IN @ " + selectedValues.substring( 0, selectedValues.length - 2) + " #"; - - insertTextCommon('aggregationCondition', selectedValues ); - getConditionDescription(); - } - else - { - insertSingleValue( elementId ); - } -} - -function getCaseAggConditionByDataset() -{ - $.get( 'getCaseAggConditionByDataset.action', - { - dataSetId: getFieldValue( 'dataSetId' ) - } - , function( html ) - { - setTableStyles(); - setInnerHTML('list', html ); - } ); -} - -function showAddCaseAggregationForm() -{ - window.location.href='showAddCaseAggregationForm.action?dataSetId=' + getFieldValue( 'dataSetId' ); -} - -function operatorOnchange(operator) -{ - if( operator=='sum' || operator=='avg' - || operator=='min' || operator=='max' ){ - enable('deSumId'); - } - else{ - disable('deSumId'); - } -} - -function filterDataElement( event, value, fieldName, backupFieldsName ) -{ - // Remove all options in data element fields - var field = jQuery('#' + fieldName + " option " ).remove(); - var valueType = getFieldValue('deValueType'); - - jQuery('#' + backupFieldsName + " option ").each( function(){ - var option = jQuery(this); - if (valueType=='' || valueType == option.attr('valueType') ) - { - if(value.length == 0 ) - { - jQuery('#' + fieldName ).append( "" ); - } - else if (option.text().toLowerCase().indexOf( value.toLowerCase() ) != -1 ) - { - jQuery('#' + fieldName ).append( "" ); - } - } - }); - -} - -function sortByOnChange( sortBy ) -{ - if( sortBy == 1) - { - jQuery('#dataElements').each(function() { - - // Keep track of the selected option. - var selectedValue = $(this).val(); - - // sort it out - $(this).html($("option", $(this)).sort(function(a, b) { - return $(a).attr('dename') == $(b).attr('dename') ? 0 : $(a).attr('dename') < $(b).attr('dename') ? -1 : 1 - })); - - // Select one option. - $(this).val(selectedValue); - - }); - } - else - { - jQuery('#dataElements').each(function() { - - // Keep track of the selected option. - var selectedValue = $(this).val(); - - // sort it out - $(this).html($("option", $(this)).sort(function(a, b) { - return $(a).attr('decode') == $(b).attr('decode') ? 0 : $(a).attr('decode') < $(b).attr('decode') ? -1 : 1 - })); - - // Select one option. - $(this).val(selectedValue); - - }); - } -} - -function displayNameOnChange( displayName ) -{ - // display - name - if(displayName=='1'){ - jQuery('#dataElements option').each(function(){ - var item = jQuery(this); - item[0].text = item.attr('dename'); - item[0].title = item[0].text; - }); - jQuery('#dataElementBackups option').each(function(){ - var item = jQuery(this); - item[0].text = item.attr('dename'); - }); - } - // display - code - else if(displayName=='2'){ - jQuery('#dataElements option').each(function(){ - var item = jQuery(this); - item[0].text = item.attr('decode'); - item[0].title = item[0].text; - }); - jQuery('#dataElementBackups option').each(function(){ - var item = jQuery(this); - item[0].text = item.attr('decode'); - }); - } - // display - code and name - else{ - jQuery('#dataElements option').each(function(){ - var item = jQuery(this); - item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename'); - item[0].title = item[0].text; - }); - jQuery('#dataElementBackups option').each(function(){ - var item = jQuery(this); - item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename'); - }); - } -} - -function cancelOnClick() -{ - var dataSetId = getFieldValue("dataSets"); - window.location.href='caseAggregation.action?dataSetId=' + dataSetId; +function testCaseAggregationCondition() { + var operator = jQuery('[name=operator]:checked').val(); + $.postUTF8('testCaseAggregationCondition.action', + { + condition: getFieldValue('aggregationCondition'), + deSumId: getFieldValue('deSumId'), + operator: operator + }, function( json ) { + var type = json.response; + + if( type == "input" ) { + showWarningMessage(i18n_run_fail); + } + else { + showSuccessMessage(i18n_run_success); + } + }); +} + +function getSuggestedValues( sourceId, targetId ) { + clearListById(targetId); + + var suggestedValues = jQuery('select[id=' + sourceId + '] option:selected').attr('suggested'); + if( suggestedValues ) { + var arrValues = new Array(); + arrValues = suggestedValues.replace(/[//[]+/g, '').replace(/]/g, '').split(', '); + + var suggestedValueSelector = byId(targetId); + for( var i = 0; i < arrValues.length; i++ ) { + var option = document.createElement("option"); + var value = jQuery.trim(arrValues[i]); + option.value = "'" + value + "'"; + option.text = value; + option.title = value; + + suggestedValueSelector.add(option, null); + } + } +} + +function insertSingleValue( elementId ) { + var element = byId(elementId); + insertTextCommon('aggregationCondition', "=" + element.options[element.selectedIndex].value); + getConditionDescription(); +} + +function insertMultiValues( elementId ) { + var list = jQuery('select[id=' + elementId + '] option:selected') + if( list.length == 0 ) { + return; + } + if( list.length > 1 ) { + var selectedValues = ""; + list.each(function() { + selectedValues += jQuery(this).val() + ", "; + }); + selectedValues = " IN @ " + selectedValues.substring(0, selectedValues.length - 2) + " #"; + + insertTextCommon('aggregationCondition', selectedValues); + getConditionDescription(); + } + else { + insertSingleValue(elementId); + } +} + +function getCaseAggConditionByDataset() { + $.get('getCaseAggConditionByDataset.action', + { + dataSetId: getFieldValue('dataSetId') + } + , function( html ) { + setTableStyles(); + setInnerHTML('list', html); + }); +} + +function showAddCaseAggregationForm() { + window.location.href = 'showAddCaseAggregationForm.action?dataSetId=' + getFieldValue('dataSetId'); +} + +function operatorOnchange( operator ) { + if( operator == 'sum' || operator == 'avg' + || operator == 'min' || operator == 'max' ) { + enable('deSumId'); + } + else { + disable('deSumId'); + } +} + +function filterDataElement( event, value, fieldName, backupFieldsName ) { + // Remove all options in data element fields + var field = jQuery('#' + fieldName + " option ").remove(); + var valueType = getFieldValue('deValueType'); + + jQuery('#' + backupFieldsName + " option ").each(function() { + var option = jQuery(this); + if( valueType == '' || valueType == option.attr('valueType') ) { + if( value.length == 0 ) { + jQuery('#' + fieldName).append(""); + } + else if( option.text().toLowerCase().indexOf(value.toLowerCase()) != -1 ) { + jQuery('#' + fieldName).append(""); + } + } + }); + +} + +function sortByOnChange( sortBy ) { + if( sortBy == 1 ) { + jQuery('#dataElements').each(function() { + + // Keep track of the selected option. + var selectedValue = $(this).val(); + + // sort it out + $(this).html($("option", $(this)).sort(function( a, b ) { + return $(a).attr('dename') == $(b).attr('dename') ? 0 : $(a).attr('dename') < $(b).attr('dename') ? -1 : 1 + })); + + // Select one option. + $(this).val(selectedValue); + + }); + } + else { + jQuery('#dataElements').each(function() { + + // Keep track of the selected option. + var selectedValue = $(this).val(); + + // sort it out + $(this).html($("option", $(this)).sort(function( a, b ) { + return $(a).attr('decode') == $(b).attr('decode') ? 0 : $(a).attr('decode') < $(b).attr('decode') ? -1 : 1 + })); + + // Select one option. + $(this).val(selectedValue); + + }); + } +} + +function displayNameOnChange( displayName ) { + // display - name + if( displayName == '1' ) { + jQuery('#dataElements option').each(function() { + var item = jQuery(this); + item[0].text = item.attr('dename'); + item[0].title = item[0].text; + }); + jQuery('#dataElementBackups option').each(function() { + var item = jQuery(this); + item[0].text = item.attr('dename'); + }); + } + // display - code + else if( displayName == '2' ) { + jQuery('#dataElements option').each(function() { + var item = jQuery(this); + item[0].text = item.attr('decode'); + item[0].title = item[0].text; + }); + jQuery('#dataElementBackups option').each(function() { + var item = jQuery(this); + item[0].text = item.attr('decode'); + }); + } + // display - code and name + else { + jQuery('#dataElements option').each(function() { + var item = jQuery(this); + item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename'); + item[0].title = item[0].text; + }); + jQuery('#dataElementBackups option').each(function() { + var item = jQuery(this); + item[0].text = "(" + item.attr('decode') + ") " + item.attr('dename'); + }); + } +} + +function cancelOnClick() { + var dataSetId = getFieldValue("dataSets"); + window.location.href = 'caseAggregation.action?dataSetId=' + dataSetId; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js 2013-05-30 06:08:13 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programIndicator.js 2013-12-06 11:18:39 +0000 @@ -1,119 +1,118 @@ +$(function() { + dhis2.contextmenu.makeContextMenu({ + menuId: 'contextMenu', + menuItemActiveClass: 'contextMenuItemActive' + }); +}); // ----------------------------------------------------------------------------- // View details // ----------------------------------------------------------------------------- -function showProgramIndicatorDetails( programIndicatorId ) -{ - jQuery.getJSON( 'getProgramIndicator.action', { id: programIndicatorId }, function ( json ) { - setInnerHTML( 'nameField', json.programIndicator.name ); - setInnerHTML( 'codeField', json.programIndicator.code ); - setInnerHTML( 'descriptionField', json.programIndicator.description ); - setInnerHTML( 'valueTypeField', json.programIndicator.valueType ); - setInnerHTML( 'rootDateField', json.programIndicator.rootDate ); - setInnerHTML( 'expressionField', json.programIndicator.expression ); - - showDetails(); - }); +function showUpdateProgramIndicator( context ) { + location.href = 'showUpdateProgramIndicator.action?id=' + context.id; +} + +function removeIndicator( context ) { + removeItem( context.id, context.name, i18n_confirm_delete , 'removeProgramIndicator.action' ); +} + +function showProgramIndicatorDetails( context ) { + jQuery.getJSON('getProgramIndicator.action', { id: context.id }, function( json ) { + setInnerHTML('nameField', json.programIndicator.name); + setInnerHTML('codeField', json.programIndicator.code); + setInnerHTML('descriptionField', json.programIndicator.description); + setInnerHTML('valueTypeField', json.programIndicator.valueType); + setInnerHTML('rootDateField', json.programIndicator.rootDate); + setInnerHTML('expressionField', json.programIndicator.expression); + + showDetails(); + }); } // ----------------------------------------------------------------------------- // Remove Program Indicator // ----------------------------------------------------------------------------- -function removeProgramIndicator( programIndicatorId, name ) -{ - removeItem( programIndicatorId, name, i18n_confirm_delete, 'removeProgramIndicator.action' ); -} - -function getPatientDataElements() -{ - clearListById( 'dataElements' ); - clearListById( 'deSumId' ); - var programStageId = getFieldValue('programStageId'); - - jQuery.getJSON( 'getPatientDataElements.action', - { - programId:getFieldValue( 'programId' ), - programStageId:programStageId - } - ,function( json ) - { - if( programStageId!='' ){ - enable('programStageProperty'); - } - else{ - disable('programStageProperty'); - } - var dataElements = jQuery('#dataElements'); - var deSumId = jQuery('#deSumId'); - for ( i in json.dataElements ) - { - if( json.dataElements[i].type=='int' || json.dataElements[i].type=='date' ) - { - dataElements.append( "" ); - if( json.dataElements[i].type=='int') - { - deSumId.append( "" ); - } - } - } - - }); -} - -function insertDataElement( element ) -{ - var programStageId = getFieldValue('programStageId'); - var dataElementId = element.options[element.selectedIndex].value; - - insertTextCommon( 'expression', "[DE:" + programStageId + "." + dataElementId + "]" ); - getConditionDescription(); -} - -function insertInfo( element, isProgramStageProperty ) -{ - var id = ""; - if( isProgramStageProperty ) - { - id = getFieldValue('programStageId'); - } - else - { - id = getFieldValue('programId'); - } - - value = element.options[element.selectedIndex].value.replace( '*', id ); - insertTextCommon('expression', value ); - getConditionDescription(); -} - -function insertOperator( value ) -{ - insertTextCommon('expression', ' ' + value + ' ' ); - getConditionDescription(); -} - -function getConditionDescription () -{ - $.postJSON( 'getProgramIndicatorDescripttion.action', - { - expression:getFieldValue('expression') - },function (json) - { - byId('aggregationDescription').innerHTML = json.message; - }) -} - -function programIndicatorOnChange() -{ - var valueType = getFieldValue('valueType'); - if(valueType=='int'){ - hideById('rootDateTR'); - disable('rootDate'); - } - else{ - showById('rootDateTR'); - enable('rootDate'); - } +function removeProgramIndicator( context ) { + removeItem(context.id, context.name, i18n_confirm_delete, 'removeProgramIndicator.action'); +} + +function getPatientDataElements() { + clearListById('dataElements'); + clearListById('deSumId'); + var programStageId = getFieldValue('programStageId'); + + jQuery.getJSON('getPatientDataElements.action', + { + programId: getFieldValue('programId'), + programStageId: programStageId + } + , function( json ) { + if( programStageId != '' ) { + enable('programStageProperty'); + } + else { + disable('programStageProperty'); + } + var dataElements = jQuery('#dataElements'); + var deSumId = jQuery('#deSumId'); + for( i in json.dataElements ) { + if( json.dataElements[i].type == 'int' || json.dataElements[i].type == 'date' ) { + dataElements.append(""); + if( json.dataElements[i].type == 'int' ) { + deSumId.append(""); + } + } + } + + }); +} + +function insertDataElement( element ) { + var programStageId = getFieldValue('programStageId'); + var dataElementId = element.options[element.selectedIndex].value; + + insertTextCommon('expression', "[DE:" + programStageId + "." + dataElementId + "]"); + getConditionDescription(); +} + +function insertInfo( element, isProgramStageProperty ) { + var id = ""; + if( isProgramStageProperty ) { + id = getFieldValue('programStageId'); + } + else { + id = getFieldValue('programId'); + } + + value = element.options[element.selectedIndex].value.replace('*', id); + insertTextCommon('expression', value); + getConditionDescription(); +} + +function insertOperator( value ) { + insertTextCommon('expression', ' ' + value + ' '); + getConditionDescription(); +} + +function getConditionDescription() { + $.postJSON('getProgramIndicatorDescripttion.action', + { + expression: getFieldValue('expression') + }, function( json ) { + byId('aggregationDescription').innerHTML = json.message; + }) +} + +function programIndicatorOnChange() { + var valueType = getFieldValue('valueType'); + if( valueType == 'int' ) { + hideById('rootDateTR'); + disable('rootDate'); + } + else { + showById('rootDateTR'); + enable('rootDate'); + } } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2012-12-07 13:00:15 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programValidation.js 2013-12-06 11:18:39 +0000 @@ -1,224 +1,209 @@ var COLOR_GREEN = '#b9ffb9'; var COLOR_WHITE = '#ffffff' -jQuery(document).ready( function(){ - validation( 'programValidationForm', function( form ){ - form.submit(); - }); +jQuery(document).ready(function() { + validation('programValidationForm', function( form ) { + form.submit(); + }); + + dhis2.contextmenu.makeContextMenu({ + menuId: 'contextMenu', + menuItemActiveClass: 'contextMenuItemActive' + }); }); // ----------------------------------------------------------------------------- // View details // ----------------------------------------------------------------------------- -function showProgramValidationDetails ( programValidationId ) -{ - jQuery.getJSON( 'getProgramValidation.action', { validationId: programValidationId }, function ( json ) { - setInnerHTML( 'descriptionField', json.validation.description ); - - var operator = json.validation.operator; - setInnerHTML( 'operatorField', i18nalizeOperator( operator ) ); - - setInnerHTML( 'leftSideDescriptionField', json.validation.leftSideDescription ); - setInnerHTML( 'leftSideExpressionField', json.validation.leftSideExpression ); - setInnerHTML( 'rightSideDescriptionField', json.validation.rightSideDescription ); - setInnerHTML( 'rightSideExpressionField', json.validation.rightSideExpression ); - - showDetails(); - }); -} - -function i18nalizeOperator( operator ) -{ - if ( operator == "equal_to" ) - { - return i18n_equal_to; - } - else if ( operator == "not_equal_to" ) - { - return i18n_not_equal_to; - } - else if ( operator == "greater_than" ) - { - return i18n_greater_than; - } - else if ( operator == "greater_than_or_equal_to" ) - { - return i18n_greater_than_or_equal_to; - } - else if ( operator == "less_than" ) - { - return i18n_less_than; - } - else if ( operator == "less_than_or_equal_to" ) - { - return i18n_less_than_or_equal_to; - } - - return null; +function showUpdateSingleProgramValidationForm( context ) { + location.href = 'showUpdateSingleProgramValidationForm.action?validationId=' + context.id; +} + +function showProgramValidationDetails( context ) { + jQuery.getJSON('getProgramValidation.action', { validationId: context.id }, function( json ) { + setInnerHTML('descriptionField', json.validation.description); + + var operator = json.validation.operator; + setInnerHTML('operatorField', i18nalizeOperator(operator)); + + setInnerHTML('leftSideDescriptionField', json.validation.leftSideDescription); + setInnerHTML('leftSideExpressionField', json.validation.leftSideExpression); + setInnerHTML('rightSideDescriptionField', json.validation.rightSideDescription); + setInnerHTML('rightSideExpressionField', json.validation.rightSideExpression); + + showDetails(); + }); +} + +function i18nalizeOperator( operator ) { + if( operator == "equal_to" ) { + return i18n_equal_to; + } + else if( operator == "not_equal_to" ) { + return i18n_not_equal_to; + } + else if( operator == "greater_than" ) { + return i18n_greater_than; + } + else if( operator == "greater_than_or_equal_to" ) { + return i18n_greater_than_or_equal_to; + } + else if( operator == "less_than" ) { + return i18n_less_than; + } + else if( operator == "less_than_or_equal_to" ) { + return i18n_less_than_or_equal_to; + } + + return null; } // ----------------------------------------------------------------------------- // Remove ProgramValidation // ----------------------------------------------------------------------------- -function removeProgramValidation( programValidationId, name ) -{ - removeItem( programValidationId, name, i18n_confirm_delete, 'removeProgramValidation.action' ); +function removeProgramValidation( context ) { + removeItem(context.id, context.name, i18n_confirm_delete, 'removeProgramValidation.action'); } //------------------------------------------------------------------------------ // Load data-elements of each program-stage //------------------------------------------------------------------------------ -function getLeftPrgramStageDataElements() -{ - clearListById( 'dataElementId' ); - - var programStage = document.getElementById( 'leftStage' ); - var programStageId = programStage.options[ programStage.selectedIndex ].value; - if( programStageId == '') return; - - jQuery.getJSON( "getPatientDataElements.action", { - programStageId:programStageId - }, function(json){ - jQuery( '#dataElementId').append( '' ); - jQuery( '#dataElementId').append( '' ); - for ( i in json.dataElements ) { - var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']'; - jQuery( '#dataElementId').append( '' ); - } - }); +function getLeftPrgramStageDataElements() { + clearListById('dataElementId'); + + var programStage = document.getElementById('leftStage'); + var programStageId = programStage.options[ programStage.selectedIndex ].value; + if( programStageId == '' ) return; + + jQuery.getJSON("getPatientDataElements.action", { + programStageId: programStageId + }, function( json ) { + jQuery('#dataElementId').append(''); + jQuery('#dataElementId').append(''); + for( i in json.dataElements ) { + var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']'; + jQuery('#dataElementId').append(''); + } + }); } -function getRightPrgramStageDataElements() -{ - clearListById( 'rightSideDE' ); - - var programStage = document.getElementById( 'rightStage' ); - var programStageId = programStage.options[ programStage.selectedIndex ].value; - if( programStageId == '') return; - - jQuery.getJSON( "getPatientDataElements.action", { - programStageId:programStageId - }, function(json){ - jQuery( '#dataElementId').append( '' ); - jQuery( '#dataElementId').append( '' ); - for ( i in json.dataElements ) { - var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']'; - jQuery( '#rightSideDE').append( '' ); - } - }); - +function getRightPrgramStageDataElements() { + clearListById('rightSideDE'); + + var programStage = document.getElementById('rightStage'); + var programStageId = programStage.options[ programStage.selectedIndex ].value; + if( programStageId == '' ) return; + + jQuery.getJSON("getPatientDataElements.action", { + programStageId: programStageId + }, function( json ) { + jQuery('#dataElementId').append(''); + jQuery('#dataElementId').append(''); + for( i in json.dataElements ) { + var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']'; + jQuery('#rightSideDE').append(''); + } + }); + } //------------------------------------------------------------------------------ // Show Left side form for designing //------------------------------------------------------------------------------ -function editLeftExpression() -{ - left = true; - - $( '#expression' ).val( $( '#leftSideExpression' ).val() ); - $( '#expression-container [id=description]' ).val( $( '#leftSideDescription' ).val() ); - $( '#formulaText' ).text( $( '#leftSideTextualExpression' ).val() ); - $( '#nullIfBlank' ).attr( 'checked', ( $( '#leftSideNullIfBlank' ).val() == 'true' || $( '#leftSideNullIfBlank' ).val() == '' ) ); - setInnerHTML( "exp-descriptionInfo", "" ); - setInnerHTML( "exp-expressionInfo", "" ); - $("#expression-container [id=description]" ).css( "background-color", "#ffffff" ); - $("#expression-container [id=expression]" ).css( "background-color", "#ffffff" ); - - dialog.dialog("open"); +function editLeftExpression() { + left = true; + + $('#expression').val($('#leftSideExpression').val()); + $('#expression-container [id=description]').val($('#leftSideDescription').val()); + $('#formulaText').text($('#leftSideTextualExpression').val()); + $('#nullIfBlank').attr('checked', ( $('#leftSideNullIfBlank').val() == 'true' || $('#leftSideNullIfBlank').val() == '' )); + setInnerHTML("exp-descriptionInfo", ""); + setInnerHTML("exp-expressionInfo", ""); + $("#expression-container [id=description]").css("background-color", "#ffffff"); + $("#expression-container [id=expression]").css("background-color", "#ffffff"); + + dialog.dialog("open"); } -function editRightExpression() -{ - left = false; - - $( '#expression' ).val( $( '#rightSideExpression' ).val() ); - $( '#expression-container [id=description]' ).val( $( '#rightSideDescription' ).val() ); - $( '#formulaText' ).text( $( '#rightSideTextualExpression' ).val() ); - $( '#nullIfBlank' ).attr( 'checked', ( $( '#rightSideNullIfBlank' ).val() == 'true' || $( '#rightSideNullIfBlank' ).val() == '' ) ); - - dialog.dialog("open"); +function editRightExpression() { + left = false; + + $('#expression').val($('#rightSideExpression').val()); + $('#expression-container [id=description]').val($('#rightSideDescription').val()); + $('#formulaText').text($('#rightSideTextualExpression').val()); + $('#nullIfBlank').attr('checked', ( $('#rightSideNullIfBlank').val() == 'true' || $('#rightSideNullIfBlank').val() == '' )); + + dialog.dialog("open"); } //------------------------------------------------------------------------------ // Insert formulas //------------------------------------------------------------------------------ -function insertText( inputAreaName, inputText ) -{ - insertTextCommon( inputAreaName, inputText ); - - getExpressionText(); +function insertText( inputAreaName, inputText ) { + insertTextCommon(inputAreaName, inputText); + + getExpressionText(); } -function getExpressionText() -{ - $.postUTF8("getProgramExpressionDescription.action", - { - programExpression: $( '#expression' ).val() - }, - function (data) - { - setInnerHTML( "formulaText", data ); - },'html'); +function getExpressionText() { + $.postUTF8("getProgramExpressionDescription.action", + { + programExpression: $('#expression').val() + }, + function( data ) { + setInnerHTML("formulaText", data); + }, 'html'); } var left = true; -function insertExpression() -{ - var expression = $( '#expression' ).val(); - var description = $( '#expression-container [id=description]' ).val(); - - if ( left ) - { - $( '#leftSideExpression' ).val( expression ); - $( '#leftSideDescription' ).val( description ); - $( '#leftSideTextualExpression' ).val( $( '#formulaText' ).text() ); - $( '#leftSideNullIfBlank' ).val( $( '#nullIfBlank' ).is( ':checked' ) ); - } - else - { - $( '#rightSideExpression' ).val( expression ); - $( '#rightSideDescription' ).val( description ); - $( '#rightSideTextualExpression' ).val( $( '#formulaText' ).text() ); - $( '#rightSideNullIfBlank' ).val( $( '#nullIfBlank' ).is( ':checked' ) ); - } - - dialog.dialog( "close" ); -} - -function validateExpression() -{ - if ( checkNotEmpty( jQuery( "#expression-container [id=description]" ), i18n_description_not_null ) == false ) - return; - if ( checkNotEmpty( jQuery( "#expression-container [id=expression]" ), i18n_expression_not_null ) == false ) - return; - insertExpression(); -} - -function checkNotEmpty( field, message ) -{ - if ( field.val().length == 0 ) - { - setInnerHTML( "exp-" + field.attr("name") + "Info", message ); - $('#expression-container [id=' + field.attr("name") + "]" ).css( "background-color", "#ffc5c5" ); - return false; - } else - { - setInnerHTML( "exp-" + field.attr("name") + "Info", '' ); - $('#expression-container [id=' + field.attr("name") + "]" ).css( "background-color", "#ffffff" ); - } - - return true; -} - -function clearSearchText() -{ - setFieldValue('filter', ''); - filterList( '', 'dataElementId' ) +function insertExpression() { + var expression = $('#expression').val(); + var description = $('#expression-container [id=description]').val(); + + if( left ) { + $('#leftSideExpression').val(expression); + $('#leftSideDescription').val(description); + $('#leftSideTextualExpression').val($('#formulaText').text()); + $('#leftSideNullIfBlank').val($('#nullIfBlank').is(':checked')); + } + else { + $('#rightSideExpression').val(expression); + $('#rightSideDescription').val(description); + $('#rightSideTextualExpression').val($('#formulaText').text()); + $('#rightSideNullIfBlank').val($('#nullIfBlank').is(':checked')); + } + + dialog.dialog("close"); +} + +function validateExpression() { + if( checkNotEmpty(jQuery("#expression-container [id=description]"), i18n_description_not_null) == false ) + return; + if( checkNotEmpty(jQuery("#expression-container [id=expression]"), i18n_expression_not_null) == false ) + return; + insertExpression(); +} + +function checkNotEmpty( field, message ) { + if( field.val().length == 0 ) { + setInnerHTML("exp-" + field.attr("name") + "Info", message); + $('#expression-container [id=' + field.attr("name") + "]").css("background-color", "#ffc5c5"); + return false; + } else { + setInnerHTML("exp-" + field.attr("name") + "Info", ''); + $('#expression-container [id=' + field.attr("name") + "]").css("background-color", "#ffffff"); + } + + return true; +} + +function clearSearchText() { + setFieldValue('filter', ''); + filterList('', 'dataElementId') } \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js 2012-10-22 06:34:53 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/validationcriteria.js 2013-12-06 11:18:39 +0000 @@ -1,74 +1,85 @@ +$(function() { + dhis2.contextmenu.makeContextMenu({ + menuId: 'contextMenu', + menuItemActiveClass: 'contextMenuItemActive' + }); +}); + +function showProgramsForValidationCriteriaForm( context ) { + location.href = 'showProgramsForValidationCriteriaForm.action?criteriaId=' + context.id; +} + +function showUpdateValidationCriteriaForm( context ) { + location.href = 'showUpdateValidationCriteriaForm.action?id=' + context.id; +} + // ----------------------------------------------------------------------------- // Remove Criteria // ----------------------------------------------------------------------------- -function removeCriteria( id, name ) -{ - removeItem( id, name, i18n_confirm_delete, 'removeValidationCriteria.action' ); +function removeCriteria( context ) { + removeItem(context.id, context.name, i18n_confirm_delete, 'removeValidationCriteria.action'); } // ----------------------------------------------------------------------------- // View details // ----------------------------------------------------------------------------- -function showValidationCriteriaDetails( criteriaId ) -{ - jQuery.getJSON( 'getValidationCriteria.action', { id: criteriaId }, function ( json ) { - setInnerHTML( 'nameField', json.validationCriteria.name ); - setInnerHTML( 'descriptionField', json.validationCriteria.description ); - - var property = json.validationCriteria.property; - var operator = json.validationCriteria.operator; - var value = json.validationCriteria.value; - - // get operator - if(operator == 0 ){ - operator = '='; - }else if(operator == -1 ){ - operator = '<'; - }else { - operator = '>'; - } - - setInnerHTML('criteriaField', property + " " + operator + " " + value ); - showDetails(); - }); +function showValidationCriteriaDetails( context ) { + jQuery.getJSON('getValidationCriteria.action', { id: context.id }, function( json ) { + setInnerHTML('nameField', json.validationCriteria.name); + setInnerHTML('descriptionField', json.validationCriteria.description); + + var property = json.validationCriteria.property; + var operator = json.validationCriteria.operator; + var value = json.validationCriteria.value; + + // get operator + if( operator == 0 ) { + operator = '='; + } else if( operator == -1 ) { + operator = '<'; + } else { + operator = '>'; + } + + setInnerHTML('criteriaField', property + " " + operator + " " + value); + showDetails(); + }); } // ---------------------------------------------------------------------------------------- // Show div to Add or Update Validation-Criteria // ---------------------------------------------------------------------------------------- -function showDivValue(){ - - var propertyName = byId('property').value; - hideDiv(); - if(propertyName != '') - { - hideById('emptyCriteria'); - - var div = byId(propertyName + 'Div'); - div.style.display = 'block'; - if( propertyName == 'gender' || - propertyName == 'dobType' ){ - - byId('operator').selectedIndex = 1; - disable('operator'); - } - else{ - enable('operator'); - } - } -} - -function hideDiv() -{ - hideById('genderDiv'); - hideById('integerValueOfAgeDiv'); - hideById('birthDateDiv'); - hideById('dobTypeDiv'); - showById('emptyCriteria'); -} - -function fillValue( value ){ - byId('value').value = value; -} \ No newline at end of file +function showDivValue() { + + var propertyName = byId('property').value; + hideDiv(); + if( propertyName != '' ) { + hideById('emptyCriteria'); + + var div = byId(propertyName + 'Div'); + div.style.display = 'block'; + if( propertyName == 'gender' || + propertyName == 'dobType' ) { + + byId('operator').selectedIndex = 1; + disable('operator'); + } + else { + enable('operator'); + } + } +} + +function hideDiv() { + hideById('genderDiv'); + hideById('integerValueOfAgeDiv'); + hideById('birthDateDiv'); + hideById('dobTypeDiv'); + showById('emptyCriteria'); +} + +function fillValue( value ) { + byId('value').value = value; +} === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm 2013-06-29 14:16:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programIndicator.vm 2013-12-06 11:18:39 +0000 @@ -1,5 +1,14 @@

    $i18n.getString( "program_indicator_management_form" )

    + +

    $program.displayName

    @@ -16,38 +25,31 @@ - - #set( $mark = false ) #foreach( $programIndicator in $programIndicators ) - - - - + + + - #set( $mark = !$mark ) #end
    $i18n.getString( "name" ) $i18n.getString( "description" )$i18n.getString( "operations" )
    $encoder.htmlEncode( $programIndicator.displayName )$encoder.htmlEncode( $programIndicator.description ) - $i18n.getString( 'edit' ) - $i18n.getString( 'translation_translate' ) - $i18n.getString( 'remove' ) - $i18n.getString( 'show_details' ) -
    $encoder.htmlEncode( $!programIndicator.displayName )$encoder.htmlEncode( $!programIndicator.description )
    - -
    -
    +
    +
    $i18n.getString( 'hide_details' )


    === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm 2013-06-29 14:16:34 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programValidationList.vm 2013-12-06 11:18:39 +0000 @@ -2,6 +2,14 @@

    $program.displayName

    + +
    @@ -20,37 +28,30 @@
    + - - + + - - - - - + + + #foreach( $validation in $validations ) + + + + #end + +
    $i18n.getString( "name" )$i18n.getString( "operations" )
    $encoder.htmlEncode( $!validation.displayName )
    + - - #foreach( $validation in $validations ) - - - $validation.name - - $i18n.getString( 'edit' ) - $i18n.getString( 'remove' ) - $i18n.getString( 'show_details' ) - - - #end - - - - -
    -
    +
    +
    $i18n.getString( 'hide_details' )


    @@ -60,7 +61,6 @@



    - @@ -68,13 +68,13 @@