Improved class appy.Hack to be able to hack static methods as well; [gen] pod field can now accept a string in param 'showTemplate' if a single format is accepted; when showing linked objects in a ref field, we show a message and no data for every object the currently logged user is not allowed to read; improved the default UI layout (less table borders).
This commit is contained in:
parent
0a174098f1
commit
b2dbef2bc4
16 changed files with 79 additions and 22 deletions
|
@ -249,6 +249,7 @@ class Pod(Field):
|
|||
formats = self.showTemplate(obj, template)
|
||||
if not formats: continue
|
||||
formats = isManager and self.getAllFormats(template) or formats
|
||||
if isinstance(formats, basestring): formats = (formats,)
|
||||
res.append(Object(template=template, formats=formats,
|
||||
freezeFormats=self.getFreezeFormats(obj, template)))
|
||||
return res
|
||||
|
|
|
@ -214,7 +214,8 @@ class Ref(Field):
|
|||
<x>:tool.pxNavigate</x>
|
||||
|
||||
<!-- No object is present -->
|
||||
<p class="discreet" if="not objects and not showPlusIcon">:_('no_ref')</p>
|
||||
<p class="discreet"
|
||||
if="not objects and (innerRef and showPlusIcon)">:_('no_ref')</p>
|
||||
|
||||
<!-- Linked objects -->
|
||||
<table if="objects" class=":not innerRef and 'list' or ''"
|
||||
|
@ -240,23 +241,29 @@ class Ref(Field):
|
|||
<tr for="tied in objects" valign="top"
|
||||
class=":loop.tied.odd and 'even' or 'odd'"
|
||||
var2="tiedUid=tied.o.id;
|
||||
objectIndex=field.getIndexOf(zobj, tiedUid)|None">
|
||||
objectIndex=field.getIndexOf(zobj, tiedUid)|None;
|
||||
mayView=tied.allows('read')">
|
||||
<td if="not inPickList and numbered">:field.pxNumber</td>
|
||||
<td for="column in columns" width=":column.width" align=":column.align"
|
||||
var2="refField=column.field">
|
||||
<!-- The "title" field -->
|
||||
<x if="refField.name == 'title'">
|
||||
<x>:field.pxObjectTitle</x>
|
||||
<div if="tied.o.mayAct()">:field.pxObjectActions</div>
|
||||
<x if="mayView">
|
||||
<x>:field.pxObjectTitle</x>
|
||||
<div if="tied.o.mayAct()">:field.pxObjectActions</div>
|
||||
</x>
|
||||
<div if="not mayView">
|
||||
<img src=":url('fake')" style="margin-right: 5px"/>
|
||||
<x>:_('unauthorized')</x></div>
|
||||
</x>
|
||||
<!-- Any other field -->
|
||||
<x if="refField.name != 'title'">
|
||||
<x if="(refField.name != 'title') and mayView">
|
||||
<x var="zobj=tied.o; obj=tied; layoutType='cell';
|
||||
innerRef=True; field=refField"
|
||||
if="field.isShowable(zobj, 'result')">:field.pxRender</x>
|
||||
</x>
|
||||
</td>
|
||||
<td if="checkboxes" class="cbCell">
|
||||
<td if="checkboxes and mayView" class="cbCell">
|
||||
<input type="checkbox" name=":ajaxHookId" checked="checked"
|
||||
value=":tiedUid" onclick="toggleRefCb(this)"/>
|
||||
</td>
|
||||
|
|
|
@ -395,7 +395,14 @@ class Transition:
|
|||
self.trigger(name, obj, wf, rq.get('comment', ''), reindex=False)
|
||||
# Reindex obj if required.
|
||||
if not obj.isTemporary(): obj.reindex()
|
||||
return tool.goto(obj.getUrl(rq['HTTP_REFERER']))
|
||||
# If we are viewing the object and if the logged user looses the
|
||||
# permission to view it, redirect the user to its home page.
|
||||
if not obj.allows('read') and \
|
||||
(obj.absolute_url_path() in rq['HTTP_REFERER']):
|
||||
back = tool.getHomePage()
|
||||
else:
|
||||
back = obj.getUrl(rq['HTTP_REFERER'])
|
||||
return tool.goto(back)
|
||||
|
||||
@staticmethod
|
||||
def getBack(workflow, transition):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue