2 /************************************************************************/
4 /************************************************************************/
5 /* Copyright (c) 2010 */
6 /* Inclusive Design Institute */
8 /* This program is free software. You can redistribute it and/or */
9 /* modify it under the terms of the GNU General Public License */
10 /* as published by the Free Software Foundation. */
11 /************************************************************************/
13 if (!defined('TR_INCLUDE_PATH')) { exit; }
15 function load_editor($simple = TRUE, $name = FALSE, $mode="textareas") {
16 global $_base_path, $content_base_href, $_course_id;
18 if (defined('TR_FORCE_GET_FILE') && TR_FORCE_GET_FILE) {
19 $course_base_href = 'get.php/';
21 $course_base_href = 'content/' . $_course_id . '/';
24 // Note: Some tinymce buttons are removed due to lack of accessibility for disabled.
26 //New Document: newdocument
27 //Insert Time: inserttime
28 //Insert Date: insertdate
30 //toggle guidelines: visualaid
34 //Insert Layer: insertlayer
35 //move forward: moveforward
36 //move backward: movebackward
37 //toggle absolute positioning: absolute
41 //visual control characters on/off: visualchars
42 //insert non-breaking space character: nonbreaking
43 //insert predefined template: template
44 //insert page break: pagebreak
46 echo '<script language="javascript" type="text/javascript" src="'.TR_BASE_HREF.'include/jscripts/tiny_mce/tiny_mce_src.js"></script>
47 <script language="javascript" type="text/javascript">';
49 echo 'var ATutor = ATutor || {};
50 trans.tinymce = trans.tinymce || {};
55 echo 'tinymce.PluginManager.load("insert_tag", "'.TR_BASE_HREF.'include/jscripts/tiny_mce_plugins/insert_tag/editor_plugin.js");
57 echo 'tinymce.PluginManager.load("swap_toolbar", "'.TR_BASE_HREF.'include/jscripts/tiny_mce_plugins/swap_toolbar/editor_plugin.js");
60 echo 'var initSettings = {';
62 echo ' mode : "exact",';
63 echo ' elements : "'.$name.'",';
65 echo ' mode : "'.$mode.'",';
67 echo 'theme: "advanced",
69 content_css :"'.$_base_path.'/include/lib/tinymce_styles.css",
71 accessibility_warnings : true,
72 entity_encoding : "raw",
73 accessibility_focus : true,
74 plugins : "-insert_tag, -swap_toolbar, acheck, table,safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template",
75 theme_advanced_toolbar_location : "top",
76 theme_advanced_toolbar_align : "left",
77 theme_advanced_path_location : "bottom",
78 theme_advanced_resizing : true,
79 remove_linebreaks: false,
80 plugin_insertdate_dateFormat : "%Y-%m-%d",
81 plugin_insertdate_timeFormat : "%H:%M:%S",
82 extended_valid_elements : "a[name|href|target|title|onclick|style|class],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
83 document_base_url: "'.TR_BASE_HREF.$course_base_href.$content_base_href.'"
86 //these are the simple tools used on the content editor page
87 var simpleToolBars = {
88 theme_advanced_buttons1 : "swap_toolbar_complex,|,bold,italic,underline,|,justifyleft,justifycenter,justifyright,|,formatselect,fontselect,fontsizeselect,|,forecolor,backcolor,|,pasteword,link,unlink,|,acheck",
89 theme_advanced_buttons2 : "",
90 theme_advanced_buttons3 : "",
91 theme_advanced_buttons4 : ""
94 //these are the more complex tools used on the content editor page
95 var complexToolBars = {
96 theme_advanced_buttons1 : "swap_toolbar_simple,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect",
97 theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,ltr,rtl,blockquote,|,forecolor,backcolor,|,sub,sup,|,tablecontrols",
98 theme_advanced_buttons3 : "cut,copy,paste,pastetext,pasteword,|,link,unlink,anchor,image,|,abbr,acronym,|,charmap,emotions,advhr,|,insert_term_tag, insert_media_tag, insert_tex_tag",
99 theme_advanced_buttons4 : "search,replace,|,removeformat,undo,redo,|,styleprops,attribs,|,acheck,|,cleanup,code,|,fullscreen "
102 trans.tinymce.initSimple = function() {
103 tinyMCE.init(jQuery.extend({}, initSettings, simpleToolBars));
106 trans.tinymce.initComplex = function() {
107 tinyMCE.init(jQuery.extend({}, initSettings, complexToolBars));
112 echo 'trans.tinymce.initSimple();
115 echo 'trans.tinymce.initComplex();