123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>TechREC</title>
- <link rel="icon" href="/static/img/icon.ico" />
- <link rel="stylesheet" type="text/css" href="/static/css/pure-min.css" />
- <link rel="stylesheet" type="text/css" href="/static/css/pure-skin-porpora.css" />
- <link rel="stylesheet" type="text/css" href="/static/css/jquery-ui.min.css" />
- <link rel="stylesheet" type="text/css" href="/static/css/techrec.css">
- <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.css" />
- <script src="/static/js/jquery-1.9.1.min.js"></script>
- <script src="/static/js/jquery-ui.min.js"></script>
- <script src="/static/js/jquery.ui.datepicker-it.min.js"></script>
- <script src="/static/js/rec.js"></script>
- <script>
- function delta(end, start) {
- //end, start are unix timestamps
- diff = parseInt(end, 10) - parseInt(start, 10); //diff is in seconds
- msec = diff*1000;
- var hh = Math.floor(msec / 1000 / 60 / 60);
- msec -= hh * 1000 * 60 * 60;
- var mm = Math.floor(msec / 1000 / 60);
- msec -= mm * 1000 * 60;
- var ss = Math.floor(msec / 1000);
- msec -= ss * 1000;
- if(hh === 0) {
- if(mm === 0) {
- return ss + 's';
- }
- return mm + 'min ' + ss + 's';
- }
- return hh + 'h ' + mm + 'm ' + ss + 's';
- }
- $(function() {
- "use strict";
- RecAPI.get_archive().success(function(archive) {
- /* To get sorted traversal, we need to do an array containing keys */
- var keys = [];
- for(var prop in archive) {
- keys.push(prop);
- }
- keys.sort(function(a,b) { return b - a; }); //descending
- /* ok, now we can traverse the objects */
- for(var i =0; i < keys.length; i++) {
- var rec = archive[keys[i]];
- console.log(rec);
- var name = $('<td/>').text(rec.name);
- var start = $('<td/>').text(config.date_read(
- parseInt(rec.starttime, 10)).toLocaleString()
- );
- var duration = $('<td/>').text(delta(rec.endtime, rec.starttime));
- var dl_text = $('<span/>').text(" Scarica").addClass('pure-hidden-phone');
- var fn = $("<td/>").append($("<a/>").prop("href", "/output/" +
- rec.filename).addClass("pure-button pure-button-small")
- .html( $("<i/>").addClass("fa fa-download").css("color", "green"))
- .append(dl_text));
- var row = $('<tr/>').append(name).append(start).append(duration).append(fn);
- $('#ongoing-recs-table tbody').append(row);
- }
- });
- });
- </script>
- </head>
- <body class="pure-skin-porpora">
- <div class="pure-menu pure-menu-open pure-menu-horizontal">
- <a href="#" class="pure-menu-heading">TechRec</a>
- <ul>
- <li><a href="new.html">Diretta</a></li>
- <li><a href="old.html">Vecchie</a></li>
- <li class="pure-menu-selected"><a href="archive.html">Archivio</a></li>
- </ul>
- </div>
- <h1>Registrazioni già completate</h1>
- <div id="rec-normal" class="pure-g-r">
- <div class="pure-u-1-8"></div>
- <div class="pure-u-3-4">
- <table width="100%" class="pure-table pure-table-horizontal pure-table-striped"
- id="ongoing-recs-table" style="margin-top: 3em;">
- <tbody>
- <tr>
- <th>Nome</th>
- <th>Inizio</th>
- <th>Durata</th>
- <th>File</th>
- </tr>
- </tbody>
- </table>
- </div>
- <div class="pure-u-1-8"></div>
- </div>
- </body>
- </html>
- <!-- vim: set ts=2 sw=2 noet: -->
|