|
27 | 27 | <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
28 | 28 | <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
29 | 29 | <![endif]-->
|
| 30 | +<style> |
| 31 | +table, th, td { |
| 32 | + border: 1px solid black; |
| 33 | +} |
| 34 | +</style> |
30 | 35 | </head>
|
31 | 36 |
|
32 | 37 | <body>
|
|
35 | 40 | <?php include 'fragments/navbar.html';?>
|
36 | 41 | </nav>
|
37 | 42 |
|
| 43 | + |
38 | 44 | <?php
|
39 |
| -// read data from local file |
40 |
| -$filter = "nightly"; |
41 |
| -$githubCacheFile = "githubdata_" . $filter . "_cache.tmp"; |
42 |
| -$githubUrl = "https://api.github.com/repos/jantje/arduino-eclipse-plugin/issues?labels=status:%20fixed%20in%20" . $filter; |
43 |
| -$issuesJson = ""; |
44 |
| -// echo "Testing existance of ".$githubCacheFile."<br/>\n"; |
45 |
| -if (file_exists ( $githubCacheFile )) { |
46 |
| - // echo $githubCacheFile." exists<br/>\n"; |
47 |
| - $GithubCacheFileDate = filectime ( $githubCacheFile ); |
48 |
| - if (time () <= $GithubCacheFileDate + (60 * 2)) { |
49 |
| - $issuesJson = file_get_contents ( $githubCacheFile ); |
50 |
| - // echo "using cache<br/>\n"; |
| 45 | +function cachedGithubJson($cachefile, $url) { |
| 46 | +// echo "geting cached data from url: <a href=" . $url . ">" . $url . "</a><br>\n"; |
| 47 | +// echo "Testing existance of " . $cachefile . "<br/>\n"; |
| 48 | + if (file_exists ( $cachefile )) { |
| 49 | +// echo $cachefile . " exists<br/>\n"; |
| 50 | + $CacheFileDate = filectime ( $cachefile ); |
| 51 | + if (time () <= $CacheFileDate + (60 * 20)) { |
| 52 | + $ret = file_get_contents ( $cachefile ); |
| 53 | + if (strlen ( $ret ) > 10) { |
| 54 | +// echo "using cache<br/>\n"; |
| 55 | + } else { |
| 56 | +// echo "Local cache is empty<br/>\n"; |
| 57 | + $ret = ""; |
| 58 | + } |
| 59 | + } else { |
| 60 | +// echo $cachefile . " Is old<br/>\n"; |
| 61 | + } |
| 62 | + } else { |
| 63 | +// echo $cachefile . " does not exists<br/>\n"; |
51 | 64 | }
|
52 |
| - // else{ |
53 |
| - // echo $githubCacheFile." Is old<br/>\n"; |
54 |
| - // } |
55 |
| -} |
56 |
| -// else{ |
57 |
| -// echo $githubCacheFile." does not exists<br/>\n"; |
58 |
| -// } |
59 |
| -if ($issuesJson == "") { |
60 |
| - $issuesJson = file_get_contents ( $githubUrl ); |
61 |
| - file_put_contents ( $githubCacheFile, $issuesJson ); |
62 |
| - // echo "refreshing cache<br/>\n"; |
| 65 | + if ($ret == "") { |
| 66 | + $ret = file_get_contents ( $url ); |
| 67 | + if ($ret === false) { |
| 68 | +// echo "<strong>failed</strong><br>\n"; |
| 69 | + $ret = file_get_contents ( $cachefile ); |
| 70 | + } else { |
| 71 | + file_put_contents ( $cachefile, $ret ); |
| 72 | + } |
| 73 | + } |
| 74 | + return $ret; |
63 | 75 | }
|
64 |
| -$issues = json_decode ( $issuesJson, true ); |
65 |
| -// var_dump($issues); |
| 76 | + |
| 77 | +function dumpIssues($issues){ |
| 78 | + echo "<table>\n"; |
| 79 | +echo "<tr><th>title</th><th>domain</th><th>importance</th><th>os</th><th>other</th></tr>"; |
66 | 80 | foreach ( $issues as $issue ) {
|
67 |
| - echo "<div><a href=" . $issue ["html_url"] . ">" . $issue ["title"] . "</a> "; |
| 81 | + $title = "<a href=" . $issue ["html_url"] . ">" . $issue ["title"] . "</a> "; |
| 82 | + $domain_label = ""; |
| 83 | + $importance_label = ""; |
| 84 | + $os_label = ""; |
| 85 | + $rest_label = ""; |
| 86 | + $importance_inbetween = ""; |
| 87 | + $domain_inbetween = ""; |
| 88 | + $os_inbetween = ""; |
| 89 | + $rest_inbetween = ""; |
| 90 | + |
68 | 91 | foreach ( $issue ["labels"] as $label ) {
|
69 |
| - echo '<SPAN style="background-color: #' . $label ["color"] . ';"> ' . $label ["name"] . " </SPAN> "; |
| 92 | + if (0 === strpos ( $label ["name"], "domain: " )) { |
| 93 | + $domain_label = $domain_label . $domain_inbetween . '<SPAN style="background-color: #' . $label ["color"] . ';"> <b>' . substr ( $label ["name"], 8 ) . " </b></SPAN> "; |
| 94 | + $domain_inbetween = "<br>"; |
| 95 | + } elseif (0 === strpos ( $label ["name"], "importance: " )) { |
| 96 | + $importance_label = $importance_label . $importance_inbetween . '<SPAN style="background-color: #' . $label ["color"] . ';"> <b>' . substr ( $label ["name"], 12 ) . " </b></SPAN> "; |
| 97 | + $importance_inbetween = "<br>"; |
| 98 | + } elseif (0 === strpos ( $label ["name"], "OS: " )) { |
| 99 | + $os_label = $os_label . $os_inbetween .'<SPAN style="background-color: #' . $label ["color"] . ';"> <b>' . substr ( $label ["name"], 4 ) . " </b></SPAN> "; |
| 100 | + $os_inbetween = "<br>"; |
| 101 | + } elseif (0 === strpos($label["name"], "status: fixed in")){ |
| 102 | + // ignore fixed status as this is per table |
| 103 | + } |
| 104 | + else { |
| 105 | + $rest_label = $rest_label . $rest_inbetween . '<SPAN style="background-color: #' . $label ["color"] . ';"> <b>' . $label ["name"] . " </b></SPAN> "; |
| 106 | + $rest_inbetween = "<br>"; |
| 107 | + } |
70 | 108 | }
|
71 |
| - echo "</div><br />\n"; |
| 109 | + echo "<tr><td>" . $title . "</td>"; |
| 110 | + echo "<td>" . $domain_label . "</td>"; |
| 111 | + echo "<td>" . $importance_label . "</td>"; |
| 112 | + echo "<td>" . $os_label . "</td>"; |
| 113 | + echo "<td>" . $rest_label . "</td>"; |
| 114 | + echo "</tr>\n"; |
| 115 | +} |
| 116 | +echo "</table>"; |
| 117 | +} |
| 118 | + |
| 119 | +// read data from local file |
| 120 | +$labelsJson = cachedGithubJson ( "githubdata_labels_cache.tmp", "https://api.github.com/repos/Sloeber/arduino-eclipse-plugin/labels?per_page=100" ); |
| 121 | +$labels = json_decode ( $labelsJson, true ); |
| 122 | +$fixedLabels=""; |
| 123 | +foreach ( $labels as $label ) { |
| 124 | + if (0 === strpos ( $label ["name"], "status: fixed in " )) { |
| 125 | + $curLabelversion=substr ( $label ["name"], 17 ) ; |
| 126 | + echo "fixed in " . $label["name"] ."<br>"; |
| 127 | + $CurIssuesJson = cachedGithubJson ( "githubdata_".$curLabelversion."_cache.tmp", "https://api.github.com/repos/Sloeber/arduino-eclipse-plugin/issues?state=all&labels=" . urlencode($label ["name"])); |
| 128 | + $CurIssues = json_decode ( $CurIssuesJson, true ); |
| 129 | + dumpIssues($CurIssues); |
| 130 | + } |
72 | 131 | }
|
73 | 132 |
|
| 133 | + |
74 | 134 | ?>
|
75 | 135 |
|
76 | 136 | <div id="footer">
|
|
0 commit comments