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 @@ JavaClock + + + diff --git a/web/organizer/calendar.pl b/web/organizer/calendar.pl index 0e1d262e6..4f98b7b75 100644 --- a/web/organizer/calendar.pl +++ b/web/organizer/calendar.pl @@ -15,6 +15,7 @@ # or indirectly caused by this software. # # Version History +# 1.6.0-4 - 04/05/15 - IA7 Aware # 1.6.0-3 - 01/04/14 - added support for control calendars (hide them) # 1.6.0-2 - 11/02/07 - minor bugfix to in icalsync name # 1.6.0-1 - 09/24/07 - Updated to organizer release 2.5.2 without admin login and ical customization @@ -31,7 +32,7 @@ # 1.5.2 - 08/22/01 - added file locking # ---------------------------------------------------------------------------- -my $VERSION = "1.6.0-3"; +my $VERSION = "1.6.0-4"; BEGIN { # $SIG{__WARN__} = \&FatalError; @@ -112,6 +113,27 @@ BEGIN file => $configFilePath, delimiter => "\t", ); +my ($objCGI) = new CGI; +#my $URL = $ENV{HTTP_QUERY_STRING}; +my $ia7_keys = $objCGI->param('ia7'); +# want to get the prefix and suffix for creating IA7 URLs +my $web_mode = "IA5"; +my $ia7_prefix = ""; +my $ia7_suffix = ""; +my $img_prefix = ""; + +#foreach my $key (sort(keys(%ENV))) { +# print "$key = $ENV{$key}
\n"; +#} +#print "keys=$ia7_keys"; +# http://127.0.0.1:8080/ia7/#_request=page&link=/organizer/calendar.pl&_collection_key=0,11,106 +if ($ia7_keys) { + $ia7_prefix = "/ia7/#_request=page&link="; + $ia7_suffix = "ia7=" . $ia7_keys . "&_collection_key=" . $ia7_keys; + $web_mode = "IA7"; + $img_prefix = "/organizer/"; +} + $objConfig->Open; my ($title) = $objConfig->FieldValue("Title"); my ($bodyTag) = $objConfig->FieldValue("BodyTag"); @@ -149,7 +171,7 @@ BEGIN

"; 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 "

\n"; print "\n"; - print "<<\n"; - print " <\n"; + print "<<\n"; + print " <\n"; print "\n"; - print " >\n"; - print " >>\n"; + print " >\n"; + print " >>\n"; print "\n"; 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 "" . $link . ""; print "" . $objMyDb->FieldValue("TIME") . " "; print "" . $link . "" . $objMyDb->FieldValue("EVENT") . " \n"; @@ -386,9 +414,9 @@ sub PrintMonth { 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"; @@ -453,16 +481,16 @@ sub PrintMonth { } if ($objMyDb->EOF) { - print "$weekDayCount
"; + print "$weekDayCount
"; } else { #$style = "style=\"color:$dataHolidayColor\"" if ($objMyDb->FieldValue("HOLIDAY") eq "on"); - print "$weekDayCount
"; + print "$weekDayCount
"; } if ($showDayDetails) { print ""; while (!$objMyDb->EOF) { - print "" .$objMyDb->FieldValue("EVENT") . "
" unless ($objMyDb->FieldValue("CONTROL") eq "on"); #Don't display CONTROL calendars; + print "" .$objMyDb->FieldValue("EVENT") . "
" unless ($objMyDb->FieldValue("CONTROL") eq "on"); #Don't display CONTROL calendars; $objMyDb->MoveNext; } print "
"; @@ -692,6 +720,7 @@ sub PrintCurrentRecord { print "\n"; } else { print "\n"; + print "\n"; print "\n"; print "\n"; } diff --git a/web/organizer/contacts.pl b/web/organizer/contacts.pl index 6efca86d8..a2fff3f29 100644 --- a/web/organizer/contacts.pl +++ b/web/organizer/contacts.pl @@ -12,6 +12,7 @@ # or indirectly caused by this software. # # Version History +# 1.5.3-1 - 04/06/15 - IA7 Aware # 1.5.3 - 09/09/05 # 1.5.2 - 02/15/02 - altered toolbar, fixed FNF Error # 1.5.1 - 11/22/01 - added search toolbar, removed "eval" when including libs @@ -19,7 +20,7 @@ # 1.4.3 - 08/22/01 - added file locking # ---------------------------------------------------------------------------- -my $VERSION = "1.5.3"; +my $VERSION = "1.5.3-1"; BEGIN { # $SIG{__WARN__} = \&FatalError; @@ -127,9 +128,24 @@ BEGIN "; my ($objCGI) = new CGI; +my $ia7_keys = $objCGI->param('ia7'); +# want to get the prefix and suffix for creating IA7 URLs +my $web_mode = "IA5"; +my $ia7_prefix = ""; +my $ia7_suffix = ""; +my $img_prefix = ""; + +if ($ia7_keys) { + $ia7_prefix = "/ia7/#_request=page&link="; + $ia7_suffix = "ia7=" . $ia7_keys . "&_collection_key=" . $ia7_keys; + $img_prefix = "/organizer/"; + $web_mode = "IA7"; +} + my ($command) = $objCGI->param('vsCOM') || ""; my ($idNum) = $objCGI->param('vsID') || ""; my ($scriptName) = $ENV{'SCRIPT_NAME'} || "contacts.pl"; +$scriptName = $ia7_prefix . "/organizer/tasks.pl" if ($web_mode eq "IA7"); my ($filePath) = $ENV{"CWD"} . "/" . $fileName; $filePath = "$config_parms{organizer_dir}/$fileName"; my ($activePage) = $objCGI->param('vsAP') || "1"; @@ -199,6 +215,8 @@ BEGIN print "vsDB Module Version " . $objDB->Version . "
"; print "vsLock Module Version " . $objLock->Version; print "
MisterAudrey Version" if ($showforAudrey); +print " Web interface: " . $web_mode; + print "

@@ -234,12 +252,12 @@ sub PrintAllRecords { print "

\n"; print "\n"; foreach $fieldName (@showFields) { - print "\n"; + print "\n"; } print "\n"; while (!$objMyDB->EOF && $count < $visiblePageSize) { print "\n"; - print "\n"; + print "\n"; foreach $fieldName (@showFields) { $fieldValue = $objMyDB->FieldValue($fieldName); $fieldValue = " " if ($fieldValue eq ""); @@ -292,10 +310,10 @@ sub PrintAllRecords { print "Result Page " . $activePage . " of " . $pageCount; if ($activePage > 1) { - print " Previous"; + print " Previous"; } if ($activePage < $pageCount) { - print " Next"; + print " Next"; } print " (" . $objMyDB->RecordCount . " Records)\n"; } @@ -338,7 +356,7 @@ sub PrintCurrentRecord { print "\n"; print "\n"; } - + print "\n"; print "\n"; print "

\n"; } diff --git a/web/organizer/tasks.pl b/web/organizer/tasks.pl index 12ef7971b..c702b16da 100644 --- a/web/organizer/tasks.pl +++ b/web/organizer/tasks.pl @@ -12,6 +12,7 @@ # or indirectly caused by this software. # # Version History +# 1.6.0-2 - 04/06/15 - IA7 Aware # 1.6.0-1 - 09/24/07 - Updated to Organizer release 2.5.2 (1.6.0 js fixes, added recordcount) # 1.4.8-4 - 08/19/07 - iCal2vsdb integration (requires v2104 database) # 1.4.8-3 - 04/29/07 - minor fixes @@ -130,10 +131,25 @@ BEGIN "; my ($objCGI) = new CGI; +my $ia7_keys = $objCGI->param('ia7'); +# want to get the prefix and suffix for creating IA7 URLs +my $web_mode = "IA5"; +my $ia7_prefix = ""; +my $ia7_suffix = ""; +my $img_prefix = ""; + +if ($ia7_keys) { + $ia7_prefix = "/ia7/#_request=page&link="; + $ia7_suffix = "ia7=" . $ia7_keys . "&_collection_key=" . $ia7_keys; + $img_prefix = "/organizer/"; + $web_mode = "IA7"; +} + my ($command) = $objCGI->param('vsCOM') || ""; my ($showCompleted) = $objCGI->param('vsSC') || 0; my ($idNum) = $objCGI->param('vsID') || ""; my ($scriptName) = $ENV{'SCRIPT_NAME'} || "tasks.pl"; +$scriptName = $ia7_prefix . "/organizer/tasks.pl" if ($web_mode eq "IA7"); my ($filePath) = $ENV{"CWD"} . "/" . $fileName; $filePath = "$config_parms{organizer_dir}/$fileName"; my ($activePage) = $objCGI->param('vsAP') || "1"; @@ -141,6 +157,7 @@ BEGIN $pageSize = $objCGI->param('vsPS') if $objCGI->param('vsPS'); + print "
\n"; @@ -200,6 +217,8 @@ BEGIN print "vsDB Module Version " . $objDB->Version . "
"; print "vsLock Module Version " . $objLock->Version; print "
ical2vsdb sync 1.0"; +print " Web interface: " . $web_mode; + print "

@@ -235,9 +254,9 @@ sub PrintAllRecords { #} if ($showCompleted) { - print " \n"; + print " \n"; } else { - print " \n"; + print " \n"; } print "

\n"; if (!$showforAudrey) { if ($showAll) { - print ""; + print ""; } else { - print ""; + print ""; } } - print " \n"; + print " \n"; print "\n"; print "\n"; print "
 " . $fieldName . "" . $fieldName . "
DetailsDetails
\n"; @@ -245,7 +264,7 @@ sub PrintAllRecords { print "\n"; print " \n"; foreach $fieldName (@showFields) { - print "" . $fieldName . "\n"; + print "" . $fieldName . "\n"; } print "\n"; my $link_open; @@ -254,8 +273,9 @@ sub PrintAllRecords { print "\n"; my $icon = $detailIcon; my $source = $objMyDB->FieldValue("SOURCE"); - $icon = "images/ical_2.jpg" if ($source =~ /^ical=/); - $link_open = ""; + $icon = "images/ical_2.jpg" if ($source =~ /^ical=/); + $icon = $img_prefix . $icon; + $link_open = ""; $link_close = ""; print "" . $link_open . "Details" . $link_close . "\n"; foreach $fieldName (@showFields) { @@ -357,6 +377,7 @@ sub PrintCurrentRecord { print "\n"; print "\n"; print "\n"; + print "\n"; print "\n"; print "\n"; print "\n"; @@ -407,6 +428,8 @@ sub PrintBlankRecord { print "\n"; print "\n"; print "\n"; + print "\n"; + print "\n"; print "\n"; print "

\n";