param('id'); if (!$vos_speaker_syllabus::meeting_no) { print $main::cgi->redirect('../index.iphtml'); die ""; } $main::dbh = DBI->connect ($dsn, $user, $password, { RaiseError => 0, PrintError => 0}) or die "Could not connect to server: $DBI::err ($DBI::errstr)\n"; my %States; my $Current_Screen; %States = ( 'Default' => \&vos_speaker_syllabus::input_page, 'Submit' => \&vos_speaker_syllabus::submission_result_page ); $Current_Screen = param(".State") || "Default"; die "No screen for $Current_Screen" unless $States{$Current_Screen}; !> #include ../../../includes/wp-vos-header.iphtml
prepare(qq{ SELECT name, meeting.city, meeting.state, meeting.location, MONTHNAME(meeting.start_date), DAYOFMONTH(meeting.start_date), YEAR(meeting.end_date), MONTHNAME(meeting.end_date), DAYOFMONTH(meeting.end_date) FROM meeting WHERE meeting_no=? AND meeting.workshop_no = 0 AND meeting.breakout_no = 0 }) || die "Prepare failed: $DBI::errstr\n"; $sth->execute($vos_speaker_syllabus::meeting_no) || die "Couldn't execute query $DBI::errstr\n"; undef(@ary); @ary = $sth->fetchrow; $sth->finish(); if (@ary) { print '

' . $ary[0] . '
'; print "

$ary[4] $ary[5]"; if ($ary[5] eq $ary[8]) { print ", $ary[6]"; } else { if ($ary[5] eq $ary[8]) { print ", $ary[6]"; } else { if ($ary[4] eq $ary[7]) { print "-$ary[8], $ary[6]"; } else { print "-$ary[7] $ary[8], $ary[6]"; } } } print '
'; print "$ary[3] • $ary[1], $ary[2]

\n"; print h3({-align=>'center'},'SYLLABUS UPLOAD FORM'); } else { print $main::cgi->redirect('../index.iphtml'); die ""; } print start_form(-name=>'emailsubmit', -enctype=>'multipart/form-data'); while (my($screen_name, $function) = each %States) { $function->($screen_name eq $Current_Screen); } print end_form(); !>
#include ../../../includes/wp-vos-footer.iphtml remote_user(); my $SQL = <prepare($SQL); $sth->execute; my @ary; @ary = $sth->fetchrow; $sth->finish; $facultyid = $ary[0]; if (!$facultyid || !$vos_speaker_syllabus::meeting_no) { print $main::cgi->redirect('../index.iphtml'); die ""; } $sth = $main::dbh->prepare ("SELECT fname,lname,title FROM member WHERE member_id = $facultyid"); $sth->execute(); @ary = $sth->fetchrow; $facultyname = $ary[0] . ' ' . $ary[1] . ' ' . $ary[2]; $sth->finish(); undef($SQL); $SQL = "SELECT COUNT(*) FROM faculty_lecture WHERE facultyid = '$facultyid' AND meetingid = $vos_speaker_syllabus::meeting_no"; $sth = $main::dbh->prepare($SQL); $sth->execute; undef(@ary); @ary = $sth->fetchrow; $sth->finish; if ($ary[0] eq "0") { $access = 0; print p('You are not listed as faculty for the above caption meeting. If this is an error, please contact VOS administrative assistant, Angela Puryear at angela@societyhq.com or phone (804) 565-6312.'); print p('Click',a({href=>"../"},'here'),'to select a different meeting.'); } if ($access) { print p('
'); print '

SYLLABUS UPLOAD FORM FOR: ' . $facultyname . '

'; print p(em('If you are not ' . $facultyname . ', you must close your web browser completely and re-login. | ',a({-href=>"./index.iphtml?id=$vos_speaker_syllabus::meeting_no"},'Return to Faculty Forms'),'.')); $sth = $main::dbh->prepare ("SELECT DATE_FORMAT(lecture_date, '%a, %b %e'), lecture, moderator, new_lecture.lectureid, TIME_FORMAT(start_time, '%h:%i %p') FROM new_lecture, faculty_lecture WHERE new_lecture.lectureid = faculty_lecture.lectureid AND committeeid=$vos_speaker_syllabus::meeting_no AND faculty_lecture.facultyid=$facultyid ORDER BY lecture_date, start_time"); $sth->execute(); @ary = (); @ary = $sth->fetchrow_array(); $sth->finish(); if (@ary) { !>

Please convert your file to PDF format before uploading. Upload a file for each lecture you are presenting. The only acceptable file format is PDF. No video files permitted. File size is limited to a total of MB each.

The slide presentation should be one per page in the PDF file.

LECTURE PRESENTATION SCHEDULE execute(); undef(@ary); while (@ary = $sth->fetchrow_array()) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } $sth->finish(); print "
Time/Date Lecture Title Syllabus
$ary[4] - $ary[0]$ary[1]
\n"; print "
\n"; print p{-align=>'left'},em('Please allow a moment for your syllabus to upload once you click submit. Depending on your connection speed this may take a few minutes.'); print p{-align=>'center'},(to_page("Submit")); } else { print p("$facultyname, you are not required to submit syllabus material. Thank you."); print p({-align=>'center'},a({-href=>"./index.iphtml?id=$vos_speaker_syllabus::meeting_no"},'Return to Faculty Forms')); } } } sub submission_result_page { my $active = shift; return unless $active; my $username = $main::cgi->remote_user(); my $updateSQL; my $rows; my $db_error = ""; my $linkserror; my $filesuploaded = ''; my $meeting_name = ''; $vos_speaker_syllabus::meeting_no = $main::cgi->param('id'); if (!$vos_speaker_syllabus::meeting_no) { print $main::cgi->redirect('../index.iphtml'); die ""; } my $SQL = <prepare($SQL); $sth->execute; my @ary; @ary = $sth->fetchrow; $sth->finish; $facultyid = $ary[0]; $sth = $main::dbh->prepare ("SELECT faculty_lecture.lectureid,lecture FROM faculty_lecture,new_lecture WHERE faculty_lecture.lectureid=new_lecture.lectureid AND meetingid=$vos_speaker_syllabus::meeting_no AND faculty_lecture.facultyid='$facultyid'"); if($ENV{REQUEST_METHOD} eq 'POST' && $ENV{CONTENT_LENGTH} > $maxbytes) { print p({-style=>'color: #F00'},strong("Error: The files you are attempting to upload exceed the total maximum allowable file size of $maxmb MB.")); } else { my $complete = 0; $sth->execute(); @ary = (); while (@ary = $sth->fetchrow_array()) { if (param("file_$ary[0]")) { $complete = 1; } } $sth->finish(); $linkserror = "
  • You must upload at least one syllabus.
  • " if !$complete; if ($complete) { my $SQL = "SELECT name, meeting.city, meeting.state, meeting.location, MONTHNAME(meeting.start_date), DAYOFMONTH(meeting.start_date), YEAR(meeting.end_date), MONTHNAME(meeting.end_date), DAYOFMONTH(meeting.end_date) FROM meeting WHERE meeting_no = '$vos_speaker_syllabus::meeting_no' AND meeting.workshop_no = 0 AND meeting.breakout_no = 0"; $sth = $main::dbh->prepare($SQL) || die "Prepare failed: $DBI::errstr\n"; $sth->execute() || die "Couldn't execute query $DBI::errstr\n"; undef(@ary); @ary = $sth->fetchrow; $sth->finish; $meeting_name = $ary[0] . "\n" . $ary[4] . ' ' . $ary[5]; if ($ary[5] eq $ary[8]) { $meeting_name .= ", $ary[6]"; } else { if ($ary[4] eq $ary[7]) { $meeting_name .= "-$ary[8], $ary[6]"; } else { $meeting_name .= "-$ary[7] $ary[8], $ary[6]"; } } $meeting_name .= "\n$ary[3], $ary[1], $ary[2]"; my $file_prefix = "$ary[6]-$ary[2]"; my $sender = "VOS Faculty Form "; my $subject = "VOS Syllabus Upload File for " . param('name'); my $buffer = "Syllabus Upload Form"; # my $recipient = "wes\@societyhq.com"; my $recipient = "angela\@societyhq.com, andrew\@societyhq.com"; $buffer .= "\n\n" . $meeting_name; $buffer .= "\n\nName: " . param('name'); $buffer .= "\n\nSYLLABUS FILE(S)\n"; # upload files section my ($bytesread, $filebuffer); my $num_bytes = 1024; my $totalbytes; my $uploadedfilename; my $linksbuffer; my $i = 1; $sth = $main::dbh->prepare ("SELECT lecture, new_lecture.lectureid, id, lecture_date FROM new_lecture, faculty_lecture WHERE new_lecture.lectureid=faculty_lecture.lectureid AND meetingid=$vos_speaker_syllabus::meeting_no AND faculty_lecture.facultyid='$facultyid'"); $sth->execute(); @ary = (); while (@ary = $sth->fetchrow_array()) { my $paramname = "file_".$ary[1]; my $filename = param($paramname); $filename =~ s/.*[\/\\](.*)/$1/; my $filehandle = upload($paramname); if ($filename) { $totalbytes = 0; my ($filen,$dir,$ext) = fileparse($filename, qr/(\.[^.]+){1,2}?/); $ext = lc $ext; # if (($ext eq ".pdf") || ($ext eq ".pdfx") || ($ext eq ".doc") || ($ext eq ".docx") || ($ext eq ".ppt") || ($ext eq ".pptx")) { if (($ext eq ".pdf") || ($ext eq ".pdfx") || ($ext eq ".ppt") || ($ext eq ".pptx")) { $uploadedfilename = $file_prefix . "-" . time() . "-" . int(rand 10000) . $ext; my $file = "/home/httpd/htdocs/vos/facultyupload/$uploadedfilename"; open (OUTFILE, ">$file") or die "Couldn't open $file for writing: $!"; while ($bytesread = read($filehandle, $filebuffer, $num_bytes)) { $totalbytes += $bytesread; print OUTFILE $filebuffer; } die "Read failure" unless defined($bytesread); unless (defined($totalbytes)) { $linkserror .= "
  • Error: Could not read file ${filename}, or the file was zero length.
  • "; } else { my $totalkbytes = int($totalbytes/1024); $filesuploaded .= "
  • FILE: " . param($paramname) . "
    LECTURE: $ary[0]
  • \n"; $linksbuffer .= "$i. $ary[3]: $ary[0] ($totalkbytes kB)
    "; # UPDATE FACULTY DATABASE $updateSQL = "UPDATE faculty_lecture SET syllabus=1,syllabusFileName='$uploadedfilename' WHERE id = $ary[2]"; $rows = $main::dbh->do(qq{$updateSQL}); $rows += 0; if (!$rows) { $linksbuffer .= "Failed to Update Database - Lecture: $ary[0]\n"; } } close OUTFILE or die "Couldn't close $file: $!"; $i++; } else { $linkserror .= "
  • File ${filename} does not appear to be in appropriate format for lecture $ary[0]. File must have only one decimal before the file extention (.pdf).
  • \n"; } } } # upload files end $sth->finish; $buffer .= "\n".$linksbuffer; $buffer =~ s/\n/
    /g; if ($linksbuffer) { open (MAIL, "|/usr/lib/sendmail -oi -t -odq") or die "can't fork sendmail: $!"; print MAIL "From: $sender To: $recipient bcc: daniel\@societyhq.com Subject: $subject Precedence: bulk MIME-Version: 1.0 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit "; print MAIL $buffer; print MAIL " "; close (MAIL); print p({-align=>'left'},'Thank you. The following file(s) have uploaded successfully:'); print "
      \n$filesuploaded
    \n"; print p(a({href=>"../assignment.iphtml?id=$vos_speaker_syllabus::meeting_no"},'Click here'),'to check for other forms that you may need to complete for this meeting.'); } if ($linkserror) { print p({-style=>'color: #F00'},strong('The following error(s) occurred:')); print "
      $linkserror.
    "; } } else { print p({-style=>'color: #F00'},strong('Error - Use your browser back button to correct the following:')); print "
      $linkserror.
    "; } } } sub to_page { submit(-NAME => ".State", -VALUE => shift) } !>