-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcp.htm
More file actions
executable file
·402 lines (350 loc) · 14.5 KB
/
Copy pathcp.htm
File metadata and controls
executable file
·402 lines (350 loc) · 14.5 KB
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
<HTML>
<head>
<Title>Corrupt Patch Update Wizard</Title>
<script type="text/javascript" src="xlatAscript.js"></script>
<script type="text/javascript" src="xlatRelevance.js"></script>
<script type="text/javascript" src="xlatSCriteria.js"></script>
<script type="text/javascript" src="simulation.js"></script>
<script type="text/javascript" >function $(id){ return document.getElementById(id);}</script>
</head>
<body onLoad="initialSettings()">
<!-- TheDataStore is a special object that persists 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">CORRUPT PATCH</div>
<div id="ImageLocation"></div>
<div id="SelectAll"></div>
<div id="ArchivePassword"></div>
<div id="NewFixletName"></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>Fixlet Search Text: </b>
<div class="indented">
<BUTTON id="ButtonLookup" class="buttonStyle" type="button">Find</BUTTON>
<INPUT id="SearchText.innerText" value="CORRUPT PATCH" onKeyDown="checkEnter()" />
<span class="optionSpan"></span>
</div>
</div>
<div id="Fixletlist" style="text-align:center" class="optionContainer"></div>
<div id="radiooptions">
<input type="radio" name="SelectAll" value="selectall" />Default Action = Action 1?</br>
<input type="radio" name="SelectAll" value="selectsome" />Remove action requires restart? </br>
</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 type="text/javascript">
var gblDebug = 0;
var foundFixletsArr = new Array();
var ListUtil = new Object();
var selectLMent = new Array();
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 enter a fixlet choice.");
// return;
}
if (Fixletlist.innerHTML == '') {
if (doLookup()) {
window.alert("Please select a fixlet choice.");
}
return;
}
if (Fixletid.length == undefined || Fixletid.length == 1) {
if (!Fixletid.checked) {
window.alert("Please verify these are the fixlet options 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 [set of] fixlets.");
return;
}
}
if (!SelectAll[0].checked && !SelectAll[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 = $(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() {
if (SearchText.innerText = "")
SearchText.value = "CORRUPT PATCH";
else
SearchText.value = SearchText.innerText;
if (SelectAll.innerText == "selectall") {
SelectAll[0].checked = true;
} else if (SelectAll.innerText == "selectsome") {
SelectAll[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 (SelectAll[1].checked ) {
SelectAll.innerText = "selectall";
} else if (SelectAll[0].checked) {
SelectAll.innerText = "selectsome";
} 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(){
WarnBox.style.display = 'none'
ErrorBox.style.display = 'none'
var datalookup = $("SearchText");
// alert(datalookup.innerText);
// var datatolookup = trim(SearchText.value);
if (datalookup.value == "") {
warningMessage("Please make a fixlet choice.");
return false;
}
foundFixletsArr = findFixlets(datalookup.innerText);
if (foundFixletsArr.length <=0 ){
warningMessage('No matching fixlets were found "' + datalookup + '"')
return false;
} else {
if (foundFixletsArr.length >254) {
foundFixletsArr.length = 255;
warningMessage("Baseline with more than 254 fixlets selected; truncated to 255.");
}
Fixletlist.innerHTML = makeTable(foundFixletsArr);
return true;
}
}
// finds all fixlets matching a specific name, and retruns an array of fixlet objects
// (id, fixletname).
function findFixlets(data){
var errFlg = false;
var resultsArr = new Array();
var returnArr = new Array();
if (gblDebug) {
resultsArr = findSimulatedFixlets(data);
} else {
var srchRel = '(id of it as string & "|" & name of it) of bes fixlets whose (name of it contains "'+data+'")';
try {
resultsArr = EvaluateRelevance(srchRel);
} catch(E) {
errorMessage("Problem finding fixlets '" + srchRel + "': " + E.description);
errFlg = true;
}
}
for(var i = 0; i < resultsArr.length; i++){
var temp = resultsArr[i].split("|")
var obj = {id:temp[0], name:temp[1]}
returnArr.push( obj )
}
return returnArr;
}
function makeTable(FixletsArr) {
var tableStr = '<form name="selectform">'+'<INPUT TYPE=SUBMIT VALUE="Build Baseline" onclick="buildBaseline(document.selectform.selections)">'
+ '<table border=1>' + '<select name="selections" multiple size=FixletsArr.length>';
for (var i = 0; i < FixletsArr.length; i++) {
// selectLMent.push(false);
tableStr += '<option value="'+String(i)+'">'+FixletsArr[i].id+'-'+FixletsArr[i].name+'</option>';
// tableStr += '<option value="selectLMent[]">'+FixletsArr[i].id+'-'+FixletsArr[i].name+'</option>';
}
tableStr += "</select></table></form>";
tableStr += '<INPUT TYPE=SUBMIT VALUE="Build Baseline" onclick="buildBaseline(document.selectform.selections)">';
return tableStr;
}
// building fewer fixlets, but more complete information (id, relevance, script, etc).
function buildBaseline(ob) {
var resultsArr = new Array();
var returnArr = new Array();
var temp = new Array();
var count=0;
var sxs = false;
var srchString = $("SearchText").textContent;
for (var i=0; i<ob.options.length; i++)
{
if (ob.options[i].selected) {
temp = ob.options[i].text.split("-");
selectLMent.push(temp[0]);
}
}
for (var j=0; j<selectLMent.length; j++) {
var srchRel = '(item 1 of it &"|"& item 2 of it &"|"& concatenation of item 3 of it as string) of (id of it,relevance of it,name of it, scripts of actions of it) of bes fixlets whose (name of it contains "'+srchString+'" and id of it = '+selectLMent[j]+')';
try {
resultsArr = EvaluateRelevance(srchRel);
} catch(E) {
errorMessage("Problem finding fixlets '" + srchRel + "': " + E.description);
errFlg = true;
}
// If there are multiple actions, we have multiple elements of the array with the same id
for(var i = 0; i < resultsArr.length; i++){
var temp = resultsArr[i].split("|")
var obj = {id:selectLMent[j], rel:temp[0], name:temp[1], act:temp[2]}
returnArr.push( obj )
}
// count++;
// }
}
sxs = doFinish(returnArr);
alert("Done finding the fixlets");
return true;
}
function propagateCommonOuterFields(xmldoc) {
}
function propagateCommonInnerFields(xmldoc, ascript, rnce, criteria) {
}
function doFinish(fxlArray){
//saveSettingsToDB("settingsOverrideOptions", true);
var newFxldoc, doc, theTitle, tID, tA, tR, tS, tF, lastFixlet=0;
doc = loadXML("CorruptPatchOuterTemplate.xml");
// doc = xmlCPmutliAction.XMLDocument;
xmlToImport = propagateCommonOuterFields(doc);
// Only use first of duplicate actions
for (i=0; i<fxlArray.length; i++) {
tID = fxlArray[i].id;
if (tID != lastFixlet) {
tR = fxlArray[i].rel;
tA = fxlArray[i].act;
tA = xlatAscript(tA);
newFxldoc = loadXML("CorruptPatchInnerTemplate.xml");
tF += propagateCommonInnerFields(newFxldoc, tA, tR, tS);
lastFixlet = tID;
}
}
xmlToImport.replace("#componentshere#", tF);
doc = xmlToImport;
theTitle = "Corrupt Patch Update Baseline ";
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 ("#Fixletname#", FixletName.innerText);
as[i].text = as[i].text.replace ("#newFixletname#", NewFixletName.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 (SelectAll.innerText == 'selectall') {
results = ImportXML(xmlCPmutliAction.xml);
} else if (SelectAll.innerText == 'selectsome') {
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>