[gen] BPX bugfixes.

This commit is contained in:
Gaetan Delannay 2013-09-11 22:11:44 +02:00
parent 7f88c7cca8
commit 383af4a687
5 changed files with 22 additions and 19 deletions

View file

@ -36,7 +36,7 @@ class Boolean(Field):
onclick=":'toggleCheckbox(%s, %s); updateSlaves(this)' % \ onclick=":'toggleCheckbox(%s, %s); updateSlaves(this)' % \
(q(name), q('%s_hidden' % name))"/> (q(name), q('%s_hidden' % name))"/>
<input type="hidden" name=":name" id=":'%s_hidden' % name" <input type="hidden" name=":name" id=":'%s_hidden' % name"
value=":isChecked and 'True' or 'False')"/> value=":isChecked and 'True' or 'False'"/>
</x>''') </x>''')
pxSearch = Px(''' pxSearch = Px('''

View file

@ -31,8 +31,8 @@ class Date(Field):
<option value="">-</option> <option value="">-</option>
<option for="day in days" <option for="day in days"
var2="zDay=str(day).zfill(2)" value=":zDay" var2="zDay=str(day).zfill(2)" value=":zDay"
selected="field.isSelected(zobj, 'day', day, \ selected=":field.isSelected(zobj, 'day', day, \
rawValue)">:zDay</option> rawValue)">:zDay</option>
</select> </select>
<!-- Month --> <!-- Month -->
@ -41,16 +41,16 @@ class Date(Field):
<option value="">-</option> <option value="">-</option>
<option for="month in months" <option for="month in months"
var2="zMonth=str(month).zfill(2)" value=":zMonth" var2="zMonth=str(month).zfill(2)" value=":zMonth"
selected="field.isSelected(zobj, 'month', month, \ selected=":field.isSelected(zobj, 'month', month, \
rawValue)">:zMonth</option> rawValue)">:zMonth</option>
</select> </select>
<!-- Year --> <!-- Year -->
<select name=":'%s_year' % name" id=":'%s_year' % name"> <select name=":'%s_year' % name" id=":'%s_year' % name">
<option value="">-</option> <option value="">-</option>
<option for="year in years" value=":year" <option for="year in years" value=":year"
selected="field.isSelected(zobj, name, 'year', year, \ selected=":field.isSelected(zobj, name, 'year', year, \
rawValue)">:year</option> rawValue)">:year</option>
</select> </select>
<!-- The icon for displaying the calendar popup --> <!-- The icon for displaying the calendar popup -->

View file

@ -246,8 +246,8 @@ class Ref(Field):
uids=[o.UID() for o in \ uids=[o.UID() for o in \
field.getLinkedObjects(zobj).objects]; field.getLinkedObjects(zobj).objects];
isBeingCreated=zobj.isTemporary()" isBeingCreated=zobj.isTemporary()"
name=":name" size="isMultiple and field.height or ''" name=":name" size=":isMultiple and field.height or ''"
multiple="isMultiple and 'multiple' or ''"> multiple=":isMultiple">
<option value="" if="not isMultiple">:_('choose_a_value')</option> <option value="" if="not isMultiple">:_('choose_a_value')</option>
<option for="ztied in zobjects" var2="uid=ztied.o.UID()" <option for="ztied in zobjects" var2="uid=ztied.o.UID()"
selected=":inRequest and (uid in requestValue) or \ selected=":inRequest and (uid in requestValue) or \

View file

@ -483,6 +483,18 @@ function generatePodDocument(contextUid, fieldName, podFormat, queryData,
} }
theForm.submit(); theForm.submit();
} }
function protectAppyForm() {
window.onbeforeunload = function(e){
theForm = document.getElementById("appyForm");
if (theForm.button.value == "") {
var e = e || window.event;
if (e) {e.returnValue = warn_leave_form;}
return warn_leave_form;
}
}
}
// Functions for opening and closing a popup // Functions for opening and closing a popup
function openPopup(popupId, msg) { function openPopup(popupId, msg) {
// Put the message into the popup // Put the message into the popup

View file

@ -562,16 +562,7 @@ class AbstractWrapper(object):
groupedFields=zobj.getGroupedFields(layoutType,page, cssJs=cssJs)"> groupedFields=zobj.getGroupedFields(layoutType,page, cssJs=cssJs)">
<x>:tool.pxPagePrologue</x> <x>:tool.pxPagePrologue</x>
<!-- Warn the user that the form should be left via buttons --> <!-- Warn the user that the form should be left via buttons -->
<script type="text/javascript"><![CDATA[ <script type="text/javascript">protectAppyForm()</script>
window.onbeforeunload = function(e){
theForm = document.getElementById('appyForm');
if (theForm.button.value == "") {
var e = e || window.event;
if (e) {e.returnValue = warn_leave_form;}
return warn_leave_form;
}
}]]>
</script>
<form id="appyForm" name="appyForm" method="post" <form id="appyForm" name="appyForm" method="post"
enctype="multipart/form-data" action=":zobj.absolute_url()+'/do'"> enctype="multipart/form-data" action=":zobj.absolute_url()+'/do'">
<input type="hidden" name="action" value="Update"/> <input type="hidden" name="action" value="Update"/>