Changeset 4630 for extensions/FCKEditor
- Timestamp:
- Jan 6, 2010, 3:37:32 PM (15 years ago)
- Location:
- extensions/FCKEditor
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/FCKEditor/fckeditor.php
r4629 r4630 9 9 if (!isset($page['page'])) return $plugin_menu_links; 10 10 11 if (!($config = unserialize($conf['FCKEditor'])))12 {13 $config = array();14 }15 11 $toolbar = 'Full'; 16 12 $width = '750px'; … … 40 36 $template->set_prefilter('notification_by_mail', 'add_remove_button'); 41 37 } 38 // Page banner 39 elseif ($page['page'] == 'configuration') 40 { 41 $areas[] = 'page_banner'; 42 $width = '70%'; 43 $toolbar = 'Basic'; 44 $template->set_outputfilter('config', 'add_remove_button_banner'); 45 } 42 46 elseif ($page['page'] == 'plugin') 43 47 { … … 48 52 $areas[] = 'ap_content'; 49 53 $width = '100%'; 50 $height = '400px'; 51 $template->set_prefilter('plugin_admin_content', 'add_remove_button'); 54 $template->set_outputfilter('module_options', 'add_remove_button_br'); 52 55 } 53 56 // PWG Stuffs … … 55 58 { 56 59 $areas[] = 'personal_content'; 57 $width = ' 100%';60 $width = '99%'; 58 61 $height = '250px'; 59 62 $template->set_prefilter('module_options', 'add_remove_button_stuffs'); … … 63 66 if (!empty($areas)) 64 67 { 65 $head_element = ' 66 <style type="text/css"> 67 FORM#catModify TABLE TABLE { width: 100%; } 68 </style> 69 <script type="text/javascript" src="'.FCK_PATH.'ckeditor/ckeditor.js"></script> 70 <script type="text/javascript"> 71 CKEDITOR.config.toolbar_Basic = 72 [ 73 ["Source"],["Bold","Italic","Underline"], 74 ["JustifyLeft","JustifyCenter","JustifyRight","JustifyBlock"], 75 ["Styles","Format","Font","FontSize"], 76 ["Link","Unlink","ShowBlocks"] 77 ]; 78 CKEDITOR.config.width = "'.$width.'"; 79 CKEDITOR.config.height = "'.$height.'"; 80 CKEDITOR.config.toolbar = "'.$toolbar.'"; 81 window.onload = function() 82 { 83 '; 84 foreach ($areas as $area) 85 { 86 if (!isset($config[$area]) or $config[$area]) 87 { 88 $head_element .= 'CKEDITOR.replace("'.$area.'");'; 89 } 90 } 91 $head_element .= ' 92 } 93 94 function toogleEditor(name) { 95 if (typeof( CKEDITOR.instances[name] ) != "undefined") { 96 CKEDITOR.instances[name].destroy(); 97 jQuery.post("plugins/FCKEditor/update_config.php", {area: name, status: "off"}); 98 } else { 99 CKEDITOR.replace(name); 100 jQuery.post("plugins/FCKEditor/update_config.php", {area: name, status: "on"}); 101 } 102 } 103 </script>'; 104 105 $template->append('head_elements', $head_element); 68 set_fckeditor_instance($areas, $toolbar, $width, $height); 106 69 } 107 70 return $plugin_menu_links; … … 123 86 } 124 87 88 function add_remove_button_banner($content, &$smarty) 89 { 90 $pattern = '#(<textarea.*?name="(.*?)".*?</textarea>)#ims'; 91 $replacement = '$1<a href="#" onClick="toogleEditor(\'$2\'); return false;" style="border-bottom: none; float: right; margin-right: 5%;">FCK Editor On/Off</a>'; 92 return preg_replace($pattern, $replacement, $content); 93 } 94 125 95 ?> -
extensions/FCKEditor/main.inc.php
r4629 r4630 17 17 include(FCK_PATH.'fckeditor.php'); 18 18 } 19 20 function set_fckeditor_instance($areas=array(), $toolbar='Basic', $width='750px', $height='200px') 21 { 22 global $template, $conf; 23 24 if (is_string($areas)) 25 { 26 $areas = array($areas); 27 } 28 if (!($config = unserialize($conf['FCKEditor']))) 29 { 30 $config = array(); 31 } 32 $template->set_filename('fckeditor', realpath(FCK_PATH.'fckeditor.tpl')); 33 $template->assign( 34 array( 35 'FCK_PATH' => FCK_PATH, 36 'FCK_config' => $config, 37 'FCK_areas' => $areas, 38 'FCK_WIDTH' => $width, 39 'FCK_HEIGHT' => $height, 40 'FCK_TOOLBAR' => $toolbar, 41 ) 42 ); 43 $template->parse('fckeditor'); 44 } 19 45 ?>
Note: See TracChangeset
for help on using the changeset viewer.