]> git.mjollnir.org Git - moodle.git/commitdiff
Dialogue entries now use the HTML editor.
authorrkingdon <rkingdon>
Wed, 23 Jun 2004 14:16:30 +0000 (14:16 +0000)
committerrkingdon <rkingdon>
Wed, 23 Jun 2004 14:16:30 +0000 (14:16 +0000)
mod/dialogue/dialogues.php
mod/dialogue/locallib.php
mod/dialogue/view.php

index df8d4816b3ce883d12e6c9930c0feb632dfa4609..f7d29b8383a34133cfabc783748857341caa3658 100644 (file)
         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> ->";
index 6be792ab15bd2296401b857aaa695aef837a164f..56d3fdb7dc95dd8396afe11a7ac525cb3134b6ba 100644 (file)
@@ -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();
index 31d8bf136f3407f3e1b82111460211317ce220c2..9cf1c65585667286891bd9f91f4ec1fb10032a45 100644 (file)
         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> ->";
     }
                                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";