}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})/<a href="$1" target=_blank>$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})/<a href="$1" target=_blank>$1<\/a>/gsi;
}
- $log = join('' , @chunks) ;
+ $log = join('' , @chnks) ;
+
$tbl = $tbl . '<tr class="r'.$tfId.'"><td id="y'.$id.'">'. $dt->ymd . '</td>'.
'<td id="t'.$id.'">' . $dt->hms . "</td>" .
}
$tbl = $tbl . '<tr class="r0"><td colspan="6" align="right">
- <input type="reset" value="Unselect All"/><input type="submit" value="Delete Selected"/>
- </form></td></tr>
-<tr class="r0"><td><form id="frm_srch" action="main.cgi">Keywords:</td><td colspan="4">
+
+ <input type="hidden" name="datediff" id="datediff" value="0"/>
+ <input type="submit" value="Date Diff Selected" onclick="return dateDiffSelected()"/>
+ <input type="reset" value="Unselect All"/>
+ <input type="submit" value="Delete Selected"/>
+ </td></tr></form>
+<tr class="r0"><form id="frm_srch" action="main.cgi"><td>Keywords:</td><td colspan="4">
<input name="keywords" type="text" size="60"/></td>
<td><input type="submit" value="Search"/></form></td></tr>
</table>';
<td>Date:</td><td id="al"><input id="ed" type="text" name="date" size="16" value=") .$today->ymd.
" ". $today->hms .
qq("> <button type="button" onclick="return setNow();">Now</button>
- <button type="reset">Clear</button>
- <button id="btn_srch" onclick="toggleSearch(this); return false;">Show Search</button></td>
+ <button type="reset">Reset</button>
+ </td>
<td>Category:</td>
</tr>
<tr><td>Log:</td>
<td id="al"><textarea id="el" name="log" rows="2" cols="60"></textarea></td>
<td>).$cats.qq(</td></tr>
<tr><td><a href="#bottom">↡</a> Ammount:</td>
- <td id="al"><input id="am" name="am" type="number" step="any"></td>
+ <td id="al">
+ <input id="am" name="am" type="number" step="any">
+ <button id="btn_srch" onclick="toggleSearch(this); return false;"i style="float: right;">Show Search</button>
+ </td>
<td><input type="submit" value="Submit"/>
</td>
</tr></table>
#!/usr/bin/perl
-package PersonalLog;
+#
+# Programed in vim by: Will Budic
+# Open Source License -> https://choosealicense.com/licenses/isc/
+#
use strict;
use warnings;
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 "<p>Error->"& $DBI::errstri &"</p>";
-
-
-
-
-
-
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 "<p>Error->"& $DBI::errstri &"</p>";
+my $st = $db->prepare( $stmtCat );
+my $rv = $st->execute() or die or die "<p>Error->"& $DBI::errstri &"</p>";
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";
my $tbl = '<form name="frm_log_del" action="remove.cgi" onSubmit="return formDelValidation();">
<table class="tbl">
<tr class="r0"><th>Date</th><th>Time</th><th>Log</th><th>Category</th></tr>';
-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 = '<table class="tbl">
+ <tr class="r0"><h2>Under Development Sorry!</h2></tr>';
+
+ $tbl .= '</table>';
+
+print "<div>".$tbl."</div>";
+}
sub ConfirmedDelition{
foreach my $prm ($q->param('chk')){
$stm = $stmS . "rowid = '" . $prm ."';";
- $sth = $dbh->prepare( $stm );
- $rv = $sth->execute() or die or die "<p>Error->"& $DBI::errstri &"</p>";
+ $st = $db->prepare( $stm );
+ $rv = $st->execute() or die or die "<p>Error->"& $DBI::errstri &"</p>";
if($rv < 0) {
print "<p>Error->"& $DBI::errstri &"</p>";
}
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 "<p>Error->"& $DBI::errstri &"</p>";
+$st = $db->prepare( $stm );
+$rv = $st->execute() or die or die "<p>Error->"& $DBI::errstri &"</p>";
if($rv < 0) {
print "<p>Error->"& $DBI::errstri &"</p>";
}
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] );
print '<center><div>' . $tbl .'</div></center>';
+ $st->finish;
}
+