This patches add the events to list to the detailed view.
This events will be rendered later to the profile.

Regards,
Gehad


On Wed, Jun 25, 2014 at 12:36 PM, Miika Turkia <miika.tur...@gmail.com>
wrote:

> Libdivecomputer.c has events structure that shows meaning of the events
> (function handle_event). Just check from a sample dive that I am correct.
> Tablet is a poor tool to check code...
>
> I believe the deleted means that user has deleted the event and does not
> want to see it anymore.
>
> miika
> On Jun 24, 2014 10:04 PM, "Gehad Elrobey" <gehadelro...@gmail.com> wrote:
>
>> I was lately working on exporting event list, I will send some patches
>> for that today.
>>
>> I don't understand well the event structure in dive.h , I don't know what
>> is the 'deleted' flag, and the type what do these numbers mean ? is there a
>> look-up table for there meaning or some enums? some help in this will be
>> appreciated.
>>
>> My to do for this week:
>>
>> - prototype the dive profile with jqplot (which is under GPL license).
>> - Fix the detailed view style (Tweak up the css)
>> - fix any semantic errors in the dive profile or the events list and add
>> missing values.
>> - will have some clean documentation and polishing to the javascript code.
>>
>> Regards,
>> Gehad
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Jun 24, 2014 at 4:41 PM, Dirk Hohndel <d...@hohndel.org> wrote:
>>
>>> On Tue, Jun 24, 2014 at 04:01:40PM +0300, Miika Turkia wrote:
>>> >
>>> > I will send Gehad's patch-set from the 17th with my signed-off as a
>>> > separate set of mail (using git e-mail), as poor Internet connection
>>> > over here forces me to use HTML-only gmail and that does not seem to
>>> > support attachments. I will skip the one from 19th that switches to
>>> > Highchart as the license is unfortunately not acceptable for
>>> > Subsurface.
>>>
>>> Thanks - I just applied them and will push in a moment, internet
>>> connection permitting :-)
>>>
>>> /D
>>>
>>
>>
From 30f06cebf55e8a5b2b1e0565602025d7aa1aa19f Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Thu, 26 Jun 2014 00:44:40 +0300
Subject: [PATCH 3/3] HTML: Add temperature and pressure curves to the JSON
 data.

Add more dive sample details to the JSON data.
This is not so optimized some zero values can be ignored.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 save-html.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/save-html.c b/save-html.c
index c6c0e8b..f5dcd34 100644
--- a/save-html.c
+++ b/save-html.c
@@ -65,7 +65,7 @@ void put_HTML_samples(struct membuffer *b, struct dive *dive)
 	put_string(b, "\"samples\":\[");
 	struct sample *s = dive->dc.sample;
 	for (i = 0; i < dive->dc.samples; i++) {
-		put_format(b, "[%d,%d],", s->time.seconds, s->depth.mm);
+		put_format(b, "[%d,%d,%d,%d],", s->time.seconds, s->depth.mm, s->cylinderpressure.mbar, s->temperature.mkelvin);
 		s++;
 	}
 	put_string(b, "],");
-- 
1.9.1

From 39e30622e6aa9c2e0e15ca7f9c7dd4ad2e27069e Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Wed, 25 Jun 2014 01:41:23 +0300
Subject: [PATCH 2/3] HTML: dive list must remember the last dive in display

When switching between dives in detailed view, The dive list must be
switched too.

Signed-off-by: Gehad elrobey <gehadelro...@gmail.com>
---
 theme/list_lib.js | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/theme/list_lib.js b/theme/list_lib.js
index 06acd5e..e5245d9 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -922,6 +922,8 @@ function showDiveDetails(dive)
 */
 function unshowDiveDetails(dive)
 {
+	start = dive_id;
+	viewInPage();
 	document.getElementById("diveListPanel").style.display = 'block';
 	document.getElementById("divePanel").style.display = 'none';
 }
-- 
1.9.1

From 14b797ab3814895de81a738abcb35231755eb966 Mon Sep 17 00:00:00 2001
From: Gehad elrobey <gehadelro...@gmail.com>
Date: Tue, 24 Jun 2014 21:40:06 +0300
Subject: [PATCH 1/3] 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 <gehadelro...@gmail.com>
---
 save-html.c       | 14 ++++++++++++++
 theme/list_lib.js | 24 ++++++++++++++++++++++++
 2 files changed, 38 insertions(+)

diff --git a/save-html.c b/save-html.c
index 6ce0f3a..c6c0e8b 100644
--- a/save-html.c
+++ b/save-html.c
@@ -11,6 +11,19 @@ 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, "{\"type\":\"%d\",", ev->type);
+		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 +168,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)++;
diff --git a/theme/list_lib.js b/theme/list_lib.js
index 20dc5a7..06acd5e 100644
--- a/theme/list_lib.js
+++ b/theme/list_lib.js
@@ -826,6 +826,29 @@ function get_cylinders_HTML(dive)
 }
 
 /**
+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.type + '</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>Bookmarks</h2><table><tr><td class="Cyl">Name</td><td class="Cyl">Type</td><td class="Cyl">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
 */
 function get_dive_HTML(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';
-- 
1.9.1

_______________________________________________
subsurface mailing list
subsurface@hohndel.org
http://lists.hohndel.org/cgi-bin/mailman/listinfo/subsurface

Reply via email to