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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1059 - (download) (as text) (annotate)
Sat Jun 7 04:30:31 2003 UTC (9 years, 11 months ago) by gage
File size: 26431 byte(s)
Restoring header #!/usr/local/bin/webwork-perl line
--Mike

    1 #!/usr/local/bin/webwork-perl
    2 
    3 ## $Id$
    4 
    5 ####################################################################
    6 # Copyright @ 1995-1998 University of Rochester
    7 # All Rights Reserved
    8 ####################################################################
    9 
   10 
   11 ## This file is profLogin.pl
   12 ## It provides access to utilities for building, correcting and viewing problem sets
   13 ##
   14 ## It is called from a form with inputs
   15 ## 'user',
   16 ##^'key'
   17 ## 'course'
   18 
   19 use lib '.'; use webworkInit; # WeBWorKInitLine
   20 use CGI qw(:standard);
   21 use Global;
   22 use Auth;
   23 use strict;
   24 
   25 my $logTimingData = 0;
   26 my $beginTime;
   27 
   28 # Prototype that needs to be here
   29 sub if_database(&;&);
   30 
   31 # begin Timing code
   32 if ($logTimingData == 1) {
   33   use Benchmark;
   34   $beginTime = new Benchmark;
   35 }
   36 # end Timing code
   37 
   38 
   39 my $cgi = new CGI;
   40 my %inputs = $cgi->Vars();
   41 
   42 # get information from CGI inputs  (see also below for additional information)
   43 
   44 my $Course    = $cgi->param('course');
   45 my $User    = $cgi->param('user');
   46 my $Session_key   = $cgi->param('key');
   47 
   48 my $Course_display = $Course;
   49 $Course_display =~ s/_/ /g;
   50 
   51 # verify that information has been received
   52 unless($Course && $User && $Session_key) {
   53   &Global::error("Script Error","The script profLogin.pl did not receive the proper input data.","","");
   54   die "The script profLogin.pl did not receive the proper input data.";
   55 }
   56 
   57 # establish environment for this script
   58 
   59 &Global::getCourseEnvironment($Course);
   60 
   61 
   62 my $cgiURL        = $Global::cgiWebworkURL;
   63 my $courseScriptsDirectory  = $Global::courseScriptsDirectory;
   64 my $databaseDirectory     = $Global::databaseDirectory;
   65 my $htmlURL           = $Global::htmlURL;
   66 my $scriptDirectory       = $Global::scriptDirectory;
   67 
   68 require "${scriptDirectory}$Global::DBglue_pl";
   69 require "${scriptDirectory}$Global::classlist_DBglue_pl";
   70 require "${scriptDirectory}$Global::FILE_pl";
   71 require "${scriptDirectory}$Global::HTMLglue_pl";
   72 
   73 # log access
   74 &Global::log_info('', query_string);
   75 
   76 
   77 my $permissionsFile = &Global::getCoursePermissionsFile($Course);
   78 my $permissions = &get_permissions($User, $permissionsFile);
   79 my $keyFile = &Global::getCourseKeyFile($Course);
   80 
   81 #verify session key
   82 &verify_key($User, $Session_key, "$keyFile", $Course);
   83 
   84 # verify permissions are correct
   85 if ($permissions != $Global::instructor_permissions ) {
   86   print "permissions = $permissions instructor_permissions = $Global::instructor_permissions\n";
   87   print &html_NO_PERMISSION;
   88   exit(0);
   89 }
   90 # get the rest of the information from the submitted form
   91 # nothing further to get in this case
   92 
   93 my %availableSets = ();
   94 my @sortedSetNames = ();
   95 my @availableStudents = ();
   96 
   97 # get information from the data base and create database if necessary
   98 
   99 if ( -e "${databaseDirectory}$Global::database" ) {
  100   # a list of all of the currently created sets:
  101   # Keys contains the set numbers and the value is a representative psvn
  102   %availableSets = &getAllProbSetNumbersHash;
  103   @sortedSetNames = &sortSetNamesByDueDate(\%availableSets);
  104   @availableStudents = @{getAllLoginNamesSortedByName()};
  105 }
  106 
  107 # print HTML text
  108 print &prof_htmlTOP("WeBWorK Professor Utilities for $Course_display")
  109   .&prof_titleBar("WeBWorK Professor Utilities for $Course_display");
  110 
  111 # print navigation buttons
  112 
  113 
  114 print
  115   $cgi->a(
  116   { -href=>"${cgiURL}login.pl?user=$User&key=$Session_key&course=$Course" },
  117   $cgi->img({ #  -name=>'upImg', # name is not a legal attribute for images
  118     -src=>"${Global::upImgUrl}",
  119     -align=>'right',
  120     -border=>'1',
  121     -alt=>'[Up]'
  122   })
  123 ),
  124   $cgi->p;
  125 
  126 
  127 my %sethash; #popup_menu takes a hash for the labels to associate each label with a specific value
  128 my %labels = (alph => 'Alphabetically', section => 'by section', recitation => 'by recitation');
  129 
  130 
  131 if_database sub {
  132   foreach (@sortedSetNames) {
  133     $sethash{$_} = "Set $_"; #insert the word Set before each set name
  134     $sethash{$_} =~ s/_/ /g;
  135   }
  136 };
  137 
  138 # Main table
  139 print "\n".$cgi->hr()."\n";
  140 print
  141   $cgi->table({border=>1},
  142     $cgi->Tr({valign=>"top"},
  143       $cgi->td({},
  144         $cgi->center({},
  145           $cgi->startform(-action=>"${cgiURL}profBuildProblemSetPage.pl").
  146           $cgi->submit(-value=>'Build and Edit Problem Sets')."\n".
  147           hiddens('user', 'key', 'course').
  148           $cgi->endform()."\n".
  149           if_database sub {
  150             $cgi->startform(-action=>"${cgiURL}profDeleteProbSet.pl").
  151             $cgi->submit(-value=>'Delete Problem Sets')."\n".
  152             hiddens('user', 'key', 'course').
  153             $cgi->endform()."\n"
  154           }
  155         )
  156 
  157       ),
  158       $cgi->td({},
  159         $cgi->center({},
  160           if_database sub {
  161             my ($key, $id, $lname, $fname, @logins, %fullnames);
  162             foreach $key (@availableStudents) {
  163               &attachCLRecord($key) || print "no Record $key\n"; #This is probably wrong
  164               $lname = &CL_getStudentLastName($key);
  165               $fname = &CL_getStudentFirstName($key);
  166               push (@logins, $key); #array for values of popup_menu
  167               $fullnames{$key} = "$lname, $fname";
  168             }
  169 
  170             $cgi->startform(-action=>"${cgiURL}dataMunger.pl").
  171             $cgi->submit(-value=>'Modify Problem Set for Student:')."\n".
  172             $cgi->popup_menu(-name=>"studentLogin", -values=>\@logins, -labels=>\%fullnames)."\n".
  173             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash)."\n".
  174             $cgi->hidden(-name=>'save', -value=>"OFF")."\n".
  175             $cgi->hidden(-name=>'firsttime', -value=>1)."\n".
  176             hiddens('user', 'key', 'course').
  177             $cgi->hidden(-name=>'pCD', -value=>'1')."\n".
  178             $cgi->endform()."\n".
  179             $cgi->small(
  180               "(change individual due dates, status, etc. and get individual hardcopy)"
  181             )
  182           }, sub { "You must build a problem set before you can modify it for a student." }
  183         )
  184       ),
  185       $cgi->td({},
  186         $cgi->center({},
  187           if_database sub {
  188             $cgi->startform(-action=>"${cgiURL}profChangeDates.pl").
  189             $cgi->submit(-value=>'Modify Whole Problem Set:'), "\n". # Change entire set
  190             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash).
  191             hiddens('user', 'key', 'course').
  192             $cgi->hidden(-name=>'pCD', -value=>'1')."\n".
  193             $cgi->endform()."\n".
  194             $cgi->small(
  195               "(extend the due date, change problem status, etc. for all students)"
  196             )
  197           }, sub { "You must build a problem set before you can modify it" }
  198         )
  199       )
  200     ),
  201     $cgi->Tr({valign=>"top"},
  202       $cgi->td({},
  203         $cgi->center({},
  204 
  205           $cgi->startform(-action=>"${cgiURL}profAddStudent.pl").
  206           $cgi->submit(-value=>'Add Students')."\n".
  207           $cgi->hidden(-name=>'number', -value=>'5')."\n".
  208           $cgi->hidden(-name=>'Action', -value=>'return')."\n".
  209           hiddens('user', 'key', 'course').
  210           $cgi->endform()."\n"
  211 
  212         )
  213       ),
  214       $cgi->td({},
  215         $cgi->center({},
  216           if_database sub {
  217             $cgi->startform(-action=>"${cgiURL}profScoring.pl").
  218             $cgi->submit(-value=>'Score Problem Sets')."\n".
  219             hiddens('user', 'key', 'course').
  220             $cgi->endform()."\n"
  221           }, sub { "You must build a problem set before you can score sets" }
  222         )
  223       ),
  224       $cgi->td({},
  225         $cgi->center({},
  226           if_database sub {
  227             $cgi->startform(-action=>"${cgiURL}profSendMail.pl").
  228             $cgi->submit(-value=>'Send Students E-Mail')."\n".
  229             hiddens('user', 'key', 'course').
  230             $cgi->endform()."\n"
  231           }, sub { "You cannot send email until you have build a problem set" }
  232         )
  233       )
  234     ),
  235     $cgi->Tr({valign=>"top"},
  236       $cgi->td({}, #5
  237         $cgi->center({},
  238 
  239           $cgi->startform(-action=>"${cgiURL}profClasslist.pl").
  240           $cgi->submit(-value=>'Edit class roster, passwords')."\n".
  241           $cgi->br."\n".
  242           "Order students \n".
  243           onecelltable(
  244           $cgi->radio_group(
  245             -linebreak=>'true',
  246             -name=>'format',
  247             -values=>['alph','section','recitation'],
  248             -default=>'alph',
  249             -labels=>\%labels),
  250           ).
  251           hiddens('user', 'key', 'course').
  252           $cgi->endform()."\n".
  253           $cgi->small("(Also, export and import the classlist database, etc.)")
  254         )
  255       ),
  256       $cgi->td({},#4
  257         $cgi->center({},
  258           if_database sub {
  259             $cgi->startform(-action=>"${cgiURL}classlist.pl").
  260             $cgi->submit(-value=>'View students progress in:')."\n".
  261             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash)."\n".
  262             $cgi->br."\n".
  263             "Order students".$cgi->br.
  264             onecelltable(
  265               $cgi->radio_group(
  266                 -linebreak=>'true',
  267                 -name=>'sortOrder',
  268                 -default=>'byCourse',
  269                 -values=>['byCourse','bySection','byRecitation'],
  270                 -labels=>{ 'byCourse'=>'Alphabetically', 'bySection'=>'by section ', 'byRecitation'=>'by recitation '})
  271             ).
  272             hiddens('user', 'key', 'course').
  273             $cgi->hidden(-name=>'pCl', -value=>1)."\n".
  274             $cgi->endform()."\n".
  275             $cgi->small("(Also, view and answer problems as a student)")
  276           }, sub { "You cannot view students progress until you have built a problem set" }
  277         )
  278       ),
  279       $cgi->td({}, #1!
  280         $cgi->center({},
  281           if_database sub {
  282             $cgi->startform(-action=>"${cgiURL}profDownloadPaperCopies.pl").
  283             $cgi->submit(-value=>'Download hardcopy')."\n".
  284             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash).
  285             $cgi->br."\n".
  286             "Order students \n".
  287             onecelltable(
  288               $cgi->radio_group(
  289                 -linebreak=>'true',
  290                 -name=>'format',
  291                 -values=>['alph','section','recitation'],
  292                 -default=>'alph',
  293                 -labels=>\%labels),
  294             ).
  295             hiddens('user', 'key', 'course').
  296             $cgi->hidden(-name=>'pCD', -value=>'1')."\n".
  297             $cgi->endform()."\n"
  298           }, sub { "You must build problem sets before you can download a hardcopy" }
  299         )
  300       )
  301     ),
  302     $cgi->Tr({valign=>"top"},
  303       $cgi->td({},#-
  304         $cgi->center({},
  305           if_database sub {
  306             $cgi->startform(-action=>"${cgiURL}profCourseData.pl").
  307             $cgi->submit(-value=>'View Statistics by Section')."\n".
  308             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash)."\n".
  309             hiddens('user', 'key', 'course')."\n".
  310             $cgi->endform()."\n"
  311           }, sub { "You cannot view statistics before you have built a problem set" }
  312         )
  313       ),
  314       $cgi->td({colspan=>2, rowspan=>2},#10!
  315         $cgi->center({},
  316           if_database sub {
  317             $cgi->startform(-action=>"${cgiURL}profHousekeeping.pl").
  318             $cgi->submit(-value=>'Housekeeping Utilities')."\n".
  319             hiddens('user', 'key', 'course').
  320             $cgi->endform()."\n".
  321             $cgi->small(
  322               "(remove old tmp files,
  323               compress the gdbm database,
  324               show users currently logged in,
  325               edit the motd file and the course homepage,
  326               edit by PSVN, etc.)"
  327             )
  328           }, sub { "You cannot access the housekeeping utilities before you have built a problem set" }
  329         )
  330       ),
  331 #     $cgi->td({},#13!
  332 #     ),
  333     ),
  334     $cgi->Tr({valign=>"top"},
  335       $cgi->td({},#2!
  336         $cgi->center({},
  337           if_database sub {
  338             $cgi->startform(-action=>"${cgiURL}profCourseRecData.pl").
  339             $cgi->submit(-value=>'View Statistics by Recitation')."\n".
  340             $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash)."\n".
  341             hiddens('user', 'key', 'course').
  342             $cgi->endform()."\n"
  343           }, sub { "You cannot view statistics before you have built a problem set" }
  344         )
  345       ),
  346 #     $cgi->td({},#-
  347 #       $cgi->center({},
  348 #         ""
  349 #       )
  350 #     ),
  351 #     $cgi->td({},#-
  352 #       $cgi->center({},
  353 #         ""
  354 #       )
  355 #     ),
  356     ),
  357   )
  358 ;
  359 
  360 =pod
  361 
  362 if ( -e "${databaseDirectory}$Global::database" ) {
  363   ### show only build problem set part if data base does not exist
  364 
  365   # course data form
  366   print heading('Section', "1. View statistical data on problem sets for the whole course and sections in $Course_display"),
  367     $cgi->startform(-action=>"${cgiURL}profCourseData.pl"),
  368     $cgi->submit(-value=>'View Course and Section Data'), "\n";
  369 
  370 
  371   foreach (@sortedSetNames) {
  372     $sethash{$_} = "Set $_"; #insert the word Set before each set name
  373     $sethash{$_} =~ s/_/ /g;
  374   }
  375 
  376   print $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash), "\n",
  377     hiddens('user', 'key', 'course'), "\n",
  378     $cgi->endform(), "\n",
  379     "This allows you to see the average score on a set and on individual problems for
  380     the course as a whole and also by section.  The average number of incorrect
  381     attempts per problem is also displayed.";
  382 
  383   # course recitation data form
  384   print heading('Recitation', "2. View statistical data on problem sets for the whole course and recitations in $Course_display"),
  385     $cgi->startform(-action=>"${cgiURL}profCourseRecData.pl"),
  386     $cgi->submit(-value=>'View Course and Recitation Data'), "\n";
  387 
  388 
  389 
  390   print $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash), "\n",
  391     hiddens('user', 'key', 'course'),
  392     $cgi->endform(), "\n",
  393     "This allows you to see the average score on a set and on individual problems for
  394     the course as a whole and also by recitation.  The average number of incorrect
  395     attempts per problem is also displayed.";
  396 
  397 
  398 
  399   # classlist.pl form -- view set data for the entire class
  400 
  401 print heading('Student', "3. View students progress on problem sets in $Course_display:"),
  402   $cgi->startform(-action=>"${cgiURL}classlist.pl"),
  403   $cgi->submit(-value=>'View Students Progress'), "\n",
  404   $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash), "\n",
  405   $cgi->br, "\n",
  406   "Order students \n",
  407   $cgi->radio_group(-name=>'sortOrder', -values=>['byCourse','bySection','byRecitation'], -labels=>{ 'byCourse'=>'Alphabetically', 'bySection'=>'by section ', 'byRecitation'=>'by recitation '}),
  408   hiddens('user', 'key', 'course'),
  409   $cgi->hidden(-name=>'pCl', -value=>1), "\n",
  410   $cgi->endform(), "\n",
  411   "This also allows you to find the psvn for a given student and to view
  412   the problems as viewed by the student.  You can see the exact answer expected
  413   by WeBWorK and also, if you wish, answer the problem for the student.";
  414 
  415 
  416 } ### end of if ( -e "${databaseDirectory}$Global::database" )
  417 ### show only build problem set part if data base does not exist
  418 
  419 ##  build problem set page form
  420 print heading('BuildProbSet', "4. Build problem sets for $Course_display:"),
  421   $cgi->startform(-action=>"${cgiURL}profBuildProblemSetPage.pl"),
  422   $cgi->submit(-value=>'Enter Build Problem Set Page'), "\n",
  423   hiddens('user', 'key', 'course'),
  424   $cgi->endform(), "\n",
  425   $cgi->p, "\n",
  426   "You can build problem sets, edit set definition files, etc.";
  427 
  428 
  429 if ( -e "${databaseDirectory}$Global::database" ) {
  430   ### show only build problem set part if data base does not exist
  431 
  432 
  433   #send email to students
  434   print heading('Email', "5. Send Email to Students for $Course_display:"),
  435     $cgi->startform(-action=>"${cgiURL}profSendMail.pl"),
  436     $cgi->submit(-value=>'Enter Send Mail Page'), "\n",
  437     hiddens('user', 'key', 'course'),
  438     $cgi->endform(), "\n",
  439     $cgi->p, "\n",
  440     "You can create and edit emails and send them to individual students or entire classlist
  441     at one time.  Macros can be used to insert student specific information into each students
  442     email on the fly.";
  443 
  444   ##  scoring page form
  445   print heading('Score', "6. Scoring procedures for $Course_display:"),
  446     $cgi->startform(-action=>"${cgiURL}profScoring.pl"),
  447     $cgi->submit(-value=>'Enter Scoring Page'), "\n",
  448     hiddens('user', 'key', 'course'),
  449     $cgi->endform(), "\n",
  450     $cgi->p, "\n",
  451     "You can score problem sets, download and upload spreadsheet scoring files, etc.";
  452 
  453   ##  add student form
  454   print heading('AddStudents', "7. Add Student(s) to $Course_display:"),
  455     $cgi->startform(-action=>"${cgiURL}profAddStudent.pl"),
  456     $cgi->submit(-value=>'Enter Add Student(s) Page'), "\n",
  457     $cgi->hidden(-name=>'number', -value=>'5'), "\n",
  458     $cgi->hidden(-name=>'Action', -value=>'return'), "\n",
  459     hiddens('user', 'key', 'course'),
  460     $cgi->endform(), "\n",
  461     $cgi->p, "\n",
  462     "You can add students to $Course_display.  This is usually used to add students who enter the course late.";
  463 
  464   ##  classlist page form
  465 
  466   $labels{alph} = 'Alphabetically';
  467   $labels{section} = 'by section';
  468   $labels{recitation} = 'by recitation';
  469 
  470   print heading('profClasslist', "8. Edit classlist database for $Course_display:"),
  471     $cgi->startform(-action=>"${cgiURL}profClasslist.pl"),
  472     $cgi->submit(-value=>'Enter Classlist Page'), "\n",
  473     $cgi->br, "\n",
  474     "Order students \n",
  475     $cgi->radio_group(-name=>'format', -values=>['alph','section','recitation'], -default=>'alph', -labels=>\%labels),
  476     hiddens('user', 'key', 'course'),
  477     $cgi->endform(), "\n",
  478     $cgi->p, "\n",
  479     "You can edit, export and import the classlist database and also reset passwords.";
  480 
  481 
  482 
  483 
  484 
  485   ##dataMunger form -- allows you to modify data for individualized set
  486   ## psvn is derived from the student name and the set number
  487 
  488   print heading('dataMungerStudent', "9. Examine or modify data for an individual student in $Course_display:"),
  489      $cgi->startform(-action=>"${cgiURL}dataMunger.pl"),
  490      $cgi->submit(-value=>'Examine or change individual problem set data for:'), "\n";
  491 
  492   my ($key, $id, $lname, $fname, @logins, %fullnames);
  493   foreach $key (@availableStudents) {
  494     &attachCLRecord($key) || print "no Record $key\n";
  495     $lname = &CL_getStudentLastName($key);
  496     $fname = &CL_getStudentFirstName($key);
  497     push (@logins, $key); #array for values of popup_menu
  498     $fullnames{$key} = "$lname, $fname";
  499   }
  500 
  501   print $cgi->br,
  502     $cgi->popup_menu(-name=>"studentLogin", -values=>\@logins, -labels=>\%fullnames), "\n",
  503     $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash), "\n",
  504     $cgi->hidden(-name=>'save', -value=>"OFF"), "\n",
  505     $cgi->hidden(-name=>'firsttime', -value=>1), "\n",
  506     hiddens('user', 'key', 'course'),
  507     $cgi->hidden(-name=>'pCD', -value=>'1'), "\n",
  508     $cgi->endform(), "\n",
  509     "Use this to make changes for an individual student. For example, you can extend the due date for an individual student or change the status
  510     (correct, incorrect) or number of allowed attempts on a problem.  You will also be able to download a postscript file of
  511     this version of the problem set.  If you know the psvn number, e.g. from
  512     3 above (\"View Students Progress\"), you can enter this psvn number directly in 10 below
  513     (\"Examine or change database for psvn\").  Note that you will get an error message if the
  514     problem set has not been built for the student you select.\n";
  515 
  516 
  517 
  518   ## dataMunger form -- allows you to modify indidual versions of the problem
  519   print heading('dataMungerPSVN', "10. Examine or modify data for an individual student in $Course_display:"),
  520     $cgi->startform(-action=>"${cgiURL}dataMunger.pl"),
  521     $cgi->submit(-value=>'Examine or change data for psvn:'), "\n",
  522     $cgi->textfield(-name=>'probSetKey', -col=>'15', -value=>'Enter PSVN'), "\n",
  523     $cgi->hidden(-name=>'save', -value=>'OFF'), "\n",
  524     $cgi->hidden(-name=>'firsttime', -value=>1), "\n",
  525     hiddens('user', 'key', 'course'),
  526     $cgi->endform(), "\n",
  527     "Use this to make changes for an individual student. For example, you can extend the due date for an individual student or change the status
  528     (correct, incorrect) or number of allowed attempts of a problem.  You will also be able to download a postscript file of
  529     this version of the problem set.";
  530 
  531 
  532   ## profChangeDates form -- allows you to modify data for entire sets
  533 
  534 
  535   print heading('ChangeDates', "11. Examine or modify data for all students in $Course_display:"),
  536     $cgi->startform(-action=>"${cgiURL}profChangeDates.pl"),
  537     $cgi->submit(-value=>'Examine or change database for entire set:'), "\n",
  538     $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash),
  539     hiddens('user', 'key', 'course'),
  540     $cgi->hidden(-name=>'pCD', -value=>'1'), "\n",
  541     $cgi->endform(), "\n",
  542     "For example, you can extend the due date for the entire class or change the status
  543     of a problem for all students.";
  544 
  545 
  546   $labels{alph} = 'Alphabetically';
  547   $labels{section} = 'by section';
  548   $labels{recitation} = 'by recitation';
  549 
  550   print heading('PaperCopies', "12. Download paper copies for some or all students in $Course_display:"),
  551     $cgi->startform(-action=>"${cgiURL}profDownloadPaperCopies.pl"),
  552     $cgi->submit(-value=>'Download paper copies'), "\n",
  553     $cgi->popup_menu(-name=>'setNo', -values=>\@sortedSetNames, -labels=>\%sethash),
  554     $cgi->br, "\n",
  555       "Order students \n",
  556     $cgi->radio_group(-name=>'format', -values=>['alph','section','recitation'], -default=>'alph', -labels=>\%labels),
  557     hiddens('user', 'key', 'course'),
  558     $cgi->hidden(-name=>'pCD', -value=>'1'), "\n",
  559     $cgi->endform(), "\n",
  560     "You can download a postscript (or pfd, tex, dvi) file containing prints outs for selected students.";
  561 
  562 
  563 
  564   # delete an entire problem set
  565   print heading('DeleteProbSet', "13. Delete problem set(s) in $Course_display:"),
  566     $cgi->startform(-action=>"${cgiURL}profDeleteProbSet.pl"),
  567     $cgi->submit(-value=>'Enter Delete Problem Set Page'), "\n",
  568     hiddens('user', 'key', 'course'),
  569     $cgi->endform(), "\n",
  570     $cgi->p, "\n",
  571     "You can delete Problem Sets for the whole class.";
  572 
  573 
  574   ##  housekeeping page form
  575   print heading('Housekeep', "14. Housekeeping utilities for $Course_display:"),
  576     $cgi->startform(-action=>"${cgiURL}profHousekeeping.pl"),
  577     $cgi->submit(-value=>'Enter Housekeeping Page'), "\n",
  578     hiddens('user', 'key', 'course'),
  579     $cgi->endform(), "\n",
  580     $cgi->p, "\n",
  581     "You can recover disk space by removing old tmp files,
  582     compress the gdbm database, show users currently logged in, edit the motd file and the course homepage, etc.";
  583 
  584 }
  585 
  586 =cut
  587 
  588 ## older scripts are archived here
  589 
  590 
  591 ## View class grades
  592 #print heading("12. View grades for $Course_display:"),
  593 #  $cgi->startform(-action=>"${cgiURL}classGradeSummary.pl"),
  594 #  $cgi->submit(-value=>'View Grades'), "\n",
  595 #  $cgi->hidden(-name=>'course', -value=>$Course), "\n",
  596 #  $cgi->hidden(-name=>'user', -value=>$User), "\n",
  597 #  $cgi->hidden(-name=>'key', -value=>$Session_key), "\n",
  598 #  $cgi->endform(), "\n",
  599 #  $cgi->p, "\n",
  600 #  "You can view a summary of all grades for all students in all sets.";
  601 #
  602 
  603 
  604 
  605 
  606 ### end of second if ( -e "${databaseDirectory}$Global::database" )
  607 ### show only build problem set part if data base does not exist
  608 
  609 
  610 #print <<EOF;
  611 #<HR SIZE=5 NOSHADE>
  612 #<H3 ALIGN=CENTER>Older scripts:</H3>
  613 #EOF
  614 #
  615 ## oldclasslist.pl -- dumps much of the database for inspection
  616 #print <<EOF;
  617 #<HR>
  618 #<FORM METHOD = "POST" ACTION= "${cgiURL}oldclasslist.pl">
  619 #         <INPUT TYPE="SUBMIT" VALUE="View Class List">
  620 #         <INPUT TYPE="HIDDEN" NAME="user" VALUE="$inputs{'user'}">
  621 #         <INPUT TYPE="HIDDEN" NAME="key" VALUE="$inputs{'key'}">
  622 #         <INPUT TYPE="HIDDEN" NAME="course" VALUE="$inputs{'course'}">
  623 #        </FORM>
  624 #An older version of the view class list script which allows you to view all sets and
  625 #much of the information available in the database.
  626 #EOF
  627 
  628 # other scripts
  629 #print <<EOF;
  630 #<HR>
  631 #Enter WeBWorK as a student
  632 #    <p>
  633 #    <a href="${cgiURL}profProbSet.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
  634 #    <img src="$Global::bluesquareImgUrl"
  635 #        border=1
  636 #        alt=""> profProbSet.pl</a> -- not working
  637 #
  638 #<P><HR>
  639 #
  640 #
  641 #
  642 #
  643 #<P>
  644 #
  645 #
  646 #<P>profProbSet.pl script:
  647 #<a href="${cgiURL}profProbSet.pl?user=$inputs{'user'}&key=$inputs{'key'}&course=$inputs{'course'}">
  648 #     <B>Test a Problem Set</B></a> -- not working
  649 #    <BR>
  650 #
  651 #
  652 #
  653 #EOF
  654 #<H3 align="center">List of Problem Sets</H3>
  655 # These are not really needed since there is a separate script for viewing and changing dates.
  656 #my %setNumberHash=&getAllSetNumbersForStudentLoginHash('gage');
  657 #&printProbSets("",\%setNumberHash);
  658 
  659 print &htmlBOTTOM("profLogin.pl", \%inputs,'profLoginHelp.html');
  660 
  661 # begin Timing code
  662 if ($logTimingData == 1) {
  663   my $endTime = new Benchmark;
  664   &Global::logTimingInfo($beginTime,$endTime,'profLogin.pl',$Course,$User);
  665 }
  666 # end Timing code
  667 exit;
  668 
  669 ################################################################################
  670 #
  671 # HELPFUL METHODS
  672 #
  673 ################################################################################
  674 
  675 #returns the horizontal line, blue square, and heading for each option
  676 #in the list, eliminating the need to repeat this code each time it is needed
  677 #this does NOT PRINT the info, so that it can be incorporated into other text
  678 sub heading {
  679         my $link = shift; #name for internal link (used for shortcuts on some pages)
  680         my $text = shift; #text used as the main heading
  681 
  682 # return $text;
  683 
  684         return "\n".
  685 #                 $cgi->p. "\n".
  686                  $cgi->a({-name=>$link}, ''). "\n".
  687 #                 $cgi->hr({ -noshade=>undef }). "\n".
  688                  $cgi->h4({},
  689                                 "\n" . $cgi->img({-src=>"$Global::bluesquareImgUrl", -border=>1, -alt=>'' }) . "\n" .
  690                                 $text ). "\n";
  691 }
  692 
  693 # this is an in-lineable if that returns the restult of $code, or "", depending on whether
  694 # the database file ${databaseDirectory}$Global::database exists.
  695 # The argument is a coderef instead of a string to delay the evaluation of any string-generation
  696 # code until after the test has been performed.
  697 sub if_database(&;&) {
  698   my $code = shift;
  699   my $else = shift;
  700   if (-e "${databaseDirectory}$Global::database") {
  701     return &$code;
  702   } elsif (defined $else) {
  703     return &$else;
  704   } else {
  705     return "";
  706   }
  707 }
  708 
  709 #prints hidden form fields for each of given cgi parameters
  710 #if a given parameter does not exist, a note is placed in the html to that affect
  711 #this does NOT PRINT the info, so that it can be incorporated into other text
  712 sub hiddens {
  713   my @params = @_;
  714   my $out;
  715 
  716   foreach my $param (@params) {
  717     if (exists $inputs{$param}) {
  718       $out .= $cgi->hidden(-name=>"$param", -value=>"$inputs{$param}") . "\n";
  719     } else {
  720       $out .= $cgi->p . "\nExpected cgi parameter $param does not exist or is empty";
  721     }
  722   }
  723   $out;
  724 }
  725 
  726 # Yes, I know.  I'm going to hell.
  727 sub onecelltable {
  728   my $contents = join "", @_;
  729   return $cgi->table(
  730     $cgi->Tr(
  731       $cgi->td(
  732         $contents
  733       )
  734     )
  735   )
  736 }
  737 
  738 # Ripped right out of welcomeAction.pl, renamed, and modified
  739 sub prof_htmlTOP {
  740     my ($title, $bg_url) = @_;
  741     my $background_url = $bg_url || $Global::background_plain_url;
  742 
  743 
  744     my $out = <<ENDhtmlTOP;
  745 Content-type: text/html
  746 Expires: 0
  747 
  748 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
  749 <HTML>
  750 <HEAD>
  751 <TITLE>$title</TITLE>
  752 </HEAD>
  753 <BODY BACKGROUND="$background_url">
  754 
  755 ENDhtmlTOP
  756     return $out;
  757 }
  758 
  759 # Ripped right out of welcomeAction.pl, renamed, and modified
  760 sub prof_titleBar {
  761   my ($title) = @_;
  762   my $title_bar = "";
  763   $title_bar .= qq{
  764     <TABLE BORDER="0" WIDTH="100%">
  765     <TR ALIGN=CENTER  >
  766     <TD ALIGN=LEFT >
  767     <A HREF="$Global::webworkDocsURL">
  768     <IMG SRC="$Global::squareWebworkGif" BORDER=1 ALT="WeBWorK"></A>
  769     </TD>
  770     <TD VALIGN=MIDDLE>
  771     <H2 ALIGN=CENTER>
  772     $title
  773     </H2>
  774     </TD>
  775     <TD ALIGN=RIGHT >
  776     </TABLE>
  777   };
  778 
  779   $title_bar;
  780 }

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9