From 7b45e774cc570d88c7ca189cdaced09dabbc781b Mon Sep 17 00:00:00 2001 From: Will Budic Date: Sat, 16 Sep 2023 14:55:26 +1000 Subject: [PATCH] CNFServices started with a bang, RSSFeedsPlugin. --- .gitignore | 2 + htdocs/cgi-bin/CNFServices.cgi | 97 ++ htdocs/cgi-bin/index.cgi | 42 +- htdocs/cgi-bin/login_ctr.cgi | 33 +- htdocs/cgi-bin/main.cgi | 30 +- htdocs/cgi-bin/rss_output/tree_feed_CPAN.cnf | 1198 ++++++++++++++++ htdocs/cgi-bin/system/modules/CNFDateTime.pm | 111 ++ htdocs/cgi-bin/system/modules/CNFNode.pm | 386 ++++-- htdocs/cgi-bin/system/modules/CNFParser.pm | 722 ++++++---- .../modules/HTMLIndexProcessorPlugin.pm | 126 +- .../cgi-bin/system/modules/MarkdownPlugin.pm | 37 +- .../cgi-bin/system/modules/RSSFeedsPlugin.pm | 349 +++++ htdocs/cgi-bin/wsrc/feeds.css | 62 + htdocs/cgi-bin/wsrc/main.js | 170 +-- install_cpan_modules_required.pl | 225 +++ rss_output/tree_feed_CPAN.cnf | 1230 +++++++++++++++++ 16 files changed, 4204 insertions(+), 616 deletions(-) create mode 100755 htdocs/cgi-bin/CNFServices.cgi create mode 100644 htdocs/cgi-bin/rss_output/tree_feed_CPAN.cnf create mode 100644 htdocs/cgi-bin/system/modules/CNFDateTime.pm create mode 100644 htdocs/cgi-bin/system/modules/RSSFeedsPlugin.pm create mode 100644 htdocs/cgi-bin/wsrc/feeds.css create mode 100755 install_cpan_modules_required.pl create mode 100644 rss_output/tree_feed_CPAN.cnf diff --git a/.gitignore b/.gitignore index fab7320..bbd220e 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ tags bck_* dbLifeLog/current_theme lighttpd.conf +dump_* +*.rdf diff --git a/htdocs/cgi-bin/CNFServices.cgi b/htdocs/cgi-bin/CNFServices.cgi new file mode 100755 index 0000000..9a83aa4 --- /dev/null +++ b/htdocs/cgi-bin/CNFServices.cgi @@ -0,0 +1,97 @@ +#!/usr/bin/env perl +# +# +use v5.30; +use strict; +use warnings; +use Exception::Class ('CNFHTMLServiceError'); +use Syntax::Keyword::Try; +use CGI; +use CGI::Session '-ip_match'; +use feature qw(signatures); +## +# We use dynamic perl compilations. The following ONLY HERE required to carp to browser on +# system requirments or/and unexpected perl compiler errors. +## +use CGI::Carp qw(fatalsToBrowser set_message); + +BEGIN { + sub handle_errors { + my $err = shift; + say "

Server Error

$err"; + } + set_message(\&handle_errors); +} + +use lib "system/modules"; +require CNFParser; +require CNFNode; + +our $GLOB_HTML_SERVE = "'{}/*.cgi' '{}/*.htm' '{}/*.html' '{}/*.md' '{}/*.txt'"; +our $script_path = $0; $script_path =~ s/\w+.cgi$//; + +exit &CNFHTMLService; + +sub CNFHTMLService { + my ($cgi,$ptr) = (CGI -> new(),undef); $cgi->param('service', 'feeds'); + 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(); + $ptr = $ptr->{'PAGE'}; + say $$ptr if $ptr; + # open my $fh, ">dump_of_output_to_browser.html"; + # print $fh $$ptr; + # close $fh; + return 0 +} + +sub _getServiceScript($cgi) { + my $service = $cgi->param('service'); $service = "undef" if not $service; + if($service eq 'feeds'){ + return _CNF_Script_For_Feeds(); + } + CNFHTMLServiceError->throw(error=>"UNKNOWN SERVICE -> $service", show_trace=>1) +} + +sub _CNF_Script_For_Feeds { +<<__CNF_IS_COOL__; +< + + RUN_FEEDS = yes + CONVERT_TO_CNF_NODES = yes + OUTPUT_TO_CONSOLE = false + OUTPUT_TO_MD = no + BENCHMARK = no + TZ=Australia/Sydney + OUTPUT_DIR = "./rss_output" + + + CONVERT_CNF_HTML = yes + CNF_TREE_STORE = true + + package : RSSFeedsPlugin + subroutine : process + property : RSS_FEEDS + +>> +// Following is a table having a list of details for available RSS feeds to process. +|| The more rows have here the longer it takes to fetch them, what is it, once a day, week, month? +<< RSS_FEEDS +ID`Name`URL`Description~ +01`CPAN`http://search.cpan.org/uploads.rdf`CPAN modules news and agenda.~ +>> +__CNF_IS_COOL__ +} + + +1; + +=begin copyright +Programed by : Will Budic +EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md) +Source : https://github.com/wbudic/LifeLog + This source file is copied and usually placed in a local directory, outside of its repository project. + So it could not be the actual or current version, can vary or has been modiefied for what ever purpose in another project. + Please leave source of origin in this file for future references. +Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md +=cut copyright \ No newline at end of file diff --git a/htdocs/cgi-bin/index.cgi b/htdocs/cgi-bin/index.cgi index d8c475d..812e4d1 100755 --- a/htdocs/cgi-bin/index.cgi +++ b/htdocs/cgi-bin/index.cgi @@ -1,6 +1,6 @@ #!/usr/bin/env perl # A delegated CNFParser processed rendering of the Document Index Web page, a Model-View-Controller Pattern approuch. -# The index.cnf script contains the structure and page skeleton, +# The index.cnf script contains the structure and page skeleton, # all configuration as well as the HTMLIndexProcessorPlugin converting the CNF to final HTML. # It is very convienient, as both style and script for the page is separated and developed in the index.cnf. # Which then can be moved to a respective include file over there. @@ -15,15 +15,15 @@ use warnings; use Exception::Class ('LifeLogException'); use Syntax::Keyword::Try; ## -# We use dynamic perl compilations. The following ONLY HERE required to carp to browser on +# We use dynamic perl compilations. The following ONLY HERE required to carp to browser on # system requirments or/and unexpected perl compiler errors. ## use CGI::Carp qw(fatalsToBrowser set_message); - + BEGIN { sub handle_errors { my $err = shift; - say "

Server Error

Error: $err
"; + say "

Server Error

Error: $err
"; } set_message(\&handle_errors); } @@ -37,20 +37,20 @@ our $script_path = $0; $script_path =~ s/\w+.cgi$//; exit &HTMLPageBuilderFromCNF; -sub HTMLPageBuilderFromCNF { +sub HTMLPageBuilderFromCNF { my $html = obtainDirListingHTML('docs'); my $cnf = CNFParser -> new ( $script_path."index.cnf",{ DO_ENABLED => 1, HAS_EXTENSIONS=>1, ANONS_ARE_PUBLIC => 1, - PAGE_HEAD => "

Index Page of Docs Directory

", - PAGE_CONTENT => $html, + PAGE_HEAD => "

Index Page of Docs Directory

", + PAGE_CONTENT => $html, PAGE_FOOT => "" } ); my $ptr = $cnf->data(); - $ptr = $ptr->{'PAGE'}; - say $$ptr if $ptr; + $ptr = $ptr->{'PAGE'}; + say $$ptr if $ptr; return 0 } @@ -58,7 +58,7 @@ sub obtainDirListingHTML { my ($dir, $ret) = (shift,""); my $html = listFiles($dir,$script_path,""); if($html){ - $ret .="
    $dir →\n"; + $ret .="
      $dir →\n"; $ret .= $html; opendir (my $handle, $script_path.$dir) or die "Couldn't open directory, $!"; while (my $node = readdir $handle) { @@ -78,17 +78,17 @@ sub listFiles ($){ my ($dir, $script_path, $ret) = @_; my $path = $script_path.$dir; my $spec = $GLOB_HTML_SERVE; $spec =~ s/{}/$path/gp; - my @files = glob ($spec); + my @files = glob ($spec); foreach my $file(@files){ ($file =~ m/(\w+\.\w*)$/g); my $name = $1; if($file =~ /\.md$/){ - my @title = getDocTitle($file); + my @title = getDocTitle($file); $ret .= qq(\t\t\t
    • $title[1] ‐ $name
    • \n); - }else{ + }else{ $ret .= qq(\t\t\t
    • $name
    • \n); } - } + } return $ret; } @@ -101,13 +101,15 @@ sub getDocTitle($){ last; } } - close $fh; + close $fh; ($file =~ m/(\w+\.\w*)$/g); return ($1,$ret) } - - - - - +1; +=begin copyright +Programed by : Will Budic +EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md) +Source : https://github.com/wbudic/LifeLog +Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md +=cut copyright diff --git a/htdocs/cgi-bin/login_ctr.cgi b/htdocs/cgi-bin/login_ctr.cgi index 332ef59..bb42c4e 100755 --- a/htdocs/cgi-bin/login_ctr.cgi +++ b/htdocs/cgi-bin/login_ctr.cgi @@ -1,8 +1,5 @@ #!/usr/bin/env perl # -# Programed by: Will Budic -# Open Source License -> https://choosealicense.com/licenses/isc/ -# use strict; use warnings; use experimental qw( switch ); @@ -67,6 +64,7 @@ try{ {-type => 'text/javascript', -src => 'wsrc/jquery-ui.js'}], -style => [ {-type => 'text/css', -src => $css}, {-type => 'text/css', -src => 'wsrc/effects.css'}, + {-type => 'text/css', -src => 'wsrc/feeds.css'}, {-type => 'text/css', -src => 'wsrc/jquery-ui.css'}, {-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'}, {-type => 'text/css', -src => 'wsrc/jquery-ui.theme.css'}], @@ -104,7 +102,8 @@ HTML print qq(

      + + ); Settings::printDebugHTML($DBG) if Settings::debug(); @@ -918,4 +937,10 @@ sub logout { exit; } +=begin copyright +Programed by : Will Budic +EContactHash : 990MWWLWM8C2MI8K (https://github.com/wbudic/EContactHash.md) +Source : https://github.com/wbudic/LifeLog +Open Source Code License -> https://github.com/wbudic/PerlCNF/blob/master/ISC_License.md +=cut copyright diff --git a/htdocs/cgi-bin/main.cgi b/htdocs/cgi-bin/main.cgi index c2a6068..6c81522 100755 --- a/htdocs/cgi-bin/main.cgi +++ b/htdocs/cgi-bin/main.cgi @@ -271,7 +271,7 @@ $td_itm_cnt = 0; foreach my $key(@keys){ if($td_itm_cnt>$present_rows_cnt){ $td_cat .= "
      "; - $td_itm_cnt = 0; + $td_itm_cnt = 0; } $td_cat .= "
    • ".$hshCats{$key}."
    • "; $td_itm_cnt++; @@ -676,7 +676,7 @@ sub buildLog { if($log =~ m/(.*\s*.*?)
      /){$h=$1} elsif($log =~ m/(\s*.*\n)/) {$h=$1} if($h){ - $log = $h.qq(); } } @@ -812,10 +812,10 @@ if($isPUBViewMode){   - +   -   +     @@ -851,9 +851,9 @@ my $frm = qq(   Enter log... - +    Category:  - + @@ -994,11 +994,11 @@ $srh .=qq(       View RTF Logs:  -   +   - + Exclude Category: @@ -1101,7 +1101,7 @@ my $help = &help; # Final Page Output from here! # ################################## my $audio = &Settings::audioEnabled ? qq( -