X-Git-Url: https://scm.cri.ensmp.fr/git/Plinn.git/blobdiff_plain/3e0a2c257d49fb162da9c70d2f70194036235166..fdb6f4e9ae1d1933e56c76b141fac14ac235960d:/skins/ajax_scripts/widget_form_manager.js?ds=sidebyside diff --git a/skins/ajax_scripts/widget_form_manager.js b/skins/ajax_scripts/widget_form_manager.js index e22a180..516dca7 100644 --- a/skins/ajax_scripts/widget_form_manager.js +++ b/skins/ajax_scripts/widget_form_manager.js @@ -1,18 +1,25 @@ // © 2009 Benoît Pin // http://plinn.org // Licence GPL -// $Id: widget_form_manager.js 1473 2009-03-06 17:02:21Z pin $ -// $URL: http://svn.cri.ensmp.fr/svn/Plinn/branches/CMF-2.1/skins/ajax_scripts/widget_form_manager.js $ +// +// var WidgetBasedFormManager; (function(){ - WidgetBasedFormManager = function(widgets, editingArea, dataArea, dataAreaSpecs) { + WidgetBasedFormManager = function(widgets, editingArea, dataArea, dataAreaSpecs, afterShow) { + /* widgets : {'add':element, 'edit':element} element targets nodes to clone. + * editingArea : surrounding element where form is + * dataArea : element where data are + * dataAreaSpecs : by default, param used to indicate the total number of columns + * afterShow : function called after a widget insertion + */ var thisWgtManager = this; this.widgets = widgets; this.openedWidget = null; this.dataArea = dataArea; this.dataAreaSpecs = dataAreaSpecs; + this.afterShow = afterShow; var form = editingArea.getElementsByTagName('form')[0]; this.form = form; @@ -33,6 +40,8 @@ var WidgetBasedFormManager; dest.appendChild(wdgtCopy); if (this.addButton) this.addButton.style.visibility = 'hidden'; + if (this.afterShow) + this.afterShow(this); }; WidgetBasedFormManager.prototype.showPopulatedWidget = function(dest, url) { @@ -71,6 +80,8 @@ var WidgetBasedFormManager; } } dest.appendChild(wdgtCopy); + if (this.afterShow) + this.afterShow(this); }; WidgetBasedFormManager.prototype.cancelWidget = function() {