Parent Directory
|
Revision Log
Revision 85 - (view) (download) (as text)
| 1 : | sam | 11 | #!/usr/local/bin/webwork-perl |
| 2 : | sam | 2 | |
| 3 : | ## $Id$ | ||
| 4 : | |||
| 5 : | #strings for HTML display in webwork | ||
| 6 : | |||
| 7 : | gage | 8 | use lib '.'; use webworkInit; # WeBWorKInitLine |
| 8 : | sam | 2 | 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 : | gage | 6 | my ($studentLogin, $studentID, $studentName, $studentEmail, $setNumber, $sectionName,$recitationName) = ('','','','','','',''); |
| 47 : | sam | 2 | |
| 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 : | gage | 6 | 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 : | apizer | 85 | $setNumber = '' unless defined($setNumber); |
| 63 : | gage | 6 | $sectionName = CL_getClassSection($studentLogin); |
| 64 : | $sectionName = '' unless defined($sectionName); | ||
| 65 : | $recitationName = CL_getClassRecitation($studentLogin); | ||
| 66 : | sam | 2 | $recitationName = '' unless defined($recitationName); |
| 67 : | } | ||
| 68 : | |||
| 69 : | |||
| 70 : | #This put in to work with the old stuff (before EmailAddress was added to DB) | ||
| 71 : | # unless (defined($studentEmail)) { | ||
| 72 : | # $studentEmail = $$inputsref{'user'} . '@uhura.cc.rochester.edu'; | ||
| 73 : | #} | ||
| 74 : | |||
| 75 : | my $out = '<HR><TABLE><TR>'; | ||
| 76 : | |||
| 77 : | $out .= '<TD valign="top">' . qq{ | ||
| 78 : | <FORM ACTION="$Global::logout_CGI" METHOD="POST"> | ||
| 79 : | <INPUT TYPE="image" SRC="$Global::logoutGifUrl" ALT="[Logout]" Value="Logout"> | ||
| 80 : | <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> | ||
| 81 : | <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> | ||
| 82 : | <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> | ||
| 83 : | </FORM> | ||
| 84 : | } . '</TD>' if $$inputsref{user} && $$inputsref{key} && $$inputsref{course}; | ||
| 85 : | |||
| 86 : | my $To = $Global::feedbackAddress; | ||
| 87 : | $To =~ s/\s//g; | ||
| 88 : | $out .= '<TD valign="top">' . qq{ | ||
| 89 : | <FORM ACTION="${Global::cgiWebworkURL}feedback.pl?$To" METHOD="POST"> | ||
| 90 : | <INPUT TYPE="image" SRC="$Global::feedbackGifUrl" ALT="[Feedback]" VALUE="Feedback"> | ||
| 91 : | <INPUT TYPE="HIDDEN" NAME="probSetKey" VALUE="$psvn"> | ||
| 92 : | <INPUT TYPE="HIDDEN" NAME="section" VALUE="$sectionName"> | ||
| 93 : | <INPUT TYPE="HIDDEN" NAME="recitation" VALUE="$recitationName"> | ||
| 94 : | <INPUT TYPE="HIDDEN" NAME="probNum" VALUE="$probNum"> | ||
| 95 : | <INPUT TYPE="HIDDEN" NAME="setnum" VALUE="$setNumber"> | ||
| 96 : | <INPUT TYPE="HIDDEN" NAME="id" VALUE="$studentID"> | ||
| 97 : | <INPUT TYPE="HIDDEN" NAME="name" VALUE="$studentName"> | ||
| 98 : | <INPUT TYPE="HIDDEN" NAME="email" VALUE="$studentEmail"> | ||
| 99 : | <INPUT TYPE="HIDDEN" NAME="Mode" VALUE="$mode"> | ||
| 100 : | }; | ||
| 101 : | |||
| 102 : | $out .= &sessionKeyInputs($inputsref) . "</FORM> </TD>\n"; | ||
| 103 : | |||
| 104 : | $out .= qq{ | ||
| 105 : | <TD valign="top"> | ||
| 106 : | <A HREF = "${Global::helpURL}$helpFile" TARGET = 'help_page'><IMG SRC="$Global::helpGifUrl" ALT="[Help]"></A> | ||
| 107 : | </TD> | ||
| 108 : | } if (defined $helpFile); | ||
| 109 : | |||
| 110 : | $out .= qq{ | ||
| 111 : | <TD valign ="top"> | ||
| 112 : | <FORM METHOD=POST ACTION=\"${Global::cgiWebworkURL}welcome.pl\"><P> | ||
| 113 : | <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> | ||
| 114 : | <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> | ||
| 115 : | <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> | ||
| 116 : | |||
| 117 : | <INPUT TYPE=SUBMIT VALUE="Problem Sets"> | ||
| 118 : | </FORM> | ||
| 119 : | </TD> | ||
| 120 : | } unless($0 =~ /welcome.pl/) ; # don't put this on the probSet.pl page | ||
| 121 : | # <INPUT TYPE=HIDDEN NAME="probSetKey" VALUE="$$inputsref{probSetKey}"> | ||
| 122 : | # removed the above line from 7 lines up. It's not needed and is sometimes undefined | ||
| 123 : | # giving a warning message. | ||
| 124 : | |||
| 125 : | # put link to Professor's page if user is a professor | ||
| 126 : | |||
| 127 : | my $User = $$inputsref{user} if defined $$inputsref{user}; | ||
| 128 : | my $Course = $$inputsref{course} if defined $$inputsref{course}; | ||
| 129 : | my $permissions = 0; | ||
| 130 : | if (defined $User and defined $Course) { | ||
| 131 : | my $permissionsFile = &Global::getCoursePermissionsFile($Course); | ||
| 132 : | $permissions = &get_permissions($User, $permissionsFile); | ||
| 133 : | } | ||
| 134 : | |||
| 135 : | if ($permissions == $Global::instructor_permissions) { | ||
| 136 : | |||
| 137 : | $out .= qq{ | ||
| 138 : | <TD valign ="top"> | ||
| 139 : | <FORM METHOD=POST ACTION=\"${Global::cgiWebworkURL}profLogin.pl\"><P> | ||
| 140 : | <INPUT TYPE="HIDDEN" NAME="user" VALUE="$$inputsref{user}"> | ||
| 141 : | <INPUT TYPE="HIDDEN" NAME="key" VALUE="$$inputsref{key}"> | ||
| 142 : | <INPUT TYPE="HIDDEN" NAME="course" VALUE="$$inputsref{course}"> | ||
| 143 : | <INPUT TYPE=SUBMIT VALUE="Enter Professor's Page"> | ||
| 144 : | </FORM> | ||
| 145 : | </TD> | ||
| 146 : | }; | ||
| 147 : | }; | ||
| 148 : | $out .= '</TR></TABLE>'; | ||
| 149 : | |||
| 150 : | $out .= qq!<TT>Problem Set Version Number: $$inputsref{'probSetKey'}</TT>\n! | ||
| 151 : | if $$inputsref{'probSetKey'}; | ||
| 152 : | |||
| 153 : | $out .= qq{ | ||
| 154 : | <BR><TT> Page produced by script: $scriptName</TT> | ||
| 155 : | |||
| 156 : | |||
| 157 : | } if $scriptName; | ||
| 158 : | $out .= qq{<H4> Compiler warnings:</H4>$Global::WARNINGS} if $Global::WARNINGS; | ||
| 159 : | $out .= '</body></html>'; | ||
| 160 : | } | ||
| 161 : | |||
| 162 : | sub html_NO_PERMISSION { | ||
| 163 : | my $out = &htmlTOP; | ||
| 164 : | $out .=qq~ | ||
| 165 : | <H1> NO PERMISSION </H1> | ||
| 166 : | Sorry, you do not have permission to use this script! | ||
| 167 : | ~; | ||
| 168 : | $out .= &htmlBOTTOM; | ||
| 169 : | $out; | ||
| 170 : | } | ||
| 171 : | 1; |
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |