Project

General

Profile

« Previous | Next » 

Revision 1188

Added by Dietmar over 14 years ago

Fix to load edit_full_area only if needed

View differences:

wb_wrapper_edit_area.php
14 14
 * @version		0.7.2.3 
15 15
 * @platform	Website Baker 2.7
16 16
*/
17
function loader_help()
18
{
19
?>
20
   <script type="text/javascript">
21
      var head= document.getElementsByTagName('head')[0];
22
      var script= document.createElement('script');
23
      script.type= 'text/javascript';
24
      script.src= '<?php print WB_URL; ?>/include/editarea/edit_area_full.js';
25
      head.appendChild(script);
26
   </script>
27
<?php
17 28

  
29
}
30

  
18 31
if (!function_exists('registerEditArea')) {
19 32
	function registerEditArea($id = 'code_area', $syntax = 'php', $syntax_selection = true
20 33
		, $allow_resize = 'no', $allow_toggle = true, $start_highlight = true
21 34
		, $min_width = 600, $min_height = 300, $toolbar = 'default')
22
	{ 
35
	{
36

  
23 37
		// set default toolbar if no user defined was specified
24 38
		if ($toolbar == 'default') {
25 39
			$toolbar = 'search, fullscreen, |, undo, redo, |, select_font, syntax_selection, |, highlight, reset_highlight, |, help';
26 40
			$toolbar = (!$syntax_selection) ? str_replace('syntax_selection,', '', $toolbar) : $toolbar;
27 41
		}
28
	
42

  
29 43
		// check if used Website Baker backend language is supported by EditArea
30 44
		$language = 'en';
31 45
		if (defined('LANGUAGE') && file_exists(dirname(__FILE__) . '/langs/' . strtolower(LANGUAGE) . '.js')) {
......
38 52
		// check if resize option is supported by edit_area
39 53
		$allow_resize = in_array($allow_resize, array('no', 'both', 'x', 'y')) ? $allow_resize : 'no';
40 54

  
55
        loader_help();
41 56
		// return the Javascript code
42 57
		$result = <<< EOT
43
		<script language="javascript" type="text/javascript">
58
		<script type="text/javascript">
44 59
			editAreaLoader.init({
45 60
				id: 				'$id'
46 61
				,start_highlight:	$start_highlight

Also available in: Unified diff