[gen] Bugfix: name clash when a transition is named 'comment'. [gen] Added AbstractWrapper::getHistoryComments allowing to collect comments of all history events of some type.
This commit is contained in:
parent
cf0309cb26
commit
424c0521de
4 changed files with 22 additions and 10 deletions
|
@ -989,11 +989,11 @@ function askConfirm(actionType, action, msg, showComment) {
|
|||
|
||||
// Transfer comment from the confirm form to some other form
|
||||
function transferComment(confirmForm, targetForm) {
|
||||
if ((confirmForm.comment.style.display != 'none') &&
|
||||
(confirmForm.comment.value)) {
|
||||
targetForm.comment.value = confirmForm.comment.value;
|
||||
if ((confirmForm.popupComment.style.display != 'none') &&
|
||||
(confirmForm.popupComment.value)) {
|
||||
targetForm.popupComment.value = confirmForm.popupComment.value;
|
||||
// Clean the confirm form
|
||||
confirmForm.comment.value = '';
|
||||
confirmForm.popupComment.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -105,7 +105,7 @@ class AbstractWrapper(object):
|
|||
<input type="hidden" name="action"/>
|
||||
<div id="commentArea" align=":dleft"><br/>
|
||||
<span class="discreet">:_('workflow_comment')</span>
|
||||
<textarea name="comment" cols="30" rows="3"></textarea>
|
||||
<textarea name="popupComment" cols="30" rows="3"></textarea>
|
||||
<br/>
|
||||
</div><br/>
|
||||
<input type="button" onclick="doConfirm()" value=":_('yes')"/>
|
||||
|
@ -379,7 +379,7 @@ class AbstractWrapper(object):
|
|||
style="display: inline" method="post">
|
||||
<input type="hidden" name="transition"/>
|
||||
<!-- Input field for storing the comment coming from the popup -->
|
||||
<textarea id="comment" name="comment" cols="30" rows="3"
|
||||
<textarea id="popupComment" name="popupComment" cols="30" rows="3"
|
||||
style="display:none"></textarea>
|
||||
<x for="transition in transitions">
|
||||
<!-- Render a transition or a group of transitions. -->
|
||||
|
@ -1291,6 +1291,17 @@ class AbstractWrapper(object):
|
|||
if condition: return event
|
||||
i -= 1
|
||||
|
||||
def getHistoryComments(self, transition, xhtml=False):
|
||||
'''Gets the concatenation of all comments for all transitions of type
|
||||
p_transition in the object history.'''
|
||||
res = []
|
||||
for event in self.history:
|
||||
if event['action'] != transition: continue
|
||||
if not event['comments']: continue
|
||||
res.append(event['comments'])
|
||||
br = xhtml and '<br/>' or '\n'
|
||||
return br.join(res)
|
||||
|
||||
def removeEvent(self, event):
|
||||
'''Removes p_event from this object's history'''
|
||||
res = []
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue