### New Development v.2.3+
+* ✔ Setting should provide page color defaults in form of an hash.
+ * These should/can change based on selected theme. That possibly in future can be changed via config.
+ * colBG,colFG, colSHDW, etc...
* ✔ Printout page to include Amount column if category of items has valued asset, expense or income set. Providing also totals. Of Assets, and total on income and expense.
* Introduce Currency setting, to replace amount '#'. Even though it could be number of, something not currency related.
* ✔ Interaction - When editing an existing log entry, it needs confirmation, if it isn't a copy (now button wasn't pressed), before overwriting.
processSubmit();
###############
Settings::setupTheme();
-Settings::session()->param("theme", Settings::css());
+Settings::session()->param("theme", Settings::theme('css'));
Settings::session()->param("bgcolor", Settings::bgcol());
getHeader();
<a class="a_" href="main.cgi">Log</a><hr>
<a class="a_" href="stats.cgi">Stats</a><hr>
<font size="2"><b>Jump to Sections</b><br>
-<a href="#categories">Categories</a><br>
-<a href="#vars">System</a><br>
-<a href="#dbsets">DB Fix</a><br>
-<a href="#passets">Pass</a><br>
-<a href="#backup">Backup</a>
+[<a href="#categories"><b>Categories</b></a>]<br>
+[<a href="#vars"><b>System</b></a>]<br>
+[<a href="#dbsets"><b>DB Fix</b></a>]<br>
+[<a href="#passets"><b>Pass</b></a>]<br>
+[<a href="#backup"><b>Backup</b></a>]
</font>
<hr>
<br>
$v = $tz;
}
$v = '<input name="var'.$i.'" type="text" value="'.$v.'" size="12">';
+ $d = '[<b><a href="time_zones.cgi" target=_blank>'.$d.'</a></b>]';
}
elsif($n eq "DATE_UNI"){
my($l,$u)=("","");
<a href="#top">↟</a> Configuration status -> <b>$status</b> <a href="#bottom">↡</a>
</div>
<br>
- <div id="rz" style="text-align:left; width:640px; padding:10px; background-color:).&Settings::bgcol.qq(">
+ <div id="rz" style="text-align:left; width:640px; padding:10px;">
<table border="0" width="100%">
sub getHeader {
print $cgi->header(-expires=>"+6s", -charset=>"UTF-8");
-print $cgi->start_html(-title => "Personal Log", -BGCOLOR=>&Settings::bgcol,
+print $cgi->start_html(-title => "Personal Log", -BGCOLOR=>Settings::theme('colBG'),
-onload => "onBodyLoadGeneric();",
- -style => [
+ -style => [
{ -type => 'text/css', -src => 'wsrc/jquery-ui.css' },
{ -type => 'text/css', -src => 'wsrc/jquery-ui.theme.css' },
{
- -type => 'text/css',
- -src => 'wsrc/jquery-ui-timepicker-addon.css'
+ -type => 'text/css',
+ -src => 'wsrc/jquery-ui-timepicker-addon.css'
},
{ -type => 'text/css', -src => 'wsrc/tip-skyblue/tip-skyblue.css' },
{
- -type => 'text/css',
- -src => 'wsrc/tip-yellowsimple/tip-yellowsimple.css'
+ -type => 'text/css',
+ -src => 'wsrc/tip-yellowsimple/tip-yellowsimple.css'
},
- { -type => 'text/css', -src => "wsrc/".&Settings::css },
+ { -type => 'text/css', -src => Settings::theme('css') },
],
-script => [
{ -type => 'text/javascript', -src => 'wsrc/main.js' },
sub printHeader {
my $title = shift;
+&Settings::setupTheme;
print $cgi->header(-expires=>"+6os");
-print $cgi->start_html(-title => $title, -BGCOLOR => &Settings::bgcol,
+print $cgi->start_html(-title => $title, -BGCOLOR => Settings::theme('colBG'),
-script=> [ {-type => 'text/javascript', -src => 'wsrc/jquery.js'},
{-type => 'text/javascript', -src => 'wsrc/jquery-ui.js'},
{-type => 'text/javascript', -src => 'wsrc/main.js'}
],
- -style => [{-type => 'text/css', -src => "wsrc/".&Settings::css}, {-type => 'text/css', -src => "wsrc/print.css"},
+ -style => [ {-type => 'text/css', -src => Settings::theme('css')},
{-type => 'text/css', -src => 'wsrc/jquery-ui.css'},
{-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'},
- {-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'},
- { -type => 'text/css', -src => "wsrc/".&Settings::css }
+ {-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'}
],
-onload => "onBodyLoadGeneric()");
</td></tr>
</table><input type="hidden" name="confirmed" value="1"></form>';
- print "<center><div style='background-color:".&Settings::bgcol."'>\n$tbl\n</div></center>";
+ print qq(<div style="marging:5px;padding:10px;">$tbl</div>);
print $cgi->end_html();
}
use DBI;
use lib "system/modules";
require Settings;
+use CGI::Carp qw(fatalsToBrowser set_message);
+BEGIN {
+ sub handle_errors {
+ my $msg = shift;
+ print "<html><body><h2>LifeLog Server Error</h2>";
+ print "<pre>@[$ENV{PWD}].Error: $msg</pre></body></html>";
+
+ }
+ set_message(\&handle_errors);
+}
my $cgi = CGI->new();
my $session = new CGI::Session("driver:File",$cgi, {Directory=>&Settings::logPath, SameSite=>'Lax'});
my $sid=$session->id();
my $cookie = $cgi->cookie(CGISESSID => $sid);
-my $db;
+my ($db,$DB_NAME,$PAGE_EXCLUDES, $DBG, $frm)="";
my $alias = $cgi->param('alias');
my $passw = $cgi->param('passw');
my $pass;
-my ($DBG,$frm) = "";
+
#Codebase release version. Release in the created db or existing one can be different, through time.
my $SCRIPT_RELEASE = Settings::release();
my $BACKUP_ENABLED = 0;
my $AUTO_SET_TIMEZONE = 0;
my $TIME_ZONE_MAP = 0;
-my ($DB_NAME,$PAGE_EXCLUDES);
my $VW_OVR_SYSLOGS=0;
my $VW_OVR_WHERE="";
my $LOGOUT_RELOGIN_TXT='No, no, NO! Log me In Again.';
try{
checkAutologinSet();
logout() if($cgi->param('logout'));
- if(processSubmit()==0){
+ if(processSubmit()==0){
+ my ($css,$colBG,$colSHDW) = (Settings::theme('css'),Settings::theme('colBG'),Settings::theme('colSHDW'));
print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);
print $cgi->start_html(
-title => "Personal Log Login",
- -BGCOLOR => &Settings::bgcol,
+ # -BGCOLOR => $colBG,
-script=> [{-type => 'text/javascript', -src => 'wsrc/main.js'},
{-type => 'text/javascript', -src => 'wsrc/jquery.js'},
{-type => 'text/javascript', -src => 'wsrc/jquery-ui.js'}],
- -style => [{-type => 'text/css', -src => "wsrc/".&Settings::css},
+ -style => [ {-type => 'text/css', -src => $css},
{-type => 'text/css', -src => 'wsrc/jquery-ui.css'},
{-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'},
{-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'}],
my $hst = "";
$hst = `hostname` . "($ht[0])" if (@ht);
- $frm = qq(
+ $frm = <<HTML;
<form id="frm_login" action="login_ctr.cgi" method="post">
<table border="0" width="50%"
- style="box-sizing: border-box; margin-bottom: 5px; box-shadow: 5px 5px 5px #9baec8;">
+ style="opacity: 1; box-sizing: border-box; margin-bottom: 5px; box-shadow: 5px 5px 5px $colSHDW;">
<tr class="r0">
<td colspan="3"><h3>Welcome to Life Log</h3></td>
</tr>
- <tr class="r1" style="border-left:1px solid black; border-right:1px solid black;">
+ <tr class="r1">
<td align="right">Alias:</td><td><input type="text" name="alias" value="$alias"/></td><td></td>
</tr>
- <tr class="r1" style="border-left:1px solid black; border-right:1px solid black;">
+ <tr class="r1">
<td align="right">Password:</td><td><input type="password" name="passw" value="$passw"/></td><td></td>
</tr>
<tr class="r1">
- <td colspan="3" style="border-left:1px solid black; border-right:1px solid black;"><font color="red">NOTICE!</font>
- Alias will create a new database if it doesn't exist. Note down your password.
+ <td colspan="3" class="log">
+ <span class="log"><font color="red">NOTICE!</font>
+ The Alias entry is used for the database name here,
+ a new database will be created for you if it doesn't exist.
+ Make sure you note down your password.</span>
<input type="hidden" name="CGISESSID" value="$sid"/>
<input type="hidden" name="login" value="1"/></td></tr>
<tr class="r0"><td colspan="2">Host -> <b>$hst</b></td><td><input type="submit" value="Login"/></td></tr>
- </table></form>);
+ </table></form>
+HTML
print qq(<br><br>
- <div class="rz" style="vertical-align:middle;text-align:center; width: 60% !important;">
+ <div class="rz login">
$frm
<br>
<a href="https://github.com/wbudic/LifeLog" target="_blank" style="font-size:small">
- <div style="display: inline-block; vertical-align: middle; text-align: center; width:50%">
+ <div style="display: inline-block; vertical-align: middle; text-align: center; width:50%; opacity: 0.8;">
<div style="display:table-cell; height:20px; vertical-align: middle;">
<img src="wsrc/images/pingy.svg" height="30px"> LifeLog v.).Settings::release().qq(</a>
</div>
print $cgi->header(-expires=>"0s", -charset=>"UTF-8", -cookie=>$cookie);
- print $cgi->start_html(-title => "Personal Log Login", -BGCOLOR=>"black",
- -style =>{-type => 'text/css', -src => 'wsrc/'.Settings::css()},
+ print $cgi->start_html(-title => "Personal Log Login",
+ -style =>{-type => 'text/css', -src => Settings::theme('css')},
);
$LOGOUT_IFRAME = "" if not $LOGOUT_IFRAME_ENABLED;
print qq(<div class="rz"><h2>You have properly logged out of the Life Log Application!</h2>
my $stmD = "";
my $sm_reset_all;
my $rec_limit = Settings::recordLimit();
-### Page specific settings Here
-my $TH_CSS = Settings::css();
-my $BGCOL = Settings::bgcol();
#Set to 1 to get debug help. Switch off with 0.
my $DEBUG = Settings::debug();
#END OF SETTINGS
##Handle Session Keeps
$sss->expire(Settings::sessionExprs());
-$sss->param('theme', $TH_CSS);
-$sss->param('bgcolor', $BGCOL);
+$sss->param('theme', Settings::theme('css'));
+$sss->param('bgcolor', Settings::theme('colBG'));
#sss->param('sss_main', $today);
#
#Reset Clicked
$sp3 = '<span class="ui-icon ui-icon-arrow-4-diag"></span>';
my $std_bck = "background-image:url('".&Settings::transimage."');";
-$std_bck = "background-color:$BGCOL;" if !&Settings::transparent;
+$std_bck = "background-color:".Settings::theme('colBG').";" if !&Settings::transparent;
my $auto_logoff = &Settings::autoLogoff;
if($isPUBViewMode){
my $srh = qq(
<form id="frm_srch" action="main.cgi">
- <table class="tbl" border="0" style="background-color:$BGCOL" width=").&Settings::pagePrcWidth.qq(%">
+ <table class="tbl" border="0" style="background-color:).Settings::theme('colBG').qq(" width=").&Settings::pagePrcWidth.qq(%">
<tr class="r0">
<td colspan="2"><b>View By/Search</b>
<a id="srch_close" href="#" onclick="return hide('#div_srh');">$sp1</a>
print $cgi->header( -expires => "+0s", -charset => "UTF-8" );
print $cgi->start_html(
-title => "Personal Log Login",
- -BGCOLOR => $BGCOL,
+ -BGCOLOR => Settings::theme('colBG'),
-script =>
{ -type => 'text/javascript', -src => 'wsrc/main.js' },
-style => { -type => 'text/css', -src => 'wsrc/main.css' },
#Bug 26 -Fixed here by prefixing to collected html body buffer.
$BUFFER = $cgi->start_html(
-title => "Personal Log",
- -BGCOLOR => $BGCOL,
+ -BGCOLOR => Settings::theme('colBG'),
-onload => "onBodyLoad('$toggle','".&Settings::language."','".&Settings::timezone."','$today','".&Settings::sessionExprs."','$rs_cur',".&Settings::dbVLSZ.");",
-style => [
{ -type => 'text/css', -src => 'wsrc/jquery-ui.css' },
{ -type => 'text/css', -src => 'wsrc/quill/monokai-sublime.min.css' },
{ -type => 'text/css', -src => 'wsrc/quill/quill.snow.css' },
{ -type => 'text/css', -src => 'wsrc/jquery.sweet-dropdown.css' },
- { -type => 'text/css', -src => "wsrc/$TH_CSS" },
+ { -type => 'text/css', -src => Settings::theme('css') },
],
-script => [
{ -type => 'text/javascript', -src => 'wsrc/main.js' },
my $CSS=<<_____CSS;
.main div {
font-family: Bookman;
- text-align: left;
+ text-align: left;
+ margin:5px;
}
.info span {
_____CSS
print $cgi->header(-expires=>"+6os", -charset=>"UTF-8");
-print $cgi->start_html(-title => "Log Data Stats", -BGCOLOR=>Settings::bgcol(),
+print $cgi->start_html(-title => "Log Data Stats",
-script=> [{-type => 'text/javascript', -src => 'wsrc/main.js'},
{-type => 'text/javascript', -src => 'wsrc/jquery.js'},
{-type => 'text/javascript', -src => 'wsrc/jquery-ui.js'}],
-style => [{-type => 'text/css', -src => 'wsrc/jquery-ui.css'},
{-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'},
{-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'},
- {-type => 'text/css', -src => "wsrc/".Settings::css()},
+ {-type => 'text/css', -src => Settings::theme('css')},
{-script=>$CSS}
],
-head => style({-type => 'text/css'}, $CSS),
use DateTime::Duration;
use DBI;
-use CGI::Carp qw(fatalsToBrowser set_message);
use Scalar::Util qw(looks_like_number);
use experimental 'switch';
-
+use CGI::Carp qw(fatalsToBrowser set_message);
BEGIN {
sub handle_errors {
my $msg = shift;
sub release {$RELEASE_VER}
sub logPath {$LOG_PATH} # <-@2021-08-15 something was calling as setter, can't replicate. On reset of categories in config.cgi.
sub logPathSet {$S_ = shift;$LOG_PATH = $S_ if $S_;return $LOG_PATH}#<-has now setter method nothing it is actually calling.
-sub theme {$THEME}
sub timezone {$TIME_ZONE}
sub transparent {$TRANSPARENCY}
sub transimage {$TRANSIMAGE}
}
return $ret;
}
+
+# @new since v.2.4 (20210903), it is staggaring how many options we have to setup colors and style, CSS, HTML, CNF
+# CNF should be only used. So the code and css files doesn't have to change. For now CNF isn't used, but the following:
+my %theme = (css=>'wsrc/main.css',colBG=>'#c8fff8',colSHDW=>'#9baec8;');
+sub theme{$S_=shift; return $theme{$S_}}
sub setupTheme {
given ($THEME){
- when ("Sun") { $BGCOL = 'goldenrod'; $TH_CSS = "main_sun.css"; }
- when ("Moon") { $BGCOL = '#000000'; $TH_CSS = "main_moon.css"; }
- when ("Earth") { $BGCOL = 'forestgreen'; $TH_CSS = "main_earth.css";} # Used to be $BGCOL = '#26be54';
+ when ("Sun") { %theme = (css=>'wsrc/main_sun.css', colBG=>'#FFD700', colSHDW=>'#FFD700') }
+ when ("Moon") { %theme = (css=>'wsrc/main_moon.css', colBG=>'#000000', colSHDW=>'#DCDCDC') }
+ when ("Earth") { %theme = (css=>'wsrc/main_earth.css', colBG=>'#228B22', colSHDW=>'#8FBC8F') }
default{
- # Standard;
- $BGCOL = '#c8fff8';
- $TH_CSS = 'main.css';
+ %theme = (css=>'wsrc/main.css',colBG=>'#c8fff8',colSHDW=>'#9baec8'); # Standard;
}
}
}
}
sub printDebugHTML {
- my $msg = shift;
- print qq(<!-- $msg -->);
+ my $msg = shift; print qq(<!-- $msg -->) if $msg;
}
sub toLog {
release {$RELEASE_VER}
logPath {$LOG_PATH}
logPathSet {$LOG_PATH}
-theme {$THEME}
timezone {$TIME_ZONE}
transparent {$TRANSPARENCY}
transimage {$TRANSIMAGE}
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
font-size: 14px;
background-image: url('images/page-bck-std.png');
+ margin: 0;
+ padding:0;
}
p {
font-family: Bookman;
padding: 2%;
margin: 0px auto;
}
+.login {
+
+ vertical-align: middle; text-align:center; width: 60% !important;
+ background-repeat: no-repeat;
+ background:#b2f8ef url('images/std--login-bck.png');
+ opacity: 1;
+}
div#rz {
border: 1px solid black;
text-align: left;
color:midnightblue;
}
a:link {
- color:#5b06fa;
+ color:#dafeff;
}
a:visited {
- color: #2d7081;
+ color: #472f80;
}
a:hover {
- color: #2d7081;
+ color: #ff4d21;
font-style:normal;
}
a:active {
$(id).show();
}
else{
- $(id).toggle();
+ var distance = $(id).offset().top;
+ if($(this).scrollTop() <= distance){
+ $(id).toggle();
+ }
}
-
}
else{
$(id).toggle();
}
-
$("html, body").animate({ scrollTop: 0 }, "fast");
return false;
}
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
font-size: 14px;
background-image: url('images/page-bck-earth.png');
+ background-repeat: no-repeat;
+ margin: 0;
+ padding:0;
}
p {
font-family: Bookman;
padding: 2%;
margin: 0px auto;
}
+.login {
+ vertical-align: middle; text-align:center; width: 60% !important;
+ background-image:repeating-radial-gradient(cyan, green, brown)
+}
div#rz {
border: 1px solid black;
text-align: left;
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
font-size: 14px;
background-image: url('images/page-bck-moon.png');
+
}
p {
font-family: Bookman;
margin: 0px auto;
padding:10px;
}
+.login {
+
+ vertical-align: middle; text-align:center; width: 60% !important;
+ background-repeat: no-repeat;
+ background:#64614e7a;
+}
div#rz {
border: 1px solid white;
text-align: left;
body{
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Bookman,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
font-size: 14px;
+ background-color: #FFD700;
background-image: url('images/page-bck-sun.png');
+ background-repeat: no-repeat;
+ margin: 0;
+ padding:0;
}
p {
font-family: Bookman;
padding: 2%;
margin: 0px auto;
}
+.login {
+
+ vertical-align: middle; text-align:center; width: 60% !important;
+ background:#b2f8ef url('images/Sun-Rotating.gif');
+ background-repeat: repeat;
+ background2:#ffd9007a;
+}
div#rz {
border: 1px solid black;
text-align: left;
- background-color: #5d740e;
+ background-color: #ffeb35;
color: #000;
vertical-align: top;
align-self: baseline;