From 210814b06462c9ed8aa32b28c7de5d16da25abec Mon Sep 17 00:00:00 2001 From: Bruce Bannon Date: Tue, 26 Sep 2023 10:59:07 -0600 Subject: [PATCH 1/3] update the other .pl files --- docs/extractfaqs.pl | 9 +-- docs/php2html.pl | 192 ++++++++++++++++++++------------------------ 2 files changed, 91 insertions(+), 110 deletions(-) diff --git a/docs/extractfaqs.pl b/docs/extractfaqs.pl index 3e40d7e29..523818948 100755 --- a/docs/extractfaqs.pl +++ b/docs/extractfaqs.pl @@ -15,13 +15,13 @@ # 02-Feb-2005 Craig Knudsen # Updated to group into categories. # -####################################################################### +################################################################################ -my @files = ( ); -my @questions = ( ); my @answers = ( ); -my @file = ( ); my @cat = ( ); +my @file = ( ); +my @files = ( ); +my @questions = ( ); for ( $i = 0; $i < @ARGV; $i++ ) { if ( -f $ARGV[$i] ) { @@ -152,4 +152,3 @@ sub process_file { } } } - diff --git a/docs/php2html.pl b/docs/php2html.pl index 220d79728..d30f1077c 100755 --- a/docs/php2html.pl +++ b/docs/php2html.pl @@ -6,8 +6,7 @@ # # Description: # Create HTML documentation from a PHP include file. -# The PHP file must use a specific syntax for documenting -# functions. +# The PHP file must use a specific syntax for documenting functions. # # History: # 21-Jan-2005 Craig Knudsen @@ -15,17 +14,17 @@ # 30-Nov-2002 Craig Knudsen # Created # -####################################################################### +################################################################################ $TITLE = 'WebCalendar Function Documentation'; sub add_links { my ( $in ) = @_; - $in =~ s/(webcal_[a-z_]+)\s+table/$1<\/tt><\/a> table/g; + $in =~ s/(webcal_[a-z_]+)\s+table/$1<\/span><\/a> table/g; foreach $funcName ( keys ( %funcNames ) ) { - $in =~ s/($funcName)\s+function/$1<\/tt><\/a> function/ig; + $in =~ s/($funcName)\s+function/$1<\/span><\/a> function/ig; } $in =~ s/&/&/g; @@ -39,11 +38,11 @@ sub add_links { sub print_function { my ( $loc ) = @_; $out{$name} = "

$name

\n"; - $out{$name} .= "$name ( " . '$' . join ( ', $', @params ) . - " )

\n"; + $out{$name} .= "$name ( " + . '$' . join ( ', $', @params ) . " )

\n"; if ( defined ( $description ) ) { - $out{$name} .= "Description:" . - "
"; + $out{$name} .= "Description:" + . "
"; $out{$name} .= add_links ( $description ) . "
\n"; } $out{$name} .= "Parameters:
\n
    \n"; @@ -51,16 +50,17 @@ sub print_function { $out{$name} .= "
  • None
  • \n"; } foreach $p ( @params ) { - $out{$name} .= "
  • \$$p"; + $out{$name} .= "
  • \$$p"; $out{$name} .= " - " . add_links ( $paramDescr{$p} ) if ( defined ( $paramDescr{$p} ) ); $out{$name} .= "
  • \n"; } $out{$name} .= "
\n"; - $out{$name} .= "Returns:
" . - ( $returns eq '' ? "Nothing" : add_links ( $returns ) ) . "
\n"; - $out{$name} .= "Location:" . - "
$loc
\n"; + $out{$name} .= "Returns:
" + . ( $returns eq '' ? "Nothing" : add_links ( $returns ) ) + . "
\n"; + $out{$name} .= "Location:" + . "
$loc
\n"; $out{$name} .= "

\n"; } @@ -174,108 +174,90 @@ sub print_function { } close ( F ); -print< - -$TITLE - - - -

$TITLE

-
-$info -
- - - - - -
Home Page:$url
WebCalendar Version:$version ($date)
Last updated:$now
-

List of Functions

-
    + + $TITLE + + + + +

    $TITLE

    +
    + $info +
    + + + + + + + + + + + + + +
    Home Page:$url
    WebCalendar Version:$version ($date)
    Last updated:$now
    +

    List of Functions

    +
      EOF foreach $name ( sort keys ( %out ) ) { - print "
    • $name
    • \n"; + print "\n
    • $name
    • "; } -print "
    \n
    \n"; +print "\n
\n
"; foreach $name ( sort keys ( %out ) ) { - print "

\n" . $out{$name}; + print "\n

\n " . $out{$name}; } -print< -

- Valid XHTML 1.0! -

- +print < +

Validate>

+ EOF From 78072023a2fb48ef863fbbe6dc095a37857edbdc Mon Sep 17 00:00:00 2001 From: Bruce Bannon Date: Tue, 26 Sep 2023 11:00:08 -0600 Subject: [PATCH 2/3] missed one --- tools/update_translation.pl | 54 ++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/tools/update_translation.pl b/tools/update_translation.pl index 0c1f77102..db9b91f20 100755 --- a/tools/update_translation.pl +++ b/tools/update_translation.pl @@ -1,11 +1,11 @@ #!/usr/bin/perl # # This tool will update a translation file by doing the following: -# - Phrases are organized by the page on which they first appear. -# - When a missing translation is found, the phrase can optionally have -# << MISSING >> -# right above it. And, when the "phrase" is an abbreviation of the -# full English text, show the English text (in a comment) below. +# - Phrases are organized by the page on which they first appear. +# - When a missing translation is found, the phrase can optionally have +# << MISSING >> +# right above it. And, when the "phrase" is an abbreviation of the +# English text, show the full English text (in a comment) below. # # Example: # << MISSING >> @@ -38,16 +38,16 @@ # perltidy -i=2 update_translation.pl # (which will create update_translation.pl.tdy, the new version) # -#################################################################### +################################################################################ use File::Copy; use File::Find; sub find_pgm_files { # Skipping non WebCalendar plugins, -# if the filename ends in .class or .php, add it to @files. +# if the filename ends in .php, add it to @files. push( @files, "$File::Find::name" ) if ( $_ =~ /\.(class|php)$/i - && $File::Find::dir !~ /(fckeditor|htmlarea|phpmailer)/i ); + && $File::Find::dir !~ /(captcha|ckeditor|hkit|htmlarea|phpmailer|pub|vendor)/i ); } $base_dir = '..'; @@ -56,7 +56,7 @@ sub find_pgm_files { $base_trans_file = "$trans_dir/English-US.txt"; $plugin = ''; -$save_backup = 0; # set to 1 to create backups +$save_backup = 1; # set to 1 to create backups $show_dups = 0; # set to 0 to minimize translation file. $show_missing = 1; # set to 0 to minimize translation file. $verbose = 0; @@ -131,9 +131,9 @@ sub find_pgm_files { if ( $verbose ); open( F, $p_base_trans_file ) || die "Error opening $p_base_trans_file"; while ( ) { - chop; - s/\r*$//g; # remove annoying CR next if ( /^#/ ); + chomp; + s/\r*$//g; # remove annoying CR if ( /\s*:\s*/ ) { $abbrev = $`; $base_trans{ $abbrev } = $' if ( $abbrev ne 'charset' ); @@ -147,9 +147,9 @@ sub find_pgm_files { open( F, $base_trans_file ) || die "Error opening $base_trans_file"; print "Reading base translation file: $base_trans_file\n" if ( $verbose ); while ( ) { - chop; - s/\r*$//g; # remove annoying CR next if ( /^#/ ); + chomp; + s/\r*$//g; # remove annoying CR if ( /\s*:\s*/ ) { $abbrev = $`; $base_trans{ $abbrev } = $'; @@ -165,7 +165,7 @@ sub find_pgm_files { open( F, $infile ) || die "Error opening $infile"; $in_header = 1; while ( ) { - chop; + chomp; s/\r*$//g; # remove annoying CR if ( $in_header && /^#/ ) { if ( /Translation last (pagified|updated)/ ) { @@ -187,16 +187,16 @@ sub find_pgm_files { } } -$trans{ 'charset' } = '=' if ( !defined( $trans{ 'charset' } ) ); -$trans{ 'direction' } = '=' if ( !defined( $trans{ 'direction' } ) ); -$trans{ '__mm__/__dd__/__yyyy__' } = '=' - if ( !defined( $trans{ '__mm__/__dd__/__yyyy__' } ) ); -$trans{ '__month__ __dd__' } = '=' - if ( !defined( $trans{ '__month__ __dd__' } ) ); -$trans{ '__month__ __dd__, __yyyy__' } = '=' - if ( !defined( $trans{ '__month__ __dd__, __yyyy__' } ) ); -$trans{ '__month__ __yyyy__' } = '=' - if ( !defined( $trans{ '__month__ __yyyy__' } ) ); +# $trans{ 'charset' } = '=' if ( !defined( $trans{ 'charset' } ) ); +# $trans{ 'direction' } = '=' if ( !defined( $trans{ 'direction' } ) ); +# $trans{ '__mm__/__dd__/__yyyy__' } = '=' +# if ( !defined( $trans{ '__mm__/__dd__/__yyyy__' } ) ); +# $trans{ '__month__ __dd__' } = '=' +# if ( !defined( $trans{ '__month__ __dd__' } ) ); +# $trans{ '__month__ __dd__, __yyyy__' } = '=' +# if ( !defined( $trans{ '__month__ __dd__, __yyyy__' } ) ); +# $trans{ '__month__ __yyyy__' } = '=' +# if ( !defined( $trans{ '__month__ __yyyy__' } ) ); if ( $plugin ne '' ) { print "Reading current WebCalendar translations from $b_infile\n" @@ -204,7 +204,7 @@ sub find_pgm_files { open( F, $b_infile ) || die "Error opening $b_infile"; $in_header = 1; while ( ) { - chop; + chomp; s/\r*$//g; # remove annoying CR if ( /\s*:\s*/ ) { $abbrev = $`; @@ -218,7 +218,7 @@ sub find_pgm_files { '# Translation last updated on ' . sprintf( "%02d-%02d-%04d", $mon + 1, $day, $year + 1900 ) . "\n"; -print "\nFinding WebCalendar class and php files.\n\n" if ( $verbose ); +print "\nFinding WebCalendar php files.\n\n" if ( $verbose ); find \&find_pgm_files, $base_dir; # @@ -331,7 +331,7 @@ sub find_pgm_files { print STDERR ( !$notfound - ? "All text was found in $infile. Good job :-)\n" + ? "All text was found in $infile. Good job :-)\n" : "$notfound translation(s) missing.\n" ); From 199f3cbdffc4fbd8940c41dfae92744c73139f4b Mon Sep 17 00:00:00 2001 From: Bruce Bannon Date: Fri, 6 Oct 2023 08:43:20 -0600 Subject: [PATCH 3/3] example jsdoc --- includes/js/dblclick_add.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/includes/js/dblclick_add.js b/includes/js/dblclick_add.js index 7c925ebfa..49af84807 100644 --- a/includes/js/dblclick_add.js +++ b/includes/js/dblclick_add.js @@ -1,8 +1,14 @@ - -// Function that will send user to the add event page. -// This is typically invoked as the ondblclick event handler. -function dblclick_add( date, name, hour, minute ) { +/** + * @description Send user to the add event page. Typically invoked as the ondblclick event handler. + * @author Craig Knudsen + * @date 2023-10-05 + * @param {int} date + * @param {string} name + * @param {int} hour + * @param {int} minute + */ +function dblclick_add ( date, name, hour, minute ) { window.location.href = 'edit_entry.php?date=' + date + '&defusers=' + name + ( hour ? '&hour=' + hour + '&minute=' - + ( typeof( minute ) != 'undefined' ? minute : 0 ) : '' ); + + ( typeof ( minute ) !== 'undefined' ? minute : 0 ) : '' ); }