Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

[r297]: trunk / multiverse / website / update / patcher.html Maximize Restore History

Download this file

patcher.html    250 lines (220 with data), 7.2 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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Multiverse Client Patcher</title>
<style type="text/css" MEDIA="screen, projection">
<!--
body,td,div,p,a,font,span {font-family: arial,sans-serif; color: white }
body { background-color: black }
.tl {padding: 0; width: 4; text-align: left; vertical-align: top }
.tr {padding: 0; width: 4; text-align: right; vertical-align: top }
.bl {padding: 0; width: 4; text-align: left; vertical-align: bottom }
.br {padding: 0; width: 4; text-align: right; vertical-align: bottom }
.caption {color:#000000; white-space:nowrap; background:#E8EEFA; text-align:center }
.form-noindent {background-color: #ffffff; border: #C3D9FF 1px solid }
.mv.label { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
.mv.value { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
.mv.button { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
.mv.remember { font-family: Arial, Helvetica, sans-serif; font-size: smaller; }
.errormsg { color: red; font-size: smaller; font-family:arial,sans-serif; }
.statusmsg { color: white; font-size: smaller; font-family:arial,sans-serif; }
.logmsg { color: white; font-size: 9px; font-family:arial,sans-serif;overflow:auto;width:300px;height:65px; }
// -->
</style>
<script>
var bytes_fetched = 0;
var bytes_needed = 1;
var files_fetched = 0;
var files_needed = 1;
var log_visible = false;
function SetStatus(portion) {
var bar_elem = document.getElementById('progress_foreground');
var pix_width = 398 * portion;
bar_elem.style.width = pix_width + 'px';
}
function SetStatusMessage(msg) {
var status_elem = document.getElementById("status");
if (status_elem) {
while (status_elem.childNodes.length > 0) {
status_elem.removeChild(status_elem.childNodes[0]);
}
status_elem.appendChild(document.createTextNode(msg));
}
}
function UpdateProgress() {
var elem;
elem = document.getElementById('bytes_fetched')
if (elem) {
elem.value = bytes_fetched;
}
elem = document.getElementById('bytes_needed')
if (elem) {
elem.value = bytes_needed;
}
elem = document.getElementById('files_fetched')
if (elem) {
elem.value = files_fetched;
}
elem = document.getElementById('files_needed')
if (elem) {
elem.value = files_needed;
}
var portion = 0.0;
portion += bytes_fetched;
portion /= bytes_needed;
SetStatus(portion);
}
function HandleLoad() {
var elem = document.getElementById('ok_button');
//alert('in here' + elem);
//elem.style.enabled = false;
bytes_fetched = 0;
bytes_needed = 0;
files_fetched = 0;
files_needed = 0;
log_visible = false;
var button_elem = document.getElementById('log_button');
var log_elem = document.getElementById('log');
button_elem.value = 'Show Log';
log_elem.style.display = 'none';
SetStatusMessage('Preparing to update');
if (window.external) {
window.external.OnLoaded();
}
}
function HandleUpdateStarted(bytes, files) {
bytes_needed = bytes;
files_needed = files;
}
function HandleUpdateCompleted(bytes, files) {
// Set the progress bar to the end
SetStatus(1);
// Enable the Cancel button
var cancel_elem = document.getElementById('cancel_button');
if (cancel_elem) {
cancel_elem.disabled = false;
}
// Enable the OK button
var ok_elem = document.getElementById('ok_button');
if (ok_elem) {
ok_elem.disabled = false;
ok_elem.focus();
}
}
function HandleFileFetchStarted(file, len) {
// alert('in handle file fetch started');
SetStatusMessage('Downloading file: ' + file);
}
function HandleFileFetchEnded(file, len) {
// alert('fetched: ' + file + ' with length type ' + typeof len);
bytes_fetched += len;
files_fetched += 1;
SetStatusMessage('Downloaded file: ' + file);
UpdateProgress();
}
function HandleFileAdded(file, len) {
SetStatusMessage('Downloaded file: ' + file);
AddLogEntry('Added file: ' + file);
}
function HandleFileModified(file, len) {
SetStatusMessage('Downloaded file: ' + file);
AddLogEntry('Modified file: ' + file);
}
function HandleFileIgnored(file, len) {
AddLogEntry('Ignored file: ' + file);
}
function HandleFileRemoved(file, len) {
SetStatusMessage('Removed file: ' + file);
AddLogEntry('Removed file: ' + file);
}
function HandleStateChanged(state) {
// alert('in handle state changed' + state);
switch (state) {
case 1: // UpdateStarted
SetStatusMessage('Updating Client ...');
break;
case 2: // UpdateEnded
SetStatusMessage('Update Completed');
break;
case 3: // FetchingManifest
SetStatusMessage('Retrieving Manifest');
break;
case 4: // ScanningFiles
SetStatusMessage('Scanning Local Files ...');
break;
case 5: // UpdatingFiles
SetStatusMessage('Updating Files ...');
break;
default:
SetStatusMessage('Invalid State: ' + state);
alert('Invalid State: ' + state)
break;
}
}
function AddLogEntry(log_msg) {
var log_elem = document.getElementById("log");
if (log_elem) {
if (log_elem.childNodes.length > 0) {
log_elem.appendChild(document.createElement('br'));
}
log_elem.appendChild(document.createTextNode(log_msg));
}
}
function ToggleLog() {
var button_elem = document.getElementById('log_button');
var log_elem = document.getElementById('log');
if (log_visible) {
button_elem.value = 'Show Log';
log_elem.style.display = 'none';
log_visible = false;
} else {
button_elem.value = 'Hide Log';
log_elem.style.display = 'block';
log_visible = true;
}
}
</script>
</head>
<body onload="HandleLoad()">
<div align="center">
<br>
<img src="mvlogo.jpg">
<br>
<form>
<table width="400" cellpadding=4 border=1>
<tr>
<td colspan="3" align="center"><h3>Please wait while the Multiverse Client downloads the latest updates</h3></td>
</tr>
<tr>
<td colspan="3"> <div id="status" class="statusmsg">Initial status</div> </td>
</tr>
<tr>
<td colspan="3">
<div id="progress_bar" style="position:relative; background-color:navy; width:400px; height:15px; font-size:1px;">
<div id="progress_background" style="position:absolute; top:1px; left:1px; width:398px; height:13px; background-color:lightgrey; font-size:1px;"></div>
<div id="progress_foreground" style="position:absolute; top:1px; left:1px; width:0px; height:13px; background-color:darkgreen; font-size:1px;"></div>
</div>
</td>
</tr>
<tr>
<td><input type="button" id="log_button" value="Show Log" class="mv button" onclick="ToggleLog()"></td>
<td></td>
<td align="right">
<input type="button" id="cancel_button" value="Cancel" class="mv button" onclick="window.external.Abort()" disabled="true">
<input type="button" id="ok_button" value="OK" class="mv button" disabled="true" onclick="window.external.OK()">
</td>
</tr>
</table>
</form>
</div>
<div id="log" class="logmsg">
</div>
<br>
<div style="display: none">
<br>
Bytes: <input type="text" id="bytes_fetched">/<input type="text" id="bytes_needed">
<br>
Files: <input type="text" id="files_fetched">/<input type="text" id="files_needed">
</div>
</body>
</html>