From 72371d8b9925bb2307935157ebc9655d82fd3cf3 Mon Sep 17 00:00:00 2001 From: Will Budic Date: Fri, 17 Nov 2023 16:50:51 +1100 Subject: [PATCH] Merge with current master from nomad. --- htdocs/cgi-bin/CNFServices.cgi | 56 ++- htdocs/cgi-bin/config.cgi | 2 +- htdocs/cgi-bin/contact.cnf | 37 ++ htdocs/cgi-bin/docs/EContactHashSpecs.md | 22 + htdocs/cgi-bin/index.cnf | 12 +- htdocs/cgi-bin/login_ctr.cgi | 1 + htdocs/cgi-bin/system/modules/CNFDateTime.pm | 1 + htdocs/cgi-bin/system/modules/CNFJSON.pm | 19 +- htdocs/cgi-bin/system/modules/CNFMeta.pm | 109 +++-- htdocs/cgi-bin/system/modules/CNFParser.pm | 448 ++++++++++-------- htdocs/cgi-bin/system/modules/CNFSQL.pm | 441 +++++++++++++++++ .../cgi-bin/system/modules/ContactsPlugin.pm | 161 +++++++ .../system/modules/DataProcessorPlugin.pm | 126 +++++ .../modules/DataProcessorWorldCitiesPlugin.pm | 88 ++++ .../modules/HTMLIndexProcessorPlugin.pm | 147 ++---- .../system/modules/HTMLProcessorPlugin.pm | 51 +- .../cgi-bin/system/modules/MarkdownPlugin.pm | 6 +- .../cgi-bin/system/modules/RSSFeedsPlugin.pm | 2 +- htdocs/cgi-bin/wsrc/feeds.js | 31 +- htdocs/cgi-bin/wsrc/main.css | 51 +- 20 files changed, 1436 insertions(+), 375 deletions(-) create mode 100644 htdocs/cgi-bin/contact.cnf create mode 100644 htdocs/cgi-bin/docs/EContactHashSpecs.md create mode 100644 htdocs/cgi-bin/system/modules/CNFSQL.pm create mode 100644 htdocs/cgi-bin/system/modules/ContactsPlugin.pm create mode 100644 htdocs/cgi-bin/system/modules/DataProcessorPlugin.pm create mode 100644 htdocs/cgi-bin/system/modules/DataProcessorWorldCitiesPlugin.pm diff --git a/htdocs/cgi-bin/CNFServices.cgi b/htdocs/cgi-bin/CNFServices.cgi index 651e8aa..03388ad 100755 --- a/htdocs/cgi-bin/CNFServices.cgi +++ b/htdocs/cgi-bin/CNFServices.cgi @@ -18,24 +18,22 @@ use feature qw(signatures); ## use CGI::Carp qw(fatalsToBrowser set_message); -## -# This is a entry point script (main). -## -use lib::relative "system/modules"; +use lib "/home/will/dev/LifeLog/htdocs/cgi-bin/system/modules"; +#use lib::relative "system/modules"; require CNFParser; require CNFNode; our $GLOB_HTML_SERVE = "'{}/*.cgi' '{}/*.htm' '{}/*.html' '{}/*.md' '{}/*.txt'"; our $script_path = $0; $script_path =~ s/\w+.cgi$//; -use constant LOG_Settings =>q( +use constant LOG_Settings => q( <<@<%LOG> file = web_server.log # Should it mirror to console too? console = 0 # Disable/enable output to file at all? - enabled = 0 + enabled = 1 # Tail size cut, set to 0 if no tail cutting is desired. - tail = 1000 + tail = 60 >> ); @@ -47,21 +45,27 @@ cgi { chomp $error; $cgi->render(text=>qq(You have unfortunately hit an cgi-bin::CNFHTMLServiceError
$error

- + ) ); } ); - exit CNFHTMLService($cgi); -}; + # my $p = $cgi->_body_params->{keyed}; + # $p->{'service'} = ['contacts']; + # $p->{'action'} = ['form']; + + ## + # This is a entry point script (main). + ## + exit CNFHTMLService($cgi); +}; -sub CNFHTMLService { - my ($cgi,$ptr) = (shift, undef); - my $cnf = CNFParser -> new (undef,{ DO_ENABLED => 1, HAS_EXTENSIONS=>1, ANONS_ARE_PUBLIC => 1, CGI=>$cgi }); - $cnf->parse(undef,_getServiceScript($cgi)); - $ptr = $cnf->data(); +sub CNFHTMLService($cgi) { + my $cnf = CNFParser -> new (undef,{ DO_ENABLED => 1, HAS_EXTENSIONS=>1, ANONS_ARE_PUBLIC => 1, CGI=>$cgi }); + $cnf -> parse(undef,_getServiceScript($cgi)); + my $ptr = $cnf->data(); $ptr = $ptr->{'PAGE'}; #say $$ptr if $ptr; $cgi -> render(text=>$$ptr); @@ -77,8 +81,30 @@ sub _getServiceScript($cgi) { if($service eq 'feeds'){ return _CNF_Script_For_Feeds(); } + elsif($service eq 'contacts'){ + return _CNF_Script_For_Contacts(); + } } +sub _CNF_Script_For_Contacts { +LOG_Settings . <<__CNF_IS_COOL__; +<<>> +< + + package : ContactsPlugin + subroutine : process + // The property holding the responce for the service. + property : ECHASH_CONTACT_RESPONSE + // The following maps in the CNF script the table and data properties for transfer/synch to the store. + // This shows how CNF can get complicated but also convenient to bind things in its scripts. + table : ECHASH_HOLDERS + data : CONTACTS_FORM_DATA + +>> +__CNF_IS_COOL__ +} + + sub _CNF_Script_For_Feeds { LOG_Settings . <<__CNF_IS_COOL__; < diff --git a/htdocs/cgi-bin/config.cgi b/htdocs/cgi-bin/config.cgi index 207f220..0564efd 100755 --- a/htdocs/cgi-bin/config.cgi +++ b/htdocs/cgi-bin/config.cgi @@ -75,7 +75,7 @@ if ($ERROR) { &error; } else { print qq(