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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2 - (download) (as text) (annotate)
Thu Jun 14 17:08:51 2001 UTC (11 years, 11 months ago) by sam
File size: 6756 byte(s)
initial import

    1 #!/usr/bin/perl
    2 
    3 
    4 
    5 ## This file is TALogin.pl
    6 ## It provides access to utilities for  viewing problem sets
    7 ##
    8 ## It is called from a form with inputs
    9 ## 'user',
   10 ##^'key'
   11 ## 'course'
   12 ## #######################################################################
   13 ## Copyright @1996, 1997 by Michael E. Gage and WeBWorK.  All rights reserved.
   14 ## #######################################################################
   15 
   16 use lib '/ww/webwork/development/'; # mainWeBWorKDirectory;
   17 
   18 use CGI qw(:standard);
   19 use Global;
   20 use Auth;
   21 use strict;
   22 
   23 # begin Timing code
   24 use Benchmark;
   25 my $beginTime = new Benchmark;
   26 # end Timing code
   27 
   28 &CGI::ReadParse;
   29 my %inputs =%main::in;
   30 
   31 # get information from CGI inputs  (see also below for additional information)
   32 
   33   my $Course      = $inputs{'course'};
   34   my $User      = $inputs{'user'};
   35   my $Session_key   = $inputs{'key'};
   36 
   37 # verify that information has been received
   38   unless($Course && $User && $Session_key) {
   39     wwerror($0,'The script TALogin.pl did not receive the proper input data.','','','');
   40     }
   41 
   42 # establish environment for this script
   43 
   44   &Global::getCourseEnvironment($inputs{'course'});
   45 
   46 
   47   my $cgiURL          = $Global::cgiWebworkURL;
   48   my $courseScriptsDirectory  = $Global::courseScriptsDirectory;
   49   my $databaseDirectory     = $Global::databaseDirectory;
   50   my $htmlURL             = $Global::htmlURL;
   51   my $scriptDirectory       = $Global::scriptDirectory;
   52 
   53   require "${scriptDirectory}$Global::DBglue_pl";
   54   require "${scriptDirectory}$Global::FILE_pl";
   55   require "${scriptDirectory}$Global::HTMLglue_pl";
   56 
   57 # log access
   58   &Global::log_info('', query_string);
   59 
   60 
   61   my $permissionsFile = &Global::getCoursePermissionsFile($inputs{'course'});
   62   my $permissions = &get_permissions($inputs{'user'}, $permissionsFile);
   63   my $keyFile = &Global::getCourseKeyFile($inputs{'course'});
   64 
   65 #verify session key
   66   &verify_key($inputs{'user'}, $inputs{'key'}, "$keyFile", $inputs{'course'});
   67 # verify permissions are correct
   68   if (($permissions != $Global::instructor_permissions) and ($permissions != $Global::TA_permissions) ) {
   69       print "permissions = $permissions instructor_permissions = $Global::instructor_permissions\n";
   70       print &html_NO_PERMISSION;
   71       exit(0);
   72       }
   73 # get the rest of the information from the submitted form
   74   # nothing further to get in this case
   75 
   76 # get information from the data base.
   77 
   78   # a list of all of the currently created sets:
   79   # Keys contains the set numbers and the value is a representative psvn
   80   my %availableSets = &getAllProbSetNumbersHash;
   81   my @sortedSetNames = &sortSetNamesByDueDate(\%availableSets);
   82 
   83   # a list of all of the currently enrolled students
   84   my @setsTemp= keys %availableSets;
   85   my $lastSetNumber = pop @setsTemp ;
   86   my @availableStudents = &getAllProbSetKeysForSetSortedByName($lastSetNumber);
   87 
   88 # print HTML text
   89 print &htmlTOP("WeBWorK TA Utilities");
   90 
   91 # print navigation buttons
   92 print qq!
   93 <A HREF="${cgiURL}login.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
   94 <IMG SRC="${Global::upImgUrl}" align="right" BORDER=1 ALT="[Up]"></A><p>
   95 !;
   96 
   97 print <<EOF;
   98 <HR><BR>
   99 
  100 <h3 align="left">WeBWorK TA Utility programs</h3>
  101 
  102 From this page, you can  monitor the progress of the students.<p>
  103 EOF
  104 
  105 
  106 # course data form
  107 print <<EOF;
  108 <P>
  109 <HR NOSHADE>
  110 <H4 ALIGN=LEFT>
  111 <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  112 1. View statistical data on problem sets for the whole course and sections in $Course:
  113 
  114 </H4>
  115 
  116     <FORM METHOD = "POST" ACTION= "${cgiURL}profCourseData.pl">
  117      <INPUT TYPE="SUBMIT" VALUE="View Course Data">
  118 EOF
  119 
  120 # enter the available set numbers
  121   print qq! <SELECT Name="setNo" >\n!;
  122   my $ind;
  123   for $ind (@sortedSetNames) {
  124     print "<OPTION VALUE = \"$ind\">Set $ind\n";
  125     }
  126   print qq!</SELECT>\n!;
  127 # resume printing the rest of the forms
  128 
  129 print <<EOF;
  130          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  131          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  132          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  133         </FORM>
  134 
  135 This allows you see the average score on a set and on individual problems for
  136 the course as a whole and also by section.  The average number of incorrect
  137 attempts per problem is also displayed.
  138 EOF
  139 
  140 
  141 # classlist.pl form -- view set data for the entire class
  142 print <<EOF;
  143 <P>
  144 <HR NOSHADE>
  145 <H4 ALIGN=LEFT>
  146 <IMG SRC="$Global::bluesquareImgUrl" BORDER=1  ALT="">
  147 2. View students  progress on problem sets in $Course:
  148 
  149 </H4>
  150 
  151     <FORM METHOD = "POST" ACTION= "${cgiURL}classlist.pl">
  152      <INPUT TYPE="SUBMIT" VALUE="View Students Progress">
  153 EOF
  154 
  155 # enter the available set numbers
  156   print qq! <SELECT Name="setNo" >\n!;
  157   for $ind (@sortedSetNames) {
  158     print "<OPTION VALUE = \"$ind\">Set $ind\n";
  159     }
  160   print qq!</SELECT>\n!;
  161 # resume printing the rest of the forms
  162 
  163 print <<EOF;
  164          <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  165          <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  166          <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  167          <INPUT TYPE="HIDDEN" NAME="pCL" VALUE="1">
  168         </FORM>
  169 
  170 This also allows you to find the psvn for a given student and to view
  171 the problems as viewed by the student.  You can see the exact answer expected
  172 by WeBWorK and also, if you wish, answer the problem for the student.
  173 EOF
  174 
  175 
  176 
  177 # View class grades
  178 print <<EOF;
  179 <P>
  180 <HR NOSHADE>
  181 <H4 ALIGN=LEFT><A HREF="${cgiURL}classGradeSummary.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
  182     <IMG SRC="$Global::bluesquareImgUrl"
  183               BORDER=1
  184               ALT=""> 3. View grades for $Course</A> -- still flakey.
  185 </H4>
  186 
  187 EOF
  188 
  189 
  190 
  191 ### older scripts are archived here
  192 #print <<EOF;
  193 #<HR SIZE=5 NOSHADE>
  194 #<H3 ALIGN=CENTER>Older scripts:</H3>
  195 #EOF
  196 #
  197 ## oldclasslist.pl -- dumps much of the database for inspection
  198 #print <<EOF;
  199 #<HR>
  200 #<FORM METHOD = "POST" ACTION= "${cgiURL}oldclasslist.pl">
  201 #         <INPUT TYPE="SUBMIT" VALUE="View Class List">
  202 #         <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  203 #         <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  204 #         <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  205 #        </FORM>
  206 #An older version of the view class list script which allows you to view all sets and
  207 #much of the information available in the database.
  208 #EOF
  209 
  210 
  211 #<H3 align="center">List of Problem Sets</H3>
  212 # These are not really needed since there is a separate script for viewing and changing dates.
  213 #my %setNumberHash=&getAllSetNumbersForStudentLoginHash('gage');
  214 #&printProbSets("",\%setNumberHash);
  215 
  216 print &htmlBOTTOM("TALogin.pl", \%inputs);
  217 
  218 # begin Timing code
  219 my $endTime = new Benchmark;
  220 &Global::logTimingInfo($beginTime,$endTime,"TALogin.pl",$inputs{'course'},$inputs{'user'});
  221 # end Timing code
  222 exit;
  223 #######################################################################
  224 

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9