[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
want to put in it. It is the way gen uses pod.'''
# 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')}
POD_ERROR = 'An error occurred while generating the document. Please ' \
'contact the system administrator.'
@ -103,7 +103,11 @@ class Pod(Field):
</table>
</div>
</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>
</table>
</td>
@ -232,15 +236,15 @@ class Pod(Field):
def getVisibleTemplates(self, obj):
'''Returns, among self.template, the template(s) that can be shown.'''
isManager = obj.user.has_role('Manager')
res = []
if not self.showTemplate:
# Show them all in any format.
res = []
for template in self.template:
res.append(Object(template=template,
formats=self.getAllFormats(template),
freezeFormats=self.getFreezeFormats(obj, template)))
res = []
else:
isManager = obj.user.has_role('Manager')
for template in self.template:
formats = isManager and self.getAllFormats(template) or \
self.showTemplate(obj, template)

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 }
td.search { padding-top: 8px }
.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%;
width: 350px; z-index : 100; background: white; padding: 8px;
border: 1px solid grey }

View file

@ -42,6 +42,11 @@ function showLoginForm() {
}
function goto(url) { window.location = url }
function len(dict) {
var res = 0;
for (var key in dict) res += 1;
return res;
}
function switchLanguage(selectWidget) {
var language = selectWidget.options[selectWidget.selectedIndex].value;
@ -92,7 +97,8 @@ function injectChunk(elem, content){
a temporary DOM element. */
var temp = document.createElement('div');
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
var semantics = node['_appy_' + elems[2] + '_sem'];
// 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);
return;
}
@ -678,24 +684,15 @@ function openPopup(popupId, msg) {
// Open the popup
var popup = document.getElementById(popupId);
// 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.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;
popup.style.display = 'block';
}
function closePopup(popupId) {
// Close the popup
var popup = document.getElementById(popupId);
popup.style.display = "none";
// Hide the greyed zone
var greyed = document.getElementById('grey');
greyed.style.display = "none";
popup.style.display = 'none';
}
// 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 -->
<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;
&nbsp;<i><a href=":newSearchUrl">:_('search_new')</a></i>
</x>

View file

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