Update of /cvsroot/aimmath/moodle/mod/math_assignment
In directory sc8-pr-cvs1:/tmp/cvs-serv27017/mod/math_assignment
Modified Files:
lib.php mod.html version.php
Log Message:
Improved handling of URLs for problem and solution sheets fixing bugs and removing $math_assignment->problemscompile etc.
Index: lib.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/lib.php,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** lib.php 16 Sep 2003 15:43:03 -0000 1.12
--- lib.php 18 Sep 2003 11:16:16 -0000 1.13
***************
*** 15,48 ****
// problems
if ($math_assignment->problems === "") {
! if ($math_assignment->problemsurl)
$math_assignment->problems = $math_assignment->problemsurl;
else if (!empty($_FILES['problemsfile']))
$math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']);
}
$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;
// solutions
if ($math_assignment->solutions === "") {
! if ($math_assignment->solutionsurl)
$math_assignment->solutions = $math_assignment->solutionsurl;
else if (!empty($_FILES['solutionsfile']))
$math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']);
}
$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;
$math_assignment->timemodified = time();
--- 15,40 ----
// problems
+ $math_assignment->problemsisurl = 0;
if ($math_assignment->problems === "") {
! if ($math_assignment->problemsurl) {
$math_assignment->problems = $math_assignment->problemsurl;
+ $math_assignment->problemsisurl = 1;
+ }
else if (!empty($_FILES['problemsfile']))
$math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']);
}
$math_assignment->problems = trim($math_assignment->problems);
// solutions
+ $math_assignment->solutionsisurl = 0;
if ($math_assignment->solutions === "") {
! if ($math_assignment->solutionsurl) {
$math_assignment->solutions = $math_assignment->solutionsurl;
+ $math_assignment->solutionsisurl = 1;
+ }
else if (!empty($_FILES['solutionsfile']))
$math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']);
}
$math_assignment->solutions = trim($math_assignment->solutions);
$math_assignment->timemodified = time();
***************
*** 62,95 ****
// problems
if ($math_assignment->problems === "") {
! if ($math_assignment->problemsurl)
$math_assignment->problems = $math_assignment->problemsurl;
else if (!empty($_FILES['problemsfile']))
$math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']);
}
$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;
// solutions
if ($math_assignment->solutions === "") {
! if ($math_assignment->solutionsurl)
$math_assignment->solutions = $math_assignment->solutionsurl;
else if (!empty($_FILES['solutionsfile']))
$math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']);
}
$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;
$math_assignment->timemodified = time();
--- 54,79 ----
// problems
+ $math_assignment->problemsisurl = 0;
if ($math_assignment->problems === "") {
! if ($math_assignment->problemsurl) {
$math_assignment->problems = $math_assignment->problemsurl;
+ $math_assignment->problemsisurl = 1;
+ }
else if (!empty($_FILES['problemsfile']))
$math_assignment->problems = math_assignment_save_upload($math_assignment->course, $_FILES['problemsfile']);
}
$math_assignment->problems = trim($math_assignment->problems);
// solutions
+ $math_assignment->solutionsisurl = 0;
if ($math_assignment->solutions === "") {
! if ($math_assignment->solutionsurl) {
$math_assignment->solutions = $math_assignment->solutionsurl;
+ $math_assignment->solutionsisurl = 1;
+ }
else if (!empty($_FILES['solutionsfile']))
$math_assignment->solutions = math_assignment_save_upload($math_assignment->course, $_FILES['solutionsfile']);
}
$math_assignment->solutions = trim($math_assignment->solutions);
$math_assignment->timemodified = time();
***************
*** 282,318 ****
global $CFG;
! if($math_assignment->problemscompile) {
! if ($math_assignment->problems || $math_assignment->aimquiz)
$proburl = "pdfgen.php?id=$math_assignment->id&type=problems";
else
! $proburl = "";
! }
! else {
! if ($math_assignment->problems) {
! if ($CFG->slasharguments)
! $proburl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->problems";
! else
! $proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems";
! }
! else
! $proburl = "";
}
! if($math_assignment->solutionscompile) {
! if ($math_assignment->solutions || $math_assignment->aimquiz)
$solurl = "pdfgen.php?id=$math_assignment->id&type=solutions";
else
! $solurl = "";
! }
! else {
! if ($math_assignment->solutions) {
! if ($CFG->slasharguments)
! $solurl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->solutions";
! else
! $solurl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->solutions";
! }
! else
! $solurl = "";
}
}
--- 266,298 ----
global $CFG;
! if($math_assignment->problems) {
! if (math_assignment_is_tex_file($math_assignment->problems))
$proburl = "pdfgen.php?id=$math_assignment->id&type=problems";
+ else if ($math_assignment->problemsisurl)
+ $proburl = $math_assignment->problems;
+ else if ($CFG->slasharguments)
+ $proburl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->problems";
else
! $proburl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->problems";
}
+ else if ($math_assignment->aimquiz)
+ $proburl = "pdfgen.php?id=$math_assignment->id&type=problems";
+ else
+ $proburl = "";
! if($math_assignment->solutions) {
! if (math_assignment_is_tex_file($math_assignment->solutions))
$solurl = "pdfgen.php?id=$math_assignment->id&type=solutions";
+ else if ($math_assignment->solutionsisurl)
+ $solurl = $math_assignment->solutions;
+ else if ($CFG->slasharguments)
+ $solurl = "$CFG->wwwroot/file.php/$math_assignment->course/$math_assignment->solutions";
else
! $solurl = "$CFG->wwwroot/file.php?file=/$math_assignment->course/$math_assignment->solutions";
}
+ else if ($math_assignment->aimquiz)
+ $solurl = "pdfgen.php?id=$math_assignment->id&type=solutions";
+ else
+ $solurl = "";
}
Index: mod.html
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/mod.html,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** mod.html 18 Sep 2003 09:48:51 -0000 1.11
--- mod.html 18 Sep 2003 11:16:16 -0000 1.12
***************
*** 54,58 ****
$form->problemsurl = "";
if ($form->problems) {
! if (strcasecmp(substr($form->problems, 0, 5), "http:") == 0) {
$form->problemsurl = $form->problems;
$form->problems = "";
--- 54,58 ----
$form->problemsurl = "";
if ($form->problems) {
! if ($form->problemsisurl) {
$form->problemsurl = $form->problems;
$form->problems = "";
***************
*** 61,65 ****
$form->solutionsurl = "";
if ($form->solutions) {
! if (strcasecmp(substr($form->solutions, 0, 5), "http:") == 0) {
$form->solutionsurl = $form->solutions;
$form->solutions = "";
--- 61,65 ----
$form->solutionsurl = "";
if ($form->solutions) {
! if ($form->solutionsisurl) {
$form->solutionsurl = $form->solutions;
$form->solutions = "";
***************
*** 171,178 ****
</td>
</tr>
- <input type="hidden" name="problemscompile" value="false"> <!--
<tr>
! <td colspan="2"><input type="checkbox" name="problemscompile"<?php if ($form->problemscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
! </tr> -->
</table>
</td>
--- 171,177 ----
</td>
</tr>
<tr>
! <td colspan="2"><?php echo "$strcompiletex"; ?></td>
! </tr>
</table>
</td>
***************
*** 220,227 ****
</td>
</tr>
- <input type="hidden" name="solutionscompile" value="false"><!--
<tr>
! <td colspan="2"><input type="checkbox" name="solutionscompile"<?php if ($form->solutionscompile) echo " checked=\"true\""; ?> /><?php echo "$strcompiletex"; ?></td>
! </tr> -->
</table>
</td>
--- 219,225 ----
</td>
</tr>
<tr>
! <td colspan="2"><?php echo "$strcompiletex"; ?></td>
! </tr>
</table>
</td>
Index: version.php
===================================================================
RCS file: /cvsroot/aimmath/moodle/mod/math_assignment/version.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** version.php 16 Sep 2003 15:21:47 -0000 1.2
--- version.php 18 Sep 2003 11:16:16 -0000 1.3
***************
*** 6,10 ****
/////////////////////////////////////////////////////////////////////////////////
! $module->version = 2003091616; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
--- 6,10 ----
/////////////////////////////////////////////////////////////////////////////////
! $module->version = 2003091812; // The (date) version of this module
$module->cron = 0; // How often should cron check this module (seconds)?
|