aimmath-commit Mailing List for AiM Assessment in Mathematics (Page 10)
Brought to you by:
gustav_delius,
npstrick
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(2) |
Jun
|
Jul
(73) |
Aug
(96) |
Sep
(240) |
Oct
(34) |
Nov
(12) |
Dec
(3) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(31) |
Feb
(6) |
Mar
(17) |
Apr
(6) |
May
(5) |
Jun
|
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(19) |
Nov
|
Dec
|
2005 |
Jan
|
Feb
|
Mar
(14) |
Apr
(33) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <ma...@us...> - 2003-09-25 15:02:35
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv24998/lang/en Modified Files: math_assignment.php Log Message: Added 'email students' button to view.php for markers / lecturers to press once the scripts have been returned. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** math_assignment.php 24 Sep 2003 11:52:46 -0000 1.16 --- math_assignment.php 25 Sep 2003 15:02:22 -0000 1.17 *************** *** 36,39 **** --- 36,40 ---- $string['editquiz'] = "AiM Quiz Administration"; $string['editsubject'] = "AiM Subject Administration"; + $string['emailstudents'] = "Email Students"; $string['externalurl'] = "link to URL"; $string['failed'] = "Error : Could not save the changes made."; |
From: <ma...@us...> - 2003-09-25 15:02:35
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv24998/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: Added 'email students' button to view.php for markers / lecturers to press once the scripts have been returned. Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** mysql.php 24 Sep 2003 13:22:22 -0000 1.10 --- mysql.php 25 Sep 2003 15:02:23 -0000 1.11 *************** *** 18,22 **** } if ($oldversion < 2003092414) { ! execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment` CHANGE `focus` `aimfocus` tinyint(1) unsigned NOT NULL default '1' AFTER aimquiz"); } --- 18,25 ---- } if ($oldversion < 2003092414) { ! execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment` CHANGE `focus` `aimfocus` tinyint(1) unsigned NOT NULL default '1' AFTER `aimquiz`"); ! } ! if ($oldversion < 2003092516) { ! execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment` ADD `papersheetsreturned` tinyint(1) NOT NULL default '0' AFTER `solutionsisurl`"); } Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mysql.sql 24 Sep 2003 13:22:22 -0000 1.9 --- mysql.sql 25 Sep 2003 15:02:23 -0000 1.10 *************** *** 14,17 **** --- 14,18 ---- solutions varchar(255) NOT NULL default '', solutionsisurl tinyint(1) NOT NULL default '1', + papersheetsreturned tinyint(1) NOT NULL default '0', aimquiz varchar(255) NOT NULL default '', aimfocus tinyint(1) unsigned NOT NULL default '1', |
From: <gus...@us...> - 2003-09-24 23:57:32
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv1217/mod/math_assignment Modified Files: pdfgen.php Log Message: Now problem and solution sheets contain images. Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** pdfgen.php 24 Sep 2003 11:53:42 -0000 1.7 --- pdfgen.php 24 Sep 2003 23:57:28 -0000 1.8 *************** *** 9,15 **** optional_variable($type, "problems"); // "problems" or "solutions" - - $solutions = (boolean)($type == "solutions"); - if (! $site = get_site()) { redirect("$CFG->wwwroot/$CFG->admin/index.php"); --- 9,12 ---- *************** *** 40,63 **** } // Load lecturer's tex files or use dummy and store in $latex ! math_assignment_get_file_urls($math_assignment,$probfile,$solfile); ! if ($solutions) $texfile = $solfile; else $texfile = $probfile; if (math_assignment_is_tex_file($texfile)) { $latex = file_get_contents($texfile); } else { ! $latex = " ! \\documentclass[12pt]{article}\n ! \\usepackage{amsmath}\n ! \\begin{document}\n ! \\begin{center} ! {\\bf " . $course->fullname . ": " . $math_assignment->name . "} ! \\end{center} ! "; } // if there is an aim quiz load it into $data ! if ($math_assignment->aimquiz) { --- 37,78 ---- } + // Create temp directory if it doesn't exist + $tempdir = "$CFG->dataroot/temp/math_assignment/$math_assignment->id"; + mkdir("$CFG->dataroot/temp", $CFG->directorypermissions); + mkdir("$CFG->dataroot/temp/math_assignment", $CFG->directorypermissions); + mkdir($tempdir, $CFG->directorypermissions); + // Load lecturer's tex files or use dummy and store in $latex ! if ($type == "problems") { ! if ($math_assignment->problemsisurl) { ! $texfile = $math_assignment->problems; ! } ! else { ! $texfile = "$CFG->dataroot/$course->id/$math_assignment->problems"; ! } ! } ! else if ($type == solutions) { ! if ($math_assignment->solutionsisurl) { ! $texfile = $math_assignment->solutions; ! } ! else { ! $texfile = "$CFG->dataroot/$course->id/$math_assignment->solutions"; ! } ! } ! if (math_assignment_is_tex_file($texfile)) { $latex = file_get_contents($texfile); } else { ! $latex = file_get_contents("$CFG->dirroot/mod/math_assignment/$type.tex"); } + // Insert course and assignment name if required + $latex = str_replace("\coursename","$course->fullname",$latex); + $latex = str_replace("\assignmentname","$math_assignment->name",$latex); + // if there is an aim quiz load it into $data ! $data = ""; if ($math_assignment->aimquiz) { *************** *** 70,87 **** $postdata = ""; ! if (isstudent($course->id)) { ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Command", "ShowQuizPage"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->passwd); ! } ! else { ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","try/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "TryQuiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); ! } // load the AiM page and grab the result --- 85,93 ---- $postdata = ""; ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","try/Quiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "TryQuiz"); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); // load the AiM page and grab the result *************** *** 102,117 **** } // convert AiM questions or solutions in $data and add to $latex ! // remove everything before the first question ! $data = preg_replace("/^[\s\S]*?(?=id=\"question)/", ! "",$data); ! if (!$solutions) { // remove all answers and solutions $data = preg_replace("/class=\"lastanswer\"[\s\S]*?((?=id=\"question)|$)/", "",$data); } ! else { // remove answers but keep solution --- 108,177 ---- } + + // convert images + + if (preg_match_all("/<img src=\"([^\"]+jpg)\"/",$data,$imagematches)) { + $imageurls = $imagematches[1]; + foreach ($imageurls as $key => $imageurl) { + if (!copy($imageurl,"$tempdir/$key.jpg")) + error("Couldn't copy image file to temp directory"); + $data = preg_replace("/<img src=\"([^\"]+jpg)\"/", + "<latex>\n\\begin\{center}\n\\pdfimageresolution=150\n\\pdfximage\{$tempdir/$key.jpg}\\pdfrefximage\\pdflastximage\n\\end\{center}\n</latex>", + $data,1 + ); + } + } + // convert AiM questions or solutions in $data and add to $latex ! $questions = preg_split("/id=\"question(\d+)\"/",$data); ! array_shift($questions); ! foreach ($questions as $question) { ! //$latex = preg_replace("/(?<!newcommand\{)\\\aimquestion/",addslashes(math_assignment_aim_to_latex($question,$type)),$latex,1); ! $latex = str_replace_once("\aimquestion",math_assignment_aim_to_latex($question,$type),$latex); ! } ! // generate pdf file from $latex ! ! //$tempfile = tempnam(); ! $tempfile = "temp.tex"; ! if (!$fp=fopen($tempfile,"w")) ! error("Sorry, I can't produce the pdf output. Failed to open temporary file."); ! fwrite($fp,$latex); ! fclose($fp); ! exec("pdflatex -interaction=batchmode temp.tex"); ! ! // output of pdf ! ! redirect("temp.pdf"); ! ! /* ! if ($file = fopen("temp.pdf", "rb")) { // the 'b' is for compatibility with Windoze ! ! // tell the browser that it is pdf ! header("Content-type: application/pdf"); ! if ($solutions) ! header("Content-disposition: inline; filename=solutions.pdf"); ! else ! header("Content-disposition: inline; filename=problems.pdf"); ! ! fpassthru($file); // chuck all the data direct to the browser and close the handle ! } ! else { ! error("It didn't work!"); // error message ! } ! ! */ ! ! function math_assignment_aim_to_latex($data,$type) { ! // This function is given a chunk of the aimpage corresponding to one question ! // and returns a latex string ! ! if ($type == "problems") { // remove all answers and solutions $data = preg_replace("/class=\"lastanswer\"[\s\S]*?((?=id=\"question)|$)/", "",$data); } ! else if ($type == "solutions") { // remove answers but keep solution *************** *** 119,139 **** // The "class=\"solu is there to save this from being erased in the next step below $data = preg_replace("/The correct answer is ([A-Z])/", ! "class=\"solu<latex>\n\n\\noindent{\\bf Right Answer: } $1</latex>",$data); // Remove anything else up to the solution or the next question or the end of file ! $data = preg_replace("/class=\"lastanswer\"[\s\S]*?((?=class=\"solu)|(?=id=\"quest)|$)/", ! "",$data); ! ! $data = preg_replace("/class=\"solution/", ! "<latex>\n\n\\noindent{\\bf Solution:}\n\n</latex>",$data); ! } ! // remove questionheaders including descriptions $data = preg_replace("/class=\"questionheader\"[\s\S]*?class=\"questionbody/", "",$data); - - // Questions - $data = preg_replace("/id=\"question(\d+)\"/i", - "<latex>\n\n\vspace{5mm}\\noindent{\\bf Question \$1:}\n\n</latex>",$data); // Parts --- 179,192 ---- // The "class=\"solu is there to save this from being erased in the next step below $data = preg_replace("/The correct answer is ([A-Z])/", ! "class=\"solu<latex>\n\n\\noindent{ Right Answer: } $1. </latex>",$data); // Remove anything else up to the solution or the next question or the end of file ! $data = preg_replace("/(?<=class=\"questionbody)[\s\S]*?((?=class=\"solu)|(?=id=\"quest)|$)/", ! "",$data); ! } ! // remove questionheaders including descriptions $data = preg_replace("/class=\"questionheader\"[\s\S]*?class=\"questionbody/", "",$data); // Parts *************** *** 155,197 **** // We might at some point want to replace input box by .... //preg_match_all("/<latex>([\s\S]*)?<\/latex>/", $data, $matches); ! //$latex .= implode(" ", $matches[0]); ! ! // extract anything inside <latex> ..</latex> and append it to $latex // this is not done elegantly, but who cares. $chunks = explode("</latex>",$data); array_pop($chunks); foreach ($chunks as $chunk) { ! preg_match("/(?<=<latex>)[\s\S]*$/","$chunk",$piece); ! $latex .= $piece[0]; } ! $latex .= "\n\n\\end{document}"; ! ! // generate pdf file from $latex ! ! //$tempfile = tempnam(); ! $tempfile = "temp.tex"; ! if (!$fp=fopen($tempfile,"w")) ! error("Sorry, I can't produce the pdf output. Failed to open temporary file."); ! fwrite($fp,$latex); ! fclose($fp); ! exec("pdflatex -interaction=batchmode temp.tex"); ! ! // output of pdf ! ! if ($file = fopen("temp.pdf", "rb")) { // the 'b' is for compatibility with Windoze ! ! // tell the browser that it is pdf ! header("Content-type: application/pdf"); ! if ($solutions) ! header("Content-disposition: inline; filename=solutions.pdf"); ! else ! header("Content-disposition: inline; filename=problems.pdf"); ! fpassthru($file); // chuck all the data direct to the browser and close the handle ! } ! else { ! error("It didn't work!"); // error message } ! ?> --- 208,238 ---- // We might at some point want to replace input box by .... //preg_match_all("/<latex>([\s\S]*)?<\/latex>/", $data, $matches); ! ! // extract anything inside <latex> ..</latex> and append it to $questiontex // this is not done elegantly, but who cares. + $questiontex = ""; $chunks = explode("</latex>",$data); array_pop($chunks); foreach ($chunks as $chunk) { ! // preg_match("/(?<=<latex>)[\s\S]*$/","$chunk",$piece); ! // $questiontex .= $piece[0]; ! $pieces = explode("<latex>",$chunk); ! $questiontex .= $pieces[1]; } ! return($questiontex); ! ! } ! function str_replace_once($needle, $replace, $haystack) { ! // Looks for the first occurence of $needle in $haystack ! // and replaces it with $replace. ! $pos = strpos($haystack, $needle); ! if ($pos === false) { ! // Nothing found ! return $haystack; } ! return substr_replace($haystack, $replace, $pos, strlen($needle)); ! } ! ?> |
From: <ma...@us...> - 2003-09-24 13:22:27
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv16244/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: Changed focus to aimfocus. Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** mysql.php 23 Sep 2003 17:53:09 -0000 1.9 --- mysql.php 24 Sep 2003 13:22:22 -0000 1.10 *************** *** 17,20 **** --- 17,23 ---- execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment_subject` DROP INDEX `UNIQUE`"); } + if ($oldversion < 2003092414) { + execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment` CHANGE `focus` `aimfocus` tinyint(1) unsigned NOT NULL default '1' AFTER aimquiz"); + } return true; Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mysql.sql 23 Sep 2003 17:53:10 -0000 1.8 --- mysql.sql 24 Sep 2003 13:22:22 -0000 1.9 *************** *** 15,23 **** solutionsisurl tinyint(1) NOT NULL default '1', aimquiz varchar(255) NOT NULL default '', papergrade int(10) unsigned NOT NULL default '0', aimgrade int(10) unsigned NOT NULL default '0', timedue int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', - focus tinyint(3) unsigned NOT NULL default '1', PRIMARY KEY (id) ) TYPE=MyISAM COMMENT='Main information about each math assignment'; --- 15,23 ---- solutionsisurl tinyint(1) NOT NULL default '1', aimquiz varchar(255) NOT NULL default '', + aimfocus tinyint(1) unsigned NOT NULL default '1', papergrade int(10) unsigned NOT NULL default '0', aimgrade int(10) unsigned NOT NULL default '0', timedue int(10) unsigned NOT NULL default '0', timemodified int(10) unsigned NOT NULL default '0', PRIMARY KEY (id) ) TYPE=MyISAM COMMENT='Main information about each math assignment'; |
From: <ma...@us...> - 2003-09-24 13:22:27
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv16244/mod/math_assignment Modified Files: aimpage.php mod.html version.php Log Message: Changed focus to aimfocus. Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** aimpage.php 23 Sep 2003 22:49:40 -0000 1.12 --- aimpage.php 24 Sep 2003 13:22:22 -0000 1.13 *************** *** 113,117 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "FocusLabel", "1"); $postdata = math_assignment_add_arg_to_url_data($postdata, "OldFocusLabel", ""); ! $focus = ($math_assignment->focus) ? "true" : "false"; $postdata = math_assignment_add_arg_to_url_data($postdata, "Focused", $focus); } --- 113,117 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "FocusLabel", "1"); $postdata = math_assignment_add_arg_to_url_data($postdata, "OldFocusLabel", ""); ! $focus = ($math_assignment->aimfocus) ? "true" : "false"; $postdata = math_assignment_add_arg_to_url_data($postdata, "Focused", $focus); } Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** mod.html 24 Sep 2003 11:48:41 -0000 1.19 --- mod.html 24 Sep 2003 13:22:22 -0000 1.20 *************** *** 29,34 **** $form->aimquiz = ""; } ! if (!isset($form->focus)) { ! $form->focus = 1; } if (!isset($form->papergrade)) { --- 29,34 ---- $form->aimquiz = ""; } ! if (!isset($form->aimfocus)) { ! $form->aimfocus = 1; } if (!isset($form->papergrade)) { *************** *** 266,272 **** <td align="right"><p><b><?php echo $straimstyle; ?>:</b></p></td> <td> ! <input type="radio" name="focus" value="1" <?php p($form->focus ? "checked" : "") ?> /> <?php p(get_string("singlequestion","math_assignment")) ?> ! <input type="radio" name="focus" value="0" <?php p($form->focus ? "" : "checked") ?> /> <?php p(get_string("multiplequestion","math_assignment")); --- 266,272 ---- <td align="right"><p><b><?php echo $straimstyle; ?>:</b></p></td> <td> ! <input type="radio" name="aimfocus" value="1" <?php p($form->aimfocus ? "checked" : "") ?> /> <?php p(get_string("singlequestion","math_assignment")) ?> ! <input type="radio" name="aimfocus" value="0" <?php p($form->aimfocus ? "" : "checked") ?> /> <?php p(get_string("multiplequestion","math_assignment")); Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** version.php 23 Sep 2003 17:53:11 -0000 1.7 --- version.php 24 Sep 2003 13:22:22 -0000 1.8 *************** *** 6,10 **** ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092315; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? --- 6,10 ---- ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092414; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? |
From: <ma...@us...> - 2003-09-24 11:56:13
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv30827/mod/math_assignment Modified Files: texedit.php Log Message: Fixed a minor bug ($navigation being appended to before it was set) Index: texedit.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/texedit.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** texedit.php 24 Sep 2003 10:58:25 -0000 1.1 --- texedit.php 24 Sep 2003 11:56:10 -0000 1.2 *************** *** 28,32 **** $strmath_assignments = get_string("modulenameplural", "math_assignment"); $streditfile = get_string("edit", "", "<B>$file</B>"); ! $navigation .= "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> ". "<a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> ". "<a href=\"view.php?q=$id\">$math_assignment->name</a> -> ".$streditfile; --- 28,32 ---- $strmath_assignments = get_string("modulenameplural", "math_assignment"); $streditfile = get_string("edit", "", "<B>$file</B>"); ! $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> ". "<a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> ". "<a href=\"view.php?q=$id\">$math_assignment->name</a> -> ".$streditfile; |
From: <ma...@us...> - 2003-09-24 11:53:46
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv30265/mod/math_assignment Modified Files: pdfgen.php Log Message: Fixed a minor bug (isteacher is a function not a constant!) Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** pdfgen.php 22 Sep 2003 21:03:55 -0000 1.6 --- pdfgen.php 24 Sep 2003 11:53:42 -0000 1.7 *************** *** 26,30 **** require_login($course->id); ! if (!isstudent($course->id) and !isteacher) { error("Sorry, this assignment is not for you!"); } --- 26,30 ---- require_login($course->id); ! if (!isstudent($course->id) and !isteacher($course->id)) { error("Sorry, this assignment is not for you!"); } |
From: <ma...@us...> - 2003-09-24 11:52:51
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv30084/lang/en Modified Files: math_assignment.php Log Message: Updated tex file selection logic. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** math_assignment.php 23 Sep 2003 22:49:40 -0000 1.15 --- math_assignment.php 24 Sep 2003 11:52:46 -0000 1.16 *************** *** 60,63 **** --- 60,64 ---- $string['maxgradepaperonly'] = "(paper-based hand-marked questions only)"; $string['multiplequestion'] = "multiple questions"; + $string['mustbetex'] = "The files must be TeX files if and only if an AiM quiz is set below. See the help for details."; $string['name'] = "Name"; $string['newgrade'] = "Override Grade"; |
From: <ma...@us...> - 2003-09-24 11:48:47
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv29125/mod/math_assignment Modified Files: lib.php mod.html Log Message: Updated tex file selection logic. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** lib.php 23 Sep 2003 22:49:41 -0000 1.18 --- lib.php 24 Sep 2003 11:48:41 -0000 1.19 *************** *** 25,28 **** --- 25,32 ---- } $math_assignment->problems = trim($math_assignment->problems); + if ($math_assignment->problems) { + if (math_assignment_is_tex_file($math_assignment->problems) xor $math_assignment->aimquiz) + return false; // sheet is not of the correct type + } // solutions *************** *** 37,40 **** --- 41,48 ---- } $math_assignment->solutions = trim($math_assignment->solutions); + if ($math_assignment->solutions) { + if (math_assignment_is_tex_file($math_assignment->solutions) xor $math_assignment->aimquiz) + return false; // sheet is not of the correct type + } $math_assignment->timemodified = time(); *************** *** 64,67 **** --- 72,79 ---- } $math_assignment->problems = trim($math_assignment->problems); + if ($math_assignment->problems) { + if (math_assignment_is_tex_file($math_assignment->problems) xor $math_assignment->aimquiz) + return false; // sheet is not of the correct type + } // solutions *************** *** 76,79 **** --- 88,95 ---- } $math_assignment->solutions = trim($math_assignment->solutions); + if ($math_assignment->solutions) { + if (math_assignment_is_tex_file($math_assignment->solutions) xor $math_assignment->aimquiz) + return false; // sheet is not of the correct type + } $math_assignment->timemodified = time(); Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** mod.html 24 Sep 2003 10:58:25 -0000 1.18 --- mod.html 24 Sep 2003 11:48:41 -0000 1.19 *************** *** 227,230 **** --- 227,240 ---- </tr> + <?php + if ($aimsubject) { + ?> + <tr valign="top"> + <td align="center" colspan="2"><p><?php print_string("mustbetex", "math_assignment"); ?></p></td> + </tr> + <?php + } + ?> + <tr valign="top"> <td align="right"><p><b><?php echo $strmaxgrade; ?>:</b></p></td> *************** *** 232,236 **** <input type="text" name="papergrade" size="10" maxlength="10" value="<?php p($form->papergrade); ?>" /> <?php // print the following clarification only if there can be an AiM component ! if ($aimsubject > 0) print_string("maxgradepaperonly", "math_assignment"); helpbutton("addupdate_maxgrade", $strmaxgrade, "math_assignment"); --- 242,246 ---- <input type="text" name="papergrade" size="10" maxlength="10" value="<?php p($form->papergrade); ?>" /> <?php // print the following clarification only if there can be an AiM component ! if ($aimsubject) print_string("maxgradepaperonly", "math_assignment"); helpbutton("addupdate_maxgrade", $strmaxgrade, "math_assignment"); |
From: <gus...@us...> - 2003-09-24 10:59:26
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv21380/mod/math_assignment Modified Files: mod.html Added Files: texedit.php Log Message: Added an "Edit" link to mod.html which opens a new window in which the lecturer can edit the tex source of problem or solution sheets. --- NEW FILE: texedit.php --- <?PHP // require_once("../../config.php"); require_variable($file); require_variable($id); // math_assignment id optional_variable($action, ""); if (! $math_assignment = get_record("math_assignment", "id", $id)) { error("Course is misconfigured"); } if (! $course = get_record("course", "id", $math_assignment->course)) { error("Course is misconfigured"); } require_login($course->id); if (! isteacher($course->id) ) { error("Only teachers can edit files"); } $basedir = "$CFG->dataroot/$course->id/"; $strmath_assignments = get_string("modulenameplural", "math_assignment"); $streditfile = get_string("edit", "", "<B>$file</B>"); $navigation .= "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> -> ". "<a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> ". "<a href=\"view.php?q=$id\">$math_assignment->name</a> -> ".$streditfile; print_header("$course->shortname: $strmath_assignments", "$course->fullname", "$navigation"); if ($action == "edit") { $fileptr = fopen($basedir.$file,"w"); fputs($fileptr, stripslashes($text)); fclose($fileptr); } $fileptr = fopen($basedir.$file, "r"); $contents = fread($fileptr, filesize($basedir.$file)); fclose($fileptr); print_heading("$streditfile"); echo "<TABLE align=\"center\"><TR><TD COLSPAN=2>"; echo "<FORM ACTION=\"texedit.php\" METHOD=\"post\" NAME=\"form\">"; echo " <INPUT TYPE=hidden NAME=id VALUE=$id>"; echo " <INPUT TYPE=hidden NAME=\"file\" VALUE=\"$file\">"; echo " <INPUT TYPE=hidden NAME=\"action\" VALUE=\"edit\">"; print_textarea(false, 25, 80, 680, 400, "text", $contents); echo "</TD></TR><TR><TD align=\"center\">"; echo " <INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\">"; echo "</FORM>"; echo "</TD><TD>"; echo "<FORM ACTION=texedit.php METHOD=get>"; echo " <INPUT TYPE=hidden NAME=id VALUE=$id>"; echo " <INPUT TYPE=hidden NAME=file VALUE=\"$file\">"; echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>"; echo " <INPUT TYPE=submit VALUE=\"".get_string("cancel")."\">"; echo "</FORM>"; echo "</TD></TR></TABLE>"; print_footer($course) ?> Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** mod.html 22 Sep 2003 10:04:33 -0000 1.17 --- mod.html 24 Sep 2003 10:58:25 -0000 1.18 *************** *** 150,155 **** --- 150,159 ---- <?php choose_from_menu ($options, "problems", $form->problems, $strnone, "sheet_change('problems', 'list');", ""); ?> + <?php if (math_assignment_is_tex_file("$rootdir/$form->problems")) { + echo " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$form->id&file=$form->problems\" target=\"_blank\">" . get_string("edit") . "</a>"; + } ?> </td> <td rowspan="4"><?php helpbutton("addupdate_problems", $strproblems, "math_assignment"); ?> + </td> </tr> <tr> *************** *** 195,200 **** --- 199,208 ---- <?php choose_from_menu ($options, "solutions", $form->solutions, $strnone, "sheet_change('solutions', 'list');", ""); ?> + <?php if (math_assignment_is_tex_file("$rootdir/$form->solutions")) { + echo " <a href=\"$CFG->wwwroot/mod/math_assignment/texedit.php?id=$form->id&file=$form->solutions\" target=\"texedit\">" . get_string("edit") . "</a>"; + } ?> </td> <td rowspan="4"><?php helpbutton("addupdate_solutions", $strsolutions, "math_assignment"); ?> + </td> </tr> <tr> |
From: <mo...@us...> - 2003-09-24 00:16:16
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv14178 Modified Files: TextQuestion.mpl Log Message: changed it so AiM checks the Value of the teacher's answer against the Maple type, not the teacher's answer itself Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** TextQuestion.mpl 23 Sep 2003 21:35:32 -0000 1.6 --- TextQuestion.mpl 24 Sep 2003 00:16:08 -0000 1.7 *************** *** 168,172 **** msg := __("Teacher's answer is empty."); elif nops([rightans]) > 1 or ! not(type(rightans,mapletype)) then msg := __("Teacher's answer has the wrong type."); fi; --- 168,175 ---- msg := __("Teacher's answer is empty."); elif nops([rightans]) > 1 or ! # KM ! # WAS: not(type(rightans,mapletype)) then ! not(type(Value(rightans),mapletype)) then ! # END KM msg := __("Teacher's answer has the wrong type."); fi; *************** *** 317,321 **** # don't type them anyway # WAS: `aim/LaTeX`(rightans), ! `if`(type(rightans),string), cat("\\mbox{",TeX(rightans),"}"), `aim/LaTeX`(rightans)), --- 320,324 ---- # don't type them anyway # WAS: `aim/LaTeX`(rightans), ! `if`(type(rightans,string), cat("\\mbox{",TeX(rightans),"}"), `aim/LaTeX`(rightans)), |
From: <ma...@us...> - 2003-09-23 22:49:45
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv487/mod/math_assignment Modified Files: aimpage.php lib.php view.php Log Message: Added zone admin links and added math output selection to view.php. Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** aimpage.php 22 Sep 2003 21:03:54 -0000 1.11 --- aimpage.php 23 Sep 2003 22:49:40 -0000 1.12 *************** *** 70,85 **** --- 70,97 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","try/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "TryQuiz"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); } else if (strcasecmp($aimaction, "edit") == 0) { // load the edit quiz page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadQuizOptions"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); } else if (strcasecmp($aimaction, "source") == 0) { // load the edit source page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/SourceDir"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "BrowseSource"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); } else if (strcasecmp($aimaction, "subject") == 0) { // load the edit subject page $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Subject"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "LoadSubjectOptions"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); + } + else if (strcasecmp($aimaction, "zoneadmin") == 0) { // load the zone admin page + $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","admin/Zone"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $server->password); } else { *************** *** 87,94 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","analyze/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "AnalyzeQuiz"); } $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); - $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); - $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); } else { --- 99,106 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","analyze/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "AnalyzeQuiz"); + $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); + $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); } $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); } else { *************** *** 191,199 **** // put output problems box and admin links side by side ! echo "<table width=\"100%\"><tr><td align=\"left\">"; // print output problems box if (function_exists('editer')) { ! print_simple_box_start(); echo "<form name=\"output_change\" action=\"aimpage.php?id=$cm->id\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"outputchange\" value=\"" . ($usexml ? "html" : "xml") . "\" />\n"; --- 203,211 ---- // put output problems box and admin links side by side ! echo "<table width=\"100%\"><tr><td align=\"left\" width=\"35%\"></td><td align=\"center\" width=\"30%\">"; // print output problems box if (function_exists('editer')) { ! print_simple_box_start("center"); echo "<form name=\"output_change\" action=\"aimpage.php?id=$cm->id\" method=\"post\">\n"; echo "<input type=\"hidden\" name=\"outputchange\" value=\"" . ($usexml ? "html" : "xml") . "\" />\n"; *************** *** 210,221 **** print_string($usexml ? "html" : "mathml", "math_assignment"); echo "</a>\n"; echo "</form>"; print_simple_box_end(); } ! echo "</td><td align=\"right\">"; // write admin links if (isteacher($course->id)) ! echo math_assignment_get_admin_links($cm, $math_assignment, "right"); echo "</td></tr></table>"; --- 222,234 ---- print_string($usexml ? "html" : "mathml", "math_assignment"); echo "</a>\n"; + math_assignment_help_button("mathdisplay", get_string("mathdisplay", "math_assignment")); echo "</form>"; print_simple_box_end(); } ! echo "</td><td align=\"right\" width=\"35%\">"; // write admin links if (isteacher($course->id)) ! echo math_assignment_get_admin_links($cm, $math_assignment, $server->password, "right"); echo "</td></tr></table>"; *************** *** 251,255 **** --- 264,277 ---- // display teacher grade override comment (if any) + echo "<br clear=\"all\" /> <br />\n"; math_assignment_print_grade_override($math_assignment, $USER->id); + echo "<br clear=\"all\" />\n"; + + if (isteacher($course->id)) { + if ($adminlinks = math_assignment_get_admin_links($cm, $math_assignment, $server->password, "center")) { + print_heading(get_string("administration")); + echo $adminlinks; + } + } if (isset($debug)) { Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** lib.php 23 Sep 2003 17:53:10 -0000 1.17 --- lib.php 23 Sep 2003 22:49:41 -0000 1.18 *************** *** 280,284 **** } ! function math_assignment_get_admin_links($cm, $math_assignment, $align="left") { /// Function which prints the admin links --- 280,284 ---- } ! function math_assignment_get_admin_links($cm, $math_assignment, $zonelink=false, $align="left") { /// Function which prints the admin links *************** *** 305,316 **** $return .= "<br />\n"; // Browse Source ! //$strbrowsesource = get_string("browsesource", "math_assignment"); ! //$return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=source\">$strbrowsesource</a>"; ! //$return .= math_assignment_help_button("admin_sourcedir", $strbrowsesource, false); ! //$return .= "<br />\n"; // Edit Subject $streditsubject = get_string("editsubject", "math_assignment"); $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=subject\">$streditsubject</a>"; $return .= math_assignment_help_button("admin_subject", $streditsubject, false); } else if ($filelinks) --- 305,323 ---- $return .= "<br />\n"; // Browse Source ! /*$strbrowsesource = get_string("browsesource", "math_assignment"); ! $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=source\">$strbrowsesource</a>"; ! $return .= math_assignment_help_button("admin_sourcedir", $strbrowsesource, false); ! $return .= "<br />\n";*/ // Edit Subject $streditsubject = get_string("editsubject", "math_assignment"); $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=subject\">$streditsubject</a>"; $return .= math_assignment_help_button("admin_subject", $streditsubject, false); + if ($zonelink) { + $return .= "<br />\n"; + // Zone Admin + $strzoneadmin = get_string("zoneadmin", "math_assignment"); + $return .= "<a href=\"aimpage.php?id=$cm->id&aimaction=zoneadmin\">$strzoneadmin</a>"; + $return .= math_assignment_help_button("admin_zoneadmin", $strzoneadmin, false); + } } else if ($filelinks) *************** *** 714,729 **** if ($entry = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { if ($entry->aimoverride) { ! echo "<p><b>"; print_string("grade"); echo ":</b> $entry->aimgrade "; print_string("gradeoverride", "math_assignment"); ! echo "</p>"; } if ($entry->aimcomment) { if (!$course = get_record("course", "id", $math_assignment->course)) $course->teacher = get_string("teacher"); ! echo "<p><b>$course->teacher "; print_string("comment", "math_assignment"); ! echo ":</b> " . nl2br(htmlspecialchars($entry->aimcomment)) . "</p>"; } } --- 721,739 ---- if ($entry = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $userid)) { if ($entry->aimoverride) { ! print_simple_box_start("left"); ! echo "<b>"; print_string("grade"); echo ":</b> $entry->aimgrade "; print_string("gradeoverride", "math_assignment"); ! print_simple_box_end(); } if ($entry->aimcomment) { + print_simple_box_start("left"); if (!$course = get_record("course", "id", $math_assignment->course)) $course->teacher = get_string("teacher"); ! echo "<b>$course->teacher "; print_string("comment", "math_assignment"); ! echo ":</b> " . nl2br(htmlspecialchars($entry->aimcomment)); ! print_simple_box_end(); } } Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** view.php 22 Sep 2003 21:09:48 -0000 1.13 --- view.php 23 Sep 2003 22:49:41 -0000 1.14 *************** *** 46,50 **** add_to_log($course->id, "math_assignment", "view", "view.php?id=$cm->id", "$math_assignment->id"); ! $hasaim = ($math_assignment->aimgrade > 0); $haspaper = ($math_assignment->papergrade > 0); --- 46,58 ---- add_to_log($course->id, "math_assignment", "view", "view.php?id=$cm->id", "$math_assignment->id"); ! ! if (isset ($outputchange)) { ! if (strcmp($outputchange, "html") == 0 || strcmp($outputchange, "xml") == 0) { ! // set the cookie ! setcookie("output", $outputchange, 0x7FFFFFFF); ! $_COOKIE['output'] = $outputchange; ! } ! } ! $hasaim = ($math_assignment->aimgrade > 0); $haspaper = ($math_assignment->papergrade > 0); *************** *** 350,354 **** if (isteacher($course->id)) { ! echo math_assignment_get_admin_links($cm, $math_assignment, "right"); print_heading($strgrades); --- 358,367 ---- if (isteacher($course->id)) { ! $zonelink = false; ! if ($subject = get_record("math_assignment_subject", "course", $course->id)) { ! if ($server = get_record("math_assignment_server", "id", $subject->server)) ! $zonelink = $server->password; ! } ! echo math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "right"); print_heading($strgrades); *************** *** 409,414 **** } ! if ($haspaper) ! echo "<form action=\"updatepapergrades.php?id=$math_assignment->id\" method=\"post\" name=\"papergradeform\">"; print_table($table); --- 422,430 ---- } ! if ($haspaper) { ! echo "<form action=\"updatepapergrades.php?id=$math_assignment->id\" method=\"post\" name=\"papergradeform\">\n"; ! echo "<input type=\"hidden\" name=\"sort\" value=\"sort\" />\n"; ! echo "<input type=\"hidden\" name=\"sortdir\" value=\"sortdir\" />\n"; ! } print_table($table); *************** *** 440,444 **** echo "</td></tr></table>"; ! if ($adminlinks = math_assignment_get_admin_links($cm, $math_assignment, "center")) { print_heading(get_string("administration")); echo $adminlinks; --- 456,460 ---- echo "</td></tr></table>"; ! if ($adminlinks = math_assignment_get_admin_links($cm, $math_assignment, $zonelink, "center")) { print_heading(get_string("administration")); echo $adminlinks; *************** *** 447,451 **** else { echo math_assignment_get_file_links($math_assignment, "center"); ! if (!empty($math_assignment->aimquiz)) { if ($grade->aimoverride) { echo "<p align=\"center\">"; --- 463,467 ---- else { echo math_assignment_get_file_links($math_assignment, "center"); ! if ($hasaim) { if ($grade->aimoverride) { echo "<p align=\"center\">"; *************** *** 455,458 **** --- 471,499 ---- echo "<p align=\"center\"><a href=\"aimpage.php?id=$cm->id\">" . get_string("viewquiz", "math_assignment") . "</a></p>"; } + } + if ($hasaim && function_exists('editer')) { + // get output option from cookie + if (array_key_exists("output", $_COOKIE)) + $usexml = (strcasecmp($_COOKIE['output'], "xml") == 0); + else + $usexml = $CFG->math_assignment_default_latex_output ? true : false; + // print output selection + print_simple_box_start("center"); + echo "<form name=\"output_change\" action=\"view.php?id=$cm->id\" method=\"post\">\n"; + echo "<input type=\"hidden\" name=\"sort\" value=\"sort\" />\n"; + echo "<input type=\"hidden\" name=\"sortdir\" value=\"sortdir\" />\n"; + echo "<input type=\"hidden\" name=\"outputchange\" value=\"" . ($usexml ? "html" : "xml") . "\" />\n"; + print_string("outputfuture", "math_assignment"); + echo " "; + print_string($usexml ? "mathml" : "html", "math_assignment"); + echo "<br />\n"; + echo "<a href=\"javascript:document.output_change.submit();\">"; + print_string("outputchange", "math_assignment"); + echo " "; + print_string($usexml ? "html" : "mathml", "math_assignment"); + echo "</a>\n"; + math_assignment_help_button("mathdisplay", get_string("mathdisplay", "math_assignment"), true); + echo "</form>"; + print_simple_box_end(); } |
From: <ma...@us...> - 2003-09-23 22:49:44
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv487/lang/en Modified Files: math_assignment.php Log Message: Added zone admin links and added math output selection to view.php. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** math_assignment.php 23 Sep 2003 17:53:09 -0000 1.14 --- math_assignment.php 23 Sep 2003 22:49:40 -0000 1.15 *************** *** 34,39 **** $string['edit'] = "Edit"; $string['editgrade'] = "Edit AiM Grade"; ! $string['editquiz'] = "AiM Quiz Administration"; //"Edit Quiz"; ! $string['editsubject'] = "AiM Subject Administration"; //"Edit Subject"; $string['externalurl'] = "link to URL"; $string['failed'] = "Error : Could not save the changes made."; --- 34,39 ---- $string['edit'] = "Edit"; $string['editgrade'] = "Edit AiM Grade"; ! $string['editquiz'] = "AiM Quiz Administration"; ! $string['editsubject'] = "AiM Subject Administration"; $string['externalurl'] = "link to URL"; $string['failed'] = "Error : Could not save the changes made."; *************** *** 50,57 **** --- 50,59 ---- $string['outputchange'] = "Click here to change to"; $string['outputcurrent'] = "Moodle is currently using"; + $string['outputfuture'] = "Mathematics will be displayed using"; $string['outputprobs'] = "Mathematics not displaying correctly?"; $string['paper'] = "Paper"; $string['problems'] = "Problem sheet"; $string['marksheet'] = "Mark sheet"; + $string['mathdisplay'] = "Displaying Mathematics"; $string['mathml'] = "MathML"; $string['maxgrade'] = "Maximum Grade"; *************** *** 84,87 **** --- 86,90 ---- $string['viewquiz'] = "View AiM Assignment"; $string['viewsolutions'] = "View Solutions"; + $string['zoneadmin'] = "AiM Zone Administration"; $string['zonepassword'] = "Zone Admin Password"; |
From: <mo...@us...> - 2003-09-23 21:35:48
|
Update of /cvsroot/aimmath/AIM/WEB-INF/maple/aim In directory sc8-pr-cvs1:/tmp/cvs-serv18338 Modified Files: Inert.mpl TextQuestion.mpl Log Message: bug fix (missing eval) and removed double quotes from teacher's answer display when it is a string Index: Inert.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/Inert.mpl,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Inert.mpl 19 Sep 2003 04:11:15 -0000 1.6 --- Inert.mpl 23 Sep 2003 21:35:32 -0000 1.7 *************** *** 493,497 **** `Package/Assign`( `Inert/Decimal`::Inert, ! "This inert represents the identity map for reals. It formats a real constant as a floating point number to certain specifications. The first argument is the number to be formatted. The optional second argument is a formatting string suitable to be used as a first argument for @sprintf@. The default format is \"% 06.3f\"", `new/Inert`( proc(x) x end, # Map (we ignore the formatting string) # TeX --- 493,498 ---- `Package/Assign`( `Inert/Decimal`::Inert, ! "This inert represents the identity map for reals. It formats a real constant as a floating point number to certain specifications. The first argument is the number to be formatted. The optional second argument is a formatting string suitable to be used as a first argument for @sprintf@. If no format string is specified, @Decimal(r)@ will format the float @r@ in a ! \"reasonable\" manner.", `new/Inert`( proc(x) x end, # Map (we ignore the formatting string) # TeX Index: TextQuestion.mpl =================================================================== RCS file: /cvsroot/aimmath/AIM/WEB-INF/maple/aim/TextQuestion.mpl,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** TextQuestion.mpl 20 Sep 2003 16:30:44 -0000 1.5 --- TextQuestion.mpl 23 Sep 2003 21:35:32 -0000 1.6 *************** *** 113,118 **** attempt := eval(`aim/Question/MakeAttempt`(x)); attempt['Clear']; ! ! floatok := hastype({this['RightAnswer']},float); listok := hastype({this['RightAnswer']},{list,table,indexed}); --- 113,120 ---- attempt := eval(`aim/Question/MakeAttempt`(x)); attempt['Clear']; ! # KM ! # WAS: floatok := hastype({this['RightAnswer']},float); ! floatok := hastype({eval(this['RightAnswer'])},float); ! # END KM listok := hastype({this['RightAnswer']},{list,table,indexed}); *************** *** 311,315 **** __("The teacher's answer was: "), "\n<latex>\\[", ! `aim/LaTeX`(rightans), "\\]</latex>\n<br/>\n"); --- 313,324 ---- __("The teacher's answer was: "), "\n<latex>\\[", ! # KM We don't need to surround the teacher's answer ! # with quotes in this situation because the students ! # don't type them anyway ! # WAS: `aim/LaTeX`(rightans), ! `if`(type(rightans),string), ! cat("\\mbox{",TeX(rightans),"}"), ! `aim/LaTeX`(rightans)), ! # END KM "\\]</latex>\n<br/>\n"); |
From: <ma...@us...> - 2003-09-23 17:54:44
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv2167/mod/math_assignment Modified Files: config.html Log Message: Added code to delete entries from the subject table left over after a course is deleted Index: config.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/config.html,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** config.html 19 Sep 2003 11:58:27 -0000 1.4 --- config.html 23 Sep 2003 17:54:40 -0000 1.5 *************** *** 71,78 **** // get aim server ! unset($options); if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { foreach ($servers as $server) { ! $option[$server->id] = $server->name; } } --- 71,78 ---- // get aim server ! $options = array(); if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { foreach ($servers as $server) { ! $options[$server->id] = $server->name; } } *************** *** 90,94 **** echo "<td align=\"right\"><p><b>$straimserver : </b></p></td>\n"; echo "<td align=\"left\">"; ! choose_from_menu ($option, "server$course->id", $subject->server, "choose", "", 0); echo "</td>\n"; echo "<td align=\"left\">"; --- 90,94 ---- echo "<td align=\"right\"><p><b>$straimserver : </b></p></td>\n"; echo "<td align=\"left\">"; ! choose_from_menu ($options, "server$course->id", $subject->server, "choose", "", 0); echo "</td>\n"; echo "<td align=\"left\">"; *************** *** 112,115 **** --- 112,125 ---- } } + + // remove any entries in the subjects table which correspond to non-existent courses + unset($courseids); + foreach ($courses as $course) { + if (isset($courseids)) + $courseids .= ", $course->id"; + else + $courseids = "$course->id"; + } + $db->Execute("DELETE FROM `{$CFG->prefix}math_assignment_subject` WHERE `course` NOT IN ($courseids)"); ?> |
From: <ma...@us...> - 2003-09-23 17:54:10
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv1777/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: Changed server admin around to provide more features and make it clearer. Also implemented the storing of the Zone Admin password. Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** mysql.php 22 Sep 2003 21:03:55 -0000 1.8 --- mysql.php 23 Sep 2003 17:53:09 -0000 1.9 *************** *** 13,16 **** --- 13,20 ---- execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment_server` DROP `student_passwd`"); } + if ($oldversion < 2003092315) { + execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment_server` ADD `password` VARCHAR(255) NOT NULL default ''"); + execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment_subject` DROP INDEX `UNIQUE`"); + } return true; Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mysql.sql 22 Sep 2003 21:03:55 -0000 1.7 --- mysql.sql 23 Sep 2003 17:53:10 -0000 1.8 *************** *** 29,34 **** `server` int(10) unsigned NOT NULL default '0', `password` varchar(255) NOT NULL default '', ! PRIMARY KEY (`course`), ! UNIQUE `UNIQUE` (`name`, `server`) ) TYPE=MyISAM COMMENT='AiM subject used by each course'; --- 29,33 ---- `server` int(10) unsigned NOT NULL default '0', `password` varchar(255) NOT NULL default '', ! PRIMARY KEY (`course`) ) TYPE=MyISAM COMMENT='AiM subject used by each course'; *************** *** 37,40 **** --- 36,40 ---- `name` varchar(255) NOT NULL default '', `address` varchar(255) NOT NULL default '', + `password` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE `NAME` (`name`) |
From: <ma...@us...> - 2003-09-23 17:54:10
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv1777/lang/en Modified Files: math_assignment.php Log Message: Changed server admin around to provide more features and make it clearer. Also implemented the storing of the Zone Admin password. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** math_assignment.php 22 Sep 2003 21:03:54 -0000 1.13 --- math_assignment.php 23 Sep 2003 17:53:09 -0000 1.14 *************** *** 7,10 **** --- 7,11 ---- $string['actions'] = "Actions"; + $string['addnewserver'] = "Add New Server"; $string['address'] = "Address"; $string['adminlinks'] = "Admin Links"; *************** *** 15,19 **** $string['aimserver'] = "AiM Server"; $string['aimserverconfig'] = "AiM Server Configuration"; - $string['aimserverplural'] = "AiM Servers"; $string['aimstyle'] = "AiM Page Style"; $string['aimsubject'] = "AiM Subject"; --- 16,19 ---- *************** *** 27,31 **** --- 27,33 ---- $string['commented'] = "Commented"; $string['coursesettings'] = "Course Settings"; + $string['deleteall'] = "None (set courses to use no AiM subject)"; $string['deletequery'] = "Are you sure you want to delete this server?"; + $string['dependantcourses'] = "Dependant Courses"; $string['displayingrows'] = "Displaying rows \$a->start to \$a->end from \$a->total"; $string['edited'] = "Edited"; *************** *** 68,71 **** --- 70,74 ---- $string['notteacher'] = "You must be a teacher to use this page."; $string['refresh'] = "Refresh"; + $string['replacementserver'] = "Replacement Server"; $string['reset'] = "Reset"; $string['reviewresults'] = "Review Results"; *************** *** 81,84 **** --- 84,88 ---- $string['viewquiz'] = "View AiM Assignment"; $string['viewsolutions'] = "View Solutions"; + $string['zonepassword'] = "Zone Admin Password"; ?> |
From: <ma...@us...> - 2003-09-23 17:53:56
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv1777/mod/math_assignment Modified Files: deleteserver.php lib.php saveconfig.php servers.php version.php Log Message: Changed server admin around to provide more features and make it clearer. Also implemented the storing of the Zone Admin password. Index: deleteserver.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/deleteserver.php,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** deleteserver.php 9 Sep 2003 18:31:07 -0000 1.1 --- deleteserver.php 23 Sep 2003 17:53:10 -0000 1.2 *************** *** 7,10 **** --- 7,11 ---- require_variable($id); // server id to delete + optional_variable($newserver, 0); // server to replace the deleted one if (! $site = get_site()) { *************** *** 17,27 **** if ($id) { // delete the server ! // delete the record ! if (!delete_records("math_assignment_server", "id", $id)) { ! error(get_string("failed", "math_assignment"), "servers.php"); } ! ! // delete subjects for this server ! if (!delete_records("math_assignment_subject", "server", $id)) { error(get_string("failed", "math_assignment"), "servers.php"); } --- 18,33 ---- if ($id) { // delete the server ! if ($newserver && $newserver != $id) { ! // change subjects using this server to use new server ! if (!$db->Execute("UPDATE `{$CFG->prefix}math_assignment_subject` SET `server` = $newserver WHERE `server` = $id")) ! error(get_string("failed", "math_assignment"), "servers.php"); } ! else { ! // delete subjects for this server ! if (!delete_records("math_assignment_subject", "server", $id)) ! error(get_string("failed", "math_assignment"), "servers.php"); ! } ! // delete the server ! if (!delete_records("math_assignment_server", "id", $id)) { error(get_string("failed", "math_assignment"), "servers.php"); } *************** *** 29,33 **** // take the user back to the server config page ! redirect("servers.php"); ?> --- 35,39 ---- // take the user back to the server config page ! redirect("servers.php", get_string("changessaved"), 1); ?> Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** lib.php 22 Sep 2003 21:03:55 -0000 1.16 --- lib.php 23 Sep 2003 17:53:10 -0000 1.17 *************** *** 184,208 **** } - function math_assignment_list_servers($selected) { - /// Function which outputs <option> tags for each server in the database - - if(! $aim_servers = get_records("math_assignment_server","","","name ASC")) { - return ($selected == 0); // no servers configured - } - - // write out an <option> tag for each server - foreach ($aim_servers as $aim_server) { - if( $aim_server->id == $selected ) { - echo "<option selected=\"true\">"; - } - else{ - echo "<option>"; - } - echo htmlspecialchars("$aim_server->name ($aim_server->address)") . "</option>\n"; - } - - return true; - } - function math_assignment_help_button($page, $name, $print=true) { /// Function which outputs / returns the output required for a help button for this module --- 184,187 ---- Index: saveconfig.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/saveconfig.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** saveconfig.php 19 Sep 2003 13:41:37 -0000 1.2 --- saveconfig.php 23 Sep 2003 17:53:10 -0000 1.3 *************** *** 43,47 **** if ($subject->server) { $subject->course = $course; ! if (!insert_record("math_assignment_subject", $subject)) $result = false; } --- 43,47 ---- if ($subject->server) { $subject->course = $course; ! if (!insert_record("math_assignment_subject", $subject, false)) $result = false; } Index: servers.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/servers.php,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** servers.php 22 Sep 2003 21:03:55 -0000 1.3 --- servers.php 23 Sep 2003 17:53:11 -0000 1.4 *************** *** 3,14 **** /// This page lets the administrator change the settings for the AiM servers require_once("../../config.php"); require_once("lib.php"); - optional_variable($server); // server to edit - optional_variable($name); // server name - optional_variable($address); // server address - optional_variable($delete); // delete button - if (! $site = get_site()) { redirect("$CFG->wwwroot/$CFG->admin/index.php"); --- 3,16 ---- /// This page lets the administrator change the settings for the AiM servers + /* optional variables: + id Server id used when editing a record + name Server name used when adding or editing a record + address Server address used when adding or editing a record + password Zone admin password for the server used when adding or editing a record + */ + require_once("../../config.php"); require_once("lib.php"); if (! $site = get_site()) { redirect("$CFG->wwwroot/$CFG->admin/index.php"); *************** *** 21,80 **** $straimserverconfig = get_string("aimserverconfig", "math_assignment"); ! if ($server) { // edit server record ! if (strcmp($delete, "Delete") == 0) { ! if ($server != get_string("newitem", "math_assignment")) { // silently ignore trying to delete the 'new' item ! // get server id ! $server = substr($server, 0, strpos($server, "(") - 1); ! if (!$server = get_record("math_assignment_server", "name", $server)) { ! error(get_string("failed","math_assignment"), "servers.php"); ! } ! // check that there are no assignments dependent on the server ! $math_assignments = array(); ! $subjects = get_records("math_assignment_subject", "server", $server->id); ! foreach ($subjects as $subject) { ! if (record_exists("math_assignment", "subject", $subject->id)) { ! error(get_string("serverinuse","math_assignment"), "servers.php"); } } ! ! // does the user really want to delete? ! print_header("$site->shortname: $straimserverconfig", "$site->fullname"); ! notice_yesno(get_string("deletequery", "math_assignment") . "<br />$server->name ($server->address)", "deleteserver.php?id=$server->id", "servers.php"); print_footer(); exit; } } ! else { ! ! if (!$name || !$address) { error(get_string("invalid", "math_assignment"), "servers.php"); ! } ! if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) { error(get_string("invalid", "math_assignment"), "servers.php"); ! } ! ! // get server id ! if ($server == get_string("newitem", "math_assignment")) { ! $newserver->id = 0; ! $newserver->name = $name; ! $newserver->address = $address; ! if (!insert_record("math_assignment_server", $newserver)) { ! error(get_string("failed", "math_assignment"), "servers.php"); ! } ! } ! else { ! $server = substr($server, 0, strpos($server, "(") - 1); ! if (!$server = get_record("math_assignment_server", "name", $server)) { ! error(get_string("failed","math_assignment"), "servers.php"); ! } ! $server->name = $name; ! $server->address = $address; ! if (!update_record("math_assignment_server", $server)) { ! error(get_string("failed","math_assignment"), "servers.php"); ! } ! } } } --- 23,96 ---- $straimserverconfig = get_string("aimserverconfig", "math_assignment"); ! if (isset($name) || isset($address) || isset($password)) { // add or edit a record ! optional_variable($name, ""); ! optional_variable($address, ""); ! optional_variable($password, ""); ! $server->name = $name; ! $server->address = $address; ! $server->password = $password; ! if (isset($id)) { // edit record ! $server->id = $id; ! if (!$name && !$address && !$password) { // delete server ! print_header(); ! print_heading(get_string("deletequery", "math_assignment")); ! echo "<form name=\"form\" action=\"deleteserver.php\" method=\"post\">\n"; ! echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"; ! if ($server = get_record("math_assignment_server", "id", $id)) ! echo "<p align=\"center\">$server->name ($server->address)</p>"; ! if ($depends = get_server_depends($server, false)) { ! // print list of courses using the server ! print_heading(get_string("dependantcourses", "math_assignment")); ! $table->head = array(get_string("course"), get_string("aimsubject", "math_assignment"), get_string("modulenameplural", "math_assignment")); ! $table->width = array("*", "*", "*"); ! $table->align = array("LEFT", "LEFT", "CENTER"); ! foreach ($depends as $depend) { ! $table->data[] = array("$depend->shortname ($depend->fullname)", $depend->name, count_records("math_assignment", "course", $depend->course)); ! } ! print_table($table); ! // allow the user to select which server to set as replacement ! echo "<p align=\"center\"><b>" . get_string("replacementserver", "math_assignment") . " :</b> "; ! $options = array(); ! if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { ! foreach ($servers as $server) { ! if ($server->id != $id) ! $options[$server->id] = $server->name; ! } } + choose_from_menu ($options, "newserver", 0, get_string("deleteall", "math_assignment"), "", 0); + echo "</p>\n"; } ! echo "<table border=\"0\" align=\"center\" cellspacing=\"0\" cellpadding=\"5\">\n"; ! echo "<tr>\n"; ! echo "<td align=\"right\"><input type=\"submit\" value=\"" . get_string("delete") . "\" />"; ! echo "</td></form>\n"; ! echo "<td align=\"left\"><form name=\"cancel\" action=\"servers.php\" action=\"post\">\n"; ! echo "<input type=\"submit\" value=\"" . get_string("cancel") . "\" />\n"; ! echo "</form></td>\n"; ! echo "</tr>\n"; ! echo "</table>\n"; print_footer(); exit; } + else { + if (!$name || !$address) + error(get_string("invalid", "math_assignment"), "servers.php"); + if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) + error(get_string("invalid", "math_assignment"), "servers.php"); + if (!update_record("math_assignment_server", $server)) + error(get_string("failed", "math_assignment"), "servers.php"); + } } ! else { // add new record ! if (!$name || !$address) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) error(get_string("invalid", "math_assignment"), "servers.php"); ! if (!insert_record("math_assignment_server", $server)) ! error(get_string("failed", "math_assignment"), "servers.php"); } + redirect("servers.php", get_string("changessaved"), 1); } *************** *** 87,91 **** print_header("$site->shortname: $straimserverconfig", "$site->fullname", ! "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/modules.php\">$strmanagemodules</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/module.php?module=math_assignment\">$strmathassignment</a> -> $straimserverconfig"); /// Print the main part of the page --- 103,107 ---- print_header("$site->shortname: $straimserverconfig", "$site->fullname", ! "<a href=\"$CFG->wwwroot/$CFG->admin/index.php\">$stradministration</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/configure.php\">$strconfiguration</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/modules.php\">$strmanagemodules</a> -> <a href=\"$CFG->wwwroot/$CFG->admin/module.php?module=math_assignment\">$strmathassignment</a> -> $straimserverconfig", "", "", false); // disable caching of this page as it includes passwords /// Print the main part of the page *************** *** 93,175 **** $strname = get_string("name", "math_assignment"); $straddress = get_string("address", "math_assignment"); ?> ! <script language="JavaScript"><!-- //hide ! // function to update edit controls when the selection changes ! function serverChanged() { ! frm = document.mainform; ! server = frm.server.options[frm.server.selectedIndex].text; ! if (server == "<?php print_string("newitem", "math_assignment") ?>") { ! frm.name.value = ""; ! frm.address.value = ""; ! } ! else { ! frm.name.value = server.slice(0, server.indexOf("(") - 1); ! frm.address.value = server.slice(server.indexOf("(") + 1, server.indexOf(")")); } ! } ! //end hiding --></script> ! <form name="mainform" method="post" action="<?php echo $ME ?>"> ! <center> ! <?php print_heading_with_help($straimserverconfig, "server", "math_assignment"); ?> ! <table cellpadding="5"> ! <!-- list of servers --> <tr valign="top"> ! <td align="right"><p><b><?php echo print_string("aimserverplural", "math_assignment"); ?>:</b></p></td> <td> ! <p><select name="server" size="8" onChange="serverChanged()"> ! <?php math_assignment_list_servers(0); ?> ! <option selected="true"><?php print_string("newitem", "math_assignment"); ?></option> ! </select> ! <a href="servers.php"><?php print_string("refresh", "math_assignment"); ?></a></p> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php echo $strname; ?>:</b></p></td> <td> ! <input type="text" name="name" size="40" maxlength="255" /> <?php helpbutton ("server_name", $strname, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php echo $straddress; ?>:</b></p></td> <td> ! <input type="text" name="address" size="40" maxlength="255" /> <?php helpbutton ("server_address", $straddress, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php print_string("actions","math_assignment"); ?>:</b></p></td> <td> ! <table cellpadding="1"> ! <tr valign="top"> ! <td align="left"> ! <input type="submit" name="save" value="<?php print_string("savechanges"); ?>" /> ! </td> ! <td align="left"> ! <input type="submit" name="delete" value="<?php print_string("delete"); ?>" /> ! </form> ! </td> ! </tr> ! </table> </td> </tr> </table> - </center> <?php print_footer(); ?> --- 109,200 ---- $strname = get_string("name", "math_assignment"); $straddress = get_string("address", "math_assignment"); + $strpassword = get_string("zonepassword", "math_assignment"); + $strdepends = get_string("dependantcourses", "math_assignment"); + $stredit = get_string("edit"); + $strdelete = get_string("delete"); ?> ! <?php ! print_heading_with_help($straimserverconfig, "server", "math_assignment"); ! ! if (isset($id)) { ! if (!$server = get_record("math_assignment_server", "id", $id)) { ! $server->name = ""; ! $server->address = ""; ! $server->password = ""; } ! } ! else if ($servers = get_records("math_assignment_server", "", "", "name ASC")) { ! $table->head = array($strname, $straddress, $strpassword, $strdepends, $stredit, $strdelete); ! $table->width = array("*", "*", "*", "*", "*", "*"); ! $table->align = array("LEFT", "LEFT", "LEFT", "CENTER", "CENTER", "CENTER"); ! foreach ($servers as $server) { ! $table->data[] = array($server->name, $server->address, str_repeat("*", strlen($server->password)), get_server_depends($server), "<a href=\"servers.php?id=$server->id\">$stredit</a>", "<a href=\"servers.php?id=$server->id&name=&address=&password=\">$strdelete</a>"); ! } ! print_table($table); ! $server->name = ""; ! $server->address = ""; ! $server->password = ""; ! print_heading(get_string("addnewserver", "math_assignment")); ! } ! ?> ! <form name="mainform" method="post" action="servers.php"> ! <?php ! if (isset($id)) ! echo "<input type=\"hidden\" name=\"id\" value=\"$id\" />\n"; ! ?> ! <center> ! <table align="center" border="0" cellpadding="5" cellspacing="0"> <tr valign="top"> ! <td align="right"><p><b><?php echo $strname; ?>:</b></p></td> <td> ! <input type="text" name="name" size="40" maxlength="255" value="<?php echo $server->name; ?>" /> <?php helpbutton ("server_name", $strname, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php echo $straddress; ?>:</b></p></td> <td> ! <input type="text" name="address" size="40" maxlength="255" value="<?php echo $server->address; ?>" /> <?php helpbutton ("server_address", $straddress, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"><p><b><?php echo $strpassword; ?>:</b></p></td> <td> ! <input type="password" name="password" size="40" maxlength="255" value="<?php echo $server->password; ?>" /> <?php helpbutton ("server_password", $strpassword, "math_assignment"); ?> </td> </tr> <tr valign="top"> ! <td align="right"> </p></td> <td> ! <input type="submit" name="save" value="<?php print_string("savechanges"); ?>" /> </td> </tr> </table> </center> + </form> <?php print_footer(); + + function get_server_depends($server, $justcount=true) { + global $CFG; + + if ($justcount) + return count_records("math_assignment_subject", "server", $server->id); + return get_records_sql("SELECT s.course, c.shortname, c.fullname, s.name FROM {$CFG->prefix}math_assignment_subject s, {$CFG->prefix}course c WHERE c.id = s.course AND s.server = $server->id"); + } ?> Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** version.php 22 Sep 2003 21:03:55 -0000 1.6 --- version.php 23 Sep 2003 17:53:11 -0000 1.7 *************** *** 6,10 **** ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092222; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? --- 6,10 ---- ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092315; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? |
From: <ma...@us...> - 2003-09-22 21:09:52
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv30476/mod/math_assignment Modified Files: view.php Log Message: Added column sort indicator Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** view.php 22 Sep 2003 19:54:35 -0000 1.12 --- view.php 22 Sep 2003 21:09:48 -0000 1.13 *************** *** 461,467 **** function get_sortable_header($id, $field, $sort, $sortdir, $title="") { if (strcasecmp($sort, $field) == 0) { ! $dir = strcasecmp($sortdir, "desc") == 0 ? "asc" : "desc"; ! $img = ""; // ## need to generate image tag here ## } else { --- 461,475 ---- function get_sortable_header($id, $field, $sort, $sortdir, $title="") { + global $CFG; + if (strcasecmp($sort, $field) == 0) { ! if (strcasecmp($sortdir, "desc") == 0) { ! $dir = "asc"; ! $img = "<img src=\"$CFG->pixpath/t/up.gif\" />"; ! } ! else { ! $dir = "desc"; ! $img = "<img src=\"$CFG->pixpath/t/down.gif\" />"; ! } } else { |
From: <ma...@us...> - 2003-09-22 21:04:06
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment/db In directory sc8-pr-cvs1:/tmp/cvs-serv28723/mod/math_assignment/db Modified Files: mysql.php mysql.sql Log Message: Removed 'student password' server setting and updated to gaining access with the subject password. Index: mysql.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.php,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** mysql.php 20 Sep 2003 19:13:43 -0000 1.7 --- mysql.php 22 Sep 2003 21:03:55 -0000 1.8 *************** *** 10,13 **** --- 10,16 ---- table_column("math_assignment", "", "focus", "tinyint", "1", "unsigned", "1"); } + if ($oldversion < 2003092222) { + execute_sql("ALTER TABLE `{$CFG->prefix}math_assignment_server` DROP `student_passwd`"); + } return true; Index: mysql.sql =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/db/mysql.sql,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** mysql.sql 20 Sep 2003 19:13:43 -0000 1.6 --- mysql.sql 22 Sep 2003 21:03:55 -0000 1.7 *************** *** 37,41 **** `name` varchar(255) NOT NULL default '', `address` varchar(255) NOT NULL default '', - `student_passwd` varchar(255) NOT NULL default '', PRIMARY KEY (`id`), UNIQUE `NAME` (`name`) --- 37,40 ---- |
From: <ma...@us...> - 2003-09-22 21:04:06
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv28723/mod/math_assignment Modified Files: aimpage.php lib.php pdfgen.php servers.php version.php Log Message: Removed 'student password' server setting and updated to gaining access with the subject password. Index: aimpage.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/aimpage.php,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** aimpage.php 20 Sep 2003 19:13:43 -0000 1.10 --- aimpage.php 22 Sep 2003 21:03:54 -0000 1.11 *************** *** 98,105 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $server->student_passwd); $postdata = math_assignment_add_arg_to_url_data($postdata, "FocusLabel", "1"); $postdata = math_assignment_add_arg_to_url_data($postdata, "OldFocusLabel", ""); ! $focus = ($math_assignment) ? "true" : "false"; $postdata = math_assignment_add_arg_to_url_data($postdata, "Focused", $focus); } --- 98,105 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); $postdata = math_assignment_add_arg_to_url_data($postdata, "FocusLabel", "1"); $postdata = math_assignment_add_arg_to_url_data($postdata, "OldFocusLabel", ""); ! $focus = ($math_assignment->focus) ? "true" : "false"; $postdata = math_assignment_add_arg_to_url_data($postdata, "Focused", $focus); } Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** lib.php 20 Sep 2003 14:49:06 -0000 1.15 --- lib.php 22 Sep 2003 21:03:55 -0000 1.16 *************** *** 199,225 **** echo "<option>"; } ! echo htmlspecialchars("$aim_server->name ($aim_server->address, $aim_server->student_passwd)") . "</option>\n"; ! } ! ! return true; ! } ! ! function math_assignment_list_subjects($id) { ! /// Function which outputs <option> tags for each subject in the database ! ! global $db, $CFG; ! ! $rs = $db->Execute("SELECT name,password FROM {$CFG->prefix}math_assignment_subject WHERE server='$id'"); ! if (empty($rs)) { ! return false; ! } ! if (!$rs = $rs->GetAssoc(false)) { ! return false; } - // write out an <option> tag for each subject - foreach ($rs as $subject => $password) { - echo "<option>" . htmlspecialchars("$subject ($password)") . "</option>\n"; - } return true; } --- 199,205 ---- echo "<option>"; } ! echo htmlspecialchars("$aim_server->name ($aim_server->address)") . "</option>\n"; } return true; } *************** *** 537,541 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentSurname", $USER->lastname); $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentEmailAddress", $USER->email); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentPassword", $server->student_passwd); $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); --- 517,521 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentSurname", $USER->lastname); $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentEmailAddress", $USER->email); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "NewStudentPassword", generate_password(10)); $postdata = math_assignment_add_arg_to_url_data($postdata, "SubjectName", $subject->name); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); Index: pdfgen.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/pdfgen.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** pdfgen.php 18 Sep 2003 23:57:57 -0000 1.5 --- pdfgen.php 22 Sep 2003 21:03:55 -0000 1.6 *************** *** 75,81 **** $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $server->student_passwd); } ! else $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","try/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "TryQuiz"); --- 75,81 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "StudentID", $USER->username); ! $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->passwd); } ! else { $postdata = math_assignment_add_arg_to_url_data($postdata, "Command","try/Quiz"); $postdata = math_assignment_add_arg_to_url_data($postdata, "Action", "TryQuiz"); *************** *** 83,86 **** --- 83,87 ---- $postdata = math_assignment_add_arg_to_url_data($postdata, "QuizName", $math_assignment->aimquiz); $postdata = math_assignment_add_arg_to_url_data($postdata, "Password", $subject->password); + } // load the AiM page and grab the result Index: servers.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/servers.php,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** servers.php 18 Sep 2003 23:57:57 -0000 1.2 --- servers.php 22 Sep 2003 21:03:55 -0000 1.3 *************** *** 9,13 **** optional_variable($name); // server name optional_variable($address); // server address - optional_variable($student_passwd); // student AiM password optional_variable($delete); // delete button --- 9,12 ---- *************** *** 53,57 **** error(get_string("invalid", "math_assignment"), "servers.php"); } ! if (!math_assignment_check_name($name) || !math_assignment_check_name($address) || !math_assignment_check_name($student_passwd)) { error(get_string("invalid", "math_assignment"), "servers.php"); } --- 52,56 ---- error(get_string("invalid", "math_assignment"), "servers.php"); } ! if (!math_assignment_check_name($name) || !math_assignment_check_name($address)) { error(get_string("invalid", "math_assignment"), "servers.php"); } *************** *** 62,66 **** $newserver->name = $name; $newserver->address = $address; - $newserver->student_passwd = $student_passwd; if (!insert_record("math_assignment_server", $newserver)) { error(get_string("failed", "math_assignment"), "servers.php"); --- 61,64 ---- *************** *** 74,78 **** $server->name = $name; $server->address = $address; - $server->student_passwd = $student_passwd; if (!update_record("math_assignment_server", $server)) { error(get_string("failed","math_assignment"), "servers.php"); --- 72,75 ---- *************** *** 96,100 **** $strname = get_string("name", "math_assignment"); $straddress = get_string("address", "math_assignment"); - $strstudentpasswd = get_string("student_password","math_assignment"); ?> --- 93,96 ---- *************** *** 109,119 **** frm.name.value = ""; frm.address.value = ""; - frm.student_passwd.value = ""; } else { frm.name.value = server.slice(0, server.indexOf("(") - 1); ! options = server.slice(server.indexOf("(") + 1, -1); ! frm.address.value = options.slice(0, options.indexOf(",")); ! frm.student_passwd.value = options.slice(options.indexOf(",") + 2); } } --- 105,112 ---- frm.name.value = ""; frm.address.value = ""; } else { frm.name.value = server.slice(0, server.indexOf("(") - 1); ! frm.address.value = server.slice(server.indexOf("(") + 1, server.indexOf(")")); } } *************** *** 152,162 **** <td> <input type="text" name="address" size="40" maxlength="255" /> <?php helpbutton ("server_address", $straddress, "math_assignment"); ?> - </td> - </tr> - - <tr valign="top"> - <td align="right"><p><b><?php echo $strstudentpasswd; ?>:</b></p></td> - <td> - <input type="text" name="student_passwd" size="40" maxlength="255" /> <?php helpbutton ("server_passwd", $strstudentpasswd, "math_assignment"); ?> </td> </tr> --- 145,148 ---- Index: version.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** version.php 20 Sep 2003 19:13:43 -0000 1.5 --- version.php 22 Sep 2003 21:03:55 -0000 1.6 *************** *** 6,10 **** ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092001; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? --- 6,10 ---- ///////////////////////////////////////////////////////////////////////////////// ! $module->version = 2003092222; // The (date) version of this module $module->cron = 0; // How often should cron check this module (seconds)? |
From: <ma...@us...> - 2003-09-22 21:04:06
|
Update of /cvsroot/aimmath/moodle/lang/en In directory sc8-pr-cvs1:/tmp/cvs-serv28723/lang/en Modified Files: math_assignment.php Log Message: Removed 'student password' server setting and updated to gaining access with the subject password. Index: math_assignment.php =================================================================== RCS file: /cvsroot/aimmath/moodle/lang/en/math_assignment.php,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** math_assignment.php 22 Sep 2003 01:13:01 -0000 1.12 --- math_assignment.php 22 Sep 2003 21:03:54 -0000 1.13 *************** *** 73,77 **** $string['singlequestion'] = "single question"; $string['solutions'] = "Solution sheet"; - $string['student_password'] = "Student AiM Password"; $string['studentnotattempted'] = "The student has not attempted this assignment."; $string['timedue'] = "Due Date and Time"; --- 73,76 ---- |
From: <ma...@us...> - 2003-09-22 21:04:06
|
Update of /cvsroot/aimmath/moodle/lang/en/help/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv28723/lang/en/help/math_assignment Removed Files: addupdate_serversubject.html addupdate_subject.html server_passwd.html Log Message: Removed 'student password' server setting and updated to gaining access with the subject password. --- addupdate_serversubject.html DELETED --- --- addupdate_subject.html DELETED --- --- server_passwd.html DELETED --- |
From: <ma...@us...> - 2003-09-22 19:54:41
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv12121/mod/math_assignment Modified Files: view.php Log Message: Removed paging, implemented a first attempt at the UI for sorting. SQL completely reworked to work faster and nicer. Index: view.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/view.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** view.php 22 Sep 2003 01:13:01 -0000 1.11 --- view.php 22 Sep 2003 19:54:35 -0000 1.12 *************** *** 11,17 **** optional_variable($q); // assignment ID optional_variable($download, ""); // to download data ! optional_variable($sort, "lastname ASC"); // column and direction to sort ! optional_variable($page, 1); // page to display ! optional_variable($pagerows, 100); // number of students to display per page if (! $site = get_site()) { --- 11,16 ---- optional_variable($q); // assignment ID optional_variable($download, ""); // to download data ! optional_variable($sort, "lastname"); // column to sort ! optional_variable($sortdir, "asc"); // direction to sort if (! $site = get_site()) { *************** *** 72,119 **** // verify that the sort string is correct ! $sort = explode(" ", $sort); ! if (count($sort) != 2) { ! $sort[0] = "lastname"; // not valid so use default instead ! $sort[1] = "ASC"; ! } ! $sortgrade = 0; ! if (strcasecmp($sort[0], "lastname") != 0) { // check for field name in most likely used order ! if (strcasecmp($sort[0], "firstname") != 0) { // to improve speed ! if (strcasecmp($sort[0], "totalgrade") != 0) ! $sort[0] = "lastname"; // not valid so use default instead ! else if (strcasecmp($sort[1], "desc") == 0) ! $sortgrade = -1; ! else ! $sortgrade = 1; } } ! if (strcasecmp($sort[1], "asc") != 0 && strcasecmp($sort[1], "desc") != 0) ! $sort[1] = "ASC"; // not valid so use default instead ! $sort = implode(" ", $sort); ! // check page is valid ! if ($page <= 0) ! $page = 1; ! if ($pagerows < 10) { // refuse to show less than 10 rows per page ! if ($pagerows > 0) ! $page = (int) (($page - 1) * $pagerows) / 10 + 1; ! else ! $page = 1; ! $pagerows = 10; } ! ! // Count all students (NOTE : MySQL 4 only but nice and fast) ! $numstudents = $db->Execute("SELECT count(*) FROM {$CFG->prefix}user u LEFT JOIN {$CFG->prefix}user_students s ON s.userid = u.id WHERE s.course = '$course->id' AND u.deleted = '0'"); ! if ($numstudents) ! $numstudents = (int) $numstudents->fields[0]; ! else ! $numstudents = 0; ! ! if (($page - 1) * $pagerows > $numstudents) ! $page = (int) ($numstudents + $pagerows - 1) / $pagerows; ! ! // Get a list of students for this page ! $page = ($page - 1) * $pagerows; ! if (!$students = get_course_students($course->id, $sortgrade ? "''" : "u.$sort" . ($pagerows ? " LIMIT $page, $pagerows" : ""))) { print_header("$course->shortname: $math_assignment->name", "$course->fullname", "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name", --- 71,132 ---- // verify that the sort string is correct ! if (strcasecmp($sort, "lastname") != 0) { // check for field name in most likely used order ! if (strcasecmp($sort, "firstname") != 0) { // to improve speed ! if (strcasecmp($sort, "totalgrade") != 0) ! $sort = "lastname"; // not valid so use default instead } } ! if (strcasecmp($sortdir, "asc") != 0 && strcasecmp($sortdir, "desc") != 0) ! $sortdir = "asc"; // not valid so use default instead ! // Get a list of students for this course including grades ! switch(strtolower($CFG->dbtype)) { ! case 'mysql': ! if (strcasecmp($sort, "totalgrade") == 0) ! $sortsql = "totalgrade $sortdir"; ! else ! $sortsql = "u.$sort $sortdir"; ! $students = get_records_sql("SELECT s.userid, u.firstname, u.lastname, u.picture, g.papergrade, g.aimgrade, g.aimoverride, g.aimcomment, least(greatest(g.papergrade,0), $math_assignment->papergrade)+least(greatest(g.aimgrade,0), $math_assignment->aimgrade) AS totalgrade FROM {$CFG->prefix}user_students s LEFT JOIN {$CFG->prefix}user u ON s.course = '$course->id' AND u.id = s.userid LEFT JOIN {$CFG->prefix}math_assignment_grades g ON g.assignment = '$math_assignment->id' AND g.userid = s.userid WHERE u.deleted = '0' ORDER BY $sortsql"); ! break; ! default: ! // emulate ! $students = get_records_sql("SELECT userid,userid FROM {$CFG->prefix}user_students WHERE course = '$course->id'"); ! if ($students) { ! foreach ($students as $key => $student) { ! if ($user = get_record_sql("SELECT firstname, lastname, picture FROM {$CFG->prefix}user WHERE id = '$key' AND deleted = '0'")) { ! $students[$key]->firstname = $user->firstname; ! $students[$key]->lastname = $user->lastname; ! $students[$key]->picture = $user->picture; ! $grade = get_record_sql("SELECT papergrade, aimgrade, aimoverride, aimcomment FROM {$CFG->prefix}math_assignment_grades WHERE assignment = '$math_assignment->id' and userid = '$key'"); ! if ($grade) { ! $students[$key]->papergrade = $grade->papergrade; ! $students[$key]->aimgrade = $grade->aimgrade; ! $students[$key]->aimoverride = $grade->aimoverride ; ! $students[$key]->aimcomment = $grade->aimcomment; ! $students[$key]->totalgrade = math_assignment_total_grade($math_assignment, $grade); ! } ! else { ! $students[$key]->papergrade = -1; ! $students[$key]->aimgrade = -1; ! $students[$key]->aimoverride = 0 ; ! $students[$key]->aimcomment = ""; ! $students[$key]->totalgrade = 0; ! } ! } ! else { ! // assume it failed because deleted was not zero ! unset($students[$key]); ! } ! } ! // sort ! if (strcasecmp($sortdir, "desc") == 0) ! $mult = -1; ! else ! $mult = 1; ! uasort($students, create_function('$a, $b', 'return (($a->' . $sort . ' > $b->' . $sort . ') ? 1 : -1) * ' . $mult . ';')); ! } ! break; } ! if (!$students) { print_header("$course->shortname: $math_assignment->name", "$course->fullname", "$navigation <a href=\"index.php?id=$course->id\">$strmath_assignments</a> -> $math_assignment->name", *************** *** 123,142 **** exit; } - - // Get grades - foreach ($students as $student) { - if (!$grades[$student->id] = get_record("math_assignment_grades", "assignment", $math_assignment->id, "userid", $student->id)) { - $grades[$student->id]->quiz = $math_assignment->id; - $grades[$student->id]->userid = $student->id; - $grades[$student->id]->papergrade = -1; - $grades[$student->id]->aimgrade = -1; - $grades[$student->id]->aimoverride = 0; - $grades[$student->id]->aimcomment = ""; - } - } - - if ($sortgrade) { // we need to do the sorting ourselves - usort($students, create_function('$a,$b','global $math_assignment, $grades; return ((math_assignment_total_grade($math_assignment, $grades[$a->id]) < math_assignment_total_grade($math_assignment, $grades[$b->id])) ? -1 : 1) * ' . $sortgrade . ';')); - } } else if (isstudent($course->id)) { --- 136,139 ---- *************** *** 181,187 **** $i = 0; ! foreach ($grades as $studentid => $studentgrade) { $i++; - $student = $students[$studentid]; $myxls->ChangePos($i,0); --- 178,183 ---- $i = 0; ! foreach ($students as $student) { $i++; $myxls->ChangePos($i,0); *************** *** 189,202 **** $myxls->InsertText($student->lastname); if ($hasboth) { ! if ($studentgrade->papergrade >= 0) ! $myxls->InsertNumber($studentgrade->papergrade); else $myxls->InsertText(""); ! if ($studentgrade->aimgrade >= 0) ! $myxls->InsertNumber($studentgrade->aimgrade); else $myxls->InsertText(""); } ! $myxls->InsertNumber(math_assignment_total_grade($math_assignment, $studentgrade)); } --- 185,198 ---- $myxls->InsertText($student->lastname); if ($hasboth) { ! if ($student->papergrade >= 0) ! $myxls->InsertNumber($student->papergrade); else $myxls->InsertText(""); ! if ($student->aimgrade >= 0) ! $myxls->InsertNumber($student->aimgrade); else $myxls->InsertText(""); } ! $myxls->InsertNumber($student->totalgrade); } *************** *** 222,237 **** /// Print all the lines of data. ! foreach ($grades as $studentid => $studentgrade) { ! $student = $students[$studentid]; echo "$student->firstname\t$student->lastname\t"; if ($hasboth) { ! if ($studentgrade->papergrade >= 0) ! echo "$studentgrade->papergrade"; echo "\t"; ! if ($studentgrade->aimgrade >= 0) ! echo "$studentgrade->aimgrade"; echo "\t"; } ! echo math_assignment_total_grade($math_assignment, $studentgrade); echo "\n"; } --- 218,232 ---- /// Print all the lines of data. ! foreach ($students as $student) { echo "$student->firstname\t$student->lastname\t"; if ($hasboth) { ! if ($student->papergrade >= 0) ! echo "$student->papergrade"; echo "\t"; ! if ($student->aimgrade >= 0) ! echo "$student->aimgrade"; echo "\t"; } ! echo $student->totalgrade; echo "\n"; } *************** *** 264,278 **** /// Print all the lines of data. ! foreach ($grades as $studentid => $studentgrade) { ! $student = $students[$studentid]; echo "<tr><td height=\"40\">$student->firstname</td><td>$student->lastname</td>"; if ($hasboth) { echo "<td>"; ! if ($studentgrade->aimgrade >= 0) ! echo $studentgrade->aimgrade; else echo " "; echo "</td><td>"; ! if ($studentgrade->papergrade >= 0) ! echo $studentgrade->papergrade; else echo " "; echo "</td>"; --- 259,272 ---- /// Print all the lines of data. ! foreach ($students as $student) { echo "<tr><td height=\"40\">$student->firstname</td><td>$student->lastname</td>"; if ($hasboth) { echo "<td>"; ! if ($student->aimgrade >= 0) ! echo $student->aimgrade; else echo " "; echo "</td><td>"; ! if ($student->papergrade >= 0) ! echo $student->papergrade; else echo " "; echo "</td>"; *************** *** 280,285 **** else { echo "<td>"; ! if (math_assignment_total_grade($math_assignment, $studentgrade) >= 0) ! echo math_assignment_total_grade($math_assignment, $studentgrade); else echo " "; echo "</td>"; --- 274,279 ---- else { echo "<td>"; ! if ($student->totalgrade > 0) ! echo $student->totalgrade; else echo " "; echo "</td>"; *************** *** 358,364 **** echo math_assignment_get_admin_links($cm, $math_assignment, "right"); print_heading($strgrades); if ($hasboth) { echo "<p align=\"center\"><b>" . get_string("maximumgrade") . "</b>: $math_assignment->papergrade ($strpaper) + $math_assignment->aimgrade ($strcomputer) = $totalmax</p>"; ! $table->head = array ("", get_string("firstname"), get_string("lastname"), "$strpaper $strgrade", "$strcomputer $strgrade", "$strtotal $strgrade"); $table->width = array(35, "", "", "", "", ""); $table->align = array("LEFT", "RIGHT", "LEFT", "CENTER", "CENTER", "CENTER"); --- 352,360 ---- echo math_assignment_get_admin_links($cm, $math_assignment, "right"); print_heading($strgrades); + + // get sort strings if ($hasboth) { echo "<p align=\"center\"><b>" . get_string("maximumgrade") . "</b>: $math_assignment->papergrade ($strpaper) + $math_assignment->aimgrade ($strcomputer) = $totalmax</p>"; ! $table->head = array ("", get_sortable_header($cm->id, "firstname", $sort, $sortdir), get_sortable_header($cm->id, "lastname", $sort, $sortdir), "$strpaper $strgrade", "$strcomputer $strgrade", get_sortable_header($cm->id, "totalgrade", $sort, $sortdir, "$strtotal $strgrade")); $table->width = array(35, "", "", "", "", ""); $table->align = array("LEFT", "RIGHT", "LEFT", "CENTER", "CENTER", "CENTER"); *************** *** 366,370 **** else { echo "<p align=\"center\"><b>" . get_string("maximumgrade") . "</b>: $totalmax</p>"; ! $table->head = array ("", get_string("firstname"), get_string("lastname"), "$strgrade"); $table->width = array(35, "", "", ""); $table->align = array("LEFT", "RIGHT", "LEFT", "CENTER"); --- 362,366 ---- else { echo "<p align=\"center\"><b>" . get_string("maximumgrade") . "</b>: $totalmax</p>"; ! $table->head = array ("", get_sortable_header($cm->id, "firstname", $sort, $sortdir), get_sortable_header($cm->id, "lastname", $sort, $sortdir), "$strgrade"); $table->width = array(35, "", "", ""); $table->align = array("LEFT", "RIGHT", "LEFT", "CENTER"); *************** *** 377,397 **** $i = 1; foreach ($students as $student) { ! $studentgrade = $grades[$student->id]; ! $picture = print_user_picture($student->id, $course->id, $student->picture, false, true); ! if ($studentgrade->papergrade >= 0) ! $papergrade = $studentgrade->papergrade; else $papergrade = ""; ! $papergrade = "<input type=\"text\" name=\"$student->id\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; ! if ($studentgrade->aimgrade >= 0) ! $aimgrade = $studentgrade->aimgrade; else $aimgrade = ""; ! if ($studentgrade->aimoverride) { $edited = "$stredited ("; $editedclose = ")"; } ! else if ($studentgrade->aimcomment) { $edited = "$strcommented ("; $editedclose = ")"; --- 373,392 ---- $i = 1; foreach ($students as $student) { ! $picture = print_user_picture($student->userid, $course->id, $student->picture, false, true); ! if ($student->papergrade >= 0) ! $papergrade = $student->papergrade; else $papergrade = ""; ! $papergrade = "<input type=\"text\" name=\"$student->userid\" size=\"10\" maxlength=\"10\" value=\"$papergrade\" tabindex=\"$i\" />"; ! if ($student->aimgrade >= 0) ! $aimgrade = $student->aimgrade; else $aimgrade = ""; ! if ($student->aimoverride) { $edited = "$stredited ("; $editedclose = ")"; } ! else if ($student->aimcomment) { $edited = "$strcommented ("; $editedclose = ")"; *************** *** 404,430 **** if ($hasboth) $table->data[] = array($picture, $student->firstname, $student->lastname, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->id\">$stredit</a>$editedclose", math_assignment_total_grade($math_assignment, $studentgrade)); else if ($haspaper) $table->data[] = array($picture, $student->firstname, $student->lastname, $papergrade); else if ($hasaim) $table->data[] = array($picture, $student->firstname, $student->lastname, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->id\">$stredit</a>$editedclose"); $i++; } ! // print paging controls ! print_paging_form ("top", $cm->id, $sort, $numstudents, $page, $pagerows); ! ! echo "<form action=\"updatepapergrades.php?id=$math_assignment->id\" method=\"post\" name=\"papergradeform\">"; print_table($table); ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! echo "<input type=\"submit\" value=\"" . get_string("savechanges") . "\" />"; ! echo "</td><td>"; ! echo "<input type=\"reset\" value=\"" . get_string("reset", "math_assignment") . "\" />"; ! echo "</td><td>"; ! helpbutton ("editpapergrades", "$strpaper $strgrades", "math_assignment"); ! echo "</td></tr></table></form>"; echo "<table border=\"0\" align=\"center\"><tr><td>"; $options["q"] = $math_assignment->id; --- 399,425 ---- if ($hasboth) $table->data[] = array($picture, $student->firstname, $student->lastname, $papergrade, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose", $student->totalgrade); else if ($haspaper) $table->data[] = array($picture, $student->firstname, $student->lastname, $papergrade); else if ($hasaim) $table->data[] = array($picture, $student->firstname, $student->lastname, ! "$aimgrade $edited<a href=\"editgrade.php?id=$math_assignment->id&userid=$student->userid\">$stredit</a>$editedclose"); $i++; } ! if ($haspaper) ! echo "<form action=\"updatepapergrades.php?id=$math_assignment->id\" method=\"post\" name=\"papergradeform\">"; print_table($table); ! if ($haspaper) { ! echo "<table border=\"0\" align=\"center\"><tr><td>"; ! echo "<input type=\"submit\" value=\"" . get_string("savechanges") . "\" />"; ! echo "</td><td>"; ! echo "<input type=\"reset\" value=\"" . get_string("reset", "math_assignment") . "\" />"; ! echo "</td><td>"; ! helpbutton ("editpapergrades", "$strpaper $strgrades", "math_assignment"); ! echo "</td></tr></table></form>"; ! } echo "<table border=\"0\" align=\"center\"><tr><td>"; $options["q"] = $math_assignment->id; *************** *** 445,451 **** echo "</td></tr></table>"; - // print paging controls - print_paging_form ("bottom", $cm->id, $sort, $numstudents, $page, $pagerows); - if ($adminlinks = math_assignment_get_admin_links($cm, $math_assignment, "center")) { print_heading(get_string("administration")); --- 440,443 ---- *************** *** 468,492 **** } ! function print_paging_form($name, $id, $sort, $count, $page, $pagerows) { ! if ($count > $pagerows) { ! echo "<form action=\"view.php?id=$id\" method=\"post\" name=\"page$name\">\n"; ! echo "<input type=\"hidden\" name=\"sort\" value=\"$sort\" />\n"; ! $moreinfo->start = $page + 1; ! $moreinfo->end = min($page + $pagerows, $count); ! $moreinfo->total = $count; ! echo "<p align=\"center\">" . get_string("displayingrows", "math_assignment", $moreinfo) . "</p>\n"; ! echo "<p align=\"center\">" . get_string("page") . " :"; ! $pages = ($count + $pagerows - 1) / $pagerows; ! $page++; ! for ($i = 1; $i <= $pages; $i++) { ! if ($i == $page) ! echo " <b>$i</b>"; ! else ! echo " <input type=\"submit\" name=\"page\" value=\"$i\" />"; ! } ! echo "</p>\n"; ! echo "<input type=\"hidden\" name=\"pagerows\" value=\"$pagerows\" />\n"; ! echo "</form>\n"; } } ?> --- 460,476 ---- } ! function get_sortable_header($id, $field, $sort, $sortdir, $title="") { ! if (strcasecmp($sort, $field) == 0) { ! $dir = strcasecmp($sortdir, "desc") == 0 ? "asc" : "desc"; ! $img = ""; // ## need to generate image tag here ## } + else { + $dir = "asc"; + $img = ""; + } + if (!$title) + $title = get_string($field); + return "<a href=\"view.php?id=$id&sort=$field&sortdir=$dir\">$title</a>$img"; } + ?> |
From: <gus...@us...> - 2003-09-22 10:04:36
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv19590/mod/math_assignment Modified Files: mod.html Log Message: focus checkboxes now default to single question Index: mod.html =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** mod.html 20 Sep 2003 19:13:43 -0000 1.16 --- mod.html 22 Sep 2003 10:04:33 -0000 1.17 *************** *** 29,34 **** $form->aimquiz = ""; } ! if (!isset($form->aimfocus)) { ! $form->aimfocus = 1; } if (!isset($form->papergrade)) { --- 29,34 ---- $form->aimquiz = ""; } ! if (!isset($form->focus)) { ! $form->focus = 1; } if (!isset($form->papergrade)) { |