[eb3e2b8] | 1 | <?php |
---|
| 2 | //importando nuestras las referencias XAJAX |
---|
| 3 | require ("xajax.common.php"); |
---|
| 4 | |
---|
| 5 | |
---|
[81f4945] | 6 | //función que lista las Particiones segun la IP elegida |
---|
| 7 | function ListarOrigenMaster($ip){ |
---|
[eb3e2b8] | 8 | |
---|
[81f4945] | 9 | include_once("../includes/ctrlacc.php"); |
---|
| 10 | include_once("../clases/AdoPhp.php"); |
---|
| 11 | include_once("../includes/constantes.php"); |
---|
| 12 | include_once("../includes/comunes.php"); |
---|
| 13 | include_once("../includes/CreaComando.php"); |
---|
| 14 | include_once("../includes/HTMLSELECT.php"); |
---|
[eb3e2b8] | 15 | |
---|
| 16 | |
---|
[81f4945] | 17 | //instanciamos el objeto para la respuesta AJAX |
---|
| 18 | $objResponse = new xajaxResponse(); |
---|
[eb3e2b8] | 19 | |
---|
[81f4945] | 20 | $SelectHtml=" "; |
---|
[eb9424f] | 21 | $SelectHtml='<select name="source"> '; |
---|
| 22 | |
---|
[81f4945] | 23 | $cmd=CreaComando($cadenaconexion); |
---|
[eb9424f] | 24 | $rs=new Recordset; |
---|
| 25 | |
---|
| 26 | //Primera consulta: Particiones del MASTER potencialmente clonables. |
---|
[81f4945] | 27 | $cmd->texto='SELECT ordenadores_particiones.numpar as PART,nombresos.nombreso as OS |
---|
[eb3e2b8] | 28 | FROM ordenadores_particiones INNER JOIN tipospar ON tipospar.codpar=ordenadores_particiones.codpar |
---|
| 29 | INNER JOIN nombresos ON ordenadores_particiones.idnombreso=nombresos.idnombreso |
---|
| 30 | INNER JOIN ordenadores ON ordenadores_particiones.idordenador=ordenadores.idordenador |
---|
| 31 | WHERE ordenadores.ip="' .$ip . '" |
---|
| 32 | AND tipospar.clonable>0 |
---|
| 33 | AND ordenadores_particiones.idnombreso>0 |
---|
| 34 | ORDER BY ordenadores_particiones.numpar'; |
---|
[eb9424f] | 35 | |
---|
[81f4945] | 36 | $rs->Comando=&$cmd; |
---|
[eb9424f] | 37 | |
---|
[81f4945] | 38 | if ($rs->Abrir()){ |
---|
| 39 | $cantRegistros=$rs->numeroderegistros; |
---|
| 40 | if($cantRegistros>0){ |
---|
[eb9424f] | 41 | $rs->Primero(); |
---|
[81f4945] | 42 | while (!$rs->EOF){ |
---|
[eb9424f] | 43 | $SelectHtml.='<OPTION value=" 1 '.$rs->campos["PART"].'"'; |
---|
[81f4945] | 44 | $SelectHtml.='>'; |
---|
[eb9424f] | 45 | $SelectHtml.='PART: '. $rs->campos["OS"].'</OPTION>'; |
---|
[81f4945] | 46 | $rs->Siguiente(); |
---|
| 47 | } |
---|
[eb3e2b8] | 48 | } |
---|
[81f4945] | 49 | else |
---|
[eb9424f] | 50 | { |
---|
[230e577] | 51 | $objResponse->alert("No partion found in this host for use it to cloning other computers."); |
---|
[81f4945] | 52 | } |
---|
| 53 | $rs->Cerrar(); |
---|
| 54 | } |
---|
[eb9424f] | 55 | |
---|
| 56 | //Segunda consulta: Imagenes del MASTER registradas como si fuese un repo. |
---|
| 57 | $cmd->texto='SELECT *,repositorios.ip as iprepositorio FROM imagenes |
---|
| 58 | INNER JOIN repositorios ON repositorios.idrepositorio=imagenes.idrepositorio |
---|
| 59 | where repositorios.ip="' .$ip .'"'; |
---|
| 60 | |
---|
| 61 | $rs->Comando=&$cmd; |
---|
| 62 | |
---|
| 63 | if ($rs->Abrir()){ |
---|
| 64 | $cantRegistros=$rs->numeroderegistros; |
---|
| 65 | if($cantRegistros>0){ |
---|
| 66 | $rs->Primero(); |
---|
| 67 | while (!$rs->EOF){ |
---|
| 68 | $SelectHtml.='<OPTION value=" CACHE /'.$rs->campos["nombreca"].'"'; |
---|
| 69 | $SelectHtml.='>'; |
---|
| 70 | $SelectHtml.='IMG-CACHE: ' . $rs->campos["nombreca"].'</OPTION>'; |
---|
| 71 | $rs->Siguiente(); |
---|
| 72 | } |
---|
| 73 | } |
---|
| 74 | else |
---|
| 75 | { |
---|
[230e577] | 76 | $objResponse->alert("No image found in CACHE in this host for use it to cloning other compuers."); |
---|
[eb9424f] | 77 | } |
---|
| 78 | $rs->Cerrar(); |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | //Tercera consulta: Imagenes del REPO, que el MASTER se encargara de enivarlas |
---|
| 82 | $cmd->texto='SELECT *,repositorios.ip as iprepositorio FROM imagenes |
---|
| 83 | INNER JOIN repositorios ON repositorios.idrepositorio=imagenes.idrepositorio |
---|
| 84 | where repositorios.idrepositorio=(select idrepositorio from ordenadores where ordenadores.ip="' .$ip .'")'; |
---|
| 85 | |
---|
| 86 | |
---|
| 87 | $rs->Comando=&$cmd; |
---|
| 88 | |
---|
| 89 | if ($rs->Abrir()){ |
---|
| 90 | $cantRegistros=$rs->numeroderegistros; |
---|
| 91 | if($cantRegistros>0){ |
---|
| 92 | $rs->Primero(); |
---|
| 93 | while (!$rs->EOF){ |
---|
| 94 | $SelectHtml.='<OPTION value=" REPO /'.$rs->campos["nombreca"].'"'; |
---|
| 95 | $SelectHtml.='>'; |
---|
| 96 | $SelectHtml.='IMG-REPO: ' . $rs->campos["nombreca"].'</OPTION>'; |
---|
| 97 | $rs->Siguiente(); |
---|
| 98 | } |
---|
| 99 | } |
---|
| 100 | else |
---|
| 101 | { |
---|
[230e577] | 102 | $objResponse->alert("No image found in REPO from this host for use it to cloning other computers."); |
---|
[eb9424f] | 103 | } |
---|
| 104 | $rs->Cerrar(); |
---|
| 105 | } |
---|
| 106 | |
---|
[81f4945] | 107 | $SelectHtml.= '</SELECT>'; |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | //asignando el contenido de la varabiale $SelectHTML al div que esta en la paquina inicial |
---|
| 111 | $objResponse->assign("divListado","innerHTML",$SelectHtml); |
---|
| 112 | |
---|
| 113 | |
---|
[eb3e2b8] | 114 | return $objResponse; //retornamos la respuesta AJAX |
---|
| 115 | } |
---|
| 116 | |
---|
[81f4945] | 117 | $xajax->processRequest(); //procesando cualquier petición AJAX |
---|
| 118 | |
---|
| 119 | |
---|
| 120 | |
---|
| 121 | |
---|
[eb3e2b8] | 122 | ?> |
---|