Skip to content

Commit

Permalink
Merge pull request #608 from hplato/ia7
Browse files Browse the repository at this point in the history
Ia7 fixes $version and hash issue
  • Loading branch information
hollie authored Jul 26, 2016
2 parents f7e97cf + 2025097 commit d65f8aa
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 10 deletions.
8 changes: 4 additions & 4 deletions code/common/ia7_collection_upgrader.pl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Category = IA7

#@ IA7 v1.2 : This is a helper utility that can find and update collections.json files
#@ IA7 Collection Updater v1.3 : This is a helper utility that can find and update collections.json files
#@ if any structural changes are required.
#@
#@ v1.2 - add in new login system id 700
Expand Down Expand Up @@ -35,14 +35,14 @@
}
push (@{$json_data->{500}->{children}},700) unless ($found);
$json_data->{meta}->{version} = "1.2";
print_log "[IA7_Collection_Updater] : Checking $file to version $ia7_coll_current_ver";
print_log "[IA7_Collection_Updater] : Updating $file to version 1.2";
$updated = 1;
}
if ($updated) {
my $json_newdata = to_json($json_data, {utf8 => 1, pretty => 1});
my $backup_file = $file . ".v" . $version . ".backup";
my $backup_file = $file . ".t" . int( ::get_tickcount() / 1000 ) . ".backup";
file_write($backup_file,$file_data);
print_log "[IA7_Collection_Updater] : Saved backup " . $file . ".v" . $version . ".backup";
print_log "[IA7_Collection_Updater] : Saved backup " . $file . ".t" . int( ::get_tickcount() / 1000 ) . ".backup";
file_write($file,$json_newdata);
}
}
Expand Down
12 changes: 8 additions & 4 deletions lib/json_server.pl
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ =head2 METHODS
=cut

#NOTE: Removed sort from line 454 for optimization.

use strict;

use RRDTool::Rawish;
Expand Down Expand Up @@ -215,8 +217,8 @@ sub json_get {
print_log
"Json_Server.pl: Client override section for $Http{Client_address} found";
for my $key (
keys $json_data{'ia7_config'}->{clients}
->{ $Http{Client_address} } )
keys %{$json_data{'ia7_config'}->{clients}
->{ $Http{Client_address} }} )
{
print_log
"Json_Server.pl: Client key=$key, value = $json_data{'ia7_config'}->{clients}->{$Http{Client_address}}->{$key}";
Expand Down Expand Up @@ -450,7 +452,8 @@ sub json_get {
push @objects, &list_objects_by_type($object_type);
}
}
foreach my $o ( map { &get_object_by_name($_) } sort @objects ) {
# foreach my $o ( map { &get_object_by_name($_) } sort @objects ) {
foreach my $o ( map { &get_object_by_name($_) } @objects ) {
next unless $o;
my $name = $o;
$name = $o->{object_name};
Expand Down Expand Up @@ -1033,14 +1036,15 @@ sub json_page {
my ($json_raw) = @_;
my $json;

#utf8::encode( $json_raw ); #may need to wrap gzip in an eval and encode it if errors develop. It crashes if a < is in the text
## utf8::encode( $json_raw ); #may need to wrap gzip in an eval and encode it if errors develop. It crashes if a < is in the text
gzip \$json_raw => \$json;
my $output = "HTTP/1.0 200 OK\r\n";
$output .= "Server: MisterHouse\r\n";
$output .= "Content-type: application/json\r\n";
$output .= "Content-Encoding: gzip\r\n";
$output .= "\r\n";
$output .= $json;
## $output .= $json_raw;

return $output;
}
Expand Down
24 changes: 22 additions & 2 deletions web/ia7/include/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -1689,9 +1689,29 @@ var fp_reposition_entities = function(){
"left": newx
};
};
var nwidth = $("#fp_graphic").get(0).naturalWidth;
fp_scale = Math.round( width/nwidth * 100);
// var nwidth = $("#fp_graphic").get(0).naturalWidth;
// var nwidth = $("#fp_graphic").width();
var nwidth;
//There are 2 sizing jumps in bootstrap.min.css one at 992 and another at 1200
//Scale icons if less than 991
//1-991
//@992 = 821 (171)
//@993 = 822
//@995 = 824
//@994 = 828 (166)
//@1100 = 991 (109)
//@1200 = 790
if (width < 992) {
nwidth = 992;
} else if (width < 1200) {
nwidth = 822;
} else {
nwidth = 790;
}

fp_scale = Math.round( width/nwidth * 100);

console.log("width="+width+" nwidth="+nwidth+" scale="+fp_scale);
// update the location of all the objects...
$(".floorplan_item").each(function(index) {
var classstr = $(this).attr("class");
Expand Down

0 comments on commit d65f8aa

Please sign in to comment.