mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
HTML: Save divecomputer data to the HTML exports
Save divecomputers data to the JSON files. and show them in the HTML dive detailed view. Fixes #711 Signed-off-by: Gehad elrobey <gehadelrobey@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
7fa8fd0e6b
commit
d00390d46d
2 changed files with 37 additions and 1 deletions
17
save-html.c
17
save-html.c
|
@ -25,6 +25,22 @@ void save_photos(struct membuffer *b, const char *photos_dir, struct dive *dive)
|
||||||
put_string(b, "],");
|
put_string(b, "],");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void write_divecomputers(struct membuffer *b, struct dive *dive)
|
||||||
|
{
|
||||||
|
put_string(b, "\"divecomputers\":[");
|
||||||
|
struct divecomputer *dc;
|
||||||
|
for_each_dc(dive, dc) {
|
||||||
|
put_format(b, "{");
|
||||||
|
write_attribute(b, "model", dc->model);
|
||||||
|
if (dc->deviceid)
|
||||||
|
put_format(b, "\"deviceid\":\"%08x\",", dc->deviceid);
|
||||||
|
if (dc->diveid)
|
||||||
|
put_format(b, "\"diveid\":\"%08x\",", dc->diveid);
|
||||||
|
put_format(b, "},");
|
||||||
|
}
|
||||||
|
put_string(b, "],");
|
||||||
|
}
|
||||||
|
|
||||||
void write_dive_status(struct membuffer *b, struct dive *dive)
|
void write_dive_status(struct membuffer *b, struct dive *dive)
|
||||||
{
|
{
|
||||||
put_format(b, "\"sac\":\"%d\",", dive->sac);
|
put_format(b, "\"sac\":\"%d\",", dive->sac);
|
||||||
|
@ -245,6 +261,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, const char *photos_d
|
||||||
put_HTML_bookmarks(b, dive);
|
put_HTML_bookmarks(b, dive);
|
||||||
write_dive_status(b, dive);
|
write_dive_status(b, dive);
|
||||||
save_photos(b, photos_dir, dive);
|
save_photos(b, photos_dir, dive);
|
||||||
|
write_divecomputers(b, dive);
|
||||||
}
|
}
|
||||||
put_string(b, "},\n");
|
put_string(b, "},\n");
|
||||||
(*dive_no)++;
|
(*dive_no)++;
|
||||||
|
|
|
@ -941,10 +941,29 @@ function get_dive_HTML(dive)
|
||||||
'</td></tr><tr><td class="words"><p>' + translate.Buddy + ': </p></td><td>' + dive.buddy +
|
'</td></tr><tr><td class="words"><p>' + translate.Buddy + ': </p></td><td>' + dive.buddy +
|
||||||
'</td></tr><tr><td class="words">' + translate.Suit + ': </td><td>' + dive.suit +
|
'</td></tr><tr><td class="words">' + translate.Suit + ': </td><td>' + dive.suit +
|
||||||
'</td></tr><tr><td class="words">' + translate.Tags + ': </td><td>' + putTags(dive.tags) +
|
'</td></tr><tr><td class="words">' + translate.Tags + ': </td><td>' + putTags(dive.tags) +
|
||||||
'</td></tr></table><div style="margin:10px;"><p class="words">' + translate.Notes + ': </p>' + dive.notes + '</div>';
|
'</td></tr></table>'+ put_divecomputer_details(dive.divecomputers) +'<div style="margin:10px;"><p class="words">' + translate.Notes + ': </p>' + dive.notes + '</div>';
|
||||||
return res;
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function put_divecomputer_details(dc)
|
||||||
|
{
|
||||||
|
if (dc.length <= 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
var res = '';
|
||||||
|
res += '<p style="margin:10px;" class="words">Divecomputer:</p>';
|
||||||
|
for (var i =0; i < dc.length; i++) {
|
||||||
|
res += '<table>';
|
||||||
|
res += '<tr><td>Model : </td><td>' + dc[i].model + '</td></tr>';
|
||||||
|
if (dc[i].deviceid)
|
||||||
|
res += '<tr><td>Device ID : </td><td>' + dc[i].deviceid + '</td></tr>';
|
||||||
|
if (dc[i].diveid)
|
||||||
|
res += '<tr><td>Dive ID : </td><td>' + dc[i].diveid + '</td></tr>';
|
||||||
|
res += '</table><br>';
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*Return HTML dive status data
|
*Return HTML dive status data
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Reference in a new issue