[system] / trunk / webwork / system / cgi / cgi-scripts / profScoring.pl Repository:
ViewVC logotype

View of /trunk/webwork/system/cgi/cgi-scripts/profScoring.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 8 - (download) (as text) (annotate)
Fri Jun 15 16:24:03 2001 UTC (11 years, 11 months ago) by gage
File size: 11423 byte(s)
modified use lib lines in cgi-scripts, scripts, courseScripts
removed Global.pm updating and use lib line code from system_webwork_setup
modified Global.pm to use webworkConfig (which is not in the repository!)

    1 #!/usr/local/bin/webwork-perl
    2 
    3 
    4 
    5 ## This file is profScoring.pl
    6 ## It provides access to utilities for building, correcting and viewing problem sets
    7 ##
    8 
    9 ####################################################################
   10 # Copyright @ 1995-1998 University of Rochester
   11 # All Rights Reserved
   12 ####################################################################
   13 
   14 use lib '.'; use webworkInit; # WeBWorKInitLine
   15 use CGI qw(:standard);
   16 use Global;
   17 use Auth;
   18 use strict;
   19 
   20 # begin Timing code
   21 use Benchmark;
   22 my $beginTime = new Benchmark;
   23 # end Timing code
   24 
   25 &CGI::ReadParse;
   26 my %inputs =%main::in;
   27 
   28 # get information from CGI inputs  (see also below for additional information)
   29 
   30   my $Course      = $inputs{'course'};
   31   my $User      = $inputs{'user'};
   32   my $Session_key   = $inputs{'key'};
   33 
   34 # verify that information has been received
   35   unless($Course && $User && $Session_key) {
   36     &wwerror("$0","The script did not receive the proper input data.","","");
   37     die "The script profLogin.pl did not receive the proper input data.";
   38     }
   39 
   40 # establish environment for this script
   41 
   42   &Global::getCourseEnvironment($inputs{'course'});
   43 
   44 
   45   my $cgiURL          = getWebworkCgiURL;
   46   my $courseScriptsDirectory  = getCourseScriptsDirectory;
   47   my $databaseDirectory     = getCourseDatabaseDirectory;
   48   my $htmlURL             = getCourseHtmlURL;
   49   my $scriptDirectory       = getWebworkScriptDirectory;
   50   my $scoringDirectory        = getCourseScoringDirectory;
   51   my $dat                     = getDat;
   52 
   53   require "${scriptDirectory}$Global::DBglue_pl";
   54   require "${scriptDirectory}$Global::classlist_DBglue_pl";
   55   require "${scriptDirectory}$Global::FILE_pl";
   56   require "${scriptDirectory}$Global::HTMLglue_pl";
   57 
   58 # log access
   59   &Global::log_info('', query_string);
   60 
   61 
   62   my $permissionsFile = &Global::getCoursePermissionsFile($inputs{'course'});
   63   my $permissions = &get_permissions($inputs{'user'}, $permissionsFile);
   64   my $keyFile = &Global::getCourseKeyFile($inputs{'course'});
   65 
   66 #verify session key
   67   &verify_key($inputs{'user'}, $inputs{'key'}, $keyFile, $inputs{'course'});
   68 
   69 # verify permissions are correct
   70   if ($permissions != $Global::instructor_permissions ) {
   71       print "permissions = $permissions instructor_permissions = $Global::instructor_permissions\n";
   72       print &html_NO_PERMISSION;
   73       exit(0);
   74       }
   75 # get the rest of the information from the submitted form
   76   # nothing further to get in this case
   77 
   78 # get information from the data base.
   79 
   80   # a list of all of the currently created sets:
   81   # Keys contains the set numbers and the value is a representative psvn
   82   my %availableSets = &getAllProbSetNumbersHash;
   83   my @sortedSetNames = &sortSetNamesByDueDate(\%availableSets);
   84 
   85 # print HTML text
   86 print &htmlTOP("Scoring Utilities");
   87 
   88 # print navigation buttons
   89 print qq!
   90 <A HREF="${cgiURL}profLogin.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
   91 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p>
   92 !;
   93 
   94 print <<EOF;
   95 <HR><BR>
   96 
   97 <h3 align="left">WeBWorK scoring programs for $Course</h3>
   98 
   99 From this page, you can score problem sets, download and upload the scoring
  100 spread sheet files, etc. <p>
  101 EOF
  102 
  103 
  104 ## profScoring form -- allows you to score problem sets
  105 print <<EOF;
  106 <P>
  107 <HR NOSHADE>
  108 <H4 ALIGN=LEFT>
  109  <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  110 1. Score problem sets in $Course:
  111 </H4>
  112 
  113 Select the set(s) you want to score.
  114 
  115     <FORM METHOD = 'POST' ACTION= "${cgiURL}profScoreProbSet.pl">
  116          <INPUT TYPE='SUBMIT' VALUE='Score problem sets'>
  117 
  118 EOF
  119 
  120 # enter the available set numbers
  121     print qq! <SELECT Name='setNo' Size =4 multiple >\n!;
  122   my ($ind,$label,$fileName, @stat, $date);
  123   for $ind (@sortedSetNames) {
  124       $label ='  Not scored';
  125       $fileName = "${scoringDirectory}s${ind}scr.$dat";
  126       if (-e $fileName) {
  127           @stat = stat($fileName);
  128           $date = $stat[9];
  129           $date = formatDateAndTime($date);
  130           $date =~ s|\s*at.*||;
  131           $label = "  Scored $date";
  132       }
  133     print "<OPTION VALUE = \"$ind\">Set $ind $label\n";
  134   }
  135     print qq!</SELECT>\n!;
  136     print qq{
  137     <BR><INPUT TYPE=CHECKBOX NAME="appendTotals" VALUE=1 checked>Append totals to ${Course}_totals.csv (Recommended)
  138     <BR>Sort Order:
  139     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='A' >  by Student Name
  140     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='S' >  by Student ID  <BR>
  141 
  142     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='AbySec' CHECKED> by Section then by Student Name
  143     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='SbySec' >  by Section then by Student ID <BR>
  144 
  145     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='AbyRec' > by Recitation then by Student Name
  146     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='SbyRec' > by Recitation then by Student ID <BR>
  147 
  148       };
  149 
  150 # resume printing the rest of the form
  151 
  152 print <<EOF;
  153          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  154          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  155          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  156          <INPUT TYPE="HIDDEN" NAME="batchMode" VALUE= 0 >
  157          </FORM>
  158 EOF
  159 
  160 print <<EOF;
  161 <P>
  162 <HR NOSHADE>
  163 <H4 ALIGN=LEFT>
  164  <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  165 2. Download (or view) $Course scoring files to your personal computer.
  166 </H4>
  167 
  168 You can download files for editing or viewing in either cvs (i.e. comma delimited), html, text, or
  169 tab (i.e. tab delimited) format.  <BR>
  170 csv is a supported format for Excel and is the recommended format if you use Excel. <BR> <BR>
  171 The <strong>totals</strong> file (${Course}_totals.csv) is the cummulative semester record of grades.<BR>
  172 The <strong>scr</strong> files (e.g. s2scr.csv) give, for each problem set, the STATUS of individual problems.
  173 The STATUS is a number between 0 and 1 depending on (partial) credit earned.  "STATUS" times "PROB VAL" gives the score for the problem.<BR>
  174 The <strong>ful</strong> files (e.g. s2ful.csv) give, for each problem set, the STATUS plus data on
  175 the number of correct and incorrect attempts for each problem.<BR>
  176 <strong>all</strong> files include backup files, etc.
  177 
  178 
  179 
  180 
  181 
  182     <FORM METHOD = "POST" ACTION= "${cgiURL}profDownloadScoringFiles.pl">
  183     format:
  184     <INPUT TYPE=RADIO NAME="format" VALUE="csv" CHECKED>csv
  185     <INPUT TYPE=RADIO NAME="format" VALUE="html" >html
  186     <INPUT TYPE=RADIO NAME="format" VALUE="text" >text
  187     <INPUT TYPE=RADIO NAME="format" VALUE="tab" >tab  <BR>
  188     <INPUT TYPE=CHECKBOX NAME="totalsFile" VALUE=1 checked> totals file
  189     <INPUT TYPE=CHECKBOX NAME="scrFiles" VALUE=1> scr files
  190     <INPUT TYPE=CHECKBOX NAME="fulFiles" VALUE=1> ful files
  191     <INPUT TYPE=CHECKBOX NAME="allFiles" VALUE=1> all files <BR>
  192 
  193          <INPUT TYPE="SUBMIT" VALUE="Select file(s)">
  194 
  195 EOF
  196 
  197 # resume printing the rest of the form
  198 
  199 print <<EOF;
  200          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  201          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  202          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  203          <INPUT TYPE="HIDDEN" NAME="download" VALUE= 0 >
  204          <INPUT TYPE="HIDDEN" NAME="fileName" VALUE= "" >
  205          </FORM>
  206 EOF
  207 
  208 print <<EOF;
  209 <P>
  210 <HR NOSHADE>
  211 <H4 ALIGN=LEFT>
  212  <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  213 3. Simple editing of $Course scoring files.
  214 </H4>
  215 
  216 Use this for simple editing, e.g. changing a few scores or possibly adding a new column of exam grades.
  217 For more complicated editing, download the file to a preadsheet program such as Excel by option 2 above.
  218 
  219 
  220     <FORM METHOD = "POST" ACTION= "${cgiURL}profFormEditScoringFiles.pl">
  221     <INPUT TYPE=CHECKBOX NAME="totalsFile" VALUE=1 checked> totals file
  222     <INPUT TYPE=CHECKBOX NAME="scrFiles" VALUE=1> scr files
  223     <INPUT TYPE=CHECKBOX NAME="fulFiles" VALUE=1> ful files
  224         <INPUT TYPE="SUBMIT" VALUE="Select file(s)">
  225 
  226 EOF
  227 
  228 
  229 
  230 # resume printing the rest of the form
  231 
  232 print <<EOF;
  233          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  234          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  235          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  236          <INPUT TYPE="HIDDEN" NAME="action" VALUE= "" >
  237          <INPUT TYPE="HIDDEN" NAME="fileName" VALUE= "" >
  238          <INPUT TYPE="HIDDEN" NAME="readWrite" VALUE= "readOnly" >
  239          </FORM>
  240 EOF
  241 
  242 
  243 print <<EOF;
  244 <P>
  245 <HR NOSHADE>
  246 <H4 ALIGN=LEFT>
  247  <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  248 4. Upload $Course scoring files from your personal computer.
  249 </H4>
  250 
  251 You can upload scoring files from your personal computer in cvs (i.e. comma delimited),
  252 tab (i.e. tab delimited), or html format.  Usually you would do this after
  253 downloading and editing a file in Excel or some other spreadsheet program.  Only valid scoring files
  254 with filenames ending in "_totals.ext", "scr.ext", and "ful.ext" can be uploaded where the extension
  255 "ext" must be "csv", "txt" (for tab delimited), "html" or "htm". You can not upload backup files without
  256 renaming them.
  257 <FORM METHOD = 'POST' enctype='multipart/form-data' ACTION= "${cgiURL}profUploadScoringFile.pl">
  258 
  259     format on personal computer:
  260     <INPUT TYPE=RADIO NAME="format" VALUE="csv" CHECKED>csv
  261     <INPUT TYPE=RADIO NAME="format" VALUE="tab" >tab
  262     <INPUT TYPE=RADIO NAME="format" VALUE="html" >html  <BR>
  263     <INPUT TYPE=CHECKBOX NAME="overWrite" VALUE=1 unchecked> Overwrite existing file
  264     <INPUT TYPE=CHECKBOX NAME="backUp" VALUE=1 checked> Backup existing file first  <BR>
  265 
  266 File to upload: <input type=file name=upload><br>
  267 <br>
  268 <input type=submit value=UpLoad> the file.
  269 
  270          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  271          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  272          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  273          </FORM>
  274 EOF
  275 
  276 
  277 print <<EOF;
  278 <P>
  279 <HR NOSHADE>
  280 <H4 ALIGN=LEFT>
  281  <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  282 5. Sort $Course scoring files.
  283 </H4>
  284 
  285 Use this for sorting scoring files.  Student records can be sorted by
  286 one of six methods: (a) by student name, (b) by student ID, (c) by section then
  287 by student name, (d) by section then by student ID, (e) by recitation then
  288 by student name and (f) by recitation then by student ID.
  289 
  290 
  291     <FORM METHOD = "POST" ACTION= "${cgiURL}profSortScoringFiles.pl">
  292     <INPUT TYPE=CHECKBOX NAME="totalsFile" VALUE=1 checked> totals file
  293     <INPUT TYPE=CHECKBOX NAME="scrFiles" VALUE=1> scr files
  294     <INPUT TYPE=CHECKBOX NAME="fulFiles" VALUE=1> ful files <BR>
  295 
  296     Sort Order:
  297     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='A' >  by Student Name
  298     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='S' >  by Student ID  <BR>
  299 
  300     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='AbySec' CHECKED> by Section then by Student Name
  301     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='SbySec' >  by Section then by Student ID <BR>
  302 
  303     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='AbyRec' > by Recitation then by Student Name
  304     <INPUT TYPE=RADIO NAME="sortOrder" VALUE='SbyRec' > by Recitation then by Student ID <BR>
  305 
  306         <INPUT TYPE="SUBMIT" VALUE="Select file(s)">
  307         <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  308         <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  309         <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  310         <INPUT TYPE="HIDDEN" NAME="action" VALUE= "" >
  311         <INPUT TYPE="HIDDEN" NAME="fileName" VALUE= "" >
  312         </FORM>
  313 EOF
  314 
  315 
  316 
  317 
  318 print &htmlBOTTOM("profScoring.pl", \%inputs,'profScoringHelp.html');
  319 
  320 # begin Timing code
  321 my $endTime = new Benchmark;
  322 &Global::logTimingInfo($beginTime,$endTime,"profScoring.pl",$inputs{'course'},$inputs{'user'});
  323 # end Timing code
  324 exit;
  325 
  326 
  327 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9