Changeset 417
- Timestamp:
- 2007-07-07 17:21:51 (18 months ago)
- Files:
-
- 1 modified
-
FCKeditor/trunk/fckeditor.asp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
FCKeditor/trunk/fckeditor.asp
r347 r417 78 78 End Property 79 79 80 Public Function Create( instanceName ) 81 82 Response.Write "<div>" 80 ' Generates the instace of the editor in the HTML output of the page. 81 Public Sub Create( instanceName ) 82 response.write CreateHtml( instanceName ) 83 end Sub 84 85 ' Returns the html code that must be used to generate an instance of FCKeditor. 86 Public Function CreateHtml( instanceName ) 87 dim html 83 88 84 89 If IsCompatible() Then 85 90 86 Dim sFile 91 Dim sFile, sLink 87 92 If Request.QueryString( "fcksource" ) = "true" Then 88 93 sFile = "fckeditor.original.html" … … 91 96 End If 92 97 93 Dim sLink94 98 sLink = sBasePath & "editor/" & sFile & "?InstanceName=" + instanceName 95 99 … … 98 102 End If 99 103 104 html = "" 100 105 ' Render the linked hidden field. 101 Response.Write"<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />"106 html = html & "<input type=""hidden"" id=""" & instanceName & """ name=""" & instanceName & """ value=""" & Server.HTMLEncode( sValue ) & """ style=""display:none"" />" 102 107 103 108 ' Render the configurations hidden field. 104 Response.Write"<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />"109 html = html & "<input type=""hidden"" id=""" & instanceName & "___Config"" value=""" & GetConfigFieldString() & """ style=""display:none"" />" 105 110 106 111 ' Render the editor IFRAME. 107 Response.Write"<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>"112 html = html & "<iframe id=""" & instanceName & "___Frame"" src=""" & sLink & """ width=""" & sWidth & """ height=""" & sHeight & """ frameborder=""0"" scrolling=""no""></iframe>" 108 113 109 114 Else … … 123 128 End If 124 129 125 Response.Write"<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>"130 html = "<textarea name=""" & instanceName & """ rows=""4"" cols=""40"" style=""width: " & sWidthCSS & "; height: " & sHeightCSS & """>" & Server.HTMLEncode( sValue ) & "</textarea>" 126 131 127 132 End If 128 133 129 Response.Write"</div>"134 CreateHtml = "<div>" & html & "</div>" 130 135 131 136 End Function … … 133 138 Private Function IsCompatible() 134 139 135 Dim sAgent 136 sAgent = Request.ServerVariables("HTTP_USER_AGENT") 137 138 Dim iVersion 139 140 If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0 AND InStr(sAgent, "Opera") <= 0 Then 141 iVersion = CInt( ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) ) 142 IsCompatible = ( iVersion >= 5.5 ) 143 ElseIf InStr(sAgent, "Gecko/") > 0 Then 144 iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) ) 145 IsCompatible = ( iVersion >= 20030210 ) 146 Else 147 IsCompatible = False 148 End If 140 IsCompatible = FCKeditor_IsCompatibleBrowser() 149 141 150 142 End Function … … 205 197 206 198 End Class 199 200 201 ' A function that can be used to check if the current browser is compatible with FCKeditor 202 ' without the need to create an instance of the class. 203 Function FCKeditor_IsCompatibleBrowser() 204 205 Dim sAgent 206 sAgent = Request.ServerVariables("HTTP_USER_AGENT") 207 208 Dim iVersion 209 210 If InStr(sAgent, "MSIE") > 0 AND InStr(sAgent, "mac") <= 0 AND InStr(sAgent, "Opera") <= 0 Then 211 iVersion = CInt( ToNumericFormat( Mid(sAgent, InStr(sAgent, "MSIE") + 5, 3) ) ) 212 FCKeditor_IsCompatibleBrowser = ( iVersion >= 5.5 ) 213 ElseIf InStr(sAgent, "Gecko/") > 0 Then 214 iVersion = CLng( Mid( sAgent, InStr( sAgent, "Gecko/" ) + 6, 8 ) ) 215 FCKeditor_IsCompatibleBrowser = ( iVersion >= 20030210 ) 216 Else 217 FCKeditor_IsCompatibleBrowser = False 218 End If 219 220 End Function 207 221 %>