source: admin/WebConsole/asistentes/jscripts/asistentes.js @ 3f73876

918-git-images-111dconfigfileconfigure-oglivegit-imageslgromero-new-oglivemainmaint-cronmount-efivarfsmultivmmultivm-ogboot-installerogClonningEngineogboot-installer-jenkinsoglive-ipv6test-python-scriptsticket-301ticket-50ticket-50-oldticket-577ticket-585ticket-611ticket-612ticket-693ticket-700ubu24tplunification2use-local-agent-oglivevarios-instalacionwebconsole3
Last change on this file since 3f73876 was 09da038, checked in by ramon <ramongomez@…>, 14 years ago

Versión 1.0.2: asistente particionado pone a nula la definición de la partición 4 cuando no se activa la caché (modifica #341)

git-svn-id: https://opengnsys.es/svn/branches/version1.0@2336 a21b9725-9963-47de-94b9-378ad31fedc9

  • Property mode set to 100644
File size: 7.4 KB
Line 
1// ***********************************************************************************************************
2// Libreria de scripts de Javascript
3// Autor:
4// Fecha Creación: 2011
5// Fecha Última modificación: enero-2011
6// Nombre del fichero: asistentes.js
7// Descripción :
8//              Este fichero implementa las funciones javascript del fichero AsistentesEjecutarScripts.php (Comandos)
9// ***********************************************************************************************************
10
11function codeCloneRemotePartition(form){
12switch (form.idmetodo.value)
13{
14        case "MULTICAST":
15                protocol="MULTICAST " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " ";
16                break;
17        case "UNICAST":
18                protocol="UNICAST " +  form.ucastport.value + ":" + form.ucastclient.value + " ";
19                break;
20}
21//form.codigo.value="cloneRemoteFromMaster " + form.ipMaster.value + " 1 " + form.PartOrigen.value + "  " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " 1 " + form.PartOrigen.value + " " + form.tool.value + " " + form.compresor.value;
22form.codigo.value="cloneRemoteFromMaster " + form.ipMaster.value + " " + form.source.value + "  " + protocol  + " " + form.targetpart.value + " " + form.tool.value + " " + form.compresor.value;
23
24}
25
26function codeDeployImage(form){
27switch (form.idmetodo.value)
28{
29        case "MULTICAST":
30                protocol="MULTICAST " + form.mcastpuerto.value  + ":" + form.mcastmodo.value + ":" + form.mcastdireccion.value + ":" + form.mcastvelocidad.value + "M:" + form.mcastnclien.value + ":" + form.mcastseg.value + " ";
31                break;
32        case "TORRENT":
33                protocol=" TORRENT " +  form.modp2p.value + ":" + form.timep2p.value;
34                break;
35        case "UNICAST":
36                protocol=" UNICAST";
37                break;
38}
39//form.codigo.value="deployImage REPO /";
40if (form.modo[0].checked)
41{
42        form.codigo.value="deployImage REPO /" + form.idimagen.value + " 1 " + form.idparticion.value + " " + protocol  ;
43}
44else
45{
46        form.codigo.value="updateCache REPO /" + form.idimagen.value + ".img" + " " + protocol  ;
47}
48
49}
50
51function codeParticionado (form) {
52        var partCode="";
53        var logicalCode="";
54        var cacheCode;
55        var cacheSize;
56        var extended=false;
57
58        for (var nPart=1; nPart<4; nPart++) {
59                var partCheck=eval("form.check"+nPart);
60                if (partCheck.checked) {
61                        var partType=eval("form.part"+nPart);
62                        if (partType.value == "CUSTOM" ) {
63                                var partTypeCustom=eval("form.part"+nPart+"custom");
64                                partCode += " " + partTypeCustom.value;
65                                if (partTypeCustom.value == "EXTENDED") {
66                                        extended=true;
67                                }
68                        } else {
69                                partCode += " " + partType.value;
70                                if (partType.value == "EXTENDED") {
71                                        extended=true;
72                                }
73                        }
74                        var partSize=eval("form.size"+nPart);
75                        if (partSize.value == "CUSTOM" ) {
76                                var partSizeCustom=eval("form.size"+nPart+"custom");
77                                partCode += ":" + partSizeCustom.value;
78                        } else {
79                                partCode += ":" + partSize.value;
80                        }
81                } else {
82                        partCode += " EMPTY:0";
83                }
84        }
85        if (form.check4.checked) {
86                if (form.size4.value == "0") {
87                        cacheCode = " ogUnmountCache \n ogUnmountAll 1 \n sizecache=`ogGetPartitionSize 1 4` \n ogDeletePartitionTable 1 \n ogUpdatePartitionTable 1 \n initCache $sizecache ";
88                } else {
89                        if (form.size4.value == "CUSTOM") {
90                                cacheSize = form.size4custom.value;
91                        } else {
92                                cacheSize = form.size4.value;
93                        }
94                        cacheCode = " ogUnmountCache \n ogUnmountAll 1 \n ogDeletePartitionTable 1 \n ogUpdatePartitionTable 1 \n initCache " + cacheSize;
95                }
96        } else {
97                cacheCode = " ogUnmountCache \n ogUnmountAll 1 \n ogDeletePartitionTable 1 \n ogUpdatePartitionTable 1 ";
98                partCode += " EMPTY:0";
99        }
100        if (extended) {
101                var lastLogical=5;
102                for (var nPart=9; nPart>5; nPart--) {
103                        if (eval ("form.check"+nPart+".checked")) {
104                                lastLogical = nPart;
105                                break;
106                        }
107                }
108                for (var nPart=5; nPart<=lastLogical; nPart++) {
109                        var partCheck=eval("form.check"+nPart);
110                        if (partCheck.checked) {
111                                var partType=eval("form.part"+nPart);
112                                if (partType.value == "CUSTOM" ) {
113                                        var partTypeCustom=eval("form.part"+nPart+"custom");
114                                        logicalCode += " " + partTypeCustom.value;
115                                } else {
116                                        logicalCode += " " + partType.value;
117                                }
118                                var partSize=eval("form.size"+nPart);
119                                if (partSize.value == "CUSTOM" ) {
120                                        var partSizeCustom=eval("form.size"+nPart+"custom");
121                                        logicalCode += ":" + partSizeCustom.value;
122                                } else {
123                                        logicalCode += ":" + partSize.value;
124                                }
125                        } else {
126                                logicalCode += " EMPTY:0";
127                        }
128                }
129                partCode += logicalCode;
130        }
131
132        form.codigo.value="\
133" + cacheCode + " \n \
134ogListPartitions 1 \n \
135ogCreatePartitions 1 " + partCode + " \n \
136ogSetPartitionActive 1 1 \n \
137ogUpdatePartitionTable 1 \n \
138ogListPartitions 1 \n";
139}
140
141
142// Código de pulsación de selección de partición.
143function clickPartitionCheckbox(form, npart) {
144        var partCheck=eval("form.check"+npart);
145        var partType=eval("form.part"+npart);
146        var partSize=eval("form.size"+npart);
147        var partTypeCustom=eval("form.part"+npart+"custom");
148        var partSizeCustom=eval("form.size"+npart+"custom");
149        var freeDisk=document.getElementById("freedisk");
150        var logical=document.getElementById("logicas");
151        if (partCheck.checked) {
152                partType.disabled=false;
153                partSize.disabled=false;
154                if (partType.options[partType.selectedIndex].value == "CUSTOM") {
155                        partTypeCustom.disabled=false;
156                }
157                if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
158                        partSizeCustom.disabled=false;
159                } else {
160                        partSizeCustom.disabled=true;
161                }
162        } else {
163                partType.disabled=true;
164                partSize.disabled=true;
165                partTypeCustom.disabled=true;
166                partSizeCustom.disabled=true;
167        }
168        if (npart <= 4) {
169                checkExtendedPartition(form);
170                calculateFreeDisk(form);
171        }
172}
173
174
175// Código para calcular el espacio libre del disco.
176function calculateFreeDisk(form) {
177        var freeDisk=document.getElementById("freedisk");
178        freeDisk.value=form.minsize.value;
179        for (npart=1; npart<=4; npart++) {
180                var partCheck=eval("form.check"+npart);
181                var partSize=eval("form.size"+npart);
182                var partSizeCustom=eval("form.size"+npart+"custom");
183                if (partCheck.checked) {
184                        if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
185                                freeDisk.value -= parseInt(partSizeCustom.value);
186                        } else {
187                                freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
188                        }
189                }
190        }
191        if (parseInt(freeDisk.value) < 0) {
192                freeDisk.style.fontWeight = "bold";
193                freeDisk.style.fontStyle = "italic";
194        } else {
195                freeDisk.style.fontWeight = "normal";
196                freeDisk.style.fontStyle = "normal";
197        }
198        if (form.size4.value == 0) {
199                freeDisk.value += " (- cache)";         // Aviso de caché sin modificar.
200        }
201}
202
203// Código para comprobar si hay partición extendida activa para mostrar las lógicas.
204function checkExtendedPartition(form) {
205        var logical=document.getElementById("logicas");
206        var visible=false;
207        for (npart=1; npart<4; npart++) {
208                var partCheck=eval("form.check"+npart);
209                var partType=eval("form.part"+npart);
210                var partTypeCustom=eval("form.part"+npart+"custom");
211                if (partCheck.checked) {
212                        partType.style.fontWeight = "normal";
213                        partTypeCustom.style.fontWeight = "normal";
214                        if (partType.value == "EXTENDED") {
215                                visible=true;
216                                partType.style.fontWeight = "bold";
217                        }
218                        if (partType.value == "CUSTOM" && partTypeCustom.value == "EXTENDED") {
219                                visible=true;
220                                partTypeCustom.style.fontWeight = "bold";
221                        }
222                }
223        }
224        if (visible) {
225                logical.style.visibility="visible";
226        } else {
227                logical.style.visibility="hidden";
228        }
229}
230
Note: See TracBrowser for help on using the repository browser.