--- /dev/null
+<?PHP // $Id$
+
+// Manage all uploaded files in a course file area
+
+// This file is a hack to files/index.php that removes
+// the headers and adds some controls so that images
+// can be selected within the Richtext editor.
+
+// All the Moodle-specific stuff is in this top section
+// Configuration and access control occurs here.
+// Must define: USER, basedir, baseweb, html_header and html_footer
+// USER is a persistent variable using sessions
+
+ require("../../config.php");
+ require("../../files/mimetypes.php");
+
+ require_variable($id);
+ optional_variable($file, "");
+ optional_variable($wdir, "");
+ optional_variable($action, "");
+ optional_variable($usecheckboxes, "");
+
+ if (! $course = get_record("course", "id", $id) ) {
+ error("That's an invalid course id");
+ }
+
+ require_login($course->id);
+
+ if (! isteacher($course->id) ) {
+ error("Only teachers can edit files");
+ }
+
+ function html_footer() {
+ echo "</td></tr></table></body></html>";
+ }
+
+ function html_header($course, $wdir, $formfield=""){
+
+ global $CFG;
+
+ if (! $site = get_site()) {
+ error("Invalid site!");
+ }
+
+ ?>
+ <html>
+ <head>
+ <title>coursefiles</title>
+ <script language="javscript" type="text/javascript">
+ <!--
+ function set_value(params) {
+ /// function's argument is an array containing necessary values
+ /// to export parent window (url,isize,itype,iwidth,iheight)
+ /// set values when user click's an image name.
+ var upper = window.parent;
+ var insimg = upper.document.getElementById('f_url');
+ try {
+ if(insimg != null) {
+ for(field in params) {
+ var value = params[field];
+ switch(field) {
+ case "url" : upper.document.getElementById('f_url').value = value;
+ upper.ipreview.location.replace('popups/preview.php?id='+ <?php print($course->id);?> +'&imageurl='+ value);
+ break;
+ case "isize" : upper.document.getElementById('isize').value = value; break;
+ case "itype" :
+ if(params[field].indexOf("image/gif") == -1 && params[field].indexOf("image/jpeg") == -1 && params[field].indexOf("image/png") == -1) {
+ alert("<?php print_string("notimage","editor");?>");
+ return false;
+ } else {
+ upper.document.getElementById('itype').value = value;
+ }
+ break;
+ case "iwidth": upper.document.getElementById('f_width').value = value; break;
+ case "iheight": upper.document.getElementById('f_height').value = value; break;
+ }
+ }
+ } else {
+ for(field in params) {
+ var value = params[field];
+ switch(field) {
+ case "url" : upper.document.getElementById('f_href').value = value; break;
+ case "imodified" : upper.document.getElementById('imodified').value = value; break;
+ case "isize" : upper.document.getElementById('isize').value = value; break;
+ case "itype" : upper.document.getElementById('itype').value = value; break;
+ }
+ }
+ }
+ } catch(e) {
+ alert("Something odd just occurred!!!");
+ }
+ return false;
+ }
+
+ function set_dir(strdir) {
+ // this function will be rewritten in near future - Janne -
+ if(window.parent.document.uploader != null) {
+ window.parent.document.uploader.wdir.value = strdir;
+ }
+ if(window.parent.document.cfolder != null) {
+ window.parent.document.cfolder.wdir.value = strdir;
+ window.parent.document.cfolder.name.value = "";
+ }
+ if(window.parent.document.irename != null) {
+ window.parent.document.irename.wdir.value = strdir;
+ }
+ }
+
+ function set_rename(strfile) {
+ if(window.parent.document.irename != null) {
+ window.parent.document.irename.file.value = strfile;
+ }
+ return true;
+ }
+
+ function reset_value() {
+ var upper = window.parent.document;
+ for(var i = 0; i < upper.forms.length; i++) {
+ var f = upper.forms[i];
+ for(var j = 0; j < f.elements.length; j++) {
+ var e = f.elements[j];
+ if(e.type != "submit" && e.type != "button" && e.type != "hidden") {
+ try {
+ e.value = "";
+ } catch (e) {
+ }
+ }
+ }
+ }
+
+ var ren = upper.getElementById('irename');
+ if(ren != null) {
+ upper.irename.file.value = "";
+ }
+ var prev = window.parent.ipreview;
+ if(prev != null) {
+ prev.location.replace('about:blank');
+ }
+ var uploader = window.parent.document.forms['uploader'];
+ if(uploader != null) {
+ uploader.reset();
+ }
+ set_dir('<?php print($_REQUEST['wdir']);?>');
+ return true;
+ }
+ -->
+ </script>
+ <style type="text/css">
+ <!--
+ body {
+ background-color: white;
+ margin-top: 2px;
+ margin-left: 4px;
+ margin-right: 4px;
+ }
+ body,p,table,td,input,select,a {
+ font-family: Tahoma, sans-serif;
+ font-size: 11px;
+ }
+ select {
+ position: absolute;
+ top: -20px;
+ left: 0px;
+ }
+ -->
+ </style>
+ </head>
+ <body onload="reset_value();">
+
+ <?php
+ }
+
+ if (! $basedir = make_upload_directory("$course->id")) {
+ error("The site administrator needs to fix the file permissions");
+ }
+
+ $baseweb = $CFG->wwwroot;
+
+// End of configuration and access control
+
+
+ $regexp="\\.\\.";
+ if (ereg( $regexp, $file, $regs )| ereg( $regexp, $wdir,$regs )) {
+ $message = "Error: Directories can not contain \"..\"";
+ $wdir = "/";
+ $action = "";
+ }
+
+ if (!$wdir) {
+ $wdir="/";
+ }
+
+ switch ($action) {
+
+ case "upload":
+ html_header($course, $wdir);
+
+ if (!empty($_FILES['userfile'])) {
+ $userfile = $_FILES['userfile'];
+ } else {
+ $save = false;
+ }
+ if (!empty($save)) {
+ if (!is_uploaded_file($userfile['tmp_name']) or $userfile['size'] == 0) {
+ notify(get_string("uploadnofilefound"));
+ } else {
+ $userfile_name = clean_filename($userfile['name']);
+ if ($userfile_name) {
+ $newfile = "$basedir$wdir/$userfile_name";
+ if (move_uploaded_file($userfile['tmp_name'], $newfile)) {
+ chmod($newfile, 0666);
+ $a = NULL;
+ $a->file = "$userfile_name (".$userfile['type'].")";
+ $a->directory = $wdir;
+ print_string("uploadedfileto", "", $a);
+ } else {
+ notify(get_string("uploadproblem", "", $userfile_name));
+ }
+ }
+ }
+ displaydir($wdir);
+
+ } else {
+ $upload_max_filesize = get_max_upload_file_size();
+ $filesize = display_size($upload_max_filesize);
+
+ $struploadafile = get_string("uploadafile");
+ $struploadthisfile = get_string("uploadthisfile");
+ $strmaxsize = get_string("maxsize", "", $filesize);
+ $strcancel = get_string("cancel");
+
+ echo "<P>$struploadafile ($strmaxsize) --> <B>$wdir</B>";
+ echo "<TABLE border=\"0\"><TR><TD COLSPAN=2>";
+ echo "<FORM ENCTYPE=\"multipart/form-data\" METHOD=\"post\" ACTION=\"".$_SERVER['PHP_SELF']."\">";
+ echo " <INPUT TYPE=hidden NAME=MAX_FILE_SIZE value=\"$upload_max_filesize\">";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=upload>";
+ echo " <INPUT NAME=\"userfile\" TYPE=\"file\" size=\"40\">";
+ echo " </TD><TR><TD align=\"right\">";
+ echo " <INPUT TYPE=submit NAME=save VALUE=\"$struploadthisfile\">";
+ echo "</FORM>";
+ echo "</TD><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=\"get\">";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"$strcancel\">";
+ echo "</FORM>";
+ echo "</TD></TR></TABLE>";
+ }
+ html_footer();
+ break;
+
+ case "delete":
+ if (!empty($confirm)) {
+ html_header($course, $wdir);
+ foreach ($USER->filelist as $file) {
+ $fullfile = $basedir.$file;
+ if (! fulldelete($fullfile)) {
+ echo "<BR>Error: Could not delete: $fullfile";
+ }
+ }
+ clearfilelist();
+ displaydir($wdir);
+ html_footer();
+
+ } else {
+ html_header($course, $wdir);
+ if (setfilelist($_POST)) {
+ echo "<p align=center>".get_string("deletecheckwarning").":</p>";
+ print_simple_box_start("center");
+ printfilelist($USER->filelist);
+ print_simple_box_end();
+ echo "<br />";
+ notice_yesno (get_string("deletecheckfiles"),
+ "".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&action=delete&confirm=1",
+ "".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&action=cancel");
+ } else {
+ displaydir($wdir);
+ }
+ html_footer();
+ }
+ break;
+
+ case "move":
+ html_header($course, $wdir);
+ if ($count = setfilelist($_POST)) {
+ $USER->fileop = $action;
+ $USER->filesource = $wdir;
+ echo "<p align=center>";
+ print_string("selectednowmove", "moodle", $count);
+ echo "</p>";
+ }
+ displaydir($wdir);
+ html_footer();
+ break;
+
+ case "paste":
+ html_header($course, $wdir);
+ if (isset($USER->fileop) and $USER->fileop == "move") {
+ foreach ($USER->filelist as $file) {
+ $shortfile = basename($file);
+ $oldfile = $basedir.$file;
+ $newfile = $basedir.$wdir."/".$shortfile;
+ if (!rename($oldfile, $newfile)) {
+ echo "<P>Error: $shortfile not moved";
+ }
+ }
+ }
+ clearfilelist();
+ displaydir($wdir);
+ html_footer();
+ break;
+
+ case "rename":
+ if (!empty($name)) {
+ html_header($course, $wdir);
+ $name = clean_filename($name);
+ if (file_exists($basedir.$wdir."/".$name)) {
+ echo "Error: $name already exists!";
+ } else if (!rename($basedir.$wdir."/".$oldname, $basedir.$wdir."/".$name)) {
+ echo "Error: could not rename $oldname to $name";
+ }
+ displaydir($wdir);
+
+ } else {
+ $strrename = get_string("rename");
+ $strcancel = get_string("cancel");
+ $strrenamefileto = get_string("renamefileto", "moodle", $file);
+ html_header($course, $wdir, "form.name");
+ echo "<P>$strrenamefileto:";
+ echo "<TABLE><TR><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=\"post\" NAME=\"form\">";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=rename>";
+ echo " <INPUT TYPE=hidden NAME=oldname VALUE=\"$file\">";
+ echo " <INPUT TYPE=text NAME=name SIZE=35 VALUE=\"$file\">";
+ echo " <INPUT TYPE=submit VALUE=\"$strrename\">";
+ echo "</FORM>";
+ echo "</TD><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"$strcancel\">";
+ echo "</FORM>";
+ echo "</TD></TR></TABLE>";
+ }
+ html_footer();
+ break;
+
+ case "mkdir":
+ if (!empty($name)) {
+ html_header($course, $wdir);
+ $name = clean_filename($name);
+ if (file_exists("$basedir$wdir/$name")) {
+ echo "Error: $name already exists!";
+ } else if (! make_upload_directory("$course->id/$wdir/$name")) {
+ echo "Error: could not create $name";
+ }
+ displaydir($wdir);
+
+ } else {
+ $strcreate = get_string("create");
+ $strcancel = get_string("cancel");
+ $strcreatefolder = get_string("createfolder", "moodle", $wdir);
+ html_header($course, $wdir, "form.name");
+ echo "<P>$strcreatefolder:";
+ echo "<TABLE><TR><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=post NAME=form>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=mkdir>";
+ echo " <INPUT TYPE=text NAME=name SIZE=35>";
+ echo " <INPUT TYPE=submit VALUE=\"$strcreate\">";
+ echo "</FORM>";
+ echo "</TD><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"$strcancel\">";
+ echo "</FORM>";
+ echo "</TD></TR></TABLE>";
+ }
+ html_footer();
+ break;
+
+ case "edit":
+ html_header($course, $wdir);
+ if (isset($text)) {
+ $fileptr = fopen($basedir.$file,"w");
+ fputs($fileptr, stripslashes($text));
+ fclose($fileptr);
+ displaydir($wdir);
+
+ } else {
+ $streditfile = get_string("edit", "", "<B>$file</B>");
+ $fileptr = fopen($basedir.$file, "r");
+ $contents = fread($fileptr, filesize($basedir.$file));
+ fclose($fileptr);
+
+ 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 "<TABLE><TR><TD COLSPAN=2>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=\"post\" NAME=\"form\" $onsubmit>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
+ echo " <INPUT TYPE=hidden NAME=file VALUE=\"$file\">";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=edit>";
+ print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents);
+ echo "</TD></TR><TR><TD>";
+ echo " <INPUT TYPE=submit VALUE=\"".get_string("savechanges")."\">";
+ echo "</FORM>";
+ echo "</TD><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"".get_string("cancel")."\">";
+ echo "</FORM>";
+ echo "</TD></TR></TABLE>";
+
+ if ($usehtmleditor) {
+ print_richedit_javascript("form", "text", "yes");
+ }
+
+
+ }
+ html_footer();
+ break;
+
+ case "zip":
+ if (!empty($name)) {
+ html_header($course, $wdir);
+ $name = clean_filename($name);
+ if (empty($CFG->zip)) { // Use built-in php-based zip function
+ $files = array();
+ foreach ($USER->filelist as $file) {
+ $files[] = "$basedir/$file";
+ }
+ include_once('../pclzip/pclzip.lib.php');
+ $archive = new PclZip("$basedir/$wdir/$name");
+ if (($list = $archive->create($files,'',"$basedir/$wdir/")) == 0) {
+ error($archive->errorInfo(true));
+ }
+ } else { // Use external zip program
+ $files = "";
+ foreach ($USER->filelist as $file) {
+ $files .= basename($file);
+ $files .= " ";
+ }
+ $command = "cd $basedir/$wdir ; $CFG->zip -r $name $files";
+ Exec($command);
+ }
+ clearfilelist();
+ displaydir($wdir);
+
+ } else {
+ html_header($course, $wdir, "form.name");
+
+ if (setfilelist($_POST)) {
+ echo "<P ALIGN=CENTER>".get_string("youareabouttocreatezip").":</P>";
+ print_simple_box_start("center");
+ printfilelist($USER->filelist);
+ print_simple_box_end();
+ echo "<BR>";
+ echo "<P ALIGN=CENTER>".get_string("whattocallzip");
+ echo "<TABLE><TR><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=post NAME=form>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=zip>";
+ echo " <INPUT TYPE=text NAME=name SIZE=35 VALUE=\"new.zip\">";
+ echo " <INPUT TYPE=submit VALUE=\"".get_string("createziparchive")."\">";
+ echo "</FORM>";
+ echo "</TD><TD>";
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"".get_string("cancel")."\">";
+ echo "</FORM>";
+ echo "</TD></TR></TABLE>";
+ } else {
+ displaydir($wdir);
+ clearfilelist();
+ }
+ }
+ html_footer();
+ break;
+
+ case "unzip":
+ html_header($course, $wdir);
+ if (!empty($file)) {
+ $strname = get_string("name");
+ $strsize = get_string("size");
+ $strmodified = get_string("modified");
+ $strstatus = get_string("status");
+ $strok = get_string("ok");
+ $strunpacking = get_string("unpacking", "", $file);
+
+ echo "<P ALIGN=CENTER>$strunpacking:</P>";
+
+ $file = basename($file);
+
+ if (empty($CFG->unzip)) { // Use built-in php-based unzip function
+ include_once('../pclzip/pclzip.lib.php');
+ $archive = new PclZip("$basedir/$wdir/$file");
+ if (!$list = $archive->extract("$basedir/$wdir")) {
+ error($archive->errorInfo(true));
+ } else { // print some output
+ echo "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\" width=640>";
+ echo "<tr><th align=left>$strname</th>";
+ echo "<th align=right>$strsize</th>";
+ echo "<th align=right>$strmodified</th>";
+ echo "<th align=right>$strstatus</th></tr>";
+ foreach ($list as $item) {
+ echo "<tr>";
+ $item['filename'] = str_replace("$basedir/$wdir/", "", $item['filename']);
+ print_cell("left", $item['filename']);
+ if (! $item['folder']) {
+ print_cell("right", display_size($item['size']));
+ } else {
+ echo "<td> </td>";
+ }
+ $filedate = userdate($item['mtime'], get_string("strftimedatetime"));
+ print_cell("right", $filedate);
+ print_cell("right", $item['status']);
+ echo "</tr>";
+ }
+ echo "</table>";
+ }
+
+ } else { // Use external unzip program
+ print_simple_box_start("center");
+ echo "<PRE>";
+ $command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
+ passthru($command);
+ echo "</PRE>";
+ print_simple_box_end();
+ }
+
+ echo "<CENTER><FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"$strok\">";
+ echo "</FORM>";
+ echo "</CENTER>";
+ } else {
+ displaydir($wdir);
+ }
+ html_footer();
+ break;
+
+ case "listzip":
+ html_header($course, $wdir);
+ if (!empty($file)) {
+ $strname = get_string("name");
+ $strsize = get_string("size");
+ $strmodified = get_string("modified");
+ $strok = get_string("ok");
+ $strlistfiles = get_string("listfiles", "", $file);
+
+ echo "<P ALIGN=CENTER>$strlistfiles:</P>";
+ $file = basename($file);
+
+ include_once('../pclzip/pclzip.lib.php');
+ $archive = new PclZip("$basedir/$wdir/$file");
+ if (!$list = $archive->listContent("$basedir/$wdir")) {
+ notify($archive->errorInfo(true));
+
+ } else {
+ echo "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\">";
+ echo "<tr><th align=left>$strname</th><th align=right>$strsize</th><th align=right>$strmodified</th></tr>";
+ foreach ($list as $item) {
+ echo "<tr>";
+ print_cell("left", $item['filename']);
+ if (! $item['folder']) {
+ print_cell("right", display_size($item['size']));
+ } else {
+ echo "<td> </td>";
+ }
+ $filedate = userdate($item['mtime'], get_string("strftimedatetime"));
+ print_cell("right", $filedate);
+ echo "</tr>";
+ }
+ echo "</table>";
+ }
+ echo "<br><center><form action=\"".$_SERVER['PHP_SELF']."\" method=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=$wdir>";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=cancel>";
+ echo " <INPUT TYPE=submit VALUE=\"$strok\">";
+ echo "</FORM>";
+ echo "</CENTER>";
+ } else {
+ displaydir($wdir);
+ }
+ html_footer();
+ break;
+
+ case "cancel";
+ clearfilelist();
+
+ default:
+ html_header($course, $wdir);
+ displaydir($wdir);
+ html_footer();
+ break;
+}
+
+
+/// FILE FUNCTIONS ///////////////////////////////////////////////////////////
+
+
+function fulldelete($location) {
+ if (is_dir($location)) {
+ $currdir = opendir($location);
+ while ($file = readdir($currdir)) {
+ if ($file <> ".." && $file <> ".") {
+ $fullfile = $location."/".$file;
+ if (is_dir($fullfile)) {
+ if (!fulldelete($fullfile)) {
+ return false;
+ }
+ } else {
+ if (!unlink($fullfile)) {
+ return false;
+ }
+ }
+ }
+ }
+ closedir($currdir);
+ if (! rmdir($location)) {
+ return false;
+ }
+
+ } else {
+ if (!unlink($location)) {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
+function setfilelist($VARS) {
+ global $USER;
+
+ $USER->filelist = array ();
+ $USER->fileop = "";
+
+ $count = 0;
+ foreach ($VARS as $key => $val) {
+ if (substr($key,0,4) == "file") {
+ $count++;
+ $USER->filelist[] = rawurldecode($val);
+ }
+ }
+ return $count;
+}
+
+function clearfilelist() {
+ global $USER;
+
+ $USER->filelist = array ();
+ $USER->fileop = "";
+}
+
+
+function printfilelist($filelist) {
+ global $basedir, $CFG;
+
+ foreach ($filelist as $file) {
+ if (is_dir($basedir.$file)) {
+ echo "<img src=\"$CFG->pixpath/f/folder.gif\" height=\"16\" width=\"16\"> $file<br />";
+ $subfilelist = array();
+ $currdir = opendir($basedir.$file);
+ while ($subfile = readdir($currdir)) {
+ if ($subfile <> ".." && $subfile <> ".") {
+ $subfilelist[] = $file."/".$subfile;
+ }
+ }
+ printfilelist($subfilelist);
+
+ } else {
+ $icon = mimeinfo("icon", $file);
+ echo "<img src=\"$CFG->pixpath/f/$icon\" height=\"16\" width=\"16\"> $file<br />";
+ }
+ }
+}
+
+
+function print_cell($alignment="center", $text=" ") {
+ echo "<TD ALIGN=\"$alignment\" NOWRAP>";
+ echo "$text";
+ echo "</TD>\n";
+}
+
+function get_image_size($filepath) {
+/// This function get's the image size
+
+ /// Check if file exists
+ if(!file_exists($filepath)) {
+ return false;
+ } else {
+ /// Get the mime type so it really an image.
+ if(mimeinfo("icon", basename($filepath)) != "image.gif") {
+ return false;
+ } else {
+ $array_size = getimagesize($filepath);
+ return $array_size;
+ }
+ }
+ unset($filepath,$array_size);
+}
+
+function displaydir ($wdir) {
+// $wdir == / or /a or /a/b/c/d etc
+
+ global $basedir;
+ global $usecheckboxes;
+ global $id;
+ global $USER, $CFG;
+
+ $fullpath = $basedir.$wdir;
+
+ $directory = opendir($fullpath); // Find all files
+ while ($file = readdir($directory)) {
+ if ($file == "." || $file == "..") {
+ continue;
+ }
+
+ if (is_dir($fullpath."/".$file)) {
+ $dirlist[] = $file;
+ } else {
+ $filelist[] = $file;
+ }
+ }
+ closedir($directory);
+
+ $strfile = get_string("file");
+ $strname = get_string("name");
+ $strsize = get_string("size");
+ $strmodified = get_string("modified");
+ $straction = get_string("action");
+ $strmakeafolder = get_string("makeafolder");
+ $struploadafile = get_string("uploadafile");
+ $strwithchosenfiles = get_string("withchosenfiles");
+ $strmovetoanotherfolder = get_string("movetoanotherfolder");
+ $strmovefilestohere = get_string("movefilestohere");
+ $strdeletecompletely = get_string("deletecompletely");
+ $strcreateziparchive = get_string("createziparchive");
+ $strrename = get_string("rename");
+ $stredit = get_string("edit");
+ $strunzip = get_string("unzip");
+ $strlist = get_string("list");
+ $strchoose = get_string("choose");
+
+
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=post NAME=dirform>";
+ echo "<TABLE BORDER=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">";
+ //echo "<TR>";
+ //echo "<TH WIDTH=5></TH>";
+ //echo "<TH ALIGN=left>$strname</TH>";
+ //echo "<TH ALIGN=center>$strsize</TH>";
+ //echo "<TH ALIGN=center>$strmodified</TH>";
+ //echo "<TH ALIGN=center>$straction</TH>";
+ //echo "</TR>\n";
+
+ if ($wdir == "/") {
+ $wdir = "";
+ } else {
+ $bdir = str_replace("/".basename($wdir),"",$wdir);
+ if($bdir == "/") {
+ $bdir = "";
+ }
+ print "<tr><td colspan=\"5\">";
+ print "<a href=\"".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$bdir&usecheckboxes=$usecheckboxes\" onclick=\"return reset_value();\">";
+ print "<img src=\"$CFG->wwwroot/lib/editor/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" ALT=\"Move up\">";
+ print "</a></td></tr>\n";
+ }
+
+ $count = 0;
+
+ if (!empty($dirlist)) {
+ asort($dirlist);
+ foreach ($dirlist as $dir) {
+
+ $count++;
+
+ $filename = $fullpath."/".$dir;
+ $fileurl = rawurlencode($wdir."/".$dir);
+ $filesafe = rawurlencode($dir);
+ $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
+
+ echo "<TR>";
+
+ if ($usecheckboxes) {
+ print_cell("center", "<input type=checkbox name=\"file$count\" value=\"$fileurl\" onclick=\"return set_rename('$filesafe');\">");
+ }
+ print_cell("left", "<a href=\"".basename($_server['php_self'])."?id=$id&wdir=$fileurl\" onclick=\"return reset_value();\"><img src=\"$CFG->pixpath/f/folder.gif\" height=16 width=16 border=0 alt=\"folder\"></a> <a href=\"".basename($_server['php_self'])."?id=$id&wdir=$fileurl&usecheckboxes=$usecheckboxes\" onclick=\"return reset_value();\">".htmlspecialchars($dir)."</a>");
+ print_cell("right", " ");
+ print_cell("right", $filedate);
+ //print_cell("right", "<A HREF=\"".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&file=$filesafe&action=rename\">$strrename</A>");
+
+ echo "</TR>";
+ }
+ }
+
+
+ if (!empty($filelist)) {
+ asort($filelist);
+ foreach ($filelist as $file) {
+
+ $icon = mimeinfo("icon", $file);
+ $imgtype = mimeinfo("type",$file);
+
+ $count++;
+ $filename = $fullpath."/".$file;
+ $fileurl = "$wdir/$file";
+ $filesafe = rawurlencode($file);
+ $fileurlsafe = rawurlencode($fileurl);
+ $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
+
+ $dimensions = get_image_size($filename);
+ if($dimensions) {
+ $imgwidth = $dimensions[0];
+ $imgheight = $dimensions[1];
+ } else {
+ $imgwidth = "Unknown";
+ $imgheight = "Unknown";
+ }
+ unset($dimensions);
+ echo "<tr>";
+
+ if ($usecheckboxes) {
+ print_cell("center", "<input type=\"checkbox\" name=\"file$count\" value=\"$fileurl\" onclick=\"return set_rename('$filesafe');\">");
+ }
+ echo "<td align=left nowrap>";
+ if ($CFG->slasharguments) {
+ $ffurl = "/file.php/$id$fileurl";
+ } else {
+ $ffurl = "/file.php?file=/$id$fileurl";
+ }
+ link_to_popup_window ($ffurl, "display",
+ "<img src=\"$CFG->pixpath/f/$icon\" height=16 width=16 border=0 align=\"absmiddle\" alt=\"$strfile\">",
+ 480, 640);
+ /*echo "<font size=\"-1\" face=\"Arial, Helvetica\">";
+ link_to_popup_window ($ffurl, "display",
+ htmlspecialchars($file),
+ 480, 640);*/
+ $file_size = filesize($filename);
+ ?>
+ <script language="javascript" type="text/javascript">
+ <!--
+ var a<?php echo $count; ?> = new Array();
+ a<?php echo $count; ?>['url'] = "<?php print($CFG->wwwroot.$ffurl);?>";
+ a<?php echo $count; ?>['isize'] = "<?php print(display_size($file_size));?>";
+ a<?php echo $count; ?>['itype'] = "<?php echo $imgtype; ?>";
+ a<?php echo $count; ?>['iwidth'] = "<?php echo $imgwidth; ?>";
+ a<?php echo $count; ?>['iheight'] = "<?php echo $imgheight; ?>";
+ a<?php echo $count; ?>['imodified'] = "<?php echo $filedate; ?>";
+
+ // -->
+ </script>
+ <?php
+ echo "<a onclick=\"return set_value(a".$count.")\" href=\"#\">$file</a>";
+ echo "<!-- </font> --></td>";
+
+
+ //print_cell("right", display_size($file_size));
+ /*if ($icon == "text.gif" || $icon == "html.gif") {
+ $edittext = "<a href=\"".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&file=$fileurl&action=edit\">$stredit</a>";
+ } else */
+ if ($icon == "zip.gif") {
+ $edittext = "<a href=\"".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&file=$fileurl&action=unzip\">$strunzip</a> ";
+ $edittext .= "<a href=\"".basename($_SERVER['PHP_SELF'])."?id=$id&wdir=$wdir&file=$fileurl&action=listzip\">$strlist</a> ";
+ } /*else if ($icon == "image.gif") {
+ $edittext = "<b><a onclick=\"return set_value('$CFG->wwwroot$ffurl','".display_size($file_size)."','$imgtype','$imgwidth','$imgheight')\" href=\"#\">$strchoose</a></b>";
+ } */else {
+ $edittext = " ";
+ }
+ print_cell("right", "$edittext ");
+ print_cell("right", $filedate);
+
+ echo "</TR>";
+ }
+ }
+ echo "</TABLE>";
+
+ if (empty($wdir)) {
+ $wdir = "/";
+ }
+
+ echo "<TABLE BORDER=0 cellspacing=2 cellpadding=2>";
+ echo "<TR><TD>";
+ echo "<INPUT TYPE=hidden NAME=id VALUE=\"$id\">";
+ echo "<INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\"> ";
+ $options = array (
+ "move" => "$strmovetoanotherfolder",
+ "delete" => "$strdeletecompletely",
+ "zip" => "$strcreateziparchive"
+ );
+ if (!empty($count)) {
+ choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()");
+ }
+
+ echo "</FORM>";
+ echo "<TD ALIGN=center>";
+ if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) {
+ echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=paste>";
+ echo " <INPUT TYPE=submit VALUE=\"$strmovefilestohere\">";
+ echo "</FORM>";
+ }
+ echo "<TD ALIGN=right>";
+ /* echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=mkdir>";
+ echo " <INPUT TYPE=submit VALUE=\"$strmakeafolder\">";
+ echo "</FORM>"; */
+ echo "</TD>";
+ echo "<TD ALIGN=right>";
+ /* echo "<FORM ACTION=\"".$_SERVER['PHP_SELF']."\" METHOD=get>";
+ echo " <INPUT TYPE=hidden NAME=id VALUE=$id>";
+ echo " <INPUT TYPE=hidden NAME=wdir VALUE=\"$wdir\">";
+ echo " <INPUT TYPE=hidden NAME=action VALUE=upload>";
+ echo " <INPUT TYPE=submit VALUE=\"$struploadafile\">";
+ echo "</FORM>"; */
+ echo "</TD></TR>";
+ echo "</TABLE>";
+
+}
+
+?>
}
clearfilelist();
displaydir($wdir);
-
+
} else {
html_header($course, $wdir, "form.name");
foreach ($filelist as $file) {
if (is_dir($basedir.$file)) {
- echo "<img src=\"$CFG->pixpath/f/folder.gif\" height=16 width=16> $file<br>";
+ echo "<IMG SRC=\"$CFG->pixpath/f/folder.gif\" HEIGHT=16 WIDTH=16> $file<BR>";
$subfilelist = array();
$currdir = opendir($basedir.$file);
while ($subfile = readdir($currdir)) {
} else {
$icon = mimeinfo("icon", $file);
- echo "<img src=\"$CFG->pixpath/f/$icon\" height=16 width=16> $file<br>";
+ echo "<IMG SRC=\"$CFG->pixpath/f/$icon\" HEIGHT=16 WIDTH=16> $file<BR>";
}
}
}
-// Though "Dialog" looks like an object, it isn't really an object. Instead
-// it's just namespace for protecting global symbols.
-
-function Dialog(url, action, init) {
- if (typeof init == "undefined") {
- init = window; // pass this window object by default
- }
- if (document.all) { // here we hope that Mozilla will never support document.all
- var value =
- showModalDialog(url, init,
- //window.open(url, '_blank',
- "resizable: no; help: no; status: no; scroll: no");
- if (action) {
- action(value);
- }
- } else {
- return Dialog._geckoOpenModal(url, action, init);
- }
-};
-
-Dialog._parentEvent = function(ev) {
- if (Dialog._modal && !Dialog._modal.closed) {
- Dialog._modal.focus();
- // we get here in Mozilla only, anyway, so we can safely use
- // the DOM version.
- ev.preventDefault();
- ev.stopPropagation();
- }
-};
-
-// should be a function, the return handler of the currently opened dialog.
-Dialog._return = null;
-
-// constant, the currently opened dialog
-Dialog._modal = null;
-
-// the dialog will read it's args from this variable
-Dialog._arguments = null;
-
-Dialog._geckoOpenModal = function(url, action, init) {
- var dlg = window.open(url, "ha_dialog",
- "toolbar=no,menubar=no,personalbar=no,width=10,height=10," +
- "scrollbars=no,resizable=no");
- Dialog._modal = dlg;
- Dialog._arguments = init;
-
- // capture some window's events
- function capwin(w) {
- w.addEventListener("click", Dialog._parentEvent, true);
- w.addEventListener("mousedown", Dialog._parentEvent, true);
- w.addEventListener("focus", Dialog._parentEvent, true);
- };
- // release the captured events
- function relwin(w) {
- w.removeEventListener("focus", Dialog._parentEvent, true);
- w.removeEventListener("mousedown", Dialog._parentEvent, true);
- w.removeEventListener("click", Dialog._parentEvent, true);
- };
- capwin(window);
- // capture other frames
- //for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));
- // make up a function to be called when the Dialog ends.
- Dialog._return = function (val) {
- if (val && action) {
- action(val);
- }
- relwin(window);
- // capture other frames
- //for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));
- Dialog._modal = null;
- };
-};
+// Though "Dialog" looks like an object, it isn't really an object. Instead\r
+// it's just namespace for protecting global symbols.\r
+\r
+function Dialog(url, action, init) {\r
+ if (typeof init == "undefined") {\r
+ init = window; // pass this window object by default\r
+ }\r
+ if (document.all) { // here we hope that Mozilla will never support document.all\r
+ var value =\r
+ showModalDialog(url, init,\r
+ //window.open(url, '_blank',\r
+ "resizable: no; help: no; status: no; scroll: no");\r
+ if (action) {\r
+ action(value);\r
+ }\r
+ } else {\r
+ return Dialog._geckoOpenModal(url, action, init);\r
+ }\r
+};\r
+\r
+Dialog._parentEvent = function(ev) {\r
+ if (Dialog._modal && !Dialog._modal.closed) {\r
+ Dialog._modal.focus();\r
+ // we get here in Mozilla only, anyway, so we can safely use\r
+ // the DOM version.\r
+ ev.preventDefault();\r
+ ev.stopPropagation();\r
+ }\r
+};\r
+\r
+// should be a function, the return handler of the currently opened dialog.\r
+Dialog._return = null;\r
+\r
+// constant, the currently opened dialog\r
+Dialog._modal = null;\r
+\r
+// the dialog will read it's args from this variable\r
+Dialog._arguments = null;\r
+\r
+Dialog._geckoOpenModal = function(url, action, init) {\r
+ var dlg = window.open(url, "ha_dialog",\r
+ "toolbar=no,menubar=no,personalbar=no,width=10,height=10," +\r
+ "scrollbars=no,resizable=no");\r
+ Dialog._modal = dlg;\r
+ Dialog._arguments = init;\r
+\r
+ // capture some window's events\r
+ function capwin(w) {\r
+ w.addEventListener("click", Dialog._parentEvent, true);\r
+ w.addEventListener("mousedown", Dialog._parentEvent, true);\r
+ w.addEventListener("focus", Dialog._parentEvent, true);\r
+ };\r
+ // release the captured events\r
+ function relwin(w) {\r
+ w.removeEventListener("focus", Dialog._parentEvent, true);\r
+ w.removeEventListener("mousedown", Dialog._parentEvent, true);\r
+ w.removeEventListener("click", Dialog._parentEvent, true);\r
+ };\r
+ capwin(window);\r
+ // capture other frames\r
+ //for (var i = 0; i < window.frames.length; capwin(window.frames[i++]));\r
+ // make up a function to be called when the Dialog ends.\r
+ Dialog._return = function (val) {\r
+ if (val && action) {\r
+ action(val);\r
+ }\r
+ relwin(window);\r
+ // capture other frames\r
+ //for (var i = 0; i < window.frames.length; relwin(window.frames[i++]));\r
+ Dialog._modal = null;\r
+ };\r
+};\r
-.htmlarea { background: #fff; }
-
-.htmlarea .toolbar {
- cursor: default;
- background: ButtonFace;
- padding: 1px 1px 2px 1px;
- border: 1px solid;
- border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
-}
-.htmlarea .toolbar table { font-family: tahoma,verdana,sans-serif; font-size: 11px; }
-.htmlarea .toolbar img { border: none; }
-.htmlarea .toolbar .label { padding: 0px 3px; }
-
-.htmlarea .toolbar .button {
- background: ButtonFace;
- color: ButtonText;
- border: 1px solid ButtonFace;
- padding: 1px;
- margin: 0px;
-}
-.htmlarea .toolbar .buttonHover {
- border: 1px solid;
- border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
-}
-.htmlarea .toolbar .buttonActive, .htmlarea .toolbar .buttonPressed {
- padding: 2px 0px 0px 2px;
- border: 1px solid;
- border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
-}
-.htmlarea .toolbar .buttonPressed {
- background: ButtonHighlight;
-}
-.htmlarea .toolbar .indicator {
- padding: 0px 3px;
- overflow: hidden;
- width: 20px;
- text-align: center;
- cursor: default;
- border: 1px solid ButtonShadow;
-}
-
-.htmlarea .toolbar .buttonDisabled { background-color: #aaa; }
-
-.htmlarea .toolbar .buttonDisabled img {
- filter: alpha(opacity = 25);
- -moz-opacity: 25%;
-}
-
-.htmlarea .toolbar .separator {
- position: relative;
- margin: 3px;
- border-left: 1px solid ButtonShadow;
- border-right: 1px solid ButtonHighlight;
- width: 0px;
- height: 16px;
- padding: 0px;
-}
-
-.htmlarea .toolbar .space { width: 5px; }
-
-.htmlarea .toolbar select { font: 11px Tahoma,Verdana,sans-serif; }
-
-.htmlarea .toolbar select,
-.htmlarea .toolbar select:hover,
-.htmlarea .toolbar select:active { background: FieldFace; color: ButtonText; }
-
-.htmlarea .statusBar {
- border: 1px solid;
- border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
- padding: 2px 4px;
- background-color: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
-}
-
-.htmlarea .statusBar .statusBarTree a {
- padding: 2px 5px;
- color: #00f;
-}
-
-.htmlarea .statusBar .statusBarTree a:visited { color: #00f; }
-.htmlarea .statusBar .statusBarTree a:hover {
- background-color: Highlight;
- color: HighlightText;
- padding: 1px 4px;
- border: 1px solid HighlightText;
-}
-
-
-/* Hidden DIV popup dialogs (PopupDiv) */
-
-.dialog {
- color: ButtonText;
- background: ButtonFace;
-}
-
-.dialog .content { padding: 2px; }
-
-.dialog, .dialog button, .dialog input, .dialog select, .dialog textarea, .dialog table {
- font: 11px Tahoma,Verdana,sans-serif;
-}
-
-.dialog table { border-collapse: collapse; }
-
-.dialog .title {
- background: #008;
- color: #ff8;
- border-bottom: 1px solid #000;
- padding: 1px 0px 2px 5px;
- font-size: 12px;
- font-weight: bold;
- cursor: default;
-}
-
-.dialog .title .button {
- float: right;
- border: 1px solid #66a;
- padding: 0px 1px 0px 2px;
- margin-right: 1px;
- color: #fff;
- text-align: center;
-}
-
-.dialog .title .button-hilite { border-color: #88f; background: #44c; }
-
-.dialog button {
- width: 5em;
- padding: 0px;
-}
-
-.dialog .buttonColor {
- padding: 1px;
- cursor: default;
- border: 1px solid;
- border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
-}
-
-.dialog .buttonColor-hilite {
- border-color: #000;
-}
-
-.dialog .buttonColor .chooser, .dialog .buttonColor .nocolor {
- height: 0.6em;
- border: 1px solid;
- padding: 0px 1em;
- border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;
-}
-
-.dialog .buttonColor .nocolor { padding: 0px; }
-.dialog .buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }
-
-.dialog .label { text-align: right; width: 6em; }
-.dialog .value input { width: 100%; }
-.dialog .buttons { text-align: right; padding: 2px 4px 0px 4px; }
-
-.dialog legend { font-weight: bold; }
-.dialog fieldset table { margin: 2px 0px; }
-
-.popupdiv {
- border: 2px solid;
- border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;
-}
-
-.popupwin {
- padding: 0px;
- margin: 0px;
-}
-
-.popupwin .title {
- background: #fff;
- color: #000;
- font-weight: bold;
- font-size: 120%;
- padding: 3px 10px;
- margin-bottom: 10px;
- border-bottom: 1px solid black;
- letter-spacing: 2px;
-}
-
-form { margin: 0px; border: none; }
+.htmlarea { background: #fff; }\r
+\r
+.htmlarea .toolbar {\r
+ cursor: default;\r
+ background: ButtonFace;\r
+ padding: 1px 1px 2px 1px;\r
+ border: 1px solid;\r
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;\r
+}\r
+.htmlarea .toolbar table { font-family: tahoma,verdana,sans-serif; font-size: 11px; }\r
+.htmlarea .toolbar img { border: none; }\r
+.htmlarea .toolbar .label { padding: 0px 3px; }\r
+\r
+.htmlarea .toolbar .button {\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ border: 1px solid ButtonFace;\r
+ padding: 1px;\r
+ margin: 0px;\r
+}\r
+.htmlarea .toolbar .buttonHover {\r
+ border: 1px solid;\r
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;\r
+}\r
+.htmlarea .toolbar .buttonActive, .htmlarea .toolbar .buttonPressed {\r
+ padding: 2px 0px 0px 2px;\r
+ border: 1px solid;\r
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;\r
+}\r
+.htmlarea .toolbar .buttonPressed {\r
+ background: ButtonHighlight;\r
+}\r
+.htmlarea .toolbar .indicator {\r
+ padding: 0px 3px;\r
+ overflow: hidden;\r
+ width: 20px;\r
+ text-align: center;\r
+ cursor: default;\r
+ border: 1px solid ButtonShadow;\r
+}\r
+\r
+.htmlarea .toolbar .buttonDisabled { background-color: #aaa; }\r
+\r
+.htmlarea .toolbar .buttonDisabled img {\r
+ filter: alpha(opacity = 25);\r
+ -moz-opacity: 25%;\r
+}\r
+\r
+.htmlarea .toolbar .separator {\r
+ position: relative;\r
+ margin: 3px;\r
+ border-left: 1px solid ButtonShadow;\r
+ border-right: 1px solid ButtonHighlight;\r
+ width: 0px;\r
+ height: 16px;\r
+ padding: 0px;\r
+}\r
+\r
+.htmlarea .toolbar .space { width: 5px; }\r
+\r
+.htmlarea .toolbar select { font: 11px Tahoma,Verdana,sans-serif; }\r
+\r
+.htmlarea .toolbar select,\r
+.htmlarea .toolbar select:hover,\r
+.htmlarea .toolbar select:active { background: FieldFace; color: ButtonText; }\r
+\r
+.htmlarea .statusBar {\r
+ border: 1px solid;\r
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;\r
+ padding: 2px 4px;\r
+ background-color: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+\r
+.htmlarea .statusBar .statusBarTree a {\r
+ padding: 2px 5px;\r
+ color: #00f;\r
+}\r
+\r
+.htmlarea .statusBar .statusBarTree a:visited { color: #00f; }\r
+.htmlarea .statusBar .statusBarTree a:hover {\r
+ background-color: Highlight;\r
+ color: HighlightText;\r
+ padding: 1px 4px;\r
+ border: 1px solid HighlightText;\r
+}\r
+\r
+\r
+/* Hidden DIV popup dialogs (PopupDiv) */\r
+\r
+.dialog {\r
+ color: ButtonText;\r
+ background: ButtonFace;\r
+}\r
+\r
+.dialog .content { padding: 2px; }\r
+\r
+.dialog, .dialog button, .dialog input, .dialog select, .dialog textarea, .dialog table {\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+\r
+.dialog table { border-collapse: collapse; }\r
+\r
+.dialog .title {\r
+ background: #008;\r
+ color: #ff8;\r
+ border-bottom: 1px solid #000;\r
+ padding: 1px 0px 2px 5px;\r
+ font-size: 12px;\r
+ font-weight: bold;\r
+ cursor: default;\r
+}\r
+\r
+.dialog .title .button {\r
+ float: right;\r
+ border: 1px solid #66a;\r
+ padding: 0px 1px 0px 2px;\r
+ margin-right: 1px;\r
+ color: #fff;\r
+ text-align: center;\r
+}\r
+\r
+.dialog .title .button-hilite { border-color: #88f; background: #44c; }\r
+\r
+.dialog button {\r
+ width: 5em;\r
+ padding: 0px;\r
+}\r
+\r
+.dialog .buttonColor {\r
+ padding: 1px;\r
+ cursor: default;\r
+ border: 1px solid;\r
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;\r
+}\r
+\r
+.dialog .buttonColor-hilite {\r
+ border-color: #000;\r
+}\r
+\r
+.dialog .buttonColor .chooser, .dialog .buttonColor .nocolor {\r
+ height: 0.6em;\r
+ border: 1px solid;\r
+ padding: 0px 1em;\r
+ border-color: ButtonShadow ButtonHighlight ButtonHighlight ButtonShadow;\r
+}\r
+\r
+.dialog .buttonColor .nocolor { padding: 0px; }\r
+.dialog .buttonColor .nocolor-hilite { background-color: #fff; color: #f00; }\r
+\r
+.dialog .label { text-align: right; width: 6em; }\r
+.dialog .value input { width: 100%; }\r
+.dialog .buttons { text-align: right; padding: 2px 4px 0px 4px; }\r
+\r
+.dialog legend { font-weight: bold; }\r
+.dialog fieldset table { margin: 2px 0px; }\r
+\r
+.popupdiv {\r
+ border: 2px solid;\r
+ border-color: ButtonHighlight ButtonShadow ButtonShadow ButtonHighlight;\r
+}\r
+\r
+.popupwin {\r
+ padding: 0px;\r
+ margin: 0px;\r
+}\r
+\r
+.popupwin .title {\r
+ background: #fff;\r
+ color: #000;\r
+ font-weight: bold;\r
+ font-size: 120%;\r
+ padding: 3px 10px;\r
+ margin-bottom: 10px;\r
+ border-bottom: 1px solid black;\r
+ letter-spacing: 2px;\r
+}\r
+\r
+form { margin: 0px; border: none; }\r
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
header("Cache-control: max_age = $lifetime");
header("Pragma: ");
-
- $lang = current_language();
+
+ $lang = current_language();
if (empty($lang)) {
$lang = "en";
$strpreformatted = get_string("preformatted", "editor");
?>
-//
-// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
+// htmlArea v3.0 - Copyright (c) 2002, 2003 interactivetools.com, inc.
// This copyright notice MUST stay intact for use (see license.txt).
//
+// Portions (c) dynarch.com, 2003
+//
// A free WYSIWYG editor replacement for <textarea> fields.
// For full source code and docs, visit http://www.interactivetools.com/
//
-// Version 3.0 developed by Mihai Bazon for InteractiveTools.
+// Version 3.0 developed by Mihai Bazon.
// http://dynarch.com/mishoo
//
-//
-// Modified for Moodle by Janne Mikkonen
// $Id$
+if (typeof _editor_url == "string") {
+ // Leave exactly one backslash at the end of _editor_url
+ _editor_url = _editor_url.replace(/\/*$/, '/');
+} else {
+ //alert("WARNING: _editor_url is not set! You should set this variable to the editor files path; it should preferably be an absolute path, like in '/htmlarea', but it can be relative if you prefer. Further we will try to load the editor files correctly but we'll probably fail.");
+ _editor_url = '<?php print ($CFG->wwwroot); ?>/lib/editor/';
+}
+
+// make sure we have a language
+if (typeof _editor_lang == "string") {
+ _editor_lang = _editor_lang.toLowerCase();
+} else {
+ _editor_lang = "en";
+}
+
// Creates a new HTMLArea object. Tries to replace the textarea with the given
// ID with it.
function HTMLArea(textarea, config) {
this._timerUndo = null;
this._undoQueue = new Array(this.config.undoSteps);
this._undoPos = -1;
+ this._customUndo = false;
this._mdoc = document; // cache the document, we need it in plugins
this.doctype = '';
}
- // Hide cut, copy and paste buttons from gecko browsers
+ // Hide cut copy paste from gecko browsers.
if (HTMLArea.is_gecko) {
this.config.hideSomeButtons(" cut copy paste ");
}
};
+// load some scripts
+(function() {
+ var scripts = HTMLArea._scripts = [ _editor_url + "htmlarea.js",
+ _editor_url + "dialog.js",
+ _editor_url + "popupwin.js",
+ _editor_url + "lang/" + _editor_lang + ".js" ];
+ var head = document.getElementsByTagName("head")[0];
+ // start from 1, htmlarea.js is already loaded
+ for (var i = 1; i < scripts.length; ++i) {
+ var script = document.createElement("script");
+ script.src = scripts[i];
+ head.appendChild(script);
+ }
+})();
+
// cache some regexps
HTMLArea.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig;
HTMLArea.RE_doctype = /(<!doctype((.|\n)*?)>)\n?/i;
// style included in the iframe document
this.pageStyle = "body { background-color: #fff; font-family: 'Times New Roman', Times; }";
- if (typeof _editor_url != "undefined") {
- this.editorURL = _editor_url;
- } else {
- this.editorURL = "<?php echo $CFG->wwwroot ?>/lib/editor/";
- }
+
+ // set to true if you want Word code to be cleaned upon Paste
+ this.killWordOnPaste = false;
+
+ // BaseURL included in the iframe document
+ this.baseURL = document.baseURI || document.URL;
+ if (this.baseURL && this.baseURL.match(/(.*)\/([^\/]+)/))
+ this.baseURL = RegExp.$1 + "/";
// URL-s
this.imgURL = "images/";
"copy", "cut", "paste", "space", "undo", "redo" ],
[ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",
+ "lefttoright", "righttoleft", "separator",
"insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",
"forecolor", "hilitecolor", "separator",
"inserthorizontalrule", "createlink", "insertimage", "inserttable",
"Arial": 'arial,helvetica,sans-serif',
"Courier New": 'courier new,courier,monospace',
"Georgia": 'georgia,times new roman,times,serif',
- "Impact": 'impact',
"Tahoma": 'tahoma,arial,helvetica,sans-serif',
"Times New Roman": 'times new roman,times,serif',
"Verdana": 'verdana,arial,helvetica,sans-serif',
+ "impact": 'impact',
"WingDings": 'wingdings'
};
this.customSelects = {};
function cut_copy_paste(e, cmd, obj) {
- try {
e.execCommand(cmd);
- } catch (e) {
- if (HTMLArea.is_gecko) {
- alert("Some revisions of Mozilla/Gecko do not support programatic " +
- "access to cut/copy/paste functions, for security reasons. " +
- "Your browser is one of them. Please use the standard key combinations:\n" +
- "CTRL-X for cut, CTRL-C for copy, CTRL-V for paste.");
- obj.element.style.display = "none";
- }
- }
};
// ADDING CUSTOM BUTTONS: please read below!
outdent: [ "Decrease Indent", "ed_indent_less.gif", false, function(e) {e.execCommand("outdent");} ],
indent: [ "Increase Indent", "ed_indent_more.gif", false, function(e) {e.execCommand("indent");} ],
forecolor: [ "Font Color", "ed_color_fg.gif", false, function(e) {e.execCommand("forecolor");} ],
- hilitecolor: [ "Background Colorxxx", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],
+ hilitecolor: [ "Background Color", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],
inserthorizontalrule: [ "Horizontal Rule", "ed_hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ],
createlink: [ "Insert Web Link", "ed_link.gif", false, function(e) {e.execCommand("createlink", true);} ],
- insertimage: [ "Insert Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ],
+ insertimage: [ "Insert/Modify Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ],
inserttable: [ "Insert Table", "insert_table.gif", false, function(e) {e.execCommand("inserttable");} ],
htmlmode: [ "Toggle HTML Source", "ed_html.gif", true, function(e) {e.execCommand("htmlmode");} ],
popupeditor: [ "Enlarge Editor", "fullscreen_maximize.gif", true, function(e) {e.execCommand("popupeditor");} ],
cut: [ "Cut selection", "ed_cut.gif", false, cut_copy_paste ],
copy: [ "Copy selection", "ed_copy.gif", false, cut_copy_paste ],
paste: [ "Paste from clipboard", "ed_paste.gif", false, cut_copy_paste ],
+ lefttoright: [ "Direction left to right", "ed_left_to_right.gif", false, function(e) {e.execCommand("lefttoright");} ],
+ righttoleft: [ "Direction right to left", "ed_right_to_left.gif", false, function(e) {e.execCommand("righttoleft");} ],
insertsmile: ["Insert Smiley", "em.icon.smile.gif", false, function(e) {e.execCommand("insertsmile");} ],
insertchar: [ "Insert Char", "icon_ins_char.gif", false, function(e) {e.execCommand("insertchar");} ]
};
// initialize tooltips from the I18N module and generate correct image path
for (var i in this.btnList) {
var btn = this.btnList[i];
- btn[1] = this.editorURL + this.imgURL + btn[1];
+ btn[1] = _editor_url + this.imgURL + btn[1];
if (typeof HTMLArea.I18N.tooltips[i] != "undefined") {
btn[0] = HTMLArea.I18N.tooltips[i];
}
}
// check for existing id
if (typeof this.customSelects[the_id] != "undefined") {
- alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
+ // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
}
if (typeof this.btnList[the_id] != "undefined") {
- alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
+ // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
}
switch (typeof id) {
case "string": this.btnList[id] = [ tooltip, image, textMode, action, context ]; break;
HTMLArea.Config.prototype.registerDropdown = function(object) {
// check for existing id
if (typeof this.customSelects[object.id] != "undefined") {
- alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
+ // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");
}
if (typeof this.btnList[object.id] != "undefined") {
- alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
+ // alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");
}
this.customSelects[object.id] = object;
};
statusbar.className = "statusBar";
this._htmlArea.appendChild(statusbar);
this._statusBar = statusbar;
- statusbar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
+ // statusbar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));
// creates a holder for the path view
div = document.createElement("span");
div.className = "statusBarTree";
+ div.innerHTML = HTMLArea.I18N.msg["Path"] + ": ";
this._statusBarTree = div;
this._statusBar.appendChild(div);
if (!this.config.statusBar) {
// FIXME: don't know what else to do here. Normally
// we'll never reach this point.
if (HTMLArea.is_gecko) {
- setTimeout(initIframe, 10);
+ setTimeout(initIframe, 100);
return false;
} else {
alert("ERROR: IFRAME can't be initialized.");
doc.open();
var html = "<html>\n";
html += "<head>\n";
+ if (editor.config.baseURL)
+ html += '<base href="' + editor.config.baseURL + '" />';
html += "<style>" + editor.config.pageStyle + " td { border: 1px dotted gray; }</style>\n";
html += "</head>\n";
html += "<body>\n";
function (event) {
return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event);
});
+
+ // check if any plugins have registered refresh handlers
+ for (var i in editor.plugins) {
+ var plugin = editor.plugins[i].instance;
+ if (typeof plugin.onGenerate == "function")
+ plugin.onGenerate();
+ }
+
+ setTimeout(function() {
editor.updateToolbar();
+ }, 250);
+
+ if (typeof editor.onGenerate == "function")
+ editor.onGenerate();
};
- setTimeout(initIframe, HTMLArea.is_gecko ? 10 : 0);
+ setTimeout(initIframe, 100);
};
// Switches editor mode; parameter can be "textmode" or "wysiwyg". If no
case "wysiwyg":
if (HTMLArea.is_gecko) {
// disable design mode before changing innerHTML
+ try {
this._doc.designMode = "off";
+ } catch(e) {};
}
if (!this.config.fullPage)
this._doc.body.innerHTML = this.getHTML();
this._textArea.style.display = "none";
if (HTMLArea.is_gecko) {
// we need to refresh that info for Moz-1.3a
+ try {
this._doc.designMode = "on";
+ this._doc.focus();
+ } catch(e) {};
}
if (this.config.statusBar) {
this._statusBar.innerHTML = '';
* Category: PLUGINS
***************************************************/
-// Create the specified plugin and register it with this HTMLArea
-HTMLArea.prototype.registerPlugin = function() {
- var plugin = arguments[0];
+// this is the variant of the function above where the plugin arguments are
+// already packed in an array. Externally, it should be only used in the
+// full-screen editor code, in order to initialize plugins with the same
+// parameters as in the opener window.
+HTMLArea.prototype.registerPlugin2 = function(plugin, args) {
if (typeof plugin == "string")
plugin = eval(plugin);
- var args = [];
- for (var i = 1; i < arguments.length; ++i)
- args.push(arguments[i]);
var obj = new plugin(this, args);
if (obj) {
var clone = {};
for (var i in info)
clone[i] = info[i];
clone.instance = obj;
+ clone.args = args;
this.plugins[plugin._pluginInfo.name] = clone;
} else
alert("Can't register plugin " + plugin.toString() + ".");
};
+// Create the specified plugin and register it with this HTMLArea
+HTMLArea.prototype.registerPlugin = function() {
+ var plugin = arguments[0];
+ var args = [];
+ for (var i = 1; i < arguments.length; ++i)
+ args.push(arguments[i]);
+ this.registerPlugin2(plugin, args);
+};
+
// static function that loads the required plugin and lang file, based on the
// language loaded already for HTMLArea. You better make sure that the plugin
// _has_ that language, otherwise shit might happen ;-)
HTMLArea.loadPlugin = function(pluginName) {
- var editorurl = '';
- if (typeof _editor_url != "undefined") {
- editorurl = _editor_url + "/";
- }
- var dir = editorurl + "plugins/" + pluginName;
+ var dir = _editor_url + "plugins/" + pluginName;
var plugin = pluginName.replace(/([a-z])([A-Z])([a-z])/g,
function (str, l1, l2, l3) {
return l1 + "-" + l2.toLowerCase() + l3;
}).toLowerCase() + ".js";
- document.write("<script type='text/javascript' src='" + dir + "/" + plugin + "'></script>");
- document.write("<script type='text/javascript' src='" + dir + "/lang/" + HTMLArea.I18N.lang + ".js'></script>");
+ var plugin_file = dir + "/" + plugin;
+ var plugin_lang = dir + "/lang/" + HTMLArea.I18N.lang + ".js";
+ HTMLArea._scripts.push(plugin_file, plugin_lang);
+ document.write("<script type='text/javascript' src='" + plugin_file + "'></script>");
+ document.write("<script type='text/javascript' src='" + plugin_lang + "'></script>");
};
+HTMLArea.loadStyle = function(style, plugin) {
+ var url = _editor_url || '';
+ if (typeof plugin != "undefined") {
+ url += "plugins/" + plugin + "/";
+ }
+ url += style;
+ document.write("<style type='text/css'>@import url(" + url + ");</style>");
+};
+HTMLArea.loadStyle("htmlarea.css");
+
/***************************************************
* Category: EDITOR UTILITIES
***************************************************/
+// The following function is a slight variation of the word cleaner code posted
+// by Weeezl (user @ InteractiveTools forums).
+HTMLArea.prototype._wordClean = function() {
+ var D = this.getInnerHTML();
+ if (D.indexOf('class=Mso') >= 0) {
+
+ // make one line
+ D = D.replace(/\r\n/g, ' ').
+ replace(/\n/g, ' ').
+ replace(/\r/g, ' ').
+ replace(/\ \;/g,' ');
+
+ // keep tags, strip attributes
+ D = D.replace(/ class=[^\s|>]*/gi,'').
+ //replace(/<p [^>]*TEXT-ALIGN: justify[^>]*>/gi,'<p align="justify">').
+ replace(/ style=\"[^>]*\"/gi,'').
+ replace(/ align=[^\s|>]*/gi,'');
+
+ //clean up tags
+ D = D.replace(/<b [^>]*>/gi,'<b>').
+ replace(/<i [^>]*>/gi,'<i>').
+ replace(/<li [^>]*>/gi,'<li>').
+ replace(/<ul [^>]*>/gi,'<ul>');
+
+ // replace outdated tags
+ D = D.replace(/<b>/gi,'<strong>').
+ replace(/<\/b>/gi,'</strong>');
+
+ // mozilla doesn't like <em> tags
+ D = D.replace(/<em>/gi,'<i>').
+ replace(/<\/em>/gi,'</i>');
+
+ // kill unwanted tags
+ D = D.replace(/<\?xml:[^>]*>/g, ''). // Word xml
+ replace(/<\/?st1:[^>]*>/g,''). // Word SmartTags
+ replace(/<\/?[a-z]\:[^>]*>/g,''). // All other funny Word non-HTML stuff
+ replace(/<\/?font[^>]*>/gi,''). // Disable if you want to keep font formatting
+ replace(/<\/?span[^>]*>/gi,' ').
+ replace(/<\/?div[^>]*>/gi,' ').
+ replace(/<\/?pre[^>]*>/gi,' ').
+ replace(/<\/?h[1-6][^>]*>/gi,' ');
+
+ //remove empty tags
+ //D = D.replace(/<strong><\/strong>/gi,'').
+ //replace(/<i><\/i>/gi,'').
+ //replace(/<P[^>]*><\/P>/gi,'');
+
+ // nuke double tags
+ oldlen = D.length + 1;
+ while(oldlen > D.length) {
+ oldlen = D.length;
+ // join us now and free the tags, we'll be free hackers, we'll be free... ;-)
+ D = D.replace(/<([a-z][a-z]*)> *<\/\1>/gi,' ').
+ replace(/<([a-z][a-z]*)> *<([a-z][^>]*)> *<\/\1>/gi,'<$2>');
+ }
+ D = D.replace(/<([a-z][a-z]*)><\1>/gi,'<$1>').
+ replace(/<\/([a-z][a-z]*)><\/\1>/gi,'<\/$1>');
+
+ // nuke double spaces
+ D = D.replace(/ */gi,' ');
+
+ this.setHTML(D);
+ this.updateToolbar();
+ }
+};
+
HTMLArea.prototype.forceRedraw = function() {
this._doc.body.style.visibility = "hidden";
this._doc.body.style.visibility = "visible";
if (!text) {
ancestors = this.getAllAncestors();
if (this.config.statusBar && !noStatus) {
- this._statusBarTree.innerHTML = ''; // clear
+ this._statusBarTree.innerHTML = HTMLArea.I18N.msg["Path"] + ": "; // clear
for (var i = ancestors.length; --i >= 0;) {
var el = ancestors[i];
if (!el) {
case "fontname":
case "fontsize":
case "formatblock":
- if (!text) {
+ if (!text) try {
var value = ("" + doc.queryCommandValue(cmd)).toLowerCase();
if (!value) {
// FIXME: what do we do here?
}
++k;
}
- }
+ } catch(e) {};
break;
case "textindicator":
if (!text) {
}
break;
case "htmlmode": btn.state("active", text); break;
+ case "lefttoright":
+ case "righttoleft":
+ var el = this.getParentElement();
+ while (el && !HTMLArea.isBlockElement(el))
+ el = el.parentNode;
+ if (el)
+ btn.state("active", (el.style.direction == ((cmd == "righttoleft") ? "rtl" : "ltr")));
+ break;
default:
try {
btn.state("active", (!text && doc.queryCommandState(cmd)));
}
}
// take undo snapshots
- if (!this._timerUndo) {
+ if (this._customUndo && !this._timerUndo) {
this._undoTakeSnapshot();
var editor = this;
this._timerUndo = setTimeout(function() {
var sel = this._getSelection();
var range = this._createRange(sel);
if (HTMLArea.is_ie) {
- return range.parentElement ? range.parentElement() : this._doc.body;
- } else {
+ switch (sel.type) {
+ case "Text":
+ case "None":
+ // It seems that even for selection of type "None",
+ // there _is_ a parent element and it's value is not
+ // only correct, but very important to us. MSIE is
+ // certainly the buggiest browser in the world and I
+ // wonder, God, how can Earth stand it?
+ return range.parentElement();
+ case "Control":
+ return range.item(0);
+ default:
+ return this._doc.body;
+ }
+ } else try {
var p = range.commonAncestorContainer;
+ if (!range.collapsed && range.startContainer == range.endContainer &&
+ range.startOffset - range.endOffset <= 1 && range.startContainer.hasChildNodes())
+ p = range.startContainer.childNodes[range.startOffset];
+ /*
+ alert(range.startContainer + ":" + range.startOffset + "\n" +
+ range.endContainer + ":" + range.endOffset);
+ */
while (p.nodeType == 3) {
p = p.parentNode;
}
return p;
+ } catch (e) {
+ return null;
}
};
if (HTMLArea.is_ie) {
existing = range.htmlText;
} else {
- existing = HTMLArea.getHTML(range.cloneContents(), false);
+ existing = HTMLArea.getHTML(range.cloneContents(), false, this);
}
return existing;
};
-// Called when the user clicks on "InsertImage" button
-HTMLArea.prototype._insertImage = function() {
+/// Return true if we have some selection
+HTMLArea.prototype.hasSelectedText = function() {
+ // FIXME: come _on_ mishoo, you can do better than this ;-)
+ return this.getSelectedHTML() != '';
+};
+
+HTMLArea.prototype._createLink = function(link) {
+ var editor = this;
+ var outparam = null;
+ if (typeof link == "undefined") {
+ link = this.getParentElement();
+ if (link && !/^a$/i.test(link.tagName))
+ link = null;
+ }
+ if (link) outparam = {
+ f_href : HTMLArea.is_ie ? editor.stripBaseURL(link.href) : link.getAttribute("href"),
+ f_title : link.title,
+ f_target : link.target
+ };
+ this._popupDialog("link.php?id=<?php print($id);?>", function(param) {
+ if (!param)
+ return false;
+ var a = link;
+ if (!a) {
+ editor._doc.execCommand("createlink", false, param.f_href);
+ a = editor.getParentElement();
+ var sel = editor._getSelection();
+ var range = editor._createRange(sel);
+ if (!HTMLArea.is_ie) {
+ a = range.startContainer;
+ if (!/^a$/i.test(a.tagName))
+ a = a.nextSibling;
+ }
+ } else a.href = param.f_href.trim();
+ if (!/^a$/i.test(a.tagName))
+ return false;
+ a.target = param.f_target.trim();
+ a.title = param.f_title.trim();
+ editor.selectNodeContents(a);
+ editor.updateToolbar();
+ }, outparam);
+};
+
+// Called when the user clicks on "InsertImage" button. If an image is already
+// there, it will just modify it's properties.
+HTMLArea.prototype._insertImage = function(image) {
var editor = this; // for nested functions
+ var outparam = null;
+ if (typeof image == "undefined") {
+ image = this.getParentElement();
+ if (image && !/^img$/i.test(image.tagName))
+ image = null;
+ }
+ if (image) outparam = {
+ f_url : HTMLArea.is_ie ? editor.stripBaseURL(image.src) : image.getAttribute("src"),
+ f_alt : image.alt,
+ f_border : image.border,
+ f_align : image.align,
+ f_vert : image.vspace,
+ f_horiz : image.hspace,
+ f_width : image.width,
+ f_height : image.height
+ };
this._popupDialog("insert_image.php?id=<?php echo $id ?>", function(param) {
if (!param) { // user must have pressed Cancel
return false;
}
+ var img = image;
+ if (!img) {
var sel = editor._getSelection();
var range = editor._createRange(sel);
- editor._doc.execCommand("insertimage", false, param["f_url"]);
- var img = null;
+ editor._doc.execCommand("insertimage", false, param.f_url);
if (HTMLArea.is_ie) {
img = range.parentElement();
// wonder if this works...
} else {
img = range.startContainer.previousSibling;
}
+ } else {
+ img.src = param.f_url;
+ }
for (field in param) {
var value = param[field];
- if (!value) {
- continue;
- }
switch (field) {
case "f_alt" : img.alt = value; break;
- case "f_border" : img.border = parseInt(value); break;
+ case "f_border" : img.border = parseInt(value || "0"); break;
case "f_align" : img.align = value; break;
- case "f_vert" : img.vspace = parseInt(value); break;
- case "f_horiz" : img.hspace = parseInt(value); break;
+ case "f_vert" : img.vspace = parseInt(value || "0"); break;
+ case "f_horiz" : img.hspace = parseInt(value || "0"); break;
+ case "f_width" : img.width = parseInt(value || "0"); break;
+ case "f_height" : img.height = parseInt(value || "0"); break;
}
}
- }, null);
+ }, outparam);
};
// Called when the user clicks the Insert Table button
continue;
}
switch (field) {
- case "f_width" : table.style.width = value + param["f_unit"]; break;
+ case "f_width" : table.width = value + param["f_unit"]; break;
case "f_align" : table.align = value; break;
case "f_border" : table.border = parseInt(value); break;
case "f_spacing" : table.cellspacing = parseInt(value); break;
return true;
}, null);
};
-
/******************************************************************
* Moodle hack - insertSmile
******************************************************************/
/************************************************************************
* Moodle hack's ends
************************************************************************/
-/// Called when the user Pastes from Ctrl-V;
-HTMLArea.prototype._pasteSpecial = function() {
- var editor = this; // for nested functions
- editor.unPasteSpecial = function () {editor._unPasteSpecial()};
- HTMLArea._addEvent(editor._doc, "keyup",editor.unPasteSpecial);
-};
-
-/// Called on Ctrl-V keyup;
-
-HTMLArea.prototype._unPasteSpecial = function() {
- var editor = this;
- HTMLArea._removeEvent(editor._doc, "keyup",editor.unPasteSpecial);
- editor._wordClean();
-};
-
-// Word Clean Function;
-
-HTMLArea.prototype._wordClean = function() {
- var D = this.getInnerHTML();
- if (D.indexOf('class=Mso') >= 0 || D.indexOf('mso') >= 0) {
-
- // make one line
- D = D.replace(/\r\n/g, ' ').
- replace(/\n/g, ' ').
- replace(/\r/g, ' ').
- replace(/\ \;/g,' ');
-
- // keep tags, strip attributes
- D = D.replace(/ class=[^\s|>]*/gi,'').
- //replace(/<p [^>]*TEXT-ALIGN: justify[^>]*>/gi,'<p align="justify">').
- replace(/ style=\"[^>]*\"/gi,'').
- replace(/ align=[^\s|>]*/gi,'');
-
- //clean up tags
- D = D.replace(/<b [^>]*>/gi,'<b>').
- replace(/<i [^>]*>/gi,'<i>').
- replace(/<li [^>]*>/gi,'<li>').
- replace(/<ul [^>]*>/gi,'<ul>');
-
- // replace outdated tags
- D = D.replace(/<b>/gi,'<strong>').
- replace(/<\/b>/gi,'</strong>');
-
- // mozilla doesn't like <em> tags
- D = D.replace(/<em>/gi,'<i>').
- replace(/<\/em>/gi,'</i>');
-
- // kill unwanted tags
- D = D.replace(/<\?xml:[^>]*>/g, ''). // Word xml
- replace(/<\/?st1:[^>]*>/g,''). // Word SmartTags
- replace(/<\/?[a-z]\:[^>]*>/g,''). // All other funny Word non-HTML stuff
- replace(/<\/?font[^>]*>/gi,''). // Disable if you want to keep font formatting
- replace(/<\/?span[^>]*>/gi,' ').
- replace(/<\/?div[^>]*>/gi,' ').
- replace(/<\/?pre[^>]*>/gi,' ').
- //replace(/<\/?h[1-6][^>]*>/gi,' ').
- /// Try to remove <!--[endif]--> and stuff
- replace(/<!--[^>]*>/gi,''); /// MOODLE HACK - not so sure does this work right?
-
- //remove empty tags
- //D = D.replace(/<strong><\/strong>/gi,'').
- //replace(/<i><\/i>/gi,'').
- //replace(/<P[^>]*><\/P>/gi,'');
-
- // nuke double tags
- oldlen = D.length + 1;
- while(oldlen > D.length) {
- oldlen = D.length;
- // join us now and free the tags, we'll be free hackers, we'll be free... ;-)
- D = D.replace(/<([a-z][a-z]*)> *<\/\1>/gi,' ').
- replace(/<([a-z][a-z]*)> *<([a-z][^>]*)> *<\/\1>/gi,'<$2>');
- }
- D = D.replace(/<([a-z][a-z]*)><\1>/gi,'<$1>').
- replace(/<\/([a-z][a-z]*)><\/\1>/gi,'<\/$1>');
-
- // nuke double spaces
- D = D.replace(/ */gi,' ');
-
- this.setHTML(D);
- this.updateToolbar();
- }
-};
/***************************************************
* Category: EVENT HANDLERS
***************************************************/
HTMLArea.prototype.execCommand = function(cmdID, UI, param) {
var editor = this; // for nested functions
this.focusEditor();
- switch (cmdID.toLowerCase()) {
+ cmdID = cmdID.toLowerCase();
+ switch (cmdID) {
case "htmlmode" : this.setMode(); break;
case "hilitecolor":
(HTMLArea.is_ie) && (cmdID = "backcolor");
}, HTMLArea._colorToRgb(this._doc.queryCommandValue(cmdID)));
break;
case "createlink":
- if (HTMLArea.is_ie || !UI) {
- this._doc.execCommand(cmdID, UI, param);
- } else {
- // browser is Mozilla & wants UI
- var param;
- if ((param = prompt("Enter URL"))) {
- this._doc.execCommand(cmdID, false, param);
- }
- }
+ this._createLink();
break;
case "popupeditor":
if (HTMLArea.is_ie) {
- window.open(this.popupURL("fullscreen.php?id=<?php echo $id ?>"), "ha_fullscreen",
+ //if (confirm(HTMLArea.I18N.msg["IE-sucks-full-screen"]))
+ {
+ window.open(this.popupURL("fullscreen.php?id=<?php print($id);?>"), "ha_fullscreen",
"toolbar=no,location=no,directories=no,status=no,menubar=no," +
- "scrollbars=no,resizable=yes,width=640,height=480");
+ "scrollbars=no,resizable=yes,width=800,height=600");
+ }
} else {
- window.open(this.popupURL("fullscreen.php?id=<?php echo $id ?>"), "ha_fullscreen",
- "toolbar=no,menubar=no,personalbar=no,width=640,height=480," +
+ window.open(this.popupURL("fullscreen.php?id=<?php print($id);?>"), "ha_fullscreen",
+ "toolbar=no,menubar=no,personalbar=no,width=800,height=600," +
"scrollbars=no,resizable=yes");
}
// pass this object to the newly opened window
HTMLArea._object = this;
break;
- case "undo": this.undo(); break;
- case "redo": this.redo(); break;
+ case "undo":
+ case "redo":
+ if (this._customUndo)
+ this[cmdID]();
+ else
+ this._doc.execCommand(cmdID, UI, param);
+ break;
case "inserttable": this._insertTable(); break;
case "insertimage": this._insertImage(); break;
case "insertsmile": this._insertSmile(); break;
case "insertchar": this._insertChar(); break;
case "about" : this._popupDialog("about.html", null, this); break;
- case "showhelp" : window.open(this.config.editorURL + "reference.html", "ha_help"); break;
- /// Moodle hack
- case "pastespecial" : this._pasteSpecial(); break;
- /// Moodle hack
+ case "showhelp" : window.open(_editor_url + "reference.html", "ha_help"); break;
+
+ case "killword": this._wordClean(); break;
+
+ case "cut":
+ case "copy":
+ case "paste":
+ try {
+ if (this.config.killWordOnPaste)
+ this._wordClean();
+ this._doc.execCommand(cmdID, UI, param);
+ } catch (e) {
+ if (HTMLArea.is_gecko) {
+ if (confirm("Unprivileged scripts cannot access Cut/Copy/Paste programatically " +
+ "for security reasons. Click OK to see a technical note at mozilla.org " +
+ "which shows you how to allow a script to access the clipboard."))
+ window.open("http://mozilla.org/editor/midasdemo/securityprefs.html");
+ }
+ }
+ break;
+ case "lefttoright":
+ case "righttoleft":
+ var dir = (cmdID == "righttoleft") ? "rtl" : "ltr";
+ var el = this.getParentElement();
+ while (el && !HTMLArea.isBlockElement(el))
+ el = el.parentNode;
+ if (el) {
+ if (el.style.direction == dir)
+ el.style.direction = "";
+ else
+ el.style.direction = dir;
+ }
+ break;
default: this._doc.execCommand(cmdID, UI, param);
}
this.updateToolbar();
case 'e': cmd = "justifycenter"; break;
case 'r': cmd = "justifyright"; break;
case 'j': cmd = "justifyfull"; break;
- case 'v': this.execCommand("pasteSpecial"); break;
case 'z': cmd = "undo"; break;
case 'y': cmd = "redo"; break;
+ case 'v': cmd = "paste"; break;
+
+ case '0': cmd = "killword"; break;
// headings
case '1':
HTMLArea.prototype.getHTML = function() {
switch (this._editMode) {
case "wysiwyg" :
- if (!this.config.fullPage)
- return HTMLArea.getHTML(this._doc.body, false);
- else
- return this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true);
+ if (!this.config.fullPage) {
+ return HTMLArea.getHTML(this._doc.body, false, this);
+ } else
+ return this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true, this);
case "textmode" : return this._textArea.value;
default : alert("Mode <" + mode + "> not defined!");
}
// variable used to pass the object to the popup editor window.
HTMLArea._object = null;
+// function that returns a clone of the given object
+HTMLArea.cloneObject = function(obj) {
+ var newObj = new Object;
+
+ // check for array objects
+ if (obj.constructor.toString().indexOf("function Array(") == 1) {
+ newObj = obj.constructor();
+ }
+
+ // check for function objects (as usual, IE is fucked up)
+ if (obj.constructor.toString().indexOf("function Function(") == 1) {
+ newObj = obj; // just copy reference to it
+ } else for (var n in obj) {
+ var node = obj[n];
+ if (typeof node == 'object') { newObj[n] = HTMLArea.cloneObject(node); }
+ else { newObj[n] = node; }
+ }
+
+ return newObj;
+};
+
// FIXME!!! this should return false for IE < 5.5
HTMLArea.checkSupportedBrowser = function() {
if (HTMLArea.is_gecko) {
} else {
this.focusEditor();
if (typeof sel != "undefined") {
+ try {
return sel.getRangeAt(0);
+ } catch(e) {
+ return this._doc.createRange();
+ }
} else {
return this._doc.createRange();
}
// Retrieves the HTML code from the given node. This is a replacement for
// getting innerHTML, using standard DOM calls.
-HTMLArea.getHTML = function(root, outputRoot) {
+HTMLArea.getHTML = function(root, outputRoot, editor) {
var html = "";
switch (root.nodeType) {
case 1: // Node.ELEMENT_NODE
case 11: // Node.DOCUMENT_FRAGMENT_NODE
var closed;
var i;
- var root_tag = root.tagName.toLowerCase();
+ var root_tag = (root.nodeType == 1) ? root.tagName.toLowerCase() : '';
if (HTMLArea.is_ie && root_tag == "head") {
if (outputRoot)
html += "<head>";
// I'm starting to HATE JavaScript
// development. Browser differences
// suck.
- if (typeof root[a.nodeName] != "undefined") {
+ //
+ // Using Gecko the values of href and src are converted to absolute links
+ // unless we get them using nodeValue()
+ if (typeof root[a.nodeName] != "undefined" && name != "href" && name != "src") {
value = root[a.nodeName];
} else {
value = a.nodeValue;
+ // IE seems not willing to return the original values - it converts to absolute
+ // links using a.nodeValue, a.value, a.stringValue, root.getAttribute("href")
+ // So we have to strip the baseurl manually -/
+ if (HTMLArea.is_ie && (name == "href" || name == "src")) {
+ value = editor.stripBaseURL(value);
+ }
}
} else { // IE fails to put style in attributes list
// FIXME: cssText reported by IE is UPPERCASE
value = root.style.cssText;
}
- if (/_moz/.test(value)) {
+ if (/(_moz|^$)/.test(value)) {
// Mozilla reports some special tags
// here; we don't need them.
continue;
html += closed ? " />" : ">";
}
for (i = root.firstChild; i; i = i.nextSibling) {
- html += HTMLArea.getHTML(i, true);
+ html += HTMLArea.getHTML(i, true, editor);
}
if (outputRoot && !closed) {
html += "</" + root.tagName.toLowerCase() + ">";
return html;
};
+HTMLArea.prototype.stripBaseURL = function(string) {
+ var baseurl = this.config.baseURL;
+
+ // strip to last directory in case baseurl points to a file
+ baseurl = baseurl.replace(/[^\/]+$/, '');
+ var basere = new RegExp(baseurl);
+ string = string.replace(basere, "");
+
+ // strip host-part of URL which is added by MSIE to links relative to server root
+ // commented out for moodle
+ //baseurl = baseurl.replace(/^(https?:\/\/[^\/]+)(.*)$/, '$1');
+ basere = new RegExp(baseurl);
+ return string.replace(basere, "");
+};
+
+String.prototype.trim = function() {
+ a = this.replace(/^\s+/, '');
+ return a.replace(/\s+$/, '');
+};
+
// creates a rgb-style color from a number
HTMLArea._makeColor = function(v) {
if (typeof v != "number") {
HTMLArea.prototype.imgURL = function(file, plugin) {
if (typeof plugin == "undefined")
- return this.config.editorURL + file;
+ return _editor_url + file;
else
- return this.config.editorURL + "plugins/" + plugin + "/img/" + file;
+ return _editor_url + "plugins/" + plugin + "/img/" + file;
};
HTMLArea.prototype.popupURL = function(file) {
var popup = RegExp.$2;
if (!/\.html$/.test(popup))
popup += ".html";
- url = this.config.editorURL + "plugins/" + plugin + "/popups/" + popup;
+ url = _editor_url + "plugins/" + plugin + "/popups/" + popup;
} else
- url = this.config.editorURL + this.config.popupURL + file;
+ url = _editor_url + this.config.popupURL + file;
return url;
};
--- /dev/null
+<?php \r
+ include("../../config.php");\r
+\r
+ $lastmodified = filemtime("htmlarea.php");\r
+ $lifetime = 1800;\r
+ \r
+ header("Content-type: application/x-javascript"); // Correct MIME type\r
+ header("Last-Modified: " . gmdate("D, d M Y H:i:s", lastmodified) . " GMT");\r
+ header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");\r
+ header("Cache-control: max_age = $lifetime"); \r
+ header("Pragma: ");\r
+\r
+ $lang = current_language();\r
+\r
+ if (empty($lang)) {\r
+ $lang = "en";\r
+ }\r
+\r
+ $strheading = get_string("heading", "editor");\r
+ $strnormal = get_string("normal", "editor");\r
+ $straddress = get_string("address", "editor");\r
+ $strpreformatted = get_string("preformatted", "editor");\r
+?>\r
+\r
+//\r
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.\r
+// This copyright notice MUST stay intact for use (see license.txt).\r
+//\r
+// A free WYSIWYG editor replacement for <textarea> fields.\r
+// For full source code and docs, visit http://www.interactivetools.com/\r
+//\r
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+// http://dynarch.com/mishoo\r
+//\r
+//\r
+// Modified for Moodle by Janne Mikkonen\r
+// $Id$\r
+\r
+// Creates a new HTMLArea object. Tries to replace the textarea with the given\r
+// ID with it.\r
+function HTMLArea(textarea, config) {\r
+ if (HTMLArea.checkSupportedBrowser()) {\r
+ if (typeof config == "undefined") {\r
+ this.config = new HTMLArea.Config();\r
+ } else {\r
+ this.config = config;\r
+ }\r
+ this._htmlArea = null;\r
+ this._textArea = textarea;\r
+ this._editMode = "wysiwyg";\r
+ this.plugins = {};\r
+ this._timerToolbar = null;\r
+ this._timerUndo = null;\r
+ this._undoQueue = new Array(this.config.undoSteps);\r
+ this._undoPos = -1;\r
+ this._mdoc = document; // cache the document, we need it in plugins\r
+ this.doctype = '';\r
+ }\r
+ // Hide cut, copy and paste buttons from gecko browsers\r
+ if (HTMLArea.is_gecko) {\r
+ this.config.hideSomeButtons(" cut copy paste ");\r
+ }\r
+};\r
+\r
+// cache some regexps\r
+HTMLArea.RE_tagName = /(<\/|<)\s*([^ \t\n>]+)/ig;\r
+HTMLArea.RE_doctype = /(<!doctype((.|\n)*?)>)\n?/i;\r
+HTMLArea.RE_head = /<head>((.|\n)*?)<\/head>/i;\r
+HTMLArea.RE_body = /<body>((.|\n)*?)<\/body>/i;\r
+\r
+HTMLArea.Config = function () {\r
+ this.version = "3.0";\r
+\r
+ this.width = "auto";\r
+ this.height = "auto";\r
+\r
+ // enable creation of a status bar?\r
+ this.statusBar = true;\r
+\r
+ // maximum size of the undo queue\r
+ this.undoSteps = 20;\r
+\r
+ // the time interval at which undo samples are taken\r
+ this.undoTimeout = 500; // 1/2 sec.\r
+\r
+ // the next parameter specifies whether the toolbar should be included\r
+ // in the size or not.\r
+ this.sizeIncludesToolbar = true;\r
+\r
+ // if true then HTMLArea will retrieve the full HTML, starting with the\r
+ // <HTML> tag.\r
+ this.fullPage = false;\r
+\r
+ // style included in the iframe document\r
+ this.pageStyle = "body { background-color: #fff; font-family: 'Times New Roman', Times; }";\r
+ if (typeof _editor_url != "undefined") {\r
+ this.editorURL = _editor_url;\r
+ } else {\r
+ this.editorURL = "<?php echo $CFG->wwwroot ?>/lib/editor/";\r
+ }\r
+\r
+ // URL-s\r
+ this.imgURL = "images/";\r
+ this.popupURL = "popups/";\r
+\r
+ /** CUSTOMIZING THE TOOLBAR\r
+ * -------------------------\r
+ *\r
+ * It is recommended that you customize the toolbar contents in an\r
+ * external file (i.e. the one calling HTMLArea) and leave this one\r
+ * unchanged. That's because when we (InteractiveTools.com) release a\r
+ * new official version, it's less likely that you will have problems\r
+ * upgrading HTMLArea.\r
+ */\r
+ this.toolbar = [\r
+ [ "fontname", "space",\r
+ "fontsize", "space",\r
+ "formatblock", "space",\r
+ "bold", "italic", "underline", "strikethrough", "separator",\r
+ "subscript", "superscript", "separator",\r
+ "copy", "cut", "paste", "space", "undo", "redo" ],\r
+\r
+ [ "justifyleft", "justifycenter", "justifyright", "justifyfull", "separator",\r
+ "insertorderedlist", "insertunorderedlist", "outdent", "indent", "separator",\r
+ "forecolor", "hilitecolor", "separator",\r
+ "inserthorizontalrule", "createlink", "insertimage", "inserttable",\r
+ "insertsmile", "insertchar", "separator", "htmlmode", "separator", "popupeditor" ]\r
+ ];\r
+\r
+ this.fontname = {\r
+ "Arial": 'arial,helvetica,sans-serif',\r
+ "Courier New": 'courier new,courier,monospace',\r
+ "Georgia": 'georgia,times new roman,times,serif',\r
+ "Impact": 'impact',\r
+ "Tahoma": 'tahoma,arial,helvetica,sans-serif',\r
+ "Times New Roman": 'times new roman,times,serif',\r
+ "Verdana": 'verdana,arial,helvetica,sans-serif',\r
+ "WingDings": 'wingdings'\r
+ };\r
+\r
+ this.fontsize = {\r
+ "1 (8 pt)": "1",\r
+ "2 (10 pt)": "2",\r
+ "3 (12 pt)": "3",\r
+ "4 (14 pt)": "4",\r
+ "5 (18 pt)": "5",\r
+ "6 (24 pt)": "6",\r
+ "7 (36 pt)": "7"\r
+ };\r
+\r
+ this.formatblock = {\r
+ "<?php echo $strheading ?> 1": "h1",\r
+ "<?php echo $strheading ?> 2": "h2",\r
+ "<?php echo $strheading ?> 3": "h3",\r
+ "<?php echo $strheading ?> 4": "h4",\r
+ "<?php echo $strheading ?> 5": "h5",\r
+ "<?php echo $strheading ?> 6": "h6",\r
+ "<?php echo $strnormal ?>": "p",\r
+ "<?php echo $straddress ?>": "address",\r
+ "<?php echo $strpreformatted ?>": "pre"\r
+ };\r
+\r
+ this.customSelects = {};\r
+\r
+ function cut_copy_paste(e, cmd, obj) {\r
+ try {\r
+ e.execCommand(cmd);\r
+ } catch (e) {\r
+ if (HTMLArea.is_gecko) {\r
+ alert("Some revisions of Mozilla/Gecko do not support programatic " +\r
+ "access to cut/copy/paste functions, for security reasons. " +\r
+ "Your browser is one of them. Please use the standard key combinations:\n" +\r
+ "CTRL-X for cut, CTRL-C for copy, CTRL-V for paste.");\r
+ obj.element.style.display = "none";\r
+ }\r
+ }\r
+ };\r
+\r
+ // ADDING CUSTOM BUTTONS: please read below!\r
+ // format of the btnList elements is "ID: [ ToolTip, Icon, Enabled in text mode?, ACTION ]"\r
+ // - ID: unique ID for the button. If the button calls document.execCommand\r
+ // it's wise to give it the same name as the called command.\r
+ // - ACTION: function that gets called when the button is clicked.\r
+ // it has the following prototype:\r
+ // function(editor, buttonName)\r
+ // - editor is the HTMLArea object that triggered the call\r
+ // - buttonName is the ID of the clicked button\r
+ // These 2 parameters makes it possible for you to use the same\r
+ // handler for more HTMLArea objects or for more different buttons.\r
+ // - ToolTip: default tooltip, for cases when it is not defined in the -lang- file (HTMLArea.I18N)\r
+ // - Icon: path to an icon image file for the button (TODO: use one image for all buttons!)\r
+ // - Enabled in text mode: if false the button gets disabled for text-only mode; otherwise enabled all the time.\r
+ this.btnList = {\r
+ bold: [ "Bold", "ed_format_bold.gif", false, function(e) {e.execCommand("bold");} ],\r
+ italic: [ "Italic", "ed_format_italic.gif", false, function(e) {e.execCommand("italic");} ],\r
+ underline: [ "Underline", "ed_format_underline.gif", false, function(e) {e.execCommand("underline");} ],\r
+ strikethrough: [ "Strikethrough", "ed_format_strike.gif", false, function(e) {e.execCommand("strikethrough");} ],\r
+ subscript: [ "Subscript", "ed_format_sub.gif", false, function(e) {e.execCommand("subscript");} ],\r
+ superscript: [ "Superscript", "ed_format_sup.gif", false, function(e) {e.execCommand("superscript");} ],\r
+ justifyleft: [ "Justify Left", "ed_align_left.gif", false, function(e) {e.execCommand("justifyleft");} ],\r
+ justifycenter: [ "Justify Center", "ed_align_center.gif", false, function(e) {e.execCommand("justifycenter");} ],\r
+ justifyright: [ "Justify Right", "ed_align_right.gif", false, function(e) {e.execCommand("justifyright");} ],\r
+ justifyfull: [ "Justify Full", "ed_align_justify.gif", false, function(e) {e.execCommand("justifyfull");} ],\r
+ insertorderedlist: [ "Ordered List", "ed_list_num.gif", false, function(e) {e.execCommand("insertorderedlist");} ],\r
+ insertunorderedlist: [ "Bulleted List", "ed_list_bullet.gif", false, function(e) {e.execCommand("insertunorderedlist");} ],\r
+ outdent: [ "Decrease Indent", "ed_indent_less.gif", false, function(e) {e.execCommand("outdent");} ],\r
+ indent: [ "Increase Indent", "ed_indent_more.gif", false, function(e) {e.execCommand("indent");} ],\r
+ forecolor: [ "Font Color", "ed_color_fg.gif", false, function(e) {e.execCommand("forecolor");} ],\r
+ hilitecolor: [ "Background Colorxxx", "ed_color_bg.gif", false, function(e) {e.execCommand("hilitecolor");} ],\r
+ inserthorizontalrule: [ "Horizontal Rule", "ed_hr.gif", false, function(e) {e.execCommand("inserthorizontalrule");} ],\r
+ createlink: [ "Insert Web Link", "ed_link.gif", false, function(e) {e.execCommand("createlink", true);} ],\r
+ insertimage: [ "Insert Image", "ed_image.gif", false, function(e) {e.execCommand("insertimage");} ],\r
+ inserttable: [ "Insert Table", "insert_table.gif", false, function(e) {e.execCommand("inserttable");} ],\r
+ htmlmode: [ "Toggle HTML Source", "ed_html.gif", true, function(e) {e.execCommand("htmlmode");} ],\r
+ popupeditor: [ "Enlarge Editor", "fullscreen_maximize.gif", true, function(e) {e.execCommand("popupeditor");} ],\r
+ about: [ "About this editor", "ed_about.gif", true, function(e) {e.execCommand("about");} ],\r
+ showhelp: [ "Help using editor", "ed_help.gif", true, function(e) {e.execCommand("showhelp");} ],\r
+ undo: [ "Undoes your last action", "ed_undo.gif", false, function(e) {e.execCommand("undo");} ],\r
+ redo: [ "Redoes your last action", "ed_redo.gif", false, function(e) {e.execCommand("redo");} ],\r
+ cut: [ "Cut selection", "ed_cut.gif", false, cut_copy_paste ],\r
+ copy: [ "Copy selection", "ed_copy.gif", false, cut_copy_paste ],\r
+ paste: [ "Paste from clipboard", "ed_paste.gif", false, cut_copy_paste ],\r
+ insertsmile: ["Insert Smiley", "em.icon.smile.gif", false, function(e) {e.execCommand("insertsmile");} ],\r
+ insertchar: [ "Insert Char", "icon_ins_char.gif", false, function(e) {e.execCommand("insertchar");} ]\r
+ };\r
+ /* ADDING CUSTOM BUTTONS\r
+ * ---------------------\r
+ *\r
+ * It is recommended that you add the custom buttons in an external\r
+ * file and leave this one unchanged. That's because when we\r
+ * (InteractiveTools.com) release a new official version, it's less\r
+ * likely that you will have problems upgrading HTMLArea.\r
+ *\r
+ * Example on how to add a custom button when you construct the HTMLArea:\r
+ *\r
+ * var editor = new HTMLArea("your_text_area_id");\r
+ * var cfg = editor.config; // this is the default configuration\r
+ * cfg.btnList["my-hilite"] =\r
+ * [ function(editor) { editor.surroundHTML('<span style="background:yellow">', '</span>'); }, // action\r
+ * "Highlight selection", // tooltip\r
+ * "my_hilite.gif", // image\r
+ * false // disabled in text mode\r
+ * ];\r
+ * cfg.toolbar.push(["linebreak", "my-hilite"]); // add the new button to the toolbar\r
+ *\r
+ * An alternate (also more convenient and recommended) way to\r
+ * accomplish this is to use the registerButton function below.\r
+ */\r
+ // initialize tooltips from the I18N module and generate correct image path\r
+ for (var i in this.btnList) {\r
+ var btn = this.btnList[i];\r
+ btn[1] = this.editorURL + this.imgURL + btn[1];\r
+ if (typeof HTMLArea.I18N.tooltips[i] != "undefined") {\r
+ btn[0] = HTMLArea.I18N.tooltips[i];\r
+ }\r
+ }\r
+};\r
+\r
+/** Helper function: register a new button with the configuration. It can be\r
+ * called with all 5 arguments, or with only one (first one). When called with\r
+ * only one argument it must be an object with the following properties: id,\r
+ * tooltip, image, textMode, action. Examples:\r
+ *\r
+ * 1. config.registerButton("my-hilite", "Hilite text", "my-hilite.gif", false, function(editor) {...});\r
+ * 2. config.registerButton({\r
+ * id : "my-hilite", // the ID of your button\r
+ * tooltip : "Hilite text", // the tooltip\r
+ * image : "my-hilite.gif", // image to be displayed in the toolbar\r
+ * textMode : false, // disabled in text mode\r
+ * action : function(editor) { // called when the button is clicked\r
+ * editor.surroundHTML('<span class="hilite">', '</span>');\r
+ * },\r
+ * context : "p" // will be disabled if outside a <p> element\r
+ * });\r
+ */\r
+HTMLArea.Config.prototype.registerButton = function(id, tooltip, image, textMode, action, context) {\r
+ var the_id;\r
+ if (typeof id == "string") {\r
+ the_id = id;\r
+ } else if (typeof id == "object") {\r
+ the_id = id.id;\r
+ } else {\r
+ alert("ERROR [HTMLArea.Config::registerButton]:\ninvalid arguments");\r
+ return false;\r
+ }\r
+ // check for existing id\r
+ if (typeof this.customSelects[the_id] != "undefined") {\r
+ alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");\r
+ }\r
+ if (typeof this.btnList[the_id] != "undefined") {\r
+ alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");\r
+ }\r
+ switch (typeof id) {\r
+ case "string": this.btnList[id] = [ tooltip, image, textMode, action, context ]; break;\r
+ case "object": this.btnList[id.id] = [ id.tooltip, id.image, id.textMode, id.action, id.context ]; break;\r
+ }\r
+};\r
+\r
+/** The following helper function registers a dropdown box with the editor\r
+ * configuration. You still have to add it to the toolbar, same as with the\r
+ * buttons. Call it like this:\r
+ *\r
+ * FIXME: add example\r
+ */\r
+HTMLArea.Config.prototype.registerDropdown = function(object) {\r
+ // check for existing id\r
+ if (typeof this.customSelects[object.id] != "undefined") {\r
+ alert("WARNING [HTMLArea.Config::registerDropdown]:\nA dropdown with the same ID already exists.");\r
+ }\r
+ if (typeof this.btnList[object.id] != "undefined") {\r
+ alert("WARNING [HTMLArea.Config::registerDropdown]:\nA button with the same ID already exists.");\r
+ }\r
+ this.customSelects[object.id] = object;\r
+};\r
+\r
+/** Call this function to remove some buttons/drop-down boxes from the toolbar.\r
+ * Pass as the only parameter a string containing button/drop-down names\r
+ * delimited by spaces. Note that the string should also begin with a space\r
+ * and end with a space. Example:\r
+ *\r
+ * config.hideSomeButtons(" fontname fontsize textindicator ");\r
+ *\r
+ * It's useful because it's easier to remove stuff from the defaul toolbar than\r
+ * create a brand new toolbar ;-)\r
+ */\r
+HTMLArea.Config.prototype.hideSomeButtons = function(remove) {\r
+ var toolbar = this.toolbar;\r
+ for (var i in toolbar) {\r
+ var line = toolbar[i];\r
+ for (var j = line.length; --j >= 0; ) {\r
+ if (remove.indexOf(" " + line[j] + " ") >= 0) {\r
+ var len = 1;\r
+ if (/separator|space/.test(line[j + 1])) {\r
+ len = 2;\r
+ }\r
+ line.splice(j, len);\r
+ }\r
+ }\r
+ }\r
+};\r
+\r
+/** Helper function: replace all TEXTAREA-s in the document with HTMLArea-s. */\r
+HTMLArea.replaceAll = function(config) {\r
+ var tas = document.getElementsByTagName("textarea");\r
+ for (var i = tas.length; i > 0; (new HTMLArea(tas[--i], config)).generate());\r
+};\r
+\r
+/** Helper function: replaces the TEXTAREA with the given ID with HTMLArea. */\r
+HTMLArea.replace = function(id, config) {\r
+ var ta = document.getElementById(id);\r
+ return ta ? (new HTMLArea(ta, config)).generate() : null;\r
+};\r
+\r
+// Creates the toolbar and appends it to the _htmlarea\r
+HTMLArea.prototype._createToolbar = function () {\r
+ var editor = this; // to access this in nested functions\r
+\r
+ var toolbar = document.createElement("div");\r
+ this._toolbar = toolbar;\r
+ toolbar.className = "toolbar";\r
+ toolbar.unselectable = "1";\r
+ var tb_row = null;\r
+ var tb_objects = new Object();\r
+ this._toolbarObjects = tb_objects;\r
+\r
+ // creates a new line in the toolbar\r
+ function newLine() {\r
+ var table = document.createElement("table");\r
+ table.border = "0px";\r
+ table.cellSpacing = "0px";\r
+ table.cellPadding = "0px";\r
+ toolbar.appendChild(table);\r
+ // TBODY is required for IE, otherwise you don't see anything\r
+ // in the TABLE.\r
+ var tb_body = document.createElement("tbody");\r
+ table.appendChild(tb_body);\r
+ tb_row = document.createElement("tr");\r
+ tb_body.appendChild(tb_row);\r
+ }; // END of function: newLine\r
+ // init first line\r
+ newLine();\r
+\r
+ // updates the state of a toolbar element. This function is member of\r
+ // a toolbar element object (unnamed objects created by createButton or\r
+ // createSelect functions below).\r
+ function setButtonStatus(id, newval) {\r
+ var oldval = this[id];\r
+ var el = this.element;\r
+ if (oldval != newval) {\r
+ switch (id) {\r
+ case "enabled":\r
+ if (newval) {\r
+ HTMLArea._removeClass(el, "buttonDisabled");\r
+ el.disabled = false;\r
+ } else {\r
+ HTMLArea._addClass(el, "buttonDisabled");\r
+ el.disabled = true;\r
+ }\r
+ break;\r
+ case "active":\r
+ if (newval) {\r
+ HTMLArea._addClass(el, "buttonPressed");\r
+ } else {\r
+ HTMLArea._removeClass(el, "buttonPressed");\r
+ }\r
+ break;\r
+ }\r
+ this[id] = newval;\r
+ }\r
+ }; // END of function: setButtonStatus\r
+\r
+ // this function will handle creation of combo boxes. Receives as\r
+ // parameter the name of a button as defined in the toolBar config.\r
+ // This function is called from createButton, above, if the given "txt"\r
+ // doesn't match a button.\r
+ function createSelect(txt) {\r
+ var options = null;\r
+ var el = null;\r
+ var cmd = null;\r
+ var customSelects = editor.config.customSelects;\r
+ var context = null;\r
+ switch (txt) {\r
+ case "fontsize":\r
+ case "fontname":\r
+ case "formatblock":\r
+ // the following line retrieves the correct\r
+ // configuration option because the variable name\r
+ // inside the Config object is named the same as the\r
+ // button/select in the toolbar. For instance, if txt\r
+ // == "formatblock" we retrieve config.formatblock (or\r
+ // a different way to write it in JS is\r
+ // config["formatblock"].\r
+ options = editor.config[txt];\r
+ cmd = txt;\r
+ break;\r
+ default:\r
+ // try to fetch it from the list of registered selects\r
+ cmd = txt;\r
+ var dropdown = customSelects[cmd];\r
+ if (typeof dropdown != "undefined") {\r
+ options = dropdown.options;\r
+ context = dropdown.context;\r
+ } else {\r
+ alert("ERROR [createSelect]:\nCan't find the requested dropdown definition");\r
+ }\r
+ break;\r
+ }\r
+ if (options) {\r
+ el = document.createElement("select");\r
+ var obj = {\r
+ name : txt, // field name\r
+ element : el, // the UI element (SELECT)\r
+ enabled : true, // is it enabled?\r
+ text : false, // enabled in text mode?\r
+ cmd : cmd, // command ID\r
+ state : setButtonStatus, // for changing state\r
+ context : context\r
+ };\r
+ tb_objects[txt] = obj;\r
+ for (var i in options) {\r
+ var op = document.createElement("option");\r
+ op.appendChild(document.createTextNode(i));\r
+ op.value = options[i];\r
+ el.appendChild(op);\r
+ }\r
+ HTMLArea._addEvent(el, "change", function () {\r
+ editor._comboSelected(el, txt);\r
+ });\r
+ }\r
+ return el;\r
+ }; // END of function: createSelect\r
+\r
+ // appends a new button to toolbar\r
+ function createButton(txt) {\r
+ // the element that will be created\r
+ var el = null;\r
+ var btn = null;\r
+ switch (txt) {\r
+ case "separator":\r
+ el = document.createElement("div");\r
+ el.className = "separator";\r
+ break;\r
+ case "space":\r
+ el = document.createElement("div");\r
+ el.className = "space";\r
+ break;\r
+ case "linebreak":\r
+ newLine();\r
+ return false;\r
+ case "textindicator":\r
+ el = document.createElement("div");\r
+ el.appendChild(document.createTextNode("A"));\r
+ el.className = "indicator";\r
+ el.title = HTMLArea.I18N.tooltips.textindicator;\r
+ var obj = {\r
+ name : txt, // the button name (i.e. 'bold')\r
+ element : el, // the UI element (DIV)\r
+ enabled : true, // is it enabled?\r
+ active : false, // is it pressed?\r
+ text : false, // enabled in text mode?\r
+ cmd : "textindicator", // the command ID\r
+ state : setButtonStatus // for changing state\r
+ };\r
+ tb_objects[txt] = obj;\r
+ break;\r
+ default:\r
+ btn = editor.config.btnList[txt];\r
+ }\r
+ if (!el && btn) {\r
+ el = document.createElement("div");\r
+ el.title = btn[0];\r
+ el.className = "button";\r
+ // let's just pretend we have a button object, and\r
+ // assign all the needed information to it.\r
+ var obj = {\r
+ name : txt, // the button name (i.e. 'bold')\r
+ element : el, // the UI element (DIV)\r
+ enabled : true, // is it enabled?\r
+ active : false, // is it pressed?\r
+ text : btn[2], // enabled in text mode?\r
+ cmd : btn[3], // the command ID\r
+ state : setButtonStatus, // for changing state\r
+ context : btn[4] || null // enabled in a certain context?\r
+ };\r
+ tb_objects[txt] = obj;\r
+ // handlers to emulate nice flat toolbar buttons\r
+ HTMLArea._addEvent(el, "mouseover", function () {\r
+ if (obj.enabled) {\r
+ HTMLArea._addClass(el, "buttonHover");\r
+ }\r
+ });\r
+ HTMLArea._addEvent(el, "mouseout", function () {\r
+ if (obj.enabled) with (HTMLArea) {\r
+ _removeClass(el, "buttonHover");\r
+ _removeClass(el, "buttonActive");\r
+ (obj.active) && _addClass(el, "buttonPressed");\r
+ }\r
+ });\r
+ HTMLArea._addEvent(el, "mousedown", function (ev) {\r
+ if (obj.enabled) with (HTMLArea) {\r
+ _addClass(el, "buttonActive");\r
+ _removeClass(el, "buttonPressed");\r
+ _stopEvent(is_ie ? window.event : ev);\r
+ }\r
+ });\r
+ // when clicked, do the following:\r
+ HTMLArea._addEvent(el, "click", function (ev) {\r
+ if (obj.enabled) with (HTMLArea) {\r
+ _removeClass(el, "buttonActive");\r
+ _removeClass(el, "buttonHover");\r
+ obj.cmd(editor, obj.name, obj);\r
+ _stopEvent(is_ie ? window.event : ev);\r
+ }\r
+ });\r
+ var img = document.createElement("img");\r
+ img.src = btn[1];\r
+ img.style.width = "18px";\r
+ img.style.height = "18px";\r
+ el.appendChild(img);\r
+ } else if (!el) {\r
+ el = createSelect(txt);\r
+ }\r
+ if (el) {\r
+ var tb_cell = document.createElement("td");\r
+ tb_row.appendChild(tb_cell);\r
+ tb_cell.appendChild(el);\r
+ } else {\r
+ alert("FIXME: Unknown toolbar item: " + txt);\r
+ }\r
+ return el;\r
+ };\r
+\r
+ var first = true;\r
+ for (var i in this.config.toolbar) {\r
+ if (!first) {\r
+ createButton("linebreak");\r
+ } else {\r
+ first = false;\r
+ }\r
+ var group = this.config.toolbar[i];\r
+ for (var j in group) {\r
+ var code = group[j];\r
+ if (/^([IT])\[(.*?)\]/.test(code)) {\r
+ // special case, create text label\r
+ var l7ed = RegExp.$1 == "I"; // localized?\r
+ var label = RegExp.$2;\r
+ if (l7ed) {\r
+ label = HTMLArea.I18N.custom[label];\r
+ }\r
+ var tb_cell = document.createElement("td");\r
+ tb_row.appendChild(tb_cell);\r
+ tb_cell.className = "label";\r
+ tb_cell.innerHTML = label;\r
+ } else {\r
+ createButton(code);\r
+ }\r
+ }\r
+ }\r
+\r
+ this._htmlArea.appendChild(toolbar);\r
+};\r
+\r
+HTMLArea.prototype._createStatusBar = function() {\r
+ var statusbar = document.createElement("div");\r
+ statusbar.className = "statusBar";\r
+ this._htmlArea.appendChild(statusbar);\r
+ this._statusBar = statusbar;\r
+ statusbar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));\r
+ // creates a holder for the path view\r
+ div = document.createElement("span");\r
+ div.className = "statusBarTree";\r
+ this._statusBarTree = div;\r
+ this._statusBar.appendChild(div);\r
+ if (!this.config.statusBar) {\r
+ // disable it...\r
+ statusbar.style.display = "none";\r
+ }\r
+};\r
+\r
+// Creates the HTMLArea object and replaces the textarea with it.\r
+HTMLArea.prototype.generate = function () {\r
+ var editor = this; // we'll need "this" in some nested functions\r
+ // get the textarea\r
+ var textarea = this._textArea;\r
+ if (typeof textarea == "string") {\r
+ // it's not element but ID\r
+ this._textArea = textarea = document.getElementById(textarea);\r
+ }\r
+ this._ta_size = {\r
+ w: textarea.offsetWidth,\r
+ h: textarea.offsetHeight\r
+ };\r
+ textarea.style.display = "none";\r
+\r
+ // create the editor framework\r
+ var htmlarea = document.createElement("div");\r
+ htmlarea.className = "htmlarea";\r
+ this._htmlArea = htmlarea;\r
+\r
+ // insert the editor before the textarea.\r
+ textarea.parentNode.insertBefore(htmlarea, textarea);\r
+\r
+ if (textarea.form) {\r
+ // we have a form, on submit get the HTMLArea content and\r
+ // update original textarea.\r
+ var f = textarea.form;\r
+ if (typeof f.onsubmit == "function") {\r
+ var funcref = f.onsubmit;\r
+ if (typeof f.__msh_prevOnSubmit == "undefined") {\r
+ f.__msh_prevOnSubmit = [];\r
+ }\r
+ f.__msh_prevOnSubmit.push(funcref);\r
+ }\r
+ f.onsubmit = function() {\r
+ editor._textArea.value = editor.getHTML();\r
+ var a = this.__msh_prevOnSubmit;\r
+ // call previous submit methods if they were there.\r
+ if (typeof a != "undefined") {\r
+ for (var i in a) {\r
+ a[i]();\r
+ }\r
+ }\r
+ };\r
+ }\r
+\r
+ // add a handler for the "back/forward" case -- on body.unload we save\r
+ // the HTML content into the original textarea.\r
+ window.onunload = function() {\r
+ editor._textArea.value = editor.getHTML();\r
+ };\r
+\r
+ // creates & appends the toolbar\r
+ this._createToolbar();\r
+\r
+ // create the IFRAME\r
+ var iframe = document.createElement("iframe");\r
+ htmlarea.appendChild(iframe);\r
+\r
+ this._iframe = iframe;\r
+\r
+ // creates & appends the status bar, if the case\r
+ this._createStatusBar();\r
+\r
+ // remove the default border as it keeps us from computing correctly\r
+ // the sizes. (somebody tell me why doesn't this work in IE)\r
+\r
+ if (!HTMLArea.is_ie) {\r
+ iframe.style.borderWidth = "1px";\r
+ // iframe.frameBorder = "1";\r
+ // iframe.marginHeight = "0";\r
+ // iframe.marginWidth = "0";\r
+ }\r
+\r
+ // size the IFRAME according to user's prefs or initial textarea\r
+ var height = (this.config.height == "auto" ? (this._ta_size.h + "px") : this.config.height);\r
+ height = parseInt(height);\r
+ var width = (this.config.width == "auto" ? (this._ta_size.w + 50 + "px") : this.config.width);\r
+ width = parseInt(width);\r
+\r
+ if (!HTMLArea.is_ie) {\r
+ height -= 2;\r
+ width -= 2;\r
+ }\r
+\r
+ iframe.style.width = width + "px";\r
+ if (this.config.sizeIncludesToolbar) {\r
+ // substract toolbar height\r
+ height -= this._toolbar.offsetHeight;\r
+ height -= this._statusBar.offsetHeight;\r
+ }\r
+ if (height < 0) {\r
+ height = 0;\r
+ }\r
+ iframe.style.height = height + "px";\r
+\r
+ // the editor including the toolbar now have the same size as the\r
+ // original textarea.. which means that we need to reduce that a bit.\r
+ textarea.style.width = iframe.style.width;\r
+ textarea.style.height = iframe.style.height;\r
+\r
+ // IMPORTANT: we have to allow Mozilla a short time to recognize the\r
+ // new frame. Otherwise we get a stupid exception.\r
+ function initIframe() {\r
+ var doc = editor._iframe.contentWindow.document;\r
+ if (!doc) {\r
+ // Try again..\r
+ // FIXME: don't know what else to do here. Normally\r
+ // we'll never reach this point.\r
+ if (HTMLArea.is_gecko) {\r
+ setTimeout(initIframe, 10);\r
+ return false;\r
+ } else {\r
+ alert("ERROR: IFRAME can't be initialized.");\r
+ }\r
+ }\r
+ if (HTMLArea.is_gecko) {\r
+ // enable editable mode for Mozilla\r
+ doc.designMode = "on";\r
+ }\r
+ editor._doc = doc;\r
+ if (!editor.config.fullPage) {\r
+ doc.open();\r
+ var html = "<html>\n";\r
+ html += "<head>\n";\r
+ html += "<style>" + editor.config.pageStyle + " td { border: 1px dotted gray; }</style>\n";\r
+ html += "</head>\n";\r
+ html += "<body>\n";\r
+ html += editor._textArea.value;\r
+ html += "</body>\n";\r
+ html += "</html>";\r
+ doc.write(html);\r
+ doc.close();\r
+ } else {\r
+ var html = editor._textArea.value;\r
+ if (html.match(HTMLArea.RE_doctype)) {\r
+ editor.setDoctype(RegExp.$1);\r
+ html = html.replace(HTMLArea.RE_doctype, "");\r
+ }\r
+ doc.open();\r
+ doc.write(html);\r
+ doc.close();\r
+ }\r
+\r
+ if (HTMLArea.is_ie) {\r
+ // enable editable mode for IE. For some reason this\r
+ // doesn't work if done in the same place as for Gecko\r
+ // (above).\r
+ doc.body.contentEditable = true;\r
+ }\r
+\r
+ editor.focusEditor();\r
+ // intercept some events; for updating the toolbar & keyboard handlers\r
+ HTMLArea._addEvents\r
+ (doc, ["keydown", "keypress", "mousedown", "mouseup", "drag"],\r
+ function (event) {\r
+ return editor._editorEvent(HTMLArea.is_ie ? editor._iframe.contentWindow.event : event);\r
+ });\r
+ editor.updateToolbar();\r
+ };\r
+ setTimeout(initIframe, HTMLArea.is_gecko ? 10 : 0);\r
+};\r
+\r
+// Switches editor mode; parameter can be "textmode" or "wysiwyg". If no\r
+// parameter was passed this function toggles between modes.\r
+HTMLArea.prototype.setMode = function(mode) {\r
+ if (typeof mode == "undefined") {\r
+ mode = ((this._editMode == "textmode") ? "wysiwyg" : "textmode");\r
+ }\r
+ switch (mode) {\r
+ case "textmode":\r
+ this._textArea.value = this.getHTML();\r
+ this._iframe.style.display = "none";\r
+ this._textArea.style.display = "block";\r
+ if (this.config.statusBar) {\r
+ this._statusBar.innerHTML = HTMLArea.I18N.msg["TEXT_MODE"];\r
+ }\r
+ break;\r
+ case "wysiwyg":\r
+ if (HTMLArea.is_gecko) {\r
+ // disable design mode before changing innerHTML\r
+ this._doc.designMode = "off";\r
+ }\r
+ if (!this.config.fullPage)\r
+ this._doc.body.innerHTML = this.getHTML();\r
+ else\r
+ this.setFullHTML(this.getHTML());\r
+ this._iframe.style.display = "block";\r
+ this._textArea.style.display = "none";\r
+ if (HTMLArea.is_gecko) {\r
+ // we need to refresh that info for Moz-1.3a\r
+ this._doc.designMode = "on";\r
+ }\r
+ if (this.config.statusBar) {\r
+ this._statusBar.innerHTML = '';\r
+ this._statusBar.appendChild(document.createTextNode(HTMLArea.I18N.msg["Path"] + ": "));\r
+ this._statusBar.appendChild(this._statusBarTree);\r
+ }\r
+ break;\r
+ default:\r
+ alert("Mode <" + mode + "> not defined!");\r
+ return false;\r
+ }\r
+ this._editMode = mode;\r
+ this.focusEditor();\r
+};\r
+\r
+HTMLArea.prototype.setFullHTML = function(html) {\r
+ var save_multiline = RegExp.multiline;\r
+ RegExp.multiline = true;\r
+ if (html.match(HTMLArea.RE_doctype)) {\r
+ this.setDoctype(RegExp.$1);\r
+ html = html.replace(HTMLArea.RE_doctype, "");\r
+ }\r
+ RegExp.multiline = save_multiline;\r
+ if (!HTMLArea.is_ie) {\r
+ if (html.match(HTMLArea.RE_head))\r
+ this._doc.getElementsByTagName("head")[0].innerHTML = RegExp.$1;\r
+ if (html.match(HTMLArea.RE_body))\r
+ this._doc.getElementsByTagName("body")[0].innerHTML = RegExp.$1;\r
+ } else {\r
+ var html_re = /<html>((.|\n)*?)<\/html>/i;\r
+ html = html.replace(html_re, "$1");\r
+ this._doc.open();\r
+ this._doc.write(html);\r
+ this._doc.close();\r
+ this._doc.body.contentEditable = true;\r
+ return true;\r
+ }\r
+};\r
+\r
+/***************************************************\r
+ * Category: PLUGINS\r
+ ***************************************************/\r
+\r
+// Create the specified plugin and register it with this HTMLArea\r
+HTMLArea.prototype.registerPlugin = function() {\r
+ var plugin = arguments[0];\r
+ if (typeof plugin == "string")\r
+ plugin = eval(plugin);\r
+ var args = [];\r
+ for (var i = 1; i < arguments.length; ++i)\r
+ args.push(arguments[i]);\r
+ var obj = new plugin(this, args);\r
+ if (obj) {\r
+ var clone = {};\r
+ var info = plugin._pluginInfo;\r
+ for (var i in info)\r
+ clone[i] = info[i];\r
+ clone.instance = obj;\r
+ this.plugins[plugin._pluginInfo.name] = clone;\r
+ } else\r
+ alert("Can't register plugin " + plugin.toString() + ".");\r
+};\r
+\r
+// static function that loads the required plugin and lang file, based on the\r
+// language loaded already for HTMLArea. You better make sure that the plugin\r
+// _has_ that language, otherwise shit might happen ;-)\r
+HTMLArea.loadPlugin = function(pluginName) {\r
+ var editorurl = '';\r
+ if (typeof _editor_url != "undefined") {\r
+ editorurl = _editor_url + "/";\r
+ }\r
+ var dir = editorurl + "plugins/" + pluginName;\r
+ var plugin = pluginName.replace(/([a-z])([A-Z])([a-z])/g,\r
+ function (str, l1, l2, l3) {\r
+ return l1 + "-" + l2.toLowerCase() + l3;\r
+ }).toLowerCase() + ".js";\r
+ document.write("<script type='text/javascript' src='" + dir + "/" + plugin + "'></script>");\r
+ document.write("<script type='text/javascript' src='" + dir + "/lang/" + HTMLArea.I18N.lang + ".js'></script>");\r
+};\r
+\r
+/***************************************************\r
+ * Category: EDITOR UTILITIES\r
+ ***************************************************/\r
+\r
+HTMLArea.prototype.forceRedraw = function() {\r
+ this._doc.body.style.visibility = "hidden";\r
+ this._doc.body.style.visibility = "visible";\r
+ // this._doc.body.innerHTML = this.getInnerHTML();\r
+};\r
+\r
+// focuses the iframe window. returns a reference to the editor document.\r
+HTMLArea.prototype.focusEditor = function() {\r
+ switch (this._editMode) {\r
+ case "wysiwyg" : this._iframe.contentWindow.focus(); break;\r
+ case "textmode": this._textArea.focus(); break;\r
+ default : alert("ERROR: mode " + this._editMode + " is not defined");\r
+ }\r
+ return this._doc;\r
+};\r
+\r
+// takes a snapshot of the current text (for undo)\r
+HTMLArea.prototype._undoTakeSnapshot = function() {\r
+ ++this._undoPos;\r
+ if (this._undoPos >= this.config.undoSteps) {\r
+ // remove the first element\r
+ this._undoQueue.shift();\r
+ --this._undoPos;\r
+ }\r
+ // use the fasted method (getInnerHTML);\r
+ var take = true;\r
+ var txt = this.getInnerHTML();\r
+ if (this._undoPos > 0)\r
+ take = (this._undoQueue[this._undoPos - 1] != txt);\r
+ if (take) {\r
+ this._undoQueue[this._undoPos] = txt;\r
+ } else {\r
+ this._undoPos--;\r
+ }\r
+};\r
+\r
+HTMLArea.prototype.undo = function() {\r
+ if (this._undoPos > 0) {\r
+ var txt = this._undoQueue[--this._undoPos];\r
+ if (txt) this.setHTML(txt);\r
+ else ++this._undoPos;\r
+ }\r
+};\r
+\r
+HTMLArea.prototype.redo = function() {\r
+ if (this._undoPos < this._undoQueue.length - 1) {\r
+ var txt = this._undoQueue[++this._undoPos];\r
+ if (txt) this.setHTML(txt);\r
+ else --this._undoPos;\r
+ }\r
+};\r
+\r
+// updates enabled/disable/active state of the toolbar elements\r
+HTMLArea.prototype.updateToolbar = function(noStatus) {\r
+ var doc = this._doc;\r
+ var text = (this._editMode == "textmode");\r
+ var ancestors = null;\r
+ if (!text) {\r
+ ancestors = this.getAllAncestors();\r
+ if (this.config.statusBar && !noStatus) {\r
+ this._statusBarTree.innerHTML = ''; // clear\r
+ for (var i = ancestors.length; --i >= 0;) {\r
+ var el = ancestors[i];\r
+ if (!el) {\r
+ // hell knows why we get here; this\r
+ // could be a classic example of why\r
+ // it's good to check for conditions\r
+ // that are impossible to happen ;-)\r
+ continue;\r
+ }\r
+ var a = document.createElement("a");\r
+ a.href = "#";\r
+ a.el = el;\r
+ a.editor = this;\r
+ a.onclick = function() {\r
+ this.blur();\r
+ this.editor.selectNodeContents(this.el);\r
+ this.editor.updateToolbar(true);\r
+ return false;\r
+ };\r
+ a.oncontextmenu = function() {\r
+ // TODO: add context menu here\r
+ this.blur();\r
+ var info = "Inline style:\n\n";\r
+ info += this.el.style.cssText.split(/;\s*/).join(";\n");\r
+ alert(info);\r
+ return false;\r
+ };\r
+ var txt = el.tagName.toLowerCase();\r
+ a.title = el.style.cssText;\r
+ if (el.id) {\r
+ txt += "#" + el.id;\r
+ }\r
+ if (el.className) {\r
+ txt += "." + el.className;\r
+ }\r
+ a.appendChild(document.createTextNode(txt));\r
+ this._statusBarTree.appendChild(a);\r
+ if (i != 0) {\r
+ this._statusBarTree.appendChild(document.createTextNode(String.fromCharCode(0xbb)));\r
+ }\r
+ }\r
+ }\r
+ }\r
+ for (var i in this._toolbarObjects) {\r
+ var btn = this._toolbarObjects[i];\r
+ var cmd = i;\r
+ var inContext = true;\r
+ if (btn.context && !text) {\r
+ inContext = false;\r
+ var context = btn.context;\r
+ var attrs = [];\r
+ if (/(.*)\[(.*?)\]/.test(context)) {\r
+ context = RegExp.$1;\r
+ attrs = RegExp.$2.split(",");\r
+ }\r
+ context = context.toLowerCase();\r
+ var match = (context == "*");\r
+ for (var k in ancestors) {\r
+ if (!ancestors[k]) {\r
+ // the impossible really happens.\r
+ continue;\r
+ }\r
+ if (match || (ancestors[k].tagName.toLowerCase() == context)) {\r
+ inContext = true;\r
+ for (var ka in attrs) {\r
+ if (!eval("ancestors[k]." + attrs[ka])) {\r
+ inContext = false;\r
+ break;\r
+ }\r
+ }\r
+ if (inContext) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ btn.state("enabled", (!text || btn.text) && inContext);\r
+ if (typeof cmd == "function") {\r
+ continue;\r
+ }\r
+ // look-it-up in the custom dropdown boxes\r
+ var dropdown = this.config.customSelects[cmd];\r
+ if ((!text || btn.text) && (typeof dropdown != "undefined")) {\r
+ dropdown.refresh(this);\r
+ continue;\r
+ }\r
+ switch (cmd) {\r
+ case "fontname":\r
+ case "fontsize":\r
+ case "formatblock":\r
+ if (!text) {\r
+ var value = ("" + doc.queryCommandValue(cmd)).toLowerCase();\r
+ if (!value) {\r
+ // FIXME: what do we do here?\r
+ break;\r
+ }\r
+ // HACK -- retrieve the config option for this\r
+ // combo box. We rely on the fact that the\r
+ // variable in config has the same name as\r
+ // button name in the toolbar.\r
+ var options = this.config[cmd];\r
+ var k = 0;\r
+ // btn.element.selectedIndex = 0;\r
+ for (var j in options) {\r
+ // FIXME: the following line is scary.\r
+ if ((j.toLowerCase() == value) ||\r
+ (options[j].substr(0, value.length).toLowerCase() == value)) {\r
+ btn.element.selectedIndex = k;\r
+ break;\r
+ }\r
+ ++k;\r
+ }\r
+ }\r
+ break;\r
+ case "textindicator":\r
+ if (!text) {\r
+ try {with (btn.element.style) {\r
+ backgroundColor = HTMLArea._makeColor(\r
+ doc.queryCommandValue(HTMLArea.is_ie ? "backcolor" : "hilitecolor"));\r
+ if (/transparent/i.test(backgroundColor)) {\r
+ // Mozilla\r
+ backgroundColor = HTMLArea._makeColor(doc.queryCommandValue("backcolor"));\r
+ }\r
+ color = HTMLArea._makeColor(doc.queryCommandValue("forecolor"));\r
+ fontFamily = doc.queryCommandValue("fontname");\r
+ fontWeight = doc.queryCommandState("bold") ? "bold" : "normal";\r
+ fontStyle = doc.queryCommandState("italic") ? "italic" : "normal";\r
+ }} catch (e) {\r
+ // alert(e + "\n\n" + cmd);\r
+ }\r
+ }\r
+ break;\r
+ case "htmlmode": btn.state("active", text); break;\r
+ default:\r
+ try {\r
+ btn.state("active", (!text && doc.queryCommandState(cmd)));\r
+ } catch (e) {}\r
+ }\r
+ }\r
+ // take undo snapshots\r
+ if (!this._timerUndo) {\r
+ this._undoTakeSnapshot();\r
+ var editor = this;\r
+ this._timerUndo = setTimeout(function() {\r
+ editor._timerUndo = null;\r
+ }, this.config.undoTimeout);\r
+ }\r
+ // check if any plugins have registered refresh handlers\r
+ for (var i in this.plugins) {\r
+ var plugin = this.plugins[i].instance;\r
+ if (typeof plugin.onUpdateToolbar == "function")\r
+ plugin.onUpdateToolbar();\r
+ }\r
+};\r
+\r
+/** Returns a node after which we can insert other nodes, in the current\r
+ * selection. The selection is removed. It splits a text node, if needed.\r
+ */\r
+HTMLArea.prototype.insertNodeAtSelection = function(toBeInserted) {\r
+ if (!HTMLArea.is_ie) {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ // remove the current selection\r
+ sel.removeAllRanges();\r
+ range.deleteContents();\r
+ var node = range.startContainer;\r
+ var pos = range.startOffset;\r
+ switch (node.nodeType) {\r
+ case 3: // Node.TEXT_NODE\r
+ // we have to split it at the caret position.\r
+ if (toBeInserted.nodeType == 3) {\r
+ // do optimized insertion\r
+ node.insertData(pos, toBeInserted.data);\r
+ range = this._createRange();\r
+ range.setEnd(node, pos + toBeInserted.length);\r
+ range.setStart(node, pos + toBeInserted.length);\r
+ sel.addRange(range);\r
+ } else {\r
+ node = node.splitText(pos);\r
+ var selnode = toBeInserted;\r
+ if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) {\r
+ selnode = selnode.firstChild;\r
+ }\r
+ node.parentNode.insertBefore(toBeInserted, node);\r
+ this.selectNodeContents(selnode);\r
+ this.updateToolbar();\r
+ }\r
+ break;\r
+ case 1: // Node.ELEMENT_NODE\r
+ var selnode = toBeInserted;\r
+ if (toBeInserted.nodeType == 11 /* Node.DOCUMENT_FRAGMENT_NODE */) {\r
+ selnode = selnode.firstChild;\r
+ }\r
+ node.insertBefore(toBeInserted, node.childNodes[pos]);\r
+ this.selectNodeContents(selnode);\r
+ this.updateToolbar();\r
+ break;\r
+ }\r
+ } else {\r
+ return null; // this function not yet used for IE <FIXME>\r
+ }\r
+};\r
+\r
+// Returns the deepest node that contains both endpoints of the selection.\r
+HTMLArea.prototype.getParentElement = function() {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ if (HTMLArea.is_ie) {\r
+ return range.parentElement ? range.parentElement() : this._doc.body;\r
+ } else {\r
+ var p = range.commonAncestorContainer;\r
+ while (p.nodeType == 3) {\r
+ p = p.parentNode;\r
+ }\r
+ return p;\r
+ }\r
+};\r
+\r
+// Returns an array with all the ancestor nodes of the selection.\r
+HTMLArea.prototype.getAllAncestors = function() {\r
+ var p = this.getParentElement();\r
+ var a = [];\r
+ while (p && (p.nodeType == 1) && (p.tagName.toLowerCase() != 'body')) {\r
+ a.push(p);\r
+ p = p.parentNode;\r
+ }\r
+ a.push(this._doc.body);\r
+ return a;\r
+};\r
+\r
+// Selects the contents inside the given node\r
+HTMLArea.prototype.selectNodeContents = function(node, pos) {\r
+ this.focusEditor();\r
+ this.forceRedraw();\r
+ var range;\r
+ var collapsed = (typeof pos != "undefined");\r
+ if (HTMLArea.is_ie) {\r
+ range = this._doc.body.createTextRange();\r
+ range.moveToElementText(node);\r
+ (collapsed) && range.collapse(pos);\r
+ range.select();\r
+ } else {\r
+ var sel = this._getSelection();\r
+ range = this._doc.createRange();\r
+ range.selectNodeContents(node);\r
+ (collapsed) && range.collapse(pos);\r
+ sel.removeAllRanges();\r
+ sel.addRange(range);\r
+ }\r
+};\r
+\r
+/** Call this function to insert HTML code at the current position. It deletes\r
+ * the selection, if any.\r
+ */\r
+HTMLArea.prototype.insertHTML = function(html) {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ if (HTMLArea.is_ie) {\r
+ range.pasteHTML(html);\r
+ } else {\r
+ // construct a new document fragment with the given HTML\r
+ var fragment = this._doc.createDocumentFragment();\r
+ var div = this._doc.createElement("div");\r
+ div.innerHTML = html;\r
+ while (div.firstChild) {\r
+ // the following call also removes the node from div\r
+ fragment.appendChild(div.firstChild);\r
+ }\r
+ // this also removes the selection\r
+ var node = this.insertNodeAtSelection(fragment);\r
+ }\r
+};\r
+\r
+/**\r
+ * Call this function to surround the existing HTML code in the selection with\r
+ * your tags. FIXME: buggy! This function will be deprecated "soon".\r
+ */\r
+HTMLArea.prototype.surroundHTML = function(startTag, endTag) {\r
+ var html = this.getSelectedHTML();\r
+ // the following also deletes the selection\r
+ this.insertHTML(startTag + html + endTag);\r
+};\r
+\r
+/// Retrieve the selected block\r
+HTMLArea.prototype.getSelectedHTML = function() {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ var existing = null;\r
+ if (HTMLArea.is_ie) {\r
+ existing = range.htmlText;\r
+ } else {\r
+ existing = HTMLArea.getHTML(range.cloneContents(), false);\r
+ }\r
+ return existing;\r
+};\r
+\r
+// Called when the user clicks on "InsertImage" button\r
+HTMLArea.prototype._insertImage = function() {\r
+ var editor = this; // for nested functions\r
+ this._popupDialog("insert_image.php?id=<?php echo $id ?>", function(param) {\r
+ if (!param) { // user must have pressed Cancel\r
+ return false;\r
+ }\r
+ var sel = editor._getSelection();\r
+ var range = editor._createRange(sel);\r
+ editor._doc.execCommand("insertimage", false, param["f_url"]);\r
+ var img = null;\r
+ if (HTMLArea.is_ie) {\r
+ img = range.parentElement();\r
+ // wonder if this works...\r
+ if (img.tagName.toLowerCase() != "img") {\r
+ img = img.previousSibling;\r
+ }\r
+ } else {\r
+ img = range.startContainer.previousSibling;\r
+ }\r
+ for (field in param) {\r
+ var value = param[field];\r
+ if (!value) {\r
+ continue;\r
+ }\r
+ switch (field) {\r
+ case "f_alt" : img.alt = value; break;\r
+ case "f_border" : img.border = parseInt(value); break;\r
+ case "f_align" : img.align = value; break;\r
+ case "f_vert" : img.vspace = parseInt(value); break;\r
+ case "f_horiz" : img.hspace = parseInt(value); break;\r
+ }\r
+ }\r
+ }, null);\r
+};\r
+\r
+// Called when the user clicks the Insert Table button\r
+HTMLArea.prototype._insertTable = function() {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ var editor = this; // for nested functions\r
+ this._popupDialog("insert_table.php", function(param) {\r
+ if (!param) { // user must have pressed Cancel\r
+ return false;\r
+ }\r
+ var doc = editor._doc;\r
+ // create the table element\r
+ var table = doc.createElement("table");\r
+ // assign the given arguments\r
+ for (var field in param) {\r
+ var value = param[field];\r
+ if (!value) {\r
+ continue;\r
+ }\r
+ switch (field) {\r
+ case "f_width" : table.style.width = value + param["f_unit"]; break;\r
+ case "f_align" : table.align = value; break;\r
+ case "f_border" : table.border = parseInt(value); break;\r
+ case "f_spacing" : table.cellspacing = parseInt(value); break;\r
+ case "f_padding" : table.cellpadding = parseInt(value); break;\r
+ }\r
+ }\r
+ var tbody = doc.createElement("tbody");\r
+ table.appendChild(tbody);\r
+ for (var i = 0; i < param["f_rows"]; ++i) {\r
+ var tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ for (var j = 0; j < param["f_cols"]; ++j) {\r
+ var td = doc.createElement("td");\r
+ /// Moodle hack\r
+ if(param["f_unit"] == "px") {\r
+ tdwidth = Math.round(table.width / param["f_cols"]);\r
+ } else {\r
+ tdwidth = Math.round(100 / param["f_cols"]);\r
+ } \r
+ td.setAttribute("width",tdwidth + param["f_unit"]);\r
+ td.setAttribute("valign","top");\r
+ /// Moodle hack -ends\r
+ tr.appendChild(td);\r
+ // Mozilla likes to see something inside the cell.\r
+ (HTMLArea.is_gecko) && td.appendChild(doc.createElement("br"));\r
+ }\r
+ }\r
+ if (HTMLArea.is_ie) {\r
+ range.pasteHTML(table.outerHTML);\r
+ } else {\r
+ // insert the table\r
+ editor.insertNodeAtSelection(table);\r
+ }\r
+ return true;\r
+ }, null);\r
+};\r
+\r
+/******************************************************************\r
+* Moodle hack - insertSmile\r
+******************************************************************/\r
+/// since method insertimage doesn't work the same way in mozilla\r
+/// as it does in IE, let's go around this for both browsers.\r
+HTMLArea.prototype._insertSmile = function() {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ var editor = this; // for nested functions\r
+ this._popupDialog("dlg_ins_smile.php", function(imgString) {\r
+ if(!imgString) {\r
+ return false;\r
+ }\r
+ if (HTMLArea.is_ie) {\r
+ range.pasteHTML(imgString);\r
+ } else {\r
+ // insert the table\r
+ editor.insertHTML(imgString);\r
+ }\r
+ return true;\r
+ }, null);\r
+};\r
+\r
+HTMLArea.prototype._insertChar = function() {\r
+ var sel = this._getSelection();\r
+ var range = this._createRange(sel);\r
+ var editor = this; // for nested functions\r
+ this._popupDialog("dlg_ins_char.php", function(sChar) {\r
+ if(!sChar) {\r
+ return false;\r
+ }\r
+ if (HTMLArea.is_ie) {\r
+ range.pasteHTML(sChar);\r
+ } else {\r
+ // insert the table\r
+ editor.insertHTML(sChar);\r
+ }\r
+ return true;\r
+ }, null);\r
+};\r
+/************************************************************************\r
+* Moodle hack's ends\r
+************************************************************************/\r
+/// Called when the user Pastes from Ctrl-V; \r
+HTMLArea.prototype._pasteSpecial = function() { \r
+ var editor = this; // for nested functions \r
+ editor.unPasteSpecial = function () {editor._unPasteSpecial()}; \r
+ HTMLArea._addEvent(editor._doc, "keyup",editor.unPasteSpecial); \r
+}; \r
+\r
+/// Called on Ctrl-V keyup; \r
+\r
+HTMLArea.prototype._unPasteSpecial = function() { \r
+ var editor = this; \r
+ HTMLArea._removeEvent(editor._doc, "keyup",editor.unPasteSpecial); \r
+ editor._wordClean(); \r
+}; \r
+\r
+// Word Clean Function; \r
+\r
+HTMLArea.prototype._wordClean = function() {\r
+ var D = this.getInnerHTML();\r
+ if (D.indexOf('class=Mso') >= 0 || D.indexOf('mso') >= 0) {\r
+\r
+ // make one line\r
+ D = D.replace(/\r\n/g, ' ').\r
+ replace(/\n/g, ' ').\r
+ replace(/\r/g, ' ').\r
+ replace(/\ \;/g,' ');\r
+\r
+ // keep tags, strip attributes\r
+ D = D.replace(/ class=[^\s|>]*/gi,'').\r
+ //replace(/<p [^>]*TEXT-ALIGN: justify[^>]*>/gi,'<p align="justify">').\r
+ replace(/ style=\"[^>]*\"/gi,'').\r
+ replace(/ align=[^\s|>]*/gi,'');\r
+\r
+ //clean up tags\r
+ D = D.replace(/<b [^>]*>/gi,'<b>').\r
+ replace(/<i [^>]*>/gi,'<i>').\r
+ replace(/<li [^>]*>/gi,'<li>').\r
+ replace(/<ul [^>]*>/gi,'<ul>');\r
+\r
+ // replace outdated tags\r
+ D = D.replace(/<b>/gi,'<strong>').\r
+ replace(/<\/b>/gi,'</strong>');\r
+\r
+ // mozilla doesn't like <em> tags\r
+ D = D.replace(/<em>/gi,'<i>').\r
+ replace(/<\/em>/gi,'</i>');\r
+\r
+ // kill unwanted tags\r
+ D = D.replace(/<\?xml:[^>]*>/g, ''). // Word xml\r
+ replace(/<\/?st1:[^>]*>/g,''). // Word SmartTags\r
+ replace(/<\/?[a-z]\:[^>]*>/g,''). // All other funny Word non-HTML stuff\r
+ replace(/<\/?font[^>]*>/gi,''). // Disable if you want to keep font formatting\r
+ replace(/<\/?span[^>]*>/gi,' ').\r
+ replace(/<\/?div[^>]*>/gi,' ').\r
+ replace(/<\/?pre[^>]*>/gi,' ').\r
+ //replace(/<\/?h[1-6][^>]*>/gi,' ').\r
+ /// Try to remove <!--[endif]--> and stuff\r
+ replace(/<!--[^>]*>/gi,''); /// MOODLE HACK - not so sure does this work right?\r
+\r
+ //remove empty tags\r
+ //D = D.replace(/<strong><\/strong>/gi,'').\r
+ //replace(/<i><\/i>/gi,'').\r
+ //replace(/<P[^>]*><\/P>/gi,'');\r
+\r
+ // nuke double tags\r
+ oldlen = D.length + 1;\r
+ while(oldlen > D.length) {\r
+ oldlen = D.length;\r
+ // join us now and free the tags, we'll be free hackers, we'll be free... ;-)\r
+ D = D.replace(/<([a-z][a-z]*)> *<\/\1>/gi,' ').\r
+ replace(/<([a-z][a-z]*)> *<([a-z][^>]*)> *<\/\1>/gi,'<$2>');\r
+ }\r
+ D = D.replace(/<([a-z][a-z]*)><\1>/gi,'<$1>').\r
+ replace(/<\/([a-z][a-z]*)><\/\1>/gi,'<\/$1>');\r
+\r
+ // nuke double spaces\r
+ D = D.replace(/ */gi,' ');\r
+\r
+ this.setHTML(D);\r
+ this.updateToolbar();\r
+ }\r
+};\r
+/***************************************************\r
+ * Category: EVENT HANDLERS\r
+ ***************************************************/\r
+\r
+// el is reference to the SELECT object\r
+// txt is the name of the select field, as in config.toolbar\r
+HTMLArea.prototype._comboSelected = function(el, txt) {\r
+ this.focusEditor();\r
+ var value = el.options[el.selectedIndex].value;\r
+ switch (txt) {\r
+ case "fontname":\r
+ case "fontsize": this.execCommand(txt, false, value); break;\r
+ case "formatblock":\r
+ (HTMLArea.is_ie) && (value = "<" + value + ">");\r
+ this.execCommand(txt, false, value);\r
+ break;\r
+ default:\r
+ // try to look it up in the registered dropdowns\r
+ var dropdown = this.config.customSelects[txt];\r
+ if (typeof dropdown != "undefined") {\r
+ dropdown.action(this);\r
+ } else {\r
+ alert("FIXME: combo box " + txt + " not implemented");\r
+ }\r
+ }\r
+};\r
+\r
+// the execCommand function (intercepts some commands and replaces them with\r
+// our own implementation)\r
+HTMLArea.prototype.execCommand = function(cmdID, UI, param) {\r
+ var editor = this; // for nested functions\r
+ this.focusEditor();\r
+ switch (cmdID.toLowerCase()) {\r
+ case "htmlmode" : this.setMode(); break;\r
+ case "hilitecolor":\r
+ (HTMLArea.is_ie) && (cmdID = "backcolor");\r
+ case "forecolor":\r
+ this._popupDialog("select_color.html", function(color) {\r
+ if (color) { // selection not canceled\r
+ editor._doc.execCommand(cmdID, false, "#" + color);\r
+ }\r
+ }, HTMLArea._colorToRgb(this._doc.queryCommandValue(cmdID)));\r
+ break;\r
+ case "createlink":\r
+ if (HTMLArea.is_ie || !UI) {\r
+ this._doc.execCommand(cmdID, UI, param);\r
+ } else {\r
+ // browser is Mozilla & wants UI\r
+ var param;\r
+ if ((param = prompt("Enter URL"))) {\r
+ this._doc.execCommand(cmdID, false, param);\r
+ }\r
+ }\r
+ break;\r
+ case "popupeditor":\r
+ if (HTMLArea.is_ie) {\r
+ window.open(this.popupURL("fullscreen.php?id=<?php echo $id ?>"), "ha_fullscreen",\r
+ "toolbar=no,location=no,directories=no,status=no,menubar=no," +\r
+ "scrollbars=no,resizable=yes,width=640,height=480");\r
+ } else {\r
+ window.open(this.popupURL("fullscreen.php?id=<?php echo $id ?>"), "ha_fullscreen",\r
+ "toolbar=no,menubar=no,personalbar=no,width=640,height=480," +\r
+ "scrollbars=no,resizable=yes");\r
+ }\r
+ // pass this object to the newly opened window\r
+ HTMLArea._object = this;\r
+ break;\r
+ case "undo": this.undo(); break;\r
+ case "redo": this.redo(); break;\r
+ case "inserttable": this._insertTable(); break;\r
+ case "insertimage": this._insertImage(); break;\r
+ case "insertsmile": this._insertSmile(); break;\r
+ case "insertchar": this._insertChar(); break;\r
+ case "about" : this._popupDialog("about.html", null, this); break;\r
+ case "showhelp" : window.open(this.config.editorURL + "reference.html", "ha_help"); break;\r
+ /// Moodle hack\r
+ case "pastespecial" : this._pasteSpecial(); break;\r
+ /// Moodle hack\r
+ default: this._doc.execCommand(cmdID, UI, param);\r
+ }\r
+ this.updateToolbar();\r
+ return false;\r
+};\r
+\r
+/** A generic event handler for things that happen in the IFRAME's document.\r
+ * This function also handles key bindings. */\r
+HTMLArea.prototype._editorEvent = function(ev) {\r
+ var editor = this;\r
+ var keyEvent = (HTMLArea.is_ie && ev.type == "keydown") || (ev.type == "keypress");\r
+ if (keyEvent && ev.ctrlKey && ! ev.altKey) {\r
+ var sel = null;\r
+ var range = null;\r
+ var key = String.fromCharCode(HTMLArea.is_ie ? ev.keyCode : ev.charCode).toLowerCase();\r
+ var cmd = null;\r
+ var value = null;\r
+ switch (key) {\r
+ case 'a':\r
+ if (!HTMLArea.is_ie) {\r
+ // KEY select all\r
+ sel = this._getSelection();\r
+ sel.removeAllRanges();\r
+ range = this._createRange();\r
+ range.selectNodeContents(this._doc.body);\r
+ sel.addRange(range);\r
+ HTMLArea._stopEvent(ev);\r
+ }\r
+ break;\r
+\r
+ // simple key commands follow\r
+\r
+ case 'b': cmd = "bold"; break;\r
+ case 'i': cmd = "italic"; break;\r
+ case 'u': cmd = "underline"; break;\r
+ case 's': cmd = "strikethrough"; break;\r
+ case 'l': cmd = "justifyleft"; break;\r
+ case 'e': cmd = "justifycenter"; break;\r
+ case 'r': cmd = "justifyright"; break;\r
+ case 'j': cmd = "justifyfull"; break;\r
+ case 'v': this.execCommand("pasteSpecial"); break;\r
+ case 'z': cmd = "undo"; break;\r
+ case 'y': cmd = "redo"; break;\r
+\r
+ // headings\r
+ case '1':\r
+ case '2':\r
+ case '3':\r
+ case '4':\r
+ case '5':\r
+ case '6':\r
+ cmd = "formatblock";\r
+ value = "h" + key;\r
+ if (HTMLArea.is_ie) {\r
+ value = "<" + value + ">";\r
+ }\r
+ break;\r
+ }\r
+ if (cmd) {\r
+ // execute simple command\r
+ this.execCommand(cmd, false, value);\r
+ HTMLArea._stopEvent(ev);\r
+ }\r
+ }\r
+ /*\r
+ else if (keyEvent) {\r
+ // other keys here\r
+ switch (ev.keyCode) {\r
+ case 13: // KEY enter\r
+ // if (HTMLArea.is_ie) {\r
+ this.insertHTML("<br />");\r
+ HTMLArea._stopEvent(ev);\r
+ // }\r
+ break;\r
+ }\r
+ }\r
+ */\r
+ // update the toolbar state after some time\r
+ if (editor._timerToolbar) {\r
+ clearTimeout(editor._timerToolbar);\r
+ }\r
+ editor._timerToolbar = setTimeout(function() {\r
+ editor.updateToolbar();\r
+ editor._timerToolbar = null;\r
+ }, 50);\r
+};\r
+\r
+// retrieve the HTML\r
+HTMLArea.prototype.getHTML = function() {\r
+ switch (this._editMode) {\r
+ case "wysiwyg" :\r
+ if (!this.config.fullPage)\r
+ return HTMLArea.getHTML(this._doc.body, false);\r
+ else\r
+ return this.doctype + "\n" + HTMLArea.getHTML(this._doc.documentElement, true);\r
+ case "textmode" : return this._textArea.value;\r
+ default : alert("Mode <" + mode + "> not defined!");\r
+ }\r
+ return false;\r
+};\r
+\r
+// retrieve the HTML (fastest version, but uses innerHTML)\r
+HTMLArea.prototype.getInnerHTML = function() {\r
+ switch (this._editMode) {\r
+ case "wysiwyg" :\r
+ if (!this.config.fullPage)\r
+ return this._doc.body.innerHTML;\r
+ else\r
+ return this.doctype + "\n" + this._doc.documentElement.innerHTML;\r
+ case "textmode" : return this._textArea.value;\r
+ default : alert("Mode <" + mode + "> not defined!");\r
+ }\r
+ return false;\r
+};\r
+\r
+// completely change the HTML inside\r
+HTMLArea.prototype.setHTML = function(html) {\r
+ switch (this._editMode) {\r
+ case "wysiwyg" :\r
+ if (!this.config.fullPage)\r
+ this._doc.body.innerHTML = html;\r
+ else\r
+ // this._doc.documentElement.innerHTML = html;\r
+ this._doc.body.innerHTML = html;\r
+ break;\r
+ case "textmode" : this._textArea.value = html; break;\r
+ default : alert("Mode <" + mode + "> not defined!");\r
+ }\r
+ return false;\r
+};\r
+\r
+// sets the given doctype (useful when config.fullPage is true)\r
+HTMLArea.prototype.setDoctype = function(doctype) {\r
+ this.doctype = doctype;\r
+};\r
+\r
+/***************************************************\r
+ * Category: UTILITY FUNCTIONS\r
+ ***************************************************/\r
+\r
+// browser identification\r
+\r
+HTMLArea.agt = navigator.userAgent.toLowerCase();\r
+HTMLArea.is_ie = ((HTMLArea.agt.indexOf("msie") != -1) && (HTMLArea.agt.indexOf("opera") == -1));\r
+HTMLArea.is_opera = (HTMLArea.agt.indexOf("opera") != -1);\r
+HTMLArea.is_mac = (HTMLArea.agt.indexOf("mac") != -1);\r
+HTMLArea.is_mac_ie = (HTMLArea.is_ie && HTMLArea.is_mac);\r
+HTMLArea.is_win_ie = (HTMLArea.is_ie && !HTMLArea.is_mac);\r
+HTMLArea.is_gecko = (navigator.product == "Gecko");\r
+\r
+// variable used to pass the object to the popup editor window.\r
+HTMLArea._object = null;\r
+\r
+// FIXME!!! this should return false for IE < 5.5\r
+HTMLArea.checkSupportedBrowser = function() {\r
+ if (HTMLArea.is_gecko) {\r
+ if (navigator.productSub < 20021201) {\r
+ alert("You need at least Mozilla-1.3 Alpha.\n" +\r
+ "Sorry, your Gecko is not supported.");\r
+ return false;\r
+ }\r
+ if (navigator.productSub < 20030210) {\r
+ alert("Mozilla < 1.3 Beta is not supported!\n" +\r
+ "I'll try, though, but it might not work.");\r
+ }\r
+ }\r
+ return HTMLArea.is_gecko || HTMLArea.is_ie;\r
+};\r
+\r
+// selection & ranges\r
+\r
+// returns the current selection object\r
+HTMLArea.prototype._getSelection = function() {\r
+ if (HTMLArea.is_ie) {\r
+ return this._doc.selection;\r
+ } else {\r
+ return this._iframe.contentWindow.getSelection();\r
+ }\r
+};\r
+\r
+// returns a range for the current selection\r
+HTMLArea.prototype._createRange = function(sel) {\r
+ if (HTMLArea.is_ie) {\r
+ return sel.createRange();\r
+ } else {\r
+ this.focusEditor();\r
+ if (typeof sel != "undefined") {\r
+ return sel.getRangeAt(0);\r
+ } else {\r
+ return this._doc.createRange();\r
+ }\r
+ }\r
+};\r
+\r
+// event handling\r
+\r
+HTMLArea._addEvent = function(el, evname, func) {\r
+ if (HTMLArea.is_ie) {\r
+ el.attachEvent("on" + evname, func);\r
+ } else {\r
+ el.addEventListener(evname, func, true);\r
+ }\r
+};\r
+\r
+HTMLArea._addEvents = function(el, evs, func) {\r
+ for (var i in evs) {\r
+ HTMLArea._addEvent(el, evs[i], func);\r
+ }\r
+};\r
+\r
+HTMLArea._removeEvent = function(el, evname, func) {\r
+ if (HTMLArea.is_ie) {\r
+ el.detachEvent("on" + evname, func);\r
+ } else {\r
+ el.removeEventListener(evname, func, true);\r
+ }\r
+};\r
+\r
+HTMLArea._removeEvents = function(el, evs, func) {\r
+ for (var i in evs) {\r
+ HTMLArea._removeEvent(el, evs[i], func);\r
+ }\r
+};\r
+\r
+HTMLArea._stopEvent = function(ev) {\r
+ if (HTMLArea.is_ie) {\r
+ ev.cancelBubble = true;\r
+ ev.returnValue = false;\r
+ } else {\r
+ ev.preventDefault();\r
+ ev.stopPropagation();\r
+ }\r
+};\r
+\r
+HTMLArea._removeClass = function(el, className) {\r
+ if (!(el && el.className)) {\r
+ return;\r
+ }\r
+ var cls = el.className.split(" ");\r
+ var ar = new Array();\r
+ for (var i = cls.length; i > 0;) {\r
+ if (cls[--i] != className) {\r
+ ar[ar.length] = cls[i];\r
+ }\r
+ }\r
+ el.className = ar.join(" ");\r
+};\r
+\r
+HTMLArea._addClass = function(el, className) {\r
+ // remove the class first, if already there\r
+ HTMLArea._removeClass(el, className);\r
+ el.className += " " + className;\r
+};\r
+\r
+HTMLArea._hasClass = function(el, className) {\r
+ if (!(el && el.className)) {\r
+ return false;\r
+ }\r
+ var cls = el.className.split(" ");\r
+ for (var i = cls.length; i > 0;) {\r
+ if (cls[--i] == className) {\r
+ return true;\r
+ }\r
+ }\r
+ return false;\r
+};\r
+\r
+HTMLArea.isBlockElement = function(el) {\r
+ var blockTags = " body form textarea fieldset ul ol dl li div " +\r
+ "p h1 h2 h3 h4 h5 h6 quote pre table thead " +\r
+ "tbody tfoot tr td iframe address ";\r
+ return (blockTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1);\r
+};\r
+\r
+HTMLArea.needsClosingTag = function(el) {\r
+ var closingTags = " head script style div span tr td tbody table em strong font a title ";\r
+ return (closingTags.indexOf(" " + el.tagName.toLowerCase() + " ") != -1);\r
+};\r
+\r
+// performs HTML encoding of some given string\r
+HTMLArea.htmlEncode = function(str) {\r
+ // we don't need regexp for that, but.. so be it for now.\r
+ str = str.replace(/&/ig, "&");\r
+ str = str.replace(/</ig, "<");\r
+ str = str.replace(/>/ig, ">");\r
+ str = str.replace(/\x22/ig, """);\r
+ // \x22 means '"' -- we use hex reprezentation so that we don't disturb\r
+ // JS compressors (well, at least mine fails.. ;)\r
+ return str;\r
+};\r
+\r
+// Retrieves the HTML code from the given node. This is a replacement for\r
+// getting innerHTML, using standard DOM calls.\r
+HTMLArea.getHTML = function(root, outputRoot) {\r
+ var html = "";\r
+ switch (root.nodeType) {\r
+ case 1: // Node.ELEMENT_NODE\r
+ case 11: // Node.DOCUMENT_FRAGMENT_NODE\r
+ var closed;\r
+ var i;\r
+ var root_tag = root.tagName.toLowerCase();\r
+ if (HTMLArea.is_ie && root_tag == "head") {\r
+ if (outputRoot)\r
+ html += "<head>";\r
+ // lowercasize\r
+ var save_multiline = RegExp.multiline;\r
+ RegExp.multiline = true;\r
+ var txt = root.innerHTML.replace(HTMLArea.RE_tagName, function(str, p1, p2) {\r
+ return p1 + p2.toLowerCase();\r
+ });\r
+ RegExp.multiline = save_multiline;\r
+ html += txt;\r
+ if (outputRoot)\r
+ html += "</head>";\r
+ break;\r
+ } else if (outputRoot) {\r
+ closed = (!(root.hasChildNodes() || HTMLArea.needsClosingTag(root)));\r
+ html = "<" + root.tagName.toLowerCase();\r
+ var attrs = root.attributes;\r
+ for (i = 0; i < attrs.length; ++i) {\r
+ var a = attrs.item(i);\r
+ if (!a.specified) {\r
+ continue;\r
+ }\r
+ var name = a.nodeName.toLowerCase();\r
+ if (/_moz|contenteditable/.test(name)) {\r
+ // avoid certain attributes\r
+ continue;\r
+ }\r
+ var value;\r
+ if (name != "style") {\r
+ // IE5.5 reports 25 when cellSpacing is\r
+ // 1; other values might be doomed too.\r
+ // For this reason we extract the\r
+ // values directly from the root node.\r
+ // I'm starting to HATE JavaScript\r
+ // development. Browser differences\r
+ // suck.\r
+ if (typeof root[a.nodeName] != "undefined") {\r
+ value = root[a.nodeName];\r
+ } else {\r
+ value = a.nodeValue;\r
+ }\r
+ } else { // IE fails to put style in attributes list\r
+ // FIXME: cssText reported by IE is UPPERCASE\r
+ value = root.style.cssText;\r
+ }\r
+ if (/_moz/.test(value)) {\r
+ // Mozilla reports some special tags\r
+ // here; we don't need them.\r
+ continue;\r
+ }\r
+ html += " " + name + '="' + value + '"';\r
+ }\r
+ html += closed ? " />" : ">";\r
+ }\r
+ for (i = root.firstChild; i; i = i.nextSibling) {\r
+ html += HTMLArea.getHTML(i, true);\r
+ }\r
+ if (outputRoot && !closed) {\r
+ html += "</" + root.tagName.toLowerCase() + ">";\r
+ }\r
+ break;\r
+ case 3: // Node.TEXT_NODE\r
+ html = HTMLArea.htmlEncode(root.data);\r
+ break;\r
+ case 8: // Node.COMMENT_NODE\r
+ html = "<!--" + root.data + "-->";\r
+ break; // skip comments, for now.\r
+ }\r
+ return html;\r
+};\r
+\r
+// creates a rgb-style color from a number\r
+HTMLArea._makeColor = function(v) {\r
+ if (typeof v != "number") {\r
+ // already in rgb (hopefully); IE doesn't get here.\r
+ return v;\r
+ }\r
+ // IE sends number; convert to rgb.\r
+ var r = v & 0xFF;\r
+ var g = (v >> 8) & 0xFF;\r
+ var b = (v >> 16) & 0xFF;\r
+ return "rgb(" + r + "," + g + "," + b + ")";\r
+};\r
+\r
+// returns hexadecimal color representation from a number or a rgb-style color.\r
+HTMLArea._colorToRgb = function(v) {\r
+ if (!v)\r
+ return '';\r
+\r
+ // returns the hex representation of one byte (2 digits)\r
+ function hex(d) {\r
+ return (d < 16) ? ("0" + d.toString(16)) : d.toString(16);\r
+ };\r
+\r
+ if (typeof v == "number") {\r
+ // we're talking to IE here\r
+ var r = v & 0xFF;\r
+ var g = (v >> 8) & 0xFF;\r
+ var b = (v >> 16) & 0xFF;\r
+ return "#" + hex(r) + hex(g) + hex(b);\r
+ }\r
+\r
+ if (v.substr(0, 3) == "rgb") {\r
+ // in rgb(...) form -- Mozilla\r
+ var re = /rgb\s*\(\s*([0-9]+)\s*,\s*([0-9]+)\s*,\s*([0-9]+)\s*\)/;\r
+ if (v.match(re)) {\r
+ var r = parseInt(RegExp.$1);\r
+ var g = parseInt(RegExp.$2);\r
+ var b = parseInt(RegExp.$3);\r
+ return "#" + hex(r) + hex(g) + hex(b);\r
+ }\r
+ // doesn't match RE?! maybe uses percentages or float numbers\r
+ // -- FIXME: not yet implemented.\r
+ return null;\r
+ }\r
+\r
+ if (v.substr(0, 1) == "#") {\r
+ // already hex rgb (hopefully :D )\r
+ return v;\r
+ }\r
+\r
+ // if everything else fails ;)\r
+ return null;\r
+};\r
+\r
+// modal dialogs for Mozilla (for IE we're using the showModalDialog() call).\r
+\r
+// receives an URL to the popup dialog and a function that receives one value;\r
+// this function will get called after the dialog is closed, with the return\r
+// value of the dialog.\r
+HTMLArea.prototype._popupDialog = function(url, action, init) {\r
+ Dialog(this.popupURL(url), action, init);\r
+};\r
+\r
+// paths\r
+\r
+HTMLArea.prototype.imgURL = function(file, plugin) {\r
+ if (typeof plugin == "undefined")\r
+ return this.config.editorURL + file;\r
+ else\r
+ return this.config.editorURL + "plugins/" + plugin + "/img/" + file;\r
+};\r
+\r
+HTMLArea.prototype.popupURL = function(file) {\r
+ var url = "";\r
+ if (file.match(/^plugin:\/\/(.*?)\/(.*)/)) {\r
+ var plugin = RegExp.$1;\r
+ var popup = RegExp.$2;\r
+ if (!/\.html$/.test(popup))\r
+ popup += ".html";\r
+ url = this.config.editorURL + "plugins/" + plugin + "/popups/" + popup;\r
+ } else\r
+ url = this.config.editorURL + this.config.popupURL + file;\r
+ return url;\r
+};\r
+\r
+// EOF\r
+// Local variables: //\r
+// c-basic-offset:8 //\r
+// indent-tabs-mode:t //\r
+// End: //\r
-// I18N constants -- Chinese Big-5
-// by Dave Lo -- dlo@interactivetools.com
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "b5",
-
- tooltips: {
- bold: "²ÊÅé",
- italic: "±×Åé",
- underline: "©³½u",
- strikethrough: "§R°£½u",
- subscript: "¤U¼Ð",
- superscript: "¤W¼Ð",
- justifyleft: "¦ì¸m¾a¥ª",
- justifycenter: "¦ì¸m©~¤¤",
- justifyright: "¦ì¸m¾a¥k",
- justifyfull: "¦ì¸m¥ª¥k¥µ¥",
- orderedlist: "¶¶§Ç²M³æ",
- unorderedlist: "µL§Ç²M³æ",
- outdent: "´î¤p¦æ«eªÅ¥Õ",
- indent: "¥[¼e¦æ«eªÅ¥Õ",
- forecolor: "¤å¦rÃC¦â",
- backcolor: "I´ºÃC¦â",
- horizontalrule: "¤ô¥½u",
- createlink: "´¡¤J³sµ²",
- insertimage: "´¡¤J¹Ï§Î",
- inserttable: "´¡¤Jªí®æ",
- htmlmode: "¤Á´«HTMLì©l½X",
- popupeditor: "©ñ¤j",
- about: "Ãö©ó HTMLArea",
- help: "»¡©ú",
- textindicator: "¦rÅé¨Ò¤l"
- }
-};
+// I18N constants -- Chinese Big-5\r
+// by Dave Lo -- dlo@interactivetools.com\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "b5",\r
+\r
+ tooltips: {\r
+ bold: "²ÊÅé",\r
+ italic: "±×Åé",\r
+ underline: "©³½u",\r
+ strikethrough: "§R°£½u",\r
+ subscript: "¤U¼Ð",\r
+ superscript: "¤W¼Ð",\r
+ justifyleft: "¦ì¸m¾a¥ª",\r
+ justifycenter: "¦ì¸m©~¤¤",\r
+ justifyright: "¦ì¸m¾a¥k",\r
+ justifyfull: "¦ì¸m¥ª¥k¥µ¥",\r
+ orderedlist: "¶¶§Ç²M³æ",\r
+ unorderedlist: "µL§Ç²M³æ",\r
+ outdent: "´î¤p¦æ«eªÅ¥Õ",\r
+ indent: "¥[¼e¦æ«eªÅ¥Õ",\r
+ forecolor: "¤å¦rÃC¦â",\r
+ backcolor: "I´ºÃC¦â",\r
+ horizontalrule: "¤ô¥½u",\r
+ createlink: "´¡¤J³sµ²",\r
+ insertimage: "´¡¤J¹Ï§Î",\r
+ inserttable: "´¡¤Jªí®æ",\r
+ htmlmode: "¤Á´«HTMLì©l½X",\r
+ popupeditor: "©ñ¤j",\r
+ about: "Ãö©ó HTMLArea",\r
+ help: "»¡©ú",\r
+ textindicator: "¦rÅé¨Ò¤l"\r
+ }\r
+};\r
--- /dev/null
+// I18N constants
+
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>
+
+// FOR TRANSLATORS:
+//
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
+// (at least a valid email address)
+//
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
+// (if this is not possible, please include a comment
+// that states what encoding is necessary.)
+<?php
+ include("../../../config.php");
+
+?>
+HTMLArea.I18N = {
+
+ // the following should be the filename without .js extension
+ // it will be used for automatically load plugin language.
+ lang: "en",
+
+ tooltips: {
+ bold: "<?php print_string("bold","editor") ?>",
+ italic: "<?php print_string("italic","editor") ?>",
+ underline: "<?php print_string("underline","editor") ?>",
+ strikethrough: "<?php print_string("strikethrough","editor") ?>",
+ subscript: "<?php print_string("subscript","editor") ?>",
+ superscript: "<?php print_string("superscript","editor") ?>",
+ justifyleft: "<?php print_string("justifyleft","editor") ?>",
+ justifycenter: "<?php print_string("justifycenter","editor") ?>",
+ justifyright: "<?php print_string("justifyright","editor") ?>",
+ justifyfull: "<?php print_string("justifyfull","editor") ?>",
+ insertorderedlist: "<?php print_string("orderedlist","editor") ?>",
+ insertunorderedlist: "<?php print_string("unorderedlist","editor") ?>",
+ outdent: "<?php print_string("outdent","editor") ?>",
+ indent: "<?php print_string("indent","editor") ?>",
+ forecolor: "<?php print_string("forecolor","editor") ?>",
+ hilitecolor: "<?php print_string("hilitecolor","editor") ?>",
+ inserthorizontalrule: "<?php print_string("horizontalrule","editor") ?>",
+ createlink: "<?php print_string("createlink","editor") ?>",
+ insertimage: "<?php print_string("insertimage","editor") ?>",
+ inserttable: "<?php print_string("inserttable","editor") ?>",
+ htmlmode: "<?php print_string("htmlmode","editor") ?>",
+ popupeditor: "<?php print_string("popupeditor","editor") ?>",
+ about: "<?php print_string("about","editor") ?>",
+ showhelp: "<?php print_string("showhelp","editor") ?>",
+ textindicator: "<?php print_string("textindicator","editor") ?>",
+ undo: "<?php print_string("undo","editor") ?>",
+ redo: "<?php print_string("redo","editor") ?>",
+ cut: "<?php print_string("cut","editor") ?>",
+ copy: "<?php print_string("copy","editor") ?>",
+ paste: "<?php print_string("paste","editor") ?>",
+ insertsmile: "<?php print_string("insertsmile","editor") ?>",
+ insertchar: "<?php print_string("insertchar","editor") ?>"
+ },
+
+ buttons: {
+ "ok": "<?php print_string("ok","editor") ?>",
+ "cancel": "<?php print_string("cancel","editor") ?>",
+ "browse": "<?php print_string("browse","editor") ?>"
+ },
+
+ msg: {
+ "Path": "<?php print_string("path","editor") ?>",
+ "TEXT_MODE": "<?php print_string("textmode","editor") ?>"
+ }
+};
-// danish version for htmlArea v3.0 - Alpha Release
-// - translated by rene<rene@laerke.net>
-// term´s and licenses are equal to htmlarea!
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "da",
-
- tooltips: {
- bold: "Fed",
- italic: "Kursiv",
- underline: "Understregning",
- strikethrough: "Overstregning ",
- subscript: "Sænket skrift",
- superscript: "Hævet skrift",
- justifyleft: "Venstrejuster",
- justifycenter: "Centrer",
- justifyright: "Højrejuster",
- justifyfull: "Lige margener",
- orderedlist: "Opstilling med tal",
- unorderedlist: "Opstilling med punkttegn",
- outdent: "Formindsk indrykning",
- indent: "Forøg indrykning",
- forecolor: "Skriftfarve",
- backcolor: "Baggrundsfarve",
- horizontalrule: "Horisontal linie",
- createlink: "Indsæt hyperlink",
- insertimage: "Indsæt billede",
- inserttable: "Indsæt tabel",
- htmlmode: "HTML visning",
- popupeditor: "Vis editor i popup",
- about: "Om htmlarea",
- help: "Hjælp",
- textindicator: "Anvendt stil"
- }
-};
+// danish version for htmlArea v3.0 - Alpha Release\r
+// - translated by rene<rene@laerke.net>\r
+// term´s and licenses are equal to htmlarea!\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "da",\r
+\r
+ tooltips: {\r
+ bold: "Fed",\r
+ italic: "Kursiv",\r
+ underline: "Understregning",\r
+ strikethrough: "Overstregning ",\r
+ subscript: "Sænket skrift",\r
+ superscript: "Hævet skrift",\r
+ justifyleft: "Venstrejuster",\r
+ justifycenter: "Centrer",\r
+ justifyright: "Højrejuster",\r
+ justifyfull: "Lige margener",\r
+ orderedlist: "Opstilling med tal",\r
+ unorderedlist: "Opstilling med punkttegn",\r
+ outdent: "Formindsk indrykning",\r
+ indent: "Forøg indrykning",\r
+ forecolor: "Skriftfarve",\r
+ backcolor: "Baggrundsfarve",\r
+ horizontalrule: "Horisontal linie",\r
+ createlink: "Indsæt hyperlink",\r
+ insertimage: "Indsæt billede",\r
+ inserttable: "Indsæt tabel",\r
+ htmlmode: "HTML visning",\r
+ popupeditor: "Vis editor i popup",\r
+ about: "Om htmlarea",\r
+ help: "Hjælp",\r
+ textindicator: "Anvendt stil"\r
+ }\r
+};\r
-// german version for htmlArea v3.0 - Alpha Release
-// - translated by AtK<atk@chello.at>
-// term´s and licenses are equal to htmlarea!
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "de",
-
- tooltips: {
- bold: "Fett",
- italic: "Kursiv",
- underline: "Unterstrichen",
- strikethrough: "Durchgestrichen",
- subscript: "hochgestellt",
- superscript: "tiefgestellt",
- justifyleft: "Links ausrichten",
- justifycenter: "Zentrieren",
- justifyright: "Rechts ausrichten",
- justifyfull: "Blocksatz",
- orderedlist: "Nummerierung",
- unorderedlist: "Aufzählungszeichen",
- outdent: "Einzug verkleinern",
- indent: "Einzug vergrössern",
- forecolor: "Text Farbe",
- backcolor: "Hintergrund Farbe",
- horizontalrule: "Horizontale Linie",
- createlink: "Hyperlink einfügen",
- insertimage: "Bild einfügen",
- inserttable: "Tabelle einfügen",
- htmlmode: "HTML Modus",
- popupeditor: "Editor im Popup öffnen",
- about: "Über htmlarea",
- help: "Hilfe",
- textindicator: "derzeitiger Stil"
- }
-};
+// german version for htmlArea v3.0 - Alpha Release\r
+// - translated by AtK<atk@chello.at>\r
+// term´s and licenses are equal to htmlarea!\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "de",\r
+\r
+ tooltips: {\r
+ bold: "Fett",\r
+ italic: "Kursiv",\r
+ underline: "Unterstrichen",\r
+ strikethrough: "Durchgestrichen",\r
+ subscript: "hochgestellt",\r
+ superscript: "tiefgestellt",\r
+ justifyleft: "Links ausrichten",\r
+ justifycenter: "Zentrieren",\r
+ justifyright: "Rechts ausrichten",\r
+ justifyfull: "Blocksatz",\r
+ orderedlist: "Nummerierung",\r
+ unorderedlist: "Aufzählungszeichen",\r
+ outdent: "Einzug verkleinern",\r
+ indent: "Einzug vergrössern",\r
+ forecolor: "Text Farbe",\r
+ backcolor: "Hintergrund Farbe",\r
+ horizontalrule: "Horizontale Linie",\r
+ createlink: "Hyperlink einfügen",\r
+ insertimage: "Bild einfügen",\r
+ inserttable: "Tabelle einfügen",\r
+ htmlmode: "HTML Modus",\r
+ popupeditor: "Editor im Popup öffnen",\r
+ about: "Über htmlarea",\r
+ help: "Hilfe",\r
+ textindicator: "derzeitiger Stil"\r
+ }\r
+};\r
-// I18N constants
-
-// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "en",
-
- tooltips: {
- bold: "Bold",
- italic: "Italic",
- underline: "Underline",
- strikethrough: "Strikethrough",
- subscript: "Subscript",
- superscript: "Superscript",
- justifyleft: "Justify Left",
- justifycenter: "Justify Center",
- justifyright: "Justify Right",
- justifyfull: "Justify Full",
- orderedlist: "Ordered List",
- unorderedlist: "Bulleted List",
- outdent: "Decrease Indent",
- indent: "Increase Indent",
- forecolor: "Font Color",
- hilitecolor: "Background Color",
- horizontalrule: "Horizontal Rule",
- createlink: "Insert Web Link",
- insertimage: "Insert Image",
- inserttable: "Insert Table",
- htmlmode: "Toggle HTML Source",
- popupeditor: "Enlarge Editor",
- about: "About this editor",
- showhelp: "Help using editor",
- textindicator: "Current style",
- undo: "Undoes your last action",
- redo: "Redoes your last action",
- cut: "Cut selection",
- copy: "Copy selection",
- paste: "Paste from clipboard"
- },
-
- buttons: {
- "ok": "OK",
- "cancel": "Cancel"
- },
-
- msg: {
- "Path": "Path",
- "TEXT_MODE": "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWIG."
- }
-};
+// I18N constants\r
+\r
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "en",\r
+\r
+ tooltips: {\r
+ bold: "Bold",\r
+ italic: "Italic",\r
+ underline: "Underline",\r
+ strikethrough: "Strikethrough",\r
+ subscript: "Subscript",\r
+ superscript: "Superscript",\r
+ justifyleft: "Justify Left",\r
+ justifycenter: "Justify Center",\r
+ justifyright: "Justify Right",\r
+ justifyfull: "Justify Full",\r
+ orderedlist: "Ordered List",\r
+ unorderedlist: "Bulleted List",\r
+ outdent: "Decrease Indent",\r
+ indent: "Increase Indent",\r
+ forecolor: "Font Color",\r
+ hilitecolor: "Background Color",\r
+ horizontalrule: "Horizontal Rule",\r
+ createlink: "Insert Web Link",\r
+ insertimage: "Insert Image",\r
+ inserttable: "Insert Table",\r
+ htmlmode: "Toggle HTML Source",\r
+ popupeditor: "Enlarge Editor",\r
+ about: "About this editor",\r
+ showhelp: "Help using editor",\r
+ textindicator: "Current style",\r
+ undo: "Undoes your last action",\r
+ redo: "Redoes your last action",\r
+ cut: "Cut selection",\r
+ copy: "Copy selection",\r
+ paste: "Paste from clipboard"\r
+ },\r
+\r
+ buttons: {\r
+ "ok": "OK",\r
+ "cancel": "Cancel"\r
+ },\r
+\r
+ msg: {\r
+ "Path": "Path",\r
+ "TEXT_MODE": "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWIG."\r
+ }\r
+};\r
<?php
- include("../../../config.php");
- $lastmodified = filemtime("en.php");
+ include("../../../config.php");
+ $lastmodified = filemtime("en.php");
$lifetime = 1800;
-
+
header("Content-type: application/x-javascript"); // Correct MIME type
header("Last-Modified: " . gmdate("D, d M Y H:i:s", lastmodified) . " GMT");
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $lifetime) . " GMT");
- header("Cache-control: max_age = $lifetime");
+ header("Cache-control: max_age = $lifetime");
header("Pragma: ");
-
+
?>
// I18N constants
-// I18N constants\r
+// I18N constants\r\r
+\r\r
+HTMLArea.I18N = {\r\r
\r
-HTMLArea.I18N = {\r
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "es",
-
- tooltips: {\r
- bold: "Negritas",\r
- italic: "Cursiva",\r
- underline: "Subrayado",\r
- strikethrough: "Texto Cruzado",\r
- subscript: "Subscript",\r
- superscript: "Superscript",\r
- justifyleft: "Alinear a la Izquierda",\r
- justifycenter: "Centrar",\r
- justifyright: "Alinear a la Derecha",\r
- justifyfull: "Justificar",\r
- orderedlist: "Lista Ordenada",\r
- unorderedlist: "Lista No Ordenada",\r
- outdent: "Aumentar Sangría",\r
- indent: "Disminuir Sangría",\r
- forecolor: "Color del Texto",\r
- backcolor: "Color del Fondo",\r
- horizontalrule: "Línea Horizontal",\r
- createlink: "Insertar Enlace",\r
- insertimage: "Insertar Imagen",\r
- inserttable: "Insertar Tabla",\r
- htmlmode: "Ver Documento en HTML",\r
- popupeditor: "Ampliar Editor",\r
- about: "Acerca del Editor",\r
- help: "Ayuda",\r
- textindicator: "Estilo Actual"\r
- }\r
-};\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "es",\r
+\r
+ tooltips: {\r\r
+ bold: "Negritas",\r\r
+ italic: "Cursiva",\r\r
+ underline: "Subrayado",\r\r
+ strikethrough: "Texto Cruzado",\r\r
+ subscript: "Subscript",\r\r
+ superscript: "Superscript",\r\r
+ justifyleft: "Alinear a la Izquierda",\r\r
+ justifycenter: "Centrar",\r\r
+ justifyright: "Alinear a la Derecha",\r\r
+ justifyfull: "Justificar",\r\r
+ orderedlist: "Lista Ordenada",\r\r
+ unorderedlist: "Lista No Ordenada",\r\r
+ outdent: "Aumentar Sangría",\r\r
+ indent: "Disminuir Sangría",\r\r
+ forecolor: "Color del Texto",\r\r
+ backcolor: "Color del Fondo",\r\r
+ horizontalrule: "Línea Horizontal",\r\r
+ createlink: "Insertar Enlace",\r\r
+ insertimage: "Insertar Imagen",\r\r
+ inserttable: "Insertar Tabla",\r\r
+ htmlmode: "Ver Documento en HTML",\r\r
+ popupeditor: "Ampliar Editor",\r\r
+ about: "Acerca del Editor",\r\r
+ help: "Ayuda",\r\r
+ textindicator: "Estilo Actual"\r\r
+ }\r\r
+};\r\r
-// I18N constants
-
-// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "fi",
-
- tooltips: {
- bold: "Lihavointi",
- italic: "Kursivointi",
- underline: "Alleviivaus",
- strikethrough: "Päälleviivaus",
- subscript: "Alaindeksi",
- superscript: "Yläindeksi",
- justifyleft: "Tasaa vasemmat reunat",
- justifycenter: "Keskitä",
- justifyright: "Tasaa oikeat reunat",
- justifyfull: "Tasaa molemmat reunat",
- orderedlist: "Numerointi",
- unorderedlist: "Luettelomerkit",
- outdent: "Lisää sisennystä",
- indent: "Vähennä sisennystä",
- forecolor: "Tekstin väri",
- hilitecolor: "Taustan väri",
- horizontalrule: "Vaakaviiva",
- createlink: "Lisää linkki",
- insertimage: "Lisää kuva",
- inserttable: "Lisää taulukko",
- htmlmode: "Näytä HTML koodi",
- popupeditor: "Suurenna editori",
- about: "Tietoja editorista",
- showhelp: "Ohje",
- textindicator: "Nykyinen tyyli",
- undo: "Peruuta viimeinen toiminto",
- redo: "Palauta viimeinen toiminto",
- cut: "Leikkaa",
- copy: "Kopioi",
- paste: "Liitä"
- },
-
- buttons: {
- "ok": "OK",
- "cancel": "Peruuta",
- },
-
- msg: {
- "Path": "Polku",
- "TEXT_MODE": "Olet tekstitilassa. Käytä [<>] painiketta palataksesi WYSIWIG -tilaan."
- }
-};
+// I18N constants\r
+\r
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "fi",\r
+\r
+ tooltips: {\r
+ bold: "Lihavointi",\r
+ italic: "Kursivointi",\r
+ underline: "Alleviivaus",\r
+ strikethrough: "Päälleviivaus",\r
+ subscript: "Alaindeksi",\r
+ superscript: "Yläindeksi",\r
+ justifyleft: "Tasaa vasemmat reunat",\r
+ justifycenter: "Keskitä",\r
+ justifyright: "Tasaa oikeat reunat",\r
+ justifyfull: "Tasaa molemmat reunat",\r
+ orderedlist: "Numerointi",\r
+ unorderedlist: "Luettelomerkit",\r
+ outdent: "Lisää sisennystä",\r
+ indent: "Vähennä sisennystä",\r
+ forecolor: "Tekstin väri",\r
+ hilitecolor: "Taustan väri",\r
+ horizontalrule: "Vaakaviiva",\r
+ createlink: "Lisää linkki",\r
+ insertimage: "Lisää kuva",\r
+ inserttable: "Lisää taulukko",\r
+ htmlmode: "Näytä HTML koodi",\r
+ popupeditor: "Suurenna editori",\r
+ about: "Tietoja editorista",\r
+ showhelp: "Ohje",\r
+ textindicator: "Nykyinen tyyli",\r
+ undo: "Peruuta viimeinen toiminto",\r
+ redo: "Palauta viimeinen toiminto",\r
+ cut: "Leikkaa",\r
+ copy: "Kopioi",\r
+ paste: "Liitä"\r
+ },\r
+\r
+ buttons: {\r
+ "ok": "OK",\r
+ "cancel": "Peruuta",\r
+ },\r
+\r
+ msg: {\r
+ "Path": "Polku",\r
+ "TEXT_MODE": "Olet tekstitilassa. Käytä [<>] painiketta palataksesi WYSIWIG -tilaan."\r
+ }\r
+};\r
-// I18N constants
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "fr",
-
- tooltips: {
- bold: "Gras",
- italic: "Italique",
- underline: "Souligné",
- strikethrough: "Barré",
- subscript: "Subscript",
- superscript: "Superscript",
- justifyleft: "Aligné à gauche",
- justifycenter: "Centré",
- justifyright: "Aligné à droite",
- justifyfull: "Justifié",
- orderedlist: "Numérotation",
- unorderedlist: "Puces",
- outdent: "Augmenter le retrait",
- indent: "Diminuer le retrait",
- forecolor: "Couleur du texte",
- backcolor: "Couleur du fond",
- horizontalrule: "Ligne horizontale",
- createlink: "Insérer un lien",
- insertimage: "Insérer une image",
- inserttable: "Insérer un tableau",
- htmlmode: "Passer au code source HTML",
- popupeditor: "Agrandir l'éditeur",
- about: "A propos de cet éditeur",
- help: "Aide sur l'éditeur",
- textindicator: "Style courant"
- }
-};
+// I18N constants\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "fr",\r
+\r
+ tooltips: {\r
+ bold: "Gras",\r
+ italic: "Italique",\r
+ underline: "Souligné",\r
+ strikethrough: "Barré",\r
+ subscript: "Subscript",\r
+ superscript: "Superscript",\r
+ justifyleft: "Aligné à gauche",\r
+ justifycenter: "Centré",\r
+ justifyright: "Aligné à droite",\r
+ justifyfull: "Justifié",\r
+ orderedlist: "Numérotation",\r
+ unorderedlist: "Puces",\r
+ outdent: "Augmenter le retrait",\r
+ indent: "Diminuer le retrait",\r
+ forecolor: "Couleur du texte",\r
+ backcolor: "Couleur du fond",\r
+ horizontalrule: "Ligne horizontale",\r
+ createlink: "Insérer un lien",\r
+ insertimage: "Insérer une image",\r
+ inserttable: "Insérer un tableau",\r
+ htmlmode: "Passer au code source HTML",\r
+ popupeditor: "Agrandir l'éditeur",\r
+ about: "A propos de cet éditeur",\r
+ help: "Aide sur l'éditeur",\r
+ textindicator: "Style courant"\r
+ }\r
+};\r
-// I18N constants -- Chinese GB
-// by Dave Lo -- dlo@interactivetools.com
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "gb",
-
- tooltips: {
- bold: "´ÖÌå",
- italic: "бÌå",
- underline: "µ×Ïß",
- strikethrough: "ɾ³ýÏß",
- subscript: "챐",
- superscript: "Éϱê",
- justifyleft: "λÖÿ¿×ó",
- justifycenter: "λÖþÓÖÐ",
- justifyright: "λÖÿ¿ÓÒ",
- justifyfull: "λÖÃ×óÓÒÆ½µÈ",
- orderedlist: "˳ÐòÇåµ¥",
- unorderedlist: "ÎÞÐòÇåµ¥",
- outdent: "¼õСÐÐǰ¿Õ°×",
- indent: "¼Ó¿íÐÐǰ¿Õ°×",
- forecolor: "ÎÄ×ÖÑÕÉ«",
- backcolor: "±³¾°ÑÕÉ«",
- horizontalrule: "ˮƽÏß",
- createlink: "²åÈëÁ¬½á",
- insertimage: "²åÈëͼÐÎ",
- inserttable: "²åÈë±í¸ñ",
- htmlmode: "Çл»HTMLÔʼÂë",
- popupeditor: "·Å´ó",
- about: "¹Øì¶ HTMLArea",
- help: "˵Ã÷",
- textindicator: "×ÖÌåÀý×Ó"
- }
-};
+// I18N constants -- Chinese GB\r
+// by Dave Lo -- dlo@interactivetools.com\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "gb",\r
+\r
+ tooltips: {\r
+ bold: "´ÖÌå",\r
+ italic: "бÌå",\r
+ underline: "µ×Ïß",\r
+ strikethrough: "ɾ³ýÏß",\r
+ subscript: "챐",\r
+ superscript: "Éϱê",\r
+ justifyleft: "λÖÿ¿×ó",\r
+ justifycenter: "λÖþÓÖÐ",\r
+ justifyright: "λÖÿ¿ÓÒ",\r
+ justifyfull: "λÖÃ×óÓÒÆ½µÈ",\r
+ orderedlist: "˳ÐòÇåµ¥",\r
+ unorderedlist: "ÎÞÐòÇåµ¥",\r
+ outdent: "¼õСÐÐǰ¿Õ°×",\r
+ indent: "¼Ó¿íÐÐǰ¿Õ°×",\r
+ forecolor: "ÎÄ×ÖÑÕÉ«",\r
+ backcolor: "±³¾°ÑÕÉ«",\r
+ horizontalrule: "ˮƽÏß",\r
+ createlink: "²åÈëÁ¬½á",\r
+ insertimage: "²åÈëͼÐÎ",\r
+ inserttable: "²åÈë±í¸ñ",\r
+ htmlmode: "Çл»HTMLÔʼÂë",\r
+ popupeditor: "·Å´ó",\r
+ about: "¹Øì¶ HTMLArea",\r
+ help: "˵Ã÷",\r
+ textindicator: "×ÖÌåÀý×Ó"\r
+ }\r
+};\r
-// I18N constants
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "it",
-
- tooltips: {
- bold: "Grassetto",
- italic: "Corsivo",
- underline: "Sottolineato",
- strikethrough: "Barrato",
- subscript: "Pedice",
- superscript: "Apice",
- justifyleft: "Allinea a sinistra",
- justifycenter: "Centra",
- justifyright: "Allinea a destra",
- justifyfull: "Giustifica",
- orderedlist: "Elenco numerato",
- unorderedlist: "Elenco puntato",
- outdent: "Riduci rientro",
- indent: "Aumenta rientro",
- forecolor: "Colore carattere",
- backcolor: "Colore di sfondo",
- horizontalrule: "Linea orizzontale",
- createlink: "Inserisci collegamento ipertestuale",
- insertimage: "Inserisci immagine",
- inserttable: "Inserisci tabella",
- htmlmode: "Passa alla visualizzazione HTML",
- popupeditor: "Ingrandisci editor",
- about: "Info",
- help: "Aiuto",
- textindicator: "Stile utilizzato"
- }
-};
+// I18N constants\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "it",\r
+\r
+ tooltips: {\r
+ bold: "Grassetto",\r
+ italic: "Corsivo",\r
+ underline: "Sottolineato",\r
+ strikethrough: "Barrato",\r
+ subscript: "Pedice",\r
+ superscript: "Apice",\r
+ justifyleft: "Allinea a sinistra",\r
+ justifycenter: "Centra",\r
+ justifyright: "Allinea a destra",\r
+ justifyfull: "Giustifica",\r
+ orderedlist: "Elenco numerato",\r
+ unorderedlist: "Elenco puntato",\r
+ outdent: "Riduci rientro",\r
+ indent: "Aumenta rientro",\r
+ forecolor: "Colore carattere",\r
+ backcolor: "Colore di sfondo",\r
+ horizontalrule: "Linea orizzontale",\r
+ createlink: "Inserisci collegamento ipertestuale",\r
+ insertimage: "Inserisci immagine",\r
+ inserttable: "Inserisci tabella",\r
+ htmlmode: "Passa alla visualizzazione HTML",\r
+ popupeditor: "Ingrandisci editor",\r
+ about: "Info",\r
+ help: "Aiuto",\r
+ textindicator: "Stile utilizzato"\r
+ }\r
+};\r
-// I18N constants -- Japanese EUC
-// by Manabu Onoue -- tmocsys@tmocsys.com
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ja-euc",
-
- tooltips: {
- bold: "ÂÀ»ú",
- italic: "¼ÐÂÎ",
- underline: "²¼Àþ",
- strikethrough: "ÂǤÁ¾Ã¤·Àþ",
- subscript: "²¼Éդꤍ»ú",
- superscript: "¾åÉդꤍ»ú",
- justifyleft: "º¸´ó¤»",
- justifycenter: "Ãæ±û´ó¤»",
- justifyright: "±¦´ó¤»",
- justifyfull: "¶ÑÅù³äÉÕ",
- orderedlist: "ÈÖ¹æÉÕ¤²Õ¾ò½ñ¤",
- unorderedlist: "µ¹æÉÕ¤²Õ¾ò½ñ¤",
- outdent: "¥¤¥ó¥Ç¥ó¥È²ò½ü",
- indent: "¥¤¥ó¥Ç¥ó¥ÈÀßÄê",
- forecolor: "ʸ»ú¿§",
- backcolor: "ÇØ·Ê¿§",
- horizontalrule: "¿åÊ¿Àþ",
- createlink: "¥ê¥ó¥¯ºîÀ®",
- insertimage: "²èÁüÁÞÆþ",
- inserttable: "¥Æ¡¼¥Ö¥ëÁÞÆþ",
- htmlmode: "HTMLɽ¼¨ÀÚÂØ",
- popupeditor: "¥¨¥Ç¥£¥¿³ÈÂç",
- about: "¥Ð¡¼¥¸¥ç¥ó¾ðÊó",
- help: "¥Ø¥ë¥×",
- textindicator: "¸½ºß¤Î¥¹¥¿¥¤¥ë"
- }
-};
+// I18N constants -- Japanese EUC\r
+// by Manabu Onoue -- tmocsys@tmocsys.com\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ja-euc",\r
+\r
+ tooltips: {\r
+ bold: "ÂÀ»ú",\r
+ italic: "¼ÐÂÎ",\r
+ underline: "²¼Àþ",\r
+ strikethrough: "ÂǤÁ¾Ã¤·Àþ",\r
+ subscript: "²¼Éդꤍ»ú",\r
+ superscript: "¾åÉդꤍ»ú",\r
+ justifyleft: "º¸´ó¤»",\r
+ justifycenter: "Ãæ±û´ó¤»",\r
+ justifyright: "±¦´ó¤»",\r
+ justifyfull: "¶ÑÅù³äÉÕ",\r
+ orderedlist: "ÈÖ¹æÉÕ¤²Õ¾ò½ñ¤",\r
+ unorderedlist: "µ¹æÉÕ¤²Õ¾ò½ñ¤",\r
+ outdent: "¥¤¥ó¥Ç¥ó¥È²ò½ü",\r
+ indent: "¥¤¥ó¥Ç¥ó¥ÈÀßÄê",\r
+ forecolor: "ʸ»ú¿§",\r
+ backcolor: "ÇØ·Ê¿§",\r
+ horizontalrule: "¿åÊ¿Àþ",\r
+ createlink: "¥ê¥ó¥¯ºîÀ®",\r
+ insertimage: "²èÁüÁÞÆþ",\r
+ inserttable: "¥Æ¡¼¥Ö¥ëÁÞÆþ",\r
+ htmlmode: "HTMLɽ¼¨ÀÚÂØ",\r
+ popupeditor: "¥¨¥Ç¥£¥¿³ÈÂç",\r
+ about: "¥Ð¡¼¥¸¥ç¥ó¾ðÊó",\r
+ help: "¥Ø¥ë¥×",\r
+ textindicator: "¸½ºß¤Î¥¹¥¿¥¤¥ë"\r
+ }\r
+};\r
-// I18N constants -- Japanese JIS
-// by Manabu Onoue -- tmocsys@tmocsys.com
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ja-jis",
-
- tooltips: {
- bold: "\e$BB@;z\e(B",
- italic: "\e$B<PBN\e(B",
- underline: "\e$B2<@~\e(B",
- strikethrough: "\e$BBG$A>C$7@~\e(B",
- subscript: "\e$B2<IU$-E:$(;z\e(B",
- superscript: "\e$B>eIU$-E:$(;z\e(B",
- justifyleft: "\e$B:84s$;\e(B",
- justifycenter: "\e$BCf1{4s$;\e(B",
- justifyright: "\e$B1&4s$;\e(B",
- justifyfull: "\e$B6QEy3dIU\e(B",
- orderedlist: "\e$BHV9fIU$-2U>r=q$-\e(B",
- unorderedlist: "\e$B5-9fIU$-2U>r=q$-\e(B",
- outdent: "\e$B%$%s%G%s%H2r=|\e(B",
- indent: "\e$B%$%s%G%s%H@_Dj\e(B",
- forecolor: "\e$BJ8;z?'\e(B",
- backcolor: "\e$BGX7J?'\e(B",
- horizontalrule: "\e$B?eJ?@~\e(B",
- createlink: "\e$B%j%s%/:n@.\e(B",
- insertimage: "\e$B2hA|A^F~\e(B",
- inserttable: "\e$B%F!<%V%kA^F~\e(B",
- htmlmode: "HTML\e$BI=<(@ZBX\e(B",
- popupeditor: "\e$B%(%G%#%?3HBg\e(B",
- about: "\e$B%P!<%8%g%s>pJs\e(B",
- help: "\e$B%X%k%W\e(B",
- textindicator: "\e$B8=:_$N%9%?%$%k\e(B"
- }
-};
+// I18N constants -- Japanese JIS\r
+// by Manabu Onoue -- tmocsys@tmocsys.com\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ja-jis",\r
+\r
+ tooltips: {\r
+ bold: "\e$BB@;z\e(B",\r
+ italic: "\e$B<PBN\e(B",\r
+ underline: "\e$B2<@~\e(B",\r
+ strikethrough: "\e$BBG$A>C$7@~\e(B",\r
+ subscript: "\e$B2<IU$-E:$(;z\e(B",\r
+ superscript: "\e$B>eIU$-E:$(;z\e(B",\r
+ justifyleft: "\e$B:84s$;\e(B",\r
+ justifycenter: "\e$BCf1{4s$;\e(B",\r
+ justifyright: "\e$B1&4s$;\e(B",\r
+ justifyfull: "\e$B6QEy3dIU\e(B",\r
+ orderedlist: "\e$BHV9fIU$-2U>r=q$-\e(B",\r
+ unorderedlist: "\e$B5-9fIU$-2U>r=q$-\e(B",\r
+ outdent: "\e$B%$%s%G%s%H2r=|\e(B",\r
+ indent: "\e$B%$%s%G%s%H@_Dj\e(B",\r
+ forecolor: "\e$BJ8;z?'\e(B",\r
+ backcolor: "\e$BGX7J?'\e(B",\r
+ horizontalrule: "\e$B?eJ?@~\e(B",\r
+ createlink: "\e$B%j%s%/:n@.\e(B",\r
+ insertimage: "\e$B2hA|A^F~\e(B",\r
+ inserttable: "\e$B%F!<%V%kA^F~\e(B",\r
+ htmlmode: "HTML\e$BI=<(@ZBX\e(B",\r
+ popupeditor: "\e$B%(%G%#%?3HBg\e(B",\r
+ about: "\e$B%P!<%8%g%s>pJs\e(B",\r
+ help: "\e$B%X%k%W\e(B",\r
+ textindicator: "\e$B8=:_$N%9%?%$%k\e(B"\r
+ }\r
+};\r
-// I18N constants -- Japanese Shift-JIS
-// by Manabu Onoue -- tmocsys@tmocsys.com
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ja-sjis",
-
- tooltips: {
- bold: "\91¾\8e\9a",
- italic: "\8eÎ\91Ì",
- underline: "\89º\90ü",
- strikethrough: "\91Å\82¿\8fÁ\82µ\90ü",
- subscript: "\89º\95t\82«\93Y\82¦\8e\9a",
- superscript: "\8fã\95t\82«\93Y\82¦\8e\9a",
- justifyleft: "\8d¶\8añ\82¹",
- justifycenter: "\92\86\89\9b\8añ\82¹",
- justifyright: "\89E\8añ\82¹",
- justifyfull: "\8bÏ\93\99\8a\84\95t",
- orderedlist: "\94Ô\8d\86\95t\82«\89Ó\8fð\8f\91\82«",
- unorderedlist: "\8bL\8d\86\95t\82«\89Ó\8fð\8f\91\82«",
- outdent: "\83C\83\93\83f\83\93\83g\89ð\8f\9c",
- indent: "\83C\83\93\83f\83\93\83g\90Ý\92è",
- forecolor: "\95¶\8e\9a\90F",
- backcolor: "\94w\8ci\90F",
- horizontalrule: "\90\85\95½\90ü",
- createlink: "\83\8a\83\93\83N\8dì\90¬",
- insertimage: "\89æ\91\9c\91}\93ü",
- inserttable: "\83e\81[\83u\83\8b\91}\93ü",
- htmlmode: "HTML\95\\8e¦\90Ø\91Ö",
- popupeditor: "\83G\83f\83B\83^\8ag\91å",
- about: "\83o\81[\83W\83\87\83\93\8fî\95ñ",
- help: "\83w\83\8b\83v",
- textindicator: "\8c»\8dÝ\82Ì\83X\83^\83C\83\8b"
- }
-};
+// I18N constants -- Japanese Shift-JIS\r
+// by Manabu Onoue -- tmocsys@tmocsys.com\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ja-sjis",\r
+\r
+ tooltips: {\r
+ bold: "\91¾\8e\9a",\r
+ italic: "\8eÎ\91Ì",\r
+ underline: "\89º\90ü",\r
+ strikethrough: "\91Å\82¿\8fÁ\82µ\90ü",\r
+ subscript: "\89º\95t\82«\93Y\82¦\8e\9a",\r
+ superscript: "\8fã\95t\82«\93Y\82¦\8e\9a",\r
+ justifyleft: "\8d¶\8añ\82¹",\r
+ justifycenter: "\92\86\89\9b\8añ\82¹",\r
+ justifyright: "\89E\8añ\82¹",\r
+ justifyfull: "\8bÏ\93\99\8a\84\95t",\r
+ orderedlist: "\94Ô\8d\86\95t\82«\89Ó\8fð\8f\91\82«",\r
+ unorderedlist: "\8bL\8d\86\95t\82«\89Ó\8fð\8f\91\82«",\r
+ outdent: "\83C\83\93\83f\83\93\83g\89ð\8f\9c",\r
+ indent: "\83C\83\93\83f\83\93\83g\90Ý\92è",\r
+ forecolor: "\95¶\8e\9a\90F",\r
+ backcolor: "\94w\8ci\90F",\r
+ horizontalrule: "\90\85\95½\90ü",\r
+ createlink: "\83\8a\83\93\83N\8dì\90¬",\r
+ insertimage: "\89æ\91\9c\91}\93ü",\r
+ inserttable: "\83e\81[\83u\83\8b\91}\93ü",\r
+ htmlmode: "HTML\95\\8e¦\90Ø\91Ö",\r
+ popupeditor: "\83G\83f\83B\83^\8ag\91å",\r
+ about: "\83o\81[\83W\83\87\83\93\8fî\95ñ",\r
+ help: "\83w\83\8b\83v",\r
+ textindicator: "\8c»\8dÝ\82Ì\83X\83^\83C\83\8b"\r
+ }\r
+};\r
-// I18N constants -- Japanese UTF-8
-// by Manabu Onoue -- tmocsys@tmocsys.com
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ja-utf8",
-
- tooltips: {
- bold: "太字",
- italic: "斜体",
- underline: "下線",
- strikethrough: "打ち消し線",
- subscript: "下付き添え字",
- superscript: "上付き添え字",
- justifyleft: "左寄せ",
- justifycenter: "中央寄せ",
- justifyright: "右寄せ",
- justifyfull: "均等割付",
- orderedlist: "番号付き箇条書き",
- unorderedlist: "記号付き箇条書き",
- outdent: "インデント解除",
- indent: "インデント設定",
- forecolor: "文字色",
- backcolor: "背景色",
- horizontalrule: "水平線",
- createlink: "リンク作成",
- insertimage: "画像挿入",
- inserttable: "テーブル挿入",
- htmlmode: "HTML表示切替",
- popupeditor: "エディタ拡大",
- about: "バージョン情報",
- help: "ヘルプ",
- textindicator: "現在のスタイル"
- }
-};
+// I18N constants -- Japanese UTF-8\r
+// by Manabu Onoue -- tmocsys@tmocsys.com\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ja-utf8",\r
+\r
+ tooltips: {\r
+ bold: "太字",\r
+ italic: "斜体",\r
+ underline: "下線",\r
+ strikethrough: "打ち消し線",\r
+ subscript: "下付き添え字",\r
+ superscript: "上付き添え字",\r
+ justifyleft: "左寄せ",\r
+ justifycenter: "中央寄せ",\r
+ justifyright: "右寄せ",\r
+ justifyfull: "均等割付",\r
+ orderedlist: "番号付き箇条書き",\r
+ unorderedlist: "記号付き箇条書き",\r
+ outdent: "インデント解除",\r
+ indent: "インデント設定",\r
+ forecolor: "文字色",\r
+ backcolor: "背景色",\r
+ horizontalrule: "水平線",\r
+ createlink: "リンク作成",\r
+ insertimage: "画像挿入",\r
+ inserttable: "テーブル挿入",\r
+ htmlmode: "HTML表示切替",\r
+ popupeditor: "エディタ拡大",\r
+ about: "バージョン情報",\r
+ help: "ヘルプ",\r
+ textindicator: "現在のスタイル"\r
+ }\r
+};\r
-// I18N constants
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "nb",
-
- tooltips: {
- bold: "Fet",
- italic: "Kursiv",
- underline: "Understreket",
- strikethrough: "Gjennomstreket",
- subscript: "Senket",
- superscript: "Hevet",
- justifyleft: "Venstrejuster",
- justifycenter: "Midtjuster",
- justifyright: "Høyrejuster",
- justifyfull: "Blokkjuster",
- orderedlist: "Nummerert liste",
- unorderedlist: "Punktmerket liste",
- outdent: "Øke innrykk",
- indent: "Reduser innrykk",
- forecolor: "Skriftfarge",
- backcolor: "Bakgrunnsfarge",
- horizontalrule: "Horisontal linje",
- createlink: "Sett inn lenke",
- insertimage: "Sett inn bilde",
- inserttable: "Sett inn tabell",
- htmlmode: "Vis HTML kode",
- popupeditor: "Forstørr redigeringsvindu",
- about: "Om..",
- help: "Hjelp",
- textindicator: "Gjeldende stil"
- }
-};
+// I18N constants\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "nb",\r
+\r
+ tooltips: {\r
+ bold: "Fet",\r
+ italic: "Kursiv",\r
+ underline: "Understreket",\r
+ strikethrough: "Gjennomstreket",\r
+ subscript: "Senket",\r
+ superscript: "Hevet",\r
+ justifyleft: "Venstrejuster",\r
+ justifycenter: "Midtjuster",\r
+ justifyright: "Høyrejuster",\r
+ justifyfull: "Blokkjuster",\r
+ orderedlist: "Nummerert liste",\r
+ unorderedlist: "Punktmerket liste",\r
+ outdent: "Øke innrykk",\r
+ indent: "Reduser innrykk",\r
+ forecolor: "Skriftfarge",\r
+ backcolor: "Bakgrunnsfarge",\r
+ horizontalrule: "Horisontal linje",\r
+ createlink: "Sett inn lenke",\r
+ insertimage: "Sett inn bilde",\r
+ inserttable: "Sett inn tabell",\r
+ htmlmode: "Vis HTML kode",\r
+ popupeditor: "Forstørr redigeringsvindu",\r
+ about: "Om..",\r
+ help: "Hjelp",\r
+ textindicator: "Gjeldende stil"\r
+ }\r
+};\r
-// Dutch version
-// Author: Wouter Meeus alias Redspider <webmaster@tielt.be>
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "nl",
-
- tooltips: {
- bold: "Vet",
- italic: "Cursief",
- underline: "Onderlijnen",
- strikethrough: "Doorstrepen",
- subscript: "Subscript",
- superscript: "Superscript",
- justifyleft: "Links Uitlijnen",
- justifycenter: "Centreren",
- justifyright: "Rechts Uitlijnen",
- justifyfull: "Uitvullen",
- orderedlist: "Nummering",
- unorderedlist: "Opsomming",
- outdent: "Verklein insprong",
- indent: "Vergroot insprong",
- forecolor: "Tekst Kleur",
- backcolor: "Achtergrond Kleur",
- horizontalrule: "Horizontale lijn",
- createlink: "Hyperlink invoegen",
- insertimage: "Afbeelding invoegen",
- inserttable: "Tabel invoegen",
- htmlmode: "HTML broncode",
- popupeditor: "Vergroot Editor",
- about: "Over deze editor",
- help: "Help",
- textindicator: "Huidige stijl"
- }
-};
+// Dutch version\r
+// Author: Wouter Meeus alias Redspider <webmaster@tielt.be>\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "nl",\r
+\r
+ tooltips: {\r
+ bold: "Vet",\r
+ italic: "Cursief",\r
+ underline: "Onderlijnen",\r
+ strikethrough: "Doorstrepen",\r
+ subscript: "Subscript",\r
+ superscript: "Superscript",\r
+ justifyleft: "Links Uitlijnen",\r
+ justifycenter: "Centreren",\r
+ justifyright: "Rechts Uitlijnen",\r
+ justifyfull: "Uitvullen",\r
+ orderedlist: "Nummering",\r
+ unorderedlist: "Opsomming",\r
+ outdent: "Verklein insprong",\r
+ indent: "Vergroot insprong",\r
+ forecolor: "Tekst Kleur",\r
+ backcolor: "Achtergrond Kleur",\r
+ horizontalrule: "Horizontale lijn",\r
+ createlink: "Hyperlink invoegen",\r
+ insertimage: "Afbeelding invoegen",\r
+ inserttable: "Tabel invoegen",\r
+ htmlmode: "HTML broncode",\r
+ popupeditor: "Vergroot Editor",\r
+ about: "Over deze editor",\r
+ help: "Help",\r
+ textindicator: "Huidige stijl"\r
+ }\r
+};\r
-// I18N constants
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "fi",
-
- tooltips: {
- bold: "Lihavoitu",
- italic: "Kursivoitu",
- underline: "Alleviivattu",
- strikethrough: "Yliviivattu",
- subscript: "Alaindeksi",
- superscript: "Yläindeksi",
- justifyleft: "Tasaa vasemmat reunat",
- justifycenter: "Keskitä",
- justifyright: "Tasaa oikeat reunat",
- justifyfull: "Tasaa molemmat reunat",
- insertorderedlist: "Numerointi",
- insertunorderedlist: "Luettelomerkit",
- outdent: "Lisää sisennystä",
- indent: "Pienennä sisennystä",
- forecolor: "Fontin väri",
- hilitecolor: "Taustaväri",
- inserthorizontalrule: "Vaakaviiva",
- createlink: "Lisää Linkki",
- insertimage: "Lisää Kuva",
- inserttable: "Lisää Taulu",
- htmlmode: "HTML Lähdekoodi vs WYSIWYG",
- popupeditor: "Suurenna Editori",
- about: "Tietoja Editorista",
- showhelp: "Näytä Ohje",
- textindicator: "Nykyinen tyyli",
- undo: "Peruuta viimeinen toiminto",
- redo: "Palauta viimeinen toiminto",
- cut: "Leikkaa maalattu",
- copy: "Kopioi maalattu",
- paste: "Liitä leikepyödältä"
- },
-
- buttons: {
- "ok": "Hyväksy",
- "cancel": "Peruuta"
- },
-
- msg: {
- "Path": "Polku",
- "TEXT_MODE": "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWIG."
- }
-};
+// I18N constants\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "fi",\r
+\r
+ tooltips: {\r
+ bold: "Lihavoitu",\r
+ italic: "Kursivoitu",\r
+ underline: "Alleviivattu",\r
+ strikethrough: "Yliviivattu",\r
+ subscript: "Alaindeksi",\r
+ superscript: "Yläindeksi",\r
+ justifyleft: "Tasaa vasemmat reunat",\r
+ justifycenter: "Keskitä",\r
+ justifyright: "Tasaa oikeat reunat",\r
+ justifyfull: "Tasaa molemmat reunat",\r
+ insertorderedlist: "Numerointi",\r
+ insertunorderedlist: "Luettelomerkit",\r
+ outdent: "Lisää sisennystä",\r
+ indent: "Pienennä sisennystä",\r
+ forecolor: "Fontin väri",\r
+ hilitecolor: "Taustaväri",\r
+ inserthorizontalrule: "Vaakaviiva",\r
+ createlink: "Lisää Linkki",\r
+ insertimage: "Lisää Kuva",\r
+ inserttable: "Lisää Taulu",\r
+ htmlmode: "HTML Lähdekoodi vs WYSIWYG",\r
+ popupeditor: "Suurenna Editori",\r
+ about: "Tietoja Editorista",\r
+ showhelp: "Näytä Ohje",\r
+ textindicator: "Nykyinen tyyli",\r
+ undo: "Peruuta viimeinen toiminto",\r
+ redo: "Palauta viimeinen toiminto",\r
+ cut: "Leikkaa maalattu",\r
+ copy: "Kopioi maalattu",\r
+ paste: "Liitä leikepyödältä"\r
+ },\r
+\r
+ buttons: {\r
+ "ok": "Hyväksy",\r
+ "cancel": "Peruuta"\r
+ },\r
+ \r
+ msg: {\r
+ "Path": "Polku",\r
+ "TEXT_MODE": "You are in TEXT MODE. Use the [<>] button to switch back to WYSIWIG."\r
+ }\r
+};\r
-// I18N constants\r
+// I18N constants\r\r
+\r\r
+HTMLArea.I18N = {\r\r
\r
-HTMLArea.I18N = {\r
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "pl",
-
- tooltips: {\r
- bold: "Pogrubienie",\r
- italic: "Pochylenie",\r
- underline: "Podkre\9clenie",\r
- strikethrough: "Przekre\9clenie",\r
- subscript: "Indeks dolny",\r
- superscript: "Indeks górny",\r
- justifyleft: "Wyrównaj do lewej",\r
- justifycenter: "Wy\9crodkuj",\r
- justifyright: "Wyrównaj do prawej",\r
- justifyfull: "Wyjustuj",\r
- orderedlist: "Numerowanie",\r
- unorderedlist: "Wypunktowanie",\r
- outdent: "Zmniejsz wciêcie",\r
- indent: "Zwiêksz wciêcie",\r
- forecolor: "Kolor czcionki",\r
- backcolor: "Kolor t³a",\r
- horizontalrule: "Linia pozioma",\r
- createlink: "Wstaw adres sieci Web",\r
- insertimage: "Wstaw obraz",\r
- inserttable: "Wstaw tabelê",\r
- htmlmode: "Edycja WYSIWYG/w \9fródle strony",\r
- popupeditor: "Pe³ny ekran",\r
- about: "Informacje o tym edytorze",\r
- help: "Pomoc",\r
- textindicator: "Obecny styl"\r
- }\r
-};\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "pl",\r
+\r
+ tooltips: {\r\r
+ bold: "Pogrubienie",\r\r
+ italic: "Pochylenie",\r\r
+ underline: "Podkre\9clenie",\r\r
+ strikethrough: "Przekre\9clenie",\r\r
+ subscript: "Indeks dolny",\r\r
+ superscript: "Indeks górny",\r\r
+ justifyleft: "Wyrównaj do lewej",\r\r
+ justifycenter: "Wy\9crodkuj",\r\r
+ justifyright: "Wyrównaj do prawej",\r\r
+ justifyfull: "Wyjustuj",\r\r
+ orderedlist: "Numerowanie",\r\r
+ unorderedlist: "Wypunktowanie",\r\r
+ outdent: "Zmniejsz wciêcie",\r\r
+ indent: "Zwiêksz wciêcie",\r\r
+ forecolor: "Kolor czcionki",\r\r
+ backcolor: "Kolor t³a",\r\r
+ horizontalrule: "Linia pozioma",\r\r
+ createlink: "Wstaw adres sieci Web",\r\r
+ insertimage: "Wstaw obraz",\r\r
+ inserttable: "Wstaw tabelê",\r\r
+ htmlmode: "Edycja WYSIWYG/w \9fródle strony",\r\r
+ popupeditor: "Pe³ny ekran",\r\r
+ about: "Informacje o tym edytorze",\r\r
+ help: "Pomoc",\r\r
+ textindicator: "Obecny styl"\r\r
+ }\r\r
+};\r\r
-// I18N constants\r
-// Brazilian Portuguese Translation by Alex Piaz <webmaster@globalmap.com>\r
+// I18N constants\r\r
+// Brazilian Portuguese Translation by Alex Piaz <webmaster@globalmap.com>\r\r
+\r\r
+HTMLArea.I18N = {\r\r
\r
-HTMLArea.I18N = {\r
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "pt_br",
-
- tooltips: {\r
- bold: "Negrito",\r
- italic: "Itálico",\r
- underline: "Sublinhado",\r
- strikethrough: "Tachado",\r
- subscript: "Subescrito",\r
- superscript: "Sobrescrito",\r
- justifyleft: "Alinhar à Esquerda",\r
- justifycenter: "Centralizar",\r
- justifyright: "Alinhar à Direita",\r
- justifyfull: "Justificar",\r
- orderedlist: "Lista Numerada",\r
- unorderedlist: "Lista Marcadores",\r
- outdent: "Diminuir Indentação",\r
- indent: "Aumentar Indentação",\r
- forecolor: "Cor da Fonte",\r
- backcolor: "Cor do Fundo",\r
- horizontalrule: "Linha Horizontal",\r
- createlink: "Inserir Link",\r
- insertimage: "Inserir Imagem",\r
- inserttable: "Inserir Tabela",\r
- htmlmode: "Ver Código-Fonte",\r
- popupeditor: "Expandir Editor",\r
- about: "Sobre",\r
- help: "Ajuda",\r
- textindicator: "Estilo Atual"\r
- }\r
-};\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "pt_br",\r
+\r
+ tooltips: {\r\r
+ bold: "Negrito",\r\r
+ italic: "Itálico",\r\r
+ underline: "Sublinhado",\r\r
+ strikethrough: "Tachado",\r\r
+ subscript: "Subescrito",\r\r
+ superscript: "Sobrescrito",\r\r
+ justifyleft: "Alinhar à Esquerda",\r\r
+ justifycenter: "Centralizar",\r\r
+ justifyright: "Alinhar à Direita",\r\r
+ justifyfull: "Justificar",\r\r
+ orderedlist: "Lista Numerada",\r\r
+ unorderedlist: "Lista Marcadores",\r\r
+ outdent: "Diminuir Indentação",\r\r
+ indent: "Aumentar Indentação",\r\r
+ forecolor: "Cor da Fonte",\r\r
+ backcolor: "Cor do Fundo",\r\r
+ horizontalrule: "Linha Horizontal",\r\r
+ createlink: "Inserir Link",\r\r
+ insertimage: "Inserir Imagem",\r\r
+ inserttable: "Inserir Tabela",\r\r
+ htmlmode: "Ver Código-Fonte",\r\r
+ popupeditor: "Expandir Editor",\r\r
+ about: "Sobre",\r\r
+ help: "Ajuda",\r\r
+ textindicator: "Estilo Atual"\r\r
+ }\r\r
+};\r\r
-// I18N constants
-
-// LANG: "ro", ENCODING: UTF-8
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ro",
-
- tooltips: {
- bold: "Îngroşat",
- italic: "Italic",
- underline: "Subliniat",
- strikethrough: "Tăiat",
- subscript: "Subscript",
- superscript: "Superscript",
- justifyleft: "Aliniere la stânga",
- justifycenter: "Aliniere pe centru",
- justifyright: "Aliniere la dreapta",
- justifyfull: "Aliniere în ambele părţi",
- orderedlist: "Listă ordonată",
- unorderedlist: "Listă marcată",
- outdent: "Micşorează alineatul",
- indent: "Măreşte alineatul",
- forecolor: "Culoarea textului",
- hilitecolor: "Culoare de fundal",
- horizontalrule: "Linie orizontală",
- createlink: "Inserează link",
- insertimage: "Inserează o imagine",
- inserttable: "Inserează un tabel",
- htmlmode: "Sursa HTML / WYSIWYG",
- popupeditor: "Maximizează editorul",
- about: "Despre editor",
- showhelp: "Documentaţie (devel)",
- textindicator: "Stilul curent",
- undo: "Anulează ultima acţiune",
- redo: "Reface ultima acţiune anulată",
- cut: "Taie în clipboard",
- copy: "Copie în clipboard",
- paste: "Aduce din clipboard"
- },
-
- buttons: {
- "ok": "OK",
- "cancel": "Anulează"
- },
-
- msg: {
- "Path": "Calea",
- "TEXT_MODE": "Eşti în modul TEXT. Apasă butonul [<>] pentru a te întoarce în modul WYSIWYG."
- }
-};
+// I18N constants\r
+\r
+// LANG: "ro", ENCODING: UTF-8\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ro",\r
+\r
+ tooltips: {\r
+ bold: "Îngroşat",\r
+ italic: "Italic",\r
+ underline: "Subliniat",\r
+ strikethrough: "Tăiat",\r
+ subscript: "Subscript",\r
+ superscript: "Superscript",\r
+ justifyleft: "Aliniere la stânga",\r
+ justifycenter: "Aliniere pe centru",\r
+ justifyright: "Aliniere la dreapta",\r
+ justifyfull: "Aliniere în ambele părţi",\r
+ orderedlist: "Listă ordonată",\r
+ unorderedlist: "Listă marcată",\r
+ outdent: "Micşorează alineatul",\r
+ indent: "Măreşte alineatul",\r
+ forecolor: "Culoarea textului",\r
+ hilitecolor: "Culoare de fundal",\r
+ horizontalrule: "Linie orizontală",\r
+ createlink: "Inserează link",\r
+ insertimage: "Inserează o imagine",\r
+ inserttable: "Inserează un tabel",\r
+ htmlmode: "Sursa HTML / WYSIWYG",\r
+ popupeditor: "Maximizează editorul",\r
+ about: "Despre editor",\r
+ showhelp: "Documentaţie (devel)",\r
+ textindicator: "Stilul curent",\r
+ undo: "Anulează ultima acţiune",\r
+ redo: "Reface ultima acţiune anulată",\r
+ cut: "Taie în clipboard",\r
+ copy: "Copie în clipboard",\r
+ paste: "Aduce din clipboard"\r
+ },\r
+\r
+ buttons: {\r
+ "ok": "OK",\r
+ "cancel": "Anulează"\r
+ },\r
+\r
+ msg: {\r
+ "Path": "Calea",\r
+ "TEXT_MODE": "Eşti în modul TEXT. Apasă butonul [<>] pentru a te întoarce în modul WYSIWYG."\r
+ }\r
+};\r
-// I18N constants
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "ru",
-
- tooltips: {
- bold: "Æèðíûé",
- italic: "Íàêëîííûé",
- underline: "Ïîä÷åðêíóòûé",
- strikethrough: "Ïåðå÷åðêíóòûé",
- subscript: "Íèæíèé èíäåêñ",
- superscript: "Âåðõíèé èíäåêñ",
- justifyleft: "Âûðàâíèâàíèå ïî ëåâîìó êðàþ",
- justifycenter: "Âûðàâíèâàíèå ïî öåíòðó",
- justifyright: "Âûðàâíèâàíèå ïî ïðàâîìó êðàþ",
- justifyfull: "Ðàñòÿíóòûé òåêñò",
- orderedlist: "Íóìåðîâàííûé ñïèñîê",
- unorderedlist: "Ìàðêèðîâàííûé ñïèñîê",
- outdent: "Ñäâèã â ëåâî",
- indent: "Ñäâèã â ïðàâî",
- forecolor: "Öâåò øðèôòà",
- backcolor: "Öâåò ôîíà",
- horizontalrule: "Ãîðèçîíòàëüíàÿ ëèíèÿ",
- createlink: "Âñòàâèòü ññûëêó",
- insertimage: "Âñòàâèòü êàðòèíêó",
- inserttable: "Âñòàâèòü òàáëèöó",
- htmlmode: "Âèäåòü HTML êîä",
- popupeditor: "Óâåëè÷èòü ðåäàêòîð",
- about: "Î ðåäàêòîðå",
- help: "Ïîìîùü â èñïîëüçîâàíèè",
- textindicator: "Äàííûé ñòèëü"
- }
-};
+// I18N constants\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "ru",\r
+\r
+ tooltips: {\r
+ bold: "Æèðíûé",\r
+ italic: "Íàêëîííûé",\r
+ underline: "Ïîä÷åðêíóòûé",\r
+ strikethrough: "Ïåðå÷åðêíóòûé",\r
+ subscript: "Íèæíèé èíäåêñ",\r
+ superscript: "Âåðõíèé èíäåêñ",\r
+ justifyleft: "Âûðàâíèâàíèå ïî ëåâîìó êðàþ",\r
+ justifycenter: "Âûðàâíèâàíèå ïî öåíòðó",\r
+ justifyright: "Âûðàâíèâàíèå ïî ïðàâîìó êðàþ",\r
+ justifyfull: "Ðàñòÿíóòûé òåêñò",\r
+ orderedlist: "Íóìåðîâàííûé ñïèñîê",\r
+ unorderedlist: "Ìàðêèðîâàííûé ñïèñîê",\r
+ outdent: "Ñäâèã â ëåâî",\r
+ indent: "Ñäâèã â ïðàâî",\r
+ forecolor: "Öâåò øðèôòà",\r
+ backcolor: "Öâåò ôîíà",\r
+ horizontalrule: "Ãîðèçîíòàëüíàÿ ëèíèÿ",\r
+ createlink: "Âñòàâèòü ññûëêó",\r
+ insertimage: "Âñòàâèòü êàðòèíêó",\r
+ inserttable: "Âñòàâèòü òàáëèöó",\r
+ htmlmode: "Âèäåòü HTML êîä",\r
+ popupeditor: "Óâåëè÷èòü ðåäàêòîð",\r
+ about: "Î ðåäàêòîðå",\r
+ help: "Ïîìîùü â èñïîëüçîâàíèè",\r
+ textindicator: "Äàííûé ñòèëü"\r
+ }\r
+};\r
-// Swedish version for htmlArea v3.0 - Alpha Release\r
-// - translated by pat<pat@engvall.nu>\r
-// term´s and licenses are equal to htmlarea!\r
+// Swedish version for htmlArea v3.0 - Alpha Release\r\r
+// - translated by pat<pat@engvall.nu>\r\r
+// term´s and licenses are equal to htmlarea!\r\r
+\r\r
+HTMLArea.I18N = {\r\r
\r
-HTMLArea.I18N = {\r
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "se",
-
- tooltips: {\r
- bold: "Fet",\r
- italic: "Kursiv",\r
- underline: "Understruken",\r
- strikethrough: "Genomstruken",\r
- subscript: "Nedsänkt",\r
- superscript: "Upphöjd",\r
- justifyleft: "Vänsterjustera",\r
- justifycenter: "Centrera",\r
- justifyright: "Högerjustera",\r
- justifyfull: "Marginaljustera",\r
- orderedlist: "Numrerad lista",\r
- unorderedlist: "Punktlista",\r
- outdent: "Minska indrag",\r
- indent: "Öka indrag",\r
- forecolor: "Textfärg",\r
- backcolor: "Bakgrundsfärg",\r
- horizontalrule: "Vågrät linje",\r
- createlink: "Infoga länk",\r
- insertimage: "Infoga bild",\r
- inserttable: "Infoga tabell",\r
- htmlmode: "Visa källkod",\r
- popupeditor: "Visa i eget fönster",\r
- about: "Om denna editor",\r
- help: "Hjälp",\r
- textindicator: "Nuvarande stil"\r
- }\r
-};\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "se",\r
+\r
+ tooltips: {\r\r
+ bold: "Fet",\r\r
+ italic: "Kursiv",\r\r
+ underline: "Understruken",\r\r
+ strikethrough: "Genomstruken",\r\r
+ subscript: "Nedsänkt",\r\r
+ superscript: "Upphöjd",\r\r
+ justifyleft: "Vänsterjustera",\r\r
+ justifycenter: "Centrera",\r\r
+ justifyright: "Högerjustera",\r\r
+ justifyfull: "Marginaljustera",\r\r
+ orderedlist: "Numrerad lista",\r\r
+ unorderedlist: "Punktlista",\r\r
+ outdent: "Minska indrag",\r\r
+ indent: "Öka indrag",\r\r
+ forecolor: "Textfärg",\r\r
+ backcolor: "Bakgrundsfärg",\r\r
+ horizontalrule: "Vågrät linje",\r\r
+ createlink: "Infoga länk",\r\r
+ insertimage: "Infoga bild",\r\r
+ inserttable: "Infoga tabell",\r\r
+ htmlmode: "Visa källkod",\r\r
+ popupeditor: "Visa i eget fönster",\r\r
+ about: "Om denna editor",\r\r
+ help: "Hjälp",\r\r
+ textindicator: "Nuvarande stil"\r\r
+ }\r\r
+};\r\r
-// I18N constants : Vietnamese
-// mviet: download the free Vietnamese script addon for htmlArea at: www.mviet.org
-// email: mviet@socal.rr.com
-
-HTMLArea.I18N = {
-
- // the following should be the filename without .js extension
- // it will be used for automatically load plugin language.
- lang: "vn",
-
- tooltips: {
- bold: "Đậm",
- italic: "Nghiêng",
- underline: "Gạch Đít",
- strikethrough: "Gạch Xóa",
- subscript: "Viết Xuống Dưới",
- superscript: "Viết Lên Trên ",
- justifyleft: "Ngay Hàng Bên Trái ",
- justifycenter: "Ngay Hàng Giữa",
- justifyright: "Ngay Hàng Lên Phải",
- justifyfull: "Ngay Hàng Trái & Phải",
- orderedlist: "Chuỗi Thứ Tự 123",
- unorderedlist: "Chuỗi Nút",
- outdent: "Giảm Vào Hàng",
- indent: "Tăng Vào Hàng",
- forecolor: "Màu Chữ",
- backcolor: "Màu Nền",
- horizontalrule: "Thước Ngang",
- createlink: "Tạo Nối",
- insertimage: "Mang Hình Vô",
- inserttable: "Mang Khuôn Vô",
- htmlmode: "Bật / Tắt Nguồn HTML",
- popupeditor: "Póp Lớn Khung Viết",
- about: "Nói Về Chương Trình",
- help: "Giúp Đỡ",
- textindicator: "Loại Kiểu Viết"
- }
-};
+// I18N constants : Vietnamese\r
+// mviet: download the free Vietnamese script addon for htmlArea at: www.mviet.org\r
+// email: mviet@socal.rr.com\r
+\r
+HTMLArea.I18N = {\r
+\r
+ // the following should be the filename without .js extension\r
+ // it will be used for automatically load plugin language.\r
+ lang: "vn",\r
+\r
+ tooltips: {\r
+ bold: "Đậm",\r
+ italic: "Nghiêng",\r
+ underline: "Gạch Đít",\r
+ strikethrough: "Gạch Xóa",\r
+ subscript: "Viết Xuống Dưới",\r
+ superscript: "Viết Lên Trên ",\r
+ justifyleft: "Ngay Hàng Bên Trái ",\r
+ justifycenter: "Ngay Hàng Giữa",\r
+ justifyright: "Ngay Hàng Lên Phải",\r
+ justifyfull: "Ngay Hàng Trái & Phải",\r
+ orderedlist: "Chuỗi Thứ Tự 123",\r
+ unorderedlist: "Chuỗi Nút",\r
+ outdent: "Giảm Vào Hàng",\r
+ indent: "Tăng Vào Hàng",\r
+ forecolor: "Màu Chữ",\r
+ backcolor: "Màu Nền",\r
+ horizontalrule: "Thước Ngang",\r
+ createlink: "Tạo Nối",\r
+ insertimage: "Mang Hình Vô",\r
+ inserttable: "Mang Khuôn Vô",\r
+ htmlmode: "Bật / Tắt Nguồn HTML",\r
+ popupeditor: "Póp Lớn Khung Viết",\r
+ about: "Nói Về Chương Trình",\r
+ help: "Giúp Đỡ",\r
+ textindicator: "Loại Kiểu Viết"\r
+ }\r
+};\r
-htmlArea License (based on BSD license)\r
-Copyright (c) 2002, interactivetools.com, inc.\r
-All rights reserved.\r
-\r
-Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\r
-\r
-1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. \r
-\r
-2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. \r
-\r
-3) Neither the name of interactivetools.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \r
-\r
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r
+htmlArea License (based on BSD license)\r\r
+Copyright (c) 2002, interactivetools.com, inc.\r\r
+All rights reserved.\r\r
+\r\r
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\r\r
+\r\r
+1) Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. \r\r
+\r\r
+2) Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. \r\r
+\r\r
+3) Neither the name of interactivetools.com, inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. \r\r
+\r\r
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\r\r
-// I18N constants
-
-// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-SpellChecker.I18N = {
- "CONFIRM_LINK_CLICK" : "Please confirm that you want to open this link",
- "Cancel" : "Cancel",
- "Dictionary" : "Dictionary",
- "Finished list of mispelled words" : "Finished list of mispelled words",
- "I will open it in a new page." : "I will open it in a new page.",
- "Ignore all" : "Ignore all",
- "Ignore" : "Ignore",
- "NO_ERRORS" : "No mispelled words found with the selected dictionary.",
- "NO_ERRORS_CLOSING" : "Spell check complete, didn't find any mispelled words. Closing now...",
- "OK" : "OK",
- "Original word" : "Original word",
- "Please wait. Calling spell checker." : "Please wait. Calling spell checker.",
- "Please wait: changing dictionary to" : "Please wait: changing dictionary to",
- "QUIT_CONFIRMATION" : "This will drop changes and quit spell checker. Please confirm.",
- "Re-check" : "Re-check",
- "Replace all" : "Replace all",
- "Replace with" : "Replace with",
- "Replace" : "Replace",
- "SC-spell-check" : "Spell-check",
- "Suggestions" : "Suggestions",
- "pliz weit ;-)" : "pliz weit ;-)"
-};
+// I18N constants\r
+\r
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+SpellChecker.I18N = {\r
+ "CONFIRM_LINK_CLICK" : "Please confirm that you want to open this link",\r
+ "Cancel" : "Cancel",\r
+ "Dictionary" : "Dictionary",\r
+ "Finished list of mispelled words" : "Finished list of mispelled words",\r
+ "I will open it in a new page." : "I will open it in a new page.",\r
+ "Ignore all" : "Ignore all",\r
+ "Ignore" : "Ignore",\r
+ "NO_ERRORS" : "No mispelled words found with the selected dictionary.",\r
+ "NO_ERRORS_CLOSING" : "Spell check complete, didn't find any mispelled words. Closing now...",\r
+ "OK" : "OK",\r
+ "Original word" : "Original word",\r
+ "Please wait. Calling spell checker." : "Please wait. Calling spell checker.",\r
+ "Please wait: changing dictionary to" : "Please wait: changing dictionary to",\r
+ "QUIT_CONFIRMATION" : "This will drop changes and quit spell checker. Please confirm.",\r
+ "Re-check" : "Re-check",\r
+ "Replace all" : "Replace all",\r
+ "Replace with" : "Replace with",\r
+ "Replace" : "Replace",\r
+ "SC-spell-check" : "Spell-check",\r
+ "Suggestions" : "Suggestions",\r
+ "pliz weit ;-)" : "pliz weit ;-)"\r
+};\r
-// I18N constants
-
-// LANG: "ro", ENCODING: UTF-8
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-SpellChecker.I18N = {
- "CONFIRM_LINK_CLICK" : "Vă rog confirmaţi că vreţi să deschideţi acest link",
- "Cancel" : "Anulează",
- "Dictionary" : "Dicţionar",
- "Finished list of mispelled words" : "Am terminat lista de cuvinte greşite",
- "I will open it in a new page." : "O voi deschide într-o altă fereastră.",
- "Ignore all" : "Ignoră toate",
- "Ignore" : "Ignoră",
- "NO_ERRORS" : "Nu am găsit nici un cuvânt greşit cu acest dicţionar.",
- "NO_ERRORS_CLOSING" : "Am terminat, nu am detectat nici o greşeală. Acum închid fereastra...",
- "OK" : "OK",
- "Original word" : "Cuvântul original",
- "Please wait. Calling spell checker." : "Vă rog aşteptaţi. Apelez spell-checker-ul.",
- "Please wait: changing dictionary to" : "Vă rog aşteptaţi. Schimb dicţionarul cu",
- "QUIT_CONFIRMATION" : "Doriţi să renunţaţi la modificări şi să închid spell-checker-ul?",
- "Re-check" : "Scanează",
- "Replace all" : "Înlocuieşte toate",
- "Replace with" : "Înlocuieşte cu",
- "Replace" : "Înlocuieşte",
- "SC-spell-check" : "Detectează greşeli",
- "Suggestions" : "Sugestii",
- "pliz weit ;-)" : "va rog ashteptatzi ;-)"
-};
+// I18N constants\r
+\r
+// LANG: "ro", ENCODING: UTF-8\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+SpellChecker.I18N = {\r
+ "CONFIRM_LINK_CLICK" : "Vă rog confirmaţi că vreţi să deschideţi acest link",\r
+ "Cancel" : "Anulează",\r
+ "Dictionary" : "Dicţionar",\r
+ "Finished list of mispelled words" : "Am terminat lista de cuvinte greşite",\r
+ "I will open it in a new page." : "O voi deschide într-o altă fereastră.",\r
+ "Ignore all" : "Ignoră toate",\r
+ "Ignore" : "Ignoră",\r
+ "NO_ERRORS" : "Nu am găsit nici un cuvânt greşit cu acest dicţionar.",\r
+ "NO_ERRORS_CLOSING" : "Am terminat, nu am detectat nici o greşeală. Acum închid fereastra...",\r
+ "OK" : "OK",\r
+ "Original word" : "Cuvântul original",\r
+ "Please wait. Calling spell checker." : "Vă rog aşteptaţi. Apelez spell-checker-ul.",\r
+ "Please wait: changing dictionary to" : "Vă rog aşteptaţi. Schimb dicţionarul cu",\r
+ "QUIT_CONFIRMATION" : "Doriţi să renunţaţi la modificări şi să închid spell-checker-ul?",\r
+ "Re-check" : "Scanează",\r
+ "Replace all" : "Înlocuieşte toate",\r
+ "Replace with" : "Înlocuieşte cu",\r
+ "Replace" : "Înlocuieşte",\r
+ "SC-spell-check" : "Detectează greşeli",\r
+ "Suggestions" : "Sugestii",\r
+ "pliz weit ;-)" : "va rog ashteptatzi ;-)"\r
+};\r
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<html>
- <head>
- <title>HTMLArea Spell Checker</title>
- </head>
-
- <body>
- <h1>HTMLArea Spell Checker</h1>
-
- <p>The HTMLArea Spell Checker subsystem consists of the following
- files:</p>
-
- <ul>
-
- <li>spell-checker.js — the spell checker plugin interface for
- HTMLArea</li>
-
- <li>spell-checker-ui.html — the HTML code for the user
- interface</li>
-
- <li>spell-checker-ui.js — functionality of the user
- interface</li>
-
- <li>spell-checker-logic.cgi — Perl CGI script that checks a text
- given through POST for spelling errors</li>
-
- <li>spell-checker-style.css — style for mispelled words</li>
-
- <li>lang/en.js — main language file (English).</li>
-
- </ul>
-
- <h2>Process overview</h2>
-
- <p>
- When an end-user clicks the "spell-check" button in the HTMLArea
- editor, a new window is opened with the URL of "spell-check-ui.html".
- This window initializes itself with the text found in the editor (uses
- <tt>window.opener.SpellChecker.editor</tt> global variable) and it
- submits the text to the server-side script "spell-check-logic.cgi".
- The target of the FORM is an inline frame which is used both to
- display the text and correcting.
- </p>
-
- <p>
- Further, spell-check-logic.cgi calls Aspell for each portion of plain
- text found in the given HTML. It rebuilds an HTML file that contains
- clear marks of which words are incorrect, along with suggestions for
- each of them. This file is then loaded in the inline frame. Upon
- loading, a JavaScript function from "spell-check-ui.js" is called.
- This function will retrieve all mispelled words from the HTML of the
- iframe and will setup the user interface so that it allows correction.
- </p>
-
- <h2>The server-side script (spell-check-logic.cgi)</h2>
-
- <p>
- <strong>Unicode safety</strong> — the program <em>is</em>
- Unicode safe. HTML entities are expanded into their corresponding
- Unicode characters. These characters will be matched as part of the
- word passed to Aspell. All texts passed to Aspell are in Unicode
- (when appropriate). However, Aspell seems to not support Unicode
- yet (<a
- href="http://mail.gnu.org/archive/html/aspell-user/2000-11/msg00007.html">thread concerning Aspell and Unicode</a>).
- This mean that words containing Unicode
- characters that are not in 0..255 are likely to be reported as "mispelled" by Aspell.
- </p>
-
- <p>
- I digged the Net for a couple of hours today and I can't seem to find
- any open-source spell checker that has Unicode support. For this
- reason we keep using Aspell, because it also seems to have the
- best suggestions engine. Unicode support will eventually be
- implemented in Aspell. <a href="mailto:kevin@atkinson.dhs.org">Email
- Kevin Atkinson</a> (Aspell author and maintainer) about this ;-)
- </p>
-
- <p>
- The Perl Unicode manual (man perluniintro) states:
- </p>
-
- <blockquote>
- <em>
- Starting from Perl 5.6.0, Perl has had the capacity to handle Unicode
- natively. Perl 5.8.0, however, is the first recommended release for
- serious Unicode work. The maintenance release 5.6.1 fixed many of the
- problems of the initial Unicode implementation, but for example regular
- expressions still do not work with Unicode in 5.6.1.
- </em>
- </blockquote>
-
- <p>In other words, do <em>not</em> assume that this script is
- Unicode-safe on Perl interpreters older than 5.8.0.</p>
-
- <p>The following Perl modules are required:</p>
-
- <ul>
- <li><a href="http://search.cpan.org/search?query=Text%3A%3AAspell&mode=all" target="_blank">Text::Aspell</a></li>
- <li><a href="http://search.cpan.org/search?query=HTML%3A%3AParser&mode=all" target="_blank">HTML::Parser</a></li>
- <li><a href="http://search.cpan.org/search?query=HTML%3A%3AEntities&mode=all" target="_blank">HTML::Entities</a></li>
- <li><a href="http://search.cpan.org/search?query=CGI&mode=all" target="_blank">CGI</a></li>
- </ul>
-
- <p>Of these, only Text::Aspell might need to be installed manually. The
- others are likely to be available by default in most Perl distributions.</p>
-
- <hr />
- <address><a href="http://students.infoiasi.ro/~mishoo/">Mihai Bazon</a></address>
-<!-- Created: Thu Jul 17 13:22:27 EEST 2003 -->
-<!-- hhmts start -->
-Last modified on Sun Aug 10 12:28:24 2003
-<!-- hhmts end -->
-<!-- doc-lang: English -->
- </body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">\r
+<html>\r
+ <head>\r
+ <title>HTMLArea Spell Checker</title>\r
+ </head>\r
+\r
+ <body>\r
+ <h1>HTMLArea Spell Checker</h1>\r
+\r
+ <p>The HTMLArea Spell Checker subsystem consists of the following\r
+ files:</p>\r
+\r
+ <ul>\r
+\r
+ <li>spell-checker.js — the spell checker plugin interface for\r
+ HTMLArea</li>\r
+\r
+ <li>spell-checker-ui.html — the HTML code for the user\r
+ interface</li>\r
+\r
+ <li>spell-checker-ui.js — functionality of the user\r
+ interface</li>\r
+\r
+ <li>spell-checker-logic.cgi — Perl CGI script that checks a text\r
+ given through POST for spelling errors</li>\r
+\r
+ <li>spell-checker-style.css — style for mispelled words</li>\r
+\r
+ <li>lang/en.js — main language file (English).</li>\r
+\r
+ </ul>\r
+\r
+ <h2>Process overview</h2>\r
+\r
+ <p>\r
+ When an end-user clicks the "spell-check" button in the HTMLArea\r
+ editor, a new window is opened with the URL of "spell-check-ui.html".\r
+ This window initializes itself with the text found in the editor (uses\r
+ <tt>window.opener.SpellChecker.editor</tt> global variable) and it\r
+ submits the text to the server-side script "spell-check-logic.cgi".\r
+ The target of the FORM is an inline frame which is used both to\r
+ display the text and correcting.\r
+ </p>\r
+\r
+ <p>\r
+ Further, spell-check-logic.cgi calls Aspell for each portion of plain\r
+ text found in the given HTML. It rebuilds an HTML file that contains\r
+ clear marks of which words are incorrect, along with suggestions for\r
+ each of them. This file is then loaded in the inline frame. Upon\r
+ loading, a JavaScript function from "spell-check-ui.js" is called.\r
+ This function will retrieve all mispelled words from the HTML of the\r
+ iframe and will setup the user interface so that it allows correction.\r
+ </p>\r
+\r
+ <h2>The server-side script (spell-check-logic.cgi)</h2>\r
+\r
+ <p>\r
+ <strong>Unicode safety</strong> — the program <em>is</em>\r
+ Unicode safe. HTML entities are expanded into their corresponding\r
+ Unicode characters. These characters will be matched as part of the\r
+ word passed to Aspell. All texts passed to Aspell are in Unicode\r
+ (when appropriate). However, Aspell seems to not support Unicode\r
+ yet (<a\r
+ href="http://mail.gnu.org/archive/html/aspell-user/2000-11/msg00007.html">thread concerning Aspell and Unicode</a>).\r
+ This mean that words containing Unicode\r
+ characters that are not in 0..255 are likely to be reported as "mispelled" by Aspell.\r
+ </p>\r
+\r
+ <p>\r
+ I digged the Net for a couple of hours today and I can't seem to find\r
+ any open-source spell checker that has Unicode support. For this\r
+ reason we keep using Aspell, because it also seems to have the\r
+ best suggestions engine. Unicode support will eventually be\r
+ implemented in Aspell. <a href="mailto:kevin@atkinson.dhs.org">Email\r
+ Kevin Atkinson</a> (Aspell author and maintainer) about this ;-)\r
+ </p>\r
+\r
+ <p>\r
+ The Perl Unicode manual (man perluniintro) states:\r
+ </p>\r
+\r
+ <blockquote>\r
+ <em>\r
+ Starting from Perl 5.6.0, Perl has had the capacity to handle Unicode\r
+ natively. Perl 5.8.0, however, is the first recommended release for\r
+ serious Unicode work. The maintenance release 5.6.1 fixed many of the\r
+ problems of the initial Unicode implementation, but for example regular\r
+ expressions still do not work with Unicode in 5.6.1.\r
+ </em>\r
+ </blockquote>\r
+\r
+ <p>In other words, do <em>not</em> assume that this script is\r
+ Unicode-safe on Perl interpreters older than 5.8.0.</p>\r
+\r
+ <p>The following Perl modules are required:</p>\r
+\r
+ <ul>\r
+ <li><a href="http://search.cpan.org/search?query=Text%3A%3AAspell&mode=all" target="_blank">Text::Aspell</a></li>\r
+ <li><a href="http://search.cpan.org/search?query=HTML%3A%3AParser&mode=all" target="_blank">HTML::Parser</a></li>\r
+ <li><a href="http://search.cpan.org/search?query=HTML%3A%3AEntities&mode=all" target="_blank">HTML::Entities</a></li>\r
+ <li><a href="http://search.cpan.org/search?query=CGI&mode=all" target="_blank">CGI</a></li>\r
+ </ul>\r
+\r
+ <p>Of these, only Text::Aspell might need to be installed manually. The\r
+ others are likely to be available by default in most Perl distributions.</p>\r
+\r
+ <hr />\r
+ <address><a href="http://students.infoiasi.ro/~mishoo/">Mihai Bazon</a></address>\r
+<!-- Created: Thu Jul 17 13:22:27 EEST 2003 -->\r
+<!-- hhmts start -->\r
+Last modified on Sun Aug 10 12:28:24 2003\r
+<!-- hhmts end -->\r
+<!-- doc-lang: English -->\r
+ </body>\r
+</html>\r
-#! /usr/bin/perl -w
-
-# Spell Checker Plugin for HTMLArea-3.0
-# Implementation by Mihai Bazon. Sponsored by www.americanbible.org
-#
-# htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
-# This notice MUST stay intact for use (see license.txt).
-#
-# A free WYSIWYG editor replacement for <textarea> fields.
-# For full source code and docs, visit http://www.interactivetools.com/
-#
-# Version 3.0 developed by Mihai Bazon for InteractiveTools.
-# http://students.infoiasi.ro/~mishoo
-#
-# $Id$
-
-use strict;
-use utf8;
-use Encode;
-use Text::Aspell;
-use HTML::Parser;
-use HTML::Entities;
-use CGI;
-
-my $debug = 0;
-
-open (DEBUG, '>:encoding(UTF-8)', '> /tmp/spell-check-debug.log') if $debug;
-
-# use Data::Dumper; # for debug only
-
-my $speller = new Text::Aspell;
-my $cgi = new CGI;
-
-# FIXME: report a nice error...
-die "Can't create speller!" unless $speller;
-
-# add configurable option for this
-my $dict = $cgi->param('dictionary') || 'en_US';
-$speller->set_option('lang', $dict);
-
-# ultra, fast, normal, bad-spellers
-# bad-spellers seems to cause segmentation fault
-$speller->set_option('sug-mode', 'ultra');
-
-my @replacements = ();
-
-sub text_handler {
- my ($offset, $length, $text, $is_cdata) = @_;
- if ($is_cdata or $text =~ /^\s*$/) {
- return 0;
- }
- # print STDERR "*** OFFSET: $offset, LENGTH: $length, $text\n";
- $text = decode_entities($text);
- $text =~ s/&#([0-9]+);/chr($1)/eg;
- $text =~ s/&#x([0-9a-fA-F]+);/chr(hex $1)/eg;
- my $repl = spellcheck($text);
- if ($repl) {
- push(@replacements, [ $offset, $length, $repl ]);
- }
-}
-
-my $p = HTML::Parser->new
- (api_version => 3,
- handlers => { start => [ sub {
- my ($self, $tagname, $attrs) = @_;
- # print STDERR "\033[1;31m parsing tag: $tagname\033[0m\n";
- # following we skip words that have already been marked as "fixed".
- if ($tagname eq "span" and $attrs->{class} =~ /HA-spellcheck-fixed/) {
- $self->handler(text => undef);
- }
- }, "self, tagname, attr"
- ],
- end => [ sub {
- my ($self, $tagname) = @_;
- # print STDERR "\033[1;32m END tag: $tagname\033[0m\n";
- $self->handler(text => \&text_handler, 'offset, length, dtext, is_cdata');
- }, "self, tagname"
- ]
- }
- );
-$p->handler(text => \&text_handler, 'offset, length, dtext, is_cdata');
-$p->case_sensitive(1);
-my $file_content = $cgi->param('content');
-
-if ($debug) {
- open (FOO, '>:encoding(UTF-8)', '/tmp/spell-check-before');
- print FOO $file_content, "\n";
- close(FOO);
-}
-
-$p->parse($file_content);
-$p->eof();
-
-foreach (reverse @replacements) {
- substr($file_content, $_->[0], $_->[1], $_->[2]);
-}
-
-# we output UTF-8
-binmode(STDOUT, ':encoding(UTF-8)'); # apparently, this sucks.
-print "Content-type: text/html; charset: utf-8\n\n";
-print qq^
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-<link rel="stylesheet" type="text/css" media="all" href="spell-check-style.css" />
-</head>
-<body onload="window.parent.finishedSpellChecking();">^;
-
-print $file_content;
-if ($cgi->param('init') eq '1') {
- my @dicts = $speller->dictionary_info();
- my $dictionaries = '';
- foreach my $i (@dicts) {
- $dictionaries .= ',' . $i->{name} unless $i->{jargon};
- }
- $dictionaries =~ s/^,//;
- print qq^
-<div id="HA-spellcheck-dictionaries"
->$dictionaries</div>
-^;
-}
-
-if ($debug) {
- open (FOO, '>:encoding(UTF-8)', '/tmp/spell-check-after');
- print FOO $file_content, "\n";
- close(FOO);
-}
-
-print '</body></html>';
-
-# Perl is beautiful.
-sub spellcheck {
- my $text = shift;
- sub check { # called for each word in the text
- # input is in UTF-8
- my $U_word = shift;
- my $word = encode($speller->get_option('encoding'), $U_word);
- print DEBUG "*$U_word* ----> |$word|\n" if $debug;
- if ($speller->check($word)) {
- return $U_word; # we return the word in UTF-8
- } else {
- # we should have suggestions; give them back to browser in UTF-8
- my $suggestions = decode($speller->get_option('encoding'), join(',', $speller->suggest($word)));
- my $ret = '<span class="HA-spellcheck-error">'.$U_word.'</span><span class="HA-spellcheck-suggestions">'.$suggestions.'</span>';
- return $ret;
- }
- }
- $text =~ s/([[:word:]']+)/check($1)/egs;
- # $text =~ s/(\w+)/check($1)/egs;
-
- # the following is definitely what we want to use; too bad it sucks most.
- # $text =~ s/(\p{IsWord}+)/check($1)/egs;
- return $text;
-}
+#! /usr/bin/perl -w\r
+\r
+# Spell Checker Plugin for HTMLArea-3.0\r
+# Implementation by Mihai Bazon. Sponsored by www.americanbible.org\r
+#\r
+# htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.\r
+# This notice MUST stay intact for use (see license.txt).\r
+#\r
+# A free WYSIWYG editor replacement for <textarea> fields.\r
+# For full source code and docs, visit http://www.interactivetools.com/\r
+#\r
+# Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+# http://students.infoiasi.ro/~mishoo\r
+#\r
+# $Id$\r
+\r
+use strict;\r
+use utf8;\r
+use Encode;\r
+use Text::Aspell;\r
+use HTML::Parser;\r
+use HTML::Entities;\r
+use CGI;\r
+\r
+my $debug = 0;\r
+\r
+open (DEBUG, '>:encoding(UTF-8)', '> /tmp/spell-check-debug.log') if $debug;\r
+\r
+# use Data::Dumper; # for debug only\r
+\r
+my $speller = new Text::Aspell;\r
+my $cgi = new CGI;\r
+\r
+# FIXME: report a nice error...\r
+die "Can't create speller!" unless $speller;\r
+\r
+# add configurable option for this\r
+my $dict = $cgi->param('dictionary') || 'en_US';\r
+$speller->set_option('lang', $dict);\r
+\r
+# ultra, fast, normal, bad-spellers\r
+# bad-spellers seems to cause segmentation fault\r
+$speller->set_option('sug-mode', 'ultra');\r
+\r
+my @replacements = ();\r
+\r
+sub text_handler {\r
+ my ($offset, $length, $text, $is_cdata) = @_;\r
+ if ($is_cdata or $text =~ /^\s*$/) {\r
+ return 0;\r
+ }\r
+ # print STDERR "*** OFFSET: $offset, LENGTH: $length, $text\n";\r
+ $text = decode_entities($text);\r
+ $text =~ s/&#([0-9]+);/chr($1)/eg;\r
+ $text =~ s/&#x([0-9a-fA-F]+);/chr(hex $1)/eg;\r
+ my $repl = spellcheck($text);\r
+ if ($repl) {\r
+ push(@replacements, [ $offset, $length, $repl ]);\r
+ }\r
+}\r
+\r
+my $p = HTML::Parser->new\r
+ (api_version => 3,\r
+ handlers => { start => [ sub {\r
+ my ($self, $tagname, $attrs) = @_;\r
+ # print STDERR "\033[1;31m parsing tag: $tagname\033[0m\n";\r
+ # following we skip words that have already been marked as "fixed".\r
+ if ($tagname eq "span" and $attrs->{class} =~ /HA-spellcheck-fixed/) {\r
+ $self->handler(text => undef);\r
+ }\r
+ }, "self, tagname, attr"\r
+ ],\r
+ end => [ sub {\r
+ my ($self, $tagname) = @_;\r
+ # print STDERR "\033[1;32m END tag: $tagname\033[0m\n";\r
+ $self->handler(text => \&text_handler, 'offset, length, dtext, is_cdata');\r
+ }, "self, tagname"\r
+ ]\r
+ }\r
+ );\r
+$p->handler(text => \&text_handler, 'offset, length, dtext, is_cdata');\r
+$p->case_sensitive(1);\r
+my $file_content = $cgi->param('content');\r
+\r
+if ($debug) {\r
+ open (FOO, '>:encoding(UTF-8)', '/tmp/spell-check-before');\r
+ print FOO $file_content, "\n";\r
+ close(FOO);\r
+}\r
+\r
+$p->parse($file_content);\r
+$p->eof();\r
+\r
+foreach (reverse @replacements) {\r
+ substr($file_content, $_->[0], $_->[1], $_->[2]);\r
+}\r
+\r
+# we output UTF-8\r
+binmode(STDOUT, ':encoding(UTF-8)'); # apparently, this sucks.\r
+print "Content-type: text/html; charset: utf-8\n\n";\r
+print qq^\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">\r
+<html>\r
+<head>\r
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
+<link rel="stylesheet" type="text/css" media="all" href="spell-check-style.css" />\r
+</head>\r
+<body onload="window.parent.finishedSpellChecking();">^;\r
+\r
+print $file_content;\r
+if ($cgi->param('init') eq '1') {\r
+ my @dicts = $speller->dictionary_info();\r
+ my $dictionaries = '';\r
+ foreach my $i (@dicts) {\r
+ $dictionaries .= ',' . $i->{name} unless $i->{jargon};\r
+ }\r
+ $dictionaries =~ s/^,//;\r
+ print qq^\r
+<div id="HA-spellcheck-dictionaries"\r
+>$dictionaries</div>\r
+^;\r
+}\r
+\r
+if ($debug) {\r
+ open (FOO, '>:encoding(UTF-8)', '/tmp/spell-check-after');\r
+ print FOO $file_content, "\n";\r
+ close(FOO);\r
+}\r
+\r
+print '</body></html>';\r
+\r
+# Perl is beautiful.\r
+sub spellcheck {\r
+ my $text = shift;\r
+ sub check { # called for each word in the text\r
+ # input is in UTF-8\r
+ my $U_word = shift;\r
+ my $word = encode($speller->get_option('encoding'), $U_word);\r
+ print DEBUG "*$U_word* ----> |$word|\n" if $debug;\r
+ if ($speller->check($word)) {\r
+ return $U_word; # we return the word in UTF-8\r
+ } else {\r
+ # we should have suggestions; give them back to browser in UTF-8\r
+ my $suggestions = decode($speller->get_option('encoding'), join(',', $speller->suggest($word)));\r
+ my $ret = '<span class="HA-spellcheck-error">'.$U_word.'</span><span class="HA-spellcheck-suggestions">'.$suggestions.'</span>';\r
+ return $ret;\r
+ }\r
+ }\r
+ $text =~ s/([[:word:]']+)/check($1)/egs;\r
+ # $text =~ s/(\w+)/check($1)/egs;\r
+\r
+ # the following is definitely what we want to use; too bad it sucks most.\r
+ # $text =~ s/(\p{IsWord}+)/check($1)/egs;\r
+ return $text;\r
+}\r
-.HA-spellcheck-error { border-bottom: 2px dotted #f00; cursor: default; }
-.HA-spellcheck-same { background-color: #ff8; color: #000; }
-.HA-spellcheck-hover { background-color: #433; color: white; }
-.HA-spellcheck-fixed { border-bottom: 1px dotted #0b8; }
-.HA-spellcheck-current { background-color: #7be; color: #000; }
-.HA-spellcheck-suggestions { display: none; }
-
-#HA-spellcheck-dictionaries { display: none; }
-
-a:link, a:visited { color: #55e; }
+.HA-spellcheck-error { border-bottom: 2px dotted #f00; cursor: default; }\r
+.HA-spellcheck-same { background-color: #ff8; color: #000; }\r
+.HA-spellcheck-hover { background-color: #433; color: white; }\r
+.HA-spellcheck-fixed { border-bottom: 1px dotted #0b8; }\r
+.HA-spellcheck-current { background-color: #7be; color: #000; }\r
+.HA-spellcheck-suggestions { display: none; }\r
+\r
+#HA-spellcheck-dictionaries { display: none; }\r
+\r
+a:link, a:visited { color: #55e; }\r
-<!--
-
- Strangely, IE sucks with or without the DOCTYPE switch.
- I thought it would only suck without it.
-
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
- "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-
- Spell Checker Plugin for HTMLArea-3.0
- Implementation by Mihai Bazon. Sponsored by www.americanbible.org
-
- htmlArea v3.0 - Copyright (c) 2003 interactivetools.com, inc.
- This notice MUST stay intact for use (see license.txt).
-
- A free WYSIWYG editor replacement for <textarea> fields.
- For full source code and docs, visit http://www.interactivetools.com/
-
- Version 3.0 developed by Mihai Bazon for InteractiveTools.
- http://students.infoiasi.ro/~mishoo
-
- $Id$
-
--->
-<html xmlns="http://www.w3.org/1999/xhtml">
-
- <head>
- <title>Spell Checker</title>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <script type="text/javascript" src="spell-check-ui.js"></script>
-
- <style type="text/css">
- html, body { height: 100%; margin: 0px; padding: 0px; background-color: #fff;
- color: #000; }
- a:link, a:visited { color: #00f; text-decoration: none; }
- a:hover { color: #f00; text-decoration: underline; }
-
- table { background-color: ButtonFace; color: ButtonText;
- font-family: tahoma,verdana,sans-serif; font-size: 11px; }
-
- iframe { background-color: #fff; color: #000; }
-
- .controls { width: 13em; }
- .controls .sectitle { /* background-color: #736c6c; color: #fff;
- border-top: 1px solid #000; border-bottom: 1px solid #fff; */
- text-align: center;
- font-weight: bold; padding: 2px 4px; }
- .controls .secbody { margin-bottom: 10px; }
-
- button, select { font-family: tahoma,verdana,sans-serif; font-size: 11px; }
- button { width: 6em; padding: 0px; }
-
- input, select { font-family: fixed,"andale mono",monospace; }
-
- #v_currentWord { color: #f00; font-weight: bold; font-size: 120%; }
- #statusbar { padding: 7px 0px 0px 5px; }
- #status { font-weight: bold; }
- </style>
-
- </head>
-
- <body onload="initDocument()">
-
- <form style="display: none;" action="spell-check-logic.cgi"
- method="post" target="framecontent"
- accept-charset="utf-8"
- ><input type="hidden" name="content" id="f_content"
- /><input type="hidden" name="dictionary" id="f_dictionary"
- /><input type="hidden" name="init" id="f_init" value="1"
- /></form>
-
- <table style="height: 100%; width: 100%; border-collapse: collapse;" cellspacing="0" cellpadding="0">
- <tr>
- <td colspan="2" style="height: 1em; padding: 2px;">
- <div style="float: right; padding: 2px;"><span>Dictionary</span>
- <select id="v_dictionaries" style="width: 10em"></select>
- <button id="b_recheck">Re-check</button>
- </div>
- <span id="status">Please wait. Calling spell checker.</span>
- </td>
- </tr>
- <tr>
- <td valign="top" class="controls">
- <div class="sectitle">Original word</div>
- <div class="secbody" id="v_currentWord" style="text-align: center">pliz weit ;-)</div>
- <div class="sectitle">Replace with</div>
- <div class="secbody">
- <input type="text" id="v_replacement" style="width: 94%; margin-left: 3%;" /><br />
- <div style="text-align: center; margin-top: 2px;">
- <button id="b_replace">Replace</button><button
- id="b_replall">Replace all</button><br /><button
- id="b_ignore">Ignore</button><button
- id="b_ignall">Ignore all</button>
- </div>
- </div>
- <div class="sectitle">Suggestions</div>
- <div class="secbody">
- <select size="11" style="width: 94%; margin-left: 3%;" id="v_suggestions"></select>
- </div>
- </td>
-
- <td>
- <iframe src="about:blank" width="100%" height="100%"
- id="i_framecontent" name="framecontent"></iframe>
- </td>
- </tr>
- <tr>
- <td style="height: 1em;" colspan="2">
- <div style="padding: 4px 2px 2px 2px; float: right;">
- <button id="b_ok">OK</button>
- <button id="b_cancel">Cancel</button>
- </div>
- <div id="statusbar"></div>
- </td>
- </tr>
- </table>
-
- </body>
-
-</html>
+<!--\r
+\r
+ Strangely, IE sucks with or without the DOCTYPE switch.\r
+ I thought it would only suck without it.\r
+\r
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"\r
+ "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
+\r
+ Spell Checker Plugin for HTMLArea-3.0\r
+ Implementation by Mihai Bazon. Sponsored by www.americanbible.org\r
+ \r
+ htmlArea v3.0 - Copyright (c) 2003 interactivetools.com, inc.\r
+ This notice MUST stay intact for use (see license.txt).\r
+ \r
+ A free WYSIWYG editor replacement for <textarea> fields.\r
+ For full source code and docs, visit http://www.interactivetools.com/\r
+ \r
+ Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+ http://students.infoiasi.ro/~mishoo\r
+ \r
+ $Id$\r
+\r
+-->\r
+<html xmlns="http://www.w3.org/1999/xhtml">\r
+\r
+ <head>\r
+ <title>Spell Checker</title>\r
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />\r
+ <script type="text/javascript" src="spell-check-ui.js"></script>\r
+\r
+ <style type="text/css">\r
+ html, body { height: 100%; margin: 0px; padding: 0px; background-color: #fff;\r
+ color: #000; }\r
+ a:link, a:visited { color: #00f; text-decoration: none; }\r
+ a:hover { color: #f00; text-decoration: underline; }\r
+\r
+ table { background-color: ButtonFace; color: ButtonText;\r
+ font-family: tahoma,verdana,sans-serif; font-size: 11px; }\r
+\r
+ iframe { background-color: #fff; color: #000; }\r
+\r
+ .controls { width: 13em; }\r
+ .controls .sectitle { /* background-color: #736c6c; color: #fff;\r
+ border-top: 1px solid #000; border-bottom: 1px solid #fff; */\r
+ text-align: center;\r
+ font-weight: bold; padding: 2px 4px; }\r
+ .controls .secbody { margin-bottom: 10px; }\r
+\r
+ button, select { font-family: tahoma,verdana,sans-serif; font-size: 11px; }\r
+ button { width: 6em; padding: 0px; }\r
+\r
+ input, select { font-family: fixed,"andale mono",monospace; }\r
+\r
+ #v_currentWord { color: #f00; font-weight: bold; font-size: 120%; }\r
+ #statusbar { padding: 7px 0px 0px 5px; }\r
+ #status { font-weight: bold; }\r
+ </style>\r
+\r
+ </head>\r
+\r
+ <body onload="initDocument()">\r
+\r
+ <form style="display: none;" action="spell-check-logic.cgi"\r
+ method="post" target="framecontent"\r
+ accept-charset="utf-8"\r
+ ><input type="hidden" name="content" id="f_content"\r
+ /><input type="hidden" name="dictionary" id="f_dictionary"\r
+ /><input type="hidden" name="init" id="f_init" value="1"\r
+ /></form>\r
+\r
+ <table style="height: 100%; width: 100%; border-collapse: collapse;" cellspacing="0" cellpadding="0">\r
+ <tr>\r
+ <td colspan="2" style="height: 1em; padding: 2px;">\r
+ <div style="float: right; padding: 2px;"><span>Dictionary</span>\r
+ <select id="v_dictionaries" style="width: 10em"></select>\r
+ <button id="b_recheck">Re-check</button>\r
+ </div>\r
+ <span id="status">Please wait. Calling spell checker.</span>\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td valign="top" class="controls">\r
+ <div class="sectitle">Original word</div>\r
+ <div class="secbody" id="v_currentWord" style="text-align: center">pliz weit ;-)</div>\r
+ <div class="sectitle">Replace with</div>\r
+ <div class="secbody">\r
+ <input type="text" id="v_replacement" style="width: 94%; margin-left: 3%;" /><br />\r
+ <div style="text-align: center; margin-top: 2px;">\r
+ <button id="b_replace">Replace</button><button\r
+ id="b_replall">Replace all</button><br /><button\r
+ id="b_ignore">Ignore</button><button\r
+ id="b_ignall">Ignore all</button>\r
+ </div>\r
+ </div>\r
+ <div class="sectitle">Suggestions</div>\r
+ <div class="secbody">\r
+ <select size="11" style="width: 94%; margin-left: 3%;" id="v_suggestions"></select>\r
+ </div>\r
+ </td>\r
+\r
+ <td>\r
+ <iframe src="about:blank" width="100%" height="100%"\r
+ id="i_framecontent" name="framecontent"></iframe>\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td style="height: 1em;" colspan="2">\r
+ <div style="padding: 4px 2px 2px 2px; float: right;">\r
+ <button id="b_ok">OK</button>\r
+ <button id="b_cancel">Cancel</button>\r
+ </div>\r
+ <div id="statusbar"></div>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+\r
+ </body>\r
+\r
+</html>\r
-// Spell Checker Plugin for HTMLArea-3.0
-// Implementation by Mihai Bazon. Sponsored by www.americanbible.org
-//
-// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
-// This notice MUST stay intact for use (see license.txt).
-//
-// A free WYSIWYG editor replacement for <textarea> fields.
-// For full source code and docs, visit http://www.interactivetools.com/
-//
-// Version 3.0 developed by Mihai Bazon for InteractiveTools.
-// http://students.infoiasi.ro/~mishoo
-//
-// $Id$
-
-// internationalization file was already loaded in parent ;-)
-var SpellChecker = window.opener.SpellChecker;
-var i18n = SpellChecker.I18N;
-
-var is_ie = window.opener.HTMLArea.is_ie;
-var editor = SpellChecker.editor;
-var frame = null;
-var currentElement = null;
-var wrongWords = null;
-var modified = false;
-var allWords = {};
-
-function makeCleanDoc(leaveFixed) {
- // document.getElementById("status").innerHTML = 'Please wait: rendering valid HTML';
- for (var i in wrongWords) {
- var el = wrongWords[i];
- if (!(leaveFixed && /HA-spellcheck-fixed/.test(el.className))) {
- el.parentNode.insertBefore(el.firstChild, el);
- el.parentNode.removeChild(el.nextSibling);
- el.parentNode.removeChild(el);
- } else {
- el.className = "HA-spellcheck-fixed";
- el.parentNode.removeChild(el.nextSibling);
- }
- }
- // we should use innerHTML here, but IE6's implementation fucks up the
- // HTML to such extent that our poor Perl parser doesn't understand it
- // anymore.
- return window.opener.HTMLArea.getHTML(frame.contentWindow.document.body, leaveFixed);
-};
-
-function recheckClicked() {
- document.getElementById("status").innerHTML = i18n["Please wait: changing dictionary to"] + ': "' + document.getElementById("f_dictionary").value + '".';
- var field = document.getElementById("f_content");
- field.value = makeCleanDoc(true);
- field.form.submit();
-};
-
-function saveClicked() {
- if (modified) {
- editor.setHTML(makeCleanDoc(false));
- }
- window.close();
- return false;
-};
-
-function cancelClicked() {
- var ok = true;
- if (modified) {
- ok = confirm(i18n["QUIT_CONFIRMATION"]);
- }
- if (ok) {
- window.close();
- }
- return false;
-};
-
-function replaceWord(el) {
- var replacement = document.getElementById("v_replacement").value;
- modified = (el.innerHTML != replacement);
- if (el) {
- el.className = el.className.replace(/\s*HA-spellcheck-(hover|fixed)\s*/g, " ");
- }
- el.className += " HA-spellcheck-fixed";
- el.__msh_fixed = true;
- if (!modified) {
- return false;
- }
- el.innerHTML = replacement;
-};
-
-function replaceClicked() {
- replaceWord(currentElement);
- var start = currentElement.__msh_id;
- var index = start;
- do {
- ++index;
- if (index == wrongWords.length) {
- index = 0;
- }
- } while ((index != start) && wrongWords[index].__msh_fixed);
- if (index == start) {
- index = 0;
- alert(i18n["Finished list of mispelled words"]);
- }
- wrongWords[index].onclick();
- return false;
-};
-
-function replaceAllClicked() {
- var replacement = document.getElementById("v_replacement").value;
- var ok = true;
- var spans = allWords[currentElement.__msh_origWord];
- if (spans.length == 0) {
- alert("An impossible condition just happened. Call FBI. ;-)");
- } else if (spans.length == 1) {
- replaceClicked();
- return false;
- }
- /*
- var message = "The word \"" + currentElement.__msh_origWord + "\" occurs " + spans.length + " times.\n";
- if (replacement == currentElement.__msh_origWord) {
- ok = confirm(message + "Ignore all occurrences?");
- } else {
- ok = confirm(message + "Replace all occurrences with \"" + replacement + "\"?");
- }
- */
- if (ok) {
- for (var i in spans) {
- if (spans[i] != currentElement) {
- replaceWord(spans[i]);
- }
- }
- // replace current element the last, so that we jump to the next word ;-)
- replaceClicked();
- }
- return false;
-};
-
-function ignoreClicked() {
- document.getElementById("v_replacement").value = currentElement.__msh_origWord;
- replaceClicked();
- return false;
-};
-
-function ignoreAllClicked() {
- document.getElementById("v_replacement").value = currentElement.__msh_origWord;
- replaceAllClicked();
- return false;
-};
-
-function learnClicked() {
- alert("Not [yet] implemented");
- return false;
-};
-
-function internationalizeWindow() {
- var types = ["div", "span", "button"];
- for (var i in types) {
- var tag = types[i];
- var els = document.getElementsByTagName(tag);
- for (var j = els.length; --j >= 0;) {
- var el = els[j];
- if (el.childNodes.length == 1 && /\S/.test(el.innerHTML)) {
- var txt = el.innerHTML;
- if (typeof i18n[txt] != "undefined") {
- el.innerHTML = i18n[txt];
- }
- }
- }
- }
-};
-
-function initDocument() {
- internationalizeWindow();
- modified = false;
- frame = document.getElementById("i_framecontent");
- var field = document.getElementById("f_content");
- field.value = editor.getHTML();
- field.form.submit();
- document.getElementById("f_init").value = "0";
-
- // assign some global event handlers
-
- var select = document.getElementById("v_suggestions");
- select.onchange = function() {
- document.getElementById("v_replacement").value = this.value;
- };
- if (is_ie) {
- select.attachEvent("ondblclick", replaceClicked);
- } else {
- select.addEventListener("dblclick", replaceClicked, true);
- }
-
- document.getElementById("b_replace").onclick = replaceClicked;
- // document.getElementById("b_learn").onclick = learnClicked;
- document.getElementById("b_replall").onclick = replaceAllClicked;
- document.getElementById("b_ignore").onclick = ignoreClicked;
- document.getElementById("b_ignall").onclick = ignoreAllClicked;
- document.getElementById("b_recheck").onclick = recheckClicked;
-
- document.getElementById("b_ok").onclick = saveClicked;
- document.getElementById("b_cancel").onclick = cancelClicked;
-
- select = document.getElementById("v_dictionaries");
- select.onchange = function() {
- document.getElementById("f_dictionary").value = this.value;
- };
-};
-
-function wordClicked() {
- if (currentElement) {
- var a = allWords[currentElement.__msh_origWord];
- currentElement.className = currentElement.className.replace(/\s*HA-spellcheck-current\s*/g, " ");
- for (var i in a) {
- var el = a[i];
- if (el != currentElement) {
- el.className = el.className.replace(/\s*HA-spellcheck-same\s*/g, " ");
- }
- }
- }
- currentElement = this;
- this.className += " HA-spellcheck-current";
- var a = allWords[currentElement.__msh_origWord];
- for (var i in a) {
- var el = a[i];
- if (el != currentElement) {
- el.className += " HA-spellcheck-same";
- }
- }
- document.getElementById("b_replall").disabled = (a.length <= 1);
- document.getElementById("b_ignall").disabled = (a.length <= 1);
- var txt;
- if (a.length == 1) {
- txt = "one occurrence";
- } else if (a.length == 2) {
- txt = "two occurrences";
- } else {
- txt = a.length + " occurrences";
- }
- document.getElementById("statusbar").innerHTML = "Found " + txt +
- ' for word "<b>' + currentElement.__msh_origWord + '</b>"';
- var select = document.getElementById("v_suggestions");
- for (var i = select.length; --i >= 0;) {
- select.remove(i);
- }
- var suggestions;
- suggestions = this.nextSibling.firstChild.data.split(/,/);
- for (var i = 0; i < suggestions.length; ++i) {
- var txt = suggestions[i];
- var option = document.createElement("option");
- option.value = txt;
- option.appendChild(document.createTextNode(txt));
- select.appendChild(option);
- }
- document.getElementById("v_currentWord").innerHTML = this.__msh_origWord;
- if (suggestions.length > 0) {
- select.selectedIndex = 0;
- select.onchange();
- } else {
- document.getElementById("v_replacement").value = this.innerHTML;
- }
- return false;
-};
-
-function wordMouseOver() {
- this.className += " HA-spellcheck-hover";
-};
-
-function wordMouseOut() {
- this.className = this.className.replace(/\s*HA-spellcheck-hover\s*/g, " ");
-};
-
-function finishedSpellChecking() {
- // initialization of global variables
- currentElement = null;
- wrongWords = null;
- allWords = {};
-
- document.getElementById("status").innerHTML = "HTMLArea Spell Checker (<a href='readme-tech.html' target='_blank' title='Technical information'>info</a>)";
- var doc = frame.contentWindow.document;
- var spans = doc.getElementsByTagName("span");
- var sps = [];
- var id = 0;
- for (var i = 0; i < spans.length; ++i) {
- var el = spans[i];
- if (/HA-spellcheck-error/.test(el.className)) {
- sps.push(el);
- el.onclick = wordClicked;
- el.onmouseover = wordMouseOver;
- el.onmouseout = wordMouseOut;
- el.__msh_id = id++;
- var txt = (el.__msh_origWord = el.firstChild.data);
- el.__msh_fixed = false;
- if (typeof allWords[txt] == "undefined") {
- allWords[txt] = [el];
- } else {
- allWords[txt].push(el);
- }
- }
- }
- wrongWords = sps;
- if (sps.length == 0) {
- if (!modified) {
- alert(i18n["NO_ERRORS_CLOSING"]);
- window.close();
- } else {
- alert(i18n["NO_ERRORS"]);
- }
- return false;
- }
- (currentElement = sps[0]).onclick();
- var as = doc.getElementsByTagName("a");
- for (var i = as.length; --i >= 0;) {
- var a = as[i];
- a.onclick = function() {
- if (confirm(i18n["CONFIRM_LINK_CLICK"] + ":\n" +
- this.href + "\n" + i18n["I will open it in a new page."])) {
- window.open(this.href);
- }
- return false;
- };
- }
- var dicts = doc.getElementById("HA-spellcheck-dictionaries");
- if (dicts) {
- dicts.parentNode.removeChild(dicts);
- dicts = dicts.innerHTML.split(/,/);
- var select = document.getElementById("v_dictionaries");
- for (var i = select.length; --i >= 0;) {
- select.remove(i);
- }
- for (var i = 0; i < dicts.length; ++i) {
- var txt = dicts[i];
- var option = document.createElement("option");
- option.value = txt;
- option.appendChild(document.createTextNode(txt));
- select.appendChild(option);
- }
- }
-};
+// Spell Checker Plugin for HTMLArea-3.0\r
+// Implementation by Mihai Bazon. Sponsored by www.americanbible.org\r
+//\r
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.\r
+// This notice MUST stay intact for use (see license.txt).\r
+//\r
+// A free WYSIWYG editor replacement for <textarea> fields.\r
+// For full source code and docs, visit http://www.interactivetools.com/\r
+//\r
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+// http://students.infoiasi.ro/~mishoo\r
+//\r
+// $Id$\r
+\r
+// internationalization file was already loaded in parent ;-)\r
+var SpellChecker = window.opener.SpellChecker;\r
+var i18n = SpellChecker.I18N;\r
+\r
+var is_ie = window.opener.HTMLArea.is_ie;\r
+var editor = SpellChecker.editor;\r
+var frame = null;\r
+var currentElement = null;\r
+var wrongWords = null;\r
+var modified = false;\r
+var allWords = {};\r
+\r
+function makeCleanDoc(leaveFixed) {\r
+ // document.getElementById("status").innerHTML = 'Please wait: rendering valid HTML';\r
+ for (var i in wrongWords) {\r
+ var el = wrongWords[i];\r
+ if (!(leaveFixed && /HA-spellcheck-fixed/.test(el.className))) {\r
+ el.parentNode.insertBefore(el.firstChild, el);\r
+ el.parentNode.removeChild(el.nextSibling);\r
+ el.parentNode.removeChild(el);\r
+ } else {\r
+ el.className = "HA-spellcheck-fixed";\r
+ el.parentNode.removeChild(el.nextSibling);\r
+ }\r
+ }\r
+ // we should use innerHTML here, but IE6's implementation fucks up the\r
+ // HTML to such extent that our poor Perl parser doesn't understand it\r
+ // anymore.\r
+ return window.opener.HTMLArea.getHTML(frame.contentWindow.document.body, leaveFixed);\r
+};\r
+\r
+function recheckClicked() {\r
+ document.getElementById("status").innerHTML = i18n["Please wait: changing dictionary to"] + ': "' + document.getElementById("f_dictionary").value + '".';\r
+ var field = document.getElementById("f_content");\r
+ field.value = makeCleanDoc(true);\r
+ field.form.submit();\r
+};\r
+\r
+function saveClicked() {\r
+ if (modified) {\r
+ editor.setHTML(makeCleanDoc(false));\r
+ }\r
+ window.close();\r
+ return false;\r
+};\r
+\r
+function cancelClicked() {\r
+ var ok = true;\r
+ if (modified) {\r
+ ok = confirm(i18n["QUIT_CONFIRMATION"]);\r
+ }\r
+ if (ok) {\r
+ window.close();\r
+ }\r
+ return false;\r
+};\r
+\r
+function replaceWord(el) {\r
+ var replacement = document.getElementById("v_replacement").value;\r
+ modified = (el.innerHTML != replacement);\r
+ if (el) {\r
+ el.className = el.className.replace(/\s*HA-spellcheck-(hover|fixed)\s*/g, " ");\r
+ }\r
+ el.className += " HA-spellcheck-fixed";\r
+ el.__msh_fixed = true;\r
+ if (!modified) {\r
+ return false;\r
+ }\r
+ el.innerHTML = replacement;\r
+};\r
+\r
+function replaceClicked() {\r
+ replaceWord(currentElement);\r
+ var start = currentElement.__msh_id;\r
+ var index = start;\r
+ do {\r
+ ++index;\r
+ if (index == wrongWords.length) {\r
+ index = 0;\r
+ }\r
+ } while ((index != start) && wrongWords[index].__msh_fixed);\r
+ if (index == start) {\r
+ index = 0;\r
+ alert(i18n["Finished list of mispelled words"]);\r
+ }\r
+ wrongWords[index].onclick();\r
+ return false;\r
+};\r
+\r
+function replaceAllClicked() {\r
+ var replacement = document.getElementById("v_replacement").value;\r
+ var ok = true;\r
+ var spans = allWords[currentElement.__msh_origWord];\r
+ if (spans.length == 0) {\r
+ alert("An impossible condition just happened. Call FBI. ;-)");\r
+ } else if (spans.length == 1) {\r
+ replaceClicked();\r
+ return false;\r
+ }\r
+ /*\r
+ var message = "The word \"" + currentElement.__msh_origWord + "\" occurs " + spans.length + " times.\n";\r
+ if (replacement == currentElement.__msh_origWord) {\r
+ ok = confirm(message + "Ignore all occurrences?");\r
+ } else {\r
+ ok = confirm(message + "Replace all occurrences with \"" + replacement + "\"?");\r
+ }\r
+ */\r
+ if (ok) {\r
+ for (var i in spans) {\r
+ if (spans[i] != currentElement) {\r
+ replaceWord(spans[i]);\r
+ }\r
+ }\r
+ // replace current element the last, so that we jump to the next word ;-)\r
+ replaceClicked();\r
+ }\r
+ return false;\r
+};\r
+\r
+function ignoreClicked() {\r
+ document.getElementById("v_replacement").value = currentElement.__msh_origWord;\r
+ replaceClicked();\r
+ return false;\r
+};\r
+\r
+function ignoreAllClicked() {\r
+ document.getElementById("v_replacement").value = currentElement.__msh_origWord;\r
+ replaceAllClicked();\r
+ return false;\r
+};\r
+\r
+function learnClicked() {\r
+ alert("Not [yet] implemented");\r
+ return false;\r
+};\r
+\r
+function internationalizeWindow() {\r
+ var types = ["div", "span", "button"];\r
+ for (var i in types) {\r
+ var tag = types[i];\r
+ var els = document.getElementsByTagName(tag);\r
+ for (var j = els.length; --j >= 0;) {\r
+ var el = els[j];\r
+ if (el.childNodes.length == 1 && /\S/.test(el.innerHTML)) {\r
+ var txt = el.innerHTML;\r
+ if (typeof i18n[txt] != "undefined") {\r
+ el.innerHTML = i18n[txt];\r
+ }\r
+ }\r
+ }\r
+ }\r
+};\r
+\r
+function initDocument() {\r
+ internationalizeWindow();\r
+ modified = false;\r
+ frame = document.getElementById("i_framecontent");\r
+ var field = document.getElementById("f_content");\r
+ field.value = editor.getHTML();\r
+ field.form.submit();\r
+ document.getElementById("f_init").value = "0";\r
+\r
+ // assign some global event handlers\r
+\r
+ var select = document.getElementById("v_suggestions");\r
+ select.onchange = function() {\r
+ document.getElementById("v_replacement").value = this.value;\r
+ };\r
+ if (is_ie) {\r
+ select.attachEvent("ondblclick", replaceClicked);\r
+ } else {\r
+ select.addEventListener("dblclick", replaceClicked, true);\r
+ }\r
+\r
+ document.getElementById("b_replace").onclick = replaceClicked;\r
+ // document.getElementById("b_learn").onclick = learnClicked;\r
+ document.getElementById("b_replall").onclick = replaceAllClicked;\r
+ document.getElementById("b_ignore").onclick = ignoreClicked;\r
+ document.getElementById("b_ignall").onclick = ignoreAllClicked;\r
+ document.getElementById("b_recheck").onclick = recheckClicked;\r
+\r
+ document.getElementById("b_ok").onclick = saveClicked;\r
+ document.getElementById("b_cancel").onclick = cancelClicked;\r
+\r
+ select = document.getElementById("v_dictionaries");\r
+ select.onchange = function() {\r
+ document.getElementById("f_dictionary").value = this.value;\r
+ };\r
+};\r
+\r
+function wordClicked() {\r
+ if (currentElement) {\r
+ var a = allWords[currentElement.__msh_origWord];\r
+ currentElement.className = currentElement.className.replace(/\s*HA-spellcheck-current\s*/g, " ");\r
+ for (var i in a) {\r
+ var el = a[i];\r
+ if (el != currentElement) {\r
+ el.className = el.className.replace(/\s*HA-spellcheck-same\s*/g, " ");\r
+ }\r
+ }\r
+ }\r
+ currentElement = this;\r
+ this.className += " HA-spellcheck-current";\r
+ var a = allWords[currentElement.__msh_origWord];\r
+ for (var i in a) {\r
+ var el = a[i];\r
+ if (el != currentElement) {\r
+ el.className += " HA-spellcheck-same";\r
+ }\r
+ }\r
+ document.getElementById("b_replall").disabled = (a.length <= 1);\r
+ document.getElementById("b_ignall").disabled = (a.length <= 1);\r
+ var txt;\r
+ if (a.length == 1) {\r
+ txt = "one occurrence";\r
+ } else if (a.length == 2) {\r
+ txt = "two occurrences";\r
+ } else {\r
+ txt = a.length + " occurrences";\r
+ }\r
+ document.getElementById("statusbar").innerHTML = "Found " + txt +\r
+ ' for word "<b>' + currentElement.__msh_origWord + '</b>"';\r
+ var select = document.getElementById("v_suggestions");\r
+ for (var i = select.length; --i >= 0;) {\r
+ select.remove(i);\r
+ }\r
+ var suggestions;\r
+ suggestions = this.nextSibling.firstChild.data.split(/,/);\r
+ for (var i = 0; i < suggestions.length; ++i) {\r
+ var txt = suggestions[i];\r
+ var option = document.createElement("option");\r
+ option.value = txt;\r
+ option.appendChild(document.createTextNode(txt));\r
+ select.appendChild(option);\r
+ }\r
+ document.getElementById("v_currentWord").innerHTML = this.__msh_origWord;\r
+ if (suggestions.length > 0) {\r
+ select.selectedIndex = 0;\r
+ select.onchange();\r
+ } else {\r
+ document.getElementById("v_replacement").value = this.innerHTML;\r
+ }\r
+ return false;\r
+};\r
+\r
+function wordMouseOver() {\r
+ this.className += " HA-spellcheck-hover";\r
+};\r
+\r
+function wordMouseOut() {\r
+ this.className = this.className.replace(/\s*HA-spellcheck-hover\s*/g, " ");\r
+};\r
+\r
+function finishedSpellChecking() {\r
+ // initialization of global variables\r
+ currentElement = null;\r
+ wrongWords = null;\r
+ allWords = {};\r
+\r
+ document.getElementById("status").innerHTML = "HTMLArea Spell Checker (<a href='readme-tech.html' target='_blank' title='Technical information'>info</a>)";\r
+ var doc = frame.contentWindow.document;\r
+ var spans = doc.getElementsByTagName("span");\r
+ var sps = [];\r
+ var id = 0;\r
+ for (var i = 0; i < spans.length; ++i) {\r
+ var el = spans[i];\r
+ if (/HA-spellcheck-error/.test(el.className)) {\r
+ sps.push(el);\r
+ el.onclick = wordClicked;\r
+ el.onmouseover = wordMouseOver;\r
+ el.onmouseout = wordMouseOut;\r
+ el.__msh_id = id++;\r
+ var txt = (el.__msh_origWord = el.firstChild.data);\r
+ el.__msh_fixed = false;\r
+ if (typeof allWords[txt] == "undefined") {\r
+ allWords[txt] = [el];\r
+ } else {\r
+ allWords[txt].push(el);\r
+ }\r
+ }\r
+ }\r
+ wrongWords = sps;\r
+ if (sps.length == 0) {\r
+ if (!modified) {\r
+ alert(i18n["NO_ERRORS_CLOSING"]);\r
+ window.close();\r
+ } else {\r
+ alert(i18n["NO_ERRORS"]);\r
+ }\r
+ return false;\r
+ }\r
+ (currentElement = sps[0]).onclick();\r
+ var as = doc.getElementsByTagName("a");\r
+ for (var i = as.length; --i >= 0;) {\r
+ var a = as[i];\r
+ a.onclick = function() {\r
+ if (confirm(i18n["CONFIRM_LINK_CLICK"] + ":\n" +\r
+ this.href + "\n" + i18n["I will open it in a new page."])) {\r
+ window.open(this.href);\r
+ }\r
+ return false;\r
+ };\r
+ }\r
+ var dicts = doc.getElementById("HA-spellcheck-dictionaries");\r
+ if (dicts) {\r
+ dicts.parentNode.removeChild(dicts);\r
+ dicts = dicts.innerHTML.split(/,/);\r
+ var select = document.getElementById("v_dictionaries");\r
+ for (var i = select.length; --i >= 0;) {\r
+ select.remove(i);\r
+ }\r
+ for (var i = 0; i < dicts.length; ++i) {\r
+ var txt = dicts[i];\r
+ var option = document.createElement("option");\r
+ option.value = txt;\r
+ option.appendChild(document.createTextNode(txt));\r
+ select.appendChild(option);\r
+ }\r
+ }\r
+};\r
-// Spell Checker Plugin for HTMLArea-3.0
-// Implementation by Mihai Bazon. Sponsored by www.americanbible.org
-//
-// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
-// This notice MUST stay intact for use (see license.txt).
-//
-// A free WYSIWYG editor replacement for <textarea> fields.
-// For full source code and docs, visit http://www.interactivetools.com/
-//
-// Version 3.0 developed by Mihai Bazon for InteractiveTools.
-// http://students.infoiasi.ro/~mishoo
-//
-// $Id$
-
-function SpellChecker(editor) {
- this.editor = editor;
-
- var cfg = editor.config;
- var tt = SpellChecker.I18N;
- var bl = SpellChecker.btnList;
- var self = this;
-
- // register the toolbar buttons provided by this plugin
- var toolbar = [];
- for (var i in bl) {
- var btn = bl[i];
- if (!btn) {
- toolbar.push("separator");
- } else {
- var id = "SC-" + btn[0];
- cfg.registerButton(id, tt[id], "plugins/SpellChecker/img/" + btn[0] + ".gif", false,
- function(editor, id) {
- // dispatch button press event
- self.buttonPress(editor, id);
- }, btn[1]);
- toolbar.push(id);
- }
- }
-
- for (var i in toolbar) {
- cfg.toolbar[0].push(toolbar[i]);
- }
-};
-
-SpellChecker.btnList = [
- null, // separator
- ["spell-check"]
- ];
-
-SpellChecker.prototype.buttonPress = function(editor, id) {
- switch (id) {
- case "SC-spell-check":
- SpellChecker.editor = editor;
- SpellChecker.init = true;
- var uiurl = editor.config.editorURL + "plugins/SpellChecker/spell-check-ui.html";
- var win;
- if (HTMLArea.is_ie) {
- win = window.open(uiurl, "SC_spell_checker",
- "toolbar=no,location=no,directories=no,status=no,menubar=no," +
- "scrollbars=no,resizable=yes,width=600,height=400");
- } else {
- win = window.open(uiurl, "SC_spell_checker",
- "toolbar=no,menubar=no,personalbar=no,width=600,height=400," +
- "scrollbars=no,resizable=yes");
- }
- win.focus();
- break;
- }
-};
-
-// this needs to be global, it's accessed from spell-check-ui.html
-SpellChecker.editor = null;
+// Spell Checker Plugin for HTMLArea-3.0\r
+// Implementation by Mihai Bazon. Sponsored by www.americanbible.org\r
+//\r
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.\r
+// This notice MUST stay intact for use (see license.txt).\r
+//\r
+// A free WYSIWYG editor replacement for <textarea> fields.\r
+// For full source code and docs, visit http://www.interactivetools.com/\r
+//\r
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+// http://students.infoiasi.ro/~mishoo\r
+//\r
+// $Id$\r
+\r
+function SpellChecker(editor) {\r
+ this.editor = editor;\r
+\r
+ var cfg = editor.config;\r
+ var tt = SpellChecker.I18N;\r
+ var bl = SpellChecker.btnList;\r
+ var self = this;\r
+\r
+ // register the toolbar buttons provided by this plugin\r
+ var toolbar = [];\r
+ for (var i in bl) {\r
+ var btn = bl[i];\r
+ if (!btn) {\r
+ toolbar.push("separator");\r
+ } else {\r
+ var id = "SC-" + btn[0];\r
+ cfg.registerButton(id, tt[id], "plugins/SpellChecker/img/" + btn[0] + ".gif", false,\r
+ function(editor, id) {\r
+ // dispatch button press event\r
+ self.buttonPress(editor, id);\r
+ }, btn[1]);\r
+ toolbar.push(id);\r
+ }\r
+ }\r
+\r
+ for (var i in toolbar) {\r
+ cfg.toolbar[0].push(toolbar[i]);\r
+ }\r
+};\r
+\r
+SpellChecker.btnList = [\r
+ null, // separator\r
+ ["spell-check"]\r
+ ];\r
+\r
+SpellChecker.prototype.buttonPress = function(editor, id) {\r
+ switch (id) {\r
+ case "SC-spell-check":\r
+ SpellChecker.editor = editor;\r
+ SpellChecker.init = true;\r
+ var uiurl = editor.config.editorURL + "plugins/SpellChecker/spell-check-ui.html";\r
+ var win;\r
+ if (HTMLArea.is_ie) {\r
+ win = window.open(uiurl, "SC_spell_checker",\r
+ "toolbar=no,location=no,directories=no,status=no,menubar=no," +\r
+ "scrollbars=no,resizable=yes,width=600,height=400");\r
+ } else {\r
+ win = window.open(uiurl, "SC_spell_checker",\r
+ "toolbar=no,menubar=no,personalbar=no,width=600,height=400," +\r
+ "scrollbars=no,resizable=yes");\r
+ }\r
+ win.focus();\r
+ break;\r
+ }\r
+};\r
+\r
+// this needs to be global, it's accessed from spell-check-ui.html\r
+SpellChecker.editor = null;\r
-// I18N constants
-
-// LANG: "en", ENCODING: UTF-8 | ISO-8859-1
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-TableOperations.I18N = {
- "Align": "Align",
- "All four sides": "All four sides",
- "Background": "Background",
- "Baseline": "Baseline",
- "Border": "Border",
- "Borders": "Borders",
- "Bottom": "Bottom",
- "CSS Style": "Style [CSS]",
- "Caption": "Caption",
- "Cell Properties": "Cell Properties",
- "Center": "Center",
- "Char": "Char",
- "Collapsed borders": "Collapsed borders",
- "Color": "Color",
- "Description": "Description",
- "FG Color": "FG Color",
- "Float": "Float",
- "Frames": "Frames",
- "Height": "Height",
- "How many columns would you like to merge?": "How many columns would you like to merge?",
- "How many rows would you like to merge?": "How many rows would you like to merge?",
- "Image URL": "Image URL",
- "Justify": "Justify",
- "Layout": "Layout",
- "Left": "Left",
- "Margin": "Margin",
- "Middle": "Middle",
- "No rules": "No rules",
- "No sides": "No sides",
- "None": "None",
- "Padding": "Padding",
- "Please click into some cell": "Please click into some cell",
- "Right": "Right",
- "Row Properties": "Row Properties",
- "Rules will appear between all rows and columns": "Rules will appear between all rows and columns",
- "Rules will appear between columns only": "Rules will appear between columns only",
- "Rules will appear between rows only": "Rules will appear between rows only",
- "Rules": "Rules",
- "Spacing and padding": "Spacing and padding",
- "Spacing": "Spacing",
- "Summary": "Summary",
- "TO-cell-delete": "Delete cell",
- "TO-cell-insert-after": "Insert cell after",
- "TO-cell-insert-before": "Insert cell before",
- "TO-cell-merge": "Merge cells",
- "TO-cell-prop": "Cell properties",
- "TO-cell-split": "Split cell",
- "TO-col-delete": "Delete column",
- "TO-col-insert-after": "Insert column after",
- "TO-col-insert-before": "Insert column before",
- "TO-col-split": "Split column",
- "TO-row-delete": "Delete row",
- "TO-row-insert-above": "Insert row before",
- "TO-row-insert-under": "Insert row after",
- "TO-row-prop": "Row properties",
- "TO-row-split": "Split row",
- "TO-table-prop": "Table properties",
- "Table Properties": "Table Properties",
- "Text align": "Text align",
- "The bottom side only": "The bottom side only",
- "The left-hand side only": "The left-hand side only",
- "The right and left sides only": "The right and left sides only",
- "The right-hand side only": "The right-hand side only",
- "The top and bottom sides only": "The top and bottom sides only",
- "The top side only": "The top side only",
- "Top": "Top",
- "Unset color": "Unset color",
- "Vertical align": "Vertical align",
- "Width": "Width",
- "not-del-last-cell": "HTMLArea cowardly refuses to delete the last cell in row.",
- "not-del-last-col": "HTMLArea cowardly refuses to delete the last column in table.",
- "not-del-last-row": "HTMLArea cowardly refuses to delete the last row in table.",
- "percent": "percent",
- "pixels": "pixels"
-};
+// I18N constants\r
+\r
+// LANG: "en", ENCODING: UTF-8 | ISO-8859-1\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+TableOperations.I18N = {\r
+ "Align": "Align",\r
+ "All four sides": "All four sides",\r
+ "Background": "Background",\r
+ "Baseline": "Baseline",\r
+ "Border": "Border",\r
+ "Borders": "Borders",\r
+ "Bottom": "Bottom",\r
+ "CSS Style": "Style [CSS]",\r
+ "Caption": "Caption",\r
+ "Cell Properties": "Cell Properties",\r
+ "Center": "Center",\r
+ "Char": "Char",\r
+ "Collapsed borders": "Collapsed borders",\r
+ "Color": "Color",\r
+ "Description": "Description",\r
+ "FG Color": "FG Color",\r
+ "Float": "Float",\r
+ "Frames": "Frames",\r
+ "Height": "Height",\r
+ "How many columns would you like to merge?": "How many columns would you like to merge?",\r
+ "How many rows would you like to merge?": "How many rows would you like to merge?",\r
+ "Image URL": "Image URL",\r
+ "Justify": "Justify",\r
+ "Layout": "Layout",\r
+ "Left": "Left",\r
+ "Margin": "Margin",\r
+ "Middle": "Middle",\r
+ "No rules": "No rules",\r
+ "No sides": "No sides",\r
+ "None": "None",\r
+ "Padding": "Padding",\r
+ "Please click into some cell": "Please click into some cell",\r
+ "Right": "Right",\r
+ "Row Properties": "Row Properties",\r
+ "Rules will appear between all rows and columns": "Rules will appear between all rows and columns",\r
+ "Rules will appear between columns only": "Rules will appear between columns only",\r
+ "Rules will appear between rows only": "Rules will appear between rows only",\r
+ "Rules": "Rules",\r
+ "Spacing and padding": "Spacing and padding",\r
+ "Spacing": "Spacing",\r
+ "Summary": "Summary",\r
+ "TO-cell-delete": "Delete cell",\r
+ "TO-cell-insert-after": "Insert cell after",\r
+ "TO-cell-insert-before": "Insert cell before",\r
+ "TO-cell-merge": "Merge cells",\r
+ "TO-cell-prop": "Cell properties",\r
+ "TO-cell-split": "Split cell",\r
+ "TO-col-delete": "Delete column",\r
+ "TO-col-insert-after": "Insert column after",\r
+ "TO-col-insert-before": "Insert column before",\r
+ "TO-col-split": "Split column",\r
+ "TO-row-delete": "Delete row",\r
+ "TO-row-insert-above": "Insert row before",\r
+ "TO-row-insert-under": "Insert row after",\r
+ "TO-row-prop": "Row properties",\r
+ "TO-row-split": "Split row",\r
+ "TO-table-prop": "Table properties",\r
+ "Table Properties": "Table Properties",\r
+ "Text align": "Text align",\r
+ "The bottom side only": "The bottom side only",\r
+ "The left-hand side only": "The left-hand side only",\r
+ "The right and left sides only": "The right and left sides only",\r
+ "The right-hand side only": "The right-hand side only",\r
+ "The top and bottom sides only": "The top and bottom sides only",\r
+ "The top side only": "The top side only",\r
+ "Top": "Top", \r
+ "Unset color": "Unset color",\r
+ "Vertical align": "Vertical align",\r
+ "Width": "Width",\r
+ "not-del-last-cell": "HTMLArea cowardly refuses to delete the last cell in row.",\r
+ "not-del-last-col": "HTMLArea cowardly refuses to delete the last column in table.",\r
+ "not-del-last-row": "HTMLArea cowardly refuses to delete the last row in table.",\r
+ "percent": "percent",\r
+ "pixels": "pixels"\r
+};\r
-TableOperations.I18N = {
- "Align": "Kohdistus",
- "All four sides": "Kaikki neljä sivua",
- "Background": "Tausta",
- "Baseline": "Takaraja",
- "Border": "Reuna",
- "Borders": "Reunat",
- "Bottom": "Alle",
- "CSS Style": "Tyyli [CSS]",
- "Caption": "Otsikko",
- "Cell Properties": "Solun asetukset",
- "Center": "Keskelle",
- "Char": "Merkki",
- "Collapsed borders": "Luhistetut reunat",
- "Color": "Väri",
- "Description": "Kuvaus",
- "FG Color": "FG Väri",
- "Frames": "Kehykset",
- "Image URL": "Kuvan osoite",
- "Layout": "Sommittelu",
- "Left": "Vasen",
- "Margin": "Marginaali",
- "Middle": "Keskelle",
- "No rules": "Ei viivoja",
- "No sides": "Ei sivuja",
- "Padding": "Palstantäyte",
- "Right": "Oikea",
- "Row Properties": "Rivin asetukset",
- "Rules will appear between all rows and columns": "Viivat jokaisen rivin ja sarakkeen välillä",
- "Rules will appear between columns only": "Viivat ainoastaan sarakkeiden välillä",
- "Rules will appear between rows only": "Viivat ainoastaan rivien välillä",
- "Rules": "Viivat",
- "Spacing": "Palstatila",
- "Summary": "Yhteenveto",
- "TO-cell-delete": "Poista solu",
- "TO-cell-insert-after": "Lisää solu perään",
- "TO-cell-insert-before": "Lisää solu ennen",
- "TO-cell-merge": "Yhdistä solut",
- "TO-cell-prop": "Solun asetukset",
- "TO-cell-split": "Jaa solu",
- "TO-col-delete": "Poista sarake",
- "TO-col-insert-after": "Lisää sarake perään",
- "TO-col-insert-before": "Lisää sarake ennen",
- "TO-col-split": "Jaa sarake",
- "TO-row-delete": "Poista rivi",
- "TO-row-insert-above": "Lisää rivi yläpuolelle",
- "TO-row-insert-under": "Lisää rivi alapuolelle",
- "TO-row-prop": "Rivin asetukset",
- "TO-row-split": "Jaa rivi",
- "TO-table-prop": "Taulukon asetukset",
- "Top": "Ylös",
- "Table Properties": "Taulukon asetukset",
- "The bottom side only": "Ainoastaan alapuolelle",
- "The left-hand side only": "Ainoastaan vasenreuna",
- "The right and left sides only": "Oikea- ja vasenreuna",
- "The right-hand side only": "Ainoastaan oikeareuna",
- "The top and bottom sides only": "Ylä- ja alapuoli.",
- "The top side only": "Ainoastaan yläpuoli",
- "Vertical align": "Vertikaali kohdistus",
- "Width": "Leveys",
- "not-del-last-cell": "Ei voida poistaa viimeistä solua rivistä.",
- "not-del-last-col": "Ei voida poistaa viimeistä saraketta taulusta.",
- "not-del-last-row": "Ei voida poistaa viimeistä riviä taulusta.",
- "percent": "prosenttia",
- "pixels": "pikseliä"
-};
+TableOperations.I18N = {\r
+ "Align": "Kohdistus",\r
+ "All four sides": "Kaikki neljä sivua",\r
+ "Background": "Tausta",\r
+ "Baseline": "Takaraja",\r
+ "Border": "Reuna",\r
+ "Borders": "Reunat",\r
+ "Bottom": "Alle",\r
+ "CSS Style": "Tyyli [CSS]",\r
+ "Caption": "Otsikko",\r
+ "Cell Properties": "Solun asetukset",\r
+ "Center": "Keskelle",\r
+ "Char": "Merkki",\r
+ "Collapsed borders": "Luhistetut reunat",\r
+ "Color": "Väri",\r
+ "Description": "Kuvaus",\r
+ "FG Color": "FG Väri",\r
+ "Frames": "Kehykset",\r
+ "Image URL": "Kuvan osoite",\r
+ "Layout": "Sommittelu",\r
+ "Left": "Vasen",\r
+ "Margin": "Marginaali",\r
+ "Middle": "Keskelle",\r
+ "No rules": "Ei viivoja",\r
+ "No sides": "Ei sivuja",\r
+ "Padding": "Palstantäyte",\r
+ "Right": "Oikea",\r
+ "Row Properties": "Rivin asetukset",\r
+ "Rules will appear between all rows and columns": "Viivat jokaisen rivin ja sarakkeen välillä",\r
+ "Rules will appear between columns only": "Viivat ainoastaan sarakkeiden välillä",\r
+ "Rules will appear between rows only": "Viivat ainoastaan rivien välillä",\r
+ "Rules": "Viivat",\r
+ "Spacing": "Palstatila",\r
+ "Summary": "Yhteenveto",\r
+ "TO-cell-delete": "Poista solu",\r
+ "TO-cell-insert-after": "Lisää solu perään",\r
+ "TO-cell-insert-before": "Lisää solu ennen",\r
+ "TO-cell-merge": "Yhdistä solut",\r
+ "TO-cell-prop": "Solun asetukset",\r
+ "TO-cell-split": "Jaa solu",\r
+ "TO-col-delete": "Poista sarake",\r
+ "TO-col-insert-after": "Lisää sarake perään",\r
+ "TO-col-insert-before": "Lisää sarake ennen",\r
+ "TO-col-split": "Jaa sarake",\r
+ "TO-row-delete": "Poista rivi",\r
+ "TO-row-insert-above": "Lisää rivi yläpuolelle",\r
+ "TO-row-insert-under": "Lisää rivi alapuolelle",\r
+ "TO-row-prop": "Rivin asetukset",\r
+ "TO-row-split": "Jaa rivi",\r
+ "TO-table-prop": "Taulukon asetukset",\r
+ "Top": "Ylös", \r
+ "Table Properties": "Taulukon asetukset",\r
+ "The bottom side only": "Ainoastaan alapuolelle",\r
+ "The left-hand side only": "Ainoastaan vasenreuna",\r
+ "The right and left sides only": "Oikea- ja vasenreuna",\r
+ "The right-hand side only": "Ainoastaan oikeareuna",\r
+ "The top and bottom sides only": "Ylä- ja alapuoli.",\r
+ "The top side only": "Ainoastaan yläpuoli",\r
+ "Vertical align": "Vertikaali kohdistus",\r
+ "Width": "Leveys",\r
+ "not-del-last-cell": "Ei voida poistaa viimeistä solua rivistä.",\r
+ "not-del-last-col": "Ei voida poistaa viimeistä saraketta taulusta.",\r
+ "not-del-last-row": "Ei voida poistaa viimeistä riviä taulusta.",\r
+ "percent": "prosenttia",\r
+ "pixels": "pikseliä"\r
+};\r
-// I18N constants
-
-// LANG: "ro", ENCODING: UTF-8
-// Author: Mihai Bazon, <mishoo@infoiasi.ro>
-
-// FOR TRANSLATORS:
-//
-// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE
-// (at least a valid email address)
-//
-// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;
-// (if this is not possible, please include a comment
-// that states what encoding is necessary.)
-
-TableOperations.I18N = {
- "Align": "Aliniere",
- "All four sides": "Toate părţile",
- "Background": "Fundal",
- "Baseline": "Baseline",
- "Border": "Chenar",
- "Borders": "Chenare",
- "Bottom": "Jos",
- "CSS Style": "Stil [CSS]",
- "Caption": "Titlu de tabel",
- "Cell Properties": "Proprietăţile celulei",
- "Center": "Centru",
- "Char": "Caracter",
- "Collapsed borders": "Chenare asimilate",
- "Color": "Culoare",
- "Description": "Descriere",
- "FG Color": "Culoare text",
- "Float": "Poziţie",
- "Frames": "Chenare",
- "Height": "Înălţimea",
- "How many columns would you like to merge?": "Câte coloane vrei să uneşti?",
- "How many rows would you like to merge?": "Câte linii vrei să uneşti?",
- "Image URL": "URL-ul imaginii",
- "Justify": "Justify",
- "Layout": "Aranjament",
- "Left": "Stânga",
- "Margin": "Margine",
- "Middle": "Mijloc",
- "No rules": "Fără linii",
- "No sides": "Fără părţi",
- "None": "Nimic",
- "Padding": "Spaţiere",
- "Please click into some cell": "Vă rog să daţi click într-o celulă",
- "Right": "Dreapta",
- "Row Properties": "Proprietăţile liniei",
- "Rules will appear between all rows and columns": "Vor apărea linii între toate rândurile şi coloanele",
- "Rules will appear between columns only": "Vor apărea doar linii verticale",
- "Rules will appear between rows only": "Vor apărea doar linii orizontale",
- "Rules": "Linii",
- "Spacing and padding": "Spaţierea",
- "Spacing": "Între celule",
- "Summary": "Sumar",
- "TO-cell-delete": "Şterge celula",
- "TO-cell-insert-after": "Inserează o celulă la dreapta",
- "TO-cell-insert-before": "Inserează o celulă la stânga",
- "TO-cell-merge": "Uneşte celulele",
- "TO-cell-prop": "Proprietăţile celulei",
- "TO-cell-split": "Împarte celula",
- "TO-col-delete": "Şterge coloana",
- "TO-col-insert-after": "Inserează o coloană la dreapta",
- "TO-col-insert-before": "Inserează o coloană la stânga",
- "TO-col-split": "Împarte coloana",
- "TO-row-delete": "Şterge rândul",
- "TO-row-insert-above": "Inserează un rând înainte",
- "TO-row-insert-under": "Inserează un rând după",
- "TO-row-prop": "Proprietăţile rândului",
- "TO-row-split": "Împarte rândul",
- "TO-table-prop": "Proprietăţile tabelei",
- "Table Properties": "Proprietăţile tabelei",
- "Text align": "Aliniere",
- "The bottom side only": "Doar partea de jos",
- "The left-hand side only": "Doar partea din stânga",
- "The right and left sides only": "Partea din stânga şi cea din dreapta",
- "The right-hand side only": "Doar partea din dreapta",
- "The top and bottom sides only": "Partea de sus si cea de jos",
- "The top side only": "Doar partea de sus",
- "Top": "Sus",
- "Unset color": "Dezactivează culoarea",
- "Vertical align": "Aliniere pe verticală",
- "Width": "Lăţime",
- "not-del-last-cell": "HTMLArea refuză cu laşitate să şteargă ultima celulă din rând.",
- "not-del-last-col": "HTMLArea refuză cu laşitate să şteargă ultima coloamă din tabela.",
- "not-del-last-row": "HTMLArea refuză cu laşitate să şteargă ultimul rând din tabela.",
- "percent": "procente",
- "pixels": "pixeli"
-};
+// I18N constants\r
+\r
+// LANG: "ro", ENCODING: UTF-8\r
+// Author: Mihai Bazon, <mishoo@infoiasi.ro>\r
+\r
+// FOR TRANSLATORS:\r
+//\r
+// 1. PLEASE PUT YOUR CONTACT INFO IN THE ABOVE LINE\r
+// (at least a valid email address)\r
+//\r
+// 2. PLEASE TRY TO USE UTF-8 FOR ENCODING;\r
+// (if this is not possible, please include a comment\r
+// that states what encoding is necessary.)\r
+\r
+TableOperations.I18N = {\r
+ "Align": "Aliniere",\r
+ "All four sides": "Toate părţile",\r
+ "Background": "Fundal",\r
+ "Baseline": "Baseline",\r
+ "Border": "Chenar",\r
+ "Borders": "Chenare",\r
+ "Bottom": "Jos",\r
+ "CSS Style": "Stil [CSS]",\r
+ "Caption": "Titlu de tabel",\r
+ "Cell Properties": "Proprietăţile celulei",\r
+ "Center": "Centru",\r
+ "Char": "Caracter",\r
+ "Collapsed borders": "Chenare asimilate",\r
+ "Color": "Culoare",\r
+ "Description": "Descriere",\r
+ "FG Color": "Culoare text",\r
+ "Float": "Poziţie",\r
+ "Frames": "Chenare",\r
+ "Height": "Înălţimea",\r
+ "How many columns would you like to merge?": "Câte coloane vrei să uneşti?",\r
+ "How many rows would you like to merge?": "Câte linii vrei să uneşti?",\r
+ "Image URL": "URL-ul imaginii",\r
+ "Justify": "Justify",\r
+ "Layout": "Aranjament",\r
+ "Left": "Stânga",\r
+ "Margin": "Margine",\r
+ "Middle": "Mijloc",\r
+ "No rules": "Fără linii",\r
+ "No sides": "Fără părţi",\r
+ "None": "Nimic",\r
+ "Padding": "Spaţiere",\r
+ "Please click into some cell": "Vă rog să daţi click într-o celulă",\r
+ "Right": "Dreapta",\r
+ "Row Properties": "Proprietăţile liniei",\r
+ "Rules will appear between all rows and columns": "Vor apărea linii între toate rândurile şi coloanele",\r
+ "Rules will appear between columns only": "Vor apărea doar linii verticale",\r
+ "Rules will appear between rows only": "Vor apărea doar linii orizontale",\r
+ "Rules": "Linii",\r
+ "Spacing and padding": "Spaţierea",\r
+ "Spacing": "Între celule",\r
+ "Summary": "Sumar",\r
+ "TO-cell-delete": "Şterge celula",\r
+ "TO-cell-insert-after": "Inserează o celulă la dreapta",\r
+ "TO-cell-insert-before": "Inserează o celulă la stânga",\r
+ "TO-cell-merge": "Uneşte celulele",\r
+ "TO-cell-prop": "Proprietăţile celulei",\r
+ "TO-cell-split": "Împarte celula",\r
+ "TO-col-delete": "Şterge coloana",\r
+ "TO-col-insert-after": "Inserează o coloană la dreapta",\r
+ "TO-col-insert-before": "Inserează o coloană la stânga",\r
+ "TO-col-split": "Împarte coloana",\r
+ "TO-row-delete": "Şterge rândul",\r
+ "TO-row-insert-above": "Inserează un rând înainte",\r
+ "TO-row-insert-under": "Inserează un rând după",\r
+ "TO-row-prop": "Proprietăţile rândului",\r
+ "TO-row-split": "Împarte rândul",\r
+ "TO-table-prop": "Proprietăţile tabelei",\r
+ "Table Properties": "Proprietăţile tabelei",\r
+ "Text align": "Aliniere",\r
+ "The bottom side only": "Doar partea de jos",\r
+ "The left-hand side only": "Doar partea din stânga",\r
+ "The right and left sides only": "Partea din stânga şi cea din dreapta",\r
+ "The right-hand side only": "Doar partea din dreapta",\r
+ "The top and bottom sides only": "Partea de sus si cea de jos",\r
+ "The top side only": "Doar partea de sus",\r
+ "Top": "Sus", \r
+ "Unset color": "Dezactivează culoarea",\r
+ "Vertical align": "Aliniere pe verticală",\r
+ "Width": "Lăţime",\r
+ "not-del-last-cell": "HTMLArea refuză cu laşitate să şteargă ultima celulă din rând.",\r
+ "not-del-last-col": "HTMLArea refuză cu laşitate să şteargă ultima coloamă din tabela.",\r
+ "not-del-last-row": "HTMLArea refuză cu laşitate să şteargă ultimul rând din tabela.",\r
+ "percent": "procente",\r
+ "pixels": "pixeli"\r
+};\r
-// Table Operations Plugin for HTMLArea-3.0
-// Implementation by Mihai Bazon. Sponsored by http://www.bloki.com
-//
-// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.
-// This notice MUST stay intact for use (see license.txt).
-//
-// A free WYSIWYG editor replacement for <textarea> fields.
-// For full source code and docs, visit http://www.interactivetools.com/
-//
-// Version 3.0 developed by Mihai Bazon for InteractiveTools.
-// http://students.infoiasi.ro/~mishoo
-//
-// $Id$
-
-// Object that will encapsulate all the table operations provided by
-// HTMLArea-3.0 (except "insert table" which is included in the main file)
-function TableOperations(editor) {
- this.editor = editor;
-
- var cfg = editor.config;
- var tt = TableOperations.I18N;
- var bl = TableOperations.btnList;
- var self = this;
-
- // register the toolbar buttons provided by this plugin
- var toolbar = ["linebreak"];
- for (var i in bl) {
- var btn = bl[i];
- if (!btn) {
- toolbar.push("separator");
- } else {
- var id = "TO-" + btn[0];
- cfg.registerButton(id, tt[id], "plugins/TableOperations/img/" + btn[0] + ".gif", false,
- function(editor, id) {
- // dispatch button press event
- self.buttonPress(editor, id);
- }, btn[1]);
- toolbar.push(id);
- }
- }
-
- // add a new line in the toolbar
- cfg.toolbar.push(toolbar);
-};
-
-/************************
- * UTILITIES
- ************************/
-
-// retrieves the closest element having the specified tagName in the list of
-// ancestors of the current selection/caret.
-TableOperations.prototype.getClosest = function(tagName) {
- var editor = this.editor;
- var ancestors = editor.getAllAncestors();
- var ret = null;
- tagName = ("" + tagName).toLowerCase();
- for (var i in ancestors) {
- var el = ancestors[i];
- if (el.tagName.toLowerCase() == tagName) {
- ret = el;
- break;
- }
- }
- return ret;
-};
-
-// this function requires the file PopupDiv/PopupWin to be loaded from browser
-TableOperations.prototype.dialogTableProperties = function() {
- var i18n = TableOperations.I18N;
- // retrieve existing values
- var table = this.getClosest("table");
- // this.editor.selectNodeContents(table);
- // this.editor.updateToolbar();
-
- var dialog = new PopupWin(this.editor, i18n["Table Properties"], function(dialog, params) {
- TableOperations.processStyle(params, table);
- for (var i in params) {
- var val = params[i];
- switch (i) {
- case "f_caption":
- if (/\S/.test(val)) {
- // contains non white-space characters
- var caption = table.getElementsByTagName("caption")[0];
- if (!caption) {
- caption = dialog.editor._doc.createElement("caption");
- table.insertBefore(caption, table.firstChild);
- }
- caption.innerHTML = val;
- } else {
- // search for caption and delete it if found
- var caption = table.getElementsByTagName("caption")[0];
- if (caption) {
- caption.parentNode.removeChild(caption);
- }
- }
- break;
- case "f_summary":
- table.summary = val;
- break;
- case "f_width":
- table.style.width = ("" + val) + params.f_unit;
- break;
- case "f_align":
- table.align = val;
- break;
- case "f_spacing":
- table.cellSpacing = val;
- break;
- case "f_padding":
- table.cellPadding = val;
- break;
- case "f_borders":
- table.border = val;
- break;
- case "f_frames":
- table.frame = val;
- break;
- case "f_rules":
- table.rules = val;
- break;
- }
- }
- // various workarounds to refresh the table display (Gecko,
- // what's going on?! do not disappoint me!)
- dialog.editor.forceRedraw();
- dialog.editor.focusEditor();
- dialog.editor.updateToolbar();
- var save_collapse = table.style.borderCollapse;
- table.style.borderCollapse = "collapse";
- table.style.borderCollapse = "separate";
- table.style.borderCollapse = save_collapse;
- },
-
- // this function gets called when the dialog needs to be initialized
- function (dialog) {
-
- var f_caption = "";
- var capel = table.getElementsByTagName("caption")[0];
- if (capel) {
- f_caption = capel.innerHTML;
- }
- var f_summary = table.summary;
- var f_width = parseInt(table.style.width);
- isNaN(f_width) && (f_width = "");
- var f_unit = /%/.test(table.style.width) ? 'percent' : 'pixels';
- var f_align = table.align;
- var f_spacing = table.cellSpacing;
- var f_padding = table.cellPadding;
- var f_borders = table.border;
- var f_frames = table.frame;
- var f_rules = table.rules;
-
- function selected(val) {
- return val ? " selected" : "";
- };
-
- // dialog contents
- dialog.content.style.width = "400px";
- dialog.content.innerHTML = " \
-<div class='title'\
- style='background: url(" + dialog.baseURL + dialog.editor.imgURL("table-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n["Table Properties"] + "\
-</div> \
-<table style='width:100%'> \
- <tr> \
- <td> \
- <fieldset><legend>" + i18n["Description"] + "</legend> \
- <table style='width:100%'> \
- <tr> \
- <td class='label'>" + i18n["Caption"] + ":</td> \
- <td class='value'><input type='text' name='f_caption' value='" + f_caption + "'/></td> \
- </tr><tr> \
- <td class='label'>" + i18n["Summary"] + ":</td> \
- <td class='value'><input type='text' name='f_summary' value='" + f_summary + "'/></td> \
- </tr> \
- </table> \
- </fieldset> \
- </td> \
- </tr> \
- <tr><td id='--HA-layout'></td></tr> \
- <tr> \
- <td> \
- <fieldset><legend>" + i18n["Spacing and padding"] + "</legend> \
- <table style='width:100%'> \
-"+// <tr> \
-// <td class='label'>" + i18n["Width"] + ":</td> \
-// <td><input type='text' name='f_width' value='" + f_width + "' size='5' /> \
-// <select name='f_unit'> \
-// <option value='%'" + selected(f_unit == "percent") + ">" + i18n["percent"] + "</option> \
-// <option value='px'" + selected(f_unit == "pixels") + ">" + i18n["pixels"] + "</option> \
-// </select> " + i18n["Align"] + ": \
-// <select name='f_align'> \
-// <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \
-// <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \
-// <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \
-// </select> \
-// </td> \
-// </tr> \
-" <tr> \
- <td class='label'>" + i18n["Spacing"] + ":</td> \
- <td><input type='text' name='f_spacing' size='5' value='" + f_spacing + "' /> " + i18n["Padding"] + ":\
- <input type='text' name='f_padding' size='5' value='" + f_padding + "' /> " + i18n["pixels"] + "\
- </td> \
- </tr> \
- </table> \
- </fieldset> \
- </td> \
- </tr> \
- <tr> \
- <td> \
- <fieldset><legend>Frame and borders</legend> \
- <table width='100%'> \
- <tr> \
- <td class='label'>" + i18n["Borders"] + ":</td> \
- <td><input name='f_borders' type='text' size='5' value='" + f_borders + "' /> " + i18n["pixels"] + "</td> \
- </tr> \
- <tr> \
- <td class='label'>" + i18n["Frames"] + ":</td> \
- <td> \
- <select name='f_frames'> \
- <option value='void'" + selected(f_frames == "void") + ">" + i18n["No sides"] + "</option> \
- <option value='above'" + selected(f_frames == "above") + ">" + i18n["The top side only"] + "</option> \
- <option value='below'" + selected(f_frames == "below") + ">" + i18n["The bottom side only"] + "</option> \
- <option value='hsides'" + selected(f_frames == "hsides") + ">" + i18n["The top and bottom sides only"] + "</option> \
- <option value='vsides'" + selected(f_frames == "vsides") + ">" + i18n["The right and left sides only"] + "</option> \
- <option value='lhs'" + selected(f_frames == "lhs") + ">" + i18n["The left-hand side only"] + "</option> \
- <option value='rhs'" + selected(f_frames == "rhs") + ">" + i18n["The right-hand side only"] + "</option> \
- <option value='box'" + selected(f_frames == "box") + ">" + i18n["All four sides"] + "</option> \
- </select> \
- </td> \
- </tr> \
- <tr> \
- <td class='label'>" + i18n["Rules"] + ":</td> \
- <td> \
- <select name='f_rules'> \
- <option value='none'" + selected(f_rules == "none") + ">" + i18n["No rules"] + "</option> \
- <option value='rows'" + selected(f_rules == "rows") + ">" + i18n["Rules will appear between rows only"] + "</option> \
- <option value='cols'" + selected(f_rules == "cols") + ">" + i18n["Rules will appear between columns only"] + "</option> \
- <option value='all'" + selected(f_rules == "all") + ">" + i18n["Rules will appear between all rows and columns"] + "</option> \
- </select> \
- </td> \
- </tr> \
- </table> \
- </fieldset> \
- </td> \
- </tr> \
- <tr> \
- <td id='--HA-style'></td> \
- </tr> \
-</table> \
-";
- var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, table);
- var p = dialog.doc.getElementById("--HA-style");
- p.appendChild(st_prop);
- var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, table);
- p = dialog.doc.getElementById("--HA-layout");
- p.appendChild(st_layout);
- dialog.modal = true;
- dialog.addButtons("ok", "cancel");
- dialog.showAtElement(dialog.editor._iframe, "c");
- });
-};
-
-// this function requires the file PopupDiv/PopupWin to be loaded from browser
-TableOperations.prototype.dialogRowCellProperties = function(cell) {
- var i18n = TableOperations.I18N;
- // retrieve existing values
- var element = this.getClosest(cell ? "td" : "tr");
- var table = this.getClosest("table");
- // this.editor.selectNodeContents(element);
- // this.editor.updateToolbar();
-
- var dialog = new PopupWin(this.editor, i18n[cell ? "Cell Properties" : "Row Properties"], function(dialog, params) {
- TableOperations.processStyle(params, element);
- for (var i in params) {
- var val = params[i];
- switch (i) {
- case "f_align":
- element.align = val;
- break;
- case "f_char":
- element.ch = val;
- break;
- case "f_valign":
- element.vAlign = val;
- break;
- }
- }
- // various workarounds to refresh the table display (Gecko,
- // what's going on?! do not disappoint me!)
- dialog.editor.forceRedraw();
- dialog.editor.focusEditor();
- dialog.editor.updateToolbar();
- var save_collapse = table.style.borderCollapse;
- table.style.borderCollapse = "collapse";
- table.style.borderCollapse = "separate";
- table.style.borderCollapse = save_collapse;
- },
-
- // this function gets called when the dialog needs to be initialized
- function (dialog) {
-
- var f_align = element.align;
- var f_valign = element.vAlign;
- var f_char = element.ch;
-
- function selected(val) {
- return val ? " selected" : "";
- };
-
- // dialog contents
- dialog.content.style.width = "400px";
- dialog.content.innerHTML = " \
-<div class='title'\
- style='background: url(" + dialog.baseURL + dialog.editor.imgURL(cell ? "cell-prop.gif" : "row-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n[cell ? "Cell Properties" : "Row Properties"] + "</div> \
-<table style='width:100%'> \
- <tr> \
- <td id='--HA-layout'> \
-"+// <fieldset><legend>" + i18n["Layout"] + "</legend> \
-// <table style='width:100%'> \
-// <tr> \
-// <td class='label'>" + i18n["Align"] + ":</td> \
-// <td> \
-// <select name='f_align'> \
-// <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \
-// <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \
-// <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \
-// <option value='char'" + selected(f_align == "char") + ">" + i18n["Char"] + "</option> \
-// </select> \
-// " + i18n["Char"] + ": \
-// <input type='text' style='font-family: monospace; text-align: center' name='f_char' size='1' value='" + f_char + "' /> \
-// </td> \
-// </tr><tr> \
-// <td class='label'>" + i18n["Vertical align"] + ":</td> \
-// <td> \
-// <select name='f_valign'> \
-// <option value='top'" + selected(f_valign == "top") + ">" + i18n["Top"] + "</option> \
-// <option value='middle'" + selected(f_valign == "middle") + ">" + i18n["Middle"] + "</option> \
-// <option value='bottom'" + selected(f_valign == "bottom") + ">" + i18n["Bottom"] + "</option> \
-// <option value='baseline'" + selected(f_valign == "baseline") + ">" + i18n["Baseline"] + "</option> \
-// </select> \
-// </td> \
-// </tr> \
-// </table> \
-// </fieldset> \
-" </td> \
- </tr> \
- <tr> \
- <td id='--HA-style'></td> \
- </tr> \
-</table> \
-";
- var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, element);
- var p = dialog.doc.getElementById("--HA-style");
- p.appendChild(st_prop);
- var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, element);
- p = dialog.doc.getElementById("--HA-layout");
- p.appendChild(st_layout);
- dialog.modal = true;
- dialog.addButtons("ok", "cancel");
- dialog.showAtElement(dialog.editor._iframe, "c");
- });
-};
-
-// this function gets called when some button from the TableOperations toolbar
-// was pressed.
-TableOperations.prototype.buttonPress = function(editor, button_id) {
- this.editor = editor;
- var mozbr = HTMLArea.is_gecko ? "<br />" : "";
- var i18n = TableOperations.I18N;
-
- // helper function that clears the content in a table row
- function clearRow(tr) {
- var tds = tr.getElementsByTagName("td");
- for (var i = tds.length; --i >= 0;) {
- var td = tds[i];
- td.rowSpan = 1;
- td.innerHTML = mozbr;
- }
- };
-
- function splitRow(td) {
- var n = parseInt("" + td.rowSpan);
- var nc = parseInt("" + td.colSpan);
- td.rowSpan = 1;
- tr = td.parentNode;
- var itr = tr.rowIndex;
- var trs = tr.parentNode.rows;
- var index = td.cellIndex;
- while (--n > 0) {
- tr = trs[++itr];
- var otd = editor._doc.createElement("td");
- otd.colSpan = td.colSpan;
- otd.innerHTML = mozbr;
- tr.insertBefore(otd, tr.cells[index]);
- }
- editor.forceRedraw();
- editor.updateToolbar();
- };
-
- function splitCol(td) {
- var nc = parseInt("" + td.colSpan);
- td.colSpan = 1;
- tr = td.parentNode;
- var ref = td.nextSibling;
- while (--nc > 0) {
- var otd = editor._doc.createElement("td");
- otd.rowSpan = td.rowSpan;
- otd.innerHTML = mozbr;
- tr.insertBefore(otd, ref);
- }
- editor.forceRedraw();
- editor.updateToolbar();
- };
-
- function splitCell(td) {
- var nc = parseInt("" + td.colSpan);
- splitCol(td);
- var items = td.parentNode.cells;
- var index = td.cellIndex;
- while (nc-- > 0) {
- splitRow(items[index++]);
- }
- };
-
- function selectNextNode(el) {
- var node = el.nextSibling;
- while (node && node.nodeType != 1) {
- node = node.nextSibling;
- }
- if (!node) {
- node = el.previousSibling;
- while (node && node.nodeType != 1) {
- node = node.previousSibling;
- }
- }
- if (!node) {
- node = el.parentNode;
- }
- editor.selectNodeContents(node);
- };
-
- switch (button_id) {
- // ROWS
-
- case "TO-row-insert-above":
- case "TO-row-insert-under":
- var tr = this.getClosest("tr");
- if (!tr) {
- break;
- }
- var otr = tr.cloneNode(true);
- clearRow(otr);
- tr.parentNode.insertBefore(otr, /under/.test(button_id) ? tr.nextSibling : tr);
- editor.forceRedraw();
- editor.focusEditor();
- break;
- case "TO-row-delete":
- var tr = this.getClosest("tr");
- if (!tr) {
- break;
- }
- var par = tr.parentNode;
- if (par.rows.length == 1) {
- alert(i18n["not-del-last-row"]);
- break;
- }
- // set the caret first to a position that doesn't
- // disappear.
- selectNextNode(tr);
- par.removeChild(tr);
- editor.forceRedraw();
- editor.focusEditor();
- editor.updateToolbar();
- break;
- case "TO-row-split":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- splitRow(td);
- break;
-
- // COLUMNS
-
- case "TO-col-insert-before":
- case "TO-col-insert-after":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- var rows = td.parentNode.parentNode.rows;
- var index = td.cellIndex;
- for (var i = rows.length; --i >= 0;) {
- var tr = rows[i];
- var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)];
- var otd = editor._doc.createElement("td");
- otd.innerHTML = mozbr;
- tr.insertBefore(otd, ref);
- }
- editor.focusEditor();
- break;
- case "TO-col-split":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- splitCol(td);
- break;
- case "TO-col-delete":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- var index = td.cellIndex;
- if (td.parentNode.cells.length == 1) {
- alert(i18n["not-del-last-col"]);
- break;
- }
- // set the caret first to a position that doesn't disappear
- selectNextNode(td);
- var rows = td.parentNode.parentNode.rows;
- for (var i = rows.length; --i >= 0;) {
- var tr = rows[i];
- tr.removeChild(tr.cells[index]);
- }
- editor.forceRedraw();
- editor.focusEditor();
- editor.updateToolbar();
- break;
-
- // CELLS
-
- case "TO-cell-split":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- splitCell(td);
- break;
- case "TO-cell-insert-before":
- case "TO-cell-insert-after":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- var tr = td.parentNode;
- var otd = editor._doc.createElement("td");
- otd.innerHTML = mozbr;
- tr.insertBefore(otd, /after/.test(button_id) ? td.nextSibling : td);
- editor.forceRedraw();
- editor.focusEditor();
- break;
- case "TO-cell-delete":
- var td = this.getClosest("td");
- if (!td) {
- break;
- }
- if (td.parentNode.cells.length == 1) {
- alert(i18n["not-del-last-cell"]);
- break;
- }
- // set the caret first to a position that doesn't disappear
- selectNextNode(td);
- td.parentNode.removeChild(td);
- editor.forceRedraw();
- editor.updateToolbar();
- break;
- case "TO-cell-merge":
- // !! FIXME: Mozilla specific !!
- var sel = editor._getSelection();
- var range, i = 0;
- var rows = [];
- var row = null;
- var cells = null;
- if (!HTMLArea.is_ie) {
- try {
- while (range = sel.getRangeAt(i++)) {
- var td = range.startContainer.childNodes[range.startOffset];
- if (td.parentNode != row) {
- row = td.parentNode;
- (cells) && rows.push(cells);
- cells = [];
- }
- cells.push(td);
- }
- } catch(e) {/* finished walking through selection */}
- rows.push(cells);
- } else {
- // Internet Explorer "browser"
- var td = this.getClosest("td");
- if (!td) {
- alert(i18n["Please click into some cell"]);
- break;
- }
- var tr = td.parentElement;
- var no_cols = prompt(i18n["How many columns would you like to merge?"], 2);
- if (!no_cols) {
- // cancelled
- break;
- }
- var no_rows = prompt(i18n["How many rows would you like to merge?"], 2);
- if (!no_rows) {
- // cancelled
- break;
- }
- var cell_index = td.cellIndex;
- while (no_rows-- > 0) {
- td = tr.cells[cell_index];
- cells = [td];
- for (var i = 1; i < no_cols; ++i) {
- td = td.nextSibling;
- if (!td) {
- break;
- }
- cells.push(td);
- }
- rows.push(cells);
- tr = tr.nextSibling;
- if (!tr) {
- break;
- }
- }
- }
- var HTML = "";
- for (i = 0; i < rows.length; ++i) {
- // i && (HTML += "<br />");
- var cells = rows[i];
- for (var j = 0; j < cells.length; ++j) {
- // j && (HTML += " ");
- var cell = cells[j];
- HTML += cell.innerHTML;
- (i || j) && (cell.parentNode.removeChild(cell));
- }
- }
- var td = rows[0][0];
- td.innerHTML = HTML;
- td.rowSpan = rows.length;
- td.colSpan = rows[0].length;
- editor.selectNodeContents(td);
- editor.forceRedraw();
- editor.focusEditor();
- break;
-
- // PROPERTIES
-
- case "TO-table-prop":
- this.dialogTableProperties();
- break;
-
- case "TO-row-prop":
- this.dialogRowCellProperties(false);
- break;
-
- case "TO-cell-prop":
- this.dialogRowCellProperties(true);
- break;
-
- default:
- alert("Button [" + button_id + "] not yet implemented");
- }
-};
-
-// the list of buttons added by this plugin
-TableOperations.btnList = [
- // table properties button
- ["table-prop", "table"],
- null, // separator
-
- // ROWS
- ["row-prop", "tr"],
- ["row-insert-above", "tr"],
- ["row-insert-under", "tr"],
- ["row-delete", "tr"],
- ["row-split", "td[rowSpan!=1]"],
- null,
-
- // COLS
- ["col-insert-before", "td"],
- ["col-insert-after", "td"],
- ["col-delete", "td"],
- ["col-split", "td[colSpan!=1]"],
- null,
-
- // CELLS
- ["cell-prop", "td"],
- ["cell-insert-before", "td"],
- ["cell-insert-after", "td"],
- ["cell-delete", "td"],
- ["cell-merge", "tr"],
- ["cell-split", "td[colSpan!=1,rowSpan!=1]"]
- ];
-
-
-
-//// GENERIC CODE [style of any element; this should be moved into a separate
-//// file as it'll be very useful]
-//// BEGIN GENERIC CODE -----------------------------------------------------
-
-TableOperations.getLength = function(value) {
- var len = parseInt(value);
- if (isNaN(len)) {
- len = "";
- }
- return len;
-};
-
-// Applies the style found in "params" to the given element.
-TableOperations.processStyle = function(params, element) {
- var style = element.style;
- for (var i in params) {
- var val = params[i];
- switch (i) {
- case "f_st_backgroundColor":
- style.backgroundColor = val;
- break;
- case "f_st_color":
- style.color = val;
- break;
- case "f_st_backgroundImage":
- if (/\S/.test(val)) {
- style.backgroundImage = "url(" + val + ")";
- } else {
- style.backgroundImage = "none";
- }
- break;
- case "f_st_borderWidth":
- style.borderWidth = val;
- break;
- case "f_st_borderStyle":
- style.borderStyle = val;
- break;
- case "f_st_borderColor":
- style.borderColor = val;
- break;
- case "f_st_borderCollapse":
- style.borderCollapse = val ? "collapse" : "";
- break;
- case "f_st_width":
- if (/\S/.test(val)) {
- style.width = val + params["f_st_widthUnit"];
- } else {
- style.width = "";
- }
- break;
- case "f_st_height":
- if (/\S/.test(val)) {
- style.height = val + params["f_st_heightUnit"];
- } else {
- style.height = "";
- }
- break;
- case "f_st_textAlign":
- if (val == "char") {
- var ch = params["f_st_textAlignChar"];
- if (ch == '"') {
- ch = '\\"';
- }
- style.textAlign = '"' + ch + '"';
- } else {
- style.textAlign = val;
- }
- break;
- case "f_st_verticalAlign":
- style.verticalAlign = val;
- break;
- case "f_st_float":
- style.cssFloat = val;
- break;
-// case "f_st_margin":
-// style.margin = val + "px";
-// break;
-// case "f_st_padding":
-// style.padding = val + "px";
-// break;
- }
- }
-};
-
-// Returns an HTML element for a widget that allows color selection. That is,
-// a button that contains the given color, if any, and when pressed will popup
-// the sooner-or-later-to-be-rewritten select_color.html dialog allowing user
-// to select some color. If a color is selected, an input field with the name
-// "f_st_"+name will be updated with the color value in #123456 format.
-TableOperations.createColorButton = function(doc, editor, color, name) {
- if (!color) {
- color = "";
- } else if (!/#/.test(color)) {
- color = HTMLArea._colorToRgb(color);
- }
-
- var df = doc.createElement("span");
- var field = doc.createElement("input");
- field.type = "hidden";
- df.appendChild(field);
- field.name = "f_st_" + name;
- field.value = color;
- var button = doc.createElement("span");
- button.className = "buttonColor";
- df.appendChild(button);
- var span = doc.createElement("span");
- span.className = "chooser";
- // span.innerHTML = " ";
- span.style.backgroundColor = color;
- button.appendChild(span);
- button.onmouseover = function() { if (!this.disabled) { this.className += " buttonColor-hilite"; }};
- button.onmouseout = function() { if (!this.disabled) { this.className = "buttonColor"; }};
- span.onclick = function() {
- if (this.parentNode.disabled) {
- return false;
- }
- editor._popupDialog("select_color.html", function(color) {
- if (color) {
- span.style.backgroundColor = "#" + color;
- field.value = "#" + color;
- }
- }, color);
- };
- var span2 = doc.createElement("span");
- span2.innerHTML = "×";
- span2.className = "nocolor";
- span2.title = TableOperations.I18N["Unset color"];
- button.appendChild(span2);
- span2.onmouseover = function() { if (!this.parentNode.disabled) { this.className += " nocolor-hilite"; }};
- span2.onmouseout = function() { if (!this.parentNode.disabled) { this.className = "nocolor"; }};
- span2.onclick = function() {
- span.style.backgroundColor = "";
- field.value = "";
- };
- return df;
-};
-
-TableOperations.createStyleLayoutFieldset = function(doc, editor, el) {
- var i18n = TableOperations.I18N;
- var fieldset = doc.createElement("fieldset");
- var legend = doc.createElement("legend");
- fieldset.appendChild(legend);
- legend.innerHTML = i18n["Layout"];
- var table = doc.createElement("table");
- fieldset.appendChild(table);
- table.style.width = "100%";
- var tbody = doc.createElement("tbody");
- table.appendChild(tbody);
-
- var tagname = el.tagName.toLowerCase();
- var tr, td, input, select, option, options, i;
-
- if (tagname != "td" && tagname != "tr" && tagname != "th") {
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- td.className = "label";
- tr.appendChild(td);
- td.innerHTML = i18n["Float"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
- select = doc.createElement("select");
- td.appendChild(select);
- select.name = "f_st_float";
- options = ["None", "Left", "Right"];
- for (i in options) {
- var Val = options[i];
- var val = options[i].toLowerCase();
- option = doc.createElement("option");
- option.innerHTML = i18n[Val];
- option.value = val;
- option.selected = (("" + el.style.cssFloat).toLowerCase() == val);
- select.appendChild(option);
- }
- }
-
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- td.className = "label";
- tr.appendChild(td);
- td.innerHTML = i18n["Width"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
- input = doc.createElement("input");
- input.type = "text";
- input.value = TableOperations.getLength(el.style.width);
- input.size = "5";
- input.name = "f_st_width";
- input.style.marginRight = "0.5em";
- td.appendChild(input);
- select = doc.createElement("select");
- select.name = "f_st_widthUnit";
- option = doc.createElement("option");
- option.innerHTML = i18n["percent"];
- option.value = "%";
- option.selected = /%/.test(el.style.width);
- select.appendChild(option);
- option = doc.createElement("option");
- option.innerHTML = i18n["pixels"];
- option.value = "px";
- option.selected = /px/.test(el.style.width);
- select.appendChild(option);
- td.appendChild(select);
-
- select.style.marginRight = "0.5em";
- td.appendChild(doc.createTextNode(i18n["Text align"] + ":"));
- select = doc.createElement("select");
- select.style.marginLeft = select.style.marginRight = "0.5em";
- td.appendChild(select);
- select.name = "f_st_textAlign";
- options = ["Left", "Center", "Right", "Justify"];
- if (tagname == "td") {
- options.push("Char");
- }
- input = doc.createElement("input");
- input.name = "f_st_textAlignChar";
- input.size = "1";
- input.style.fontFamily = "monospace";
- td.appendChild(input);
- for (i in options) {
- var Val = options[i];
- var val = Val.toLowerCase();
- option = doc.createElement("option");
- option.value = val;
- option.innerHTML = i18n[Val];
- option.selected = (el.style.textAlign.toLowerCase() == val);
- select.appendChild(option);
- }
- function setCharVisibility(value) {
- input.style.visibility = value ? "visible" : "hidden";
- if (value) {
- input.focus();
- input.select();
- }
- };
- select.onchange = function() { setCharVisibility(this.value == "char"); };
- setCharVisibility(select.value == "char");
-
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- td.className = "label";
- tr.appendChild(td);
- td.innerHTML = i18n["Height"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
- input = doc.createElement("input");
- input.type = "text";
- input.value = TableOperations.getLength(el.style.height);
- input.size = "5";
- input.name = "f_st_height";
- input.style.marginRight = "0.5em";
- td.appendChild(input);
- select = doc.createElement("select");
- select.name = "f_st_heightUnit";
- option = doc.createElement("option");
- option.innerHTML = i18n["percent"];
- option.value = "%";
- option.selected = /%/.test(el.style.height);
- select.appendChild(option);
- option = doc.createElement("option");
- option.innerHTML = i18n["pixels"];
- option.value = "px";
- option.selected = /px/.test(el.style.height);
- select.appendChild(option);
- td.appendChild(select);
-
- select.style.marginRight = "0.5em";
- td.appendChild(doc.createTextNode(i18n["Vertical align"] + ":"));
- select = doc.createElement("select");
- select.name = "f_st_verticalAlign";
- select.style.marginLeft = "0.5em";
- td.appendChild(select);
- options = ["Top", "Middle", "Bottom", "Baseline"];
- for (i in options) {
- var Val = options[i];
- var val = Val.toLowerCase();
- option = doc.createElement("option");
- option.value = val;
- option.innerHTML = i18n[Val];
- option.selected = (el.style.verticalAlign.toLowerCase() == val);
- select.appendChild(option);
- }
-
- return fieldset;
-};
-
-// Returns an HTML element containing the style attributes for the given
-// element. This can be easily embedded into any dialog; the functionality is
-// also provided.
-TableOperations.createStyleFieldset = function(doc, editor, el) {
- var i18n = TableOperations.I18N;
- var fieldset = doc.createElement("fieldset");
- var legend = doc.createElement("legend");
- fieldset.appendChild(legend);
- legend.innerHTML = i18n["CSS Style"];
- var table = doc.createElement("table");
- fieldset.appendChild(table);
- table.style.width = "100%";
- var tbody = doc.createElement("tbody");
- table.appendChild(tbody);
-
- var tr, td, input, select, option, options, i;
-
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- tr.appendChild(td);
- td.className = "label";
- td.innerHTML = i18n["Background"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
- var df = TableOperations.createColorButton(doc, editor, el.style.backgroundColor, "backgroundColor");
- df.firstChild.nextSibling.style.marginRight = "0.5em";
- td.appendChild(df);
- td.appendChild(doc.createTextNode(i18n["Image URL"] + ": "));
- input = doc.createElement("input");
- input.type = "text";
- input.name = "f_st_backgroundImage";
- if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) {
- input.value = RegExp.$1;
- }
- // input.style.width = "100%";
- td.appendChild(input);
-
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- tr.appendChild(td);
- td.className = "label";
- td.innerHTML = i18n["FG Color"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
- td.appendChild(TableOperations.createColorButton(doc, editor, el.style.color, "color"));
-
- // for better alignment we include an invisible field.
- input = doc.createElement("input");
- input.style.visibility = "hidden";
- input.type = "text";
- td.appendChild(input);
-
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- tr.appendChild(td);
- td.className = "label";
- td.innerHTML = i18n["Border"] + ":";
- td = doc.createElement("td");
- tr.appendChild(td);
-
- var colorButton = TableOperations.createColorButton(doc, editor, el.style.borderColor, "borderColor");
- var btn = colorButton.firstChild.nextSibling;
- td.appendChild(colorButton);
- // borderFields.push(btn);
- btn.style.marginRight = "0.5em";
-
- select = doc.createElement("select");
- var borderFields = [];
- td.appendChild(select);
- select.name = "f_st_borderStyle";
- options = ["none", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"];
- var currentBorderStyle = el.style.borderStyle;
- // Gecko reports "solid solid solid solid" for "border-style: solid".
- // That is, "top right bottom left" -- we only consider the first
- // value.
- (currentBorderStyle.match(/([^\s]*)\s/)) && (currentBorderStyle = RegExp.$1);
- for (i in options) {
- var val = options[i];
- option = doc.createElement("option");
- option.value = val;
- option.innerHTML = val;
- (val == currentBorderStyle) && (option.selected = true);
- select.appendChild(option);
- }
- select.style.marginRight = "0.5em";
- function setBorderFieldsStatus(value) {
- for (i in borderFields) {
- var el = borderFields[i];
- el.style.visibility = value ? "hidden" : "visible";
- if (!value && (el.tagName.toLowerCase() == "input")) {
- el.focus();
- el.select();
- }
- }
- };
- select.onchange = function() { setBorderFieldsStatus(this.value == "none"); };
-
- input = doc.createElement("input");
- borderFields.push(input);
- input.type = "text";
- input.name = "f_st_borderWidth";
- input.value = TableOperations.getLength(el.style.borderWidth);
- input.size = "5";
- td.appendChild(input);
- input.style.marginRight = "0.5em";
- var span = doc.createElement("span");
- span.innerHTML = i18n["pixels"];
- td.appendChild(span);
- borderFields.push(span);
-
- setBorderFieldsStatus(select.value == "none");
-
- if (el.tagName.toLowerCase() == "table") {
- // the border-collapse style is only for tables
- tr = doc.createElement("tr");
- tbody.appendChild(tr);
- td = doc.createElement("td");
- td.className = "label";
- tr.appendChild(td);
- input = doc.createElement("input");
- input.type = "checkbox";
- input.name = "f_st_borderCollapse";
- input.id = "f_st_borderCollapse";
- var val = (/collapse/i.test(el.style.borderCollapse));
- input.checked = val ? 1 : 0;
- td.appendChild(input);
-
- td = doc.createElement("td");
- tr.appendChild(td);
- var label = doc.createElement("label");
- label.htmlFor = "f_st_borderCollapse";
- label.innerHTML = i18n["Collapsed borders"];
- td.appendChild(label);
- }
-
-// tr = doc.createElement("tr");
-// tbody.appendChild(tr);
-// td = doc.createElement("td");
-// td.className = "label";
-// tr.appendChild(td);
-// td.innerHTML = i18n["Margin"] + ":";
-// td = doc.createElement("td");
-// tr.appendChild(td);
-// input = doc.createElement("input");
-// input.type = "text";
-// input.size = "5";
-// input.name = "f_st_margin";
-// td.appendChild(input);
-// input.style.marginRight = "0.5em";
-// td.appendChild(doc.createTextNode(i18n["Padding"] + ":"));
-
-// input = doc.createElement("input");
-// input.type = "text";
-// input.size = "5";
-// input.name = "f_st_padding";
-// td.appendChild(input);
-// input.style.marginLeft = "0.5em";
-// input.style.marginRight = "0.5em";
-// td.appendChild(doc.createTextNode(i18n["pixels"]));
-
- return fieldset;
-};
-
-//// END GENERIC CODE -------------------------------------------------------
+// Table Operations Plugin for HTMLArea-3.0\r
+// Implementation by Mihai Bazon. Sponsored by http://www.bloki.com\r
+//\r
+// htmlArea v3.0 - Copyright (c) 2002 interactivetools.com, inc.\r
+// This notice MUST stay intact for use (see license.txt).\r
+//\r
+// A free WYSIWYG editor replacement for <textarea> fields.\r
+// For full source code and docs, visit http://www.interactivetools.com/\r
+//\r
+// Version 3.0 developed by Mihai Bazon for InteractiveTools.\r
+// http://students.infoiasi.ro/~mishoo\r
+//\r
+// $Id$\r
+\r
+// Object that will encapsulate all the table operations provided by\r
+// HTMLArea-3.0 (except "insert table" which is included in the main file)\r
+function TableOperations(editor) {\r
+ this.editor = editor;\r
+\r
+ var cfg = editor.config;\r
+ var tt = TableOperations.I18N;\r
+ var bl = TableOperations.btnList;\r
+ var self = this;\r
+\r
+ // register the toolbar buttons provided by this plugin\r
+ var toolbar = ["linebreak"];\r
+ for (var i in bl) {\r
+ var btn = bl[i];\r
+ if (!btn) {\r
+ toolbar.push("separator");\r
+ } else {\r
+ var id = "TO-" + btn[0];\r
+ cfg.registerButton(id, tt[id], "plugins/TableOperations/img/" + btn[0] + ".gif", false,\r
+ function(editor, id) {\r
+ // dispatch button press event\r
+ self.buttonPress(editor, id);\r
+ }, btn[1]);\r
+ toolbar.push(id);\r
+ }\r
+ }\r
+\r
+ // add a new line in the toolbar\r
+ cfg.toolbar.push(toolbar);\r
+};\r
+\r
+/************************\r
+ * UTILITIES\r
+ ************************/\r
+\r
+// retrieves the closest element having the specified tagName in the list of\r
+// ancestors of the current selection/caret.\r
+TableOperations.prototype.getClosest = function(tagName) {\r
+ var editor = this.editor;\r
+ var ancestors = editor.getAllAncestors();\r
+ var ret = null;\r
+ tagName = ("" + tagName).toLowerCase();\r
+ for (var i in ancestors) {\r
+ var el = ancestors[i];\r
+ if (el.tagName.toLowerCase() == tagName) {\r
+ ret = el;\r
+ break;\r
+ }\r
+ }\r
+ return ret;\r
+};\r
+\r
+// this function requires the file PopupDiv/PopupWin to be loaded from browser\r
+TableOperations.prototype.dialogTableProperties = function() {\r
+ var i18n = TableOperations.I18N;\r
+ // retrieve existing values\r
+ var table = this.getClosest("table");\r
+ // this.editor.selectNodeContents(table);\r
+ // this.editor.updateToolbar();\r
+\r
+ var dialog = new PopupWin(this.editor, i18n["Table Properties"], function(dialog, params) {\r
+ TableOperations.processStyle(params, table);\r
+ for (var i in params) {\r
+ var val = params[i];\r
+ switch (i) {\r
+ case "f_caption":\r
+ if (/\S/.test(val)) {\r
+ // contains non white-space characters\r
+ var caption = table.getElementsByTagName("caption")[0];\r
+ if (!caption) {\r
+ caption = dialog.editor._doc.createElement("caption");\r
+ table.insertBefore(caption, table.firstChild);\r
+ }\r
+ caption.innerHTML = val;\r
+ } else {\r
+ // search for caption and delete it if found\r
+ var caption = table.getElementsByTagName("caption")[0];\r
+ if (caption) {\r
+ caption.parentNode.removeChild(caption);\r
+ }\r
+ }\r
+ break;\r
+ case "f_summary":\r
+ table.summary = val;\r
+ break;\r
+ case "f_width":\r
+ table.style.width = ("" + val) + params.f_unit;\r
+ break;\r
+ case "f_align":\r
+ table.align = val;\r
+ break;\r
+ case "f_spacing":\r
+ table.cellSpacing = val;\r
+ break;\r
+ case "f_padding":\r
+ table.cellPadding = val;\r
+ break;\r
+ case "f_borders":\r
+ table.border = val;\r
+ break;\r
+ case "f_frames":\r
+ table.frame = val;\r
+ break;\r
+ case "f_rules":\r
+ table.rules = val;\r
+ break;\r
+ }\r
+ }\r
+ // various workarounds to refresh the table display (Gecko,\r
+ // what's going on?! do not disappoint me!)\r
+ dialog.editor.forceRedraw();\r
+ dialog.editor.focusEditor();\r
+ dialog.editor.updateToolbar();\r
+ var save_collapse = table.style.borderCollapse;\r
+ table.style.borderCollapse = "collapse";\r
+ table.style.borderCollapse = "separate";\r
+ table.style.borderCollapse = save_collapse;\r
+ },\r
+\r
+ // this function gets called when the dialog needs to be initialized\r
+ function (dialog) {\r
+\r
+ var f_caption = "";\r
+ var capel = table.getElementsByTagName("caption")[0];\r
+ if (capel) {\r
+ f_caption = capel.innerHTML;\r
+ }\r
+ var f_summary = table.summary;\r
+ var f_width = parseInt(table.style.width);\r
+ isNaN(f_width) && (f_width = "");\r
+ var f_unit = /%/.test(table.style.width) ? 'percent' : 'pixels';\r
+ var f_align = table.align;\r
+ var f_spacing = table.cellSpacing;\r
+ var f_padding = table.cellPadding;\r
+ var f_borders = table.border;\r
+ var f_frames = table.frame;\r
+ var f_rules = table.rules;\r
+\r
+ function selected(val) {\r
+ return val ? " selected" : "";\r
+ };\r
+\r
+ // dialog contents\r
+ dialog.content.style.width = "400px";\r
+ dialog.content.innerHTML = " \\r
+<div class='title'\\r
+ style='background: url(" + dialog.baseURL + dialog.editor.imgURL("table-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n["Table Properties"] + "\\r
+</div> \\r
+<table style='width:100%'> \\r
+ <tr> \\r
+ <td> \\r
+ <fieldset><legend>" + i18n["Description"] + "</legend> \\r
+ <table style='width:100%'> \\r
+ <tr> \\r
+ <td class='label'>" + i18n["Caption"] + ":</td> \\r
+ <td class='value'><input type='text' name='f_caption' value='" + f_caption + "'/></td> \\r
+ </tr><tr> \\r
+ <td class='label'>" + i18n["Summary"] + ":</td> \\r
+ <td class='value'><input type='text' name='f_summary' value='" + f_summary + "'/></td> \\r
+ </tr> \\r
+ </table> \\r
+ </fieldset> \\r
+ </td> \\r
+ </tr> \\r
+ <tr><td id='--HA-layout'></td></tr> \\r
+ <tr> \\r
+ <td> \\r
+ <fieldset><legend>" + i18n["Spacing and padding"] + "</legend> \\r
+ <table style='width:100%'> \\r
+"+// <tr> \\r
+// <td class='label'>" + i18n["Width"] + ":</td> \\r
+// <td><input type='text' name='f_width' value='" + f_width + "' size='5' /> \\r
+// <select name='f_unit'> \\r
+// <option value='%'" + selected(f_unit == "percent") + ">" + i18n["percent"] + "</option> \\r
+// <option value='px'" + selected(f_unit == "pixels") + ">" + i18n["pixels"] + "</option> \\r
+// </select> " + i18n["Align"] + ": \\r
+// <select name='f_align'> \\r
+// <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \\r
+// <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \\r
+// <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \\r
+// </select> \\r
+// </td> \\r
+// </tr> \\r
+" <tr> \\r
+ <td class='label'>" + i18n["Spacing"] + ":</td> \\r
+ <td><input type='text' name='f_spacing' size='5' value='" + f_spacing + "' /> " + i18n["Padding"] + ":\\r
+ <input type='text' name='f_padding' size='5' value='" + f_padding + "' /> " + i18n["pixels"] + "\\r
+ </td> \\r
+ </tr> \\r
+ </table> \\r
+ </fieldset> \\r
+ </td> \\r
+ </tr> \\r
+ <tr> \\r
+ <td> \\r
+ <fieldset><legend>Frame and borders</legend> \\r
+ <table width='100%'> \\r
+ <tr> \\r
+ <td class='label'>" + i18n["Borders"] + ":</td> \\r
+ <td><input name='f_borders' type='text' size='5' value='" + f_borders + "' /> " + i18n["pixels"] + "</td> \\r
+ </tr> \\r
+ <tr> \\r
+ <td class='label'>" + i18n["Frames"] + ":</td> \\r
+ <td> \\r
+ <select name='f_frames'> \\r
+ <option value='void'" + selected(f_frames == "void") + ">" + i18n["No sides"] + "</option> \\r
+ <option value='above'" + selected(f_frames == "above") + ">" + i18n["The top side only"] + "</option> \\r
+ <option value='below'" + selected(f_frames == "below") + ">" + i18n["The bottom side only"] + "</option> \\r
+ <option value='hsides'" + selected(f_frames == "hsides") + ">" + i18n["The top and bottom sides only"] + "</option> \\r
+ <option value='vsides'" + selected(f_frames == "vsides") + ">" + i18n["The right and left sides only"] + "</option> \\r
+ <option value='lhs'" + selected(f_frames == "lhs") + ">" + i18n["The left-hand side only"] + "</option> \\r
+ <option value='rhs'" + selected(f_frames == "rhs") + ">" + i18n["The right-hand side only"] + "</option> \\r
+ <option value='box'" + selected(f_frames == "box") + ">" + i18n["All four sides"] + "</option> \\r
+ </select> \\r
+ </td> \\r
+ </tr> \\r
+ <tr> \\r
+ <td class='label'>" + i18n["Rules"] + ":</td> \\r
+ <td> \\r
+ <select name='f_rules'> \\r
+ <option value='none'" + selected(f_rules == "none") + ">" + i18n["No rules"] + "</option> \\r
+ <option value='rows'" + selected(f_rules == "rows") + ">" + i18n["Rules will appear between rows only"] + "</option> \\r
+ <option value='cols'" + selected(f_rules == "cols") + ">" + i18n["Rules will appear between columns only"] + "</option> \\r
+ <option value='all'" + selected(f_rules == "all") + ">" + i18n["Rules will appear between all rows and columns"] + "</option> \\r
+ </select> \\r
+ </td> \\r
+ </tr> \\r
+ </table> \\r
+ </fieldset> \\r
+ </td> \\r
+ </tr> \\r
+ <tr> \\r
+ <td id='--HA-style'></td> \\r
+ </tr> \\r
+</table> \\r
+";\r
+ var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, table);\r
+ var p = dialog.doc.getElementById("--HA-style");\r
+ p.appendChild(st_prop);\r
+ var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, table);\r
+ p = dialog.doc.getElementById("--HA-layout");\r
+ p.appendChild(st_layout);\r
+ dialog.modal = true;\r
+ dialog.addButtons("ok", "cancel");\r
+ dialog.showAtElement(dialog.editor._iframe, "c");\r
+ });\r
+};\r
+\r
+// this function requires the file PopupDiv/PopupWin to be loaded from browser\r
+TableOperations.prototype.dialogRowCellProperties = function(cell) {\r
+ var i18n = TableOperations.I18N;\r
+ // retrieve existing values\r
+ var element = this.getClosest(cell ? "td" : "tr");\r
+ var table = this.getClosest("table");\r
+ // this.editor.selectNodeContents(element);\r
+ // this.editor.updateToolbar();\r
+\r
+ var dialog = new PopupWin(this.editor, i18n[cell ? "Cell Properties" : "Row Properties"], function(dialog, params) {\r
+ TableOperations.processStyle(params, element);\r
+ for (var i in params) {\r
+ var val = params[i];\r
+ switch (i) {\r
+ case "f_align":\r
+ element.align = val;\r
+ break;\r
+ case "f_char":\r
+ element.ch = val;\r
+ break;\r
+ case "f_valign":\r
+ element.vAlign = val;\r
+ break;\r
+ }\r
+ }\r
+ // various workarounds to refresh the table display (Gecko,\r
+ // what's going on?! do not disappoint me!)\r
+ dialog.editor.forceRedraw();\r
+ dialog.editor.focusEditor();\r
+ dialog.editor.updateToolbar();\r
+ var save_collapse = table.style.borderCollapse;\r
+ table.style.borderCollapse = "collapse";\r
+ table.style.borderCollapse = "separate";\r
+ table.style.borderCollapse = save_collapse;\r
+ },\r
+\r
+ // this function gets called when the dialog needs to be initialized\r
+ function (dialog) {\r
+\r
+ var f_align = element.align;\r
+ var f_valign = element.vAlign;\r
+ var f_char = element.ch;\r
+\r
+ function selected(val) {\r
+ return val ? " selected" : "";\r
+ };\r
+\r
+ // dialog contents\r
+ dialog.content.style.width = "400px";\r
+ dialog.content.innerHTML = " \\r
+<div class='title'\\r
+ style='background: url(" + dialog.baseURL + dialog.editor.imgURL(cell ? "cell-prop.gif" : "row-prop.gif", "TableOperations") + ") #fff 98% 50% no-repeat'>" + i18n[cell ? "Cell Properties" : "Row Properties"] + "</div> \\r
+<table style='width:100%'> \\r
+ <tr> \\r
+ <td id='--HA-layout'> \\r
+"+// <fieldset><legend>" + i18n["Layout"] + "</legend> \\r
+// <table style='width:100%'> \\r
+// <tr> \\r
+// <td class='label'>" + i18n["Align"] + ":</td> \\r
+// <td> \\r
+// <select name='f_align'> \\r
+// <option value='left'" + selected(f_align == "left") + ">" + i18n["Left"] + "</option> \\r
+// <option value='center'" + selected(f_align == "center") + ">" + i18n["Center"] + "</option> \\r
+// <option value='right'" + selected(f_align == "right") + ">" + i18n["Right"] + "</option> \\r
+// <option value='char'" + selected(f_align == "char") + ">" + i18n["Char"] + "</option> \\r
+// </select> \\r
+// " + i18n["Char"] + ": \\r
+// <input type='text' style='font-family: monospace; text-align: center' name='f_char' size='1' value='" + f_char + "' /> \\r
+// </td> \\r
+// </tr><tr> \\r
+// <td class='label'>" + i18n["Vertical align"] + ":</td> \\r
+// <td> \\r
+// <select name='f_valign'> \\r
+// <option value='top'" + selected(f_valign == "top") + ">" + i18n["Top"] + "</option> \\r
+// <option value='middle'" + selected(f_valign == "middle") + ">" + i18n["Middle"] + "</option> \\r
+// <option value='bottom'" + selected(f_valign == "bottom") + ">" + i18n["Bottom"] + "</option> \\r
+// <option value='baseline'" + selected(f_valign == "baseline") + ">" + i18n["Baseline"] + "</option> \\r
+// </select> \\r
+// </td> \\r
+// </tr> \\r
+// </table> \\r
+// </fieldset> \\r
+" </td> \\r
+ </tr> \\r
+ <tr> \\r
+ <td id='--HA-style'></td> \\r
+ </tr> \\r
+</table> \\r
+";\r
+ var st_prop = TableOperations.createStyleFieldset(dialog.doc, dialog.editor, element);\r
+ var p = dialog.doc.getElementById("--HA-style");\r
+ p.appendChild(st_prop);\r
+ var st_layout = TableOperations.createStyleLayoutFieldset(dialog.doc, dialog.editor, element);\r
+ p = dialog.doc.getElementById("--HA-layout");\r
+ p.appendChild(st_layout);\r
+ dialog.modal = true;\r
+ dialog.addButtons("ok", "cancel");\r
+ dialog.showAtElement(dialog.editor._iframe, "c");\r
+ });\r
+};\r
+\r
+// this function gets called when some button from the TableOperations toolbar\r
+// was pressed.\r
+TableOperations.prototype.buttonPress = function(editor, button_id) {\r
+ this.editor = editor;\r
+ var mozbr = HTMLArea.is_gecko ? "<br />" : "";\r
+ var i18n = TableOperations.I18N;\r
+\r
+ // helper function that clears the content in a table row\r
+ function clearRow(tr) {\r
+ var tds = tr.getElementsByTagName("td");\r
+ for (var i = tds.length; --i >= 0;) {\r
+ var td = tds[i];\r
+ td.rowSpan = 1;\r
+ td.innerHTML = mozbr;\r
+ }\r
+ };\r
+\r
+ function splitRow(td) {\r
+ var n = parseInt("" + td.rowSpan);\r
+ var nc = parseInt("" + td.colSpan);\r
+ td.rowSpan = 1;\r
+ tr = td.parentNode;\r
+ var itr = tr.rowIndex;\r
+ var trs = tr.parentNode.rows;\r
+ var index = td.cellIndex;\r
+ while (--n > 0) {\r
+ tr = trs[++itr];\r
+ var otd = editor._doc.createElement("td");\r
+ otd.colSpan = td.colSpan;\r
+ otd.innerHTML = mozbr;\r
+ tr.insertBefore(otd, tr.cells[index]);\r
+ }\r
+ editor.forceRedraw();\r
+ editor.updateToolbar();\r
+ };\r
+\r
+ function splitCol(td) {\r
+ var nc = parseInt("" + td.colSpan);\r
+ td.colSpan = 1;\r
+ tr = td.parentNode;\r
+ var ref = td.nextSibling;\r
+ while (--nc > 0) {\r
+ var otd = editor._doc.createElement("td");\r
+ otd.rowSpan = td.rowSpan;\r
+ otd.innerHTML = mozbr;\r
+ tr.insertBefore(otd, ref);\r
+ }\r
+ editor.forceRedraw();\r
+ editor.updateToolbar();\r
+ };\r
+\r
+ function splitCell(td) {\r
+ var nc = parseInt("" + td.colSpan);\r
+ splitCol(td);\r
+ var items = td.parentNode.cells;\r
+ var index = td.cellIndex;\r
+ while (nc-- > 0) {\r
+ splitRow(items[index++]);\r
+ }\r
+ };\r
+\r
+ function selectNextNode(el) {\r
+ var node = el.nextSibling;\r
+ while (node && node.nodeType != 1) {\r
+ node = node.nextSibling;\r
+ }\r
+ if (!node) {\r
+ node = el.previousSibling;\r
+ while (node && node.nodeType != 1) {\r
+ node = node.previousSibling;\r
+ }\r
+ }\r
+ if (!node) {\r
+ node = el.parentNode;\r
+ }\r
+ editor.selectNodeContents(node);\r
+ };\r
+\r
+ switch (button_id) {\r
+ // ROWS\r
+\r
+ case "TO-row-insert-above":\r
+ case "TO-row-insert-under":\r
+ var tr = this.getClosest("tr");\r
+ if (!tr) {\r
+ break;\r
+ }\r
+ var otr = tr.cloneNode(true);\r
+ clearRow(otr);\r
+ tr.parentNode.insertBefore(otr, /under/.test(button_id) ? tr.nextSibling : tr);\r
+ editor.forceRedraw();\r
+ editor.focusEditor();\r
+ break;\r
+ case "TO-row-delete":\r
+ var tr = this.getClosest("tr");\r
+ if (!tr) {\r
+ break;\r
+ }\r
+ var par = tr.parentNode;\r
+ if (par.rows.length == 1) {\r
+ alert(i18n["not-del-last-row"]);\r
+ break;\r
+ }\r
+ // set the caret first to a position that doesn't\r
+ // disappear.\r
+ selectNextNode(tr);\r
+ par.removeChild(tr);\r
+ editor.forceRedraw();\r
+ editor.focusEditor();\r
+ editor.updateToolbar();\r
+ break;\r
+ case "TO-row-split":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ splitRow(td);\r
+ break;\r
+\r
+ // COLUMNS\r
+\r
+ case "TO-col-insert-before":\r
+ case "TO-col-insert-after":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ var rows = td.parentNode.parentNode.rows;\r
+ var index = td.cellIndex;\r
+ for (var i = rows.length; --i >= 0;) {\r
+ var tr = rows[i];\r
+ var ref = tr.cells[index + (/after/.test(button_id) ? 1 : 0)];\r
+ var otd = editor._doc.createElement("td");\r
+ otd.innerHTML = mozbr;\r
+ tr.insertBefore(otd, ref);\r
+ }\r
+ editor.focusEditor();\r
+ break;\r
+ case "TO-col-split":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ splitCol(td);\r
+ break;\r
+ case "TO-col-delete":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ var index = td.cellIndex;\r
+ if (td.parentNode.cells.length == 1) {\r
+ alert(i18n["not-del-last-col"]);\r
+ break;\r
+ }\r
+ // set the caret first to a position that doesn't disappear\r
+ selectNextNode(td);\r
+ var rows = td.parentNode.parentNode.rows;\r
+ for (var i = rows.length; --i >= 0;) {\r
+ var tr = rows[i];\r
+ tr.removeChild(tr.cells[index]);\r
+ }\r
+ editor.forceRedraw();\r
+ editor.focusEditor();\r
+ editor.updateToolbar();\r
+ break;\r
+\r
+ // CELLS\r
+\r
+ case "TO-cell-split":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ splitCell(td);\r
+ break;\r
+ case "TO-cell-insert-before":\r
+ case "TO-cell-insert-after":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ var tr = td.parentNode;\r
+ var otd = editor._doc.createElement("td");\r
+ otd.innerHTML = mozbr;\r
+ tr.insertBefore(otd, /after/.test(button_id) ? td.nextSibling : td);\r
+ editor.forceRedraw();\r
+ editor.focusEditor();\r
+ break;\r
+ case "TO-cell-delete":\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ break;\r
+ }\r
+ if (td.parentNode.cells.length == 1) {\r
+ alert(i18n["not-del-last-cell"]);\r
+ break;\r
+ }\r
+ // set the caret first to a position that doesn't disappear\r
+ selectNextNode(td);\r
+ td.parentNode.removeChild(td);\r
+ editor.forceRedraw();\r
+ editor.updateToolbar();\r
+ break;\r
+ case "TO-cell-merge":\r
+ // !! FIXME: Mozilla specific !!\r
+ var sel = editor._getSelection();\r
+ var range, i = 0;\r
+ var rows = [];\r
+ var row = null;\r
+ var cells = null;\r
+ if (!HTMLArea.is_ie) {\r
+ try {\r
+ while (range = sel.getRangeAt(i++)) {\r
+ var td = range.startContainer.childNodes[range.startOffset];\r
+ if (td.parentNode != row) {\r
+ row = td.parentNode;\r
+ (cells) && rows.push(cells);\r
+ cells = [];\r
+ }\r
+ cells.push(td);\r
+ }\r
+ } catch(e) {/* finished walking through selection */}\r
+ rows.push(cells);\r
+ } else {\r
+ // Internet Explorer "browser"\r
+ var td = this.getClosest("td");\r
+ if (!td) {\r
+ alert(i18n["Please click into some cell"]);\r
+ break;\r
+ }\r
+ var tr = td.parentElement;\r
+ var no_cols = prompt(i18n["How many columns would you like to merge?"], 2);\r
+ if (!no_cols) {\r
+ // cancelled\r
+ break;\r
+ }\r
+ var no_rows = prompt(i18n["How many rows would you like to merge?"], 2);\r
+ if (!no_rows) {\r
+ // cancelled\r
+ break;\r
+ }\r
+ var cell_index = td.cellIndex;\r
+ while (no_rows-- > 0) {\r
+ td = tr.cells[cell_index];\r
+ cells = [td];\r
+ for (var i = 1; i < no_cols; ++i) {\r
+ td = td.nextSibling;\r
+ if (!td) {\r
+ break;\r
+ }\r
+ cells.push(td);\r
+ }\r
+ rows.push(cells);\r
+ tr = tr.nextSibling;\r
+ if (!tr) {\r
+ break;\r
+ }\r
+ }\r
+ }\r
+ var HTML = "";\r
+ for (i = 0; i < rows.length; ++i) {\r
+ // i && (HTML += "<br />");\r
+ var cells = rows[i];\r
+ for (var j = 0; j < cells.length; ++j) {\r
+ // j && (HTML += " ");\r
+ var cell = cells[j];\r
+ HTML += cell.innerHTML;\r
+ (i || j) && (cell.parentNode.removeChild(cell));\r
+ }\r
+ }\r
+ var td = rows[0][0];\r
+ td.innerHTML = HTML;\r
+ td.rowSpan = rows.length;\r
+ td.colSpan = rows[0].length;\r
+ editor.selectNodeContents(td);\r
+ editor.forceRedraw();\r
+ editor.focusEditor();\r
+ break;\r
+\r
+ // PROPERTIES\r
+\r
+ case "TO-table-prop":\r
+ this.dialogTableProperties();\r
+ break;\r
+\r
+ case "TO-row-prop":\r
+ this.dialogRowCellProperties(false);\r
+ break;\r
+\r
+ case "TO-cell-prop":\r
+ this.dialogRowCellProperties(true);\r
+ break;\r
+\r
+ default:\r
+ alert("Button [" + button_id + "] not yet implemented");\r
+ }\r
+};\r
+\r
+// the list of buttons added by this plugin\r
+TableOperations.btnList = [\r
+ // table properties button\r
+ ["table-prop", "table"],\r
+ null, // separator\r
+\r
+ // ROWS\r
+ ["row-prop", "tr"],\r
+ ["row-insert-above", "tr"],\r
+ ["row-insert-under", "tr"],\r
+ ["row-delete", "tr"],\r
+ ["row-split", "td[rowSpan!=1]"],\r
+ null,\r
+\r
+ // COLS\r
+ ["col-insert-before", "td"],\r
+ ["col-insert-after", "td"],\r
+ ["col-delete", "td"],\r
+ ["col-split", "td[colSpan!=1]"],\r
+ null,\r
+\r
+ // CELLS\r
+ ["cell-prop", "td"],\r
+ ["cell-insert-before", "td"],\r
+ ["cell-insert-after", "td"],\r
+ ["cell-delete", "td"],\r
+ ["cell-merge", "tr"],\r
+ ["cell-split", "td[colSpan!=1,rowSpan!=1]"]\r
+ ];\r
+\r
+\r
+\r
+//// GENERIC CODE [style of any element; this should be moved into a separate\r
+//// file as it'll be very useful]\r
+//// BEGIN GENERIC CODE -----------------------------------------------------\r
+\r
+TableOperations.getLength = function(value) {\r
+ var len = parseInt(value);\r
+ if (isNaN(len)) {\r
+ len = "";\r
+ }\r
+ return len;\r
+};\r
+\r
+// Applies the style found in "params" to the given element.\r
+TableOperations.processStyle = function(params, element) {\r
+ var style = element.style;\r
+ for (var i in params) {\r
+ var val = params[i];\r
+ switch (i) {\r
+ case "f_st_backgroundColor":\r
+ style.backgroundColor = val;\r
+ break;\r
+ case "f_st_color":\r
+ style.color = val;\r
+ break;\r
+ case "f_st_backgroundImage":\r
+ if (/\S/.test(val)) {\r
+ style.backgroundImage = "url(" + val + ")";\r
+ } else {\r
+ style.backgroundImage = "none";\r
+ }\r
+ break;\r
+ case "f_st_borderWidth":\r
+ style.borderWidth = val;\r
+ break;\r
+ case "f_st_borderStyle":\r
+ style.borderStyle = val;\r
+ break;\r
+ case "f_st_borderColor":\r
+ style.borderColor = val;\r
+ break;\r
+ case "f_st_borderCollapse":\r
+ style.borderCollapse = val ? "collapse" : "";\r
+ break;\r
+ case "f_st_width":\r
+ if (/\S/.test(val)) {\r
+ style.width = val + params["f_st_widthUnit"];\r
+ } else {\r
+ style.width = "";\r
+ }\r
+ break;\r
+ case "f_st_height":\r
+ if (/\S/.test(val)) {\r
+ style.height = val + params["f_st_heightUnit"];\r
+ } else {\r
+ style.height = "";\r
+ }\r
+ break;\r
+ case "f_st_textAlign":\r
+ if (val == "char") {\r
+ var ch = params["f_st_textAlignChar"];\r
+ if (ch == '"') {\r
+ ch = '\\"';\r
+ }\r
+ style.textAlign = '"' + ch + '"';\r
+ } else {\r
+ style.textAlign = val;\r
+ }\r
+ break;\r
+ case "f_st_verticalAlign":\r
+ style.verticalAlign = val;\r
+ break;\r
+ case "f_st_float":\r
+ style.cssFloat = val;\r
+ break;\r
+// case "f_st_margin":\r
+// style.margin = val + "px";\r
+// break;\r
+// case "f_st_padding":\r
+// style.padding = val + "px";\r
+// break;\r
+ }\r
+ }\r
+};\r
+\r
+// Returns an HTML element for a widget that allows color selection. That is,\r
+// a button that contains the given color, if any, and when pressed will popup\r
+// the sooner-or-later-to-be-rewritten select_color.html dialog allowing user\r
+// to select some color. If a color is selected, an input field with the name\r
+// "f_st_"+name will be updated with the color value in #123456 format.\r
+TableOperations.createColorButton = function(doc, editor, color, name) {\r
+ if (!color) {\r
+ color = "";\r
+ } else if (!/#/.test(color)) {\r
+ color = HTMLArea._colorToRgb(color);\r
+ }\r
+\r
+ var df = doc.createElement("span");\r
+ var field = doc.createElement("input");\r
+ field.type = "hidden";\r
+ df.appendChild(field);\r
+ field.name = "f_st_" + name;\r
+ field.value = color;\r
+ var button = doc.createElement("span");\r
+ button.className = "buttonColor";\r
+ df.appendChild(button);\r
+ var span = doc.createElement("span");\r
+ span.className = "chooser";\r
+ // span.innerHTML = " ";\r
+ span.style.backgroundColor = color;\r
+ button.appendChild(span);\r
+ button.onmouseover = function() { if (!this.disabled) { this.className += " buttonColor-hilite"; }};\r
+ button.onmouseout = function() { if (!this.disabled) { this.className = "buttonColor"; }};\r
+ span.onclick = function() {\r
+ if (this.parentNode.disabled) {\r
+ return false;\r
+ }\r
+ editor._popupDialog("select_color.html", function(color) {\r
+ if (color) {\r
+ span.style.backgroundColor = "#" + color;\r
+ field.value = "#" + color;\r
+ }\r
+ }, color);\r
+ };\r
+ var span2 = doc.createElement("span");\r
+ span2.innerHTML = "×";\r
+ span2.className = "nocolor";\r
+ span2.title = TableOperations.I18N["Unset color"];\r
+ button.appendChild(span2);\r
+ span2.onmouseover = function() { if (!this.parentNode.disabled) { this.className += " nocolor-hilite"; }};\r
+ span2.onmouseout = function() { if (!this.parentNode.disabled) { this.className = "nocolor"; }};\r
+ span2.onclick = function() {\r
+ span.style.backgroundColor = "";\r
+ field.value = "";\r
+ };\r
+ return df;\r
+};\r
+\r
+TableOperations.createStyleLayoutFieldset = function(doc, editor, el) {\r
+ var i18n = TableOperations.I18N;\r
+ var fieldset = doc.createElement("fieldset");\r
+ var legend = doc.createElement("legend");\r
+ fieldset.appendChild(legend);\r
+ legend.innerHTML = i18n["Layout"];\r
+ var table = doc.createElement("table");\r
+ fieldset.appendChild(table);\r
+ table.style.width = "100%";\r
+ var tbody = doc.createElement("tbody");\r
+ table.appendChild(tbody);\r
+\r
+ var tagname = el.tagName.toLowerCase();\r
+ var tr, td, input, select, option, options, i;\r
+\r
+ if (tagname != "td" && tagname != "tr" && tagname != "th") {\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ td.className = "label";\r
+ tr.appendChild(td);\r
+ td.innerHTML = i18n["Float"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ select = doc.createElement("select");\r
+ td.appendChild(select);\r
+ select.name = "f_st_float";\r
+ options = ["None", "Left", "Right"];\r
+ for (i in options) {\r
+ var Val = options[i];\r
+ var val = options[i].toLowerCase();\r
+ option = doc.createElement("option");\r
+ option.innerHTML = i18n[Val];\r
+ option.value = val;\r
+ option.selected = (("" + el.style.cssFloat).toLowerCase() == val);\r
+ select.appendChild(option);\r
+ }\r
+ }\r
+\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ td.className = "label";\r
+ tr.appendChild(td);\r
+ td.innerHTML = i18n["Width"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ input = doc.createElement("input");\r
+ input.type = "text";\r
+ input.value = TableOperations.getLength(el.style.width);\r
+ input.size = "5";\r
+ input.name = "f_st_width";\r
+ input.style.marginRight = "0.5em";\r
+ td.appendChild(input);\r
+ select = doc.createElement("select");\r
+ select.name = "f_st_widthUnit";\r
+ option = doc.createElement("option");\r
+ option.innerHTML = i18n["percent"];\r
+ option.value = "%";\r
+ option.selected = /%/.test(el.style.width);\r
+ select.appendChild(option);\r
+ option = doc.createElement("option");\r
+ option.innerHTML = i18n["pixels"];\r
+ option.value = "px";\r
+ option.selected = /px/.test(el.style.width);\r
+ select.appendChild(option);\r
+ td.appendChild(select);\r
+\r
+ select.style.marginRight = "0.5em";\r
+ td.appendChild(doc.createTextNode(i18n["Text align"] + ":"));\r
+ select = doc.createElement("select");\r
+ select.style.marginLeft = select.style.marginRight = "0.5em";\r
+ td.appendChild(select);\r
+ select.name = "f_st_textAlign";\r
+ options = ["Left", "Center", "Right", "Justify"];\r
+ if (tagname == "td") {\r
+ options.push("Char");\r
+ }\r
+ input = doc.createElement("input");\r
+ input.name = "f_st_textAlignChar";\r
+ input.size = "1";\r
+ input.style.fontFamily = "monospace";\r
+ td.appendChild(input);\r
+ for (i in options) {\r
+ var Val = options[i];\r
+ var val = Val.toLowerCase();\r
+ option = doc.createElement("option");\r
+ option.value = val;\r
+ option.innerHTML = i18n[Val];\r
+ option.selected = (el.style.textAlign.toLowerCase() == val);\r
+ select.appendChild(option);\r
+ }\r
+ function setCharVisibility(value) {\r
+ input.style.visibility = value ? "visible" : "hidden";\r
+ if (value) {\r
+ input.focus();\r
+ input.select();\r
+ }\r
+ };\r
+ select.onchange = function() { setCharVisibility(this.value == "char"); };\r
+ setCharVisibility(select.value == "char");\r
+\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ td.className = "label";\r
+ tr.appendChild(td);\r
+ td.innerHTML = i18n["Height"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ input = doc.createElement("input");\r
+ input.type = "text";\r
+ input.value = TableOperations.getLength(el.style.height);\r
+ input.size = "5";\r
+ input.name = "f_st_height";\r
+ input.style.marginRight = "0.5em";\r
+ td.appendChild(input);\r
+ select = doc.createElement("select");\r
+ select.name = "f_st_heightUnit";\r
+ option = doc.createElement("option");\r
+ option.innerHTML = i18n["percent"];\r
+ option.value = "%";\r
+ option.selected = /%/.test(el.style.height);\r
+ select.appendChild(option);\r
+ option = doc.createElement("option");\r
+ option.innerHTML = i18n["pixels"];\r
+ option.value = "px";\r
+ option.selected = /px/.test(el.style.height);\r
+ select.appendChild(option);\r
+ td.appendChild(select);\r
+\r
+ select.style.marginRight = "0.5em";\r
+ td.appendChild(doc.createTextNode(i18n["Vertical align"] + ":"));\r
+ select = doc.createElement("select");\r
+ select.name = "f_st_verticalAlign";\r
+ select.style.marginLeft = "0.5em";\r
+ td.appendChild(select);\r
+ options = ["Top", "Middle", "Bottom", "Baseline"];\r
+ for (i in options) {\r
+ var Val = options[i];\r
+ var val = Val.toLowerCase();\r
+ option = doc.createElement("option");\r
+ option.value = val;\r
+ option.innerHTML = i18n[Val];\r
+ option.selected = (el.style.verticalAlign.toLowerCase() == val);\r
+ select.appendChild(option);\r
+ }\r
+\r
+ return fieldset;\r
+};\r
+\r
+// Returns an HTML element containing the style attributes for the given\r
+// element. This can be easily embedded into any dialog; the functionality is\r
+// also provided.\r
+TableOperations.createStyleFieldset = function(doc, editor, el) {\r
+ var i18n = TableOperations.I18N;\r
+ var fieldset = doc.createElement("fieldset");\r
+ var legend = doc.createElement("legend");\r
+ fieldset.appendChild(legend);\r
+ legend.innerHTML = i18n["CSS Style"];\r
+ var table = doc.createElement("table");\r
+ fieldset.appendChild(table);\r
+ table.style.width = "100%";\r
+ var tbody = doc.createElement("tbody");\r
+ table.appendChild(tbody);\r
+\r
+ var tr, td, input, select, option, options, i;\r
+\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ td.className = "label";\r
+ td.innerHTML = i18n["Background"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ var df = TableOperations.createColorButton(doc, editor, el.style.backgroundColor, "backgroundColor");\r
+ df.firstChild.nextSibling.style.marginRight = "0.5em";\r
+ td.appendChild(df);\r
+ td.appendChild(doc.createTextNode(i18n["Image URL"] + ": "));\r
+ input = doc.createElement("input");\r
+ input.type = "text";\r
+ input.name = "f_st_backgroundImage";\r
+ if (el.style.backgroundImage.match(/url\(\s*(.*?)\s*\)/)) {\r
+ input.value = RegExp.$1;\r
+ }\r
+ // input.style.width = "100%";\r
+ td.appendChild(input);\r
+\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ td.className = "label";\r
+ td.innerHTML = i18n["FG Color"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ td.appendChild(TableOperations.createColorButton(doc, editor, el.style.color, "color"));\r
+\r
+ // for better alignment we include an invisible field.\r
+ input = doc.createElement("input");\r
+ input.style.visibility = "hidden";\r
+ input.type = "text";\r
+ td.appendChild(input);\r
+\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ td.className = "label";\r
+ td.innerHTML = i18n["Border"] + ":";\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+\r
+ var colorButton = TableOperations.createColorButton(doc, editor, el.style.borderColor, "borderColor");\r
+ var btn = colorButton.firstChild.nextSibling;\r
+ td.appendChild(colorButton);\r
+ // borderFields.push(btn);\r
+ btn.style.marginRight = "0.5em";\r
+\r
+ select = doc.createElement("select");\r
+ var borderFields = [];\r
+ td.appendChild(select);\r
+ select.name = "f_st_borderStyle";\r
+ options = ["none", "dotted", "dashed", "solid", "double", "groove", "ridge", "inset", "outset"];\r
+ var currentBorderStyle = el.style.borderStyle;\r
+ // Gecko reports "solid solid solid solid" for "border-style: solid".\r
+ // That is, "top right bottom left" -- we only consider the first\r
+ // value.\r
+ (currentBorderStyle.match(/([^\s]*)\s/)) && (currentBorderStyle = RegExp.$1);\r
+ for (i in options) {\r
+ var val = options[i];\r
+ option = doc.createElement("option");\r
+ option.value = val;\r
+ option.innerHTML = val;\r
+ (val == currentBorderStyle) && (option.selected = true);\r
+ select.appendChild(option);\r
+ }\r
+ select.style.marginRight = "0.5em";\r
+ function setBorderFieldsStatus(value) {\r
+ for (i in borderFields) {\r
+ var el = borderFields[i];\r
+ el.style.visibility = value ? "hidden" : "visible";\r
+ if (!value && (el.tagName.toLowerCase() == "input")) {\r
+ el.focus();\r
+ el.select();\r
+ }\r
+ }\r
+ };\r
+ select.onchange = function() { setBorderFieldsStatus(this.value == "none"); };\r
+\r
+ input = doc.createElement("input");\r
+ borderFields.push(input);\r
+ input.type = "text";\r
+ input.name = "f_st_borderWidth";\r
+ input.value = TableOperations.getLength(el.style.borderWidth);\r
+ input.size = "5";\r
+ td.appendChild(input);\r
+ input.style.marginRight = "0.5em";\r
+ var span = doc.createElement("span");\r
+ span.innerHTML = i18n["pixels"];\r
+ td.appendChild(span);\r
+ borderFields.push(span);\r
+\r
+ setBorderFieldsStatus(select.value == "none");\r
+\r
+ if (el.tagName.toLowerCase() == "table") {\r
+ // the border-collapse style is only for tables\r
+ tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ td = doc.createElement("td");\r
+ td.className = "label";\r
+ tr.appendChild(td);\r
+ input = doc.createElement("input");\r
+ input.type = "checkbox";\r
+ input.name = "f_st_borderCollapse";\r
+ input.id = "f_st_borderCollapse";\r
+ var val = (/collapse/i.test(el.style.borderCollapse));\r
+ input.checked = val ? 1 : 0;\r
+ td.appendChild(input);\r
+\r
+ td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ var label = doc.createElement("label");\r
+ label.htmlFor = "f_st_borderCollapse";\r
+ label.innerHTML = i18n["Collapsed borders"];\r
+ td.appendChild(label);\r
+ }\r
+\r
+// tr = doc.createElement("tr");\r
+// tbody.appendChild(tr);\r
+// td = doc.createElement("td");\r
+// td.className = "label";\r
+// tr.appendChild(td);\r
+// td.innerHTML = i18n["Margin"] + ":";\r
+// td = doc.createElement("td");\r
+// tr.appendChild(td);\r
+// input = doc.createElement("input");\r
+// input.type = "text";\r
+// input.size = "5";\r
+// input.name = "f_st_margin";\r
+// td.appendChild(input);\r
+// input.style.marginRight = "0.5em";\r
+// td.appendChild(doc.createTextNode(i18n["Padding"] + ":"));\r
+\r
+// input = doc.createElement("input");\r
+// input.type = "text";\r
+// input.size = "5";\r
+// input.name = "f_st_padding";\r
+// td.appendChild(input);\r
+// input.style.marginLeft = "0.5em";\r
+// input.style.marginRight = "0.5em";\r
+// td.appendChild(doc.createTextNode(i18n["pixels"]));\r
+\r
+ return fieldset;\r
+};\r
+\r
+//// END GENERIC CODE -------------------------------------------------------\r
-/** This file is derived from PopupDiv, developed by Mihai Bazon for
- * SamWare.net. Modifications were needed to make it usable in HTMLArea.
- * HTMLArea is a free WYSIWYG online HTML editor from InteractiveTools.com.
- *
- * This file does not function standalone. It is dependent of global functions
- * defined in HTMLArea-3.0 (htmlarea.js).
- *
- * Please see file htmlarea.js for further details.
- **/
-
-var is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) &&
- (navigator.userAgent.toLowerCase().indexOf("opera") == -1) );
-var is_compat = (document.compatMode == "BackCompat");
-
-function PopupDiv(editor, titleText, handler, initFunction) {
- var self = this;
-
- this.editor = editor;
- this.doc = editor._mdoc;
- this.handler = handler;
-
- var el = this.doc.createElement("div");
- el.className = "content";
-
- var popup = this.doc.createElement("div");
- popup.className = "dialog popupdiv";
- this.element = popup;
- var s = popup.style;
- s.position = "absolute";
- s.left = "0px";
- s.top = "0px";
-
- var title = this.doc.createElement("div");
- title.className = "title";
- this.title = title;
- popup.appendChild(title);
-
- HTMLArea._addEvent(title, "mousedown", function(ev) {
- self._dragStart(is_ie ? window.event : ev);
- });
-
- var button = this.doc.createElement("div");
- button.className = "button";
- title.appendChild(button);
- button.innerHTML = "×";
- title.appendChild(this.doc.createTextNode(titleText));
- this.titleText = titleText;
-
- button.onmouseover = function() {
- this.className += " button-hilite";
- };
- button.onmouseout = function() {
- this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
- };
- button.onclick = function() {
- this.className = this.className.replace(/\s*button-hilite\s*/g, " ");
- self.close();
- };
-
- popup.appendChild(el);
- this.content = el;
-
- this.doc.body.appendChild(popup);
-
- this.dragging = false;
- this.onShow = null;
- this.onClose = null;
- this.modal = false;
-
- initFunction(this);
-};
-
-PopupDiv.currentPopup = null;
-
-PopupDiv.prototype.showAtElement = function(el, mode) {
- this.defaultSize();
- var pos, ew, eh;
- var popup = this.element;
- popup.style.display = "block";
- var w = popup.offsetWidth;
- var h = popup.offsetHeight;
- popup.style.display = "none";
- if (el != window) {
- pos = PopupDiv.getAbsolutePos(el);
- ew = el.offsetWidth;
- eh = el.offsetHeight;
- } else {
- pos = {x:0, y:0};
- var size = PopupDiv.getWindowSize();
- ew = size.x;
- eh = size.y;
- }
- var FX = false, FY = false;
- if (mode.indexOf("l") != -1) {
- pos.x -= w;
- FX = true;
- }
- if (mode.indexOf("r") != -1) {
- pos.x += ew;
- FX = true;
- }
- if (mode.indexOf("t") != -1) {
- pos.y -= h;
- FY = true;
- }
- if (mode.indexOf("b") != -1) {
- pos.y += eh;
- FY = true;
- }
- if (mode.indexOf("c") != -1) {
- FX || (pos.x += Math.round((ew - w) / 2));
- FY || (pos.y += Math.round((eh - h) / 2));
- }
- this.showAt(pos.x, pos.y);
-};
-
-PopupDiv.prototype.defaultSize = function() {
- var s = this.element.style;
- var cs = this.element.currentStyle;
- var addX = (is_ie && is_compat) ? (parseInt(cs.borderLeftWidth) +
- parseInt(cs.borderRightWidth) +
- parseInt(cs.paddingLeft) +
- parseInt(cs.paddingRight)) : 0;
- var addY = (is_ie && is_compat) ? (parseInt(cs.borderTopWidth) +
- parseInt(cs.borderBottomWidth) +
- parseInt(cs.paddingTop) +
- parseInt(cs.paddingBottom)) : 0;
- s.display = "block";
- s.width = (this.content.offsetWidth + addX) + "px";
- s.height = (this.content.offsetHeight + this.title.offsetHeight) + "px";
- s.display = "none";
-};
-
-PopupDiv.prototype.showAt = function(x, y) {
- this.defaultSize();
- var s = this.element.style;
- s.display = "block";
- s.left = x + "px";
- s.top = y + "px";
- this.hideShowCovered();
-
- PopupDiv.currentPopup = this;
- HTMLArea._addEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
- HTMLArea._addEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
- if (is_ie && this.modal) {
- this.doc.body.setCapture(false);
- this.doc.body.onlosecapture = function() {
- (PopupDiv.currentPopup) && (this.doc.body.setCapture(false));
- };
- }
- window.event && HTMLArea._stopEvent(window.event);
-
- if (typeof this.onShow == "function") {
- this.onShow();
- } else if (typeof this.onShow == "string") {
- eval(this.onShow);
- }
-
- var field = this.element.getElementsByTagName("input")[0];
- if (!field) {
- field = this.element.getElementsByTagName("select")[0];
- }
- if (!field) {
- field = this.element.getElementsByTagName("textarea")[0];
- }
- if (field) {
- field.focus();
- }
-};
-
-PopupDiv.prototype.close = function() {
- this.element.style.display = "none";
- PopupDiv.currentPopup = null;
- this.hideShowCovered();
- HTMLArea._removeEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
- HTMLArea._removeEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);
- is_ie && this.modal && this.doc.body.releaseCapture();
- if (typeof this.onClose == "function") {
- this.onClose();
- } else if (typeof this.onClose == "string") {
- eval(this.onClose);
- }
- this.element.parentNode.removeChild(this.element);
-};
-
-PopupDiv.prototype.getForm = function() {
- var forms = this.content.getElementsByTagName("form");
- return (forms.length > 0) ? forms[0] : null;
-};
-
-PopupDiv.prototype.callHandler = function() {
- var tags = ["input", "textarea", "select"];
- var params = new Object();
- for (var ti in tags) {
- var tag = tags[ti];
- var els = this.content.getElementsByTagName(tag);
- for (var j = 0; j < els.length; ++j) {
- var el = els[j];
- params[el.name] = el.value;
- }
- }
- this.handler(this, params);
- return false;
-};
-
-PopupDiv.getAbsolutePos = function(el) {
- var r = { x: el.offsetLeft, y: el.offsetTop };
- if (el.offsetParent) {
- var tmp = PopupDiv.getAbsolutePos(el.offsetParent);
- r.x += tmp.x;
- r.y += tmp.y;
- }
- return r;
-};
-
-PopupDiv.getWindowSize = function() {
- if (window.innerHeight) {
- return { y: window.innerHeight, x: window.innerWidth };
- }
- if (this.doc.body.clientHeight) {
- return { y: this.doc.body.clientHeight, x: this.doc.body.clientWidth };
- }
- return { y: this.doc.documentElement.clientHeight, x: this.doc.documentElement.clientWidth };
-};
-
-PopupDiv.prototype.hideShowCovered = function () {
- var self = this;
- function isContained(el) {
- while (el) {
- if (el == self.element) {
- return true;
- }
- el = el.parentNode;
- }
- return false;
- };
- var tags = new Array("applet", "select");
- var el = this.element;
-
- var p = PopupDiv.getAbsolutePos(el);
- var EX1 = p.x;
- var EX2 = el.offsetWidth + EX1;
- var EY1 = p.y;
- var EY2 = el.offsetHeight + EY1;
-
- if (el.style.display == "none") {
- EX1 = EX2 = EY1 = EY2 = 0;
- }
-
- for (var k = tags.length; k > 0; ) {
- var ar = this.doc.getElementsByTagName(tags[--k]);
- var cc = null;
-
- for (var i = ar.length; i > 0;) {
- cc = ar[--i];
- if (isContained(cc)) {
- cc.style.visibility = "visible";
- continue;
- }
-
- p = PopupDiv.getAbsolutePos(cc);
- var CX1 = p.x;
- var CX2 = cc.offsetWidth + CX1;
- var CY1 = p.y;
- var CY2 = cc.offsetHeight + CY1;
-
- if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {
- cc.style.visibility = "visible";
- } else {
- cc.style.visibility = "hidden";
- }
- }
- }
-};
-
-PopupDiv.prototype._dragStart = function (ev) {
- if (this.dragging) {
- return false;
- }
- this.dragging = true;
- PopupDiv.currentPopup = this;
- var posX = ev.clientX;
- var posY = ev.clientY;
- if (is_ie) {
- posY += this.doc.body.scrollTop;
- posX += this.doc.body.scrollLeft;
- } else {
- posY += window.scrollY;
- posX += window.scrollX;
- }
- var st = this.element.style;
- this.xOffs = posX - parseInt(st.left);
- this.yOffs = posY - parseInt(st.top);
- HTMLArea._addEvent(this.doc, "mousemove", PopupDiv.dragIt);
- HTMLArea._addEvent(this.doc, "mouseover", HTMLArea._stopEvent);
- HTMLArea._addEvent(this.doc, "mouseup", PopupDiv.dragEnd);
- HTMLArea._stopEvent(ev);
-};
-
-PopupDiv.dragIt = function (ev) {
- var popup = PopupDiv.currentPopup;
- if (!(popup && popup.dragging)) {
- return false;
- }
- is_ie && (ev = window.event);
- var posX = ev.clientX;
- var posY = ev.clientY;
- if (is_ie) {
- posY += this.doc.body.scrollTop;
- posX += this.doc.body.scrollLeft;
- } else {
- posY += window.scrollY;
- posX += window.scrollX;
- }
- popup.hideShowCovered();
- var st = popup.element.style;
- st.left = (posX - popup.xOffs) + "px";
- st.top = (posY - popup.yOffs) + "px";
- HTMLArea._stopEvent(ev);
-};
-
-PopupDiv.dragEnd = function () {
- var popup = PopupDiv.currentPopup;
- if (!popup) {
- return false;
- }
- popup.dragging = false;
- HTMLArea._removeEvent(popup.doc, "mouseup", PopupDiv.dragEnd);
- HTMLArea._removeEvent(popup.doc, "mouseover", HTMLArea._stopEvent);
- HTMLArea._removeEvent(popup.doc, "mousemove", PopupDiv.dragIt);
- popup.hideShowCovered();
-};
-
-PopupDiv.checkPopup = function (ev) {
- is_ie && (ev = window.event);
- var el = is_ie ? ev.srcElement : ev.target;
- var cp = PopupDiv.currentPopup;
- for (; (el != null) && (el != cp.element); el = el.parentNode);
- if (el == null) {
- cp.modal || ev.type == "mouseover" || cp.close();
- HTMLArea._stopEvent(ev);
- }
-};
-
-PopupDiv.prototype.addButtons = function() {
- var self = this;
- var div = this.doc.createElement("div");
- this.content.appendChild(div);
- div.className = "buttons";
- for (var i = 0; i < arguments.length; ++i) {
- var btn = arguments[i];
- var button = this.doc.createElement("button");
- div.appendChild(button);
- button.innerHTML = HTMLArea.I18N.buttons[btn];
- switch (btn) {
- case "ok":
- button.onclick = function() {
- self.callHandler();
- self.close();
- };
- break;
- case "cancel":
- button.onclick = function() {
- self.close();
- };
- break;
- }
- }
-};
+/** This file is derived from PopupDiv, developed by Mihai Bazon for\r
+ * SamWare.net. Modifications were needed to make it usable in HTMLArea.\r
+ * HTMLArea is a free WYSIWYG online HTML editor from InteractiveTools.com.\r
+ *\r
+ * This file does not function standalone. It is dependent of global functions\r
+ * defined in HTMLArea-3.0 (htmlarea.js).\r
+ *\r
+ * Please see file htmlarea.js for further details.\r
+ **/\r
+\r
+var is_ie = ( (navigator.userAgent.toLowerCase().indexOf("msie") != -1) &&\r
+ (navigator.userAgent.toLowerCase().indexOf("opera") == -1) );\r
+var is_compat = (document.compatMode == "BackCompat");\r
+\r
+function PopupDiv(editor, titleText, handler, initFunction) {\r
+ var self = this;\r
+\r
+ this.editor = editor;\r
+ this.doc = editor._mdoc;\r
+ this.handler = handler;\r
+\r
+ var el = this.doc.createElement("div");\r
+ el.className = "content";\r
+\r
+ var popup = this.doc.createElement("div");\r
+ popup.className = "dialog popupdiv";\r
+ this.element = popup;\r
+ var s = popup.style;\r
+ s.position = "absolute";\r
+ s.left = "0px";\r
+ s.top = "0px";\r
+\r
+ var title = this.doc.createElement("div");\r
+ title.className = "title";\r
+ this.title = title;\r
+ popup.appendChild(title);\r
+\r
+ HTMLArea._addEvent(title, "mousedown", function(ev) {\r
+ self._dragStart(is_ie ? window.event : ev);\r
+ });\r
+\r
+ var button = this.doc.createElement("div");\r
+ button.className = "button";\r
+ title.appendChild(button);\r
+ button.innerHTML = "×";\r
+ title.appendChild(this.doc.createTextNode(titleText));\r
+ this.titleText = titleText;\r
+\r
+ button.onmouseover = function() {\r
+ this.className += " button-hilite";\r
+ };\r
+ button.onmouseout = function() {\r
+ this.className = this.className.replace(/\s*button-hilite\s*/g, " ");\r
+ };\r
+ button.onclick = function() {\r
+ this.className = this.className.replace(/\s*button-hilite\s*/g, " ");\r
+ self.close();\r
+ };\r
+\r
+ popup.appendChild(el);\r
+ this.content = el;\r
+\r
+ this.doc.body.appendChild(popup);\r
+\r
+ this.dragging = false;\r
+ this.onShow = null;\r
+ this.onClose = null;\r
+ this.modal = false;\r
+\r
+ initFunction(this);\r
+};\r
+\r
+PopupDiv.currentPopup = null;\r
+\r
+PopupDiv.prototype.showAtElement = function(el, mode) {\r
+ this.defaultSize();\r
+ var pos, ew, eh;\r
+ var popup = this.element;\r
+ popup.style.display = "block";\r
+ var w = popup.offsetWidth;\r
+ var h = popup.offsetHeight;\r
+ popup.style.display = "none";\r
+ if (el != window) {\r
+ pos = PopupDiv.getAbsolutePos(el);\r
+ ew = el.offsetWidth;\r
+ eh = el.offsetHeight;\r
+ } else {\r
+ pos = {x:0, y:0};\r
+ var size = PopupDiv.getWindowSize();\r
+ ew = size.x;\r
+ eh = size.y;\r
+ }\r
+ var FX = false, FY = false;\r
+ if (mode.indexOf("l") != -1) {\r
+ pos.x -= w;\r
+ FX = true;\r
+ }\r
+ if (mode.indexOf("r") != -1) {\r
+ pos.x += ew;\r
+ FX = true;\r
+ }\r
+ if (mode.indexOf("t") != -1) {\r
+ pos.y -= h;\r
+ FY = true;\r
+ }\r
+ if (mode.indexOf("b") != -1) {\r
+ pos.y += eh;\r
+ FY = true;\r
+ }\r
+ if (mode.indexOf("c") != -1) {\r
+ FX || (pos.x += Math.round((ew - w) / 2));\r
+ FY || (pos.y += Math.round((eh - h) / 2));\r
+ }\r
+ this.showAt(pos.x, pos.y);\r
+};\r
+\r
+PopupDiv.prototype.defaultSize = function() {\r
+ var s = this.element.style;\r
+ var cs = this.element.currentStyle;\r
+ var addX = (is_ie && is_compat) ? (parseInt(cs.borderLeftWidth) +\r
+ parseInt(cs.borderRightWidth) +\r
+ parseInt(cs.paddingLeft) +\r
+ parseInt(cs.paddingRight)) : 0;\r
+ var addY = (is_ie && is_compat) ? (parseInt(cs.borderTopWidth) +\r
+ parseInt(cs.borderBottomWidth) +\r
+ parseInt(cs.paddingTop) +\r
+ parseInt(cs.paddingBottom)) : 0;\r
+ s.display = "block";\r
+ s.width = (this.content.offsetWidth + addX) + "px";\r
+ s.height = (this.content.offsetHeight + this.title.offsetHeight) + "px";\r
+ s.display = "none";\r
+};\r
+\r
+PopupDiv.prototype.showAt = function(x, y) {\r
+ this.defaultSize();\r
+ var s = this.element.style;\r
+ s.display = "block";\r
+ s.left = x + "px";\r
+ s.top = y + "px";\r
+ this.hideShowCovered();\r
+\r
+ PopupDiv.currentPopup = this;\r
+ HTMLArea._addEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);\r
+ HTMLArea._addEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);\r
+ if (is_ie && this.modal) {\r
+ this.doc.body.setCapture(false);\r
+ this.doc.body.onlosecapture = function() {\r
+ (PopupDiv.currentPopup) && (this.doc.body.setCapture(false));\r
+ };\r
+ }\r
+ window.event && HTMLArea._stopEvent(window.event);\r
+\r
+ if (typeof this.onShow == "function") {\r
+ this.onShow();\r
+ } else if (typeof this.onShow == "string") {\r
+ eval(this.onShow);\r
+ }\r
+\r
+ var field = this.element.getElementsByTagName("input")[0];\r
+ if (!field) {\r
+ field = this.element.getElementsByTagName("select")[0];\r
+ }\r
+ if (!field) {\r
+ field = this.element.getElementsByTagName("textarea")[0];\r
+ }\r
+ if (field) {\r
+ field.focus();\r
+ }\r
+};\r
+\r
+PopupDiv.prototype.close = function() {\r
+ this.element.style.display = "none";\r
+ PopupDiv.currentPopup = null;\r
+ this.hideShowCovered();\r
+ HTMLArea._removeEvents(this.doc.body, ["mousedown", "click"], PopupDiv.checkPopup);\r
+ HTMLArea._removeEvents(this.editor._doc.body, ["mousedown", "click"], PopupDiv.checkPopup);\r
+ is_ie && this.modal && this.doc.body.releaseCapture();\r
+ if (typeof this.onClose == "function") {\r
+ this.onClose();\r
+ } else if (typeof this.onClose == "string") {\r
+ eval(this.onClose);\r
+ }\r
+ this.element.parentNode.removeChild(this.element);\r
+};\r
+\r
+PopupDiv.prototype.getForm = function() {\r
+ var forms = this.content.getElementsByTagName("form");\r
+ return (forms.length > 0) ? forms[0] : null;\r
+};\r
+\r
+PopupDiv.prototype.callHandler = function() {\r
+ var tags = ["input", "textarea", "select"];\r
+ var params = new Object();\r
+ for (var ti in tags) {\r
+ var tag = tags[ti];\r
+ var els = this.content.getElementsByTagName(tag);\r
+ for (var j = 0; j < els.length; ++j) {\r
+ var el = els[j];\r
+ params[el.name] = el.value;\r
+ }\r
+ }\r
+ this.handler(this, params);\r
+ return false;\r
+};\r
+\r
+PopupDiv.getAbsolutePos = function(el) {\r
+ var r = { x: el.offsetLeft, y: el.offsetTop };\r
+ if (el.offsetParent) {\r
+ var tmp = PopupDiv.getAbsolutePos(el.offsetParent);\r
+ r.x += tmp.x;\r
+ r.y += tmp.y;\r
+ }\r
+ return r;\r
+};\r
+\r
+PopupDiv.getWindowSize = function() {\r
+ if (window.innerHeight) {\r
+ return { y: window.innerHeight, x: window.innerWidth };\r
+ }\r
+ if (this.doc.body.clientHeight) {\r
+ return { y: this.doc.body.clientHeight, x: this.doc.body.clientWidth };\r
+ }\r
+ return { y: this.doc.documentElement.clientHeight, x: this.doc.documentElement.clientWidth };\r
+};\r
+\r
+PopupDiv.prototype.hideShowCovered = function () {\r
+ var self = this;\r
+ function isContained(el) {\r
+ while (el) {\r
+ if (el == self.element) {\r
+ return true;\r
+ }\r
+ el = el.parentNode;\r
+ }\r
+ return false;\r
+ };\r
+ var tags = new Array("applet", "select");\r
+ var el = this.element;\r
+\r
+ var p = PopupDiv.getAbsolutePos(el);\r
+ var EX1 = p.x;\r
+ var EX2 = el.offsetWidth + EX1;\r
+ var EY1 = p.y;\r
+ var EY2 = el.offsetHeight + EY1;\r
+\r
+ if (el.style.display == "none") {\r
+ EX1 = EX2 = EY1 = EY2 = 0;\r
+ }\r
+\r
+ for (var k = tags.length; k > 0; ) {\r
+ var ar = this.doc.getElementsByTagName(tags[--k]);\r
+ var cc = null;\r
+\r
+ for (var i = ar.length; i > 0;) {\r
+ cc = ar[--i];\r
+ if (isContained(cc)) {\r
+ cc.style.visibility = "visible";\r
+ continue;\r
+ }\r
+\r
+ p = PopupDiv.getAbsolutePos(cc);\r
+ var CX1 = p.x;\r
+ var CX2 = cc.offsetWidth + CX1;\r
+ var CY1 = p.y;\r
+ var CY2 = cc.offsetHeight + CY1;\r
+\r
+ if ((CX1 > EX2) || (CX2 < EX1) || (CY1 > EY2) || (CY2 < EY1)) {\r
+ cc.style.visibility = "visible";\r
+ } else {\r
+ cc.style.visibility = "hidden";\r
+ }\r
+ }\r
+ }\r
+};\r
+\r
+PopupDiv.prototype._dragStart = function (ev) {\r
+ if (this.dragging) {\r
+ return false;\r
+ }\r
+ this.dragging = true;\r
+ PopupDiv.currentPopup = this;\r
+ var posX = ev.clientX;\r
+ var posY = ev.clientY;\r
+ if (is_ie) {\r
+ posY += this.doc.body.scrollTop;\r
+ posX += this.doc.body.scrollLeft;\r
+ } else {\r
+ posY += window.scrollY;\r
+ posX += window.scrollX;\r
+ }\r
+ var st = this.element.style;\r
+ this.xOffs = posX - parseInt(st.left);\r
+ this.yOffs = posY - parseInt(st.top);\r
+ HTMLArea._addEvent(this.doc, "mousemove", PopupDiv.dragIt);\r
+ HTMLArea._addEvent(this.doc, "mouseover", HTMLArea._stopEvent);\r
+ HTMLArea._addEvent(this.doc, "mouseup", PopupDiv.dragEnd);\r
+ HTMLArea._stopEvent(ev);\r
+};\r
+\r
+PopupDiv.dragIt = function (ev) {\r
+ var popup = PopupDiv.currentPopup;\r
+ if (!(popup && popup.dragging)) {\r
+ return false;\r
+ }\r
+ is_ie && (ev = window.event);\r
+ var posX = ev.clientX;\r
+ var posY = ev.clientY;\r
+ if (is_ie) {\r
+ posY += this.doc.body.scrollTop;\r
+ posX += this.doc.body.scrollLeft;\r
+ } else {\r
+ posY += window.scrollY;\r
+ posX += window.scrollX;\r
+ }\r
+ popup.hideShowCovered();\r
+ var st = popup.element.style;\r
+ st.left = (posX - popup.xOffs) + "px";\r
+ st.top = (posY - popup.yOffs) + "px";\r
+ HTMLArea._stopEvent(ev);\r
+};\r
+\r
+PopupDiv.dragEnd = function () {\r
+ var popup = PopupDiv.currentPopup;\r
+ if (!popup) {\r
+ return false;\r
+ }\r
+ popup.dragging = false;\r
+ HTMLArea._removeEvent(popup.doc, "mouseup", PopupDiv.dragEnd);\r
+ HTMLArea._removeEvent(popup.doc, "mouseover", HTMLArea._stopEvent);\r
+ HTMLArea._removeEvent(popup.doc, "mousemove", PopupDiv.dragIt);\r
+ popup.hideShowCovered();\r
+};\r
+\r
+PopupDiv.checkPopup = function (ev) {\r
+ is_ie && (ev = window.event);\r
+ var el = is_ie ? ev.srcElement : ev.target;\r
+ var cp = PopupDiv.currentPopup;\r
+ for (; (el != null) && (el != cp.element); el = el.parentNode);\r
+ if (el == null) {\r
+ cp.modal || ev.type == "mouseover" || cp.close();\r
+ HTMLArea._stopEvent(ev);\r
+ }\r
+};\r
+\r
+PopupDiv.prototype.addButtons = function() {\r
+ var self = this;\r
+ var div = this.doc.createElement("div");\r
+ this.content.appendChild(div);\r
+ div.className = "buttons";\r
+ for (var i = 0; i < arguments.length; ++i) {\r
+ var btn = arguments[i];\r
+ var button = this.doc.createElement("button");\r
+ div.appendChild(button);\r
+ button.innerHTML = HTMLArea.I18N.buttons[btn];\r
+ switch (btn) {\r
+ case "ok":\r
+ button.onclick = function() {\r
+ self.callHandler();\r
+ self.close();\r
+ };\r
+ break;\r
+ case "cancel":\r
+ button.onclick = function() {\r
+ self.close();\r
+ };\r
+ break;\r
+ }\r
+ }\r
+};\r
-<html style="width: 380px; height: 250px;">
-<head><title>About HTMLArea</title>
-<script type="text/javascript" src="popup.js"></script>
-<script type="text/javascript">
-function closeAbout() {
- __dlg_close(null);
-}
-</script>
-<style>
- html,body,textarea { font-family: tahoma,verdana,arial; font-size: 11px;
-padding: 0px; margin: 0px; }
- tt { font-size: 120%; }
- body { padding: 0px; background: ButtonFace; color: ButtonText; }
- a:link, a:visited { color: #00f; }
- a:hover { color: #f00; }
- a:active { color: #f80; }
- button { font: 11px tahoma,verdana,sans-serif; }
-</style></head>
-<body onload="__dlg_init()">
-
-<div style="background-color: #fff; color: #000; padding: 3px; border-bottom: 1px solid #000;">
-<div style="font-family: 'arial black',arial,sans-serif; font-size: 28px;
-letter-spacing: -1px;">
-<span style="position: relative; top: -0.2em">H</span><span
-style="position: relative; top: 0.1em">T</span><span
-style="position: relative; top: -0.1em">M</span><span
-style="position: relative; top: 0.2em">L</span> Area
-3.0 <span style="position: relative; top: -0.6em; font-size: 50%; font-weight: normal">[ rev. beta ]</span></div>
-
-<div style="text-align: right; font-size: 90%; margin-bottom: 1em">
-Released on Aug 11, 2003 [21:30] GMT
-</div>
-</div>
-
-<div style="margin: 1em">
-
-<p>A free WYSIWYG editor replacement for <tt><textarea></tt> fields.</p>
-
-<p>For full source code and docs, visit:<br />
-<a href="http://www.interactivetools.com/products/htmlarea/" target="_blank"
->http://www.interactivetools.com/products/htmlarea/</a></p>
-
-<p>Version 3.0 developed and maintained by <a href="http://students.infoiasi.ro/~mishoo/" target="_blank">mishoo</a>.</p>
-
-<p>© 2002, 2003 <a href="http://interactivetools.com" target="_blank">interactivetools.com</a>, inc. All Rights Reserved.</p>
-
-</div>
-
-<div style="text-align: right; padding: 0px 3px 3px 0px;">
-<button type="button" onclick="closeAbout()">I agree it's cool</button>
-</div>
-
-</body></html>
-
-
+<html style="width: 380px; height: 250px;">\r
+<head><title>About HTMLArea</title>\r
+<script type="text/javascript" src="popup.js"></script>\r
+<script type="text/javascript">\r
+function closeAbout() {\r
+ __dlg_close(null);\r
+}\r
+</script>\r
+<style>\r
+ html,body,textarea { font-family: tahoma,verdana,arial; font-size: 11px;\r
+padding: 0px; margin: 0px; }\r
+ tt { font-size: 120%; }\r
+ body { padding: 0px; background: ButtonFace; color: ButtonText; }\r
+ a:link, a:visited { color: #00f; }\r
+ a:hover { color: #f00; }\r
+ a:active { color: #f80; }\r
+ button { font: 11px tahoma,verdana,sans-serif; }\r
+</style></head>\r
+<body onload="__dlg_init()">\r
+\r
+<div style="background-color: #fff; color: #000; padding: 3px; border-bottom: 1px solid #000;">\r
+<div style="font-family: 'arial black',arial,sans-serif; font-size: 28px;\r
+letter-spacing: -1px;">\r
+<span style="position: relative; top: -0.2em">H</span><span\r
+style="position: relative; top: 0.1em">T</span><span\r
+style="position: relative; top: -0.1em">M</span><span\r
+style="position: relative; top: 0.2em">L</span> Area\r
+3.0 <span style="position: relative; top: -0.6em; font-size: 50%; font-weight: normal">[ rev. beta ]</span></div>\r
+\r
+<div style="text-align: right; font-size: 90%; margin-bottom: 1em">\r
+Released on Aug 11, 2003 [21:30] GMT\r
+</div>\r
+</div>\r
+\r
+<div style="margin: 1em">\r
+\r
+<p>A free WYSIWYG editor replacement for <tt><textarea></tt> fields.</p>\r
+\r
+<p>For full source code and docs, visit:<br />\r
+<a href="http://www.interactivetools.com/products/htmlarea/" target="_blank"\r
+>http://www.interactivetools.com/products/htmlarea/</a></p>\r
+\r
+<p>Version 3.0 developed and maintained by <a href="http://students.infoiasi.ro/~mishoo/" target="_blank">mishoo</a>.</p>\r
+\r
+<p>© 2002, 2003 <a href="http://interactivetools.com" target="_blank">interactivetools.com</a>, inc. All Rights Reserved.</p>\r
+\r
+</div>\r
+\r
+<div style="text-align: right; padding: 0px 3px 3px 0px;">\r
+<button type="button" onclick="closeAbout()">I agree it's cool</button>\r
+</div>\r
+\r
+</body></html>\r
+\r
+\r
-<html>\r
+<html>\r\r
</html>
\ No newline at end of file
-/*******************************************************************************
-**
-** HTML Text Editing Component for hosting in Web Pages
-** Copyright (C) 2001 Ramesys (Contracting Services) Limited
-**
-** This library is free software; you can redistribute it and/or
-** modify it under the terms of the GNU Lesser General Public
-** License as published by the Free Software Foundation; either
-** version 2.1 of the License, or (at your option) any later version.
-**
-** This library is distributed in the hope that it will be useful,
-** but WITHOUT ANY WARRANTY; without even the implied warranty of
-** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-** Lesser General Public License for more details.
-**
-** You should have received a copy of the GNU LesserGeneral Public License
-** along with this program; if not a copy can be obtained from
-**
-** http://www.gnu.org/copyleft/lesser.html
-**
-** or by writing to:
-**
-** Free Software Foundation, Inc.
-** 59 Temple Place - Suite 330,
-** Boston,
-** MA 02111-1307,
-** USA.
-**
-** Original Developer:
-**
-** Austin David France
-** Ramesys (Contracting Services) Limited
-** Mentor House
-** Ainsworth Street
-** Blackburn
-** Lancashire
-** BB1 6AY
-** United Kingdom
-** email: Austin.France@Ramesys.com
-**
-** Home Page: http://richtext.sourceforge.net/
-** Support: http://richtext.sourceforge.net/
-**
-*******************************************************************************/
-html, body {
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-body { padding: 5px; }
-table {
-font: 11px Tahoma,Verdana,sans-serif;
-}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
-}
-td.smile {
-background-color: transparent;
-font-family: "Courier New", courier;
-font-size: 10pt;
-}
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
-button { width: 70px; }
-.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
+/*******************************************************************************\r
+**\r
+** HTML Text Editing Component for hosting in Web Pages\r
+** Copyright (C) 2001 Ramesys (Contracting Services) Limited\r
+** \r
+** This library is free software; you can redistribute it and/or\r
+** modify it under the terms of the GNU Lesser General Public\r
+** License as published by the Free Software Foundation; either\r
+** version 2.1 of the License, or (at your option) any later version.\r
+**\r
+** This library is distributed in the hope that it will be useful,\r
+** but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+** Lesser General Public License for more details.\r
+**\r
+** You should have received a copy of the GNU LesserGeneral Public License\r
+** along with this program; if not a copy can be obtained from \r
+**\r
+** http://www.gnu.org/copyleft/lesser.html\r
+**\r
+** or by writing to:\r
+**\r
+** Free Software Foundation, Inc.\r
+** 59 Temple Place - Suite 330,\r
+** Boston,\r
+** MA 02111-1307,\r
+** USA.\r
+** \r
+** Original Developer:\r
+**\r
+** Austin David France\r
+** Ramesys (Contracting Services) Limited\r
+** Mentor House\r
+** Ainsworth Street\r
+** Blackburn\r
+** Lancashire\r
+** BB1 6AY\r
+** United Kingdom\r
+** email: Austin.France@Ramesys.com\r
+**\r
+** Home Page: http://richtext.sourceforge.net/\r
+** Support: http://richtext.sourceforge.net/\r
+** \r
+*******************************************************************************/\r
+html, body {\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+ margin: 0px;\r
+ padding: 0px;\r
+}\r
+body { padding: 5px; }\r
+table {\r
+font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+form p {\r
+ margin-top: 5px;\r
+ margin-bottom: 5px;\r
+}\r
+td.smile {\r
+background-color: transparent;\r
+font-family: "Courier New", courier;\r
+font-size: 10pt;\r
+}\r
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }\r
+button { width: 70px; }\r
+.space { padding: 2px; }\r
+\r
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;\r
+border-bottom: 1px solid black; letter-spacing: 2px;\r
+}\r
+form { padding: 0px; margin: 0px; }\r
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html style="height:270px;">
-<head>
-<style type="text/css">
- BODY {
- background-color: buttonface;
- }
-
-</style>
-<script type="text/javascript" src="popup.js"></script>
-<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
-<!--
-function Init() {
- __dlg_init();
-}
-var chars = ["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","\83","\84","\85","\86","\87","\88","\\89","\8a","\8b","\8c","‘","’","’","“","”","\95","–","—","\98","\99","\9a","\9b","\9c","\9f","¡","¢","£","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ü","ý","þ","ÿ"]
-
-function tab(w,h) {
- var strtab = ["<TABLE border='1' cellspacing='0' cellpadding='0' align='center' bordercolor='#dcdcdc' bgcolor='#C0C0C0'>"]
- var k = 0;
- for(var i = 0; i < w; i++) {
- strtab[strtab.length] = "<TR>";
- for(var j = 0; j < h; j++) {
- strtab[strtab.length] = "<TD width='14' align='center' onClick='getchar(this)' onMouseOver='hover(this,true)' onMouseOut='hover(this,false)'>"+(chars[k]||'')+"</TD>";
- k++;
- }
- strtab[strtab.length]="</TR>";
- }
- strtab[strtab.length] = "</TABLE>";
- return strtab.join("\n");
-}
-
-function hover(obj,val) {
- if (!obj.innerHTML) {
- obj.style.cursor = "default";
- return;
- }
- obj.style.border = val ? "1px solid black" : "1px solid #dcdcdc";
- //obj.style.backgroundColor = val ? "black" : "#C0C0C0"
- //obj.style.color = val ? "white" : "black";
-}
-function getchar(obj) {
- if(!obj.innerHTML) return;
- var sChar = obj.innerHTML || "";
- __dlg_close(sChar);
- return false;
-}
-function cancel() {
- __dlg_close(null);
- return false;
-}
-//-->
-</SCRIPT>
-<title>Insert Character</title>
-</head>
-<body onload="Init()">
-<table class="dlg" cellpadding="0" cellspacing="2">
-<tr><td><table width="100%"><tr><td nowrap>Choose Character</td><td valign="middle" width="100%"><hr width="100%"></td></tr></table></td></tr>
-<tr>
-<td>
- <table border="0" align="center" cellpadding="5">
- <tr valign="top">
- <td>
-
- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
- <!--
- document.write(tab(7,32))
- //-->
- </SCRIPT>
-
- </td>
- </tr>
- </table>
- </td>
- </tr>
-<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>
-<tr><td align="right">
- <input type="button" value="Close" onclick="cancel()"></td></tr>
-</table>
-</body>
-</body>
-</html>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
+<html style="height:270px;">\r
+<head>\r
+<style type="text/css">\r
+ BODY {\r
+ background-color: buttonface;\r
+ }\r
+ \r
+</style>\r
+<script type="text/javascript" src="popup.js"></script>\r
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+<!--\r
+function Init() {\r
+ __dlg_init();\r
+}\r
+var chars = ["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","\83","\84","\85","\86","\87","\88","\\89","\8a","\8b","\8c","‘","’","’","“","”","\95","–","—","\98","\99","\9a","\9b","\9c","\9f","¡","¢","£","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ü","ý","þ","ÿ"]\r
+\r
+function tab(w,h) {\r
+ var strtab = ["<TABLE border='1' cellspacing='0' cellpadding='0' align='center' bordercolor='#dcdcdc' bgcolor='#C0C0C0'>"]\r
+ var k = 0;\r
+ for(var i = 0; i < w; i++) {\r
+ strtab[strtab.length] = "<TR>";\r
+ for(var j = 0; j < h; j++) {\r
+ strtab[strtab.length] = "<TD width='14' align='center' onClick='getchar(this)' onMouseOver='hover(this,true)' onMouseOut='hover(this,false)'>"+(chars[k]||'')+"</TD>";\r
+ k++;\r
+ }\r
+ strtab[strtab.length]="</TR>";\r
+ }\r
+ strtab[strtab.length] = "</TABLE>";\r
+ return strtab.join("\n");\r
+}\r
+\r
+function hover(obj,val) {\r
+ if (!obj.innerHTML) {\r
+ obj.style.cursor = "default";\r
+ return;\r
+ }\r
+ obj.style.border = val ? "1px solid black" : "1px solid #dcdcdc";\r
+ //obj.style.backgroundColor = val ? "black" : "#C0C0C0"\r
+ //obj.style.color = val ? "white" : "black";\r
+}\r
+function getchar(obj) {\r
+ if(!obj.innerHTML) return;\r
+ var sChar = obj.innerHTML || "";\r
+ __dlg_close(sChar);\r
+ return false;\r
+}\r
+function cancel() {\r
+ __dlg_close(null);\r
+ return false;\r
+}\r
+//-->\r
+</SCRIPT>\r
+<title>Insert Character</title>\r
+</head>\r
+<body onload="Init()">\r
+<table class="dlg" cellpadding="0" cellspacing="2">\r
+<tr><td><table width="100%"><tr><td nowrap>Choose Character</td><td valign="middle" width="100%"><hr width="100%"></td></tr></table></td></tr>\r
+<tr>\r
+<td>\r
+ <table border="0" align="center" cellpadding="5">\r
+ <tr valign="top">\r
+ <td>\r
+\r
+ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+ <!--\r
+ document.write(tab(7,32))\r
+ //-->\r
+ </SCRIPT>\r
+\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </td>\r
+ </tr>\r
+<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>\r
+<tr><td align="right">\r
+ <input type="button" value="Close" onclick="cancel()"></td></tr>\r
+</table>\r
+</body>\r
+</body>\r
+</html>\r
-<!--
-################################################################################
-##
-## HTML Text Editing Component for hosting in Web Pages
-## Copyright (C) 2001 Ramesys (Contracting Services) Limited
-##
-## This library is free software; you can redistribute it and/or
-## modify it under the terms of the GNU Lesser General Public
-## License as published by the Free Software Foundation; either
-## version 2.1 of the License, or (at your option) any later version.
-##
-## This library is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-## Lesser General Public License for more details.
-##
-## You should have received a copy of the GNU LesserGeneral Public License
-## along with this program; if not a copy can be obtained from
-##
-## http://www.gnu.org/copyleft/lesser.html
-##
-## or by writing to:
-##
-## Free Software Foundation, Inc.
-## 59 Temple Place - Suite 330,
-## Boston,
-## MA 02111-1307,
-## USA.
-##
-## Original Developer:
-##
-## Austin David France
-## Ramesys (Contracting Services) Limited
-## Mentor House
-## Ainsworth Street
-## Blackburn
-## Lancashire
-## BB1 6AY
-## United Kingdom
-## email: Austin.France@Ramesys.com
-##
-## Home Page: http://richtext.sourceforge.net/
-## Support: http://richtext.sourceforge.net/
-##
-################################################################################
--->
-<?php
- include("../../../config.php");
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
-<html style="height: 270px;">
-<head>
-<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>">
-<style type="text/css">
-body {
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-body { padding: 5px; }
-table {
- font: 11px Tahoma,Verdana,sans-serif;
-}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
-}
-
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
-button { width: 70px; }
-.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
-.chr {
-background-color: transparent;
-border: 1px solid #dcdcdc;
-font-family: "Times New Roman", times;
-font-size: small;
-}
-</style>
-<script type="text/javascript" src="popup.js"></script>
-<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
-<!--
-function Init() {
- __dlg_init();
-}
-var chars = ["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","\83","\84","\85","\86","\87","\88","\\89","\8a","\8b","\8c","‘","’","’","“","”","\95","–","—","\98","\99","\9a","\9b","\9c","\9f","¡","¢","£","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ü","ý","þ","ÿ"]
-
-function tab(w,h) {
- var strtab = ["<table border='0' cellspacing='0' cellpadding='0' align='center' bordercolor='#dcdcdc' bgcolor='#C0C0C0'>"]
- var k = 0;
- for(var i = 0; i < w; i++) {
- strtab[strtab.length] = "<tr>";
- for(var j = 0; j < h; j++) {
- strtab[strtab.length] = "<td class='chr' width='14' align='center' onClick='getchar(this)' onMouseOver='hover(this,true)' onMouseOut='hover(this,false)'>"+(chars[k]||'')+"</td>";
- k++;
- }
- strtab[strtab.length]="</tr>";
- }
- strtab[strtab.length] = "</table>";
- return strtab.join("\n");
-}
-
-function hover(obj,val) {
- if (!obj.innerHTML) {
- obj.style.cursor = "default";
- return;
- }
- obj.style.border = val ? "1px solid black" : "1px solid #dcdcdc";
- //obj.style.backgroundColor = val ? "black" : "#C0C0C0"
- //obj.style.color = val ? "white" : "black";
-}
-function getchar(obj) {
- if(!obj.innerHTML) return;
- var sChar = obj.innerHTML || "";
- __dlg_close(sChar);
- return false;
-}
-function cancel() {
- __dlg_close(null);
- return false;
-}
-//-->
-</SCRIPT>
-<title>Insert Character</title>
-</head>
-<body onload="Init()">
-<table class="dlg" cellpadding="0" cellspacing="2">
-<tr><td><table width="100%"><tr><td class="title" nowrap><?php print_string("choosechar","editor") ?></td></tr></table></td></tr>
-<tr>
-<td>
- <table border="0" align="center" cellpadding="5">
- <tr valign="top">
- <td>
-
- <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
- <!--
- document.write(tab(7,32))
- //-->
- </SCRIPT>
-
- </td>
- </tr>
- </table>
- </td>
- </tr>
-<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>
-<tr><td align="right">
- <button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>
-</table>
-</body>
-</body>
-</html>
+<!--\r
+################################################################################\r
+##\r
+## HTML Text Editing Component for hosting in Web Pages\r
+## Copyright (C) 2001 Ramesys (Contracting Services) Limited\r
+##\r
+## This library is free software; you can redistribute it and/or\r
+## modify it under the terms of the GNU Lesser General Public\r
+## License as published by the Free Software Foundation; either\r
+## version 2.1 of the License, or (at your option) any later version.\r
+##\r
+## This library is distributed in the hope that it will be useful,\r
+## but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
+## Lesser General Public License for more details.\r
+##\r
+## You should have received a copy of the GNU LesserGeneral Public License\r
+## along with this program; if not a copy can be obtained from\r
+##\r
+## http://www.gnu.org/copyleft/lesser.html\r
+##\r
+## or by writing to:\r
+##\r
+## Free Software Foundation, Inc.\r
+## 59 Temple Place - Suite 330,\r
+## Boston,\r
+## MA 02111-1307,\r
+## USA.\r
+##\r
+## Original Developer:\r
+##\r
+## Austin David France\r
+## Ramesys (Contracting Services) Limited\r
+## Mentor House\r
+## Ainsworth Street\r
+## Blackburn\r
+## Lancashire\r
+## BB1 6AY\r
+## United Kingdom\r
+## email: Austin.France@Ramesys.com\r
+##\r
+## Home Page: http://richtext.sourceforge.net/\r
+## Support: http://richtext.sourceforge.net/\r
+##\r
+################################################################################\r
+-->\r
+<?php\r
+ include("../../../config.php");\r
+?>\r
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">\r
+<html style="height: 270px;">\r
+<head>\r
+<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>">\r
+<style type="text/css">\r
+body {\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+ margin: 0px;\r
+ padding: 0px;\r
+}\r
+body { padding: 5px; }\r
+table {\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+form p {\r
+ margin-top: 5px;\r
+ margin-bottom: 5px;\r
+}\r
+\r
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }\r
+button { width: 70px; }\r
+.space { padding: 2px; }\r
+\r
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;\r
+border-bottom: 1px solid black; letter-spacing: 2px;\r
+}\r
+form { padding: 0px; margin: 0px; }\r
+.chr {\r
+background-color: transparent;\r
+border: 1px solid #dcdcdc;\r
+font-family: "Times New Roman", times;\r
+font-size: small;\r
+}\r
+</style>\r
+<script type="text/javascript" src="popup.js"></script>\r
+<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+<!--\r
+function Init() {\r
+ __dlg_init();\r
+}\r
+var chars = ["!",""","#","$","%","&","'","(",")","*","+","-",".","/","0","1","2","3","4","5","6","7","8","9",":",";","<","=",">","?","@","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","[","]","^","_","`","a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","{","|","}","~","€","\83","\84","\85","\86","\87","\88","\\89","\8a","\8b","\8c","‘","’","’","“","”","\95","–","—","\98","\99","\9a","\9b","\9c","\9f","¡","¢","£","£","¤","¥","¦","§","¨","©","ª","«","¬","","®","¯","°","±","²","³","´","µ","¶","·","¸","¹","º","»","¼","½","¾","¿","À","Á","Â","Ã","Ä","Å","Æ","Ç","È","É","Ê","Ë","Ì","Í","Î","Ï","Ð","Ñ","Ò","Ó","Ô","Õ","Ö","×","Ø","Ù","Ú","Û","Ü","Ý","Þ","ß","à","á","â","ã","ä","å","æ","ç","è","é","ê","ë","ì","í","î","ï","ð","ñ","ò","ó","ô","õ","ö","÷","ø","ù","ú","û","ü","ü","ý","þ","ÿ"]\r
+\r
+function tab(w,h) {\r
+ var strtab = ["<table border='0' cellspacing='0' cellpadding='0' align='center' bordercolor='#dcdcdc' bgcolor='#C0C0C0'>"]\r
+ var k = 0;\r
+ for(var i = 0; i < w; i++) {\r
+ strtab[strtab.length] = "<tr>";\r
+ for(var j = 0; j < h; j++) {\r
+ strtab[strtab.length] = "<td class='chr' width='14' align='center' onClick='getchar(this)' onMouseOver='hover(this,true)' onMouseOut='hover(this,false)'>"+(chars[k]||'')+"</td>";\r
+ k++;\r
+ }\r
+ strtab[strtab.length]="</tr>";\r
+ }\r
+ strtab[strtab.length] = "</table>";\r
+ return strtab.join("\n");\r
+}\r
+\r
+function hover(obj,val) {\r
+ if (!obj.innerHTML) {\r
+ obj.style.cursor = "default";\r
+ return;\r
+ }\r
+ obj.style.border = val ? "1px solid black" : "1px solid #dcdcdc";\r
+ //obj.style.backgroundColor = val ? "black" : "#C0C0C0"\r
+ //obj.style.color = val ? "white" : "black";\r
+}\r
+function getchar(obj) {\r
+ if(!obj.innerHTML) return;\r
+ var sChar = obj.innerHTML || "";\r
+ __dlg_close(sChar);\r
+ return false;\r
+}\r
+function cancel() {\r
+ __dlg_close(null);\r
+ return false;\r
+}\r
+//-->\r
+</SCRIPT>\r
+<title>Insert Character</title>\r
+</head>\r
+<body onload="Init()">\r
+<table class="dlg" cellpadding="0" cellspacing="2">\r
+<tr><td><table width="100%"><tr><td class="title" nowrap><?php print_string("choosechar","editor") ?></td></tr></table></td></tr>\r
+<tr>\r
+<td>\r
+ <table border="0" align="center" cellpadding="5">\r
+ <tr valign="top">\r
+ <td>\r
+\r
+ <SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">\r
+ <!--\r
+ document.write(tab(7,32))\r
+ //-->\r
+ </SCRIPT>\r
+\r
+ </td>\r
+ </tr>\r
+ </table>\r
+ </td>\r
+ </tr>\r
+<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>\r
+<tr><td align="right">\r
+ <button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>\r
+</table>\r
+</body>\r
+</body>\r
+</html>\r
-<!--
-#################################################################################
-##
-## $Id$
-##
-#################################################################################
--->
-<?php
- include('../../../config.php');
- $pixpath = "$CFG->pixpath/s";
-
- $fullnames = get_list_of_pixnames();
-
- $emoticons = array ( 'smiley' => ':-)',
- 'biggrin' => ':-D',
- 'wink' => ';-)',
- 'mixed' => ':-/',
- 'thoughtful' => 'V-.',
- 'tongueout' => ':-P',
- 'cool' => 'B-)',
- 'approve' => '^-)',
- 'wideeyes' => '8-)',
- 'clown' => ':o)',
- 'sad' => ':-(',
- 'shy' => '8-.',
- 'blush' => ':-I',
- 'kiss' => ':-X',
- 'surprise' => '8-o',
- 'blackeye' => 'P-|',
- 'angry' => '8-[',
- 'dead' => 'xx-P',
- 'sleepy' => '|-.',
- 'evil' => '}-]' );
-
-?>
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
-<meta name=vs_targetSchema content="HTML 4.0">
-<meta name="GENERATOR" content="Microsoft Visual Studio 7.0">
-<LINK rel="stylesheet" type="text/css" href="dialog.css">
-<title><?php print_string('insertsmile', 'editor') ?> </title>
-<script type="text/javascript" src="popup.js"></script>
-
-<script language="JavaScript" type="text/javascript">
-function Init() {
- __dlg_init();
-}
-function attr(name, value) {
- if (!value || value == "") return "";
- return ' ' + name + '="' + value + '"';
-}
-function insert(img,text) {
- if (img) {
- var strImage = img;
- var strAlt = text;
- var imgString = "<img src=\"" + strImage +"\" alt=\"" + strAlt +"\" />";
- }
- // pass data back to the calling window
- __dlg_close(imgString);
- return false;
-};
-
-function cancel() {
- __dlg_close(null);
- return false;
-};
-</script>
-<style type="text/css">
-body {
- width: 330;
- height: 360;
-}
-</style>
-</head>
-<body onload="Init()">
-<table class="dlg" cellpadding="0" cellspacing="2" width="100%" height="100%">
-<tr><td><table width="100%"><tr><td class="title" nowrap><?php print_string("chooseicon","editor") ?></td></tr></table></td></tr>
-<tr>
-<td>
- <table border="0" align="center" cellpadding="5">
- <tr valign="top">
- <td>
- <table border="0" align="center">
-<?php
- $list = array('smiley', 'biggrin', 'wink', 'mixed', 'thoughtful',
- 'tongueout', 'cool', 'approve', 'wideeyes', 'surprise');
- foreach ($list as $image) {
- $name = $fullnames[$image];
- $icon = $emoticons[$image];
- echo '<tr>';
- echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".
- " onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";
- echo "<td>$name</td>";
- echo "<td class=\"smile\">$icon</td>";
- echo "</tr>";
- }
-?>
- </table>
- </td>
- <td>
- <table border="0" align="center">
-
-<?php
- $list = array('sad', 'shy', 'blush', 'kiss', 'clown', 'blackeye',
- 'angry', 'dead', 'sleepy', 'evil');
- foreach ($list as $image) {
- $name = $fullnames[$image];
- $icon = $emoticons[$image];
- echo '<tr>';
- echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".
- " onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";
- echo "<td>$name</td>";
- echo "<td class=\"smile\">$icon</td>";
- echo "</tr>";
- }
-?>
- </table>
- </td>
- </tr>
- </table>
-
- </td>
- </tr>
-<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>
-<tr><td align="right">
- <button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>
-</table>
-</body>
-</html>
+<!--\r
+#################################################################################\r
+##\r
+## $Id$\r
+##\r
+#################################################################################\r
+-->\r
+<?php \r
+ include('../../../config.php'); \r
+ $pixpath = "$CFG->pixpath/s";\r
+\r
+ $fullnames = get_list_of_pixnames();\r
+\r
+ $emoticons = array ( 'smiley' => ':-)',\r
+ 'biggrin' => ':-D',\r
+ 'wink' => ';-)',\r
+ 'mixed' => ':-/',\r
+ 'thoughtful' => 'V-.',\r
+ 'tongueout' => ':-P',\r
+ 'cool' => 'B-)',\r
+ 'approve' => '^-)',\r
+ 'wideeyes' => '8-)',\r
+ 'clown' => ':o)',\r
+ 'sad' => ':-(',\r
+ 'shy' => '8-.',\r
+ 'blush' => ':-I',\r
+ 'kiss' => ':-X',\r
+ 'surprise' => '8-o',\r
+ 'blackeye' => 'P-|',\r
+ 'angry' => '8-[',\r
+ 'dead' => 'xx-P',\r
+ 'sleepy' => '|-.',\r
+ 'evil' => '}-]' );\r
+ \r
+?>\r
+<html>\r
+<head>\r
+<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />\r
+<meta name=vs_targetSchema content="HTML 4.0">\r
+<meta name="GENERATOR" content="Microsoft Visual Studio 7.0">\r
+<LINK rel="stylesheet" type="text/css" href="dialog.css">\r
+<title><?php print_string('insertsmile', 'editor') ?> </title>\r
+<script type="text/javascript" src="popup.js"></script>\r
+\r
+<script language="JavaScript" type="text/javascript">\r
+function Init() {\r
+ __dlg_init();\r
+}\r
+function attr(name, value) {\r
+ if (!value || value == "") return "";\r
+ return ' ' + name + '="' + value + '"';\r
+}\r
+function insert(img,text) {\r
+ if (img) {\r
+ var strImage = img;\r
+ var strAlt = text;\r
+ var imgString = "<img src=\"" + strImage +"\" alt=\"" + strAlt +"\" />";\r
+ }\r
+ // pass data back to the calling window\r
+ __dlg_close(imgString);\r
+ return false;\r
+};\r
+\r
+function cancel() {\r
+ __dlg_close(null);\r
+ return false;\r
+};\r
+</script>\r
+<style type="text/css">\r
+body {\r
+ width: 330;\r
+ height: 360;\r
+}\r
+</style>\r
+</head>\r
+<body onload="Init()">\r
+<table class="dlg" cellpadding="0" cellspacing="2" width="100%" height="100%">\r
+<tr><td><table width="100%"><tr><td class="title" nowrap><?php print_string("chooseicon","editor") ?></td></tr></table></td></tr>\r
+<tr>\r
+<td>\r
+ <table border="0" align="center" cellpadding="5">\r
+ <tr valign="top">\r
+ <td>\r
+ <table border="0" align="center">\r
+<?php \r
+ $list = array('smiley', 'biggrin', 'wink', 'mixed', 'thoughtful', \r
+ 'tongueout', 'cool', 'approve', 'wideeyes', 'surprise');\r
+ foreach ($list as $image) {\r
+ $name = $fullnames[$image];\r
+ $icon = $emoticons[$image];\r
+ echo '<tr>';\r
+ echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".\r
+ " onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";\r
+ echo "<td>$name</td>";\r
+ echo "<td class=\"smile\">$icon</td>";\r
+ echo "</tr>";\r
+ }\r
+?>\r
+ </table>\r
+ </td>\r
+ <td>\r
+ <table border="0" align="center">\r
+\r
+<?php \r
+ $list = array('sad', 'shy', 'blush', 'kiss', 'clown', 'blackeye',\r
+ 'angry', 'dead', 'sleepy', 'evil');\r
+ foreach ($list as $image) {\r
+ $name = $fullnames[$image];\r
+ $icon = $emoticons[$image];\r
+ echo '<tr>';\r
+ echo "<td><img alt=\"$name\" border=\"0\" hspace=\"10\" src=\"$pixpath/$image.gif\" ".\r
+ " onclick=\"insert('$pixpath/$image.gif','$name')\" width=\"15\" height=\"15\"></td>";\r
+ echo "<td>$name</td>";\r
+ echo "<td class=\"smile\">$icon</td>";\r
+ echo "</tr>";\r
+ }\r
+?>\r
+ </table>\r
+ </td>\r
+ </tr>\r
+ </table>\r
+\r
+ </td>\r
+ </tr>\r
+<tr><td><table width="100%"><tr><td valign="middle" width="90%"><hr width="100%"></td></tr></table></td></tr>\r
+<tr><td align="right">\r
+ <button type="button" onclick="cancel()"><?php print_string("close","editor") ?></button></td></tr>\r
+</table>\r
+</body>\r
+</html>\r
-<html>\r
- <head>\r
- <title>Editor Help</title>\r
- <style>\r
- body, td, p, div { font-family: arial; font-size: x-small; }\r
- </style>\r
- </head>\r
-<body>\r
-\r
-<h2>Editor Help<hr></h2>\r
-\r
-Todo...\r
-\r
-\r
-</body>\r
+<html>\r\r
+ <head>\r\r
+ <title>Editor Help</title>\r\r
+ <style>\r\r
+ body, td, p, div { font-family: arial; font-size: x-small; }\r\r
+ </style>\r\r
+ </head>\r\r
+<body>\r\r
+\r\r
+<h2>Editor Help<hr></h2>\r\r
+\r\r
+Todo...\r\r
+\r\r
+\r\r
+</body>\r\r
</html>
\ No newline at end of file
-<html>
-<head><title>Fullscreen Editor</title>
-<style type="text/css">
-@import url(../htmlarea.css);
-html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>
-
-
-<script type="text/javascript" src="../htmlarea.php<?php echo $id ?>"></script>
-<script type="text/javascript" src="../lang/en.js"></script>
-<script type="text/javascript" src="../dialog.js"></script>
-
-<script type="text/javascript">
-// load same scripts that were present in the opener page
-var scripts = opener.document.getElementsByTagName("script");
-var head = document.getElementsByTagName("head")[0];
-for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (typeof script.src != "undefined" && /\S/.test(script.src)) {
- // document.write("<scr" + "ipt type=" + "\"script/javascript\"");
- // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");
- var new_script = document.createElement("script");
- if (/^http:/i.test(script.src)) {
- new_script.src = script.src;
- } else {
- new_script.src = "../" + script.src;
- }
- head.appendChild(new_script);
- }
-}
-</script>
-
-<script type="text/javascript">
-
-var parent_object = null;
-var editor = null; // to be initialized later [ function init() ]
-
-/* ---------------------------------------------------------------------- *\
- Function :
- Description :
-\* ---------------------------------------------------------------------- */
-
-function _CloseOnEsc(ev) {
- if (document.all) {
- // IE
- ev = window.event;
- }
- if (ev.keyCode == 27) {
- // update_parent();
- window.close();
- return;
- }
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : cloneObject
- Description : copy an object by value instead of by reference
- Usage : var newObj = cloneObject(oldObj);
-\* ---------------------------------------------------------------------- */
-
-function cloneObject(obj) {
- var newObj = new Object;
-
- // check for array objects
- if (obj.constructor.toString().indexOf("function Array(") == 1) {
- newObj = obj.constructor();
- }
-
- // check for function objects (as usual, IE is fucked up)
- if (obj.constructor.toString().indexOf("function Function(") == 1) {
- newObj = obj; // just copy reference to it
- } else for (var n in obj) {
- var node = obj[n];
- if (typeof node == 'object') { newObj[n] = cloneObject(node); }
- else { newObj[n] = node; }
- }
-
- return newObj;
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : resize_editor
- Description : resize the editor when the user resizes the popup
-\* ---------------------------------------------------------------------- */
-
-function resize_editor() { // resize editor to fix window
- var newHeight;
- if (document.all) {
- // IE
- newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
- if (newHeight < 0) { newHeight = 0; }
- } else {
- // Gecko
- newHeight = window.innerHeight - editor._toolbar.offsetHeight;
- }
- if (editor.config.statusBar) {
- newHeight -= editor._statusBar.offsetHeight;
- }
- editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : init
- Description : run this code on page load
-\* ---------------------------------------------------------------------- */
-
-function init() {
- parent_object = opener.HTMLArea._object;
- var config = cloneObject( parent_object.config );
- config.editorURL = "../";
- config.width = "100%";
- config.height = "auto";
-
- // change maximize button to minimize button
- config.btnList["popupeditor"] = [ 'Minimize Editor', 'images/fullscreen_minimize.gif', true,
- function() { window.close(); } ];
-
- // generate editor and resize it
- editor = new HTMLArea("editor", config);
- editor.generate();
- editor._iframe.style.width = "100%";
- editor._textArea.style.width = "100%";
- resize_editor();
-
- // set child window contents and event handlers, after a small delay
- setTimeout(function() {
- editor.setHTML(parent_object.getInnerHTML());
-
- // switch mode if needed
- if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
-
- // continuously update parent editor window
- setInterval(update_parent, 500);
-
- // setup event handlers
- document.body.onkeypress = _CloseOnEsc;
- editor._doc.body.onkeypress = _CloseOnEsc;
- editor._textArea.onkeypress = _CloseOnEsc;
- window.onresize = resize_editor;
- }, 333); // give it some time to meet the new frame
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : update_parent
- Description : update parent window editor field with contents from child window
-\* ---------------------------------------------------------------------- */
-
-function update_parent() {
- // use the fast version
- parent_object.setHTML(editor.getInnerHTML());
-}
-
-
-</script>
-</head>
-<body scroll="no" onload="init()" onunload="update_parent()">
-
-<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
-<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>
-</form>
-
-</body></html>
+<html>\r
+<head><title>Fullscreen Editor</title>\r
+<style type="text/css">\r
+@import url(../htmlarea.css);\r
+html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>\r
+\r
+\r
+<script type="text/javascript" src="../htmlarea.php<?php echo $id ?>"></script>\r
+<script type="text/javascript" src="../lang/en.js"></script>\r
+<script type="text/javascript" src="../dialog.js"></script>\r
+\r
+<script type="text/javascript">\r
+// load same scripts that were present in the opener page\r
+var scripts = opener.document.getElementsByTagName("script");\r
+var head = document.getElementsByTagName("head")[0];\r
+for (var i = 0; i < scripts.length; ++i) {\r
+ var script = scripts[i];\r
+ if (typeof script.src != "undefined" && /\S/.test(script.src)) {\r
+ // document.write("<scr" + "ipt type=" + "\"script/javascript\"");\r
+ // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");\r
+ var new_script = document.createElement("script");\r
+ if (/^http:/i.test(script.src)) {\r
+ new_script.src = script.src;\r
+ } else {\r
+ new_script.src = "../" + script.src;\r
+ }\r
+ head.appendChild(new_script);\r
+ }\r
+}\r
+</script>\r
+\r
+<script type="text/javascript">\r
+\r
+var parent_object = null;\r
+var editor = null; // to be initialized later [ function init() ]\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : \r
+ Description : \r
+\* ---------------------------------------------------------------------- */\r
+\r
+function _CloseOnEsc(ev) {\r
+ if (document.all) {\r
+ // IE\r
+ ev = window.event;\r
+ }\r
+ if (ev.keyCode == 27) {\r
+ // update_parent();\r
+ window.close();\r
+ return;\r
+ }\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : cloneObject\r
+ Description : copy an object by value instead of by reference\r
+ Usage : var newObj = cloneObject(oldObj);\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function cloneObject(obj) {\r
+ var newObj = new Object; \r
+\r
+ // check for array objects\r
+ if (obj.constructor.toString().indexOf("function Array(") == 1) {\r
+ newObj = obj.constructor();\r
+ }\r
+\r
+ // check for function objects (as usual, IE is fucked up)\r
+ if (obj.constructor.toString().indexOf("function Function(") == 1) {\r
+ newObj = obj; // just copy reference to it\r
+ } else for (var n in obj) {\r
+ var node = obj[n];\r
+ if (typeof node == 'object') { newObj[n] = cloneObject(node); }\r
+ else { newObj[n] = node; }\r
+ }\r
+ \r
+ return newObj;\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : resize_editor\r
+ Description : resize the editor when the user resizes the popup\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function resize_editor() { // resize editor to fix window\r
+ var newHeight;\r
+ if (document.all) {\r
+ // IE\r
+ newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;\r
+ if (newHeight < 0) { newHeight = 0; }\r
+ } else {\r
+ // Gecko\r
+ newHeight = window.innerHeight - editor._toolbar.offsetHeight;\r
+ }\r
+ if (editor.config.statusBar) {\r
+ newHeight -= editor._statusBar.offsetHeight;\r
+ }\r
+ editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : init\r
+ Description : run this code on page load\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function init() {\r
+ parent_object = opener.HTMLArea._object;\r
+ var config = cloneObject( parent_object.config );\r
+ config.editorURL = "../";\r
+ config.width = "100%";\r
+ config.height = "auto";\r
+\r
+ // change maximize button to minimize button\r
+ config.btnList["popupeditor"] = [ 'Minimize Editor', 'images/fullscreen_minimize.gif', true,\r
+ function() { window.close(); } ];\r
+\r
+ // generate editor and resize it\r
+ editor = new HTMLArea("editor", config);\r
+ editor.generate();\r
+ editor._iframe.style.width = "100%";\r
+ editor._textArea.style.width = "100%";\r
+ resize_editor();\r
+\r
+ // set child window contents and event handlers, after a small delay\r
+ setTimeout(function() {\r
+ editor.setHTML(parent_object.getInnerHTML());\r
+\r
+ // switch mode if needed\r
+ if (parent_object._mode == "textmode") { editor.setMode("textmode"); }\r
+\r
+ // continuously update parent editor window\r
+ setInterval(update_parent, 500);\r
+\r
+ // setup event handlers\r
+ document.body.onkeypress = _CloseOnEsc;\r
+ editor._doc.body.onkeypress = _CloseOnEsc;\r
+ editor._textArea.onkeypress = _CloseOnEsc;\r
+ window.onresize = resize_editor;\r
+ }, 333); // give it some time to meet the new frame\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : update_parent\r
+ Description : update parent window editor field with contents from child window\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function update_parent() {\r
+ // use the fast version\r
+ parent_object.setHTML(editor.getInnerHTML());\r
+}\r
+\r
+\r
+</script>\r
+</head>\r
+<body scroll="no" onload="init()" onunload="update_parent()">\r
+\r
+<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">\r
+<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>\r
+</form>\r
+\r
+</body></html>\r
-<?php
- include("../../../config.php");
-?>
-<html>
-<head><title>Fullscreen Editor</title>
-<style type="text/css">
-@import url(../htmlarea.css);
-html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>
-
-
-<script type="text/javascript" src="../htmlarea.php<?php print($id != "")?"?id=$id":"";?>"></script>
-<script type="text/javascript" src="../lang/en.php"></script>
-<script type="text/javascript" src="../dialog.js"></script>
-
-<script type="text/javascript">
-// load same scripts that were present in the opener page
-var scripts = opener.document.getElementsByTagName("script");
-var head = document.getElementsByTagName("head")[0];
-for (var i = 0; i < scripts.length; ++i) {
- var script = scripts[i];
- if (typeof script.src != "undefined" && /\S/.test(script.src)) {
- // document.write("<scr" + "ipt type=" + "\"script/javascript\"");
- // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");
- var new_script = document.createElement("script");
- if (/^http:/i.test(script.src)) {
- new_script.src = script.src;
- } else {
- new_script.src = "../" + script.src;
- }
- head.appendChild(new_script);
- }
-}
-</script>
-
-<script type="text/javascript">
-
-var parent_object = null;
-var editor = null; // to be initialized later [ function init() ]
-
-/* ---------------------------------------------------------------------- *\
- Function : cloneObject
- Description : copy an object by value instead of by reference
- Usage : var newObj = cloneObject(oldObj);
-\* ---------------------------------------------------------------------- */
-
-function cloneObject(obj) {
- var newObj = new Object;
-
- // check for array objects
- if (obj.constructor.toString().indexOf("function Array(") == 1) {
- newObj = obj.constructor();
- }
-
- // check for function objects (as usual, IE is fucked up)
- if (obj.constructor.toString().indexOf("function Function(") == 1) {
- newObj = obj; // just copy reference to it
- } else for (var n in obj) {
- var node = obj[n];
- if (typeof node == 'object') { newObj[n] = cloneObject(node); }
- else { newObj[n] = node; }
- }
-
- return newObj;
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : resize_editor
- Description : resize the editor when the user resizes the popup
-\* ---------------------------------------------------------------------- */
-
-function resize_editor() { // resize editor to fix window
- var newHeight;
- if (document.all) {
- // IE
- newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;
- if (newHeight < 0) { newHeight = 0; }
- } else {
- // Gecko
- newHeight = window.innerHeight - editor._toolbar.offsetHeight;
- }
- if (editor.config.statusBar) {
- newHeight -= editor._statusBar.offsetHeight;
- }
- editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : init
- Description : run this code on page load
-\* ---------------------------------------------------------------------- */
-
-function init() {
- parent_object = opener.HTMLArea._object;
- var config = cloneObject( parent_object.config );
- config.editorURL = "../";
- config.width = "100%";
- config.height = "auto";
-
- // change maximize button to minimize button
- config.btnList["popupeditor"] = [ 'Minimize Editor', '<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_minimize.gif', true,
- function() { window.close(); } ];
-
- // generate editor and resize it
- editor = new HTMLArea("editor", config);
- editor.generate();
- editor._iframe.style.width = "100%";
- editor._textArea.style.width = "100%";
- resize_editor();
-
- // set child window contents and event handlers, after a small delay
- setTimeout(function() {
- editor.setHTML(parent_object.getInnerHTML());
-
- // switch mode if needed
- if (parent_object._mode == "textmode") { editor.setMode("textmode"); }
-
- // continuously update parent editor window
- setInterval(update_parent, 500);
-
- // setup event handlers
- window.onresize = resize_editor;
- }, 333); // give it some time to meet the new frame
-}
-
-/* ---------------------------------------------------------------------- *\
- Function : update_parent
- Description : update parent window editor field with contents from child window
-\* ---------------------------------------------------------------------- */
-
-function update_parent() {
- // use the fast version
- parent_object.setHTML(editor.getInnerHTML());
-}
-
-
-</script>
-</head>
-<body scroll="no" onload="init()" onunload="update_parent()">
-
-<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">
-<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>
-</form>
-
-</body></html>
+<?php\r
+ include("../../../config.php");\r
+?>\r
+<html>\r
+<head><title>Fullscreen Editor</title>\r
+<style type="text/css">\r
+@import url(../htmlarea.css);\r
+html, body { margin: 0px; border: 0px; background-color: buttonface; } </style>\r
+\r
+\r
+<script type="text/javascript" src="../htmlarea.php<?php print($id != "")?"?id=$id":"";?>"></script>\r
+<script type="text/javascript" src="../lang/en.php"></script>\r
+<script type="text/javascript" src="../dialog.js"></script>\r
+\r
+<script type="text/javascript">\r
+// load same scripts that were present in the opener page\r
+var scripts = opener.document.getElementsByTagName("script");\r
+var head = document.getElementsByTagName("head")[0];\r
+for (var i = 0; i < scripts.length; ++i) {\r
+ var script = scripts[i];\r
+ if (typeof script.src != "undefined" && /\S/.test(script.src)) {\r
+ // document.write("<scr" + "ipt type=" + "\"script/javascript\"");\r
+ // document.write(" src=\"../" + script.src + "\"></scr" + "ipt>");\r
+ var new_script = document.createElement("script");\r
+ if (/^http:/i.test(script.src)) {\r
+ new_script.src = script.src;\r
+ } else {\r
+ new_script.src = "../" + script.src;\r
+ }\r
+ head.appendChild(new_script);\r
+ }\r
+}\r
+</script>\r
+\r
+<script type="text/javascript">\r
+\r
+var parent_object = null;\r
+var editor = null; // to be initialized later [ function init() ]\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : \r
+ Description : \r
+\* ---------------------------------------------------------------------- */\r
+\r
+function _CloseOnEsc(ev) {\r
+ if (document.all) {\r
+ // IE\r
+ ev = window.event;\r
+ }\r
+ if (ev.keyCode == 27) {\r
+ // update_parent();\r
+ window.close();\r
+ return;\r
+ }\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : cloneObject\r
+ Description : copy an object by value instead of by reference\r
+ Usage : var newObj = cloneObject(oldObj);\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function cloneObject(obj) {\r
+ var newObj = new Object; \r
+\r
+ // check for array objects\r
+ if (obj.constructor.toString().indexOf("function Array(") == 1) {\r
+ newObj = obj.constructor();\r
+ }\r
+\r
+ // check for function objects (as usual, IE is fucked up)\r
+ if (obj.constructor.toString().indexOf("function Function(") == 1) {\r
+ newObj = obj; // just copy reference to it\r
+ } else for (var n in obj) {\r
+ var node = obj[n];\r
+ if (typeof node == 'object') { newObj[n] = cloneObject(node); }\r
+ else { newObj[n] = node; }\r
+ }\r
+ \r
+ return newObj;\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : resize_editor\r
+ Description : resize the editor when the user resizes the popup\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function resize_editor() { // resize editor to fix window\r
+ var newHeight;\r
+ if (document.all) {\r
+ // IE\r
+ newHeight = document.body.offsetHeight - editor._toolbar.offsetHeight;\r
+ if (newHeight < 0) { newHeight = 0; }\r
+ } else {\r
+ // Gecko\r
+ newHeight = window.innerHeight - editor._toolbar.offsetHeight;\r
+ }\r
+ if (editor.config.statusBar) {\r
+ newHeight -= editor._statusBar.offsetHeight;\r
+ }\r
+ editor._textArea.style.height = editor._iframe.style.height = newHeight + "px";\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : init\r
+ Description : run this code on page load\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function init() {\r
+ parent_object = opener.HTMLArea._object;\r
+ var config = cloneObject( parent_object.config );\r
+ config.editorURL = "../";\r
+ config.width = "100%";\r
+ config.height = "auto";\r
+\r
+ // change maximize button to minimize button\r
+ config.btnList["popupeditor"] = [ 'Minimize Editor', '<?php echo $CFG->wwwroot ?>/lib/editor/images/fullscreen_minimize.gif', true,\r
+ function() { window.close(); } ];\r
+\r
+ // generate editor and resize it\r
+ editor = new HTMLArea("editor", config);\r
+ editor.generate();\r
+ editor._iframe.style.width = "100%";\r
+ editor._textArea.style.width = "100%";\r
+ resize_editor();\r
+\r
+ // set child window contents and event handlers, after a small delay\r
+ setTimeout(function() {\r
+ editor.setHTML(parent_object.getInnerHTML());\r
+\r
+ // switch mode if needed\r
+ if (parent_object._mode == "textmode") { editor.setMode("textmode"); }\r
+\r
+ // continuously update parent editor window\r
+ setInterval(update_parent, 500);\r
+\r
+ // setup event handlers\r
+ document.body.onkeypress = _CloseOnEsc;\r
+ editor._doc.body.onkeypress = _CloseOnEsc;\r
+ editor._textArea.onkeypress = _CloseOnEsc;\r
+ window.onresize = resize_editor;\r
+ }, 333); // give it some time to meet the new frame\r
+}\r
+\r
+/* ---------------------------------------------------------------------- *\\r
+ Function : update_parent\r
+ Description : update parent window editor field with contents from child window\r
+\* ---------------------------------------------------------------------- */\r
+\r
+function update_parent() {\r
+ // use the fast version\r
+ parent_object.setHTML(editor.getInnerHTML());\r
+}\r
+\r
+\r
+</script>\r
+</head>\r
+<body scroll="no" onload="init()" onunload="update_parent()">\r
+\r
+<form style="margin: 0px; border: 1px solid; border-color: threedshadow threedhighlight threedhighlight threedshadow;">\r
+<textarea name="editor" id="editor" style="width:100%; height:300px"> </textarea>\r
+</form>\r
+\r
+</body></html>\r
-<html style="width: 398; height: 218">
-
-<head>
- <title>Insert Image</title>
-
-<script type="text/javascript" src="popup.js"></script>
-
-<script type="text/javascript">
-var preview_window = null;
-
-function Init() {
- __dlg_init();
- document.getElementById("f_url").focus();
-};
-
-function onOK() {
- var required = {
- "f_url": "You must enter the URL",
- "f_alt": "Please enter the alternate text"
- };
- for (var i in required) {
- var el = document.getElementById(i);
- if (!el.value) {
- alert(required[i]);
- el.focus();
- return false;
- }
- }
- // pass data back to the calling window
- var fields = ["f_url", "f_alt", "f_align", "f_border",
- "f_horiz", "f_vert"];
- var param = new Object();
- for (var i in fields) {
- var id = fields[i];
- var el = document.getElementById(id);
- param[id] = el.value;
- }
- if (preview_window) {
- preview_window.close();
- }
- __dlg_close(param);
- return false;
-};
-
-function onCancel() {
- if (preview_window) {
- preview_window.close();
- }
- __dlg_close(null);
- return false;
-};
-
-function onPreview() {
- var f_url = document.getElementById("f_url");
- var url = f_url.value;
- if (!url) {
- alert("You have to enter an URL first");
- f_url.focus();
- return false;
- }
- var img = new Image();
- img.src = url;
- var win = null;
- if (!document.all) {
- win = window.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");
- } else {
- win = window.open("about:blank", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no");
- }
- preview_window = win;
- var doc = win.document;
- var body = doc.body;
- if (body) {
- body.innerHTML = "";
- body.style.padding = "0px";
- body.style.margin = "0px";
- var el = doc.createElement("img");
- el.src = url;
-
- var table = doc.createElement("table");
- body.appendChild(table);
- table.style.width = "100%";
- table.style.height = "100%";
- var tbody = doc.createElement("tbody");
- table.appendChild(tbody);
- var tr = doc.createElement("tr");
- tbody.appendChild(tr);
- var td = doc.createElement("td");
- tr.appendChild(td);
- td.style.textAlign = "center";
-
- td.appendChild(el);
- win.resizeTo(el.offsetWidth + 30, el.offsetHeight + 30);
- }
- win.focus();
- return false;
-};
-</script>
-
-<style type="text/css">
-html, body {
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-body { padding: 5px; }
-table {
- font: 11px Tahoma,Verdana,sans-serif;
-}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
-}
-.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
-.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
-fieldset { padding: 0px 10px 5px 5px; }
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
-button { width: 70px; }
-.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
-</style>
-
-</head>
-
-<body onload="Init()">
-
-<div class="title">Insert Image</div>
-
-<form action="" method="get">
-<table border="0" width="100%" style="padding: 0px; margin: 0px">
- <tbody>
-
- <tr>
- <td style="width: 7em; text-align: right">Image URL:</td>
- <td><input type="text" name="url" id="f_url" style="width:75%"
- title="Enter the image URL here" />
- <button name="preview" onclick="return onPreview()"
- title="Preview the image in a new window">Preview</button>
- </td>
- </tr>
- <tr>
- <td style="width: 7em; text-align: right">Alternate text:</td>
- <td><input type="text" name="alt" id="f_alt" style="width:100%"
- title="For browsers that don't support images" /></td>
- </tr>
-
- </tbody>
-</table>
-
-<p />
-
-<fieldset style="float: left; margin-left: 5px;">
-<legend>Layout</legend>
-
-<div class="space"></div>
-
-<div class="fl">Alignment:</div>
-<select size="1" name="align" id="f_align"
- title="Positioning of this image">
- <option value="" >Not set</option>
- <option value="left" >Left</option>
- <option value="right" >Right</option>
- <option value="texttop" >Texttop</option>
- <option value="absmiddle" >Absmiddle</option>
- <option value="baseline" selected="1" >Baseline</option>
- <option value="absbottom" >Absbottom</option>
- <option value="bottom" >Bottom</option>
- <option value="middle" >Middle</option>
- <option value="top" >Top</option>
-</select>
-
-<p />
-
-<div class="fl">Border thickness:</div>
-<input type="text" name="border" id="f_border" size="5"
-title="Leave empty for no border" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<fieldset style="float:right; margin-right: 5px;">
-<legend>Spacing</legend>
-
-<div class="space"></div>
-
-<div class="fr">Horizontal:</div>
-<input type="text" name="horiz" id="f_horiz" size="5"
-title="Horizontal padding" />
-
-<p />
-
-<div class="fr">Vertical:</div>
-<input type="text" name="vert" id="f_vert" size="5"
-title="Vertical padding" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<div style="margin-top: 85px; text-align: right;">
-<hr />
-<button type="button" name="ok" onclick="return onOK();">OK</button>
-<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
-</div>
-
-</form>
-
-</body>
-</html>
+<html style="width: 398; height: 218">\r
+\r
+<head>\r
+ <title>Insert Image</title>\r
+\r
+<script type="text/javascript" src="popup.js"></script>\r
+\r
+<script type="text/javascript">\r
+var preview_window = null;\r
+\r
+function Init() {\r
+ __dlg_init();\r
+ document.getElementById("f_url").focus();\r
+};\r
+\r
+function onOK() {\r
+ var required = {\r
+ "f_url": "You must enter the URL",\r
+ "f_alt": "Please enter the alternate text"\r
+ };\r
+ for (var i in required) {\r
+ var el = document.getElementById(i);\r
+ if (!el.value) {\r
+ alert(required[i]);\r
+ el.focus();\r
+ return false;\r
+ }\r
+ }\r
+ // pass data back to the calling window\r
+ var fields = ["f_url", "f_alt", "f_align", "f_border",\r
+ "f_horiz", "f_vert"];\r
+ var param = new Object();\r
+ for (var i in fields) {\r
+ var id = fields[i];\r
+ var el = document.getElementById(id);\r
+ param[id] = el.value;\r
+ }\r
+ if (preview_window) {\r
+ preview_window.close();\r
+ }\r
+ __dlg_close(param);\r
+ return false;\r
+};\r
+\r
+function onCancel() {\r
+ if (preview_window) {\r
+ preview_window.close();\r
+ }\r
+ __dlg_close(null);\r
+ return false;\r
+};\r
+\r
+function onPreview() {\r
+ var f_url = document.getElementById("f_url");\r
+ var url = f_url.value;\r
+ if (!url) {\r
+ alert("You have to enter an URL first");\r
+ f_url.focus();\r
+ return false;\r
+ }\r
+ var img = new Image();\r
+ img.src = url;\r
+ var win = null;\r
+ if (!document.all) {\r
+ win = window.open("about:blank", "ha_imgpreview", "toolbar=no,menubar=no,personalbar=no,innerWidth=100,innerHeight=100,scrollbars=no,resizable=yes");\r
+ } else {\r
+ win = window.open("about:blank", "ha_imgpreview", "channelmode=no,directories=no,height=100,width=100,location=no,menubar=no,resizable=yes,scrollbars=no,toolbar=no");\r
+ }\r
+ preview_window = win;\r
+ var doc = win.document;\r
+ var body = doc.body;\r
+ if (body) {\r
+ body.innerHTML = "";\r
+ body.style.padding = "0px";\r
+ body.style.margin = "0px";\r
+ var el = doc.createElement("img");\r
+ el.src = url;\r
+\r
+ var table = doc.createElement("table");\r
+ body.appendChild(table);\r
+ table.style.width = "100%";\r
+ table.style.height = "100%";\r
+ var tbody = doc.createElement("tbody");\r
+ table.appendChild(tbody);\r
+ var tr = doc.createElement("tr");\r
+ tbody.appendChild(tr);\r
+ var td = doc.createElement("td");\r
+ tr.appendChild(td);\r
+ td.style.textAlign = "center";\r
+\r
+ td.appendChild(el);\r
+ win.resizeTo(el.offsetWidth + 30, el.offsetHeight + 30);\r
+ }\r
+ win.focus();\r
+ return false;\r
+};\r
+</script>\r
+\r
+<style type="text/css">\r
+html, body {\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+ margin: 0px;\r
+ padding: 0px;\r
+}\r
+body { padding: 5px; }\r
+table {\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+form p {\r
+ margin-top: 5px;\r
+ margin-bottom: 5px;\r
+}\r
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }\r
+.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }\r
+fieldset { padding: 0px 10px 5px 5px; }\r
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }\r
+button { width: 70px; }\r
+.space { padding: 2px; }\r
+\r
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;\r
+border-bottom: 1px solid black; letter-spacing: 2px;\r
+}\r
+form { padding: 0px; margin: 0px; }\r
+</style>\r
+\r
+</head>\r
+\r
+<body onload="Init()">\r
+\r
+<div class="title">Insert Image</div>\r
+\r
+<form action="" method="get">\r
+<table border="0" width="100%" style="padding: 0px; margin: 0px">\r
+ <tbody>\r
+\r
+ <tr>\r
+ <td style="width: 7em; text-align: right">Image URL:</td>\r
+ <td><input type="text" name="url" id="f_url" style="width:75%"\r
+ title="Enter the image URL here" />\r
+ <button name="preview" onclick="return onPreview()"\r
+ title="Preview the image in a new window">Preview</button>\r
+ </td>\r
+ </tr>\r
+ <tr>\r
+ <td style="width: 7em; text-align: right">Alternate text:</td>\r
+ <td><input type="text" name="alt" id="f_alt" style="width:100%"\r
+ title="For browsers that don't support images" /></td>\r
+ </tr>\r
+\r
+ </tbody>\r
+</table>\r
+\r
+<p />\r
+\r
+<fieldset style="float: left; margin-left: 5px;">\r
+<legend>Layout</legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fl">Alignment:</div>\r
+<select size="1" name="align" id="f_align"\r
+ title="Positioning of this image">\r
+ <option value="" >Not set</option>\r
+ <option value="left" >Left</option>\r
+ <option value="right" >Right</option>\r
+ <option value="texttop" >Texttop</option>\r
+ <option value="absmiddle" >Absmiddle</option>\r
+ <option value="baseline" selected="1" >Baseline</option>\r
+ <option value="absbottom" >Absbottom</option>\r
+ <option value="bottom" >Bottom</option>\r
+ <option value="middle" >Middle</option>\r
+ <option value="top" >Top</option>\r
+</select>\r
+\r
+<p />\r
+\r
+<div class="fl">Border thickness:</div>\r
+<input type="text" name="border" id="f_border" size="5"\r
+title="Leave empty for no border" />\r
+\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<fieldset style="float:right; margin-right: 5px;">\r
+<legend>Spacing</legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fr">Horizontal:</div>\r
+<input type="text" name="horiz" id="f_horiz" size="5"\r
+title="Horizontal padding" />\r
+\r
+<p />\r
+\r
+<div class="fr">Vertical:</div>\r
+<input type="text" name="vert" id="f_vert" size="5"\r
+title="Vertical padding" />\r
+\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<div style="margin-top: 85px; text-align: right;">\r
+<hr />\r
+<button type="button" name="ok" onclick="return onOK();">OK</button>\r
+<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>\r
+</div>\r
+\r
+</form>\r
+\r
+</body>\r
+</html>\r
-<?php include("../../../config.php");
+<?php // $Id$
+
+ include("../../../config.php");
require_variable($id);
if (!$course = get_record("course", "id", $id)) {
$course->fullname = ""; // Just to keep display happy, though browsing may fail
}
+
?>
<html>
<head>
- <title>Insert Image</title>
<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
+<title><?php print_string("insertimage","editor");?></title>
<script type="text/javascript" src="popup.js"></script>
<script type="text/javascript">
+window.resizeTo(730, 540);
var preview_window = null;
function Init() {
__dlg_init();
- //document.getElementById("f_url").focus();
+ var param = window.dialogArguments;
+ if (param) {
+ document.getElementById("f_url").value = param["f_url"];
+ document.getElementById("f_alt").value = param["f_alt"];
+ document.getElementById("f_border").value = param["f_border"];
+ document.getElementById("f_align").value = param["f_align"];
+ document.getElementById("f_vert").value = param["f_vert"];
+ document.getElementById("f_horiz").value = param["f_horiz"];
+ document.getElementById("f_width").value = param["f_width"];
+ document.getElementById("f_height").value = param["f_height"];
+ window.ipreview.location.replace('preview.php?id='+ <?php print($course->id);?> +'&imageurl='+ param.f_url);
+ }
+ document.getElementById("f_url").focus();
};
function onOK() {
}
// pass data back to the calling window
var fields = ["f_url", "f_alt", "f_align", "f_border",
- "f_horiz", "f_vert"];
+ "f_horiz", "f_vert","f_width","f_height"];
var param = new Object();
for (var i in fields) {
var id = fields[i];
win.focus();
return false;
};
-function set_url_value()
-{
- var url = "<?php echo $CFG->wwwroot ?>/lib/editor/courseimages.php?id=<?php echo $id ?>";
- window.open(url,'koje','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=no, copyhistory=yes, width=700, height=450, top=150, left=200');
+
+function checkvalue(elm,formname) {
+ var el = document.getElementById(elm);
+ if(!el.value) {
+ alert("Nothing to do!");
+ el.focus();
+ return false;
+ }
}
-</script>
+function submit_form(dothis) {
+ if(dothis == "delete") {
+ window.ibrowser.document.dirform.action.value = "delete";
+ }
+ if(dothis == "move") {
+ window.ibrowser.document.dirform.action.value = "move";
+ }
+ if(dothis == "zip") {
+ window.ibrowser.document.dirform.action.value = "zip";
+ }
+
+ window.ibrowser.document.dirform.submit();
+ return false;
+}
+
+
+</script>
<style type="text/css">
html, body {
- width: 410;
- height: 240;
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
+width: 730;
+height: 540;
+margin: 2px;
+background-color: rgb(212,208,200);
+font-family: Tahoma, Verdana, sans-serif;
+font-size: 11px;
}
-body { padding: 5px; }
-table {
- font: 11px Tahoma,Verdana,sans-serif;
+.title {
+background-color: #ddddff;
+padding: 5px;
+border-bottom: 1px solid black;
+font-family: Tahoma, sans-serif;
+font-weight: bold;
+font-size: 14px;
+color: black;
}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
+td, input, select, button {
+font-family: Tahoma, Verdana, sans-serif;
+font-size: 11px;
}
-.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
-.fr { width: 6em; float: left; padding: 2px 5px; text-align: right; }
-fieldset { padding: 0px 10px 5px 5px; }
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
button { width: 70px; }
.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
+form { margin-bottom: 0px; margin-top: 0px; }
</style>
-
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body onload="Init()">
-
-<div class="title"><?php print_string("insertimage","editor") ?></div>
-
-<form action="" method="get">
-<table border="0" width="100%" style="padding: 0px; margin: 0px">
- <tbody>
-
- <tr>
- <td style="width: 7em; text-align: right"><?php print_string("imageurl","editor") ?>:</td>
- <td><input type="text" name="url" id="f_url" style="width:75%"
- title="Enter the image URL here" />
- <button name="preview" onclick="return onPreview();"
- title="Preview the image in a new window"><?php print_string("preview","editor") ?></button>
- </td>
- </tr>
- <tr>
- <td style="width: 7em; text-align: right"><?php print_string("alternatetext","editor") ?>:</td>
- <td><input type="text" name="alt" id="f_alt" style="width:100%"
- title="For browsers that don't support images" /></td>
- </tr>
-
- </tbody>
-</table>
-
-<p />
-
-<fieldset style="float: left; margin-left: 5px;">
-<legend><?php print_string("layout","editor") ?></legend>
-
-<div class="space"></div>
-
-<div class="fl"><?php print_string("alignment","editor") ?>:</div>
-<select size="1" name="align" id="f_align"
- title="Positioning of this image">
- <option value="" ><?php print_string("notset","editor") ?></option>
- <option value="left" ><?php print_string("left","editor") ?></option>
- <option value="right" ><?php print_string("right","editor") ?></option>
- <option value="texttop" ><?php print_string("texttop","editor") ?></option>
- <option value="absmiddle" ><?php print_string("absmiddle","editor") ?></option>
- <option value="baseline" selected="1" ><?php print_string("baseline","editor") ?></option>
- <option value="absbottom" ><?php print_string("absbottom","editor") ?></option>
- <option value="bottom" ><?php print_string("bottom","editor") ?></option>
- <option value="middle" ><?php print_string("middle","editor") ?></option>
- <option value="top" ><?php print_string("top","editor") ?></option>
-</select>
-
-<p />
-
-<div class="fl"><?php print_string("borderthickness","editor") ?>:</div>
-<input type="text" name="border" id="f_border" size="5"
-title="Leave empty for no border" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<fieldset style="float:right; margin-right: 5px;">
-<legend><?php print_string("spacing","editor") ?></legend>
-
-<div class="space"></div>
-
-<div class="fr"><?php print_string("horizontal","editor") ?>:</div>
-<input type="text" name="horiz" id="f_horiz" size="5"
-title="Horizontal padding" />
-
-<p />
-
-<div class="fr"><?php print_string("vertical","editor") ?>:</div>
-<input type="text" name="vert" id="f_vert" size="5"
-title="Vertical padding" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<div style="margin-top: 85px; text-align: right;">
-<hr />
-<?php
-print(isteacher($id))?"<button title=\"$course->fullname\" type=\"button\" name=\"browse\" onclick=\"set_url_value()\">".get_string("browse","editor")."</button> \n":"";
-?>
-<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor") ?></button>
-<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor") ?></button>
-</div>
-
-</form>
-
+ <div class="title"><?php print_string("insertimage","editor");?></div>
+ <div class="space"></div>
+ <div class="space"></div>
+ <div class="space"></div>
+ <form action="" method="get" name="first" id="first">
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="15%" align="right"><?php print_string("imageurl","editor");?>:</td>
+ <td width="60%"><input name="f_url" type="text" id="f_url" style="width: 100%;" /></td>
+ <td width="23%" align="center">
+ <button name="btnOK" type="button" id="btnOK" onclick="return onOK();"><?php print_string("ok","editor") ?></button></td>
+ </tr>
+ <tr>
+ <td align="right"><?php print_string("alternatetext","editor");?>:</td>
+ <td><input name="f_alt" type="text" id="f_alt" style="width: 100%;" /></td>
+ <td align="center">
+ <button name="btnCancel" type="button" id="btnCancel" onclick="return onCancel();"><?php print_string("cancel","editor") ?></button></td>
+ </tr>
+ </table>
+ <div class="space"></div>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="32%" valign="top">
+ <fieldset><legend><?php print_string("layout","editor");?></legend>
+ <div class="space"></div>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="40%" align="right"><?php print_string("alignment","editor");?>:</td>
+ <td width="60%">
+ <select size="1" name="f_align" id="f_align"
+ title="Positioning of this image">
+ <option value="" ><?php print_string("notset","editor") ?></option>
+ <option value="left" ><?php print_string("left","editor") ?></option>
+ <option value="right" ><?php print_string("right","editor") ?></option>
+ <option value="texttop" ><?php print_string("texttop","editor") ?></option>
+ <option value="absmiddle" ><?php print_string("absmiddle","editor") ?></option>
+ <option value="baseline" selected="1" ><?php print_string("baseline","editor") ?></option>
+ <option value="absbottom" ><?php print_string("absbottom","editor") ?></option>
+ <option value="bottom" ><?php print_string("bottom","editor") ?></option>
+ <option value="middle" ><?php print_string("middle","editor") ?></option>
+ <option value="top" ><?php print_string("top","editor") ?></option>
+ </select></td>
+ </tr>
+ <tr>
+ <td width="40%" align="right"><?php print_string("borderthickness","editor") ?>:</td>
+ <td width="60%">
+ <input type="text" id="f_border" name="f_border" size="5" /></td>
+ </tr>
+ </table><div class="space"></div>
+ </fieldset> </td>
+ <td width="34%" valign="top">
+ <fieldset><legend><?php print_string("spacing","editor");?></legend>
+ <div class="space"></div>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="40%" align="right"><?php print_string("horizontal","editor");?>: </td>
+ <td width="60%">
+ <input name="f_horiz" type="text" id="f_horiz" size="5" />
+ </td>
+ </tr>
+ <tr>
+ <td width="40%" align="right"><?php print_string("vertical","editor");?>:</td>
+ <td width="60%">
+ <input name="f_vert" type="text" id="f_vert" size="5" /></td>
+ </tr>
+ </table><div class="space"></div></fieldset></td>
+ <td width="34%" valign="top">
+ <fieldset><legend><?php print_string("size","editor");?></legend>
+ <div class="space"></div>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="40%" align="right"><?php print_string("width","editor");?>:</td>
+ <td width="60%">
+ <input name="f_width" type="text" id="f_width" size="5" />
+ </td>
+ </tr>
+ <tr>
+ <td width="40%" align="right"><?php print_string("height","editor");?>:</td>
+ <td width="60%">
+ <input name="f_height" type="text" id="f_height" size="5" /></td>
+ </tr>
+ </table><div class="space"></div>
+ </fieldset></td>
+ </tr>
+ </table></form>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="55%" valign="top"><?php print_string("filebrowser","editor");?>:<br>
+ <?php print(isteacher($id))?
+ "<iframe id=\"ibrowser\" name=\"ibrowser\" src=\"".$CFG->wwwroot."/lib/editor/coursefiles.php?usecheckboxes=true&id=".$course->id."\" style=\"width: 100%; height: 200px;\"></iframe>":
+ "<iframe src=\"about:blank\" style=\"width: 100%; height: 200px;\"></iframe>";?>
+ </td>
+ <td width="45%" valign="top"><?php print_string("preview","editor");?>:<br>
+ <iframe id="ipreview" name="ipreview" src="about:blank" style="width: 100%; height: 200px;"></iframe>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" border="0" cellspacing="0" cellpadding="0">
+ <tr>
+ <td width="55%"><div class="space"></div>
+ <?php if(isteacher($id)) { ?>
+ <table border="0" cellpadding="2" cellspacing="0">
+ <tr><td><?php print_string("selection","editor");?>: </td>
+ <td><form name="idelete" id="idelete">
+ <input name="btnDelete" type="submit" id="btnDelete" value="<?php print_string("delete","editor");?>" onclick="return submit_form('delete');" /></form></td>
+ <td><form name="imove" id="imove">
+ <input name="btnMove" type="submit" id="btnMove" value="<?php print_string("move","editor");?>" onclick="return submit_form('move');" /></td>
+ <td><form name="izip" id="izip">
+ <input name="btnZip" type="submit" id="btnZip" value="<?php print_string("zip","editor");?>" onclick="return submit_form('zip');" /></form></td>
+ <td><form name="irename" id="irename" method="post" action="../coursefiles.php" target="ibrowser">
+ <input type="hidden" name="id" value="<?php print($course->id);?>" />
+ <input type="hidden" name="wdir" value="" />
+ <input type="hidden" name="file" value="" />
+ <input type="hidden" name="action" value="rename" />
+ <input name="btnRename" type="submit" id="btnRename" value="<?php print_string("rename","editor");?>" /></form></td>
+ <tr></table>
+ <br>
+ <?php
+ } else {
+ print "";
+ } ?>
+ </td>
+ <td width="45%" rowspan="2" valign="top"><fieldset>
+ <legend><?php print_string("properties","editor");?></legend>
+ <div class="space"></div>
+ <div class="space"></div>
+ <?php print_string("size","editor");?>:
+ <input type="text" id="isize" name="isize" size="10" style="background: transparent; border: none;" />
+ <?php print_string("type","editor");?>: <input type="text" id="itype" name="itype" size="10" style="background: transparent; border: none;" />
+ <div class="space"></div>
+ <div class="space"></div>
+ </fieldset></td>
+ </tr>
+ <tr>
+ <td height="22"><?php
+ if(isteacher($id)) { ?>
+ <form name="cfolder" id="cfolder" action="../coursefiles.php" method="post" target="ibrowser">
+ <input type="hidden" name="id" value="<?php print($course->id);?>" />
+ <input type="hidden" name="wdir" value="" />
+ <input type="hidden" name="action" value="mkdir" />
+ <input name="name" type="text" id="foldername" size="35" />
+ <input name="btnCfolder" type="submit" id="btnCfolder" value="<?php print_string("createfolder","editor");?>" onclick="return checkvalue('foldername','cfolder');" />
+ </form>
+ <div class="space"></div>
+ <form action="../coursefiles.php?id=<?php print($course->id);?>" method="post" enctype="multipart/form-data" name="uploader" target="ibrowser" id="uploader">
+ <input type="hidden" name="MAX_FILE_SIZE" value="<?php print($upload_max_filesize);?>" />
+ <input type="hidden" name="id" VALUE="<?php print($course->id);?>" />
+ <input type="hidden" name="wdir" value="" />
+ <input type="hidden" name="action" value="upload" />
+ <input type="file" name="userfile" id="userfile" size="35" />
+ <input name="save" type="submit" id="save" onclick="return checkvalue('userfile','uploader');" value="<?php print_string("upload","editor");?>" />
+ </form>
+ <?php
+ } else {
+ print "";
+ } ?>
+ </td>
+ </tr>
+ </table>
+ <p> </p>
</body>
</html>
-<html style="width: 398; height: 218">
-
-<head>
- <title>Insert Table</title>
-
-<script type="text/javascript" src="popup.js"></script>
-<script type="text/javascript" src="../lang/en.php"></script>
-<script type="text/javascript">
-
-function Init() {
- __dlg_init();
- document.getElementById('f_rows').focus();
-};
-
-function onOK() {
- var required = {
- "f_rows": "You must enter a number of rows",
- "f_cols": "You must enter a number of columns"
- };
- for (var i in required) {
- var el = document.getElementById(i);
- if (!el.value) {
- alert(required[i]);
- el.focus();
- return false;
- }
- }
- var fields = ["f_rows", "f_cols", "f_width", "f_unit",
- "f_align", "f_border", "f_spacing", "f_padding"];
- var param = new Object();
- for (var i in fields) {
- var id = fields[i];
- var el = document.getElementById(id);
- param[id] = el.value;
- }
- __dlg_close(param);
- return false;
-};
-
-function onCancel() {
- __dlg_close(null);
- return false;
-};
-
-</script>
-
-<style type="text/css">
-html, body {
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-body { padding: 5px; }
-table {
- font: 11px Tahoma,Verdana,sans-serif;
-}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
-}
-.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
-.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
-fieldset { padding: 0px 10px 5px 5px; }
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
-button { width: 70px; }
-.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
-</style>
-
-</head>
-
-<body onload="Init()">
-
-<div class="title">Insert Table</div>
-
-<form action="" method="get">
-<table border="0" style="padding: 0px; margin: 0px">
- <tbody>
-
- <tr>
- <td style="width: 4em; text-align: right">Rows:</td>
- <td><input type="text" name="f_rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td style="width: 4em; text-align: right">Cols:</td>
- <td><input type="text" name="f_cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
- <td style="width: 4em; text-align: right">Width:</td>
- <td><input type="text" name="f_width" id="f_width" size="5" title="Width of the table" value="100" /></td>
- <td><select size="1" name="f_unit" id="f_unit" title="Width unit">
- <option value="%" selected="1" >Percent</option>
- <option value="px" >Pixels</option>
- <option value="em" >Em</option>
- </select></td>
- </tr>
-
- </tbody>
-</table>
-
-<p />
-
-<fieldset style="float: left; margin-left: 5px;">
-<legend>Layout</legend>
-
-<div class="space"></div>
-
-<div class="fl">Alignment:</div>
-<select size="1" name="f_align" id="f_align"
- title="Positioning of this image">
- <option value="" selected="1" >Not set</option>
- <option value="left" >Left</option>
- <option value="right" >Right</option>
- <option value="texttop" >Texttop</option>
- <option value="absmiddle" >Absmiddle</option>
- <option value="baseline" >Baseline</option>
- <option value="absbottom" >Absbottom</option>
- <option value="bottom" >Bottom</option>
- <option value="middle" >Middle</option>
- <option value="top" >Top</option>
-</select>
-
-<p />
-
-<div class="fl">Border thickness:</div>
-<input type="text" name="f_border" id="f_border" size="5" value="1"
-title="Leave empty for no border" />
-<!--
-<p />
-
-<div class="fl">Collapse borders:</div>
-<input type="checkbox" name="collapse" id="f_collapse" />
--->
-<div class="space"></div>
-
-</fieldset>
-
-<fieldset style="float:right; margin-right: 5px;">
-<legend>Spacing</legend>
-
-<div class="space"></div>
-
-<div class="fr">Cell spacing:</div>
-<input type="text" name="f_spacing" id="f_spacing" size="5" value="1"
-title="Space between adjacent cells" />
-
-<p />
-
-<div class="fr">Cell padding:</div>
-<input type="text" name="f_padding" id="f_padding" size="5" value="1"
-title="Space between content and border in cell" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<div style="margin-top: 85px; text-align: right;">
-<hr />
-<button type="button" name="ok" onclick="return onOK();">OK</button>
-<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>
-</div>
-
-</form>
-
-</body>
-</html>
+<html style="width: 398; height: 218">\r
+\r
+<head>\r
+ <title>Insert Table</title>\r
+\r
+<script type="text/javascript" src="popup.js"></script>\r
+<script type="text/javascript" src="../lang/en.php"></script>\r
+<script type="text/javascript">\r
+\r
+function Init() {\r
+ __dlg_init();\r
+ document.getElementById('f_rows').focus();\r
+};\r
+\r
+function onOK() {\r
+ var required = {\r
+ "f_rows": "You must enter a number of rows",\r
+ "f_cols": "You must enter a number of columns"\r
+ };\r
+ for (var i in required) {\r
+ var el = document.getElementById(i);\r
+ if (!el.value) {\r
+ alert(required[i]);\r
+ el.focus();\r
+ return false;\r
+ }\r
+ }\r
+ var fields = ["f_rows", "f_cols", "f_width", "f_unit",\r
+ "f_align", "f_border", "f_spacing", "f_padding"];\r
+ var param = new Object();\r
+ for (var i in fields) {\r
+ var id = fields[i];\r
+ var el = document.getElementById(id);\r
+ param[id] = el.value;\r
+ }\r
+ __dlg_close(param);\r
+ return false;\r
+};\r
+\r
+function onCancel() {\r
+ __dlg_close(null);\r
+ return false;\r
+};\r
+\r
+</script>\r
+\r
+<style type="text/css">\r
+html, body {\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+ margin: 0px;\r
+ padding: 0px;\r
+}\r
+body { padding: 5px; }\r
+table {\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+form p {\r
+ margin-top: 5px;\r
+ margin-bottom: 5px;\r
+}\r
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }\r
+.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }\r
+fieldset { padding: 0px 10px 5px 5px; }\r
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }\r
+button { width: 70px; }\r
+.space { padding: 2px; }\r
+\r
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;\r
+border-bottom: 1px solid black; letter-spacing: 2px;\r
+}\r
+form { padding: 0px; margin: 0px; }\r
+</style>\r
+\r
+</head>\r
+\r
+<body onload="Init()">\r
+\r
+<div class="title">Insert Table</div>\r
+\r
+<form action="" method="get">\r
+<table border="0" style="padding: 0px; margin: 0px">\r
+ <tbody>\r
+\r
+ <tr>\r
+ <td style="width: 4em; text-align: right">Rows:</td>\r
+ <td><input type="text" name="f_rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>\r
+ <td></td>\r
+ <td></td>\r
+ <td></td>\r
+ </tr>\r
+ <tr>\r
+ <td style="width: 4em; text-align: right">Cols:</td>\r
+ <td><input type="text" name="f_cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>\r
+ <td style="width: 4em; text-align: right">Width:</td>\r
+ <td><input type="text" name="f_width" id="f_width" size="5" title="Width of the table" value="100" /></td>\r
+ <td><select size="1" name="f_unit" id="f_unit" title="Width unit">\r
+ <option value="%" selected="1" >Percent</option>\r
+ <option value="px" >Pixels</option>\r
+ <option value="em" >Em</option>\r
+ </select></td>\r
+ </tr>\r
+\r
+ </tbody>\r
+</table>\r
+\r
+<p />\r
+\r
+<fieldset style="float: left; margin-left: 5px;">\r
+<legend>Layout</legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fl">Alignment:</div>\r
+<select size="1" name="f_align" id="f_align"\r
+ title="Positioning of this image">\r
+ <option value="" selected="1" >Not set</option>\r
+ <option value="left" >Left</option>\r
+ <option value="right" >Right</option>\r
+ <option value="texttop" >Texttop</option>\r
+ <option value="absmiddle" >Absmiddle</option>\r
+ <option value="baseline" >Baseline</option>\r
+ <option value="absbottom" >Absbottom</option>\r
+ <option value="bottom" >Bottom</option>\r
+ <option value="middle" >Middle</option>\r
+ <option value="top" >Top</option>\r
+</select>\r
+\r
+<p />\r
+\r
+<div class="fl">Border thickness:</div>\r
+<input type="text" name="f_border" id="f_border" size="5" value="1"\r
+title="Leave empty for no border" />\r
+<!--\r
+<p />\r
+\r
+<div class="fl">Collapse borders:</div>\r
+<input type="checkbox" name="collapse" id="f_collapse" />\r
+-->\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<fieldset style="float:right; margin-right: 5px;">\r
+<legend>Spacing</legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fr">Cell spacing:</div>\r
+<input type="text" name="f_spacing" id="f_spacing" size="5" value="1"\r
+title="Space between adjacent cells" />\r
+\r
+<p />\r
+\r
+<div class="fr">Cell padding:</div>\r
+<input type="text" name="f_padding" id="f_padding" size="5" value="1"\r
+title="Space between content and border in cell" />\r
+\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<div style="margin-top: 85px; text-align: right;">\r
+<hr />\r
+<button type="button" name="ok" onclick="return onOK();">OK</button>\r
+<button type="button" name="cancel" onclick="return onCancel();">Cancel</button>\r
+</div>\r
+\r
+</form>\r
+\r
+</body>\r
+</html>\r
-<?php
- include("../../../config.php");
-?>
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />
- <title>Insert Table</title>
-<script type="text/javascript" src="popup.js"></script>
-<script type="text/javascript">
-
-function Init() {
- __dlg_init();
- document.getElementById('f_rows').focus();
-};
-
-function onOK() {
- var required = {
- "f_rows": "You must enter a number of rows",
- "f_cols": "You must enter a number of columns"
- };
- for (var i in required) {
- var el = document.getElementById(i);
- if (!el.value) {
- alert(required[i]);
- el.focus();
- return false;
- }
- }
- var fields = ["f_rows", "f_cols", "f_width", "f_unit",
- "f_align", "f_border", "f_spacing", "f_padding"];
- var param = new Object();
- for (var i in fields) {
- var id = fields[i];
- var el = document.getElementById(id);
- param[id] = el.value;
- }
- __dlg_close(param);
- return false;
-};
-
-function onCancel() {
- __dlg_close(null);
- return false;
-};
-
-</script>
-
-<style type="text/css">
-html, body {
- width: 410;
- height: 240;
- background: ButtonFace;
- color: ButtonText;
- font: 11px Tahoma,Verdana,sans-serif;
- margin: 0px;
- padding: 0px;
-}
-body { padding: 5px; }
-table {
- font: 11px Tahoma,Verdana,sans-serif;
-}
-form p {
- margin-top: 5px;
- margin-bottom: 5px;
-}
-.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }
-.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }
-fieldset { padding: 0px 10px 5px 5px; }
-select, input, button { font: 11px Tahoma,Verdana,sans-serif; }
-button { width: 70px; }
-.space { padding: 2px; }
-
-.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;
-border-bottom: 1px solid black; letter-spacing: 2px;
-}
-form { padding: 0px; margin: 0px; }
-</style>
-
-</head>
-
-<body onload="Init()">
-
-<div class="title"><?php print_string("inserttable","editor") ?></div>
-
-<form action="" method="get">
-<table border="0" style="padding: 0px; margin: 0px">
- <tbody>
-
- <tr>
- <td style="width: 4em; text-align: right"><?php print_string("rows","editor") ?>:</td>
- <td><input type="text" name="f_rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>
- <td></td>
- <td></td>
- <td></td>
- </tr>
- <tr>
- <td style="width: 4em; text-align: right"><?php print_string("cols","editor") ?>:</td>
- <td><input type="text" name="f_cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>
- <td style="width: 4em; text-align: right"><?php print_string("width","editor") ?>:</td>
- <td><input type="text" name="f_width" id="f_width" size="5" title="Width of the table" value="100" /></td>
- <td><select size="1" name="f_unit" id="f_unit" title="Width unit">
- <option value="%" selected="1" ><?php print_string("percent","editor") ?></option>
- <option value="px" ><?php print_string("pixels","editor") ?></option>
- <option value="em" >Em</option>
- </select></td>
- </tr>
-
- </tbody>
-</table>
-
-<p />
-
-<fieldset style="float: left; margin-left: 5px;">
-<legend><?php print_string("layout","editor") ?></legend>
-
-<div class="space"></div>
-
-<div class="fl"><?php print_string("alignment","editor") ?>:</div>
-<select size="1" name="f_align" id="f_align"
- title="Positioning of this image">
- <option value="" selected="1" ><?php print_string("notset","editor") ?></option>
- <option value="left" ><?php print_string("left","editor") ?></option>
- <option value="right" ><?php print_string("right","editor") ?></option>
- <option value="texttop" ><?php print_string("texttop","editor") ?></option>
- <option value="absmiddle" ><?php print_string("absmiddle","editor") ?></option>
- <option value="baseline" ><?php print_string("baseline","editor") ?></option>
- <option value="absbottom" ><?php print_string("absbottom","editor") ?></option>
- <option value="bottom" ><?php print_string("bottom","editor") ?></option>
- <option value="middle" ><?php print_string("middle","editor") ?></option>
- <option value="top" ><?php print_string("top","editor") ?></option>
-</select>
-
-<p />
-
-<div class="fl"><?php print_string("borderthickness","editor") ?>:</div>
-<input type="text" name="f_border" id="f_border" size="5" value="1"
-title="Leave empty for no border" />
-<!--
-<p />
-
-<div class="fl">Collapse borders:</div>
-<input type="checkbox" name="collapse" id="f_collapse" />
--->
-<div class="space"></div>
-
-</fieldset>
-
-<fieldset style="float:right; margin-right: 5px;">
-<legend><?php print_string("spacing","editor") ?></legend>
-
-<div class="space"></div>
-
-<div class="fr"><?php print_string("cellspacing","editor") ?>:</div>
-<input type="text" name="f_spacing" id="f_spacing" size="5" value="1"
-title="Space between adjacent cells" />
-
-<p />
-
-<div class="fr"><?php print_string("cellpadding","editor") ?>:</div>
-<input type="text" name="f_padding" id="f_padding" size="5" value="1"
-title="Space between content and border in cell" />
-
-<div class="space"></div>
-
-</fieldset>
-
-<div style="margin-top: 85px; text-align: right;">
-<hr />
-<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor") ?></button>
-<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor") ?></button>
-</div>
-
-</form>
-
-</body>
-</html>
+<?php\r
+ include("../../../config.php");\r
+?>\r
+<html>\r
+<head>\r
+<meta http-equiv="content-type" content="text/html; charset=<?php print_string("thischarset");?>" />\r
+ <title>Insert Table</title>\r
+<script type="text/javascript" src="popup.js"></script>\r
+<script type="text/javascript">\r
+\r
+function Init() {\r
+ __dlg_init();\r
+ document.getElementById('f_rows').focus();\r
+};\r
+\r
+function onOK() {\r
+ var required = {\r
+ "f_rows": "You must enter a number of rows",\r
+ "f_cols": "You must enter a number of columns"\r
+ };\r
+ for (var i in required) {\r
+ var el = document.getElementById(i);\r
+ if (!el.value) {\r
+ alert(required[i]);\r
+ el.focus();\r
+ return false;\r
+ }\r
+ }\r
+ var fields = ["f_rows", "f_cols", "f_width", "f_unit",\r
+ "f_align", "f_border", "f_spacing", "f_padding"];\r
+ var param = new Object();\r
+ for (var i in fields) {\r
+ var id = fields[i];\r
+ var el = document.getElementById(id);\r
+ param[id] = el.value;\r
+ }\r
+ __dlg_close(param);\r
+ return false;\r
+};\r
+\r
+function onCancel() {\r
+ __dlg_close(null);\r
+ return false;\r
+};\r
+\r
+</script>\r
+\r
+<style type="text/css">\r
+html, body {\r
+ width: 410;\r
+ height: 240;\r
+ background: ButtonFace;\r
+ color: ButtonText;\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+ margin: 0px;\r
+ padding: 0px;\r
+}\r
+body { padding: 5px; }\r
+table {\r
+ font: 11px Tahoma,Verdana,sans-serif;\r
+}\r
+form p {\r
+ margin-top: 5px;\r
+ margin-bottom: 5px;\r
+}\r
+.fl { width: 9em; float: left; padding: 2px 5px; text-align: right; }\r
+.fr { width: 7em; float: left; padding: 2px 5px; text-align: right; }\r
+fieldset { padding: 0px 10px 5px 5px; }\r
+select, input, button { font: 11px Tahoma,Verdana,sans-serif; }\r
+button { width: 70px; }\r
+.space { padding: 2px; }\r
+\r
+.title { background: #ddf; color: #000; font-weight: bold; font-size: 120%; padding: 3px 10px; margin-bottom: 10px;\r
+border-bottom: 1px solid black; letter-spacing: 2px;\r
+}\r
+form { padding: 0px; margin: 0px; }\r
+</style>\r
+\r
+</head>\r
+\r
+<body onload="Init()">\r
+\r
+<div class="title"><?php print_string("inserttable","editor") ?></div>\r
+\r
+<form action="" method="get">\r
+<table border="0" style="padding: 0px; margin: 0px">\r
+ <tbody>\r
+\r
+ <tr>\r
+ <td style="width: 4em; text-align: right"><?php print_string("rows","editor") ?>:</td>\r
+ <td><input type="text" name="f_rows" id="f_rows" size="5" title="Number of rows" value="2" /></td>\r
+ <td></td>\r
+ <td></td>\r
+ <td></td>\r
+ </tr>\r
+ <tr>\r
+ <td style="width: 4em; text-align: right"><?php print_string("cols","editor") ?>:</td>\r
+ <td><input type="text" name="f_cols" id="f_cols" size="5" title="Number of columns" value="4" /></td>\r
+ <td style="width: 4em; text-align: right"><?php print_string("width","editor") ?>:</td>\r
+ <td><input type="text" name="f_width" id="f_width" size="5" title="Width of the table" value="100" /></td>\r
+ <td><select size="1" name="f_unit" id="f_unit" title="Width unit">\r
+ <option value="%" selected="1" ><?php print_string("percent","editor") ?></option>\r
+ <option value="px" ><?php print_string("pixels","editor") ?></option>\r
+ <option value="em" >Em</option>\r
+ </select></td>\r
+ </tr>\r
+\r
+ </tbody>\r
+</table>\r
+\r
+<p />\r
+\r
+<fieldset style="float: left; margin-left: 5px;">\r
+<legend><?php print_string("layout","editor") ?></legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fl"><?php print_string("alignment","editor") ?>:</div>\r
+<select size="1" name="f_align" id="f_align"\r
+ title="Positioning of this image">\r
+ <option value="" selected="1" ><?php print_string("notset","editor") ?></option>\r
+ <option value="left" ><?php print_string("left","editor") ?></option>\r
+ <option value="right" ><?php print_string("right","editor") ?></option>\r
+ <option value="texttop" ><?php print_string("texttop","editor") ?></option>\r
+ <option value="absmiddle" ><?php print_string("absmiddle","editor") ?></option>\r
+ <option value="baseline" ><?php print_string("baseline","editor") ?></option>\r
+ <option value="absbottom" ><?php print_string("absbottom","editor") ?></option>\r
+ <option value="bottom" ><?php print_string("bottom","editor") ?></option>\r
+ <option value="middle" ><?php print_string("middle","editor") ?></option>\r
+ <option value="top" ><?php print_string("top","editor") ?></option>\r
+</select>\r
+\r
+<p />\r
+\r
+<div class="fl"><?php print_string("borderthickness","editor") ?>:</div>\r
+<input type="text" name="f_border" id="f_border" size="5" value="1"\r
+title="Leave empty for no border" />\r
+<!--\r
+<p />\r
+\r
+<div class="fl">Collapse borders:</div>\r
+<input type="checkbox" name="collapse" id="f_collapse" />\r
+-->\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<fieldset style="float:right; margin-right: 5px;">\r
+<legend><?php print_string("spacing","editor") ?></legend>\r
+\r
+<div class="space"></div>\r
+\r
+<div class="fr"><?php print_string("cellspacing","editor") ?>:</div>\r
+<input type="text" name="f_spacing" id="f_spacing" size="5" value="1"\r
+title="Space between adjacent cells" />\r
+\r
+<p />\r
+\r
+<div class="fr"><?php print_string("cellpadding","editor") ?>:</div>\r
+<input type="text" name="f_padding" id="f_padding" size="5" value="1"\r
+title="Space between content and border in cell" />\r
+\r
+<div class="space"></div>\r
+\r
+</fieldset>\r
+\r
+<div style="margin-top: 85px; text-align: right;">\r
+<hr />\r
+<button type="button" name="ok" onclick="return onOK();"><?php print_string("ok","editor") ?></button>\r
+<button type="button" name="cancel" onclick="return onCancel();"><?php print_string("cancel","editor") ?></button>\r
+</div>\r
+\r
+</form>\r
+\r
+</body>\r
+</html>\r
--- /dev/null
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>testaus</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<script type="text/javascript" src="popup.js"></script>
+<script language="JavaScript" type="text/javascript">
+window.resizeTo(700, 460);
+
+//I18N = window.opener.HTMLArea.I18N.dialogs;
+
+// function i18n(str) {
+// return (I18N[str] || str);
+// };
+
+function onTargetChanged() {
+ var f = document.getElementById("f_other_target");
+ if (this.value == "_other") {
+ f.style.visibility = "visible";
+ f.select();
+ f.focus();
+ } else f.style.visibility = "hidden";
+};
+
+function Init() {
+ //__dlg_translate(I18N);
+ __dlg_init();
+ var param = window.dialogArguments;
+ var target_select = document.getElementById("f_target");
+ if (param) {
+ document.getElementById("f_href").value = param["f_href"];
+ document.getElementById("f_title").value = param["f_title"];
+ comboSelectValue(target_select, param["f_target"]);
+ if (target_select.value != param.f_target) {
+ var opt = document.createElement("option");
+ opt.value = param.f_target;
+ opt.innerHTML = opt.value;
+ target_select.appendChild(opt);
+ opt.selected = true;
+ }
+ }
+ var opt = document.createElement("option");
+ opt.value = "_other";
+ opt.innerHTML = "muu";
+ target_select.appendChild(opt);
+ target_select.onchange = onTargetChanged;
+ document.getElementById("f_href").focus();
+ window.focus();
+ document.getElementById("f_href").select();
+};
+
+function onOK() {
+ var required = {
+ "f_href": alert("You must enter the URL where this link points to")
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ["f_href", "f_title", "f_target" ];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ if (param.f_target == "_other")
+ param.f_target = document.getElementById("f_other_target").value;
+ __dlg_close(param);
+ return false;
+};
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+};
+
+function indexFrom() {
+ var set_url = document.getElementById('findex');
+ var url = set_url.value;
+ window.fbrowser.location.replace(url);
+
+ var resetme = document.forms['mainform'];
+ resetme.fcreated.value = "";
+ resetme.ftype.value = "";
+ resetme.fsize.value = "";
+ return false;
+};
+</script>
+<style type="text/css">
+html, body {
+width: 700;
+height: 460;
+background-color: rgb(212,208,200);
+}
+.title {
+background-color: #ddddff;
+padding: 5px;
+border-bottom: 1px solid black;
+font-family: Tahoma, sans-serif;
+font-weight: bold;
+font-size: 14px;
+color: black;
+}
+input,select {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+legend {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+p {
+margin-left: 10px;
+background-color: transparent;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+color: black;
+}
+td {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+button {
+width: 70px;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+#fcreated,#ftype,#fsize {
+background-color: rgb(212,208,200);
+border: none;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+color: black;
+}
+.space { padding: 2px; }
+</style>
+</head>
+
+<body onload="Init()">
+<div class="title">Lisää linkki</div>
+ <table width="660" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td width="380" valign="top"><fieldset>
+ <legend>Tiedosto selain</legend>
+
+ <div class="space"></div>
+ <iframe id="fbrowser" name="fbrowser" src="../coursefiles.php" width="360" height="260"></iframe>
+ <p>
+ <form id="uploader" name="uploader" enctype="multipart/form-data" method="post" action="browser.php" target="fbrowser">
+ <input type="hidden" name="MAX_FILE_SIZE" value="2097152">
+ <input type="hidden" name="a" value="s">
+ <input id="dir" type="hidden" name="dir" value="none">
+ <input id="fiilu" type="file" name="fiilu" size="35">
+ <input type="submit" name="subval" value="Lataa tiedosto">
+ </form></p>
+ <div class="space"></div>
+ </fieldset> </td>
+ <td width="300" valign="top">
+ <form name="mainform">
+ <fieldset>
+ <legend>Tiedoston ominaisuudet</legend>
+ <div class="space"></div>
+ <table width="298" border="0">
+ <tr>
+ <td width="35" align="right">Luotu:</td>
+ <td align="left"><input id="fcreated" type="text" name="fcreated" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right">Tyyppi:</td>
+ <td align="left"><input id="ftype" type="text" name="ftype" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right">Koko:</td>
+ <td align="left"><input id="fsize" type="text" name="fsize" size="40"></td>
+ </tr>
+ </table>
+ <br>
+ </fieldset>
+ <fieldset><legend>Linkin ominaisuudet</legend>
+ <br>
+ <table width="82%">
+ <tr>
+ <td width="35" align="right">Osoite:</td>
+ <td><input id="f_href" type="text" name="url" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right">Otsikko:</td>
+ <td><input id="f_title" type="text" name="f_title" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right">Kohde:</td>
+ <td><select id="f_target" name="f_target">
+ <option value="">None (use implicit)</option>
+ <option value="_blank">Uuteen ikkunaan (_blank)</option>
+ <option value="_self">Samaan kehykseen (_self)</option>
+ <option value="_top">Ylä kehykseen (_top)</option>
+ </select></td>
+ </tr>
+ </table>
+ <div class="space"></div>
+ <table width="78%" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td align="right" valign="middle"><button name="btnOk" onclick="return onOK();">OK</button>
+ <button name="btnCancel" onclick="return onCancel();">Peruuta</button></td>
+ </tr>
+ </table>
+ <div class="space"></div>
+ </fieldset>
+ </form>
+ </td>
+ </tr>
+ </table>
+<p> </p>
+</body>
+</html>
--- /dev/null
+<?php // $Id$
+ include("../../../config.php");
+
+ $id = $_GET['id'];
+
+ require_variable($id);
+
+ if (!$course = get_record("course", "id", $id)) {
+ $course->fullname = ""; // Just to keep display happy, though browsing may fail
+ }
+?>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
+<html>
+<head>
+<title>testaus</title>
+<meta http-equiv="Content-Type" content="text/html; <?php print_string("thischarset");?>">
+<script type="text/javascript" src="popup.js"></script>
+<script language="JavaScript" type="text/javascript">
+window.resizeTo(700, 460);
+
+//I18N = window.opener.HTMLArea.I18N.dialogs;
+
+// function i18n(str) {
+// return (I18N[str] || str);
+// };
+
+function onTargetChanged() {
+/*
+ // commented out since it does not work!!!
+ var f = document.getElementById("f_other_target");
+ if (this.value == "_other") {
+ f.style.visibility = "visible";
+ f.select();
+ f.focus();
+ } else f.style.visibility = "hidden";
+*/};
+
+function Init() {
+ //__dlg_translate(I18N);
+ __dlg_init();
+ var param = window.dialogArguments;
+ var target_select = document.getElementById("f_target");
+ if (param) {
+ document.getElementById("f_href").value = param["f_href"];
+ document.getElementById("f_title").value = param["f_title"];
+ //comboSelectValue(target_select, param["f_target"]);
+ if (target_select.value != param.f_target) {
+ var opt = document.createElement("option");
+ opt.value = param.f_target;
+ opt.innerHTML = opt.value;
+ target_select.appendChild(opt);
+ opt.selected = true;
+ }
+ }
+ var opt = document.createElement("option");
+ opt.value = "_other";
+ opt.innerHTML = "<?php print_string("linktargetother","editor");?>";
+ target_select.appendChild(opt);
+ target_select.onchange = onTargetChanged;
+ document.getElementById("f_href").focus();
+ window.focus();
+ document.getElementById("f_href").select();
+};
+
+function onOK() {
+ var required = {
+ "f_href": "You must enter the URL where this link points to"
+ };
+ for (var i in required) {
+ var el = document.getElementById(i);
+ if (!el.value) {
+ alert(required[i]);
+ el.focus();
+ return false;
+ }
+ }
+ // pass data back to the calling window
+ var fields = ["f_href", "f_title", "f_target" ];
+ var param = new Object();
+ for (var i in fields) {
+ var id = fields[i];
+ var el = document.getElementById(id);
+ param[id] = el.value;
+ }
+ if (param.f_target == "_other")
+ param.f_target = document.getElementById("f_other_target").value;
+ __dlg_close(param);
+ return false;
+};
+
+function onCancel() {
+ __dlg_close(null);
+ return false;
+};
+
+function indexFrom() {
+ var set_url = document.getElementById('findex');
+ var url = set_url.value;
+ window.fbrowser.location.replace(url);
+
+ var resetme = document.forms['mainform'];
+ resetme.fcreated.value = "";
+ resetme.ftype.value = "";
+ resetme.fsize.value = "";
+ return false;
+};
+</script>
+<style type="text/css">
+html, body {
+width: 700;
+height: 460;
+background-color: rgb(212,208,200);
+}
+.title {
+background-color: #ddddff;
+padding: 5px;
+border-bottom: 1px solid black;
+font-family: Tahoma, sans-serif;
+font-weight: bold;
+font-size: 14px;
+color: black;
+}
+input,select {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+legend {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+p {
+margin-left: 10px;
+background-color: transparent;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+color: black;
+}
+td {
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+button {
+width: 70px;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+}
+#imodified,#itype,#isize {
+background-color: rgb(212,208,200);
+border: none;
+font-family: Tahoma, sans-serif;
+font-size: 11px;
+color: black;
+}
+.space { padding: 2px; }
+</style>
+</head>
+
+<body onload="Init()">
+<div class="title"><?php print_string("insertlink","editor");?></div>
+ <table width="660" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td width="380" valign="top"><fieldset>
+ <legend><?php print_string("filebrowser","editor");?></legend>
+
+ <div class="space"></div>
+ <?php print(isteacher($id))?
+ "<iframe id=\"fbrowser\" name=\"fbrowser\" src=\"../coursefiles.php?id=".$course->id."\" width=\"360\" height=\"260\"></iframe>":
+ "<iframe src=\"blank.html\" width=\"360\" height=\"260\"></iframe>"; ?>
+ <p>
+ </p>
+ <div class="space"></div>
+ </fieldset> </td>
+ <td width="300" valign="top">
+ <form name="mainform">
+ <fieldset>
+ <legend><?php print_string("properties","editor");?></legend>
+ <div class="space"></div>
+ <table width="298" border="0">
+ <tr>
+ <td width="35" align="right"><?php print_string("modified");?>:</td>
+ <td align="left"><input id="imodified" type="text" name="imodified" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right"><?php print_string("type","editor");?>:</td>
+ <td align="left"><input id="itype" type="text" name="itype" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right"><?php print_string("size","editor");?>:</td>
+ <td align="left"><input id="isize" type="text" name="isize" size="40"></td>
+ </tr>
+ </table>
+ <br>
+ </fieldset>
+ <fieldset><legend><?php print_string("linkproperties","editor");?></legend>
+ <br>
+ <table width="82%">
+ <tr>
+ <td width="35" align="right"><?php print_string("linkurl","editor");?>:</td>
+ <td><input id="f_href" type="text" name="f_href" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right"><?php print_string("linktitle","editor");?>:</td>
+ <td><input id="f_title" type="text" name="f_title" size="40"></td>
+ </tr>
+ <tr>
+ <td width="35" align="right"><?php print_string("linktarget","editor");?>:</td>
+ <td><select id="f_target" name="f_target">
+ <option value=""><?php print_string("linktargetnone","editor");?></option>
+ <option value="_blank"><?php print_string("linktargetblank","editor");?></option>
+ <option value="_self"><?php print_string("linktargetself","editor");?></option>
+ <option value="_top"><?php print_string("linktargettop","editor");?></option>
+ </select></td>
+ </tr>
+ </table>
+ <div class="space"></div>
+ <table width="78%" border="0" cellspacing="0" cellpadding="2">
+ <tr>
+ <td align="right" valign="middle"><button name="btnOk" onclick="return onOK();"><?php print_string("ok","editor");?></button>
+ <button name="btnCancel" onclick="return onCancel();"><?php print_string("cancel","editor");?></button></td>
+ </tr>
+ </table>
+ <div class="space"></div>
+ </fieldset>
+ </form>
+ </td>
+ </tr>
+ </table>
+<p> </p>
+</body>
+</html>
-function __dlg_onclose() {
- if (!document.all) {
- opener.Dialog._return(null);
- }
-};
-
-function __dlg_init() {
- if (!document.all) {
- // init dialogArguments, as IE gets it
- window.dialogArguments = opener.Dialog._arguments;
- window.sizeToContent();
- window.sizeToContent(); // for reasons beyond understanding,
- // only if we call it twice we get the
- // correct size.
- window.addEventListener("unload", __dlg_onclose, true);
- // center on parent
- var px1 = opener.screenX;
- var px2 = opener.screenX + opener.outerWidth;
- var py1 = opener.screenY;
- var py2 = opener.screenY + opener.outerHeight;
- var x = (px2 - px1 - window.outerWidth) / 2;
- var y = (py2 - py1 - window.outerHeight) / 2;
- window.moveTo(x, y);
- var body = document.body;
- window.innerHeight = body.offsetHeight + 10;
- window.innerWidth = body.offsetWidth + 10;
- window.focus();
- } else {
- var body = document.body;
- window.dialogWidth = body.offsetWidth + "px";
- window.dialogHeight = body.offsetHeight + 50 + "px";
- }
-};
-
-// closes the dialog and passes the return info upper.
-function __dlg_close(val) {
- if (document.all) { // IE
- window.returnValue = val;
- } else {
- opener.Dialog._return(val);
- }
- window.close();
-};
+function __dlg_onclose() {\r
+ if (!document.all) {\r
+ opener.Dialog._return(null);\r
+ }\r
+};\r
+\r
+function __dlg_init() {\r
+ if (!document.all) {\r
+ // init dialogArguments, as IE gets it\r
+ window.dialogArguments = opener.Dialog._arguments;\r
+ window.sizeToContent();\r
+ window.sizeToContent(); // for reasons beyond understanding,\r
+ // only if we call it twice we get the\r
+ // correct size.\r
+ window.addEventListener("unload", __dlg_onclose, true);\r
+ // center on parent\r
+ var px1 = opener.screenX;\r
+ var px2 = opener.screenX + opener.outerWidth;\r
+ var py1 = opener.screenY;\r
+ var py2 = opener.screenY + opener.outerHeight;\r
+ var x = (px2 - px1 - window.outerWidth) / 2;\r
+ var y = (py2 - py1 - window.outerHeight) / 2;\r
+ window.moveTo(x, y);\r
+ var body = document.body;\r
+ window.innerHeight = body.offsetHeight + 10;\r
+ window.innerWidth = body.offsetWidth + 10;\r
+ window.focus();\r
+ } else {\r
+ var body = document.body;\r
+ window.dialogWidth = body.offsetWidth + "px";\r
+ window.dialogHeight = body.offsetHeight + 50 + "px";\r
+ }\r
+};\r
+\r
+// closes the dialog and passes the return info upper.\r
+function __dlg_close(val) {\r
+ if (document.all) { // IE\r
+ window.returnValue = val;\r
+ } else {\r
+ opener.Dialog._return(val);\r
+ }\r
+ window.close();\r
+};\r
--- /dev/null
+<?php // $Id$ preview for insert image dialog
+
+ include("../../../config.php");
+ require("../../../files/mimetypes.php");
+
+ require_variable($id);
+ require_variable($imageurl);
+
+ if (! $course = get_record("course", "id", $id) ) {
+ error("That's an invalid course id");
+ }
+
+ require_login($course->id);
+
+ if (!isteacher($course->id)) {
+ error("Only teachers can use this functionality");
+ }
+
+ $imageurl = rawurldecode($imageurl); /// Full URL starts with $CFG->wwwroot/file.php
+ $imagepath = str_replace("$CFG->wwwroot/file.php", '', $imageurl);
+
+ if ($imagepath != $imageurl) { /// This is an internal image
+ $size = getimagesize($CFG->dataroot.$imagepath);
+ }
+
+ $width = $size[0];
+ $height = $size[1];
+ settype($width, "integer");
+ settype($height, "integer");
+
+ if ($height >= 200) {
+ $division = ($height / 190);
+ $width = round($width / $division);
+ $height = 190;
+ }
+
+ echo "<html>\n";
+ echo "<head>\n";
+ echo "<title>Preview</title>\n";
+ echo "<style type=\"text/css\">\n";
+ echo " body { margin: 2px; }\n";
+ echo "</style>\n";
+ echo "</head>\n";
+ echo "<body bgcolor=\"#ffffff\">\n";
+ print "<img src=\"$imageurl\" width=\"$width\" height=\"$height\" alt=\"\">";
+ echo "</body>\n</html>\n";
+
+?>
-<!-- note: this version of the color picker is optimized for IE 5.5+ only -->\r
-\r
-<html style="width: 238px; height: 182px"><head><title>Select Color</title>\r
-\r
-<script type="text/javascript" src="popup.js"></script>\r
-\r
-<script type="text/javascript">\r
-\r
-function _CloseOnEsc() {\r
- if (event.keyCode == 27) { window.close(); return; }\r
-}\r
-\r
-function Init() { // run on page load\r
- __dlg_init(); // <!-- this can be found in popup.js -->\r
- document.body.onkeypress = _CloseOnEsc;\r
-\r
- var color = window.dialogArguments;\r
- color = ValidateColor(color) || '000000';\r
- View(color); // set default color\r
-}\r
-\r
-function View(color) { // preview color\r
- document.getElementById("ColorPreview").style.backgroundColor = '#' + color;\r
- document.getElementById("ColorHex").value = '#' + color;\r
-}\r
-\r
-function Set(string) { // select color\r
- var color = ValidateColor(string);\r
- if (color == null) { alert("Invalid color code: " + string); } // invalid color\r
- else { // valid color\r
- View(color); // show selected color\r
- __dlg_close(color);\r
- }\r
-}\r
-\r
-function ValidateColor(string) { // return valid color code\r
- string = string || '';\r
- string = string + "";\r
- string = string.toUpperCase();\r
- var chars = '0123456789ABCDEF';\r
- var out = '';\r
-\r
- for (var i=0; i<string.length; i++) { // remove invalid color chars\r
- var schar = string.charAt(i);\r
- if (chars.indexOf(schar) != -1) { out += schar; }\r
- }\r
-\r
- if (out.length != 6) { return null; } // check length\r
- return out;\r
-}\r
-\r
-</script>\r
-</head>\r
-<body style="background:ButtonFace; margin:0px; padding:0px" onload="Init()">\r
-\r
-<form method="get" style="margin:0px; padding:0px" onSubmit="Set(document.getElementById('ColorHex').value); return false;">\r
-<table border="0px" cellspacing="0px" cellpadding="4" width="100%">\r
- <tr>\r
- <td style="background:buttonface" valign=center><div style="background-color: #000000; padding: 1; height: 21px; width: 50px"><div id="ColorPreview" style="height: 100%; width: 100%"></div></div></td>\r
- <td style="background:buttonface" valign=center><input type="text" name="ColorHex"\r
- id="ColorHex" value="" size=15 style="font-size: 12px"></td>\r
- <td style="background:buttonface" width=100%></td>\r
- </tr>\r
-</table>\r
-</form>\r
-\r
-<table border="0" cellspacing="1px" cellpadding="0px" width="100%" bgcolor="#000000" style="cursor: hand;">\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#003300 onMouseOver=View('003300') onClick=Set('003300') height="10px" width="10px"></td>\r
-<td bgcolor=#006600 onMouseOver=View('006600') onClick=Set('006600') height="10px" width="10px"></td>\r
-<td bgcolor=#009900 onMouseOver=View('009900') onClick=Set('009900') height="10px" width="10px"></td>\r
-<td bgcolor=#00CC00 onMouseOver=View('00CC00') onClick=Set('00CC00') height="10px" width="10px"></td>\r
-<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>\r
-<td bgcolor=#330000 onMouseOver=View('330000') onClick=Set('330000') height="10px" width="10px"></td>\r
-<td bgcolor=#333300 onMouseOver=View('333300') onClick=Set('333300') height="10px" width="10px"></td>\r
-<td bgcolor=#336600 onMouseOver=View('336600') onClick=Set('336600') height="10px" width="10px"></td>\r
-<td bgcolor=#339900 onMouseOver=View('339900') onClick=Set('339900') height="10px" width="10px"></td>\r
-<td bgcolor=#33CC00 onMouseOver=View('33CC00') onClick=Set('33CC00') height="10px" width="10px"></td>\r
-<td bgcolor=#33FF00 onMouseOver=View('33FF00') onClick=Set('33FF00') height="10px" width="10px"></td>\r
-<td bgcolor=#660000 onMouseOver=View('660000') onClick=Set('660000') height="10px" width="10px"></td>\r
-<td bgcolor=#663300 onMouseOver=View('663300') onClick=Set('663300') height="10px" width="10px"></td>\r
-<td bgcolor=#666600 onMouseOver=View('666600') onClick=Set('666600') height="10px" width="10px"></td>\r
-<td bgcolor=#669900 onMouseOver=View('669900') onClick=Set('669900') height="10px" width="10px"></td>\r
-<td bgcolor=#66CC00 onMouseOver=View('66CC00') onClick=Set('66CC00') height="10px" width="10px"></td>\r
-<td bgcolor=#66FF00 onMouseOver=View('66FF00') onClick=Set('66FF00') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000033 onMouseOver=View('000033') onClick=Set('000033') height="10px" width="10px"></td>\r
-<td bgcolor=#003333 onMouseOver=View('003333') onClick=Set('003333') height="10px" width="10px"></td>\r
-<td bgcolor=#006633 onMouseOver=View('006633') onClick=Set('006633') height="10px" width="10px"></td>\r
-<td bgcolor=#009933 onMouseOver=View('009933') onClick=Set('009933') height="10px" width="10px"></td>\r
-<td bgcolor=#00CC33 onMouseOver=View('00CC33') onClick=Set('00CC33') height="10px" width="10px"></td>\r
-<td bgcolor=#00FF33 onMouseOver=View('00FF33') onClick=Set('00FF33') height="10px" width="10px"></td>\r
-<td bgcolor=#330033 onMouseOver=View('330033') onClick=Set('330033') height="10px" width="10px"></td>\r
-<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>\r
-<td bgcolor=#336633 onMouseOver=View('336633') onClick=Set('336633') height="10px" width="10px"></td>\r
-<td bgcolor=#339933 onMouseOver=View('339933') onClick=Set('339933') height="10px" width="10px"></td>\r
-<td bgcolor=#33CC33 onMouseOver=View('33CC33') onClick=Set('33CC33') height="10px" width="10px"></td>\r
-<td bgcolor=#33FF33 onMouseOver=View('33FF33') onClick=Set('33FF33') height="10px" width="10px"></td>\r
-<td bgcolor=#660033 onMouseOver=View('660033') onClick=Set('660033') height="10px" width="10px"></td>\r
-<td bgcolor=#663333 onMouseOver=View('663333') onClick=Set('663333') height="10px" width="10px"></td>\r
-<td bgcolor=#666633 onMouseOver=View('666633') onClick=Set('666633') height="10px" width="10px"></td>\r
-<td bgcolor=#669933 onMouseOver=View('669933') onClick=Set('669933') height="10px" width="10px"></td>\r
-<td bgcolor=#66CC33 onMouseOver=View('66CC33') onClick=Set('66CC33') height="10px" width="10px"></td>\r
-<td bgcolor=#66FF33 onMouseOver=View('66FF33') onClick=Set('66FF33') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000066 onMouseOver=View('000066') onClick=Set('000066') height="10px" width="10px"></td>\r
-<td bgcolor=#003366 onMouseOver=View('003366') onClick=Set('003366') height="10px" width="10px"></td>\r
-<td bgcolor=#006666 onMouseOver=View('006666') onClick=Set('006666') height="10px" width="10px"></td>\r
-<td bgcolor=#009966 onMouseOver=View('009966') onClick=Set('009966') height="10px" width="10px"></td>\r
-<td bgcolor=#00CC66 onMouseOver=View('00CC66') onClick=Set('00CC66') height="10px" width="10px"></td>\r
-<td bgcolor=#00FF66 onMouseOver=View('00FF66') onClick=Set('00FF66') height="10px" width="10px"></td>\r
-<td bgcolor=#330066 onMouseOver=View('330066') onClick=Set('330066') height="10px" width="10px"></td>\r
-<td bgcolor=#333366 onMouseOver=View('333366') onClick=Set('333366') height="10px" width="10px"></td>\r
-<td bgcolor=#336666 onMouseOver=View('336666') onClick=Set('336666') height="10px" width="10px"></td>\r
-<td bgcolor=#339966 onMouseOver=View('339966') onClick=Set('339966') height="10px" width="10px"></td>\r
-<td bgcolor=#33CC66 onMouseOver=View('33CC66') onClick=Set('33CC66') height="10px" width="10px"></td>\r
-<td bgcolor=#33FF66 onMouseOver=View('33FF66') onClick=Set('33FF66') height="10px" width="10px"></td>\r
-<td bgcolor=#660066 onMouseOver=View('660066') onClick=Set('660066') height="10px" width="10px"></td>\r
-<td bgcolor=#663366 onMouseOver=View('663366') onClick=Set('663366') height="10px" width="10px"></td>\r
-<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>\r
-<td bgcolor=#669966 onMouseOver=View('669966') onClick=Set('669966') height="10px" width="10px"></td>\r
-<td bgcolor=#66CC66 onMouseOver=View('66CC66') onClick=Set('66CC66') height="10px" width="10px"></td>\r
-<td bgcolor=#66FF66 onMouseOver=View('66FF66') onClick=Set('66FF66') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#000099 onMouseOver=View('000099') onClick=Set('000099') height="10px" width="10px"></td>\r
-<td bgcolor=#003399 onMouseOver=View('003399') onClick=Set('003399') height="10px" width="10px"></td>\r
-<td bgcolor=#006699 onMouseOver=View('006699') onClick=Set('006699') height="10px" width="10px"></td>\r
-<td bgcolor=#009999 onMouseOver=View('009999') onClick=Set('009999') height="10px" width="10px"></td>\r
-<td bgcolor=#00CC99 onMouseOver=View('00CC99') onClick=Set('00CC99') height="10px" width="10px"></td>\r
-<td bgcolor=#00FF99 onMouseOver=View('00FF99') onClick=Set('00FF99') height="10px" width="10px"></td>\r
-<td bgcolor=#330099 onMouseOver=View('330099') onClick=Set('330099') height="10px" width="10px"></td>\r
-<td bgcolor=#333399 onMouseOver=View('333399') onClick=Set('333399') height="10px" width="10px"></td>\r
-<td bgcolor=#336699 onMouseOver=View('336699') onClick=Set('336699') height="10px" width="10px"></td>\r
-<td bgcolor=#339999 onMouseOver=View('339999') onClick=Set('339999') height="10px" width="10px"></td>\r
-<td bgcolor=#33CC99 onMouseOver=View('33CC99') onClick=Set('33CC99') height="10px" width="10px"></td>\r
-<td bgcolor=#33FF99 onMouseOver=View('33FF99') onClick=Set('33FF99') height="10px" width="10px"></td>\r
-<td bgcolor=#660099 onMouseOver=View('660099') onClick=Set('660099') height="10px" width="10px"></td>\r
-<td bgcolor=#663399 onMouseOver=View('663399') onClick=Set('663399') height="10px" width="10px"></td>\r
-<td bgcolor=#666699 onMouseOver=View('666699') onClick=Set('666699') height="10px" width="10px"></td>\r
-<td bgcolor=#669999 onMouseOver=View('669999') onClick=Set('669999') height="10px" width="10px"></td>\r
-<td bgcolor=#66CC99 onMouseOver=View('66CC99') onClick=Set('66CC99') height="10px" width="10px"></td>\r
-<td bgcolor=#66FF99 onMouseOver=View('66FF99') onClick=Set('66FF99') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#0000CC onMouseOver=View('0000CC') onClick=Set('0000CC') height="10px" width="10px"></td>\r
-<td bgcolor=#0033CC onMouseOver=View('0033CC') onClick=Set('0033CC') height="10px" width="10px"></td>\r
-<td bgcolor=#0066CC onMouseOver=View('0066CC') onClick=Set('0066CC') height="10px" width="10px"></td>\r
-<td bgcolor=#0099CC onMouseOver=View('0099CC') onClick=Set('0099CC') height="10px" width="10px"></td>\r
-<td bgcolor=#00CCCC onMouseOver=View('00CCCC') onClick=Set('00CCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#00FFCC onMouseOver=View('00FFCC') onClick=Set('00FFCC') height="10px" width="10px"></td>\r
-<td bgcolor=#3300CC onMouseOver=View('3300CC') onClick=Set('3300CC') height="10px" width="10px"></td>\r
-<td bgcolor=#3333CC onMouseOver=View('3333CC') onClick=Set('3333CC') height="10px" width="10px"></td>\r
-<td bgcolor=#3366CC onMouseOver=View('3366CC') onClick=Set('3366CC') height="10px" width="10px"></td>\r
-<td bgcolor=#3399CC onMouseOver=View('3399CC') onClick=Set('3399CC') height="10px" width="10px"></td>\r
-<td bgcolor=#33CCCC onMouseOver=View('33CCCC') onClick=Set('33CCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#33FFCC onMouseOver=View('33FFCC') onClick=Set('33FFCC') height="10px" width="10px"></td>\r
-<td bgcolor=#6600CC onMouseOver=View('6600CC') onClick=Set('6600CC') height="10px" width="10px"></td>\r
-<td bgcolor=#6633CC onMouseOver=View('6633CC') onClick=Set('6633CC') height="10px" width="10px"></td>\r
-<td bgcolor=#6666CC onMouseOver=View('6666CC') onClick=Set('6666CC') height="10px" width="10px"></td>\r
-<td bgcolor=#6699CC onMouseOver=View('6699CC') onClick=Set('6699CC') height="10px" width="10px"></td>\r
-<td bgcolor=#66CCCC onMouseOver=View('66CCCC') onClick=Set('66CCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#66FFCC onMouseOver=View('66FFCC') onClick=Set('66FFCC') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>\r
-<td bgcolor=#0033FF onMouseOver=View('0033FF') onClick=Set('0033FF') height="10px" width="10px"></td>\r
-<td bgcolor=#0066FF onMouseOver=View('0066FF') onClick=Set('0066FF') height="10px" width="10px"></td>\r
-<td bgcolor=#0099FF onMouseOver=View('0099FF') onClick=Set('0099FF') height="10px" width="10px"></td>\r
-<td bgcolor=#00CCFF onMouseOver=View('00CCFF') onClick=Set('00CCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#3300FF onMouseOver=View('3300FF') onClick=Set('3300FF') height="10px" width="10px"></td>\r
-<td bgcolor=#3333FF onMouseOver=View('3333FF') onClick=Set('3333FF') height="10px" width="10px"></td>\r
-<td bgcolor=#3366FF onMouseOver=View('3366FF') onClick=Set('3366FF') height="10px" width="10px"></td>\r
-<td bgcolor=#3399FF onMouseOver=View('3399FF') onClick=Set('3399FF') height="10px" width="10px"></td>\r
-<td bgcolor=#33CCFF onMouseOver=View('33CCFF') onClick=Set('33CCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#33FFFF onMouseOver=View('33FFFF') onClick=Set('33FFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#6600FF onMouseOver=View('6600FF') onClick=Set('6600FF') height="10px" width="10px"></td>\r
-<td bgcolor=#6633FF onMouseOver=View('6633FF') onClick=Set('6633FF') height="10px" width="10px"></td>\r
-<td bgcolor=#6666FF onMouseOver=View('6666FF') onClick=Set('6666FF') height="10px" width="10px"></td>\r
-<td bgcolor=#6699FF onMouseOver=View('6699FF') onClick=Set('6699FF') height="10px" width="10px"></td>\r
-<td bgcolor=#66CCFF onMouseOver=View('66CCFF') onClick=Set('66CCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#66FFFF onMouseOver=View('66FFFF') onClick=Set('66FFFF') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#990000 onMouseOver=View('990000') onClick=Set('990000') height="10px" width="10px"></td>\r
-<td bgcolor=#993300 onMouseOver=View('993300') onClick=Set('993300') height="10px" width="10px"></td>\r
-<td bgcolor=#996600 onMouseOver=View('996600') onClick=Set('996600') height="10px" width="10px"></td>\r
-<td bgcolor=#999900 onMouseOver=View('999900') onClick=Set('999900') height="10px" width="10px"></td>\r
-<td bgcolor=#99CC00 onMouseOver=View('99CC00') onClick=Set('99CC00') height="10px" width="10px"></td>\r
-<td bgcolor=#99FF00 onMouseOver=View('99FF00') onClick=Set('99FF00') height="10px" width="10px"></td>\r
-<td bgcolor=#CC0000 onMouseOver=View('CC0000') onClick=Set('CC0000') height="10px" width="10px"></td>\r
-<td bgcolor=#CC3300 onMouseOver=View('CC3300') onClick=Set('CC3300') height="10px" width="10px"></td>\r
-<td bgcolor=#CC6600 onMouseOver=View('CC6600') onClick=Set('CC6600') height="10px" width="10px"></td>\r
-<td bgcolor=#CC9900 onMouseOver=View('CC9900') onClick=Set('CC9900') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCC00 onMouseOver=View('CCCC00') onClick=Set('CCCC00') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFF00 onMouseOver=View('CCFF00') onClick=Set('CCFF00') height="10px" width="10px"></td>\r
-<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>\r
-<td bgcolor=#FF3300 onMouseOver=View('FF3300') onClick=Set('FF3300') height="10px" width="10px"></td>\r
-<td bgcolor=#FF6600 onMouseOver=View('FF6600') onClick=Set('FF6600') height="10px" width="10px"></td>\r
-<td bgcolor=#FF9900 onMouseOver=View('FF9900') onClick=Set('FF9900') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCC00 onMouseOver=View('FFCC00') onClick=Set('FFCC00') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#990033 onMouseOver=View('990033') onClick=Set('990033') height="10px" width="10px"></td>\r
-<td bgcolor=#993333 onMouseOver=View('993333') onClick=Set('993333') height="10px" width="10px"></td>\r
-<td bgcolor=#996633 onMouseOver=View('996633') onClick=Set('996633') height="10px" width="10px"></td>\r
-<td bgcolor=#999933 onMouseOver=View('999933') onClick=Set('999933') height="10px" width="10px"></td>\r
-<td bgcolor=#99CC33 onMouseOver=View('99CC33') onClick=Set('99CC33') height="10px" width="10px"></td>\r
-<td bgcolor=#99FF33 onMouseOver=View('99FF33') onClick=Set('99FF33') height="10px" width="10px"></td>\r
-<td bgcolor=#CC0033 onMouseOver=View('CC0033') onClick=Set('CC0033') height="10px" width="10px"></td>\r
-<td bgcolor=#CC3333 onMouseOver=View('CC3333') onClick=Set('CC3333') height="10px" width="10px"></td>\r
-<td bgcolor=#CC6633 onMouseOver=View('CC6633') onClick=Set('CC6633') height="10px" width="10px"></td>\r
-<td bgcolor=#CC9933 onMouseOver=View('CC9933') onClick=Set('CC9933') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCC33 onMouseOver=View('CCCC33') onClick=Set('CCCC33') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFF33 onMouseOver=View('CCFF33') onClick=Set('CCFF33') height="10px" width="10px"></td>\r
-<td bgcolor=#FF0033 onMouseOver=View('FF0033') onClick=Set('FF0033') height="10px" width="10px"></td>\r
-<td bgcolor=#FF3333 onMouseOver=View('FF3333') onClick=Set('FF3333') height="10px" width="10px"></td>\r
-<td bgcolor=#FF6633 onMouseOver=View('FF6633') onClick=Set('FF6633') height="10px" width="10px"></td>\r
-<td bgcolor=#FF9933 onMouseOver=View('FF9933') onClick=Set('FF9933') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCC33 onMouseOver=View('FFCC33') onClick=Set('FFCC33') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFF33 onMouseOver=View('FFFF33') onClick=Set('FFFF33') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#990066 onMouseOver=View('990066') onClick=Set('990066') height="10px" width="10px"></td>\r
-<td bgcolor=#993366 onMouseOver=View('993366') onClick=Set('993366') height="10px" width="10px"></td>\r
-<td bgcolor=#996666 onMouseOver=View('996666') onClick=Set('996666') height="10px" width="10px"></td>\r
-<td bgcolor=#999966 onMouseOver=View('999966') onClick=Set('999966') height="10px" width="10px"></td>\r
-<td bgcolor=#99CC66 onMouseOver=View('99CC66') onClick=Set('99CC66') height="10px" width="10px"></td>\r
-<td bgcolor=#99FF66 onMouseOver=View('99FF66') onClick=Set('99FF66') height="10px" width="10px"></td>\r
-<td bgcolor=#CC0066 onMouseOver=View('CC0066') onClick=Set('CC0066') height="10px" width="10px"></td>\r
-<td bgcolor=#CC3366 onMouseOver=View('CC3366') onClick=Set('CC3366') height="10px" width="10px"></td>\r
-<td bgcolor=#CC6666 onMouseOver=View('CC6666') onClick=Set('CC6666') height="10px" width="10px"></td>\r
-<td bgcolor=#CC9966 onMouseOver=View('CC9966') onClick=Set('CC9966') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCC66 onMouseOver=View('CCCC66') onClick=Set('CCCC66') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFF66 onMouseOver=View('CCFF66') onClick=Set('CCFF66') height="10px" width="10px"></td>\r
-<td bgcolor=#FF0066 onMouseOver=View('FF0066') onClick=Set('FF0066') height="10px" width="10px"></td>\r
-<td bgcolor=#FF3366 onMouseOver=View('FF3366') onClick=Set('FF3366') height="10px" width="10px"></td>\r
-<td bgcolor=#FF6666 onMouseOver=View('FF6666') onClick=Set('FF6666') height="10px" width="10px"></td>\r
-<td bgcolor=#FF9966 onMouseOver=View('FF9966') onClick=Set('FF9966') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCC66 onMouseOver=View('FFCC66') onClick=Set('FFCC66') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFF66 onMouseOver=View('FFFF66') onClick=Set('FFFF66') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#990099 onMouseOver=View('990099') onClick=Set('990099') height="10px" width="10px"></td>\r
-<td bgcolor=#993399 onMouseOver=View('993399') onClick=Set('993399') height="10px" width="10px"></td>\r
-<td bgcolor=#996699 onMouseOver=View('996699') onClick=Set('996699') height="10px" width="10px"></td>\r
-<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>\r
-<td bgcolor=#99CC99 onMouseOver=View('99CC99') onClick=Set('99CC99') height="10px" width="10px"></td>\r
-<td bgcolor=#99FF99 onMouseOver=View('99FF99') onClick=Set('99FF99') height="10px" width="10px"></td>\r
-<td bgcolor=#CC0099 onMouseOver=View('CC0099') onClick=Set('CC0099') height="10px" width="10px"></td>\r
-<td bgcolor=#CC3399 onMouseOver=View('CC3399') onClick=Set('CC3399') height="10px" width="10px"></td>\r
-<td bgcolor=#CC6699 onMouseOver=View('CC6699') onClick=Set('CC6699') height="10px" width="10px"></td>\r
-<td bgcolor=#CC9999 onMouseOver=View('CC9999') onClick=Set('CC9999') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCC99 onMouseOver=View('CCCC99') onClick=Set('CCCC99') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFF99 onMouseOver=View('CCFF99') onClick=Set('CCFF99') height="10px" width="10px"></td>\r
-<td bgcolor=#FF0099 onMouseOver=View('FF0099') onClick=Set('FF0099') height="10px" width="10px"></td>\r
-<td bgcolor=#FF3399 onMouseOver=View('FF3399') onClick=Set('FF3399') height="10px" width="10px"></td>\r
-<td bgcolor=#FF6699 onMouseOver=View('FF6699') onClick=Set('FF6699') height="10px" width="10px"></td>\r
-<td bgcolor=#FF9999 onMouseOver=View('FF9999') onClick=Set('FF9999') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCC99 onMouseOver=View('FFCC99') onClick=Set('FFCC99') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFF99 onMouseOver=View('FFFF99') onClick=Set('FFFF99') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#9900CC onMouseOver=View('9900CC') onClick=Set('9900CC') height="10px" width="10px"></td>\r
-<td bgcolor=#9933CC onMouseOver=View('9933CC') onClick=Set('9933CC') height="10px" width="10px"></td>\r
-<td bgcolor=#9966CC onMouseOver=View('9966CC') onClick=Set('9966CC') height="10px" width="10px"></td>\r
-<td bgcolor=#9999CC onMouseOver=View('9999CC') onClick=Set('9999CC') height="10px" width="10px"></td>\r
-<td bgcolor=#99CCCC onMouseOver=View('99CCCC') onClick=Set('99CCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#99FFCC onMouseOver=View('99FFCC') onClick=Set('99FFCC') height="10px" width="10px"></td>\r
-<td bgcolor=#CC00CC onMouseOver=View('CC00CC') onClick=Set('CC00CC') height="10px" width="10px"></td>\r
-<td bgcolor=#CC33CC onMouseOver=View('CC33CC') onClick=Set('CC33CC') height="10px" width="10px"></td>\r
-<td bgcolor=#CC66CC onMouseOver=View('CC66CC') onClick=Set('CC66CC') height="10px" width="10px"></td>\r
-<td bgcolor=#CC99CC onMouseOver=View('CC99CC') onClick=Set('CC99CC') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFFCC onMouseOver=View('CCFFCC') onClick=Set('CCFFCC') height="10px" width="10px"></td>\r
-<td bgcolor=#FF00CC onMouseOver=View('FF00CC') onClick=Set('FF00CC') height="10px" width="10px"></td>\r
-<td bgcolor=#FF33CC onMouseOver=View('FF33CC') onClick=Set('FF33CC') height="10px" width="10px"></td>\r
-<td bgcolor=#FF66CC onMouseOver=View('FF66CC') onClick=Set('FF66CC') height="10px" width="10px"></td>\r
-<td bgcolor=#FF99CC onMouseOver=View('FF99CC') onClick=Set('FF99CC') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCCCC onMouseOver=View('FFCCCC') onClick=Set('FFCCCC') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFFCC onMouseOver=View('FFFFCC') onClick=Set('FFFFCC') height="10px" width="10px"></td>\r
-</tr>\r
-<tr>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>\r
-<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r
-<td bgcolor=#9900FF onMouseOver=View('9900FF') onClick=Set('9900FF') height="10px" width="10px"></td>\r
-<td bgcolor=#9933FF onMouseOver=View('9933FF') onClick=Set('9933FF') height="10px" width="10px"></td>\r
-<td bgcolor=#9966FF onMouseOver=View('9966FF') onClick=Set('9966FF') height="10px" width="10px"></td>\r
-<td bgcolor=#9999FF onMouseOver=View('9999FF') onClick=Set('9999FF') height="10px" width="10px"></td>\r
-<td bgcolor=#99CCFF onMouseOver=View('99CCFF') onClick=Set('99CCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#99FFFF onMouseOver=View('99FFFF') onClick=Set('99FFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#CC00FF onMouseOver=View('CC00FF') onClick=Set('CC00FF') height="10px" width="10px"></td>\r
-<td bgcolor=#CC33FF onMouseOver=View('CC33FF') onClick=Set('CC33FF') height="10px" width="10px"></td>\r
-<td bgcolor=#CC66FF onMouseOver=View('CC66FF') onClick=Set('CC66FF') height="10px" width="10px"></td>\r
-<td bgcolor=#CC99FF onMouseOver=View('CC99FF') onClick=Set('CC99FF') height="10px" width="10px"></td>\r
-<td bgcolor=#CCCCFF onMouseOver=View('CCCCFF') onClick=Set('CCCCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#CCFFFF onMouseOver=View('CCFFFF') onClick=Set('CCFFFF') height="10px" width="10px"></td>\r
-<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>\r
-<td bgcolor=#FF33FF onMouseOver=View('FF33FF') onClick=Set('FF33FF') height="10px" width="10px"></td>\r
-<td bgcolor=#FF66FF onMouseOver=View('FF66FF') onClick=Set('FF66FF') height="10px" width="10px"></td>\r
-<td bgcolor=#FF99FF onMouseOver=View('FF99FF') onClick=Set('FF99FF') height="10px" width="10px"></td>\r
-<td bgcolor=#FFCCFF onMouseOver=View('FFCCFF') onClick=Set('FFCCFF') height="10px" width="10px"></td>\r
-<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>\r
-</tr>\r
-</table>\r
-\r
-</body></html>\r
+<!-- note: this version of the color picker is optimized for IE 5.5+ only -->\r\r
+\r\r
+<html style="width: 238px; height: 182px"><head><title>Select Color</title>\r\r
+\r\r
+<script type="text/javascript" src="popup.js"></script>\r\r
+\r\r
+<script type="text/javascript">\r\r
+\r\r
+function _CloseOnEsc() {\r\r
+ if (event.keyCode == 27) { window.close(); return; }\r\r
+}\r\r
+\r\r
+function Init() { // run on page load\r\r
+ __dlg_init(); // <!-- this can be found in popup.js -->\r\r
+ document.body.onkeypress = _CloseOnEsc;\r\r
+\r\r
+ var color = window.dialogArguments;\r\r
+ color = ValidateColor(color) || '000000';\r\r
+ View(color); // set default color\r\r
+}\r\r
+\r\r
+function View(color) { // preview color\r\r
+ document.getElementById("ColorPreview").style.backgroundColor = '#' + color;\r\r
+ document.getElementById("ColorHex").value = '#' + color;\r\r
+}\r\r
+\r\r
+function Set(string) { // select color\r\r
+ var color = ValidateColor(string);\r\r
+ if (color == null) { alert("Invalid color code: " + string); } // invalid color\r\r
+ else { // valid color\r\r
+ View(color); // show selected color\r\r
+ __dlg_close(color);\r\r
+ }\r\r
+}\r\r
+\r\r
+function ValidateColor(string) { // return valid color code\r\r
+ string = string || '';\r\r
+ string = string + "";\r\r
+ string = string.toUpperCase();\r\r
+ var chars = '0123456789ABCDEF';\r\r
+ var out = '';\r\r
+\r\r
+ for (var i=0; i<string.length; i++) { // remove invalid color chars\r\r
+ var schar = string.charAt(i);\r\r
+ if (chars.indexOf(schar) != -1) { out += schar; }\r\r
+ }\r\r
+\r\r
+ if (out.length != 6) { return null; } // check length\r\r
+ return out;\r\r
+}\r\r
+\r\r
+</script>\r\r
+</head>\r\r
+<body style="background:ButtonFace; margin:0px; padding:0px" onload="Init()">\r\r
+\r\r
+<form method="get" style="margin:0px; padding:0px" onSubmit="Set(document.getElementById('ColorHex').value); return false;">\r\r
+<table border="0px" cellspacing="0px" cellpadding="4" width="100%">\r\r
+ <tr>\r\r
+ <td style="background:buttonface" valign=center><div style="background-color: #000000; padding: 1; height: 21px; width: 50px"><div id="ColorPreview" style="height: 100%; width: 100%"></div></div></td>\r\r
+ <td style="background:buttonface" valign=center><input type="text" name="ColorHex"\r\r
+ id="ColorHex" value="" size=15 style="font-size: 12px"></td>\r\r
+ <td style="background:buttonface" width=100%></td>\r\r
+ </tr>\r\r
+</table>\r\r
+</form>\r\r
+\r\r
+<table border="0" cellspacing="1px" cellpadding="0px" width="100%" bgcolor="#000000" style="cursor: hand;">\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#003300 onMouseOver=View('003300') onClick=Set('003300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#006600 onMouseOver=View('006600') onClick=Set('006600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#009900 onMouseOver=View('009900') onClick=Set('009900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CC00 onMouseOver=View('00CC00') onClick=Set('00CC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#330000 onMouseOver=View('330000') onClick=Set('330000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#333300 onMouseOver=View('333300') onClick=Set('333300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#336600 onMouseOver=View('336600') onClick=Set('336600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#339900 onMouseOver=View('339900') onClick=Set('339900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CC00 onMouseOver=View('33CC00') onClick=Set('33CC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FF00 onMouseOver=View('33FF00') onClick=Set('33FF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#660000 onMouseOver=View('660000') onClick=Set('660000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#663300 onMouseOver=View('663300') onClick=Set('663300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#666600 onMouseOver=View('666600') onClick=Set('666600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#669900 onMouseOver=View('669900') onClick=Set('669900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CC00 onMouseOver=View('66CC00') onClick=Set('66CC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FF00 onMouseOver=View('66FF00') onClick=Set('66FF00') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000033 onMouseOver=View('000033') onClick=Set('000033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#003333 onMouseOver=View('003333') onClick=Set('003333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#006633 onMouseOver=View('006633') onClick=Set('006633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#009933 onMouseOver=View('009933') onClick=Set('009933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CC33 onMouseOver=View('00CC33') onClick=Set('00CC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FF33 onMouseOver=View('00FF33') onClick=Set('00FF33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#330033 onMouseOver=View('330033') onClick=Set('330033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#333333 onMouseOver=View('333333') onClick=Set('333333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#336633 onMouseOver=View('336633') onClick=Set('336633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#339933 onMouseOver=View('339933') onClick=Set('339933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CC33 onMouseOver=View('33CC33') onClick=Set('33CC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FF33 onMouseOver=View('33FF33') onClick=Set('33FF33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#660033 onMouseOver=View('660033') onClick=Set('660033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#663333 onMouseOver=View('663333') onClick=Set('663333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#666633 onMouseOver=View('666633') onClick=Set('666633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#669933 onMouseOver=View('669933') onClick=Set('669933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CC33 onMouseOver=View('66CC33') onClick=Set('66CC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FF33 onMouseOver=View('66FF33') onClick=Set('66FF33') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000066 onMouseOver=View('000066') onClick=Set('000066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#003366 onMouseOver=View('003366') onClick=Set('003366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#006666 onMouseOver=View('006666') onClick=Set('006666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#009966 onMouseOver=View('009966') onClick=Set('009966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CC66 onMouseOver=View('00CC66') onClick=Set('00CC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FF66 onMouseOver=View('00FF66') onClick=Set('00FF66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#330066 onMouseOver=View('330066') onClick=Set('330066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#333366 onMouseOver=View('333366') onClick=Set('333366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#336666 onMouseOver=View('336666') onClick=Set('336666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#339966 onMouseOver=View('339966') onClick=Set('339966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CC66 onMouseOver=View('33CC66') onClick=Set('33CC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FF66 onMouseOver=View('33FF66') onClick=Set('33FF66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#660066 onMouseOver=View('660066') onClick=Set('660066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#663366 onMouseOver=View('663366') onClick=Set('663366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#666666 onMouseOver=View('666666') onClick=Set('666666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#669966 onMouseOver=View('669966') onClick=Set('669966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CC66 onMouseOver=View('66CC66') onClick=Set('66CC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FF66 onMouseOver=View('66FF66') onClick=Set('66FF66') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000099 onMouseOver=View('000099') onClick=Set('000099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#003399 onMouseOver=View('003399') onClick=Set('003399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#006699 onMouseOver=View('006699') onClick=Set('006699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#009999 onMouseOver=View('009999') onClick=Set('009999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CC99 onMouseOver=View('00CC99') onClick=Set('00CC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FF99 onMouseOver=View('00FF99') onClick=Set('00FF99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#330099 onMouseOver=View('330099') onClick=Set('330099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#333399 onMouseOver=View('333399') onClick=Set('333399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#336699 onMouseOver=View('336699') onClick=Set('336699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#339999 onMouseOver=View('339999') onClick=Set('339999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CC99 onMouseOver=View('33CC99') onClick=Set('33CC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FF99 onMouseOver=View('33FF99') onClick=Set('33FF99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#660099 onMouseOver=View('660099') onClick=Set('660099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#663399 onMouseOver=View('663399') onClick=Set('663399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#666699 onMouseOver=View('666699') onClick=Set('666699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#669999 onMouseOver=View('669999') onClick=Set('669999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CC99 onMouseOver=View('66CC99') onClick=Set('66CC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FF99 onMouseOver=View('66FF99') onClick=Set('66FF99') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0000CC onMouseOver=View('0000CC') onClick=Set('0000CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0033CC onMouseOver=View('0033CC') onClick=Set('0033CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0066CC onMouseOver=View('0066CC') onClick=Set('0066CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0099CC onMouseOver=View('0099CC') onClick=Set('0099CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CCCC onMouseOver=View('00CCCC') onClick=Set('00CCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FFCC onMouseOver=View('00FFCC') onClick=Set('00FFCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3300CC onMouseOver=View('3300CC') onClick=Set('3300CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3333CC onMouseOver=View('3333CC') onClick=Set('3333CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3366CC onMouseOver=View('3366CC') onClick=Set('3366CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3399CC onMouseOver=View('3399CC') onClick=Set('3399CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CCCC onMouseOver=View('33CCCC') onClick=Set('33CCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FFCC onMouseOver=View('33FFCC') onClick=Set('33FFCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6600CC onMouseOver=View('6600CC') onClick=Set('6600CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6633CC onMouseOver=View('6633CC') onClick=Set('6633CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6666CC onMouseOver=View('6666CC') onClick=Set('6666CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6699CC onMouseOver=View('6699CC') onClick=Set('6699CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CCCC onMouseOver=View('66CCCC') onClick=Set('66CCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FFCC onMouseOver=View('66FFCC') onClick=Set('66FFCC') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0033FF onMouseOver=View('0033FF') onClick=Set('0033FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0066FF onMouseOver=View('0066FF') onClick=Set('0066FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0099FF onMouseOver=View('0099FF') onClick=Set('0099FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00CCFF onMouseOver=View('00CCFF') onClick=Set('00CCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3300FF onMouseOver=View('3300FF') onClick=Set('3300FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3333FF onMouseOver=View('3333FF') onClick=Set('3333FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3366FF onMouseOver=View('3366FF') onClick=Set('3366FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#3399FF onMouseOver=View('3399FF') onClick=Set('3399FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33CCFF onMouseOver=View('33CCFF') onClick=Set('33CCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#33FFFF onMouseOver=View('33FFFF') onClick=Set('33FFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6600FF onMouseOver=View('6600FF') onClick=Set('6600FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6633FF onMouseOver=View('6633FF') onClick=Set('6633FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6666FF onMouseOver=View('6666FF') onClick=Set('6666FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#6699FF onMouseOver=View('6699FF') onClick=Set('6699FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66CCFF onMouseOver=View('66CCFF') onClick=Set('66CCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#66FFFF onMouseOver=View('66FFFF') onClick=Set('66FFFF') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#990000 onMouseOver=View('990000') onClick=Set('990000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#993300 onMouseOver=View('993300') onClick=Set('993300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#996600 onMouseOver=View('996600') onClick=Set('996600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#999900 onMouseOver=View('999900') onClick=Set('999900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CC00 onMouseOver=View('99CC00') onClick=Set('99CC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FF00 onMouseOver=View('99FF00') onClick=Set('99FF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC0000 onMouseOver=View('CC0000') onClick=Set('CC0000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC3300 onMouseOver=View('CC3300') onClick=Set('CC3300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC6600 onMouseOver=View('CC6600') onClick=Set('CC6600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC9900 onMouseOver=View('CC9900') onClick=Set('CC9900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCC00 onMouseOver=View('CCCC00') onClick=Set('CCCC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFF00 onMouseOver=View('CCFF00') onClick=Set('CCFF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF0000 onMouseOver=View('FF0000') onClick=Set('FF0000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF3300 onMouseOver=View('FF3300') onClick=Set('FF3300') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF6600 onMouseOver=View('FF6600') onClick=Set('FF6600') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF9900 onMouseOver=View('FF9900') onClick=Set('FF9900') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCC00 onMouseOver=View('FFCC00') onClick=Set('FFCC00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FF00 onMouseOver=View('00FF00') onClick=Set('00FF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#990033 onMouseOver=View('990033') onClick=Set('990033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#993333 onMouseOver=View('993333') onClick=Set('993333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#996633 onMouseOver=View('996633') onClick=Set('996633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#999933 onMouseOver=View('999933') onClick=Set('999933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CC33 onMouseOver=View('99CC33') onClick=Set('99CC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FF33 onMouseOver=View('99FF33') onClick=Set('99FF33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC0033 onMouseOver=View('CC0033') onClick=Set('CC0033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC3333 onMouseOver=View('CC3333') onClick=Set('CC3333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC6633 onMouseOver=View('CC6633') onClick=Set('CC6633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC9933 onMouseOver=View('CC9933') onClick=Set('CC9933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCC33 onMouseOver=View('CCCC33') onClick=Set('CCCC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFF33 onMouseOver=View('CCFF33') onClick=Set('CCFF33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF0033 onMouseOver=View('FF0033') onClick=Set('FF0033') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF3333 onMouseOver=View('FF3333') onClick=Set('FF3333') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF6633 onMouseOver=View('FF6633') onClick=Set('FF6633') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF9933 onMouseOver=View('FF9933') onClick=Set('FF9933') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCC33 onMouseOver=View('FFCC33') onClick=Set('FFCC33') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFF33 onMouseOver=View('FFFF33') onClick=Set('FFFF33') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#0000FF onMouseOver=View('0000FF') onClick=Set('0000FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#990066 onMouseOver=View('990066') onClick=Set('990066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#993366 onMouseOver=View('993366') onClick=Set('993366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#996666 onMouseOver=View('996666') onClick=Set('996666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#999966 onMouseOver=View('999966') onClick=Set('999966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CC66 onMouseOver=View('99CC66') onClick=Set('99CC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FF66 onMouseOver=View('99FF66') onClick=Set('99FF66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC0066 onMouseOver=View('CC0066') onClick=Set('CC0066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC3366 onMouseOver=View('CC3366') onClick=Set('CC3366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC6666 onMouseOver=View('CC6666') onClick=Set('CC6666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC9966 onMouseOver=View('CC9966') onClick=Set('CC9966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCC66 onMouseOver=View('CCCC66') onClick=Set('CCCC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFF66 onMouseOver=View('CCFF66') onClick=Set('CCFF66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF0066 onMouseOver=View('FF0066') onClick=Set('FF0066') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF3366 onMouseOver=View('FF3366') onClick=Set('FF3366') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF6666 onMouseOver=View('FF6666') onClick=Set('FF6666') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF9966 onMouseOver=View('FF9966') onClick=Set('FF9966') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCC66 onMouseOver=View('FFCC66') onClick=Set('FFCC66') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFF66 onMouseOver=View('FFFF66') onClick=Set('FFFF66') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFF00 onMouseOver=View('FFFF00') onClick=Set('FFFF00') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#990099 onMouseOver=View('990099') onClick=Set('990099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#993399 onMouseOver=View('993399') onClick=Set('993399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#996699 onMouseOver=View('996699') onClick=Set('996699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#999999 onMouseOver=View('999999') onClick=Set('999999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CC99 onMouseOver=View('99CC99') onClick=Set('99CC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FF99 onMouseOver=View('99FF99') onClick=Set('99FF99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC0099 onMouseOver=View('CC0099') onClick=Set('CC0099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC3399 onMouseOver=View('CC3399') onClick=Set('CC3399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC6699 onMouseOver=View('CC6699') onClick=Set('CC6699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC9999 onMouseOver=View('CC9999') onClick=Set('CC9999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCC99 onMouseOver=View('CCCC99') onClick=Set('CCCC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFF99 onMouseOver=View('CCFF99') onClick=Set('CCFF99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF0099 onMouseOver=View('FF0099') onClick=Set('FF0099') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF3399 onMouseOver=View('FF3399') onClick=Set('FF3399') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF6699 onMouseOver=View('FF6699') onClick=Set('FF6699') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF9999 onMouseOver=View('FF9999') onClick=Set('FF9999') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCC99 onMouseOver=View('FFCC99') onClick=Set('FFCC99') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFF99 onMouseOver=View('FFFF99') onClick=Set('FFFF99') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#00FFFF onMouseOver=View('00FFFF') onClick=Set('00FFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9900CC onMouseOver=View('9900CC') onClick=Set('9900CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9933CC onMouseOver=View('9933CC') onClick=Set('9933CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9966CC onMouseOver=View('9966CC') onClick=Set('9966CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9999CC onMouseOver=View('9999CC') onClick=Set('9999CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CCCC onMouseOver=View('99CCCC') onClick=Set('99CCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FFCC onMouseOver=View('99FFCC') onClick=Set('99FFCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC00CC onMouseOver=View('CC00CC') onClick=Set('CC00CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC33CC onMouseOver=View('CC33CC') onClick=Set('CC33CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC66CC onMouseOver=View('CC66CC') onClick=Set('CC66CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC99CC onMouseOver=View('CC99CC') onClick=Set('CC99CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCCCC onMouseOver=View('CCCCCC') onClick=Set('CCCCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFFCC onMouseOver=View('CCFFCC') onClick=Set('CCFFCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF00CC onMouseOver=View('FF00CC') onClick=Set('FF00CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF33CC onMouseOver=View('FF33CC') onClick=Set('FF33CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF66CC onMouseOver=View('FF66CC') onClick=Set('FF66CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF99CC onMouseOver=View('FF99CC') onClick=Set('FF99CC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCCCC onMouseOver=View('FFCCCC') onClick=Set('FFCCCC') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFFCC onMouseOver=View('FFFFCC') onClick=Set('FFFFCC') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+<tr>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#000000 onMouseOver=View('000000') onClick=Set('000000') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9900FF onMouseOver=View('9900FF') onClick=Set('9900FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9933FF onMouseOver=View('9933FF') onClick=Set('9933FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9966FF onMouseOver=View('9966FF') onClick=Set('9966FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#9999FF onMouseOver=View('9999FF') onClick=Set('9999FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99CCFF onMouseOver=View('99CCFF') onClick=Set('99CCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#99FFFF onMouseOver=View('99FFFF') onClick=Set('99FFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC00FF onMouseOver=View('CC00FF') onClick=Set('CC00FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC33FF onMouseOver=View('CC33FF') onClick=Set('CC33FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC66FF onMouseOver=View('CC66FF') onClick=Set('CC66FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CC99FF onMouseOver=View('CC99FF') onClick=Set('CC99FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCCCFF onMouseOver=View('CCCCFF') onClick=Set('CCCCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#CCFFFF onMouseOver=View('CCFFFF') onClick=Set('CCFFFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF00FF onMouseOver=View('FF00FF') onClick=Set('FF00FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF33FF onMouseOver=View('FF33FF') onClick=Set('FF33FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF66FF onMouseOver=View('FF66FF') onClick=Set('FF66FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FF99FF onMouseOver=View('FF99FF') onClick=Set('FF99FF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFCCFF onMouseOver=View('FFCCFF') onClick=Set('FFCCFF') height="10px" width="10px"></td>\r\r
+<td bgcolor=#FFFFFF onMouseOver=View('FFFFFF') onClick=Set('FFFFFF') height="10px" width="10px"></td>\r\r
+</tr>\r\r
+</table>\r\r
+\r\r
+</body></html>\r\r
-function PopupWin(editor, title, handler, initFunction) {
- this.editor = editor;
- this.handler = handler;
- var dlg = window.open("", "__ha_dialog",
- "toolbar=no,menubar=no,personalbar=no,width=600,height=600," +
- "scrollbars=no,resizable=no");
- this.window = dlg;
- var doc = dlg.document;
- this.doc = doc;
- var self = this;
-
- var base = document.baseURI || document.URL;
- if (base && base.match(/(.*)\/([^\/]+)/)) {
- base = RegExp.$1 + "/";
- }
- this.baseURL = base;
-
- doc.open();
- var html = "<html><head><title>" + title + "</title>\n";
- // html += "<base href='" + base + "htmlarea.js' />\n";
- html += "<style type='text/css'>@import url(" + base + "htmlarea.css);</style></head>\n";
- html += "<body class='dialog popupwin' id='--HA-body'></body></html>";
- doc.write(html);
- doc.close();
-
- // sometimes I Hate Mozilla... ;-(
- function init2() {
- var body = doc.body;
- if (!body) {
- setTimeout(init2, 25);
- return false;
- }
- dlg.title = title;
- doc.documentElement.style.padding = "0px";
- doc.documentElement.style.margin = "0px";
- var content = doc.createElement("div");
- content.className = "content";
- self.content = content;
- body.appendChild(content);
- self.element = body;
- initFunction(self);
- dlg.focus();
- };
- init2();
-};
-
-PopupWin.prototype.callHandler = function() {
- var tags = ["input", "textarea", "select"];
- var params = new Object();
- for (var ti in tags) {
- var tag = tags[ti];
- var els = this.content.getElementsByTagName(tag);
- for (var j = 0; j < els.length; ++j) {
- var el = els[j];
- var val = el.value;
- if (el.tagName.toLowerCase() == "input") {
- if (el.type == "checkbox") {
- val = el.checked;
- }
- }
- params[el.name] = val;
- }
- }
- this.handler(this, params);
- return false;
-};
-
-PopupWin.prototype.close = function() {
- this.window.close();
-};
-
-PopupWin.prototype.addButtons = function() {
- var self = this;
- var div = this.doc.createElement("div");
- this.content.appendChild(div);
- div.className = "buttons";
- for (var i = 0; i < arguments.length; ++i) {
- var btn = arguments[i];
- var button = this.doc.createElement("button");
- div.appendChild(button);
- button.innerHTML = HTMLArea.I18N.buttons[btn];
- switch (btn) {
- case "ok":
- button.onclick = function() {
- self.callHandler();
- self.close();
- return false;
- };
- break;
- case "cancel":
- button.onclick = function() {
- self.close();
- return false;
- };
- break;
- }
- }
-};
-
-PopupWin.prototype.showAtElement = function() {
- var self = this;
- // Mozilla needs some time to realize what's goin' on..
- setTimeout(function() {
- var w = self.content.offsetWidth + 4;
- var h = self.content.offsetHeight + 4;
- // size to content -- that's fuckin' buggy in all fuckin' browsers!!!
- // so that we set a larger size for the dialog window and then center
- // the element inside... phuck!
-
- // center...
- var el = self.content;
- var s = el.style;
- // s.width = el.offsetWidth + "px";
- // s.height = el.offsetHeight + "px";
- s.position = "absolute";
- s.left = (w - el.offsetWidth) / 2 + "px";
- s.top = (h - el.offsetHeight) / 2 + "px";
- if (HTMLArea.is_gecko) {
- self.window.innerWidth = w;
- self.window.innerHeight = h;
- } else {
- self.window.resizeTo(w + 8, h + 35);
- }
- }, 25);
-};
+function PopupWin(editor, title, handler, initFunction) {\r
+ this.editor = editor;\r
+ this.handler = handler;\r
+ var dlg = window.open("", "__ha_dialog",\r
+ "toolbar=no,menubar=no,personalbar=no,width=600,height=600," +\r
+ "scrollbars=no,resizable=no");\r
+ this.window = dlg;\r
+ var doc = dlg.document;\r
+ this.doc = doc;\r
+ var self = this;\r
+\r
+ var base = document.baseURI || document.URL;\r
+ if (base && base.match(/(.*)\/([^\/]+)/)) {\r
+ base = RegExp.$1 + "/";\r
+ }\r
+ this.baseURL = base;\r
+\r
+ doc.open();\r
+ var html = "<html><head><title>" + title + "</title>\n";\r
+ // html += "<base href='" + base + "htmlarea.js' />\n";\r
+ html += "<style type='text/css'>@import url(" + base + "htmlarea.css);</style></head>\n";\r
+ html += "<body class='dialog popupwin' id='--HA-body'></body></html>";\r
+ doc.write(html);\r
+ doc.close();\r
+\r
+ // sometimes I Hate Mozilla... ;-(\r
+ function init2() {\r
+ var body = doc.body;\r
+ if (!body) {\r
+ setTimeout(init2, 25);\r
+ return false;\r
+ }\r
+ dlg.title = title;\r
+ doc.documentElement.style.padding = "0px";\r
+ doc.documentElement.style.margin = "0px";\r
+ var content = doc.createElement("div");\r
+ content.className = "content";\r
+ self.content = content;\r
+ body.appendChild(content);\r
+ self.element = body;\r
+ initFunction(self);\r
+ dlg.focus();\r
+ };\r
+ init2();\r
+};\r
+\r
+PopupWin.prototype.callHandler = function() {\r
+ var tags = ["input", "textarea", "select"];\r
+ var params = new Object();\r
+ for (var ti in tags) {\r
+ var tag = tags[ti];\r
+ var els = this.content.getElementsByTagName(tag);\r
+ for (var j = 0; j < els.length; ++j) {\r
+ var el = els[j];\r
+ var val = el.value;\r
+ if (el.tagName.toLowerCase() == "input") {\r
+ if (el.type == "checkbox") {\r
+ val = el.checked;\r
+ }\r
+ }\r
+ params[el.name] = val;\r
+ }\r
+ }\r
+ this.handler(this, params);\r
+ return false;\r
+};\r
+\r
+PopupWin.prototype.close = function() {\r
+ this.window.close();\r
+};\r
+\r
+PopupWin.prototype.addButtons = function() {\r
+ var self = this;\r
+ var div = this.doc.createElement("div");\r
+ this.content.appendChild(div);\r
+ div.className = "buttons";\r
+ for (var i = 0; i < arguments.length; ++i) {\r
+ var btn = arguments[i];\r
+ var button = this.doc.createElement("button");\r
+ div.appendChild(button);\r
+ button.innerHTML = HTMLArea.I18N.buttons[btn];\r
+ switch (btn) {\r
+ case "ok":\r
+ button.onclick = function() {\r
+ self.callHandler();\r
+ self.close();\r
+ return false;\r
+ };\r
+ break;\r
+ case "cancel":\r
+ button.onclick = function() {\r
+ self.close();\r
+ return false;\r
+ };\r
+ break;\r
+ }\r
+ }\r
+};\r
+\r
+PopupWin.prototype.showAtElement = function() {\r
+ var self = this;\r
+ // Mozilla needs some time to realize what's goin' on..\r
+ setTimeout(function() {\r
+ var w = self.content.offsetWidth + 4;\r
+ var h = self.content.offsetHeight + 4;\r
+ // size to content -- that's fuckin' buggy in all fuckin' browsers!!!\r
+ // so that we set a larger size for the dialog window and then center\r
+ // the element inside... phuck!\r
+\r
+ // center...\r
+ var el = self.content;\r
+ var s = el.style;\r
+ // s.width = el.offsetWidth + "px";\r
+ // s.height = el.offsetHeight + "px";\r
+ s.position = "absolute";\r
+ s.left = (w - el.offsetWidth) / 2 + "px";\r
+ s.top = (h - el.offsetHeight) / 2 + "px";\r
+ if (HTMLArea.is_gecko) {\r
+ self.window.innerWidth = w;\r
+ self.window.innerHeight = h;\r
+ } else {\r
+ self.window.resizeTo(w + 8, h + 35);\r
+ }\r
+ }, 25);\r
+};\r
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">
-<html>
- <head>
- <title>HTMLArea-3.0-beta release notes</title>
- </head>
-
- <body>
-
- <h1>HTMLArea-3.0-beta release notes</h1>
-
- <p>This release was compiled on Aug 11, 2003 [21:30] GMT.</p>
-
-
- <p>Changes since 3.0-Alpha:</p>
-
- <ul>
-
- <li>Performance improvements.</li>
-
- <li>Many bugs fixed.</li>
-
- <li>Plugin infrastructure.</li>
-
- <li>TableOperations plugin.</li>
-
- <li>SpellChecker plugin.</li>
-
- <li>Status bar.</li>
-
- <li>API for registering custom buttons and drop-down boxes in the
- toolbar.</li>
-
- <li>Toolbar can contain text labels.</li>
-
- <li>Cut, copy, paste, undo, redo buttons.</li>
-
- </ul>
-
- <h2>Rationale for Beta</h2>
-
- <p>Why was this released as "Beta"? The code is quite stable and it
- didn't deserve a "Beta" qualification. However, there are some things
- left to do for the real 3.0 version. These things will not affect the
- API to work with HTMLArea, in other words, you can install the Beta
- right now and then install the final release without modifying your
- code. That's if you don't modify HTMLArea itself. ;-)</p>
-
- <h2>To-Do before 3.0 final</h2>
-
- <ol>
-
- <li>We should use a single popup interface. Currently there are two:
- dialog.js and popupwin.js; dialog.js emulates modal dialogs, which
- sucks when you want to open "select-color" from another popup and not
- from the editor itself. Very buggy in IE. We should probably use only
- modeless dialogs (that is, popupwin.js).</li>
-
- <li>Internationalization for the SpellChecker plugin.</li>
-
- <li>Internationalization for the TableOperations plugin.</li>
-
- <li>People who sent translations are invited to re-iterate through
- their work and make it up-to-date with lang/en.js which is the main
- lang file for HTMLArea-3.0. Some things have changed but not all
- translations are updated.</li>
-
- <li><strong>Documentation</strong>.</li>
-
- </ol>
-
-
- <hr />
- <address><a href="http://students.infoiasi.ro/~mishoo/">Mihai Bazon</a></address>
-<!-- Created: Sun Aug 3 16:55:08 EEST 2003 -->
-<!-- hhmts start -->
-Last modified on Sun Aug 10 19:31:39 2003
-<!-- hhmts end -->
-<!-- doc-lang: English -->
- </body>
-</html>
-
-
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.2//EN">\r
+<html>\r
+ <head>\r
+ <title>HTMLArea-3.0-beta release notes</title>\r
+ </head>\r
+\r
+ <body>\r
+\r
+ <h1>HTMLArea-3.0-beta release notes</h1>\r
+\r
+ <p>This release was compiled on Aug 11, 2003 [21:30] GMT.</p>\r
+\r
+\r
+ <p>Changes since 3.0-Alpha:</p>\r
+\r
+ <ul>\r
+\r
+ <li>Performance improvements.</li>\r
+\r
+ <li>Many bugs fixed.</li>\r
+\r
+ <li>Plugin infrastructure.</li>\r
+\r
+ <li>TableOperations plugin.</li>\r
+\r
+ <li>SpellChecker plugin.</li>\r
+\r
+ <li>Status bar.</li>\r
+\r
+ <li>API for registering custom buttons and drop-down boxes in the\r
+ toolbar.</li>\r
+\r
+ <li>Toolbar can contain text labels.</li>\r
+\r
+ <li>Cut, copy, paste, undo, redo buttons.</li>\r
+\r
+ </ul>\r
+\r
+ <h2>Rationale for Beta</h2>\r
+\r
+ <p>Why was this released as "Beta"? The code is quite stable and it\r
+ didn't deserve a "Beta" qualification. However, there are some things\r
+ left to do for the real 3.0 version. These things will not affect the\r
+ API to work with HTMLArea, in other words, you can install the Beta\r
+ right now and then install the final release without modifying your\r
+ code. That's if you don't modify HTMLArea itself. ;-)</p>\r
+\r
+ <h2>To-Do before 3.0 final</h2>\r
+\r
+ <ol>\r
+\r
+ <li>We should use a single popup interface. Currently there are two:\r
+ dialog.js and popupwin.js; dialog.js emulates modal dialogs, which\r
+ sucks when you want to open "select-color" from another popup and not\r
+ from the editor itself. Very buggy in IE. We should probably use only\r
+ modeless dialogs (that is, popupwin.js).</li>\r
+\r
+ <li>Internationalization for the SpellChecker plugin.</li>\r
+\r
+ <li>Internationalization for the TableOperations plugin.</li>\r
+\r
+ <li>People who sent translations are invited to re-iterate through\r
+ their work and make it up-to-date with lang/en.js which is the main\r
+ lang file for HTMLArea-3.0. Some things have changed but not all\r
+ translations are updated.</li>\r
+\r
+ <li><strong>Documentation</strong>.</li>\r
+\r
+ </ol>\r
+\r
+\r
+ <hr />\r
+ <address><a href="http://students.infoiasi.ro/~mishoo/">Mihai Bazon</a></address>\r
+<!-- Created: Sun Aug 3 16:55:08 EEST 2003 -->\r
+<!-- hhmts start -->\r
+Last modified on Sun Aug 10 19:31:39 2003\r
+<!-- hhmts end -->\r
+<!-- doc-lang: English -->\r
+ </body>\r
+</html>\r
+\r
+\r