version 1.212, 2007/12/21 05:40:43
|
version 1.213, 2007/12/21 12:41:25
|
Line 249 sub print_username_entry_form {
|
Line 249 sub print_username_entry_form {
|
); |
); |
my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface'); |
my $help = &Apache::loncommon::help_open_menu(undef,undef,282,'Instructor Interface'); |
my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges'); |
my $helpsiur=&Apache::loncommon::help_open_topic('Course_Change_Privileges'); |
|
my $helpsist=&Apache::loncommon::help_open_topic('Course_Add_Student'); |
my $helpecpr=&Apache::loncommon::help_open_topic('Course_Editing_Custom_Roles'); |
my $helpecpr=&Apache::loncommon::help_open_topic('Course_Editing_Custom_Roles'); |
my $sellink=&Apache::loncommon::selectstudent_link('crtuser','srchterm','srchdomain'); |
my $sellink=&Apache::loncommon::selectstudent_link('crtuser','srchterm','srchdomain'); |
if ($sellink) { |
if ($sellink) { |
Line 272 $lt{'nr'}: $choice <input type="text" si
|
Line 273 $lt{'nr'}: $choice <input type="text" si
|
</form> |
</form> |
ENDCUSTOM |
ENDCUSTOM |
} |
} |
|
} else { |
|
my $actiontext = $lt{'mod'}.$helpsiur; |
|
if ($env{'form.action'} eq 'singlestudent') { |
|
$actiontext = $lt{'enrl'}.$helpsist; |
|
} |
|
$r->print(" |
|
<h3>$lt{'srch'} $sellink $actiontext</h3>"); |
|
if ($env{'form.origform'} ne 'crtusername') { |
|
$r->print("\n".$response); |
|
} |
|
$r->print(&entry_form($defdom,$srch,$forcenewuser,$context,$response)); |
} |
} |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
Line 478 sub print_user_modification_page {
|
Line 490 sub print_user_modification_page {
|
&print_username_entry_form($r,$context,$usermsg); |
&print_username_entry_form($r,$context,$usermsg); |
return; |
return; |
} |
} |
|
my ($form,$formname); |
|
if ($env{'form.action'} eq 'singlestudent') { |
|
$form = 'document.enrollstudent'; |
|
$formname = 'enrollstudent'; |
|
} else { |
|
$form = 'document.cu'; |
|
$formname = 'cu'; |
|
} |
my %abv_auth = &auth_abbrev(); |
my %abv_auth = &auth_abbrev(); |
my ($curr_authtype,%rulematch,%inst_results,$curr_kerb_ver,$newuser, |
my ($curr_authtype,%rulematch,%inst_results,$curr_kerb_ver,$newuser, |
%alerts,%curr_rules,%got_rules); |
%alerts,%curr_rules,%got_rules); |
Line 721 ENDFORMINFO
|
Line 741 ENDFORMINFO
|
&initialize_authen_forms($ccdomain); |
&initialize_authen_forms($ccdomain); |
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'cnu' => 'Create New User', |
'cnu' => 'Create New User', |
|
'ast' => 'as a student', |
'ind' => 'in domain', |
'ind' => 'in domain', |
'lg' => 'Login Data', |
'lg' => 'Login Data', |
'hs' => "Home Server", |
'hs' => "Home Server", |
Line 736 $loginscript
|
Line 757 $loginscript
|
<input type='hidden' name='makeuser' value='1' /> |
<input type='hidden' name='makeuser' value='1' /> |
<h2>$lt{'cnu'} "$ccuname" $lt{'ind'} $ccdomain</h2> |
<h2>$lt{'cnu'} "$ccuname" $lt{'ind'} $ccdomain</h2> |
ENDTITLE |
ENDTITLE |
$r->print('<div class="LC_left_float">'); |
if ($env{'form.action'} eq 'singlestudent') { |
|
$r->print(' ('.$lt{'ast'}.')'); |
|
} |
|
$r->print('</h2>'."\n".'<div class="LC_left_float">'); |
my $personal_table = |
my $personal_table = |
&personal_data_display($ccuname,$ccdomain,$newuser,$context, |
&personal_data_display($ccuname,$ccdomain,$newuser,$context, |
$inst_results{$ccuname.':'.$ccdomain}); |
$inst_results{$ccuname.':'.$ccdomain}); |
Line 802 ENDAUTH
|
Line 826 ENDAUTH
|
} else { |
} else { |
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc)); |
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc)); |
} |
} |
$r->print(<<ENDPORT); |
$r->print('</h2>'."\n".'<div class="LC_left_float">'); |
$portfolioform |
} else { # user already exist- |
</div><div class="LC_clear_float_footer"></div> |
|
ENDPORT |
|
} else { # user already exists |
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'cup' => "Modify existing user: ", |
'cup' => "Modify existing user: ", |
|
'ens' => "Enroll one student: ", |
'id' => "in domain", |
'id' => "in domain", |
); |
); |
$r->print(<<ENDCHANGEUSER); |
$r->print(<<ENDCHANGEUSER); |
$start_page |
$start_page |
$crumbs |
$crumbs |
$forminfo |
$forminfo |
<h2>$lt{'cup'} "$ccuname" $lt{'id'} "$ccdomain"</h2> |
<h2> |
ENDCHANGEUSER |
ENDCHANGEUSER |
$r->print('<div class="LC_left_float">'); |
if ($env{'form.action'} eq 'singlestudent') { |
|
$r->print($lt{'ens'}); |
|
} else { |
|
$r->print($lt{'cup'}); |
|
} |
|
$r->print(' "'.$ccuname.'" '.$lt{'id'}.' "'.$ccdomain.'"</h2>'. |
|
"\n".'<div class="LC_left_float">'); |
my ($personal_table,$showforceid) = |
my ($personal_table,$showforceid) = |
&personal_data_display($ccuname,$ccdomain,$newuser,$context, |
&personal_data_display($ccuname,$ccdomain,$newuser,$context, |
$inst_results{$ccuname.':'.$ccdomain}); |
$inst_results{$ccuname.':'.$ccdomain}); |
Line 852 ENDNOPORTPRIV
|
Line 880 ENDNOPORTPRIV
|
if ($user_quota_text ne '') { |
if ($user_quota_text ne '') { |
$r->print($user_quota_text); |
$r->print($user_quota_text); |
} |
} |
$r->print('</div>'); |
if ($env{'form.action'} eq 'singlestudent') { |
|
$r->print(&date_sections_select($context,$newuser,$formname)); |
|
} |
} elsif ($user_quota_text ne '') { |
} elsif ($user_quota_text ne '') { |
$r->print('<div class="LC_left_float">'.$user_quota_text.'</div>'); |
$r->print('<div class="LC_left_float">'.$user_quota_text); |
|
if ($env{'form.action'} eq 'singlestudent') { |
|
$r->print(&date_sections_select($context,$newuser,$formname)); |
|
} |
|
} else { |
|
if ($env{'form.action'} eq 'singlestudent') { |
|
$r->print('<div class="LC_left_float">'. |
|
&date_sections_select($context,$newuser,$formname)); |
|
} |
} |
} |
$r->print('<div class="LC_clear_float_footer"></div>'); |
$r->print('</div><div class="LC_clear_float_footer"></div>'); |
my %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname); |
my %rolesdump=&Apache::lonnet::dump('roles',$ccdomain,$ccuname); |
# Build up table of user roles to allow revocation of a role. |
# Build up table of user roles to allow revocation of a role. |
my ($tmp) = keys(%rolesdump); |
my ($tmp) = keys(%rolesdump); |
Line 1186 ENDNOPORTPRIV
|
Line 1223 ENDNOPORTPRIV
|
$r->print("</form>".&Apache::loncommon::end_page()); |
$r->print("</form>".&Apache::loncommon::end_page()); |
} |
} |
|
|
|
sub singleuser_breadcrumb { |
|
my %breadcrumb_text; |
|
if ($env{'form.action'} eq 'singlestudent') { |
|
$breadcrumb_text{'search'} = 'Enroll a student'; |
|
$breadcrumb_text{'userpicked'} = 'Select a user', |
|
$breadcrumb_text{'modify'} = 'Set section/dates', |
|
} else { |
|
$breadcrumb_text{'search'} = 'Create/modify user'; |
|
$breadcrumb_text{'userpicked'} = 'Select a user', |
|
$breadcrumb_text{'modify'} = 'Set user role', |
|
} |
|
return %breadcrumb_text; |
|
} |
|
|
|
sub date_sections_select { |
|
my ($context,$newuser,$formname,$permission) = @_; |
|
my $cid = $env{'request.course.id'}; |
|
my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity($cid); |
|
my $date_table = '<h3>'.&mt('Starting and Ending Dates').'</h3>'."\n". |
|
&Apache::lonuserutils::date_setting_table(undef,undef,$context, |
|
undef,$formname,$permission); |
|
my $rowtitle = 'Section'; |
|
my $secbox = '<h3>'.&mt('Section').'</h3>'."\n". |
|
&Apache::lonuserutils::section_picker($cdom,$cnum,'st',$rowtitle, |
|
$permission); |
|
my $output = $date_table.$secbox; |
|
return $output; |
|
} |
|
|
sub user_authentication { |
sub user_authentication { |
my ($ccuname,$ccdomain,$krbdefdom,$abv_auth) = @_; |
my ($ccuname,$ccdomain,$krbdefdom,$abv_auth) = @_; |
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
my $currentauth=&Apache::lonnet::queryauthenticate($ccuname,$ccdomain); |
Line 1459 sub update_user_data {
|
Line 1525 sub update_user_data {
|
} else { |
} else { |
$title='Modify User Privileges'; |
$title='Modify User Privileges'; |
} |
} |
|
my $newuser = 0; |
my ($jsback,$elements) = &crumb_utilities(); |
my ($jsback,$elements) = &crumb_utilities(); |
my $jscript = '<script type="text/javascript">'."\n". |
my $jscript = '<script type="text/javascript">'."\n". |
$jsback."\n".'</script>'."\n"; |
$jsback."\n".'</script>'."\n"; |
|
my %breadcrumb_text = &singleuser_breadcrumb(); |
$r->print(&Apache::loncommon::start_page($title,$jscript)); |
$r->print(&Apache::loncommon::start_page($title,$jscript)); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.userupdate)", |
({href=>"javascript:backPage(document.userupdate)", |
text=>"Create/modify user", |
text=>$breadcrumb_text{'search'}, |
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
if ($env{'form.prevphase'} eq 'userpicked') { |
if ($env{'form.prevphase'} eq 'userpicked') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.userupdate,'get_user_info','select')", |
({href=>"javascript:backPage(document.userupdate,'get_user_info','select')", |
text=>"Select a user", |
text=>$breadcrumb_text{'userpicked'}, |
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
Line 1632 sub update_user_data {
|
Line 1698 sub update_user_data {
|
} |
} |
} |
} |
## |
## |
|
my (@userroles,%userupdate,$cnum,$cdom,$namechanged); |
|
if ($context eq 'course') { |
|
($cnum,$cdom) = &Apache::lonuserutils::get_course_identity(); |
|
} |
if (! $env{'form.makeuser'} ) { |
if (! $env{'form.makeuser'} ) { |
# Check for need to change |
# Check for need to change |
my %userenv = &Apache::lonnet::get |
my %userenv = &Apache::lonnet::get |
Line 1647 sub update_user_data {
|
Line 1717 sub update_user_data {
|
my %domconfig = |
my %domconfig = |
&Apache::lonnet::get_dom('configuration',['usermodification'], |
&Apache::lonnet::get_dom('configuration',['usermodification'], |
$env{'form.ccdomain'}); |
$env{'form.ccdomain'}); |
my @roletypes = ('active','future'); |
my @statuses = ('active','future'); |
my %roles = &Apache::lonnet::get_my_roles($env{'form.ccuname'},$env{'form.ccdomain'},'userroles',\@roletypes,undef,$env{'request.role.domain'}); |
my %roles = &Apache::lonnet::get_my_roles($env{'form.ccuname'},$env{'form.ccdomain'},'userroles',\@statuses,undef,$env{'request.role.domain'}); |
my @userroles; |
my ($auname,$audom); |
my ($cnum,$cdom,$auname,$audom); |
|
if ($context eq 'course') { |
if ($context eq 'course') { |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
$cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
Line 1783 sub update_user_data {
|
Line 1852 sub update_user_data {
|
} |
} |
} |
} |
} |
} |
my ($quotachanged,$namechanged,$oldportfolioquota,$newportfolioquota, |
my ($quotachanged,$oldportfolioquota,$newportfolioquota, |
$inststatus,$oldisdefault,$newisdefault,$olddefquotatext, |
$inststatus,$oldisdefault,$newisdefault,$olddefquotatext, |
$newdefquotatext); |
$newdefquotatext); |
my ($defquota,$settingstatus) = |
my ($defquota,$settingstatus) = |
Line 1918 END
|
Line 1987 END
|
($env{'form.ccuname'} => $env{'form.cid'})); |
($env{'form.ccuname'} => $env{'form.cid'})); |
if (($recurseid) && |
if (($recurseid) && |
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { |
(&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}))) { |
my %userupdate = ( |
%userupdate = ( |
lastname => $env{'form.clasaname'}, |
lastname => $env{'form.clasaname'}, |
middlename => $env{'form.cmiddlename'}, |
middlename => $env{'form.cmiddlename'}, |
firstname => $env{'form.cfirstname'}, |
firstname => $env{'form.cfirstname'}, |
Line 2655 sub handler {
|
Line 2724 sub handler {
|
&Apache::lonuserutils::print_first_users_upload_form($r,$context); |
&Apache::lonuserutils::print_first_users_upload_form($r,$context); |
} |
} |
$r->print('</form>'.&Apache::loncommon::end_page()); |
$r->print('</form>'.&Apache::loncommon::end_page()); |
} elsif ($env{'form.action'} eq 'singleuser' && $permission->{'cusr'}) { |
} elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'} |
|
eq 'singlestudent')) && ($permission->{'cusr'})) { |
my $phase = $env{'form.phase'}; |
my $phase = $env{'form.phase'}; |
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); |
my @search = ('srchterm','srchby','srchin','srchtype','srchdomain'); |
&Apache::loncreateuser::restore_prev_selections(); |
&Apache::loncreateuser::restore_prev_selections(); |
Line 2768 sub handler {
|
Line 2838 sub handler {
|
$formname,$totcodes,$codetitles,$idlist,$idlist_titles); |
$formname,$totcodes,$codetitles,$idlist,$idlist_titles); |
$r->print(&Apache::loncommon::end_page()); |
$r->print(&Apache::loncommon::end_page()); |
} |
} |
|
} elsif ($env{'form.action'} eq 'drop' && $permission->{'cusr'}) { |
|
$r->print(&header()); |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>'/adm/createuser?action=drop', |
|
text=>"Drop Students"}); |
|
if (!exists($env{'form.state'})) { |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Drop Students', |
|
'Course_Drop_Student')); |
|
|
|
&Apache::lonuserutils::print_drop_menu($r,$context,$permission); |
|
} elsif ($env{'form.state'} eq 'done') { |
|
&Apache::lonhtmlcommon::add_breadcrumb |
|
({href=>'/adm/createuser?action=drop', |
|
text=>"Result"}); |
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('Drop Students', |
|
'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') { |
} elsif ($env{'form.action'} eq 'dateselect') { |
if ($permission->{'cusr'}) { |
if ($permission->{'cusr'}) { |
$r->print(&header(undef,undef,{'no_nav_bar' => 1}). |
$r->print(&header(undef,undef,{'no_nav_bar' => 1}). |
Line 2866 sub print_main_menu {
|
Line 2956 sub print_main_menu {
|
push(@menu,$customlink); |
push(@menu,$customlink); |
} |
} |
if ($context eq 'course') { |
if ($context eq 'course') { |
my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'}; |
my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity(); |
my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'}; |
my @courselinks = |
my @courselinks = |
|
( |
( |
{ text => 'Automated Enrollment Manager', |
{ text => 'Enroll a Single Student', |
|
help => 'Course_Single_Student', |
|
action => 'singlestudent', |
|
permission => $permission->{'cusr'}, |
|
}, |
|
{ text => 'Drop Students', |
|
help => 'Course_Drop_Student', |
|
action => 'drop', |
|
permission => $permission->{'cusr'}, |
|
}); |
|
if (!exists($permission->{'cusr_section'})) { |
|
push(@courselinks, |
|
{ text => 'Automated Student Enrollment Manager', |
permission => (&Apache::lonnet::auto_run($cnum,$cdom) |
permission => (&Apache::lonnet::auto_run($cnum,$cdom) |
&& $permission->{'cusr'}), |
&& $permission->{'cusr'}), |
url => '/adm/populate', |
url => '/adm/populate', |
}, |
}); |
|
} |
|
push(@courselinks, |
{ text => 'Manage Course Groups', |
{ text => 'Manage Course Groups', |
help => 'Course_Manage_Group', |
help => 'Course_Manage_Group', |
permission => $permission->{'grp_manage'}, |
permission => $permission->{'grp_manage'}, |
url => '/adm/coursegroups?refpage=cusr', |
url => '/adm/coursegroups?refpage=cusr', |
}, |
}); |
); |
|
push(@menu,@courselinks); |
push(@menu,@courselinks); |
} |
} |
my $menu_html = ''; |
my $menu_html = ''; |
Line 3378 sub course_level_table {
|
Line 3480 sub course_level_table {
|
&Apache::loncommon::get_sections($domain,$cnum); |
&Apache::loncommon::get_sections($domain,$cnum); |
} |
} |
} |
} |
foreach my $role ('st','ta','ep','in','cc') { |
my @roles = &Apache::lonuserutils::roles_by_context('course'); |
|
foreach my $role (@roles) { |
if (&Apache::lonnet::allowed('c'.$role,$thiscourse)) { |
if (&Apache::lonnet::allowed('c'.$role,$thiscourse)) { |
my $plrole=&Apache::lonnet::plaintext($role); |
my $plrole=&Apache::lonnet::plaintext($role); |
$table .= &Apache::loncommon::start_data_table_row(). |
$table .= &Apache::loncommon::start_data_table_row(). |
Line 3478 $table.
|
Line 3581 $table.
|
sub course_level_dc { |
sub course_level_dc { |
my ($dcdom) = @_; |
my ($dcdom) = @_; |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
my %customroles=&Apache::lonuserutils::my_custom_roles(); |
|
my @roles = &Apache::lonuserutils::roles_by_context('course'); |
my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'. |
my $hiddenitems = '<input type="hidden" name="dcdomain" value="'.$dcdom.'" />'. |
'<input type="hidden" name="origdom" value="'.$dcdom.'" />'. |
'<input type="hidden" name="origdom" value="'.$dcdom.'" />'. |
'<input type="hidden" name="dccourse" value="" />'; |
'<input type="hidden" name="dccourse" value="" />'; |
Line 3502 sub course_level_dc {
|
Line 3606 sub course_level_dc {
|
my $otheritems = &Apache::loncommon::start_data_table_row()."\n". |
my $otheritems = &Apache::loncommon::start_data_table_row()."\n". |
'<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc',''".')" /></td>'."\n". |
'<td><input type="text" name="coursedesc" value="" onFocus="this.blur();opencrsbrowser('."'cu','dccourse','dcdomain','coursedesc',''".')" /></td>'."\n". |
'<td><select name="role">'."\n"; |
'<td><select name="role">'."\n"; |
foreach my $role ('st','ta','ep','in','cc') { |
foreach my $role (@roles) { |
my $plrole=&Apache::lonnet::plaintext($role); |
my $plrole=&Apache::lonnet::plaintext($role); |
$otheritems .= ' <option value="'.$role.'">'.$plrole; |
$otheritems .= ' <option value="'.$role.'">'.$plrole; |
} |
} |