source: sandbox/filemanager/tp/fckeditor/fckeditor.afp @ 1575

Revision 1575, 4.2 KB checked in by amuller, 14 years ago (diff)

Ticket #597 - Implentação, melhorias do modulo gerenciador de arquivos

  • Property svn:executable set to *
Line 
1<%
2 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
3 * Copyright (C) 2003-2009 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 = []
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                RETURN (html)
98        ENDFUNC
99
100
101&& -----------------------------------------------------------------------
102        FUNCTION IsCompatible()
103                LOCAL llRetval
104                LOCAL sAgent
105
106                llRetval=.F.
107
108                SET POINT TO "."
109
110                sAgent = LOWER(ALLTRIM(request.servervariables("HTTP_USER_AGENT")))
111
112                IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0
113                        iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3))
114                        llRetval= iVersion > 5.5
115                ELSE
116                        IF AT("gecko/",sAgent)>0
117                                iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8))
118                                llRetval =iVersion > 20030210
119                        ENDIF
120                ELSE
121                        IF AT("opera/",sAgent)>0
122                                iVersion=VAL(SUBSTR(sAgent,AT("opera/",sAgent)+6,4))
123                                llRetval =iVersion >= 9.5
124                        ENDIF
125                ELSE
126                        IF AT("applewebkit/",sAgent)>0
127                                iVersion=VAL(SUBSTR(sAgent,AT("applewebkit/",sAgent)+12,3))
128                                llRetval =iVersion >= 522
129                        ENDIF
130                ENDIF
131
132                SET POINT TO
133
134                RETURN (llRetval)
135        ENDFUNC
136
137&& -----------------------------------------------------------------------
138        FUNCTION GetConfigFieldString()
139                LOCAL sParams
140                LOCAL bFirst
141                LOCAL sKey
142                sParams = ""
143                bFirst = .T.
144                FOR lnLoop=1 TO 10 && ALEN(this.aconfig)
145                        IF !EMPTY(THIS.aConfig(lnLoop,1))
146                                IF bFirst = .F.
147                                        sParams = sParams + "&"
148                                ELSE
149                                        bFirst = .F.
150                                ENDIF
151                                sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2)
152                        ELSE
153                                EXIT
154                        ENDIF
155                NEXT
156                RETURN(sParams)
157        ENDFUNC
158ENDDEFINE
159%>
Note: See TracBrowser for help on using the repository browser.