1<% 2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net 3 * Copyright (C) 2003-2007 Frederico Caldeira Knabben 4 * 5 * == BEGIN LICENSE == 6 * 7 * Licensed under the terms of any of the following licenses at your 8 * choice: 9 * 10 * - GNU General Public License Version 2 or later (the "GPL") 11 * http://www.gnu.org/licenses/gpl.html 12 * 13 * - GNU Lesser General Public License Version 2.1 or later (the "LGPL") 14 * http://www.gnu.org/licenses/lgpl.html 15 * 16 * - Mozilla Public License Version 1.1 or later (the "MPL") 17 * http://www.mozilla.org/MPL/MPL-1.1.html 18 * 19 * == END LICENSE == 20 * 21 * This is the integration file for Active FoxPro Pages. 22 * 23 24DEFINE CLASS goFckeditor AS CONTAINER OLEPUBLIC 25 26 cInstanceName ="" 27 BasePath ="" 28 cWIDTH ="" 29 cHEIGHT ="" 30 ToolbarSet ="" 31 cValue="" 32 DIMENSION aConfig(10,2) 33 34&& ----------------------------------------------------------------------- 35 FUNCTION fckeditor( tcInstanceName ) 36 LOCAL lnLoop,lnLoop2 37 THIS.cInstanceName = tcInstanceName 38 THIS.BasePath = '/fckeditor/' 39 THIS.cWIDTH = '100%' 40 THIS.cHEIGHT = '200' 41 THIS.ToolbarSet = 'Default' 42 THIS.cValue = '' 43 FOR lnLoop=1 TO 10 44 FOR lnLoop2=1 TO 2 45 THIS.aConfig(lnLoop,lnLoop2) = "" 46 NEXT 47 NEXT 48 RETURN 49 ENDFUNC 50 51 52&& ----------------------------------------------------------------------- 53 FUNCTION CREATE() 54 ? THIS.CreateHtml() 55 RETURN 56 ENDFUNC 57 58&& ----------------------------------------------------------------------- 59 FUNCTION CreateHtml() 60 LOCAL html 61 LOCAL lcLink 62 63 HtmlValue = THIS.cValue && HTMLSPECIALCHARS() 64 65 html = [<div>] 66 IF THIS.IsCompatible() 67 lcLink = THIS.BasePath+[editor/fckeditor.html?InstanceName=]+THIS.cInstanceName 68 69 IF ( !THIS.ToolbarSet == '' ) 70 lcLink = lcLink + [&Toolbar=]+THIS.ToolbarSet 71 ENDIF 72 73 && Render the LINKED HIDDEN FIELD. 74 html = html + [<input type="hidden" id="]+THIS.cInstanceName +[" name="]+THIS.cInstanceName +[" value="]+HtmlValue+[" style="display:none" />] 75 76 && Render the configurations HIDDEN FIELD. 77 html = html + [<input type="hidden" id="]+THIS.cInstanceName +[___Config" value="]+THIS.GetConfigFieldString() + [" style="display:none" />] +CHR(13)+CHR(10) 78 79 && Render the EDITOR IFRAME. 80 html = html + [<iframe id="]+THIS.cInstanceName +[___Frame" src="Link" width="]+THIS.cWIDTH+[" height="]+THIS.cHEIGHT+[" frameborder="0" scrolling="no"></iframe>] 81 ELSE 82 IF ( AT("%", THIS.cWIDTH)=0 ) 83 WidthCSS = THIS.cWIDTH + 'px' 84 ELSE 85 WidthCSS = THIS.cWIDTH 86 ENDIF 87 88 IF ( AT("%",THIS.cHEIGHT)=0 ) 89 HeightCSS = THIS.cHEIGHT + 'px' 90 ELSE 91 HeightCSS = THIS.cHEIGHT 92 ENDIF 93 94 html = html + [<textarea name="]+THIS.cInstanceName +[" rows="4" cols="40" style="width: ]+WidthCSS+[ height: ]+HeightCSS+[">]+HtmlValue+[</textarea>] 95 ENDIF 96 97 html = html + [</div>] 98 99 RETURN (html) 100 ENDFUNC 101 102 103&& ----------------------------------------------------------------------- 104 FUNCTION IsCompatible() 105 LOCAL llRetval 106 LOCAL sAgent 107 108 llRetval=.F. 109 110 111 sAgent = LOWER(ALLTRIM(request.servervariables("HTTP_USER_AGENT"))) 112 113 IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0 114 iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3)) 115 llRetval= iVersion > 5.5 116 ELSE 117 IF AT("gecko",sAgent)>0 118 iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8)) 119 llRetval =iVersion > 20030210 120 ENDIF 121 ENDIF 122 RETURN (llRetval) 123 ENDFUNC 124 125&& ----------------------------------------------------------------------- 126 FUNCTION GetConfigFieldString() 127 LOCAL sParams 128 LOCAL bFirst 129 LOCAL sKey 130 sParams = "" 131 bFirst = .T. 132 FOR lnLoop=1 TO 10 && ALEN(this.aconfig) 133 IF !EMPTY(THIS.aConfig(lnLoop,1)) 134 IF bFirst = .F. 135 sParams = sParams + "&" 136 ELSE 137 bFirst = .F. 138 ENDIF 139 sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2) 140 ELSE 141 EXIT 142 ENDIF 143 NEXT 144 RETURN(sParams) 145 ENDFUNC 146ENDDEFINE 147%>