Back to index

moin  1.9.0~rc2
Public Member Functions | Public Attributes
fckeditor.FCKeditor Class Reference

List of all members.

Public Member Functions

def __init__
def Create
def CreateHtml
def IsCompatible
def GetConfigFieldString

Public Attributes

 InstanceName
 BasePath
 Width
 Height
 ToolbarSet
 Value
 Config

Detailed Description

Definition at line 44 of file fckeditor.py.


Constructor & Destructor Documentation

def fckeditor.FCKeditor.__init__ (   self,
  instanceName 
)

Definition at line 45 of file fckeditor.py.

00045 
00046        def __init__(self, instanceName):
00047               self.InstanceName = instanceName
00048               self.BasePath = '/fckeditor/'
00049               self.Width = '100%'
00050               self.Height = '200'
00051               self.ToolbarSet = 'Default'
00052               self.Value = '';
00053 
00054               self.Config = {}


Member Function Documentation

Definition at line 55 of file fckeditor.py.

00055 
00056        def Create(self):
00057               return self.CreateHtml()

Here is the call graph for this function:

Definition at line 58 of file fckeditor.py.

00058 
00059        def CreateHtml(self):
00060               HtmlValue = escape(self.Value)
00061               Html = ""
00062 
00063               if (self.IsCompatible()):
00064                      File = "fckeditor.html"
00065                      Link = "%seditor/%s?InstanceName=%s" % (
00066                                    self.BasePath,
00067                                    File,
00068                                    self.InstanceName
00069                                    )
00070                      if (self.ToolbarSet is not None):
00071                             Link += "&Toolbar=%s" % self.ToolbarSet
00072 
00073                      # Render the linked hidden field
00074                      Html += "<input type=\"hidden\" id=\"%s\" name=\"%s\" value=\"%s\" style=\"display:none\" />" % (
00075                                    self.InstanceName,
00076                                    self.InstanceName,
00077                                    HtmlValue
00078                                    )
00079 
00080                      # Render the configurations hidden field
00081                      Html += "<input type=\"hidden\" id=\"%s___Config\" value=\"%s\" style=\"display:none\" />" % (
00082                                    self.InstanceName,
00083                                    self.GetConfigFieldString()
00084                                    )
00085 
00086                      # Render the editor iframe
00087                      Html += "<iframe id=\"%s\__Frame\" src=\"%s\" width=\"%s\" height=\"%s\" frameborder=\"0\" scrolling=\"no\"></iframe>" % (
00088                                    self.InstanceName,
00089                                    Link,
00090                                    self.Width,
00091                                    self.Height
00092                                    )
00093               else:
00094                      if (self.Width.find("%%") < 0):
00095                             WidthCSS = "%spx" % self.Width
00096                      else:
00097                             WidthCSS = self.Width
00098                      if (self.Height.find("%%") < 0):
00099                             HeightCSS = "%spx" % self.Height
00100                      else:
00101                             HeightCSS = self.Height
00102 
00103                      Html += "<textarea name=\"%s\" rows=\"4\" cols=\"40\" style=\"width: %s; height: %s;\" wrap=\"virtual\">%s</textarea>" % (
00104                                    self.InstanceName,
00105                                    WidthCSS,
00106                                    HeightCSS,
00107                                    HtmlValue
00108                                    )
00109               return Html

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 142 of file fckeditor.py.

00142 
00143        def GetConfigFieldString(self):
00144               sParams = ""
00145               bFirst = True
00146               for sKey in self.Config.keys():
00147                      sValue = self.Config[sKey]
00148                      if (not bFirst):
00149                             sParams += "&amp;"
00150                      else:
00151                             bFirst = False
00152                      if (sValue):
00153                             k = escape(sKey)
00154                             v = escape(sValue)
00155                             if (sValue == "true"):
00156                                    sParams += "%s=true" % k
00157                             elif (sValue == "false"):
00158                                    sParams += "%s=false" % k
00159                             else:
00160                                    sParams += "%s=%s" % (k, v)
00161               return sParams

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 110 of file fckeditor.py.

00110 
00111        def IsCompatible(self):
00112               if (os.environ.has_key("HTTP_USER_AGENT")):
00113                      sAgent = os.environ.get("HTTP_USER_AGENT", "")
00114               else:
00115                      sAgent = ""
00116               if (sAgent.find("MSIE") >= 0) and (sAgent.find("mac") < 0) and (sAgent.find("Opera") < 0):
00117                      i = sAgent.find("MSIE")
00118                      iVersion = float(sAgent[i+5:i+5+3])
00119                      if (iVersion >= 5.5):
00120                             return True
00121                      return False
00122               elif (sAgent.find("Gecko/") >= 0):
00123                      i = sAgent.find("Gecko/")
00124                      iVersion = int(sAgent[i+6:i+6+8])
00125                      if (iVersion >= 20030210):
00126                             return True
00127                      return False
00128               elif (sAgent.find("Opera/") >= 0):
00129                      i = sAgent.find("Opera/")
00130                      iVersion = float(sAgent[i+6:i+6+4])
00131                      if (iVersion >= 9.5):
00132                             return True
00133                      return False
00134               elif (sAgent.find("AppleWebKit/") >= 0):
00135                      p = re.compile('AppleWebKit\/(\d+)', re.IGNORECASE)
00136                      m = p.search(sAgent)
00137                      if (m.group(1) >= 522):
00138                             return True
00139                      return False
00140               else:
00141                      return False

Here is the caller graph for this function:


Member Data Documentation

Definition at line 47 of file fckeditor.py.

Definition at line 53 of file fckeditor.py.

Definition at line 49 of file fckeditor.py.

Definition at line 46 of file fckeditor.py.

Definition at line 50 of file fckeditor.py.

Definition at line 51 of file fckeditor.py.

Definition at line 48 of file fckeditor.py.


The documentation for this class was generated from the following file: