| 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$ |
4 | # $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator.pm,v 1.75 2004/01/17 16:29:52 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. |
| … | |
… | |
| 493 | } |
493 | } |
| 494 | |
494 | |
| 495 | sub loginstatus { |
495 | sub loginstatus { |
| 496 | my $self = shift; |
496 | my $self = shift; |
| 497 | my $r = $self->{r}; |
497 | my $r = $self->{r}; |
|
|
498 | my $ce = $self->{ce}; |
|
|
499 | |
| 498 | my $user = $r->param("user"); |
500 | my $user = $r->param("user"); |
| 499 | my $eUser = $r->param("effectiveUser"); |
501 | my $eUser = $r->param("effectiveUser"); |
| 500 | my $key = $r->param("key"); |
502 | my $key = $r->param("key"); |
|
|
503 | |
| 501 | return "" unless $key; |
504 | return "" unless $key; |
|
|
505 | |
| 502 | my $exitURL = $r->uri() . "?user=$user&key=$key"; |
506 | my $exitURL = $r->uri() . "?user=$user&key=$key"; |
|
|
507 | |
|
|
508 | my $root = $ce->{webworkURLs}->{root}; |
|
|
509 | my $courseID = $ce->{courseName}; |
|
|
510 | my $logout = "$root/$courseID/logout/?" . $self->url_authen_args(); |
|
|
511 | |
| 503 | print CGI::small("User:", "$user"); |
512 | print CGI::small("User:", "$user"); |
|
|
513 | |
| 504 | if ($user ne $eUser) { |
514 | if ($user ne $eUser) { |
| 505 | print CGI::br(), CGI::font({-color=>'red'}, |
515 | print CGI::br(), CGI::font({-color=>'red'}, |
| 506 | CGI::small("Acting as:", "$eUser") |
516 | CGI::small("Acting as:", "$eUser") |
| 507 | ), |
517 | ), |
| 508 | CGI::br(), CGI::a({-href=>$exitURL}, |
518 | CGI::br(), CGI::a({-href=>$exitURL}, |
| 509 | CGI::small("Stop Acting") |
519 | CGI::small("Stop Acting") |
| 510 | ); |
520 | ); |
| 511 | } |
521 | } |
|
|
522 | |
|
|
523 | print CGI::br(), CGI::a({-href=>$logout}, CGI::small("Log Out")); |
|
|
524 | |
| 512 | return ""; |
525 | return ""; |
| 513 | } |
526 | } |
| 514 | |
527 | |
| 515 | # FIXME: drunk code. rewrite. |
528 | # FIXME: drunk code. rewrite. |
| 516 | # also, this should be structured s.t. subclasses can add items to the links |
529 | # also, this should be structured s.t. subclasses can add items to the links |
| … | |
… | |
| 542 | my $permLevel = (defined $PermissionLevel |
555 | my $permLevel = (defined $PermissionLevel |
| 543 | ? $PermissionLevel->permission() |
556 | ? $PermissionLevel->permission() |
| 544 | : 0); |
557 | : 0); |
| 545 | |
558 | |
| 546 | return join("", |
559 | return join("", |
| 547 | CGI::a({-href=>$probSets}, "Problem Sets"), CGI::br(), |
560 | CGI::div( {style=>'font-size:larger'},CGI::a({-href=>$probSets}, "Problem Sets") |
|
|
561 | ), |
| 548 | CGI::a({-href=>$prefs}, "User Prefs"), CGI::br(), |
562 | CGI::a({-href=>$prefs}, "User Prefs"), CGI::br(), |
| 549 | CGI::a({-href=>$help}, "Help"), CGI::br(), |
563 | CGI::a({-href=>$help,-target=>'_help_'}, "Help"), CGI::br(), |
| 550 | CGI::a({-href=>$logout}, "Log Out"), CGI::br(), |
564 | #CGI::a({-href=>$logout}, "Log Out"), CGI::br(), |
| 551 | ($permLevel > 0 |
565 | ($permLevel > 0 |
| 552 | ? $self->instructor_links(@components) : "" |
566 | ? $self->instructor_links(@components) : "" |
| 553 | ), |
567 | ), |
| 554 | ); |
568 | ); |
| 555 | } |
569 | } |
| … | |
… | |
| 597 | # : ''; |
611 | # : ''; |
| 598 | #$setProb .= ':' . CGI::a({-href=>$probURL},$prob) if $setProb && $probURL; |
612 | #$setProb .= ':' . CGI::a({-href=>$probURL},$prob) if $setProb && $probURL; |
| 599 | |
613 | |
| 600 | return join("", |
614 | return join("", |
| 601 | CGI::hr(), |
615 | CGI::hr(), |
|
|
616 | CGI::div( {style=>'font-size:larger'}, |
| 602 | CGI::a({-href=>$instructor}, "Instructor Tools") , CGI::br(), |
617 | CGI::a({-href=>$instructor}, "Instructor Tools") |
|
|
618 | ), |
|
|
619 | ' ',CGI::a({-href=>$users}, "User List"), CGI::br(), |
| 603 | ' ',CGI::a({-href=>$sets}, "Set List"), CGI::br(), |
620 | ' ',CGI::a({-href=>$sets}, "Set List"), CGI::br(), |
| 604 | $setLink, |
621 | $setLink, |
| 605 | $problemLink, |
622 | $problemLink, |
| 606 | ' ',CGI::a({-href=>$users}, "User List"), CGI::br(), |
|
|
| 607 | ' ',CGI::a({-href=>$email}, "Send Email"), CGI::br(), |
623 | ' ',CGI::a({-href=>$email}, "Mail Merge"), CGI::br(), |
| 608 | ' ',CGI::a({-href=>$scoring}, "Score Sets"), CGI::br(), |
624 | ' ',CGI::a({-href=>$scoring}, "Scoring"), CGI::br(), |
| 609 | ' ',CGI::a({-href=>$stats}, 'Statistics'), CGI::br(), |
625 | ' ',CGI::a({-href=>$stats}, "Statistics"), CGI::br(), |
| 610 | (defined($set)) |
626 | (defined($set)) |
| 611 | ? ' '.CGI::a({-href=>"$statsRoot/set/$set/?".$self->url_authen_args}, "$set").CGI::br() |
627 | ? ' '.CGI::a({-href=>"$statsRoot/set/$set/?".$self->url_authen_args}, "$set").CGI::br() |
| 612 | : '', |
628 | : '', |
| 613 | (defined($userName)) |
629 | (defined($userName)) |
| 614 | ? ' '.CGI::a({-href=>"$statsRoot/student/$userName/?".$self->url_authen_args}, "$userName").CGI::br() |
630 | ? ' '.CGI::a({-href=>"$statsRoot/student/$userName/?".$self->url_authen_args}, "$userName").CGI::br() |
| 615 | : '', |
631 | : '', |
| 616 | ' ',CGI::a({-href=>$fileXfer}, "File Transfer"), CGI::br(), |
632 | ' ',CGI::a({-href=>$fileXfer}, "File Transfer"), CGI::br(), |
| 617 | ); |
633 | ); |
| 618 | } |
634 | } |
| 619 | |
635 | |
| 620 | # &if_can will return 1 if the current object->can("do $_[1]") |
636 | # &if_can will return 1 if the current object->can("do $_[1]") |
| 621 | sub if_can ($$) { |
637 | sub if_can ($$) { |