Revision 1289
Added by kweitzel over 14 years ago
wb_wrapper_edit_area.php | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
/** |
3 |
* Website Baker wrapper functions for the Javascript code editor: "EditArea" |
|
4 | 3 |
* |
5 |
* EditArea is created by Christophe Dolivet and released under "LGPL", |
|
6 |
* "Apache" and "BSD" licenses. For the integration into Website Baker |
|
7 |
* the LGPL license was choosen. |
|
4 |
* @category framework |
|
5 |
* @package include |
|
6 |
* @author Christophe Dolivet (EditArea), Christian Sommer (WB wrapper) |
|
7 |
* @author WebsiteBaker Project |
|
8 |
* @copyright 2004-2009, Ryan Djurovich |
|
9 |
* @copyright 2009-2010, Website Baker Org. e.V. |
|
10 |
* @link http://www.websitebaker2.org/ |
|
11 |
* @license http://www.gnu.org/licenses/gpl.html |
|
12 |
* @platform WebsiteBaker 2.8.x |
|
13 |
* @requirements PHP 4.3.4 and higher |
|
14 |
* @version $Id$ |
|
15 |
* @filesource $HeadURL$ |
|
16 |
* @lastmodified $Date$ |
|
8 | 17 |
* |
9 |
* LICENSE: GNU Lesser General Public License 3.0 |
|
10 |
* |
|
11 |
* @author Christophe Dolivet (EditArea), Christian Sommer (WB wrapper) |
|
12 |
* @copyright (c) 2005-2009 |
|
13 |
* @license http://www.gnu.org/copyleft/lesser.html |
|
14 |
* @version 0.7.2.3 |
|
15 |
* @platform Website Baker 2.7 |
|
16 |
*/ |
|
18 |
*/ |
|
17 | 19 |
|
20 |
function loader_help() |
|
21 |
{ |
|
22 |
?> |
|
23 |
<script type="text/javascript"> |
|
24 |
var head= document.getElementsByTagName('head')[0]; |
|
25 |
var script= document.createElement('script'); |
|
26 |
script.type= 'text/javascript'; |
|
27 |
script.src= '<?php print WB_URL; ?>/include/editarea/edit_area_full.js'; |
|
28 |
head.appendChild(script); |
|
29 |
</script> |
|
30 |
<?php |
|
31 |
|
|
32 |
} |
|
33 |
|
|
18 | 34 |
if (!function_exists('registerEditArea')) { |
19 |
function registerEditArea($id = 'code_area', $syntax = 'php', $syntax_selection = true |
|
20 |
, $allow_resize = 'no', $allow_toggle = true, $start_highlight = true |
|
21 |
, $min_width = 600, $min_height = 300, $toolbar = 'default') |
|
22 |
{ |
|
35 |
function registerEditArea( |
|
36 |
$id = 'code_area', |
|
37 |
$syntax = 'php', |
|
38 |
$syntax_selection = true, |
|
39 |
$allow_resize = 'both', |
|
40 |
$allow_toggle = true, |
|
41 |
$start_highlight = true, |
|
42 |
$min_width = 600, |
|
43 |
$min_height = 300, |
|
44 |
$toolbar = 'default' |
|
45 |
) |
|
46 |
{ |
|
47 |
|
|
23 | 48 |
// set default toolbar if no user defined was specified |
24 | 49 |
if ($toolbar == 'default') { |
25 | 50 |
$toolbar = 'search, fullscreen, |, undo, redo, |, select_font, syntax_selection, |, highlight, reset_highlight, |, help'; |
26 | 51 |
$toolbar = (!$syntax_selection) ? str_replace('syntax_selection,', '', $toolbar) : $toolbar; |
27 | 52 |
} |
28 |
|
|
53 |
|
|
29 | 54 |
// check if used Website Baker backend language is supported by EditArea |
30 | 55 |
$language = 'en'; |
31 |
if (defined('LANGUAGE') && file_exists(dirname(__FILE__) . '/langs/' . strtolower(LANGUAGE) . '.js')) { |
|
56 |
if (defined('LANGUAGE') && file_exists(dirname(__FILE__) . '/langs/' . strtolower(LANGUAGE) . '.js')) |
|
57 |
{ |
|
32 | 58 |
$language = strtolower(LANGUAGE); |
33 | 59 |
} |
34 | 60 |
|
... | ... | |
40 | 66 |
|
41 | 67 |
// return the Javascript code |
42 | 68 |
$result = <<< EOT |
43 |
<script language="javascript" type="text/javascript">
|
|
69 |
<script type="text/javascript"> |
|
44 | 70 |
editAreaLoader.init({ |
45 |
id: '$id' |
|
46 |
,start_highlight: $start_highlight
|
|
47 |
,syntax: '$syntax'
|
|
48 |
,min_width: $min_width
|
|
49 |
,min_height: $min_height
|
|
50 |
,allow_resize: '$allow_resize'
|
|
51 |
,allow_toggle: $allow_toggle
|
|
52 |
,toolbar: '$toolbar'
|
|
53 |
,language: '$language'
|
|
71 |
id: '$id',
|
|
72 |
start_highlight: $start_highlight,
|
|
73 |
syntax: '$syntax',
|
|
74 |
min_width: $min_width,
|
|
75 |
min_height: $min_height,
|
|
76 |
allow_resize: '$allow_resize',
|
|
77 |
allow_toggle: $allow_toggle,
|
|
78 |
toolbar: '$toolbar',
|
|
79 |
language: '$language' |
|
54 | 80 |
}); |
55 | 81 |
</script> |
56 | 82 |
EOT; |
57 | 83 |
Also available in: Unified diff
Branch 2.8.1 merged back into Trunk