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


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

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

function getdegreecode() {
  $.ajax({
    type: "POST",
    url: $host_url + "getdegreecode",
    success: getdegreecodeResponce
  });
}

function getdegreecodeResponce(responce) {
  responce = eval("(" + responce + ")");
  document.getElementById("type").options.length = 0;
  var FDEGREE = responce.data["FDEGREE"];
  $op = new Option();
  $op.id = 0; //specifying the id  for options
  for ($i = 0; $i < FDEGREE.length; $i++) {
    $op = new Option(FDEGREE[$i]["value"], FDEGREE[$i]["internal_code"]);
    $op.id = FDEGREE[$i]["internal_code"]; //specifying the id  for options
    document.getElementById("type").options.add($op);
  }
}

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) {
  row_index = index;
  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");

  var ext = $("#student_entry_upload_" + 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;

  $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 UserSelectedPhotoUploadfile() {
  var valid_file_extentions = new Array("jpeg", "jpg", "png", "gif");
  var ext = $("#student_entry_upload").val();
  var type = $("#type").val();
  var examination = $("#examination").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 + "&type=" + type + "&examination=" + examination;
  $upload = $host_url + "saveuserselectedphotofile&" + $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);
}

function onlyAlphabets(e, t) {
  try {
    if (window.event) {
      var charCode = window.event.keyCode;
    } else if (e) {
      var charCode = e.which;
    } else {
      return true;
    }
    if (
      (charCode > 64 && charCode < 91) ||
      (charCode > 96 && charCode < 123) ||
      charCode == 8 ||
      charCode == 0
    )
      return true;
    else return false;
  } catch (err) {
    alert(err.Description);
  }
}