version 1.164, 2007/07/31 18:58:07
|
version 1.167, 2007/08/02 01:04:41
|
Line 204 sub print_username_entry_form {
|
Line 204 sub print_username_entry_form {
|
my ($jsback,$elements) = &crumb_utilities(); |
my ($jsback,$elements) = &crumb_utilities(); |
|
|
my $jscript = &Apache::loncommon::studentbrowser_javascript()."\n". |
my $jscript = &Apache::loncommon::studentbrowser_javascript()."\n". |
'<script type"text/javascript">'."\n". |
'<script type="text/javascript">'."\n". |
&Apache::lonhtmlcommon::set_form_elements($elements->{$formtoset}). |
&Apache::lonhtmlcommon::set_form_elements($elements->{$formtoset}). |
'</script>'."\n"; |
'</script>'."\n"; |
|
|
Line 216 sub print_username_entry_form {
|
Line 216 sub print_username_entry_form {
|
$jscript,{'add_entries' => \%loaditems,}); |
$jscript,{'add_entries' => \%loaditems,}); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.crtuser)", |
({href=>"javascript:backPage(document.crtuser)", |
text=>"User/custom role search", |
text=>"User modify/custom role", |
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
|
|
my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management'); |
my $crumbs = &Apache::lonhtmlcommon::breadcrumbs('User Management'); |
Line 232 sub print_username_entry_form {
|
Line 232 sub print_username_entry_form {
|
'ecrp' => "Edit Custom Role Privileges", |
'ecrp' => "Edit Custom Role Privileges", |
'nr' => "Name of Role", |
'nr' => "Name of Role", |
'cre' => "Custom Role Editor", |
'cre' => "Custom Role Editor", |
|
'mod' => "to add/modify roles", |
); |
); |
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'); |
Line 244 sub print_username_entry_form {
|
Line 245 sub print_username_entry_form {
|
$start_page |
$start_page |
$crumbs |
$crumbs |
<h2>$lt{siur}$helpsiur</h2> |
<h2>$lt{siur}$helpsiur</h2> |
<h3>$lt{'srch'} $sellink</h3> |
<h3>$lt{'srch'} $sellink $lt{'mod'}</h3> |
$response"); |
$response"); |
$r->print(&entry_form($defdom,$srch,$forcenewuser)); |
$r->print(&entry_form($defdom,$srch,$forcenewuser)); |
if (&Apache::lonnet::allowed('mcr','/')) { |
if (&Apache::lonnet::allowed('mcr','/')) { |
Line 328 $jsback
|
Line 329 $jsback
|
ENDSCRIPT |
ENDSCRIPT |
|
|
my %lt=&Apache::lonlocal::texthash( |
my %lt=&Apache::lonlocal::texthash( |
'srch' => "User Search", |
'srch' => "User Search to add/modify roles of", |
'username' => "username", |
'username' => "username", |
'domain' => "domain", |
'domain' => "domain", |
'lastname' => "last name", |
'lastname' => "last name", |
Line 338 ENDSCRIPT
|
Line 339 ENDSCRIPT
|
$r->print(&Apache::loncommon::start_page('Create Users, Change User Privileges',$jscript)); |
$r->print(&Apache::loncommon::start_page('Create Users, Change User Privileges',$jscript)); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.usersrchform,'','')", |
({href=>"javascript:backPage(document.usersrchform,'','')", |
text=>"User/custom role search", |
text=>"User modify/custom role edit", |
faq=>282,bug=>'Instructor Interface',}, |
faq=>282,bug=>'Instructor Interface',}, |
{href=>"javascript:backPage(document.usersrchform,'get_user_info','select')", |
{href=>"javascript:backPage(document.usersrchform,'get_user_info','select')", |
text=>"Select User", |
text=>"Select User", |
Line 346 ENDSCRIPT
|
Line 347 ENDSCRIPT
|
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management')); |
$r->print(&Apache::lonhtmlcommon::breadcrumbs('User Management')); |
$r->print("<b>$lt{'srch'}</b><br />"); |
$r->print("<b>$lt{'srch'}</b><br />"); |
$r->print(&entry_form($srch->{'srchdomain'},$srch)); |
$r->print(&entry_form($srch->{'srchdomain'},$srch)); |
$r->print('<h3>'.&mt('Select a user').'</h3>'); |
$r->print('<h3>'.&mt('Select a user to add/modify roles of').'</h3>'); |
$r->print('<form name="usersrchform" method="post">'. |
$r->print('<form name="usersrchform" method="post">'. |
&Apache::loncommon::start_data_table()."\n". |
&Apache::loncommon::start_data_table()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
&Apache::loncommon::start_data_table_header_row()."\n". |
Line 359 ENDSCRIPT
|
Line 360 ENDSCRIPT
|
$r->print(&Apache::loncommon::end_data_table_header_row()); |
$r->print(&Apache::loncommon::end_data_table_header_row()); |
|
|
my @sorted_users = sort { |
my @sorted_users = sort { |
lc($srch_results->{$a}->{$sortby}) cmp lc($srch_results->{$b}->{$sortby}) |
lc($srch_results->{$a}->{$sortby}) cmp lc($srch_results->{$b}->{$sortby}) |
|| |
|| |
lc($srch_results->{$a}->{lastname}) cmp lc($srch_results->{$b}->{lastname}) |
lc($srch_results->{$a}->{lastname}) cmp lc($srch_results->{$b}->{lastname}) |
|| |
|| |
lc($srch_results->{$a}->{firstname}) cmp lc($srch_results->{$b}->{firstname}) |
lc($srch_results->{$a}->{firstname}) cmp lc($srch_results->{$b}->{firstname}) |
|
|| |
|
lc($a) cmp lc($b) |
} (keys(%$srch_results)); |
} (keys(%$srch_results)); |
|
|
foreach my $user (@sorted_users) { |
foreach my $user (@sorted_users) { |
Line 630 ENDSECCODE
|
Line 633 ENDSECCODE
|
$js,{'add_entries' => \%loaditem,}); |
$js,{'add_entries' => \%loaditem,}); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.cu)", |
({href=>"javascript:backPage(document.cu)", |
text=>"User/custom role search", |
text=>"User modify/custom role edit", |
faq=>282,bug=>'Instructor Interface',}); |
faq=>282,bug=>'Instructor Interface',}); |
|
|
if ($env{'form.phase'} eq 'userpicked') { |
if ($env{'form.phase'} eq 'userpicked') { |
Line 1230 sub update_user_data {
|
Line 1233 sub update_user_data {
|
$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=>"User/custom role search", |
text=>"User modify/custom role edit", |
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 |
Line 1883 sub custom_role_editor {
|
Line 1886 sub custom_role_editor {
|
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script)); |
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script)); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.form1,'','')", |
({href=>"javascript:backPage(document.form1,'','')", |
text=>"User/custom role search", |
text=>"User modify/custom role edit", |
faq=>282,bug=>'Instructor Interface',}, |
faq=>282,bug=>'Instructor Interface',}, |
{href=>"javascript:backPage(document.form1,'','')", |
{href=>"javascript:backPage(document.form1,'','')", |
text=>"Edit custom role", |
text=>"Edit custom role", |
Line 2023 sub set_custom_role {
|
Line 2026 sub set_custom_role {
|
$r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript); |
$r->print(&Apache::loncommon::start_page('Save Custom Role'),$jscript); |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>"javascript:backPage(document.customresult,'','')", |
({href=>"javascript:backPage(document.customresult,'','')", |
text=>"User/custom role search", |
text=>"User modify/custom role edit", |
faq=>282,bug=>'Instructor Interface',}, |
faq=>282,bug=>'Instructor Interface',}, |
{href=>"javascript:backPage(document.customresult,'selected_custom_edit','')", |
{href=>"javascript:backPage(document.customresult,'selected_custom_edit','')", |
text=>"Edit custom role", |
text=>"Edit custom role", |
Line 2236 sub user_search_result {
|
Line 2239 sub user_search_result {
|
&build_search_response($srch,%srch_results); |
&build_search_response($srch,%srch_results); |
} |
} |
} else { |
} else { |
my %courseusers = &get_courseusers(); |
my $courseusers = &get_courseusers(); |
if ($srch->{'srchtype'} eq 'exact') { |
if ($srch->{'srchtype'} eq 'exact') { |
if (exists($courseusers{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) { |
if (exists($courseusers->{$srch->{'srchterm'}.':'.$srch->{'srchdomain'}})) { |
$state = 'modify'; |
$state = 'modify'; |
} else { |
} else { |
($state,$response,$forcenewuser) = |
($state,$response,$forcenewuser) = |
&build_search_response($srch,%srch_results); |
&build_search_response($srch,%srch_results); |
} |
} |
} else { |
} else { |
foreach my $user (keys(%courseusers)) { |
foreach my $user (keys(%$courseusers)) { |
my ($cuname,$cudomain) = split(/:/,$user); |
my ($cuname,$cudomain) = split(/:/,$user); |
if ($cudomain eq $srch->{'srchdomain'}) { |
if ($cudomain eq $srch->{'srchdomain'}) { |
if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) { |
if ($cuname =~ /\Q$srch->{'srchterm'}\E/i) { |
$srch_results{$user} = ''; |
$srch_results{$user} = |
|
{&Apache::lonnet::get('environment', |
|
['firstname', |
|
'lastname', |
|
'permanentemail'])}; |
} |
} |
} |
} |
} |
} |
Line 2271 sub user_search_result {
|
Line 2278 sub user_search_result {
|
($state,$response,$forcenewuser) = |
($state,$response,$forcenewuser) = |
&build_search_response($srch,%srch_results); |
&build_search_response($srch,%srch_results); |
} elsif ($srch->{'srchin'} eq 'crs') { |
} elsif ($srch->{'srchin'} eq 'crs') { |
my %courseusers = &get_courseusers(); |
my $courseusers = &get_courseusers(); |
foreach my $user (keys(%courseusers)) { |
foreach my $user (keys(%$courseusers)) { |
my ($uname,$udom) = split(/:/,$user); |
my ($uname,$udom) = split(/:/,$user); |
my %names = &Apache::loncommon::getnames($uname,$udom); |
my %names = &Apache::loncommon::getnames($uname,$udom); |
my %emails = &Apache::loncommon::getemails($uname,$udom); |
my %emails = &Apache::loncommon::getemails($uname,$udom); |
Line 2363 sub directorysrch_check {
|
Line 2370 sub directorysrch_check {
|
return &mt('Directory search has not been configured for domain: [_1]',$srch->{'srchdomain'}); |
return &mt('Directory search has not been configured for domain: [_1]',$srch->{'srchdomain'}); |
} |
} |
my %longtext = &Apache::lonlocal::texthash ( |
my %longtext = &Apache::lonlocal::texthash ( |
uname => 'username', |
uname => 'username', |
lastfirst => 'last name, first name', |
lastfirst => 'last name, first name', |
lastname => 'last name', |
lastname => 'last name', |
contains => 'is contained in', |
contains => 'is contained in', |
exact => 'as exact match to' |
exact => 'as exact match to' |
); |
); |
if ($can_search) { |
if ($can_search) { |
if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') { |
if (ref($dom_inst_srch{'directorysrch'}{'searchby'}) eq 'ARRAY') { |
Line 2391 sub directorysrch_check {
|
Line 2398 sub directorysrch_check {
|
|
|
sub get_courseusers { |
sub get_courseusers { |
my %advhash; |
my %advhash; |
|
my $classlist = &Apache::loncoursedata::get_classlist(); |
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
my %coursepersonnel=&Apache::lonnet::get_course_adv_roles(); |
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach my $role (sort(keys(%coursepersonnel))) { |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
foreach my $user (split(/\,/,$coursepersonnel{$role})) { |
$advhash{$user} = ''; |
if (!exists($classlist->{$user})) { |
|
$classlist->{$user} = []; |
|
} |
} |
} |
} |
} |
my $classlist = &Apache::loncoursedata::get_classlist(); |
return $classlist; |
my %combined = (%advhash, %{$classlist}); |
|
return %combined; |
|
} |
} |
|
|
sub build_search_response { |
sub build_search_response { |