source: companies/celepar/news_admin/templates/celepar/fckeditor/to_delete/fckeditor.afp @ 763

Revision 763, 3.7 KB checked in by niltonneto, 15 years ago (diff)

Importação inicial do Expresso da Celepar

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