From: moodler Date: Sat, 21 Feb 2004 05:49:31 +0000 (+0000) Subject: Many updates from Janne. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=a87491c1d05f1848b9d53e01c2d377c7e6c6a528;p=moodle.git Many updates from Janne. I've done a basic review and fixed a few things, but there will need to be a lot more testing and cleanup over this weekend. --- diff --git a/lib/editor/coursefiles.php b/lib/editor/coursefiles.php new file mode 100644 index 0000000000..2edf2e6e4f --- /dev/null +++ b/lib/editor/coursefiles.php @@ -0,0 +1,955 @@ +id); + + if (! isteacher($course->id) ) { + error("Only teachers can edit files"); + } + + function html_footer() { + echo ""; + } + + function html_header($course, $wdir, $formfield=""){ + + global $CFG; + + if (! $site = get_site()) { + error("Invalid site!"); + } + + ?> + + + coursefiles + + + + + + 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 "

$struploadafile ($strmaxsize) --> $wdir"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo " "; + echo ""; + echo ""; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } + html_footer(); + break; + + case "delete": + if (!empty($confirm)) { + html_header($course, $wdir); + foreach ($USER->filelist as $file) { + $fullfile = $basedir.$file; + if (! fulldelete($fullfile)) { + echo "
Error: Could not delete: $fullfile"; + } + } + clearfilelist(); + displaydir($wdir); + html_footer(); + + } else { + html_header($course, $wdir); + if (setfilelist($_POST)) { + echo "

".get_string("deletecheckwarning").":

"; + print_simple_box_start("center"); + printfilelist($USER->filelist); + print_simple_box_end(); + echo "
"; + 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 "

"; + print_string("selectednowmove", "moodle", $count); + echo "

"; + } + 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 "

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 "

$strrenamefileto:"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } + 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 "

$strcreatefolder:"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } + 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", "", "$file"); + $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 "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + print_textarea($usehtmleditor, 25, 80, 680, 400, "text", $contents); + echo "
"; + echo " "; + echo ""; + echo ""; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + + 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 "

".get_string("youareabouttocreatezip").":

"; + print_simple_box_start("center"); + printfilelist($USER->filelist); + print_simple_box_end(); + echo "
"; + echo "

".get_string("whattocallzip"); + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } 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 "

$strunpacking:

"; + + $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 ""; + echo ""; + echo ""; + echo ""; + echo ""; + foreach ($list as $item) { + echo ""; + $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 ""; + } + $filedate = userdate($item['mtime'], get_string("strftimedatetime")); + print_cell("right", $filedate); + print_cell("right", $item['status']); + echo ""; + } + echo "
$strname$strsize$strmodified$strstatus
 
"; + } + + } else { // Use external unzip program + print_simple_box_start("center"); + echo "
";
+                    $command = "cd $basedir/$wdir ; $CFG->unzip -o $file 2>&1";
+                    passthru($command);
+                    echo "
"; + print_simple_box_end(); + } + + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } 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 "

$strlistfiles:

"; + $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 ""; + echo ""; + foreach ($list as $item) { + echo ""; + print_cell("left", $item['filename']); + if (! $item['folder']) { + print_cell("right", display_size($item['size'])); + } else { + echo ""; + } + $filedate = userdate($item['mtime'], get_string("strftimedatetime")); + print_cell("right", $filedate); + echo ""; + } + echo "
$strname$strsize$strmodified
 
"; + } + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + echo "
"; + } 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 "pixpath/f/folder.gif\" height=\"16\" width=\"16\"> $file
"; + $subfilelist = array(); + $currdir = opendir($basedir.$file); + while ($subfile = readdir($currdir)) { + if ($subfile <> ".." && $subfile <> ".") { + $subfilelist[] = $file."/".$subfile; + } + } + printfilelist($subfilelist); + + } else { + $icon = mimeinfo("icon", $file); + echo "pixpath/f/$icon\" height=\"16\" width=\"16\"> $file
"; + } + } +} + + +function print_cell($alignment="center", $text=" ") { + echo ""; + echo "$text"; + echo "\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 "
"; + echo ""; + //echo ""; + //echo ""; + //echo ""; + //echo ""; + //echo ""; + //echo ""; + //echo "\n"; + + if ($wdir == "/") { + $wdir = ""; + } else { + $bdir = str_replace("/".basename($wdir),"",$wdir); + if($bdir == "/") { + $bdir = ""; + } + print "\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 ""; + + if ($usecheckboxes) { + print_cell("center", ""); + } + print_cell("left", "pixpath/f/folder.gif\" height=16 width=16 border=0 alt=\"folder\">".htmlspecialchars($dir).""); + print_cell("right", " "); + print_cell("right", $filedate); + //print_cell("right", "$strrename"); + + echo ""; + } + } + + + 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 ""; + + if ($usecheckboxes) { + print_cell("center", ""); + } + echo ""; + + + //print_cell("right", display_size($file_size)); + /*if ($icon == "text.gif" || $icon == "html.gif") { + $edittext = "$stredit"; + } else */ + if ($icon == "zip.gif") { + $edittext = "$strunzip "; + $edittext .= "$strlist "; + } /*else if ($icon == "image.gif") { + $edittext = "wwwroot$ffurl','".display_size($file_size)."','$imgtype','$imgwidth','$imgheight')\" href=\"#\">$strchoose"; + } */else { + $edittext = " "; + } + print_cell("right", "$edittext "); + print_cell("right", $filedate); + + echo ""; + } + } + echo "
$strname$strsize$strmodified$straction
"; + print ""; + print "wwwroot/lib/editor/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" ALT=\"Move up\">"; + print "
"; + if ($CFG->slasharguments) { + $ffurl = "/file.php/$id$fileurl"; + } else { + $ffurl = "/file.php?file=/$id$fileurl"; + } + link_to_popup_window ($ffurl, "display", + "pixpath/f/$icon\" height=16 width=16 border=0 align=\"absmiddle\" alt=\"$strfile\">", + 480, 640); + /*echo ""; + link_to_popup_window ($ffurl, "display", + htmlspecialchars($file), + 480, 640);*/ + $file_size = filesize($filename); + ?> + + $file"; + echo "
"; + + if (empty($wdir)) { + $wdir = "/"; + } + + echo ""; + echo ""; + echo ""; + echo "
"; + echo ""; + echo " "; + $options = array ( + "move" => "$strmovetoanotherfolder", + "delete" => "$strdeletecompletely", + "zip" => "$strcreateziparchive" + ); + if (!empty($count)) { + choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:document.dirform.submit()"); + } + + echo ""; + echo ""; + if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) { + echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; + } + echo "
"; + /* echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; */ + echo "
"; + /* echo "
"; + echo " "; + echo " "; + echo " "; + echo " "; + echo "
"; */ + echo "
"; + +} + +?> diff --git a/lib/editor/courseimages.php b/lib/editor/courseimages.php index 254b1f1068..a459d8ba8f 100644 --- a/lib/editor/courseimages.php +++ b/lib/editor/courseimages.php @@ -397,7 +397,7 @@ } clearfilelist(); displaydir($wdir); - + } else { html_header($course, $wdir, "form.name"); @@ -646,7 +646,7 @@ function printfilelist($filelist) { foreach ($filelist as $file) { if (is_dir($basedir.$file)) { - echo "pixpath/f/folder.gif\" height=16 width=16> $file
"; + echo "pixpath/f/folder.gif\" HEIGHT=16 WIDTH=16> $file
"; $subfilelist = array(); $currdir = opendir($basedir.$file); while ($subfile = readdir($currdir)) { @@ -658,7 +658,7 @@ function printfilelist($filelist) { } else { $icon = mimeinfo("icon", $file); - echo "pixpath/f/$icon\" height=16 width=16> $file
"; + echo "pixpath/f/$icon\" HEIGHT=16 WIDTH=16> $file
"; } } } diff --git a/lib/editor/dialog.js b/lib/editor/dialog.js index 435121ae6d..86c4bc0b9c 100644 --- a/lib/editor/dialog.js +++ b/lib/editor/dialog.js @@ -1,72 +1,72 @@ -// 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 +// 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; + }; +}; diff --git a/lib/editor/htmlarea.css b/lib/editor/htmlarea.css index 23bdf7d9db..3f4d914f9a 100644 --- a/lib/editor/htmlarea.css +++ b/lib/editor/htmlarea.css @@ -1,180 +1,180 @@ -.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; } + +.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; } diff --git a/lib/editor/htmlarea.php b/lib/editor/htmlarea.php index 670f78c139..a529a154f5 100644 --- a/lib/editor/htmlarea.php +++ b/lib/editor/htmlarea.php @@ -9,8 +9,8 @@ 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"; @@ -22,20 +22,34 @@ $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 - - - + +Fullscreen Editor + + + + + + + + + + + + + +
+ +
+ + diff --git a/lib/editor/popups/fullscreen.php b/lib/editor/popups/fullscreen.php index 46dadd8803..f0b70dfd80 100644 --- a/lib/editor/popups/fullscreen.php +++ b/lib/editor/popups/fullscreen.php @@ -1,144 +1,164 @@ - - -Fullscreen Editor - - - - - - - - - - - - - -
- -
- - + + +Fullscreen Editor + + + + + + + + + + + + + +
+ +
+ + diff --git a/lib/editor/popups/insert_image.html b/lib/editor/popups/insert_image.html index 292dd35822..06e643301a 100644 --- a/lib/editor/popups/insert_image.html +++ b/lib/editor/popups/insert_image.html @@ -1,215 +1,215 @@ - - - - Insert Image - - - - - - - - - - - -
Insert Image
- -
- - - - - - - - - - - - - -
Image URL: - -
Alternate text:
- -

- -

-Layout - -
- -
Alignment:
- - -

- -

Border thickness:
- - -
- -
- -
-Spacing - -
- -
Horizontal:
- - -

- -

Vertical:
- - -
- -
- -
-
- - -
- -
- - - + + + + Insert Image + + + + + + + + + + + +
Insert Image
+ +
+ + + + + + + + + + + + + +
Image URL: + +
Alternate text:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Horizontal:
+ + +

+ +

Vertical:
+ + +
+ +
+ +
+
+ + +
+ +
+ + + diff --git a/lib/editor/popups/insert_image.php b/lib/editor/popups/insert_image.php index 12068b3f84..ac7945186c 100644 --- a/lib/editor/popups/insert_image.php +++ b/lib/editor/popups/insert_image.php @@ -1,22 +1,38 @@ -fullname = ""; // Just to keep display happy, though browsing may fail } + ?> - Insert Image " /> +<?php print_string("insertimage","editor");?> +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; +} + + + - + - -
- -
- - - - - - - - - - - - - -
: - -
:
- -

- -

- - -
- -
:
- - -

- -

:
- - -
- -
- -
- - -
- -
:
- - -

- -

:
- - -
- -
- -
-
-fullname\" type=\"button\" name=\"browse\" onclick=\"set_url_value()\">".get_string("browse","editor")." \n":""; -?> - - -
- -
- +
+
+
+
+
+ + + + + + + + + + + +
: +
: +
+
+ + + + + + +
+
+
+ + + + + + + + + +
: +
: +
+
 
+
+
+ + + + + + + + + +
: + +
: +
+
+
+ + + + + + + + + +
: + +
: +
+
+ + + + + +
:
+ wwwroot."/lib/editor/coursefiles.php?usecheckboxes=true&id=".$course->id."\" style=\"width: 100%; height: 200px;\">": + "";?> +
:
+ +
+ + + + + + + + +
+ + + + + + + +
:
+ " onclick="return submit_form('delete');" />
+ " onclick="return submit_form('move');" />
+ " onclick="return submit_form('zip');" />
+ + + + + " />
+
+ +
+ +
+
+   : + + : +
+
+
+
+ + + + + " onclick="return checkvalue('foldername','cfolder');" /> +
+
+
+ + + + + + " /> +
+ +
+

 

diff --git a/lib/editor/popups/insert_table.html b/lib/editor/popups/insert_table.html index bdf527c210..ebb6982ed7 100644 --- a/lib/editor/popups/insert_table.html +++ b/lib/editor/popups/insert_table.html @@ -1,173 +1,173 @@ - - - - Insert Table - - - - - - - - - - - -
Insert Table
- -
- - - - - - - - - - - - - - - - - - - -
Rows:
Cols:Width:
- -

- -

-Layout - -
- -
Alignment:
- - -

- -

Border thickness:
- - -
- -
- -
-Spacing - -
- -
Cell spacing:
- - -

- -

Cell padding:
- - -
- -
- -
-
- - -
- -
- - - + + + + Insert Table + + + + + + + + + + + +
Insert Table
+ +
+ + + + + + + + + + + + + + + + + + + +
Rows:
Cols:Width:
+ +

+ +

+Layout + +
+ +
Alignment:
+ + +

+ +

Border thickness:
+ + +
+ +
+ +
+Spacing + +
+ +
Cell spacing:
+ + +

+ +

Cell padding:
+ + +
+ +
+ +
+
+ + +
+ +
+ + + diff --git a/lib/editor/popups/insert_table.php b/lib/editor/popups/insert_table.php index 53555ab56d..17029558ce 100644 --- a/lib/editor/popups/insert_table.php +++ b/lib/editor/popups/insert_table.php @@ -1,176 +1,176 @@ - - - -" /> - Insert Table - - - - - - - - - -
- -
- - - - - - - - - - - - - - - - - - - -
:
::
- -

- -

- - -
- -
:
- - -

- -

:
- - -
- -
- -
- - -
- -
:
- - -

- -

:
- - -
- -
- -
-
- - -
- -
- - - + + + +" /> + Insert Table + + + + + + + + + +
+ +
+ + + + + + + + + + + + + + + + + + + +
:
::
+ +

+ +

+ + +
+ +
:
+ + +

+ +

:
+ + +
+ +
+ +
+ + +
+ +
:
+ + +

+ +

:
+ + +
+ +
+ +
+
+ + +
+ +
+ + + diff --git a/lib/editor/popups/link.html b/lib/editor/popups/link.html new file mode 100644 index 0000000000..97a9edac40 --- /dev/null +++ b/lib/editor/popups/link.html @@ -0,0 +1,221 @@ + + + +testaus + + + + + + + +
Lisää linkki
+ + + + + +
+ Tiedosto selain + +
+ +

+

+ + + +   + +

+
+
 
+
+
+ Tiedoston ominaisuudet +
+ + + + + + + + + + + + + +
Luotu:
Tyyppi:
Koko:
+
+
+
Linkin ominaisuudet +
+ + + + + + + + + + + + + +
Osoite:
Otsikko:
Kohde:
+
+ + + + +
  +
+
+
+
+
+

 

+ + diff --git a/lib/editor/popups/link.php b/lib/editor/popups/link.php new file mode 100644 index 0000000000..940cbf4545 --- /dev/null +++ b/lib/editor/popups/link.php @@ -0,0 +1,230 @@ +fullname = ""; // Just to keep display happy, though browsing may fail + } +?> + + + +testaus +"> + + + + + + +
+ + + + + +
+ + +
+ id."\" width=\"360\" height=\"260\">": + ""; ?> +

+

+
+
 
+
+
+ +
+ + + + + + + + + + + + + +
:
:
:
+
+
+
+
+ + + + + + + + + + + + + +
:
:
:
+
+ + + + +
  +
+
+
+
+
+

 

+ + diff --git a/lib/editor/popups/popup.js b/lib/editor/popups/popup.js index 0b075fcf37..64852fe7fd 100644 --- a/lib/editor/popups/popup.js +++ b/lib/editor/popups/popup.js @@ -1,43 +1,43 @@ -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() { + 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(); +}; diff --git a/lib/editor/popups/preview.php b/lib/editor/popups/preview.php new file mode 100644 index 0000000000..dd39333c7b --- /dev/null +++ b/lib/editor/popups/preview.php @@ -0,0 +1,48 @@ +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 "\n"; + echo "\n"; + echo "Preview\n"; + echo "\n"; + echo "\n"; + echo "\n"; + print "\"\""; + echo "\n\n"; + +?> diff --git a/lib/editor/popups/select_color.html b/lib/editor/popups/select_color.html index 2209b92a13..ce527c28d3 100644 --- a/lib/editor/popups/select_color.html +++ b/lib/editor/popups/select_color.html @@ -1,346 +1,346 @@ - - -Select Color - - - - - - - -
- - - - - - -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - + + +Select Color + + + + + + + +
+ + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + diff --git a/lib/editor/popupwin.js b/lib/editor/popupwin.js index 8d37f254fe..7ce9ef95f3 100644 --- a/lib/editor/popupwin.js +++ b/lib/editor/popupwin.js @@ -1,125 +1,125 @@ -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 = "" + title + "\n"; - // html += "\n"; - html += "\n"; - 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) { + 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 = "" + title + "\n"; + // html += "\n"; + html += "\n"; + 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); +}; diff --git a/lib/editor/release-notes.html b/lib/editor/release-notes.html index f37d40a160..cdc820ca7e 100644 --- a/lib/editor/release-notes.html +++ b/lib/editor/release-notes.html @@ -1,82 +1,82 @@ - - - - HTMLArea-3.0-beta release notes - - - - -

HTMLArea-3.0-beta release notes

- -

This release was compiled on Aug 11, 2003 [21:30] GMT.

- - -

Changes since 3.0-Alpha:

- - - -

Rationale for Beta

- -

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. ;-)

- -

To-Do before 3.0 final

- -
    - -
  1. 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).
  2. - -
  3. Internationalization for the SpellChecker plugin.
  4. - -
  5. Internationalization for the TableOperations plugin.
  6. - -
  7. 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.
  8. - -
  9. Documentation.
  10. - -
- - -
-
Mihai Bazon
- - -Last modified on Sun Aug 10 19:31:39 2003 - - - - - - + + + + HTMLArea-3.0-beta release notes + + + + +

HTMLArea-3.0-beta release notes

+ +

This release was compiled on Aug 11, 2003 [21:30] GMT.

+ + +

Changes since 3.0-Alpha:

+ + + +

Rationale for Beta

+ +

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. ;-)

+ +

To-Do before 3.0 final

+ +
    + +
  1. 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).
  2. + +
  3. Internationalization for the SpellChecker plugin.
  4. + +
  5. Internationalization for the TableOperations plugin.
  6. + +
  7. 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.
  8. + +
  9. Documentation.
  10. + +
+ + +
+
Mihai Bazon
+ + +Last modified on Sun Aug 10 19:31:39 2003 + + + + + +