5
/** Manda los encabezados correctos para una aplicación XUL
7
header('Content-type: application/vnd.mozilla.xul+xml');
8
echo '<?xml version="1.0"?>
9
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>';
13
echo '<html:link type="text/css" href="alianza.css" rel="stylesheet" />';
15
function encabezado($titulo)
20
title="'.$titulo.'Find Files"
22
xmlns:html="http://www.w3.org/1999/xhtml"
23
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">';
24
echo "<html:h1>$titulo</html:h1>";
26
function encabezadoMenu($texto)
28
echo "<html:h2>$texto</html:h2>";
30
function imagenMenu($imagen,$enlace,$texto)
33
<html:a href="'.$enlace.'">
34
<html:img src="../images/'.$imagen.'" width="64" height="64" align="top" border="0" />
38
function encabezadoImagen($titulo,$imagen)
43
<html:img src="../images/'.$imagen.'" border="0" />'.$titulo.
46
function encabezadoFecha($titulo)
50
echo '<html:style type="text/css">@import url(../js/calendar-win2k-1.css);</html:style>';
51
echo '<script type="text/javascript" src="../js/calendar.js"></script>';
52
echo '<script type="text/javascript" src="../js/lang/calendar-es.js"></script>';
53
echo '<script type="text/javascript" src="../js/calendar-setup.js"></script>';
60
<html:span class="nota">'.$texto.'</html:span>
65
function pie($texto,$enlace){
69
<html:a href="'.$enlace.'">'.$texto .'</html:a>
76
echo '<html:input type="submit" value="Aceptar" />';
78
function moneda($numero)
80
$moneda = number_format($numero, 2);
81
$moneda = '$' . $moneda;
84
function mysqlAFecha($fecha)
86
ereg( "([0-9]{2,4})-([0-9]{1,2})-([0-9]{1,2})", $fecha, $mifecha);
87
$lafecha=$mifecha[3]."/".$mifecha[2]."/".$mifecha[1];
90
function fechaAMysql($fecha)
92
ereg( "([0-9]{1,2})/([0-9]{1,2})/([0-9]{2,4})", $fecha, $mifecha);
93
$lafecha=$mifecha[3]."-".$mifecha[2]."-".$mifecha[1];
96
function duplicado($pagina)
99
nota('Ya existe un dato igual al que usted intenta agregar.
100
Verifique el dato e inténtelo nuevamente');
101
boton('Volver',$pagina);
103
function confirmarBorrar($id,$pagina)
105
encabezado('Confirmar eliminación de registro');
106
nota('¿Esta seguro que desea eliminar este registro?');
107
echo '<html:form action="'.$pagina.'?accion=eliminar" method="post">';
108
echo '<html:input type="hidden" name="id" value="'. $id.'">';
109
echo '<html:input type="submit" value="Confirmar">';
111
boton('Volver',$pagina);
113
function borrar($bdd,$id,$pagina)
115
$sql = 'DELETE from ' . $bdd . ' WHERE id = "' . $id . '"';
116
$result = mysql_query($sql) or die('Error: ' . mysql_error());
119
function celda($texto)
121
echo '<treecell label="'.$texto.'" />';
123
function lineaMoneda($texto)
125
echo '<html:td align="right">'.moneda($texto).'</html:td>';
127
function lineaNumero($texto)
129
echo '<html:td align="right">'.number_format($texto,2,'.','').'</html:td>';
131
function noAutorizado()
134
encabezado('Acceso no autorizado');
135
nota('Usted no se encuentra autorizado para ver esta página');
136
boton('Volver','alianza.py');
139
function scriptFecha()
141
echo '<script type="text/javascript">
143
inputField : "f_date_b", //*
144
ifFormat : "%d/%m/%Y",
146
button : "f_trigger_b", //*
151
function scriptNoenter()
153
echo '<script type="text/javascript">
154
function stopRKey(evt) {
155
var evt = (evt) ? evt : ((event) ? event : null);
156
var node = (evt.target) ? evt.target : ((evt.srcElement) ? evt.srcElement : null);
157
if ((evt.keyCode == 13) && (node.type=="text")) {return false;}
159
document.onkeypress = stopRKey;
162
function inputFecha($texto,$campo,$valor)
165
<html:td>'.$texto.'</html:td>
167
<html:input type="text" name="'.$campo.'" id="f_date_b" value="'.mysql_a_fecha($valor).'"/>
168
<html:button type="reset" id="f_trigger_b">...</html:button>
172
function inputTexto($texto,$campo,$valor)
175
<html:td>'.$texto.'</html:td>
177
<html:input type="text" name="'.$campo.'" value="'.$valor.'" />
181
function inputNumero($texto,$campo,$valor)
184
<html:td>'.$texto.'</html:td>
186
<html:input type="text" name="'.$campo.'" value="'.number_format($valor,2,'.','').'" />
190
function inputMemo($texto,$campo,$valor)
193
<html:td>'.$texto.'</html:td>
195
<html:textarea name="'.$campo.'" rows="10" cols="50">'.$valor.'</html:textarea>
199
function formulario($accion)
201
echo '<html:form action="'.$accion.'" method="POST">';
204
echo '</treechildren></tree>';
206
function inputCombo($texto,$campo,$resultado,$valor)
208
echo '<html:tr><html:td>'.$texto.'</html:td>';
209
echo '<html:td><html:select name="'.$campo.'">';
210
for($i=0; $i < mysql_num_rows($resultado); $i++){
211
$fil = mysql_fetch_row($resultado);
212
echo '<html:option value="' . $fil[0] .'"';
214
echo 'selected="selected"';
216
echo '>'.$fil[1].'</html:option>';
218
echo '</html:select></html:td></html:tr>';
220
function boton($texto,$accion){
221
echo '<button label="'.$texto.'" onclick="window.location='."'".$accion."'".';"
224
function mboton($texto,$accion)
226
echo '<html:button class="menubutton" onClick=parent.location="'.$accion.'">'.$texto.'</html:button>';
228
function tboton($texto,$accion)
231
<html:button class="cssbutton" onClick=parent.location="'.$accion.'">'.$texto.'</html:button>
238
function imagen($imagen)
240
echo '<html:img src="../images/'.$imagen.'" width="64" height="64" border="0" />';
242
function imagenEnlace($imagen,$enlace){
243
echo '<html:a href="'.$enlace.'">
244
<html:img src="../images/'.$imagen.'" border="0" />
247
function encabezadoTabla($arr){
248
echo '<tree flex="1">
251
echo '<treecol id="'.$a.'" label="'.$a.'" flex="1"/>';
253
echo '</treecols><treechildren>';
255
function campoOculto($variable,$dato)
257
echo '<html:input type="hidden" name="'.$variable.'" value="'.$dato.'" />';
259
function finFormulario()
263
function inputCheck($texto,$variable,$valor)
265
echo '<html:tr><html:td>';
268
$adicional= "checked";
272
<html:input type="checkbox" name="'.$variable.'" value="1"'.$adicional.' />
273
</html:td></html:tr>';
276
function autorizacion($niv)
286
if ($_SESSION['auth']!='yes') {
287
redirigir("no_autorizado.html");
289
$sql = 'SELECT * FROM usuarios WHERE usuario="' . $_SESSION['logname'] . '"';
290
$res = mysql_query($sql);
292
header("location: no_autorizado.html");
294
$fil = mysql_fetch_row($res);
297
header("location: no_autorizado.html");
300
function session_started()
302
if(isset($_SESSION)){ return true; }else{ return false; }
304
function redirigir($url)
306
echo '<script type="text/javascript">
308
window.location = "' .$url.'"