Parent Directory
|
Revision Log
nothing should change
1 #!/usr/local/bin/perl 2 3 ## $Id$ 4 5 #strings for HTML display in webwork 6 7 use lib '.'; use webworkInit; # WeBWorKInitLine 8 use strict; 9 10 use Global; 11 12 sub htmlTOP { 13 my ($title, $bg_url, @headers) = @_; 14 my $background_url = $bg_url || $Global::background_plain_url; 15 16 my $out = <<ENDhtmlTOP; 17 content-type: text/html 18 @headers 19 20 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd"> 21 <HTML> 22 <HEAD> 23 <TITLE>$title</TITLE> 24 </HEAD> 25 <BODY BACKGROUND="$background_url"><p> 26 <P> 27 <P ALIGN="CENTER"><IMG SRC="$Global::headerImgUrl" BORDER=1 ALT="WeBWorK"></P> 28 <P> 29 ENDhtmlTOP 30 $out; 31 } 32 33 sub sessionKeyInputs { 34 my($inputsref) = @_; # Argument is a pointer to the hash %inputs 35 my $out = qq! 36 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{'course'}"> 37 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{'user'}"> 38 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{'key'}"> 39 !; 40 41 $out; 42 } 43 44 sub htmlBOTTOM { 45 my ($scriptName,$inputsref, $helpFile) = @_; 46 my ($studentLogin, $studentID, $studentName, $studentEmail, $setNumber, $sectionName,$recitationName) = ('','','','','','',''); 47 48 my ($psvn,$probNum); 49 $psvn = ( defined($$inputsref{'probSetKey'}) ) ? $$inputsref{'probSetKey'}: ""; 50 $probNum = ( defined($$inputsref{'probNum'} ) ) ? $$inputsref{'probNum'} : ""; 51 my $mode = $$inputsref{'Mode'}; 52 $mode = $Global::htmlModeDefault unless $mode; 53 if ($psvn) { 54 attachProbSetRecord($psvn); 55 $studentLogin = getStudentLogin($psvn); 56 attachCLRecord($studentLogin); 57 58 $studentID = CL_getStudentID($studentLogin); 59 $studentEmail = CL_getStudentEmailAddress($studentLogin); 60 $studentName = CL_getStudentName($studentLogin); 61 $setNumber = getSetNumber($psvn); 62 $sectionName = CL_getClassSection($studentLogin); 63 $sectionName = '' unless defined($sectionName); 64 $recitationName = CL_getClassRecitation($studentLogin); 65 $recitationName = '' unless defined($recitationName); 66 } 67 68 69 #This put in to work with the old stuff (before EmailAddress was added to DB) 70 # unless (defined($studentEmail)) { 71 # $studentEmail = $$inputsref{'user'} . '@uhura.cc.rochester.edu'; 72 #} 73 74 my $out = '<HR><TABLE><TR>'; 75 76 $out .= '<TD valign="top">' . qq{ 77 <FORM ACTION="$Global::logout_CGI" METHOD="POST"> 78 <INPUT TYPE="image" SRC="$Global::logoutGifUrl" ALT="[Logout]" Value="Logout"> 79 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> 80 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> 81 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> 82 </FORM> 83 } . '</TD>' if $$inputsref{user} && $$inputsref{key} && $$inputsref{course}; 84 85 my $To = $Global::feedbackAddress; 86 $To =~ s/\s//g; 87 $out .= '<TD valign="top">' . qq{ 88 <FORM ACTION="${Global::cgiWebworkURL}feedback.pl?$To" METHOD="POST"> 89 <INPUT TYPE="image" SRC="$Global::feedbackGifUrl" ALT="[Feedback]" VALUE="Feedback"> 90 <INPUT TYPE="HIDDEN" NAME="probSetKey" VALUE="$psvn"> 91 <INPUT TYPE="HIDDEN" NAME="section" VALUE="$sectionName"> 92 <INPUT TYPE="HIDDEN" NAME="recitation" VALUE="$recitationName"> 93 <INPUT TYPE="HIDDEN" NAME="probNum" VALUE="$probNum"> 94 <INPUT TYPE="HIDDEN" NAME="setnum" VALUE="$setNumber"> 95 <INPUT TYPE="HIDDEN" NAME="id" VALUE="$studentID"> 96 <INPUT TYPE="HIDDEN" NAME="name" VALUE="$studentName"> 97 <INPUT TYPE="HIDDEN" NAME="email" VALUE="$studentEmail"> 98 <INPUT TYPE="HIDDEN" NAME="Mode" VALUE="$mode"> 99 }; 100 101 $out .= &sessionKeyInputs($inputsref) . "</FORM> </TD>\n"; 102 103 $out .= qq{ 104 <TD valign="top"> 105 <A HREF = "${Global::helpURL}$helpFile" TARGET = 'help_page'><IMG SRC="$Global::helpGifUrl" ALT="[Help]"></A> 106 </TD> 107 } if (defined $helpFile); 108 109 $out .= qq{ 110 <TD valign ="top"> 111 <FORM METHOD=POST ACTION=\"${Global::cgiWebworkURL}welcome.pl\"><P> 112 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> 113 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> 114 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> 115 116 <INPUT TYPE=SUBMIT VALUE="Problem Sets"> 117 </FORM> 118 </TD> 119 } unless($0 =~ /welcome.pl/) ; # don't put this on the probSet.pl page 120 # <INPUT TYPE=HIDDEN NAME="probSetKey" VALUE="$$inputsref{probSetKey}"> 121 # removed the above line from 7 lines up. It's not needed and is sometimes undefined 122 # giving a warning message. 123 124 # put link to Professor's page if user is a professor 125 126 my $User = $$inputsref{user} if defined $$inputsref{user}; 127 my $Course = $$inputsref{course} if defined $$inputsref{course}; 128 my $permissions = 0; 129 if (defined $User and defined $Course) { 130 my $permissionsFile = &Global::getCoursePermissionsFile($Course); 131 $permissions = &get_permissions($User, $permissionsFile); 132 } 133 134 if ($permissions == $Global::instructor_permissions) { 135 136 $out .= qq{ 137 <TD valign ="top"> 138 <FORM METHOD=POST ACTION=\"${Global::cgiWebworkURL}profLogin.pl\"><P> 139 <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> 140 <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> 141 <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> 142 <INPUT TYPE=SUBMIT VALUE="Enter Professor's Page"> 143 </FORM> 144 </TD> 145 }; 146 }; 147 $out .= '</TR></TABLE>'; 148 149 $out .= qq!<TT>Problem Set Version Number: $$inputsref{'probSetKey'}</TT>\n! 150 if $$inputsref{'probSetKey'}; 151 152 $out .= qq{ 153 <BR><TT> Page produced by script: $scriptName</TT> 154 155 156 } if $scriptName; 157 $out .= qq{<H4> Compiler warnings:</H4>$Global::WARNINGS} if $Global::WARNINGS; 158 $out .= '</body></html>'; 159 } 160 161 sub html_NO_PERMISSION { 162 my $out = &htmlTOP; 163 $out .=qq~ 164 <H1> NO PERMISSION </H1> 165 Sorry, you do not have permission to use this script! 166 ~; 167 $out .= &htmlBOTTOM; 168 $out; 169 } 170 1;
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |