1#!/usr/bin/python
2##
3## license:BSD-3-Clause
4## copyright-holders:Vas Crabb
5
6import string
7
8
9ERROR_PAGE = string.Template(
10        '<!DOCTYPE html>\n' \
11        '<html>\n' \
12        '<head>\n' \
13        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
14        '    <title>${code} ${message}</title>\n' \
15        '</head>\n' \
16        '<body>\n' \
17        '<h1>${message}</h1>\n' \
18        '</body>\n' \
19        '</html>\n')
20
21
22SORTABLE_TABLE_EPILOGUE = string.Template(
23        '    </tbody>\n'
24        '</table>\n'
25        '<script>make_table_sortable(document.getElementById("${id}"));</script>\n')
26
27
28MACHINE_PROLOGUE = string.Template(
29        '<!DOCTYPE html>\n' \
30        '<html>\n' \
31        '<head>\n' \
32        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
33        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
34        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
35        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
36        '    <script type="text/javascript">\n' \
37        '        var appurl="${app}"\n' \
38        '        var assetsurl="${assets}"\n' \
39        '    </script>\n' \
40        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
41        '    <script type="text/javascript" src="${assets}/machine.js"></script>\n' \
42        '    <title>Machine: ${description} (${shortname})</title>\n' \
43        '</head>\n' \
44        '<body>\n' \
45        '<h1>${description}</h1>\n' \
46        '<table class="sysinfo">\n' \
47        '    <tr><th>Short name:</th><td>${shortname}</td></tr>\n' \
48        '    <tr><th>Is device:</th><td>${isdevice}</td></tr>\n' \
49        '    <tr><th>Runnable:</th><td>${runnable}</td></tr>\n' \
50        '    <tr><th>Source file:</th><td><a href="${sourcehref}">${sourcefile}</a></td></tr>\n')
51
52MACHINE_CLONES_PROLOGUE = string.Template(
53        '<h2>Clones</h2>\n' \
54        '<table id="tbl-clones">\n' \
55        '    <thead>\n' \
56        '        <tr>\n' \
57        '            <th>Short name</th>\n' \
58        '            <th>Description</th>\n' \
59        '            <th>Year</th>\n' \
60        '            <th>Manufacturer</th>\n' \
61        '        </tr>\n' \
62        '    </thead>\n' \
63        '    <tbody>\n')
64
65MACHINE_CLONES_ROW = string.Template(
66        '        <tr>\n' \
67        '            <td><a href="${href}">${shortname}</a></td>\n' \
68        '            <td><a href="${href}">${description}</a></td>\n' \
69        '            <td>${year}</td>\n' \
70        '            <td>${manufacturer}</td>\n' \
71        '        </tr>\n')
72
73MACHINE_SOFTWARELISTS_TABLE_PROLOGUE = string.Template(
74        '<h2 id="heading-softwarelists">Software Lists</h2>\n' \
75        '<table id="tbl-softwarelists">\n' \
76        '    <thead>\n' \
77        '        <tr>\n' \
78        '            <th>Card</th>\n' \
79        '            <th>Short name</th>\n' \
80        '            <th>Description</th>\n' \
81        '            <th>Status</th>\n' \
82        '            <th class="numeric">Total</th>\n' \
83        '            <th class="numeric">Supported</th>\n' \
84        '            <th class="numeric">Partially supported</th>\n' \
85        '            <th class="numeric">Unsupported</th>\n' \
86        '        </tr>\n' \
87        '    </thead>\n' \
88        '    <tbody>\n')
89
90MACHINE_SOFTWARELISTS_TABLE_ROW = string.Template(
91        '        <tr id="row-softwarelists-${rowid}">\n' \
92        '            <td></td>\n' \
93        '            <td><a href="${href}">${shortname}</a></td>\n' \
94        '            <td><a href="${href}">${description}</a></td>\n' \
95        '            <td>${status}</td>\n' \
96        '            <td style="text-align: right">${total}</td>\n' \
97        '            <td style="text-align: right">${supported}</td>\n' \
98        '            <td style="text-align: right">${partiallysupported}</td>\n' \
99        '            <td style="text-align: right">${unsupported}</td>\n' \
100        '        </tr>\n')
101
102MACHINE_SOFTWARELISTS_TABLE_EPILOGUE = string.Template(
103        '    </tbody>\n' \
104        '</table>\n' \
105        '<script>\n' \
106        '    make_table_sortable(document.getElementById("tbl-softwarelists"));\n' \
107        '    if (!document.getElementById("tbl-softwarelists").tBodies[0].rows.length)\n' \
108        '    {\n' \
109        '        document.getElementById("heading-softwarelists").style.display = "none";\n' \
110        '        document.getElementById("tbl-softwarelists").style.display = "none";\n' \
111        '    }\n' \
112        '</script>\n')
113
114MACHINE_OPTIONS_HEADING = string.Template(
115        '<h2>Options</h2>\n' \
116        '<p>\n' \
117        '    Format: <select id="select-options-format" onchange="update_cmd_preview()"><option value="cmd">Command line</option><option value="ini">INI file</option></select>\n' \
118        '    <input type="checkbox" id="check-explicit-defaults" onchange="update_cmd_preview()"><label for="check-explicit-defaults">Explicit defaults</label>\n' \
119        '</p>\n' \
120        '<p id="para-cmd-preview"></p>\n')
121
122MACHINE_BIOS_PROLOGUE = string.Template(
123        '<h3>System BIOS</h3>' \
124        '<select id="select-system-bios" onchange="update_cmd_preview()">')
125
126MACHINE_BIOS_OPTION = string.Template(
127        '    <option value="${name}" data-isdefault="${isdefault}">${name} - ${description}</option>\n')
128
129MACHINE_RAM_PROLOGUE = string.Template(
130        '<h3>RAM Size</h3>' \
131        '<select id="select-ram-option" onchange="update_cmd_preview()">')
132
133MACHINE_RAM_OPTION = string.Template(
134        '    <option value="${name}" data-isdefault="${isdefault}">${name} (${size})</option>\n')
135
136MACHINE_SLOTS_PLACEHOLDER_PROLOGUE = string.Template(
137        '<h3>Slots</h3>\n' \
138        '<p id="para-slots-placeholder">Loading slot information&hellip;<p>\n' \
139        '<script>\n')
140
141MACHINE_SLOTS_PLACEHOLDER_EPILOGUE = string.Template(
142        '    populate_slots(${machine});\n'
143        '</script>\n')
144
145MACHINE_ROW = string.Template(
146        '        <tr>\n' \
147        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
148        '            <td><a href="${machinehref}">${description}</a></td>\n' \
149        '            <td><a href="${sourcehref}">${sourcefile}</a></td>\n' \
150        '        </tr>\n')
151
152EXCL_MACHINE_ROW = string.Template(
153        '        <tr>\n' \
154        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
155        '            <td></td>\n' \
156        '            <td></td>\n' \
157        '        </tr>\n')
158
159COMPATIBLE_SLOT_ROW = string.Template(
160        '        <tr>\n' \
161        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
162        '            <td><a href="${machinehref}">${description}</a></td>\n' \
163        '            <td>${slot}</td>\n' \
164        '            <td>${slotoption}</td>\n' \
165        '            <td><a href="${sourcehref}">${sourcefile}</a></td>\n' \
166        '        </tr>\n')
167
168
169SOURCEFILE_PROLOGUE = string.Template(
170        '<!DOCTYPE html>\n' \
171        '<html>\n' \
172        '<head>\n' \
173        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
174        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
175        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
176        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
177        '    <script type="text/javascript">var assetsurl="${assets}"</script>\n' \
178        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
179        '    <title>Source File: ${filename}</title>\n' \
180        '</head>\n' \
181        '<body>\n' \
182        '<h1>${title}</h1>\n')
183
184SOURCEFILE_ROW_PARENT = string.Template(
185        '        <tr>\n' \
186        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
187        '            <td><a href="${machinehref}">${description}</a></td>\n' \
188        '            <td>${year}</td>\n' \
189        '            <td>${manufacturer}</td>\n' \
190        '            <td>${runnable}</td>\n' \
191        '            <td></td>\n' \
192        '        </tr>\n')
193
194SOURCEFILE_ROW_CLONE = string.Template(
195        '        <tr>\n' \
196        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
197        '            <td><a href="${machinehref}">${description}</a></td>\n' \
198        '            <td>${year}</td>\n' \
199        '            <td>${manufacturer}</td>\n' \
200        '            <td>${runnable}</td>\n' \
201        '            <td><a href="${parenthref}">${parent}</a></td>\n' \
202        '        </tr>\n')
203
204
205SOURCEFILE_LIST_PROLOGUE = string.Template(
206        '<!DOCTYPE html>\n' \
207        '<html>\n' \
208        '<head>\n' \
209        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
210        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
211        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
212        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
213        '    <script type="text/javascript">var assetsurl="${assets}"</script>\n' \
214        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
215        '    <title>${title}</title>\n' \
216        '</head>\n' \
217        '<body>\n' \
218        '<h1>${heading}</h1>\n' \
219        '<table id="tbl-sourcefiles">\n' \
220        '    <thead>\n' \
221        '        <tr>\n' \
222        '            <th>Source file</th>\n' \
223        '            <th class="numeric">Machines</th>\n' \
224        '        </tr>\n' \
225        '    </thead>\n' \
226        '    <tbody>\n')
227
228SOURCEFILE_LIST_ROW = string.Template(
229        '        <tr>\n' \
230        '            <td>${sourcefile}</td>\n' \
231        '            <td style="text-align: right">${machines}</td>\n' \
232        '        </tr>\n')
233
234
235SOFTWARE_PROLOGUE = string.Template(
236        '<!DOCTYPE html>\n' \
237        '<html>\n' \
238        '<head>\n' \
239        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
240        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
241        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
242        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
243        '    <script type="text/javascript">var assetsurl="${assets}"</script>\n' \
244        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
245        '    <title>${title}</title>\n' \
246        '</head>\n' \
247        '<body>\n' \
248        '<h1>${heading}</h1>\n' \
249        '<table class="sysinfo">\n' \
250        '    <tr><th>Software list:</th><td><a href="${softwarelisthref}">${softwarelistdescription} (${softwarelist})</a></td></tr>\n' \
251        '    <tr><th>Short name:</th><td>${shortname}</td></tr>\n' \
252        '    <tr><th>Year:</th><td>${year}</td></tr>\n' \
253        '    <tr><th>Publisher:</th><td>${publisher}</td></tr>\n');
254
255SOFTWARE_CLONES_PROLOGUE = string.Template(
256        '<h2>Clones</h2>\n' \
257        '<table id="tbl-clones">\n' \
258        '    <thead>\n' \
259        '        <tr>\n' \
260        '            <th>Short name</th>\n' \
261        '            <th>Description</th>\n' \
262        '            <th>Year</th>\n' \
263        '            <th>Publisher</th>\n' \
264        '            <th>Supported</th>\n' \
265        '        </tr>\n' \
266        '    </thead>\n' \
267        '    <tbody>\n')
268
269SOFTWARE_CLONES_ROW = string.Template(
270        '        <tr>\n' \
271        '            <td><a href="${href}">${shortname}</a></td>\n' \
272        '            <td><a href="${href}">${description}</a></td>\n' \
273        '            <td>${year}</td>\n' \
274        '            <td>${publisher}</td>\n' \
275        '            <td>${supported}</td>\n' \
276        '        </tr>\n')
277
278SOFTWARE_PART_PROLOGUE = string.Template(
279        '<h3>${heading}</h3>\n' \
280        '<table class="sysinfo">\n' \
281        '    <tr><th>Short name:</th><td>${shortname}</td></tr>\n' \
282        '    <tr><th>Interface:</th><td>${interface}</td></tr>\n')
283
284
285SOFTWARELIST_PROLOGUE = string.Template(
286        '<!DOCTYPE html>\n' \
287        '<html>\n' \
288        '<head>\n' \
289        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
290        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
291        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
292        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
293        '    <script type="text/javascript">var assetsurl="${assets}"</script>\n' \
294        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
295        '    <title>${title}</title>\n' \
296        '</head>\n' \
297        '<body>\n' \
298        '<h1>${heading}</h1>\n' \
299        '<table class="sysinfo">\n' \
300        '    <tr>\n' \
301        '        <th>Short name:</th>\n' \
302        '        <td>${shortname}</td>\n' \
303        '    </tr>\n' \
304        '    <tr>\n' \
305        '        <th>Total:</th>\n' \
306        '        <td style="text-align: right">${total}</td>\n' \
307        '    </tr>\n' \
308        '    <tr>\n' \
309        '        <th>Supported:</th>\n' \
310        '        <td style="text-align: right">${supported}</td>\n' \
311        '        <td style="text-align: right">(${supportedpc}%)</td>\n' \
312        '    </tr>\n' \
313        '    <tr>\n' \
314        '        <th>Partially supported:</th>\n' \
315        '        <td style="text-align: right">${partiallysupported}</td>\n' \
316        '        <td style="text-align: right">(${partiallysupportedpc}%)</td>\n' \
317        '    </tr>\n' \
318        '    <tr>\n' \
319        '        <th>Unsupported:</th>\n' \
320        '        <td style="text-align: right">${unsupported}</td>\n' \
321        '        <td style="text-align: right">(${unsupportedpc}%)</td>\n' \
322        '    </tr>\n' \
323        '</table>\n')
324
325SOFTWARELIST_MACHINE_TABLE_HEADER = string.Template(
326        '<h2>Machines</h2>\n' \
327        '<table id="tbl-machines">\n' \
328        '    <thead>\n' \
329        '        <tr>\n' \
330        '            <th>Short name</th>\n' \
331        '            <th>Description</th>\n' \
332        '            <th>Year</th>\n' \
333        '            <th>Manufacturer</th>\n' \
334        '            <th>Status</th>\n' \
335        '        </tr>\n' \
336        '    </thead>\n' \
337        '    <tbody>\n')
338
339SOFTWARELIST_MACHINE_TABLE_ROW = string.Template(
340        '        <tr>\n' \
341        '            <td><a href="${machinehref}">${shortname}</a></td>\n' \
342        '            <td><a href="${machinehref}">${description}</a></td>\n' \
343        '            <td>${year}</td>\n' \
344        '            <td>${manufacturer}</td>\n' \
345        '            <td>${status}</td>\n' \
346        '        </tr>\n')
347
348SOFTWARELIST_SOFTWARE_TABLE_HEADER = string.Template(
349        '<h2>Software</h2>\n' \
350        '<table id="tbl-software">\n' \
351        '    <thead>\n' \
352        '        <tr>\n' \
353        '            <th>Short name</th>\n' \
354        '            <th>Description</th>\n' \
355        '            <th>Year</th>\n' \
356        '            <th>Publisher</th>\n' \
357        '            <th>Supported</th>\n' \
358        '            <th class="numeric">Parts</th>\n' \
359        '            <th class="numeric">Bad dumps</th>\n' \
360        '            <th>Parent</th>\n' \
361        '        </tr>\n' \
362        '    </thead>\n' \
363        '    <tbody>\n')
364
365SOFTWARELIST_SOFTWARE_ROW = string.Template(
366        '        <tr>\n' \
367        '            <td><a href="${softwarehref}">${shortname}</a></td>\n' \
368        '            <td><a href="${softwarehref}">${description}</a></td>\n' \
369        '            <td>${year}</td>\n' \
370        '            <td>${publisher}</td>\n' \
371        '            <td>${supported}</td>\n' \
372        '            <td style="text-align: right">${parts}</td>\n' \
373        '            <td style="text-align: right">${baddumps}</td>\n' \
374        '            <td>${parent}</td>\n' \
375        '        </tr>\n')
376
377
378SOFTWARELIST_LIST_PROLOGUE = string.Template(
379        '<!DOCTYPE html>\n' \
380        '<html>\n' \
381        '<head>\n' \
382        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
383        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
384        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
385        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
386        '    <script type="text/javascript">var assetsurl="${assets}"</script>\n' \
387        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
388        '    <title>${title}</title>\n' \
389        '</head>\n' \
390        '<body>\n' \
391        '<h1>${heading}</h1>\n' \
392        '<table id="tbl-softwarelists">\n' \
393        '    <thead>\n' \
394        '        <tr>\n' \
395        '            <th>Short name</th>\n' \
396        '            <th>Description</th>\n' \
397        '            <th class="numeric">Total</th>\n' \
398        '            <th class="numeric">Supported</th>\n' \
399        '            <th class="numeric">Partially supported</th>\n' \
400        '            <th class="numeric">Unsupported</th>\n' \
401        '        </tr>\n' \
402        '    </thead>\n' \
403        '    <tbody>\n')
404
405SOFTWARELIST_LIST_ROW = string.Template(
406        '        <tr>\n' \
407        '            <td><a href="${href}">${shortname}</a></td>\n' \
408        '            <td><a href="${href}">${description}</a></td>\n' \
409        '            <td style="text-align: right">${total}</td>\n' \
410        '            <td style="text-align: right">${supported}</td>\n' \
411        '            <td style="text-align: right">${partiallysupported}</td>\n' \
412        '            <td style="text-align: right">${unsupported}</td>\n' \
413        '        </tr>\n')
414
415
416ROMIDENT_PAGE = string.Template(
417        '<!DOCTYPE html>\n' \
418        '<html>\n' \
419        '<head>\n' \
420        '    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">\n' \
421        '    <meta http-equiv="Content-Style-Type" content="text/css">\n' \
422        '    <meta http-equiv="Content-Script-Type" content="text/javascript">\n' \
423        '    <link rel="stylesheet" type="text/css" href="${assets}/style.css">\n' \
424        '    <script type="text/javascript">\n' \
425        '        var appurl="${app}"\n' \
426        '        var assetsurl="${assets}"\n' \
427        '    </script>\n' \
428        '    <script type="text/javascript" src="${assets}/common.js"></script>\n' \
429        '    <script type="text/javascript" src="${assets}/digest.js"></script>\n' \
430        '    <script type="text/javascript" src="${assets}/romident.js"></script>\n' \
431        '    <title>Identify ROM/Disk Dumps</title>\n' \
432        '</head>\n' \
433        '<body>\n' \
434        '<h1>Identify ROM/Disk Dumps</h1>\n' \
435        '<p>No files are uploaded.  Files are examined locally and checksums/digests are sent to the server.  File checksums and digests may be logged on the server.</p>\n' \
436        '<div id="div-dropzone" class="dropzone" ondragover="div_dropzone_dragover(event)" ondrop="div_dropzone_drop(event)">\n' \
437        '<p><button type="button" onclick="document.getElementById(&quot;input-dumps&quot;).click()">Select ROM/disk dumps</button></p>\n' \
438        '<p>Drag and drop ROM/disk dump files here to identify them.</p>\n' \
439        '</div>\n' \
440        '<input id="input-dumps" type="file" multiple onchange="add_dump_files(this.files)" style="display: none">\n' \
441        '<div id="div-progress"></div>\n' \
442        '<div id="div-issues"></div>\n' \
443        '<div id="div-unmatched"></div>\n' \
444        '<div id="div-machines"></div>\n' \
445        '<div id="div-software"></div>\n' \
446        '</body>\n' \
447        '</html>\n')
448