| … | |
… | |
| 55 | $self->{ce} = $ce; |
55 | $self->{ce} = $ce; |
| 56 | bless $self; |
56 | bless $self; |
| 57 | return $self; |
57 | return $self; |
| 58 | } |
58 | } |
| 59 | |
59 | |
|
|
60 | sub array_to_soap_string { |
|
|
61 | my @array = @_; |
|
|
62 | @array = map { SOAP::Data->type( 'string', $_ ) } @array; |
|
|
63 | return \@array; |
|
|
64 | } |
|
|
65 | |
| 60 | sub soap_fault_authen { |
66 | sub soap_fault_authen { |
| 61 | die SOAP::Fault->faultcode(SOAPERROR_AUTHEN_FAILED) |
67 | die SOAP::Fault->faultcode(SOAPERROR_AUTHEN_FAILED) |
| 62 | ->faultstring("SOAP Webservice Authentication Failed!"); |
68 | ->faultstring("SOAP Webservice Authentication Failed!"); |
| 63 | } |
69 | } |
| 64 | |
70 | |
| … | |
… | |
| 101 | if($authenKey != $WebworkSOAP::SeedCE{soap_authen_key}) { |
107 | if($authenKey != $WebworkSOAP::SeedCE{soap_authen_key}) { |
| 102 | soap_fault_authen; |
108 | soap_fault_authen; |
| 103 | } |
109 | } |
| 104 | $@ and soap_fault_major("Course Environment cannot be constructed."); |
110 | $@ and soap_fault_major("Course Environment cannot be constructed."); |
| 105 | my @test = listCourses($ce); |
111 | my @test = listCourses($ce); |
| 106 | return \@test; |
112 | return array_to_soap_string( @test ); |
| 107 | } |
113 | } |
| 108 | |
114 | |
| 109 | =pod |
115 | =pod |
| 110 | =begin WSDL |
116 | =begin WSDL |
| 111 | _IN authenKey $string |
117 | _IN authenKey $string |
| … | |
… | |
| 125 | $newKey = join ("", @chars[map rand(@chars), 1 .. $length]); |
131 | $newKey = join ("", @chars[map rand(@chars), 1 .. $length]); |
| 126 | my $Key = $soapEnv->{db}->newKey(user_id=>$userID, key=>$newKey, timestamp=>$timestamp); |
132 | my $Key = $soapEnv->{db}->newKey(user_id=>$userID, key=>$newKey, timestamp=>$timestamp); |
| 127 | eval { $soapEnv->{db}->deleteKey($userID) }; |
133 | eval { $soapEnv->{db}->deleteKey($userID) }; |
| 128 | eval { $soapEnv->{db}->addKey($Key) }; |
134 | eval { $soapEnv->{db}->addKey($Key) }; |
| 129 | $@ and soap_fault(SOAPERROR_USER_NOT_FOUND,"User not found."); |
135 | $@ and soap_fault(SOAPERROR_USER_NOT_FOUND,"User not found."); |
| 130 | return $newKey; |
136 | return SOAP::Data->type( 'string', $newKey ); |
| 131 | } |
137 | } |
| 132 | |
138 | |
| 133 | =pod |
139 | =pod |
| 134 | =begin WSDL |
140 | =begin WSDL |
| 135 | _IN authenKey $string |
141 | _IN authenKey $string |
| … | |
… | |
| 169 | $UserProblem->set_id($GlobalProblem->set_id); |
175 | $UserProblem->set_id($GlobalProblem->set_id); |
| 170 | $UserProblem->problem_id($GlobalProblem->problem_id); |
176 | $UserProblem->problem_id($GlobalProblem->problem_id); |
| 171 | initializeUserProblem($UserProblem, $seed); |
177 | initializeUserProblem($UserProblem, $seed); |
| 172 | eval { $db->addUserProblem($UserProblem) }; |
178 | eval { $db->addUserProblem($UserProblem) }; |
| 173 | } |
179 | } |
| 174 | return @results; |
180 | return array_to_soap_string( @results ); #FIXME WSDL says $string, not @string? |
| 175 | } |
181 | } |
| 176 | |
182 | |
| 177 | =pod |
183 | =pod |
| 178 | =begin WSDL |
184 | =begin WSDL |
| 179 | _IN authenKey $string |
185 | _IN authenKey $string |
| … | |
… | |
| 194 | for(my $i=0;$i<@problemData;$i++) { |
200 | for(my $i=0;$i<@problemData;$i++) { |
| 195 | $grade += @problemData[$i]->status; |
201 | $grade += @problemData[$i]->status; |
| 196 | } |
202 | } |
| 197 | push(@grades,$grade); |
203 | push(@grades,$grade); |
| 198 | } |
204 | } |
| 199 | return \@grades; |
205 | return array_to_soap_string( @grades ); |
| 200 | } |
206 | } |
| 201 | |
207 | |
| 202 | =pod |
208 | =pod |
| 203 | =begin WSDL |
209 | =begin WSDL |
| 204 | _IN authenKey $string |
210 | _IN authenKey $string |
| 205 | _IN courseName $string |
211 | _IN courseName $string |
| 206 | _IN setID $string |
212 | _IN setID $string |
| 207 | _RETURN @string |
213 | _RETURN $WebworkSOAP::Classes::GlobalSet |
| 208 | =end WSDL |
214 | =end WSDL |
| 209 | =cut |
215 | =cut |
| 210 | sub get_set_data { |
216 | sub get_set_data { |
| 211 | my ($self,$authenKey,$courseName,$setID) = @_; |
217 | my ($self,$authenKey,$courseName,$setID) = @_; |
| 212 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
218 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| … | |
… | |
| 214 | if(not defined $setData) { |
220 | if(not defined $setData) { |
| 215 | return -1; |
221 | return -1; |
| 216 | } |
222 | } |
| 217 | my $set = new WebworkSOAP::Classes::GlobalSet($setData); |
223 | my $set = new WebworkSOAP::Classes::GlobalSet($setData); |
| 218 | return $set; |
224 | return $set; |
| 219 | |
|
|
| 220 | |
|
|
| 221 | } |
225 | } |
| 222 | |
226 | |
| 223 | #################################################################### |
227 | #################################################################### |
| 224 | ##FUNCTIONS DIRECTLY MAPPED TO FUNCTIONS IN DB.pm |
228 | ##FUNCTIONS DIRECTLY MAPPED TO FUNCTIONS IN DB.pm |
| 225 | #################################################################### |
229 | #################################################################### |
| … | |
… | |
| 238 | sub add_password { |
242 | sub add_password { |
| 239 | my ($self,$authenKey,$courseName,$record) = @_; |
243 | my ($self,$authenKey,$courseName,$record) = @_; |
| 240 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
244 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 241 | my $newPassword = $soapEnv->{db}->newPassword; |
245 | my $newPassword = $soapEnv->{db}->newPassword; |
| 242 | %$newPassword = %$record; |
246 | %$newPassword = %$record; |
| 243 | return $soapEnv->{db}->addPassword($newPassword); |
247 | return SOAP::Data->type( 'string', $soapEnv->{db}->addPassword($newPassword) ); |
| 244 | } |
248 | } |
| 245 | |
249 | |
| 246 | =pod |
250 | =pod |
| 247 | =begin WSDL |
251 | =begin WSDL |
| 248 | _IN authenKey $string |
252 | _IN authenKey $string |
| … | |
… | |
| 252 | =end WSDL |
256 | =end WSDL |
| 253 | =cut |
257 | =cut |
| 254 | sub put_password { |
258 | sub put_password { |
| 255 | my ($self,$authenKey,$courseName,$record) = @_; |
259 | my ($self,$authenKey,$courseName,$record) = @_; |
| 256 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
260 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 257 | return $soapEnv->{db}->putPassword($record); |
261 | return SOAP::Data->type( 'string', $soapEnv->{db}->putPassword($record) ); |
| 258 | } |
262 | } |
| 259 | |
263 | |
| 260 | =pod |
264 | =pod |
| 261 | =begin WSDL |
265 | =begin WSDL |
| 262 | _IN authenKey $string |
266 | _IN authenKey $string |
| … | |
… | |
| 266 | =cut |
270 | =cut |
| 267 | sub list_password { |
271 | sub list_password { |
| 268 | my ($self,$authenKey,$courseName) = @_; |
272 | my ($self,$authenKey,$courseName) = @_; |
| 269 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
273 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 270 | my @tempArray = $soapEnv->{db}->listPasswords; |
274 | my @tempArray = $soapEnv->{db}->listPasswords; |
| 271 | return \@tempArray; |
275 | return array_to_soap_string( @tempArray ); |
| 272 | } |
276 | } |
| 273 | |
277 | |
| 274 | =pod |
278 | =pod |
| 275 | =begin WSDL |
279 | =begin WSDL |
| 276 | _IN authenKey $string |
280 | _IN authenKey $string |
| … | |
… | |
| 324 | sub add_permission { |
328 | sub add_permission { |
| 325 | my ($self,$authenKey,$courseName,$record) = @_; |
329 | my ($self,$authenKey,$courseName,$record) = @_; |
| 326 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
330 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 327 | my $newPermissionLevel = $soapEnv->{db}->newPermissionLevel; |
331 | my $newPermissionLevel = $soapEnv->{db}->newPermissionLevel; |
| 328 | %$newPermissionLevel = %$record; |
332 | %$newPermissionLevel = %$record; |
| 329 | return $soapEnv->{db}->addPermissionLevel($newPermissionLevel); |
333 | return SOAP::Data->type( 'string', $soapEnv->{db}->addPermissionLevel($newPermissionLevel) ); |
| 330 | } |
334 | } |
| 331 | |
335 | |
| 332 | =pod |
336 | =pod |
| 333 | =begin WSDL |
337 | =begin WSDL |
| 334 | _IN authenKey $string |
338 | _IN authenKey $string |
| … | |
… | |
| 338 | =end WSDL |
342 | =end WSDL |
| 339 | =cut |
343 | =cut |
| 340 | sub put_permission { |
344 | sub put_permission { |
| 341 | my ($self,$authenKey,$courseName,$record) = @_; |
345 | my ($self,$authenKey,$courseName,$record) = @_; |
| 342 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
346 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 343 | return $soapEnv->{db}->putPermissionLevel($record); |
347 | return SOAP::Data->type( 'string', $soapEnv->{db}->putPermissionLevel($record) ); |
| 344 | } |
348 | } |
| 345 | |
349 | |
| 346 | =pod |
350 | =pod |
| 347 | =begin WSDL |
351 | =begin WSDL |
| 348 | _IN authenKey $string |
352 | _IN authenKey $string |
| … | |
… | |
| 352 | =cut |
356 | =cut |
| 353 | sub list_permissions { |
357 | sub list_permissions { |
| 354 | my ($self,$authenKey,$courseName) = @_; |
358 | my ($self,$authenKey,$courseName) = @_; |
| 355 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
359 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 356 | my @tempArray = $soapEnv->{db}->listPermissionLevels; |
360 | my @tempArray = $soapEnv->{db}->listPermissionLevels; |
| 357 | return \@tempArray; |
361 | return array_to_soap_string( @tempArray ); |
| 358 | } |
362 | } |
| 359 | |
363 | |
| 360 | =pod |
364 | =pod |
| 361 | =begin WSDL |
365 | =begin WSDL |
| 362 | _IN authenKey $string |
366 | _IN authenKey $string |
| … | |
… | |
| 410 | sub add_key { |
414 | sub add_key { |
| 411 | my ($self,$authenKey,$courseName,$record) = @_; |
415 | my ($self,$authenKey,$courseName,$record) = @_; |
| 412 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
416 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 413 | my $newKey = $soapEnv->{db}->newKey; |
417 | my $newKey = $soapEnv->{db}->newKey; |
| 414 | %$newKey = %$record; |
418 | %$newKey = %$record; |
| 415 | return $soapEnv->{db}->addKey($newKey); |
419 | return SOAP::Data->type( 'string', $soapEnv->{db}->addKey($newKey) ); |
| 416 | } |
420 | } |
| 417 | |
421 | |
| 418 | =pod |
422 | =pod |
| 419 | =begin WSDL |
423 | =begin WSDL |
| 420 | _IN authenKey $string |
424 | _IN authenKey $string |
| … | |
… | |
| 424 | =end WSDL |
428 | =end WSDL |
| 425 | =cut |
429 | =cut |
| 426 | sub put_key { |
430 | sub put_key { |
| 427 | my ($self,$authenKey,$courseName,$record) = @_; |
431 | my ($self,$authenKey,$courseName,$record) = @_; |
| 428 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
432 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 429 | return $soapEnv->{db}->putKey($record); |
433 | return SOAP::Data->type( 'string', $soapEnv->{db}->putKey($record) ); |
| 430 | } |
434 | } |
| 431 | |
435 | |
| 432 | =pod |
436 | =pod |
| 433 | =begin WSDL |
437 | =begin WSDL |
| 434 | _IN authenKey $string |
438 | _IN authenKey $string |
| … | |
… | |
| 438 | =cut |
442 | =cut |
| 439 | sub list_keys { |
443 | sub list_keys { |
| 440 | my ($self,$authenKey,$courseName) = @_; |
444 | my ($self,$authenKey,$courseName) = @_; |
| 441 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
445 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 442 | my @tempArray = $soapEnv->{db}->listKeys; |
446 | my @tempArray = $soapEnv->{db}->listKeys; |
| 443 | return \@tempArray; |
447 | return array_to_soap_string( @tempArray ); |
| 444 | } |
448 | } |
| 445 | |
449 | |
| 446 | =pod |
450 | =pod |
| 447 | =begin WSDL |
451 | =begin WSDL |
| 448 | _IN authenKey $string |
452 | _IN authenKey $string |
| … | |
… | |
| 496 | sub add_user { |
500 | sub add_user { |
| 497 | my ($self,$authenKey,$courseName,$record) = @_; |
501 | my ($self,$authenKey,$courseName,$record) = @_; |
| 498 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
502 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 499 | my $newUser = $soapEnv->{db}->newUser; |
503 | my $newUser = $soapEnv->{db}->newUser; |
| 500 | %$newUser = %$record; |
504 | %$newUser = %$record; |
| 501 | return $soapEnv->{db}->addUser($newUser); |
505 | return SOAP::Data->type( 'string', $soapEnv->{db}->addUser($newUser) ); |
| 502 | } |
506 | } |
| 503 | |
507 | |
| 504 | =pod |
508 | =pod |
| 505 | =begin WSDL |
509 | =begin WSDL |
| 506 | _IN authenKey $string |
510 | _IN authenKey $string |
| … | |
… | |
| 510 | =end WSDL |
514 | =end WSDL |
| 511 | =cut |
515 | =cut |
| 512 | sub put_user { |
516 | sub put_user { |
| 513 | my ($self,$authenKey,$courseName,$record) = @_; |
517 | my ($self,$authenKey,$courseName,$record) = @_; |
| 514 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
518 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 515 | return $soapEnv->{db}->putUser($record); |
519 | return SOAP::Data->type( 'string', $soapEnv->{db}->putUser($record) ); |
| 516 | } |
520 | } |
| 517 | |
521 | |
| 518 | =pod |
522 | =pod |
| 519 | =begin WSDL |
523 | =begin WSDL |
| 520 | _IN authenKey $string |
524 | _IN authenKey $string |
| … | |
… | |
| 524 | =cut |
528 | =cut |
| 525 | sub list_users { |
529 | sub list_users { |
| 526 | my ($self,$authenKey,$courseName) = @_; |
530 | my ($self,$authenKey,$courseName) = @_; |
| 527 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
531 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 528 | my @tempArray = $soapEnv->{db}->listUsers; |
532 | my @tempArray = $soapEnv->{db}->listUsers; |
| 529 | return \@tempArray; |
533 | return array_to_soap_string( @tempArray ); |
| 530 | } |
534 | } |
| 531 | |
535 | |
| 532 | =pod |
536 | =pod |
| 533 | =begin WSDL |
537 | =begin WSDL |
| 534 | _IN authenKey $string |
538 | _IN authenKey $string |
| … | |
… | |
| 576 | =end WSDL |
580 | =end WSDL |
| 577 | =cut |
581 | =cut |
| 578 | sub delete_user { |
582 | sub delete_user { |
| 579 | my ($self,$authenKey,$courseName,$userID) = @_; |
583 | my ($self,$authenKey,$courseName,$userID) = @_; |
| 580 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
584 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 581 | return $soapEnv->{db}->deleteUser($userID); |
585 | return SOAP::Data->type( 'string', $soapEnv->{db}->deleteUser($userID) ); |
| 582 | } |
586 | } |
| 583 | |
587 | |
| 584 | ################################################## |
588 | ################################################## |
| 585 | ##Global Sets |
589 | ##Global Sets |
| 586 | ################################################## |
590 | ################################################## |
| … | |
… | |
| 596 | sub add_global_set { |
600 | sub add_global_set { |
| 597 | my ($self,$authenKey,$courseName,$record) = @_; |
601 | my ($self,$authenKey,$courseName,$record) = @_; |
| 598 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
602 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 599 | my $newGlobalSet = $soapEnv->{db}->newGlobalSet; |
603 | my $newGlobalSet = $soapEnv->{db}->newGlobalSet; |
| 600 | %$newGlobalSet = %$record; |
604 | %$newGlobalSet = %$record; |
| 601 | return $soapEnv->{db}->addGlobalSet($newGlobalSet); |
605 | return SOAP::Data->type( 'string', $soapEnv->{db}->addGlobalSet($newGlobalSet) ); |
| 602 | } |
606 | } |
| 603 | |
607 | |
| 604 | =pod |
608 | =pod |
| 605 | =begin WSDL |
609 | =begin WSDL |
| 606 | _IN authenKey $string |
610 | _IN authenKey $string |
| … | |
… | |
| 610 | =end WSDL |
614 | =end WSDL |
| 611 | =cut |
615 | =cut |
| 612 | sub put_global_set { |
616 | sub put_global_set { |
| 613 | my ($self,$authenKey,$courseName,$record) = @_; |
617 | my ($self,$authenKey,$courseName,$record) = @_; |
| 614 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
618 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 615 | return $soapEnv->{db}->putGlobalSet($record); |
619 | return SOAP::Data->type( 'string', $soapEnv->{db}->putGlobalSet($record) ); |
| 616 | } |
620 | } |
| 617 | |
621 | |
| 618 | =pod |
622 | =pod |
| 619 | =begin WSDL |
623 | =begin WSDL |
| 620 | _IN authenKey $string |
624 | _IN authenKey $string |
| … | |
… | |
| 624 | =cut |
628 | =cut |
| 625 | sub list_global_sets { |
629 | sub list_global_sets { |
| 626 | my ($self,$authenKey,$courseName) = @_; |
630 | my ($self,$authenKey,$courseName) = @_; |
| 627 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
631 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 628 | my @tempArray = $soapEnv->{db}->listGlobalSets; |
632 | my @tempArray = $soapEnv->{db}->listGlobalSets; |
| 629 | return \@tempArray; |
633 | return array_to_soap_string( @tempArray ); |
| 630 | } |
634 | } |
| 631 | |
|
|
| 632 | |
635 | |
| 633 | =pod |
636 | =pod |
| 634 | =begin WSDL |
637 | =begin WSDL |
| 635 | _IN authenKey $string |
638 | _IN authenKey $string |
| 636 | _IN courseName $string |
639 | _IN courseName $string |
| … | |
… | |
| 696 | =end WSDL |
699 | =end WSDL |
| 697 | =cut |
700 | =cut |
| 698 | sub delete_global_set { |
701 | sub delete_global_set { |
| 699 | my ($self,$authenKey,$courseName,$setID) = @_; |
702 | my ($self,$authenKey,$courseName,$setID) = @_; |
| 700 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
703 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 701 | return $soapEnv->{db}->deleteGlobalSet($setID); |
704 | return SOAP::Data->type( 'string', $soapEnv->{db}->deleteGlobalSet($setID) ); |
| 702 | } |
705 | } |
| 703 | |
706 | |
| 704 | ################################################## |
707 | ################################################## |
| 705 | ##Global Problems |
708 | ##Global Problems |
| 706 | ################################################## |
709 | ################################################## |
| … | |
… | |
| 716 | sub add_global_problem { |
719 | sub add_global_problem { |
| 717 | my ($self,$authenKey,$courseName,$record) = @_; |
720 | my ($self,$authenKey,$courseName,$record) = @_; |
| 718 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
721 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 719 | my $newGlobalProblem = $soapEnv->{db}->newGlobalProblem; |
722 | my $newGlobalProblem = $soapEnv->{db}->newGlobalProblem; |
| 720 | %$newGlobalProblem = %$record; |
723 | %$newGlobalProblem = %$record; |
| 721 | return $soapEnv->{db}->addGlobalProblem($newGlobalProblem); |
724 | return SOAP::Data->type( 'string', $soapEnv->{db}->addGlobalProblem($newGlobalProblem) ); |
| 722 | } |
725 | } |
| 723 | |
726 | |
| 724 | =pod |
727 | =pod |
| 725 | =begin WSDL |
728 | =begin WSDL |
| 726 | _IN authenKey $string |
729 | _IN authenKey $string |
| … | |
… | |
| 730 | =end WSDL |
733 | =end WSDL |
| 731 | =cut |
734 | =cut |
| 732 | sub put_global_problem { |
735 | sub put_global_problem { |
| 733 | my ($self,$authenKey,$courseName,$record) = @_; |
736 | my ($self,$authenKey,$courseName,$record) = @_; |
| 734 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
737 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 735 | return $soapEnv->{db}->putGlobalProblem($record); |
738 | return SOAP::Data->type( 'string', $soapEnv->{db}->putGlobalProblem($record) ); |
| 736 | } |
739 | } |
| 737 | |
740 | |
| 738 | =pod |
741 | =pod |
| 739 | =begin WSDL |
742 | =begin WSDL |
| 740 | _IN authenKey $string |
743 | _IN authenKey $string |
| … | |
… | |
| 745 | =cut |
748 | =cut |
| 746 | sub list_global_problems { |
749 | sub list_global_problems { |
| 747 | my ($self,$authenKey,$courseName,$setID) = @_; |
750 | my ($self,$authenKey,$courseName,$setID) = @_; |
| 748 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
751 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 749 | my @tempArray = $soapEnv->{db}->listGlobalProblems($setID); |
752 | my @tempArray = $soapEnv->{db}->listGlobalProblems($setID); |
| 750 | return \@tempArray; |
753 | return array_to_soap_string( @tempArray ); |
| 751 | } |
754 | } |
| 752 | |
755 | |
| 753 | =pod |
756 | =pod |
| 754 | =begin WSDL |
757 | =begin WSDL |
| 755 | _IN authenKey $string |
758 | _IN authenKey $string |
| … | |
… | |
| 771 | |
774 | |
| 772 | =pod |
775 | =pod |
| 773 | =begin |
776 | =begin |
| 774 | _IN authenKey $string |
777 | _IN authenKey $string |
| 775 | _IN courseName $string |
778 | _IN courseName $string |
| 776 | _IN problemIDs @string |
779 | _IN problemIDs @string An array reference: [userID setID problemID] |
| 777 | _RETURN @WebworkSOAP::Classes::GlobalProblem Array of user objects |
780 | _RETURN @WebworkSOAP::Classes::GlobalProblem Array of user objects |
| 778 | =end WSDL |
781 | =end WSDL |
| 779 | =cut |
782 | =cut |
| 780 | sub get_global_problems { |
783 | sub get_global_problems { |
| 781 | my ($self,$authenKey,$courseName,$problemIDs) = @_; |
784 | my ($self,$authenKey,$courseName,$problemIDs) = @_; |
| 782 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
785 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 783 | my @problemData = $soapEnv->{db}->getGlobalProblems(@$problemIDs); |
786 | my @problemData = $soapEnv->{db}->getGlobalProblems(@$problemIDs); |
| 784 | my @problems; |
787 | my @problems; |
| 785 | for(my $i=0;$i<@problemData;$i++) { |
788 | for(my $i=0;$i<@problemData;$i++) { |
| 786 | push(@problems,new WebworkSOAP::Classes::GlobalProblem(@problemData[$i])); |
789 | push(@problems,new WebworkSOAP::Classes::GlobalProblem(@problemData[$i])); #FIXME $problemData[$i]? |
| 787 | } |
790 | } |
| 788 | return \@problems; |
791 | return \@problems; |
| 789 | } |
792 | } |
| 790 | |
793 | |
| 791 | =pod |
794 | =pod |
| … | |
… | |
| 818 | =end WSDL |
821 | =end WSDL |
| 819 | =cut |
822 | =cut |
| 820 | sub delete_global_problem { |
823 | sub delete_global_problem { |
| 821 | my ($self,$authenKey,$courseName,$setID,$problemID) = @_; |
824 | my ($self,$authenKey,$courseName,$setID,$problemID) = @_; |
| 822 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
825 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 823 | return $soapEnv->{db}->deleteGlobalProblem($setID,$problemID); |
826 | return SOAP::Data->type( 'string', $soapEnv->{db}->deleteGlobalProblem($setID,$problemID) ); |
| 824 | } |
827 | } |
| 825 | |
828 | |
| 826 | ################################################## |
829 | ################################################## |
| 827 | ##USER PROBLEM |
830 | ##USER PROBLEM |
| 828 | ################################################## |
831 | ################################################## |
| … | |
… | |
| 838 | sub add_user_problem { |
841 | sub add_user_problem { |
| 839 | my ($self,$authenKey,$courseName,$record) = @_; |
842 | my ($self,$authenKey,$courseName,$record) = @_; |
| 840 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
843 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 841 | my $newUserProblem = $soapEnv->{db}->newUserProblem; |
844 | my $newUserProblem = $soapEnv->{db}->newUserProblem; |
| 842 | %$newUserProblem = %$record; |
845 | %$newUserProblem = %$record; |
| 843 | return $soapEnv->{db}->addUserProblem($newUserProblem); |
846 | return SOAP::Data->type( 'string', $soapEnv->{db}->addUserProblem($newUserProblem) ); |
| 844 | } |
847 | } |
| 845 | |
848 | |
| 846 | =pod |
849 | =pod |
| 847 | =begin WSDL |
850 | =begin WSDL |
| 848 | _IN authenKey $string |
851 | _IN authenKey $string |
| … | |
… | |
| 852 | =end WSDL |
855 | =end WSDL |
| 853 | =cut |
856 | =cut |
| 854 | sub put_user_problem { |
857 | sub put_user_problem { |
| 855 | my ($self,$authenKey,$courseName,$record) = @_; |
858 | my ($self,$authenKey,$courseName,$record) = @_; |
| 856 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
859 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 857 | return $soapEnv->{db}->putUserProblem($record); |
860 | return SOAP::Data->type( 'string', $soapEnv->{db}->putUserProblem($record) ); |
| 858 | } |
861 | } |
| 859 | |
862 | |
| 860 | =pod |
863 | =pod |
| 861 | =begin WSDL |
864 | =begin WSDL |
| 862 | _IN authenKey $string |
865 | _IN authenKey $string |
|
|
866 | _IN courseName $string |
| 863 | _IN courseName $string |
867 | _IN userID $string |
| 864 | _IN userID $string |
868 | _IN setID $string |
| 865 | _RETURN @string of names objects. |
869 | _RETURN @string of names objects. |
| 866 | =end WSDL |
870 | =end WSDL |
| 867 | =cut |
871 | =cut |
| 868 | sub list_user_problems { |
872 | sub list_user_problems { |
| 869 | my ($self,$authenKey,$courseName,$userID) = @_; |
873 | my ($self,$authenKey,$courseName,$userID,$setID) = @_; |
| 870 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
874 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 871 | my @tempArray = $soapEnv->{db}->listUserProblems($userID); |
875 | my @tempArray = $soapEnv->{db}->listUserProblems($userID,$setID); |
| 872 | return \@tempArray; |
876 | return array_to_soap_string( @tempArray ); |
| 873 | } |
877 | } |
| 874 | |
878 | |
| 875 | =pod |
879 | =pod |
| 876 | =begin WSDL |
880 | =begin WSDL |
| 877 | _IN authenKey $string |
881 | _IN authenKey $string |
| … | |
… | |
| 894 | |
898 | |
| 895 | =pod |
899 | =pod |
| 896 | =begin WSDL |
900 | =begin WSDL |
| 897 | _IN authenKey $string |
901 | _IN authenKey $string |
| 898 | _IN courseName $string |
902 | _IN courseName $string |
| 899 | _IN userProblemIDs @string |
903 | _IN userProblemIDs @string A 3 element array: { user_ID, setID, problemID } |
| 900 | _RETURN @WebworkSOAP::Classes::UserProblem of names objects. |
904 | _RETURN @WebworkSOAP::Classes::UserProblem of names objects. |
| 901 | =end WSDL |
905 | =end WSDL |
| 902 | =cut |
906 | =cut |
| 903 | sub get_user_problems { |
907 | sub get_user_problems { |
| 904 | my ($self,$authenKey,$courseName,$userProblemIDs) = @_; |
908 | my ($self,$authenKey,$courseName,$userProblemIDs) = @_; |
| … | |
… | |
| 943 | =end WSDL |
947 | =end WSDL |
| 944 | =cut |
948 | =cut |
| 945 | sub delete_user_problem { |
949 | sub delete_user_problem { |
| 946 | my ($self,$authenKey,$courseName,$userID,$setID,$problemID) = @_; |
950 | my ($self,$authenKey,$courseName,$userID,$setID,$problemID) = @_; |
| 947 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
951 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 948 | return $soapEnv->{db}->deleteUserProblem($userID,$setID,$problemID); |
952 | return SOAP::Data->type( 'string', $soapEnv->{db}->deleteUserProblem($userID,$setID,$problemID) ); |
| 949 | } |
953 | } |
| 950 | |
954 | |
| 951 | ################################################## |
955 | ################################################## |
| 952 | ##USER SET |
956 | ##USER SET |
| 953 | ################################################## |
957 | ################################################## |
| … | |
… | |
| 963 | sub add_user_set { |
967 | sub add_user_set { |
| 964 | my ($self,$authenKey,$courseName,$record) = @_; |
968 | my ($self,$authenKey,$courseName,$record) = @_; |
| 965 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
969 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 966 | my $newUserSet = $soapEnv->{db}->newUserSet; |
970 | my $newUserSet = $soapEnv->{db}->newUserSet; |
| 967 | %$newUserSet = %$record; |
971 | %$newUserSet = %$record; |
| 968 | return $soapEnv->{db}->addUserSet($newUserSet); |
972 | return SOAP::Data->type( 'string', $soapEnv->{db}->addUserSet($newUserSet) ); |
| 969 | } |
973 | } |
| 970 | |
974 | |
| 971 | =pod |
975 | =pod |
| 972 | =begin WSDL |
976 | =begin WSDL |
| 973 | _IN authenKey $string |
977 | _IN authenKey $string |
| … | |
… | |
| 977 | =end WSDL |
981 | =end WSDL |
| 978 | =cut |
982 | =cut |
| 979 | sub put_user_set { |
983 | sub put_user_set { |
| 980 | my ($self,$authenKey,$courseName,$record) = @_; |
984 | my ($self,$authenKey,$courseName,$record) = @_; |
| 981 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
985 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 982 | return $soapEnv->{db}->addUserSet($record); |
986 | return SOAP::Data->type( 'string', $soapEnv->{db}->addUserSet($record) ); |
| 983 | } |
987 | } |
| 984 | |
988 | |
| 985 | =pod |
989 | =pod |
| 986 | =begin WSDL |
990 | =begin WSDL |
| 987 | _IN authenKey $string |
991 | _IN authenKey $string |
| … | |
… | |
| 992 | =cut |
996 | =cut |
| 993 | sub list_user_sets { |
997 | sub list_user_sets { |
| 994 | my ($self,$authenKey,$courseName,$userID) = @_; |
998 | my ($self,$authenKey,$courseName,$userID) = @_; |
| 995 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
999 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 996 | my @tempArray = $soapEnv->{db}->listUserSets($userID); |
1000 | my @tempArray = $soapEnv->{db}->listUserSets($userID); |
| 997 | return \@tempArray; |
1001 | return array_to_soap_string( @tempArray ); |
| 998 | } |
1002 | } |
| 999 | |
1003 | |
| 1000 | =pod |
1004 | =pod |
| 1001 | =begin WSDL |
1005 | =begin WSDL |
| 1002 | _IN authenKey $string |
1006 | _IN authenKey $string |
| … | |
… | |
| 1064 | =end WSDL |
1068 | =end WSDL |
| 1065 | =cut |
1069 | =cut |
| 1066 | sub delete_user_set { |
1070 | sub delete_user_set { |
| 1067 | my ($self,$authenKey,$courseName,$userID,$setID) = @_; |
1071 | my ($self,$authenKey,$courseName,$userID,$setID) = @_; |
| 1068 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
1072 | my $soapEnv = new WebworkSOAP($authenKey,$courseName); |
| 1069 | return $soapEnv->{db}->deleteUserSet($userID,$setID); |
1073 | return SOAP::Data->type( 'string', $soapEnv->{db}->deleteUserSet($userID,$setID) ); |
| 1070 | } |
1074 | } |
| 1071 | |
1075 | |
| 1072 | |
1076 | |
| 1073 | 1; |
1077 | 1; |