Ejemplo n.º 1
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.º 2
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.º 3
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.º 4
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.º 5
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 
    }
Ejemplo n.º 6
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.º 7
0
 /**
  * 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();
 }
Ejemplo n.º 8
0
echo toba::vinculador()->get_url('toba_usuarios', '3432', array(), array('menu' => true));
?>
';
	if ( url == '') {
		alert('No posee permisos para acceder al proyecto "toba_usuarios"!');	
		return;
	}
	var opciones = {'width': 1000, 'scrollbars' : 'yes', 'height': 650, 'resizable': 'yes'};
	abrir_popup('toba_instancia', url, opciones, null, false);
}
</script>

<?php 
$js_editor = toba_recurso::js('editor.js');
$datos = toba_editor::get_parametros_previsualizacion_js();
$parametros_previsualizacion = toba_js::arreglo($datos, true);
?>
<SCRIPT language='JavaScript1.4' type='text/javascript' src='<?php 
echo $js_editor;
?>
'></SCRIPT>
<SCRIPT language='JavaScript1.4' type='text/javascript' >
	editor.set_parametros_previsualizacion(<?php 
echo $parametros_previsualizacion;
?>
);

	var tab_actual = null;	
	function seleccionar_tab(span)
	{
		if (isset(tab_actual)) {
 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.º 10
0
 /**
  * @ignore
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     echo $identado . "window.{$this->objeto_js} = new ei_firma({$id}, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t'{$this->_submit}', \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . ($this->_multiple ? 'true' : 'false') . ");\n";
     echo "\n\t\t\tfunction appletLoaded() {\n\t\t\t\t{$this->objeto_js}.applet_cargado();\n\t\t\t}\n\t\t\tfunction firmaOk() {\n\t\t\t\t{$this->objeto_js}.firma_ok();\n\t\t\t}\n\t\t\tif (! {$this->objeto_js}._multiple) {\n\t\t\t\twindow.onload = function () {\n\t\t\t\t\t{$this->objeto_js}.ver_pdf_inline('{$this->_url_pdf_embebido}');\n\t\t\t\t};\n\t\t\t}\t\t\t\n\t\t";
 }
Ejemplo n.º 11
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $identado = toba_js::instancia()->identado();
     //Creación de los objetos javascript de los objetos
     $rango_tabs = "new Array({$this->_rango_tabs[0]}, {$this->_rango_tabs[1]})";
     $filas = toba_js::arreglo($this->_filas_enviadas);
     $en_linea = toba_js::bool($this->_info_formulario['filas_agregar_online']);
     $seleccionada = isset($this->_clave_seleccionada) ? $this->_clave_seleccionada : "null";
     $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_ml";
     echo "({$id}, '{$this->objeto_js}', {$rango_tabs}, '{$this->_submit}', {$filas}, {$this->_siguiente_id_fila}, {$seleccionada}, {$en_linea}, {$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) {
         echo $identado . "{$this->objeto_js}.agregar_ef({$this->_elemento_formulario[$ef]->crear_objeto_js()}, '{$ef}');\n";
     }
     //Agregado de callbacks para calculo de totales
     if (count($this->_lista_ef_totales) > 0) {
         foreach ($this->_lista_ef_post as $ef) {
             if (in_array($ef, $this->_lista_ef_totales)) {
                 echo $identado . "{$this->objeto_js}.agregar_total('{$ef}');\n";
             }
         }
     }
     if ($this->_hay_toggle) {
         foreach ($this->_lista_ef_post as $ef) {
             if ($this->_elemento_formulario[$ef]->get_toggle()) {
                 echo $identado . "{$this->objeto_js}.set_toggle('{$ef}');\n";
             }
         }
     }
     if (!$this->_mostrar_cabecera_sin_datos) {
         echo $identado . "{$this->objeto_js}.set_cabecera_visible_sin_datos(false);\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.º 12
0
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $efs_esclavos = $this->_carga_opciones_ef->get_cascadas_esclavos();
     $identado = toba_js::instancia()->identado();
     $id = toba_js::arreglo($this->_id, false);
     $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);
     echo $identado . "window.{$this->objeto_js} = new ei_filtro({$id}, '{$this->objeto_js}', '{$this->_submit}', {$maestros}, {$esclavos});\n";
     foreach ($this->_columnas as $columna) {
         $visible = $columna->es_visible() ? 'true' : 'false';
         $compuesto = $columna->es_compuesto() ? 'true' : 'false';
         echo $identado . "{$this->objeto_js}.agregar_ef({$columna->crear_objeto_js()}, '{$columna->get_nombre()}', {$visible}, {$compuesto});\n";
     }
     //Ciclo por los eventos para definir el comportamiento que lance el predeterminado
     foreach (array_keys($this->_eventos_usuario_utilizados) as $id_evento) {
         if ($this->evento($id_evento)->es_predeterminado()) {
             $excluidos = array();
             foreach ($this->_columnas as $columna) {
                 //Aca tengo que ciclar por las columnas
                 if ($columna->es_solo_lectura()) {
                     $excluidos[] = $columna->get_ef()->get_id();
                 }
             }
             $excluidos = toba_js::arreglo($excluidos);
             echo $identado . "{$this->objeto_js}.set_procesar_cambios(true, '{$id_evento}', {$excluidos});\n";
         }
     }
 }
Ejemplo n.º 13
0
 function extender_objeto_js()
 {
     echo "\n\t\t//---- Validacion general ----------------------------------\n\t\t\n\t\t{$this->objeto_js}.evt__validar_datos = function()\n\t\t{\n\t\t\tvar tablas = new Array();\n\t\t\tvar repetidas = new Array();\n\t\t\tvar filas = this.filas();\n\t\t\t// Control de filas repetidas\n\t\t\tfor (var id_fila in filas) {\n\t\t\t\tvar valor = this.ef('tabla_rel_dim').ir_a_fila(filas[id_fila]).get_estado();\n\t\t\t\tif( in_array(valor, tablas) ) {\n\t\t\t\t\trepetidas.push( valor );\n\t\t\t\t} else {\n\t\t\t\t    tablas.push( valor );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Control de valores duplicados con los datos del contexto\n\t\t\tvar tablas_utilizadas = " . toba_js::arreglo($this->tablas) . ";\n\t\t\tvar reutilizadas = new Array();\n\t\t\tfor ( id_fila in tablas ) {\n\t\t\t\tif( in_array(tablas[id_fila], tablas_utilizadas) ) {\n\t\t\t\t\treutilizadas.push( tablas[id_fila] );\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t// Notificacion y validacion\n\t\t\tvar ok = true;\n\t\t\tif( repetidas.length > 0 ) {\n\t\t\t\tnotificacion.agregar('No es posible repetir GATILLOS dentro de una dimension. (' + repetidas.join(', ')  + ')' );\n\t\t\t\tok = false;\n\t\t\t}\n\t\t\tif( reutilizadas.length > 0 ) {\n\t\t\t\tnotificacion.agregar('Existen gatillos que ya fueron utilizados como GATILLOS {$this->contexto_opuesto}. (' + reutilizadas.join(', ') + ')' );\n\t\t\t\tok = false;\n\t\t\t}\n\t\t\treturn ok;\n\t\t}\n\t\t";
 }
Ejemplo n.º 14
0
 /**
  * Retorna el codigo necesario para crear un evento en js
  *
  * @param string $id Id. del evento
  * @param string $evento Datos del evento, en forma de arreglo
  */
 static function evento($id, $evento, $parametros = null, $es_implicito = false)
 {
     $js_confirm = isset($evento['confirmacion']) ? "'{$evento['confirmacion']}'" : "''";
     $js_validar = isset($evento['maneja_datos']) ? toba_js::bool($evento['maneja_datos']) : "true";
     if (is_array($parametros)) {
         $param = ", " . toba_js::arreglo($parametros, true);
     } else {
         $param = isset($parametros) ? ", '" . addslashes(str_replace('"', "'", $parametros)) . "'" : '';
     }
     $implicito = '';
     if ($es_implicito) {
         $implicito = $param == '' ? ",''" : '';
         $implicito .= ', ' . toba_js::bool(true);
     }
     return "new evento_ei('{$id}', {$js_validar}, {$js_confirm} {$param} {$implicito})";
 }
Ejemplo n.º 15
0
 protected function parametros_js()
 {
     $imgs = array();
     $imgs[] = toba_recurso::imagen_toba('nucleo/paginacion/no_siguiente.gif', false);
     $imgs[] = toba_recurso::imagen_toba('nucleo/paginacion/si_siguiente.gif', false);
     $imgs[] = toba_recurso::imagen_toba('nucleo/paginacion/no_anterior.gif', false);
     $imgs[] = toba_recurso::imagen_toba('nucleo/paginacion/si_anterior.gif', false);
     $claves = array();
     foreach (array_keys($this->opciones) as $clave) {
         $claves[] = texto_plano($clave);
     }
     $orden_opciones = toba_js::arreglo($claves);
     return parent::parametros_js() . "," . toba_js::arreglo($imgs, false) . ', ' . $orden_opciones;
 }
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
 /**
  * @ignore 
  */
 protected function crear_objeto_js()
 {
     $id = toba_js::arreglo($this->_id, false);
     $identado = toba_js::instancia()->identado();
     $ajax = toba_js::bool($this->_navegacion_ajax);
     //Crea le objeto CI
     echo $identado . "window.{$this->objeto_js} = new ci({$id}, '{$this->objeto_js}', '{$this->_nombre_formulario}', '{$this->_submit}', '{$this->_id_en_controlador}', {$ajax});\n";
     //Agrega la lista de pantallas con las que trabaja el ci
     toba_js::instancia()->identar(1);
     if ($this->_info_ci['tipo_navegacion'] == self::NAVEGACION_TAB_HORIZONTAL || $this->_info_ci['tipo_navegacion'] == self::NAVEGACION_TAB_VERTICAL) {
         $pantallas_activas = array();
         foreach ($this->_lista_tabs as $id => $tab) {
             $pantallas_activas[$id] = $tab->esta_activado();
         }
         echo $identado . "window.{$this->objeto_js}.agregar_pantallas(" . toba_js::arreglo($pantallas_activas, true) . "); \n";
     }
     //Crea los objetos hijos
     $objetos = array();
     foreach ($this->_dependencias as $id => $dep) {
         $objetos[$id] = $dep->generar_js();
     }
     $identado = toba_js::instancia()->identar(-1);
     //Agrega a los objetos hijos
     //ATENCION: Esto no permite tener el mismo formulario instanciado dos veces
     echo "\n";
     foreach ($objetos as $id => $objeto) {
         echo $identado . "window.{$this->objeto_js}.agregar_objeto({$objeto}, '{$id}');\n";
     }
 }
Ejemplo n.º 20
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.º 21
0
 protected function get_invocacion_js_eventos_multiples($evt_multiples, $id_fila, $objeto_js)
 {
     $js = '';
     if ($this->_cuadro->hay_eventos_multiples()) {
         $lista_eventos_js = toba_js::arreglo($evt_multiples);
         $js = "onclick=\"{$objeto_js}.seleccionar('{$id_fila}', {$lista_eventos_js});\" ";
     }
     return $js;
 }
Ejemplo n.º 22
0
 /**
  * Genera el HTML que posibilita cambiar entre procesos
  * @ventana
  */
 protected function cambio_proyecto()
 {
     $proyectos = toba::instancia()->get_proyectos_accesibles();
     $actual = toba::proyecto()->get_id();
     if (count($proyectos) > 1) {
         //-- Si hay al menos dos proyectos
         echo '<div class="enc-cambio-proy">';
         echo '<a href="#" title="Ir a la inicio" onclick="vinculador.ir_a_proyecto(\'' . $actual . '\');">' . toba_recurso::imagen_toba("home.png", true) . '</a>';
         $datos = rs_convertir_asociativo($proyectos, array(0), 1);
         echo toba_form::select(apex_sesion_qs_cambio_proyecto, $actual, $datos, 'ef-combo', 'onchange="vinculador.ir_a_proyecto(this.value)"');
         echo toba_js::abrir();
         echo 'var url_proyectos = ' . toba_js::arreglo(toba::instancia()->get_url_proyectos(array_keys($datos)), true);
         echo toba_js::cerrar();
         echo '</div>';
     }
 }