1[//lasso 2/* 3 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 4 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 5 * 6 * == BEGIN LICENSE == 7 * 8 * Licensed under the terms of any of the following licenses at your 9 * choice: 10 * 11 * - GNU General Public License Version 2 or later (the "GPL") 12 * http://www.gnu.org/licenses/gpl.html 13 * 14 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 15 * http://www.gnu.org/licenses/lgpl.html 16 * 17 * - Mozilla Public License Version 1.1 or later (the "MPL") 18 * http://www.mozilla.org/MPL/MPL-1.1.html 19 * 20 * == END LICENSE == 21 * 22 * This is the integration file for Lasso. 23 * 24 * It defines the FCKeditor class ("custom type" in Lasso terms) that can 25 * be used to create editor instances in Lasso pages on server side. 26 */ 27 28 define_type( 29 'editor', 30 -namespace='fck_', 31 -description='Creates an instance of FCKEditor.' 32 ); 33 local( 34 'instancename' = 'FCKEditor1', 35 'width' = '100%', 36 'height' = '200', 37 'toolbarset' = 'Default', 38 'initialvalue' = string, 39 'basepath' = '/fckeditor/', 40 'config' = array, 41 'checkbrowser' = true, 42 'displayerrors' = false 43 ); 44 45 define_tag( 46 'onCreate', 47 -required='instancename', -type='string', 48 -optional='width', -type='string', 49 -optional='height', -type='string', 50 -optional='toolbarset', -type='string', 51 -optional='initialvalue', -type='string', 52 -optional='basepath', -type='string', 53 -optional='config', -type='array' 54 ); 55 self->instancename = #instancename; 56 local_defined('width') ? self->width = #width; 57 local_defined('height') ? self->height = #height; 58 local_defined('toolbarset') ? self->toolbarset = #toolbarset; 59 local_defined('initialvalue') ? self->initialvalue = #initialvalue; 60 local_defined('basepath') ? self->basepath = #basepath; 61 local_defined('config') ? self->config = #config; 62 /define_tag; 63 64 define_tag('create'); 65 if(self->isCompatibleBrowser); 66 local('out' = ' 67 <div> 68 <input type="hidden" id="' + self->instancename + '" name="' + self->instancename + '" value="' + encode_html(self->initialvalue) + '" style="display:none" /> 69 ' + self->parseConfig + ' 70 <iframe id="' + self->instancename + '___Frame" src="' + self->basepath + 'editor/fckeditor.html?InstanceName=' + self->instancename + '&Toolbar=' + self->toolbarset + '" width="' + self->width + '" height="' + self->height + '" frameborder="0" scrolling="no"></iframe> 71 </div> 72 '); 73 else; 74 local('out' = ' 75 <div> 76 <textarea name="' + self->instancename + '" rows="4" cols="40" style="width: ' + self->width + '; height: ' + self->height + '">' + encode_html(self->initialvalue) + '</textarea> 77 </div> 78 '); 79 /if; 80 return(@#out); 81 /define_tag; 82 83 define_tag('isCompatibleBrowser'); 84 local('result' = false); 85 if (client_browser->Find("MSIE") && !client_browser->Find("mac") && !client_browser->Find("Opera")); 86 #result = client_browser->Substring(client_browser->Find("MSIE")+5,3)>=5.5; 87 /if; 88 if (client_browser->Find("Gecko/")); 89 #result = client_browser->Substring(client_browser->Find("Gecko/")+6,8)>=20030210; 90 /if; 91 if (client_browser->Find("Opera/")); 92 #result = client_browser->Substring(client_browser->Find("Opera/")+6,4)>=9.5; 93 /if; 94 if (client_browser->Find("AppleWebKit/")); 95 #result = client_browser->Substring(client_browser->Find("AppleWebKit/")+12,3)>=522; 96 /if; 97 return(#result); 98 /define_tag; 99 100 define_tag('parseConfig'); 101 if(self->config->size); 102 local('out' = '<input type="hidden" id="' + self->instancename + '___Config" value="'); 103 iterate(self->config, local('this')); 104 loop_count > 1 ? #out += '&'; 105 #out += encode_html(#this->first) + '=' + encode_html(#this->second); 106 /iterate; 107 #out += '" style="display:none" />\n'; 108 return(@#out); 109 /if; 110 /define_tag; 111 /define_type; 112] 113