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 : 18.216.253.84


Current Path : /var/www/oasis/js_old/
Upload File :
Current File : /var/www/oasis/js_old/uploadStudentPhotos.js

function CalluploadStudentPhotos() {
  $("#page_main_div").load(
    "../html_modules/upload_studentphoto.html",
    function() {
      document.getElementById("display_module_name").innerHTML = "Upload Photo";
      document.getElementById("module_name_for_save").value = "Upload Photo";
      clearCalluploadStudentPhotos();
      getDefaultHeadFooterLinks("Upload Photo");
    }
  );
  // $('#module_details_div').hide();
}

function clearCalluploadStudentPhotos() {
  $("#degree_code").val("");
  //document.getElementById('it_module').innerHTML = '';
  $("#degree_code").focus();
}

function viewUploadStudentPhoto() {
  if (trim($("#degree_code").val()) == "") {
    alert("Enter Degree Code ");
    $("#degree_code").focus();
    return;
  }
  var dataString =
    "degreeCode=" +
    $("#degree_code").val() +
    "&regStart=" +
    $("#uploadPhoto_regno_start_from").val() +
    "&regEnd=" +
    $("#uploadPhoto_regno_end_to").val();
  $.ajax({
    type: "POST",
    data: dataString,
    url: $host_url + "viewStudInfoToupload",
    success: viewStudInfoTouploadResponse
  });
}

function viewStudInfoTouploadResponse($responce) {
  $responce = eval("(" + $responce + ")");
  if ($responce.error_code == -1) {
    // alert($responce.data);
  } else {
    $("#uploadPh_studlist").show();
    $("#uploadPh_studlist").html($responce.data["html"]);
  }
}

var row_index = 0;
var filepath;
var regnumb;

function UserSelectedPhotoDisplay(index, regno) {
  row_index = index;

  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");

  var ext = $("#student_entry_upload_" + index).val();

  var regno = $("#hd_regno_" + index).val();

  filepath = ext;

  ext = ext.substring(ext.length - 3, ext.length);

  ext = ext.toLowerCase();

  if (ext != "" && !in_array(ext, valid_file_extentions)) {
    alert("Please Select the Valid Photo!");

    return false;
  }

  // var lstr_data = "&filepath=" + filepath + "&index=" + index;
  $lstr_data = "filepath=" + filepath + "&index=" + index + "&regno=" + regno;

  $upload = $host_url + "UserSelectedPhotoDisplay&" + $lstr_data;

  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", $upload);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UserSelectedPhotoDisplayResponse }
  );
}

function UserSelectedPhotoDisplayResponse($responce) {
  $responce = eval("(" + $responce + ")");

  if ($responce.error_code == 0)
    $("#student_entry_photo_" + row_index).attr("src", $responce.data);
  else if ($responce.error_code == -1)
    $("#student_entry_photo_" + row_index).attr(
      "src",
      "images/default_photo.jpg"
    );
  else if ($responce.error_code == -2) {
    // alert($responce.data);
    $("#student_entry_photo_" + row_index).attr(
      "src",
      "images/default_photo.jpg"
    );
    $("#student_entry_upload_" + row_index).val("");
  }
}

function UserSelectedPhotoUpload(index, regno) {
  console.log("UserSelectedPhotoUpload");
  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
  var ext = $("#student_entry_upload_" + index).val();
  var regno = $("#hd_regno_" + index).val();
  filepath = ext;

  ext = ext.substring(ext.length - 3, ext.length);
  ext = ext.toLowerCase();

  if (
    ext == "" ||
    !in_array(ext, valid_file_extentions) ||
    ext == "default_photo.jpg"
  ) {
    alert("Select the Valid Photo!");
    return false;
  }
  $lstr_data = "filepath=" + filepath + "&index=" + index + "&regno=" + regno;
  $upload = $host_url + "saveUserSelectedPhotoUpload&" + $lstr_data;
  document
    .getElementById("form_module_image_upload")
    .setAttribute("action", $upload);
  return AIM.submit(
    document.getElementById("form_module_image_upload"),
    "report_display",
    { onComplete: UserSelectedPhotoUploadResponse }
  );
}

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