#END OF SETTINGS
my $BUFFER;
+sub toBuf {
+ $BUFFER .= shift;
+}
my $lang = Date::Language->new(Settings::language());
my $today = DateTime->now;
my $sqlCAT = "SELECT ID, NAME, DESCRIPTION FROM CAT ORDER BY ID;";
my $sqlVWL = "$stmS STICKY = 1 $stmE";
-PrintB (qq(## Using db -> $dsn\n)) if $DEBUG;
+toBuf (qq(## Using db -> $dsn\n)) if $DEBUG;
$st = $db->prepare($sqlCAT);
$st->execute() or LifeLogException->throw($DBI::errstri);
}
}
my $log_output =
-qq(<form id="frm_log" action="data.cgi" onSubmit="return formDelValidation();">
+qq(<FORM id="frm_log" action="data.cgi" onSubmit="return formDelValidation();">
<TABLE class="tbl" border="0" width=").&Settings::pagePrcWidth.qq(%">
<tr class="hdr">
<th>Date</th>
my $re_a_tag = qr/<a\s+.*?>.*<\/a>/si;
my $isInViewMode = rindex ($sqlVWL, 'PID<=') > 0 || rindex ($sqlVWL, 'ID_CAT=') > 0 || $prm_aa || rindex ($sqlVWL, 'REGEXP')>0;
- PrintB $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG;
+ toBuf $cgi->pre("###[Session PARAMS->isV:$isInViewMode|vc=$prm_vc|xc=$prm_xc|aa: $prm_aa|xc_lst=$prm_xc_lst|\@xc_lst=@xc_lst|keepExcludes=".&Settings::keepExcludes."] -> ".$sqlVWL) if $DEBUG;
if ( $log_start > 0 ) {
#Following is saying is in page selection, not view selection, or accounting on type of sticky entries.
if( !$isInViewMode && !$prm_vc && !$prm_xc && !$rs_keys && !$rs_dat_from ){
$sqlVWL = "$stmS STICKY != 1 $stmE";
- PrintB $cgi->pre("###2 -> ".$sqlVWL) if $DEBUG;
+ toBuf $cgi->pre("###2 -> ".$sqlVWL) if $DEBUG;
;
&buildLog(traceDBExe($sqlVWL));
}
sub traceDBExe {
my $sql = shift;
try{
- PrintB("do:$sql") if ($DEBUG);
+ toBuf("do:$sql") if ($DEBUG);
my $st = $db->prepare($sql);
$st -> execute() or LifeLogException->throw("Execute failed [$DBI::errstri]", show_trace=>1);
return $st;
}catch{
- LifeLogException->throw(error=>"Database error encountered.", show_trace=>1);
+ LifeLogException->throw(error=>"Database error encountered.", show_trace=>1);
}
}
sub buildLog {
my $pst = shift;
- #PrintB "## sqlVWL: $sqlVWL\n";
+ #toBuf "## sqlVWL: $sqlVWL\n";
while ( my @row = $pst->fetchrow_array() ) {
my $i = 0;
$id = $row[$i++]; #ID must be rowid in LOG.
} #while end
}#buildLog
- if ( $tfId == 1 ) { $tfId = 0; }
- else { $tfId = 1; }
- my ($tot,$tin);
- $tot = $sum + $ass - abs($exp);
- $tin = &cam($sum);
- $exp = &cam($exp);
- $ass = &cam($ass);
- $tot = &cam($tot);
- $tot = "<font color='red'>$tot</font>" if($tot<0);
-
- $log_output .= qq(
- <tr class="r$tfId">
- <td></td>
- <td></td>
- <td id="summary" colspan="4" style="text-align:right"># <i>Totals</i>: Assets [ $ass ] Inc [ $tin ] Exp [ <font color="red">$exp</font> ] <b>→ Gross [<i>$tot</i> ] </b></td>
- </tr>);
-
- ###
- &buildNavigationButtons;
- ###
-
- ##
- #Fetch Keywords autocomplete we go by words larger then three.
- #
- my $aw_cnt = 0;
- my $autowords = qq("gas","money","today");
+if ( $tfId == 1 ) { $tfId = 0; }
+else { $tfId = 1; }
+my ($tot,$tin);
+$tot = $sum + $ass - abs($exp);
+$tin = &cam($sum);
+$exp = &cam($exp);
+$ass = &cam($ass);
+$tot = &cam($tot);
+$tot = "<font color='red'>$tot</font>" if($tot<0);
+
+$log_output .= qq(
+<tr class="r$tfId">
+ <td></td>
+ <td></td>
+ <td id="summary" colspan="4" style="text-align:right"># <i>Totals</i>: Assets [ $ass ] Inc [ $tin ] Exp [ <font color="red">$exp</font> ] <b>→ Gross [<i>$tot</i> ] </b></td>
+</tr>);
- &fetchAutocomplete;
+###
+&buildNavigationButtons;
+###
- if ( $log_rc == 0 ) {
+##
+# Fetch Keywords autocomplete we go by words larger then three.
+#
+my $aw_cnt = 0;
+my $autowords = qq("gas","money","today");
- if ($stmD) {
- $log_output .= qq(<tr><td colspan="5">
- <b>Search Failed to Retrive any records on select: [<i>$stmD</i>] !</b></td></tr>');
- }
- elsif ($rs_keys) {
- my $criter = "";
- if ( $prm_vc > 0 ) {
- $criter = "->Criteria[" . $hshCats{$prm_vc} . "]";
- }
- $log_output .= qq(<tr><td colspan="5">
- <b>Search Failed to Retrive any records on keywords: [<i>$rs_keys</i>]$criter!</b></td></tr>);
- }
- else {
- if ($isInViewMode) { $log_output .= '<tr><td colspan="5"><b>You have reached the end of the data view!</b></td></tr>' }
- else{ $log_output .= '<tr><td colspan="5"><b>Database is New or Empty!</b></td></tr>'}
+&fetchAutocomplete;
+
+if ( $log_rc == 0 ) {
+
+ if ($stmD) {
+ $log_output .= qq(<tr><td colspan="5">
+ <b>Search Failed to Retrive any records on select: [<i>$stmD</i>] !</b></td></tr>');
+ }
+ elsif ($rs_keys) {
+ my $criter = "";
+ if ( $prm_vc > 0 ) {
+ $criter = "->Criteria[" . $hshCats{$prm_vc} . "]";
}
+ $log_output .= qq(<tr><td colspan="5">
+ <b>Search Failed to Retrive any records on keywords: [<i>$rs_keys</i>]$criter!</b></td></tr>);
}
+ else {
+ if ($isInViewMode) { $log_output .= '<tr><td colspan="5"><b>You have reached the end of the data view!</b></td></tr>' }
+ else{ $log_output .= '<tr><td colspan="5"><b>Database is New or Empty!</b></td></tr>'}
+ }
+}
- $log_output .= <<_TXT;
+$log_output .= <<_TXT;
<tr class="r0"><td colspan="2">Show All hidden with ➔
-<a id="menu_close" href="#" onclick="return showAll();"><span class="ui-icon ui-icon-heart" style="float:none;></span></a>
+<a id="menu_close" href="#" onclick="return showAll();"><span class="ui-icon ui-icon-heart" style="float:none;"></span></a>
<a href="#top">↟</a></td>
<td colspan="4" align="right">
<input type="reset" value="Unselect All"/>
<input id="del_sel" type="submit" value="Delete Selected"/>
</td></tr>
-</form>
-<form id="frm_srch" action="main.cgi">
- <tr class="r0"><td><b>Keywords:</b></td><td colspan="4" align="left">
- <input id="rs_keys2" name="keywords" type="text" size="60"/></td>
- <td><input type="submit" value="Search"/></td></tr>
-</form>
-</TABLE>
+</TABLE></FORM>
_TXT
+$log_output .= qq(<form id="frm_srch" action="main.cgi"><TABLE class="tbl" border="0" width=").&Settings::pagePrcWidth.qq(%">
+ <tr class="r0"><td><b>Keywords:</b></td><td colspan="4" align="left">
+ <input id="rs_keys2" name="keywords" type="text" size="60"/>
+ <input type="submit" value="Search"/></td></tr>
+ </TABLE>
+</form>);
+
my ( $sp1, $sp2, $sp3 );
$sp1 = '<span class="ui-icon ui-icon-heart"></span>';
$sp2 = '<span class="ui-icon ui-icon-circle-triangle-s"></span>';
</td>
<td align="right">
<span id="sss_status"></span>
- <input id="log_submit" type="submit" onclick="return saveRTF(-1, 'store');" value="Submit"/></div>
+ <input id="log_submit" type="submit" onclick="return saveRTF(-1, 'store');" value="Submit"/>
</td>
</tr>
<tr class="collpsd"><td colspan="3"></td></tr>
<button id="btnxca" onClick="return addExclude()"/>Add</button>
<button id="btnxca" type="button" onClick="return removeExclude()">Remove</button>
- <button id="btnxca type="button" onClick="return resetExclude()">Reset</button>
+ <button id="btnxca" type="button" onClick="return resetExclude()">Reset</button>
<button id="btn_cat" onclick="return viewExcludeCategory(this);">View</button>
- <input id="sss_xc" name="sss_xc" type="checkbox" $sss_checked> Keep In Session </input>
+ <input id="sss_xc" name="sss_xc" type="checkbox" $sss_checked/> Keep In Session
</td>
</tr>
<tr class="collpsd">$tdivxc</tr>
my $quill = &quill( $cgi->param('submit_is_edit') );
my $help = &help;
- ################################
- # Page PrintBout from here! #
-################################
+ ##################################
+ # Final Page Output from here! #
+ ##################################
-printB (qq(
+toBuf (qq(
<div id="menu" title="To close this menu click on its heart, and wait.">
<div class="hdr" style="marging=0;padding:0px;">
<a id="to_top" href="#top" title="Go to top of page."><span class="ui-icon ui-icon-arrowthick-1-n" style="float:none;"></span></a>
<a class="a_" onclick="return toggle('#tbl_hlp',true);">Help</a><hr>
<a class="a_" href="stats.cgi">Stats</a><hr>
<a class="a_" href="config.cgi">Config</a><hr>
-<a class="a_" id="lnk_show_all" onclick="return showAll();">Show All <span class="ui-icon ui-icon-heart"></a><hr>
+<a class="a_" id="lnk_show_all" onclick="return showAll();">Show All <span class="ui-icon ui-icon-heart"></span></a><hr>
$sm_reset_all
<a class="a_" href="login_ctr.cgi?logout=bye">LOGOUT</a><br><hr>
<span style="font-size: x-small; font-weight: bold;">$vmode</span><br>
<div>\n$log_output\n</div><br>
<div><a class="a_" href="stats.cgi">View Statistics</a></div><br>
<div><a class="a_" href="config.cgi">Configure Log</a></div><hr>
- <div><a class="a_" href="login_ctr.cgi?logout=bye">LOGOUT</a><hr><a name="bottom"/></div>
-<!-- Cat Data Start-->
+ <div><a class="a_" href="login_ctr.cgi?logout=bye">LOGOUT</a><hr><a name="bottom"></a></div>
+<!-- Cat Data Start -->
<span id="meta_cats">
$data_cats
</span>
-<!--Cat Data End->
+<!--Cat Data End -->
<!-- Page Settings Specifics date:20200222 -->
<script type="text/javascript">
- \$( function() {
- var tags = [$autowords];
- \$( "#rs_keys, #rs_keys2" ).autocomplete({
- source: tags
- });
- });
+ var AUTOWORDS = [$autowords];
</script>
));
STICKY=$sticky WHERE rowid="$edit_mode";
<br>);
#
- print $stm if $DEBUG;
+ toBuf $stm if $DEBUG;
#
my $dbUpd = DBI->connect( $dsn, $userid, $password, { RaiseError => 1 } ) or LifeLogException->throw("Execute failed [$DBI::errstri]");
if ($st->fetchrow_array() ) {
return;
}
- if ($dtCur > $dt){$sticky = 1; print $cgi->p("<b>Insert forced to be sticky, it is in the past!</b>");}
+ if ($dtCur > $dt){$sticky = 1; toBuf $cgi->p("<b>Insert forced to be sticky, it is in the past!</b>");}
$stm = qq(INSERT INTO LOG (ID_CAT, ID_RTF, DATE, LOG, AMOUNT, AFLAG, STICKY) VALUES ($cat,$rtf,'$date','$log',$am,$af,$sticky););
$st = traceDBExe($stm);
if($sssCDB){
$st = traceDBExe("SELECT LID FROM NOTES WHERE LID=".$lid[0].";");
if($st->fetchrow_array()){
$st = $db->do("DELETE FROM NOTES WHERE LID=".$lid[0].";");
- print qq(<p>Warning deleted (possible old) NOTES.LID[$lid[0]] -> lid:@lid</p>);
+ toBuf qq(<p>Warning deleted (possible old) NOTES.LID[$lid[0]] -> lid:@lid</p>);
}
$st = $db->prepare("INSERT INTO NOTES(LID, DOC) VALUES (?, ?);");
$st->execute($lid[0], $gzero[0]);
\@DB::args:@DB::args
\$DBI::err:$DBI::errstr
cnt:$cnt, cat:$cat, date:$date, log:$log, am:$am, af:$af, rtf:$rtf, sticky:$sticky);
-print $cgi->header,
+ print $cgi->header,
"<hr><font color=red><b>SERVER ERROR</b></font> on ".DateTime->now.
"<hr><pre>$pwd/$0 -> &".caller." -> [<font color=red><b>$DBI::errstr</b></font>] $err\n$dbg</pre>",
$cgi->end_html;
</td></tr>
<tr class="collpsd"><td>
<div id="rz" class="rz">
- <h2>L-Tags Specs</h2>
+ <h2>L-Tags Specs</h2>
<p class="rz">
Life Log Tags are simple markup allowing fancy formatting and functionality
for your logs HTML layout.
</p>
<p>
- <b><<B<<i>{Text To Bold}</i><b>>></b>
+ <b><<B<<i>{Text To Bold}</i>>></b>
</p>
<p>
- <b><<I<<i>{Text To Italic}</i><b>>></b>
+ <b><<I<<i>{Text To Italic}</i>>></b>
</p>
<p>
- <b><<TITLE<<i>{Title Text}</i><b>>></b>
+ <b><<TITLE<<i>{Title Text}</i>>></b>
</p>
<p>
- <b><<LIST<<i>{List of items delimited by new line to terminate item or with '~' otherwise.}</i><b>></b>
+ <b><<LIST<<i>{List of items delimited by new line to terminate item or with '~' otherwise.}</i>></b>
</p>
<p>
- <b><<IMG<<i>{url to image}</i><b>>></b>
+ <b><<IMG<<i>{url to image}</i>>></b>
</p>
<p>
- <b><<FRM<<i>{file name}_frm.png}</i><b>>></b><br><br>
+ <b><<FRM<<i>{file name}_frm.png}</i>>></b><br><br>
*_frm.png images file pairs are located in the ./images folder of the cgi-bin directory.<br>
These are manually resized by the user. Next to the original.
Otherwise considered as stand alone icons. *_frm.png Image resized to -> width="210" height="120"
<<FRM>my_cat_simon_frm.png> <<TITLE<Simon The Cat>>
This is my pet, can you hold him for a week while I am on holiday?
- </pre>
- </p>
- <p>
- <b><<LNK<<i>{url to image}</i><b>>></b><br><br>
+ </pre>
+ <p>
+ <b><<LNK<<i>{url to image}</i>>></b><br><br>
Explicitly tag an URL in the log entry.
Required if using in log IMG or FRM tags.
Otherwise link appears as plain text.
- </p>
- <hr>
- </p>
- <h3>Log Page Particulars</h3>
- ↟ or ↡ - Jump links to top or bottom of page respectivelly.
- </p>
+ </p>
+ <hr>
+ <h3>Log Page Particulars</h3><p> ↟ or ↡ - Jump links to top or bottom of page respectivelly. </p>
</div>
-</td></tr></table>
-)
-}
-sub printB {
- $BUFFER .= shift;
+</td></tr></table>)
}
sub outputPage {
-
-
- printB ($cgi->start_html(
- -title => "Personal Log",
- -BGCOLOR => $BGCOL,
- -onload => "onBodyLoad('$toggle','".Settings::timezone()."','$today','".&Settings::sessionExprs."',$rs_cur);",
- -style => [
+ #Bug 26 -Fixed here by prefixing to collected html body buffer.
+ $BUFFER = $cgi->start_html(
+ -title => "Personal Log",
+ -BGCOLOR => $BGCOL,
+ -onload => "onBodyLoad('$toggle','".Settings::timezone()."','$today','".&Settings::sessionExprs."',$rs_cur);",
+ -style => [
{ -type => 'text/css', -src => "wsrc/$TH_CSS" },
{ -type => 'text/css', -src => 'wsrc/jquery-ui.css' },
{ -type => 'text/css', -src => 'wsrc/jquery-ui.theme.css' },
{ -type => 'text/javascript', -src => 'wsrc/moment-timezone-with-data.js' },
{ -type => 'text/javascript', -src => 'wsrc/jquery.sweet-dropdown.js'}
- ],
- ));
-
-
- my $enc = $cgi->http('Accept-Encoding');
-
- if($enc =~ m/gzip/ && Settings->compressPage()){
+ ]) .
+ $BUFFER;
+
+ if(Settings->compressPage() && $cgi->http('Accept-Encoding') =~ m/gzip/){
print $cgi->header(-expires => "1s", -charset => "UTF-8", -Content_Encoding => 'gzip');
$BUFFER = gzip($BUFFER);
}