[gen] Bugfixes.
This commit is contained in:
parent
f842c0ce02
commit
8b90d877a8
12 changed files with 92 additions and 74 deletions
|
@ -73,7 +73,9 @@ class Config:
|
|||
# of classes defined in your application.
|
||||
defaultCreators = ['Manager']
|
||||
# The "root" classes are those that will get their menu in the user
|
||||
# interface. Put their names in the list below.
|
||||
# interface. Put their names in the list below. If you leave the list empty,
|
||||
# all gen-classes will be considered root classes (the default). If
|
||||
# rootClasses is None, no class will be considered as root.
|
||||
rootClasses = []
|
||||
# Number of translations for every page on a Translation object
|
||||
translationsPerPage = 30
|
||||
|
|
|
@ -226,6 +226,7 @@ class ToolMixin(BaseMixin):
|
|||
'''Returns the list of root classes for this application'''
|
||||
cfg = self.getProductConfig().appConfig
|
||||
rootClasses = cfg.rootClasses
|
||||
if rootClasses == None: return [] # No root class at all
|
||||
if not rootClasses:
|
||||
# We consider every class as being a root class
|
||||
rootClasses = self.getProductConfig().appClassNames
|
||||
|
@ -259,19 +260,6 @@ class ToolMixin(BaseMixin):
|
|||
fields.append(field)
|
||||
return Object(fields=fields, nbOfColumns=nbOfColumns)
|
||||
|
||||
queryParamNames = ('className', 'search', 'sortKey', 'sortOrder',
|
||||
'filterKey', 'filterValue')
|
||||
def getQueryInfo(self):
|
||||
'''If we are showing search results, this method encodes in a string all
|
||||
the params in the request that are required for re-triggering the
|
||||
search.'''
|
||||
rq = self.REQUEST
|
||||
res = ''
|
||||
if rq.has_key('search'):
|
||||
res = ';'.join([rq.get(key,'').replace(';','') \
|
||||
for key in self.queryParamNames])
|
||||
return res
|
||||
|
||||
def showPortlet(self, obj, layoutType):
|
||||
'''When must the portlet be shown? p_obj and p_layoutType can be None
|
||||
if we are not browing any objet (ie, we are on the home page).'''
|
||||
|
|
|
@ -246,6 +246,8 @@ function AjaxData(hook, px, params, parentHook, url, mode, beforeSend, onGet) {
|
|||
/* If a parentHook is spefified, this AjaxData must be completed with a parent
|
||||
AjaxData instance. */
|
||||
this.parentHook = parentHook;
|
||||
// Inject this AjaxData instance into p_hook
|
||||
getAjaxHook(hook, true)['ajax'] = this;
|
||||
}
|
||||
|
||||
function askAjax(hook, form, params) {
|
||||
|
@ -269,6 +271,12 @@ function askAjax(hook, form, params) {
|
|||
}
|
||||
}
|
||||
}
|
||||
// Resolve dynamic parameter "cbChecked" if present
|
||||
if ('cbChecked' in d.params) {
|
||||
var cb = getAjaxHook(d.params['cbChecked'], true);
|
||||
if (cb) d.params['cbChecked'] = cb.checked;
|
||||
else delete d.params['cbChecked'];
|
||||
}
|
||||
// If a p_form id is given, integrate the form submission in the ajax request
|
||||
if (form) {
|
||||
var f = document.getElementById(form);
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
function toggleVisibility(node, nodeType){
|
||||
// Toggle visibility of all elements having p_nodeType within p_node
|
||||
var elements = node.getElementsByTagName(nodeType);
|
||||
for (var i=0; i<elements.length; i++){
|
||||
var sNode = elements[i];
|
||||
if (sNode.style.visibility == 'hidden') sNode.style.visibility = 'visible';
|
||||
else sNode.style.visibility = 'hidden';
|
||||
}
|
||||
}
|
||||
|
||||
function askMonthView(hookId, objectUrl, fieldName, month) {
|
||||
// Sends an Ajax request for getting the view month of a calendar field
|
||||
var params = {'month': month};
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxMonthView', params);
|
||||
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxViewMonth', params);
|
||||
}
|
||||
|
||||
function openEventPopup(action, fieldName, day, spansDays,
|
||||
|
@ -78,7 +88,7 @@ function triggerCalendarEvent(action, hookId, fieldName, objectUrl,
|
|||
}
|
||||
var elems = f.elements;
|
||||
var params = {};
|
||||
// Put form elements into "params".
|
||||
// Put form elements into "params"
|
||||
for (var i=0; i < elems.length; i++) {
|
||||
params[elems[i].name] = elems[i].value;
|
||||
}
|
||||
|
|
|
@ -121,8 +121,8 @@ class UserWrapper(AbstractWrapper):
|
|||
zopeUser = self.getZopeUser()
|
||||
tool = self.tool.o
|
||||
zopeUser.__ = self.encryptPassword(newPassword)
|
||||
req = tool.REQUEST
|
||||
if hasattr(req, 'user') and (req.userLogin == login):
|
||||
req = getattr(tool, 'REQUEST', None)
|
||||
if req and hasattr(req, 'user') and (req.userLogin == login):
|
||||
# The user for which we change the password is the currently logged
|
||||
# user. So update the authentication cookie, too.
|
||||
gutils.writeCookie(login, newPassword, self.request)
|
||||
|
|
|
@ -575,18 +575,20 @@ class AbstractWrapper(object):
|
|||
<tr valign="top" class=":rowCss"
|
||||
var2="tiedUid=tied.o.id;
|
||||
objectIndex=field.getIndexOf(zobj, tiedUid)|None;
|
||||
mayView=tied.o.mayView()"
|
||||
mayView=tied.o.mayView();
|
||||
cbId='%s_%s' % (ajaxHookId, currentNumber)"
|
||||
id=":tiedUid">
|
||||
<td if="not inPickList and numbered">:field.pxNumber</td>
|
||||
<td if="checkboxes" class="cbCell">
|
||||
<input if="mayView" type="checkbox" name=":ajaxHookId" checked="checked"
|
||||
<input if="mayView" type="checkbox" name=":ajaxHookId" id=":cbId"
|
||||
var2="checked=cbChecked|True" checked=":checked"
|
||||
value=":tiedUid" onclick="toggleCb(this)"/>
|
||||
</td>
|
||||
<td for="column in columns" width=":column.width" align=":column.align"
|
||||
var2="refField=column.field">:refField.pxRenderAsTied</td>
|
||||
<!-- Store data in this tr node allowing to ajax-refresh it -->
|
||||
<script>:field.getAjaxDataRow(tied, ajaxHookId, rowCss=rowCss, \
|
||||
currentNumber=currentNumber)</script>
|
||||
currentNumber=currentNumber, cbChecked=cbId)</script>
|
||||
</tr>''')
|
||||
|
||||
# When calling pxViewAsTied from Ajax, this surrounding PX is called to
|
||||
|
@ -624,18 +626,18 @@ class AbstractWrapper(object):
|
|||
cbId='%s_%s' % (checkboxesId, currentNumber)"
|
||||
id=":zobj.id" class=":rowCss" valign="top">
|
||||
<!-- A checkbox if required -->
|
||||
<td if="checkboxes" class="cbCell" id=":cbId"
|
||||
style=":'display:%s' % cbDisplay">
|
||||
<td if="checkboxes" class="cbCell" style=":'display:%s' % cbDisplay">
|
||||
<input type="checkbox" name=":checkboxesId" checked="checked"
|
||||
value=":zobj.id" onclick="toggleCb(this)"/>
|
||||
var2="checked=cbChecked|True" value=":zobj.id"
|
||||
onclick="toggleCb(this)" id=":cbId"/>
|
||||
</td>
|
||||
<td for="column in columns"
|
||||
var2="field=column.field" id=":'field_%s' % field.name"
|
||||
width=":column.width"
|
||||
align=":column.align">:field.pxRenderAsResult</td>
|
||||
<!-- Store data in this tr node allowing to ajax-refresh it -->
|
||||
<script>:uiSearch.getAjaxDataRow(zobj, ajaxHookId, \
|
||||
currentNumber=currentNumber, rowCss=rowCss)</script>
|
||||
<script>:uiSearch.getAjaxDataRow(zobj, ajaxHookId, rowCss=rowCss, \
|
||||
currentNumber=currentNumber, cbChecked=cbId)</script>
|
||||
</tr>''')
|
||||
|
||||
# When calling pxViewAsResult from Ajax, this surrounding PX is called to
|
||||
|
@ -1291,7 +1293,7 @@ class AbstractWrapper(object):
|
|||
i -= 1
|
||||
|
||||
def removeEvent(self, event):
|
||||
'''Removes p_event from this object's history.'''
|
||||
'''Removes p_event from this object's history'''
|
||||
res = []
|
||||
# Because data change events carry the workflow state, we must ensure
|
||||
# that, after having removed p_event, this workflow state is still
|
||||
|
@ -1313,7 +1315,7 @@ class AbstractWrapper(object):
|
|||
return self.o.formatText(text, format)
|
||||
|
||||
def listStates(self):
|
||||
'''Lists the possible states for this object.'''
|
||||
'''Lists the possible states for this object'''
|
||||
res = []
|
||||
o = self.o
|
||||
workflow = o.getWorkflow()
|
||||
|
@ -1325,7 +1327,7 @@ class AbstractWrapper(object):
|
|||
return res
|
||||
|
||||
def path(self, name):
|
||||
'''Returns the absolute file name of file stored in File field p_nnamed
|
||||
'''Returns the absolute file name of file stored in File field p_named
|
||||
p_name.'''
|
||||
v = getattr(self, name)
|
||||
if v: return v.getFilePath(self)
|
||||
|
@ -1337,7 +1339,7 @@ class AbstractWrapper(object):
|
|||
return o.getAppyType(name).getIndexOf(o, obj.uid)
|
||||
|
||||
def allows(self, permission, raiseError=False):
|
||||
'''Check doc @Mixin.allows.'''
|
||||
'''Check doc @Mixin.allows'''
|
||||
return self.o.allows(permission, raiseError=raiseError)
|
||||
|
||||
def resetLocalRoles(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue