Parent Directory
|
Revision Log
initial import
1 #!/usr/bin/perl 2 3 ## $Id$ 4 5 #################################################################### 6 # Copyright @ 1995-1998 University of Rochester 7 # All Rights Reserved 8 #################################################################### 9 10 11 ## This file is profChangeDates.pl 12 ## It provides access to utilities for building, correcting and viewing problem sets 13 ## 14 15 16 use lib '/ww/webwork/development/'; # mainWeBWorKDirectory; 17 require 5.001; 18 use strict; 19 20 21 use Global; 22 use Auth; 23 use TimeLocal; 24 use CGI qw(:standard); 25 26 27 # Timing code 28 use Benchmark; 29 my $beginTime = new Benchmark; 30 # end Timing code 31 32 # variables global to this file 33 my ($setNumber,$setHeaderFileName,$probHeaderFileName,$dueDate,$openDate,$answerDate,$problemListref,$problemValueListref,$problemAttemptLimitListref); 34 my (@problemList,@problemValueList,@problemAttemptLimitList); 35 36 #&CGI::ReadParse; 37 #my %inputs=%main::in; 38 my $cgi = new CGI; 39 if( $CGI::VERSION < 2.5 ) { 40 die "This version of WeBWorK requires at least version 2.50 of the CGI.pm library"; 41 } 42 my %inputs = $cgi -> Vars(); 43 my ($classID, $fileName); 44 45 # establish environment for this script 46 47 my $Course = $inputs{'course'}; 48 &Global::getCourseEnvironment($Course); 49 50 51 my $cgiURL = getWebworkCgiURL($Course); 52 my $courseScriptsDirectory = getCourseScriptsDirectory($Course); 53 my $databaseDirectory = getCourseDatabaseDirectory($Course); 54 my $htmlURL = getCourseHtmlURL($Course); 55 my $scriptDirectory = getWebworkScriptDirectory($Course); 56 my $templateDirectory = getCourseTemplateDirectory; 57 58 require "${scriptDirectory}$Global::DBglue_pl"; 59 require "${scriptDirectory}$Global::FILE_pl"; 60 require "${scriptDirectory}$Global::HTMLglue_pl"; 61 62 # log access 63 &Global::log_info('', query_string); 64 65 &webDatePage; 66 67 # begin Timing code 68 my $endTime = new Benchmark; 69 &Global::logTimingInfo($beginTime,$endTime,"profChangeDates.pl",$inputs{'course'},$inputs{'course'}); 70 # end Timing code 71 exit; 72 73 #####################################END###################################### 74 75 sub webDatePage { 76 # verify the identity of the user. 77 my $keyFile = &Global::getCourseKeyFile($inputs{'course'}); 78 &verify_key($inputs{'user'}, $inputs{'key'}, "$keyFile", $inputs{'course'}); 79 my $permissionsFile = &Global::getCoursePermissionsFile($inputs{'course'}); 80 my $permissions = &get_permissions($inputs{'user'}, $permissionsFile); 81 if ($permissions != $Global::instructor_permissions ) { 82 print "permissions = $permissions instructor_permissions= $Global::instructor_permissions\n"; 83 print &html_NO_PERMISSION; 84 exit(0); 85 } 86 87 else { 88 print &htmlTOP("Download Paper copies"); 89 # print navigation buttons 90 print qq! 91 <A HREF="${cgiURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}"> 92 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p> 93 !; 94 $setNumber=$inputs{'setNo'}; 95 &printForms($setNumber); 96 print &htmlBOTTOM("profDownloadPaperCopies.pl", \%inputs); 97 } 98 99 100 } 101 102 103 104 105 106 sub printForms { 107 my ($setNumber) = @_; 108 109 # Problem Set Number $SetNumber -- psvn: $psvn -- for $StudentLastName, $StudentFirstName<BR> 110 ############################################# 111 # FORM for downloading postscript versions 112 ############################################# 113 114 my $format = $inputs{'format'}; #alph, section, or recitation 115 116 my @local_psvns; 117 if ($format eq 'section') { 118 @local_psvns = getAllProbSetKeysForSetSortedBySectionThenByName($setNumber); 119 } 120 elsif ($format eq 'recitation') { 121 @local_psvns = getAllProbSetKeysForSetSortedByRecitationThenByName($setNumber); 122 } 123 else { 124 @local_psvns = getAllProbSetKeysForSetSortedByName($setNumber); 125 } 126 127 128 129 print qq! 130 <FORM action="${Global::cgiWebworkURL}welcomeAction.pl"> 131 <HR NOSHADE><H3>Download paper copies of set $setNumber for selected students:</H3>\n 132 This will produce a large file containing every selected student's version of the problem set. Also this 133 may take quite a while for large number of students. Selecting TeX format and then TeX'ing the resulting TeX 134 file on your local computer may be much more efficient. <BR>!; 135 136 # enter available individual logins 137 print qq!<BR>\n<SELECT Name='local_psvns' Size =10 multiple>\n!; 138 my ($lastName, $firstName, $studentID, $local_psvn, $studentLogin, $section, $recitation, $label); 139 foreach $local_psvn (@local_psvns) { 140 attachProbSetRecord($local_psvn); 141 ## student 142 $lastName = getStudentLastName($local_psvn); 143 $firstName = getStudentFirstName($local_psvn); 144 $studentID = getStudentID($local_psvn); 145 $studentLogin = getStudentLogin($local_psvn); 146 $section = getClassSection($local_psvn); 147 $recitation = getClassRecitation($local_psvn); 148 149 if ($format eq 'section') { 150 $label = ", $section"; 151 } 152 elsif ($format eq 'recitation') { 153 $label = ", $recitation"; 154 } 155 else { 156 $label = ''; 157 } 158 $label = "$lastName, $firstName, $studentID, $studentLogin". $label; 159 print " <OPTION VALUE = \"$local_psvn\">$label \n"; 160 } 161 162 print qq! \n</SELECT>\n!; 163 164 165 print qq! 166 <INPUT TYPE='HIDDEN' NAME='action' VALUE='Get_all_copies'> 167 <INPUT TYPE="HIDDEN" NAME="setNo" VALUE="$setNumber"> 168 <INPUT TYPE='HIDDEN' NAME='probSetKey' VALUE=-1><BR> 169 <B>Download Type:</B> <INPUT TYPE=RADIO NAME=\"downloadType\" VALUE=\"ps\" CHECKED><B>postscript</B> format 170 <INPUT TYPE=RADIO NAME=\"downloadType\" VALUE=\"pdf\"><B>pdf</B> format 171 <INPUT TYPE=RADIO NAME=\"downloadType\" VALUE=\"TeX\"><B>TeX</B> format 172 <INPUT TYPE=RADIO NAME=\"downloadType\" VALUE=\"dvi\"><B>DVI</B> format<BR> 173 174 <INPUT TYPE=CHECKBOX NAME=\"ShowAns\" VALUE=\"1\"> Show answers in hard copy.<BR> 175 176 !; 177 178 print &sessionKeyInputs(\%inputs); 179 180 print qq! 181 <br><input type="submit" value="Download Sets"> 182 </FORM> 183 !; 184 }
| aubreyja at gmail dot com | ViewVC Help |
| Powered by ViewVC 1.0.9 |