[gen] Appy is now integrated to ckeditor 4.4.7 via CDN (check http://cdn.ckeditor.com).

This commit is contained in:
Gaetan Delannay 2015-02-22 12:42:04 +01:00
parent 302556192b
commit af635f936f
236 changed files with 72 additions and 3311 deletions

View file

@ -621,7 +621,7 @@ class Field:
res = copy.deepcopy(defaultFieldLayouts)
return res
def getCss(self, layoutType, res):
def getCss(self, layoutType, res, config):
'''This method completes the list p_res with the names of CSS files
that are required for displaying widgets of self's type on a given
p_layoutType. p_res is not a set because order of inclusion of CSS
@ -631,7 +631,7 @@ class Field:
if fileName not in res:
res.append(fileName)
def getJs(self, layoutType, res):
def getJs(self, layoutType, res, config):
'''This method completes the list p_res with the names of Javascript
files that are required for displaying widgets of self's type on a
given p_layoutType. p_res is not a set because order of inclusion of

View file

@ -209,13 +209,13 @@ class Date(Field):
historized, mapping, label, sdefault, scolspan, swidth,
sheight, persist, view, xml)
def getCss(self, layoutType, res):
# CSS files are only required if the calendar must be shown.
if self.calendar: Field.getCss(self, layoutType, res)
def getCss(self, layoutType, res, config):
# CSS files are only required if the calendar must be shown
if self.calendar: Field.getCss(self, layoutType, res, config)
def getJs(self, layoutType, res):
# Javascript files are only required if the calendar must be shown.
if self.calendar: Field.getJs(self, layoutType, res)
def getJs(self, layoutType, res, config):
# Javascript files are only required if the calendar must be shown
if self.calendar: Field.getJs(self, layoutType, res, config)
def getSelectableYears(self):
'''Gets the list of years one may select for this field.'''

View file

@ -186,13 +186,13 @@ class List(Field):
if value != None: return value
return ''
def getCss(self, layoutType, res):
'''Gets the CSS required by sub-fields if any.'''
def getCss(self, layoutType, res, config):
'''Gets the CSS required by sub-fields if any'''
for name, field in self.fields:
field.getCss(layoutType, res)
field.getCss(layoutType, res, config)
def getJs(self, layoutType, res):
'''Gets the JS required by sub-fields if any.'''
def getJs(self, layoutType, res, config):
'''Gets the JS required by sub-fields if any'''
for name, field in self.fields:
field.getJs(layoutType, res)
field.getJs(layoutType, res, config)
# ------------------------------------------------------------------------------

View file

@ -69,9 +69,9 @@ class Selection:
# ------------------------------------------------------------------------------
class String(Field):
# Javascript files sometimes required by this type
jsFiles = {'edit': ('ckeditor/ckeditor.js',),
'view': ('ckeditor/ckeditor.js',)}
# Javascript files sometimes required by this type. Method String.getJs
# below determines when the files must be included.
cdnUrl = '//cdn.ckeditor.com/%s/%s/ckeditor.js'
# Some predefined regular expressions that may be used as validators
c = re.compile
@ -944,8 +944,11 @@ class String(Field):
return 'XhtmlIndex'
return Field.getIndexType(self)
def getJs(self, layoutType, res):
if self.format == String.XHTML: Field.getJs(self, layoutType, res)
def getJs(self, layoutType, res, config):
if (self.format == String.XHTML) and (layoutType in ('edit', 'view')):
# Compute the URL to ckeditor CDN
ckUrl = String.cdnUrl % (config.ckVersion, config.ckDistribution)
if ckUrl not in res: res.append(ckUrl)
def getCaptchaChallenge(self, session):
'''Returns a Captcha challenge in the form of a dict. At key "text",
@ -983,8 +986,10 @@ class String(Field):
return 'en_US'
def getCkParams(self, obj, language):
'''Gets the base params to set on a rich text field.'''
ckAttrs = {'toolbar': 'Appy',
'''Gets the base params to set on a rich text field'''
ckAttrs = {'customConfig': '/ui/ckeditor/config.js',
'contentsCss': '/ui/ckeditor/contents.css',
'stylesSet': '/ui/ckeditor/styles.js', 'toolbar': 'Appy',
'format_tags': ';'.join(self.styles),
'scayt_sLang': self.getCkLanguage(obj, language)}
if self.width: ckAttrs['width'] = self.width