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.191.54.190


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

function calldegstudymat() {
  $("#page_main_div").load("../html_modules/degstudymat.html", function() {
    document.getElementById("display_module_name").innerHTML =
      "Upload Study Material";
    document.getElementById("module_name_for_save").value =
      "Upload Study Material";
    getDefaultHeadFooterLinks("Study Material");

    var datastring = "";
    $.ajax({
      type: "POST",
      data: datastring,
      url: $host_url + "getcolldeg",
      success: function(responce) {
        var responce = eval("(" + responce + ")");
        if (responce.error_code == 0) {
          var exam = responce.data;
          var options;
          options += `<option value="">--Select--</option>`;
          for (var i = 0; i < exam.length; i++) {
            options += `<option value="${exam[i].fexamno}">${exam[i].fexamname}</options>`;
          }

          $("#sem").html(options);
        }
      }
    });
  });
}

function getcolldegexam() {
  var sem = $("#sem").val();
  $.ajax({
    type: "POST",
    data: "type=loadsub" + "&sem=" + sem,
    url: $host_url + "getcolldegexam",
    success: function(responce) {
      var responce = eval("(" + responce + ")");
      if (responce.error_code == 0) {
        var degree = responce.data;
        var options;
        options += `<option value="">--Select--</option>`;
        for (var i = 0; i < degree.length; i++) {
          console.log(degree);
          options += `<option value="${degree[i].fdegree}">${degree[i].fdescpn}</options>`;
        }

        $("#fdegree").html(options);
      }
    }
  });
}

function getSubject() {
  var degree = $("#fdegree").val();
  var sem = $("#sem").val();

  $.ajax({
    type: "POST",
    async: false,
    data: "type=loadsub" + "&degree=" + degree + "&sem=" + sem,
    url: $host_url + "getSubject",
    success: function(responce) {
      var responce = eval("(" + responce + ")");
      if (responce.error_code == 0) {
        var subject = responce.data;
        var options;
        options += `<option value="">--Select--</option>`;
        for (var i = 0; i < subject.length; i++) {
          options += `<option value="${subject[i].fsubcode}">${subject[i].fsubname}</options>`;
        }

        $("#subject").html(options);
      }
    }
  });
}

function upload_file(file_file) {
  var valid_file_extentions = new Array("jpeg", "jpg");
  var ext = $("#" + file_file).val();
  filepath = ext;
  ext = ext.substring(ext.length - 3, ext.length);
  ext = ext.toLowerCase();

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>"
  });
  var lstr_data = "&filepath=" + filepath;
  $upload = $host_url + "upload_file&" + lstr_data;

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

function upload_fileResponse($responce) {
  $responce = eval("(" + $responce + ")");
  $.unblockUI();
  if ($responce.error_code == 0) $("#h_studymatrial").val($responce.data);
  else {
    alert("Please try after sometime");
    $("#h_studymatrial").val("");
    return;
  }
}

function saveStudyMaterial() {
  var tech = $("#tech").val();
  var fdegree = $("#fdegree").val();
  var sem = $("#sem").val();
  var subject = $("#subject").val();
  var lesson = $("#lesson").val();
  var path = $("#h_studymatrial").val();

  if (tech == "") {
    alert("Please Enter Teacher Name");
    document.getElementById("tech").focus();
    return;
  }

  if (fdegree == "") {
    alert("Please Select Degree");
    document.getElementById("fdegree").focus();
    return;
  }

  if (sem == "") {
    alert("Please Select Semester");
    document.getElementById("sem").focus();
    return;
  }

  if (subject == "") {
    alert("Please Select Subject");
    document.getElementById("subject").focus();
    return;
  }

  if (lesson == "") {
    alert("Please Enter lesson");
    document.getElementById("lesson").focus();
    return;
  }

  if (path == "") {
    alert("Please Upload File");
    document.getElementById("path").focus();
    return;
  }

  $.blockUI({
    message:
      "<h1 class='h1' style='font-size:12px'><img src='images/ajax-loader.gif' border='0'></h1>"
  });
  $.ajax({
    type: "POST",
    async: false,
    data:
      "&tech=" +
      tech +
      "&type=study&sem=" +
      sem +
      "&path=" +
      path +
      "&fdegree=" +
      fdegree +
      "&subject=" +
      subject +
      "&lesson=" +
      lesson,
    url: $host_url + "saveStudyMaterial",
    success: function(responce) {
      $.unblockUI();

      var responce = eval("(" + responce + ")");
      $("#lesson").val("");
      $("#subject").val("");
      $("#sem").val("");
      $("#fdegree").val("");
      $("#h_studymatrial").val("");
      document.getElementById("studymatrial").value = "";
      alert(responce.data);
      return;
    }
  });
}