[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface loncreateuser.pm
raeburn
raeburn@source.lon-capa.org
Mon, 08 Nov 2010 19:52:02 -0000
raeburn Mon Nov 8 19:52:02 2010 EDT
Modified files: (Branch: GCI_3)
/loncom/interface loncreateuser.pm
Log:
- Customization for GCI_3.
- caller form element renamed context.
- display course request breadcrumbs when file upload of users
occurs during course request.
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.329.2.5 loncom/interface/loncreateuser.pm:1.329.2.6
--- loncom/interface/loncreateuser.pm:1.329.2.5 Mon Oct 11 15:38:17 2010
+++ loncom/interface/loncreateuser.pm Mon Nov 8 19:52:01 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.329.2.5 2010/10/11 15:38:17 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.329.2.6 2010/11/08 19:52:01 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -70,6 +70,7 @@
use Apache::longroup;
use Apache::lonuserutils;
use Apache::loncoursequeueadmin;
+use Apache::lonrequestcourse;
use LONCAPA qw(:DEFAULT :match);
my $loginscript; # piece of javascript used in two separate instances
@@ -4054,6 +4055,18 @@
} else {
$context = 'domain';
}
+ my ($permission,$allowed) =
+ &Apache::lonuserutils::get_permission($context,$crstype);
+ if (!$allowed) {
+ $env{'user.error.msg'}=
+ "/adm/createuser:cst:0:0:Cannot create/modify user data ".
+ "or view user status.";
+ return HTTP_NOT_ACCEPTABLE;
+ }
+
+ &Apache::loncommon::content_type($r,'text/html');
+ $r->send_http_header;
+
my $title = 'User Management';
my $is_custom = &Apache::loncommon::needs_gci_custom();
if ($context eq 'course') {
@@ -4068,7 +4081,15 @@
my $args;
my $brcrum = [];
my $bread_crumbs_component = $title;
- if ($env{'form.action'} ne 'dateselect') {
+ if ($env{'form.context'} eq 'requestcrs') {
+ my $reqstate = 'uploadroster';
+ if ($env{'form.state'} eq 'enrolling') {
+ $reqstate = 'enrolling';
+ }
+ unless (&Apache::lonrequestcourse::generate_page($r,'new',$reqstate)) {
+ return OK;
+ }
+ } elsif ($env{'form.action'} ne 'dateselect') {
$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'}
@@ -4076,17 +4097,6 @@
}
#SD Following files not added to help, because the corresponding .tex-files seem to
#be missing: Course_Approve_Selfenroll,Course_User_Logs,
- my ($permission,$allowed) =
- &Apache::lonuserutils::get_permission($context,$crstype);
- if (!$allowed) {
- $env{'user.error.msg'}=
- "/adm/createuser:cst:0:0:Cannot create/modify user data ".
- "or view user status.";
- return HTTP_NOT_ACCEPTABLE;
- }
-
- &Apache::loncommon::content_type($r,'text/html');
- $r->send_http_header;
# Main switch on form.action and form.state, as appropriate
if (! exists($env{'form.action'})) {
@@ -4095,34 +4105,51 @@
$r->print(&header(undef,$args));
$r->print(&print_main_menu($permission,$context,$crstype));
} elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
- 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");
+ unless ($env{'form.context'} eq 'requestcrs') {
+ 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));
+ }
+ unless (($env{'form.context'} eq 'requestcrs') && ($env{'form.state'} eq 'enrolling')) {
+ $r->print('<form name="studentform" method="post" '.
+ 'enctype="multipart/form-data" '.
+ ' action="/adm/createuser">'."\n");
+ }
if (! exists($env{'form.state'})) {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
} elsif ($env{'form.state'} eq 'got_file') {
my $formname;
- if ($env{'form.caller'} eq 'requestcrs') {
+ if ($env{'form.context'} eq 'requestcrs') {
$formname = 'studentform';
}
&Apache::lonuserutils::print_upload_manager_form($r,$context,
$permission,$crstype,$formname);
+ if ($env{'form.context'} eq 'requestcrs') {
+ $r->print('<input type="hidden" name="concepttest" value="'.$env{'form.concepttest'}.'" />');
+ }
} elsif ($env{'form.state'} eq 'enrolling') {
if ($env{'form.datatoken'}) {
&Apache::lonuserutils::upfile_drop_add($r,$context,$permission);
+ if ($env{'form.context'} eq 'requestcrs') {
+ $r->print('<br /><hr />'.
+ '<form name="requestcrs" method="post" action="/adm/requestcourse">'.
+ '<input type="hidden" name="context" value="'.$env{'form.context'}.'" />'.
+ '<input type="hidden" name="concepttest" value="'.$env{'form.concepttest'}.'" />'.
+ '<input type="hidden" name="reqaction" value="new" />'.
+ '<input type="hidden" name="state" value="'.$env{'form.state'}.'" />'.
+ &Apache::lonrequestcourse::done_display());
+ }
}
} else {
&Apache::lonuserutils::print_first_users_upload_form($r,$context);
}
+ $r->print('</form>');
} elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
eq 'singlestudent')) && ($permission->{'cusr'})) {
my $phase = $env{'form.phase'};