HTML: export dive events to detailed view

Add table of dive events to the dive detailed view. This should view
each event, its type and the time this event took place.

Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com>
Signed-off-by: Miika Turkia <miika.turkia@gmail.com>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Gehad elrobey 2014-06-24 21:40:06 +03:00 committed by Dirk Hohndel
parent b438158693
commit 10345d62fc
2 changed files with 37 additions and 0 deletions

View file

@ -825,6 +825,29 @@ function get_cylinders_HTML(dive)
return result;
}
/**
Return the HTML string for a bookmark entry in the table.
*/
function get_bookmark_HTML(event)
{
return '<tr><td class="Cyl">' + event.name + '</td><td class="Cyl">' + event.time + '</td></tr>';
}
/**
*Return HTML table of bookmarks of a dive.
*/
function get_bookmarks_HTML(dive)
{
var result = "";
result += '<h2 class="det_hed">Events</h2><table><tr><td class="words">Name</td><td class="words">Time</td></tr>';
for (var i in dive.events) {
result += get_bookmark_HTML(dive.events[i]);
}
result += '</table>';
return result;
}
/**
*Return HTML main data of a dive
*/
@ -886,6 +909,7 @@ function showDiveDetails(dive)
canvas_draw();
document.getElementById("diveinfo").innerHTML = get_dive_HTML(items[dive_id]);
document.getElementById("dive_equipments").innerHTML = get_cylinders_HTML(items[dive_id]);
document.getElementById("bookmarks").innerHTML=get_bookmarks_HTML(items[dive_id]);
//hide the list of dives and show the canvas.
document.getElementById("diveListPanel").style.display = 'none';