From 311ce7373c05ee7c66f4428391fa7002f397409d Mon Sep 17 00:00:00 2001 From: "H.Plato" Date: Thu, 30 Mar 2017 14:35:13 -0600 Subject: [PATCH 1/2] IA7 v1.3.630 - get json_store.objects if opening up a non-root page --- web/ia7/house/main.shtml | 2 +- web/ia7/include/javascript.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/web/ia7/house/main.shtml b/web/ia7/house/main.shtml index bedabfbb0..1826494f9 100644 --- a/web/ia7/house/main.shtml +++ b/web/ia7/house/main.shtml @@ -82,7 +82,7 @@

MisterHouse was created by Bruce Winter. Ron Klinkien developed the v2.3 web interface. Kevin Robert Keegan - designed the v4 web prototype, updates by H.Plato. IA7 v1.3.620 Font Awesome by Dave Gandy - http://fontawesome.io

+ designed the v4 web prototype, updates by H.Plato. IA7 v1.3.630 Font Awesome by Dave Gandy - http://fontawesome.io

diff --git a/web/ia7/include/javascript.js b/web/ia7/include/javascript.js index 961cc4dde..901826d61 100644 --- a/web/ia7/include/javascript.js +++ b/web/ia7/include/javascript.js @@ -1,4 +1,4 @@ -// v1.3.610 +// v1.3.630 var entity_store = {}; //global storage of entities var json_store = {}; @@ -168,7 +168,7 @@ function changePage (){ notifications = "enabled"; } } - if (getJSONDataByPath("collections") === undefined){ + if (getJSONDataByPath("collections") === undefined || json_store.objects === undefined){ // We need at minimum the basic collections data to render all pages // (the breadcrumb) // NOTE may want to think about how to handle dynamic changes to the From 86b6888147bf8cd024eced589f0c7545db0c4cdc Mon Sep 17 00:00:00 2001 From: "H.Plato" Date: Thu, 30 Mar 2017 15:20:38 -0600 Subject: [PATCH 2/2] Add in time check for type=Type and type=Category and don't send the same data if present --- lib/json_server.pl | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/json_server.pl b/lib/json_server.pl index 33efe66ee..b8436e5da 100755 --- a/lib/json_server.pl +++ b/lib/json_server.pl @@ -528,8 +528,12 @@ sub json_get { 'type' => 'Category', 'members' => '' }; - if ( filter_object( $temp_object, \%args ) ) { - $json_data{objects}{$category} = $temp_object; + # if a time has been supplied, then the client data has been initialized, and we don't need to send it again + # if a category gets added, it won't refresh, but that's rare and this prevents the clients from continually sending data + unless ( $args{time} && $args{time}[0] > 0 ) { + if ( filter_object( $temp_object, \%args ) ) { + $json_data{objects}{$category} = $temp_object; + } } } @@ -541,8 +545,12 @@ sub json_get { 'type' => 'Type', 'members' => '' }; - if ( filter_object( $temp_object, \%args ) ) { - $json_data{objects}{$type} = $temp_object; + # if a time has been supplied, then the client data has been initialized, and we don't need to send it again + # if a category gets added, it won't refresh, but that's rare and this prevents the clients from continually sending data + unless ( $args{time} && $args{time}[0] > 0 ) { + if ( filter_object( $temp_object, \%args ) ) { + $json_data{objects}{$type} = $temp_object; + } } } } @@ -922,7 +930,7 @@ sub json_object_detail { #To avoid missed changes, since they can happen at the millisecond level, give a second's cushion #Object has not changed since time, so return undefined return; - } + } } my %json_objects;