/** * Retorna el html y js localizado de un componente y sus dependencias. * Pensado como respuesta a una solicitud AJAX */ protected function servicio__html_parcial($objetos) { echo "[--toba--]"; //-- Se reenvia el encabezado $this->tipo_pagina()->barra_superior(); echo "</div>"; //--- Parte superior de la zona if (toba::solicitud()->hay_zona() && toba::zona()->cargada()) { toba::zona()->generar_html_barra_superior(); } //--- Se incluyen botones en la botonera de la operacion $this->generar_html_botonera_sup($objetos); echo "[--toba--]"; $ok = true; try { //--- Se envia el HTML foreach ($objetos as $objeto) { $objeto->generar_html(); } } catch (toba_error $e) { $ok = false; toba::logger()->error($e, 'toba'); $mensaje = $e->get_mensaje(); $mensaje_debug = null; if (toba::logger()->modo_debug()) { $mensaje_debug = $e->get_mensaje_log(); } toba::notificacion()->error($mensaje, $mensaje_debug); } echo "[--toba--]"; //-- Se envia info de debug if (toba_editor::modo_prueba()) { $item = toba::solicitud()->get_datos_item('item'); $accion = toba::solicitud()->get_datos_item('item_act_accion_script'); toba_editor::generar_zona_vinculos_item($item, $accion, false); } echo "[--toba--]"; //--- Se envian los consumos js $consumos = array(); foreach ($objetos as $objeto) { $consumos = array_merge($consumos, $objeto->get_consumo_javascript()); } echo "toba.incluir(" . toba_js::arreglo($consumos, false) . ");\n"; echo "[--toba--]"; //--- Se envia el javascript //Se actualiza el vinculo del form $autovinculo = toba::vinculador()->get_url(); echo "document.formulario_toba.action='{$autovinculo}'\n"; toba::vinculador()->generar_js(); toba_js::cargar_definiciones_runtime(); if ($ok) { try { foreach ($objetos as $objeto) { //$objeto->servicio__html_parcial(); $objeto_js = $objeto->generar_js(); echo "\nwindow.{$objeto_js}.iniciar();\n"; } } catch (toba_error $e) { toba::logger()->error($e, 'toba'); $mensaje_debug = null; if (toba::logger()->modo_debug()) { $mensaje_debug = $e->get_mensaje_log(); } toba::notificacion()->error($e->get_mensaje(), $mensaje_debug); } } toba::notificacion()->mostrar(false); toba::acciones_js()->generar_js(); $this->generar_analizador_estadistico(); }