Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major web interface rehaul #489

Merged
merged 78 commits into from
Mar 18, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
de7dc15
Initial Start of New Version 7 Web Interface
krkeegan Nov 17, 2013
a6f1c39
Ia7: Create IA7_Utils.pm, Move Category Database There
krkeegan Nov 17, 2013
dd399a6
Ia7: Move Header into Util, Add Sub Category Page
krkeegan Nov 17, 2013
9c839c8
Ia7: Add MH Home Subcategories, Add About Page
krkeegan Nov 17, 2013
6b51819
Merge branch 'master' into ia7
krkeegan Nov 17, 2013
1ee112c
Ia7: Copy About Audrey Page from Ia5
krkeegan Nov 17, 2013
b9d1b19
Ia7: Convert About Audrey Page
krkeegan Nov 17, 2013
c2797ce
Ia7: Copy BrowseMiserHouse from Ia5
krkeegan Nov 17, 2013
b2d89fc
Ia7: Edit Browse Mr. House Page
krkeegan Nov 17, 2013
0acdcaa
Ia7: Create AJAX/XML BrowseMisterHouse Page
krkeegan Nov 19, 2013
fe31757
Merge branch 'master' into ia7
krkeegan Nov 19, 2013
8cd00e0
Ia7: Add Response Dialog to Browse MisterHouse Page
krkeegan Nov 19, 2013
45bcdf8
Ia7: Allow for Listing of All Categories
krkeegan Nov 19, 2013
a516491
JSON/XML/Print_Log: Add Support for Iterative Print Log Updates
krkeegan Nov 20, 2013
c03f688
Merge branch 'master' into ia7
krkeegan Nov 20, 2013
2e9d407
Ia7: Add Test AJAX Print Log Page
krkeegan Nov 20, 2013
191632b
JSON: Fix Error with Truncate Option in JSON Server
krkeegan Nov 20, 2013
80fb082
Ia7: Condense Print_Log Javascript Call
krkeegan Nov 20, 2013
b20c329
JSON: Remove Global Replacement of Entities in JSON Response
krkeegan Nov 20, 2013
f13a52c
JSON: Tailor Entity Replacement to Keys Only
krkeegan Nov 20, 2013
ad757d1
Ia7: Convert XML Calls to JSON
krkeegan Nov 20, 2013
7296b4f
Merge branch 'fix_debug' into ia7
krkeegan Nov 21, 2013
bccc5f0
Merge branch 'fix_x10_plm_issue' into ia7
krkeegan Nov 21, 2013
a4bb0ad
Ia7: Condense Javascript Routines, Add Initial Support for Group and …
krkeegan Nov 21, 2013
0440236
Ia7: Add Control Modal for Objects
krkeegan Nov 24, 2013
ff94789
Ia7: Capture Button Press on Object Control and Submit Command
krkeegan Nov 24, 2013
daf199d
Ia7: Reorganize and Condense Javascript
krkeegan Dec 5, 2013
5a25506
Ia7: Adopt AJAX-like loading of Pages
krkeegan Dec 8, 2013
8b3465e
Merge branch 'Insteon_Thermo_Fix' into ia7
krkeegan Dec 8, 2013
c2ed76b
Ia7: Change Collections Database Structure
krkeegan Dec 8, 2013
9c19f09
Ia7: Add Breadcrumbs to Header for Navigation
krkeegan Dec 9, 2013
10616fb
Ia7: Condense Link Building into Routine
krkeegan Dec 9, 2013
d6860b9
Ia7: Only Load Collections DB Once
krkeegan Dec 9, 2013
b105bc1
Ia7: Load Pages Into Index Page Using AJAX
krkeegan Dec 9, 2013
57af15e
Ia7: Remove Unnecessary Header Stuff from About Audrey Page
krkeegan Dec 22, 2013
75e124d
Ia7: Add More Collection Pages
krkeegan Dec 22, 2013
9fda270
Ia7: Remove Unnecessary Header Stuff from Print Log File
krkeegan Dec 22, 2013
4c41a87
Ia7: Cleanup main Index Page
krkeegan Dec 22, 2013
ec8997e
Ia7: Convert URL to Hash
krkeegan Dec 22, 2013
08690da
Ia7: Update Breadcrumb on Page Change, Call Necessary Routines
krkeegan Dec 22, 2013
b174794
Ia7: Print MH Variables in a Readable Form
krkeegan Dec 22, 2013
f9a20b3
Ia7: Update the Main LoadList Javascript Routine
krkeegan Dec 22, 2013
dd38873
Ia7: Update Main LoadCollection Javascript Routine
krkeegan Dec 22, 2013
9b76b91
Merge branch 'master' into ia7
krkeegan Jan 3, 2014
c2915cc
Ia7: Finish Catalog of PagesCopied from Ia5
krkeegan Jan 3, 2014
ec5da68
Ia7: First Draft of Editable Trigger Page
krkeegan Jan 7, 2014
6293923
Merge branch 'master' into ia7
krkeegan Jul 25, 2014
c7008d8
IA7: Move Last of IA7 Utils Into Other Files
krkeegan Aug 12, 2014
30d97d1
HTTP_Server: Properly Handle Quoted Strings in a Sub Request
krkeegan Aug 12, 2014
6133868
IA7: Allow for use of Label Names in Objects
krkeegan Aug 12, 2014
2eba4e8
IA7: Change to Non-Recursive Listing of Groups
krkeegan Aug 12, 2014
931cb02
IA7/JSON: Properly Return Array in JSON Response
krkeegan Aug 12, 2014
d87611c
Merge branch 'master' into ia7
krkeegan Aug 12, 2014
207bef2
HTTP Server: Fix If Modified Check
krkeegan Aug 15, 2014
2a6a276
AJAX Server: Send Status Code Response When Closing an Empty Socket
krkeegan Aug 15, 2014
34790fb
IA7/JSON: Change JSON Structure; Enable Updating in IA7
krkeegan Aug 15, 2014
7555fd4
Generic_Item/Group: Add Function to Store Sort Order of Members
krkeegan Aug 19, 2014
b487aee
JSON/IA7: Add Support for Sort Order
krkeegan Aug 19, 2014
da74160
IA7: Limit Updates to a Single Thread; Begin Support for Sortable Da…
krkeegan Aug 19, 2014
ba3a7de
JSON: GZIP Compress JSON Output
krkeegan Aug 19, 2014
aeafd9a
JSON: Dramatically Reorganize the JSON Schema
krkeegan Aug 19, 2014
f3fa9f0
Print Log: Fix Error in Print Log Since Time Function
krkeegan Aug 26, 2014
8ae3a9c
Add Get_Type Function to Various Packages
krkeegan Aug 26, 2014
96efa17
IA7: Move Collections Data to Data Directory
krkeegan Aug 26, 2014
b19bb5e
IA7/JSON: Major Change in JSON Schema; Significant Fixes
krkeegan Aug 26, 2014
fd0dac5
JSON: Better Handling of Idle Changed
krkeegan Aug 27, 2014
b04b69d
IA7: Start Implementation of Sortable Interface
krkeegan Aug 27, 2014
58d1139
IA7: Add HTTP Globals; Make URL Link to JSON Sub; Enable Support for …
krkeegan Sep 5, 2014
6b0dc7b
Http_Server: Fix Glitch in Merging Body and Arguments
krkeegan Sep 5, 2014
4f6ed1f
IA7: Add Basic Support for Calling a Function Based on Put Data
krkeegan Sep 5, 2014
13d58a5
Alpha release with modifications to ia7. Includes
Mar 7, 2015
3a37512
Added in cannonical setting for sorting
hplato Mar 7, 2015
0b89e3c
Almost there with print_speaklog. Just need to figure out why the Spe…
hplato Mar 17, 2015
28ccfe7
Minor fix w/ print_speaklog
hplato Mar 17, 2015
cb66e1f
changed method to enable ia7 code, ia7_enable=all|mobile in your mh.ini
hplato Mar 18, 2015
2fbff98
added in sample.shtml for "mixing" both static and dynamic content
hplato Mar 18, 2015
c190edc
Added in dynamic 'mode' page
hplato Mar 18, 2015
702f061
Fixed Wiki link
hplato Mar 18, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 104 additions & 10 deletions bin/mh
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ use vars qw(%Run_Members);

my ($Pgm_PathU);
my ($Loop_Speed, @Loop_Speeds, $Loop_Sleep_Time, $Loop_Tk_Passes, $Web_Play_Index);
my (@Requested_Files, @Print_Log, @Display_Log, @Speak_Log, @Error_Log);
my (@Requested_Files, @Print_Log, @Print_Log_Time, @Display_Log, @Speak_Log, @Speak_Log_Time, @Error_Log, @Error_Log_Time);

my ($exit_flag, $xcmd_file, %file_code_times, %file_code_times2, %file_change_times);
my (@Loop_Code, @Sub_Code, %Sub_Code, %Run_Members, %Run_Members_Error_Count, %Benchmark_Members, @Item_Code, @Item_Code_Objects);
Expand Down Expand Up @@ -1131,20 +1131,24 @@ sub open_logs {
my $speak_log = "$config_parms{data_dir}/logs/speak.log";
my $error_log = "$config_parms{data_dir}/logs/error.log";

my (@log);
my (@log,@speaklog,@errorlog);
@log = &file_tail($print_log, $config_parms{max_log_entries});
chomp @log;
@Print_Log = reverse @log;
unshift @Print_Log, "$Time_Date ---------- Restart ---------- ";
@Print_Log_Time = (1)x scalar @Print_Log;

@speaklog = &file_tail($speak_log, $config_parms{max_log_entries});
chomp @speaklog;
@Speak_Log = reverse @speaklog;
@Speak_Log_Time = (1)x scalar @Speak_Log;

@log = &file_tail($speak_log, $config_parms{max_log_entries});
chomp @log;
@Speak_Log = reverse @log;
# unshift @Speak_Log, "$Time_Date ---------- Restart ---------- ";

@log = &file_tail($error_log, $config_parms{max_log_entries});
chomp @log;
@Error_Log = reverse @log;
@errorlog = &file_tail($error_log, $config_parms{max_log_entries});
chomp @errorlog;
@Error_Log = reverse @errorlog;
@Error_Log_Time = (1)x scalar @Error_Log;
unshift @Error_Log, "$Time_Date ---------- Restart ---------- ";


Expand Down Expand Up @@ -3998,6 +4002,9 @@ sub print_log {
unshift (@Print_Log, $data);
pop @Print_Log if @Print_Log > $config_parms{max_log_entries};

unshift (@Print_Log_Time, &get_tickcount);
pop @Print_Log_Time if @Print_Log_Time > @Print_Log;

$Last_Response = 'print_log' unless $Last_Response;


Expand Down Expand Up @@ -4025,6 +4032,37 @@ sub print_log_last {
}
}

sub print_log_since {
# Return the print_log phrases since time
my ($time) = @_;
#Search from front to back, we are likely looking for an entry near the front
my $index;
for my $i (0 .. $#Print_Log_Time) {
$index = $i;
if ($time >= $Print_Log_Time[$i]){
# We have already seen this message, so the prior index is what we need
$index--;
last;
}
}
my $count = @Print_Log;
if ($index < 0) {
return;
}
elsif (($index+1) >= $count) {
return @Print_Log;
}
else {
return (@Print_Log[0 .. $index]);
}
}

sub print_log_current_time {
# Return the time of most recent print_log phrase
return $Print_Log_Time[0] unless (scalar @Print_Log_Time <= 0);
return 0;
}

sub error_log_last {
# Return the last how_many error_log phrases
my ($how_many) = @_;
Expand Down Expand Up @@ -4058,12 +4096,15 @@ sub print_speaklog {
# my ($data) = @_;
my $data = "@_";

$data =~ s/<\/?voice.*?>//g; # Drop XML speech tags
$data =~ s/\n *$//; # Drop trailing cr

# unshift (@Speak_Log, "$Time_Now $data");
unshift (@Speak_Log, "$Time_Date $data");
pop @Speak_Log if @Speak_Log > $config_parms{max_log_entries};
unshift (@Speak_Log_Time, &get_tickcount);
pop @Speak_Log_Time if @Speak_Log_Time > @Speak_Log;

$data =~ s/<\/?voice.*?>//g; # Drop XML speech tags
$data =~ s/\n *$//; # Drop trailing cr

if ($Tk_objects{speak_window}) {
# Most recent at top ... if we put it on the bottom, we have to constantly
Expand All @@ -4074,8 +4115,61 @@ sub print_speaklog {
print "$data\n" unless $config_parms{no_log} =~ /speak/ or $Startup; # On startup no print needed as it is just the "System Restarted" message (or an error with its own debug info)
}
print SPEAKLOG "$Time_Date $data\n";

return;
}

sub print_speaklog_last {
# Return the last how_many speak phrases
my ($how_many) = @_;
my $count = @Speak_Log;
if ($how_many == 1) {
return $Speak_Log[0];
}
elsif ($how_many >= $count) {
return @Speak_Log;
}
else {
return (@Speak_Log[0 .. ($how_many-1)]);
}
}

sub print_speaklog_since {
# Return the speak phrases since time
my ($time) = @_;
#Search from front to back, we are likely looking for an entry near the front
my $index;
for my $i (0 .. $#Speak_Log_Time) {
$index = $i;
#print "db/mh/since: i=$i time=$time, plt=$Print_Log_Time[$i] slt=$Speak_Log_Time[$i]\n";
if ($time >= $Speak_Log_Time[$i]){ #TODO: Problem
# We have already seen this message, so the prior index is what we need
$index--;
last;
}
}
my $count = @Speak_Log;
if ($index < 0) {
return;
}
elsif (($index+1) >= $count) {
return @Speak_Log;
}
else {
print "db/mh/since [ " . @Speak_Log[0 .. $index]. "]\n";
return (@Speak_Log[0 .. $index]);
}
}

sub print_speaklog_current_time {
# Return the time of most recent speak phrase

#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 0;
}


sub process_external_command {
my ($cmd, $warning_flag, $set_by, $respond_target) = @_;
$cmd =~ s/^\s+//; # Deletes leading blanks
Expand Down
Loading