#!/usr/bin/perl # # Single Line Enty Journal (SLEJ) # By Kirk Waingrow (Sep/02) v 1.2 # print "Content-type: text/html\n\n"; # PATH WHERE ALL THE DAILY JOURNALS ARE KEPT # *** MUST BE R/W BY APACHE **** $MYNAME="Kirk Waingrow"; $DPATH="/httpd/html/slej"; $buffer = "$QUERY_STRING"; $buffer = $ENV{'QUERY_STRING'}; $DT=`date '+%A - %B %d, 20%y'`; chomp($DT); $TM=`date '+%H.%M'`; chomp($TM); $DFILE=`date '+%y.%m.%d'`; chomp($DFILE); print qq~
"; } if ( ! "$form{ID}" ) { print "ID is required
Use: http://[webserver]/cgi-bin/slej?ID=xxx"; exit; } else { $ID="$form{ID}"; } sub displaysearchbox() { print qq~ JOURNAL ENTRY (Entry)
~; } #print "STRING=$form{'STRING'}"; # # Show 7 days worth # if ($form{'action'} eq "show7" ) { print "";
print "";
@days=`ls -1r $DPATH/$ID | head -7`;
for $d (@days)
{
#print "$d ";
}
print "
";
open(IN, "$DPATH/$ID/$d");
while (
"; }
close(IN);
print "
";
print "";
@days=`ls -1r $DPATH/$ID`;
for $d (@days)
{
$dt=`head -1 $DPATH/$ID/$d`; $x=""; @found="";
open(IN, "$DPATH/$ID/$d");
while (
";
}
#
# Display Input search box
#
if ($form{'action'} eq "search" )
{
&displaysearchbox;
}
#
# DISPLAY LIST OF JOURNAL DATES
#
if ($form{'action'} eq "display" )
{
print qq~
Select A Date to View$dt ";
for $f (@found)
{ if ( "$f" ) { print "$f
\n"; } }
print " \n";
}
}
print "
~;
open(IN, "ls -1r $DPATH/$ID | ");
while (
";
}
if ( ! "$form{action}" )
{
#
# WRITE OUT STRING INTO JOURNAL
#
if ($form{'STRING'} )
{
if ( ! -d "$DPATH/$ID" )
{
`mkdir -p $DPATH/$ID`;
`chmod 770 $DPATH/$ID`;
}
if ( ! -f "$DPATH/$ID/$DFILE" )
{
open(OUT, "> $DPATH/$ID/$DFILE");
print OUT "$DT\n";
print OUT "--------------------------------------------------\n";
close(OUT);
}
open(OUT, ">> $DPATH/$ID/$DFILE");
print OUT "$TM : $form{STRING}\n";
close(OUT);
`chmod 660 $DPATH/$ID/$DFILE`;
}
print qq~
JOURNAL ENTRY
(Display
| 7 days
| Search)
~;
}
$TDY $TDT \n";
#print "$_
";
}
close(IN);
print "