Unfinished activity ('quantified self') tracker
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

index.php 4.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
  2. <html>
  3. <head>
  4. <title>Chris tracking</title>
  5. <script src="res/prototype.js" type="text/javascript"></script>
  6. <script type="text/javascript">
  7. function doFilter() {
  8. var params = new Hash();
  9. params.set('dummy', 'true');
  10. params.set('period', document.getElementById('period').value);
  11. var elements = document.getElementsByTagName('input');
  12. for (var i = 0; i < elements.length; i++) {
  13. var element = elements[i];
  14. if (element.type == 'checkbox' && element.checked) {
  15. params.set(element.id, 'true');
  16. }
  17. }
  18. params.set('sort', document.getElementById('sort').value);
  19. new Ajax.Updater('content', 'content.php', {parameters:params});
  20. return false;
  21. }
  22. Ajax.Responders.register({
  23. onCreate: function(request) {
  24. document.getElementById('loading').style.display = 'block';
  25. },
  26. onComplete: function(request) {
  27. document.getElementById('loading').style.display = 'none';
  28. }
  29. });
  30. </script>
  31. <style type="text/css">
  32. li.WikiSource { list-style-image: url('res/wiki.ico'); }
  33. li.SvnSource, li.DMDircSvnSource { list-style-image: url('res/svn.ico'); }
  34. li.WeightSource { list-style-image: url('res/weight.png'); }
  35. li.TransportSource { list-style-image: url('res/transport.ico'); }
  36. li.AudioscrobblerSource { list-style-image: url('res/lastfm.ico'); }
  37. li.AudioscrobblerSource li { list-style-image: none; list-style-type: decimal; }
  38. li.DMDircIssuesSource { list-style-image: url('res/dmdirc.ico'); }
  39. li { margin-bottom: 6px; }
  40. li ul li { margin-bottom: 2px; }
  41. #content {
  42. position: absolute;
  43. top: 20px;
  44. right: 250px;
  45. left: 20px;
  46. bottom: 20px;
  47. overflow: auto;
  48. border: 1px solid #aaa;
  49. padding: 10px;
  50. }
  51. #right {
  52. position: absolute;
  53. top: 20px;
  54. right: 20px;
  55. width: 210px;
  56. }
  57. #filter, #timespan, #sortbox {
  58. border: 1px solid #aaa;
  59. padding: 10px;
  60. margin-bottom: 20px;
  61. }
  62. input[type="checkbox"] {
  63. margin-right: 10px;
  64. }
  65. h2 {
  66. margin: 0px;
  67. }
  68. select {
  69. width: 100%;
  70. margin-top: 10px;
  71. }
  72. #loading {
  73. position: absolute;
  74. top: 50%;
  75. left: 50%;
  76. width: 100px;
  77. padding: 5px;
  78. margin-top: -0.75em;
  79. margin-left: -50px;
  80. background-color: #900;
  81. color: white;
  82. text-align: center;
  83. border: 0px;
  84. z-index: 100;
  85. }
  86. </style>
  87. </head>
  88. <body>
  89. <div id="loading" style="display: none;">
  90. Loading...
  91. </div>
  92. <div id="content">
  93. <?PHP require_once('content.php'); ?>
  94. </div>
  95. <div id="right">
  96. <form action="/tracker/" method="POST" onsubmit="return doFilter();">
  97. <input type="hidden" name="dummy" value="true">
  98. <div id="filter">
  99. <h2>Filter</h2>
  100. <ul id="filterlist">
  101. <?PHP
  102. foreach ($_SOURCES as $source) {
  103. $name = get_class($source);
  104. $nicename = preg_replace('/([a-z])([A-Z])/', '\1 \2', substr($name, 0, -6));
  105. $checked = '';
  106. if (empty($_POST) || isset($_POST[$name])) {
  107. $checked = ' checked="checked"';
  108. }
  109. echo '<li class="', $name,' "><label><input type="checkbox" id="', $name, '" name="', $name, '"', $checked, '>';
  110. echo $nicename, '</label>';
  111. }
  112. ?>
  113. </ul>
  114. </div>
  115. <div id="timespan">
  116. <h2>Timespan</h2>
  117. <select id="period" name="period">
  118. <?PHP
  119. foreach (array('day', 'week', 'month', 'year') as $timespan) {
  120. echo '<option value="', $timespan, '"';
  121. if ((isset($_POST['timespan']) && $_POST['timespan'] == $timespan)
  122. || (!isset($_POST['timespan']) && $timespan == 'week')) {
  123. echo ' selected="selected"';
  124. }
  125. echo '>', ucfirst($timespan), '</option>';
  126. }
  127. ?>
  128. </select>
  129. </div>
  130. <div id="sortbox">
  131. <h2>Sort order</h2>
  132. <select name="sort" id="sort">
  133. <?PHP
  134. foreach (array('forwards', 'backwards') as $timespan) {
  135. echo '<option value="', $timespan, '"';
  136. if ((isset($_POST['sort']) && $_POST['sort'] == $timespan)
  137. || (!isset($_POST['sort']) && $timespan == 'backwards')) {
  138. echo ' selected="selected"';
  139. }
  140. echo '>', ucfirst($timespan), '</option>';
  141. }
  142. ?>
  143. </select>
  144. </div>
  145. <input type="submit" value="Apply" id="filterbutton">
  146. </form>
  147. </div>
  148. </body>
  149. </html>