From: wbudic Date: Tue, 5 Mar 2019 04:09:08 +0000 (+1100) Subject: Chrome Browser testing and style fixes. Date bug fix. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=68e08ee1438f15e4097eb389e758f35bb57a4c20;p=LifeLog.git Chrome Browser testing and style fixes. Date bug fix. --- diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index 8e5c166..34c628d 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -189,13 +189,16 @@ if($tbl_start>0){ }else{ $tfId = 1; } - my @chunks = split(/($re_a_tag)/si , $log) ; - - foreach my $chunks_i ( @chunks ) { - next if $chunks_i =~ /$re_a_tag/ ; - $chunks_i =~ s/($RE{URI}{HTTP})/$1<\/a>/gsi; + + #Replace with a full link an HTTP URI + my @chnks = split(/($re_a_tag)/si , $log) ; + foreach my $ch_i ( @chnks ) { + next if $ch_i =~ /$re_a_tag/ ; + $ch_i =~ s/https/http/gsi; + $ch_i =~ s/($RE{URI}{HTTP})/$1<\/a>/gsi; } - $log = join('' , @chunks) ; + $log = join('' , @chnks) ; + $tbl = $tbl . ''. $dt->ymd . ''. '' . $dt->hms . "" . @@ -244,9 +247,13 @@ if($tbl_start>0){ } $tbl = $tbl . ' - - -
Keywords: + + +   + + +
+
Keywords:
'; @@ -260,15 +267,18 @@ my $frm = qq(
Date:hms . qq(">  -   -   +   + Category: Log: ).$cats.qq(  Ammount: - + + + + diff --git a/htdocs/cgi-bin/remove.cgi b/htdocs/cgi-bin/remove.cgi index 9a876a1..a7b8214 100755 --- a/htdocs/cgi-bin/remove.cgi +++ b/htdocs/cgi-bin/remove.cgi @@ -1,5 +1,8 @@ #!/usr/bin/perl -package PersonalLog; +# +# Programed in vim by: Will Budic +# Open Source License -> https://choosealicense.com/licenses/isc/ +# use strict; use warnings; @@ -17,29 +20,21 @@ my $database = "../../dbLifeLog/data_log.db"; my $dsn = "DBI:$driver:dbname=$database"; my $userid = ""; my $password = ""; -my $dbh = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) +my $db = DBI->connect($dsn, $userid, $password, { RaiseError => 1 }) or die "

Error->"& $DBI::errstri &"

"; - - - - - - my $today = DateTime->now; -$today->set_time_zone( 'Australia/Sydney' ); + $today->set_time_zone( 'Australia/Sydney' ); my $stmtCat = "SELECT * FROM CAT;"; - - -my $sth = $dbh->prepare( $stmtCat ); -my $rv = $sth->execute() or die or die "

Error->"& $DBI::errstri &"

"; +my $st = $db->prepare( $stmtCat ); +my $rv = $st->execute() or die or die "

Error->"& $DBI::errstri &"

"; my %hshCats; my $tbl_rc =0; - while(my @row = $sth->fetchrow_array()) { +while(my @row = $st->fetchrow_array()) { $hshCats{$row[0]} = $row[1]; - } +} my $stmS = "SELECT rowid, ID_CAT, DATE, LOG from LOG WHERE"; @@ -47,23 +42,46 @@ my $stmE = " ORDER BY DATE DESC, rowid DESC;"; my $tbl = '
'; -my $confirmed = $q->param('confirmed'); -if (!$confirmed){ - print $q->header(-expires=>"+6os"); - print $q->start_html(-title => "Personal Log Record Removal", - -script=>{-type => 'text/javascript', -src => 'wsrc/main.js'}, - -style =>{-type => 'text/css', -src => 'wsrc/main.css'} - ); +print $q->header(-expires=>"+6os"); + +my $datediff = $q->param("datediff"); +my $confirmed = $q->param('confirmed'); +if ($datediff){ + print $q->start_html(-title => "Date Difference Report", + -script=>{-type => 'text/javascript', -src => 'wsrc/main.js'}, + -style =>{-type => 'text/css', -src => 'wsrc/main.css'} - &NotConfirmed; - print $q->end_html; + ); + &DisplayDateDiffs; } else{ - &ConfirmedDelition; + if (!$confirmed){ + print $q->start_html(-title => "Personal Log Record Removal", + -script=>{-type => 'text/javascript', -src => 'wsrc/main.js'}, + -style =>{-type => 'text/css', -src => 'wsrc/main.css'} + + ); + + &NotConfirmed; + } + else{ + &ConfirmedDelition; + } } -$dbh->disconnect(); +print $q->end_html; +$db->disconnect(); +exit; + +sub DisplayDateDiffs{ + $tbl = '
DateTimeLogCategory
+

Under Development Sorry!

'; + + $tbl .= '
'; + +print "
".$tbl."
"; +} sub ConfirmedDelition{ @@ -73,8 +91,8 @@ sub ConfirmedDelition{ foreach my $prm ($q->param('chk')){ $stm = $stmS . "rowid = '" . $prm ."';"; - $sth = $dbh->prepare( $stm ); - $rv = $sth->execute() or die or die "

Error->"& $DBI::errstri &"

"; + $st = $db->prepare( $stm ); + $rv = $st->execute() or die or die "

Error->"& $DBI::errstri &"

"; if($rv < 0) { print "

Error->"& $DBI::errstri &"

"; } @@ -83,27 +101,28 @@ sub ConfirmedDelition{ print $q->redirect('main.cgi'); + $st->finish; } sub NotConfirmed{ #Get prms and build confirm table and check my $stm = $stmS ." "; -foreach my $prm ($q->param('chk')){ - $stm = $stm . "rowid = '" . $prm . "' OR "; -} + foreach my $prm ($q->param('chk')){ + $stm = $stm . "rowid = '" . $prm . "' OR "; + } #rid=0 hack! ;) $stm = $stm . "rowid = '0' " . $stmE; # -$sth = $dbh->prepare( $stm ); -$rv = $sth->execute() or die or die "

Error->"& $DBI::errstri &"

"; +$st = $db->prepare( $stm ); +$rv = $st->execute() or die or die "

Error->"& $DBI::errstri &"

"; if($rv < 0) { print "

Error->"& $DBI::errstri &"

"; } my $r_cnt = 0; -while(my @row = $sth->fetchrow_array()) { +while(my @row = $st->fetchrow_array()) { my $ct = $hshCats{@row[1]}; my $dt = DateTime::Format::SQLite->parse_datetime( $row[2] ); @@ -132,4 +151,6 @@ if($r_cnt>1){ print '
' . $tbl .'
'; + $st->finish; } + diff --git a/htdocs/cgi-bin/stats.cgi b/htdocs/cgi-bin/stats.cgi index d659fe2..ce614bb 100755 --- a/htdocs/cgi-bin/stats.cgi +++ b/htdocs/cgi-bin/stats.cgi @@ -39,7 +39,7 @@ print $q->start_html(-title => "Log Data Stats", ); -my $tbl = ''; +my $tbl = '
Personal Log Data Stats
'; @@ -68,9 +68,9 @@ my $processes = `$prc | sort -u -r -`; #Strip kernel 0 processes reported $processes =~ s/\s*0.00.*//gd; -$tbl = $tbl . ' - diff --git a/htdocs/cgi-bin/wsrc/.main.js.swp b/htdocs/cgi-bin/wsrc/.main.css.swp similarity index 53% rename from htdocs/cgi-bin/wsrc/.main.js.swp rename to htdocs/cgi-bin/wsrc/.main.css.swp index b39e577..77e4799 100644 Binary files a/htdocs/cgi-bin/wsrc/.main.js.swp and b/htdocs/cgi-bin/wsrc/.main.css.swp differ diff --git a/htdocs/cgi-bin/wsrc/main.js b/htdocs/cgi-bin/wsrc/main.js index 58bd665..78f7e0e 100644 --- a/htdocs/cgi-bin/wsrc/main.js +++ b/htdocs/cgi-bin/wsrc/main.js @@ -44,8 +44,7 @@ function setNow(){ var mm = fix0(dt.getMonth()+1); var dd = fix0(dt.getUTCDate()); date.value = dt.getFullYear()+"-"+mm+"-"+dd+ " " + - dt.getHours() + ":" + dt.getMinutes() +":"+dt.getSeconds(); - + fix0(dt.getHours()) + ":" + fix0(dt.getMinutes()) +":"+ fix0(dt.getSeconds()); return false; } @@ -166,3 +165,8 @@ function submitNewCategory(){ frm.cchg.value = cid.value; return true; } + +function dateDiffSelected(){ + document.getElementById("datediff").value = 1; + return true; +}
* PERSONAL LOG DATA STATS *
Number of Records:'. +$tbl = $tbl . '
Number of Records:'. $log_rc.'
No. of Records This Year:'. +
No. of Records This Year:'. $log_this_year_rc.'
# Sum of Expenses For Year '.$today->year(). ''.$expense.'