From c1aa47d0f84720d1cb0635fe9acea973fd2ba3cc Mon Sep 17 00:00:00 2001 From: wbudic Date: Sat, 21 Aug 2021 23:40:15 +1000 Subject: [PATCH] Upd. log change interaction on a edited log entry. --- htdocs/cgi-bin/system/modules/Settings.pm | 3 +- htdocs/cgi-bin/wsrc/main.js | 77 +++++++++++++++++++---- 2 files changed, 68 insertions(+), 12 deletions(-) diff --git a/htdocs/cgi-bin/system/modules/Settings.pm b/htdocs/cgi-bin/system/modules/Settings.pm index f278ed8..a5b3f79 100644 --- a/htdocs/cgi-bin/system/modules/Settings.pm +++ b/htdocs/cgi-bin/system/modules/Settings.pm @@ -400,7 +400,7 @@ return qq( sub getConfiguration { my ($db, $hsh) = @_; my $fh; - my $ftzmap = $ENV{'PWD'}.'tz.map'; + my $ftzmap = 'tz.map'; try { my $st = $db->prepare("SELECT ID, NAME, VALUE FROM CONFIG;"); $st->execute(); @@ -762,6 +762,7 @@ my $reg_autonom = qr/(<<)(.+?)(<)(\n*.+\s*)(>{3,})/mp; sub parseAutonom { #Parses autonom tag for its crest value, returns undef if tag not found or wrong for passed line. my $tag = shift; my $line = shift; + return if $line =~ /^\s*[\/#]/; #standard start of single line of comment, skip. if($line =~ /$reg_autonom/g){ my ($t,$val) = ($2,$4); $val =~ s/""$//g; #empty is like not set diff --git a/htdocs/cgi-bin/wsrc/main.js b/htdocs/cgi-bin/wsrc/main.js index 51da926..15668dc 100644 --- a/htdocs/cgi-bin/wsrc/main.js +++ b/htdocs/cgi-bin/wsrc/main.js @@ -20,6 +20,7 @@ var TIME_STAMP; var LOCALE; var TIMEZONE; var DBI_LVAR_SZ; +var EDIT_LOG_TXT = ""; function onBodyLoadGeneric() { $("input[type=submit], input[type=reset], .ui-widget-content, button, .a_").button(); @@ -447,6 +448,7 @@ function validate(dt, log) { if(msg){ return dialogModal( "Sorry Form Validation Failed", msg); } + return true; } function validTime(val) { @@ -492,7 +494,8 @@ function setNow() { date.value = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + seconds; $("#submit_is_edit").val("0"); - toggleDoc(true); + toggleDoc(true); + EDIT_LOG_TXT = ""; return false; } @@ -547,6 +550,7 @@ function edit(row) { var sticky = $("#s" + row); //RTF doc var isRTF = (rtf.val()>0?true:false); var isSticky = (sticky.val()>0?true:false); + var txt; if(!isRTF){ $('#rtf_doc').hide(); $('#tbl_doc').hide(); @@ -554,23 +558,22 @@ function edit(row) { $("#btn_load_doc").hide(); } - - $("html, body").animate({ scrollTop: 0 }, "slow"); + $("html, body").animate({ scrollTop: 0 }, "slow", function(){$("#el").focus()}); if (tag.length) { - $("#el").val(decodeToHTMLText(tag.val())); + txt = decodeToHTMLText(tag.val()); } else { - var txt = log.html(); + txt = log.html(); txt = txt.replace(/
/g,"\n"); txt = txt.replace(/^
/,""); txt = txt.replace(/<\/div>$/,""); - $("#el").val(decodeToText(txt)); + txt = decodeToText(txt); } - + $("#el").val(txt); EDIT_LOG_TXT = txt; $("#ed").val(ed_v.val() + " " + et_v.html()); //Time field var val = ea_v.text(); val = val.replace(/\,/g,""); - $("#am").val(val); //Amount field, fix 04-08-2019 HTML input doesn't accept formated string. + $("#am").val(val); //Amount field, fix 04-08-2019 HTML input doesn't accept formatted string. $("#RTF").prop('checked', isRTF); $("#STICKY").prop('checked', isSticky); @@ -1051,6 +1054,18 @@ function sumSelected() { return false; } + + + +/*