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 SET POINT TO "." 111 112 sAgent = LOWER(ALLTRIM(request.servervariables("HTTP_USER_AGENT"))) 113 114 IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0 115 iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3)) 116 llRetval= iVersion > 5.5 117 ELSE 118 IF AT("gecko/",sAgent)>0 119 iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8)) 120 llRetval =iVersion > 20030210 121 ENDIF 122 ELSE 123 IF AT("opera/",sAgent)>0 124 iVersion=VAL(SUBSTR(sAgent,AT("opera/",sAgent)+6,4)) 125 llRetval =iVersion >= 9.5 126 ENDIF 127 ELSE 128 IF AT("applewebkit/",sAgent)>0 129 iVersion=VAL(SUBSTR(sAgent,AT("applewebkit/",sAgent)+12,3)) 130 llRetval =iVersion >= 522 131 ENDIF 132 ENDIF 133 134 SET POINT TO 135 136 RETURN (llRetval) 137 ENDFUNC 138 139&& ----------------------------------------------------------------------- 140 FUNCTION GetConfigFieldString() 141 LOCAL sParams 142 LOCAL bFirst 143 LOCAL sKey 144 sParams = "" 145 bFirst = .T. 146 FOR lnLoop=1 TO 10 && ALEN(this.aconfig) 147 IF !EMPTY(THIS.aConfig(lnLoop,1)) 148 IF bFirst = .F. 149 sParams = sParams + "&" 150 ELSE 151 bFirst = .F. 152 ENDIF 153 sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2) 154 ELSE 155 EXIT 156 ENDIF 157 NEXT 158 RETURN(sParams) 159 ENDFUNC 160ENDDEFINE 161%>