[gen] Bugfix: rendering of pod fields.

This commit is contained in:
Gaetan Delannay 2014-05-14 17:05:50 +02:00
parent b4e6333472
commit 79837d3f00
3 changed files with 56 additions and 62 deletions

View file

@ -32,7 +32,7 @@ class Pod(Field):
from data contained in Appy class and linked objects or anything you from data contained in Appy class and linked objects or anything you
want to put in it. It is the way gen uses pod.''' want to put in it. It is the way gen uses pod.'''
# Layout for rendering a POD field for exporting query results. # Layout for rendering a POD field for exporting query results.
rLayouts = {'view': 'l-f!'} rLayouts = {'view': 'fl!'}
allFormats = {'.odt': ('pdf', 'doc', 'odt'), '.ods': ('xls', 'ods')} allFormats = {'.odt': ('pdf', 'doc', 'odt'), '.ods': ('xls', 'ods')}
POD_ERROR = 'An error occurred while generating the document. Please ' \ POD_ERROR = 'An error occurred while generating the document. Please ' \
'contact the system administrator.' 'contact the system administrator.'
@ -52,27 +52,23 @@ class Pod(Field):
q(info.template), q(fmt), q(ztool.getQueryInfo()))"/>''') q(info.template), q(fmt), q(ztool.getQueryInfo()))"/>''')
pxView = pxCell = Px(''' pxView = pxCell = Px('''
<table cellpadding="0" cellspacing="0" var="uid=obj.uid"> <x var="uid=obj.uid"
<tr> for="info in field.getVisibleTemplates(obj)">
<td for="info in field.getVisibleTemplates(obj)"> <x for="fmt in info.formats"
<table cellpadding="0" cellspacing="0" class="podTable">
<tr>
<td for="fmt in info.formats"
var2="freezeAllowed=(fmt in info.freezeFormats) and \ var2="freezeAllowed=(fmt in info.freezeFormats) and \
(field.show != 'result'); (field.show != 'result');
frozen=field.isFrozen(obj, info.template, fmt)"> frozen=field.isFrozen(obj, info.template, fmt)">
<!-- A clickable icon if no freeze action is allowed --> <!-- A clickable icon if no freeze action is allowed -->
<x if="not freezeAllowed">:field.pxIcon</x> <x if="not freezeAllowed">:field.pxIcon</x>
<!-- A clickable icon and a dropdown menu else. --> <!-- A clickable icon and a dropdown menu else. -->
<div if="freezeAllowed" class="dropdownMenu" <span if="freezeAllowed" class="dropdownMenu"
var2="dropdownId='%s_%s' % (uid, \ var2="dropdownId='%s_%s' % (uid, \
field.getFreezeName(info.template, fmt, sep='_'))" field.getFreezeName(info.template, fmt, sep='_'))"
onmouseover=":'toggleDropdown(%s)' % q(dropdownId)" onmouseover=":'toggleDropdown(%s)' % q(dropdownId)"
onmouseout=":'toggleDropdown(%s,%s)' % (q(dropdownId), \ onmouseout=":'toggleDropdown(%s,%s)' % (q(dropdownId), q('none'))">
q('none'))">
<x>:field.pxIcon</x> <x>:field.pxIcon</x>
<!-- The dropdown menu containing freeze actions --> <!-- The dropdown menu containing freeze actions -->
<table id=":dropdownId" class="dropdown"> <table id=":dropdownId" class="dropdown" width="75px">
<!-- Unfreeze --> <!-- Unfreeze -->
<tr if="frozen" valign="top"> <tr if="frozen" valign="top">
<td> <td>
@ -101,18 +97,15 @@ class Pod(Field):
<td align="center"><img src=":url('upload')"/></td> <td align="center"><img src=":url('upload')"/></td>
</tr> </tr>
</table> </table>
</div> </span>
</td> </x>
<!-- Show the specific template name only if there is more than one <!-- Show the specific template name only if there is more than one
template. For a single template, the field label already does template. For a single template, the field label already does the
the job. --> job. -->
<td if="len(field.template) &gt; 1" style="padding-left: 3px" <span if="len(field.template) &gt; 1"
class="smaller">:field.getTemplateName(obj, info.template)</td> class=":not loop.info.last and 'pod smaller' or \
</tr> 'smaller'">:field.getTemplateName(obj, info.template)</span>
</table> </x>''')
</td>
</tr>
</table>''')
pxEdit = pxSearch = '' pxEdit = pxSearch = ''

View file

@ -99,7 +99,7 @@ td.search { padding-top: 8px }
.dropdown { display:none; position: absolute; border: 1px solid #cccccc; .dropdown { display:none; position: absolute; border: 1px solid #cccccc;
background-color: white; padding: 3px 4px 0; font-size: 8pt; background-color: white; padding: 3px 4px 0; font-size: 8pt;
font-weight: normal; z-index: 2 } font-weight: normal; z-index: 2 }
.dropdownMenu { cursor: pointer; padding-right: 4px; font-size: 93% } .dropdownMenu { cursor: pointer; font-size: 93%; position: relative }
.dropdown a:hover { text-decoration: underline } .dropdown a:hover { text-decoration: underline }
.list { margin-bottom: 3px } .list { margin-bottom: 3px }
.list td, .list th { border: 3px solid #ededed; color: grey; .list td, .list th { border: 3px solid #ededed; color: grey;
@ -156,7 +156,7 @@ td.search { padding-top: 8px }
.first { margin-top: 0px } .first { margin-top: 0px }
.error { margin: 5px } .error { margin: 5px }
.smaller { font-size: 95% } .smaller { font-size: 95% }
.podTable { margin-left: 15px } .pod { padding-right: 15px }
.cbCell { width: 10px; text-align: center} .cbCell { width: 10px; text-align: center}
.tabs { position:relative; bottom:-2px } .tabs { position:relative; bottom:-2px }
.tab { padding: 0 10px 0 10px; text-align: center; font-size: 90%; .tab { padding: 0 10px 0 10px; text-align: center; font-size: 90%;

View file

@ -438,13 +438,14 @@ class ToolWrapper(AbstractWrapper):
if="zobjects and fields" align=":dright"> if="zobjects and fields" align=":dright">
<tr> <tr>
<td var="zobj=zobjects[0]; obj=zobj.appy()" <td var="zobj=zobjects[0]; obj=zobj.appy()"
for="field in fields">:field.pxRender</td> for="field in fields"
class=":not loop.field.last and 'pod' or ''">:field.pxRender</td>
</tr> </tr>
</table> </table>
<!-- The title of the search --> <!-- The title of the search -->
<p> <p>
<x>:uiSearch.translated</x> (<span class="discreet">:totalNumber</span>) <x>::uiSearch.translated</x> (<span class="discreet">:totalNumber</span>)
<x if="showNewSearch and (searchName == 'customSearch')">&nbsp;&mdash; <x if="showNewSearch and (searchName == 'customSearch')">&nbsp;&mdash;
&nbsp;<i><a href=":newSearchUrl">:_('search_new')</a></i> &nbsp;<i><a href=":newSearchUrl">:_('search_new')</a></i>
</x> </x>