// Global Variables
grdOptions = new Array(); // Grade Array
reportOption = "";
rptNumber = 1;
rptNumberOth = 1;
rptNumberAdvOth = 1;
// AJAX
loadHTML = "Loading...";
urlBase = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=EAR&optionclass$=EAR&mode$=EAR&wrap=false";
// --> Session Variables appended in TPL
if ( !Array.indexOf ) {
Array.prototype.indexOf = function(obj) {
for ( var i=0; i < this.length; i++ ) {
if ( this[i] == obj ) {
return i;
}
}
return -1;
}
}
jQuery.fn.autoStudent = function(dsp) {
var textInput = $(this);
$.get( urlBase, "template$=ear_oth_student_data", function(responseText, textStatus, XMLHttpRequest) {
var studentData = new Array();
var studentName = new Array();
studentData = responseText.split("\n");
for ( s = 0; s < studentData.length; s++ ) {
studentData[s] = studentData[s].replace(/\r/g, "").split(" : ");
studentName[s] = studentData[s][0];
}
textInput.autocomplete({
delay: 0,
minLength: 3,
source: studentName,
create: function(event, ui) {
$(this).data("selected", false);
$(this).data("open", false);
},
search: function(event, ui) {
$(this).data("selected", false);
$(this).data("open", false);
},
open: function(event, ui) {
$(this).data("open", true);
},
select: function(event, ui) {
$(this).data("selected", true);
var stdIndex = studentName.indexOf(ui.item.value);
var stdId = studentData[stdIndex][1];
$(this).data("stdId", stdId);
if ( typeof(dsp) != "undefined" ) { dsp.loadStudent(stdId, "Oth"); }
$(this).data("open", false);
},
close: function(event, ui) {
/*
if ( !$(this).data("selected") && $(this).val().length > 6 ) {
var dlg = $("#dlgAddCrsCode");
dlg.data("autoField", $(this));
$("#fldAddCrsCode", dlg).val($(this).val());
$("#fldAddCrsTheirId, #fldAddCrsTitle", dlg).val("");
dlg.dialog("open");
}
*/
}
});
});
}
function docReady(term) {
var menuTabs = $("#menuTabs");
menuTabs.tabs({ disabled: [2] });
// var tabFac = $("#tabFac", menuTabs);
var tabFac = $("#tabFac");
var crsList = $("#crsList", tabFac);
$("#termselect", tabFac).attr("size", "1").val(term).change(function() {
crsList.loadCourses();
});
crsList.loadCourses();
var facMenu = $("#tblFacMenu", tabFac);
var mnuFac = $("th", facMenu)
mnuFac.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickFacMenu();
});
}
});
$("label", mnuFac).css("color", "#000000");
var mnuFacRpt = $("td.menuFacRpt", facMenu);
mnuFacRpt.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickFacRpt();
});
}
});
var mnuFacRst = $("td.menuFacRst", facMenu);
mnuFacRst.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickFacRst();
});
}
});
var mnuFacOth = $("td.menuFacOth", facMenu);
mnuFacOth.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickFacOth();
});
}
});
$("label", facMenu).css("width", "200px");
$("input, button", facMenu).button("disable");
var tabAdv = $("#tabAdv", menuTabs);
var stdInfo = $("#stdInfo", tabAdv);
$("form[name='sisHeader']", $(this)).submit(function() {
stdInfo.loadStudent($("#studentid", $(this)).val(), "Adv");
return false;
});
$("#studentid", tabAdv).attr("size", "1").val(" ").change(function() {
stdInfo.loadStudent($(this).val(), "Adv");
});
var advMenu = $("#tblAdvMenu", tabAdv);
var mnuAdv = $("th", advMenu)
mnuAdv.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickAdvMenu();
});
}
});
$("label", mnuAdv).css("color", "#000000");
var mnuAdvInf = $("td.menuAdvInf", advMenu);
mnuAdvInf.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickAdvInf();
});
}
});
var mnuAdvReg = $("td.menuAdvReg", advMenu);
$("#btnAdv2yrCS", mnuAdvReg).button();
$("#setAdvReg", mnuAdvReg).buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickAdvReg();
});
}
});
$("#btnAdvWeb", mnuAdvReg).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickAdvReg();
});
}
});
var mnuAdvRpt = $("td.menuAdvRpt", advMenu);
mnuAdvRpt.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickAdvRpt();
});
}
});
var mnuAdvOth = $("td.menuAdvOth", advMenu);
$("#setAdvOth", mnuAdvOth).buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickAdvOth();
});
}
});
$("#btnAdvASR", mnuAdvOth).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickAdvASR();
});
}
});
$("label, #btnAdvASR, #btnAdv2yrCS, #btnAdvOthHow", advMenu).css("width", "200px");
$("input, button", advMenu).button("disable");
var tabOth = $("#tabOth", menuTabs);
var stdInfoOth = $("#stdInfoOth", tabOth);
if ( stdInfoOth.length ) { $("#studentidOth", tabOth).autoStudent(stdInfoOth); }
var othMenu = $("#tblOthMenu", tabOth);
var mnuOth = $("th", othMenu)
mnuOth.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickOthMenu();
});
}
});
$("label", mnuOth).css("color", "#000000");
var mnuOthSap = $("td.menuOthSap", othMenu);
mnuOthSap.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickOthSap();
});
}
});
var mnuOthRpt = $("td.menuOthRpt", othMenu);
mnuOthRpt.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickOthRpt();
});
}
});
var mnuOthHow = $("td.menuOthHow", othMenu);
mnuOthHow.buttonset({
create: function(event, ui) {
$("input", $(this)).click(function(e) {
$(this).clickOthHow();
});
}
});
$("label, #btnOthHowAPR", othMenu).css("width", "200px");
$("input, button", othMenu).button("disable");
/*
$("html").click(function() {
timer = 60;
var url = urlBase + "&template$=ear_session";
$.get(url);
});
*/
getAttOptions();
getGrdOptions();
$("#tplWrap").addClass("js");
// Go to Tab Option
switch(tabLoad) {
case "ADV":
menuTabs.tabs("option", "selected", 1);
$("#studentid").val(tabStdId).change();
switch(tabOption) {
case "APR":
$("#btnAdvRptAPR").click().prop("checked", true).button("refresh");
break;
}
break;
}
}
jQuery.fn.loadCourses = function() {
var url = urlBase + "&template$=ear_courses";
var data = "termselect=" + $("#termselect").val();
var tabFac = $("#tabFac");
var tblFacMenu = $("#tblFacMenu");
$("input:checked", tblFacMenu).removeProp("checked").button("refresh");
// $("div.dspFac", tabFac).html("").hide();
// Traditional CampusConnect ONLY
$("div.dspFac", tabFac).html("");
$(this).load(url, data, function() {
var courseId = $("#courseId", $(this));
if ( courseId.length ) {
courseId.change(function() {
$("input:checked", tblFacMenu).removeProp("checked").button("refresh");
// $("div.dspFac", $("#tabFac")).html("").hide();
// Traditional CampusConnect ONLY
$("div.dspFac", $("#tabFac")).html("");
$("#crsInfo").loadCourseInfo($(this).val());
// Traditional CampusConnect ONLY
if ( tabOption == "apr" ) { $("#dspFacRpt").loadFacRptAPR(); }
else if ( tabOption == "att" ) { $("#dspFacRpt").loadFacRptAtt(); }
else if ( tabOption == "grd" ) { $("#dspFacRpt").loadFacRptCG(); }
});
// Traditional CampusConnect ONLY
courseId.change();
$("#crsInfo").loadCourseInfo(courseId.val());
$("input, button", $("#tblFacMenu")).not("#btnFacRptAss, #btnFacOth, input[name='btnFacOth']").button("enable");
} else {
$("#crsInfo").html("");
$("input, button", $("#tblFacMenu")).button("disable");
}
});
}
jQuery.fn.loadStudent = function(stdId, opt) {
$(this).html(loadHTML);
var url = urlBase + "&template$=ear_student_info";
var data = "studentid=" + stdId;
var opt = ( typeof(opt) != "undefined" ) ? opt : "";
var tab = $("#tab" + opt);
var tblTabMenu = $("#tbl" + opt + "Menu", tab);
$("input:checked", tblTabMenu).removeProp("checked").button("refresh");
$("div.dsp" + opt, tab).html("").hide();
switch(opt) {
case "Adv":
var col = $("td.menuAdvReg", tblTabMenu);
$("#btnAdvWeb", col).removeProp("checked").button("option", "label", "WebReg");
$("label[for='btnAdvWeb'], col").css("color", "");
break;
case "Oth":
break;
default:
}
$("input, button", tblTabMenu).button("disable");
if ( $.trim(stdId) != "" ) {
$(this).load(url, data, function() {
$("input, button", tblTabMenu).not("#btnAdvRptAR, #btnAdvRptARP, #btnAdvRptAGR, #btnAdvRptACS, #btnAdvOthEA, #btnOthRptFUP").button("enable");
if ( opt == "Adv" ) { $("#dspAdvReg").loadAdvWeb(stdId, "btnAdvWeb"); }
/*
switch(opt) {
case "Adv":
$("#dspAdvReg").loadAdvWeb(stdId, "btnAdvWeb");
break;
case "Oth":
break;
default:
}
*/
});
} else {
$(this).html("");
}
}
/*
jQuery.fn.loadStudentAdv = function() {
$(this).html(loadHTML);
var url = urlBase + "&template$=ear_student_info";
var tabAdv = $("#tabAdv");
var stdId = $("#studentid", tabAdv).val()
var tblAdvMenu = $("#tblAdvMenu", tabAdv);
var col = $("td.menuAdvReg", tblAdvMenu);
var data = "studentid=" + stdId;
$("input:checked", tblAdvMenu).removeProp("checked").button("refresh");
$("div.dspAdv", tabAdv).html("").hide();
$("#btnAdvWeb", col).removeProp("checked").button("option", "label", "WebReg");
$("label[for='btnAdvWeb'], col").css("color", "");
$("input, button", tblAdvMenu).button("disable");
if ( $.trim(stdId) != "" ) {
$(this).load(url, data, function() {
$("input, button", tblAdvMenu).button("enable");
$("#dspAdvReg").loadAdvWeb(stdId, "btnAdvWeb");
});
} else {
$(this).html("");
}
}
*/
jQuery.fn.loadCourseInfo = function(crsId) {
$(this).html(loadHTML);
var url = urlBase + "&template$=ear_course_info";
var data = "courseid=" + crsId;
$(this).load(url, data);
}
jQuery.fn.loadCourseMenu = function() {
var url = urlBase + "&template$=ear_course_tabs";
$(this).load(url, function() {
var crsMenuTabs = $("#crsMenuTabs", $(this));
$("#menuFacRpt", crsMenuTabs).buttonset({
create: function(event, ui) {
$(this).clickFacRpt();
}
});
$("#menuFacRst ", crsMenuTabs).buttonset({
create: function(event, ui) {
$(this).clickFacRst();
}
});
$("#menuFacOth", crsMenuTabs).buttonset({
create: function(event, ui) {
$(this).clickFacOth();
}
});
crsMenuTabs.tabs();
});
};
jQuery.fn.loadFacRptAPR = function() {
$("#hdrFacRpt").html("Early Alert Reporting");
var url = urlBase + "&template$=ear_rpt";
var data = "termselect=" + $("#termselect").val() + "&courseid=" + $("#courseId").val();
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("#btnFacRptAPR_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspFacRptAPR").loadFacRptAPR_Add();
e.preventDefault();
});
}
});
$("button", $("#tblFacRptAPR_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspFacRptAPR").loadFacRptAPR_View(rptId);
if ( flgEdit ) $("#dspFacRptAPR").loadFacRptAPR_Edit(rptId);
if ( flgDelete ) $("#dspFacRptAPR").loadFacRptAPR_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblFacRptAPR_List", $("#dspFacRptAPR")).hideButtons();
});
}
jQuery.fn.loadFacRptAPR_Add = function() {
var url = urlBase + "&template$=ear_rpt_add";
var data = "courseid=" + $("#courseId").val() + "&termselect=" + $("#termselect").val();
$("#courseId").data("rptPost", "add");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).click( function(event) {
$(this).clickFacRptAPR(event);
});
}
});
$(this).setDatepickers();
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).append(grdOptions);
$("textarea.comment").each(function(index) {
$(this).change(function() {
$(this).textCounter(512, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") );
});
$("textarea.message").each(function(index) {
$(this).change(function() {
$(this).textCounter(320, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") );
});
});
}
jQuery.fn.saveFacRptAPR = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_rpt_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=E&rptPost=" + $("#courseId").data("rptPost");
$(this).html("Saving...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptAPR').loadFacRptAPR_View('" + rptId + "')", 2000);
});
}
jQuery.fn.signFacRptAPR = function(rptId) {
var flagged = false;
stdCount = $("#stdCnt").val();
for (i = 1; i <= stdCount; i++) {
if ( $("#stdFlag" + i).val() == "S" ) flagged = true;
}
if ( !flagged ) {
alert("You must report at least one student to Sumbit an APR.");
return;
}
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_rpt_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=S&signed=Y&rptPost=" + crs.data("rptPost");
$(this).html("Submitting...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptAPR').loadFacRptAPR_View('" + rptId +"')", 2000);
});
}
jQuery.fn.deleteFacRptAPR = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_rpt_save";
var data = "&reportid=" + rptId + "&courseid=" + crsId + "&approval=X&signed=&rptPost=delete";
$(this).html("Deleting...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptAPR').loadFacRptAPR()", 2000);
});
}
jQuery.fn.loadFacRptAPR_Edit = function(rptId) {
var url = urlBase + "&template$=ear_rpt_edit";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "edit");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$(this).setDatepickers();
for ( row = 1; row <= $("#stdCnt").val(); row++ ) { setFlag(row); }
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).val($(this).data("dfltValue")).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).each(function() {
$(this).append(grdOptions).val($(this).data("dfltValue"));
});
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(event) {
$(this).clickFacRptAPR(event);
});
}
});
$("textarea.comment").each(function(index) {
$(this).change(function() {
$(this).textCounter(512, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
$("textarea.message").each(function(index) {
$(this).change(function() {
$(this).textCounter(320, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
});
}
jQuery.fn.loadFacRptAPR_View = function(rptId) {
var url = urlBase + "&template$=ear_rpt_view";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "view");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
switch(this.id) {
case "btnFacRptAPR_Confirm":
$("#dspFacRptAPR").deleteFacRptAPR(rptId);
break;
default:
$(this).clickFacRptAPR(e);
break;
}
e.preventDefault();
});
}
});
});
};
jQuery.fn.loadFacRptAtt = function() {
$("#hdrFacRpt").html("Attendance Reporting");
var url = urlBase + "&template$=ear_att";
var data = "termselect=" + $("#termselect").val() + "&courseid=" + $("#courseId").val();
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("#btnFacRptAtt_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspFacRptAtt").loadFacRptAtt_Add();
e.preventDefault();
});
}
});
$("button", $("#tblFacRptAtt_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspFacRptAtt").loadFacRptAtt_View(rptId);
if ( flgEdit ) $("#dspFacRptAtt").loadFacRptAtt_Edit(rptId);
if ( flgDelete ) $("#dspFacRptAtt").loadFacRptAtt_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblFacRptAtt_List", $("#dspFacRptAtt")).hideButtons();
});
}
jQuery.fn.loadFacRptAtt_Add = function() {
var url = urlBase + "&template$=ear_att_add";
var data = "courseid=" + $("#courseId").val() + "&termselect=" + $("#termselect").val();
$("#courseId").data("rptPost", "add");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("#dpReportPick").datepicker({
altField: "#reportDate",
altFormat: 'mmddyy',
duration: 'fast',
minDate: '-4m',
maxDate: '+6m',
firstDay: '1',
hideIfNoPrevNext: true,
navigationAsDateFormat: true,
// beforeShowDay: $.datepicker.noWeekends,
showButtonPanel: true,
showMonthAfterYear: true,
changeMonth: true,
changeYear: true,
currentText: 'MM',
onSelect: function(dateText, inst) {
$("td.rptDate", $("#tblFacRptAtt_Add")).html(dateText);
}
});
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickFacRptAtt(event);
});
}
});
});
}
jQuery.fn.saveFacRptAtt = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_att_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var data = $("form", $(this)).serialize();
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=E&rptPost=" + crs.data("rptPost");
$(this).html("Saving...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptAtt').loadFacRptAtt_View('" + rptId + "')", 2000);
});
}
jQuery.fn.signFacRptAtt = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_att_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var data = $("form", $(this)).serialize();
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=S&signed=Y&rptPost=" + crs.data("rptPost");
$(this).html("Submitting...");
var elm = $(this);
$.post(url, data, function(data) {
$("#crsInfo").loadCourseInfo(crsId);
elm.html(data);
var t = setTimeout("$('#dspFacRptAtt').loadFacRptAtt_View('" + rptId +"')", 2000);
});
}
jQuery.fn.deleteFacRptAtt = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_att_save";
var data = "&reportid=" + rptId + "&courseid=" + crsId + "&approval=X&signed=&rptPost=delete";
$(this).html("Deleting...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptAtt').loadFacRptAtt()", 2000);
});
}
jQuery.fn.loadFacRptAtt_Edit = function(rptId) {
var url = urlBase + "&template$=ear_att_edit";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "edit");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("#dpReportPick").datepicker({
altField: "#reportDate",
altFormat: 'mmddyy',
duration: 'fast',
minDate: '-4m',
maxDate: '+0m',
firstDay: '1',
hideIfNoPrevNext: true,
navigationAsDateFormat: true,
// beforeShowDay: $.datepicker.noWeekends,
showButtonPanel: true,
currentText: 'MM',
onSelect: function(dateText, inst) {
$("td.rptDate", $("#tblFacRptAtt_Edit")).html(dateText);
}
});
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickFacRptAtt(event);
});
}
});
});
}
jQuery.fn.loadFacRptAtt_View = function(rptId) {
var url = urlBase + "&template$=ear_att_view";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "view");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
switch(this.id) {
case "btnFacRptAtt_Confirm":
$("#dspFacRptAtt").deleteFacRptAtt(rptId);
break;
default:
alert(this.id);
break;
}
e.preventDefault();
});
}
});
});
};
jQuery.fn.setDatepickers = function() {
var r = 1, rowCnt = $('#stdCnt', $(this)).val();
while (r <= rowCnt) {
var pickDate = $("#iDate" + r, $(this));
var saveDateId = "#issueDate" + r;
pickDate.datepicker({
altField: saveDateId,
altFormat: 'mmddyy',
duration: 'fast',
minDate: '-2m',
maxDate: '+0m',
firstDay: '1',
hideIfNoPrevNext: true,
navigationAsDateFormat: true,
beforeShowDay: $.datepicker.noWeekends,
showButtonPanel: true,
currentText: 'MM'
});
r = r + 1;
}
$("input.msgNotice").keyup(function (e) {
if ( $('#stdFlag' + $(this).attr("row")).val() != "S" ) {
$(this).val("");
alert("You must have a reported Early Alert to send a message to the student.");
}
});
}
function setFlag(row) {
var flag = "";
var stdFlag = $("#stdFlag" + row);
var iRow = stdFlag.closest("table");
$("select, input:text, textarea", iRow).each(function() {
if ($(this).val() != "") flag = "S";
});
$("input:checkbox, input:radio", iRow).not("input.chkNoEmail").each(function() {
if ( this.checked ) flag = "S";
});
// Set Flag
stdFlag.val(flag);
// if (flag != "S") $("#message" + row, iRow).val("");
}
function attendChange(dd, row, focus) {
var dPick = $("#iDate" + row, dd.closest("table"));
if ($("option:selected", dd).attr("class") == "askDate") {
dPick.removeProp("disabled");
if (focus != false) { dPick.focus(); }
}
else {
dPick.val("");
dPick.removeProp("disabled");
}
dPick.shadeDate();
/*
if (reportOption != "EDIT") setFlag(row);
*/
}
jQuery.fn.shadeDate = function() {
var color = "#55FF55"; // GREEN
if ( $(this).prop("disabled") ) { // GREY
color = "#AAAAAA";
$(this).next("input[type='hidden'").val("");
} else if ( $(this).val().length != 10 ) {
// color = ( $(this).val() == "" ) ? "#FFFF55" : "#FF5555"; // YELLOW else RED
color = ( $(this).val() == "" ) ? "#FFD100" : "#FF5555"; // MC Gold else RED
}
$(this).css("background-color", color);
}
function setStatus() {
elms = $("select.issue", $("#dspFacRptAPR"));
for (i = 0; i < elms.length; i++) {
attendChange(elms[i], i + 1, false);
}
}
jQuery.fn.hideButtons = function() {
for (row = 1; row <= $("#rptCnt", $(this).parent()).val(); row++) {
var rptApproval = $("#rptApproval" + row, $(this));
if ( rptApproval.val() == "S" ) {
$("button.edit, button.delete", rptApproval.closest("tr")).css("visibility", "hidden");
}
}
}
jQuery.fn.clickFacRpt = function( display ) {
$("#btnFacRpt").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspFacRpt");
var id = $(this).attr("id");
if ( id == "btnFacRptAPR" ) { dsp.loadFacRptAPR(); }
else if ( id == "btnFacRptAtt" ) { dsp.loadFacRptAtt(); }
else if ( id == "btnFacRptCG" ) { dsp.loadFacRptCG(); }
else if ( id == "btnFacRptMFG" ) { dsp.loadFacRptMFG(); }
// else if ( id == "btnFacRptAss" ) { dsp.loadFacRptAss(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.loadFacRptCG = function() {
$("#hdrFacRpt").html("Current Grades");
// $(this).html("
Coming Soon!
");
// return;
var url = urlBase + "&template$=ear_cg";
var data = "termselect=" + $("#termselect").val() + "&courseid=" + $("#courseId").val();
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("#btnFacRptCG_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspFacRptCG").loadFacRptCG_Add();
e.preventDefault();
});
}
});
$("button", $("#tblFacRptCG_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspFacRptCG").loadFacRptCG_View(rptId);
if ( flgEdit ) $("#dspFacRptCG").loadFacRptCG_Edit(rptId);
if ( flgDelete ) $("#dspFacRptCG").loadFacRptCG_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblFacRptCG_List", $("#dspFacRptCG")).hideButtons();
});
}
jQuery.fn.clickFacRptCG = function(e) {
var rptId = $(this).attr("reportid");
// if ( $(this).hasClass("btnAddCancel") ) { $("#btnFacRptCG", $("#tabFac")).click(); }
// Traditional CampusConnect ONLY
if ( $(this).hasClass("btnAddCancel") ) { $("#courseId").change(); }
else if ( $(this).hasClass("btnAddSave") ) { $("#dspFacRptCG").saveFacRptCG( rptId ); }
else if ( $(this).hasClass("btnAddSign") ) { $("#dspFacRptCG").signFacRptCG( rptId ); }
else { alert(this.className); }
e.preventDefault();
}
jQuery.fn.loadFacRptCG_Add = function() {
var url = urlBase + "&template$=ear_cg_add";
var data = "courseid=" + $("#courseId").val() + "&termselect=" + $("#termselect").val();
$("#courseId").data("rptPost", "add");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickFacRptCG(event);
});
}
});
});
}
jQuery.fn.saveFacRptCG = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_cg_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var data = $("form", $(this)).serialize();
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=E&rptPost=" + crs.data("rptPost");
$(this).html("Saving...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptCG').loadFacRptCG_View('" + rptId + "')", 2000);
});
}
jQuery.fn.signFacRptCG = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_cg_save";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumber);
var rptId = crsId + rptString;
}
var data = $("form", $(this)).serialize();
data += "&reportid=" + rptId + "&courseid=" + crsId + "&approval=S&signed=Y&rptPost=" + crs.data("rptPost");
$(this).html("Submitting...");
var elm = $(this);
$.post(url, data, function(data) {
$("#crsInfo").loadCourseInfo(crsId);
elm.html(data);
var t = setTimeout("$('#dspFacRptCG').loadFacRptCG_View('" + rptId +"')", 2000);
});
}
jQuery.fn.deleteFacRptCG = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_cg_save";
var data = "&reportid=" + rptId + "&courseid=" + crsId + "&approval=X&signed=&rptPost=delete";
$(this).html("Deleting...");
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
var t = setTimeout("$('#dspFacRptCG').loadFacRptCG()", 2000);
});
}
jQuery.fn.loadFacRptCG_Edit = function(rptId) {
var url = urlBase + "&template$=ear_cg_edit";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "edit");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(e) {
$(this).clickFacRptCG(event);
});
}
});
});
}
jQuery.fn.loadFacRptCG_View = function(rptId) {
var url = urlBase + "&template$=ear_cg_view";
var data = "reportId=" + rptId;
$("#courseId").data("rptPost", "view");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
switch(this.id) {
case "btnFacRptCG_Confirm":
$("#dspFacRptCG").deleteFacRptCG(rptId);
break;
default:
alert(this.id);
break;
}
e.preventDefault();
});
}
});
});
};
jQuery.fn.clickAdvInf = function( display ) {
$("#btnAdvInf").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspAdvInf");
var stdId = $("#studentid").val();
var id = $(this).attr("id");
if ( id == "btnAdvInfDD" ) { dsp.loadAdvInfDD(stdId); }
else if ( id == "btnAdvInfDA" ) { dsp.loadAdvInfDA(stdId); }
else if ( id == "btnAdvInfUT" ) { dsp.loadAdvInfUT(stdId); }
else if ( id == "btnAdvInfVS" ) { dsp.loadAdvInfVS(stdId); }
else if ( id == "btnAdvInfVG" ) { dsp.loadAdvInfVG(stdId); }
else if ( id == "btnAdvInfVT" ) { dsp.loadAdvInfVT(stdId); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.loadAdvInfDD = function(stdId) {
$("#hdrAdvInf").html("Demographic Data");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=view_demographic&option$=view_demographic&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
// dsp.frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvInfDA = function(stdId) {
$("#hdrAdvInf").html("Degree Audit");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=degree_audit&option$=degree_audit&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
// dsp.frmCaptureRegAskTerm(url);
});
}
function SubmitDeg(opt, mode) {
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&logmode=ADV_&studentid=" + $("#studentid").val();
if ( opt == 'SHOP' ) {
url += "&template$=degree_shop&option$=degree_shop";
} else if ( opt == 'SAVED' ) {
url += "&template$=degree_review&option$=degree_review";
} else if ( opt == '' ) {
url += "&template$=degree_audit&option$=degree_audit";
} else {
alert("Option " + opt + " is NOT defined!");
return;
}
$("#dspAdvInf").load(url);
}
jQuery.fn.loadAdvInfUT = function(stdId) {
$("#hdrAdvInf").html("Unofficial Transcript");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=view_transcript&option$=view_transcript&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
// dsp.frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvInfVS = function(stdId) {
$("#hdrAdvInf").html("View Schedule");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=schedule&option$=schedule&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
$(this).frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvInfVG = function(stdId) {
$("#hdrAdvInf").html("View Grades");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=grade_report&option$=grade_report&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
dsp.frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvInfVT = function(stdId) {
$("#hdrAdvInf").html("Advising Info");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=test_scores&option$=test_scores&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
dsp.frmCaptureRegAskTerm(url);
});
}
jQuery.fn.clickAdvReg = function( display ) {
$("#btnAdvReg").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspAdvReg");
var stdId = $("#studentid").val();
var id = $(this).attr("id");
if ( id == "btnAdvRegCA" ) { dsp.loadAdvRegCA(stdId); }
else if ( id == "btnAdvRegAD" ) { dsp.loadAdvRegAD(stdId); }
else if ( id == "btnAdvWeb" ) { dsp.loadAdvWeb(stdId, "btnAdvWeb", true); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.frmCaptureRegAskTerm = function(url) {
var dsp = $(this);
$("#termselect", dsp).attr("selectedIndex", 0);
$("form[name='AskTerm']", dsp).submit(function() {
var data = $(this).serialize();
dsp.html(loadHTML);
$.post(url, data, function(data) {
dsp.html(data);
dsp.frmCaptureRegist(url);
});
return false;
});
}
jQuery.fn.frmCaptureRegist = function(url) {
var dsp = $(this);
$("form[name='chngTrmDpt']", dsp).submit(function() {
var data = $(this).serialize();
dsp.html(loadHTML);
$.post(url, data, function(data) {
dsp.html(data);
dsp.frmCaptureRegAskTerm(url);
});
return false;
});
$("input[value='Add']", dsp).removeAttr("onclick").click(function(e) {
$("input[name='course']", dsp).val($(this).attr("coursecode"));
$("input[name='mode']", dsp).val("add");
var data = $("form[name='regist']", dsp).serialize();
dsp.html(loadHTML);
$.post(url, data, function(data) {
dsp.html(data);
dsp.frmCaptureRegist(url);
});
return false;
});
$("input[value='Drop']", dsp).removeAttr("onclick").click(function(e) {
$("input[name='course']", dsp).val($(this).attr("coursecode"));
$("input[name='mode']", dsp).val("drop");
var data = $("form[name='regist']", dsp).serialize();
dsp.html(loadHTML);
$.post(url, data, function(data) {
dsp.html(data);
dsp.frmCaptureRegist(url);
});
return false;
});
$("input.goBack", dsp).removeAttr("onclick").click(function(e) {
$("input[name='course']", dsp).val($(this).attr("coursecode"));
$("input[name='mode']", dsp).val("add");
var data = $("form[name='goBack']", dsp).serialize();
dsp.html(loadHTML);
$.post(url, data, function(data) {
dsp.html(data);
dsp.frmCaptureRegAskTerm(url);
});
return false;
});
}
jQuery.fn.loadAdvRegCA = function(stdId) {
$("#hdrAdvReg").html("Course Availibility");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=course_avail&option$=course_avail&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
$(this).frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvRegAD = function(stdId) {
$("#hdrAdvReg").html("Add/Drop Courses");
var url = "/cc3_scripts/cc_server2.exe?style$=GUI&class$=ICS&optionclass$=ICS&mode$=ICS&wrap=false";
url += urlUser + "&template$=registration&option$=registration&logmode=ADV_&studentid=" + stdId;
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, function() {
dsp.frmCaptureRegAskTerm(url);
});
}
jQuery.fn.loadAdvWeb = function(stdId, btnId, opt) {
var toggle = ( typeof(opt) != "undefined" ) ? opt : false;
$("#hdrAdvReg").html("WebReg");
var url = urlBase + "&template$=ear_webreg";
var data = "studentid=" + stdId + "&btnId=" + btnId;
if ( toggle ) { data += "&webRegOpt=toggle"; }
$(this).html(loadHTML);
$(this).load(url, data);
}
jQuery.fn.clickAdvRpt = function( display ) {
$("#btnAdvRpt").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspAdvRpt");
var id = $(this).attr("id");
if ( id == "btnAdvRptRst" ) { dsp.loadAdvRptRst(); }
else if ( id == "btnAdvRptRwP" ) { dsp.loadAdvRptRwP(); }
else if ( id == "btnAdvRptGR" ) { dsp.loadAdvRptGR(); }
else if ( id == "btnAdvRptCS" ) { dsp.loadAdvRptCS(); }
else if ( id == "btnAdvRptAPR" ) { dsp.loadAdvRptAPR(); }
else if ( id == "btnAdvRptAtt" ) { dsp.loadAdvRptAtt(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.clickAdvOth = function( display ) {
$("#btnAdvOth").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspAdvOth");
var id = $(this).attr("id");
if ( id == "btnAdvOthAPR" ) { dsp.loadAdvOthAPR(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.loadAdvOthAPR = function() {
$("#hdrAdvOth").html("Early Alert Reporting");
var url = urlBase + "&template$=ear_rpt_oth&rand=" + Math.random();
var stdOth = $("#studentid");
var data = "termselect=" + $("#termselect").val() + "&studentid=" + stdOth.val();
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("#btnOthRptAPR_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_Add(stdOth);
e.preventDefault();
});
}
});
$("button", $("#tblOthRptAPR_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_View(rptId);
if ( flgEdit ) $("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_Edit(rptId);
if ( flgDelete ) $("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblOthRptAPR_List", $("#dspOthRptAPR", $("#dspAdvOth"))).hideButtons();
});
}
jQuery.fn.loadAdvOthAPR_Add = function(std) {
var url = urlBase + "&template$=ear_rpt_add_oth&rand=" + Math.random();
var data = "studentid=" + std.val();
std.data("rptPost", "add");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$(this).setDatepickers();
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).val($(this).data("dfltValue")).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).append(grdOptions);
$("button", $(this)).button({
create: function(event, ui) {
$(this).click( function(event) {
$(this).clickAdvOthAPR(event);
});
}
});
});
}
jQuery.fn.clickAdvOthAPR = function(e) {
var rptId = $(this).attr("reportid");
var rdos = $("input[name='" + $(this).attr("clear") + "']", $(this).closest("table"));
if ( $(this).hasClass("btnAddCancel") ) { $("#btnAdvOthAPR", $("#tabAdv")).click(); }
else if ( $(this).hasClass("btnAddSave") ) { $("#dspOthRptAPR", $("#dspAdvOth")).saveAdvOthAPR( rptId ); }
else if ( $(this).hasClass("btnAddSign") ) { $("#dspOthRptAPR", $("#dspAdvOth")).signAdvOthAPR( rptId ); }
else if ( $(this).hasClass("rdoProgress") || $(this).hasClass("rdoPath") ) {
rdos.removeProp("checked");
setFlag("");
}
else { alert(this.className); }
e.preventDefault();
}
jQuery.fn.saveAdvOthAPR = function(rptId) {
var stdOth = $("#studentid");
var stdId = stdOth.val();
var url = urlBase + "&template$=ear_rpt_save_oth";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumberAdvOth);
var rptId = "STAF" + stdId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&approval=E&rptPost=" + stdOth.data("rptPost");
var dsp = $(this);
dsp.html("Saving...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_View("' + rptId + '")', 2000);
});
}
jQuery.fn.signAdvOthAPR = function(rptId) {
var flagged = ( $("#stdFlag", $("#dspAdvOth")).val() == "S" ) ? true : false;
if ( !flagged ) {
alert("You must report at least one item to Sumbit an APR.");
return;
}
var std = $("#studentid");
var stdId = std.val();
var url = urlBase + "&template$=ear_rpt_save_oth";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumberAdvOth);
var rptId = "STAF" + stdId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&approval=S&signed=Y&rptPost=" + std.data("rptPost");
var dsp = $(this);
dsp.html("Submitting...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR_View("' + rptId +'")', 2000);
});
}
jQuery.fn.deleteAdvOthAPR = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_rpt_save_oth";
var data = "&reportid=" + rptId + "&courseid=" + crsId + "&approval=X&signed=&rptPost=delete";
var dsp = $(this);
dsp.html("Deleting...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspAdvOth")).loadAdvOthAPR()', 2000);
});
}
jQuery.fn.loadAdvOthAPR_Edit = function(rptId) {
var url = urlBase + "&template$=ear_rpt_edit_oth";
var data = "reportId=" + rptId;
var stdOth = $("#studentid");
stdOth.data("rptPost", "edit");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$(this).setDatepickers();
setFlag("");
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).val($(this).data("dfltValue")).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).each(function() {
$(this).append(grdOptions).val($(this).data("dfltValue"));
});;
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(event) {
$(this).clickAdvOthAPR(event);
});
}
});
$("textarea.comment").each(function(index) {
$(this).change(function() {
$(this).textCounter(512, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
$("textarea.message").each(function(index) {
$(this).change(function() {
$(this).textCounter(320, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
});
}
jQuery.fn.loadAdvOthAPR_View = function(rptId) {
var url = urlBase + "&template$=ear_rpt_view_oth";
var data = "reportId=" + rptId;
var stdOth = $("#studentid");
stdOth.data("rptPost", "view");
var dsp = $(this);
dsp.html("Loading...");
dsp.load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
switch(this.id) {
case "btnOthRptAPR_Confirm":
dsp.deleteAdvOthAPR(rptId);
break;
default:
alert(this.id);
break;
}
e.preventDefault();
});
}
});
});
};
jQuery.fn.clickFacRptAPR = function(e) {
var rptId = $(this).attr("reportid");
var rdos = $("input[name='" + $(this).attr("clear") + "']", $(this).closest("table"));
// if ( $(this).hasClass("btnAddCancel") ) { $("#btnFacRptAPR", $("#tabFac")).click(); }
// Traditional CampusConnect ONLY
if ( $(this).hasClass("btnAddCancel") ) { $("#courseId").change(); }
else if ( $(this).hasClass("btnAddSave") ) { $("#dspFacRptAPR").saveFacRptAPR( rptId ); }
else if ( $(this).hasClass("btnAddSign") ) { $("#dspFacRptAPR").signFacRptAPR( rptId ); }
else if ( $(this).hasClass("rdoProgress") || $(this).hasClass("rdoPath") ) {
rdos.removeProp("checked");
setFlag($(this).attr("row"));
}
else { alert(this.className); }
e.preventDefault();
}
jQuery.fn.clickFacRptAtt = function(e) {
var rptId = $(this).attr("reportid");
// if ( $(this).hasClass("btnAddCancel") ) { $("#btnFacRptAtt", $("#tabFac")).click(); }
// Traditional CampusConnect ONLY
if ( $(this).hasClass("btnAddCancel") ) { $("#courseId").change(); }
else if ( $(this).hasClass("btnAddSave") ) { $("#dspFacRptAtt").saveFacRptAtt( rptId ); }
else if ( $(this).hasClass("btnAddSign") ) { $("#dspFacRptAtt").signFacRptAtt( rptId ); }
else { alert(this.className); }
e.preventDefault();
}
jQuery.fn.loadFacRptMFG = function() {
$("#hdrFacRpt").html("Midterm & Final Grades");
var url = urlBase + "&template$=grade_entry";
var data = "courseid=" + $("#courseId").val() + "&termselect=" + $("#termselect").val();
data += "&option$=grade_entry";
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("form[name='myForm']", $(this)).submit(function() {
var data = $(this).serialize();
$(this).html(loadHTML);
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
});
return false;
});
});
}
jQuery.fn.clickFacRst = function( display ) {
$("#btnFacRst").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspFacRst");
var id = $(this).attr("id");
if ( id == "btnFacRstOR" ) { dsp.loadFacRstOR(); }
else if ( id == "btnFacRstORP" ) { dsp.loadFacRstORP(); }
else if ( id == "btnFacRstCR" ) { dsp.loadFacRstCR(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.loadFacRstOR = function() {
$("#hdrFacRst").html("Official Roster");
var url = urlBase + "&template$=roster";
var data = "termselect=" + $("#termselect").val() + "&courseid=" + $("#courseId").val();
$(this).html(loadHTML);
$(this).load(url, data);
}
jQuery.fn.loadFacRstORP = function() {
$("#hdrFacRst").html("Official Roster w/Photo");
var url = urlBase + "&template$=roster";
var data = "termselect=" + $("#termselect").val() + "&courseid=" + $("#courseId").val() + "&wrap=false&photo=true";
$(this).html(loadHTML);
$(this).load(url, data);
}
jQuery.fn.loadFacRstCR = function() {
$("#hdrFacRst").html("Certified Roster");
var url = urlBase + "&template$=roster_cert";
var data = "courseid=" + $("#courseId").val() + "&termselect=" + $("#termselect").val();
data += "&option$=roster_cert";
$(this).html(loadHTML);
$(this).load(url, data, function() {
$("form[name='myForm']", $(this)).submit(function() {
var data = $(this).serialize();
$(this).html(loadHTML);
var elm = $(this);
$.post(url, data, function(data) {
elm.html(data);
});
return false;
});
});
}
jQuery.fn.clickFacOth = function( display ) {
$("#btnFacOth").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspFacRst");
var id = $(this).attr("id");
alert("Button " + id + " is undefined.");
/*
if ( id == "btnFacOthASR" ) { dsp.loadFacOthASR(); }
else if ( id == "btnFacOthAS" ) { dsp.loadFacOthAS(); }
else if ( id == "btnFacOthRpt" ) { dsp.loadFacOthRpt(); }
else if ( id == "btnFacOthES" ) { dsp.loadFacOthES(); }
else { alert("Button " + id + " is undefined."); }
*/
}
jQuery.fn.clickFacMenu = function() {
var tab = $("#tabFac");
var rpt = $("#dspFacRpt, #hdrFacRpt", tab);
var rst = $("#dspFacRst, #hdrFacRst", tab);
var oth = $("#dspFacOth, #hdrFacOth", tab);
var id = $(this).attr("id");
if ( id == "btnFacRpt" ) { rpt.show(); } else { rpt.hide(); }
if ( id == "btnFacRst" ) { rst.show(); } else { rst.hide(); }
if ( id == "btnFacOth" ) { oth.show(); } else { oth.hide(); }
}
jQuery.fn.clickAdvMenu = function(tab) {
var tab = $("#tabAdv");
var inf = $("#dspAdvInf, #hdrAdvInf", tab);
var reg = $("#dspAdvReg, #hdrAdvReg", tab);
var rpt = $("#dspAdvRpt, #hdrAdvRpt", tab);
var oth = $("#dspAdvOth, #hdrAdvOth", tab);
var id = $(this).attr("id");
if ( id == "btnAdvInf" ) { inf.show(); } else { inf.hide(); }
if ( id == "btnAdvReg" ) { reg.show() } else { reg.hide(); }
if ( id == "btnAdvRpt" ) { rpt.show(); } else { rpt.hide(); }
if ( id == "btnAdvOth" ) { oth.show(); } else { oth.hide(); }
}
jQuery.fn.loadAdvRptAPR = function() {
$("#hdrAdvRpt").html("Advisee APRs");
$(this).html(loadHTML);
var url = urlBase + "&template$=ear_rpt_follow";
var data = "termselect=" + $("#termselect").val() + "&studentid=" + $("#studentid").val();
$(this).load(url, data, function() {
var tblAdvRptAPR = $("#tblAdvRptAPR", $(this));
$("button.btnFollowUp", tblAdvRptAPR).button({
create: function(event, ui) {
$(this).click(function(e) {
var aprId = $(this).attr("aprId");
var aprRow = $(this).attr("row");
if ( $(this).button("option", "label") != "Close" ) {
$(this).button("option", "label", "Close");
var row = $(this).closest("tr").next();
row.slideDown("fast");
var detail = $("div:first", row);
var url = urlBase + "&template$=ear_rpt_fup_view";
var data = "aprId=" + aprId + "&aprRow=" + aprRow + "&aprView=advisee";
detail.load(url, data, function(responseText, textStatus, XMLHttpRequest) {
});
$("div.aprHistory", row).loadAdvRptAPR_History(aprId, aprRow);
} else {
$(this).button("option", "label", "Open").closest("tr").next().slideUp("fast");
}
e.preventDefault();
});
/*
if ( tabAPR && $(this).attr("aprid") == tabAPR ) {
$(this).click();
tabAPR = "";
}
*/
}
});
// if ( tabAPR != "" ) $("button[aprid='" + tabAPR + "']").click();
$("textarea.follow", tblAdvRptAPR).change(function(e) {
$(this).textCounter(1536, 128);
}).keyup(function() {
$(this).change();
});
$("button.btnFollowUp_Add", tblAdvRptAPR).button({
create: function(event, ui) {
$(this).css({ color: "red", position: "static" });
$(this).click(function(e) {
$(this).closest("tr.rowAdvRptAprFollow" + $(this).attr("row")).saveAdvRptAPR_Follow($(this).attr("reportid"));
e.preventDefault();
});
}
});
});
}
jQuery.fn.loadAdvRptAPR_History = function(aprId, aprRow) {
url = urlBase + "&template$=ear_rpt_fup_history&rand=" + Math.random();
data = "aprId=" + aprId + "&aprRow=" + aprRow + "&aprView=advisee";
$(this).load(url, data, function() {
$("button.btnAdvRptAPR_HistoryDelete", $(this)).button({
create: function(event, ui) {
$(this).css({ color: "red", position: "static", height: "50%" });
$(this).click(function(e) {
$(this).closest("tr.rowAdvRptAprFollow" + aprRow).deleteAdvRptAPR_Follow($(this).attr("record"), aprId);
e.preventDefault();
});
if ( $(this).attr("user") != earUsername && $(this).attr("user") != "" ) { $(this).hide() }
}
});
});
}
jQuery.fn.saveAdvRptAPR_Follow = function(rptId) {
var elm = $("div.aprHistory", $(this));
elm.html(loadHTML);
var url = urlBase + "&template$=ear_rpt_fup_store&rand=" + Math.random();
var aprId = rptId + $("#studentid").val();
var data = "aprId=" + aprId;
$("textarea.follow", $(this)).each(function() {
$("input." + $(this).attr("id")).each(function(index) {
data += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
});
});
var aprRow = $("button.btnFollowUp", $(this).prev()).attr("row");
$.post(url, data, function(responseText, textStatus, XMLHttpRequest) {
elm.html(responseText);
$("button.btnAdvRptAPR_HistoryDelete", elm).button({
create: function(event, ui) {
$(this).css({ color: "red", position: "static" });
$(this).click(function(e) {
$(this).closest("tr.rowAdvRptAprFollow" + aprRow).deleteAdvRptAPR_Follow($(this).attr("record"), aprId);
e.preventDefault();
});
if ( $(this).attr("user") != earUsername && $(this).attr("user") != "" ) { $(this).hide() }
}
});
});
}
jQuery.fn.deleteAdvRptAPR_Follow = function(rec, aprId) {
var elm = $("div.aprHistory", $(this));
elm.html(loadHTML);
var url = urlBase + "&template$=ear_rpt_fup_delete&rand=" + Math.random();
var data = "aprId=" + aprId + "&record=" + rec;
var aprRow = $("button.btnFollowUp", $(this).prev()).attr("row");
elm.load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button.btnAdvRptAPR_HistoryDelete", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$(this).closest("tr.rowAdvRptAprFollow" + aprRow).deleteAdvRptAPR_Follow($(this).attr("record"), aprId);
e.preventDefault();
});
if ( $(this).attr("user") != earUsername && $(this).attr("user") != "" ) { $(this).hide() }
}
});
});
}
jQuery.fn.loadAdvRptAtt = function() {
$("#hdrAdvRpt").html("Advisee Attendance");
$(this).html(loadHTML);
var url = urlBase + "&template$=ear_att_advisee";
var data = "termselect=" + $("#termselect").val() + "&studentid=" + $("#studentid").val();
$(this).load(url, data, function() {
/*
$("#btnFacRptAPR_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspFacRptAPR").loadFacRptAPR_Add();
e.preventDefault();
});
}
});
$("button", $("#tblFacRptAPR_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspFacRptAPR").loadFacRptAPR_View(rptId);
if ( flgEdit ) $("#dspFacRptAPR").loadFacRptAPR_Edit(rptId);
if ( flgDelete ) $("#dspFacRptAPR").loadFacRptAPR_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblFacRptAPR_List", $("#dspFacRptAPR")).hideButtons();
*/
});
}
jQuery.fn.clickOthMenu = function(tab) {
var tab = $("#tabOth");
var sap = $("#dspOthSap, #hdrOthSap", tab);
var rpt = $("#dspOthRpt, #hdrOthRpt", tab);
var how = $("#dspOthHow, #hdrOthHow", tab);
var id = $(this).attr("id");
if ( id == "btnOthSap" ) { sap.show(); } else { sap.hide(); }
if ( id == "btnOthRpt" ) { rpt.show() } else { rpt.hide(); }
if ( id == "btnOthHow" ) { how.show(); } else { how.hide(); }
}
jQuery.fn.clickOthSap = function( display ) {
$("#btnOthSap").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspOthSap");
var id = $(this).attr("id");
if ( id == "btnOthSapFU" ) { dsp.loadOthSapFU(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.clickOthRpt = function( display ) {
$("#btnOthRpt").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspOthRpt");
var id = $(this).attr("id");
if ( id == "btnOthRptAPR" ) { dsp.loadOthRptAPR(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.loadOthRptAPR = function() {
$("#hdrOthRpt").html("Early Alert Reporting");
var url = urlBase + "&template$=ear_rpt_oth&rand=" + Math.random();
var stdOth = $("#studentidOth");
var data = "termselect=" + $("#termselect").val() + "&studentid=" + stdOth.data("stdId");
var dsp = $(this);
dsp.html(loadHTML);
dsp.load(url, data, function() {
$("#btnOthRptAPR_Add", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
$("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_Add(stdOth);
e.preventDefault();
});
}
});
$("button", $("#tblOthRptAPR_List", $(this))).button({
create: function(event, ui) {
$(this).click(function(e) {
var rptId = $(this).attr("reportid");
var flgView = $(this).hasClass("view");
var flgEdit = $(this).hasClass("edit");
var flgDelete = $(this).hasClass("delete");
if ( flgView ) $("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_View(rptId);
if ( flgEdit ) $("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_Edit(rptId);
if ( flgDelete ) $("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_View(rptId + "&confirm=true");
if ( !flgView && !flgEdit && !flgDelete ) alert(this.className);
e.preventDefault();
});
}
});
$("#tblOthRptAPR_List", $("#dspOthRptAPR", $("#dspOthRpt"))).hideButtons();
});
}
jQuery.fn.loadOthRptAPR_Add = function(std) {
var url = urlBase + "&template$=ear_rpt_add_oth&rand=" + Math.random();
var data = "studentid=" + std.data("stdId");
std.data("rptPost", "add");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$(this).setDatepickers();
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).append(grdOptions);
$("button", $(this)).button({
create: function(event, ui) {
$(this).click( function(event) {
$(this).clickOthRptAPR(event);
});
}
});
});
}
jQuery.fn.clickOthRptAPR = function(e) {
var rptId = $(this).attr("reportid");
var rdos = $("input[name='" + $(this).attr("clear") + "']", $(this).closest("table"));
if ( $(this).hasClass("btnAddCancel") ) { $("#btnOthRptAPR", $("#tabOth")).click(); }
else if ( $(this).hasClass("btnAddSave") ) { $("#dspOthRptAPR", $("#dspOthRpt")).saveOthRptAPR( rptId ); }
else if ( $(this).hasClass("btnAddSign") ) { $("#dspOthRptAPR", $("#dspOthRpt")).signOthRptAPR( rptId ); }
else if ( $(this).hasClass("rdoProgress") || $(this).hasClass("rdoPath") ) {
rdos.removeProp("checked");
setFlag("");
}
else { alert(this.className); }
e.preventDefault();
}
jQuery.fn.saveOthRptAPR = function(rptId) {
var stdOth = $("#studentidOth");
var url = urlBase + "&template$=ear_rpt_save_oth";
var stdId = stdOth.data("stdId");
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumberOth);
var rptId = "STAF" + stdId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&approval=E&rptPost=" + stdOth.data("rptPost");
var dsp = $(this);
dsp.html("Saving...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_View("' + rptId + '")', 2000);
});
}
jQuery.fn.signOthRptAPR = function(rptId) {
var flagged = ( $("#stdFlag", $("#dspOthRpt")).val() == "S" ) ? true : false;
if ( !flagged ) {
alert("You must report at least one item to Sumbit an APR.");
return;
}
var std = $("#studentidOth");
var stdId = std.data("stdId");
var url = urlBase + "&template$=ear_rpt_save_oth";
if ( typeof(rptId) == "undefined" ) {
var rptString = getRptNbrString(rptNumberOth);
var rptId = "STAF" + stdId + rptString;
}
var cmtData = "";
var cmt = $("textarea.comment", $(this));
cmt.each(function() {
cmtId = cmt.attr("id");
$("input." + cmtId).each(function(index) {
cmtData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var msgData = "";
var msg = $("textarea.message", $(this));
msg.each(function() {
msgId = msg.attr("id");
$("input." + msgId).each(function(index) {
msgData += "&" + $(this).attr("name") + "=" + encodeURIComponent($(this).val());
}).remove();
}).remove();
var data = $("form", $(this)).serialize() + cmtData + msgData;
data += "&reportid=" + rptId + "&approval=S&signed=Y&rptPost=" + std.data("rptPost");
var dsp = $(this);
dsp.html("Submitting...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR_View("' + rptId + '")', 2000);
});
}
jQuery.fn.deleteOthRptAPR = function(rptId) {
var crs = $("#courseId");
var crsId = crs.val();
var url = urlBase + "&template$=ear_rpt_save_oth";
var data = "&reportid=" + rptId + "&courseid=" + crsId + "&approval=X&signed=&rptPost=delete";
var dsp = $(this);
dsp.html("Deleting...");
$.post(url, data, function(data) {
dsp.html(data);
var t = setTimeout('$("#dspOthRptAPR", $("#dspOthRpt")).loadOthRptAPR()', 2000);
});
}
jQuery.fn.loadOthRptAPR_Edit = function(rptId) {
var url = urlBase + "&template$=ear_rpt_edit_oth";
var data = "reportId=" + rptId;
var stdOth = $("#studentidOth");
stdOth.data("rptPost", "edit");
$(this).html("Loading...");
$(this).load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$(this).setDatepickers();
setFlag("");
$("select.issue", $(this)).each(function() {
$(this).append(attOptions).val($(this).data("dfltValue")).change(function() {
$(this).statusChange($(this).data("row"), true);
}).change();
});
$("select.grade", $(this)).each(function() {
$(this).append(grdOptions).val($(this).data("dfltValue"));
});
$("button", $(this)).button({
create: function(event, ui) {
$(this).click(function(event) {
$(this).clickOthRptAPR(event);
});
}
});
$("textarea.comment").each(function(index) {
$(this).change(function() {
$(this).textCounter(512, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
$("textarea.message").each(function(index) {
$(this).change(function() {
$(this).textCounter(320, 64);
setFlag(index + 1);
}).keyup(function() {
$(this).change();
});
var html = "";
$(this).parent().find("." + $(this).attr("id")).each(function() {
html += $(this).val();
});
$(this).html( html.replace(/
/g, "\n") ).change();
});
});
}
jQuery.fn.loadOthRptAPR_View = function(rptId) {
var url = urlBase + "&template$=ear_rpt_view_oth";
var data = "reportId=" + rptId;
var stdOth = $("#studentidOth");
stdOth.data("rptPost", "view");
var dsp = $(this);
dsp.html("Loading...");
dsp.load(url, data, function(responseText, textStatus, XMLHttpRequest) {
$("button", $(this)).button({
create: function(event, ui) {
$(this).css("color", "red");
$(this).click(function(e) {
switch(this.id) {
case "btnOthRptAPR_Confirm":
dsp.deleteOthRptAPR(rptId);
break;
default:
alert(this.id);
break;
}
e.preventDefault();
});
}
});
});
};
jQuery.fn.clickOthHow = function( display ) {
$("#btnOthHow").click().button("refresh");
var dsp = ( typeof(display) != "undefined" ) ? display : $("#dspOthHow");
var id = $(this).attr("id");
if ( id == "btnOthHowAPR" ) { dsp.loadOthHowAPR(); }
else { alert("Button " + id + " is undefined."); }
}
jQuery.fn.getLastAttend = function(crsId, stdId, elmId) {
var url = urlBase + "&template$=ear_rpt_lastattend";
var data = "courseid=" + crsId + "&studentid=" + stdId + "&priorId=" + $(this).attr("id") + "&elmId=" + elmId;
alert(data);
$.get(url, data, function(responseText, textStatus, XMLHttpRequest) {
alert(textStatus);
});
}
function getRptNbrString(rptNum) {
var nbrString = new String(rptNum);
while ( nbrString.length < 4 ) {
nbrString = " " + nbrString;
}
return nbrString;
}
function getGrdOptions(bld) {
var url = urlBase + "&template$=ear_opt_grades";
var rebuild = ( typeof(bld) != "undefined" ) ? bld : false;
if ( rebuild ) url += "&rebuild=TRUE&rand=" + Math.random();
$.get( url, function(responseText, textStatus, XMLHttpRequest) {
if ( textStatus == "success" ) {
grdOptions = new Array();
grdOptions = responseText;
}
});
}
function getAttOptions(bld) {
var url = urlBase + "&template$=ear_opt_attend";
var rebuild = ( typeof(bld) != "undefined" ) ? bld : false;
if ( rebuild ) url += "&rebuild=TRUE&rand=" + Math.random();
$.get( url, function(responseText, textStatus, XMLHttpRequest) {
attOptions = responseText;
});
}
jQuery.fn.statusChange = function(row, nofocus) {
var noFocus = ( typeof(nofocus) != "undefined" ) ? nofocus : false;
var optValue = $(this).val();
var optClass = $("option:selected", $(this)).attr("class");
var iDate = document.getElementById("iDate" + row);
var jDate = $("#iDate" + row);
if (optClass == "askDate") {
jDate.show();
iDate.disabled = false;
if (!nofocus) { iDate.focus(); }
} else {
iDate.value = "";
iDate.disabled = true;
jDate.hide();
}
$(iDate).shadeDate();
var numAbsences = $("#numAbsences" + row);
var lblAbsences = $("#lblAbsences" + row);
var absMsg = $("#absMsg" + row);
if (optClass == "askNumAbs") {
numAbsences.show().removeProp("disabled");
lblAbsences.show();
absMsg.show();
if (!nofocus) { numAbsences.focus(); }
} else {
numAbsences.val("").prop("disabled", true).hide();
lblAbsences.hide();
absMsg.hide();
}
numAbsences.shade();
setFlag(row);
}
jQuery.fn.shade = function() {
var elmVal = $(this).val();
if ( $(this).prop("disabled") ) { // Disabled - GREY
$(this).css("backgroundColor", "#AAAAAA");
} else {
if ( isNaN(elmVal) ) {// Invalid - RED
$(this).css("backgroundColor", "#FF5555");
} else { // Valid - YELLOW else GREEN
// var color = ( elmVal == "" ) ? "#FFFF55" : "#55FF55";
var color = ( elmVal == "" ) ? "#FFD100" : "#55FF55";
$(this).css("backgroundColor", color);
}
}
}
jQuery.fn.setCheck = function( val ) {
if ( $(this).val() == val ) {
$(this).prop("checked", true);
} else {
$(this).removeProp("checked");
}
}