From 04fa59d0152681729224bb49ec327787d0eb14aa Mon Sep 17 00:00:00 2001 From: moodler Date: Thu, 26 Dec 2002 16:26:55 +0000 Subject: [PATCH] Use HTML editor for editing HTML files --- files/index.php | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/files/index.php b/files/index.php index 4d612143dc7..c1677501047 100644 --- a/files/index.php +++ b/files/index.php @@ -279,20 +279,31 @@ displaydir($wdir); } else { + $streditfile = get_string("edit", "", "$file"); $fileptr = fopen($basedir.$file, "r"); $contents = fread($fileptr, filesize($basedir.$file)); fclose($fileptr); - echo "

Editing $file:"; + if (mimeinfo("type", $file) == "text/html") { + if ($usehtmleditor = can_use_richtext_editor()) { + $onsubmit = "onsubmit=\"copyrichtext(document.form.text);\""; + } else { + $onsubmit = ""; + } + } else { + $usehtmleditor = false; + $onsubmit = ""; + } + + print_heading("$streditfile"); + echo "
"; - echo "
"; + echo ""; echo " "; echo " "; echo " "; echo " "; - echo ""; + print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents); echo "
"; echo " "; echo ""; @@ -304,6 +315,12 @@ echo " "; echo ""; echo "
"; + + if ($usehtmleditor) { + print_richedit_javascript("form", "text", "yes"); + } + + } html_footer(); break;