dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26609
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13160: context-menus in maint-patient module, wip
------------------------------------------------------------
revno: 13160
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-12-06 12:18:39 +0100
message:
context-menus in maint-patient module, wip
modified:
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/caseAggregationList.vm
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/programIndicator.js
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/validationcriteria.js
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/programValidationList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-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 @@
+<script>
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+</script>
+
<h3>$i18n.getString( 'patient_aggregation_query_builder_management' ) #openHelp( "patient_aggregation_query_builder" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateCaseAggregationForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removeCaseAggregation"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showCaseAggregationDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
@@ -17,8 +35,8 @@
</td>
</tr>
<tr>
- <td>$i18n.getString( "filter_by_name" )</td>
- <td>
+ <td>$i18n.getString( "filter_by_name" )</td>
+ <td>
<input type="text" onkeyup="filterValues( this.value , 1)" />
</td>
<td colspan="3" style="text-align:right">
@@ -29,33 +47,29 @@
<table class="listTable">
<col>
- <col width="120">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
- <th>$i18n.getString( "operations" )</th>
</tr>
</thead>
<tbody id="list">
#parse( "/dhis-web-maintenance-patient/caseAggregationList.vm" )
</tbody>
-
- </table>
+ </table>
</td>
+
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
<a href="javascript:hideDetails()" title="$i18n.getString( "hide_details" )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
- <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
- <p><label class="bold">$i18n.getString( "operator" ):</label><br><span id="operatorField"></span></p>
- <p><label class="bold">$i18n.getString( "aggregation_data_element" ):</label><br><span id="aggregationDataElementField"></span></p>
+ <p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
+ <p><label class="bold">$i18n.getString( "operator" ):</label><br><span id="operatorField"></span></p>
+ <p><label class="bold">$i18n.getString( "aggregation_data_element" ):</label><br><span id="aggregationDataElementField"></span></p>
<p><label class="bold">$i18n.getString( "option_combo" ):</label><br><span id="optionComboField"></span></p>
- <p><label class="bold">$i18n.getString( "data_element_for_sum_avg_min_max" ):</label><br><span id="deSumField"></span></p>
- <p><label class="bold">$i18n.getString( "aggregation_expression" ):</label><br><span id="aggregationExpressionField"></span></p>
+ <p><label class="bold">$i18n.getString( "data_element_for_sum_avg_min_max" ):</label><br><span id="deSumField"></span></p>
+ <p><label class="bold">$i18n.getString( "aggregation_expression" ):</label><br><span id="aggregationExpressionField"></span></p>
</div>
-
</td>
</tr>
</table>
=== 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 )
- <tr id="tr${aggregationCondition.id}" #alternate( $mark )>
- <td onclick="javascript:showCaseAggregationDetails( $aggregationCondition.id )" >$encoder.htmlEncode( $aggregationCondition.displayName )</td>
- <td>
- <a href="showUpdateCaseAggregationForm.action?id=$aggregationCondition.id&dataSetId=$!dataSetId" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'CaseAggregationCondition', '$aggregationCondition.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removeCaseAggregation( '$aggregationCondition.id', '$encoder.jsEncode( $aggregationCondition.displayName )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showCaseAggregationDetails( $aggregationCondition.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
+ <tr id="tr${aggregationCondition.id}" data-id="$!aggregationCondition.id" data-uid="$!aggregationCondition.uid" data-type="CaseAggregationCondition"
+ data-name="$encoder.htmlEncode( $!aggregationCondition.displayName )"
+ data-can-manage="$security.canManage( $aggregationCondition )"
+ data-can-update="$security.canUpdate( $aggregationCondition )"
+ data-can-delete="$security.canDelete( $aggregationCondition )">
+ <td>$encoder.htmlEncode( $!aggregationCondition.displayName )</td>
</tr>
- #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 $( "<li></li>" )
- .data( "item.autocomplete", item )
- .append( "<a>" + item.label + "</a>" )
- .appendTo( ul );
- };
-
- var wrapper = this.wrapper = $( "<span style='width:200px'>" )
- .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 $("<li></li>")
+ .data("item.autocomplete", item)
+ .append("<a>" + item.label + "</a>")
+ .appendTo(ul);
+ };
+
+ var wrapper = this.wrapper = $("<span style='width:200px'>")
+ .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( '<option suggested="" title="' + i18n_total_of_patient_registration + '" value="[PT:count]">'+ i18n_total_of_patient_registration +'</option>' );
- caseProperty.append( '<option suggested="F, M" title="' + i18n_gender + '" value="[CP:gender]">'+ i18n_gender +'</option>' );
- caseProperty.append( '<option suggested="" title="' + i18n_dob_type + '" value="[CP:dobType]">'+ i18n_dob_type +'</option>' );
- caseProperty.append( '<option suggested="" title="' + i18n_age_days + '" value="[CP:age]">'+ i18n_age_days +'</option>' );
-
- 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( "<option value='" + id + "' title='" + name + "'>" + name + "</option>" );
- }
-
- if( json.programStages.length > 1 )
- {
- programstage.prepend( "<option value='' title='" + i18n_all + "'>" + i18n_all + "</option>" );
- }
- 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( "<option value='" + id + "' title='" + name + "' suggested='" + json.fixedAttributes[i].suggested + "'>" + name + "</option>" );
- }
-
- 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( "<option value='" + id + "' title='" + name + "' suggested='" + suggested + "'>" + name + "</option>" );
- }
- }
- });
+function getParams() {
+ clearListById('programStageId');
+ clearListById('dataElements');
+ clearListById('caseProperty');
+ var programId = getFieldValue('programId');
+ if( programId == '' ) {
+ var caseProperty = jQuery('#caseProperty');
+ caseProperty.append('<option suggested="" title="' + i18n_total_of_patient_registration + '" value="[PT:count]">' + i18n_total_of_patient_registration + '</option>');
+ caseProperty.append('<option suggested="F, M" title="' + i18n_gender + '" value="[CP:gender]">' + i18n_gender + '</option>');
+ caseProperty.append('<option suggested="" title="' + i18n_dob_type + '" value="[CP:dobType]">' + i18n_dob_type + '</option>');
+ caseProperty.append('<option suggested="" title="' + i18n_age_days + '" value="[CP:age]">' + i18n_age_days + '</option>');
+
+ 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("<option value='" + id + "' title='" + name + "'>" + name + "</option>");
+ }
+
+ if( json.programStages.length > 1 ) {
+ programstage.prepend("<option value='' title='" + i18n_all + "'>" + i18n_all + "</option>");
+ }
+ 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("<option value='" + id + "' title='" + name + "' suggested='" + json.fixedAttributes[i].suggested + "'>" + name + "</option>");
+ }
+
+ 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("<option value='" + id + "' title='" + name + "' suggested='" + suggested + "'>" + name + "</option>");
+ }
+ }
+ });
}
-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( "<option value='" + formularId + "' title='" + name + "'>" + name + "</option>" );
- }
- });
+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("<option value='" + formularId + "' title='" + name + "'>" + name + "</option>");
+ }
+ });
}
//------------------------------------------------------------------------------
// 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( "<option value='' >" + i18n_please_select + "</option>" );
- for ( i in json.dataElements )
- {
- dataElements.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
- dataElementBackups.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
- if( json.dataElements[i].type=='int')
- {
- deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>" );
- }
- }
-
- });
+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("<option value='' >" + i18n_please_select + "</option>");
+ for( i in json.dataElements ) {
+ dataElements.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>");
+ dataElementBackups.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' dename='" + json.dataElements[i].name + "' decode='" + json.dataElements[i].code + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>");
+ if( json.dataElements[i].type == 'int' ) {
+ deSumId.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "' valuetype='" + json.dataElements[i].type + "'>" + json.dataElements[i].name + "</option>");
+ }
+ }
+
+ });
}
//-----------------------------------------------------------------
// 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( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>" );
- }
- else if (option.text().toLowerCase().indexOf( value.toLowerCase() ) != -1 )
- {
- jQuery('#' + fieldName ).append( "<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>" );
- }
- }
- });
-
-}
-
-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("<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>");
+ }
+ else if( option.text().toLowerCase().indexOf(value.toLowerCase()) != -1 ) {
+ jQuery('#' + fieldName).append("<option value='" + option.attr('value') + "' title='" + option.text() + "' suggested='" + option.attr('optionset') + "' valueType='" + option.attr('valueType') + "'>" + option.text() + "</option>");
+ }
+ }
+ });
+
+}
+
+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( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
- if( json.dataElements[i].type=='int')
- {
- deSumId.append( "<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>" );
- }
- }
- }
-
- });
-}
-
-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("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
+ if( json.dataElements[i].type == 'int' ) {
+ deSumId.append("<option value='" + json.dataElements[i].id + "' title='" + json.dataElements[i].name + "' suggested='" + json.dataElements[i].optionset + "'>" + json.dataElements[i].name + "</option>");
+ }
+ }
+ }
+
+ });
+}
+
+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( '<option value="DUE_DATE">' + i18n_due_date + '</option>' );
- jQuery( '#dataElementId').append( '<option value="REPORT_DATE">' + i18n_report_date + '</option>' );
- for ( i in json.dataElements ) {
- var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']';
- jQuery( '#dataElementId').append( '<option value="' + id + '">' + json.dataElements[i].name + '</option>' );
- }
- });
+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('<option value="DUE_DATE">' + i18n_due_date + '</option>');
+ jQuery('#dataElementId').append('<option value="REPORT_DATE">' + i18n_report_date + '</option>');
+ for( i in json.dataElements ) {
+ var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']';
+ jQuery('#dataElementId').append('<option value="' + id + '">' + json.dataElements[i].name + '</option>');
+ }
+ });
}
-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( '<option value="DUE_DATE">' + i18n_due_date + '</option>' );
- jQuery( '#dataElementId').append( '<option value="REPORT_DATE">' + i18n_report_date + '</option>' );
- for ( i in json.dataElements ) {
- var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']';
- jQuery( '#rightSideDE').append( '<option value="' + id + '">' + json.dataElements[i].name + '</option>' );
- }
- });
-
+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('<option value="DUE_DATE">' + i18n_due_date + '</option>');
+ jQuery('#dataElementId').append('<option value="REPORT_DATE">' + i18n_report_date + '</option>');
+ for( i in json.dataElements ) {
+ var id = '[DE:' + programStageId + '.' + json.dataElements[i].id + ']';
+ jQuery('#rightSideDE').append('<option value="' + id + '">' + json.dataElements[i].name + '</option>');
+ }
+ });
+
}
//------------------------------------------------------------------------------
// 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 @@
<h3>$i18n.getString( "program_indicator_management_form" )</h3>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateProgramIndicator"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removeIndicator"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showProgramIndicatorDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<h4>$program.displayName</h4>
<input type='hidden' id='id' name='id' value='$program.id'>
@@ -16,38 +25,31 @@
<table class="listTable" id="listTable">
<col>
<col>
- <col width="180">
<thead>
<tr>
<th>$i18n.getString( "name" )</th>
<th>$i18n.getString( "description" )</th>
- <th>$i18n.getString( "operations" )</th>
</tr>
</thead>
<tbody id="list">
#set( $mark = false )
#foreach( $programIndicator in $programIndicators )
- <tr id="tr${programIndicator.id}" #alternate( $mark )>
- <td onclick="showProgramIndicatorDetails( $programIndicator.id )">$encoder.htmlEncode( $programIndicator.displayName )</td>
- <td onclick="showProgramIndicatorDetails( $programIndicator.id )">$encoder.htmlEncode( $programIndicator.description )</td>
- <td style="text-align:center"#alternate( $mark )>
- <a href="showUpdateProgramIndicator.action?id=$programIndicator.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'ProgramIndicator', '$programIndicator.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removeItem( '$programIndicator.id', '$encoder.jsEncode( $programIndicator.displayName )', i18n_confirm_delete , 'removeProgramIndicator.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showProgramIndicatorDetails( $programIndicator.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
+ <tr id="tr${programIndicator.id}" data-id="$!programIndicator.id" data-uid="$!programIndicator.uid" data-type="ProgramIndicator" data-name="$encoder.htmlEncode( $!programIndicator.displayName )"
+ data-can-manage="$security.canManage( $programIndicator )"
+ data-can-update="$security.canUpdate( $programIndicator )"
+ data-can-delete="$security.canDelete( $programIndicator )">
+ <td>$encoder.htmlEncode( $!programIndicator.displayName )</td>
+ <td>$encoder.htmlEncode( $!programIndicator.description )</td>
</tr>
- #set( $mark = !$mark )
#end
</tbody>
</table>
</td>
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="nameField"></span></p>
=== 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 @@
<h4>$program.displayName</h4>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateSingleProgramValidationForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="removeProgramValidation"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showProgramValidationDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
@@ -20,37 +28,30 @@
</td>
</tr>
</table>
+
<table class="listTable">
- <col>
- <col width="100">
+ <col>
+ <thead>
<tr>
- <td></td>
- <td></td>
- </tr>
- <tr>
<th>$i18n.getString( "name" )</th>
- <th colspan='2'>$i18n.getString( "operations" )</th>
</tr>
+ </thead>
+ <tbody id="list">
+ #foreach( $validation in $validations )
+ <tr id="tr${validation.id}" data-id="$!validation.id" data-uid="$!validation.uid" data-type="ProgramValidation" data-name="$encoder.htmlEncode( $!validation.displayName )"
+ data-can-manage="$security.canManage( $validation )"
+ data-can-update="$security.canUpdate( $validation )"
+ data-can-delete="$security.canDelete( $validation )">
+ <td>$encoder.htmlEncode( $!validation.displayName )</td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </td>
- <tbody id="list">
- #foreach( $validation in $validations )
- <tr id="tr${validation.id}">
-
- <td onclick="showProgramValidationDetails( $validation.id )">$validation.name</td>
- <td>
- <a href="showUpdateSingleProgramValidationForm.action?validationId=$validation.id&id=$program.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:removeProgramValidation( '$validation.id', '$encoder.jsEncode( $validation.description )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showProgramValidationDetails( $validation.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
- </tr>
- #end
- </tbody>
- </table>
- </td>
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id="descriptionField"></span></p>
@@ -60,7 +61,6 @@
<p><label class="bold">$i18n.getString( "right_side_description" ):</label><br><span id="rightSideDescriptionField"></span></p>
<p><label class="bold">$i18n.getString( "right_side_expression" ):</label><br><span id="rightSideExpressionField"></span></p>
</div>
-
</td>
</tr>
</table>
@@ -68,13 +68,13 @@
<script type="text/javascript">
var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_patient_attribute" ) , "'" )';
var i18n_none = '$encoder.jsEscape( $i18n.getString( "none" ), "'")';
- var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
- var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
- var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
- var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
- var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
- var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
- var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
+ var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
+ var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
+ var i18n_number = '$encoder.jsEscape( $i18n.getString( "number" ) , "'")';
+ var i18n_yes_no = '$encoder.jsEscape( $i18n.getString( "yes_no" ) , "'")';
+ var i18n_text = '$encoder.jsEscape( $i18n.getString( "text" ) , "'")';
+ var i18n_date = '$encoder.jsEscape( $i18n.getString( "date" ) , "'")';
+ var i18n_combo = '$encoder.jsEscape( $i18n.getString( "combo" ) , "'")';
var i18n_processing = '$encoder.jsEscape( $i18n.getString( "processing" ) , "'")';
var i18n_done = '$encoder.jsEscape( $i18n.getString( "done" ) , "'")';
var i18n_left_side = '$encoder.jsEscape( $i18n.getString( "left_side" ) , "'")';
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/validationCriteria.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/validationCriteria.vm 2013-12-06 11:18:39 +0000
@@ -1,5 +1,23 @@
<h3>$i18n.getString( "validation_criteria_management" ) #openHelp( "validation_criteria" )</h3>
+<!-- >
+<a href="showProgramsForValidationCriteriaForm.action?criteriaId=$criteria.id" title="$i18n.getString( 'assign_validation_for_programs' )"><img src="../images/assign.png" alt="$i18n.getString( 'assign_validation_for_programs' )"></a>
+<a href="showUpdateValidationCriteriaForm.action?id=$criteria.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
+<a href="javascript:translate( 'ValidationCriteria', '$criteria.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
+<a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.displayName )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
+<a href="javascript:showValidationCriteriaDetails( '$criteria.id' )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
+-->
+
+<div id="contextMenu" class="contextMenu" style="width: 210px;">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showProgramsForValidationCriteriaForm"><i class="fa fa-plus"></i> $i18n.getString( "assign_validation_for_programs" )</a></li>
+ <li><a data-target-fn="showUpdateValidationCriteriaForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li><a data-target-fn="removeCriteria"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showValidationCriteriaDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
<td style="vertical-align:top">
@@ -18,29 +36,24 @@
<thead>
<tr>
<th>$i18n.getString('name')</th>
- <th style="width:140px;" class="{sorter: false}">$i18n.getString('operator')</th>
</tr>
</thead>
<tbody id="list">
#foreach($criteria in $criterias)
- <tr id="tr${criteria.id}">
- <td onclick="javascript:showValidationCriteriaDetails( '$criteria.id' )">$criteria.displayName</td>
- <td>
- <a href="showProgramsForValidationCriteriaForm.action?criteriaId=$criteria.id" title="$i18n.getString( 'assign_validation_for_programs' )"><img src="../images/assign.png" alt="$i18n.getString( 'assign_validation_for_programs' )"></a>
- <a href="showUpdateValidationCriteriaForm.action?id=$criteria.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'ValidationCriteria', '$criteria.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- <a href="javascript:removeCriteria( '$criteria.id', '$encoder.jsEncode( $criteria.displayName )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- <a href="javascript:showValidationCriteriaDetails( '$criteria.id' )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
+ <tr id="tr${criteria.id}" data-id="$!criteria.id" data-uid="$!criteria.uid" data-type="ValidationCriteria" data-name="$encoder.htmlEncode( $!criteria.displayName )"
+ data-can-manage="$security.canManage( $criteria )"
+ data-can-update="$security.canUpdate( $criteria )"
+ data-can-delete="$security.canDelete( $criteria )">
+ <td>$encoder.htmlEncode( $!criteria.displayName )</td>
</tr>
#end
</tbody>
</table>
</td>
+
<td id="detailsData">
-
- <div id="detailsArea">
- <div id="hideDetailsArea">
+ <div id="detailsArea">
+ <div id="hideDetailsArea">
<a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/hide.png" alt="$i18n.getString( 'hide_details' )"></a>
</div>
<p><label class="bold">$i18n.getString( "name" ):</label><br><span id='nameField'></span></p>