***NOTE NOTE NOTE **********************************************************

THIS IS A BIG CHANGE!

I've renamed the "reading" module to "resource".

This meant changing quite a few references throughout Moodle.

The automatic upgrade process should work OK (it worked OK on my
development server) and there shouldn't be any problems.

BUT PLEASE PROCEED WITH CAUTION AND KEEP BACKUPS OF EVERYTHING
UNTIL I HAVE A FEW MORE TESTS!   If you upgrade please let me know.

One thing that will break are any hard-coded links within forum messages.

What I will be doing to fix this on my apache server is to add this to
httpd.conf:

Redirect /mod/reading/ http://moodle.com/mod/resource/

Sorry about any inconvenience, but it's better this is done sooner than later.
This commit is contained in:
moodler 2002-10-17 14:03:59 +00:00
parent e1ac42728d
commit 2a439ba7f6
21 changed files with 680 additions and 26 deletions

194
mod/resource/details.php Normal file
View file

@ -0,0 +1,194 @@
<?PHP // $Id$
require("../../config.php");
require("lib.php");
require_login();
$usehtmleditor = can_use_richtext_editor();
if (match_referer("$destination") && isset($HTTP_POST_VARS)) { // form submitted
$form = (object)$HTTP_POST_VARS;
if (! $course = get_record("course", "id", $form->course)) {
error("This course doesn't exist");
}
require_login($course->id);
if (!isteacher($course->id)) {
error("You can't modify this course!");
}
$strediting = get_string("editingaresource", "resource");
$strname = get_string("name");
print_header("$course->shortname: $strediting", "$course->shortname: $strediting",
"<A HREF=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</A> -> $strediting");
if (!$form->name or !$form->type or !$form->summary) {
error(get_string("filloutallfields"), $HTTP_REFERER);
}
print_simple_box_start("center", "", "$THEME->cellheading");
if ($usehtmleditor and $form->type == HTML) {
$onsubmit = "onsubmit=\"copyrichtext(theform.alltext);\"";
}
echo "<FORM NAME=theform METHOD=post $onsubmit ACTION=\"$form->destination\">";
echo "<TABLE CELLPADDING=5 ALIGN=CENTER>";
echo "<TR><TD ALIGN=right NOWRAP><P><B>$strname:</B></P></TD><TD><P>$form->name</P></A></TD></TR>";
$strtypename = $RESOURCE_TYPE["$form->type"];
$strexample = get_string("example", "resource");
switch ($form->type) {
case REFERENCE:
$strexamplereference = get_string("examplereference", "resource");
?>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strtypename?>:</B></P>
</TD>
<TD>
<TEXTAREA NAME="reference" ROWS=3 COLS=50 WRAP="virtual"><? p($form->reference) ?></TEXTAREA>
</TD>
</TR>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B>(<?=$strexample?>)</B></P>
</TD>
<TD>
<P><?=$strexamplereference?></P>
</TD>
</TR>
<?
break;
case WEBPAGE:
case WEBLINK:
$strexampleurl = get_string("exampleurl", "resource");
?>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strtypename?>:</B></P>
</TD>
<TD>
<INPUT NAME="reference" SIZE=60 VALUE="<? p($form->reference) ?>">
</TD>
</TR>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B>(<?=$strexample?>)</B></P>
</TD>
<TD>
<P><?=$strexampleurl?>
</P>
</TD>
</TR>
<?
break;
case UPLOADEDFILE:
$strfilename = get_string("filename", "resource");
$strnote = get_string("note", "resource");
$strnotefile = get_string("notefile", "resource", "$CFG->wwwroot/files/index.php?id=$course->id");
?>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strfilename?>:</B></P>
</TD>
<TD>
<?
$rootdir = $CFG->dataroot."/".$course->id;
$coursedirs = get_directory_list($rootdir, $CFG->moddata);
foreach ($coursedirs as $dir) {
$options["$dir"] = $dir;
}
choose_from_menu ($options, "reference", $form->reference);
?>
</TD>
</TR>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strnote?>:</B></P>
</TD>
<TD>
<P><?=$strnotefile?>
</P>
</TD>
</TR>
<?
break;
case PLAINTEXT:
$strfulltext = get_string("fulltext", "resource");
?>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strfulltext?>:</B></P>
<BR><? helpbutton("text", get_string("helptext")) ?>
</TD>
<TD>
<TEXTAREA NAME="alltext" ROWS=20 COLS=50 WRAP="virtual"><? p($form->alltext) ?></TEXTAREA>
</TD>
</TR>
<?
break;
case HTML:
$strhtmlfragment = get_string("htmlfragment", "resource");
?>
<TR VALIGN=top>
<TD ALIGN=right NOWRAP>
<P><B><?=$strhtmlfragment?>:</B></P>
<? if ($usehtmleditor) { ?>
<BR><? helpbutton("richtext", get_string("helprichtext")) ?>
<? } else { ?>
<BR><? helpbutton("html", get_string("helphtml")) ?>
<? } ?>
</TD>
<TD>
<? print_textarea($usehtmleditor, 20, 50, 680, 400, "alltext", $form->alltext); ?>
</TD>
</TR>
<?
break;
default:
error(get_string("notypechosen", "resource"), $HTTP_REFERER);
break;
}
?>
</TABLE>
<input type="hidden" name=summary value="<? p($form->summary) ?>">
<input type="hidden" name=type value="<? p($form->type) ?>">
<input type="hidden" name=name value="<? p($form->name) ?>">
<input type="hidden" name=course value="<? p($form->course) ?>">
<input type="hidden" name=coursemodule value="<? p($form->coursemodule) ?>">
<input type="hidden" name=section value="<? p($form->section) ?>">
<input type="hidden" name=module value="<? p($form->module) ?>">
<input type="hidden" name=modulename value="<? p($form->modulename) ?>">
<input type="hidden" name=instance value="<? p($form->instance) ?>">
<input type="hidden" name=mode value="<? p($form->mode) ?>">
<CENTER>
<input type="submit" value="<? print_string("savechanges") ?>">
<input type="submit" name=cancel value="<? print_string("cancel") ?>">
</CENTER>
</FORM>
<?
if ($usehtmleditor) {
print_richedit_javascript("theform", "alltext", "yes");
}
print_simple_box_end();
print_footer($course);
} else {
error("This script was called incorrectly");
}
?>