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["contact_id" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["first_name" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["last_name" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["email" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["message" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["status" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["replied" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["usr_login" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; scEventControl_data["date_sent" + iSeqRow] = {"blur": false, "change": false, "autocomp": false, "original": "", "calculated": ""}; } function scEventControl_active(iSeqRow) { if (scEventControl_data["contact_id" + iSeqRow] && scEventControl_data["contact_id" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["contact_id" + iSeqRow] && scEventControl_data["contact_id" + iSeqRow]["change"]) { return true; } if (scEventControl_data["first_name" + iSeqRow] && scEventControl_data["first_name" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["first_name" + iSeqRow] && scEventControl_data["first_name" + iSeqRow]["change"]) { return true; } if (scEventControl_data["last_name" + iSeqRow] && scEventControl_data["last_name" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["last_name" + iSeqRow] && scEventControl_data["last_name" + 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["message" + iSeqRow] && scEventControl_data["message" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["message" + iSeqRow] && scEventControl_data["message" + iSeqRow]["change"]) { return true; } if (scEventControl_data["status" + iSeqRow] && scEventControl_data["status" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["status" + iSeqRow] && scEventControl_data["status" + iSeqRow]["change"]) { return true; } if (scEventControl_data["replied" + iSeqRow] && scEventControl_data["replied" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["replied" + iSeqRow] && scEventControl_data["replied" + iSeqRow]["change"]) { return true; } if (scEventControl_data["usr_login" + iSeqRow] && scEventControl_data["usr_login" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["usr_login" + iSeqRow] && scEventControl_data["usr_login" + iSeqRow]["change"]) { return true; } if (scEventControl_data["date_sent" + iSeqRow] && scEventControl_data["date_sent" + iSeqRow]["blur"]) { return true; } if (scEventControl_data["date_sent" + iSeqRow] && scEventControl_data["date_sent" + 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; 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_pm_id' + iSeqRow).bind('change', function() { sc_form_portal_messages_pm_id_onchange(this, iSeqRow, event) }); $('#id_sc_field_usr_login' + iSeqRow).bind('blur', function() { sc_form_portal_messages_usr_login_onblur('#id_sc_field_usr_login' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_usr_login_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_usr_login_onfocus(this, iSeqRow, event) }); $('#id_sc_field_date_sent' + iSeqRow).bind('blur', function() { sc_form_portal_messages_date_sent_onblur('#id_sc_field_date_sent' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_date_sent_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_date_sent_onfocus(this, iSeqRow, event) }); $('#id_sc_field_date_sent_hora' + iSeqRow).bind('blur', function() { sc_form_portal_messages_date_sent_hora_onblur('#id_sc_field_date_sent' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_date_sent_hora_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_date_sent_hora_onfocus(this, iSeqRow, event) }); $('#id_sc_field_contact_id' + iSeqRow).bind('blur', function() { sc_form_portal_messages_contact_id_onblur('#id_sc_field_contact_id' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_contact_id_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_contact_id_onfocus(this, iSeqRow, event) }); $('#id_sc_field_first_name' + iSeqRow).bind('blur', function() { sc_form_portal_messages_first_name_onblur('#id_sc_field_first_name' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_first_name_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_first_name_onfocus(this, iSeqRow, event) }); $('#id_sc_field_last_name' + iSeqRow).bind('blur', function() { sc_form_portal_messages_last_name_onblur('#id_sc_field_last_name' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_last_name_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_last_name_onfocus(this, iSeqRow, event) }); $('#id_sc_field_email' + iSeqRow).bind('blur', function() { sc_form_portal_messages_email_onblur('#id_sc_field_email' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_email_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_email_onfocus(this, iSeqRow, event) }); $('#id_sc_field_message' + iSeqRow).bind('blur', function() { sc_form_portal_messages_message_onblur('#id_sc_field_message' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_message_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_message_onfocus(this, iSeqRow, event) }); $('#id_sc_field_status' + iSeqRow).bind('blur', function() { sc_form_portal_messages_status_onblur('#id_sc_field_status' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_status_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_status_onfocus(this, iSeqRow, event) }); $('#id_sc_field_replied' + iSeqRow).bind('blur', function() { sc_form_portal_messages_replied_onblur('#id_sc_field_replied' + iSeqRow, iSeqRow, event) }) .bind('change', function() { sc_form_portal_messages_replied_onchange(this, iSeqRow, event) }) .bind('focus', function() { sc_form_portal_messages_replied_onfocus(this, iSeqRow, event) }); } // scJQEventsAdd Upload_Cancel = false; function sc_form_portal_messages_pm_id_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_usr_login_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_usr_login(); scCssBlur(oThis); } function sc_form_portal_messages_usr_login_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_usr_login_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_date_sent_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_date_sent(); scCssBlur(oThis); } function sc_form_portal_messages_date_sent_hora_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_date_sent(); scCssBlur(oThis); } function sc_form_portal_messages_date_sent_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_date_sent_hora_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_date_sent_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_date_sent_hora_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_contact_id_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_contact_id(); scCssBlur(oThis); } function sc_form_portal_messages_contact_id_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_contact_id_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_first_name_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_first_name(); scCssBlur(oThis); } function sc_form_portal_messages_first_name_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_first_name_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_last_name_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_last_name(); scCssBlur(oThis); } function sc_form_portal_messages_last_name_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_last_name_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_email_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_email(); scCssBlur(oThis); } function sc_form_portal_messages_email_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_email_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_message_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_message(); scCssBlur(oThis); } function sc_form_portal_messages_message_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_message_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_status_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_status(); scCssBlur(oThis); } function sc_form_portal_messages_status_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_status_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function sc_form_portal_messages_replied_onblur(oThis, iSeqRow, event) { do_ajax_form_portal_messages_validate_replied(); scCssBlur(oThis); } function sc_form_portal_messages_replied_onchange(oThis, iSeqRow, event) { scMarkFormAsChanged(); } function sc_form_portal_messages_replied_onfocus(oThis, iSeqRow, event) { scEventControl_onFocus(oThis, iSeqRow); scCssFocus(oThis); } function displayChange_block(block, status) { if ("0" == block) { displayChange_block_0(status); } } function displayChange_block_0(status) { displayChange_field("contact_id", "", status); displayChange_field("first_name", "", status); displayChange_field("last_name", "", status); displayChange_field("email", "", status); displayChange_field("message", "", status); displayChange_field("status", "", status); displayChange_field("replied", "", status); displayChange_field("usr_login", "", status); displayChange_field("date_sent", "", status); } function displayChange_row(row, status) { displayChange_field_contact_id(row, status); displayChange_field_first_name(row, status); displayChange_field_last_name(row, status); displayChange_field_email(row, status); displayChange_field_message(row, status); displayChange_field_status(row, status); displayChange_field_replied(row, status); displayChange_field_usr_login(row, status); displayChange_field_date_sent(row, status); } function displayChange_field(field, row, status) { if ("contact_id" == field) { displayChange_field_contact_id(row, status); } if ("first_name" == field) { displayChange_field_first_name(row, status); } if ("last_name" == field) { displayChange_field_last_name(row, status); } if ("email" == field) { displayChange_field_email(row, status); } if ("message" == field) { displayChange_field_message(row, status); } if ("status" == field) { displayChange_field_status(row, status); } if ("replied" == field) { displayChange_field_replied(row, status); } if ("usr_login" == field) { displayChange_field_usr_login(row, status); } if ("date_sent" == field) { displayChange_field_date_sent(row, status); } } function displayChange_field_contact_id(row, status) { var fieldId; } function displayChange_field_first_name(row, status) { var fieldId; } function displayChange_field_last_name(row, status) { var fieldId; } function displayChange_field_email(row, status) { var fieldId; } function displayChange_field_message(row, status) { var fieldId; } function displayChange_field_status(row, status) { var fieldId; } function displayChange_field_replied(row, status) { var fieldId; } function displayChange_field_usr_login(row, status) { var fieldId; } function displayChange_field_date_sent(row, status) { var fieldId; } function scRecreateSelect2() { } function scResetPagesDisplay() { $(".sc-form-page").show(); } function scHidePage(pageNo) { $("#id_form_portal_messages_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(31); } } } var sc_jq_calendar_value = {}; function scJQCalendarAdd(iSeqRow) { $("#id_sc_field_date_sent" + iSeqRow).datepicker('destroy'); $("#id_sc_field_date_sent" + iSeqRow).datepicker({ beforeShow: function(input, inst) { var $oField = $(this), aParts = $oField.val().split(" "), sTime = ""; sc_jq_calendar_value["#id_sc_field_date_sent" + iSeqRow] = $oField.val(); if (2 == aParts.length) { sTime = " " + aParts[1]; } if ('' == sTime || ' ' == sTime) { sTime = '