Ejemplo n.º 1
0
 function extender_objeto_js()
 {
     parent::extender_objeto_js();
     $id_js = $this->objeto_js;
     $id_gral = $this->_submit;
     $img_acceso = toba_recurso::imagen_toba('aplicar.png', false);
     $img_sin_acceso = toba_recurso::imagen_toba('prohibido.png', false);
     //Busco el estado de cada uno de los hijos involucrados en el pedido de pagina
     $estado = array('activos' => array(), 'inactivos' => array());
     if (isset($this->_nodos_inicial) && !empty($this->_nodos_inicial)) {
         $raiz = $this->_nodos_inicial[0];
         if ($raiz->tiene_hijos_cargados()) {
             foreach ($raiz->get_hijos() as $nodo) {
                 $aux = $nodo->recuperar_estado_recursivo();
                 $estado['activos'] = array_merge($estado['activos'], $aux['activos']);
                 $estado['inactivos'] = array_merge($estado['inactivos'], $aux['inactivos']);
             }
         }
     }
     //Genero un par de arreglos que van a servir como lista en js
     $ids_activos = !empty($estado['activos']) ? array_fill_keys($estado['activos'], true) : array();
     $ids_desactivados = !empty($estado['inactivos']) ? array_fill_keys($estado['inactivos'], true) : array();
     echo ' var ' . $id_js . '_items_activos = ' . toba_js::arreglo($ids_activos, true) . "; \n";
     echo ' var ' . $id_js . '_items_desactivados = ' . toba_js::arreglo($ids_desactivados, true) . "; \n";
     echo "\t\t\t\n\t\t\t{$id_js}.cambiar_acceso = function(id_input)\n\t\t\t{\n\t\t\t\tvar id_elemento = '{$id_gral}' + '_' + id_input; \t\t\t\t\t\n\t\t\t\tif (isset({$this->objeto_js}_items_activos[id_input])) {\t\t\t//Esta visible, hay que ocultarlo\t\t\t\t\t\n\t\t\t\t\tdelete({$this->objeto_js}_items_activos[id_input]);\n\t\t\t\t\t{$this->objeto_js}_items_desactivados[id_input] = true;\n\t\t\t\t\t\$\$(id_elemento + '_acceso_img').src = '{$img_sin_acceso}';\t\t\t\t\t\t\n\t\t\t\t} else if (isset({$this->objeto_js}_items_desactivados[id_input])) {\t\t//Esta oculto, hay que mostrarlo\t\t\t\t\t\n\t\t\t\t\tdelete({$this->objeto_js}_items_desactivados[id_input]);\n\t\t\t\t\t{$this->objeto_js}_items_activos[id_input] = true;\n\t\t\t\t\t\$\$(id_elemento + '_acceso_img').src = '{$img_acceso}';\t\t\t\t\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t{$id_js}.marcar = function(id_input, valor)\n\t\t\t{\t\t\t\t\n\t\t\t\tvar id_final = '{$id_gral}' + '_' + id_input + '_carpeta';\n\t\t\t\tvar padre = \$\$(id_final).parentNode.parentNode;\t\t\n\t\t\t\tvar nodo = this.buscar_primer_marca(padre, 'UL');\n\t\t\t\tif (nodo) {\t\t\n\t\t\t\t\tfor (var i=0; i < nodo.childNodes.length; i++) {\n\t\t\t\t\t\tvar hijo = nodo.childNodes[i];\n\t\t\t\t\t\tif (hijo.tagName && (hijo.tagName == 'LI')) {\n\t\t\t\t\t\t\tif (! this.buscar_primer_marca(hijo, 'UL')) {\n\t\t\t\t\t\t\t\tthis.cambiar_estado_acceso(hijo, valor);\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tthis.marcar_recursivo(hijo, valor);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t\n\t\t\t{$id_js}.marcar_recursivo = function(carpeta, valor) \n\t\t\t{\n\t\t\t\tvar marca_carpeta = this.buscar_primer_marca(carpeta, 'SPAN');\n\t\t\t\tif (marca_carpeta) {\n\t\t\t\t\tfor (var i=0; i < marca_carpeta.childNodes.length; i++) {\n\t\t\t\t\t\tvar hc = marca_carpeta.childNodes[i];\n\t\t\t\t\t\tif (hc.tagName && (hc.tagName == 'INPUT')) {\n\t\t\t\t\t\t\t\$\$(hc.id).value = valor;\n\t\t\t\t\t\t\t\$\$(hc.id).checked = (valor == 0) ? true : false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tvar nodo = this.buscar_primer_marca(carpeta, 'UL');\t\t\n\t\t\t\tfor (var i=0; i < nodo.childNodes.length; i++) {\n\t\t\t\t\tvar hijo = nodo.childNodes[i];\n\t\t\t\t\tif (hijo.tagName && (hijo.tagName == 'LI')) {\n\t\t\t\t\t\tif (!this.buscar_primer_marca(hijo, 'UL')) {\n\t\t\t\t\t\t\tthis.cambiar_estado_acceso(hijo, valor);\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tthis.marcar_recursivo(hijo, valor);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t{$id_js}.cambiar_estado_acceso = function(nodo, valor)\n\t\t\t{\n\t\t\t\tfor (var i=0; i < nodo.childNodes.length; i++) {\n\t\t\t\t\tif (nodo.childNodes[i].tagName == 'SPAN') {\n\t\t\t\t\t\tvar hijo = nodo.childNodes[i];\n\t\t\t\t\t\tfor (var j=0; j < hijo.childNodes.length; j++) {\n\t\t\t\t\t\t\tif (hijo.childNodes[j].tagName == 'IMG') {\t\n\t\t\t\t\t\t\t\thijo.childNodes[j].onclick();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t{$id_js}.buscar_primer_marca = function (nodo, marca) {\n\t\t\t\tfor (var i=0; i < nodo.childNodes.length; i++) {\n\t\t\t\t\tif (nodo.childNodes[i].tagName == marca) {\n\t\t\t\t\t\treturn nodo.childNodes[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t\n\t\t\t{$id_js}.submit = function()\n\t\t\t{\t\t\t\t\n\t\t\t\tvar padre_esta_en_proceso = this.controlador && !this.controlador.en_submit();\n\t\t\t\tif (padre_esta_en_proceso) {\n\t\t\t\t\treturn this.controlador.submit();\n\t\t\t\t}\n\t\t\t\tif (this._evento) {\n\t\t\t\t\t//Si es la selección de una semana marco la semana\n\t\t\t\t\tif (this._evento.id == 'ver_propiedades') {\n\t\t\t\t\t\tdocument.getElementById(this._input_submit + '__seleccion').value = this._evento.parametros;\n\t\t\t\t\t}\n\t\t\t\t\t//Marco la ejecucion del evento para que la clase PHP lo reconozca\n\t\t\t\t\tdocument.getElementById(this._input_submit).value = this._evento.id;\t\t\t\n\t\t\t\t}\n\t\t\t\tdocument.getElementById(this._input_submit + '__apertura_datos').value = this.datos_apertura();\t\t\t\t\n\n\t\t\t\t//Agrego como lista los nodos seleccionados y deseleccionados\n\t\t\t\tvar claves = [];\n\t\t\t\tfor (var i in {$id_js}_items_activos) {\n\t\t\t\t\tclaves.push(i);\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('{$id_gral}__nodos_seleccionados').value = claves.join(toba_hilo_separador_interno);\n\n\t\t\t\tvar claves = [];\t\t\t\t\n\t\t\t\tfor (var i in {$id_js}_items_desactivados) {\n\t\t\t\t\tclaves.push(i);\n\t\t\t\t}\n\t\t\t\tdocument.getElementById('{$id_gral}__nodos_deseleccionados').value = claves.join(toba_hilo_separador_interno);\t\t\t\t\n\t\t\t\t\n\t\t\t}\n\t\t";
 }
Ejemplo n.º 2
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     $dim = toba_js::arreglo($this->get_dimensiones(), false);
     echo $identado . "window.{$this->objeto_js} = new ei_codigo({$id}, {$dim}, '{$this->_submit}', '{$this->_id_post_codigo}');\n";
 }
Ejemplo n.º 3
0
 function extender_objeto_js()
 {
     //--- Se insertan los css de cada estilo para hacer la visualización
     $estilos = rs_convertir_asociativo(toba_info_editores::get_lista_estilos_columnas(), array('columna_estilo'), 'css');
     echo 'var editor_col_css=' . toba_js::arreglo($estilos, true);
     echo "\n\t\t\t{$this->objeto_js}.evt__usar_vinculo__procesar = function(inicial) \n\t\t\t{\n\t\t\t\tvar se_muestra = (this.ef('usar_vinculo').valor() == '1');\n\t\t\t\tthis.ef('evento_asociado').mostrar(se_muestra, true);\n\t\t\t\tthis.ef('vinculo_indice').mostrar(se_muestra, true);\n\t\t\t}\n\t\t\t\t\t\n\t\t\t{$this->objeto_js}.es_estilo_manual = function()\n\t\t\t{\n\t\t\t\tvar estado = this.ef('estilo_precarga').get_estado();\t\t\t\t\t\n\t\t\t\treturn (estado == apex_ef_no_seteado);\n\t\t\t}\n\n\t\t\t{$this->objeto_js}.evt__estilo_precarga__procesar = function(inicial) \n\t\t\t{\t\t\t\t\t\n\t\t\t\tif (this.es_estilo_manual()) {\n\t\t\t\t\tthis.ef('estilo_editable').mostrar(true);\n\t\t\t\t} else {\n\t\t\t\t\tthis.ef('estilo_editable').mostrar(false, true);\t\t//Reseteo el valor del editable cuando lo oculto\n\t\t\t\t\tvar estado = this.ef('estilo_precarga').get_estado();\n\t\t\t\t\tvar input = this.ef('prueba_estilo').input();\t\t\t\t\t\t\t//Modifico el preview\n\t\t\t\t\tinput.className = editor_col_css[estado] + ' columna-preview';\t\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t{$this->objeto_js}.evt__estilo_editable__procesar = function(inicial)\n\t\t\t{\t\t\t\n\t\t\t\tif (this.es_estilo_manual()) {\n\t\t\t\t\tvar estilo = this.ef('estilo_editable').get_estado();\n\t\t\t\t\tvar input = this.ef('prueba_estilo').input();\n\t\t\t\t\tinput.className = estilo + ' columna-preview';\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\n\t\t";
 }
Ejemplo n.º 4
0
 function conf__final()
 {
     // Me abrieron desde el ADMIN
     if (toba::memoria()->existe_dato_instancia('instancia')) {
         echo toba_js::ejecutar('window.close();');
     }
 }
Ejemplo n.º 5
0
 static function redireccionar_a_editor_objeto($proyecto, $objeto)
 {
     $clave = array('componente' => $objeto, 'proyecto' => $proyecto);
     $vinculo = toba_constructor::get_info($clave)->vinculo_editor();
     admin_util::refrescar_editor_item();
     echo toba_js::abrir();
     echo "window.location.href='{$vinculo}'\n";
     echo toba_js::cerrar();
 }
Ejemplo n.º 6
0
 function generar_html()
 {
     // si se da un timeout, esta pagina puede cargarse en un frame...
     // esta funcion detecta este caso y lo soluciona
     $codigo_js = "\n\t\t\tif(self.name!=top.name)\t{\n\t\t\t\ttop.location.href='{$_SERVER['PHP_SELF']}';\n\t\t\t}\n\t\t";
     echo toba_js::ejecutar($codigo_js);
     echo "\n\t\t\t<style type='text/css'>\n\t\t\t.ci-barra-sup {\n\t\t\t\t-moz-border-radius:6px 6px 0 0;\n\t\t\t\tborder-radius:6px 6px 0 0;\n\t\t\t\t-webkit-border-radius:6px 6px 0 0;\n\t\t\t\tpadding: 3px;\n\t\t\t\t\tbackground-image: -webkit-gradient(\n\t\t\t\t    linear,\n\t\t\t\t    left top,\n\t\t\t\t    left bottom,\n\t\t\t\t    color-stop(0.5, #7485b3),\n\t\t\t\t    color-stop(0.5, #5368a1)\n\t\t\t\t);\n\t\t\t\tbackground-image: -moz-linear-gradient(\n\t\t\t\t    center top,\n\t\t\t\t    #7485b3 50%,\n\t\t\t\t    #5368a1 50%\n\t\t\t\t);\n\t\t\t\tmargin-bottom: 3px;\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t}\n\t\t\t.cuerpo {\n\t\t\t\tborder-top: 2px solid black;\n\n\t\t\t}\n\t\t\t</style>\n\t\t";
     parent::generar_html();
 }
Ejemplo n.º 7
0
 function generar_html()
 {
     $orden = $this->get_orden();
     $url = $this->get_gadget_url();
     $titulo = $this->get_titulo();
     echo "<div id='gadget-chrome-{$orden}' class='gadgets-gadget-chrome'></div>\n";
     echo toba_js::abrir();
     echo "\n\t\t\tvar gadget{$orden} = gadgets.container.createGadget({specUrl: '{$url}', title: '{$titulo}', elim: " . ($this->es_eliminable() ? 'true' : 'false') . "});\n\t\t\tgadgets.container.addGadget(gadget{$orden});\n\n\t\t\tif (typeof gadgets.container.layoutManager.gadgetChromeIds_ == 'undefined') {\n\t\t\t\tgadgets.container.layoutManager.gadgetChromeIds_ = [];\n\t\t\t}\n\t\t\tgadgets.container.layoutManager.gadgetChromeIds_.push('gadget-chrome-{$orden}');\n\n\t\t\tgadgets.container.renderGadget(gadget{$orden});\n\t\t";
     echo toba_js::cerrar();
 }
Ejemplo n.º 8
0
 protected function generar_html_encabezado()
 {
     echo "<html><head>";
     $estilo = toba::proyecto()->get_parametro('estilo');
     echo toba_recurso::link_css("toba_impr", 'screen');
     echo toba_recurso::link_css("toba_impr", 'print');
     echo "<style type='text/css' media='print'>\n\t\t\t.barra-impresion {\n\t\t\t\tdisplay: none;\t\t\t\t\n\t\t\t}\n\t\t\t</style>\n";
     toba_js::cargar_consumos_basicos();
     echo "</head><body>\n";
     echo "<div class='barra-impresion'>";
     echo "<button onclick='window.print()'>" . toba_recurso::imagen_toba('impresora.gif', true, null, null) . "    Imprimir</button>";
     echo "</div>";
     echo $this->encabezado();
 }
Ejemplo n.º 9
0
 function generar_layout()
 {
     $tipos_rs = toba_info_editores::get_lista_tipo_molde();
     $tipos = array();
     foreach ($tipos_rs as $tipo) {
         $tipos[$tipo['operacion_tipo']] = array('descripcion' => $tipo['descripcion'], 'vista_previa' => toba_recurso::imagen_proyecto($tipo['vista_previa'], false));
     }
     echo toba_js::abrir();
     echo 'var tipos_operacion = ' . toba_js::arreglo($tipos, true, true) . "\n";
     echo toba_js::cerrar();
     $this->dep('form_tipo_operacion')->generar_html();
     //$this->generar_botones();
     //$this->generar_boton('siguiente_editar');
     echo "<div style='background-color: #808080;padding-bottom: 15px;margin-top: 5px; color: white; text-align:center; font-size:12px; font-weight: bold;'><hr>";
     echo "<div id='operacion_descripcion'></div>";
     echo "<div id='operacion_vista_previa' style='display:none; padding-top:10px;'></div>";
     echo '</div>';
 }
Ejemplo n.º 10
0
    /**
     *	Retorna el html que grafica el app_launcher con informacion del usuario y aplicaciones a las que tiene acceso
     *	@return string	html del app_launcher
     */
    public function get_html_app_launcher()
    {
        $js = toba_editor::modo_prueba() ? 'window.close()' : 'salir()';
        $url_js_app_launcher = toba::instalacion()->get_url() . '/js/js-app-launcher/';
        $html = '	<link rel="stylesheet" href="' . $url_js_app_launcher . 'css/font-awesome-4.4.0/css/font-awesome.min.css" type="text/css" />';
        $html .= '	<link rel="stylesheet" href="' . $url_js_app_launcher . 'css/app_launcher.css" type="text/css" />';
        $html .= toba_js::incluir($url_js_app_launcher . 'app_launcher.js');
        $html .= '	<div id="enc-usuario" class="enc-usuario">';
        $html .= '	</div>';
        $html .= '	<script>
					appLauncher.init({
						container: "#enc-usuario",
						data: ' . json_encode($this->get_app_launcher_data()) . ',
						js_salir: function() { javascript:' . $js . '},
					});
				</script>';
        return $html;
    }
Ejemplo n.º 11
0
 protected function generar_cuerpo()
 {
     $id_div = '';
     $id = "id='{$this->objeto_js}_nodo_raiz'";
     if (count($this->_nodos_inicial) > 1) {
         $id_div = $id;
         $id = '';
     }
     if ($this->modo_editable) {
         echo toba_js::incluir('jquery.easyui.min.js');
     }
     echo "<div class='ei-cuerpo ei-arbol-cuerpo' {$id_div}>\n";
     foreach ($this->_nodos_inicial as $nodo_inicial) {
         echo "\n<ul {$id} class='ei-arbol-raiz'>";
         echo $this->recorrer_recursivo($nodo_inicial, true);
         echo '</ul>';
         $id = null;
         //El id lo tiene solo el primer nodo
     }
     echo '</div>';
 }
Ejemplo n.º 12
0
    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();
        }
    }
Ejemplo n.º 13
0
 /**
  * @ignore 
  */
 function generar_js()
 {
     $identado = toba_js::instancia()->identado();
     echo "\n{$identado}//---------------- CREANDO OBJETO {$this->objeto_js} --------------  \n";
     $this->crear_objeto_js();
     $this->controlador->extender_objeto_js();
     $this->extender_objeto_js();
     echo "\n";
     $this->iniciar_objeto_js();
     echo "{$identado}//-----------------------------------------------------------------  \n";
     return $this->objeto_js;
 }
 function actualizar_estado_js($nodo)
 {
     $js_code = '';
     $estado = $this->recuperar_estado_nodos($nodo);
     //Busco el estado de los nodos
     if (!empty($estado['activos'])) {
         $js_code .= $this->objeto_js . '.agregar_activos(' . toba_js::arreglo(array_fill_keys($estado['activos'], true), true) . ');';
     }
     if (!empty($estado['inactivos'])) {
         $js_code .= $this->objeto_js . '.agregar_inactivos(' . toba_js::arreglo(array_fill_keys($estado['inactivos'], true), true) . ');';
     }
     return $js_code;
 }
Ejemplo n.º 15
0
 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;
 }
Ejemplo n.º 16
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     //Si hay seleccion multiple, envia los ids de las filas
     $id_evt_multiple = $this->get_ids_evento_aplicacion_multiple();
     $hay_multiple = !empty($id_evt_multiple);
     $id_evt_multiple = ', ' . toba_js::arreglo($id_evt_multiple);
     $filas = ',[]';
     if ($hay_multiple) {
         $datos = isset($this->datos) && is_array($this->datos) ? $this->datos : array();
         $filas = ',' . toba_js::arreglo(array_keys($datos));
     }
     echo $identado . "window.{$this->objeto_js} = new ei_cuadro({$id}, '{$this->objeto_js}', '{$this->_submit}'{$filas} {$id_evt_multiple});\n";
 }
Ejemplo n.º 17
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $rango_tabs = "new Array({$this->_rango_tabs[0]}, {$this->_rango_tabs[1]})";
     $esclavos = toba_js::arreglo($this->_carga_opciones_ef->get_cascadas_esclavos(), true, false);
     $maestros = toba_js::arreglo($this->_carga_opciones_ef->get_cascadas_maestros(), true, false);
     $id = toba_js::arreglo($this->_id, false);
     $invalidos = toba_js::arreglo($this->_efs_invalidos, true);
     echo $identado . "window.{$this->objeto_js} = new ei_formulario({$id}, '{$this->objeto_js}', {$rango_tabs}, '{$this->_submit}', {$maestros}, {$esclavos}, {$invalidos});\n";
     if ($this->_disparo_evento_condicionado_a_datos) {
         echo $identado . "{$this->objeto_js}.set_eventos_condicionados_por_datos(true);";
     }
     foreach ($this->_lista_ef_post as $ef) {
         if (!in_array($ef, $this->_efs_generados)) {
             throw new toba_error_def($this->get_txt() . " Error en la redefinición del layout: Falta salida ef '{$ef}'");
         }
         echo $identado . "{$this->objeto_js}.agregar_ef({$this->_elemento_formulario[$ef]->crear_objeto_js()}, '{$ef}');\n";
     }
     if ($this->_detectar_cambios) {
         foreach (array_keys($this->_eventos_usuario_utilizados) as $id_evento) {
             if ($this->evento($id_evento)->es_predeterminado()) {
                 $excluidos = array();
                 foreach ($this->_lista_ef_post as $ef) {
                     if ($this->ef($ef)->es_solo_lectura()) {
                         $excluidos[] = $ef;
                     }
                 }
                 $excluidos = toba_js::arreglo($excluidos);
                 echo $identado . "{$this->objeto_js}.set_procesar_cambios(true, '{$id_evento}', {$excluidos});\n";
             }
         }
     }
 }
Ejemplo n.º 18
0
 /**
  * Genera el codigo para inicializar el objeto JS
  * @ignore
  */
 protected function iniciar_objeto_js()
 {
     $url = $this->get_url_mapa();
     $identado = toba_js::instancia()->identado();
     //Obtengo el Full Extent del mapa, los zooms intermedios los maneja el cliente
     $extent_full = "'{$this->_extent->minx}' ,' {$this->_extent->maxx}', '{$this->_extent->miny}', '{$this->_extent->maxy}'";
     //Porcion actualmente visible, si no hay valores tomo el extent full como referencia
     if (isset($this->_extent_activo)) {
         $extent = "'" . $this->_extent_activo['xmin'] . "' ,'" . $this->_extent_activo['xmax'] . "', '" . $this->_extent_activo['ymin'] . "', '" . $this->_extent_activo['ymax'] . "'";
     } else {
         $extent = $extent_full;
     }
     //Obtengo la lista de Layers original del mapa
     $layers = implode(' ', $this->get_nombre_layers());
     //Genero los eventos en JS
     $this->generar_botones_eventos_js();
     //Se agrega al objeto al singleton toba
     echo $identado . "toba.agregar_objeto(window.{$this->objeto_js});\n";
     //Envio todas las variables necesarias en el cliente
     echo $identado . "{$this->objeto_js}.set_url('{$url}');\n";
     echo $identado . "{$this->objeto_js}.set_full_extent({$extent_full}); \n";
     echo $identado . "{$this->objeto_js}.set_extent({$extent});\n";
     echo $identado . "{$this->objeto_js}.set_layers('{$layers}');\n";
     echo $identado . "{$this->objeto_js}.set_layers_activos(" . toba_js::arreglo(array_fill_keys($this->_layers_activos, 1), true) . "); \n";
     echo $identado . "{$this->objeto_js}.iniciar();\n";
     echo $identado . "{$this->objeto_js}.render();\n";
     //-- EVENTO implicito --
     /*		if (isset($this->_evento_implicito) && is_object($this->_evento_implicito)){
     			$evento_js = $this->_evento_implicito->get_evt_javascript();
     			echo toba_js::instancia()->identado()."{$this->objeto_js}.set_evento_implicito($evento_js);\n";
     		}*/
     if ($this->_colapsado) {
         echo $identado . "window.{$this->objeto_js}.colapsar();\n";
     }
 }
Ejemplo n.º 19
0
 /**
  * Genera el tag HTML necesario para incluir el archivo generado por GrahpViz
  * @param string $url
  * @param string $formato
  * @param string $ancho
  * @param string $alto
  */
 static function generar_sentencia_incrustacion($url, $formato, $ancho = null, $alto = null, $incluir_mapa = null, $objeto_js = null)
 {
     if (!$incluir_mapa || !($ancho && $alto)) {
         $ancho = isset($ancho) ? "width='{$ancho}'" : "";
         $alto = isset($alto) ? "height='{$alto}'" : "";
         switch ($formato) {
             case 'png':
             case 'gif':
                 echo "<img src='{$url}' {$ancho} {$alto} border='0'>";
                 break;
             case 'svg':
                 /*toba_js::cargar_consumos_globales(array("utilidades/svglib"));
                 		echo toba_js::abrir();
                 		echo "//aviso_instalacion_svg()";
                 		echo toba_js::cerrar();	*/
                 echo "<embed src='{$url}' type='image/svg+xml' {$ancho} {$alto} palette='foreground' pluginspage='http://www.adobe.com/svg/viewer/install/auto'>\n";
                 echo "</embed>";
                 break;
         }
     } else {
         //Sacamos el ratio (el lado mas largo del mapa tendrá 100px)
         /*			$ratio = ($ancho>$alto)?100/$ancho:100/$alto;
         			$alto_mapa = $alto*$ratio;
         			$ancho_mapa = $ancho*$ratio;*/
         if (substr($alto, -2) == 'px') {
             $alto = substr($alto, 0, -2);
         }
         if (substr($ancho, -2) == 'px') {
             $ancho = substr($ancho, 0, -2);
         }
         switch ($formato) {
             case 'png':
             case 'gif':
                 $imagen_real = "<img id='imagen_real_{$objeto_js}' src='{$url}' border='0'>";
                 $imagen_mapa = "<img id='imagen_mapa_{$objeto_js}' src='{$url}' border='0'>";
                 break;
             case 'svg':
                 /*toba_js::cargar_consumos_globales(array("utilidades/svglib"));
                 		echo toba_js::abrir();
                 		echo "//aviso_instalacion_svg()";
                 		echo toba_js::cerrar();	*/
                 $imagen_real = "<embed id='imagen_real_{$objeto_js}' src='{$url}' type='image/svg+xml' palette='foreground' pluginspage='http://www.adobe.com/svg/viewer/install/auto'></embed>";
                 $imagen_mapa = "<embed id='imagen_mapa_{$objeto_js}' src='{$url}' type='image/svg+xml' palette='foreground' pluginspage='http://www.adobe.com/svg/viewer/install/auto'></embed>";
                 break;
         }
         echo "\n\t\t\t<div class='ei-barra-sup ci-barra-sup ei-barra-sup-sin-botonera' style='height: 20px; width: {$ancho}px; color: white; position: relative'>\n\t\t\t\t<span id='colapsado_mapa_{$objeto_js}' style='position: absolute; width: 16px; height: 16px; left: 0px;  text-align: center; padding: 2px'>" . toba_recurso::imagen_toba('colapsado.gif', true) . "</span>\n\t\t\t\t<div style='height: 20px;position: absolute; left: 20px; width: " . ($ancho - 20) . "px'> \n\t\t\t\t\t<span id='escala_mapa_{$objeto_js}' style='position: absolute; width: 16px; height: 16px; right: 0px; text-align: center; padding: 2px; border-right: 1px solid black'>" . toba_recurso::imagen_toba('transform-move.png', true) . "</span>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div style='height: {$alto}px; width: {$ancho}px; position: relative'>\n\t\t\t\t<div id='marco_{$objeto_js}' style='height: {$alto}px; width: {$ancho}px; overflow: hidden; position: absolute; top: 0: left: 0;'>\n\t\t\t\t\t{$imagen_real}\n\t\t\t\t</div>\n\t\t\t\t<div id='mapa_{$objeto_js}' style='position: absolute; top: 0; left: 0; border: 1px solid black; overflow: hidden'>\n\t\t\t\t\t<div id='lupa_{$objeto_js}' style='position: absolute; top: 0: left: 0; border: 1px solid red'></div>\n\t\t\t\t\t{$imagen_mapa}\n\t\t\t\t</div>\n\t\t\t\t\n\t\t\t</div>";
         $tam_mapa = '';
         if (substr($incluir_mapa, -1) == '%') {
             $tam_mapa = ($alto < $ancho ? $alto : $ancho) * (int) substr($incluir_mapa, 0, -1) / 100;
         } elseif (strtolower(substr($incluir_mapa, -2)) == 'px') {
             $tam_mapa = substr($incluir_mapa, 0, -2);
         } else {
             $tam_mapa = $incluir_mapa;
         }
         echo toba_js::incluir(toba_recurso::js('basicos/jquery-1.9.1.min.js'));
         echo toba_js::incluir(toba_recurso::js('utilidades/jquery-ui-1.10.1.custom.min.js'));
         echo toba_js::abrir();
         echo "\n\t\t\tdocument.readyFunc = function(e) {\n\t\t\t\t\n\t\t\t\tvar img_real = document.getElementById('imagen_real_{$objeto_js}');\n\t\t\t\tif (img_real.clientHeight > 0 && img_real.clientWidth > 0) {\n\t\t\t\t\n\t\t\t\t\tvar marco = document.getElementById('marco_{$objeto_js}');\n\t\t\t\t\tvar mapa = document.getElementById('mapa_{$objeto_js}');\n\t\t\t\t\tvar escala = document.getElementById('escala_mapa_{$objeto_js}');\n\t\t\t\t\tvar colapsado = document.getElementById('colapsado_mapa_{$objeto_js}');\n\t\t\t\t\tvar lupa = document.getElementById('lupa_{$objeto_js}');\n\t\t\t\t\tvar img_mapa = document.getElementById('imagen_mapa_{$objeto_js}');\n\t\t\t\t\tvar ancho_mapa = 200 > marco.clientHeight?marco.clientHeight:200;\n\t\t\t\t\tvar ratio;\n\t\t\t\t\tvar alto_mapa;\n\t\t\t\t\tif(marco.clientHeight > img_real.clientHeight && marco.clientWidth > img_real.clientWidth) {\n\t\t\t\t\t\tescala.style.display = 'none';\n\t\t\t\t\t\tmapa.style.display = 'none';\n\t\t\t\t\t}\n\t\t\t\t\tvar escalar_{$objeto_js} = function(skipImg) {\n\t\t\t\t\t\tratio = ancho_mapa/img_real.clientWidth;\n\t\t\t\t\t\talto_mapa = img_real.clientHeight*ratio;\n\t\t\t\t\t\tif(alto_mapa > marco.clientHeight) {\n\t\t\t\t\t\t\tratio = marco.clientHeight/img_real.clientHeight;\n\t\t\t\t\t\t\talto_mapa = img_real.clientHeight*ratio;\n\t\t\t\t\t\t\tancho_mapa = img_real.clientWidth*ratio;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tmapa.style.height= alto_mapa+'px';\n\t\t\t\t\t\tmapa.style.width= ancho_mapa+'px';\n\t\t\t\t\t\tescala.style.left= (ancho_mapa-39)+'px';\n\t\t\t\t\t\tif(!skipImg) {\n\t\t\t\t\t\t\timg_mapa.style.height= alto_mapa+'px';\n\t\t\t\t\t\t\timg_mapa.style.width= ancho_mapa+'px';\n\t\t\t\t\t\t\tlupa.style.height=((marco.clientHeight*ratio)-2)+'px';//-2: Hay que tener en cuenta el borde\n\t\t\t\t\t\t\tlupa.style.width=((marco.clientWidth*ratio)-2)+'px';\n\t\t\t\t\t\t\tlupa.style.top=(marco.scrollTop*ratio)+'px';\n\t\t\t\t\t\t\tlupa.style.left=(marco.scrollLeft*ratio)+'px';\n\t\t\t\t\t\t}\n\t\t\t\t\t};\n\t\t\t\t\tescalar_{$objeto_js}();\n\t\t\t\t\t\n\t\t\t\t\tlupa.date = new Date();\n\t\t\t\t\t\$(lupa).draggable({\n\t\t\t\t\t\tcontainment: 'parent',\n\t\t\t\t\t\t/*drag: function() {\n\t\t\t\t\t\t\tvar d = new Date();\n\t\t\t\t\t\t\tif(d.getTime() - lupa.date.getTime() > 100) {\n\t\t\t\t\t\t\t\tvar t = parseInt(lupa.style.top.substr(0, lupa.style.top.length-2))/ratio; \n\t\t\t\t\t\t\t\tvar l = parseInt(lupa.style.left.substr(0, lupa.style.left.length-2))/ratio;\n\t\t\t\t\t\t\t\tmarco.scrollTop = t;\n\t\t\t\t\t\t\t\tmarco.scrollLeft = l;\n\t\t\t\t\t\t\t\tlupa.date = d;\n\t\t\t\t\t\t\t} \n\t\t\t\t\t\t},*/ \n\t\t\t\t\t\tstop: function() {\n\t\t\t\t\t\t\tvar t = parseInt(lupa.style.top.substr(0, lupa.style.top.length-2))/ratio; \n\t\t\t\t\t\t\tvar l = parseInt(lupa.style.left.substr(0, lupa.style.left.length-2))/ratio;\n\t\t\t\t\t\t\tmarco.scrollTop = t;\n\t\t\t\t\t\t\tmarco.scrollLeft = l;\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\$(colapsado).click(function() {\n\t\t\t\t\t\t\$(mapa).slideToggle('slow', function() {\n\t\t\t\t\t\t\tescala.style.display = this.style.display;\n\t\t\t\t\t\t});\n\t\t\t\t\t});\n\t\t\t\t\t\$(escala).draggable({\n\t\t\t\t\t\tcontainment: 'parent', \n\t\t\t\t\t\taxis: 'x',\n\t\t\t\t\t\tdrag: function() {\n\t\t\t\t\t\t\tvar left = escala.style.left;\n\t\t\t\t\t\t\tancho_mapa = parseInt(left.substr(0, left.length - 2))+39;\n\t\t\t\t\t\t\tescalar_{$objeto_js}(true);\n\t\t\t\t\t\t},\n\t\t\t\t\t\tstop: function() {\n\t\t\t\t\t\t\tescalar_{$objeto_js}();\n\t\t\t\t\t\t}\n\t\t\t\t\t});\n\t\t\t\t\t\$(img_mapa).click(function(event) {\n\t\t\t\t\t\tvar x = event.offsetX?event.offsetX:event.layerX;\n\t\t\t\t\t\tvar y = event.offsetY?event.offsetY:event.layerY;\n\t\t\t\t\t\tvar lh = parseInt(lupa.style.height.substr(0, lupa.style.height.length-2)); \n\t\t\t\t\t\tvar lw = parseInt(lupa.style.width.substr(0, lupa.style.width.length-2));\n\t\t\t\t\t\t\n\t\t\t\t\t\tvar l = x - (lw/2) - 1; //-1: Hay que tener en cuenta el borde \n\t\t\t\t\t\tvar t = y - (lh/2) - 1; \n\t\t\t\t\t\tif(l < 0) {\n\t\t\t\t\t\t\tl = 0;\n\t\t\t\t\t\t} else if (l + lw + 2 > ancho_mapa) {\n\t\t\t\t\t\t\tl = ancho_mapa - lw - 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(t < 0) {\n\t\t\t\t\t\t\tt = 0;\n\t\t\t\t\t\t} else if (t + lh + 2 > alto_mapa) {\n\t\t\t\t\t\t\tt = alto_mapa - lh - 2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlupa.style.top = t+'px';\n\t\t\t\t\t\tlupa.style.left = l+'px';\n\t\t\t\t\t\tmarco.scrollTop = t/ratio;\n\t\t\t\t\t\tmarco.scrollLeft = l/ratio;\n\t\t\t\t\t});\n\t\t\t\t} else { \n\t\t\t\t\tsetTimeout('\$(document).ready(document.readyFunc)', 100);\n\t\t\t\t}\n\t\t\t};\n\t\t\t\$(document).ready(document.readyFunc);\n\t\t\t";
         echo toba_js::cerrar();
     }
 }
Ejemplo n.º 20
0
 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>";
     }
 }
Ejemplo n.º 21
0
 /**
  * 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();
     }
 }
Ejemplo n.º 22
0
 /**
  * @ignore 
  */
 protected function dump_esquema_relaciones($nodo)
 {
     $datos = $nodo->getData();
     $diagrama = '';
     foreach ($nodo->getNeighbours() as $nodo_vecino) {
         $datos_vecino = $nodo_vecino->getData();
         //Busco los toba_relacion_entre_tablas correspondientes
         $hijo_id = $datos_vecino['identificador'];
         $padre_id = $datos['identificador'];
         $relacion = $this->_relaciones[$padre_id . "-" . $hijo_id];
         $mapeo = $relacion->get_mapeo_filas();
         //Incluyo el mapeo en JS para poder dumpearlo
         $var_mapeo = $padre_id . "_" . $hijo_id . self::$debug_pasadas;
         echo toba_js::abrir();
         echo "var {$var_mapeo} = " . toba_js::arreglo($mapeo, true) . ";\n";
         echo toba_js::cerrar();
         //Calculo la cantidad de filas padres e hijas involucradas en la relación
         $cant_padres = 0;
         $cant_hijos = 0;
         $mapeo_hijos = array();
         foreach ($mapeo as $padre => $hijos) {
             if (count($hijos) > 0) {
                 $cant_padres++;
             }
             $mapeo_hijos = array_merge($mapeo_hijos, $hijos);
         }
         $cant_hijos = count(array_unique($mapeo_hijos));
         //Incluyo la relación
         $diagrama .= $padre_id . " -> " . $hijo_id . " [fontsize=6,color=gray, label=\"{$cant_padres} - {$cant_hijos}\"" . ",URL=\"javascript: padre=(window.parent.var_dump)? window.parent : window;padre.var_dump(padre.{$var_mapeo})\"];\n";
     }
     return $diagrama;
 }
Ejemplo n.º 23
0
 function generar_js()
 {
     echo "vinculador.limpiar_vinculos();\n";
     foreach ($this->vinculos as $id => $vinculo) {
         $opciones = $vinculo->get_opciones();
         if (!isset($opciones['validar'])) {
             //Por defecto los vinculos no se validan.
             $opciones['validar'] = false;
         }
         $datos['url'] = $this->get_url($vinculo->get_proyecto(), $vinculo->get_item(), $vinculo->get_parametros(), $opciones);
         if (isset($datos['url'])) {
             $datos['popup'] = $vinculo->estado_popup();
             $datos['popup_parametros'] = $vinculo->get_popup_parametros();
             $datos['target'] = $vinculo->get_target();
             $datos['activado'] = 1;
             $datos['ajax'] = $vinculo->get_ajax();
             $datos['nombre_ventana'] = $vinculo->get_id_ventana_popup();
             $datos_js = toba_js::arreglo($datos, true);
             echo "vinculador.agregar_vinculo('{$id}',{$datos_js});\n";
         }
     }
 }
Ejemplo n.º 24
0
 function crear_objeto_js()
 {
     $mantiene_estado_js = toba_js::bool($this->mantiene_estado_cascada);
     return "new ef_combo({$this->parametros_js()}, {$mantiene_estado_js})";
 }
Ejemplo n.º 25
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $opciones['servicio'] = 'ejecutar';
     $opciones['objetos_destino'] = array($this->_id);
     $autovinculo = toba::vinculador()->get_url(null, null, '', $opciones);
     echo $identado . "window.{$this->objeto_js} = new ei_arbol('{$this->objeto_js}',\n\t\t'{$this->_submit}', '{$autovinculo}');\n";
 }
Ejemplo n.º 26
0
 function crear_objeto_js()
 {
     $mantiene_estado_js = toba_js::bool($this->mantiene_estado_cascada);
     if (!$this->es_solo_lectura()) {
         return "new ef_combo_editable({$this->parametros_js()}, {$mantiene_estado_js})";
     } else {
         //--En el caso que sea solo-lectura en el server, se comporta como un combo normal en js
         $parametros = parent::parametros_js();
         return "new ef_combo({$parametros}, {$mantiene_estado_js})";
     }
 }
Ejemplo n.º 27
0
		 	 
	</tr>
	</table>
</td></tr>
<?php 
$item_actual = toba::memoria()->get_item_solicitado();
//------------ TABS
$tabs = array(array('nombre' => 'Operaciones', 'imagen' => toba_recurso::imagen_proyecto('item.gif', true), 'url' => toba::vinculador()->get_url(toba_editor::get_id(), 1000239, null, array('menu' => true, 'celda_memoria' => 'lateral')), 'ayuda' => 'Operaciones disponibles en el Proyecto'), array('nombre' => 'Comp.', 'imagen' => toba_recurso::imagen_toba('objetos/objeto.gif', true), 'url' => toba::vinculador()->get_url(toba_editor::get_id(), 1240, null, array('menu' => true, 'celda_memoria' => 'lateral')), 'ayuda' => 'Componentes disponibles en el Proyecto'), array('nombre' => 'Datos', 'imagen' => toba_recurso::imagen_toba('fuente.png', true), 'url' => toba::vinculador()->get_url(toba_editor::get_id(), 3397, null, array('menu' => true, 'celda_memoria' => 'lateral')), 'ayuda' => 'Acceso a datos'), array('nombre' => 'PHP', 'imagen' => toba_recurso::imagen_toba('nucleo/php.gif', true), 'url' => toba::vinculador()->get_url(toba_editor::get_id(), 30000012, null, array('menu' => true, 'celda_memoria' => 'lateral')), 'ayuda' => 'Código PHP del proyecto'), array('nombre' => 'Conf.', 'imagen' => toba_recurso::imagen_toba('configurar.png', true), 'url' => toba::vinculador()->get_url(toba_editor::get_id(), 1000258, null, array('menu' => true, 'celda_memoria' => 'lateral')), 'ayuda' => 'Configuración general del proyecto'));
echo "<tr  class='listado-barra-fila'><td class='ci-tabs-h-lista'>\n";
echo "<ul  style='margin-top: 6px'>\n";
$id = 'id="tab_inicial"';
$i = 0;
foreach ($tabs as $tab) {
    if ($i == 0) {
        $class = 'ci-tabs-h-solapa-sel';
    } else {
        $class = 'ci-tabs-h-solapa';
    }
    echo "<li class='{$class}'>";
    echo "<a {$id} href='{$tab['url']}' title='{$tab['ayuda']}'  onclick='seleccionar_tab(this)' target='" . apex_frame_lista . "'>{$tab['imagen']} {$tab['nombre']}</a>";
    echo '</li>';
    $id = '';
    $i++;
}
echo toba_js::ejecutar('$$("tab_inicial").onclick()');
echo '</ul>';
echo "</td></tr>\n";
?>
</table>
<?php 
echo toba_form::cerrar();
Ejemplo n.º 28
0
 /**
  * Genera la invocación JS necesaria para incluir en un onclick por ejemplo
  */
 function get_invocacion_js($objeto_js = null, $id_componente = null)
 {
     if (!isset($objeto_js)) {
         $objeto_js = $this->contenedor->get_id_objeto_js();
     }
     if (!isset($id_componente)) {
         $id_componente = $this->contenedor->get_id();
     }
     if ($this->posee_accion_imprimir()) {
         // ---*** IMPRIMIR HTML ***---
         $opciones['servicio'] = 'vista_toba_impr_html';
         $opciones['objetos_destino'] = array($id_componente);
         //$opciones['celda_memoria'] = 'popup';
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         if ($this->datos['accion_imphtml_debug'] == 1) {
             $js = "imprimir_html('{$url}',true);";
         } else {
             $js = "imprimir_html('{$url}');";
         }
     } elseif ($this->posee_accion_vista_pdf()) {
         // ---*** VISTA PDF ***---
         $opciones['servicio'] = 'vista_pdf';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_excel()) {
         // ---*** VISTA EXCEL ***---
         $opciones['servicio'] = 'vista_excel';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_xslfo()) {
         // ---*** VISTA XSLFo ***---
         $opciones['servicio'] = 'vista_xslfo';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_jasperreports()) {
         // ---*** VISTA JASPERREPORTS ***---
         $opciones['servicio'] = 'vista_jasperreports';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vista_xml()) {
         // ---*** VISTA XML ***---
         $opciones['servicio'] = 'vista_xml';
         $opciones['objetos_destino'] = array($id_componente);
         $url = toba::vinculador()->get_url(null, null, array(), $opciones);
         $js = "document.location.href='{$url}';";
     } elseif ($this->posee_accion_vincular()) {
         // ---*** VINCULO ***---
         if (isset($this->datos['accion_vinculo_servicio']) && !is_null($this->datos['accion_vinculo_servicio'])) {
             $this->vinculo()->set_servicio($this->datos['accion_vinculo_servicio']);
         }
         // Registro el vinculo en el vinculador
         $id_vinculo = toba::vinculador()->registrar_vinculo($this->vinculo());
         if (!isset($id_vinculo)) {
             //Si no tiene permisos no devuelve un identificador
             return null;
         }
         $es_boton_visible = ($this->esta_en_botonera() || $this->esta_sobre_fila()) && $this->esta_activado();
         // Escribo la sentencia que invocaria el vinculo
         if ($this->posee_confirmacion() && $es_boton_visible) {
             $conf_msg = $this->get_msg_confirmacion();
             $js = "{$objeto_js}.invocar_vinculo_confirmado('" . $this->get_id() . "', '{$id_vinculo}', '{$conf_msg}');";
         } else {
             $js = "{$objeto_js}.invocar_vinculo('" . $this->get_id() . "', '{$id_vinculo}');";
         }
     } elseif ($this->posee_accion_respuesta_popup()) {
         //--- En una respuesta a un ef_popup
         $param = addslashes(str_replace('"', "'", $this->parametros));
         $js = "iniciar_respuesta_popup(this, '{$param}');";
     } else {
         // Manejo estandar de eventos
         $submit = toba_js::bool(!($this->es_seleccion_multiple() || $this->posee_accionar_diferido()));
         $js = "{$objeto_js}.set_evento(" . $this->get_evt_javascript() . ", {$submit}, this);";
     }
     return $js;
 }
Ejemplo n.º 29
0
 /**
  * Genera el HTML correspondiente a la barra de paginacion
  */
 protected function html_barra_paginacion()
 {
     $objeto_js = $this->_cuadro->get_id_objeto_js();
     $total_registros = $this->_cuadro->get_total_registros();
     $tamanio_pagina = $this->_cuadro->get_tamanio_pagina();
     $pagina_actual = $this->_cuadro->get_pagina_actual();
     $cantidad_paginas = $this->_cuadro->get_cantidad_paginas();
     $parametros = $this->_cuadro->get_nombres_parametros();
     $eventos = $this->_cuadro->get_eventos();
     echo "<div class='ei-cuadro-pag'>";
     if (isset($total_registros) && !($tamanio_pagina >= $total_registros)) {
         //Calculo los posibles saltos
         //Primero y Anterior
         if ($pagina_actual == 1) {
             $anterior = toba_recurso::imagen_toba("nucleo/paginacion/anterior_deshabilitado.gif", true);
             $primero = toba_recurso::imagen_toba("nucleo/paginacion/primero_deshabilitado.gif", true);
         } else {
             $evento_js = toba_js::evento('cambiar_pagina', $eventos["cambiar_pagina"], $pagina_actual - 1);
             $js = "{$objeto_js}.set_evento({$evento_js});";
             $img = toba_recurso::imagen_toba("nucleo/paginacion/anterior.gif");
             $anterior = toba_recurso::imagen($img, null, null, 'Página Anterior', '', "onclick=\"{$js}\"", 'cursor: pointer;cursor:hand;');
             $evento_js = toba_js::evento('cambiar_pagina', $eventos["cambiar_pagina"], 1);
             $js = "{$objeto_js}.set_evento({$evento_js});";
             $img = toba_recurso::imagen_toba("nucleo/paginacion/primero.gif");
             $primero = toba_recurso::imagen($img, null, null, 'Página Inicial', '', "onclick=\"{$js}\"", 'cursor: pointer;cursor:hand;');
         }
         //Ultimo y Siguiente
         if ($pagina_actual == $cantidad_paginas) {
             $siguiente = toba_recurso::imagen_toba("nucleo/paginacion/siguiente_deshabilitado.gif", true);
             $ultimo = toba_recurso::imagen_toba("nucleo/paginacion/ultimo_deshabilitado.gif", true);
         } else {
             $evento_js = toba_js::evento('cambiar_pagina', $eventos["cambiar_pagina"], $pagina_actual + 1);
             $js = "{$objeto_js}.set_evento({$evento_js});";
             $img = toba_recurso::imagen_toba("nucleo/paginacion/siguiente.gif");
             $siguiente = toba_recurso::imagen($img, null, null, 'Página Siguiente', '', "onclick=\"{$js}\"", 'cursor: pointer;cursor:hand;');
             $evento_js = toba_js::evento('cambiar_pagina', $eventos["cambiar_pagina"], $cantidad_paginas);
             $js = "{$objeto_js}.set_evento({$evento_js});";
             $img = toba_recurso::imagen_toba("nucleo/paginacion/ultimo.gif");
             $ultimo = toba_recurso::imagen($img, null, null, 'Página Final', '', "onclick=\"{$js}\"", 'cursor: pointer;cursor:hand;');
         }
         echo "{$primero} {$anterior} Página <strong>";
         $js = "{$objeto_js}.ir_a_pagina(this.value);";
         $tamanio = ceil(log10($total_registros));
         echo toba_form::text($parametros['paginado'], $pagina_actual, false, '', $tamanio, 'ef-numero', "onchange=\"{$js}\"");
         echo "</strong> de <strong>{$cantidad_paginas}</strong> {$siguiente} {$ultimo}";
     }
     echo "</div>";
 }
Ejemplo n.º 30
0
    function extender_objeto_js()
    {
        if (!$this->controlador->debe_mostrar_visor() || !$this->controlador->existe_archivo_log()) {
            return;
        }
        $niveles = toba::logger()->get_niveles();
        $parametros = array();
        ?>
			var ultima_mod ='<?php 
        echo $this->controlador->timestamp_archivo();
        ?>
';
			var niveles = <?php 
        echo toba_js::arreglo($niveles);
        ?>
;
			var niveles_actuales = {length: 0};

			<?php 
        echo $this->objeto_js;
        ?>
.evt__refrescar = function() {
				this.ajax('get_datos_logger', ultima_mod, this, this.respuesta_refresco);
				return false;
			}
			
			<?php 
        echo $this->objeto_js;
        ?>
.respuesta_refresco = function(resp)
			{
				if (resp != null) {
					toba.inicio_aguardar();				
					ultima_mod = resp['ultima_mod'];
					document.getElementById('logger_encabezados').innerHTML = resp['encabezado'];
					document.getElementById('logger_detalle').innerHTML = resp['detalle'];
					document.getElementById('logger_info_operacion').innerHTML = resp['info_op'];
					refrescar_cantidad_niveles(resp['cant_por_nivel']);		
					refrescar_detalle();
					this.mostrar_proyecto(true);
					setTimeout("toba.fin_aguardar()", 200);					
				}
			}
			
			function mostrar_nivel(nivel)
			{
				var li_nivel = document.getElementById('nivel_' + nivel);
				if (! niveles_actuales[nivel]) {
					niveles_actuales[nivel] = true;
					niveles_actuales.length++;
				} else {
					delete(niveles_actuales[nivel]);
					niveles_actuales.length--;
				}
				refrescar_niveles();
				refrescar_detalle();
			}

			<?php 
        echo $this->objeto_js;
        ?>
.mostrar_proyecto = function (inicial)
			{
				obj_combo = document.getElementById('opciones_proyectos');
				valor = obj_combo.options[obj_combo.selectedIndex].value;

				//Informo el modo de seleccion para que sea recordado entre pedidos de pagina
				if (!inicial){
					this.ajax('set_modo_detalle_seleccionado', valor, this, this.dump_response);
				}

				//Refresco la visualizacion del detalle
				var mostrar_todos = (valor == 'no_seteado');
				var detalle = document.getElementById('logger_detalle');
				for (var i=0; i < detalle.childNodes.length; i++) {
					var nodo = detalle.childNodes[i];
					var pr = nodo.attributes['proyecto'].value;
					var debe_mostrar = (mostrar_todos || (pr == valor));
					if (debe_mostrar && nodo.style.display == 'none') {
						nodo.style.display = '';
					}
					if (!debe_mostrar && nodo.style.display == '') {
						nodo.style.display = 'none';
					}
				}
			}

			function refrescar_niveles()
			{
				var mostrar_todos = (niveles_actuales.length == 0);			
				for (var i=0; i < niveles.length; i++) {
					var nivel_min = niveles[i].toLowerCase();
					var li_nivel = document.getElementById('nivel_' + niveles[i]);
					var src_actual = li_nivel.childNodes[0].childNodes[0].src;
					var diff = (mostrar_todos || niveles_actuales[niveles[i]]) ? '' : '_des';
					var src_nuevo = toba_proyecto_alias + '/img/logger/' + nivel_min + diff + '.gif';
					if (src_actual != src_nuevo) {
						li_nivel.childNodes[0].childNodes[0].src = src_nuevo;
					}
				}
			}
			
			function refrescar_detalle()
			{
				var mostrar_todos = (niveles_actuales.length == 0);
				var detalle = document.getElementById('logger_detalle');
				for (var i=0; i < detalle.childNodes.length; i++) {
					var nodo = detalle.childNodes[i];
					var nivel = nodo.attributes['nivel'].value;
					var debe_mostrar = (mostrar_todos || niveles_actuales[nivel]);
					if (debe_mostrar && nodo.style.display == 'none') {
						nodo.style.display = '';
					}
					if (!debe_mostrar && nodo.style.display == '') {
						nodo.style.display = 'none';	
					}
				}
			}			
			
			function refrescar_cantidad_niveles(cantidades)
			{
				for (var nivel in cantidades) {
					var cant = (cantidades[nivel] > 0) ? '[' + cantidades[nivel] + ']' : '';
					document.getElementById('nivel_cant_' + nivel).innerHTML = cant;
				}
			}

			<?php 
        echo $this->objeto_js;
        ?>
.dump_response = function(resp){
					//Esta funcion esta para desechar la respuesta, la cual no existe
			}

			<?php 
        echo $this->objeto_js;
        ?>
.evt__con_encabezados__click = function(obj){
				toggle_nodo(document.getElementById('logger_encabezados'));
				this.ajax('set_estado_encabezados', obj.checked, this, this.dump_response);
				return false;
			}

			<?php 
        echo $this->objeto_js;
        ?>
.mostrar_proyecto(true);
<?php 
    }