[gen] Master-slave fields: slave values can now ajax-change when the user modifies master values.
This commit is contained in:
parent
f7172be6ee
commit
b8ceb66a49
15 changed files with 253 additions and 74 deletions
|
@ -209,8 +209,12 @@ class ToolMixin(BaseMixin):
|
|||
|
||||
def getRootClasses(self):
|
||||
'''Returns the list of root classes for this application.'''
|
||||
cfg = self.getProductConfig()
|
||||
return [self.getAppyClass(k) for k in cfg.rootClasses]
|
||||
cfg = self.getProductConfig().appConfig
|
||||
rootClasses = cfg.rootClasses
|
||||
if not rootClasses:
|
||||
# We consider every class as being a root class.
|
||||
rootClasses = cfg.appClassNames
|
||||
return [self.getAppyClass(k) for k in rootClasses]
|
||||
|
||||
def getSearchInfo(self, className, refInfo=None):
|
||||
'''Returns, as an object:
|
||||
|
@ -466,6 +470,10 @@ class ToolMixin(BaseMixin):
|
|||
'''Gets the Appy class corresponding to the Zope class named p_name.
|
||||
If p_wrapper is True, it returns the Appy wrapper. Else, it returns
|
||||
the user-defined class.'''
|
||||
# p_zopeName may be the name of the Zope class *or* the name of the Appy
|
||||
# class (shorter, not prefixed with the underscored package path).
|
||||
classes = self.getProductConfig().allShortClassNames
|
||||
if zopeName in classes: zopeName = classes[zopeName]
|
||||
zopeClass = self.getZopeClass(zopeName)
|
||||
if wrapper: return zopeClass.wrapperClass
|
||||
else: return zopeClass.wrapperClass.__bases__[-1]
|
||||
|
|
|
@ -814,6 +814,20 @@ class BaseMixin:
|
|||
res.append(field)
|
||||
return res
|
||||
|
||||
def getSlaveFieldsRequestValues(self, pageName):
|
||||
'''Returns the list of slave fields having a masterValue being a
|
||||
method.'''
|
||||
res = {}
|
||||
req = self.REQUEST
|
||||
for field in self.getAllAppyTypes():
|
||||
if field.page.name != pageName: continue
|
||||
if field.masterValue and callable(field.masterValue):
|
||||
# We have such a field
|
||||
name = field.name
|
||||
if req.has_key(name) and req[name]:
|
||||
res[name] = req[name]
|
||||
return sutils.getStringDict(res)
|
||||
|
||||
def getCssJs(self, fields, layoutType, res):
|
||||
'''Gets, in p_res ~{'css':[s_css], 'js':[s_js]}~ the lists of
|
||||
Javascript and CSS files required by Appy types p_fields when shown
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue