0xV3NOMx
Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64



Your IP : 52.14.255.122


Current Path : /var/www/oasis/js/
Upload File :
Current File : /var/www/oasis/js/message_text.js

// $geditinternalcode=1;CallEnableTeacherEntry("Edit");

var totallength = "";

function EnableMessageText() {
  $("#page_main_div").load("../html_modules/message_text.html", function () {
    document.getElementById("display_module_name").innerHTML = "Message Text";
    document.getElementById("module_name_for_save").value = "Message Text";
    getDefaultHeadFooterLinks("Message Text");
    $("#mess_details").hide();
  });
}

function display() {
  $("#mess_details").show();
  let fmodule = $("#fmodule").val();
  if (fmodule == "") {
    alert("Please select Module");
    return;
  }
  var datastring = "&fmodule=" + fmodule;

  $.ajax({
    type: "POST",
    url: $host_url + "displayMessage",
    data: datastring,
    success: displayTxetresponse,
  });
}

function displayTxetresponse(responce) {
  responce = eval("(" + responce + ")");
  if (responce.error_code == 0) {
    $("#messagetext").html("");
    $("#messagetext").html(responce.data["message"]);
    $("#fdate").val(responce.data["display_from"]);
    $("#tdate").val(responce.data["display_to"]);
  } else {
    alert(responce.data);
    return;
  }
}

function SaveMessageTxet() {
  var messagetext = document.getElementById("messagetext").value;
  messagetext = messagetext.replace("'", '"');
  var fmodule = document.getElementById("fmodule").value;
  var fdate = document.getElementById("fdate").value;
  var tdate = document.getElementById("tdate").value;

  var datastring =
    `&messagetext=` +
    messagetext +
    `&fmodule=` +
    fmodule +
    `&fdate=` +
    fdate +
    `&tdate=` +
    tdate;

  $.ajax({
    type: "POST",
    url: $host_url + "SaveMessageTxet",
    data: datastring,
    success: SaveMessageTxetresponse,
  });
}

function SaveMessageTxetresponse(responce) {
  responce = eval("(" + responce + ")");
  alert(responce.data);
}

function validateDate(ldate) {
  var pattern = /^([0-9]{2})\/([0-9]{2})\/([0-9]{4})$/;
  if (ldate == null || ldate == "" || !pattern.test(ldate)) {
    errMessage = "Invalid date\n";
    alert(errMessage);
    return errMessage;
  } else {
    return 999;
  }
}