[system] / trunk / webwork2 / lib / WeBWorK / ContentGenerator.pm Repository:
ViewVC logotype

Diff of /trunk/webwork2/lib/WeBWorK/ContentGenerator.pm

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

Revision 2390 Revision 2397
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.pm,v 1.108 2004/06/24 17:22:44 sh002i Exp $ 4# $CVSHeader: webwork-modperl/lib/WeBWorK/ContentGenerator.pm,v 1.109 2004/06/24 20:54:19 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.
489 my $user = $r->param('user'); 489 my $user = $r->param('user');
490 490
491 # we're linking to other places in the same course, so grab the courseID from the current path 491 # we're linking to other places in the same course, so grab the courseID from the current path
492 my $courseID = $urlpath->arg("courseID"); 492 my $courseID = $urlpath->arg("courseID");
493 493
494 # some links are only available if you have the correct permissions.
495 my $PermissionLevel = $db->getPermissionLevel($r->param("user")); # checked
496 my $permLevel = $PermissionLevel ? $PermissionLevel->permission : 0;
497
498 # to make things more concise 494 # to make things more concise
499 my %args = ( courseID => $courseID ); 495 my %args = ( courseID => $courseID );
500 my $pfx = "WeBWorK::ContentGenerator::"; 496 my $pfx = "WeBWorK::ContentGenerator::";
501 497
502 my $sets = $urlpath->newFromModule("${pfx}ProblemSets", %args); 498 my $sets = $urlpath->newFromModule("${pfx}ProblemSets", %args);
513 CGI::a({href=>$self->systemLink($sets)}, PROBLEM_SETS))); 509 CGI::a({href=>$self->systemLink($sets)}, PROBLEM_SETS)));
514 print CGI::li(CGI::a({href=>$self->systemLink($options)}, OPTIONS)); 510 print CGI::li(CGI::a({href=>$self->systemLink($options)}, OPTIONS));
515 print CGI::li(CGI::a({href=>$self->systemLink($grades)}, GRADES)); 511 print CGI::li(CGI::a({href=>$self->systemLink($grades)}, GRADES));
516 print CGI::li(CGI::a({href=>$self->systemLink($logout)}, LOG_OUT)); 512 print CGI::li(CGI::a({href=>$self->systemLink($logout)}, LOG_OUT));
517 513
518 if ($permLevel > 0) { 514 if ($authz->hasPermissions($user, "access_instructor_tools")) {
519 my $ipfx = "${pfx}Instructor::"; 515 my $ipfx = "${pfx}Instructor::";
520 516
521 my $userID = $r->param("effectiveUser"); 517 my $userID = $r->param("effectiveUser");
522 my $setID = $urlpath->arg("setID"); 518 my $setID = $urlpath->arg("setID");
523 $setID = "" if (defined $setID && !(grep /$setID/, $db->listUserSets($userID))); 519 $setID = "" if (defined $setID && !(grep /$setID/, $db->listUserSets($userID)));
553 549
554 print CGI::hr(); 550 print CGI::hr();
555 print CGI::start_li(); 551 print CGI::start_li();
556 print CGI::span({style=>"font-size:larger"}, CGI::a({href=>$self->systemLink($instr)}, space2nbsp($instr->name))); 552 print CGI::span({style=>"font-size:larger"}, CGI::a({href=>$self->systemLink($instr)}, space2nbsp($instr->name)));
557 print CGI::start_ul(); 553 print CGI::start_ul();
558 #print CGI::li(CGI::a({href=>$self->systemLink($addUsers)}, ADD_USERS)); 554 #print CGI::li(CGI::a({href=>$self->systemLink($addUsers)}, ADD_USERS)) if $authz->hasPermissions($user, "modify_student_data");
559 print CGI::li(CGI::a({href=>$self->systemLink($userList)}, USER_LIST)); 555 print CGI::li(CGI::a({href=>$self->systemLink($userList)}, USER_LIST));
560 print CGI::start_li(); 556 print CGI::start_li();
561 print CGI::a({href=>$self->systemLink($setList)}, SET_LIST); 557 print CGI::a({href=>$self->systemLink($setList)}, SET_LIST);
562 if (defined $setID and $setID ne "") { 558 if (defined $setID and $setID ne "") {
563 print CGI::start_ul(); 559 print CGI::start_ul();
570 } 566 }
571 print CGI::end_li(); 567 print CGI::end_li();
572 print CGI::end_ul(); 568 print CGI::end_ul();
573 } 569 }
574 print CGI::end_li(); 570 print CGI::end_li();
575 print CGI::li(CGI::a({href=>$self->systemLink($maker)}, SET_MAKER)); 571 print CGI::li(CGI::a({href=>$self->systemLink($maker)}, SET_MAKER)) if $authz->hasPermissions($user, "modify_problem_sets");
576 print CGI::li(CGI::a({href=>$self->systemLink($assigner)}, ASSIGNER)); 572 print CGI::li(CGI::a({href=>$self->systemLink($assigner)}, ASSIGNER)) if $authz->hasPermissions($user, "assign_problem_sets");
577 573
578 574
579 print CGI::start_li(); 575 print CGI::start_li();
580 print CGI::a({href=>$self->systemLink($stats)}, STATS); 576 print CGI::a({href=>$self->systemLink($stats)}, STATS);
581 if (defined $userID and $userID ne "") { 577 if (defined $userID and $userID ne "") {
603 CGI::li(CGI::a({href=>$self->systemLink($setProgress)}, space2nbsp($setID))) 599 CGI::li(CGI::a({href=>$self->systemLink($setProgress)}, space2nbsp($setID)))
604 ); 600 );
605 } 601 }
606 print CGI::end_li(); 602 print CGI::end_li();
607 603
608 print CGI::li(CGI::a({href=>$self->systemLink($scoring)}, SCORING)); 604 print CGI::li(CGI::a({href=>$self->systemLink($scoring)}, SCORING)) if $authz->hasPermissions($user, "score_sets");
609 print CGI::li(CGI::a({href=>$self->systemLink($mail)}, MAIL)); 605 print CGI::li(CGI::a({href=>$self->systemLink($mail)}, MAIL)) if $authz->hasPermissions($user, "send_mail");
610 print CGI::li(CGI::a({href=>$self->systemLink($files)}, FILE_TRANSFER)); 606 print CGI::li(CGI::a({href=>$self->systemLink($files)}, FILE_TRANSFER));
611 print CGI::end_ul(); 607 print CGI::end_ul();
612 print CGI::end_li(); 608 print CGI::end_li();
613 } 609 }
614 610

Legend:
Removed from v.2390  
changed lines
  Added in v.2397

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9