static function generar_zona_vinculos_item($item, $accion, $enviar_div_wrapper = true) { if (!self::acceso_recursivo()) { toba::solicitud()->set_cronometrar(true); } toba_js::cargar_consumos_globales(array('utilidades/toba_editor')); $html_ayuda_editor = toba_recurso::ayuda(null, 'Presionando la tecla CTRL se pueden ver los enlaces hacia los editores de los distintos componentes de esta página'); $html_ayuda_cronometro = toba_recurso::ayuda(null, 'Ver los tiempos de ejecución en la generación de esta página'); $html_ayuda_ajax = toba_recurso::ayuda(null, 'Activar/Desactivar navegación interna de la operación via AJAX'); $html_ayuda_editor = toba_recurso::ayuda(null, 'Volver al editor de toba'); $solicitud = toba::solicitud()->get_id(); $link_cronometro = toba::vinculador()->get_url('toba_editor', '1000263', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_analizador_sql = toba::vinculador()->get_url('toba_editor', '30000030', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_logger = toba::vinculador()->get_url('toba_editor', '1000003', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $link_archivos = toba::vinculador()->get_url('toba_editor', '30000029', null, array('prefijo' => toba_editor::get_punto_acceso_editor())); $estilo = toba::proyecto()->get_parametro('estilo'); if ($enviar_div_wrapper) { echo "<div id='editor_previsualizacion'>"; /*echo "<div id='editor_previsualizacion_colap'><img style='cursor:pointer;_cursor:hand;' title='Ocultar la barra' src='".toba_recurso::imagen_toba('nucleo/expandir_izq.gif', false)."' onclick='toggle_nodo(\$\$(\"editor_previsualizacion_cont\"))'/></div>";*/ } echo "<span id='editor_previsualizacion_cont'>"; echo "<span id='editor_previsualizacion_vis'>"; //Logger list($log_nivel, $log_cant) = toba::logger()->get_mensajes_minimo_nivel(); $niveles = toba::logger()->get_niveles(); $niveles[0] = 'INFO'; $img = self::imagen_editor('logger/' . strtolower($niveles[$log_nivel]) . '.gif', true); $html_ayuda_logger = toba_recurso::ayuda(null, 'Visor de logs'); echo "<a href='{$link_logger}' target='logger' {$html_ayuda_logger} >" . $img . " {$log_cant}</a>\n"; //Cronometro toba::cronometro()->marcar('Resumen toba_editor'); echo "<a href='{$link_cronometro}' target='logger' {$html_ayuda_cronometro} >\n" . toba_recurso::imagen_toba('clock.png', true) . ' ' . round(toba::cronometro()->tiempo_acumulado(), 2) . ' seg' . "</a> "; //Memoria if (function_exists('memory_get_peak_usage')) { $memoria_pico = memory_get_peak_usage(); echo toba_recurso::imagen_toba('memory.png', true, 16, 16, 'Pico máximo de memoria que ha consumido el script actual'); echo ' ' . file_size($memoria_pico, 0) . ' '; } //Base de datos $fuente = toba_admin_fuentes::instancia()->get_fuente_predeterminada(false, toba_editor::get_proyecto_cargado()); if ($fuente) { try { $base = toba_admin_fuentes::instancia()->get_fuente($fuente, toba_editor::get_proyecto_cargado())->get_db(); $info_db = $base->get_info_debug(); $total = 0; foreach ($info_db as $info) { if (isset($info['fin'])) { $total += $info['fin'] - $info['inicio']; } } $rol = toba::db()->get_rol_actual(); toba::memoria()->set_dato_instancia('previsualizacion_consultas', array('fuente' => $fuente, 'datos' => $info_db)); echo "<a href='{$link_analizador_sql}' target='logger'>" . toba_recurso::imagen_toba('objetos/datos_relacion.gif', true, 16, 16, 'Ver detalles de las consultas y comandos ejecutados en este pedido de página') . count($info_db) . " ({$rol})</a>"; } catch (toba_error $e) { //Si no se tiene acceso a la base no se hace nada } } //Archivos $archivos = self::get_archivos_incluidos(); $total = 0; foreach ($archivos as $arch) { $total += filesize($arch); } toba::memoria()->set_dato_instancia('previsualizacion_archivos', $archivos); echo "<a href='{$link_archivos}' target='logger'>" . toba_recurso::imagen_toba('nucleo/php.gif', true, 16, 16, 'Ver detalle de archivos .php del proyecto incluidos en este pedido de página') . ' ' . count($archivos) . " arch. (" . file_size($total, 0) . ')</a>'; //Session $tamano = file_size(strlen(serialize($_SESSION)), 0); echo toba_recurso::imagen_toba('sesion.png', true, 16, 16, 'Tamaño de la sesión') . " {$tamano} "; echo "</span>"; //-- ACCIONES echo "<span id='editor_previsualizacion_acc'>"; $perfiles = array(apex_ef_no_seteado => '-- Todos --'); foreach (toba::manejador_sesiones()->get_perfiles_funcionales() as $perfil) { $perfiles[$perfil] = $perfil; } $actuales = toba::manejador_sesiones()->get_perfiles_funcionales_activos(); $actual = null; if (count($actuales) == 1) { $actual = current($actuales); } $js = "title='Cambia el perfil actual del usuario' onchange=\"location.href = toba_prefijo_vinculo + '&perfil_activo=' + this.value\""; echo "Perfiles: " . toba_form::select('cambiar_perfiles', $actual, $perfiles, 'ef-combo', $js); //Usuario de la base $hay_limitado = false; if (!isset(self::$fuentes)) { self::$fuentes = toba_info_editores::get_fuentes_datos(toba_editor::get_proyecto_cargado()); } foreach (self::$fuentes as $fuente) { if ($fuente['permisos_por_tabla']) { $hay_limitado = true; } } if ($hay_limitado) { $actual = self::$memoria['conexion_limitada'] ? 'limitado' : 'normal'; $datos = array("normal" => "Normal", "limitado" => "Limitados"); $js = "title='Cambia temporalmente el usuario de conexión a la base' onchange=\"location.href = toba_prefijo_vinculo + '&usuario_conexion=' + this.value\""; echo "Permisos DB: " . toba_form::select('cambiar_rol', $actual, $datos, 'ef-combo', $js); } //Skin $skins = rs_convertir_asociativo(toba_info_editores::get_lista_skins(), array('estilo', 'proyecto'), 'descripcion'); $js = "title='Cambia temporalmente el skin de la aplicación' onchange=\"location.href = toba_prefijo_vinculo + '&skin=' + this.value\""; $defecto = toba::proyecto()->get_parametro('estilo') . apex_qs_separador . toba::proyecto()->get_parametro('estilo_proyecto'); echo "Skin: " . toba_form::select('cambiar_skin', $defecto, $skins, 'ef-combo', $js); //AJAX echo "<a id='editor_ajax' href='javascript: editor_cambiar_ajax()' {$html_ayuda_ajax}>" . toba_recurso::imagen_toba('objetos/ajax_off.png', true) . "</a>\n"; //Edicion echo "<a href='javascript: editor_cambiar_vinculos()' {$html_ayuda_editor} >" . toba_recurso::imagen_toba('edicion_chico.png', true) . "</a>\n"; //Arbol $vinculos = self::get_vinculos_item($item, $accion); if (isset($vinculos[1])) { self::mostrar_vinculo($vinculos[1]); } //Editor echo "<a href='#' onclick='return toba_invocar_editor()' {$html_ayuda_editor}>" . toba_recurso::imagen_toba('icono_16.png', true) . "</a>\n"; echo "</span>"; echo "</span>"; echo "<div class='div-editor' style='position:fixed; top: 85px; left: 1px;'>"; foreach (self::get_vinculos_item($item, $accion) as $vinculo) { self::mostrar_vinculo($vinculo); } echo "</div>"; if ($enviar_div_wrapper) { echo "</div>"; } }
function mostrar() { $this->preparar_arbol(); echo $this->arbol; if ($this->hay_algun_item) { $consumos = array('yui/yahoo/yahoo-min', 'yui/dom/dom-min', 'yui/event/event-min', 'yui/container/container-min', 'yui/menu/menu-min'); toba_js::cargar_consumos_globales($consumos); echo toba_js::abrir(); echo ' // "load" event handler for the window YAHOO.example.onWindowLoad = function(p_oEvent) { // "click" event handler for each item in the root MenuBar instance function onMenuBarItemClick(p_sType, p_aArguments) { this.parent.hasFocus = true; var oActiveItem = this.parent.activeItem; // Hide any other submenus that might be visible if(oActiveItem && oActiveItem != this) { this.parent.clearActiveItem(); } // Select and focus the current MenuItem instance this.cfg.setProperty("selected", true); this.focus(); // Show the submenu for this instance var oSubmenu = this.cfg.getProperty("submenu"); if(oSubmenu) { if(oSubmenu.cfg.getProperty("visible")) { oSubmenu.hide(); } else { oSubmenu.show(); } } } // "mouseover" event handler for each item in the root MenuBar instance function onMenuBarItemMouseOver(p_sType, p_aArguments) { var oActiveItem = this.parent.activeItem; // Hide any other submenus that might be visible if(oActiveItem && oActiveItem != this) { this.parent.clearActiveItem(); } // Select and focus the current MenuItem instance this.cfg.setProperty("selected", true); this.focus(); if(this.parent.hasFocus) { // Show the submenu for this instance var oSubmenu = this.cfg.getProperty("submenu"); if(oSubmenu) { if( oSubmenu.cfg.getProperty("visible") && oSubmenu != oActiveItem.cfg.getProperty("submenu") ) { oSubmenu.hide(); } else { oSubmenu.show(); } } } } var oMenuBar = new YAHOO.widget.MenuBar("menu_principal", {width:"80%"}); oMenuBar.render(); /* Add a "click" and "mouseover" event handler to each item in the root MenuBar instnace */ var i = oMenuBar.getItemGroups()[0].length - 1, oMenuBarItem; do { oMenuBarItem = oMenuBar.getItem(i); if(oMenuBarItem) { oMenuBarItem.clickEvent.subscribe( onMenuBarItemClick, oMenuBarItem, true ); oMenuBarItem.mouseOverEvent.subscribe( onMenuBarItemMouseOver, oMenuBarItem, true ); } } while(i--); // "click" event handler for the document function onDocumentClick(p_oEvent) { var oTarget = YAHOO.util.Event.getTarget(p_oEvent); if( oTarget != oMenuBar.element && !YAHOO.util.Dom.isAncestor(oMenuBar.element, oTarget) ) { oMenuBar.hasFocus = false; if(oMenuBar.activeItem) { var oSubmenu = oMenuBar.activeItem.cfg.getProperty("submenu"); if(oSubmenu) { oSubmenu.hide(); } oMenuBar.clearActiveItem(); oMenuBar.activeItem.blur(); } } } // Add a "click" handler for the document YAHOO.util.Event.addListener( document, "click", onDocumentClick ); } // Add a "load" handler for the window YAHOO.util.Event.addListener(window, "load", YAHOO.example.onWindowLoad); '; echo toba_js::cerrar(); } }
/** * Muestra toda la lista de notificaciones almacenadas * Esto tiene que hacerse una única vez por página, y por lo generar el framework * es el encargado de hacerlo */ function mostrar($incluir_comsumos = true) { if ($incluir_comsumos) { toba_js::cargar_consumos_basicos(); //Por si no se cargaron antes toba_js::cargar_consumos_globales(array("basicos/notificacion")); echo toba_js::abrir(); } foreach ($this->mensajes as $mensaje) { $texto = toba_parser_ayuda::parsear($mensaje[0]); $texto = str_replace("'", '"', $texto); $texto = toba_js::string($texto); //Mensaje para debug if (isset($mensaje[2]) && trim($mensaje[2]) != '') { $texto_debug = toba_parser_ayuda::parsear($mensaje[2]); $texto_debug = str_replace("'", '"', $texto_debug); $texto_debug = toba_js::string($texto_debug); echo "notificacion.agregar('{$texto}' + '\\n', '{$mensaje[1]}', undefined, '{$texto_debug}');\n"; } else { echo "notificacion.agregar('{$texto}' + '\\n', '{$mensaje[1]}');\n"; } } if (isset($this->titulo)) { echo "notificacion.set_titulo_ventana('{$this->titulo}');\n"; } echo "notificacion.mostrar();\n"; if ($incluir_comsumos) { echo toba_js::cerrar(); } }
function mostrar() { $nombre_var = $this->modo_prueba ? 'prueba_m' : 'horizontals'; $id_tag = $this->modo_prueba ? 'prueba' : 'menu-h'; $this->preparar_arbol(); echo $this->arbol; if ($this->hay_algun_item) { toba_js::cargar_consumos_globales(array('basicos/listmenu')); echo toba_js::ejecutar("var {$nombre_var} = new simpleMenu('{$id_tag}', 'horizontal');"); } $this->menu_enviado = true; }
function mostrar() { $this->preparar_arbol(); echo $this->arbol; if ($this->hay_algun_item) { $id_tag = $this->modo_prueba ? 'prueba' : 'id_menu'; toba_js::cargar_consumos_globales(array('basicos/libmenu')); echo toba_js::ejecutar("var menu = Menu(); menu.inicializarMenu('{$id_tag}');"); } }
/** * Envia los archivos js necesarios para correr shindig * @ignore */ protected function configurar_consumos_globales_js() { toba_js::cargar_consumos_globales(array('shindig/features/src/main/javascript/features/rpc/wpm.transport', 'shindig/features/src/main/javascript/features/rpc/rpc', 'shindig/javascript/container/cookies', 'shindig/javascript/container/util', 'shindig/javascript/container/gadgets', 'shindig/javascript/container/cookiebaseduserprefstore')); }
protected function comienzo_cuerpo_basico() { echo "<body>\n"; $cerrar = toba_recurso::imagen_toba('nucleo/cerrar_ventana.gif', false); toba_js::cargar_consumos_globales(array('basicos/tipclick')); echo "\n<div id='overlay'>"; echo "<div id='overlay_contenido'></div></div>"; $wait = toba_recurso::imagen_toba('wait.gif'); echo "<div id='div_toba_esperar' class='div-esperar' style='display:none'>"; echo "<img src='{$wait}' style='vertical-align: middle;' alt='' /> Procesando..."; echo "</div>\n"; $logo = toba_recurso::imagen_proyecto('logo.gif', false); echo "<div id='capa_espera'>\n\t\t\t\t<div>\n\t\t\t\t\t<img class='overlay-cerrar' title='Cerrar ventana' src='{$cerrar}' onclick='mostrar_esperar()' />\n\t\t\t\t\t<img src='{$logo}' /><p>Procesando. Por favor aguarde...</p><img src='{$wait}'>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t"; }
/** * Servicio común de generación html */ protected function servicio__generar_html($objetos) { //--- 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 "</div>"; //---- Se finaliza aqui el div de la barra superior echo '<div style="clear:both;"></div>'; echo "</div>"; //-- Se finaliza aqui el div del encabezado, por la optimizacion del pre-servicio.. $this->tipo_pagina()->pre_contenido(); //--- Abre el formulario $accion = $this->info['basica']['item_act_accion_script']; if ($accion == '') { $extra = "onsubmit='return false;'"; if (!$this->autocomplete) { $extra .= " autocomplete='off'"; } echo toba_form::abrir("formulario_toba", toba::vinculador()->get_url(), $extra); toba_manejador_sesiones::enviar_csrf_hidden(); //HTML foreach ($objetos as $obj) { //-- Librerias JS necesarias toba_js::cargar_consumos_globales($obj->get_consumo_javascript()); //-- HTML propio del objeto $obj->generar_html(); } //Javascript echo toba_js::abrir(); try { toba_js::cargar_definiciones_runtime(); foreach ($objetos as $obj) { $objeto_js = $obj->generar_js(); echo "\n{$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); } echo toba_js::cerrar(); //--- Fin del form y parte inferior del tipo de página echo toba_form::cerrar(); } else { echo toba_js::abrir(); toba_js::cargar_definiciones_runtime(); echo toba_js::cerrar(); include $accion; } $this->tipo_pagina()->post_contenido(); // Carga de componentes JS genericos echo toba_js::abrir(); toba::vinculador()->generar_js(); toba::notificacion()->mostrar(false); toba::acciones_js()->generar_js(); $this->generar_analizador_estadistico(); echo toba_js::cerrar(); //--- Parte inferior de la zona if ($this->hay_zona() && $this->zona->cargada()) { $this->zona->generar_html_barra_inferior(); } $this->tipo_pagina()->pie(); }