-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCorruptPatchTest.htm
executable file
·449 lines (382 loc) · 14.6 KB
/
CorruptPatchTest.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<Title>Corrupt Patch Update Wizard TEST</Title>
<script type="text/javascript">
window.onscroll = function() {
var oPageContents = document.getElementById("contents");
oPageContents.style.top = document.body.scrollTop;
}
</script>"
</head>
<body>
<!-- TheDataStore is a special object that persists between pages. Use it to save user inputs between pages -->
<div id="TheDataStore" style="DISPLAY: none; LEFT: 0px; POSITION: absolute; TOP: 100%">
<!-- selected computer properites -->
<div id="FixletName"></div>
<div id="FixletID"></div>
<div id="FixletList"></div>
<div id="SearchText"></div>
<div id="ImageLocation"></div>
<div id="SelectAll"></div>
<div id="ArchivePassword"></div>
<div id="NewFixletName"></div>
<div id="theXMLToImport">
</div>
</div>
<div class="contents">
<div class="header">
<h1>Corrupt Patch Update Wizard</h1>
</div>
<div class="sectionBody">
<div class="sectionArea" >
<p>Select which of the following CORRUPT PATCH fixlets to process</p>
<div style="MARGIN-Left: 8px; margin-top:10px" ><b></b></div>
<hr>
<div style="MARGIN-Left: 8px;">
<div id='ErrorBox' class="errorbox control" style="display:none"></div>
<div id='WarnBox' class="warnbox control" style="display:none"></div>
<div class="optionContainer">
<b>Computer Name / IP Address: </b>
<div class="indented">
<INPUT id="searchtext" onKeyDown="checkEnter()" />
<BUTTON id="ButtonLookup" class="buttonStyle" type="button">Find</BUTTON>
<span class="optionSpan"></span>
</div>
</div>
<div id="Fixletlist" style="text-align:center" class="optionContainer"></div>
<div id="radiooptions">
<input type="radio" name="imagingtype" value="reimage" /> Re-Image
<br>
<input type="radio" name="imagingtype" value="capture" /> Capture Image
</div>
</div>
</div>
<!-- Nav Button Area, OD -->
<div id="buttonSection" class="buttonArea">
<HR/>
<div class="buttonSpacing">
<div id="CancelDiv" class="buttonSpacing"><BUTTON id="ButtonCancel" class="buttonStyle" type="button">Cancel</BUTTON></div>
<div id="ButtonDiv" class="buttonSpacing"><BUTTON id="ButtonNext" class="buttonStyle" type="button">Next</BUTTON></div>
</div>
</div>
</div>
</div>
<script language="text/javascript">
var page=0;
ButtonNext.onclick = navToPage;
ButtonLookup.onclick = doLookup;
// contains an array of computer objects which have {id, name, link, lastReport} properties
//var foundFixletsArr = new Array()
// loadSettingsFromDB("settingsOverrideOptions", true);
function trim(str) {
str = str.replace(/^\s*|\s*$/g,"");
return str;
}
function checkEnter() {
if (window.event.keyCode == 13) {
doLookup();
}
}
function navToPage(){
if (searchtext.value == '') {
window.alert("Please select the appropriate fixlets.");
return;
}
if (Fixletlist.innerHTML == '') {
if (doLookup()) {
window.alert("Please select a fixlet.");
}
return;
}
if (Fixletid.length == undefined || Fixletid.length == 1) {
if (!Fixletid.checked) {
window.alert("Please verify that this is the fixlet you want to select.");
return;
} else {
var mydata = Fixletid.value.split('|', 2);
FixletID.innerText = mydata[0];
FixletName.innerText = mydata[1];
}
} else if (Fixletid.length > 1) {
var selected = 0;
for (var i = 0; i < Fixletid.length; i++) {
if (Fixletid[i].checked) {
selected = 1;
var mydata = Fixletid[i].value.split('|', 2);
FixletID.innerText = mydata[0];
FixletName.innerText = mydata[1];
break;
}
}
if (!selected) {
window.alert("Please select a fixlet.");
return;
}
}
if (!imagingtype[0].checked && !imagingtype[1].checked ) {
window.alert("Please select an Corrupt Patch Update operation to perform.");
return;
}
SetStoreFromControls();
window.navigate("linkpage:page3");
}
function isANumber(num)
{
if(!isNaN(trim(num)) && trim(num) != ''){
return true;
}else{
return false;
}
}
function disDiv(id,dis) {
var theDiv = document.getElementById(id)
var theFields = theDiv.getElementsByTagName('input');
for (var i=0; i < theFields.length;i++) {
theFields[i].disabled=dis;
}
theDiv.disabled=dis;
}
function initialSettings() {
//disDiv("radiooptions", true);
searchtext.focus();
SetControlsFromStore();
}
// this function syncs the pages' inputs with what is in TheDataStore
function SetControlsFromStore() {
searchtext.value = SearchText.innerText;
if (ImagingType.innerText == "reimage") {
imagingtype[0].checked = true;
} else if (ImagingType.innerText == "capture") {
imagingtype[1].checked = true;
}
Fixletlist.innerHTML = FixletList.innerHTML;
if (Fixletlist.innerHTML != '') {
if (Fixletid.length == undefined) {
var mydata = Fixletid.value.split('|', 2);
if (FixletID.innerText == mydata[0]) {
Fixletid.checked = true;
} else {
Fixletid.checked = false;
}
} else {
for (var i = 0; i < Fixletid.length; i++) {
var mydata = Fixletid[i].value.split('|', 2);
if (FixletID.innerText == mydata[0]) {
Fixletid[i].checked = true;
} else {
Fixletid[i].checked = false;
}
}
}
}
}
// this function syncs TheDataStore with the users inputs, so that it may be referenced on other pages.
function SetStoreFromControls() {
SearchText.innerText = searchtext.value;
if (imagingtype[1].checked ) {
ImagingType.innerText = "capture";
} else if (imagingtype[0].checked) {
ImagingType.innerText = "reimage";
} else {
window.alert("Warning! Unexpected lack of selection for image type.");
}
FixletList.innerHTML = Fixletlist.innerHTML;
}
function errorMessage(message){
ErrorBox.innerHTML = message;
ErrorBox.style.display ='';
}
function warningMessage(message){
WarnBox.innerHTML = message;
WarnBox.style.display = ''
}
function doLookup(){
var foundFixletsArr = new Array();
WarnBox.style.display = 'none'
ErrorBox.style.display = 'none'
var datatolookup = trim(searchtext.value);
if (datatolookup == "") {
warningMessage("Please a fixlet choice.");
return false;
}
foundFixletsArr = findFixlets(datatolookup);
if (foundFixletsArr.length <=0 ){
warningMessage('No matching fixlets were found "' + datatolookup + '"')
return false;
} else {
Fixletlist.innerHTML = makeTable(foundFixletsArr);
return true;
}
}
// finds all fixlets matching a specific name, and retruns an array of fixlet objects
function findFixlets(data){
var resultsArr = new Array();
var returnArr = new Array();
var i=0;
try {
resultsArr = EvaluateRelevance('(id of it as string & "|" & name of it) of bes fixlets whose (name of it contains "CORRUPT PATCH")');
} catch(E) {
errorMessage("Problem finding fixlets '" + data + "': " + E.description);
}
if (gblDebug)
i=i;
// resultsArr = openfile("CorruptPatch.src");
for(var i = 0; i < resultsArr.length; i++){
var temp = resultsArr[i].split("|")
var obj = {id:temp[0], name:temp[4]}
returnArr.push( obj )
//printObj(obj)
}
return returnArr;
}
//Makes a table from a Fixlet Object Array
function makeTable(FixletsArr) {
var tableStr =
'<table class="ResultsTable" class=sortable>' +
'<td> </th><th>ID</th><th>Name</th>';
for (var i = 0; i < FixletsArr.length; i++) {
if (i % 2 > 0) {
tableStr += '<tr class=wr_evenRow>';
} else {
tableStr += '<tr class=wr_oddRow>';
}
tableStr += '<td>' + '<input type="radio" name="Fixletid" value="' + FixletsArr[i].id + '|'
+ FixletsArr[i].name + '" />' +'</tr>';
}
tableStr += "</table>";
return tableStr;
}
// converts an object to a string, useful for debugging
function printObj(obj){
var alertstr= ''
for(things in obj){
alertstr += things + "="+ obj[things] + "\n";
}
alert(alertstr)
}
// converts an object to a string, useful for debugging
function printObj(obj){
var alertstr= '';
for(things in obj){
alertstr += things + "="+ obj[things] + "\n";
}
alert(alertstr);
}
function navToPage(page){
window.navigate("linkpage:" +page);
}
function loadSettingsFromStore(){
x = document.getElementById("theDataStore");
return x;
}
function loadSettings(){
//window.alert(FixletName.innerText);
var cname = FixletName.innerText;
var imageloc = ImageLocation.innerText;
var newcname = NewFixletName.innerText;
var reimage;
if (ImagingType.innerText == 'reimage') {
reimage = true;
} else if (ImagingType.innerText == 'capture') {
reimage = false;
} else {
window.alert("Warning: Unknown Image Type");
}
if (reimage) {
reimagingwarnings.style.display = '';
} else {
capturewarnings.style.display = '';
}
var s = '';
s += "Confirmation:<br>";
s += '<table><tr><td>';
if (reimage) {
s += 'Computer to re-image: ';
} else {
s += 'Computer to capture image from:';
}
s += '</td><td>';
s += cname;
s += '</td></tr><tr><td>';
s += 'Image file: ';
s += '</td><td>';
s += imageloc;
s += '</td></tr>';
if (reimage) {
s += '<tr><td>New computer name: </td><td>';
s += newcname;
s += '</td></tr>';
}
s += '<tr><td>';
s += 'Other options:'
s += '</td><td>';
s += '...'; // TODO
s += '</td></tr>';
s += '</table>';
s += "<br><br>";
imageoptions.innerHTML = s;
}
function openActionDoc(actionid) {
openactionhack.innerHTML = '<a id="hackclick" href="linkid:openaction(' + actionid + ')"></a>';
hackclick.click();
}
function doFinish(){
//saveSettingsToDB("settingsOverrideOptions", true);
var doc;
var theTitle;
if (ImagingType.innerText == 'reimage') {
doc = xmlCPmutliAction.XMLDocument;
theTitle = "Re-Image Computer " + FixletName.innerText;
} else if (ImagingType.innerText == 'capture') {
doc = xmlCPbaseline.XMLDocument;
theTitle = "Capture Image from Computer " + FixletName.innerText;
}
var rel = 'computer id = ' + FixletID.innerText;
var r = doc.selectSingleNode("BES/MultipleActionGroup/Relevance");
r.text = rel;
var t = doc.selectSingleNode("BES/MultipleActionGroup/Title");
t.text = theTitle;
//////////// Replace Action Parameters (because there isn't direct support for importing action parameters and this is probably the easiest way)//////
// I know from the XML that I want the second action... but if the xml is changed or rearranged, this will break... need a better system -- Ben
//var as = doc.selectNodes("BES/MultipleActionGroup/MemberAction/ActionScript");
// Changed it to a xpath search for every Actionscript element
var as = doc.selectNodes("//ActionScript");
for (var i = 0; i < as.length; i++) {
as[i].text = as[i].text.replace ("#imagelocation#", ImageLocation.innerText);
as[i].text = as[i].text.replace ("#Fixletname#", FixletName.innerText);
as[i].text = as[i].text.replace ("#newFixletname#", NewFixletName.innerText);
as[i].text = as[i].text.replace ("#username#", UserName.innerText);
as[i].text = as[i].text.replace ("#pw#", Password.innerText);
as[i].text = as[i].text.replace ("#archivepw#", ArchivePassword.innerText);
as[i].text = as[i].text.replace ("#workgroup#", Workgroup.innerText);
as[i].text = as[i].text.replace ("#networktype#", NetworkType.innerText);
as[i].text = as[i].text.replace ("#staticip#", StaticIP.innerText);
as[i].text = as[i].text.replace ("#gateway#", Gateway.innerText);
as[i].text = as[i].text.replace ("#subnetmask#", SubnetMask.innerText);
as[i].text = as[i].text.replace ("#agentprepare#", AgentPrepare.innerText);
as[i].text = as[i].text.replace ("#driverspath#", DriversPath.innerText);
}
//var a = doc.selectSingleNode("BES/SingleAction/ActionScript");
//a.text = theAction;
doc.selectSingleNode("/BES").setAttribute("SkipUI", "true");
//window.alert(xmlCPmutliAction.xml);
var results;
try {
if (ImagingType.innerText == 'reimage') {
results = ImportXML(xmlCPmutliAction.xml);
} else if (ImagingType.innerText == 'capture') {
results = ImportXML(xmlCPbaseline.xml);
}
if (results > 0) {
openActionDoc(results);
ButtonCancel.click();
}
} catch (E) {
window.alert("There was an error importing the action: " + E.message);
}
}
</script>
</body>
</html>