summaryrefslogtreecommitdiffstats
path: root/save-html.c
diff options
context:
space:
mode:
authorGravatar Gehad elrobey <gehadelrobey@gmail.com>2014-06-24 21:40:06 +0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-06-30 07:56:12 -0700
commit10345d62fcb3bbe16d1c048e281f37e8570c4a19 (patch)
tree05589c4db4dd352f8c59a107f4ab1ef30ba7caf8 /save-html.c
parentb438158693b54ed0e9359184a075947dcd602790 (diff)
downloadsubsurface-10345d62fcb3bbe16d1c048e281f37e8570c4a19.tar.gz
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>
Diffstat (limited to 'save-html.c')
-rw-r--r--save-html.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/save-html.c b/save-html.c
index 6ce0f3ab7..bad1ef41c 100644
--- a/save-html.c
+++ b/save-html.c
@@ -11,6 +11,18 @@ void write_attribute(struct membuffer *b, const char *att_name, const char *valu
put_string(b, "\",");
}
+void put_HTML_bookmarks(struct membuffer *b, struct dive *dive)
+{
+ struct event *ev = dive->dc.events;
+ put_string(b, "\"events\":[");
+ while (ev) {
+ put_format(b, "{\"name\":\"%s\",", ev->name);
+ put_format(b, "\"time\":\"%d:%02d min\",},", FRACTION(ev->time.seconds, 60));
+ ev = ev->next;
+ }
+ put_string(b, "],");
+}
+
static void put_cylinder_HTML(struct membuffer *b, struct dive *dive)
{
int i, nr;
@@ -155,6 +167,7 @@ void write_one_dive(struct membuffer *b, struct dive *dive, int *dive_no, const
if (!list_only) {
put_cylinder_HTML(b, dive);
put_HTML_samples(b, dive);
+ put_HTML_bookmarks(b, dive);
}
put_string(b, "},\n");
(*dive_no)++;