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

Diff of /trunk/webwork-modperl/lib/WeBWorK/DB.pm

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

Revision 3052 Revision 3056
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/DB.pm,v 1.60 2004/12/18 22:21:26 gage Exp $ 4# $CVSHeader: webwork2/lib/WeBWorK/DB.pm,v 1.61 2004/12/19 00:53:27 gage 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.
341 341
342 # connect 342 # connect
343 $self->{set_user}->{driver}->connect("ro") 343 $self->{set_user}->{driver}->connect("ro")
344 or return 0, @results, "Failed to connect to set_user database."; 344 or return 0, @results, "Failed to connect to set_user database.";
345 345
346 # get PSVNs for global user (N) 346 # get PSVNs for global user (ïN)
347 # this reads from "login<>global_user" 347 # this reads from "login<>global_user"
348 my @globalUserPSVNs = $self->{set_user}->getPSVNsForUser($globalUserID); 348 my @globalUserPSVNs = $self->{set_user}->getPSVNsForUser($globalUserID);
349 #warn "found ", scalar @globalUserPSVNs, " PSVNs for the global user.\n"; 349 #warn "found ", scalar @globalUserPSVNs, " PSVNs for the global user.\n";
350 350
351 # get setIDs for PSVNs (M) 351 # get setIDs for PSVNs (M)
356 my (undef, $setID) = $self->{set_user}->string2IDs($string); # discard userID, problemIDs 356 my (undef, $setID) = $self->{set_user}->string2IDs($string); # discard userID, problemIDs
357 push @globalUserSetIDs, $setID; 357 push @globalUserSetIDs, $setID;
358 #warn "got setID '$setID'\n"; 358 #warn "got setID '$setID'\n";
359 } 359 }
360 360
361 # get PSVNs for each setID (N*M) 361 # get PSVNs for each setID (ïN*M)
362 # this reads from "set<>$_" 362 # this reads from "set<>$_"
363 my @okPSVNs = map { $self->{set_user}->getPSVNsForSet($_) } @globalUserSetIDs; 363 my @okPSVNs = map { $self->{set_user}->getPSVNsForSet($_) } @globalUserSetIDs;
364 #warn "found ", scalar @okPSVNs, " PSVNs for sets assigned to the global user.\n"; 364 #warn "found ", scalar @okPSVNs, " PSVNs for sets assigned to the global user.\n";
365 365
366 # get all PSVNs (N*M) 366 # get all PSVNs (N*M)
1969 if ($keyfield eq "problem_id") { 1969 if ($keyfield eq "problem_id") {
1970 croak "checkKeyfields: invalid characters in $keyfield field: $value (valid characters are [0-9])" 1970 croak "checkKeyfields: invalid characters in $keyfield field: $value (valid characters are [0-9])"
1971 unless $value =~ m/^\d*$/; 1971 unless $value =~ m/^\d*$/;
1972 } else { 1972 } else {
1973 croak "checkKeyfields: invalid characters in $keyfield field: $value (valid characters are [A-Za-z0-9_.])" 1973 croak "checkKeyfields: invalid characters in $keyfield field: $value (valid characters are [A-Za-z0-9_.])"
1974 unless $value =~ m/^[.\w-]*$/; 1974 unless $value =~ m/^[.\w\-]*$/;
1975 } 1975 }
1976 } 1976 }
1977} 1977}
1978 1978
1979=head1 AUTHOR 1979=head1 AUTHOR

Legend:
Removed from v.3052  
changed lines
  Added in v.3056

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9