function scJQGeneralAdd() { scLoadScInput('input:text.sc-js-input'); scLoadScInput('input:password.sc-js-input'); scLoadScInput('input:checkbox.sc-js-input'); scLoadScInput('input:radio.sc-js-input'); scLoadScInput('select.sc-js-input'); scLoadScInput('textarea.sc-js-input'); } // scJQGeneralAdd function scFocusField(sField) { var $oField = $('#id_sc_field_' + sField); if (0 == $oField.length) { $oField = $('input[name=' + sField + ']'); } if (0 == $oField.length && document.F1.elements[sField]) { $oField = $(document.F1.elements[sField]); } if ($("#id_ac_" + sField).length > 0) { if ($oField.hasClass("select2-hidden-accessible")) { if (false == scSetFocusOnField($oField, sField)) { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } else { if (false == scSetFocusOnField($oField, sField)) { if (false == scSetFocusOnField($("#id_ac_" + sField, sField))) { setTimeout(function() { scSetFocusOnField($("#id_ac_" + sField, sField)); }, 500); } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } } else { setTimeout(function() { scSetFocusOnField($oField, sField); }, 500); } } // scFocusField function scSetFocusOnField($oField, sField) { if ($oField.length > 0 && $oField[0].offsetHeight > 0 && $oField[0].offsetWidth > 0 && !$oField[0].disabled) { $oField[0].focus(); return true; } return false; } // scSetFocusOnField function scEventControl_init(iSeqRow) { scEventControl_data["client_id" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["template" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["email" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["subject" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["message" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["recipient_list" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["send_mode" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; } function scEventControl_active(iSeqRow) { if (scEventControl_data["client_id" + iSeqRow] && scEventControl_data["client_id" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["client_id" + iSeqRow] && scEventControl_data["client_id" + iSeqRow]["change"]) { return true; } if (scEventControl_data["template" + iSeqRow] && scEventControl_data["template" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["template" + iSeqRow] && scEventControl_data["template" + iSeqRow]["change"]) { return true; } if (scEventControl_data["email" + iSeqRow] && scEventControl_data["email" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["email" + iSeqRow] && scEventControl_data["email" + iSeqRow]["change"]) { return true; } if (scEventControl_data["subject" + iSeqRow] && scEventControl_data["subject" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["subject" + iSeqRow] && scEventControl_data["subject" + iSeqRow]["change"]) { return true; } if (scEventControl_data["message" + iSeqRow] && scEventControl_data["message" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["message" + iSeqRow] && scEventControl_data["message" + iSeqRow]["change"]) { return true; } if (scEventControl_data["recipient_list" + iSeqRow] && scEventControl_data["recipient_list" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["recipient_list" + iSeqRow] && scEventControl_data["recipient_list" + iSeqRow]["change"]) { return true; } if (scEventControl_data["send_mode" + iSeqRow] && scEventControl_data["send_mode" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["send_mode" + iSeqRow] && scEventControl_data["send_mode" + iSeqRow]["change"]) { return true; } return false; } // scEventControl_active function scEventControl_onFocus(oField, iSeq) { var fieldId, fieldName; fieldId = $(oField).attr("id"); fieldName = fieldId.substr(12); scEventControl_data[fieldName]["blur"] = true; if ("client_id" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("template" + iSeq == fieldName) { scEventControl_data[fieldName]["blur"] = false; } if ("client_id" + iSeq == fieldName) { scEventControl_data[fieldName]["change"] = true; scEventControl_data[fieldName]["original"] = $(oField).val(); scEventControl_data[fieldName]["calculated"] = $(oField).val(); return; } if ("template" + iSeq == fieldName) { scEventControl_data[fieldName]["change"] = true; scEventControl_data[fieldName]["original"] = $(oField).val(); scEventControl_data[fieldName]["calculated"] = $(oField).val(); return; } scEventControl_data[fieldName]["change"] = false; } // scEventControl_onFocus function scEventControl_onBlur(sFieldName) { scEventControl_data[sFieldName]["blur"] = false; if (scEventControl_data[sFieldName]["change"]) { if (scEventControl_data[sFieldName]["original"] == $("#id_sc_field_" + sFieldName).val() || scEventControl_data[sFieldName]["calculated"] == $("#id_sc_field_" + sFieldName).val()) { scEventControl_data[sFieldName]["change"] = false; } } } // scEventControl_onBlur function scEventControl_onChange(sFieldName) { scEventControl_data[sFieldName]["change"] = false; } // scEventControl_onChange function scEventControl_onAutocomp(sFieldName) { scEventControl_data[sFieldName]["autocomp"] = false; } // scEventControl_onChange var scEventControl_data = {}; function scJQEventsAdd(iSeqRow) { $('#id_sc_field_client_id' + iSeqRow).bind('blur', function() { sc_control_send_message_client_id_onblur('#id_sc_field_client_id' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_control_send_message_client_id_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_client_id_onfocus(this, iSeqRow, event) }); $('#id_sc_field_email' + iSeqRow).bind('blur', function() { sc_control_send_message_email_onblur('#id_sc_field_email' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_email_onfocus(this, iSeqRow, event) }); $('#id_sc_field_subject' + iSeqRow).bind('blur', function() { sc_control_send_message_subject_onblur('#id_sc_field_subject' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_subject_onfocus(this, iSeqRow, event) }); $('#id_sc_field_message' + iSeqRow).bind('blur', function() { sc_control_send_message_message_onblur('#id_sc_field_message' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_message_onfocus(this, iSeqRow, event) }); $('#id_sc_field_template' + iSeqRow).bind('blur', function() { sc_control_send_message_template_onblur('#id_sc_field_template' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_control_send_message_template_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_template_onfocus(this, iSeqRow, event) }); $('#id_sc_field_recipient_list' + iSeqRow).bind('blur', function() { sc_control_send_message_recipient_list_onblur('#id_sc_field_recipient_list' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_recipient_list_onfocus(this, iSeqRow, event) }); $('#id_sc_field_send_mode' + iSeqRow).bind('blur', function() { sc_control_send_message_send_mode_onblur('#id_sc_field_send_mode' + iSeqRow, iSeqRow, event) }) .bind('focus', function() { sc_control_send_message_send_mode_onfocus(this, iSeqRow, event) }); } // scJQEventsAdd Upload_Cancel = false; function sc_control_send_message_client_id_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_client_id(); scCssBlur(oThis); } function sc_control_send_message_client_id_onchange(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_event_client_id_onchange(); } function sc_control_send_message_client_id_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_email_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_email(); scCssBlur(oThis); } function sc_control_send_message_email_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_subject_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_subject(); scCssBlur(oThis); } function sc_control_send_message_subject_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_message_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_message(); scCssBlur(oThis); } function sc_control_send_message_message_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_template_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_template(); scCssBlur(oThis); } function sc_control_send_message_template_onchange(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_event_template_onchange(); } function sc_control_send_message_template_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_recipient_list_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_recipient_list(); scCssBlur(oThis); } function sc_control_send_message_recipient_list_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_control_send_message_send_mode_onblur(oThis, iSeqRow, event) { do_ajax_control_send_message_mob_validate_send_mode(); scCssBlur(oThis); } function sc_control_send_message_send_mode_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function displayChange_block(block, status) { if ("0" == block) { displayChange_block_0(status); } if ("1" == block) { displayChange_block_1(status); } if ("2" == block) { displayChange_block_2(status); } } function displayChange_block_0(status) { displayChange_field("client_id", "", status); displayChange_field("template", "", status); } function displayChange_block_1(status) { displayChange_field("email", "", status); displayChange_field("subject", "", status); } function displayChange_block_2(status) { displayChange_field("message", "", status); displayChange_field("recipient_list", "", status); displayChange_field("send_mode", "", status); } function displayChange_row(row, status) { displayChange_field_client_id(row, status); displayChange_field_template(row, status); displayChange_field_email(row, status); displayChange_field_subject(row, status); displayChange_field_message(row, status); displayChange_field_recipient_list(row, status); displayChange_field_send_mode(row, status); } function displayChange_field(field, row, status) { if ("client_id" == field) { displayChange_field_client_id(row, status); } if ("template" == field) { displayChange_field_template(row, status); } if ("email" == field) { displayChange_field_email(row, status); } if ("subject" == field) { displayChange_field_subject(row, status); } if ("message" == field) { displayChange_field_message(row, status); } if ("recipient_list" == field) { displayChange_field_recipient_list(row, status); } if ("send_mode" == field) { displayChange_field_send_mode(row, status); } } function displayChange_field_client_id(row, status) { var fieldId; } function displayChange_field_template(row, status) { var fieldId; } function displayChange_field_email(row, status) { var fieldId; } function displayChange_field_subject(row, status) { var fieldId; } function displayChange_field_message(row, status) { var fieldId; if ("on" == status) { if ("all" == row) { var fieldList = $(".css_message__obj"); for (var i = 0; i < fieldList.length; i++) { fieldId = $(fieldList[i]).attr("id").substr(12); scAjaxExecFieldEditorHtml('mceRemoveControl', false, fieldId); scAjaxExecFieldEditorHtml('mceAddControl', false, fieldId); } } else { scAjaxExecFieldEditorHtml('mceRemoveControl', false, "message"); scAjaxExecFieldEditorHtml('mceAddControl', false, "message"); } } } function displayChange_field_recipient_list(row, status) { var fieldId; } function displayChange_field_send_mode(row, status) { var fieldId; } function scRecreateSelect2() { } function scResetPagesDisplay() { $(".sc-form-page").show(); } function scHidePage(pageNo) { $("#id_control_send_message_mob_form" + pageNo).hide(); } function scCheckNoPageSelected() { if (!$(".sc-form-page").filter(".scTabActive").filter(":visible").length) { var inactiveTabs = $(".sc-form-page").filter(".scTabInactive").filter(":visible"); if (inactiveTabs.length) { var tabNo = $(inactiveTabs[0]).attr("id").substr(35); } } } var scJQHtmlEditorData = (function() { var data = {}; function scJQHtmlEditorData(a, b) { if (a) { if (typeof(a) === typeof({})) { for (var d in a) { if (a.hasOwnProperty(d)) { data[d] = a[d]; } } } else if ((typeof(a) === typeof('')) || (typeof(a) === typeof(1))) { if (b) { data[a] = b; } else { if (typeof(a) === typeof('')) { var v = data; a = a.split('.'); a.forEach(function (r) { v = v[r]; }); return v; } return data[a]; } } } return data; } return scJQHtmlEditorData; }()); function scJQHtmlEditorAdd(iSeqRow) {