[system] / trunk / webwork-modperl / lib / WeBWorK / ContentGenerator / CourseAdmin.pm Repository:
ViewVC logotype

Diff of /trunk/webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1985 Revision 2004
1################################################################################ 1################################################################################
2# WeBWorK Online Homework Delivery System 2# WeBWorK Online Homework Delivery System
3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/ 3# Copyright © 2000-2003 The WeBWorK Project, http://openwebwork.sf.net/
4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.2 2004/04/09 20:19:25 sh002i Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator/CourseAdmin.pm,v 1.3 2004/04/29 22:22:33 sh002i Exp $
5# 5#
6# This program is free software; you can redistribute it and/or modify it under 6# This program is free software; you can redistribute it and/or modify it under
7# the terms of either: (a) the GNU General Public License as published by the 7# the terms of either: (a) the GNU General Public License as published by the
8# Free Software Foundation; either version 2, or (at your option) any later 8# Free Software Foundation; either version 2, or (at your option) any later
9# version, or (b) the "Artistic License" which comes with this package. 9# version, or (b) the "Artistic License" which comes with this package.
386 print CGI::end_table(); 386 print CGI::end_table();
387 } elsif ($dbLayout eq "gdbm") { 387 } elsif ($dbLayout eq "gdbm") {
388 print CGI::start_table({class=>"FormLayout"}); 388 print CGI::start_table({class=>"FormLayout"});
389 print CGI::Tr( 389 print CGI::Tr(
390 CGI::th({class=>"LeftHeader"}, "GDBM Global User ID:"), 390 CGI::th({class=>"LeftHeader"}, "GDBM Global User ID:"),
391 CGI::td(CGI::textfield("add_gdbm_globalUserID", $add_gdbm_globalUserID || "professor", 25)), 391 CGI::td(CGI::textfield("add_gdbm_globalUserID", $add_gdbm_globalUserID || "global_user", 25)),
392 ); 392 );
393 print CGI::end_table(); 393 print CGI::end_table();
394 } 394 }
395 395
396 print CGI::end_td(); 396 print CGI::end_td();
492 $ce->{webworkURLs}->{root}, 492 $ce->{webworkURLs}->{root},
493 $ce->{pg}->{directories}->{root}, 493 $ce->{pg}->{directories}->{root},
494 $add_courseID, 494 $add_courseID,
495 ); 495 );
496 496
497 my %courseOptions = { dbLayoutName => $add_dbLayout };
498 if ($add_dbLayout eq "gdbm") {
499 $courseOptions{globalUserID} = $add_gdbm_globalUserID if $add_gdbm_globalUserID ne "";
500 }
501
497 my %dbOptions; 502 my %dbOptions;
498 if ($add_dbLayout eq "sql") { 503 if ($add_dbLayout eq "sql") {
499 $dbOptions{host} = $add_sql_host if $add_sql_host ne ""; 504 $dbOptions{host} = $add_sql_host if $add_sql_host ne "";
500 $dbOptions{port} = $add_sql_port if $add_sql_port ne ""; 505 $dbOptions{port} = $add_sql_port if $add_sql_port ne "";
501 $dbOptions{username} = $add_sql_username; 506 $dbOptions{username} = $add_sql_username;
504 $dbOptions{wwhost} = $add_sql_wwhost; 509 $dbOptions{wwhost} = $add_sql_wwhost;
505 } 510 }
506 511
507 my @users; 512 my @users;
508 if ($add_initial_userID ne "") { 513 if ($add_initial_userID ne "") {
509 my $User = $db->newUser( 514 my $User = $db->newUser(
510 user_id => $add_initial_userID, 515 user_id => $add_initial_userID,
511 status => "C", 516 status => "C",
512 ); 517 );
513 my $Password = $db->newPassword( 518 my $Password = $db->newPassword(
514 user_id => $add_initial_userID, 519 user_id => $add_initial_userID,
515 password => cryptPassword($add_initial_password), 520 password => cryptPassword($add_initial_password),
516 ); 521 );
517 my $PermissionLevel = $db->newPermissionLevel( 522 my $PermissionLevel = $db->newPermissionLevel(
518 user_id => $add_initial_userID, 523 user_id => $add_initial_userID,
519 permission => "10", 524 permission => "10",
520 ); 525 );
521 push @users, [ $User, $Password, $PermissionLevel ]; 526 push @users, [ $User, $Password, $PermissionLevel ];
522 } 527 }
523 528
524 eval { 529 eval {
525 addCourse( 530 addCourse(
526 courseID => $add_courseID, 531 courseID => $add_courseID,
527 ce => $ce2, 532 ce => $ce2,
528 courseOptions => { dbLayoutName => $add_dbLayout }, 533 courseOptions => \%courseOptions,
529 dbOptions => \%dbOptions, 534 dbOptions => \%dbOptions,
530 users => \@users, 535 users => \@users,
531 ); 536 );
532 }; 537 };
533 538
534 if ($@) { 539 if ($@) {
535 my $error = $@; 540 my $error = $@;

Legend:
Removed from v.1985  
changed lines
  Added in v.2004

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9