[gen] Bugfixes.

This commit is contained in:
Gaetan Delannay 2015-02-17 08:58:04 +01:00
parent f842c0ce02
commit 8b90d877a8
12 changed files with 92 additions and 74 deletions

View file

@ -246,6 +246,8 @@ function AjaxData(hook, px, params, parentHook, url, mode, beforeSend, onGet) {
/* If a parentHook is spefified, this AjaxData must be completed with a parent
AjaxData instance. */
this.parentHook = parentHook;
// Inject this AjaxData instance into p_hook
getAjaxHook(hook, true)['ajax'] = this;
}
function askAjax(hook, form, params) {
@ -269,6 +271,12 @@ function askAjax(hook, form, params) {
}
}
}
// Resolve dynamic parameter "cbChecked" if present
if ('cbChecked' in d.params) {
var cb = getAjaxHook(d.params['cbChecked'], true);
if (cb) d.params['cbChecked'] = cb.checked;
else delete d.params['cbChecked'];
}
// If a p_form id is given, integrate the form submission in the ajax request
if (form) {
var f = document.getElementById(form);

View file

@ -1,7 +1,17 @@
function toggleVisibility(node, nodeType){
// Toggle visibility of all elements having p_nodeType within p_node
var elements = node.getElementsByTagName(nodeType);
for (var i=0; i<elements.length; i++){
var sNode = elements[i];
if (sNode.style.visibility == 'hidden') sNode.style.visibility = 'visible';
else sNode.style.visibility = 'hidden';
}
}
function askMonthView(hookId, objectUrl, fieldName, month) {
// Sends an Ajax request for getting the view month of a calendar field
var params = {'month': month};
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxMonthView', params);
askAjaxChunk(hookId, 'GET', objectUrl, fieldName+':pxViewMonth', params);
}
function openEventPopup(action, fieldName, day, spansDays,
@ -78,7 +88,7 @@ function triggerCalendarEvent(action, hookId, fieldName, objectUrl,
}
var elems = f.elements;
var params = {};
// Put form elements into "params".
// Put form elements into "params"
for (var i=0; i < elems.length; i++) {
params[elems[i].name] = elems[i].value;
}