From: Will Budic Date: Fri, 17 Nov 2023 05:50:51 +0000 (+1100) Subject: Merge with current master from nomad. X-Git-Url: https://lifelog.hopto.org/gitweb/?a=commitdiff_plain;h=72371d8b9925bb2307935157ebc9655d82fd3cf3;p=LifeLog.git Merge with current master from nomad. --- 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(