Permalink
Browse files

OK, for bug fixes this is a pretty big checkin!! :-/

I finally was able to see the HTML Editor bug in IE/XP that everyone
was talking about, and it's a very serious bug as it makes Moodle 1.3
almost unusable for these people.  :-(  :-(

So, I eventually found out that the problem is that the Javascript that
attaches the editor has troubles when it is embedded within the table                                                   that course/mod.php puts around the mod.html forms in each module.
(Only in IE and only sometimes, mind you).

While testing I also had a good look at a long standing issue which is the
inconsistency of the mod.html forms when using the editor.

So, to fix both I decided to put the HTML editor calls OUTSIDE the mod.html
in the mod.php file.  This means that all modules get the HTML editor by default
on all text areas during activity module setup by default.

I've been running through this for the past few hours and it seems
pretty stable now and a lot more consistent, so I'm checking it in
as big fix towards the Moodle 1.3.1 we have to have.

Unfortunately it also means the API has changed a bit  ... I had to
update all the module dependencies to this exact version (or later).

Please test this "stable" version hard using the standard modules only
and I'll merge these changes over to the trunk in a day or so and update
all known third-party modules.
  • Loading branch information...
1 parent 507ee65 commit 031dd5f017bf7acbf6ff8bafc855ec257281fd1b moodler committed Jun 3, 2004
View
@@ -184,7 +184,7 @@
print_footer($course);
if ($usehtmleditor) {
- use_html_editor();
+ use_html_editor("summary");
}
exit;
@@ -58,7 +58,7 @@
print_simple_box_end();
if ($usehtmleditor) {
- use_html_editor();
+ use_html_editor("summary");
}
print_footer($course);
View
@@ -95,7 +95,7 @@
include('group-edit.html');
if ($usehtmleditor) {
- use_html_editor();
+ use_html_editor("description");
}
print_footer();
View
@@ -527,13 +527,23 @@
if (file_exists($modform)) {
+ if ($usehtmleditor = can_use_html_editor()) {
+ $defaultformat = FORMAT_HTML;
+ } else {
+ $defaultformat = FORMAT_MOODLE;
+ }
+
$icon = "<img align=absmiddle height=16 width=16 src=\"$CFG->modpixpath/$module->name/icon.gif\">&nbsp;";
print_heading_with_help($pageheading, "mods", $module->name, $icon);
print_simple_box_start("center", "", "$THEME->cellheading");
include_once($modform);
print_simple_box_end();
+ if ($usehtmleditor and empty($nohtmleditorneeded)) {
+ use_html_editor();
+ }
+
} else {
notice("This module cannot be added to this course yet! (No file found at: $modform)", "$CFG->wwwroot/course/view.php?id=$course->id");
}
View
@@ -1649,11 +1649,11 @@ function use_html_editor($name="") {
echo "<script language=\"javascript\" type=\"text/javascript\" defer=\"1\">\n";
if (empty($name)) {
- echo "HTMLArea.replaceAll();";
+ echo "HTMLArea.replaceAll();\n";
} else {
- echo "HTMLArea.replace('$name')";
+ echo "HTMLArea.replace('$name');\n";
}
- echo "</script>";
+ echo "</script>\n";
}
@@ -1,9 +1,4 @@
<?php
- if ($usehtmleditor = can_use_richtext_editor()) {
- $defaultformat = FORMAT_HTML;
- } else {
- $defaultformat = FORMAT_MOODLE;
- }
if (empty($form->name)) {
$form->name = "";
}
@@ -30,15 +25,15 @@
}
?>
-<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
-<table cellpadding=5>
-<tr valign=top>
+<form name="form" method="post" action="mod.php">
+<table cellpadding="5">
+<tr valign="top">
<td align=right><p><b><?php print_string("assignmentname", "assignment") ?>:</b></p></td>
<td>
<input type="text" name="name" size=60 value="<?php p($form->name) ?>">
</td>
</tr>
-<tr valign=top>
+<tr valign="top">
<td align=right><p><b><?php print_string("description", "assignment") ?>:</b></p>
<font size="1">
<?php
@@ -59,23 +54,27 @@
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "description", $form->description);
- echo "<p align=right>";
- helpbutton("textformat", get_string("formattexttype"));
- print_string("formattexttype");
- echo ":&nbsp;";
- if (!$form->format) {
- $form->format = $defaultformat;
+ if ($usehtmleditor) {
+ echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
+ } else {
+ echo '<p align="right">';
+ helpbutton("textformat", get_string("formattexttype"));
+ print_string("formattexttype");
+ echo ':&nbsp;';
+ if (!$form->format) {
+ $form->format = $defaultformat;
+ }
+ choose_from_menu(format_text_menu(), "format", $form->format, "");
+ echo '</p>';
}
- choose_from_menu(format_text_menu(), "format", $form->format, "");
- echo "</p>";
?>
</td>
</tr>
-<tr valign=top>
+<tr valign="top">
<td align=right><p><b><?php print_string("assignmenttype", "assignment") ?>:</b></p></td>
<td>
<?php
- require("$CFG->dirroot/mod/assignment/lib.php");
+ require_once("$CFG->dirroot/mod/assignment/lib.php");
asort($ASSIGNMENT_TYPE);
choose_from_menu($ASSIGNMENT_TYPE, "type", $form->type, "");
helpbutton("assignmenttype", get_string("assignmenttype", "assignment"), "assignment");
@@ -119,21 +118,14 @@
</table>
<br />
<center>
-<input type="hidden" name=course value="<?php p($form->course) ?>">
-<input type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>">
-<input type="hidden" name=section value="<?php p($form->section) ?>">
-<input type="hidden" name=module value="<?php p($form->module) ?>">
-<input type="hidden" name=modulename value="<?php p($form->modulename) ?>">
-<input type="hidden" name=instance value="<?php p($form->instance) ?>">
-<input type="hidden" name=mode value="<?php p($form->mode) ?>">
-<input type="submit" value="<?php print_string("savechanges") ?>">
-<input type="submit" name=cancel value="<?php print_string("cancel") ?>">
+<input type="hidden" name=course value="<?php p($form->course) ?>" />
+<input type="hidden" name=coursemodule value="<?php p($form->coursemodule) ?>" />
+<input type="hidden" name=section value="<?php p($form->section) ?>" />
+<input type="hidden" name=module value="<?php p($form->module) ?>" />
+<input type="hidden" name=modulename value="<?php p($form->modulename) ?>" />
+<input type="hidden" name=instance value="<?php p($form->instance) ?>" />
+<input type="hidden" name=mode value="<?php p($form->mode) ?>" />
+<input type="submit" value="<?php print_string("savechanges") ?>" />
+<input type="submit" name=cancel value="<?php print_string("cancel") ?>" />
</center>
</form>
-
-<?php
- if ($usehtmleditor) {
- print_richedit_javascript("form", "description", "yes");
- }
-?>
-
@@ -6,7 +6,7 @@
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004040100;
-$module->requires = 2004013101; // Requires this Moodle version
+$module->requires = 2004052501; // Requires this Moodle version
$module->cron = 60;
?>
@@ -40,10 +40,11 @@ function attendance_add_instance($attendance) {
$attendance->day = make_timestamp($attendance->theyear,
$attendance->themonth, $attendance->theday);
}
+ $attendance->notes = $attendance->name;
$attendance->name=userdate($attendance->day, get_string("strftimedate"));
- if (isset($attendance->notes)) {
- $attendance->name = $attendance->name . " - " . $attendance->notes;
- }
+ if ($attendance->notes) {
+ $attendance->name = $attendance->name . " - " . $attendance->notes;
+ }
$attendance->edited = 0;
if ($attendance->dynsection) {
if ($mod->course) {
@@ -78,10 +79,10 @@ function attendance_update_instance($attendance) {
$attendance->day = make_timestamp($attendance->theyear,
$attendance->themonth, $attendance->theday);
+ $attendance->notes = $attendance->name;
$attendance->name=userdate($attendance->day, get_string("strftimedate"));
if ($attendance->notes) {
- $attendance->name = $attendance->name . " - " .
- $attendance->notes;
+ $attendance->name = $attendance->name . " - " . $attendance->notes;
}
if ($attendance->dynsection) {
//get info about the course
@@ -4,6 +4,7 @@
<!-- RJJ I'm using inline CSS styles for some stuff in this page because I want to centralize -->
<!-- the logic and styles in a single directory -->
<?php @include_once("$CFG->dirroot/mod/attendance/lib.php");
+ $nohtmleditorneeded = true;
//require_once("lib.php")
// error_reporting(E_ALL);
@@ -20,8 +21,6 @@
?>
<FORM name="form" method="post" action="<?php echo $ME ?>">
<CENTER>
-<INPUT type="submit" value="<?php print_string("savechanges") ?>">
-<INPUT type="submit" name="cancel" value="<?php print_string("cancel") ?>">
<TABLE cellpadding=5>
<!-- <?php $options[0] = get_string("no"); $options[1] = get_string("yes"); ?> -->
@@ -30,9 +29,9 @@
<!-- <TD align=left><?php choose_from_menu($options, "roll", $form->roll, "") ?></td> -->
<!-- </tr> -->
<tr valign=top>
- <td align=right><p><b><?php print_string("notes", "attendance") ?>:</b></p></td>
+ <td align=right><p><b><?php print_string("name") ?>:</b></p></td>
<td colspan="3">
- <input type="text" name="notes" size=60 value="<?php p($form->notes)?>">
+ <input type="text" name="name" size=60 value="<?php p($form->notes)?>">
</td>
</tr>
@@ -6,7 +6,7 @@
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2004050301; // The current module version (Date: YYYYMMDDXX)
-$module->requires = 2004013101; // Requires this Moodle version
+$module->requires = 2004052501; // Requires this Moodle version
$module->cron = 3600; // Period for cron to check this module (secs)
?>
View
@@ -12,7 +12,7 @@
$form->studentlogs = 0;
}
?>
-<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
+<form name="form" method="post" action="mod.php">
<table cellpadding=5>
<tr>
<tr valign=top>
@@ -35,7 +35,7 @@
</font>
</td>
<td>
- <textarea name="intro" rows=4 cols=50 wrap="virtual"><?php p($form->intro) ?></textarea>
+ <?php print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro); ?>
</td>
</tr>
<tr valign=top>
@@ -6,7 +6,7 @@
/////////////////////////////////////////////////////////////////////////////////
$module->version = 2004043000; // The (date) version of this module
-$module->requires = 2004013101; // Requires this Moodle version
+$module->requires = 2004052501; // Requires this Moodle version
$module->cron = 300; // How often should cron check this module (seconds)?
?>
View
@@ -33,16 +33,8 @@
$form->showunanswered = 0;
}
- if ($usehtmleditor = can_use_richtext_editor()) {
- $defaultformat = FORMAT_HTML;
- $onsubmit = "onsubmit=\"copyrichtext(document.form.text);\"";
- } else {
- $defaultformat = FORMAT_MOODLE;
- $onsubmit = "";
- }
-
?>
-<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
+<form name="form" method="post" action="mod.php">
<table cellpadding=5>
@@ -74,15 +66,19 @@
<?php
print_textarea($usehtmleditor, 20, 60, 680, 400, "text", $form->text);
- echo "<p align=right>";
- helpbutton("textformat", get_string("formattexttype"));
- print_string("formattexttype");
- echo ":&nbsp;";
- if (!$form->format) {
- $form->format = $defaultformat;
+ if ($usehtmleditor) {
+ echo '<input type="hidden" name="format" value="'.FORMAT_HTML.'" />';
+ } else {
+ echo "<p align=right>";
+ helpbutton("textformat", get_string("formattexttype"));
+ print_string("formattexttype");
+ echo ":&nbsp;";
+ if (!$form->format) {
+ $form->format = $defaultformat;
+ }
+ choose_from_menu(format_text_menu(), "format", $form->format, "");
+ echo "</p>";
}
- choose_from_menu(format_text_menu(), "format", $form->format, "");
- echo "</p>";
?>
</td>
</tr>
@@ -167,9 +163,3 @@
<input type="submit" name=cancel value="<?php print_string("cancel") ?>">
</center>
</form>
-
-<?php
- if ($usehtmleditor) {
- print_richedit_javascript("form", "text", "yes");
- }
-?>
@@ -6,7 +6,7 @@
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004021700;
-$module->requires = 2004013101; // Requires this Moodle version
+$module->requires = 2004052501; // Requires this Moodle version
$module->cron = 0;
?>
View
@@ -1,13 +1,4 @@
<?php
- // set the defaults...
- if ($usehtmleditor = can_use_richtext_editor()) {
- $defaultformat = FORMAT_HTML;
- $onsubmit = "onsubmit=\"copyrichtext(document.form.description);\"";
- } else {
- $defaultformat = FORMAT_MOODLE;
- $onsubmit = "";
- }
- // ...and fill the form if needed
if (!isset($form->name)) {
$form->name = "";
}
@@ -29,7 +20,7 @@
print_heading_with_help(get_string("furtherinformation", "dialogue"), "info", "dialogue");
?>
-<form name="form" method="post" <?php echo $onsubmit ?> action="mod.php">
+<form name="form" method="post" action="mod.php">
<table cellpadding=5>
<tr valign=top>
<td align=right><p><b><?php print_string("dialoguename", "dialogue") ?>:</b></p></td>
@@ -50,7 +41,7 @@
</TD>
<td>
- <textarea name="intro" rows=15 cols=30 wrap="virtual"><?php p($form->intro) ?></textarea>
+ <?php print_textarea($usehtmleditor, 20, 50, 680, 400, "intro", $form->intro); ?>
</td>
</tr>
<tr valign=top>
@@ -6,7 +6,7 @@
////////////////////////////////////////////////////////////////////////////////
$module->version = 2004013101;
-$module->requires = 2004013101; // Requires this Moodle version
+$module->requires = 2004052501; // Requires this Moodle version
$module->cron = 60;
?>
@@ -22,6 +22,8 @@
if (empty($form->deadline)) {
$form->deadline = "";
}
+
+ $nohtmleditorneeded = true;
?>
<form name="form" method="post" action="mod.php">
@@ -49,7 +51,7 @@
$grades[$i] = $i;
}
choose_from_menu($grades, "grade", "$form->grade", "");
- helpbutton("grade", get_string("maximumgrade", "exercise"), "exercise");
+ helpbutton("grade", get_string("maximumgrade", "exercise"), "exercise");
?>
</td>
</tr>
@@ -83,7 +85,7 @@
$numbers[$i] = $i;
}
choose_from_menu($numbers, "nelements", "$form->nelements", "");
- helpbutton("nelements", get_string("numberofassessmentelements", "exercise"), "exercise");
+ helpbutton("nelements", get_string("numberofassessmentelements", "exercise"), "exercise");
?>
</td>
</tr>
Oops, something went wrong.

0 comments on commit 031dd5f

Please sign in to comment.