diff --git a/data/web/collections.json b/data/web/collections.json index 29c2f7565..b621cae82 100644 --- a/data/web/collections.json +++ b/data/web/collections.json @@ -132,6 +132,7 @@ "106" : { "link" : "/organizer/calendar.pl", "name" : "Calendar", + "keys" : "true", "icon" : "fa-calendar" }, "52" : { @@ -194,6 +195,7 @@ "108" : { "link" : "/organizer/tasks.pl", "name" : "TODO List", + "keys" : "true", "icon" : "fa-list" }, "94" : { @@ -237,7 +239,7 @@ "link" : "/ia7/#path=/objects&type=Voice_Cmd&category=Photos" }, "59" : { - "external" : "http://www.weather.com/weather/local/91403", + "iframe" : "http://www.weather.com/weather/local/91403", "icon" : "fa-cloud", "name" : "Weather.com - Local" }, @@ -383,7 +385,7 @@ "113" : { "name" : "LED Clock", "icon" : "fa-clock-o", - "link" : "/clock" + "link" : "/clock/index.html" }, "71" : { "name" : "Camera Files", @@ -429,7 +431,7 @@ "98" : { "icon" : "fa-volume-up", "name" : "Speak Text", - "link" : "/ia5/speak/speakframe.html" + "link" : "/ia7/house/speaktext.shtml" }, "96" : { "link" : "/ia7/#path=/objects&type=Voice_Cmd&category=Music", @@ -479,6 +481,7 @@ "107" : { "link" : "/organizer/contacts.pl", "icon" : "fa-book", + "keys" : "true", "name" : "Address Book" }, "26" : { @@ -689,7 +692,7 @@ "58" : { "name" : "Weather Underground", "icon" : "fa-sun-o", - "external" : "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=91403" + "iframe" : "http://www.wunderground.com/cgi-bin/findweather/getForecast?query=91403" }, "115" : { "name" : "Browse Timed_Events", @@ -778,8 +781,8 @@ "name" : "Authorize", "icon" : "fa-lock" }, - "600" : { + "600" : { "link" : "/ia7/#path=/objects&parents=ia7_status_items", "name" : "Status" } -} \ No newline at end of file +} diff --git a/lib/Generic_Item.pm b/lib/Generic_Item.pm index 84df0e613..136cd7bd9 100644 --- a/lib/Generic_Item.pm +++ b/lib/Generic_Item.pm @@ -457,14 +457,13 @@ If set to 1, the object will not show up on Tk or Web menus. Can only be run at =cut sub hidden { - return unless $main::Reload; my ($self, $flag) = @_; - # Set it if (defined $flag) { + return unless $main::Reload; $self->{hidden} = $flag; } else { # Return it, but this currently only will work on $Reload. - return $self->{hidden}; + return $self->{hidden}; # HP - really, no reason why this can't be a read-only method any time? } } diff --git a/lib/json_server.pl b/lib/json_server.pl index 105c6b178..dab76f2b7 100644 --- a/lib/json_server.pl +++ b/lib/json_server.pl @@ -42,6 +42,7 @@ =head2 METHODS use HTML::Entities; # So we can encode characters like <>& etc use JSON qw(decode_json); use IO::Compress::Gzip qw(gzip); +use vars qw(%json_table); sub json { my ($request_type, $path_str, $arguments, $body) = @_; @@ -162,8 +163,16 @@ sub json_get { $collection_file = "$config_parms{data_dir}/web/collections.json" if -e "$config_parms{data_dir}/web/collections.json"; # Consider copying the source file to the user data dir here. - my $json_collections = file_read($collection_file); - $json_data{'collections'} = decode_json($json_collections); + + eval { + my $json_collections = file_read($collection_file); + $json_data{'collections'} = decode_json($json_collections); #HP, wrap this in eval to prevent MH crashes + }; + if ($@){ + print_log "Json_Server.pl: WARNING: decode_json failed for collection.json. Please check this file!"; + $json_data{'collections'} = decode_json('{ "0" : { "name" : "error" } }'); #write a blank collection + + } } # List objects @@ -287,6 +296,16 @@ sub json_get { $json_data{vars} = \%json_vars; } + if ( $path[0] eq 'table_data') { + #print Dumper $json_table{$args{var}[0]};# if $Debug{json}; + if ($args{var}) { + my $jt_time = int($json_table{$args{var}[0]}{time}); + if (($args{time} && int($args{time}[0]) < $jt_time) or (!$args{time})) { + $json_data{'table_data'} = $json_table{$args{var}[0]}; + } + } + } + # List print_log phrases if ( $path[0] eq 'print_log' || $path[0] eq '' ) { my @log; @@ -507,7 +526,7 @@ sub json_object_detail { my $ref = ref \$object; return unless $ref eq 'REF'; - return if $object->can('hidden') and $object->hidden; #Not sure about this + #return if $object->can('hidden') and $object->hidden; #Not sure about this, HP - should just return a hidden property my $object_name = $object->{object_name}; # Skip object if time arg supplied and not changed @@ -534,7 +553,7 @@ sub json_object_detail { my %json_objects; my %json_complete_object; my @f = qw( category filename measurement rf_id set_by members - state states state_log type label sort_order groups parents + state states state_log type label sort_order groups hidden parents idle_time text html seconds_remaining level); # Build list of fields based on those requested. @@ -559,6 +578,14 @@ sub json_object_detail { my @a = $object->$method; $value = \@a; } + #if ( $f eq 'hidden' ) { + # my $a = $object->$method; + # if ($a == 1 or $a eq "1") { + # print_log "json true"; + # } else { + # print_log "json false"; + # } + #} else { $value = $object->$method; $value = encode_entities( $value, "\200-\377&<>" ); @@ -726,6 +753,68 @@ sub json_usage { return $html; } + +sub json_table_create { + my ($key) = @_; + + return 0 if (defined $json_table{$key}{exist}); + + $json_table{$key}{exist} = 1; + return 1; +} + +sub json_table_delete { + my ($key) = @_; + + return 0 if (!defined $json_table{$key}{exist}); + + $json_table{$key} = {}; + return 1; +} + +sub json_table_put_header { + my ($key,$pos,$value) = @_; + + return 0 if (!defined $json_table{$key}{exist}); + + $json_table{$key}{head}[$pos] = $value; + return 1; +} + +sub json_table_get_header { + my ($key,$pos) = @_; + + return 0 if (!defined $json_table{$key}{exist}); + + return $json_table{$key}{head}[$pos]; +} + +sub json_table_put_data { + my ($key,$posx,$posy,$value) = @_; + + return 0 if (!defined $json_table{$key}{exist}); + + $json_table{$key}{data}[$posx][$posy] = $value; + return 1; +} + +sub json_table_get_data { + my ($key,$posx,$posy) = @_; + + return 0 if (!defined $json_table{$key}{data}[$posx][$posy]); + + return $json_table{$key}{data}[$posx][$posy]; +} + +sub json_table_push { + my ($key) = @_; + + return 0 if (!defined $json_table{$key}); + + $json_table{$key}{time} = &get_tickcount; + return 1; +} + return 1; # Make require happy diff --git a/web/clock/index.html b/web/clock/index.html index 3c34c385b..4e5eeba92 100644 --- a/web/clock/index.html +++ b/web/clock/index.html @@ -1,29 +1,49 @@
";
my ($scriptName) = $ENV{'SCRIPT_NAME'} || "calendar.pl";
-my ($objCGI) = new CGI;
+$scriptName = $ia7_prefix . "/organizer/calendar.pl" if ($web_mode eq "IA7");
my @dateArray = localtime(time);
my ($month) = $objCGI->param('vsMonth') || $dateArray[4]+1;
my ($year) = $objCGI->param('vsYear') || $dateArray[5]+1900;
@@ -160,6 +182,10 @@ BEGIN
## --- Custom
my ($showDayDetails) = $objCGI->param('vsSD') || 0;
+#print "vsSD=$showDayDetails";
+#my $URL1 = $objCGI->param('ia7');
+#print "URL1=$URL1";
+
my ($showforAudrey) = $objCGI->param('vsMA') || 0;
my ($noShowDayDetails) = 1;
my ($cellSize) = 25;
@@ -222,6 +248,7 @@ BEGIN
print "vsLock Module Version " . $objLock->Version;
print "
MisterAudrey Version" if ($showforAudrey);
print "
ical2vsdb sync 1.0";
+print " Web interface: " . $web_mode;
print "
@@ -264,20 +291,20 @@ sub PrintDefault { # display the navigation print "
"; @@ -347,7 +374,8 @@ sub PrintDay { my $icon = $detailIcon; my $source = $objMyDb->FieldValue("SOURCE"); $icon = "images/ical_1.jpg" if ($source =~ /^ical=/); - my $link = ""; + $icon = $img_prefix . $icon; + my $link = ""; print "\n"; print "$months[$month-1] $year\n"; if ($showDayDetails) { - print " [Hide Details]\n" + print " [Hide Details]\n" } else { - print " [Show Details]\n" + print " [Show Details]\n" } print "
\n"; if (!$showforAudrey) { if ($showAll) { - print ""; + print ""; } else { - print ""; + print ""; } } - print " \n"; + print " \n"; print " | \n"; print " | \n"; print " |
\n";