X-Git-Url: https://git.llucax.com/software/sercom.git/blobdiff_plain/db587d0d4ce6518b3c4f8cf18989fc1f65b40c5e..2c23f36223624514f3ad84a7c629792a27e74a68:/sercom/widgets.py diff --git a/sercom/widgets.py b/sercom/widgets.py index 08adea7..218fb3a 100644 --- a/sercom/widgets.py +++ b/sercom/widgets.py @@ -17,4 +17,89 @@ class CustomTextField(widgets.TextField): /> +''' + +AlumnoMultiSelectAjax = ''' + + function _on_alumno_get_result(lista, results) + { + load.style.visibility = 'hidden'; + if (results.error) { + alert(results.msg); + return; + } + MochiKit.DOM.appendChildNodes(lista, OPTION(results.msg)); + } + + function _on_alumno_get_error(results) + { + alert(results) + load.style.visibility = 'hidden'; + } + + function agregar_a_la_lista(texto, lista) + { + load = MochiKit.DOM.getElement('loading'); + load.style.visibility = 'visible'; + t = MochiKit.DOM.getElement(texto); + url = "/grupo/get_inscripto?cursoid=1&padron="+t.value; + var d = loadJSONDoc(url); + d.addCallbacks(partial(_on_alumno_get_result, lista), _on_alumno_get_error); + t.value = ""; + } + + function sacar_de_la_lista(lista) + { + l = MochiKit.DOM.getElement(lista); + if (l.selectedIndex < 0) return; + + /* caso especial, 1 solo item */ + if (l.options.length == 1) { + l.options.length = 0 + return; + } + + for (i=l.selectedIndex; i + + + + + + + + + + + + ''' + javascript = [widgets.JSSource(AlumnoMultiSelectAjax)] +