// eg $CFG->textfilter1 = "mod/glossary/dynalink.php";\r
// $CFG->textfilter2 = "library/librarylib.php";\r
\r
+//=========================================================================\r
+// 8. HTML EDITOR (temporary setting in development version only)\r
+//=========================================================================\r
+// We are currently moving to a new HTML editor that works on \r
+// Mozilla browsers as well as Internet Explorer. To enable this \r
+// editor, uncomment the following line.\r
+//\r
+// $CFG->useneweditor = true;\r
+\r
\r
//=========================================================================\r
// ALL DONE! To continue installation, visit your main page with a browser\r
--- /dev/null
+<?php // $Id$
+ // Strings for the HTML editor
+
+$string['bold'] = "Bold";
+$string['italic'] = "Italic";
+$string['underline'] = "Underline";
+$string['strikethrough'] = "Strikethrough";
+$string['subscript'] = "Subscript";
+$string['superscript'] = "Superscript";
+$string['justifyleft'] = "Justify Left";
+$string['justifycenter'] = "Justify Center";
+$string['justifyright'] = "Justify Right";
+$string['justifyfull'] = "Justify Full";
+$string['orderedlist'] = "Ordered List";
+$string['unorderedlist'] = "Bulleted List";
+$string['outdent'] = "Decrease Indent";
+$string['indent'] = "Increase Indent";
+$string['forecolor'] = "Font Color";
+$string['hilitecolor'] = "Background Color";
+$string['horizontalrule'] = "Horizontal Rule";
+$string['createlink'] = "Insert Web Link";
+$string['insertimage'] = "Insert Image";
+$string['inserttable'] = "Insert Table";
+$string['htmlmode'] = "Toggle HTML Source";
+$string['popupeditor'] = "Enlarge Editor";
+$string['about'] = "About this editor";
+$string['showhelp'] = "Help using editor";
+$string['textindicator'] = "Current style";
+$string['undo'] = "Undo your last action";
+$string['redo'] = "Redo your last action";
+$string['cut'] = "Cut selection";
+$string['copy'] = "Copy selection";
+$string['paste'] = "Paste from clipboard";
+$string['ok'] = "OK";
+$string['cancel'] = "Cancel";
+$string['browse'] = "Browse";
+$string['imageurl'] = "Image URL";
+$string['preview'] = "Preview";
+$string['alternatetext'] = "Alternate text";
+$string['alignment'] = "Alignment";
+$string['layout'] = "Layout";
+$string['spacing'] = "Spacing";
+$string['borderthickness'] = "Border thickness";
+$string['horizontal'] = "Horizontal";
+$string['vertical'] = "Vertical";
+$string['notset'] = "Not Set";
+$string['left'] = "Left";
+$string['right'] = "Right";
+$string['texttop'] = "Texttop";
+$string['baseline'] = "Baseline";
+$string['absbottom'] = "Absbottom";
+$string['bottom'] = "Bottom";
+$string['middle'] = "Middle";
+$string['top'] = "Top";
+$string['absmiddle'] = "Absmiddle";
+$string['rows'] = "Rows";
+$string['cols'] = "Cols";
+$string['width'] = "Width";
+$string['percent'] = "Percent";
+$string['pixels'] = "Pixels";
+$string['cellspacing'] = "Cellspacing";
+$string['cellpadding'] = "Cellpadding";
+$string['close'] = "Close";
+$string['chooseicon'] = "Choose an icon to insert";
+$string['choosechar'] = "Choose Character";
+$string['insertsmile'] = "Insert smile";
+$string['insertchar'] = "Insert Special Character";
+$string['Path'] = "Path";
+$string['TEXT_MODE'] = "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWIG."
+?>
$string['helppicture'] = "How to upload a picture";
$string['helpreading'] = "Read carefully";
$string['helptext'] = "How to write text";
-$string['helprichtext'] = "About Richtext editor";
+$string['helprichtext'] = "About the HTML editor";
$string['helpsummaries'] = "About these summaries";
$string['helpquestions'] = "Ask good questions";
$string['helpwiki'] = "How to write Wiki text";
$string['hour'] = "hour";
$string['hours'] = "hours";
$string['howtomakethemes'] = "How to make new themes";
-$string['htmleditor'] = "Use Richtext HTML editor (IE only, 5.5 or later)";
-$string['htmleditoravailable'] = "The Richtext editor is available";
-$string['htmleditordisabled'] = "You have disabled the Richtext editor in your user profile";
-$string['htmleditordisabledadmin'] = "The administrator has disabled the Richtext editor on this site";
-$string['htmleditordisabledbrowser'] = "The Richtext editor is unavailable because you are not using Internet Explorer 5.5 or better";
+$string['htmleditor'] = "Use HTML editor (some browsers only)";
+$string['htmleditoravailable'] = "The HTML editor is available";
+$string['htmleditordisabled'] = "You have disabled the HTML editor in your user profile";
+$string['htmleditordisabledadmin'] = "The administrator has disabled the HTML editor on this site";
+$string['htmleditordisabledbrowser'] = "The HTML editor is unavailable because your web browser is not compatible";
$string['htmlformat'] = "Pretty HTML format";
$string['icqnumber'] = "ICQ number";
$string['idnumber'] = "ID number";
--- /dev/null
+<?PHP // $Id$
+ // htmlarea.php - created with Moodle 1.2 development (2003100900)
+
+
+$string['Path'] = "Polku";
+$string['TEXT_MODE'] = "Olet tekstitilassa. Käytä [<>] painiketta palataksesi takaisin WYSIWIG -tilaan.";
+$string['about'] = "Tietoja editorista";
+$string['absbottom'] = "Absbottom";
+$string['absmiddle'] = "Absmiddle";
+$string['alignment'] = "Tasaus";
+$string['alternatetext'] = "Oletusteksti";
+$string['baseline'] = "Baseline";
+$string['bold'] = "Lihavoitu";
+$string['borderthickness'] = "Reunan paksuus";
+$string['bottom'] = "Alas";
+$string['browse'] = "Selaa";
+$string['cancel'] = "Peruuta";
+$string['cellpadding'] = "Solun täyttö";
+$string['cellspacing'] = "Solujen väli";
+$string['choosechar'] = "Valitse merkki";
+$string['chooseicon'] = "Valitse liitettävä hymiö";
+$string['close'] = "Sulje";
+$string['cols'] = "Solut";
+$string['copy'] = "Kopioi";
+$string['createlink'] = "Lisää linkki";
+$string['cut'] = "Leikkaa";
+$string['forecolor'] = "Tekstin väri";
+$string['hilitecolor'] = "Taustan väri";
+$string['horizontal'] = "Vaaka";
+$string['horizontalrule'] = "Vaakaviiva";
+$string['htmlmode'] = "Näytä HTML koodi";
+$string['imageurl'] = "Kuvan URL";
+$string['indent'] = "Lisää sisennystä";
+$string['insertchar'] = "Lisää merkki";
+$string['insertimage'] = "Lisää kuva";
+$string['insertsmile'] = "Lisää hymiö";
+$string['inserttable'] = "Lisää taulukko";
+$string['italic'] = "Kursivoitu";
+$string['justifycenter'] = "Keskitä";
+$string['justifyfull'] = "Tasaa molemmat reunat";
+$string['justifyleft'] = "Tasaa vasemmat reunat";
+$string['justifyright'] = "Tasaa oikeat reunat";
+$string['layout'] = "Ulkoasu";
+$string['left'] = "Vasen";
+$string['middle'] = "Middle";
+$string['notset'] = "Not Set";
+$string['ok'] = "OK";
+$string['orderedlist'] = "Numerointi";
+$string['outdent'] = "Vähennä sisennystä";
+$string['paste'] = "Liitä";
+$string['percent'] = "Prosenttia";
+$string['pixels'] = "Pikseliä";
+$string['popupeditor'] = "Suurenna editori";
+$string['preview'] = "Esikatsele";
+$string['redo'] = "Palauta viimeinen toiminto";
+$string['right'] = "Oikea";
+$string['rows'] = "Rivit";
+$string['showhelp'] = "Ohje";
+$string['spacing'] = "Välys";
+$string['strikethrough'] = "Yliviivattu";
+$string['subscript'] = "Alaindeksi";
+$string['superscript'] = "Ylädeksi";
+$string['textindicator'] = "Nykyinen tyyli";
+$string['texttop'] = "Texttop";
+$string['top'] = "Ylös";
+$string['underline'] = "Alleviivattu";
+$string['undo'] = "Peruuta viimeinen toiminto";
+$string['unorderedlist'] = "Luettelomerkit";
+$string['vertical'] = "Pysty";
+$string['width'] = "Leveys";
+
+?>
lang: "en",
tooltips: {
- bold: "<?php print(get_string("bold","htmlarea"));?>",
- italic: "<?php print(get_string("italic","htmlarea"));?>",
- underline: "<?php print(get_string("underline","htmlarea"));?>",
- strikethrough: "<?php print(get_string("strikethrough","htmlarea"));?>",
- subscript: "<?php print(get_string("subscript","htmlarea"));?>",
- superscript: "<?php print(get_string("superscript","htmlarea"));?>",
- justifyleft: "<?php print(get_string("justifyleft","htmlarea"));?>",
- justifycenter: "<?php print(get_string("justifycenter","htmlarea"));?>",
- justifyright: "<?php print(get_string("justifyright","htmlarea"));?>",
- justifyfull: "<?php print(get_string("justifyfull","htmlarea"));?>",
- insertorderedlist: "<?php print(get_string("orderedlist","htmlarea"));?>",
- insertunorderedlist: "<?php print(get_string("unorderedlist","htmlarea"));?>",
- outdent: "<?php print(get_string("outdent","htmlarea"));?>",
- indent: "<?php print(get_string("indent","htmlarea"));?>",
- forecolor: "<?php print(get_string("forecolor","htmlarea"));?>",
- hilitecolor: "<?php print(get_string("hilitecolor","htmlarea"));?>",
- inserthorizontalrule: "<?php print(get_string("horizontalrule","htmlarea"));?>",
- createlink: "<?php print(get_string("createlink","htmlarea"));?>",
- insertimage: "<?php print(get_string("insertimage","htmlarea"));?>",
- inserttable: "<?php print(get_string("inserttable","htmlarea"));?>",
- htmlmode: "<?php print(get_string("htmlmode","htmlarea"));?>",
- popupeditor: "<?php print(get_string("popupeditor","htmlarea"));?>",
- about: "<?php print(get_string("about","htmlarea"));?>",
- showhelp: "<?php print(get_string("showhelp","htmlarea"));?>",
- textindicator: "<?php print(get_string("textindicator","htmlarea"));?>",
- undo: "<?php print(get_string("undo","htmlarea"));?>",
- redo: "<?php print(get_string("redo","htmlarea"));?>",
- cut: "<?php print(get_string("cut","htmlarea"));?>",
- copy: "<?php print(get_string("copy","htmlarea"));?>",
- paste: "<?php print(get_string("paste","htmlarea"));?>",
- insertsmile: "<?php print(get_string("insertsmile","htmlarea"));?>",
- insertchar: "<?php print(get_string("insertchar","htmlarea"));?>"
+ bold: "<?php print(get_string("bold","editor"));?>",
+ italic: "<?php print(get_string("italic","editor"));?>",
+ underline: "<?php print(get_string("underline","editor"));?>",
+ strikethrough: "<?php print(get_string("strikethrough","editor"));?>",
+ subscript: "<?php print(get_string("subscript","editor"));?>",
+ superscript: "<?php print(get_string("superscript","editor"));?>",
+ justifyleft: "<?php print(get_string("justifyleft","editor"));?>",
+ justifycenter: "<?php print(get_string("justifycenter","editor"));?>",
+ justifyright: "<?php print(get_string("justifyright","editor"));?>",
+ justifyfull: "<?php print(get_string("justifyfull","editor"));?>",
+ insertorderedlist: "<?php print(get_string("orderedlist","editor"));?>",
+ insertunorderedlist: "<?php print(get_string("unorderedlist","editor"));?>",
+ outdent: "<?php print(get_string("outdent","editor"));?>",
+ indent: "<?php print(get_string("indent","editor"));?>",
+ forecolor: "<?php print(get_string("forecolor","editor"));?>",
+ hilitecolor: "<?php print(get_string("hilitecolor","editor"));?>",
+ inserthorizontalrule: "<?php print(get_string("horizontalrule","editor"));?>",
+ createlink: "<?php print(get_string("createlink","editor"));?>",
+ insertimage: "<?php print(get_string("insertimage","editor"));?>",
+ inserttable: "<?php print(get_string("inserttable","editor"));?>",
+ htmlmode: "<?php print(get_string("htmlmode","editor"));?>",
+ popupeditor: "<?php print(get_string("popupeditor","editor"));?>",
+ about: "<?php print(get_string("about","editor"));?>",
+ showhelp: "<?php print(get_string("showhelp","editor"));?>",
+ textindicator: "<?php print(get_string("textindicator","editor"));?>",
+ undo: "<?php print(get_string("undo","editor"));?>",
+ redo: "<?php print(get_string("redo","editor"));?>",
+ cut: "<?php print(get_string("cut","editor"));?>",
+ copy: "<?php print(get_string("copy","editor"));?>",
+ paste: "<?php print(get_string("paste","editor"));?>",
+ insertsmile: "<?php print(get_string("insertsmile","editor"));?>",
+ insertchar: "<?php print(get_string("insertchar","editor"));?>"
},
buttons: {
- "ok": "<?php print(get_string("ok","htmlarea"));?>",
- "cancel": "<?php print(get_string("cancel","htmlarea"));?>",
- "browse": "<?php print(get_string("browse","htmlarea"));?>"
+ "ok": "<?php print(get_string("ok","editor"));?>",
+ "cancel": "<?php print(get_string("cancel","editor"));?>",
+ "browse": "<?php print(get_string("browse","editor"));?>"
},
msg: {
- "Path": "<?php print(get_string("Path","htmlarea"));?>",
- "TEXT_MODE": "<?php print(get_string("TEXT_MODE","htmlarea"));?>"
+ "Path": "<?php print(get_string("Path","editor"));?>",
+ "TEXT_MODE": "<?php print(get_string("TEXT_MODE","editor"));?>"
}
};
/// Checks to see if is a browser matches the specified
/// brand and is equal or better version.
- if (empty($_SERVER["HTTP_USER_AGENT"])) {
- return false;
- }
- $string = explode(";", $_SERVER["HTTP_USER_AGENT"]);
- if (!isset($string[1])) {
- return false;
- }
- $string = explode(" ", trim($string[1]));
- if (!isset($string[0]) and !isset($string[1])) {
+ $agent = $_SERVER["HTTP_USER_AGENT"];
+
+ if (empty($agent)) {
return false;
}
- if ($string[0] == $brand and (float)$string[1] >= $version ) {
- return true;
+
+ switch ($brand) {
+
+ case "Gecko": /// Gecko based browsers
+
+ if (substr_count($agent, "Camino")) { // MacOS X Camino not supported.
+ return false;
+ }
+
+ // the proper string - Gecko/CCYYMMDD Vendor/Version
+ if (ereg("^([a-zA-Z]+)/([0-9]+\.[0-9]+) \((.*)\) (.*)$", $agent, $match)) {
+ if (ereg("^([Gecko]+)/([0-9]+)",$match[4], $reldate)) {
+ if ($reldate[2] > $version) {
+ return true;
+ }
+ }
+ }
+ break;
+
+
+ case "MSIE": /// Internet Explorer
+
+ $string = explode(";", $agent);
+ if (!isset($string[1])) {
+ return false;
+ }
+ $string = explode(" ", trim($string[1]));
+ if (!isset($string[0]) and !isset($string[1])) {
+ return false;
+ }
+ if ($string[0] == $brand and (float)$string[1] >= $version ) {
+ return true;
+ }
+ break;
+
}
+
return false;
}
+
function ini_get_bool($ini_get_arg) {
/// This function makes the return value of ini_get consistent if you are
/// setting server directives through the .htaccess file in apache.
}
function can_use_richtext_editor() {
-/// Is the richedit editor enabled?
+/// Is the HTML editor enabled? This depends on site and user
+/// settings, as well as the current browser being used.
+
global $USER, $CFG;
+
if (!empty($USER->htmleditor) and !empty($CFG->htmleditor)) {
- return check_browser_version("MSIE", 5.5);
+ if (check_browser_version("MSIE", 5.5)) {
+ return true;
+ } else if (check_browser_version("Gecko", 20030516) and !empty($CFG->useneweditor) ) {
+ return true;
+ }
}
return false;
}
function print_textarea($richedit, $rows, $cols, $width, $height, $name, $value="", $courseid=0) {
/// Prints a richtext field or a normal textarea
+
global $CFG, $THEME, $course;
if (empty($courseid)) {
}
if ($richedit) {
- $richediturl = "$CFG->wwwroot/lib/rte/richedit.html";
- if (!empty($courseid) and isteacher($courseid)) {
- $richediturl = "$CFG->wwwroot/lib/rte/richedit.php?id=$courseid";
- }
+ if (!empty($CFG->useneweditor)) { /// Use the new HTMLarea editor
- echo "<object id=\"richedit\" style=\"background-color: buttonface\"";
- echo " data=\"$richediturl\"";
- echo " width=\"$width\" height=\"$height\" ";
- echo " type=\"text/x-scriptlet\" VIEWASTEXT=\"true\"></object>\n";
- echo "<textarea style=\"display:none\" name=\"$name\" rows=\"1\" cols=\"1\">";
- p($value);
- echo "</textarea>\n";
+ if (!empty($courseid) and isteacher($courseid)) {
+ echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/lib/editor/htmlarea.php?id=$courseid\"></script>\n";
+ } else {
+ echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/lib/editor/htmlarea.php\"></script>\n";
+ }
+ echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/lib/editor/dialog.js\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/lib/editor/lang/en.php\"></script>\n";
+ echo "<script type=\"text/javascript\" src=\"$CFG->wwwroot/lib/editor/popupwin.js\"></script>\n";
+ echo "<style type=\"text/css\">@import url($CFG->wwwroot/lib/editor/htmlarea.css);</style>\n";
+ if ($rows < 20) {
+ $rows = 20; /// Minimum rows
+ }
+ if ($cols < 65) {
+ $cols = 65; /// Minimum columns
+ }
+ echo "<textarea id=\"TA\" name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=\"virtual\">";
+ p($value);
+ echo "</textarea>\n";
+
+ } else { /// Use the old Richtext editor
+ $richediturl = "$CFG->wwwroot/lib/rte/richedit.html";
+ if (!empty($courseid) and isteacher($courseid)) {
+ $richediturl = "$CFG->wwwroot/lib/rte/richedit.php?id=$courseid";
+ }
+
+ echo "<object id=\"richedit\" style=\"background-color: buttonface\"";
+ echo " data=\"$richediturl\"";
+ echo " width=\"$width\" height=\"$height\" ";
+ echo " type=\"text/x-scriptlet\" VIEWASTEXT=\"true\"></object>\n";
+ echo "<textarea style=\"display:none\" name=\"$name\" rows=\"1\" cols=\"1\">";
+ p($value);
+ echo "</textarea>\n";
+ }
} else {
echo "<textarea name=\"$name\" rows=\"$rows\" cols=\"$cols\" wrap=\"virtual\">";
p($value);
}
function print_richedit_javascript($form, $name, $source="no") {
- echo "<script language=\"javascript\" event=\"onload\" for=\"window\">\n";
- echo " document.richedit.options = \"history=no;source=$source\";";
- echo " document.richedit.docHtml = $form.$name.innerText;";
- echo "</script>";
+ global $CFG;
+
+ if (!empty($CFG->useneweditor)) { /// Use the new HTMLarea editor
+ echo "<script language=\"javascript\" type=\"text/javascript\" defer=\"1\">\n";
+ echo "var editor = null;\n";
+ echo "function initEditor() {\n";
+ echo " editor = new HTMLArea(\"TA\");\n";
+ echo " editor.generate();\n";
+ echo " return false;\n";
+ echo "}\n";
+ echo "initEditor();\n";
+ echo "</script>\n";
+
+ } else { /// Use the old Richtext editor
+ echo "<script language=\"javascript\" event=\"onload\" for=\"window\">\n";
+ echo " document.richedit.options = \"history=no;source=$source\";";
+ echo " document.richedit.docHtml = $form.$name.innerText;";
+ echo "</script>";
+ }
}
// Uses META tags to redirect the user, after printing a notice
if (empty($message)) {
- echo "<meta http-equiv=\"refresh\" content=\"$delay; url=$url\" />";
+ echo "<html><head><meta http-equiv=\"refresh\" content=\"$delay; url=$url\" /></head></html>";
} else {
if (empty($delay)) {
$delay = 3; // There's no point having a message with no delay
// database to determine whether upgrades should
// be performed (see lib/db/*.php)
-$version = 2003102700; // The current version is a date (YYYYMMDDXX)
+$version = 2003102900; // The current version is a date (YYYYMMDDXX)
$release = "1.2 development"; // User-friendly version number