Permalink
Browse files

Dialogue entries now use the HTML editor.

  • Loading branch information...
1 parent b1bd2cf commit 352ab98fa0d850cfcf05db06acd34a8dadcf8098 rkingdon committed Jun 23, 2004
Showing with 28 additions and 35 deletions.
  1. +3 −2 mod/dialogue/dialogues.php
  2. +18 −25 mod/dialogue/locallib.php
  3. +7 −8 mod/dialogue/view.php
@@ -28,14 +28,15 @@
error("Course is misconfigured");
}
- require_login($course->id);
-
if (! $dialogue = get_record("dialogue", "id", $cm->instance)) {
error("Course module dialogue is incorrect");
}
require_login($course->id);
+ // set up some general variables
+ $usehtmleditor = can_use_html_editor();
+
$navigation = "";
if ($course->category) {
$navigation = "<A HREF=\"../../course/view.php?id=$course->id\">$course->shortname</A> ->";
@@ -338,11 +338,12 @@ function dialogue_list_conversations_self($dialogue) {
if (! $cm = get_coursemodule_from_instance("dialogue", $dialogue->id, $course->id)) {
error("Course Module ID was incorrect");
}
-
+
+ // set up some general variables
+ $usehtmleditor = can_use_html_editor();
+
$timenow = time();
$showbutton = false;
- $showemoticon = false; // never show emoticons for now - need to close or reload the popup
- // window to get the focus into the correct textarea on the second time round
echo "<form name=\"replies\" method=\"post\" action=\"dialogues.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"insertentries\">\n";
@@ -395,7 +396,8 @@ function dialogue_list_conversations_self($dialogue) {
}
echo "<div></td></tr>";
- if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id", "id")) {
+ if ($entries = get_records_select("dialogue_entries", "conversationid = $conversation->id",
+ "id")) {
foreach ($entries as $entry) {
if ($entry->userid == $USER->id) {
echo "<tr><td colspan=\"2\" bgcolor=\"#FFFFFF\">\n";
@@ -424,23 +426,19 @@ function dialogue_list_conversations_self($dialogue) {
echo "<tr><td valign=\"top\" align=\"right\">\n";
helpbutton("writing", get_string("helpwriting"), "dialogue", true, true);
echo "<br />";
- if ($showemoticon) {
- emoticonhelpbutton("replies", "reply$conversation->id");
- $showemoticon = false;
- }
echo "</td><td>\n";
- // use a cumbersome name on the textarea as the emoticonhelp doesn't like an "array" name
- echo "<textarea name=\"reply$conversation->id\" rows=\"5\" cols=\"60\" wrap=\"virtual\">";
- echo "</textarea>\n";
+ // use a cumbersome name on the textarea is just historical :-)
+ print_textarea($usehtmleditor, 20, 75, 630, 300, "reply$conversation->id");
echo "</td></tr>";
echo "</table></center><br />\n";
}
print_simple_box_end();
- if ($showbutton) {
- echo "<hr />\n";
- echo "<br /><input type=\"submit\" value=\"".get_string("addmynewentries", "dialogue")."\">\n";
- }
- echo "</form>\n";
+ use_html_editor();
+ if ($showbutton) {
+ echo "<hr />\n";
+ echo "<br /><input type=\"submit\" value=\"".get_string("addmynewentries", "dialogue")."\">\n";
+ }
+ echo "</form>\n";
}
}
@@ -459,8 +457,6 @@ function dialogue_print_conversation($dialogue, $conversation) {
$timenow = time();
$showbutton = false;
- $showemoticon = false; // never show emoticons for now - need to close or reload the popup
- // window to get the focus into the correct textarea on the second time round
echo "<form name=\"replies\" method=\"post\" action=\"dialogues.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"insertentries\">\n";
@@ -520,14 +516,11 @@ function dialogue_print_conversation($dialogue, $conversation) {
echo "<tr><td valign=\"top\" align=\"right\">\n";
helpbutton("writing", get_string("helpwriting"), "dialogue", true, true);
echo "<br />";
- if ($showemoticon) {
- emoticonhelpbutton("replies", "reply$conversation->id");
- $showemoticon = false;
- }
echo "</td><td>\n";
- // use a cumbersome name on the textarea as the emoticonhelp doesn't like an "array" name
- echo "<textarea name=\"reply$conversation->id\" rows=\"5\" cols=\"60\" wrap=\"virtual\">";
- echo "</textarea>\n";
+ // use a cumbersome name on the textarea for historical reasons :-)
+ $usehtmleditor = can_use_html_editor();
+ print_textarea($usehtmleditor, 20, 75, 630, 300, "reply$conversation->id");
+ use_html_editor();
echo "</td></tr>";
echo "</table></center><br />\n";
print_simple_box_end();
View
@@ -14,18 +14,21 @@
error("Course is misconfigured");
}
- require_login($course->id);
-
if (! $dialogue = get_record("dialogue", "id", $cm->instance)) {
error("Course module is incorrect");
}
+ require_login($course->id);
+
add_to_log($course->id, "dialogue", "view", "view.php?id=$cm->id", $dialogue->id, $cm->id);
if (! $cw = get_record("course_sections", "id", $cm->section)) {
error("Course module is incorrect");
}
+ // set up some general variables
+ $usehtmleditor = can_use_html_editor();
+
if ($course->category) {
$navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->";
}
@@ -133,13 +136,9 @@
echo "<tr><td valign=\"top\" align=\"right\">\n";
helpbutton("writing", get_string("helpwriting"), "dialogue", true, true);
echo "<br />";
- $showemoticon = false;
- if ($showemoticon) {
- emoticonhelpbutton("replies", "firstentry");
- }
echo "</td><td>\n";
- echo "<textarea name=\"firstentry\" rows=\"5\" cols=\"60\" wrap=\"virtual\">";
- echo "</textarea>\n";
+ print_textarea($usehtmleditor, 20, 75, 630, 300, "firstentry");
+ use_html_editor();
echo "</td></tr>";
echo "<tr><td colspan=\"2\" align=\"center\"><input type=\"submit\" value=\"".
get_string("opendialogue","dialogue")."\"></td></tr>\n";

0 comments on commit 352ab98

Please sign in to comment.