in class/System.Windows/System.Windows.Controls/:
[moon.git] / demo-status.sh
blob70fe2994472a54b2a325e28241edf64a5a155ef5
1 #!/bin/bash -e
3 # input file
4 DEMOSTATUS=demo-status.txt
6 # variables we use
7 SITE=
8 URL=
9 RATING=
10 COMMENTS=
11 ROW=
12 ROWS=
13 # the final result: pass (0) if all test sites have rating >= 2, otherwise fail (RESULT=1)
14 RESULT=0
16 # icons
17 IMG_OK=http://www.mono-project.com/files/2/22/Accept.png
18 IMG_STAR=http://www.mono-project.com/files/2/2e/Star.png
19 IMG_BAD=http://www.mono-project.com/files/8/8c/Delete.png
20 IMG_BROKEN=http://www.mono-project.com/files/a/aa/Help.png
22 STAR_N1="<img src='$IMG_BROKEN' alt='Site url is broken or the application is broken on Silverlight' />"
23 STAR_0="<img src='$IMG_BAD' alt='Site has no functionality or crashes Firefox' />"
24 STAR_1="<img src='$IMG_STAR' alt='Site has minimal functionality and/or major cosmetic issues.' />"
25 STAR_2="<img src='$IMG_STAR' alt='Site has some functionality and/or cosmetic issues' /><img src='$IMG_STAR' alt='Site has some functionality and/or cosmetic issues' />"
26 STAR_3="<img src='$IMG_STAR' alt='Site has most features working and/or has minor cosmetic issues' /><img src='$IMG_STAR' alt='Site has most features working and/or has minor cosmetic issues' /><img src='$IMG_STAR' alt='Site has most features working and/or has minor cosmetic issues' />"
27 STAR_4="<img src='$IMG_OK' alt='Site has some functionality and/or cosmetic issues'/>"
29 # can't seem to get a -1 index to work in bash, move to 10 and add a special case below
30 ICONS[10]=$STAR_N1
31 ICONS[0]=$STAR_0
32 ICONS[1]=$STAR_1
33 ICONS[2]=$STAR_2
34 ICONS[3]=$STAR_3
35 ICONS[4]=$STAR_4
37 # parse the input file
38 while read i; do
39 if [[ "x${i:0:1}" == "x#" ]]; then
40 continue
43 if [[ "x$i" == "x" ]]; then
44 if [[ "x$RATING" == "x-1" ]]; then
45 IDX=10
46 else
47 IDX=$RATING
50 ROW="<tr><td>$RATING ${ICONS[$IDX]}</td><td><a href='$URL'>$SITE</a></td><td><ul>$COMMENTS</ul></td></tr>"
51 ROWS="$ROWS
52 $ROW"
53 COMMENTS=
54 SITE=
55 URL=
56 RATING=
57 continue
60 case "$i" in
61 site:*)
62 SITE=${i:5}
63 #echo "Site is: $SITE"
65 url:*)
66 URL=${i:4}
67 #echo "Url is: $URL"
69 rating:*)
70 RATING=${i:7}
71 if [[ $RATING -le 2 ]]; then
72 RESULT=1
73 echo Site \"$SITE\" has a rating below 3 \(rating: $RATING\): we fail.
75 #echo "Rating is: $RATING"
77 "*"*)
78 COMMENT=${i:2}
80 if echo $COMMENT | grep "Bug [[:digit:]]\{5\}" > /dev/null; then
81 COMMENT=`echo $COMMENT | sed 's|Bug \([0-9]*\)|<a href="http://bugzilla.novell.com/show_bug.cgi?id=\1">&</a>|'`
84 COMMENTS="$COMMENTS<li>$COMMENT</li>"
85 #echo "Comment is: ${i:2}"
88 #echo "Else: $i"
90 esac
91 done < $DEMOSTATUS
94 cat > demo-status.html << EOF
95 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
96 <html xmlns='http://www.w3.org/1999/xhtml'>
97 <head>
98 <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
99 <title>Moonlight Test Sites</title>
101 <script type='text/javascript'>
102 <!--
103 /* this script was found here: http://www.kryogenix.org/code/browser/sorttable/sorttable.js */
105 SortTable
106 version 2
107 7th April 2007
108 Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
110 Instructions:
111 Download this file
112 Add <script src="sorttable.js"><\/script> to your HTML
113 Add class="sortable" to any table you'd like to make sortable
114 Click on the headers to sort
116 Thanks to many, many people for contributions and suggestions.
117 Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
118 This basically means: do what you want with it.
122 var stIsIE = /*@cc_on!@*/false;
124 sorttable = {
125 init: function() {
126 // quit if this function has already been called
127 if (arguments.callee.done) return;
128 // flag this function so we don't do the same thing twice
129 arguments.callee.done = true;
130 // kill the timer
131 if (_timer) clearInterval(_timer);
133 if (!document.createElement || !document.getElementsByTagName) return;
135 sorttable.DATE_RE = /^(\d\d?)[\/\.-](\d\d?)[\/\.-]((\d\d)?\d\d)$/;
137 forEach(document.getElementsByTagName('table'), function(table) {
138 if (table.className.search(/\bsortable\b/) != -1) {
139 sorttable.makeSortable(table);
145 makeSortable: function(table) {
146 if (table.getElementsByTagName('thead').length == 0) {
147 // table doesn't have a tHead. Since it should have, create one and
148 // put the first table row in it.
149 the = document.createElement('thead');
150 the.appendChild(table.rows[0]);
151 table.insertBefore(the,table.firstChild);
153 // Safari doesn't support table.tHead, sigh
154 if (table.tHead == null) table.tHead = table.getElementsByTagName('thead')[0];
156 if (table.tHead.rows.length != 1) return; // can't cope with two header rows
158 // Sorttable v1 put rows with a class of "sortbottom" at the bottom (as
159 // "total" rows, for example). This is B&amp;R, since what you're supposed
160 // to do is put them in a tfoot. So, if there are sortbottom rows,
161 // for backwards compatibility, move them to tfoot (creating it if needed).
162 sortbottomrows = [];
163 for (var i=0; i<table.rows.length; i++) {
164 if (table.rows[i].className.search(/\bsortbottom\b/) != -1) {
165 sortbottomrows[sortbottomrows.length] = table.rows[i];
168 if (sortbottomrows) {
169 if (table.tFoot == null) {
170 // table doesn't have a tfoot. Create one.
171 tfo = document.createElement('tfoot');
172 table.appendChild(tfo);
174 for (var i=0; i<sortbottomrows.length; i++) {
175 tfo.appendChild(sortbottomrows[i]);
177 delete sortbottomrows;
180 // work through each column and calculate its type
181 headrow = table.tHead.rows[0].cells;
182 for (var i=0; i<headrow.length; i++) {
183 // manually override the type with a sorttable_type attribute
184 if (!headrow[i].className.match(/\bsorttable_nosort\b/)) { // skip this col
185 mtch = headrow[i].className.match(/\bsorttable_([a-z0-9]+)\b/);
186 if (mtch) { override = mtch[1]; }
187 if (mtch && typeof sorttable["sort_"+override] == 'function') {
188 headrow[i].sorttable_sortfunction = sorttable["sort_"+override];
189 } else {
190 headrow[i].sorttable_sortfunction = sorttable.guessType(table,i);
192 // make it clickable to sort
193 headrow[i].sorttable_columnindex = i;
194 headrow[i].sorttable_tbody = table.tBodies[0];
195 dean_addEvent(headrow[i],"click", function(e) {
197 if (this.className.search(/\bsorttable_sorted\b/) != -1) {
198 // if we're already sorted by this column, just
199 // reverse the table, which is quicker
200 sorttable.reverse(this.sorttable_tbody);
201 this.className = this.className.replace('sorttable_sorted',
202 'sorttable_sorted_reverse');
203 this.removeChild(document.getElementById('sorttable_sortfwdind'));
204 sortrevind = document.createElement('span');
205 sortrevind.id = "sorttable_sortrevind";
206 sortrevind.innerHTML = stIsIE ? '&nbsp<font face="webdings">5</font>' : '&nbsp;&#x25B4;';
207 this.appendChild(sortrevind);
208 return;
210 if (this.className.search(/\bsorttable_sorted_reverse\b/) != -1) {
211 // if we're already sorted by this column in reverse, just
212 // re-reverse the table, which is quicker
213 sorttable.reverse(this.sorttable_tbody);
214 this.className = this.className.replace('sorttable_sorted_reverse',
215 'sorttable_sorted');
216 this.removeChild(document.getElementById('sorttable_sortrevind'));
217 sortfwdind = document.createElement('span');
218 sortfwdind.id = "sorttable_sortfwdind";
219 sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
220 this.appendChild(sortfwdind);
221 return;
224 // remove sorttable_sorted classes
225 theadrow = this.parentNode;
226 forEach(theadrow.childNodes, function(cell) {
227 if (cell.nodeType == 1) { // an element
228 cell.className = cell.className.replace('sorttable_sorted_reverse','');
229 cell.className = cell.className.replace('sorttable_sorted','');
232 sortfwdind = document.getElementById('sorttable_sortfwdind');
233 if (sortfwdind) { sortfwdind.parentNode.removeChild(sortfwdind); }
234 sortrevind = document.getElementById('sorttable_sortrevind');
235 if (sortrevind) { sortrevind.parentNode.removeChild(sortrevind); }
237 this.className += ' sorttable_sorted';
238 sortfwdind = document.createElement('span');
239 sortfwdind.id = "sorttable_sortfwdind";
240 sortfwdind.innerHTML = stIsIE ? '&nbsp<font face="webdings">6</font>' : '&nbsp;&#x25BE;';
241 this.appendChild(sortfwdind);
243 // build an array to sort. This is a Schwartzian transform thing,
244 // i.e., we "decorate" each row with the actual sort key,
245 // sort based on the sort keys, and then put the rows back in order
246 // which is a lot faster because you only do getInnerText once per row
247 row_array = [];
248 col = this.sorttable_columnindex;
249 rows = this.sorttable_tbody.rows;
250 for (var j=0; j<rows.length; j++) {
251 row_array[row_array.length] = [sorttable.getInnerText(rows[j].cells[col]), rows[j]];
253 /* If you want a stable sort, uncomment the following line */
254 //sorttable.shaker_sort(row_array, this.sorttable_sortfunction);
255 /* and comment out this one */
256 row_array.sort(this.sorttable_sortfunction);
258 tb = this.sorttable_tbody;
259 for (var j=0; j<row_array.length; j++) {
260 tb.appendChild(row_array[j][1]);
263 delete row_array;
269 guessType: function(table, column) {
270 // guess the type of a column based on its first non-blank row
271 sortfn = sorttable.sort_alpha;
272 for (var i=0; i<table.tBodies[0].rows.length; i++) {
273 text = sorttable.getInnerText(table.tBodies[0].rows[i].cells[column]);
274 if (text != '') {
275 if (text.match(/^-?[£$¤]?[\d,.]+%?$/)) {
276 return sorttable.sort_numeric;
278 // check for a date: dd/mm/yyyy or dd/mm/yy
279 // can have / or . or - as separator
280 // can be mm/dd as well
281 possdate = text.match(sorttable.DATE_RE)
282 if (possdate) {
283 // looks like a date
284 first = parseInt(possdate[1]);
285 second = parseInt(possdate[2]);
286 if (first > 12) {
287 // definitely dd/mm
288 return sorttable.sort_ddmm;
289 } else if (second > 12) {
290 return sorttable.sort_mmdd;
291 } else {
292 // looks like a date, but we can't tell which, so assume
293 // that it's dd/mm (English imperialism!) and keep looking
294 sortfn = sorttable.sort_ddmm;
299 return sortfn;
302 getInnerText: function(node) {
303 // gets the text we want to use for sorting for a cell.
304 // strips leading and trailing whitespace.
305 // this is *not* a generic getInnerText function; it's special to sorttable.
306 // for example, you can override the cell text with a customkey attribute.
307 // it also gets .value for <input> fields.
309 hasInputs = (typeof node.getElementsByTagName == 'function') &&
310 node.getElementsByTagName('input').length;
312 if (node.getAttribute("sorttable_customkey") != null) {
313 return node.getAttribute("sorttable_customkey");
315 else if (typeof node.textContent != 'undefined' && !hasInputs) {
316 return node.textContent.replace(/^\s+|\s+$/g, '');
318 else if (typeof node.innerText != 'undefined' && !hasInputs) {
319 return node.innerText.replace(/^\s+|\s+$/g, '');
321 else if (typeof node.text != 'undefined' && !hasInputs) {
322 return node.text.replace(/^\s+|\s+$/g, '');
324 else {
325 switch (node.nodeType) {
326 case 3:
327 if (node.nodeName.toLowerCase() == 'input') {
328 return node.value.replace(/^\s+|\s+$/g, '');
330 case 4:
331 return node.nodeValue.replace(/^\s+|\s+$/g, '');
332 break;
333 case 1:
334 case 11:
335 var innerText = '';
336 for (var i = 0; i < node.childNodes.length; i++) {
337 innerText += sorttable.getInnerText(node.childNodes[i]);
339 return innerText.replace(/^\s+|\s+$/g, '');
340 break;
341 default:
342 return '';
347 reverse: function(tbody) {
348 // reverse the rows in a tbody
349 newrows = [];
350 for (var i=0; i<tbody.rows.length; i++) {
351 newrows[newrows.length] = tbody.rows[i];
353 for (var i=newrows.length-1; i>=0; i-=1) {
354 tbody.appendChild(newrows[i]);
356 delete newrows;
359 /* sort functions
360 each sort function takes two parameters, a and b
361 you are comparing a[0] and b[0] */
362 sort_numeric: function(a,b) {
363 aa = parseFloat(a[0].replace(/[^0-9.-]/g,''));
364 if (isNaN(aa)) aa = 0;
365 bb = parseFloat(b[0].replace(/[^0-9.-]/g,''));
366 if (isNaN(bb)) bb = 0;
367 return aa-bb;
369 sort_alpha: function(a,b) {
370 if (a[0]==b[0]) return 0;
371 if (a[0]<b[0]) return -1;
372 return 1;
374 sort_ddmm: function(a,b) {
375 mtch = a[0].match(sorttable.DATE_RE);
376 y = mtch[3]; m = mtch[2]; d = mtch[1];
377 if (m.length == 1) m = '0'+m;
378 if (d.length == 1) d = '0'+d;
379 dt1 = y+m+d;
380 mtch = b[0].match(sorttable.DATE_RE);
381 y = mtch[3]; m = mtch[2]; d = mtch[1];
382 if (m.length == 1) m = '0'+m;
383 if (d.length == 1) d = '0'+d;
384 dt2 = y+m+d;
385 if (dt1==dt2) return 0;
386 if (dt1<dt2) return -1;
387 return 1;
389 sort_mmdd: function(a,b) {
390 mtch = a[0].match(sorttable.DATE_RE);
391 y = mtch[3]; d = mtch[2]; m = mtch[1];
392 if (m.length == 1) m = '0'+m;
393 if (d.length == 1) d = '0'+d;
394 dt1 = y+m+d;
395 mtch = b[0].match(sorttable.DATE_RE);
396 y = mtch[3]; d = mtch[2]; m = mtch[1];
397 if (m.length == 1) m = '0'+m;
398 if (d.length == 1) d = '0'+d;
399 dt2 = y+m+d;
400 if (dt1==dt2) return 0;
401 if (dt1<dt2) return -1;
402 return 1;
405 shaker_sort: function(list, comp_func) {
406 // A stable sort function to allow multi-level sorting of data
407 // see: http://en.wikipedia.org/wiki/Cocktail_sort
408 // thanks to Joseph Nahmias
409 var b = 0;
410 var t = list.length - 1;
411 var swap = true;
413 while(swap) {
414 swap = false;
415 for(var i = b; i < t; ++i) {
416 if ( comp_func(list[i], list[i+1]) > 0 ) {
417 var q = list[i]; list[i] = list[i+1]; list[i+1] = q;
418 swap = true;
420 } // for
421 t-=1;
423 if (!swap) break;
425 for(var i = t; i > b; i-=1) {
426 if ( comp_func(list[i], list[i-1]) < 0 ) {
427 var q = list[i]; list[i] = list[i-1]; list[i-1] = q;
428 swap = true;
430 } // for
431 b++;
433 } // while(swap)
437 /* ******************************************************************
438 Supporting functions: bundled here to avoid depending on a library
439 ****************************************************************** */
441 // Dean Edwards/Matthias Miller/John Resig
443 /* for Mozilla/Opera9 */
444 if (document.addEventListener) {
445 document.addEventListener("DOMContentLoaded", sorttable.init, false);
448 /* for Internet Explorer */
449 /*@cc_on @*/
450 /*@if (@_win32)
451 document.write("<script id=__ie_onload defer src=javascript:void(0)><\/script>");
452 var script = document.getElementById("__ie_onload");
453 script.onreadystatechange = function() {
454 if (this.readyState == "complete") {
455 sorttable.init(); // call the onload handler
458 /*@end @*/
460 /* for Safari */
461 if (/WebKit/i.test(navigator.userAgent)) { // sniff
462 var _timer = setInterval(function() {
463 if (/loaded|complete/.test(document.readyState)) {
464 sorttable.init(); // call the onload handler
466 }, 10);
469 /* for other browsers */
470 window.onload = sorttable.init;
472 // written by Dean Edwards, 2005
473 // with input from Tino Zijdel, Matthias Miller, Diego Perini
475 // http://dean.edwards.name/weblog/2005/10/add-event/
477 function dean_addEvent(element, type, handler) {
478 if (element.addEventListener) {
479 element.addEventListener(type, handler, false);
480 } else {
481 // assign each event handler a unique ID
482 if (!handler.\$\$guid) handler.\$\$guid = dean_addEvent.guid++;
483 // create a hash table of event types for the element
484 if (!element.events) element.events = {};
485 // create a hash table of event handlers for each element/event pair
486 var handlers = element.events[type];
487 if (!handlers) {
488 handlers = element.events[type] = {};
489 // store the existing event handler (if there is one)
490 if (element["on" + type]) {
491 handlers[0] = element["on" + type];
494 // store the event handler in the hash table
495 handlers[handler.\$\$guid] = handler;
496 // assign a global event handler to do all the work
497 element["on" + type] = handleEvent;
500 // a counter used to create unique IDs
501 dean_addEvent.guid = 1;
503 function removeEvent(element, type, handler) {
504 if (element.removeEventListener) {
505 element.removeEventListener(type, handler, false);
506 } else {
507 // delete the event handler from the hash table
508 if (element.events && element.events[type]) {
509 delete element.events[type][handler.\$\$guid];
514 function handleEvent(event) {
515 var returnValue = true;
516 // grab the event object (IE uses a global event object)
517 event = event || fixEvent(((this.ownerDocument || this.document || this).parentWindow || window).event);
518 // get a reference to the hash table of event handlers
519 var handlers = this.events[event.type];
520 // execute each event handler
521 for (var i in handlers) {
522 this.\$\$handleEvent = handlers[i];
523 if (this.\$\$handleEvent(event) === false) {
524 returnValue = false;
527 return returnValue;
530 function fixEvent(event) {
531 // add W3C standard event methods
532 event.preventDefault = fixEvent.preventDefault;
533 event.stopPropagation = fixEvent.stopPropagation;
534 return event;
536 fixEvent.preventDefault = function() {
537 this.returnValue = false;
539 fixEvent.stopPropagation = function() {
540 this.cancelBubble = true;
543 // Dean's forEach: http://dean.edwards.name/base/forEach.js
545 forEach, version 1.0
546 Copyright 2006, Dean Edwards
547 License: http://www.opensource.org/licenses/mit-license.php
550 // array-like enumeration
551 if (!Array.forEach) { // mozilla already supports this
552 Array.forEach = function(array, block, context) {
553 for (var i = 0; i < array.length; i++) {
554 block.call(context, array[i], i, array);
559 // generic enumeration
560 Function.prototype.forEach = function(object, block, context) {
561 for (var key in object) {
562 if (typeof this.prototype[key] == "undefined") {
563 block.call(context, object[key], key, object);
568 // character enumeration
569 String.forEach = function(string, block, context) {
570 Array.forEach(string.split(""), function(chr, index) {
571 block.call(context, chr, index, string);
575 // globally resolve forEach enumeration
576 var forEach = function(object, block, context) {
577 if (object) {
578 var resolve = Object; // default
579 if (object instanceof Function) {
580 // functions have a "length" property
581 resolve = Function;
582 } else if (object.forEach instanceof Function) {
583 // the object implements a custom forEach method so use that
584 object.forEach(block, context);
585 return;
586 } else if (typeof object == "string") {
587 // the object is a string
588 resolve = String;
589 } else if (typeof object.length == "number") {
590 // the object is array-like
591 resolve = Array;
593 resolve.forEach(object, block, context);
597 </script>
598 <style type='text/css'>
599 table
601 font-family: Verdana, sans-serif; font-size: 12px;
602 color: black;
603 border: solid 1px black;
605 table tbody td
607 border: solid 1px black;
608 padding: 2px;
610 table.center
612 margin-left:auto;
613 margin-right:auto;
615 h1, h2
617 text-align: center;
619 </style>
620 </head>
621 <body>
622 <h1>Moonlight Test Sites</h1>
623 <center>
624 <p>This is a list of various Silverlight websites that we are using to test Moonlight, and the current status of each test.
625 To edit this page, modify trunk/moon/demo-status.txt.</p>
626 <p>The rating of each site is a somewhat arbitrary rank of 0-4 based on the functionality and appearance of the site.
627 </p>
628 </center>
629 <br/>
630 <table class='sortable center'>
631 <tr>
632 <th width='50'>Rating</th><th width='100'>Icons</th><th>Description</th></tr>
633 <tr><td>-1</td><td>$STAR_N1</td>
634 <td>Site url is broken or the application is broken on Silverlight</td></tr>
636 <tr><td>0</td><td>$STAR_0</td>
637 <td>Site has no functionality or crashes Firefox</td></tr>
639 <tr><td>1</td><td>$STAR_1</td>
640 <td>Site has minimal functionality and/or major cosmetic issues.</td></tr>
642 <tr><td>2</td><td>$STAR_2</td>
643 <td>Site has some functionality and/or cosmetic issues</td></tr>
645 <tr><td>3</td><td>$STAR_3</td>
646 <td>Site has most features working and/or has minor cosmetic issues</td></tr>
648 <tr><td>4</td><td>$STAR_4</td>
649 <td>All feature of the site work reliably and has proper appearance</td></tr>
650 </table>
651 <br/>
653 <table class='sortable center'>
654 <tr><th width='100'>Rating</th><th width='200'>Site</th><th width='600'>Comments</th></tr>
655 $ROWS
656 </table>
658 </body>
659 </html>
662 #exit $RESULT