[gen] Various bugfixes: single-temlplate pod fields, ajax master/slaves and IE10, popup management.

This commit is contained in:
Gaetan Delannay 2014-04-14 20:55:23 +02:00
parent a417db2ad9
commit ac08d2d795
5 changed files with 26 additions and 31 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': Table('fl', width=None)} rLayouts = {'view': 'l-f!'}
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.'
@ -103,7 +103,11 @@ class Pod(Field):
</table> </table>
</div> </div>
</td> </td>
<td class="podName">:field.getTemplateName(obj, info.template)</td> <!-- Show the specific template name only if there is more than one
template. For a single template, the field label already does
the job. -->
<td if="len(field.template) &gt; 1"
class="podName">:field.getTemplateName(obj, info.template)</td>
</tr> </tr>
</table> </table>
</td> </td>
@ -232,20 +236,20 @@ class Pod(Field):
def getVisibleTemplates(self, obj): def getVisibleTemplates(self, obj):
'''Returns, among self.template, the template(s) that can be shown.''' '''Returns, among self.template, the template(s) that can be shown.'''
isManager = obj.user.has_role('Manager') res = []
if not self.showTemplate: if not self.showTemplate:
# Show them all in any format. # Show them all in any format.
res = []
for template in self.template: for template in self.template:
res.append(Object(template=template, res.append(Object(template=template,
formats=self.getAllFormats(template), formats=self.getAllFormats(template),
freezeFormats=self.getFreezeFormats(obj, template))) freezeFormats=self.getFreezeFormats(obj, template)))
res = [] else:
for template in self.template: isManager = obj.user.has_role('Manager')
formats = isManager and self.getAllFormats(template) or \ for template in self.template:
self.showTemplate(obj, template) formats = isManager and self.getAllFormats(template) or \
if formats: self.showTemplate(obj, template)
res.append(Object(template=template, formats=formats, if formats:
res.append(Object(template=template, formats=formats,
freezeFormats=self.getFreezeFormats(obj, template))) freezeFormats=self.getFreezeFormats(obj, template)))
return res return res

View file

@ -95,9 +95,6 @@ input.button { border-width: 0 !important; color: #666666; height: 24px;
.inputSearch { height: 15px; width: 132px; margin: 3px 3px 2px 3px !important } .inputSearch { height: 15px; width: 132px; margin: 3px 3px 2px 3px !important }
td.search { padding-top: 8px } td.search { padding-top: 8px }
.content { padding: 14px 14px 9px 15px; background-color: #f1f1f1 } .content { padding: 14px 14px 9px 15px; background-color: #f1f1f1 }
.grey { display: none; position: absolute; left: 0px; top: 0px; z-index:2;
background:grey; opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5;
filter:alpha(Opacity=50) }
.popup { display: none; position: absolute; top: 30%; left: 35%; .popup { display: none; position: absolute; top: 30%; left: 35%;
width: 350px; z-index : 100; background: white; padding: 8px; width: 350px; z-index : 100; background: white; padding: 8px;
border: 1px solid grey } border: 1px solid grey }

View file

@ -42,6 +42,11 @@ function showLoginForm() {
} }
function goto(url) { window.location = url } function goto(url) { window.location = url }
function len(dict) {
var res = 0;
for (var key in dict) res += 1;
return res;
}
function switchLanguage(selectWidget) { function switchLanguage(selectWidget) {
var language = selectWidget.options[selectWidget.selectedIndex].value; var language = selectWidget.options[selectWidget.selectedIndex].value;
@ -92,7 +97,8 @@ function injectChunk(elem, content){
a temporary DOM element. */ a temporary DOM element. */
var temp = document.createElement('div'); var temp = document.createElement('div');
temp.innerHTML = content; temp.innerHTML = content;
elem.replaceChild(temp.firstChild, elem.firstChild); temp.firstChild.id = elem.id;
elem.parentNode.replaceChild(temp.firstChild, elem);
} }
} }
} }
@ -550,7 +556,7 @@ function onLinkMany(action, id) {
// Get the array semantics // Get the array semantics
var semantics = node['_appy_' + elems[2] + '_sem']; var semantics = node['_appy_' + elems[2] + '_sem'];
// Show an error messagge if non element is selected. // Show an error messagge if non element is selected.
if ((semantics == 'checked') && (Object.keys(statuses).length == 0)) { if ((semantics == 'checked') && (len(statuses) == 0)) {
openPopup('alertPopup', no_elem_selected); openPopup('alertPopup', no_elem_selected);
return; return;
} }
@ -678,24 +684,15 @@ function openPopup(popupId, msg) {
// Open the popup // Open the popup
var popup = document.getElementById(popupId); var popup = document.getElementById(popupId);
// Put it at the right place on the screen // Put it at the right place on the screen
var scrollTop = document.body.scrollTop || window.pageYOffset || 0; var scrollTop = document.documentElement.scrollTop || window.pageYOffset || 0;
popup.style.top = (scrollTop + 150) + 'px'; popup.style.top = (scrollTop + 150) + 'px';
popup.style.display = "block"; popup.style.display = 'block';
// Show the greyed zone
var greyed = document.getElementById('grey');
greyed.style.top = scrollTop + 'px';
greyed.style.display = "block";
greyed.style.height = document.body.clientHeight;
greyed.style.width = document.body.clientWidth;
} }
function closePopup(popupId) { function closePopup(popupId) {
// Close the popup // Close the popup
var popup = document.getElementById(popupId); var popup = document.getElementById(popupId);
popup.style.display = "none"; popup.style.display = 'none';
// Hide the greyed zone
var greyed = document.getElementById('grey');
greyed.style.display = "none";
} }
// Function triggered when an action needs to be confirmed by the user // Function triggered when an action needs to be confirmed by the user

View file

@ -442,7 +442,7 @@ class ToolWrapper(AbstractWrapper):
<!-- The title of the search --> <!-- The title of the search -->
<p> <p>
<x>:uiSearch.translated</x> (<x>:totalNumber</x>) <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>

View file

@ -101,9 +101,6 @@ class AbstractWrapper(object):
<script var="gaCode=ztool.getGoogleAnalyticsCode()" if="gaCode" <script var="gaCode=ztool.getGoogleAnalyticsCode()" if="gaCode"
type="text/javascript">:gaCode</script> type="text/javascript">:gaCode</script>
<!-- Grey background shown when popups are shown -->
<div id="grey" class="grey"></div>
<!-- Popup for confirming an action --> <!-- Popup for confirming an action -->
<div id="confirmActionPopup" class="popup"> <div id="confirmActionPopup" class="popup">
<form id="confirmActionForm" method="post"> <form id="confirmActionForm" method="post">