diff --git a/Anvil/Tools.pm b/Anvil/Tools.pm index e9980019..8800ef70 100755 --- a/Anvil/Tools.pm +++ b/Anvil/Tools.pm @@ -739,6 +739,19 @@ sub _set_defaults language => "en_CA", skin => "alteeve", }, + # This is data filled from the active user's database table. + users => { + user_name => "", + user_password_hash => "", + user_session_salt => "", + user_salt => "", + user_algorithm => "", + user_hash_count => "", + user_language => "", + user_is_admin => "", + user_is_experienced => "", + user_is_trusted => "", + }, }; $anvil->data->{defaults} = { ## Network stuff... The second octet auto-increments to handle N-number of netowrks. As such, diff --git a/Anvil/Tools/Words.pm b/Anvil/Tools/Words.pm index 350fb6cd..0627e2a7 100755 --- a/Anvil/Tools/Words.pm +++ b/Anvil/Tools/Words.pm @@ -452,8 +452,7 @@ sub string # restore them once we're out of this loop. foreach my $check ($string =~ /#!([^\s]+?)!#/) { - if (($check !~ /^replace/) && - ($check !~ /^data/) && + if (($check !~ /^data/) && ($check !~ /^string/) && ($check !~ /^variable/)) { diff --git a/cgi-bin/home b/cgi-bin/home index a961c65a..e992f332 100755 --- a/cgi-bin/home +++ b/cgi-bin/home @@ -60,13 +60,15 @@ $| = 1; ### Setup some variables. $anvil->data->{form}{error_massage} = " "; +$anvil->data->{form}{back_link} = ""; +$anvil->data->{form}{refresh_link} = ""; # Read in any CGI variables, if needed. $anvil->Get->cgi(); -$anvil->data->{skin}{url} = $anvil->data->{path}{urls}{skins}."/".$anvil->Template->skin; +$anvil->data->{skin}{url} = $anvil->data->{path}{urls}{skins}."/".$anvil->Template->skin; +$anvil->data->{form}{body} = ""; my $header = $anvil->Template->get({file => "main.html", name => "header", variables => { language => $anvil->Words->language }}); -my $body = ""; # If any jobs are pending/running, show the "unavailable" option. my $available = check_availability($anvil); @@ -74,7 +76,7 @@ $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list if (not $available) { # Set the body to 'say::maintenance'. - $body = $anvil->data->{say}{maintenance}; + $anvil->data->{form}{body} = $anvil->data->{say}{maintenance}; } # If there is no user account yet, then the system is new and needs to be reconfigured. @@ -82,20 +84,51 @@ my $configured = check_if_configured($anvil); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { configured => $configured }}); if (not $configured) { - $body = configure_striker($anvil); + configure_striker($anvil); } else { # Normal operation - $body = process_task($anvil); + process_task($anvil); } +# Preparing the back (and eventually 'reload' button) takes a bit more work. +my $refresh_button = ""; +if ($anvil->data->{form}{refresh_link}) +{ + $refresh_button = $anvil->Template->get({file => "main.html", name => "refresh_button_on", variables => { url => $anvil->data->{form}{refresh_link} }}); +} +else +{ + $refresh_button = $anvil->Template->get({file => "main.html", name => "refresh_button_off"}); +} + +my $back_button = ""; +if ($anvil->data->{form}{back_link}) +{ + my $url = $THIS_FILE; + if ($anvil->data->{form}{back_link} ne "?") + { + # Turn on the back button, + $url = $anvil->data->{form}{back_link}; + } + $back_button = $anvil->Template->get({file => "main.html", name => "back_button_on", variables => { url => $url }}); +} +else +{ + # Back is disabled. + $back_button = $anvil->Template->get({file => "main.html", name => "back_button_off"}); +} my $buttons = $anvil->Template->get({file => "main.html", name => "button_bar", variables => { + back_button => $back_button, + refresh_button => $refresh_button, anvil_button => 0 ? $anvil->Template->get({file => "main.html", name => "anvil_button_on"}) : $anvil->Template->get({file => "main.html", name => "anvil_button_off"}), striker_button => 0 ? $anvil->Template->get({file => "main.html", name => "striker_button_on"}) : $anvil->Template->get({file => "main.html", name => "striker_button_off"}), user_button => $anvil->data->{sys}{users}{user_name} ? $anvil->Template->get({file => "main.html", name => "user_button_on"}) : $anvil->Template->get({file => "main.html", name => "user_button_off"}), }}); -my $footer = $anvil->Template->get({file => "main.html", name => "footer"}); +my $footer = $anvil->Template->get({file => "main.html", name => "footer", variables => { + user => $anvil->data->{sys}{users}{user_name} ? "#!string!message_0034!#" : " ", +}}); # Display the page. my $template = $anvil->Template->get({file => "main.html", name => "master", variables => { @@ -104,7 +137,7 @@ my $template = $anvil->Template->get({file => "main.html", name => "master", var left_top_bar => " ", center_top_bar => $anvil->data->{form}{error_massage}, right_top_bar => $buttons, - center_body => $body, + center_body => $anvil->data->{form}{body}, left_bottom_bar => " ", center_bottom_bar => " ", right_bottom_bar => " ", @@ -127,7 +160,6 @@ sub process_task my ($anvil) = @_; # Is the user trying to log in? - my $body = "hi"; my $logged_in = 0; if ((defined $anvil->data->{cgi}{login}) && ($anvil->data->{cgi}{login}{value})) { @@ -169,16 +201,28 @@ sub process_task $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { logged_in => $logged_in }}); if (not $logged_in) { - $body = $anvil->Template->get({file => "main.html", name => "striker-login", variables => { + $anvil->data->{form}{body} = $anvil->Template->get({file => "main.html", name => "striker-login", variables => { user => $anvil->data->{cgi}{username}{value}, password => "", }}); - $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { body => $body }}); - return($body); + $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 3, list => { "form::body" => $anvil->data->{form}{body} }}); + return(0); } # If we're here, the user is logged in! - $body = "logged in as: [".$anvil->data->{sys}{users}{user_name}."]\n"; + if ($anvil->data->{cgi}{striker}{value}) + { + $anvil->data->{form}{back_link} = "?"; + $anvil->data->{form}{body} = $anvil->Template->get({file => "main.html", name => "striker-setup"}); + } + elsif (0) + { + } + else + { + # Load the main page. + $anvil->data->{form}{body} = $anvil->Template->get({file => "main.html", name => "striker-welcome"}); + } # $anvil->data->{sys}{users}{user_name} = $user_name; # $anvil->data->{sys}{users}{user_uuid} = $user_uuid; @@ -191,7 +235,7 @@ sub process_task # $anvil->data->{sys}{users}{user_is_experienced} = $user_is_experienced, # $anvil->data->{sys}{users}{user_is_trusted} = $user_is_trusted, - return($body); + return(0); } # This shows the menus for configuring Striker. @@ -200,10 +244,9 @@ sub configure_striker my ($anvil) = @_; # This will be true when the dashboard is unconfigured. - my $body = ""; if (not $anvil->data->{cgi}{step}{value}) { - $body = config_step1($anvil); + $anvil->data->{form}{body} = config_step1($anvil); } elsif ($anvil->data->{cgi}{step}{value} eq "step1") { @@ -213,12 +256,12 @@ sub configure_striker if ($sane) { # Step 1 was sane, show step 2. - $body = config_step2($anvil); + $anvil->data->{form}{body} = config_step2($anvil); } else { # No good - $body = config_step1($anvil); + $anvil->data->{form}{body} = config_step1($anvil); } } elsif ($anvil->data->{cgi}{step}{value} eq "step2") @@ -229,25 +272,25 @@ sub configure_striker if ($sane) { # Step 2 was sane, show step 3. - $body = config_step3($anvil); + $anvil->data->{form}{body} = config_step3($anvil); } else { # No good - $body = config_step2($anvil); + $anvil->data->{form}{body} = config_step2($anvil); } } elsif ($anvil->data->{cgi}{step}{value} eq "step3") { # User has confirmed, update the system! - $body = save_job($anvil); + $anvil->data->{form}{body} = save_job($anvil); } else { - $body = get_network_details_form($anvil); + $anvil->data->{form}{body} = get_network_details_form($anvil); } - return($body); + return(0); } # This checks to see if the local machine has been configured after initial install. If not, it will present diff --git a/html/skins/alteeve/images/anvil_icon_off.png b/html/skins/alteeve/images/anvil_icon_off.png new file mode 100644 index 00000000..4d734bf0 Binary files /dev/null and b/html/skins/alteeve/images/anvil_icon_off.png differ diff --git a/html/skins/alteeve/images/back_off.png b/html/skins/alteeve/images/back_off.png new file mode 100644 index 00000000..cb4fdff2 Binary files /dev/null and b/html/skins/alteeve/images/back_off.png differ diff --git a/html/skins/alteeve/images/back_on.png b/html/skins/alteeve/images/back_on.png new file mode 100644 index 00000000..a7de104e Binary files /dev/null and b/html/skins/alteeve/images/back_on.png differ diff --git a/html/skins/alteeve/images/refresh_off.png b/html/skins/alteeve/images/refresh_off.png new file mode 100644 index 00000000..40af8256 Binary files /dev/null and b/html/skins/alteeve/images/refresh_off.png differ diff --git a/html/skins/alteeve/images/refresh_on.png b/html/skins/alteeve/images/refresh_on.png new file mode 100644 index 00000000..8a767607 Binary files /dev/null and b/html/skins/alteeve/images/refresh_on.png differ diff --git a/html/skins/alteeve/images/sources.txt b/html/skins/alteeve/images/sources.txt index e656d8b3..054804e2 100644 --- a/html/skins/alteeve/images/sources.txt +++ b/html/skins/alteeve/images/sources.txt @@ -16,3 +16,15 @@ User by Wilson Joseph from the Noun Project (https://thenounproject.com/term/use Question by Travis Avery from the Noun Project (https://thenounproject.com/term/question/587291/) - help_icon.png + +Sync by Edward Boatman from the Noun Project (https://thenounproject.com/term/sync/290/) +- sync.png + +update by sofi from the Noun Project (https://thenounproject.com/term/update/1723034/) +- update.png + +back by K from the Noun Project (https://thenounproject.com/term/back/453801/) +- back.png + +Refresh by Denis Klyuchnikov from the Noun Project (https://thenounproject.com/term/refresh/1147205/) +- refresh.png diff --git a/html/skins/alteeve/images/striker_icon_off.png b/html/skins/alteeve/images/striker_icon_off.png new file mode 100644 index 00000000..f91b8eb7 Binary files /dev/null and b/html/skins/alteeve/images/striker_icon_off.png differ diff --git a/html/skins/alteeve/images/sync.png b/html/skins/alteeve/images/sync.png new file mode 100644 index 00000000..f976acd6 Binary files /dev/null and b/html/skins/alteeve/images/sync.png differ diff --git a/html/skins/alteeve/images/update.png b/html/skins/alteeve/images/update.png new file mode 100644 index 00000000..1eb6c8f0 Binary files /dev/null and b/html/skins/alteeve/images/update.png differ diff --git a/html/skins/alteeve/images/users_icon_off.png b/html/skins/alteeve/images/users_icon_off.png new file mode 100644 index 00000000..b0b4a74b Binary files /dev/null and b/html/skins/alteeve/images/users_icon_off.png differ diff --git a/html/skins/alteeve/main.css b/html/skins/alteeve/main.css index c6eaeeb7..d96bed7c 100644 --- a/html/skins/alteeve/main.css +++ b/html/skins/alteeve/main.css @@ -210,7 +210,6 @@ td { } .footer { - text-align: center; background: #171717; font-size: 12px; color: #515151; @@ -231,3 +230,36 @@ td { text-decoration: none; color: #616161; } + +.fixed_width { + font-family: 'Dejavu Sans Mono', Courier; +} + +#center_body { + height: 100%; +} + +.striker_welcome { +} + +.title { + font-size: 1.2em; + text-align: center; +} + +.icon_button { + padding-top: 30px; + vertical-align: top; +} + +.menu_title { + font-size: 1.1em; + padding-top: 30px; + padding-left: 20px; + padding-bottom: 10px; +} + +.menu_details { + padding-left: 10px; + padding-right: 10px; +} diff --git a/html/skins/alteeve/main.html b/html/skins/alteeve/main.html index 6534ddff..c84544f9 100644 --- a/html/skins/alteeve/main.html +++ b/html/skins/alteeve/main.html @@ -1,6 +1,105 @@ + +
+ #!variable!back_button!# + | ++ #!variable!refresh_button!# + | #!variable!striker_button!# | @@ -17,12 +116,28 @@