From c566e016a3b26af04b8a131278dc32a800144b7b Mon Sep 17 00:00:00 2001 From: deepak-srivastava Date: Fri, 3 Oct 2014 15:29:00 +0100 Subject: [PATCH] if else spacing, and ts tags --- templates/CRM/Core/Form/RecurringEntity.tpl | 124 +++++++++--------- .../Form/ManageEvent/ConfirmRepeatMode.tpl | 12 +- .../CRM/Event/Form/ManageEvent/Repeat.tpl | 2 +- templates/CRM/Event/Page/DashBoard.tpl | 4 +- 4 files changed, 71 insertions(+), 71 deletions(-) diff --git a/templates/CRM/Core/Form/RecurringEntity.tpl b/templates/CRM/Core/Form/RecurringEntity.tpl index 06de2b0766..ca723d0118 100644 --- a/templates/CRM/Core/Form/RecurringEntity.tpl +++ b/templates/CRM/Core/Form/RecurringEntity.tpl @@ -79,7 +79,7 @@ - Summary: + {ts}Summary:{/ts} @@ -97,64 +97,64 @@ cj(document).ready(function() { cj('#repetition_start_date_display').closest("tr").hide(); /****** On load "Repeats By" and "Repeats On" blocks should be hidden if dropdown value is not week or month****** (Edit Mode)***/ - if(cj('#repetition_frequency_unit').val() == "week"){ + if (cj('#repetition_frequency_unit').val() == "week") { cj('.crm-core-form-recurringentity-block-start_action_condition').show(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); - }else if(cj('#repetition_frequency_unit').val() == "month"){ + } else if (cj('#repetition_frequency_unit').val() == "month") { cj('.crm-core-form-recurringentity-block-repeats_by td').show(); cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); - }else{ + } else { cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); } cj("#repeats-every-text").html(cj('#repetition_frequency_unit').val()+'(s)'); /***********On Load Set Ends Value (Edit Mode) **********/ - if(cj('input:radio[name=ends]:checked').val() == 1){ + if (cj('input:radio[name=ends]:checked').val() == 1) { cj('#start_action_offset').removeAttr('disabled').attr('enabled','enabled'); cj('#repeat_absolute_date_display').removeAttr("enabled").attr('disabled','disabled'); cj('#repeat_absolute_date_display').val(''); - }else if(cj('input:radio[name=ends]:checked').val() == 2){ + } else if (cj('input:radio[name=ends]:checked').val() == 2) { cj('#repeat_absolute_date_display').removeAttr("disabled").attr('enabled','enabled'); cj('#start_action_offset').removeAttr('enabled').attr('disabled','disabled'); cj('#start_action_offset').val(''); - }else{ + } else { cj('#start_action_offset').removeAttr('enabled').attr('disabled','disabled'); cj('#repeat_absolute_date_display').removeAttr('enabled').attr('disabled','disabled'); } /******On Load set Repeats by section******************/ - if(cj('input:radio[name=repeats_by]:checked').val() == 1){ + if (cj('input:radio[name=repeats_by]:checked').val() == 1) { cj('#limit_to').removeAttr('disabled').attr('enabled','enabled'); cj('#entity_status_1, #entity_status_2').removeAttr("enabled").attr('disabled','disabled'); - }else if(cj('input:radio[name=repeats_by]:checked').val() == 2){ + } else if (cj('input:radio[name=repeats_by]:checked').val() == 2) { cj('#entity_status_1, #entity_status_2').removeAttr("disabled").attr('enabled','enabled'); cj('#limit_to').removeAttr('enabled').attr('disabled','disabled'); - }else{ + } else { //Just in-case block shows up, disable it cj('#limit_to, #entity_status_1, #entity_status_2').removeAttr('enabled').attr('disabled','disabled'); } cj('#repetition_frequency_unit').change(function () { - if(cj(this).val()==='hour'){ + if (cj(this).val()==='hour') { cj('#repeats-every-text').html(cj(this).val()+'(s)'); cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); - }else if(cj(this).val()==='day'){ + } else if (cj(this).val()==='day') { cj('#repeats-every-text').html(cj(this).val()+'(s)'); cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); - }else if(cj(this).val()==='week'){ + } else if (cj(this).val()==='week') { cj('#repeats-every-text').html(cj(this).val()+'(s)'); //Show "Repeats On" block when week is selected cj('.crm-core-form-recurringentity-block-start_action_condition').show(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); - }else if(cj(this).val()==='month'){ + } else if (cj(this).val()==='month') { cj('#repeats-every-text').html(cj(this).val()+'(s)'); cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); //Show "Repeats By" block when month is selected cj('.crm-core-form-recurringentity-block-repeats_by td').show(); - }else if(cj(this).val()==='year'){ + } else if (cj(this).val()==='year') { cj('#repeats-every-text').html(cj(this).val()+'(s)'); cj('.crm-core-form-recurringentity-block-start_action_condition').hide(); cj('.crm-core-form-recurringentity-block-repeats_by td').hide(); @@ -163,28 +163,28 @@ // For "Ends" block cj('input:radio[name=ends]').click(function() { - if(cj(this).val() == 1){ + if (cj(this).val() == 1) { cj('#start_action_offset').removeAttr('disabled').attr('enabled','enabled'); cj('#repeat_absolute_date_display').val(''); - }else if(cj(this).val() == 2){ + } else if (cj(this).val() == 2) { cj('#repeat_absolute_date_display').removeAttr('disabled').attr('enabled','enabled'); cj('#start_action_offset').val(''); - }else{ + } else { cj('#repeat_absolute_date_display').removeAttr('enabled').attr('disabled','disabled'); } }); //For "Repeats By" block cj('input:radio[name=repeats_by]').click(function() { - if(cj(this).val() == 1){ + if (cj(this).val() == 1) { cj('#limit_to').removeAttr('disabled').attr('enabled','enabled'); - }else{ + } else { cj('#limit_to').removeAttr('enabled').attr('disabled','disabled'); } - if(cj(this).val() == 2){ + if (cj(this).val() == 2) { cj('#entity_status_1').removeAttr('disabled').attr('enabled','enabled'); cj('#entity_status_2').removeAttr('disabled').attr('enabled','enabled'); - }else{ + } else { cj('#entity_status_1').removeAttr('enabled').attr('disabled','disabled'); cj('#entity_status_2').removeAttr('enabled').attr('disabled','disabled'); } @@ -195,18 +195,18 @@ cj('#exclude_date_list option').attr('selected',true); //Check form for values submitted - if(cj('input[name=ends]:checked').val() == 1){ - if(cj('#start_action_offset').val() == ""){ - if(!cj('span#start_action_offset-error').length){ + if (cj('input[name=ends]:checked').val() == 1) { + if (cj('#start_action_offset').val() == "") { + if (!cj('span#start_action_offset-error').length) { cj('#start_action_offset').after(' This is a required field.'); //Check if other message already present, hide it cj('span#repeat_absolute_date_display-error').toggle(); } return false; } - }else if (cj('input[name=ends]:checked').val() == 2){ - if(cj('#repeat_absolute_date_display').val() == ""){ - if(!cj('span#repeat_absolute_date_display-error').length){ + } else if (cj('input[name=ends]:checked').val() == 2) { + if (cj('#repeat_absolute_date_display').val() == "") { + if (!cj('span#repeat_absolute_date_display-error').length) { cj('#repeat_absolute_date_display').after(' This is a required field.'); //Check if other message already present, hide it cj('span#start_action_offset-error').toggle(); @@ -219,11 +219,11 @@ //Dialog for preview repeat Configuration dates cj('#preview-dialog').dialog({ autoOpen: false }); - cj('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom').click( function (){ + cj('#_qf_Repeat_submit-top, #_qf_Repeat_submit-bottom').click( function () { cj('#exclude_date_list option').attr('selected',true); //Copy exclude dates var dateTxt=[]; - cj('#exclude_date_list option:selected').each(function(){ + cj('#exclude_date_list option:selected').each(function() { dateTxt.push(cj(this).text()); }); var completeDateText = dateTxt.join(','); @@ -248,7 +248,7 @@ }); var ajaxurl = CRM.url("civicrm/ajax/recurringentity/generate-preview"); var eventID = {/literal}{$currentEntityId}{literal}; - if(eventID != ""){ + if (eventID != "") { ajaxurl += "?event_id="+eventID; } var formData = cj('form').serializeArray(); @@ -258,14 +258,14 @@ data: formData, url: ajaxurl, success: function (result) { - if(Object.keys(result).length > 0){ + if (Object.keys(result).length > 0) { var errors = []; var participantData = []; var html = 'Based on your repeat configuration here is the list of event dates, Do you wish to proceed creating events for these dates?
'; var count = 1; for(var i in result) { - if(i != 'errors'){ - if(i == 'participantData'){ + if (i != 'errors') { + if (i == 'participantData') { participantData = result.participantData; break; } @@ -273,50 +273,50 @@ var end_date = result[i].end_date; var end_date_text = ''; - if(end_date !== undefined){ + if (end_date !== undefined) { end_date_text = ''; } html += ''+end_date_text+''; count = count + 1; - }else{ + } else { errors = result.errors; } } html += '
Sr NoStart dateEnd date
'+end_date+'
'+count+''+start_date+'
'; var warningHtml = ''; - if(Object.keys(participantData).length > 0){ + if (Object.keys(participantData).length > 0) { warningHtml += '
 There are registrations for the repeating events already present in the set, continuing with the process would unlink them and repeating events without registration would be trashed.
'; for (var id in participantData) { - for(var data in participantData[id]){ + for(var data in participantData[id]) { warningHtml += ''; } } warningHtml += '
Event IDEventParticipant Count
'+id+' '+data+''+participantData[id][data]+'

'; } - if(errors.length > 0){ + if (errors.length > 0) { html = ''; for (var j = 0; j < errors.length; j++) { html += '* ' + errors[j] + '
'; } } - if(warningHtml != ""){ + if (warningHtml != "") { cj('#generated_dates').append(warningHtml).append(html); - }else{ + } else { cj('#generated_dates').html(html); } - if(end_date_text == ""){ + if (end_date_text == "") { cj('#th-end-date').hide(); } - if(cj("#preview-dialog").height() >= 300){ + if (cj("#preview-dialog").height() >= 300) { cj('#preview-dialog').css('height', '300'); cj('#preview-dialog').css('overflow-y', 'auto'); } - }else{ + } else { cj('div.ui-dialog-buttonset button span:contains(Ok)').hide(); cj('#generated_dates').append("Sorry, no dates could be generated for the given criteria!"); } }, - complete: function(){ + complete: function() { cj('div.crm-loading-element').hide(); } }); @@ -327,16 +327,16 @@ var finalSummary = ''; var numberText = ''; var interval = cj('#repetition_frequency_interval').val() + ' '; - if(cj('#repetition_frequency_interval').val() == 1){ + if (cj('#repetition_frequency_interval').val() == 1) { interval = ''; - }else{ + } else { numberText = 's'; } finalSummary = "Every " + interval + cj('#repetition_frequency_unit option:selected').val() + numberText; //Case Week var dayOfWeek = new Array(); - if(cj('#repetition_frequency_unit option:selected').val() == "week"){ + if (cj('#repetition_frequency_unit option:selected').val() == "week") { cj("input[name^='start_action_condition']:checked").each(function() { var tempArray = new Array(); var thisID = cj(this).attr('id'); @@ -347,30 +347,30 @@ } //Case Monthly - if(cj('#repetition_frequency_unit option:selected').val() == "month"){ - if(cj('input:radio[name=repeats_by]:checked').val() == 1){ + if (cj('#repetition_frequency_unit option:selected').val() == "month") { + if (cj('input:radio[name=repeats_by]:checked').val() == 1) { finalSummary += ' on day ' + cj('#limit_to').val(); } - if(cj('input:radio[name=repeats_by]:checked').val() == 2){ + if (cj('input:radio[name=repeats_by]:checked').val() == 2) { finalSummary += ' on ' + cj('#entity_status_1').val().substr(0, 1).toUpperCase() + cj('#entity_status_1').val().substr(1).toLowerCase() + ' ' + cj('#entity_status_2').val().substr(0, 1).toUpperCase() + cj('#entity_status_2').val().substr(1).toLowerCase(); } } //Case Ends - if(cj('input:radio[name=ends]:checked').val() == 1){ + if (cj('input:radio[name=ends]:checked').val() == 1) { var timeText = '' - if(cj('#start_action_offset').val() != 1){ + if (cj('#start_action_offset').val() != 1) { timeText = cj('#start_action_offset').val() + ' times'; - }else{ + } else { timeText = ' once'; } finalSummary += ', ' + timeText; } - if(cj('input:radio[name=ends]:checked').val() == 2){ + if (cj('input:radio[name=ends]:checked').val() == 2) { var monthNames = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); var date = new Date(cj('#repeat_absolute_date_display').val()); function addOrdinal(d) { - if(d>3 && d<21) return 'th'; + if (d>3 && d<21) return 'th'; switch (d % 10) { case 1: return "st"; case 2: return "nd"; @@ -389,15 +389,15 @@ //Exclude list function function addToExcludeList(val) { - if(val !== ""){ + if (val !== "") { var exists = false; - for(var i = 0, opts = document.getElementById('exclude_date_list').options; i < opts.length; ++i){ - if(opts[i].text == val){ + for(var i = 0, opts = document.getElementById('exclude_date_list').options; i < opts.length; ++i) { + if (opts[i].text == val) { exists = true; break; } } - if (exists == false){ + if (exists == false) { cj('#exclude_date_list').append(''); } } @@ -406,10 +406,10 @@ function removeFromExcludeList(sourceID) { var src = document.getElementById(sourceID); for(var count= src.options.length-1; count >= 0; count--) { - if(src.options[count].selected == true) { + if (src.options[count].selected == true) { try{ src.remove(count, null); - }catch(error){ + }catch(error) { src.remove(count); } } diff --git a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl index 5bb588f5fc..b38d3ff429 100644 --- a/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl +++ b/templates/CRM/Event/Form/ManageEvent/ConfirmRepeatMode.tpl @@ -64,7 +64,7 @@ var form = ''; $('#crm-main-content-wrapper').on('click', 'div.crm-submit-buttons span.crm-button input[value="Save"], div.crm-submit-buttons span.crm-button input[value="Save and Done"]', function() { form = $(this).parents('form:first').attr('class'); - if( form != "" && mapper.hasOwnProperty(form) ){ + if (form != "" && mapper.hasOwnProperty(form)) { $("#recurring-dialog").dialog({ title: ts('How does this change affect other repeating events in the set?'), modal: true, @@ -79,15 +79,15 @@ } }); - $(".only-this-event").click(function(){ + $(".only-this-event").click(function() { updateMode(1); }); - cj(".this-and-all-following-event").click(function(){ + cj(".this-and-all-following-event").click(function() { updateMode(2); }); - cj(".all-events").click(function(){ + cj(".all-events").click(function() { updateMode(3); }); @@ -101,10 +101,10 @@ data: data, url: ajaxurl, success: function (result) { - if(result.status != "" && result.status == 'Done'){ + if (result.status != "" && result.status == 'Done') { $("#recurring-dialog").dialog('close'); $('#mainTabContainer div:visible Form').submit(); - }else if(result.status != "" && result.status == 'Error'){ + } else if (result.status != "" && result.status == 'Error') { var errorBox = confirm(ts("Mode could not be updated, save only this event?")); if (errorBox == true) { $("#recurring-dialog").dialog('close'); diff --git a/templates/CRM/Event/Form/ManageEvent/Repeat.tpl b/templates/CRM/Event/Form/ManageEvent/Repeat.tpl index 55c0da04e0..cdda3f0ac3 100644 --- a/templates/CRM/Event/Form/ManageEvent/Repeat.tpl +++ b/templates/CRM/Event/Form/ManageEvent/Repeat.tpl @@ -82,7 +82,7 @@ {literal}