| 1 | // ************************************************************************************************************************************************* |
|---|
| 2 | // Libreria de scripts de Javascript |
|---|
| 3 | // Autor: Alberto García Padilla (Universidad de Málaga) |
|---|
| 4 | // Fecha Creación: 2012 |
|---|
| 5 | // Fecha Última modificación: Mayo-2012 |
|---|
| 6 | // Nombre del fichero: boot_grub4dos.js |
|---|
| 7 | // Descripción : |
|---|
| 8 | // Este fichero implementa las funciones javascript del fichero boot_grub4dos.php |
|---|
| 9 | // ************************************************************************************************************************************************* |
|---|
| 10 | //________________________________________________________________________________________________________ |
|---|
| 11 | // Se utiliza en los botones in y out de las columnas |
|---|
| 12 | // Permite mover los equipos seleccionados desde una columna a otra |
|---|
| 13 | function move(fbox, tbox) { |
|---|
| 14 | var arrFbox = new Array(); |
|---|
| 15 | var arrTbox = new Array(); |
|---|
| 16 | var arrLookup = new Array(); |
|---|
| 17 | var i; |
|---|
| 18 | for (i = 0; i < tbox.options.length; i++) { |
|---|
| 19 | arrLookup[tbox.options[i].text] = tbox.options[i].value; |
|---|
| 20 | arrTbox[i] = tbox.options[i].text; |
|---|
| 21 | } |
|---|
| 22 | var fLength = 0; |
|---|
| 23 | var tLength = arrTbox.length; |
|---|
| 24 | for(i = 0; i < fbox.options.length; i++) { |
|---|
| 25 | arrLookup[fbox.options[i].text] = fbox.options[i].value; |
|---|
| 26 | if (fbox.options[i].selected && fbox.options[i].value != "") { |
|---|
| 27 | arrTbox[tLength] = fbox.options[i].text; |
|---|
| 28 | tLength++; |
|---|
| 29 | } |
|---|
| 30 | else { |
|---|
| 31 | arrFbox[fLength] = fbox.options[i].text; |
|---|
| 32 | fLength++; |
|---|
| 33 | } |
|---|
| 34 | } |
|---|
| 35 | arrFbox.sort(); |
|---|
| 36 | arrTbox.sort(); |
|---|
| 37 | fbox.length = 0; |
|---|
| 38 | tbox.length = 0; |
|---|
| 39 | var c; |
|---|
| 40 | |
|---|
| 41 | for(c = 0; c < arrFbox.length; c++) { |
|---|
| 42 | var no = new Option(); |
|---|
| 43 | no.value = arrLookup[arrFbox[c]]; |
|---|
| 44 | no.text = arrFbox[c]; |
|---|
| 45 | fbox[c] = no; |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | for(c = 0; c < arrTbox.length; c++) { |
|---|
| 49 | var no = new Option(); |
|---|
| 50 | no.value = arrLookup[arrTbox[c]]; |
|---|
| 51 | no.text = arrTbox[c]; |
|---|
| 52 | tbox[c] = no; |
|---|
| 53 | } |
|---|
| 54 | } |
|---|
| 55 | // Se utiliza al enviar el formulario |
|---|
| 56 | // Asigna como valor del campo listOfItems un listado |
|---|
| 57 | // con las correspodendencias nombre plantilla - nombre equipo. |
|---|
| 58 | // Version 1.1.1 - Se identifica plantilla y equipo como necesita el script setclienmode (#802) |
|---|
| 59 | function allSelect() |
|---|
| 60 | { |
|---|
| 61 | var saveString = ""; |
|---|
| 62 | // seleccionamos cada uno de los select |
|---|
| 63 | var input = document.getElementsByTagName('select'); |
|---|
| 64 | |
|---|
| 65 | for(var i=0; i<input.length; i++){ |
|---|
| 66 | label = input[i].parentNode.id; |
|---|
| 67 | // La plantilla 00unknown no existe, no se incluye en el listado |
|---|
| 68 | if (label === "00unknown") continue; |
|---|
| 69 | |
|---|
| 70 | for (j=0;j<input[i].length;j++) |
|---|
| 71 | { |
|---|
| 72 | saveString = saveString + label + '|' + input[i].options[j].text + ';'; |
|---|
| 73 | } |
|---|
| 74 | } |
|---|
| 75 | document.forms[0].listOfItems.value = saveString; |
|---|
| 76 | } |
|---|