/* * This set of Javascript functions provides general utilities for the system. None * of the functions in this file are directly related to look and feel. It is strongly * recommended NOT to modify these functions. */ /* * Hook to be called whenever a page is loaded. * Override this to provide functionality. */ function onLoad() { // Do nothing } /* * Hook to be called whenever a page is resized. * Override this to provide functionality. */ function onResize() { // Do nothing } /* * Hook to be called whenever a page is left. * Override this to provide functionality. */ function onUnload() { // Do nothing } /* * Hook to be called whenever a form is submitted. * Override this to provide functionality. */ function onSubmit() { return true; } /* * This is the basic action-delegation method called to submit forms to EDU. * Most button clicks result in a call to this function. */ function doAction(action) { var frm = document.forms["edu_form"]; frm.elements.actionID.value = action; if (onSubmit()) { frm.submit(); } } /* * Read a question response from a Java applet that conforms to the contract of * Java question type. */ function readAppletItems() { var form = document.edu_form; var elts = form.elements; var pattern = /ans\.(\d+)\.(\d+)/; for (var i=0; i"); d.writeln(" "); d.writeln("
"); d.writeln(" "); d.writeln("
"); d.writeln(" "); d.writeln(""); d.close(); d.forms[0].submit(); w.focus(); } /* * Provide help for a user in one of the system roles of instructor, student, administrator, or proctor. */ function getHelp(what) { var winspec = "scrollbars,resizable,width=800,height=600"; var help; // The definitions of the help urls are in helpURLs.js if (what == "instructor") { help = INSTRUCTOR_HELP_URL; } else if (what == "administrator") { help = SYSADMIN_HELP_URL; } else if (what == "proctor") { help = PROCTOR_HELP_URL; } else if (what == "inline_editor") { help = INLINE_EDITOR_HELP_URL; } else if (what == "math_symbol_mode") { help = MATH_SYMBOL_MODE_HELP_URL; } else if (what == "math_text_mode") { help = MATH_TEXT_MODE_HELP_URL; } else if (what == "chem_symbol_mode") { help = CHEM_SYMBOL_MODE_HELP_URL; } else if (what == "chem_text_mode") { help = CHEM_TEXT_MODE_HELP_URL; } else { help = ASSIGNMENT_TYPE_HELP_URL; } window.open(getBaseURL() + help, "helpWindow", winspec); } /* * Set the crumb trail for the current page. Depending on the look and feel of the system, * this function may not server any purpose. */ function setCrumbTrail(trail) { var t; if (document.getElementById && (t = document.getElementById("crumb_trail"))) { t.innerHTML = trail; } } /* * Utility method. Not called from outside this package. */ function getMaplePlotURL(maple, plot, type, libname, driver) { var url = getBaseURL() + "modules/mapleTA.plotserver.PlotServer" + "?maple=" + myEscape(maple) + (plot != null ? "&plot=" + myEscape(plot) : "") + (type != null ? "&type=" + myEscape(type) : "") + (libname != null ? "&libname=" + myEscape(libname) : "") + ((driver == null || driver.length ==0) ? "" : "&plotdriver=" + myEscape(driver)); return url; } /* * Create a plot using the provided Maple code. * Utility method. Not called from outside this package. */ function drawMaplePlot(maple, width, height, libname, driver) { var url = getMaplePlotURL(maple, null, null, libname, driver); document.write(""); } /* * Create a popup plot of Maple code. */ function popupMaplePlot(maple, plot, type, libname, driver) { var url = getMaplePlotURL(maple, plot, type, libname, driver); var w = window.open("", "maplepopup", "width=500,height=380,scrollbars=no,resizable=no"); var d = w.document; d.open("text/html"); d.writeln(""); d.writeln(""); d.writeln(""); d.writeln(""); d.writeln(""); d.writeln(""); d.writeln(""); d.close(); w.focus(); } /* * Utility method to perform URL escaping since there are problems with the Javascript * built-in function. */ function myEscape(s) { var a = escape(s); var b = ""; for (i=0; i