[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface loncreateuser.pm
raeburn
raeburn@source.lon-capa.org
Mon, 11 Oct 2010 15:38:18 -0000
This is a MIME encoded message
--raeburn1286811498
Content-Type: text/plain
raeburn Mon Oct 11 15:38:18 2010 EDT
Modified files: (Branch: GCI_3)
/loncom/interface loncreateuser.pm
Log:
- Customization for GCI_3.
- Backport 1.351, 1.352.
--raeburn1286811498
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20101011153818.txt"
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.329.2.4 loncom/interface/loncreateuser.pm:1.329.2.5
--- loncom/interface/loncreateuser.pm:1.329.2.4 Sun Sep 19 16:44:44 2010
+++ loncom/interface/loncreateuser.pm Mon Oct 11 15:38:17 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.329.2.4 2010/09/19 16:44:44 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.329.2.5 2010/10/11 15:38:17 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -469,7 +469,7 @@
# =================================================================== Phase one
sub print_username_entry_form {
- my ($r,$context,$response,$srch,$forcenewuser,$crstype) = @_;
+ my ($r,$context,$response,$srch,$forcenewuser,$crstype,$brcrum) = @_;
my $defdom=$env{'request.role.domain'};
my $formtoset = 'crtuser';
my $is_custom = &Apache::loncommon::needs_gci_custom();
@@ -494,37 +494,42 @@
&& (&Apache::lonnet::allowed('mcr','/'))) {
$jscript .= &customrole_javascript();
}
- my %loaditems = (
- 'onload' => "javascript:setFormElements(document.$formtoset)",
- );
- my %breadcrumb_text = &singleuser_breadcrumb($crstype);
my $title = 'User Management';
if ($context eq 'course') {
if ($is_custom) {
$title = 'Enrollment and Student Activity';
}
}
- my $start_page =
- &Apache::loncommon::start_page($title,
- $jscript,{'add_entries' => \%loaditems,});
- if ($env{'form.action'} eq 'custom') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.crtuser)",
- text=>"Pick custom role",});
- } else {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.crtuser)",
- text=>$breadcrumb_text{'search'},
- faq=>282,bug=>'Instructor Interface',});
- }
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'custom') {
$helpitem = 'Course_Editing_Custom_Roles';
} elsif ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
}
- my $crumbs = &Apache::lonhtmlcommon::breadcrumbs($title,
- $helpitem);
+ my %breadcrumb_text = &singleuser_breadcrumb($crstype);
+ if ($env{'form.action'} eq 'custom') {
+ push(@{$brcrum},
+ {href=>"javascript:backPage(document.crtuser)",
+ text=>"Pick custom role",
+ help => $helpitem,}
+ );
+ } else {
+ push (@{$brcrum},
+ {href => "javascript:backPage(document.crtuser)",
+ text => $breadcrumb_text{'search'},
+ help => $helpitem,
+ faq => 282,
+ bug => 'Instructor Interface',}
+ );
+ }
+ my %loaditems = (
+ 'onload' => "javascript:setFormElements(document.$formtoset)",
+ );
+ my $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => 'User Management',
+ add_entries => \%loaditems,};
+ $r->print(&Apache::loncommon::start_page($title,$jscript,$args));
+
my %lt=&Apache::lonlocal::texthash(
'srst' => 'Search for a user and enroll as a student',
'srme' => 'Search for a user and enroll as a member',
@@ -535,7 +540,6 @@
'nr' => "role name",
'cre' => "Next",
);
- $r->print($start_page."\n".$crumbs);
if ($env{'form.action'} eq 'custom') {
if (&Apache::lonnet::allowed('mcr','/')) {
my $newroletext = &mt('Define new custom role:');
@@ -588,7 +592,6 @@
}
$r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response,$crstype));
}
- $r->print(&Apache::loncommon::end_page());
}
sub customrole_javascript {
@@ -758,7 +761,7 @@
# =================================================================== Phase two
sub print_user_selection_page {
- my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype) = @_;
+ my ($r,$response,$srch,$srch_results,$srcharray,$context,$opener_elements,$crstype,$brcrum) = @_;
my @fields = ('username','domain','lastname','firstname','permanentemail');
my $sortby = $env{'form.sortby'};
my $is_custom = &Apache::loncommon::needs_gci_custom();
@@ -806,25 +809,30 @@
$title = 'Enrollment and Student Activity';
}
}
- $r->print(&Apache::loncommon::start_page($title,$jscript));
-
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.usersrchform,'','')",
- text=>$breadcrumb_text{'search'},
- faq=>282,bug=>'Instructor Interface',},
- {href=>"javascript:backPage(document.usersrchform,'get_user_info','select')",
- text=>$breadcrumb_text{'userpicked'},
- faq=>282,bug=>'Instructor Interface',});
+ my $helpitem;
+ if ($env{'form.action'} eq 'singleuser') {
+ $helpitem = 'Course_Change_Privileges';
+ } elsif ($env{'form.action'} eq 'singlestudent') {
+ $helpitem = 'Course_Add_Student';
+ }
+ push (@{$brcrum},
+ {href => "javascript:backPage(document.usersrchform,'','')",
+ text => $breadcrumb_text{'search'},
+ faq => 282,
+ bug => 'Instructor Interface',},
+ {href => "javascript:backPage(document.usersrchform,'get_user_info','select')",
+ text => $breadcrumb_text{'userpicked'},
+ faq => 282,
+ bug => 'Instructor Interface',
+ help => $helpitem}
+ );
+ $r->print(&Apache::loncommon::start_page($title,$jscript,{bread_crumbs => $brcrum}));
if ($env{'form.action'} eq 'singleuser') {
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
- 'Course_Change_Privileges'));
$r->print("<b>$lt{'usrch'}</b><br />");
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
$r->print('<h3>'.$lt{'usel'}.'</h3>');
} elsif ($env{'form.action'} eq 'singlestudent') {
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
- 'Course_Add_Student'));
$r->print($jscript."<b>");
if ($crstype eq 'Community') {
$r->print($lt{'memsrch'});
@@ -906,7 +914,7 @@
}
sub print_user_query_page {
- my ($r,$caller) = @_;
+ my ($r,$caller,$brcrum) = @_;
# FIXME - this is for a network-wide name search (similar to catalog search)
# To use frames with similar behavior to catalog/portfolio search.
# To be implemented.
@@ -914,11 +922,11 @@
}
sub print_user_modification_page {
- my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype) = @_;
+ my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype,$brcrum) = @_;
if (($ccuname eq '') || ($ccdomain eq '')) {
my $usermsg = &mt('No username and/or domain provided.');
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$usermsg,'','',$crstype);
+ &print_username_entry_form($r,$context,$usermsg,'','',$crstype,$brcrum);
return;
}
my ($form,$formname);
@@ -977,7 +985,7 @@
.'</p><br />';
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,undef,undef,$crstype);
+ &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
return;
}
$newuser = 1;
@@ -1001,7 +1009,7 @@
'username');
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype);
+ &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum);
return;
}
}
@@ -1022,40 +1030,43 @@
my $js = &validation_javascript($context,$ccdomain,$pjump_def,
$groupslist,$newuser,$formname,\%loaditem);
- my $args = {'add_entries' => \%loaditem};
- if ($env{'form.popup'}) {
- $args->{'no_nav_bar'} = 1;
- }
my $title = 'User Management';
if ($context eq 'course') {
if ($is_custom) {
$title = 'Enrollment and Student Activity';
}
}
- my $start_page =
- &Apache::loncommon::start_page($title,$js,$args);
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage($form)",
- text=>$breadcrumb_text{'search'},
- faq=>282,bug=>'Instructor Interface',});
-
- if ($env{'form.phase'} eq 'userpicked') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage($form,'get_user_info','select')",
- text=>$breadcrumb_text{'userpicked'},
- faq=>282,bug=>'Instructor Interface',});
- }
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage($form,'$env{'form.phase'}','modify')",
- text=>$breadcrumb_text{'modify'},
- faq=>282,bug=>'Instructor Interface',});
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
}
- my $crumbs = &Apache::lonhtmlcommon::breadcrumbs($title,
- $helpitem);
+ push (@{$brcrum},
+ {href => "javascript:backPage($form)",
+ text => $breadcrumb_text{'search'},
+ faq => 282,
+ bug => 'Instructor Interface',});
+ if ($env{'form.phase'} eq 'userpicked') {
+ push(@{$brcrum},
+ {href => "javascript:backPage($form,'get_user_info','select')",
+ text => $breadcrumb_text{'userpicked'},
+ faq => 282,
+ bug => 'Instructor Interface',});
+ }
+ push(@{$brcrum},
+ {href => "javascript:backPage($form,'$env{'form.phase'}','modify')",
+ text => $breadcrumb_text{'modify'},
+ faq => 282,
+ bug => 'Instructor Interface',
+ help => $helpitem});
+ my $args = {'add_entries' => \%loaditem,
+ 'bread_crumbs' => $brcrum,
+ 'bread_crumbs_component' => 'User Management'};
+ if ($env{'form.popup'}) {
+ $args->{'no_nav_bar'} = 1;
+ }
+ my $start_page =
+ &Apache::loncommon::start_page($title,$js,$args);
my $forminfo =<<"ENDFORMINFO";
<form action="/adm/createuser" method="post" name="$formname">
@@ -1104,7 +1115,6 @@
);
$r->print(<<ENDTITLE);
$start_page
-$crumbs
$response
$forminfo
<script type="text/javascript" language="Javascript">
@@ -1218,7 +1228,6 @@
);
$r->print(<<ENDCHANGEUSER);
$start_page
-$crumbs
$forminfo
<h2>
ENDCHANGEUSER
@@ -1364,8 +1373,7 @@
}
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
$r->print('<input type="hidden" name="currstate" value="" />');
- $r->print('<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" />');
- $r->print("</form>".&Apache::loncommon::end_page());
+ $r->print('<input type="hidden" name="prevphase" value="'.$env{'form.phase'}.'" /></form>');
return;
}
@@ -2189,7 +2197,7 @@
# ================================================================= Phase Three
sub update_user_data {
- my ($r,$context,$crstype) = @_;
+ my ($r,$context,$crstype,$brcrum) = @_;
my $is_custom = &Apache::loncommon::needs_gci_custom();
my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},
$env{'form.ccdomain'});
@@ -2215,42 +2223,33 @@
'// ]]>'."\n".
'</script>'."\n";
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
- my $args;
- if ($env{'form.popup'}) {
- $args->{'no_nav_bar'} = 1;
- } else {
- $args = undef;
- }
- $r->print(&Apache::loncommon::start_page($title,$jscript,$args));
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.userupdate)",
- text=>$breadcrumb_text{'search'},
- faq=>282,bug=>'Instructor Interface',});
- if ($env{'form.prevphase'} eq 'userpicked') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.userupdate,'get_user_info','select')",
- text=>$breadcrumb_text{'userpicked'},
- faq=>282,bug=>'Instructor Interface',});
- }
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.userupdate,'$env{'form.prevphase'}','modify')",
- text=>$breadcrumb_text{'modify'},
- faq=>282,bug=>'Instructor Interface',},
- {href=>"/adm/createuser",
- text=>"Result",
- faq=>282,bug=>'Instructor Interface',});
my $helpitem = 'Course_Change_Privileges';
if ($env{'form.action'} eq 'singlestudent') {
$helpitem = 'Course_Add_Student';
}
- my $title = 'User Management';
+ my $bread_crumbs_component = 'User Management';
if ($context eq 'course') {
if ($is_custom) {
- $title = 'Enrollment and Student Activity';
+ $bread_crumbs_component = 'Enrollment and Student Activity';
}
}
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
- $helpitem));
+ push(@{$brcrum},
+ {href => "javascript:backPage(document.userupdate,'$env{'form.prevphase'}','modify')",
+ text => $breadcrumb_text{'modify'},
+ faq => 282,
+ bug => 'Instructor Interface',},
+ {href => "/adm/createuser",
+ text => "Result",
+ faq => 282,
+ bug => 'Instructor Interface',
+ help => $helpitem});
+ my $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ if ($env{'form.popup'}) {
+ $args->{'no_nav_bar'} = 1;
+ }
+ $r->print(&Apache::loncommon::start_page($title,$jscript,$args));
+
$r->print(&update_result_form($uhome));
# Check Inputs
if (! $env{'form.ccuname'} ) {
@@ -3045,7 +3044,6 @@
.&mt('Create/Modify Another User').'</a></p>');
}
}
- $r->print(&Apache::loncommon::end_page());
}
sub tool_changes {
@@ -3655,7 +3653,7 @@
# ========================================================== Custom Role Editor
sub custom_role_editor {
- my ($r) = @_;
+ my ($r,$brcrum) = @_;
my $action = $env{'form.customroleaction'};
my $rolename;
if ($action eq 'new') {
@@ -3664,11 +3662,6 @@
$rolename=$env{'form.rolename'};
}
- $rolename=~s/[^A-Za-z0-9]//gs;
- if (!$rolename || $env{'form.phase'} eq 'pickrole') {
- &print_username_entry_form($r);
- return;
- }
my ($crstype,$context);
if ($env{'request.course.id'}) {
$crstype = &Apache::loncommon::course_type();
@@ -3677,6 +3670,12 @@
$context = 'domain';
$crstype = $env{'form.templatecrstype'};
}
+
+ $rolename=~s/[^A-Za-z0-9]//gs;
+ if (!$rolename || $env{'form.phase'} eq 'pickrole') {
+ &print_username_entry_form($r,undef,undef,undef,undef,$crstype,$brcrum);
+ return;
+ }
my $is_custom = &Apache::loncommon::needs_gci_custom();
my $title = 'User Management';
if ($context eq 'course') {
@@ -3791,25 +3790,28 @@
$head_script .= "\n".$jsback."\n"
.'// ]]>'."\n"
.'</script>'."\n";
- $r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.form1,'pickrole','')",
- text=>"Pick custom role",
- faq=>282,bug=>'Instructor Interface',},
- {href=>"javascript:backPage(document.form1,'','')",
- text=>"Edit custom role",
- faq=>282,bug=>'Instructor Interface',});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
- 'Course_Editing_Custom_Roles'));
-
- $r->print($body_top);
+ push (@{$brcrum},
+ {href => "javascript:backPage(document.form1,'pickrole','')",
+ text => "Pick custom role",
+ faq => 282,bug=>'Instructor Interface',},
+ {href => "javascript:backPage(document.form1,'','')",
+ text => "Edit custom role",
+ faq => 282,
+ bug => 'Instructor Interface',
+ help => 'Course_Editing_Custom_Roles'}
+ );
+ my $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => 'User Management'};
+
+ $r->print(&Apache::loncommon::start_page('Custom Role Editor',
+ $head_script,$args).
+ $body_top);
my %lt=&Apache::lonlocal::texthash(
'prv' => "Privilege",
'crl' => "Course Level",
'dml' => "Domain Level",
'ssl' => "System Level");
-
$r->print('<div class="LC_left_float">'
.'<form action=""><fieldset>'
.'<legend>'.&mt('Select a Template').'</legend>'
@@ -3860,8 +3862,7 @@
'<input type="hidden" name="startrolename" value="'.$env{'form.rolename'}.
'" />'."\n".'<input type="hidden" name="currstate" value="" />'."\n".
'<input type="reset" value="'.&mt("Reset").'" />'."\n".
- '<input type="submit" value="'.&mt('Save').'" /></form>'.
- &Apache::loncommon::end_page());
+ '<input type="submit" value="'.&mt('Save').'" /></form>');
}
# --------------------------------------------------------
sub make_script_template {
@@ -3939,11 +3940,11 @@
}
# ---------------------------------------------------------- Call to definerole
sub set_custom_role {
- my ($r,$context) = @_;
+ my ($r,$context,$brcrum) = @_;
my $rolename=$env{'form.rolename'};
$rolename=~s/[^A-Za-z0-9]//gs;
if (!$rolename) {
- &custom_role_editor($r);
+ &custom_role_editor($r,$brcrum);
return;
}
my ($jsback,$elements) = &crumb_utilities();
@@ -3952,26 +3953,32 @@
.$jsback."\n"
.'// ]]>'."\n"
.'</script>'."\n";
- my $title = 'User Management';
+ my $bread_crumbs_component = 'User Management';
my $is_custom = &Apache::loncommon::needs_gci_custom();
if ($context eq 'course') {
if ($is_custom) {
- $title = 'Enrollment and Student Activity';
+ $bread_crumbs_component = 'Enrollment and Student Activity';
}
}
- $r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript);
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"javascript:backPage(document.customresult,'pickrole','')",
- text=>"Pick custom role",
- faq=>282,bug=>'Instructor Interface',},
- {href=>"javascript:backPage(document.customresult,'selected_custom_edit','')",
- text=>"Edit custom role",
- faq=>282,bug=>'Instructor Interface',},
- {href=>"javascript:backPage(document.customresult,'set_custom_roles','')",
- text=>"Result",
- faq=>282,bug=>'Instructor Interface',});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title,
- 'Course_Editing_Custom_Roles'));
+
+ push(@{$brcrum},
+ {href => "javascript:backPage(document.customresult,'pickrole','')",
+ text => "Pick custom role",
+ faq => 282,
+ bug => 'Instructor Interface',},
+ {href => "javascript:backPage(document.customresult,'selected_custom_edit','')",
+ text => "Edit custom role",
+ faq => 282,
+ bug => 'Instructor Interface',},
+ {href => "javascript:backPage(document.customresult,'set_custom_roles','')",
+ text => "Result",
+ faq => 282,
+ bug => 'Instructor Interface',
+ help => 'Course_Editing_Custom_Roles'},
+ );
+ my $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component };
+ $r->print(&Apache::loncommon::start_page('Save Custom Role',$jscript,$args));
my ($rdummy,$roledef)=
&Apache::lonnet::get('roles',["rolesdef_$rolename"]);
@@ -4028,7 +4035,6 @@
}
$r->print('<p><a href="javascript:backPage(document.customresult,'."'pickrole'".')">'.&mt('Create or edit another custom role').'</a></p><form name="customresult" method="post">');
$r->print(&Apache::lonhtmlcommon::echo_form_input([]).'</form>');
- $r->print(&Apache::loncommon::end_page());
}
# ================================================================ Main Handler
@@ -4059,11 +4065,14 @@
['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
&Apache::lonhtmlcommon::clear_breadcrumbs();
+ my $args;
+ my $brcrum = [];
+ my $bread_crumbs_component = $title;
if ($env{'form.action'} ne 'dateselect') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>"/adm/createuser",
- 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'});
+ $brcrum = [{href=>"/adm/createuser",
+ 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
#be missing: Course_Approve_Selfenroll,Course_User_Logs,
@@ -4081,17 +4090,20 @@
# Main switch on form.action and form.state, as appropriate
if (! exists($env{'form.action'})) {
- $r->print(&header());
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));
+ $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
$r->print(&print_main_menu($permission,$context,$crstype));
- $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
- $r->print(&header());
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=upload&state=',
- text=>"Upload Users List"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Upload Users List',
- 'Course_Create_Class_List'));
+ push(@{$brcrum},
+ { href => '/adm/createuser?action=upload&state=',
+ text => 'Upload Users List',
+ help => 'Course_Create_Class_List',
+ });
+ $bread_crumbs_component = 'Upload Users List';
+ $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
$r->print('<form name="studentform" method="post" '.
'enctype="multipart/form-data" '.
' action="/adm/createuser">'."\n");
@@ -4111,7 +4123,6 @@
} else {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
}
- $r->print('</form>'.&Apache::loncommon::end_page());
} elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
eq 'singlestudent')) && ($permission->{'cusr'})) {
my $phase = $env{'form.phase'};
@@ -4128,7 +4139,7 @@
if ($env{'form.srchterm'} !~ /^$match_username$/) {
my $response = '<p class="LC_warning">'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'</p>';
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,$srch,undef,$crstype);
+ &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum);
} else {
my $ccuname =&LONCAPA::clean_username($srch->{'srchterm'});
my $ccdomain=&LONCAPA::clean_domain($srch->{'srchdomain'});
@@ -4162,42 +4173,46 @@
}
&print_user_modification_page($r,$ccuname,$ccdomain,
$srch,$response,$context,
- $permission,$crstype);
+ $permission,$crstype,$brcrum);
} elsif ($currstate eq 'query') {
- &print_user_query_page($r,'createuser');
+ &print_user_query_page($r,'createuser',$brcrum);
} else {
$env{'form.phase'} = '';
&print_username_entry_form($r,$context,$response,$srch,
- $forcenewuser,$crstype);
+ $forcenewuser,$crstype,$brcrum);
}
} elsif ($env{'form.phase'} eq 'userpicked') {
my $ccuname = &LONCAPA::clean_username($env{'form.seluname'});
my $ccdomain = &LONCAPA::clean_domain($env{'form.seludom'});
&print_user_modification_page($r,$ccuname,$ccdomain,$srch,'',
- $context,$permission,$crstype);
+ $context,$permission,$crstype,$brcrum);
}
} elsif ($env{'form.phase'} eq 'update_user_data') {
- &update_user_data($r,$context,$crstype);
+ &update_user_data($r,$context,$crstype,$brcrum);
} else {
- &print_username_entry_form($r,$context,undef,$srch,undef,$crstype);
+ &print_username_entry_form($r,$context,undef,$srch,undef,$crstype,$brcrum);
}
} elsif ($env{'form.action'} eq 'custom' && $permission->{'custom'}) {
if ($env{'form.phase'} eq 'set_custom_roles') {
- &set_custom_role($r,$context);
+ &set_custom_role($r,$context,$brcrum);
} else {
- &custom_role_editor($r);
+ &custom_role_editor($r,$brcrum);
}
} elsif (($env{'form.action'} eq 'listusers') &&
($permission->{'view'} || $permission->{'cusr'})) {
if ($env{'form.phase'} eq 'bulkchange') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=listusers',
- text=>"List Users"},
- {href=>"/adm/createuser",
- text=>"Result"});
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=listusers',
+ text => "List Users"},
+ {href => "/adm/createuser",
+ text => "Result",
+ help => 'Course_View_Class_List'});
+ $bread_crumbs_component = 'Update Users';
+ $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
my $setting = $env{'form.roletype'};
my $choice = $env{'form.bulkaction'};
- $r->print(&header());
$r->print(&Apache::lonhtmlcommon::breadcrumbs("Update Users",
'Course_View_Class_List'));
if ($permission->{'cusr'}) {
@@ -4206,12 +4221,15 @@
} else {
$r->print(&mt('You are not authorized to make bulk changes to user roles'));
$r->print('<p><a href="/adm/createuser?action=listusers">'.&mt('Display User Lists').'</a>');
- $r->print(&Apache::loncommon::end_page());
}
} else {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=listusers',
- text=>"List Users"});
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=listusers',
+ text => "List Users",
+ help => 'Course_View_Class_List'});
+ $bread_crumbs_component = 'List Users';
+ $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
my ($cb_jscript,$jscript,$totcodes,$codetitles,$idlist,$idlist_titles);
my $formname = 'studentform';
if (($context eq 'domain') && (($env{'form.roletype'} eq 'course') ||
@@ -4232,130 +4250,137 @@
}
$jscript .= &verify_user_display();
my $js = &add_script($jscript).$cb_jscript;
- my $loadcode =
+ my $loadcode =
&Apache::lonuserutils::course_selector_loadcode($formname);
if ($loadcode ne '') {
- $r->print(&header($js,{'onload' => $loadcode,}));
- } else {
- $r->print(&header($js));
+ $args->{add_entries} = {onload => $loadcode};
}
+ $r->print(&header($js,$args));
} else {
- $r->print(&header(&add_script(&verify_user_display())));
+ $r->print(&header(&add_script(&verify_user_display()),$args));
}
- $r->print(&Apache::lonhtmlcommon::breadcrumbs("List Users",
- 'Course_View_Class_List'));
&Apache::lonuserutils::print_userlist($r,undef,$permission,$context,
$formname,$totcodes,$codetitles,$idlist,$idlist_titles);
- $r->print(&Apache::loncommon::end_page());
}
} elsif ($env{'form.action'} eq 'drop' && $permission->{'cusr'}) {
- $r->print(&header());
my $brtext;
if ($crstype eq 'Community') {
$brtext = 'Drop Members';
} else {
$brtext = 'Drop Students';
}
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=drop',
- text=>$brtext});
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=drop',
+ text => $brtext,
+ help => 'Course_Drop_Student'});
+ if ($env{'form.state'} eq 'done') {
+ push(@{$brcrum},
+ {href=>'/adm/createuser?action=drop',
+ text=>"Result"});
+ }
+ $bread_crumbs_component = $brtext;
+ $args = {bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
if (!exists($env{'form.state'})) {
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($brtext,
- 'Course_Drop_Student'));
-
&Apache::lonuserutils::print_drop_menu($r,$context,$permission,$crstype);
} elsif ($env{'form.state'} eq 'done') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=drop',
- text=>"Result"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($brtext,
- 'Course_Drop_Student'));
&Apache::lonuserutils::update_user_list($r,$context,undef,
$env{'form.action'});
}
- $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'dateselect') {
if ($permission->{'cusr'}) {
$r->print(&header(undef,undef,{'no_nav_bar' => 1}).
&Apache::lonuserutils::date_section_selector($context,
- $permission,$crstype).
- &Apache::loncommon::end_page());
+ $permission,$crstype));
} else {
$r->print(&header().
- '<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>'.
- &Apache::loncommon::end_page());
+ '<span class="LC_error">'.&mt('You do not have permission to modify dates or sections for users').'</span>');
}
} elsif ($env{'form.action'} eq 'selfenroll') {
- $r->print(&header());
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=selfenroll',
- text=>"Configure Self-enrollment"});
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=selfenroll',
+ text => "Configure Self-enrollment",
+ help => 'Course_Self_Enrollment'});
if (!exists($env{'form.state'})) {
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Configure Self-enrollment',
- 'Course_Self_Enrollment'));
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => 'Configure Self-enrollment'};
+ $r->print(&header(undef,$args));
$r->print('<h3>'.&mt('Self-enrollment with a student role').'</h3>'."\n");
&print_selfenroll_menu($r,$context,$permission);
} elsif ($env{'form.state'} eq 'done') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=selfenroll',
- text=>"Result"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enrollment result',
- 'Course_Self_Enrollment'));
+ push (@{$brcrum},
+ {href=>'/adm/createuser?action=selfenroll',
+ text=>"Result"});
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => 'Self-enrollment result'};
+ $r->print(&header(undef,$args));
$r->print('<h3>'.&mt('Self-enrollment with a student role').'</h3>'."\n");
&update_selfenroll_config($r,$context,$permission);
}
- $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'selfenrollqueue') {
- $r->print(&header());
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=selfenrollqueue',
- text=>"Enrollment requests"});
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=selfenrollqueue',
+ text => 'Enrollment requests',
+ help => 'Course_Self_Enrollment'});
+ $bread_crumbs_component = 'Enrollment requests';
+ if ($env{'form.state'} eq 'done') {
+ push(@{$brcrum},
+ {href => '/adm/createuser?action=selfenrollqueue',
+ text => 'Result',
+ help => 'Course_Self_Enrollment'});
+ $bread_crumbs_component = 'Enrollment result';
+ }
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
my $cid = $env{'request.course.id'};
my $cdom = $env{'course.'.$cid.'.domain'};
my $cnum = $env{'course.'.$cid.'.num'};
my $coursedesc = $env{'course.'.$cid.'.description'};
if (!exists($env{'form.state'})) {
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment requests',
- 'Course_SelfEnrollment_Approval'));
$r->print('<h3>'.&mt('Pending enrollment requests').'</h3>'."\n");
$r->print(&Apache::loncoursequeueadmin::display_queued_requests($context,
$cdom,$cnum));
} elsif ($env{'form.state'} eq 'done') {
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=selfenrollqueue',
- text=>"Result"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('Enrollment result',
- 'Course_Self_Enrollment'));
$r->print('<h3>'.&mt('Enrollment request processing').'</h3>'."\n");
$r->print(&Apache::loncoursequeueadmin::update_request_queue($context,
$cdom,$cnum,$coursedesc));
}
- $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'changelogs') {
- $r->print(&header());
- &Apache::lonhtmlcommon::add_breadcrumb
- ({href=>'/adm/createuser?action=changelogs',
- text=>"User Management Logs"});
- $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Changes',
- 'Course_User_Logs'));
- &print_userchangelogs_display($r,$context,$permission);
- $r->print(&Apache::loncommon::end_page());
+ push (@{$brcrum},
+ {href => '/adm/createuser?action=changelogs',
+ text => 'User Management Logs',
+ help => 'Course_User_Logs'});
+ $bread_crumbs_component = 'User Changes';
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
+ &print_userchangelogs_display($r,$context,$permission);
} else {
- $r->print(&header());
- $r->print(&Apache::lonhtmlcommon::breadcrumbs($title));
+ $args = { bread_crumbs => $brcrum,
+ bread_crumbs_component => $bread_crumbs_component};
+ $r->print(&header(undef,$args));
$r->print(&print_main_menu($permission,$context,$crstype));
- $r->print(&Apache::loncommon::end_page());
}
+ $r->print(&Apache::loncommon::end_page());
return OK;
}
sub header {
- my ($jscript,$loaditems,$args) = @_;
+ my ($jscript,$args) = @_;
+ my $title = 'User Management';
+ my $is_custom = &Apache::loncommon::needs_gci_custom();
+ if ($env{'request.course.id'}) {
+ if ($is_custom) {
+ $title = 'Enrollment and Student Activity';
+ }
+ }
my $start_page;
- if (ref($loaditems) eq 'HASH') {
- $start_page=&Apache::loncommon::start_page('User Management',$jscript,{'add_entries' => $loaditems});
+ if (ref($args) eq 'HASH') {
+ $start_page=&Apache::loncommon::start_page($title,$jscript,$args);
} else {
- $start_page=&Apache::loncommon::start_page('User Management',$jscript,$args);
+ $start_page=&Apache::loncommon::start_page($title,$jscript);
}
return $start_page;
}
--raeburn1286811498--