');
} else {
- my $title = 'User Management';
- if ($context eq 'course') {
- if ($is_custom) {
- $title = 'Enrollment and Student Activity';
- }
- }
+ $r->print(&Apache::loncommon::start_page('User Management',$jscript));
+
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
- 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}));
+ &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',});
if ($env{'form.action'} eq 'singleuser') {
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ 'Course_Change_Privileges'));
$r->print("
$lt{'usrch'} ");
$r->print(&entry_form($srch->{'srchdomain'},$srch,undef,$context,undef,$crstype));
$r->print('
'.$lt{'usel'}.' ');
} elsif ($env{'form.action'} eq 'singlestudent') {
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ 'Course_Add_Student'));
$r->print($jscript."
");
if ($crstype eq 'Community') {
$r->print($lt{'memsrch'});
@@ -915,7 +902,7 @@ ENDSCRIPT
}
sub print_user_query_page {
- my ($r,$caller,$brcrum) = @_;
+ my ($r,$caller) = @_;
# 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.
@@ -923,11 +910,11 @@ sub print_user_query_page {
}
sub print_user_modification_page {
- my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype,$brcrum) = @_;
+ my ($r,$ccuname,$ccdomain,$srch,$response,$context,$permission,$crstype) = @_;
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,$brcrum);
+ &print_username_entry_form($r,$context,$usermsg,'','',$crstype);
return;
}
my ($form,$formname);
@@ -941,21 +928,12 @@ sub print_user_modification_page {
my %abv_auth = &auth_abbrev();
my (%rulematch,%inst_results,$newuser,%alerts,%curr_rules,%got_rules);
my $uhome=&Apache::lonnet::homeserver($ccuname,$ccdomain);
- my $is_custom = &Apache::loncommon::needs_gci_custom();
- if ($is_custom) {
- if ($uhome eq 'no_host') {
- my $lc_ccuname = lc($ccuname);
- if ($lc_ccuname ne $ccuname) {
- $uhome = &Apache::lonnet::homeserver($lc_ccuname,$ccdomain);
- $ccuname = $lc_ccuname;
- }
- }
- }
if ($uhome eq 'no_host') {
+ my $usertype;
my ($rules,$ruleorder) =
&Apache::lonnet::inst_userrules($ccdomain,'username');
- my $usertype =
- &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);
+ $usertype =
+ &Apache::lonuserutils::check_usertype($ccdomain,$ccuname,$rules);
my $cancreate =
&Apache::lonuserutils::can_create_user($ccdomain,$context,
$usertype);
@@ -965,28 +943,19 @@ sub print_user_modification_page {
official => 'institutional',
unofficial => 'non-institutional',
);
- if ($ccdomain eq 'gci') {
- $usertypetext{'unofficial'} = 'institutional',
- }
my $response;
if ($env{'form.origform'} eq 'crtusername') {
- if ($is_custom) {
- $response = ''.&mt('Invalid format for username for new user: [_1]',''.$ccuname.' ').
- ' ';
- } else {
- $response = ''.&mt('No match was found for the username ([_1]) in LON-CAPA domain: [_2]',$ccuname,$ccdomain).' ';
- }
+ $response = ''.&mt('No match found for the username [_1] in LON-CAPA domain: [_2]',''.$ccuname.' ',$ccdomain).
+ ' ';
}
$response .= ' '
.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.")
- .' ';
- if ($ccdomain eq 'gcitest') {
- $response .= &mt('Enter a valid e-mail address as the username for the new user.').' '.&mt('Please contact the [_1]helpdesk[_2] for assistance.'
- ,'',' ')
- .'
';
- }
+ .' '
+ .&mt('Please contact the [_1]helpdesk[_2] for assistance.'
+ ,'
',' ')
+ .'
';
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$response,undef,undef,$crstype);
return;
}
$newuser = 1;
@@ -1010,7 +979,7 @@ sub print_user_modification_page {
'username');
}
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$userchkmsg,undef,undef,$crstype);
return;
}
}
@@ -1031,43 +1000,34 @@ sub print_user_modification_page {
my $js = &validation_javascript($context,$ccdomain,$pjump_def,
$groupslist,$newuser,$formname,\%loaditem);
- my $title = 'User Management';
- if ($context eq 'course') {
- if ($is_custom) {
- $title = 'Enrollment and Student Activity';
- }
+ my $args = {'add_entries' => \%loaditem};
+ if ($env{'form.popup'}) {
+ $args->{'no_nav_bar'} = 1;
}
+ my $start_page =
+ &Apache::loncommon::start_page('User Management',$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';
}
- 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 $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management',
+ $helpitem);
my $forminfo =<<"ENDFORMINFO";
');
+ $r->print('
');
+ $r->print("".&Apache::loncommon::end_page());
return;
}
@@ -1492,6 +1455,8 @@ sub display_existing_roles {
$newkey .= '_'.$newrole;
if ($start ne '' && $end ne '') {
$newvalue .= '_'.$end.'_'.$start;
+ } elsif ($end ne '') {
+ $newvalue .= '_'.$end;
}
$rolesdump{$newkey} = $newvalue;
}
@@ -2100,9 +2065,22 @@ sub personal_data_display {
if ($canmodify_status{'inststatus'}) {
$shown = &pick_inst_statuses($userenv{'inststatus'},$usertypes,$types);
} else {
- $shown .= $userenv{'inststatus'};
if ($userenv{'inststatus'} eq '') {
$hiderow = 1;
+ } else {
+ my @showitems;
+ foreach my $item ( map { &unescape($_); } split(':',$userenv{'inststatus'})) {
+ if (exists($usertypes->{$item})) {
+ push(@showitems,$usertypes->{$item});
+ } else {
+ push(@showitems,$item);
+ }
+ }
+ if (@showitems) {
+ $shown = join(', ',@showitems);
+ } else {
+ $hiderow = 1;
+ }
}
}
if (!$hiderow) {
@@ -2198,8 +2176,7 @@ sub get_inststatuses {
# ================================================================= Phase Three
sub update_user_data {
- my ($r,$context,$crstype,$brcrum) = @_;
- my $is_custom = &Apache::loncommon::needs_gci_custom();
+ my ($r,$context,$crstype) = @_;
my $uhome=&Apache::lonnet::homeserver($env{'form.ccuname'},
$env{'form.ccdomain'});
# Error messages
@@ -2224,33 +2201,36 @@ sub update_user_data {
'// ]]>'."\n".
''."\n";
my %breadcrumb_text = &singleuser_breadcrumb($crstype);
- my $helpitem = 'Course_Change_Privileges';
- if ($env{'form.action'} eq 'singlestudent') {
- $helpitem = 'Course_Add_Student';
- }
- my $bread_crumbs_component = 'User Management';
- if ($context eq 'course') {
- if ($is_custom) {
- $bread_crumbs_component = 'Enrollment and Student Activity';
- }
- }
- 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};
+ 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';
+ }
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management',
+ $helpitem));
$r->print(&update_result_form($uhome));
# Check Inputs
if (! $env{'form.ccuname'} ) {
@@ -2318,10 +2298,14 @@ sub update_user_data {
$r->print('
'.&mt('User [_1] in domain [_2]',
$env{'form.ccuname'}, $env{'form.ccdomain'}).' ');
my (%alerts,%rulematch,%inst_results,%curr_rules);
+ my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
my @usertools = ('aboutme','blog','portfolio');
my @requestcourses = ('official','unofficial','community');
my ($othertitle,$usertypes,$types) =
&Apache::loncommon::sorted_inst_types($env{'form.ccdomain'});
+ my %canmodify_status =
+ &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},
+ ['inststatus']);
if ($env{'form.makeuser'}) {
$r->print('
'.&mt('Creating new account.').' ');
# Check for the authentication mode and password
@@ -2381,49 +2365,50 @@ sub update_user_data {
$r->print(&mt('Generating user').': '.$result);
$uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
$env{'form.ccdomain'});
- my (%changeHash,%newcustom,%changed);
+ my (%changeHash,%newcustom,%changed,%changedinfo);
if ($uhome ne 'no_host') {
- if ($env{'form.customquota'} == 1) {
- if ($env{'form.portfolioquota'} eq '') {
- $newcustom{'quota'} = 0;
- } else {
- $newcustom{'quota'} = $env{'form.portfolioquota'};
- $newcustom{'quota'} =~ s/[^\d\.]//g;
+ if ($context eq 'domain') {
+ if ($env{'form.customquota'} == 1) {
+ if ($env{'form.portfolioquota'} eq '') {
+ $newcustom{'quota'} = 0;
+ } else {
+ $newcustom{'quota'} = $env{'form.portfolioquota'};
+ $newcustom{'quota'} =~ s/[^\d\.]//g;
+ }
+ $changed{'quota'} = "a_admin($newcustom{'quota'},\%changeHash);
}
- $changed{'quota'} = "a_admin($newcustom{'quota'},\%changeHash);
- }
- foreach my $item (@usertools) {
- if ($env{'form.custom'.$item} == 1) {
- $newcustom{$item} = $env{'form.tools_'.$item};
- $changed{$item} = &tool_admin($item,$newcustom{$item},
- \%changeHash,'tools');
+ foreach my $item (@usertools) {
+ if ($env{'form.custom'.$item} == 1) {
+ $newcustom{$item} = $env{'form.tools_'.$item};
+ $changed{$item} = &tool_admin($item,$newcustom{$item},
+ \%changeHash,'tools');
+ }
}
- }
- foreach my $item (@requestcourses) {
- $newcustom{$item} = $env{'form.crsreq_'.$item};
- if ($env{'form.crsreq_'.$item} eq 'autolimit') {
- $newcustom{$item} .= '=';
- unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
- $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
+ foreach my $item (@requestcourses) {
+ $newcustom{$item} = $env{'form.crsreq_'.$item};
+ if ($env{'form.crsreq_'.$item} eq 'autolimit') {
+ $newcustom{$item} .= '=';
+ unless ($env{'form.crsreq_'.$item.'_limit'} =~ /\D/) {
+ $newcustom{$item} .= $env{'form.crsreq_'.$item.'_limit'};
+ }
}
+ $changed{$item} = &tool_admin($item,$newcustom{$item},
+ \%changeHash,'requestcourses');
}
- $changed{$item} = &tool_admin($item,$newcustom{$item},
- \%changeHash,'requestcourses');
}
- if (exists($env{'form.inststatus'})) {
- my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
- if (@inststatuses > 0) {
- $changeHash{'inststatus'} = join(',',@inststatuses);
- $changed{'inststatus'} = $changeHash{'inststatus'};
+ if ($canmodify_status{'inststatus'}) {
+ if (exists($env{'form.inststatus'})) {
+ my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
+ if (@inststatuses > 0) {
+ $changeHash{'inststatus'} = join(',',@inststatuses);
+ $changed{'inststatus'} = $changeHash{'inststatus'};
+ }
}
}
if (keys(%changed)) {
- $changeHash{'firstname'} = $env{'form.cfirstname'};
- $changeHash{'middlename'} = $env{'form.cmiddlename'};
- $changeHash{'lastname'} = $env{'form.clastname'};
- $changeHash{'generation'} = $env{'form.cgeneration'};
- $changeHash{'id'} = $env{'form.cid'};
- $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
+ foreach my $item (@userinfo) {
+ $changeHash{$item} = $env{'form.c'.$item};
+ }
my $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
@@ -2452,7 +2437,7 @@ sub update_user_data {
}
}
##
- my (@userroles,%userupdate,$cnum,$cdom,$crstype,$namechanged);
+ my (@userroles,%userupdate,$cnum,$cdom,$crstype,%namechanged);
if ($context eq 'course') {
($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
$crstype = &Apache::loncommon::course_type($cdom.'_'.$cnum);
@@ -2542,7 +2527,6 @@ sub update_user_data {
push(@longroles,&Apache::lonnet::plaintext($role,$crstype));
}
}
- my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
my %canmodify = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},\@userinfo,\@userroles);
foreach my $item (@userinfo) {
# Strip leading and trailing whitespace
@@ -2589,40 +2573,46 @@ sub update_user_data {
}
}
my ($quotachanged,$oldportfolioquota,$newportfolioquota,$oldinststatus,
- $inststatus,$newinststatus,$oldisdefault,$newisdefault,$olddefquotatext,
- $newdefquotatext,%oldaccess,%oldaccesstext,%newaccess,%newaccesstext,
- $oldinststatuses,$newinststatuses);
+ $newinststatus,$oldisdefault,$newisdefault,%oldsettings,
+ %oldsettingstext,%newsettings,%newsettingstext,@disporder);
+ @disporder = ('inststatus');
+ if ($env{'request.role.domain'} eq $env{'form.ccdomain'}) {
+ push(@disporder,'requestcourses');
+ } else {
+ push(@disporder,'reqcrsotherdom');
+ }
+ push(@disporder,('quota','tools'));
+ $oldinststatus = $userenv{'inststatus'};
my ($defquota,$settingstatus) =
- &Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus);
- my ($showquota,$showtools,$showrequestcourses,$showinststatus,$showreqotherdom);
+ &Apache::loncommon::default_quota($env{'form.ccdomain'},$oldinststatus);
+ my %canshow;
if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
- $showquota = 1;
+ $canshow{'quota'} = 1;
}
if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
- $showtools = 1;
+ $canshow{'tools'} = 1;
}
if (&Apache::lonnet::allowed('ccc',$env{'form.ccdomain'})) {
- $showrequestcourses = 1;
+ $canshow{'requestcourses'} = 1;
} elsif (&Apache::lonnet::allowed('ccc',$env{'request.role.domain'})) {
- $showreqotherdom = 1;
+ $canshow{'reqcrsotherdom'} = 1;
}
if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'})) {
- $showinststatus = 1;
+ $canshow{'inststatus'} = 1;
}
my (%changeHash,%changed);
- $oldinststatus = $userenv{'inststatus'};
if ($oldinststatus eq '') {
- $oldinststatuses = $othertitle;
+ $oldsettings{'inststatus'} = $othertitle;
} else {
if (ref($usertypes) eq 'HASH') {
- $oldinststatuses = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
+ $oldsettings{'inststatus'} = join(', ',map{ $usertypes->{ &unescape($_) }; } (split(/:/,$userenv{'inststatus'})));
} else {
- $oldinststatuses = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
+ $oldsettings{'inststatus'} = join(', ',map{ &unescape($_); } (split(/:/,$userenv{'inststatus'})));
}
}
$changeHash{'inststatus'} = $userenv{'inststatus'};
- my %canmodify_inststatus = &Apache::lonuserutils::can_modify_userinfo($context,$env{'form.ccdomain'},['inststatus'],\@userroles);
- if ($canmodify_inststatus{'inststatus'}) {
+ if ($canmodify_status{'inststatus'}) {
+ $canshow{'inststatus'} = 1;
if (exists($env{'form.inststatus'})) {
my @inststatuses = &Apache::loncommon::get_env_multiple('form.inststatus');
if (@inststatuses > 0) {
@@ -2632,84 +2622,82 @@ sub update_user_data {
$changed{'inststatus'} = $newinststatus;
}
if (ref($usertypes) eq 'HASH') {
- $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
+ $newsettings{'inststatus'} = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
} else {
- $newinststatuses = join(', ',map{ $usertypes->{$_}; } (@inststatuses));
- }
- } else {
- $newinststatus = '';
- $changeHash{'inststatus'} = $newinststatus;
- $newinststatuses = $othertitle;
- if ($newinststatus ne $oldinststatus) {
- $changed{'inststatus'} = $changeHash{'inststatus'};
+ $newsettings{'inststatus'} = join(', ',@inststatuses);
}
}
+ } else {
+ $newinststatus = '';
+ $changeHash{'inststatus'} = $newinststatus;
+ $newsettings{'inststatus'} = $othertitle;
+ if ($newinststatus ne $oldinststatus) {
+ $changed{'inststatus'} = $changeHash{'inststatus'};
+ }
}
+ } elsif ($context ne 'selfcreate') {
+ $canshow{'inststatus'} = 1;
+ $newsettings{'inststatus'} = $oldsettings{'inststatus'};
}
$changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
- if ($userenv{'portfolioquota'} ne '') {
- $oldportfolioquota = $userenv{'portfolioquota'};
- if ($env{'form.customquota'} == 1) {
- if ($env{'form.portfolioquota'} eq '') {
- $newportfolioquota = 0;
+ if ($context eq 'domain') {
+ if ($userenv{'portfolioquota'} ne '') {
+ $oldportfolioquota = $userenv{'portfolioquota'};
+ if ($env{'form.customquota'} == 1) {
+ if ($env{'form.portfolioquota'} eq '') {
+ $newportfolioquota = 0;
+ } else {
+ $newportfolioquota = $env{'form.portfolioquota'};
+ $newportfolioquota =~ s/[^\d\.]//g;
+ }
+ if ($newportfolioquota != $oldportfolioquota) {
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
+ }
} else {
- $newportfolioquota = $env{'form.portfolioquota'};
- $newportfolioquota =~ s/[^\d\.]//g;
- }
- if ($newportfolioquota != $oldportfolioquota) {
- $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
+ $changed{'quota'} = "a_admin('',\%changeHash);
+ $newportfolioquota = $defquota;
+ $newisdefault = 1;
}
} else {
- $changed{'quota'} = "a_admin('',\%changeHash);
- $newportfolioquota = $defquota;
- $newisdefault = 1;
- }
- } else {
- $oldisdefault = 1;
- $oldportfolioquota = $defquota;
- if ($env{'form.customquota'} == 1) {
- if ($env{'form.portfolioquota'} eq '') {
- $newportfolioquota = 0;
+ $oldisdefault = 1;
+ $oldportfolioquota = $defquota;
+ if ($env{'form.customquota'} == 1) {
+ if ($env{'form.portfolioquota'} eq '') {
+ $newportfolioquota = 0;
+ } else {
+ $newportfolioquota = $env{'form.portfolioquota'};
+ $newportfolioquota =~ s/[^\d\.]//g;
+ }
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
} else {
- $newportfolioquota = $env{'form.portfolioquota'};
- $newportfolioquota =~ s/[^\d\.]//g;
+ $newportfolioquota = $defquota;
+ $newisdefault = 1;
}
- $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
+ }
+ if ($oldisdefault) {
+ $oldsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+ }
+ if ($newisdefault) {
+ $newsettingstext{'quota'} = &get_defaultquota_text($settingstatus);
+ }
+ &tool_changes('tools',\@usertools,\%oldsettings,\%oldsettingstext,\%userenv,
+ \%changeHash,\%changed,\%newsettings,\%newsettingstext);
+ if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
+ &tool_changes('requestcourses',\@requestcourses,\%oldsettings,\%oldsettingstext,
+ \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
} else {
- $newportfolioquota = $defquota;
- $newisdefault = 1;
+ &tool_changes('reqcrsotherdom',\@requestcourses,\%oldsettings,\%oldsettingstext,
+ \%userenv,\%changeHash,\%changed,\%newsettings,\%newsettingstext);
}
}
- if ($oldisdefault) {
- $olddefquotatext = &get_defaultquota_text($settingstatus);
- }
- if ($newisdefault) {
- $newdefquotatext = &get_defaultquota_text($settingstatus);
- }
- &tool_changes('tools',\@usertools,\%oldaccess,\%oldaccesstext,\%userenv,
- \%changeHash,\%changed,\%newaccess,\%newaccesstext);
- if ($env{'form.ccdomain'} eq $env{'request.role.domain'}) {
- &tool_changes('requestcourses',\@requestcourses,\%oldaccess,\%oldaccesstext,
- \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
- } else {
- &tool_changes('reqcrsotherdom',\@requestcourses,\%oldaccess,\%oldaccesstext,
- \%userenv,\%changeHash,\%changed,\%newaccess,\%newaccesstext);
- }
- if ($env{'form.cfirstname'} ne $userenv{'firstname'} ||
- $env{'form.cmiddlename'} ne $userenv{'middlename'} ||
- $env{'form.clastname'} ne $userenv{'lastname'} ||
- $env{'form.cgeneration'} ne $userenv{'generation'} ||
- $env{'form.cid'} ne $userenv{'id'} ||
- $env{'form.cpermanentemail'} ne $userenv{'permanentemail'} ) {
- $namechanged = 1;
- }
- if (($namechanged) || (keys(%changed) > 0)) {
- $changeHash{'firstname'} = $env{'form.cfirstname'};
- $changeHash{'middlename'} = $env{'form.cmiddlename'};
- $changeHash{'lastname'} = $env{'form.clastname'};
- $changeHash{'generation'} = $env{'form.cgeneration'};
- $changeHash{'id'} = $env{'form.cid'};
- $changeHash{'permanentemail'} = $env{'form.cpermanentemail'};
+ foreach my $item (@userinfo) {
+ if ($env{'form.c'.$item} ne $userenv{$item}) {
+ $namechanged{$item} = 1;
+ }
+ }
+ $oldsettings{'quota'} = $oldportfolioquota.' Mb';
+ $newsettings{'quota'} = $newportfolioquota.' Mb';
+ if ((keys(%namechanged) > 0) || (keys(%changed) > 0)) {
my ($chgresult,$namechgresult);
if (keys(%changed) > 0) {
$chgresult =
@@ -2725,8 +2713,7 @@ sub update_user_data {
$newenvhash{'environment.requestcourses.'.$key} =
$changeHash{'requestcourses.'.$key};
if ($changeHash{'requestcourses.'.$key} ne '') {
- $newenvhash{'environment.canrequest.'.$key} =
- $changeHash{'requestcourses.'.$key};
+ $newenvhash{'environment.canrequest.'.$key} = 1;
} else {
$newenvhash{'environment.canrequest.'.$key} =
&Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
@@ -2740,8 +2727,7 @@ sub update_user_data {
$changeHash{'tools.'.$key};
} else {
$newenvhash{'environment.availabletools.'.$key} =
- &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'},
- $key,'reload','tools');
+ &Apache::lonnet::usertools_access($env{'user.name'},$env{'user.domain'}, $key,'reload','tools');
}
}
}
@@ -2751,14 +2737,17 @@ sub update_user_data {
}
}
}
- if ($namechanged) {
- # Make the change
+ if (keys(%namechanged) > 0) {
+ foreach my $field (@userinfo) {
+ $changeHash{$field} = $env{'form.c'.$field};
+ }
+# Make the change
$namechgresult =
&Apache::lonnet::modifyuser($env{'form.ccdomain'},
$env{'form.ccuname'},$changeHash{'id'},undef,undef,
$changeHash{'firstname'},$changeHash{'middlename'},
$changeHash{'lastname'},$changeHash{'generation'},
- $changeHash{'id'},undef,$changeHash{'permanentemail'});
+ $changeHash{'id'},undef,$changeHash{'permanentemail'},undef,\@userinfo);
%userupdate = (
lastname => $env{'form.clastname'},
middlename => $env{'form.cmiddlename'},
@@ -2767,139 +2756,13 @@ sub update_user_data {
id => $env{'form.cid'},
);
}
- if (($namechanged && $namechgresult eq 'ok') ||
+ if (((keys(%namechanged) > 0) && $namechgresult eq 'ok') ||
((keys(%changed) > 0) && $chgresult eq 'ok')) {
# Tell the user we changed the name
- my %lt=&Apache::lonlocal::texthash(
- 'uic' => 'User Information Changed',
- 'frst' => 'First Name',
- 'mddl' => 'Middle Name',
- 'lst' => 'Last Name',
- 'gen' => 'Generation',
- 'id' => 'Student/Employee ID',
- 'mail' => 'Permanent e-mail address',
- 'disk' => 'Disk space allocated to portfolio files',
- 'blog' => 'Blog Availability',
- 'aboutme' => 'Personal Information Page Availability',
- 'portfolio' => 'Portfolio Availability',
- 'official' => 'Can Request Official Courses',
- 'unofficial' => 'Can Request Unofficial Courses',
- 'community' => 'Can Request Communities',
- 'inststatus' => "Affiliation",
- 'prvs' => 'Previous Value:',
- 'chto' => 'Changed To:'
- );
- $r->print('
'.$lt{'uic'}.' '.
- &Apache::loncommon::start_data_table().
- &Apache::loncommon::start_data_table_header_row());
- $r->print(<<"END");
-
-
$lt{'frst'}
-
$lt{'mddl'}
-
$lt{'lst'}
-
$lt{'gen'}
-
$lt{'id'}
-
$lt{'mail'}
-END
- if ($showinststatus) {
- $r->print("
-
$lt{'inststatus'} \n");
- }
- if ($showrequestcourses) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$lt{$item} \n");
- }
- } elsif ($showreqotherdom) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$lt{$item} \n");
- }
- }
- if ($showquota) {
- $r->print("
-
$lt{'disk'} \n");
- }
- if ($showtools) {
- foreach my $item (@usertools) {
- $r->print("
-
$lt{$item} \n");
- }
- }
- $r->print(&Apache::loncommon::end_data_table_header_row().
- &Apache::loncommon::start_data_table_row());
- $r->print(<<"END");
-
$lt{'prvs'}
-
$userenv{'firstname'}
-
$userenv{'middlename'}
-
$userenv{'lastname'}
-
$userenv{'generation'}
-
$userenv{'id'}
-
$userenv{'permanentemail'}
-END
- if ($showinststatus) {
- $r->print("
-
$oldinststatuses \n");
- }
- if ($showrequestcourses) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$oldaccess{$item} $oldaccesstext{$item} \n");
- }
- } elsif ($showreqotherdom) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$oldaccess{$item} $oldaccesstext{$item} \n");
- }
- }
- if ($showquota) {
- $r->print("
-
$oldportfolioquota Mb $olddefquotatext \n");
- }
- if ($showtools) {
- foreach my $item (@usertools) {
- $r->print("
-
$oldaccess{$item} $oldaccesstext{$item} \n");
- }
- }
- $r->print(&Apache::loncommon::end_data_table_row().
- &Apache::loncommon::start_data_table_row());
- $r->print(<<"END");
-
$lt{'chto'}
-
$env{'form.cfirstname'}
-
$env{'form.cmiddlename'}
-
$env{'form.clastname'}
-
$env{'form.cgeneration'}
-
$env{'form.cid'}
-
$env{'form.cpermanentemail'}
-END
- if ($showinststatus) {
- $r->print("
-
$newinststatuses \n");
- }
- if ($showrequestcourses) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$newaccess{$item} $newaccesstext{$item} \n");
- }
- } elsif ($showreqotherdom) {
- foreach my $item (@requestcourses) {
- $r->print("
-
$newaccess{$item} $newaccesstext{$item} \n");
- }
- }
- if ($showquota) {
- $r->print("
-
$newportfolioquota Mb $newdefquotatext \n");
- }
- if ($showtools) {
- foreach my $item (@usertools) {
- $r->print("
-
$newaccess{$item} $newaccesstext{$item} \n");
- }
- }
- $r->print(&Apache::loncommon::end_data_table_row().
- &Apache::loncommon::end_data_table().'
');
+ &display_userinfo($r,1,\@disporder,\%canshow,\@requestcourses,
+ \@usertools,\%userenv,\%changed,\%namechanged,
+ \%oldsettings, \%oldsettingstext,\%newsettings,
+ \%newsettingstext);
if ($env{'form.cid'} ne $userenv{'id'}) {
&Apache::lonnet::idput($env{'form.ccdomain'},
($env{'form.ccuname'} => $env{'form.cid'}));
@@ -2925,54 +2788,13 @@ END
$env{'form.ccuname'}.' '.&mt('in domain').' '.
$env{'form.ccdomain'}.'
');
}
- } else { # End of if ($env ... ) logic
+ } else { # End of if ($env ... ) logic
# They did not want to change the users name, quota, tool availability,
# or ability to request creation of courses,
# but we can still tell them what the name and quota and availabilities are
- my %lt=&Apache::lonlocal::texthash(
- 'id' => "Student/Employee ID",
- 'mail' => "Permanent e-mail address",
- 'disk' => "Disk space allocated to user's portfolio files",
- 'blog' => "Blog Availability",
- 'aboutme' => "Personal Information Page Availability",
- 'portfolio' => "Portfolio Availability",
- 'official' => "Can Request Official Courses",
- 'unofficial' => "Can Request Unofficial Courses",
- 'community' => "Can Request Communities",
- 'inststatus' => "Affiliation",
- );
- $r->print(<<"END");
-
$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'}
-END
- if ($userenv{'permanentemail'} ne '') {
- $r->print(' ['.$lt{'mail'}.': '.
- $userenv{'permanentemail'}.']');
- }
- if ($showinststatus) {
- $r->print(' ['.$lt{'inststatus'}.': '.$oldinststatuses.']');
- }
- if ($showrequestcourses) {
- foreach my $item (@requestcourses) {
- $r->print(' ['.$lt{$item}.': '.$newaccess{$item}.' '.
- $newaccesstext{$item}.']'."\n");
- }
- } elsif ($showreqotherdom) {
- foreach my $item (@requestcourses) {
- $r->print(' ['.$lt{$item}.': '.$newaccess{$item}.' '.
- $newaccesstext{$item}.']'."\n");
- }
- }
- if ($showtools) {
- foreach my $item (@usertools) {
- $r->print(' ['.$lt{$item}.': '.$newaccess{$item}.' '.
- $newaccesstext{$item}.']'."\n");
- }
- }
- if ($showquota) {
- $r->print(' ['.$lt{'disk'}.': '.$oldportfolioquota.' Mb '.
- $olddefquotatext.']');
- }
- $r->print(' ');
+ &display_userinfo($r,undef,\@disporder,\%canshow,\@requestcourses,
+ \@usertools,\%userenv,\%changed,\%namechanged,\%oldsettings,
+ \%oldsettingstext,\%newsettings,\%newsettingstext);
}
if (@mod_disallowed) {
my ($rolestr,$contextname);
@@ -3019,7 +2841,7 @@ END
$r->print('');
} else {
my @rolechanges = &update_roles($r,$context);
- if ($namechanged) {
+ if (keys(%namechanged) > 0) {
if ($context eq 'course') {
if (@userroles > 0) {
if ((@rolechanges == 0) ||
@@ -3045,6 +2867,137 @@ END
.&mt('Create/Modify Another User').'');
}
}
+ $r->print(&Apache::loncommon::end_page());
+}
+
+sub display_userinfo {
+ my ($r,$changed,$order,$canshow,$requestcourses,$usertools,$userenv,
+ $changedhash,$namechangedhash,$oldsetting,$oldsettingtext,
+ $newsetting,$newsettingtext) = @_;
+ return unless (ref($order) eq 'ARRAY' &&
+ ref($canshow) eq 'HASH' &&
+ ref($requestcourses) eq 'ARRAY' &&
+ ref($usertools) eq 'ARRAY' &&
+ ref($userenv) eq 'HASH' &&
+ ref($changedhash) eq 'HASH' &&
+ ref($oldsetting) eq 'HASH' &&
+ ref($oldsettingtext) eq 'HASH' &&
+ ref($newsetting) eq 'HASH' &&
+ ref($newsettingtext) eq 'HASH');
+ my %lt=&Apache::lonlocal::texthash(
+ 'ui' => 'User Information (unchanged)',
+ 'uic' => 'User Information Changed',
+ 'firstname' => 'First Name',
+ 'middlename' => 'Middle Name',
+ 'lastname' => 'Last Name',
+ 'generation' => 'Generation',
+ 'id' => 'Student/Employee ID',
+ 'permanentemail' => 'Permanent e-mail address',
+ 'quota' => 'Disk space allocated to portfolio files',
+ 'blog' => 'Blog Availability',
+ 'aboutme' => 'Personal Information Page Availability',
+ 'portfolio' => 'Portfolio Availability',
+ 'official' => 'Can Request Official Courses',
+ 'unofficial' => 'Can Request Unofficial Courses',
+ 'community' => 'Can Request Communities',
+ 'inststatus' => "Affiliation",
+ 'prvs' => 'Previous Value:',
+ 'chto' => 'Changed To:'
+ );
+ my $title = $lt{'ui'};
+ if ($changed) {
+ $title = $lt{'uic'};
+ }
+ $r->print('
'.$title.' '.
+ &Apache::loncommon::start_data_table().
+ &Apache::loncommon::start_data_table_header_row());
+ if ($changed) {
+ $r->print("
\n");
+ }
+ my @userinfo = ('firstname','middlename','lastname','generation','permanentemail','id');
+ foreach my $item (@userinfo) {
+ $r->print("
$lt{$item} \n");
+ }
+ foreach my $entry (@{$order}) {
+ if ($canshow->{$entry}) {
+ if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+ foreach my $item (@{$requestcourses}) {
+ $r->print("
$lt{$item} \n");
+ }
+ } elsif ($entry eq 'tools') {
+ foreach my $item (@{$usertools}) {
+ $r->print("
$lt{$item} \n");
+ }
+ } else {
+ $r->print("
$lt{$entry} \n");
+ }
+ }
+ }
+ $r->print(&Apache::loncommon::end_data_table_header_row().
+ &Apache::loncommon::start_data_table_row());
+ if ($changed) {
+ $r->print('
'.$lt{'prvs'}.' '."\n");
+ }
+ foreach my $item (@userinfo) {
+ $r->print('
'.$userenv->{$item}.' '."\n");
+ }
+ foreach my $entry (@{$order}) {
+ if ($canshow->{$entry}) {
+ if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+ foreach my $item (@{$requestcourses}) {
+ $r->print("
$oldsetting->{$item} $oldsettingtext->{$item} \n");
+ }
+ } elsif ($entry eq 'tools') {
+ foreach my $item (@{$usertools}) {
+ $r->print("
$oldsetting->{$item} $oldsettingtext->{$item} \n");
+ }
+ } else {
+ $r->print("
$oldsetting->{$entry} $oldsettingtext->{$entry} \n");
+ }
+ }
+ }
+ $r->print(&Apache::loncommon::end_data_table_row());
+ if ($changed) {
+ $r->print(&Apache::loncommon::start_data_table_row().
+ '
'.$lt{'chto'}.' '."\n");
+ foreach my $item (@userinfo) {
+ my $value = $env{'form.c'.$item};
+ if ($namechangedhash->{$item}) {
+ $value = '
'.$value.' ';
+ }
+ $r->print("
$value \n");
+ }
+ foreach my $entry (@{$order}) {
+ if ($canshow->{$entry}) {
+ if (($entry eq 'requestcourses') || ($entry eq 'reqcrsotherdom')) {
+ foreach my $item (@{$requestcourses}) {
+ my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
+ if ($changedhash->{$item}) {
+ $value = '
'.$value.' ';
+ }
+ $r->print("
$value \n");
+ }
+ } elsif ($entry eq 'tools') {
+ foreach my $item (@{$usertools}) {
+ my $value = $newsetting->{$item}.' '.$newsettingtext->{$item};
+ if ($changedhash->{$item}) {
+ $value = '
'.$value.' ';
+ }
+ $r->print("
$value \n");
+ }
+ } else {
+ my $value = $newsetting->{$entry}.' '.$newsettingtext->{$entry};
+ if ($changedhash->{$entry}) {
+ $value = '
'.$value.' ';
+ }
+ $r->print("
$value \n");
+ }
+ }
+ }
+ $r->print(&Apache::loncommon::end_data_table_row());
+ }
+ $r->print(&Apache::loncommon::end_data_table().'
');
+ return;
}
sub tool_changes {
@@ -3654,7 +3607,7 @@ sub build_roles {
# ========================================================== Custom Role Editor
sub custom_role_editor {
- my ($r,$brcrum) = @_;
+ my ($r) = @_;
my $action = $env{'form.customroleaction'};
my $rolename;
if ($action eq 'new') {
@@ -3663,6 +3616,11 @@ sub custom_role_editor {
$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();
@@ -3671,19 +3629,6 @@ sub custom_role_editor {
$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') {
- if ($is_custom) {
- $title = 'Enrollment and Student Activity';
- }
- }
# ------------------------------------------------------- What can be assigned?
my %full=();
my %courselevel=();
@@ -3791,28 +3736,25 @@ sub custom_role_editor {
$head_script .= "\n".$jsback."\n"
.'// ]]>'."\n"
.''."\n";
- 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);
+ $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('User Management',
+ 'Course_Editing_Custom_Roles'));
+
+ $r->print($body_top);
my %lt=&Apache::lonlocal::texthash(
'prv' => "Privilege",
'crl' => "Course Level",
'dml' => "Domain Level",
'ssl' => "System Level");
+
$r->print('
'
.'
');
+ '
'.
+ &Apache::loncommon::end_page());
}
# --------------------------------------------------------
sub make_script_template {
@@ -3941,11 +3884,11 @@ sub make_button_code {
}
# ---------------------------------------------------------- Call to definerole
sub set_custom_role {
- my ($r,$context,$brcrum) = @_;
+ my ($r,$context) = @_;
my $rolename=$env{'form.rolename'};
$rolename=~s/[^A-Za-z0-9]//gs;
if (!$rolename) {
- &custom_role_editor($r,$brcrum);
+ &custom_role_editor($r);
return;
}
my ($jsback,$elements) = &crumb_utilities();
@@ -3954,32 +3897,20 @@ sub set_custom_role {
.$jsback."\n"
.'// ]]>'."\n"
.''."\n";
- my $bread_crumbs_component = 'User Management';
- my $is_custom = &Apache::loncommon::needs_gci_custom();
- if ($context eq 'course') {
- if ($is_custom) {
- $bread_crumbs_component = 'Enrollment and Student Activity';
- }
- }
- 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));
+ $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('User Management',
+ 'Course_Editing_Custom_Roles'));
my ($rdummy,$roledef)=
&Apache::lonnet::get('roles',["rolesdef_$rolename"]);
@@ -4036,6 +3967,7 @@ sub set_custom_role {
}
$r->print('
'.&mt('Create or edit another custom role').'
');
+ $r->print(&Apache::loncommon::end_page());
}
# ================================================================ Main Handler
@@ -4055,7 +3987,19 @@ sub handler {
} else {
$context = 'domain';
}
- my ($permission,$allowed) =
+ &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},
+ ['action','state','callingform','roletype','showrole','bulkaction','popup','phase',
+ 'username','domain','srchterm','srchdomain','srchin','srchby','srchtype']);
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($env{'form.action'} ne 'dateselect') {
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>"/adm/createuser",
+ text=>"User Management",
+ 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,
+ my ($permission,$allowed) =
&Apache::lonuserutils::get_permission($context,$crstype);
if (!$allowed) {
$env{'user.error.msg'}=
@@ -4067,89 +4011,35 @@ sub handler {
&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') {
- if ($is_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']);
- &Apache::lonhtmlcommon::clear_breadcrumbs();
- my $args;
- my $brcrum = [];
- my $bread_crumbs_component = $title;
- 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'}
- ];
- }
- #SD Following files not added to help, because the corresponding .tex-files seem to
- #be missing: Course_Approve_Selfenroll,Course_User_Logs,
-
# Main switch on form.action and form.state, as appropriate
if (! exists($env{'form.action'})) {
- $args = {bread_crumbs => $brcrum,
- bread_crumbs_component => $bread_crumbs_component};
- $r->print(&header(undef,$args));
+ $r->print(&header());
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
$r->print(&print_main_menu($permission,$context,$crstype));
+ $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'upload' && $permission->{'cusr'}) {
- 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('
');
+ $r->print(''.&Apache::loncommon::end_page());
} elsif ((($env{'form.action'} eq 'singleuser') || ($env{'form.action'}
eq 'singlestudent')) && ($permission->{'cusr'})) {
my $phase = $env{'form.phase'};
@@ -4164,9 +4054,9 @@ sub handler {
if ($env{'form.phase'} eq 'createnewuser') {
my $response;
if ($env{'form.srchterm'} !~ /^$match_username$/) {
- my $response = '
'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'
';
+ my $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
$env{'form.phase'} = '';
- &print_username_entry_form($r,$context,$response,$srch,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,$response,$srch,undef,$crstype);
} else {
my $ccuname =&LONCAPA::clean_username($srch->{'srchterm'});
my $ccdomain=&LONCAPA::clean_domain($srch->{'srchdomain'});
@@ -4200,63 +4090,56 @@ sub handler {
}
&print_user_modification_page($r,$ccuname,$ccdomain,
$srch,$response,$context,
- $permission,$crstype,$brcrum);
+ $permission,$crstype);
} elsif ($currstate eq 'query') {
- &print_user_query_page($r,'createuser',$brcrum);
+ &print_user_query_page($r,'createuser');
} else {
$env{'form.phase'} = '';
&print_username_entry_form($r,$context,$response,$srch,
- $forcenewuser,$crstype,$brcrum);
+ $forcenewuser,$crstype);
}
} 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,$brcrum);
+ $context,$permission,$crstype);
}
} elsif ($env{'form.phase'} eq 'update_user_data') {
- &update_user_data($r,$context,$crstype,$brcrum);
+ &update_user_data($r,$context,$crstype);
} else {
- &print_username_entry_form($r,$context,undef,$srch,undef,$crstype,$brcrum);
+ &print_username_entry_form($r,$context,undef,$srch,undef,$crstype);
}
} elsif ($env{'form.action'} eq 'custom' && $permission->{'custom'}) {
if ($env{'form.phase'} eq 'set_custom_roles') {
- &set_custom_role($r,$context,$brcrum);
+ &set_custom_role($r,$context);
} else {
- &custom_role_editor($r,$brcrum);
+ &custom_role_editor($r);
}
} elsif (($env{'form.action'} eq 'listusers') &&
($permission->{'view'} || $permission->{'cusr'})) {
if ($env{'form.phase'} eq 'bulkchange') {
- 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));
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=listusers',
+ text=>"List Users"},
+ {href=>"/adm/createuser",
+ text=>"Result"});
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'}) {
- &Apache::lonuserutils::update_user_list($r,$context,$setting,$choice);
+ &Apache::lonuserutils::update_user_list($r,$context,$setting,$choice,$crstype);
$r->print(&Apache::loncommon::end_page());
} else {
$r->print(&mt('You are not authorized to make bulk changes to user roles'));
$r->print('
'.&mt('Display User Lists').' ');
+ $r->print(&Apache::loncommon::end_page());
}
} else {
- 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};
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=listusers',
+ text=>"List Users"});
my ($cb_jscript,$jscript,$totcodes,$codetitles,$idlist,$idlist_titles);
my $formname = 'studentform';
if (($context eq 'domain') && (($env{'form.roletype'} eq 'course') ||
@@ -4277,137 +4160,130 @@ sub handler {
}
$jscript .= &verify_user_display();
my $js = &add_script($jscript).$cb_jscript;
- my $loadcode =
+ my $loadcode =
&Apache::lonuserutils::course_selector_loadcode($formname);
if ($loadcode ne '') {
- $args->{add_entries} = {onload => $loadcode};
+ $r->print(&header($js,{'onload' => $loadcode,}));
+ } else {
+ $r->print(&header($js));
}
- $r->print(&header($js,$args));
} else {
- $r->print(&header(&add_script(&verify_user_display()),$args));
+ $r->print(&header(&add_script(&verify_user_display())));
}
+ $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';
}
- 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));
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=drop',
+ text=>$brtext});
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));
+ $permission,$crstype).
+ &Apache::loncommon::end_page());
} else {
$r->print(&header().
- ''.&mt('You do not have permission to modify dates or sections for users').' ');
+ ''.&mt('You do not have permission to modify dates or sections for users').' '.
+ &Apache::loncommon::end_page());
}
} elsif ($env{'form.action'} eq 'selfenroll') {
- push(@{$brcrum},
- {href => '/adm/createuser?action=selfenroll',
- text => "Configure Self-enrollment",
- help => 'Course_Self_Enrollment'});
+ $r->print(&header());
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=selfenroll',
+ text=>"Configure Self-enrollment"});
if (!exists($env{'form.state'})) {
- $args = { bread_crumbs => $brcrum,
- bread_crumbs_component => 'Configure Self-enrollment'};
- $r->print(&header(undef,$args));
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Configure Self-enrollment',
+ 'Course_Self_Enrollment'));
$r->print('
'.&mt('Self-enrollment with a student role').' '."\n");
&print_selfenroll_menu($r,$context,$permission);
} elsif ($env{'form.state'} eq 'done') {
- push (@{$brcrum},
- {href=>'/adm/createuser?action=selfenroll',
- text=>"Result"});
- $args = { bread_crumbs => $brcrum,
- bread_crumbs_component => 'Self-enrollment result'};
- $r->print(&header(undef,$args));
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=selfenroll',
+ text=>"Result"});
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('Self-enrollment result',
+ 'Course_Self_Enrollment'));
$r->print('
'.&mt('Self-enrollment with a student role').' '."\n");
&update_selfenroll_config($r,$context,$permission);
}
+ $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'selfenrollqueue') {
- 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));
+ $r->print(&header());
+ &Apache::lonhtmlcommon::add_breadcrumb
+ ({href=>'/adm/createuser?action=selfenrollqueue',
+ text=>"Enrollment requests"});
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('
'.&mt('Pending enrollment requests').' '."\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('
'.&mt('Enrollment request processing').' '."\n");
$r->print(&Apache::loncoursequeueadmin::update_request_queue($context,
$cdom,$cnum,$coursedesc));
}
+ $r->print(&Apache::loncommon::end_page());
} elsif ($env{'form.action'} eq 'changelogs') {
- 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);
+ $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());
} else {
- $args = { bread_crumbs => $brcrum,
- bread_crumbs_component => $bread_crumbs_component};
- $r->print(&header(undef,$args));
+ $r->print(&header());
+ $r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management'));
$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,$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 ($jscript,$loaditems,$args) = @_;
my $start_page;
- if (ref($args) eq 'HASH') {
- $start_page=&Apache::loncommon::start_page($title,$jscript,$args);
+ if (ref($loaditems) eq 'HASH') {
+ $start_page=&Apache::loncommon::start_page('User Management',$jscript,{'add_entries' => $loaditems});
} else {
- $start_page=&Apache::loncommon::start_page($title,$jscript);
+ $start_page=&Apache::loncommon::start_page('User Management',$jscript,$args);
}
return $start_page;
}
@@ -4440,10 +4316,6 @@ END
# Menu Phase One
sub print_main_menu {
my ($permission,$context,$crstype) = @_;
- my $is_custom = &Apache::loncommon::needs_gci_custom();
- if (($context eq 'course') && ($is_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')) {
@@ -4603,7 +4475,7 @@ sub print_main_menu {
},
{
linktext => $linktext{$crstype}{'groups'},
- icon => 'conf.png',
+ icon => 'grps.png',
#help => 'Course_Manage_Group',
url => '/adm/coursegroups?refpage=cusr',
permission => $permission->{'grp_manage'},
@@ -4665,82 +4537,6 @@ 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',
@@ -5705,7 +5501,16 @@ 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;
}
@@ -5755,7 +5560,7 @@ sub user_search_result {
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'instd')) {
if (($srch->{'srchdomain'} eq '') ||
! (&Apache::lonnet::domain($srch->{'srchdomain'}))) {
- $response = '
'.&mt('You must specify a valid domain when searching in a domain or institutional directory.').'
';
+ $response = &mt('You must specify a valid domain when searching in a domain or institutional directory.')
}
}
if (($srch->{'srchin'} eq 'dom') || ($srch->{'srchin'} eq 'crs') ||
@@ -5768,7 +5573,7 @@ sub user_search_result {
}
}
if ($unamecheck !~ /^$match_username$/) {
- $response = '
'.&mt('You must specify a valid username. Only the following are allowed: letters numbers - . @').'
';
+ $response = &mt('You must specify a valid username. Only the following are allowed: letters numbers - . @');
}
}
}
@@ -5943,8 +5748,7 @@ sub user_search_result {
($currstate,$response,$forcenewuser) =
&build_search_response($context,$srch,%srch_results);
} else {
- my $showdom = &display_domain_info($srch->{'srchdomain'});
- $response = '
'.
+ my $showdom = &display_domain_info($srch->{'srchdomain'}); $response = ''.
&mt('Institutional directory search is not available in domain: [_1]',$showdom).
' '.
&mt('You may want to search in the LON-CAPA domain instead of the institutional directory.').
@@ -6055,12 +5859,12 @@ sub build_search_response {
my ($context,$srch,%srch_results) = @_;
my ($currstate,$response,$forcenewuser);
my %names = (
- 'uname' => 'username',
- 'lastname' => 'last name',
+ 'uname' => 'username',
+ 'lastname' => 'last name',
'lastfirst' => 'last name, first name',
- 'crs' => 'this course',
- 'dom' => 'LON-CAPA domain: ',
- 'instd' => 'the institutional directory for domain: ',
+ 'crs' => 'this course',
+ 'dom' => 'LON-CAPA domain',
+ 'instd' => 'the institutional directory for domain',
);
my %single = (
@@ -6080,14 +5884,20 @@ sub build_search_response {
$currstate = 'modify';
$response = &mt("$single{$srch->{'srchtype'}} was found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}.",$srch->{'srchterm'});
if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {
- $response .= &display_domain_info($srch->{'srchdomain'});
+ $response .= ': '.&display_domain_info($srch->{'srchdomain'});
}
- } else {
- $response = ''.&mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} ([_1]) in $names{$srch->{'srchin'}}",$srch->{'srchterm'});
+ } else { # Search has nothing found. Prepare message to user.
+ $response = '';
if ($srch->{'srchin'} eq 'dom' || $srch->{'srchin'} eq 'instd') {
- $response .= &display_domain_info($srch->{'srchdomain'});
+ $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}: [_2]",
+ ''.$srch->{'srchterm'}.' ',
+ &display_domain_info($srch->{'srchdomain'}));
+ } else {
+ $response .= &mt("$nomatch{$srch->{'srchtype'}} found for the $names{$srch->{'srchby'}} [_1] in $names{$srch->{'srchin'}}.",
+ ''.$srch->{'srchterm'}.' ');
}
$response .= ' ';
+
if ($srch->{'srchin'} ne 'alc') {
$forcenewuser = 1;
my $cansrchinst = 0;
@@ -6459,7 +6269,8 @@ sub update_selfenroll_config {
$newnum ++;
}
}
- for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) { if ((!grep(/^$j$/,@deletedoms)) && (!grep(/^$j$/,@activations))) {
+ for (my $j=0; $j<$env{'form.selfenroll_types_total'}; $j++) {
+ if ((!grep(/^$j$/,@deletedoms)) && (!grep(/^$j$/,@activations))) {
my @types = &Apache::loncommon::get_env_multiple('form.selfenroll_types_'.$j);
if (@types > 0) {
@types = sort(@types);
@@ -6771,7 +6582,7 @@ sub is_courseowner {
}
if ($courseowner ne '') {
if ($courseowner eq $env{'user.name'}.':'.$env{'user.domain'}) {
- return 1;
+ return 1;
}
}
return;