| 1 | // ************************************************************************************************************************************************* | 
|---|
| 2 | // Libreria de scripts de Javascript | 
|---|
| 3 | // Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla | 
|---|
| 4 | // Fecha Creación: 2009-2010 | 
|---|
| 5 | // Fecha Última modificación: Noviembre-2005 | 
|---|
| 6 | // Nombre del fichero: L_Iconos.js | 
|---|
| 7 | // Descripción : | 
|---|
| 8 | //              Este fichero implementa las funciones javascript del fichero L_Iconos.php | 
|---|
| 9 | // ************************************************************************************************************************************************* | 
|---|
| 10 | // Opciones | 
|---|
| 11 | var Menu=0 | 
|---|
| 12 | var Insertar=1 | 
|---|
| 13 | var Eliminar=2 | 
|---|
| 14 | var Modificar=3 | 
|---|
| 15 | var Consultar=4 | 
|---|
| 16 |  | 
|---|
| 17 | // Acciones | 
|---|
| 18 | var Sin_accion=0 | 
|---|
| 19 | var Insertar_registro=1 | 
|---|
| 20 | var Borrar_registro=2 | 
|---|
| 21 | var Modificar_registro=3 | 
|---|
| 22 | var Leer_registro=4 | 
|---|
| 23 |  | 
|---|
| 24 | var currentImg=null; | 
|---|
| 25 |  | 
|---|
| 26 | var IE=(navigator.appName=="Microsoft Internet Explorer"); | 
|---|
| 27 | var NS=(navigator.appName=="Netscape"); | 
|---|
| 28 | //----------------------------------------------------------------------------------------------------- | 
|---|
| 29 | function consultar(){ | 
|---|
| 30 | reset_contextual(-1,-1); | 
|---|
| 31 | id=document.fdatos.identificador.value | 
|---|
| 32 | var whref | 
|---|
| 33 | whref="M_Iconos.php" | 
|---|
| 34 | whref=whref + "?opcion=" + Consultar | 
|---|
| 35 | whref=whref + "&accion=" + Leer_registro | 
|---|
| 36 | whref=whref + "&idicono=" + id | 
|---|
| 37 | window.open(whref,"frame_contenidos") | 
|---|
| 38 | } | 
|---|
| 39 | //----------------------------------------------------------------------------------------------------- | 
|---|
| 40 | function borrar(){ | 
|---|
| 41 | reset_contextual(-1,-1); | 
|---|
| 42 | id=document.fdatos.identificador.value | 
|---|
| 43 | var whref | 
|---|
| 44 | whref="M_Iconos.php" | 
|---|
| 45 | whref=whref + "?opcion=" + Eliminar | 
|---|
| 46 | whref=whref + "&accion=" + Leer_registro | 
|---|
| 47 | whref=whref + "&idicono=" + id | 
|---|
| 48 | window.open(whref,"frame_contenidos") | 
|---|
| 49 | } | 
|---|
| 50 | //----------------------------------------------------------------------------------------------------- | 
|---|
| 51 | function modificar(){ | 
|---|
| 52 | reset_contextual(-1,-1); | 
|---|
| 53 | id=document.fdatos.identificador.value | 
|---|
| 54 | var whref | 
|---|
| 55 | whref="M_Iconos.php" | 
|---|
| 56 | whref=whref + "?opcion=" + Modificar | 
|---|
| 57 | whref=whref + "&accion=" + Leer_registro | 
|---|
| 58 | whref=whref + "&idicono=" + id | 
|---|
| 59 | window.open(whref,"frame_contenidos") | 
|---|
| 60 | } | 
|---|
| 61 | //_____________________________________________________________________________________ | 
|---|
| 62 | // | 
|---|
| 63 | function menu_contextual(o){ | 
|---|
| 64 | document.fdatos.identificador.value=o.getAttribute("id") | 
|---|
| 65 | if (currentImg!=null) | 
|---|
| 66 | currentImg.src="../images/iconos/administrar_off.gif" | 
|---|
| 67 | o.src="../images/iconos/administrar_on.gif"; | 
|---|
| 68 | currentImg=o; | 
|---|
| 69 | var menuctx=document.getElementById("flo_menu"); | 
|---|
| 70 | muestra_contextual(ClickX,ClickY,menuctx); | 
|---|
| 71 | } | 
|---|
| 72 | //____________________________________________________________________________ | 
|---|
| 73 | // | 
|---|
| 74 | //      Se ejecuta cada vez que se hace click con el puntero del ratón. Se usa para desmarca | 
|---|
| 75 | //      cualquier item de menu contextual que estuviese activo | 
|---|
| 76 | //____________________________________________________________________________ | 
|---|
| 77 | function click_de_raton(e){ | 
|---|
| 78 | if(IE){ | 
|---|
| 79 | botonraton=event.button | 
|---|
| 80 | event.returnValue=true; | 
|---|
| 81 | } | 
|---|
| 82 | if(NS){ | 
|---|
| 83 | botonraton=e.which; | 
|---|
| 84 | e.returnValue=true; | 
|---|
| 85 | } | 
|---|
| 86 | } | 
|---|
| 87 | //____________________________________________________________________________ | 
|---|
| 88 | // | 
|---|
| 89 | //      Se ejecuta cada vez que se mueve el puntero del ratón. Se usa para capturar coordenadas | 
|---|
| 90 | //____________________________________________________________________________ | 
|---|
| 91 | function move_de_raton(e){ | 
|---|
| 92 | if(IE){ | 
|---|
| 93 | ClickX=event.clientX | 
|---|
| 94 | ClickY=event.clientY | 
|---|
| 95 | event.returnValue=true; | 
|---|
| 96 | } | 
|---|
| 97 | if(NS){ | 
|---|
| 98 | ClickX=e.clientX | 
|---|
| 99 | ClickY=e.clientY | 
|---|
| 100 | e.returnValue=true; | 
|---|
| 101 | } | 
|---|
| 102 | } | 
|---|
| 103 | //____________________________________________________________________________ | 
|---|
| 104 | // | 
|---|
| 105 | //      Redirecciona el evento onmousedown a la función de usuario especificada. | 
|---|
| 106 | //____________________________________________________________________________ | 
|---|
| 107 | document.onmousedown = click_de_raton; // Redefine el evento onmousedown | 
|---|
| 108 | document.onmousemove = move_de_raton; // Redefine el evento onmousedown | 
|---|
| 109 |  | 
|---|
| 110 |  | 
|---|
| 111 |  | 
|---|