source: admin/WebConsole/asistentes/jscripts/asistentes.js @ fea70bf

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 fea70bf was b41b30c, checked in by ramon <ramongomez@…>, 14 years ago

Versión 1.0.2: corregir pequeña errata al componer el código de particionado (modifica #434)

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

  • Property mode set to 100644
File size: 7.3 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.size4.value == "0") {
86                cacheCode = "ogUnmountCache \n ogUnmountAll 1 \n sizecache=`ogGetPartitionSize 1 4` \n ogDeletePartitionTable 1  \n ogUpdatePartitionTable 1 \n initCache $sizecache ";
87        } else {
88                if (form.size4.value == "CUSTOM") {
89                        cacheSize = form.size4custom.value;
90                } else {
91                        cacheSize = form.size4.value;
92                }
93                cacheCode = "ogUnmountCache \n ogUnmountAll 1 \n ogDeletePartitionTable 1 \n ogUpdatePartitionTable 1 \n initCache " + cacheSize;
94        }
95        if (extended) {
96                var lastLogical=5;
97                for (var nPart=9; nPart>5; nPart--) {
98                        if (eval ("form.check"+nPart+".checked")) {
99                                lastLogical = nPart;
100                                break;
101                        }
102                }
103                for (var nPart=5; nPart<=lastLogical; nPart++) {
104                        var partCheck=eval("form.check"+nPart);
105                        if (partCheck.checked) {
106                                var partType=eval("form.part"+nPart);
107                                if (partType.value == "CUSTOM" ) {
108                                        var partTypeCustom=eval("form.part"+nPart+"custom");
109                                        logicalCode += " " + partTypeCustom.value;
110                                } else {
111                                        logicalCode += " " + partType.value;
112                                }
113                                var partSize=eval("form.size"+nPart);
114                                if (partSize.value == "CUSTOM" ) {
115                                        var partSizeCustom=eval("form.size"+nPart+"custom");
116                                        logicalCode += ":" + partSizeCustom.value;
117                                } else {
118                                        logicalCode += ":" + partSize.value;
119                                }
120                        } else {
121                                logicalCode += " EMPTY:0";
122                        }
123                }
124                partCode += logicalCode;
125        }
126
127        form.codigo.value="\
128" + cacheCode + " \n \
129ogListPartitions 1 \n \
130ogCreatePartitions 1 " + partCode + " \n \
131ogSetPartitionActive 1 1 \n \
132ogUpdatePartitionTable 1 \n \
133ogListPartitions 1 \n";
134}
135
136
137// Código de pulsación de selección de partición.
138function clickPartitionCheckbox(form, npart) {
139        var partCheck=eval("form.check"+npart);
140        var partType=eval("form.part"+npart);
141        var partSize=eval("form.size"+npart);
142        var partTypeCustom=eval("form.part"+npart+"custom");
143        var partSizeCustom=eval("form.size"+npart+"custom");
144        var freeDisk=document.getElementById("freedisk");
145        var logical=document.getElementById("logicas");
146        if (partCheck.checked) {
147                partType.disabled=false;
148                partSize.disabled=false;
149                if (partType.options[partType.selectedIndex].value == "CUSTOM") {
150                        partTypeCustom.disabled=false;
151                }
152                if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
153                        partSizeCustom.disabled=false;
154                } else {
155                        partSizeCustom.disabled=true;
156                }
157        } else {
158                partType.disabled=true;
159                partSize.disabled=true;
160                partTypeCustom.disabled=true;
161                partSizeCustom.disabled=true;
162        }
163        if (npart <= 4) {
164                checkExtendedPartition(form);
165                calculateFreeDisk(form);
166        }
167}
168
169
170// Código para calcular el espacio libre del disco.
171function calculateFreeDisk(form) {
172        var freeDisk=document.getElementById("freedisk");
173        freeDisk.value=form.minsize.value;
174        for (npart=1; npart<=4; npart++) {
175                var partCheck=eval("form.check"+npart);
176                var partSize=eval("form.size"+npart);
177                var partSizeCustom=eval("form.size"+npart+"custom");
178                if (partCheck.checked) {
179                        if (partSize.options[partSize.selectedIndex].value == "CUSTOM") {
180                                freeDisk.value -= parseInt(partSizeCustom.value);
181                        } else {
182                                freeDisk.value -= parseInt(partSize.options[partSize.selectedIndex].value);
183                        }
184                }
185        }
186        if (parseInt(freeDisk.value) < 0) {
187                freeDisk.style.fontWeight = "bold";
188                freeDisk.style.fontStyle = "italic";
189        } else {
190                freeDisk.style.fontWeight = "normal";
191                freeDisk.style.fontStyle = "normal";
192        }
193        if (form.size4.value == 0) {
194                freeDisk.value += " (- cache)";         // Aviso de caché sin modificar.
195        }
196}
197
198// Código para comprobar si hay partición extendida activa para mostrar las lógicas.
199function checkExtendedPartition(form) {
200        var logical=document.getElementById("logicas");
201        var visible=false;
202        for (npart=1; npart<4; npart++) {
203                var partCheck=eval("form.check"+npart);
204                var partType=eval("form.part"+npart);
205                var partTypeCustom=eval("form.part"+npart+"custom");
206                if (partCheck.checked) {
207                        partType.style.fontWeight = "normal";
208                        partTypeCustom.style.fontWeight = "normal";
209                        if (partType.value == "EXTENDED") {
210                                visible=true;
211                                partType.style.fontWeight = "bold";
212                        }
213                        if (partType.value == "CUSTOM" && partTypeCustom.value == "EXTENDED") {
214                                visible=true;
215                                partTypeCustom.style.fontWeight = "bold";
216                        }
217                }
218        }
219        if (visible) {
220                logical.style.visibility="visible";
221        } else {
222                logical.style.visibility="hidden";
223        }
224}
225
Note: See TracBrowser for help on using the repository browser.