[Aimmath-commit] moodle/mod/math_assignment lib.php,1.11,1.12
Brought to you by:
gustav_delius,
npstrick
From: <ma...@us...> - 2003-09-16 15:43:08
|
Update of /cvsroot/aimmath/moodle/mod/math_assignment In directory sc8-pr-cvs1:/tmp/cvs-serv23990/mod/math_assignment Modified Files: lib.php Log Message: Changed handling of problem and solution sheets. Index: lib.php =================================================================== RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** lib.php 16 Sep 2003 15:26:30 -0000 1.11 --- lib.php 16 Sep 2003 15:43:03 -0000 1.12 *************** *** 22,27 **** } $math_assignment->problems = trim($math_assignment->problems); ! if (isset($math_assignment->problemscompile)) $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); else $math_assignment->problemscompile = false; --- 22,30 ---- } $math_assignment->problems = trim($math_assignment->problems); ! if (isset($math_assignment->problemscompile)) { $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); + if (!math_assignment_is_tex_file($math_assignment->problems)) + $math_assignment->problemscompile = false; + } else $math_assignment->problemscompile = false; *************** *** 35,40 **** } $math_assignment->solutions = trim($math_assignment->solutions); ! if (isset($math_assignment->solutionscompile)) $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); else $math_assignment->solutionscompile = false; --- 38,46 ---- } $math_assignment->solutions = trim($math_assignment->solutions); ! if (isset($math_assignment->solutionscompile)) { $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); + if (!math_assignment_is_tex_file($math_assignment->solutions)) + $math_assignment->solutionscompile = false; + } else $math_assignment->solutionscompile = false; *************** *** 63,68 **** } $math_assignment->problems = trim($math_assignment->problems); ! if (isset($math_assignment->problemscompile)) $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); else $math_assignment->problemscompile = false; --- 69,77 ---- } $math_assignment->problems = trim($math_assignment->problems); ! if (isset($math_assignment->problemscompile)) { $math_assignment->problemscompile = ($math_assignment->problemscompile != ""); + if (!math_assignment_is_tex_file($math_assignment->problems)) + $math_assignment->problemscompile = false; + } else $math_assignment->problemscompile = false; *************** *** 76,81 **** } $math_assignment->solutions = trim($math_assignment->solutions); ! if (isset($math_assignment->solutionscompile)) $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); else $math_assignment->solutionscompile = false; --- 85,93 ---- } $math_assignment->solutions = trim($math_assignment->solutions); ! if (isset($math_assignment->solutionscompile)) { $math_assignment->solutionscompile = ($math_assignment->solutionscompile != ""); + if (!math_assignment_is_tex_file($math_assignment->solutions)) + $math_assignment->solutionscompile = false; + } else $math_assignment->solutionscompile = false; *************** *** 176,179 **** --- 188,201 ---- chmod("$basedir/$file_name", 0666); return $file_name; + } + + function math_assignment_is_tex_file($file) { + /// Function which determins if a file is a tex file based on the extension + + if (strcasecmp(substr($file, -4), ".tex") == 0) + return true; + if (strcasecmp(substr($file, -6), ".latex") == 0) + return true; + return false; } |