Skip to content

Commit

Permalink
Merge pull request #493 from hplato/ia7
Browse files Browse the repository at this point in the history
Further updates from @hplato regarding the new responsive web interface.
  • Loading branch information
hollie committed Mar 26, 2015
2 parents adf8ca4 + 174f825 commit da3714e
Show file tree
Hide file tree
Showing 18 changed files with 2,267 additions and 23 deletions.
1 change: 1 addition & 0 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -4185,6 +4185,7 @@ sub print_speaklog_current_time {

#print "db/mh/curr: time=" . &get_tickcount . " plt=$Print_Log_Time[0] slt=$Speak_Log_Time[0]\n";
return $Print_Log_Time[0] unless (scalar @Speak_Log_Time <= 0); #TODO HP should return $Speak_Log_Time
#return $Speak_Log_Time[0] unless (scalar @Speak_Log_Time <= 0); #TODO HP should return $Speak_Log_Time
return 0;
}

Expand Down
92 changes: 85 additions & 7 deletions data/web/collections.json
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@
"1" : {
"children" : [
13,
14,
15,
16,
17,
Expand Down Expand Up @@ -448,12 +447,12 @@
"link" : "/bin/shopping_list.pl"
},
"48" : {
"link" : "/ia5/modes/main.shtml",
"link" : "/ia7/house/modes.shtml",
"icon" : "fa-tasks",
"name" : "Control Modes & Events"
},
"37" : {
"link" : "/ia5/statistics/speechlog.shtml",
"link" : "/ia7/#path=/print_speaklog",
"name" : "View Speech Log",
"icon" : "fa-bullhorn"
},
Expand Down Expand Up @@ -561,7 +560,7 @@
]
},
"97" : {
"link" : "/speech",
"link" : "/ia7/#path=/print_speaklog",
"icon" : "fa-bullhorn",
"name" : "View Speech Log"
},
Expand Down Expand Up @@ -613,8 +612,70 @@
"61" : {
"icon" : "fa-bolt",
"name" : "Weather Station",
"link" : "/ia5/outside/weather_index.shtml"
},
"children" : [
116,
117,
118,
119,
120,
121,
122,
123,
124,
125
]
},
"116" : {
"icon" : "fa-search",
"name" : "Weather Zoom",
"link" : "/bin/weather_graph_zoom.pl"
},
"117" : {
"icon" : "fa-leaf",
"name" : "Outdoor Temp",
"link" : "/bin/weather_graph.pl?tempout"
},
"118" : {
"icon" : "wi-thermometer",
"name" : "Indoor Temp",
"link" : "/bin/weather_graph.pl?tempin"
},
"119" : {
"icon" : "wi-sprinkle",
"name" : "Outdoor Humidity",
"link" : "/bin/weather_graph.pl?humout"
},
"120" : {
"icon" : "wi-sprinkles",
"name" : "Indoor Humidity",
"link" : "/bin/weather_graph.pl?humin"
},
"121" : {
"icon" : "wi-strong-wind",
"name" : "Wind Speed",
"link" : "/bin/weather_graph.pl?windspeed"
},
"122" : {
"icon" : "fa-arrows",
"name" : "Wind Direction",
"link" : "/bin/weather_graph.pl?winddir"
},
"123" : {
"icon" : "wi-rain",
"name" : "Total Rain",
"link" : "/bin/weather_graph.pl?raintotal"
},
"124" : {
"icon" : "wi-sprinkle",
"name" : "Rain Rate",
"link" : "/bin/weather_graph.pl?rainrate"
},
"125" : {
"icon" : "wi-cloud-refresh",
"name" : "Baro Pressure",
"link" : "/bin/weather_graph.pl?press"
},

"92" : {
"name" : "Local Movies",
"external" : "http://www.google.com/search?&q=movie%3A+91403",
Expand Down Expand Up @@ -703,5 +764,22 @@
"link" : "/ia5/modes/browse.shtml",
"name" : "Browse Modes",
"icon" : "fa-th"
}
},
"500" : {
"icon" : "fa-home",
"name" : "Gear Settings",
"children" : [
501

]
},
"501" : {
"link" : "/UNSET_PASSWORD?user=admin",
"name" : "Authorize",
"icon" : "fa-lock"
},
"600" : {
"link" : "/ia7/#path=/objects&parents=ia7_status_items",
"name" : "Status"
}
}
18 changes: 16 additions & 2 deletions lib/json_server.pl
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,25 @@ sub json_get {
if ($path[0] eq 'objects' || $path[0] eq '') {
$json_data{objects} = {};
my @objects;

# Building the list of parent groups for each object
# we could use &::list_groups_by_object() for each object, but that sub
# is time consuming, particularly when called numerous times. Instead,
# we create a lookup table one time, saving a lot of processing time.
my $parent_table = build_parent_table();

if ($args{items} && $args{items}[0] ne "") {
foreach my $name (@{$args{items}}){
#$name =~ s/\$|\%|\&|\@//g;
my $o = &get_object_by_name($name);
print_log "json: object name=$name ref=" . ref $o if $Debug{json};
if (my $data = &json_object_detail( $o, \%args, \%fields, $parent_table)){
$json_data{objects}{$name} = $data;
}
}
} else {


# Restrict object list by type here to make things faster
if ($args{type}){
for (@{$args{type}}){
Expand Down Expand Up @@ -224,6 +237,7 @@ sub json_get {
}
}
}
}
;
# List subroutines
if ($path[0] eq 'subs' || $path[0] eq '') {
Expand Down Expand Up @@ -549,8 +563,7 @@ sub json_object_detail {
$value = $object->$method;
$value = encode_entities( $value, "\200-\377&<>" );
}
print_log "json: object_dets f $f m $method v $value"
if $Debug{json};
print_log "json: object_dets f $f m $method v $value" if $Debug{json};
}
elsif ($f eq 'members'){
## Currently only list members for group items, but at some point we
Expand Down Expand Up @@ -606,6 +619,7 @@ sub filter_object {
next if (lc($f) eq 'time');
next if (lc($f) eq 'fields');
next if (lc($f) eq 'long_poll');
next if (lc($f) eq 'items'); #HP, we should already have parsed the items
next if ($f eq '');
if ($$object{$f}) {
for my $test_val (@{$args{$f}}) {
Expand Down
Binary file added web/ia7/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file added web/ia7/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file added web/ia7/fonts/weathericons-regular-webfont.ttf
Binary file not shown.
Loading

0 comments on commit da3714e

Please sign in to comment.