AdminInterface
Home
About

FAQs

General
Admin
Assist
Student

Docs

Admin
Assistant

CGI

Admin
Assistant
Download
Form
Student

Packages

AdminInterface
Assignments
AssistantInterface
Form
Interface
Record
Roster
StudentInterface
SystemVariables
Teams
VincentFile
VincentLog


  0 #Adminsitrative Interface Package
  1 #Copyright 2000 Matt Jadud
  2 #This program is free software; you can redistribute it and/or
  3 #modify it under the terms of the GNU General Public License
  4 #as published by the Free Software Foundation; either version 2
  5 #of the License, or (at your option) any later version.
  6 #
  7 #This program is distributed in the hope that it will be useful,
  8 #but WITHOUT ANY WARRANTY; without even the implied warranty of
  9 #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10 #GNU General Public License for more details.
 11 #
 12 #You should have received a copy of the GNU General Public License
 13 #along with this program; if not, write to the Free Software
 14 #Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 15 
 16 
 17 
 18 #########################################
 19 # About the AdminInterface.pm module
 20 #########################################
 21 # The AdminInterface.pm module provides 
 22 # a way of organizing the administrator
 23 # interface into logical blocks based on 
 24 # the function of the interface. 
 25 #
 26 # Some simple logic is contained in the mainMenu
 27 # function for choosing what part of the
 28 # interface is being presented, as no code
 29 # outside of the module should call anything
 30 # _except_ mainMenu. Put another way - all calls
 31 # to the AdminInterface module should be through
 32 # mainMenu, and routed accordingly.
 33 #
 34 # AdminInterface.pm relies heavily on Interface.pm,
 35 # which provides organization and standardization
 36 # of elements like tables, input elements, etc.
 37 # Some higher level things are included in Interface.pm,
 38 # in particular functions like "viewGrades." These are
 39 # functions that are only slightly different depending
 40 # on the calling script - that is, whether it is
 41 # being called by an administrator, assistant, or student.
 42 
 43 use SystemVariables;
 44 use AssistantInterface;
 45 use Interface;
 46 use Form;
 47 use Fcntl qw(:flock);  # imports LOCK_EX, LOCK_SH, LOCK_NB
 48 
 49 package AdminInterface; 
 50 
 51 #Turn debugging on or off;
 52 $DEBUG = 1;
 53 $| = 1;
 54 
 55 #########################################
 56 # Main Menu
 57 #########################################
 58 # The main menu accepts any number of parameters,
 59 # which get incorporated into the title bar
 60 # at the top of the page. If one of those parameters
 61 # happens to be one of the control options 
 62 # ("Create", "ModifyChooser," etc.), then the menu
 63 # branches, and calls the appropriate subroutine
 64 # to generate that aspect of the admin interface, instead
 65 # of the default menu.
 66 sub mainMenu  {
 67     
 68     my ($choices, 
 69 	$choice,
 70 	%menuOptions,
 71 	$key
 72 	);
 73     $choices = 0;
 74     $username = $_[0];
 75 
 76     %menuOptions = ( #Assignment Options
 77 		     "Create"          => &createAssignment,
 78 		     "ModifyChooser"   => &modifyAssignment,
 79 		     "RemoveChooser"   => &removeAssignment,
 80 		     "ModifyForm"      => &modifyAssignmentForm,
 81 		     "assignmentDownload" => &Interface::assignmentDownload,
 82 		     "submitGrades" => &Interface::submitGradesForm,
 83 		     "ViewGrades"   => &Interface::viewGrades,
 84 		     "GradeMappingForm" => &gradeMappingForm,
 85 		     #Roster Options
 86 		     "SelectRoster"    => &rosterUpload,
 87 		     "AddStudent"      => &addStudent,
 88 		     "ModifyStudent"   => &modifyStudent,
 89 
 90 		     #Global Defaults
 91 		     "ClassID"         => &classID,
 92 		     "StudentDefaults" => &studentDefaults,
 93 		     "AdminAndAssist"  => &adminAndAssist,
 94 		     "DOWNLOADABLEFILE"=> &chooseDatesForFile,
 95 		     
 96 		     #Team Options 
 97 		     "EditTeams"       => &editTeams,
 98 		     "ViewPeerEvals"   => &viewPeerEvals
 99 		     );
 100 
 101 
 102 
 103 	
 104     #This is now a toggled menu... I may have made this too
 105     # complex this way... it branches based on the parameters
 106     # passed to mainMenu, and defaults to a basic first page.
 107     foreach $choice (@_) {
 108 
 109 	#Cycle through the various keys in the menuOptions hash;
 110 	# if any of them are equal to the current value in the CGI
 111 	# query, then print the top and bottom of the display,
 112 	# and route to the function contained in the hash. 
 113 	# 
 114 	# This loop sets $choices to 1, indicating that 
 115 	# the user had selected some choice, and the default
 116 	# view should not be presented.
 117 
 118 	foreach $key (keys %menuOptions) {
 119 	    if($choice eq $key) {
 120 
 121 	      Interface::menuTop("Vincent: Administrator Interface", @_);
 122 		$choices = 1;
 123 		$menuOptions{$key}->(@_);
 124 	      Interface::menuBottom();
 125 		print"<CENTER><A HREF='admin.cgi'>Return to the admin script.</A></CENTER>";
 126 	      
 127 		exit();
 128 		
 129 	    }
 130 	}
 131     }
 132     
 133     #Default choices: if no control choices were
 134     # hit above, then we present the standard
 135     # options presented below
 136 
 137     if(!$choices) {
 138 
 139 	##LOGGING
 140       VincentLog::clickLog("MAINPAGE", "Default admin page.");
 141 	
 142       Interface::menuTop("Vincent: Administrator Interface", @_);
 143 
 144 	#THIS IS THE SYSTEM-LEVEL SECURITY.
 145 	# A simple call to isAdministrator() checks to
 146 	# see if the kerberos authenticated user is
 147 	# in the admin list; if they are, the default options
 148 	# are displayed. If not, they are asked to bugger off.
 149 
 150 	#If they are an administrator...
 151 	if(Record::isAdministrator($username) ||
 152 	   Record::isGod($username)) {	 
 153 	    rosterChooser();
 154 	    assignChooser();
 155 	  Interface::downloadChooser();
 156 	  Form::formViewer();
 157 	  Interface::gradesChooser();
 158 	     globalChooser();
 159 	    fileDownloadChooser();
 160 	    
 161 	    if(SystemVariables::useTeams()) {
 162 		teamChooser();
 163 	    }
 164 	} else { #If they aren't an administrator
 165 	    print "<TR><TD>";
 166 	    print "<CENTER><H1><FONT COLOR='RED'>";
 167 	    print "You are not an administrator.<P>Bugger off.";
 168 	    print "</FONT></H1></CENTER>";
 169 	    print "</TD></TR>";
 170 	}
 171 
 172 	  Interface::menuBottom();
 173 	
 174 
 175 
 176     }
 177 
 178 }
 179 
 180 #########################################
 181 # Roster Options
 182 #########################################
 183 # The roster chooser is the first part of
 184 # the roster administration interface.
 185 # It presents all important options to the
 186 # administrator regarding updating rosters,
 187 # adding students to the roster, etc.
 188 sub rosterChooser  {
 189 
 190     my ($adminWebPath);
 191 
 192     $adminWebPath = SystemVariables::getAdminWebPath();
 193     
 194     print "<TR><TD>n";
 195     
 196   Interface::tableTop("Roster/Student Maintenance");
 197   Interface::startForm($adminWebPath . "admin.cgi");
 198     
 199   Interface::radio("SelectRoster", 
 200 		   "ROSTERCHOOSER", 
 201 		   "Submit a new Roster",
 202 		   "CHECKED");
 203    
 204   Interface::radio("AddStudent", 
 205 		   "ROSTERCHOOSER", 
 206 		   "Add a student to the system."
 207 		   );
 208 
 209     print "<TABLE WIDTH='100%'>";
 210     print "<TR><TD>";
 211 
 212   Interface::radio("ModifyStudent",
 213 		   "ROSTERCHOOSER",
 214 		   "Modify an existing student's record."
 215 		   );
 216     print "</TD><TD>";
 217 
 218   Interface::textInput("Username",
 219 		  "_STUDENTUSERNAME",
 220 		  "",
 221 		  "20");
 222     print "</TD></TR></TABLE>";
 223 
 224   Interface::endForm();
 225   Interface::tableBottom();
 226     print "</TD></TR>";
 227 }
 228 
 229 sub rosterUpload  {
 230 
 231     my( $adminWebPath );
 232     $adminWebPath = SystemVariables::getAdminWebPath();
 233 
 234     ##LOGGING
 235   VincentLog::clickLog("ROSTER", "Upload roster form.");
 236     
 237     print "<TR><TD>n";
 238 
 239   Interface::tableTop("Submit a new Roster.");
 240   Interface::startForm($adminWebPath . "admin.cgi");
 241     #The hidden tags are being used here to force
 242     # navigation in the admin.cgi script. Because it
 243     # is the first query that gets parsed, it can direct
 244     # the logic of the entire admin script...
 245     # hard-coding or sensical? Tough to say...
 246   Interface::hidden("SUBMITNEWROSTER", "New Roster");
 247   Interface::file("Roster File", "ROSTERFILE");
 248 
 249   Interface::endForm();
 250   Interface::tableBottom();
 251     print "</TD></TR>";
 252 }
 253 
 254 sub modifyStudent  {
 255     
 256     my ($student,
 257 	$student_data,
 258 	$adminWebPath,
 259 	$key,
 260 	$prettykey
 261 
 262 	);
 263 
 264 
 265     $student = $_[2];
 266     
 267     $adminWebPath = SystemVariables::getAdminWebPath();
 268     
 269     $student_data = Record::getStudentRecord($student);
 270 
 271     ##LOGGING
 272   VincentLog::clickLog("ROSTER", "Displayed record for $student.");
 273     
 274     print "<TR><TD>n";
 275 
 276   Interface::tableTop("Modify Student Record for $student");
 277   Interface::startForm($adminWebPath . "admin.cgi");
 278   Interface::hidden("MODIFIEDSTUDENT", "$student");
 279     
 280     foreach $key (sort keys %{$student_data}) {
 281 	$prettykey = $key;
 282 	$prettykey =~ s/_//g;
 283      
 284       Interface::textInput($prettykey,
 285 			   $key,
 286 			   $$student_data{$key},
 287 			   "30");
 288 			   
 289     }
 290 
 291     
 292   Interface::endForm();
 293   Interface::tableBottom();
 294     print "</TD></TR>";
 295 }
 296 
 297 
 298 sub addStudent  {
 299 
 300     my( $adminWebPath,
 301 	$defaults
 302 	);
 303 
 304     $adminWebPath = SystemVariables::getAdminWebPath();
 305     $defaults = SystemVariables::getStudentDefaults();
 306 
 307     
 308     ##LOGGING
 309   VincentLog::clickLog("ROSTER", "Add student form.");
 310     
 311 
 312     print "<TR><TD>n";
 313 
 314   Interface::tableTop("Add a Student to the System");
 315   Interface::startForm($adminWebPath . "admin.cgi");
 316   Interface::hidden("ADDNEWSTUDENT", "New Student");
 317     
 318   Interface::textInput("Username", "_USERNAME", "", "10");
 319   Interface::textInput("Last Name", "_LASTNAME", "", "20");
 320   Interface::textInput("First Name", "_FIRSTNAME", "", "20");
 321   Interface::textInput("Student ID", "_SID", "", "9");
 322   Interface::textInput("Section Number", "_SECTIONNUMBER", "", "5");
 323    
 324   Interface::textInput("Expiration", "_EXPIRATION", $$defaults{"_CLASSEXPIRATION"}, "25");
 325     
 326   Interface::endForm();
 327   Interface::tableBottom();
 328   
 329     print "</TD></TR>";
 330 }
 331 
 332 ##########################
 333 # This can be superceded by the functions
 334 # in SystemVariables for handling dates and 
 335 # whatnot... doesn't belong here...
 336 sub tomorrowMidnight  {
 337     
 338     my ($date,
 339 	%Months,
 340 	$month,
 341 	$day,
 342 	$year,
 343 	$time);
 344     
 345     %Months = ("Jan", "1",
 346 	       "Feb", "2",
 347 	       "Mar", "3",
 348 	       "Apr", "4",
 349 	       "May", "5",
 350 	       "Jun", "6",
 351 	       "Jul", "7",
 352 	       "Aug", "8",
 353 	       "Sep", "9",
 354 	       "Oct", "10",
 355 	       "Nov", "11",
 356 	       "Dec", "12");
 357     
 358     $date = localtime;
 359     
 360     ($month, $day, $year, $time) = (split(/s+/, $date))[1,2,4,3];
 361     chomp $month;
 362     chomp $day;
 363     chomp $year;
 364     chomp $time;
 365     
 366 
 367     $month = $Months{$month};
 368     $day = $day + 1;
 369     $time = "23:59:59";
 370 
 371     $date = "$year,$month,$day,$time";
 372     return $date;
 373 }
 374 
 375 #########################################
 376 # Assignment Options
 377 #########################################
 378 # The assignChooser presents all appropriate
 379 # options for controlling and updating 
 380 # assignments in the system - creating
 381 # new assignments, modifying existing
 382 # assignments, etc. This interface
 383 # option presents the main choices 
 384 # for assignments operations.
 385 sub assignChooser  {
 386  
 387     my ($adminWebPath);
 388 
 389     $adminWebPath = SystemVariables::getAdminWebPath();
 390     
 391     print "<TR><TD>n";
 392     
 393   Interface::tableTop("Handling Assignments");
 394   Interface::startForm($adminWebPath . "admin.cgi");
 395     
 396   Interface::radio("Create", 
 397 		   "ASSIGNCHOOSER", 
 398 		   "Create a new assignment.", 
 399 		   "CHECKED");
 400 
 401   Interface::radio("Modify", 
 402 		   "ASSIGNCHOOSER", 
 403 		   "Modify an existing assignment.");
 404 
 405     
 406   Interface::radio("Mapping", 
 407 		   "ASSIGNCHOOSER", 
 408 		   "Create a new grade mapping.");
 409 
 410     print "<HR NOSHADE>";
 411     
 412   Interface::radio("Remove", 
 413 		   "ASSIGNCHOOSER", 
 414 		   "<FONT COLOR='RED'>REMOVE</FONT> an existing assignment.");
 415     
 416   
 417   Interface::endForm();
 418   Interface::tableBottom();
 419     print "</TD></TR>";
 420 }
 421 
 422 # ModifyAssignment presents a list of assignments
 423 # in the system, and allows the administrator
 424 # to choose which assignment they want to modify.
 425 # It routes into modifyAssignmentForm
 426 sub modifyAssignment  {
 427     
 428     my( $assignmentIDs,
 429 	$adminWebPath
 430 	);
 431 
 432     
 433     $adminWebPath = SystemVariables::getAdminWebPath();
 434   SystemVariables::webErrOut($adminWebPath);
 435     
 436      print "<TR><TD>n";
 437   
 438   Interface::tableTop("Choose an Assignment to Modify");
 439   Interface::startForm($adminWebPath . "admin.cgi");
 440 
 441     $assignmentIDs = Assignments::getAssignmentIDs();
 442   
 443   Interface::selectInput("Assignment", 
 444 			 "MODIFYASSIGNMENT",
 445 			 @$assignmentIDs
 446 			 );
 447   Interface::endForm();
 448   Interface::tableBottom();
 449   
 450     print "</TD></TR>n";
 451 
 452 }
 453 
 454 sub removeAssignment  {
 455     
 456     my( $assignmentIDs,
 457 	$adminWebPath
 458 	);
 459 
 460     
 461     $adminWebPath = SystemVariables::getAdminWebPath();
 462   SystemVariables::webErrOut($adminWebPath);
 463     
 464      print "<TR><TD>n";
 465   
 466   Interface::tableTop("Choose an Assignment to Remove");
 467   Interface::startForm($adminWebPath . "admin.cgi");
 468 
 469     $assignmentIDs = Assignments::getAssignmentIDs();
 470   
 471   Interface::selectInput("Assignment", 
 472 			 "REMOVEASSIGNMENT",
 473 			 @$assignmentIDs
 474 			 );
 475   Interface::endForm();
 476   Interface::tableBottom();
 477   
 478     print "</TD></TR>n";
 479 
 480 }
 481 
 482 
 483 # modifyAssignmentForm presents a form similar
 484 # to the "createAssignment" form, populated with
 485 # data from the assignment chosen in the 
 486 # modifyAssignment menu option. Data changed 
 487 # here is then updated in that assignment's
 488 # datafile, and propegated to all of the students
 489 # in the course.
 490 
 491 sub modifyAssignmentForm  {
 492 
 493     my ( $assign_id,
 494 	 $assign_data,
 495 	 $key,
 496 	 $temp,
 497 	 $adminWebPath,
 498 	 $prettykey,
 499 	 $sys_id
 500 	 );
 501     
 502     $assign_id = $_[2];
 503     chomp $assign_id;
 504 
 505     #SystemVariables::DEBUG("AdminInt:", @_, " ", $assign_id);
 506     $adminWebPath = SystemVariables::getAdminWebPath();
 507 
 508     
 509     ##LOGGING
 510   VincentLog::clickLog("ASSIGNMENTS", "Modify form for $assign_id");
 511 
 512 
 513     print "<TR><TD>n";
 514        
 515   Interface::tableTop("Modify $assign_id");
 516   Interface::startForm($adminWebPath . "admin.cgi");
 517     $sys_id = Assignments::getAssignmentSystemID($assign_id);
 518     SystemVariables::DEBUG("AdminInt:", "Hiding ", 
 519 			   $sys_id,
 520 			   " in this form.");
 521 
 522   Interface::hidden("UPDATEASSIGNMENT", $sys_id);
 523 
 524     $assign_data = Assignments::getAssignmentData($assign_id);
 525 
 526     foreach $key (sort keys %{$assign_data}) {
 527 	$prettykey = $key;
 528 	$prettykey =~ s/_//g;
 529 	#NO need to include the SYSID here... instructors
 530 	# could seriously bung the system if we let them
 531 	# modify that piece of data...
 532 	if($prettykey !~ /^SYS/) {
 533 	  Interface::textInput($prettykey,
 534 			       $key,
 535 			       $$assign_data{$key},
 536 			       "30");
 537 	} 
 538 	  
 539     }
 540 
 541     
 542   Interface::endForm();
 543   Interface::tableBottom();
 544     print "</TD></TR>";
 545 }
 546 
 547 
 548 #createAssignment allows the administrator to create
 549 # a new assignment for inclusion in the course DB.
 550 # Upon creation, it is propegated to the individual
 551 # student dataspaces as well.
 552 sub createAssignment  {
 553 
 554     ##LOGGING
 555   VincentLog::clickLog("ASSIGNMENTS", "Create assignment form.");
 556 
 557 
 558     print "<TR><TD>n";
 559   Interface::tableTop("Create a New Assignment");
 560   Interface::startForm("admin.cgi");
 561  
 562 
 563     #Assignment parameters are all required
 564   Interface::hidden("CREATEASSIGNMENT", "Create");
 565   Interface::selectInput("Assign. Type", "_TYPE", 
 566 			 "FILE", "PEEREVAL", "QUESTIONFORM");
 567   Interface::textInput("Assign. ID", "_ASSIGNID", "", "10");
 568   Interface::textInput("Desc.", "_DESCRIPTION", "", "30");
 569   Interface::textInput("Upload Msg.", "_MESSAGE", "", "30"); 
 570   Interface::textInput("Max Val.", "_MAXVALUE", "", "10");
 571   Interface::textInput("Num. Files", "_NUMFILES", "", "10");
 572   Interface::textInput("Due Date", "_DUEDATE", "2000,12,31,12:59:59", "20");
 573 
 574     #Toggling doneness....
 575     if(SystemVariables::useDoneness()) {
 576       Interface::textInput("Done", 
 577 			   "_DONE", 
 578 			 "", 
 579 			   "20");
 580     } else {
 581       Interface::textInput("Grade Visible After", 
 582 			   "_DONE", 
 583 			 SystemVariables::getCurrentTime(), 
 584 			   "20");
 585     }
 586 
 587   Interface::textInput("Naming Grep", "_NAMINGGREP", "_ANYTHING_", "30");
 588 
 589   Interface::selectInput("Grade Mapping", 
 590 			 "_GRADEMAPPING",
 591 			 @{SystemVariables::getAllGradeMappings()}
 592 			 );
 593     
 594   Interface::hidden("_JULESPROCESSOR", "NONE");
 595 
 596     #Get all the post-processors available
 597     $PostProcessors = SystemVariables::getAllPostProcessors();
 598     
 599   Interface::selectInput("Post Processor", 
 600 			 "_POSTPROCESSOR",
 601 			 "NONE",
 602 			 @{$PostProcessors}
 603 			 );
 604   
 605   Interface::endForm();
 606   Interface::tableBottom();
 607     print "</TD></TR>n";
 608 }
 609 
 610 sub gradeMappingForm  {
 611 
 612     
 613     my ($adminWebPath,
 614 	$i);
 615 
 616     $adminWebPath = SystemVariables::getAdminWebPath();
 617     
 618     ##LOGGING
 619   VincentLog::clickLog("GRADEMAPPING", "Create grade mapping form.");
 620 
 621 
 622     print "<TR><TD>n";
 623     
 624   Interface::tableTop("Create a Grade Mapping");
 625   Interface::startForm($adminWebPath . "admin.cgi");
 626     
 627 
 628       Interface::textInput("Mapping Name: ",
 629 			   "MAPPINGNAME",
 630 			   "",
 631 			   30);
 632 
 633     for($i=1;$i<16;$i++) {
 634 	#($text, $name, $value, $width, $lpercent, $rpercent) = @_;
 635 	
 636 	print "<TABLE WIDTH='100%'><TR>";
 637 	print "<TD>";
 638       Interface::textInput("Category $i: ",
 639 			   "CATEGORY$i",
 640 			   "",
 641 			   10);
 642 	print "</TD><TD>";
 643 	
 644       Interface::textInput("Low: ",
 645 			   "LOW$i",
 646 			   "",
 647 			   3);
 648 	print "</TD><TD>";
 649 	
 650       Interface::textInput("High: ",
 651 			   "HIGH$i",
 652 			   "",
 653 			   3);
 654 
 655 	print "</TD></TR></TABLE>";
 656     }
 657 
 658   Interface::endForm();
 659   Interface::tableBottom();
 660     print "</TD></TR>";
 661 }
 662 
 663 ########################################
 664 # Team Options
 665 ########################################
 666 sub teamChooser  {
 667 
 668   Interface::teamChooser();
 669     
 670 }
 671 
 672 sub editTeams  {
 673 
 674     my($teamRef);
 675     
 676     $teamRef = $_[1];
 677     
 678     ##LOGGING
 679   VincentLog::clickLog("TEAMS", "Edit teams form.");
 680 
 681     
 682   Interface::editTeams($teamRef);
 683 
 684 }
 685 
 686 sub viewPeerEvals  {
 687 
 688     ##LOGGING
 689   VincentLog::clickLog("PEEREVALS", "View Peer Evals form.");
 690 
 691   Interface::viewPeerEvals(@_);
 692 
 693 }
 694 
 695 #########################################
 696 # Global Options
 697 #########################################
 698 sub globalChooser  {
 699 
 700     my ($adminWebPath);
 701 
 702     $adminWebPath = SystemVariables::getAdminWebPath();
 703     
 704     print "<TR><TD>n";
 705     
 706   Interface::tableTop("Global Course Configuration");
 707   Interface::startForm($adminWebPath . "admin.cgi");
 708     
 709   Interface::radio("ClassID", 
 710 		   "GLOBALCHOOSER", 
 711 		   "Set the Class ID/Tagline", 
 712 		   "CHECKED");
 713 
 714   Interface::radio("StudentDefaults", 
 715 		   "GLOBALCHOOSER", 
 716 		   "Set defaults for all students in or entering the system.");
 717 
 718   Interface::radio("AdminAndAssist",
 719 		   "GLOBALCHOOSER",
 720 		   "Edit the Administrator/Assistant list for " . 
 721 		 SystemVariables::getClassID());
 722   
 723   Interface::endForm();
 724   Interface::tableBottom();
 725     print "</TD></TR>";
 726 }
 727 
 728 sub adminAndAssist  {
 729     
 730     my ($adminWebPath);
 731   
 732   ##LOGGING
 733   VincentLog::clickLog("CONFIG", "Admin and assist list form.");
 734 
 735     print "<TR><TD>n";
 736 
 737     $adminWebPath = SystemVariables::getAdminWebPath();
 738   Interface::tableTop("Edit the Administrator and Assistant Lists");
 739   Interface::startForm($adminWebPath . "admin.cgi");
 740   Interface::hidden("ADMINUPDATE", 1);
 741 
 742   Interface::textInput("Administrators: ", "_ADMINISTRATORS",
 743 		       SystemVariables::getAdminString(), "30");
 744 
 745   Interface::textInput("Assistants: ", "_ASSISTANTS",
 746 		       SystemVariables::getAssistString(), "30");
 747     
 748   Interface::endForm();
 749   Interface::tableBottom();
 750 
 751     print "</TD></TR>n";
 752     
 753 }
 754 
 755 sub studentDefaults  {
 756 
 757     my ($adminWebPath,
 758 	$defaults
 759 	);
 760 
 761     ##LOGGING
 762   VincentLog::clickLog("CONFIG", "Student defaults form.");
 763 
 764 
 765     $adminWebPath = SystemVariables::getAdminWebPath();
 766     #The defaults are a hash reference
 767     $defaults = SystemVariables::getStudentDefaults();
 768 
 769     print "<TR><TD>n";
 770     
 771   Interface::tableTop("System-wide Student Defaults");
 772   Interface::startForm($adminWebPath . "admin.cgi");
 773   Interface::hidden("UPDATESTUDENTDEFAULTS", "UpdateStudentDefaults");
 774 
 775 
 776   Interface::selectInput("Use sliptime?", "_USESLIPTIME", 
 777 		       $$defaults{"_USESLIPTIME"}, "YES", "NO");
 778 
 779     print "<TABLE WIDTH='100%'><TR><TD>";
 780 
 781   Interface::textInput("Sliptime (hrs)", "_SLIPTIME", 
 782 		       $$defaults{"_SLIPTIME"}, "10");
 783 
 784     print "</TD><TD>";
 785    Interface::checkbox(1, "resetsliptime",
 786 			  "Reset sliptime for all students.",
 787 			 );
 788     print "</TD></TR></TABLE>";
 789     
 790   Interface::selectInput("Use teams?", "_USETEAMS", 
 791 		       $$defaults{"_USETEAMS"}, "YES", "NO");
 792 
 793  
 794   Interface::selectInput("Allow Assistants to Edit Teams?", "_ASSISTANTEDITTEAMS", 
 795 		       $$defaults{"_ASSISTANTEDITTEAMS"}, "YES", "NO"); 
 796 
 797   Interface::selectInput("Allow student file download?",
 798 			 "_STUFILEDOWNLOAD",
 799 			 $$defaults{"_STUFILEDOWNLOAD"},
 800 			 "YES",
 801 			 "NO");
 802     
 803   Interface::selectInput("Let students see the class average in gradeviews?",
 804 			 "_SHOWAVERAGE",
 805 			 $$defaults{"_SHOWAVERAGE"},
 806 			 "YES",
 807 			 "NO");
 808 
 809     print "<TABLE WIDTH='100%'><TR><TD>";
 810     print "<STRONG>Do not change anything below this line once the semester has begun.</STRONG>";
 811     print "<HR>";
 812     print "</TD></TR><TR><TD  BGCOLOR='FFCCCC'>";
 813 
 814   Interface::selectInput("Use "Doneness" regarding student submissions?",
 815 			 "_DONENESS",
 816 			 $$defaults{"_DONENESS"}, "YES", "NO");
 817 
 818 
 819    print "<TABLE WIDTH='100%'><TR><TD>";
 820     my($exp);
 821 
 822     if(defined($$defaults{"_CLASSEXPIRATION"})) {
 823 	$exp = $$defaults{"_CLASSEXPIRATION"};
 824     } else {
 825 	$exp = "2000,12,31,23:59:59"; 
 826     }
 827 
 828   Interface::textInput("All students expire on: ", "_CLASSEXPIRATION", 
 829 		       $exp, "20");
 830 
 831     print "</TD><TD>";
 832     print "<STRONG>Format:</STRONG> YYYY,MM,DD,HH:MM:SS";
 833     Interface::checkbox(1, "updateallexp",
 834 			  "Set expiration for all students.");
 835     print "</TD></TR></TABLE>";
 836 
 837 
 838     print "</TD></TR></TABLE>";
 839 
 840 
 841 
 842 
 843   Interface::endForm();
 844   Interface::tableBottom();
 845     print "</TD></TR>n";
 846 
 847 }
 848 
 849 #classID includes places for the instructor to update the class
 850 # id ('A110', 'A290', etc.) and the class tagline 
 851 # ("Introduction to LEGO Robotics," "Programming Languages for
 852 # Dummies," etc.). 
 853 sub classID  {
 854     
 855     my ($ID,
 856 	$tagline,
 857 	$adminWebPath
 858 	);
 859     
 860    ##LOGGING
 861   VincentLog::clickLog("CONFIG", "Course ID/tagline form.");
 862 
 863     $adminWebPath = SystemVariables::getAdminWebPath();
 864 
 865     $ID = SystemVariables::getClassID();
 866     if(!$ID) { $ID = ""; }
 867 
 868     $tagline = SystemVariables::getClassTagline();
 869     if(!$tagline) { $tagline = ""; }
 870     
 871     print "<TR><TD>n";
 872   Interface::tableTop("Class ID");
 873   Interface::startForm($adminWebPath . "admin.cgi");
 874 
 875   Interface::textInput("Class ID", "CLASSID", $ID, "50");
 876   Interface::textInput("Tagline", "TAGLINE", $tagline, "50");
 877 
 878   Interface::endForm();
 879   Interface::tableBottom();
 880     print "</TD></TR>n";
 881 }
 882 
 883 sub fileDownloadChooser  {
 884 
 885     
 886     my ($adminWebPath,
 887 	$defaults,
 888 	@months	
 889 	);
 890 
 891     $adminWebPath = SystemVariables::getAdminWebPath();
 892     #The defaults are a hash reference
 893     $defaults = SystemVariables::getStudentDefaults();
 894     @months = ("Jan", "Feb", "Mar", "Apr",
 895 	       "May", "Jun", "Jul", "Aug",
 896 	       "Sep", "Oct", "Nov", "Dec");
 897     
 898     print "<TR><TD>n";
 899     
 900   Interface::tableTop("Downloadable Files");
 901   Interface::startForm($adminWebPath . "admin.cgi");
 902     
 903  
 904   Interface::file("Add file to system: ", "DOWNLOADABLEFILE");
 905 
 906     print "<BR>";
 907     
 908   Interface::textInput("Description ",
 909 		       "_description",
 910 		       "",
 911 		       "30");
 912 
 913     print "<BR>";
 914 
 915  
 916   Interface::selectInput("Type: ",
 917 			 "_type",
 918 			 "ALWAYS",
 919 			 "SCHEDULE",
 920 			 "PERMISSION");
 921 
 922     print "<Table WIDTH='100%'><TR><TD WIDTH='50%'>";
 923     
 924   Interface::selectInput("Start Month",
 925 			 "_startmonth",
 926 			 @months);
 927     print "</TD><TD>";
 928     
 929   Interface::selectInput("End Month",
 930 			 "_endmonth",
 931 			 "Dec",
 932 			 @months);
 933 
 934     print "</TD></TR></TABLE>";
 935 
 936   Interface::endForm();
 937   Interface::tableBottom();
 938     print "</TD></TR>n";
 939 }
 940 
 941 sub chooseDatesForFile  {
 942 
 943      
 944     my ($adminWebPath,
 945 	$defaults,
 946 	$start,
 947 	$end,
 948 	$startindex,
 949 	$endindex,
 950 	@months,
 951 	$sysID,
 952 	$type
 953 	);
 954 
 955     $start = $_[1];
 956     $end   = $_[2];
 957     $type  = $_[3];
 958     $sysID = $_[4];
 959 
 960 
 961      ##LOGGING
 962   VincentLog::clickLog("DOWNLOADABLE", "Choose dates for downloadable file form.");
 963 
 964 
 965     @months = ("Jan", "Feb", "Mar", "Apr",
 966 	       "May", "Jun", "Jul", "Aug",
 967 	       "Sep", "Oct", "Nov", "Dec");
 968     $startindex = getArrayIndex($start, @months);
 969     $endindex   = getArrayIndex($end,   @months);
 970     
 971     $startindex++;
 972     $endindex++;
 973 
 974     $adminWebPath = SystemVariables::getAdminWebPath();
 975     #The defaults are a hash reference
 976     $defaults = SystemVariables::getStudentDefaults();
 977 
 978     print "<TR><TD>n";
 979     
 980   Interface::tableTop("Downloadable Files");
 981   Interface::startForm($adminWebPath . "admin.cgi");
 982   Interface::hidden("DOWNLOADCALENDAR", "1");
 983   Interface::hidden("_sysID", $sysID);
 984   Interface::hidden("_type", $type);
 985 
 986     $currentMonth = SystemVariables::getCurrentMonth();
 987     $currentMonth =~ s/0//g;
 988 
 989     for($i=$startindex;$i<($endindex+1);$i++) {
 990       Interface::calendar($i, 2000);
 991     }
 992     
 993   Interface::endForm();
 994   Interface::tableBottom();
 995     print "</TD></TR>n";
 996     
 997 }
 998 
 999 sub getArrayIndex  {
 1000 
 1001     my ($item, @array, $i, $index);
 1002 
 1003     ($item, @array) = @_;
 1004     
 1005     $index = 0;
 1006 
 1007     foreach $i (@array) {
 1008 	if($item eq $i) {
 1009 	    return $index;
 1010 	} else {
 1011 	    $index++;
 1012 	}
 1013     }
 1014 }
 1015 
 1016 sub useDebugging())'>DEBUG { if(SystemVariables::useDebugging())  { print "AdminInt: ", @_, "n<P>"; } }
 1017 
 1018 
 1019 

Last update: 1/6/01; 9:32:32 AM