dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #26607
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 13159: context-menus in maint-patient module, wip
------------------------------------------------------------
revno: 13159
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-12-06 09:54:56 +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/javascript/program.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.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/javascript/program.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-09-27 17:04:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/program.js 2013-12-06 08:54:56 +0000
@@ -1,456 +1,454 @@
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+
// -----------------------------------------------------------------------------
// View details
// -----------------------------------------------------------------------------
-function showProgramDetails( programId )
-{
- jQuery.getJSON( "getProgram.action", {
- id:programId
- }, function(json){
- setInnerHTML( 'nameField', json.program.name );
- setInnerHTML( 'descriptionField', json.program.description );
-
- var type = i18n_multiple_events_with_registration;
- if( json.program.type == "2" )
- type = i18n_single_event_with_registration;
- else if( json.program.type == "3" )
- type = i18n_single_event_without_registration;
- setInnerHTML( 'typeField', type );
-
- var displayIncidentDate = ( json.program.displayIncidentDate == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'displayIncidentDateField', displayIncidentDate );
-
- var ignoreOverdueEvents = ( json.program.ignoreOverdueEvents == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'ignoreOverdueEventsField', ignoreOverdueEvents );
-
- var onlyEnrollOnce = ( json.program.onlyEnrollOnce == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'onlyEnrollOnceField', onlyEnrollOnce );
-
- var displayOnAllOrgunit= ( json.program.displayOnAllOrgunit == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'displayOnAllOrgunitField', displayOnAllOrgunit );
-
- var useBirthDateAsIncidentDate = ( json.program.useBirthDateAsIncidentDate == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'useBirthDateAsIncidentDateField', useBirthDateAsIncidentDate );
-
- var useBirthDateAsEnrollmentDate = ( json.program.useBirthDateAsEnrollmentDate == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'useBirthDateAsEnrollmentDateField', useBirthDateAsEnrollmentDate );
-
- var selectEnrollmentDatesInFuture= ( json.program.selectEnrollmentDatesInFuture == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'selectEnrollmentDatesInFutureField', selectEnrollmentDatesInFuture );
-
- var selectIncidentDatesInFuture= ( json.program.selectIncidentDatesInFuture == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'selectIncidentDatesInFutureField', selectIncidentDatesInFuture );
-
- var dataEntryMethod= ( json.program.dataEntryMethod == 'true') ? i18n_yes : i18n_no;
- setInnerHTML( 'dataEntryMethodField', dataEntryMethod );
-
- setInnerHTML( 'dateOfEnrollmentDescriptionField', json.program.dateOfEnrollmentDescription );
- setInnerHTML( 'dateOfIncidentDescriptionField', json.program.dateOfIncidentDescription );
- setInnerHTML( 'programStageCountField', json.program.programStageCount );
- setInnerHTML( 'noAttributesField', json.program.noAttributes );
- setInnerHTML( 'noIdentifierTypesField', json.program.noIdentifierTypes );
-
- showDetails();
- });
+function programIndicatorManagementForm( context ) {
+ location.href = 'programIndicator.action?programId=' + context.id;
+}
+
+function showProgramUserRoleForm( context ) {
+ location.href = 'showProgramUserroleForm.action?id=' + context.id;
+}
+
+function showUpdateProgramForm( context ) {
+ location.href = 'showUpdateProgramForm.action?id=' + context.id;
+}
+
+function programStageManagement( context ) {
+ location.href = 'programStage.action?id=' + context.id;
+}
+
+function programValidationManagement( context ) {
+ location.href = 'programValidation.action?programId=' + context.id;
+}
+
+function defineProgramAssociationsForm( context ) {
+ location.href = 'defineProgramAssociationsForm.action?id=' + context.id;
+}
+
+function showProgramDetails( context ) {
+ jQuery.getJSON("getProgram.action", {
+ id: context.id
+ }, function( json ) {
+ setInnerHTML('nameField', json.program.name);
+ setInnerHTML('descriptionField', json.program.description);
+
+ var type = i18n_multiple_events_with_registration;
+ if( json.program.type == "2" )
+ type = i18n_single_event_with_registration;
+ else if( json.program.type == "3" )
+ type = i18n_single_event_without_registration;
+ setInnerHTML('typeField', type);
+
+ var displayIncidentDate = ( json.program.displayIncidentDate == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('displayIncidentDateField', displayIncidentDate);
+
+ var ignoreOverdueEvents = ( json.program.ignoreOverdueEvents == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('ignoreOverdueEventsField', ignoreOverdueEvents);
+
+ var onlyEnrollOnce = ( json.program.onlyEnrollOnce == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('onlyEnrollOnceField', onlyEnrollOnce);
+
+ var displayOnAllOrgunit = ( json.program.displayOnAllOrgunit == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('displayOnAllOrgunitField', displayOnAllOrgunit);
+
+ var useBirthDateAsIncidentDate = ( json.program.useBirthDateAsIncidentDate == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('useBirthDateAsIncidentDateField', useBirthDateAsIncidentDate);
+
+ var useBirthDateAsEnrollmentDate = ( json.program.useBirthDateAsEnrollmentDate == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('useBirthDateAsEnrollmentDateField', useBirthDateAsEnrollmentDate);
+
+ var selectEnrollmentDatesInFuture = ( json.program.selectEnrollmentDatesInFuture == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('selectEnrollmentDatesInFutureField', selectEnrollmentDatesInFuture);
+
+ var selectIncidentDatesInFuture = ( json.program.selectIncidentDatesInFuture == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('selectIncidentDatesInFutureField', selectIncidentDatesInFuture);
+
+ var dataEntryMethod = ( json.program.dataEntryMethod == 'true') ? i18n_yes : i18n_no;
+ setInnerHTML('dataEntryMethodField', dataEntryMethod);
+
+ setInnerHTML('dateOfEnrollmentDescriptionField', json.program.dateOfEnrollmentDescription);
+ setInnerHTML('dateOfIncidentDescriptionField', json.program.dateOfIncidentDescription);
+ setInnerHTML('programStageCountField', json.program.programStageCount);
+ setInnerHTML('noAttributesField', json.program.noAttributes);
+ setInnerHTML('noIdentifierTypesField', json.program.noIdentifierTypes);
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
// Remove Program
// -----------------------------------------------------------------------------
-function removeProgram( programId, name )
-{
- removeItem( programId, name, i18n_confirm_delete, 'removeProgram.action' );
-}
-
-function relationshipTypeOnchange()
-{
- clearListById( 'relationshipSide' );
- var relationshipType = jQuery('#relationshipTypeId option:selected');
- if( relationshipType.val() != "")
- {
- var aIsToB = relationshipType.attr('aIsToB');
- var bIsToA = relationshipType.attr('bIsToA');
-
- var relationshipSide = jQuery("#relationshipFromA");
- relationshipSide.append( '<option value="false">' + aIsToB + '</option>' );
- relationshipSide.append( '<option value="true">' + bIsToA + '</option>' );
- }
-}
-
-function programOnChange()
-{
- var type = getFieldValue('type');
-
- // anonymous
- if(type == "3")
- {
- disable('onlyEnrollOnce');
- disable('dateOfEnrollmentDescription');
- disable("displayIncidentDate");
- disable("dateOfIncidentDescription");
- disable("generatedByEnrollmentDate");
- disable("availablePropertyIds");
- disable('ignoreOverdueEvents');
- hideById('selectedList');
- hideById('programMessageTB');
-
- jQuery("[name=displayed]").attr("disabled", true);
- jQuery("[name=displayed]").removeAttr("checked");
-
- jQuery("[name=nonAnonymous]").hide();
- }
- else{
- enable('onlyEnrollOnce');
- jQuery("[name=displayed]").prop("disabled", false);
- enable("availablePropertyIds");
- enable("generatedByEnrollmentDate");
- enable('dateOfEnrollmentDescription');
- enable("displayIncidentDate");
- enable('ignoreOverdueEvents');
- showById('programMessageTB');
- showById("selectedList");
-
- jQuery("[name=nonAnonymous]").show();
- if( type == 2 ){
- disable('ignoreOverdueEvents');
- disable('onlyEnrollOnce');
- disable('generatedByEnrollmentDate');
- }
-
- if(byId('displayIncidentDate').checked){
- enable("dateOfIncidentDescription");
- }
- else {
- disable("dateOfIncidentDescription");
- }
- }
+function removeProgram( context ) {
+ removeItem(context.id, context.name, i18n_confirm_delete, 'removeProgram.action');
+}
+
+function relationshipTypeOnchange() {
+ clearListById('relationshipSide');
+ var relationshipType = jQuery('#relationshipTypeId option:selected');
+ if( relationshipType.val() != "" ) {
+ var aIsToB = relationshipType.attr('aIsToB');
+ var bIsToA = relationshipType.attr('bIsToA');
+
+ var relationshipSide = jQuery("#relationshipFromA");
+ relationshipSide.append('<option value="false">' + aIsToB + '</option>');
+ relationshipSide.append('<option value="true">' + bIsToA + '</option>');
+ }
+}
+
+function programOnChange() {
+ var type = getFieldValue('type');
+
+ // anonymous
+ if( type == "3" ) {
+ disable('onlyEnrollOnce');
+ disable('dateOfEnrollmentDescription');
+ disable("displayIncidentDate");
+ disable("dateOfIncidentDescription");
+ disable("generatedByEnrollmentDate");
+ disable("availablePropertyIds");
+ disable('ignoreOverdueEvents');
+ hideById('selectedList');
+ hideById('programMessageTB');
+
+ jQuery("[name=displayed]").attr("disabled", true);
+ jQuery("[name=displayed]").removeAttr("checked");
+
+ jQuery("[name=nonAnonymous]").hide();
+ }
+ else {
+ enable('onlyEnrollOnce');
+ jQuery("[name=displayed]").prop("disabled", false);
+ enable("availablePropertyIds");
+ enable("generatedByEnrollmentDate");
+ enable('dateOfEnrollmentDescription');
+ enable("displayIncidentDate");
+ enable('ignoreOverdueEvents');
+ showById('programMessageTB');
+ showById("selectedList");
+
+ jQuery("[name=nonAnonymous]").show();
+ if( type == 2 ) {
+ disable('ignoreOverdueEvents');
+ disable('onlyEnrollOnce');
+ disable('generatedByEnrollmentDate');
+ }
+
+ if( byId('displayIncidentDate').checked ) {
+ enable("dateOfIncidentDescription");
+ }
+ else {
+ disable("dateOfIncidentDescription");
+ }
+ }
}
// -----------------------------------------------------------------------------
// select identifiers / attributes
// -----------------------------------------------------------------------------
-function selectProperties()
-{
- var selectedList = jQuery("#selectedList");
- jQuery("#availablePropertyIds").children().each(function(i, item){
- if( item.selected ){
- html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectProperties( this )'><td onmousedown='select(event,this)'>" + item.text + "</td>";
- html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
- if( item.value.match("^attr_")=="attr_" )
- {
- html += " style='display:none' ";
- }
- html += "></td></tr>";
- selectedList.append( html );
- jQuery( item ).remove();
- }
- });
-
- if(getFieldValue('type') == "3")
- {
- jQuery("[name=displayed]").attr("disabled", true);
- }
-}
-
-function selectAllProperties()
-{
- var selectedList = jQuery("#selectedList");
- jQuery("#availablePropertyIds").children().each(function(i, item){
- html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectDataElement( this )'><td onmousedown='select(this)'>" + item.text + "</td>";
- html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
- if( item.value.match("^attr_")=="attr_" )
- {
- html += " style='display:none' ";
- }
- html += "'></td></tr>";
- selectedList.append( html );
- jQuery( item ).remove();
- });
-}
-
-function unSelectProperties()
-{
- var availableList = jQuery("#availablePropertyIds");
- jQuery("#selectedList").find("tr").each( function( i, item ){
- item = jQuery(item);
- if( item.hasClass("selected") )
- {
- availableList.append( "<option value='" + item.attr( "id" ) + "' selected='true'>" + item.find("td:first").text() + "</option>" );
- item.remove();
- }
- });
-}
-
-function unSelectAllProperties()
-{
- var availableList = jQuery("#availablePropertyIds");
- jQuery("#selectedList").find("tr").each( function( i, item ){
- item = jQuery(item);
- availableList.append( "<option value='" + item.attr( "id" ) + "' selected='true'>" + item.find("td:first").text() + "</option>" );
- item.remove();
- });
-}
-
-function select( event, element )
-{
- if ( !getKeyCode( event ) )// Ctrl
- {
- jQuery("#selectedList .selected").removeClass( 'selected' );
- }
-
- element = jQuery( element ).parent();
- if( element.hasClass( 'selected') ) element.removeClass( 'selected' );
- else element.addClass( 'selected' );
-}
-
-function getKeyCode(e)
-{
- var ctrlPressed=0;
-
- if (parseInt(navigator.appVersion)>3) {
-
- var evt = e ? e:window.event;
-
- if (document.layers && navigator.appName=="Netscape"
- && parseInt(navigator.appVersion)==4) {
- // NETSCAPE 4 CODE
- var mString =(e.modifiers+32).toString(2).substring(3,6);
- ctrlPressed =(mString.charAt(1)=="1");
- }
- else {
- // NEWER BROWSERS [CROSS-PLATFORM]
- ctrlPressed=evt.ctrlKey;
- }
- }
- return ctrlPressed;
+function selectProperties() {
+ var selectedList = jQuery("#selectedList");
+ jQuery("#availablePropertyIds").children().each(function( i, item ) {
+ if( item.selected ) {
+ html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectProperties( this )'><td onmousedown='select(event,this)'>" + item.text + "</td>";
+ html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
+ if( item.value.match("^attr_") == "attr_" ) {
+ html += " style='display:none' ";
+ }
+ html += "></td></tr>";
+ selectedList.append(html);
+ jQuery(item).remove();
+ }
+ });
+
+ if( getFieldValue('type') == "3" ) {
+ jQuery("[name=displayed]").attr("disabled", true);
+ }
+}
+
+function selectAllProperties() {
+ var selectedList = jQuery("#selectedList");
+ jQuery("#availablePropertyIds").children().each(function( i, item ) {
+ html = "<tr class='selected' id='" + item.value + "' ondblclick='unSelectDataElement( this )'><td onmousedown='select(this)'>" + item.text + "</td>";
+ html += "<td align='center'><input type='checkbox' name='displayed' value='" + item.value + "'";
+ if( item.value.match("^attr_") == "attr_" ) {
+ html += " style='display:none' ";
+ }
+ html += "'></td></tr>";
+ selectedList.append(html);
+ jQuery(item).remove();
+ });
+}
+
+function unSelectProperties() {
+ var availableList = jQuery("#availablePropertyIds");
+ jQuery("#selectedList").find("tr").each(function( i, item ) {
+ item = jQuery(item);
+ if( item.hasClass("selected") ) {
+ availableList.append("<option value='" + item.attr("id") + "' selected='true'>" + item.find("td:first").text() + "</option>");
+ item.remove();
+ }
+ });
+}
+
+function unSelectAllProperties() {
+ var availableList = jQuery("#availablePropertyIds");
+ jQuery("#selectedList").find("tr").each(function( i, item ) {
+ item = jQuery(item);
+ availableList.append("<option value='" + item.attr("id") + "' selected='true'>" + item.find("td:first").text() + "</option>");
+ item.remove();
+ });
+}
+
+function select( event, element ) {
+ if( !getKeyCode(event) )// Ctrl
+ {
+ jQuery("#selectedList .selected").removeClass('selected');
+ }
+
+ element = jQuery(element).parent();
+ if( element.hasClass('selected') ) element.removeClass('selected');
+ else element.addClass('selected');
+}
+
+function getKeyCode( e ) {
+ var ctrlPressed = 0;
+
+ if( parseInt(navigator.appVersion) > 3 ) {
+
+ var evt = e ? e : window.event;
+
+ if( document.layers && navigator.appName == "Netscape"
+ && parseInt(navigator.appVersion) == 4 ) {
+ // NETSCAPE 4 CODE
+ var mString = (e.modifiers + 32).toString(2).substring(3, 6);
+ ctrlPressed = (mString.charAt(1) == "1");
+ }
+ else {
+ // NEWER BROWSERS [CROSS-PLATFORM]
+ ctrlPressed = evt.ctrlKey;
+ }
+ }
+ return ctrlPressed;
}
//-----------------------------------------------------------------------------
//Move Table Row Up and Down
//-----------------------------------------------------------------------------
-function moveUpPropertyList()
-{
- var selectedList = jQuery("#selectedList");
+function moveUpPropertyList() {
+ var selectedList = jQuery("#selectedList");
- jQuery("#selectedList").find("tr").each( function( i, item ){
- item = jQuery(item);
- if( item.hasClass("selected") )
- {
- var prev = item.prev('#selectedList tr');
- if (prev.length == 1)
- {
- prev.before(item);
- }
- }
- });
+ jQuery("#selectedList").find("tr").each(function( i, item ) {
+ item = jQuery(item);
+ if( item.hasClass("selected") ) {
+ var prev = item.prev('#selectedList tr');
+ if( prev.length == 1 ) {
+ prev.before(item);
+ }
+ }
+ });
}
-function moveDownPropertyList()
-{
- var selectedList = jQuery("#selectedList");
- var items = new Array();
- jQuery("#selectedList").find("tr").each( function( i, item ){
- items.push(jQuery(item));
- });
-
- for( var i=items.length-1;i>=0;i--)
- {
- var item = items[i];
- if( item.hasClass("selected") )
- {
- var next = item.next('#selectedList tr');
- if (next.length == 1)
- {
- next.after(item);
- }
- }
- }
+function moveDownPropertyList() {
+ var selectedList = jQuery("#selectedList");
+ var items = new Array();
+ jQuery("#selectedList").find("tr").each(function( i, item ) {
+ items.push(jQuery(item));
+ });
+
+ for( var i = items.length - 1; i >= 0; i-- ) {
+ var item = items[i];
+ if( item.hasClass("selected") ) {
+ var next = item.next('#selectedList tr');
+ if( next.length == 1 ) {
+ next.after(item);
+ }
+ }
+ }
}
// --------------------------------------------------------------------
// Generate template message form
// --------------------------------------------------------------------
-function generateTemplateMessageForm()
-{
- var rowId = jQuery('.daysAllowedSendMessage').length + 1;
- var contend = '<tr name="tr' + rowId + '" class="listAlternateRow" >'
- + '<td colspan="2">' + i18n_reminder + ' ' + rowId + '<a href="javascript:removeTemplateMessageForm('+ rowId +')"> ( '+ i18n_remove_reminder + ' )</a></td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td><label>' + i18n_send_when_to + '</label></td>'
- + '<td>'
- + '<select id="whenToSend' + rowId + '" name="whenToSend' + rowId + '" class="whenToSend" onchange="whenToSendOnChange(' + rowId + ')" >'
- + '<option value="">' + i18n_days_scheduled + '</option>'
- + '<option value="3">' + i18n_complete_program + '</option>'
- + '<option value="1">' + i18n_program_enrollment + '</option>'
- + '</select>'
- + '</td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td><label>' + i18n_date_to_compare + '</label></td>'
- + '<td>'
- + '<select id="dateToCompare' + rowId + '" class="dateToCompare">'
- + '<option value="dateofincident">' + i18n_incident_date + '</option>'
- + '<option value="enrollmentdate">' + i18n_enrollment_date + '</option>'
- + '</select>'
- + '</td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td><label>' + i18n_send_message + '</label></td>'
- + '<td>'
- + '<input type="text" onchange="setRealDays(' + rowId + ')" style="width:100px;" realvalue="" id="daysAllowedSendMessage' + rowId + '" name="daysAllowedSendMessage' + rowId + '" class="daysAllowedSendMessage {validate:{required:true,number:true}}"/> '
- + i18n_days
- + ' <select id="time' + rowId + '" name="time' + rowId + '" style="width:100px;" onchange="setRealDays(' + rowId + ')" >'
- + '<option value="1">' + i18n_before + '</option>'
- + '<option value="-1">' + i18n_after + '</option>'
- + '</select> '
- + i18n_scheduled_date
- + ' </td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td><label>' + i18n_recipients + '</label></td>'
- + '<td>'
- + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" onchange="onchangeUserGroup('+ rowId +')">'
- + '<option value="1">' + i18n_patient_sms_only + '</option>'
- + '<option value="3">' + i18n_orgunit_phone_number_sms_only + '</option>'
- + '<option value="2">' + i18n_health_worker_assigned_to_person + '</option>'
- + '<option value="4">' + i18n_all_users_at_orgunit + '</option>'
- + '<option value="5">' + i18n_user_group + '</option>'
- + '</select>'
- + '</td>'
- + '/<tr>'
- + '<tr name="tr' + rowId + '" id="tr' + rowId + '">'
- + '<td><label>' + i18n_user_group + '</label></td>'
- + '<td>'
- + program_SMS_reminder_form
- + '</td>'
- + '/<tr>'
- + '<tr name="tr' + rowId + '">'
- + ' <td><label>' + i18n_message_type + '</label></td>'
- + ' <td>'
- + ' <select type="text" id="messageType' + rowId + '" name="messageType' + rowId + '" class="messageType {validate:{required:true,number:true}}" >'
- + ' <option value="1">' + i18n_direct_sms + '</option>'
- + ' <option value="2">' + i18n_message + '</option>'
- + ' <option value="3">' + i18n_both + '</option>'
- + ' </select>'
- + ' </td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td>' + i18n_params + '</td>'
- + '<td>'
- + '<select multiple size="4" id="params' + rowId +'" name="params" ondblclick="insertParams(this.value, ' + rowId + ');">'
- + '<option value="{patient-name}">' + i18n_patient_name + '</option>'
- + '<option value="{program-name}">' + i18n_program_name + '</option>'
- + '<option value="{incident-date}">' + i18n_incident_date + '</option>'
- + '<option value="{days-since-incident-date}">' + i18n_days_since_incident_date + '</option>'
- + '<option value="{enrollement-date}">' + i18n_enrollment_date + '</option>'
- + '<option value="{days-since-enrollement-date}">' + i18n_days_since_enrollment_date + '</option>'
- + '<option value="{orgunit-name}">' + i18n_orgunit_name + '</option>'
- + '</select>'
- + '</td>'
- + '</tr>'
- + '<tr name="tr' + rowId + '">'
- + '<td><label>' + i18n_message + '</label></td>'
- + '<td><textarea onkeyup="getMessageLength( ' + rowId + ');" id="templateMessage' + rowId + '" name="templateMessage' + rowId + '" style="width:320px" class="templateMessage {validate:{required:true}}"></textarea></td>'
- + '</tr>'
- + '<tr>'
- + '<td></td>'
- + '<td id="messageLengthTD' + rowId + '"></td>'
- + '</tr>';
-
- jQuery('#programStageMessage').append( contend );
- showHideUserGroup();
-}
-
-function showHideUserGroup()
-{
- jQuery(".sendTo").each( function( i, item ){
- var numb = i+1;
- if( item.value == 5){
- showById( 'tr'+numb );
- }
- else
- hideById ( 'tr'+numb );
- });
-}
-
-function removeTemplateMessageForm( rowId )
-{
- jQuery("[name=tr" + rowId + "]").remove();
-}
-
-function insertParams( paramValue, rowId )
-{
- var templateMessage = paramValue;
- insertTextCommon('templateMessage' + rowId, templateMessage);
- getMessageLength(rowId );
-}
-
-function whenToSendOnChange(index)
-{
- var whenToSend = getFieldValue('whenToSend' + index );
- if(whenToSend==""){
- enable('dateToCompare' + index );
- enable('daysAllowedSendMessage' + index );
- enable('time' + index );
- }
- else{
- disable('dateToCompare' + index );
- disable('daysAllowedSendMessage' + index );
- disable('time' + index );
- }
-}
-
-function getMessageLength(rowId)
-{
- var message = getFieldValue( 'templateMessage' + rowId );
- var length = 0;
- var idx = message.indexOf('{');
- while( idx >=0 ){
- length += message.substr(0,idx).length;
- var end = message.indexOf('}');
- if(end>=0){
- message = message.substr(end + 1, message.length);
- idx = message.indexOf('{');
- }
- }
- length += message.length;
- setInnerHTML('messageLengthTD' + rowId, length + " " + i18n_characters_without_params);
- if( length>=160 )
- {
- jQuery('#templateMessage' + rowId ).attr('maxlength', 160);
- }
- else
- {
- jQuery('#templateMessage' + rowId ).removeAttr('maxlength');
- }
-}
-
-function setRealDays(rowId)
-{
- var daysAllowedSendMessage = jQuery("#daysAllowedSendMessage" + rowId);
- var time = jQuery("#time" + rowId + " option:selected ").val();
- daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
- var aasdf= 0;
-}
-
-function onchangeUserGroup( id )
-{
- var value = document.getElementById( 'sendTo' + id ).value;
- hideById( 'tr'+id );
-
- if( value=="1" || value=="3" ){
- setFieldValue('messageType' + id , '1');
- disable('messageType' + id );
- }
- else{
- if ( value == "5") {
- showById( 'tr' + id );
- }
- enable ('messageType' + id );
- }
+function generateTemplateMessageForm() {
+ var rowId = jQuery('.daysAllowedSendMessage').length + 1;
+ var contend = '<tr name="tr' + rowId + '" class="listAlternateRow" >'
+ + '<td colspan="2">' + i18n_reminder + ' ' + rowId + '<a href="javascript:removeTemplateMessageForm(' + rowId + ')"> ( ' + i18n_remove_reminder + ' )</a></td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td><label>' + i18n_send_when_to + '</label></td>'
+ + '<td>'
+ + '<select id="whenToSend' + rowId + '" name="whenToSend' + rowId + '" class="whenToSend" onchange="whenToSendOnChange(' + rowId + ')" >'
+ + '<option value="">' + i18n_days_scheduled + '</option>'
+ + '<option value="3">' + i18n_complete_program + '</option>'
+ + '<option value="1">' + i18n_program_enrollment + '</option>'
+ + '</select>'
+ + '</td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td><label>' + i18n_date_to_compare + '</label></td>'
+ + '<td>'
+ + '<select id="dateToCompare' + rowId + '" class="dateToCompare">'
+ + '<option value="dateofincident">' + i18n_incident_date + '</option>'
+ + '<option value="enrollmentdate">' + i18n_enrollment_date + '</option>'
+ + '</select>'
+ + '</td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td><label>' + i18n_send_message + '</label></td>'
+ + '<td>'
+ + '<input type="text" onchange="setRealDays(' + rowId + ')" style="width:100px;" realvalue="" id="daysAllowedSendMessage' + rowId + '" name="daysAllowedSendMessage' + rowId + '" class="daysAllowedSendMessage {validate:{required:true,number:true}}"/> '
+ + i18n_days
+ + ' <select id="time' + rowId + '" name="time' + rowId + '" style="width:100px;" onchange="setRealDays(' + rowId + ')" >'
+ + '<option value="1">' + i18n_before + '</option>'
+ + '<option value="-1">' + i18n_after + '</option>'
+ + '</select> '
+ + i18n_scheduled_date
+ + ' </td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td><label>' + i18n_recipients + '</label></td>'
+ + '<td>'
+ + '<select id="sendTo' + rowId + '" name="sendTo' + rowId + '" class="sendTo" onchange="onchangeUserGroup(' + rowId + ')">'
+ + '<option value="1">' + i18n_patient_sms_only + '</option>'
+ + '<option value="3">' + i18n_orgunit_phone_number_sms_only + '</option>'
+ + '<option value="2">' + i18n_health_worker_assigned_to_person + '</option>'
+ + '<option value="4">' + i18n_all_users_at_orgunit + '</option>'
+ + '<option value="5">' + i18n_user_group + '</option>'
+ + '</select>'
+ + '</td>'
+ + '/<tr>'
+ + '<tr name="tr' + rowId + '" id="tr' + rowId + '">'
+ + '<td><label>' + i18n_user_group + '</label></td>'
+ + '<td>'
+ + program_SMS_reminder_form
+ + '</td>'
+ + '/<tr>'
+ + '<tr name="tr' + rowId + '">'
+ + ' <td><label>' + i18n_message_type + '</label></td>'
+ + ' <td>'
+ + ' <select type="text" id="messageType' + rowId + '" name="messageType' + rowId + '" class="messageType {validate:{required:true,number:true}}" >'
+ + ' <option value="1">' + i18n_direct_sms + '</option>'
+ + ' <option value="2">' + i18n_message + '</option>'
+ + ' <option value="3">' + i18n_both + '</option>'
+ + ' </select>'
+ + ' </td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td>' + i18n_params + '</td>'
+ + '<td>'
+ + '<select multiple size="4" id="params' + rowId + '" name="params" ondblclick="insertParams(this.value, ' + rowId + ');">'
+ + '<option value="{patient-name}">' + i18n_patient_name + '</option>'
+ + '<option value="{program-name}">' + i18n_program_name + '</option>'
+ + '<option value="{incident-date}">' + i18n_incident_date + '</option>'
+ + '<option value="{days-since-incident-date}">' + i18n_days_since_incident_date + '</option>'
+ + '<option value="{enrollement-date}">' + i18n_enrollment_date + '</option>'
+ + '<option value="{days-since-enrollement-date}">' + i18n_days_since_enrollment_date + '</option>'
+ + '<option value="{orgunit-name}">' + i18n_orgunit_name + '</option>'
+ + '</select>'
+ + '</td>'
+ + '</tr>'
+ + '<tr name="tr' + rowId + '">'
+ + '<td><label>' + i18n_message + '</label></td>'
+ + '<td><textarea onkeyup="getMessageLength( ' + rowId + ');" id="templateMessage' + rowId + '" name="templateMessage' + rowId + '" style="width:320px" class="templateMessage {validate:{required:true}}"></textarea></td>'
+ + '</tr>'
+ + '<tr>'
+ + '<td></td>'
+ + '<td id="messageLengthTD' + rowId + '"></td>'
+ + '</tr>';
+
+ jQuery('#programStageMessage').append(contend);
+ showHideUserGroup();
+}
+
+function showHideUserGroup() {
+ jQuery(".sendTo").each(function( i, item ) {
+ var numb = i + 1;
+ if( item.value == 5 ) {
+ showById('tr' + numb);
+ }
+ else
+ hideById('tr' + numb);
+ });
+}
+
+function removeTemplateMessageForm( rowId ) {
+ jQuery("[name=tr" + rowId + "]").remove();
+}
+
+function insertParams( paramValue, rowId ) {
+ var templateMessage = paramValue;
+ insertTextCommon('templateMessage' + rowId, templateMessage);
+ getMessageLength(rowId);
+}
+
+function whenToSendOnChange( index ) {
+ var whenToSend = getFieldValue('whenToSend' + index);
+ if( whenToSend == "" ) {
+ enable('dateToCompare' + index);
+ enable('daysAllowedSendMessage' + index);
+ enable('time' + index);
+ }
+ else {
+ disable('dateToCompare' + index);
+ disable('daysAllowedSendMessage' + index);
+ disable('time' + index);
+ }
+}
+
+function getMessageLength( rowId ) {
+ var message = getFieldValue('templateMessage' + rowId);
+ var length = 0;
+ var idx = message.indexOf('{');
+ while( idx >= 0 ) {
+ length += message.substr(0, idx).length;
+ var end = message.indexOf('}');
+ if( end >= 0 ) {
+ message = message.substr(end + 1, message.length);
+ idx = message.indexOf('{');
+ }
+ }
+ length += message.length;
+ setInnerHTML('messageLengthTD' + rowId, length + " " + i18n_characters_without_params);
+ if( length >= 160 ) {
+ jQuery('#templateMessage' + rowId).attr('maxlength', 160);
+ }
+ else {
+ jQuery('#templateMessage' + rowId).removeAttr('maxlength');
+ }
+}
+
+function setRealDays( rowId ) {
+ var daysAllowedSendMessage = jQuery("#daysAllowedSendMessage" + rowId);
+ var time = jQuery("#time" + rowId + " option:selected ").val();
+ daysAllowedSendMessage.attr("realvalue", time * eval(daysAllowedSendMessage).val());
+ var aasdf = 0;
+}
+
+function onchangeUserGroup( id ) {
+ var value = document.getElementById('sendTo' + id).value;
+ hideById('tr' + id);
+
+ if( value == "1" || value == "3" ) {
+ setFieldValue('messageType' + id, '1');
+ disable('messageType' + id);
+ }
+ else {
+ if( value == "5" ) {
+ showById('tr' + id);
+ }
+ enable('messageType' + id);
+ }
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-09-24 11:21:38 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/programStage.js 2013-12-06 08:54:56 +0000
@@ -1,3 +1,25 @@
+$(function() {
+ dhis2.contextmenu.makeContextMenu({
+ menuId: 'contextMenu',
+ menuItemActiveClass: 'contextMenuItemActive'
+ });
+});
+
+function removeProgramStage( context ) {
+ removeItem( context.id, context.name, i18n_confirm_delete , 'removeProgramStage.action' );
+}
+
+function showUpdateProgramStageForm( context ) {
+ location.href = 'showUpdateProgramStageForm.action?id=' + context.id;
+}
+
+function viewDataEntryForm( context ) {
+ location.href = 'viewDataEntryForm.action?programStageId=' + context.id;
+}
+
+function programStageSectionList( context ) {
+ location.href = 'programStageSectionList.action?id=' + context.id;
+}
function getStageByProgram( programId )
{
@@ -49,9 +71,9 @@
// View details
// -----------------------------------------------------------------------------
-function showProgramStageDetails( programStageId )
+function showProgramStageDetails( context )
{
- jQuery.getJSON( 'getProgramStage.action', { id: programStageId }, function ( json ) {
+ jQuery.getJSON( 'getProgramStage.action', { id: context.id }, function ( json ) {
setInnerHTML( 'nameField', json.programStage.name );
setInnerHTML( 'descriptionField', json.programStage.description );
setInnerHTML( 'scheduledDaysFromStartField', json.programStage.minDaysFromStart );
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm 2013-10-10 03:11:32 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/patientRegistrationForm.vm 2013-12-06 08:54:56 +0000
@@ -30,7 +30,7 @@
$i18n.getString('no_program')
#set($hasCommonForm = 'true')
#end
- </td>
+ </td>
<td style="text-align:center">
<a href="javascript:updateNewForm($registrationForm.id, '$!registrationForm.program.id')" title="$i18n.getString( 'edit' )"><img src="../images/edit_layout.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
<a href="javascript:removeRegistrationForm( '$!registrationForm.program.id', '$!encoder.jsEncode( $registrationForm.program.name )')" title="$i18n.getString( "remove" )"><img id='active_$registrationForm.program.id' src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-10-21 07:40:21 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programList.vm 2013-12-06 08:54:56 +0000
@@ -2,86 +2,56 @@
<h3>$i18n.getString( "program_management" ) #openHelp( "program" )</h3>
+<div id="contextMenu" class="contextMenu" style="width: 250px;">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li data-enabled="canUpdate"><a data-target-fn="defineProgramAssociationsForm"><i class="fa fa-plus"></i> $i18n.getString( "assign_program_to_orgunits" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="showProgramUserRoleForm"><i class="fa fa-plus"></i> $i18n.getString( "assign_program_to_userroles" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="showUpdateProgramForm"><i class="fa fa-edit"></i> $i18n.getString( "edit" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="programStageManagement"><i class="fa fa-edit"></i> $i18n.getString( "view_program_stages" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="programValidationManagement"><i class="fa fa-edit"></i> $i18n.getString( "program_validation_rule_management" )</a></li>
+ <li data-enabled="canManageForm"><a data-target-fn="programIndicatorManagementForm"><i class="fa fa-edit"></i> $i18n.getString( "program_indicator_management_form" )</a></li>
+ <li data-enabled="canManage"><a data-target-fn="showSharingDialogWithContext"><i class="fa fa-share"></i> $i18n.getString( "sharing_settings" )</a></li>
+ <li data-enabled="canUpdate"><a data-target-fn="translateWithContext"><i class="fa fa-globe"></i> $i18n.getString( "translation_translate" )</a></li>
+ <li data-enabled="canDelete"><a data-target-fn="removeProgram"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showProgramDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ </ul>
+</div>
+
<table class="mainPageTable">
<tr>
- <td align="right"><input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddProgramForm.action'" style="width:70px"></td>
+ <td align="right">
+ <input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddProgramForm.action'" style="width:70px">
+ </td>
</tr>
+
<tr>
<td style="vertical-align:top">
<table class="listTable" id="listTable">
- <col>
- <col width="300">
- <thead>
+ <col>
+ <thead>
<tr>
<th>$i18n.getString( "name" )</th>
- <th class="{sorter: false}">$i18n.getString( "operations" )</th>
</tr>
</thead>
- <tbody id="list">
- #foreach( $program in $programs )
- <tr id="tr${program.id}">
-
- <td onclick="showProgramDetails( $program.id )">$encoder.htmlEncode( $program.displayName )</td>
-
- <td style="text-align:center">
- <!-- assign orgunit -->
- #if( $security.canUpdate( $program ) )
- <a href="defineProgramAssociationsForm.action?id=$program.id" title="$i18n.getString( 'assign_program_to_orgunits' )"><img src="../images/assign.png" alt="$i18n.getString( 'assign_program_to_orgunits' )"></a>
- #else
- <img src="../images/assign-denied.png">
- #end
-
- #if( $security.canUpdate( $program ) )
- <!-- assign userrole -->
- <a href="showProgramUserroleForm.action?id=$program.id" title="$i18n.getString( 'assign_program_to_userroles' )"><img src="images/userrole.png" alt="$i18n.getString( 'assign_program_to_userroles' )"></a>
- <a href="showUpdateProgramForm.action?id=$program.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="programStage.action?id=$program.id" title="$i18n.getString( 'view_program_stages' )"><img src="../images/add_section.png" alt="$i18n.getString( 'view_stage_management' )"></a>
- <a href="programValidation.action?programId=$program.id" title="$i18n.getString( 'program_validation_rule_management' )"><img src="../images/assign_b.png" alt="$i18n.getString( 'program_validation_rule_management' )"></a>
- #else
- <img src="images/userrole-defined.png">
- <img src="../images/edit-denied.png">
- <img src="images/programstage-denied.png">
- <img src="../images/assign_b-denied.png">
- #end
-
- #if( $auth.hasAccess( "dhis-web-maintenance-patient", "programIndicator" ) && $program.type !='3' )
- <a href="programIndicator.action?programId=$program.id" title="$i18n.getString( 'program_indicator_management_form' )"><img src="images/indicator.png" ></a>
- #else
- <img src="images/indicator_denied.png">
- #end
-
- #if ( $security.canManage( $program ) )
- <a href="javascript:showSharingDialog('program', '$program.uid');" title="$i18n.getString( 'sharing_settings' )"><img src="../images/relationship.png" alt="$i18n.getString( 'sharing_settings' )"></a>
- #else
- <img src="../images/relationship-denied.png">
- #end
-
- #if( $security.canUpdate( $program ) )
- <a href="javascript:translate( 'Program', '$program.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- #else
- <img src="../images/i18n-denied.png">
- #end
-
- #if( $security.canDelete( $program ) )
- <a href="javascript:removeProgram( '$program.id', '$encoder.jsEncode( $program.displayName )' )" title="$i18n.getString( "remove" )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- #else
- <img src="../images/delete-denied.png">
- #end
-
- <a href="javascript:showProgramDetails( $program.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- </td>
-
- </tr>
- #end
+ <tbody id="list">
+ #foreach( $program in $programs )
+ <tr id="tr${program.id}" data-id="$!program.id" data-uid="$!program.uid" data-type="Program" data-name="$encoder.htmlEncode( $!program.displayName )"
+ data-can-manage="$security.canManage( $program )"
+ data-can-update="$security.canUpdate( $program )"
+ data-can-delete="$security.canDelete( $program )"
+ data-can-manage-form="#if( $auth.hasAccess( "dhis-web-maintenance-patient", "programIndicator" ) && $program.type !='3' )true#{else}false#end">
+ <td>$encoder.htmlEncode( $!program.displayName )</td>
+ </tr>
+ #end
- </tbody>
- </table>
+ </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>
@@ -113,6 +83,6 @@
var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'" )';
var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ), "'")';
var i18n_multiple_events_with_registration = '$encoder.jsEscape( $i18n.getString( "multiple_events_with_registration" ) , "'")';
- var i18n_single_event_with_registration = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")';
- var i18n_single_event_without_registration = '$encoder.jsEscape( $i18n.getString( "single_event_without_registration" ) , "'")';
+ var i18n_single_event_with_registration = '$encoder.jsEscape( $i18n.getString( "single_event_with_registration" ) , "'")';
+ var i18n_single_event_without_registration = '$encoder.jsEscape( $i18n.getString( "single_event_without_registration" ) , "'")';
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-09-19 12:43:34 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/programStage.vm 2013-12-06 08:54:56 +0000
@@ -2,6 +2,17 @@
<h4>$program.displayName</h4>
+<div id="contextMenu" class="contextMenu">
+ <ul id="contextMenuItems" class="contextMenuItems">
+ <li><a data-target-fn="showUpdateProgramStageForm"><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 data-enabled="canRemove"><a data-target-fn="removeProgramStage"><i class="fa fa-trash-o"></i> $i18n.getString( "remove" )</a></li>
+ <li><a data-target-fn="showProgramStageDetails"><i class="fa fa-info-circle"></i> $i18n.getString( "show_details" )</a></li>
+ <li><a data-target-fn="programStageSectionList"><i class="fa fa-edit"></i> $i18n.getString( "section_management" )</a></li>
+ <li><a data-target-fn="viewDataEntryForm"><i class="fa fa-edit"></i> $i18n.getString( "design_data_entry_form" )</a></li>
+ </ul>
+</div>
+
<input type='hidden' id='id' name='id' value='$program.id'>
<table class="mainPageTable">
@@ -19,43 +30,31 @@
<table class="listTable" id="listTable">
<col>
<col>
- <col width="180">
<thead>
- <tr>
+ <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( $association in $associations )
- <tr id="tr${association.id}" #alternate( $mark )>
- <td onclick="showProgramStageDetails( $association.id )">$encoder.htmlEncode( $association.displayName )</td>
- <td onclick="showProgramStageDetails( $association.id )">$encoder.htmlEncode( $association.description )</td>
-
- <td style="text-align:center"#alternate( $mark )>
- <a href="showUpdateProgramStageForm.action?id=$association.id" title="$i18n.getString( "edit" )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"></a>
- <a href="javascript:translate( 'ProgramStage', '$association.id' )" title="$i18n.getString( 'translation_translate' )"><img src="../images/i18n.png" alt="$i18n.getString( 'translation_translate' )"/></a>
- #if( $program.type=='1' )
- <a href="javascript:removeItem( '$association.id', '$encoder.jsEncode( $association.name )', i18n_confirm_delete , 'removeProgramStage.action' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"></a>
- #end
- <a href="javascript:showProgramStageDetails( $association.id )" title="$i18n.getString( "show_details" )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"></a>
- <a href="programStageSectionList.action?id=$association.id" title="$i18n.getString( 'section_management' )"><img src="images/sections.png" alt="$i18n.getString( 'section_management' )"></a>
- <a href="viewDataEntryForm.action?programStageId=$association.id" title="$i18n.getString( "design_data_entry_form" )"><img src="../images/edit_layout.png" alt="$i18n.getString( 'design_data_entry_form' )"></a>
- </td>
+ <tr id="tr${association.id}" data-id="$!association.id" data-uid="$!association.uid" data-type="ProgramStage" data-name="$encoder.htmlEncode( $!association.displayName )"
+ data-can-manage="$security.canManage( $association )"
+ data-can-update="$security.canUpdate( $association )"
+ data-can-delete="$security.canDelete( $association )"
+ data-can-remove="#if( $program.type=='1' )true#{else}false#end">
+ <td>$encoder.htmlEncode( $!association.displayName )</td>
+ <td>$encoder.htmlEncode( $!association.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>