From: scyrma Date: Mon, 12 May 2008 09:02:17 +0000 (+0000) Subject: MDL-14795: initial commit of the code sent in by Mauno Korpelainen, after reformatting. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=19be75a856426a38a07a03890504866d5798471a;p=moodle.git MDL-14795: initial commit of the code sent in by Mauno Korpelainen, after reformatting. --- diff --git a/lib/editor/tinymce/adminscr.php b/lib/editor/tinymce/adminscr.php new file mode 100644 index 0000000000..baa5801aa3 --- /dev/null +++ b/lib/editor/tinymce/adminscr.php @@ -0,0 +1,138 @@ + + diff --git a/lib/editor/tinymce/coursefiles.php b/lib/editor/tinymce/coursefiles.php new file mode 100644 index 0000000000..358a56861f --- /dev/null +++ b/lib/editor/tinymce/coursefiles.php @@ -0,0 +1,818 @@ +libdir.'/filelib.php'); + + $id = required_param('id', PARAM_INT); + $file = optional_param('file', '', PARAM_PATH); + $wdir = optional_param('wdir', '', PARAM_PATH); + $action = optional_param('action', '', PARAM_ACTION); + $name = optional_param('name', '', PARAM_FILE); + $oldname = optional_param('oldname', '', PARAM_FILE); + $usecheckboxes = optional_param('usecheckboxes', 1, PARAM_INT); + $save = optional_param('save', 0, PARAM_BOOL); + $text = optional_param('text', '', PARAM_RAW); + $confirm = optional_param('confirm', 0, PARAM_BOOL); + + + if (! $course = get_record("course", "id", $id) ) { + print_error("That's an invalid course id"); + } + + require_login($course); + require_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $id)); + + function html_footer() { + echo "\n\n\n"; + } + + function html_header($course, $wdir, $formfield=""){ + + global $CFG; + + ?> + + + + + coursefiles + + + + + + id")) { + print_error("The site administrator needs to fix the file permissions"); + } + + $baseweb = $CFG->wwwroot; + +// End of configuration and access control + + + if ($wdir == '') { + $wdir='/'; + } + + switch ($action) { + + case "upload": + html_header($course, $wdir); + require_once($CFG->dirroot.'/lib/uploadlib.php'); + + if ($save and confirm_sesskey()) { + $um = new upload_manager('userfile',false,false,$course,false,0); + $dir = "$basedir$wdir"; + if ($um->process_file_uploads($dir)) { + notify(get_string('uploadedfile')); + } + // um will take care of error reporting. + displaydir($wdir); + } else { + $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); + $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 "\n\n\n
\n"; + echo "
\n"; + upload_print_form_fragment(1,array('userfile'),null,false,null,$course->maxbytes,0,false); + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo "
"; + echo " \n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } + html_footer(); + break; + + case "delete": + if ($confirm and confirm_sesskey()) { + 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 "
"; + $frameold = $CFG->framename; + $CFG->framename = "ibrowser"; + notice_yesno (get_string("deletecheckfiles"), + "coursefiles.php?id=$id&wdir=$wdir&action=delete&confirm=1&sesskey=$USER->sesskey", + "coursefiles.php?id=$id&wdir=$wdir&action=cancel"); + $CFG->framename = $frameold; + } else { + displaydir($wdir); + } + html_footer(); + } + break; + + case "move": + html_header($course, $wdir); + if ($count = setfilelist($_POST) and confirm_sesskey()) { + $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" and confirm_sesskey()) { + 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) and confirm_sesskey()) { + 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 "\n\n\n
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
"; + echo "
\n"; + } + html_footer(); + break; + + case "mkdir": + if (!empty($name) and confirm_sesskey()) { + 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 "\n\n\n
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } + html_footer(); + break; + + case "edit": + html_header($course, $wdir); + if (($text != '') and confirm_sesskey()) { + $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); + + print_heading("$streditfile"); + + echo "\n\n\n\n
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " "; + echo " \n"; + echo " sesskey\" />\n"; + print_textarea(false, 25, 80, 680, 400, "text", $contents); + echo "
\n"; + echo " \n"; + echo "\n"; + echo "\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + + if ($usehtmleditor) { + use_html_editor("text"); + } + + + } + html_footer(); + break; + + case "zip": + if (!empty($name) and confirm_sesskey()) { + html_header($course, $wdir); + $name = clean_filename($name); + + $files = array(); + foreach ($USER->filelist as $file) { + $files[] = "$basedir/$file"; + } + + if (!zip_files($files,"$basedir/$wdir/$name")) { + print_error("zipfileserror","error"); + } + + 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 "\n\n\n\n\n
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo " \n"; + echo " "; + echo "
\n"; + echo "
\n"; + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } else { + displaydir($wdir); + clearfilelist(); + } + } + html_footer(); + break; + + case "unzip": + html_header($course, $wdir); + if (!empty($file) and confirm_sesskey()) { + $strok = get_string("ok"); + $strunpacking = get_string("unpacking", "", $file); + + echo "

$strunpacking:

"; + + $file = basename($file); + + if (!unzip_file("$basedir/$wdir/$file")) { + print_error("unzipfileserror","error"); + } + + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } else { + displaydir($wdir); + } + html_footer(); + break; + + case "listzip": + html_header($course, $wdir); + if (!empty($file) and confirm_sesskey()) { + $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); + + require_once($CFG->libdir.'/pclzip/pclzip.lib.php'); + $archive = new PclZip("$basedir/$wdir/$file"); + if (!$list = $archive->listContent("$basedir/$wdir")) { + notify($archive->errorInfo(true)); + + } else { + echo "\n"; + echo "\n"; + foreach ($list as $item) { + echo ""; + print_cell("left", $item['filename']); + if (! $item['folder']) { + print_cell("right", display_size($item['size'])); + } else { + echo "\n"; + } + $filedate = userdate($item['mtime'], get_string("strftimedatetime")); + print_cell("right", $filedate); + echo "\n"; + } + echo "
$strname$strsize$strmodified
 
\n"; + } + echo "
\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo " \n"; + echo "
\n"; + echo "
\n"; + } else { + displaydir($wdir); + } + html_footer(); + break; + + case "cancel": + clearfilelist(); + + default: + html_header($course, $wdir); + displaydir($wdir); + html_footer(); + break; +} + + +/// FILE FUNCTIONS /////////////////////////////////////////////////////////// + + +function setfilelist($VARS) { + global $USER; + + $USER->filelist = array (); + $USER->fileop = ""; + + $count = 0; + foreach ($VARS as $key => $val) { + if (substr($key,0,4) == "file") { + $count++; + $val = rawurldecode($val); + if (!detect_munged_arguments($val, 0)) { + $USER->filelist[] = $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\" class=\"icon\" alt=\"".get_string('folder')."\" /> $file
"; + $subfilelist = array(); + $currdir = opendir($basedir.$file); + while (false !== ($subfile = readdir($currdir))) { + if ($subfile <> ".." && $subfile <> ".") { + $subfilelist[] = $file."/".$subfile; + } + } + printfilelist($subfilelist); + + } else { + $icon = mimeinfo("icon", $file); + echo "pixpath/f/$icon\" class=\"icon\" alt=\"".get_string('file')."\" /> $file
"; + } + } +} + + +function print_cell($alignment="center", $text=" ") { + echo "\n"; + 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 (false !== ($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 "
\n"; + echo "\n"; + + if ($wdir == "/") { + $wdir = ""; + } else { + $bdir = str_replace("/".basename($wdir),"",$wdir); + if($bdir == "/") { + $bdir = ""; + } + print "\n\n\n"; + } + + $count = 0; + + if (!empty($dirlist)) { + asort($dirlist); + foreach ($dirlist as $dir) { + + $count++; + + $filename = $fullpath."/".$dir; + $fileurl = $wdir."/".$dir; + $filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p"); + + echo ""; + + if ($usecheckboxes) { + print_cell("center", ""); + } + print_cell("left", "pixpath/f/folder.gif\" class=\"icon\" alt=\"".get_string('folder')."\" />".htmlspecialchars($dir).""); + print_cell("right", " "); + print_cell("right", $filedate); + + 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"; + $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 "\n"; + + if ($usecheckboxes) { + print_cell("center", ""); + } + echo "\n"; + + if ($icon == "zip.gif") { + $edittext = "sesskey\">$strunzip "; + $edittext .= "sesskey\">$strlist "; + } else { + $edittext = " "; + } + print_cell("right", "$edittext "); + print_cell("right", $filedate); + + echo "\n"; + } + } + echo "
"; + print ""; + print "wwwroot/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"".get_string('parentfolder')."\" />"; + 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\" class=\"icon\" alt=\"$strfile\" />", + 480, 640); + $file_size = filesize($filename); + + echo "wwwroot.$ffurl."',"; + echo " isize: '".$file_size."', itype: '".$imgtype."', iwidth: '".$imgwidth."',"; + echo " iheight: '".$imgheight."', imodified: '".$filedate."' })\" href=\"#\">$file"; + echo "
\n"; + + if (empty($wdir)) { + $wdir = "/"; + } + + echo "\n"; + echo "\n\n"; + echo "
"; + echo "\n"; + echo "\n"; + echo "sesskey\" />\n"; + $options = array ( + "move" => "$strmovetoanotherfolder", + "delete" => "$strdeletecompletely", + "zip" => "$strcreateziparchive" + ); + if (!empty($count)) { + choose_from_menu ($options, "action", "", "$strwithchosenfiles...", "javascript:getElementById('dirform').submit()"); + } + if (!empty($USER->fileop) and ($USER->fileop == "move") and ($USER->filesource <> $wdir)) { + echo "\n"; + echo " \n"; + echo " \n"; + echo " \n"; + echo " sesskey\" />\n"; + echo " \n"; + echo ""; + } + echo "
\n"; + echo "\n"; +} +?> diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php index c3fb9aebce..bf1e0a9e40 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php +++ b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodleimage/insert_image.php @@ -218,7 +218,7 @@ form { margin-bottom: 0px; margin-top: 0px; } "; - echo ""; + echo ""; ?> :
@@ -238,7 +238,7 @@ form { margin-bottom: 0px; margin-top: 0px; } " onclick="return submit_form('move');" />
" onclick="return submit_form('zip');" />
-
+ @@ -265,7 +265,7 @@ form { margin-bottom: 0px; margin-top: 0px; } - + @@ -276,7 +276,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
-
+ diff --git a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodlelink/link.php b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodlelink/link.php index d255af8fd3..67f9ae7950 100644 --- a/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodlelink/link.php +++ b/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodlelink/link.php @@ -112,7 +112,7 @@ form { margin-bottom: 0px; margin-top: 0px; }
": + "": ""; ?>

@@ -131,7 +131,7 @@ form { margin-bottom: 0px; margin-top: 0px; } " onclick="return submit_form('move');" />
" onclick="return submit_form('zip');" />
-
+ @@ -150,7 +150,7 @@ form { margin-bottom: 0px; margin-top: 0px; } - + @@ -158,7 +158,7 @@ form { margin-bottom: 0px; margin-top: 0px; } " onclick="return checkvalue('foldername','cfolder');" />
-
+ diff --git a/lib/editor/tinymce/langlist.php b/lib/editor/tinymce/langlist.php new file mode 100644 index 0000000000..45dca6f245 --- /dev/null +++ b/lib/editor/tinymce/langlist.php @@ -0,0 +1 @@ +theme_standard_styles : "aa=aa;ab=ab;ae=ae;af=af;am=am;ar=ar;as=as;ay=ay;az=az;ba=ba;be=be;bg=bg;bh=bh;bi=bi;bn=bn;bo=bo;br=br;bs=bs;ca=ca;ce=ce;ch=ch;co=co;cs=cs;cu=cu;cv=cv;cy=cy;da=da;de=de;dz=dz;el=el;en=en;eo=eo;es=es;et=et;eu=eu;fa=fa;fi=fi;fj=fj;fo=fo;fr=fr;fy=fy;ga=ga;gd=gd;gl=gl;gn=gn;gu=gu;gv=gv;ha=ha;he=he;hi=hi;ho=ho;hr=hr;hu=hu;hy=hy;hz=hz;ia=ia;id=id;ie=ie;ik=ik;is=is;it=it;iu=iu;ja=ja;jw=jw;ka=ka;ki=ki;kj=kj;kk=kk;kl=kl;km=km;kn=kn;ko=ko;ks=ks;ku=ku;kv=kv;kw=kw;ky=ky;la=la;lb=lb;ln=ln;lo=lo;lt=lt;lv=lv;mg=mg;mh=mh;mi=mi;mk=mk;ml=ml;mn=mn;mo=mo;mr=mr;ms=ms;mt=mt;my=my;na=na;nb=nb;nd=nd;ne=ne;ng=ng;nl=nl;nn=nn;no=no;nr=nr;nv=nv;ny=ny;oc=oc;om=om;or=or;os=os;pa=pa;ph=ph;pi=pi;pl=pl;ps=ps;pt=pt;pt-br=pt-br;qu=qu;rm=rm;rn=rn;ro=ro;ru=ru;rw=rw;sa=sa;sc=sc;sd=sd;se=se;sg=sg;si=si;sk=sk;sl=sl;sm=sm;sn=sn;so=so;sq=sq;sr=sr;ss=ss;st=st;su=su;sv=sv;sw=sw;ta=ta;te=te;tg=tg;th=th;tk=tk;tl=tl;tn=tn;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or/tinymce/messages.php new file mode 100644 index 0000000000..6f8621ee32 --- /dev/null +++ b/lib/editor/tinymce/messages.php @@ -0,0 +1,183 @@ +editorbackgroundcolor))) { + $str .= " background-color: $CFG->editorbackgroundcolor;"; + } + + if (!(empty($CFG->editorfontfamily))) { + $str .= " font-family: $CFG->editorfontfamily;"; + } + + if (!(empty($CFG->editorfontsize))) { + $str .= " font-size: $CFG->editorfontsize;"; + } + + $str .= " }\";\n"; + $str .= "config.killWordOnPaste = "; + $str .= (empty($CFG->editorkillword)) ? "false":"true"; + $str .= ';'."\n"; + $str .= 'config.fontname = {'."\n"; + + $fontlist = isset($CFG->editorfontlist) ? explode(';', $CFG->editorfontlist) : array(); + $i = 1; // Counter is used to get rid of the last comma. + + foreach ($fontlist as $fontline) { + if (!empty($fontline)) { + if ($i > 1) { + $str .= ','."\n"; + } + list($fontkey, $fontvalue) = split(':', $fontline); + $str .= '"'. $fontkey ."\":\t'". $fontvalue ."'"; + + $i++; + } + } + $str .= '};'; + + if (!empty($editorhidebuttons)) { + $str .= "\nconfig.hideSomeButtons(\" ". $editorhidebuttons ." \");\n"; + } else if (!empty($CFG->editorhidebuttons)) { + $str .= "\nconfig.hideSomeButtons(\" ". $CFG->editorhidebuttons ." \");\n"; + } + + if (!empty($CFG->editorspelling) && !empty($CFG->aspellpath)) { + $str .= print_speller_code($CFG->htmleditor, true); + } + + if ($return) { + return $str; + } + echo $str; +} + +function use_html_editor($name='', $editorhidebuttons='', $id='') { +} + +function use_admin_editor($name='', $editorhidebuttons='', $id='') { + echo ''; +} + +function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='') { + global $CFG, $COURSE, $HTTPSPAGEREQUIRED; + $str = ''; + if ($id === '') { + $id = 'edit-'.$name; + } + if (empty($courseid)) { + $courseid = $COURSE->id; + } + if ($usehtmleditor) { + $str .= '
'."\n"; + $toggle_ed = ''; + $str .= "".$toggle_ed." "; + $str .= ''; + } else { + $str .= ''."\n"; + } + if ($return) { + return $str; + } + echo $str; +} +?> + + diff --git a/lib/editor/tinymce/meta.php b/lib/editor/tinymce/meta.php new file mode 100644 index 0000000000..e414a86866 --- /dev/null +++ b/lib/editor/tinymce/meta.php @@ -0,0 +1,109 @@ +editorbackgroundcolor))) { + $str .= " background-color: $CFG->editorbackgroundcolor;"; + } + + if (!(empty($CFG->editorfontfamily))) { + $str .= " font-family: $CFG->editorfontfamily;"; + } + + if (!(empty($CFG->editorfontsize))) { + $str .= " font-size: $CFG->editorfontsize;"; + } + + $str .= " }\";\n"; + $str .= "config.killWordOnPaste = "; + $str .= (empty($CFG->editorkillword)) ? "false":"true"; + $str .= ';'."\n"; + $str .= 'config.fontname = {'."\n"; + + $fontlist = isset($CFG->editorfontlist) ? explode(';', $CFG->editorfontlist) : array(); + $i = 1; // Counter is used to get rid of the last comma. + + foreach ($fontlist as $fontline) { + if (!empty($fontline)) { + if ($i > 1) { + $str .= ','."\n"; + } + list($fontkey, $fontvalue) = split(':', $fontline); + $str .= '"'. $fontkey ."\":\t'". $fontvalue ."'"; + + $i++; + } + } + $str .= '};'; + + if (!empty($editorhidebuttons)) { + $str .= "\nconfig.hideSomeButtons(\" ". $editorhidebuttons ." \");\n"; + } else if (!empty($CFG->editorhidebuttons)) { + $str .= "\nconfig.hideSomeButtons(\" ". $CFG->editorhidebuttons ." \");\n"; + } + + if (!empty($CFG->editorspelling) && !empty($CFG->aspellpath)) { + $str .= print_speller_code($CFG->htmleditor, true); + } + + if ($return) { + return $str; + } + echo $str; +} + +function use_html_editor($name='', $editorhidebuttons='', $id='') { + global $THEME; +} + +function use_admin_editor($name='', $editorhidebuttons='', $id='') { + global $THEME; + echo ''; +} + +function print_textarea($usehtmleditor, $rows, $cols, $width, $height, $name, $value='', $courseid=0, $return=false, $id='') { + global $CFG, $COURSE, $HTTPSPAGEREQUIRED; + + $str = ''; + if ($id === '') { + $id = 'edit-'.$name; + } + if (empty($courseid)) { + $courseid = $COURSE->id; + } + if ($usehtmleditor) { + $str .= '
'."\n"; + $toggle_ed = ''.get_string('toggleeditor','editor').''; + $str .= "".$toggle_ed." "; + $str .= ''; + } + else + { + $str .= ''."\n"; + } + if ($return) { + return $str; + } + echo $str; +} +?> + +id < 2) and has_capability('moodle/site:doanything', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { + include_once('adminscr.php'); +} else { + if (!empty($COURSE->id) and has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $COURSE->id))) { + include_once('staff.php'); + } else { + include_once('student.php'); + } +} +?> diff --git a/lib/editor/tinymce/staff.php b/lib/editor/tinymce/staff.php new file mode 100644 index 0000000000..f0797169af --- /dev/null +++ b/lib/editor/tinymce/staff.php @@ -0,0 +1,70 @@ + diff --git a/lib/editor/tinymce/student.php b/lib/editor/tinymce/student.php new file mode 100644 index 0000000000..d207fa6fe2 --- /dev/null +++ b/lib/editor/tinymce/student.php @@ -0,0 +1,53 @@ + diff --git a/lib/editor/tinymce/xhtml_ruleset.txt b/lib/editor/tinymce/xhtml_ruleset.txt new file mode 100644 index 0000000000..f444c7112f --- /dev/null +++ b/lib/editor/tinymce/xhtml_ruleset.txt @@ -0,0 +1,90 @@ + valid_elements : "" ++"a[accesskey|charset|class|coords|dir