From 9d49c7fd1032330050462ae86ec64e89924d5a35 Mon Sep 17 00:00:00 2001 From: xdrm-brackets Date: Sun, 12 Nov 2017 18:34:52 +0100 Subject: [PATCH] Now on click on timeline.event -> load this event entry --- build/generic/view/history/details/main.php | 9 +++++---- public_html/view/js/history.js | 4 +++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build/generic/view/history/details/main.php b/build/generic/view/history/details/main.php index 4817f37..4d1c630 100644 --- a/build/generic/view/history/details/main.php +++ b/build/generic/view/history/details/main.php @@ -83,7 +83,7 @@ return ''; /* (4) Useful variables */ - $y_pad = 80; // padding between each node + $y_pad = 50; // padding between each node $line_pad = 50; // padding on each LINE end $line_height = ( $cl + 1 ) * $y_pad; // line height (each node * @y_pad + @y_pad) $height = $line_height + 2*$line_pad; // svg height @@ -153,11 +153,12 @@ /* (3) Get useful data */ $action_class = strtolower($entry['action_name']); $icon_uri = '/src/static/timeline/'.$action_class.'@ffffff.svg'; - $data_user = "data-user='".$entry['user_name']."'"; + $data_entry = "data-entry='".$entry['id_history']."'"; + $data_user = " data-user='".$entry['user_name']."'"; $data_machine = " data-machine='".$entry['machine_name']."'"; $data_action = " data-action='".$entry['action_name']."'"; $data_time = " data-time='".date('H:i:s d/m/Y', $entry['timestamp'])."'"; - $data_tags = $data_user.$data_machine.$data_action.$data_time; + $data_tags = $data_entry.$data_user.$data_machine.$data_action.$data_time; $y_img = $y - 5.5; @@ -178,7 +179,7 @@ /* (6) Hour */ $x_decal = $x + 25; $y_decal = $y + 5; - $RAW .= "".date('H:i:s', $entry['timestamp']).""; + $RAW .= "".date('H:i:s', $entry['timestamp'])." - ".$entry['user_name'].""; diff --git a/public_html/view/js/history.js b/public_html/view/js/history.js index 544e084..bf7db01 100644 --- a/public_html/view/js/history.js +++ b/public_html/view/js/history.js @@ -203,6 +203,8 @@ if( section.details.element != null ){ /* (1) Set click handler */ section.details.event.handler = function(target){ + pageManager.vars[1] = target.getData('entry'); + pageManager.refresh(); // section.details.info.element.addClass('active'); console.log('show infobox on element', target); @@ -212,7 +214,7 @@ if( section.details.element != null ){ section.details.svg.element.addEventListener('click', function(e){ // {1} Trigger function only if element is an 'around circle' // - if( e.target.nodeName && e.target.getData('user') && e.target.getData('machine') && e.target.getData('action') && e.target.getData('time') ) + if( e.target.nodeName && e.target.getData('entry') && e.target.getData('user') && e.target.getData('machine') && e.target.getData('action') && e.target.getData('time') ) section.details.event.handler(e.target); }, false);