Changeset 230 for devel/units/tinymce
- Timestamp:
- 01/27/06 15:53:20 (3 years ago)
- Files:
-
- devel/units/tinymce/main.php (modified) (1 diff)
- devel/units/tinymce/tinymce_js.php (modified) (1 diff)
- devel/units/tinymce/tinymce_userdetails.php (modified) (1 diff)
- devel/units/tinymce/tinymce_userdetails_actions.php (modified) (1 diff)
- devel/units/tinymce/tinymce_userdetails_edit.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
devel/units/tinymce/main.php
r180 r230 1 1 <?php 2 2 3 /// TinyMCE editor3 /// TinyMCE editor 4 4 5 global $CFG;6 global $function;5 global $CFG; 6 global $function; 7 7 8 // Add JS to embed file in weblog script9 $function['files:embed:js'][] = path . "units/tinymce/file_embed_js.php";8 // Add JS to embed file in weblog script 9 $function['files:embed:js'][] = path . "units/tinymce/file_embed_js.php"; 10 10 11 // Only load the editor in the following contexts12 $function['weblogs:edit'][] = path . "units/tinymce/tinymce_js.php";13 $function['weblogs:posts:view:individual'][] = path . "units/tinymce/tinymce_js.php";11 // Only load the editor in the following contexts 12 $function['weblogs:edit'][] = path . "units/tinymce/tinymce_js.php"; 13 $function['weblogs:posts:view:individual'][] = path . "units/tinymce/tinymce_js.php"; 14 14 15 // What is the user preference16 $function['userdetails:editor'][] = path . "units/tinymce/tinymce_userdetails.php";15 // What is the user preference 16 $function['userdetails:editor'][] = path . "units/tinymce/tinymce_userdetails.php"; 17 17 18 // Action handling19 $function['userdetails:init'][] = path . "units/tinymce/tinymce_userdetails_actions.php";20 // TODO figure this out21 // User details editable options22 $function['userdetails:edit:details'][] = path . "units/tinymce/tinymce_userdetails_edit.php";18 // Action handling 19 $function['userdetails:init'][] = path . "units/tinymce/tinymce_userdetails_actions.php"; 20 // TODO figure this out 21 // User details editable options 22 $function['userdetails:edit:details'][] = path . "units/tinymce/tinymce_userdetails_edit.php"; 23 23 24 // Let the system know we've got TinyMCE loaded25 //$CFG->plugins->tinymce = true;24 // Let the system know we've got TinyMCE loaded 25 //$CFG->plugins->tinymce = true; 26 26 27 // Added editor section to enable future editor choice in user config28 $CFG->plugins->editor["tinymce"] = true;27 // Added editor section to enable future editor choice in user config 28 $CFG->plugins->editor["tinymce"] = true; 29 29 ?> devel/units/tinymce/tinymce_js.php
r180 r230 1 1 <?php 2 // Language setting2 // Language setting 3 3 4 global $language;5 global $page_owner;4 global $language; 5 global $page_owner; 6 6 7 if (run('userdetails:editor', $page_owner) == "yes") {8 if (!$language) {9 $language = locale;10 }7 if (run('userdetails:editor', $page_owner) == "yes") { 8 if (!$language) { 9 $language = locale; 10 } 11 11 12 // Keep base language, no variations for now13 $lang = substr($language, 0, 2);12 // Keep base language, no variations for now 13 $lang = substr($language, 0, 2); 14 14 15 // Loose the trailing slash16 $url = substr(url, 0, -1);15 // Loose the trailing slash 16 $url = substr(url, 0, -1); 17 17 18 global $metatags;18 global $metatags; 19 19 20 $metatags .= <<< END21 <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script>22 <script language="javascript" type="text/javascript">23 tinyMCE.init({24 language : "$lang",25 mode : "exact",26 convert_urls : false,27 relative_urls : false,28 elements : "new_weblog_post,new_weblog_comment",29 theme : "advanced",30 theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen",31 theme_advanced_buttons2 : "",32 theme_advanced_buttons3 : "",33 theme_advanced_toolbar_location : "top",34 theme_advanced_toolbar_align : "left",35 theme_advanced_path_location : "bottom",36 extended_valid_elements : "a[name|href|target|title|onclick],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]",37 remove_linebreaks: true,38 theme_advanced_source_editor_width : "400",39 theme_advanced_source_editor_height : "300",40 plugins : "fullscreen",41 document_base_url : "$url",42 fullscreen_settings : {43 theme_advanced_path_location : "top"44 }45 46 });47 </script>\n20 $metatags .= <<< END 21 <script language="javascript" type="text/javascript" src="$url/_tinymce/jscripts/tiny_mce/tiny_mce_gzip.php"></script> 22 <script language="javascript" type="text/javascript"> 23 tinyMCE.init({ 24 language : "$lang", 25 mode : "exact", 26 convert_urls : false, 27 relative_urls : false, 28 elements : "new_weblog_post,new_weblog_comment", 29 theme : "advanced", 30 theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,image,undo,redo,link,unlink,code,fullscreen", 31 theme_advanced_buttons2 : "", 32 theme_advanced_buttons3 : "", 33 theme_advanced_toolbar_location : "top", 34 theme_advanced_toolbar_align : "left", 35 theme_advanced_path_location : "bottom", 36 extended_valid_elements : "a[name|href|target|title|onclick],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]", 37 remove_linebreaks: true, 38 theme_advanced_source_editor_width : "400", 39 theme_advanced_source_editor_height : "300", 40 plugins : "fullscreen", 41 document_base_url : "$url", 42 fullscreen_settings : { 43 theme_advanced_path_location : "top" 44 } 45 46 }); 47 </script>\n 48 48 END; 49 }49 } 50 50 ?> devel/units/tinymce/tinymce_userdetails.php
r180 r230 1 1 <?php 2 2 3 // Get the user preferences for the editor3 // Get the user preferences for the editor 4 4 5 // Userid6 $id = (int) $parameter;5 // Userid 6 $id = (int) $parameter; 7 7 8 // Editor is enabeled by default9 $value = "yes";8 // Editor is enabeled by default 9 $value = "yes"; 10 10 11 // Query result12 $result = db_query("select value from user_flags value where flag = 'visualeditor' and user_id = $id");11 // Query result 12 $result = db_query("select value from user_flags value where flag = 'visualeditor' and user_id = $id"); 13 13 14 // Process resultset15 if ($row = $result[0]) {16 // We have a result, the preference has been set earlier17 $value = $row->value;18 } else {19 // No result, store a default value20 db_query("insert into user_flags set flag='visualeditor', value='$value', user_id=$id");21 }14 // Process resultset 15 if ($row = $result[0]) { 16 // We have a result, the preference has been set earlier 17 $value = $row->value; 18 } else { 19 // No result, store a default value 20 db_query("insert into user_flags set flag='visualeditor', value='$value', user_id=$id"); 21 } 22 22 23 $run_result = $value;23 $run_result = $value; 24 24 ?> devel/units/tinymce/tinymce_userdetails_actions.php
r180 r230 1 1 <?php 2 2 3 // Save the user's editor choice3 // Save the user's editor choice 4 4 5 if (logged_on && isset($_REQUEST['action']) && run("permissions:check",6 array("userdetails:change",((int) $_REQUEST['id'])))) {5 if (logged_on && isset($_REQUEST['action']) && run("permissions:check", 6 array("userdetails:change",((int) $_REQUEST['id'])))) { 7 7 8 if (isset($_REQUEST['visualeditor']) && ($_REQUEST['visualeditor'] == "yes" || $_REQUEST['visualeditor'] == "no")) {8 if (isset($_REQUEST['visualeditor']) && ($_REQUEST['visualeditor'] == "yes" || $_REQUEST['visualeditor'] == "no")) { 9 9 10 // Get the current value, will also create an initial entry if not yet set11 $current = run('userdetails:editor', (int) $_REQUEST['id']);12 $value = $_REQUEST['visualeditor'];13 $id= (int) $_REQUEST['id'];10 // Get the current value, will also create an initial entry if not yet set 11 $current = run('userdetails:editor', (int) $_REQUEST['id']); 12 $value = $_REQUEST['visualeditor']; 13 $id = (int) $_REQUEST['id']; 14 14 15 if ($current == $value) {16 $messages[] .= gettext("Your editor preferences have been saved");17 } else {18 db_query("update user_flags set value = '$value' where flag = 'visualeditor' and user_id = $id");19 $messages[] .= gettext("Your editor preferences have been changed");20 }21 }22 }15 if ($current == $value) { 16 $messages[] .= gettext("Your editor preferences have been saved"); 17 } else { 18 db_query("update user_flags set value = '$value' where flag = 'visualeditor' and user_id = $id"); 19 $messages[] .= gettext("Your editor preferences have been changed"); 20 } 21 } 22 } 23 23 24 24 ?> devel/units/tinymce/tinymce_userdetails_edit.php
r180 r230 1 1 <?php 2 2 3 $visualEditor = gettext("Visual text editing");4 $visualEditorRules = gettext("Set this to 'yes' if you would like to use a visual (WYSIWYG) text editor for your posts and comments.");3 $visualEditor = gettext("Visual text editing"); 4 $visualEditorRules = gettext("Set this to 'yes' if you would like to use a visual (WYSIWYG) text editor for your posts and comments."); 5 5 6 $body .= <<< END6 $body .= <<< END 7 7 8 <h2>$visualEditor</h2>9 <p>10 $visualEditorRules11 </p>8 <h2>$visualEditor</h2> 9 <p> 10 $visualEditorRules 11 </p> 12 12 13 13 END; 14 14 15 $editor = run('userdetails:editor', $page_owner);15 $editor = run('userdetails:editor', $page_owner); 16 16 17 if ($editor == "yes") {18 $body .= run("templates:draw", array(19 'context' => 'databox',20 'name' => gettext("Enable visual editor: "),21 'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" /> " . gettext("No") . "</label>"22 )23 );24 } else {25 $body .= run("templates:draw", array(26 'context' => 'databox',27 'name' => gettext("Enable visual editor: "),28 'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>"29 )30 );31 }17 if ($editor == "yes") { 18 $body .= run("templates:draw", array( 19 'context' => 'databox', 20 'name' => gettext("Enable visual editor: "), 21 'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" checked=\"checked\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" /> " . gettext("No") . "</label>" 22 ) 23 ); 24 } else { 25 $body .= run("templates:draw", array( 26 'context' => 'databox', 27 'name' => gettext("Enable visual editor: "), 28 'column1' => "<label><input type=\"radio\" name=\"visualeditor\" value=\"yes\" /> " . gettext("Yes") . "</label> <label><input type=\"radio\" name=\"visualeditor\" value=\"no\" checked=\"checked\" /> " . gettext("No") . "</label>" 29 ) 30 ); 31 } 32 32 33 33 34 $run_result= $body;34 $run_result .= $body; 35 35 36 36 ?>
