[ Index ]
 

Code source de FCKeditor 2.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/ -> fckeditor.afp (source)

   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   * File Name: fckeditor.afp
  22   *    This is the integration file for Active FoxPro Pages.
  23   * 
  24   * Version:  1.01 
  25   * Modified: 2006-11-13
  26   * 
  27   * File Authors: Soenke Freitag (www.afp-hosting.de)
  28   *         
  29  
  30  DEFINE CLASS goFckeditor AS CONTAINER OLEPUBLIC
  31  
  32      cInstanceName =""
  33      BasePath =""
  34      cWIDTH =""
  35      cHEIGHT =""
  36      ToolbarSet =""
  37      cValue=""
  38      DIMENSION aConfig(10,2)
  39  
  40  && -----------------------------------------------------------------------
  41      FUNCTION fckeditor( tcInstanceName )
  42          LOCAL lnLoop,lnLoop2
  43          THIS.cInstanceName    = tcInstanceName
  44          THIS.BasePath    = '/fckeditor/'
  45          THIS.cWIDTH        = '100%'
  46          THIS.cHEIGHT    = '200'
  47          THIS.ToolbarSet    = 'Default'
  48          THIS.cValue        = ''
  49          FOR lnLoop=1 TO 10
  50              FOR lnLoop2=1 TO 2
  51                  THIS.aConfig(lnLoop,lnLoop2)    = ""
  52              NEXT
  53          NEXT
  54          RETURN
  55      ENDFUNC
  56  
  57  
  58  && -----------------------------------------------------------------------
  59      FUNCTION CREATE()
  60          ? THIS.CreateHtml()
  61          RETURN
  62      ENDFUNC
  63  
  64  && -----------------------------------------------------------------------
  65      FUNCTION CreateHtml()
  66          LOCAL html
  67          LOCAL lcLink
  68  
  69          HtmlValue = THIS.cValue        && HTMLSPECIALCHARS()
  70  
  71          html = [<div>]
  72          IF THIS.IsCompatible()
  73              lcLink = THIS.BasePath+[editor/fckeditor.html?InstanceName=]+THIS.cInstanceName
  74  
  75              IF ( !THIS.ToolbarSet == '' )
  76                  lcLink = lcLink + [&Toolbar=]+THIS.ToolbarSet
  77              ENDIF
  78  
  79              && Render the LINKED HIDDEN FIELD.
  80              html = html + [<input type="hidden" id="]+THIS.cInstanceName +[" name="]+THIS.cInstanceName +[" value="]+HtmlValue+[" style="display:none" />]
  81  
  82              && Render the configurations HIDDEN FIELD.
  83              html = html + [<input type="hidden" id="]+THIS.cInstanceName +[___Config" value="]+THIS.GetConfigFieldString() + [" style="display:none" />] +CHR(13)+CHR(10)
  84  
  85              && Render the EDITOR IFRAME.
  86              html = html + [<iframe id="]+THIS.cInstanceName +[___Frame" src="Link" width="]+THIS.cWIDTH+[" height="]+THIS.cHEIGHT+[" frameborder="0" scrolling="no"></iframe>]
  87          ELSE
  88              IF ( AT("%", THIS.cWIDTH)=0 )
  89                  WidthCSS = THIS.cWIDTH + 'px'
  90              ELSE
  91                  WidthCSS = THIS.cWIDTH
  92              ENDIF
  93  
  94              IF ( AT("%",THIS.cHEIGHT)=0  )
  95                  HeightCSS = THIS.cHEIGHT + 'px'
  96              ELSE
  97                  HeightCSS = THIS.cHEIGHT
  98              ENDIF
  99  
 100              html = html + [<textarea name="]+THIS.cInstanceName +[" rows="4" cols="40" style="width: ]+WidthCSS+[ height: ]+HeightCSS+[">]+HtmlValue+[</textarea>]
 101          ENDIF
 102  
 103          html = html + [</div>]
 104  
 105          RETURN (html)
 106      ENDFUNC
 107  
 108  
 109  && -----------------------------------------------------------------------
 110      FUNCTION IsCompatible()
 111          LOCAL llRetval
 112          LOCAL sAgent
 113  
 114          llRetval=.F.
 115  
 116  
 117          sAgent = LOWER(ALLTRIM(request.servervariables("HTTP_USER_AGENT")))
 118  
 119          IF AT("msie",sAgent) >0 .AND. AT("mac",sAgent)=0 .AND. AT("opera",sAgent)=0
 120              iVersion=VAL(SUBSTR(sAgent,AT("msie",sAgent)+5,3))
 121              llRetval= iVersion > 5.5
 122          ELSE
 123              IF AT("gecko",sAgent)>0
 124                  iVersion=VAL(SUBSTR(sAgent,AT("gecko/",sAgent)+6,8))
 125                  llRetval =iVersion > 20030210
 126              ENDIF
 127          ENDIF
 128          RETURN (llRetval)
 129      ENDFUNC
 130  
 131  && -----------------------------------------------------------------------
 132      FUNCTION GetConfigFieldString()
 133          LOCAL sParams
 134          LOCAL bFirst
 135          LOCAL sKey
 136          sParams = ""
 137          bFirst = .T.
 138          FOR lnLoop=1 TO 10 && ALEN(this.aconfig)
 139              IF !EMPTY(THIS.aConfig(lnLoop,1))
 140                  IF bFirst = .F.
 141                      sParams = sParams + "&"
 142                  ELSE
 143                      bFirst = .F.
 144                  ENDIF
 145                  sParams = sParams +THIS.aConfig(lnLoop,1)+[=]+THIS.aConfig(lnLoop,2)
 146              ELSE
 147                  EXIT
 148              ENDIF
 149          NEXT
 150          RETURN(sParams)
 151      ENDFUNC
 152  ENDDEFINE
 153  %>


Généré le : Sun Feb 25 15:28:05 2007 par Balluche grâce à PHPXref 0.7