#!/usr/local/bin/webwork-perl ## $Id$ #strings for HTML display in webwork use lib '.'; use webworkInit; # WeBWorKInitLine use strict; use CGI qw(:standard); use Global; sub htmlTOP { my ($title, $bg_url, @headers) = @_; my $background_url = $bg_url || $Global::background_plain_url; my $out = < $title

WeBWorK

ENDhtmlTOP $out; } sub sessionKeyInputs { my($inputsref) = @_; # Argument is a pointer to the hash %inputs my $out = qq! !; $out; } sub htmlBOTTOM { my ($scriptName,$inputsref, $helpFile) = @_; my ($studentLogin, $studentID, $studentName, $studentEmail, $setNumber, $sectionName,$recitationName) = ('','','','','','',''); my ($psvn,$probNum); $psvn = ( defined($$inputsref{'probSetKey'}) ) ? $$inputsref{'probSetKey'}: ""; $probNum = ( defined($$inputsref{'probNum'} ) ) ? $$inputsref{'probNum'} : ""; my $mode = $$inputsref{'Mode'}; $mode = $Global::htmlModeDefault unless $mode; if ($psvn) { attachProbSetRecord($psvn); $studentLogin = getStudentLogin($psvn); attachCLRecord($studentLogin); $studentID = CL_getStudentID($studentLogin); $studentEmail = CL_getStudentEmailAddress($studentLogin); $studentName = CL_getStudentName($studentLogin); $setNumber = getSetNumber($psvn); $setNumber = '' unless defined($setNumber); $sectionName = CL_getClassSection($studentLogin); $sectionName = '' unless defined($sectionName); $recitationName = CL_getClassRecitation($studentLogin); $recitationName = '' unless defined($recitationName); } my $cgi = new CGI(''); ## we want a new empty object since we just don't need any cgi parameters ## first set up the navigation button forms and links my $logout_form = ''; if ($$inputsref{user} && $$inputsref{key} && $$inputsref{course}) { $logout_form = join("\n", $cgi->startform(-method=>'POST', -action=>"$Global::logout_CGI"), $cgi->input({-type=>'image', -src=>"$Global::logoutGifUrl", -alt=>'Logout'}), $cgi->hidden(-name=>'user', -value=>"$$inputsref{user}"), $cgi->hidden(-name=>'key', -value=>"$$inputsref{key}"), $cgi->hidden(-name=>'course', -value=>"$$inputsref{course}"), $cgi->endform() ); } my $To = $Global::feedbackAddress; $To =~ s/\s//g; my $feedback_form = join("\n", $cgi->startform(-method=>'POST', -action=>"${Global::cgiWebworkURL}feedback.pl?$To"), $cgi->input({-type=>'image', -src=>"$Global::feedbackGifUrl", -alt=>'Feedback'}), $cgi->hidden(-name=>'probSetKey', -value=>"$psvn"), $cgi->hidden(-name=>'section', -value=>"$sectionName"), $cgi->hidden(-name=>'recitation', -value=>"$recitationName"), $cgi->hidden(-name=>'probNum', -value=>"$probNum"), $cgi->hidden(-name=>'setnum', -value=>"setNumber"), $cgi->hidden(-name=>'id', -value=>"$studentID"), $cgi->hidden(-name=>'name', -value=>$studentName), $cgi->hidden(-name=>'email', -value=>"$studentEmail"), $cgi->hidden(-name=>'Mode', -value=>"$mode"), $cgi->hidden(-name=>'user', -value=>"$$inputsref{user}"), $cgi->hidden(-name=>'key', -value=>"$$inputsref{key}"), $cgi->hidden(-name=>'course', -value=>"$$inputsref{course}"), $cgi->endform() ); my $help_link = ''; $help_link .= $cgi->a({-href=>"${Global::helpURL}$helpFile"}, $cgi->img({-src=>$Global::helpGifUrl, -alt=>'Help'})) if (defined $helpFile); my $problemSet_form =''; $problemSet_form = join("\n", $cgi->startform(-method=>'POST', -action=>"${Global::cgiWebworkURL}welcome.pl"), $cgi->hidden(-name=>'user', -value=>"$$inputsref{user}"), $cgi->hidden(-name=>'key', -value=>"$$inputsref{key}"), $cgi->hidden(-name=>'course', -value=>"$$inputsref{course}"), $cgi->submit(-name => 'action', -value=>'Problem Sets'), $cgi->endform() ) unless($0 =~ /welcome.pl/) ; # don't put this on the probSet.pl page my $profPage_form = ''; my $User = $$inputsref{user} if defined $$inputsref{user}; my $Course = $$inputsref{course} if defined $$inputsref{course}; my $permissions = 0; if (defined $User and defined $Course) { my $permissionsFile = &Global::getCoursePermissionsFile($Course); $permissions = &get_permissions($User, $permissionsFile); } if ($permissions == $Global::instructor_permissions) { $profPage_form = join("\n", $cgi->startform(-method=>'POST', -action=>"${Global::cgiWebworkURL}profLogin.pl"), $cgi->hidden(-name=>'user', -value=>"$$inputsref{user}"), $cgi->hidden(-name=>'key', -value=>"$$inputsref{key}"), $cgi->hidden(-name=>'course', -value=>"$$inputsref{course}"), $cgi->submit(-name => 'action', -value=>"Enter Professor's Page"), $cgi->endform() ); } ## Now set up the table of buttons my $out = join("\n", $cgi->hr, $cgi->table( $cgi->Tr( $cgi->td({-valign=>'TOP'}, [$logout_form, $feedback_form, $help_link, $problemSet_form, $profPage_form]) ) ) ); $out .= qq!Problem Set Version Number: $$inputsref{'probSetKey'}\n! if $$inputsref{'probSetKey'}; # Add the date/time, except for welcome.pl which already displays it my $currentDate = formatDateAndTime(time); $out .= qq!
Current time: $currentDate

! unless $0 =~ /welcome.pl/; # $out .= qq{ #
Page produced by script: $scriptName # } if $scriptName; $out .= qq{

Compiler warnings:

$Global::WARNINGS} if $Global::WARNINGS; $out .= ''; } sub html_NO_PERMISSION { my $out = &htmlTOP; $out .=qq~

NO PERMISSION

Sorry, you do not have permission to use this script! ~; $out .= &htmlBOTTOM; $out; } 1;