[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,67 +52,60 @@ 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"> var2="freezeAllowed=(fmt in info.freezeFormats) and \
<tr> (field.show != 'result');
<td for="fmt in info.formats" frozen=field.isFrozen(obj, info.template, fmt)">
var2="freezeAllowed=(fmt in info.freezeFormats) and \ <!-- A clickable icon if no freeze action is allowed -->
(field.show != 'result'); <x if="not freezeAllowed">:field.pxIcon</x>
frozen=field.isFrozen(obj, info.template, fmt)"> <!-- A clickable icon and a dropdown menu else. -->
<!-- A clickable icon if no freeze action is allowed --> <span if="freezeAllowed" class="dropdownMenu"
<x if="not freezeAllowed">:field.pxIcon</x> var2="dropdownId='%s_%s' % (uid, \
<!-- A clickable icon and a dropdown menu else. -->
<div if="freezeAllowed" class="dropdownMenu"
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" width="75px">
<table id=":dropdownId" class="dropdown"> <!-- Unfreeze -->
<!-- Unfreeze --> <tr if="frozen" valign="top">
<tr if="frozen" valign="top"> <td>
<td> <a onclick=":'freezePod(%s,%s,%s,%s,%s)' % (q(uid), q(name), \
<a onclick=":'freezePod(%s,%s,%s,%s,%s)' % (q(uid), q(name), \ q(info.template), q(fmt), q('unfreeze'))"
q(info.template), q(fmt), q('unfreeze'))" class="smaller">:_('unfreezeField')</a>
class="smaller">:_('unfreezeField')</a>
</td>
<td align="center"><img src=":url('unfreeze')"/></td>
</tr>
<!-- (Re-)freeze -->
<tr valign="top">
<td>
<a onclick=":'freezePod(%s,%s,%s,%s,%s)' % (q(uid), q(name), \
q(info.template), q(fmt), q('freeze'))"
class="smaller">:_('freezeField')</a>
</td>
<td align="center"><img src=":url('freeze')"/></td>
</tr>
<!-- (Re-)upload -->
<tr valign="top">
<td>
<a onclick=":'uploadPod(%s,%s,%s,%s)' % (q(uid), q(name), \
q(info.template), q(fmt))"
class="smaller">:_('uploadField')</a>
</td>
<td align="center"><img src=":url('upload')"/></td>
</tr>
</table>
</div>
</td> </td>
<!-- Show the specific template name only if there is more than one <td align="center"><img src=":url('unfreeze')"/></td>
template. For a single template, the field label already does </tr>
the job. --> <!-- (Re-)freeze -->
<td if="len(field.template) &gt; 1" style="padding-left: 3px" <tr valign="top">
class="smaller">:field.getTemplateName(obj, info.template)</td> <td>
<a onclick=":'freezePod(%s,%s,%s,%s,%s)' % (q(uid), q(name), \
q(info.template), q(fmt), q('freeze'))"
class="smaller">:_('freezeField')</a>
</td>
<td align="center"><img src=":url('freeze')"/></td>
</tr>
<!-- (Re-)upload -->
<tr valign="top">
<td>
<a onclick=":'uploadPod(%s,%s,%s,%s)' % (q(uid), q(name), \
q(info.template), q(fmt))"
class="smaller">:_('uploadField')</a>
</td>
<td align="center"><img src=":url('upload')"/></td>
</tr> </tr>
</table> </table>
</td> </span>
</tr> </x>
</table>''') <!-- Show the specific template name only if there is more than one
template. For a single template, the field label already does the
job. -->
<span if="len(field.template) &gt; 1"
class=":not loop.info.last and 'pod smaller' or \
'smaller'">:field.getTemplateName(obj, info.template)</span>
</x>''')
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>