archive.html 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>TechREC</title>
  5. <link rel="icon" href="/static/img/icon.ico" />
  6. <link rel="stylesheet" type="text/css" href="/static/css/pure-min.css" />
  7. <link rel="stylesheet" type="text/css" href="/static/css/pure-skin-porpora.css" />
  8. <link rel="stylesheet" type="text/css" href="/static/css/jquery-ui.min.css" />
  9. <link rel="stylesheet" type="text/css" href="/static/css/techrec.css">
  10. <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.css" />
  11. <script src="/static/js/jquery-1.9.1.min.js"></script>
  12. <script src="/static/js/jquery-ui.min.js"></script>
  13. <script src="/static/js/jquery.ui.datepicker-it.min.js"></script>
  14. <script src="/static/js/rec.js"></script>
  15. <script>
  16. function delta(end, start) {
  17. //end, start are unix timestamps
  18. diff = parseInt(end, 10) - parseInt(start, 10); //diff is in seconds
  19. msec = diff*1000;
  20. var hh = Math.floor(msec / 1000 / 60 / 60);
  21. msec -= hh * 1000 * 60 * 60;
  22. var mm = Math.floor(msec / 1000 / 60);
  23. msec -= mm * 1000 * 60;
  24. var ss = Math.floor(msec / 1000);
  25. msec -= ss * 1000;
  26. if(hh === 0) {
  27. if(mm === 0) {
  28. return ss + 's';
  29. }
  30. return mm + 'min ' + ss + 's';
  31. }
  32. return hh + 'h ' + mm + 'm ' + ss + 's';
  33. }
  34. $(function() {
  35. "use strict";
  36. RecAPI.get_archive().success(function(archive) {
  37. /* To get sorted traversal, we need to do an array containing keys */
  38. var keys = [];
  39. for(var prop in archive) {
  40. keys.push(prop);
  41. }
  42. keys.sort(function(a,b) { return b - a; }); //descending
  43. /* ok, now we can traverse the objects */
  44. for(var i =0; i < keys.length; i++) {
  45. var rec = archive[keys[i]];
  46. console.log(rec);
  47. var name = $('<td/>').text(rec.name);
  48. var start = $('<td/>').text(config.date_read(
  49. parseInt(rec.starttime, 10)).toLocaleString()
  50. );
  51. var duration = $('<td/>').text(delta(rec.endtime, rec.starttime));
  52. var dl_text = $('<span/>').text(" Scarica").addClass('pure-hidden-phone');
  53. var fn = $("<td/>").append($("<a/>").prop("href", "/output/" +
  54. rec.filename).addClass("pure-button pure-button-small")
  55. .html( $("<i/>").addClass("fa fa-download").css("color", "green"))
  56. .append(dl_text));
  57. var row = $('<tr/>').append(name).append(start).append(duration).append(fn);
  58. $('#ongoing-recs-table tbody').append(row);
  59. }
  60. });
  61. });
  62. </script>
  63. </head>
  64. <body class="pure-skin-porpora">
  65. <div class="pure-menu pure-menu-open pure-menu-horizontal">
  66. <a href="#" class="pure-menu-heading">TechRec</a>
  67. <ul>
  68. <li><a href="new.html">Diretta</a></li>
  69. <li><a href="old.html">Vecchie</a></li>
  70. <li class="pure-menu-selected"><a href="archive.html">Archivio</a></li>
  71. </ul>
  72. </div>
  73. <h1>Registrazioni gi&agrave; completate</h1>
  74. <div id="rec-normal" class="pure-g-r">
  75. <div class="pure-u-1-8"></div>
  76. <div class="pure-u-3-4">
  77. <table width="100%" class="pure-table pure-table-horizontal pure-table-striped"
  78. id="ongoing-recs-table" style="margin-top: 3em;">
  79. <tbody>
  80. <tr>
  81. <th>Nome</th>
  82. <th>Inizio</th>
  83. <th>Durata</th>
  84. <th>File</th>
  85. </tr>
  86. </tbody>
  87. </table>
  88. </div>
  89. <div class="pure-u-1-8"></div>
  90. </div>
  91. </body>
  92. </html>
  93. <!-- vim: set ts=2 sw=2 noet: -->