'.
&Apache::loncommon::end_data_table_header_row());
- foreach my $type ('Construction Space','Course','Community','Domain','System','Unknown') {
- if ($output{$type}) {
- $r->print($output{$type}."\n");
- }
+ foreach my $type ('Construction Space','Course','Community','Domain','System','Unknown') {
+ if ($output{$type}) {
+ $r->print($output{$type}."\n");
}
- $r->print(&Apache::loncommon::end_data_table());
}
- } # End of check for keys in rolesdump
+ $r->print(&Apache::loncommon::end_data_table());
+ }
return;
}
@@ -2137,7 +2222,13 @@ sub update_user_data {
if ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
}
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ my $title = 'User Management';
+ if ($context eq 'course') {
+ if (&Apache::loncommon::needs_gci_custom()) {
+ $title = 'Enrollment and Student Activity';
+ }
+ }
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
$helpitem));
$r->print(&update_result_form($uhome));
# Check Inputs
@@ -3564,6 +3655,12 @@ sub custom_role_editor {
$context = 'domain';
$crstype = $env{'form.templatecrstype'};
}
+ my $title = 'User Management';
+ if ($context eq 'course') {
+ if (&Apache::loncommon::needs_gci_custom()) {
+ $title = 'Enrollment and Student Activity';
+ }
+ }
# ------------------------------------------------------- What can be assigned?
my %full=();
my %courselevel=();
@@ -3679,7 +3776,7 @@ sub custom_role_editor {
{href=>"javascript:backPage(document.form1,'','')",
text=>"Edit custom role",
faq=>282,bug=>'Instructor Interface',});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
'Course_Editing_Custom_Roles'));
$r->print($body_top);
@@ -3832,7 +3929,12 @@ sub set_custom_role {
.$jsback."\n"
.'// ]]>'."\n"
.''."\n";
-
+ my $title = 'User Management';
+ if ($context eq 'course') {
+ if (&Apache::loncommon::needs_gci_custom()) {
+ $title = 'Enrollment and Student Activity';
+ }
+ }
$r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"javascript:backPage(document.customresult,'pickrole','')",
@@ -3844,7 +3946,7 @@ sub set_custom_role {
{href=>"javascript:backPage(document.customresult,'set_custom_roles','')",
text=>"Result",
faq=>282,bug=>'Instructor Interface',});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
'Course_Editing_Custom_Roles'));
my ($rdummy,$roledef)=
@@ -3922,6 +4024,12 @@ sub handler {
} else {
$context = 'domain';
}
+ my $title = 'User Management';
+ if ($context eq 'course') {
+ if (&Apache::loncommon::needs_gci_custom()) {
+ $title = 'Enrollment and Student Activity';
+ }
+ }
&Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
@@ -3929,7 +4037,7 @@ sub handler {
if ($env{'form.action'} ne 'dateselect') {
&Apache::lonhtmlcommon::add_breadcrumb
({href=>"/adm/createuser",
- text=>"User Management",
+ text=>$title,
help=>'Course_Create_Class_List,Course_Change_Privileges,Course_View_Class_List,Course_Editing_Custom_Roles,Course_Add_Student,Course_Drop_Student,Course_Automated_Enrollment,Course_Self_Enrollment,Course_Manage_Group'});
}
#SD Following files not added to help, because the corresponding .tex-files seem to
@@ -3949,7 +4057,7 @@ sub handler {
# Main switch on form.action and form.state, as appropriate
if (! exists($env{'form.action'})) {
$r->print(&header());
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));
$r->print(&print_main_menu($permission,$context,$crstype));
$r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
@@ -4205,7 +4313,7 @@ sub handler {
$r->print(&Apache::loncommon::end_page());
} else {
$r->print(&header());
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));
$r->print(&print_main_menu($permission,$context,$crstype));
$r->print(&Apache::loncommon::end_page());
}
@@ -4251,6 +4359,9 @@ END
# Menu Phase One
sub print_main_menu {
my ($permission,$context,$crstype) = @_;
+ if (($context eq 'course') && (&Apache::loncommon::needs_gci_custom())) {
+ return &print_gci_main_menu($permission,$context,$crstype)
+ }
my $linkcontext = $context;
my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));
if (($context eq 'course') && ($crstype eq 'Community')) {
@@ -4472,6 +4583,82 @@ return Apache::lonhtmlcommon::generate_m
# });
}
+sub print_gci_main_menu {
+ my ($permission,$context,$crstype) = @_;
+ my $stuterm = lc(&Apache::lonnet::plaintext('st',$crstype));
+ my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
+ my %links = (
+ course => {
+ single => 'Add/Modify a Student',
+ drop => 'Drop Students',
+ upload => 'Upload a File of Course Users',
+ singleuser => 'Add/Modify a Course User',
+ listusers => 'Concept Test Roster and Student Activity',
+ },
+ );
+ my %linktitles = (
+ course => {
+ singleuser => 'Add a user with a certain role to this course.',
+ listusers => 'Show and manage users in this course.',
+ single => 'Add a user with the role of student to this course',
+ drop => 'Remove a student from this course.',
+ upload => 'Upload a CSV or a text file containing users.',
+ },
+ );
+ my @menu = ( {categorytitle => 'Manage Users',
+ items =>
+ [
+ {
+ linktext => $links{$context}{'single'},
+ #help => 'Course_Add_Student',
+ icon => 'list-add.png',
+ url => '/adm/createuser?action=singlestudent',
+ permission => $permission->{'cusr'},
+ linktitle => $linktitles{$context}{'single'},
+
+ },
+ {
+ linktext => $links{$context}{'drop'},
+ icon => 'edit-undo.png',
+ #help => 'Course_Drop_Student',
+ url => '/adm/createuser?action=drop',
+ permission => $permission->{'cusr'},
+ linktitle => $linktitles{$context}{'drop'},
+ },
+ {
+ linktext => $links{$context}{'upload'},
+ icon => 'sctr.png',
+ #help => 'Course_Create_Class_List',
+ url => '/adm/createuser?action=upload',
+ permission => $permission->{'cusr'},
+ linktitle => $linktitles{$context}{'upload'},
+ },
+ {
+ linktext => $links{$context}{'listusers'},
+ icon => 'edit-find.png',
+ #help => 'Course_View_Class_List',
+ url => '/adm/createuser?action=listusers',
+ permission => ($permission->{'view'} || $permission->{'cusr'}),
+ linktitle => $linktitles{$context}{'listusers'},
+ },
+ ]},
+ {categorytitle => 'Administration',
+ items => [ ]},
+ );
+
+ push(@{ $menu[1]->{items} }, #Category: Administration
+ {
+ linktext => 'Change Log',
+ icon => 'document-properties.png',
+ #help => 'Course_User_Logs',
+ url => '/adm/createuser?action=changelogs',
+ permission => $permission->{'cusr'},
+ linktitle => 'View change log.',
+ },
+ );
+ return Apache::lonhtmlcommon::generate_menu(@menu);
+}
+
sub restore_prev_selections {
my %saveable_parameters = ('srchby' => 'scalar',
'srchin' => 'scalar',
@@ -5436,16 +5623,7 @@ sub role_display_filter {
# Update Display button
$output .= '
'
.''
- .'
';
-
- # Server version info
- $output .= '
'
- .&mt('Only changes made from servers running LON-CAPA [_1] or later are displayed.'
- ,'2.6.99.0');
- if ($version) {
- $output .= ' '.&mt('This LON-CAPA server is version [_1]',$version);
- }
- $output .= '
';
+ .'';
return $output;
}
@@ -5976,10 +6154,11 @@ sub course_level_table {
'end' => "End"
);
- foreach my $protectedcourse (sort( keys(%inccourses))) {
+ foreach my $protectedcourse (sort(keys(%inccourses))) {
my $thiscourse=$protectedcourse;
$thiscourse=~s:_:/:g;
my %coursedata=&Apache::lonnet::coursedescription($thiscourse);
+ my $isowner = &is_courseowner($protectedcourse,$coursedata{'internal.courseowner'});
my $area=$coursedata{'description'};
my $crstype=$coursedata{'type'};
if (!defined($area)) { $area=&mt('Unavailable course').': '.$protectedcourse; }
@@ -5994,9 +6173,10 @@ sub course_level_table {
my @roles = &Apache::lonuserutils::roles_by_context('course','',$crstype);
foreach my $role (@roles) {
my $plrole=&Apache::lonnet::plaintext($role,$crstype);
- if (&Apache::lonnet::allowed('c'.$role,$thiscourse)) {
+ if ((&Apache::lonnet::allowed('c'.$role,$thiscourse)) ||
+ ((($role eq 'cc') || ($role eq 'co')) && ($isowner))) {
$table .= &course_level_row($protectedcourse,$role,$area,$domain,
- $plrole,\%sections_count,\%lt);
+ $plrole,\%sections_count,\%lt);
} elsif ($env{'request.course.sec'} ne '') {
if (&Apache::lonnet::allowed('c'.$role,$thiscourse.'/'.
$env{'request.course.sec'})) {
@@ -6499,6 +6679,21 @@ sub get_selfenroll_titles {
return (\@row,\%lt);
}
+sub is_courseowner {
+ my ($thiscourse,$courseowner) = @_;
+ if ($courseowner eq '') {
+ if ($env{'request.course.id'} eq $thiscourse) {
+ $courseowner = $env{'course.'.$env{'request.course.id'}.'.internal.courseowner'};
+ }
+ }
+ if ($courseowner ne '') {
+ if ($courseowner eq $env{'user.name'}.':'.$env{'user.domain'}) {
+ return 1;
+ }
+ }
+ return;
+}
+
#---------------------------------------------- end functions for &phase_two
#--------------------------------- functions for &phase_two and &phase_three