Exemple #1
0
 function test_tag_sin_desc()
 {
     $texto = "[test:Referencia/PaginaWiki]";
     $this->assertFalse(toba_parser_ayuda::es_texto_plano($texto));
     $salida = toba_parser_ayuda::parsear($texto, true);
     $esperado = "<test>Referencia/PaginaWiki</test>";
     $this->assertEqual($salida, $esperado);
 }
Exemple #2
0
 function barra_superior()
 {
     echo "<div id='barra-superior' class='barra-superior barra-superior-tit barra-popup'>\n";
     $info = toba::solicitud()->get_datos_item();
     echo "<div class='item-barra'>";
     if (trim($info['item_descripcion']) != '') {
         $desc = toba_parser_ayuda::parsear(trim($info['item_descripcion']));
         $ayuda = toba_recurso::ayuda(null, $desc, 'item-barra-ayuda', 0);
         echo "<div {$ayuda}>";
         echo toba_recurso::imagen_toba("ayuda_grande.gif", true);
         echo "</div>";
     }
     echo "<div class='item-barra-tit'>" . $this->titulo_item() . "</div>";
     echo "</div>\n\n";
 }
 protected function generar_ayuda()
 {
     $mensaje = toba::mensajes()->get_operacion_actual();
     if (isset($mensaje)) {
         if (strpos($mensaje, ' ') !== false) {
             //Detecta si es una url o un mensaje completo
             $desc = toba_parser_ayuda::parsear($mensaje);
             $ayuda = toba_recurso::ayuda(null, $desc, 'item-barra-ayuda', 0);
             echo "<div {$ayuda}>";
             echo toba_recurso::imagen_toba("ayuda_grande.gif", true);
             echo "</div>";
         } else {
             if (!toba_parser_ayuda::es_texto_plano($mensaje)) {
                 $mensaje = toba_parser_ayuda::parsear($mensaje, true);
                 //Version resumida
             }
             $js = "abrir_popup('ayuda', '{$mensaje}', {width: 800, height: 600, scrollbars: 1})";
             echo "<a class='barra-superior-ayuda' href='#' onclick=\"{$js}\" title='Abrir ayuda'>" . toba_recurso::imagen_toba("ayuda_grande.gif", true) . "</a>";
         }
     }
 }
Exemple #4
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();
     }
 }
Exemple #5
0
 /**
  * Retorna el html de la etiqueta de un ef especifico
  * @param string $ef Id. del ef
  * @param string $ancho_etiqueta Ancho de la etiqueta del ef. Si no se setea, usa la definida en el editor.
  * Recordar incluír las medidas (px, %, etc.). 
  */
 protected function get_etiqueta_ef($ef, $ancho_etiqueta = null)
 {
     $estilo = $this->_elemento_formulario[$ef]->get_estilo_etiqueta();
     $marca = '';
     if ($estilo == '') {
         if ($this->_elemento_formulario[$ef]->es_obligatorio()) {
             $estilo = 'ei-form-etiq-oblig';
             $marca = '(*)';
         } else {
             $estilo = 'ei-form-etiq';
         }
     }
     $desc = '';
     if (!isset($this->_info_formulario['expandir_descripcion']) || !$this->_info_formulario['expandir_descripcion']) {
         $desc = $this->_elemento_formulario[$ef]->get_descripcion();
         if ($desc != "") {
             $desc = toba_parser_ayuda::parsear($desc);
             $desc = toba_recurso::imagen_toba("descripcion.gif", true, null, null, $desc);
         }
     }
     $id_ef = $this->_elemento_formulario[$ef]->get_id_form();
     $editor = $this->generar_vinculo_editor($ef);
     $etiqueta = $this->_elemento_formulario[$ef]->get_etiqueta();
     //--- El _width es para evitar el 'bug de los 3px'  del IE
     $ancho = isset($ancho_etiqueta) ? $ancho_etiqueta : $this->_ancho_etiqueta;
     return "<label style='width:{$ancho};' for='{$id_ef}' class='{$estilo}'>{$editor} {$desc} {$etiqueta} {$marca}</label>\n";
 }
Exemple #6
0
 /**
  * Genera el grafico utilizando el comando graphviz y lo almacena en un archivo temporal
  *
  * @param string $contenido Grafico graphviz
  * @param string $formato Parametro -T del comando graphviz
  * @param boolean $es_dirigido
  * @return string Nombre del archivo temporal generado
  */
 static function generar_archivo($contenido, $formato, $es_dirigido = true)
 {
     $nombre_archivo = mt_rand() . '.' . $formato;
     $dir_temp = toba::instalacion()->get_path_temp();
     $grafico = toba_manejador_archivos::path_a_unix($dir_temp . "/" . mt_rand() . '.dot');
     $salida = toba_manejador_archivos::path_a_unix($dir_temp . "/" . $nombre_archivo);
     if (!file_put_contents($grafico, $contenido)) {
         toba::logger()->error("No se tiene permiso de escritura sobre el archivo {$grafico}");
     }
     $comando = $es_dirigido ? "dot" : "neato";
     $llamada = $comando . " -Gcharset=latin1 -T" . $formato . " -o{$salida} {$grafico}";
     //Se analiza la salida
     $salida = array();
     $status = 0;
     exec($llamada . " 2>&1 ", $salida, $status);
     if ($status !== 0) {
         $ayuda = toba_parser_ayuda::parsear("[wiki:Referencia/Objetos/ei_esquema esquema]");
         echo "Recuerde que para poder visualizar el {$ayuda} debe instalar\n\t\t\t\t\t<a href='http://www.graphviz.org/Download.php' target='_blank'>GraphViz</a> en el servidor.";
         echo "<pre>";
         echo implode("\n", $salida);
         echo "</pre>";
         toba::logger()->error(implode("\n", $salida));
     }
     //Se elimina el archivo .dot
     unlink($grafico);
     return $nombre_archivo;
 }
Exemple #7
0
 /**
  * @ignore
  */
 protected function mostrar_utilerias($nodo)
 {
     $salida = '';
     if ($nodo instanceof toba_nodo_arbol_form) {
         $id = $this->_submit . '_' . $nodo->get_id();
         $salida .= '<span style=\'float:right;\'>' . $nodo->get_input($id) . '</span>';
     }
     $utilerias = $nodo->get_utilerias();
     if ($this->_mostrar_utilerias && count($utilerias) > 0) {
         $plegados = '';
         $despl = '';
         $salida .= '<span style=\'float:right;\'>';
         $cant_plegados = 0;
         foreach ($utilerias as $utileria) {
             $ayuda = toba_parser_ayuda::parsear($utileria['ayuda']);
             $js = isset($utileria['javascript']) ? $utileria['javascript'] : '';
             $img = toba_recurso::imagen($utileria['imagen'], null, null, $ayuda, null, $js);
             if (isset($utileria['vinculo'])) {
                 $target = isset($utileria['target']) ? $utileria['target'] : $this->_frame_destino;
                 $html = "<a href=\"{$utileria['vinculo']}\" target='{$target}'>{$img}</a>\n";
             } else {
                 $html = $img;
             }
             if (isset($utileria['plegado']) && $utileria['plegado']) {
                 $cant_plegados++;
                 $plegados .= $html;
             } else {
                 $despl .= $html;
             }
         }
         if ($cant_plegados > 0) {
             $img = toba_recurso::imagen_toba('nucleo/expandir_izq.gif', true);
             $salida .= "<a href='#' style='padding-right:2px' onclick='toggle_nodo(this.nextSibling);return false'>{$img}</a>";
             $salida .= "<span style='display:none'>{$plegados}</span>";
         }
         $salida .= $despl;
         $salida .= '</span>';
     }
     return $salida;
 }
 function get_html_etiqueta()
 {
     $html = '';
     $marca = '';
     if ($this->_ef->es_obligatorio()) {
         $estilo = 'ei-filtro-etiq-oblig';
         $marca = '(*)';
     } else {
         $estilo = 'ei-filtro-etiq';
     }
     $desc = '';
     $desc = $this->_datos['descripcion'];
     if ($desc != "") {
         $desc = toba_parser_ayuda::parsear($desc);
         $desc = toba_recurso::imagen_toba("descripcion.gif", true, null, null, $desc);
     }
     $id_ef = $this->_ef->get_id_form();
     $editor = '';
     //$editor = $this->generar_vinculo_editor($ef);
     $etiqueta = $this->get_etiqueta();
     $html .= "<label for='{$id_ef}' class='{$estilo}'>{$editor} {$desc} {$etiqueta} {$marca}</label>\n";
     return $html;
 }
Exemple #9
0
 /**
  * Genera una descripcion HTML para informar la ocurrencia de algun evento
  * @ignore
  */
 protected function generar_html_descripcion($mensaje, $tipo = null)
 {
     if (!isset($tipo) || $tipo == 'info') {
         $imagen = toba_recurso::imagen_toba("info_chico.gif", true);
         $clase = 'ei-barra-sup-desc-info';
     } elseif ($tipo == 'warning') {
         $imagen = toba_recurso::imagen_toba("warning.gif", true);
         $clase = 'ei-barra-sup-desc-warning';
     } elseif ($tipo == 'error') {
         $imagen = toba_recurso::imagen_toba("error.gif", true);
         $clase = 'ei-barra-sup-desc-error';
     }
     $descripcion = toba_parser_ayuda::parsear($mensaje);
     echo "<table class='tabla-0 {$clase}'><tr><td class='ei-barra-sup-desc-img'>{$imagen}</td><td>{$descripcion}</td></table>\n";
 }
Exemple #10
0
 function get_string_iconos($iconos)
 {
     $salida = '';
     foreach ($iconos as $icono) {
         $ayuda = toba_parser_ayuda::parsear($icono['ayuda']);
         $img = toba_recurso::imagen($icono['imagen'], null, null, $ayuda);
         if (isset($icono['vinculo'])) {
             $salida .= "<a target='" . apex_frame_centro . "' href=\"" . $icono['vinculo'] . "\">{$img}</a>\n";
         } else {
             $salida .= $img . "\n";
         }
     }
     return $salida;
 }