\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().' ');
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -2055,12 +2274,15 @@ END
$env{'form.ccdomain'}.' ');
}
} else { # End of if ($env ... ) logic
- # They did not want to change the users name or quota but we can
- # still tell them what the name and quota are
+ # They did not want to change the users name, quota or tool availability,
+ # 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",
- 'disk' => "Disk space allocated to user's portfolio files",
+ 'id' => "Student/Employee ID",
+ 'mail' => "Permanent e-mail",
+ 'disk' => "Disk space allocated to user's portfolio files",
+ 'blog' => "Blog Availability",
+ 'aboutme' => "Home Page Availability",
+ 'portfolio' => "Portfolio Availability",
);
$r->print(<<"END");
');
@@ -2246,8 +2474,8 @@ sub update_roles {
my $result=&Apache::lonnet::assignrole($env{'form.ccdomain'},
$env{'form.ccuname'},$url,$role,0,$now,'','',
$context);
- $output = &mt('Re-enabling [_1] in [_2]: [_3]',
- $role,$url,$result).' ';
+ $output = &mt('Re-enabling [_1] in [_2]: [_3]',
+ $role,$url,''.$result.'').' ';
}
$r->print($output);
if (!grep(/^\Q$role\E$/,@rolechanges)) {
@@ -2260,8 +2488,8 @@ sub update_roles {
my $result = &Apache::lonnet::assigncustomrole(
$env{'form.ccdomain'}, $env{'form.ccuname'},
$url,$rdom,$rnam,$rolename,0,$now,undef,$context);
- $r->print(&mt('Re-enabling custom role [_1] by [_2]@[_3] in [_4] : [_5]',
- $rolename,$rnam,$rdom,$url,$result).' ');
+ $r->print(&mt('Re-enabling custom role [_1] by [_2]:[_3] in [_4] : [_5]',
+ $rolename,$rnam,$rdom,$url,''.$result.'').' ');
if (!grep(/^cr$/,@rolechanges)) {
push(@rolechanges,'cr');
}
@@ -2490,12 +2718,27 @@ sub quota_admin {
my $quotachanged;
if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
# Current user has quota modification privileges
- $quotachanged = 1;
- $changeHash->{'portfolioquota'} = $setquota;
+ if (ref($changeHash) eq 'HASH') {
+ $quotachanged = 1;
+ $changeHash->{'portfolioquota'} = $setquota;
+ }
}
return $quotachanged;
}
+sub tool_admin {
+ my ($tool,$settool,$changeHash) = @_;
+ my $toolchanged;
+ if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
+ # Current user has quota modification privileges
+ if (ref($changeHash) eq 'HASH') {
+ $toolchanged = 1;
+ $changeHash->{'tools.'.$tool} = $settool;
+ }
+ }
+ return $toolchanged;
+}
+
sub build_roles {
my ($sectionstr,$sections,$role) = @_;
my $num_sections = 0;
@@ -2605,7 +2848,7 @@ sub custom_role_editor {
my @template_roles = ("cc","in","ta","ep","st");
foreach my $role (@template_roles) {
$head_script .= &make_script_template($role);
- $button_code .= &make_button_code($role);
+ $button_code .= &make_button_code($role).' ';
}
$head_script .= "\n".$jsback."\n".''."\n";
$r->print(&Apache::loncommon::start_page('Custom Role Editor',$head_script));
@@ -2625,10 +2868,15 @@ sub custom_role_editor {
'crl' => "Course Level",
'dml' => "Domain Level",
'ssl' => "System Level");
- $r->print(&mt('Select a Template').' ');
- $r->print('');
+
+ $r->print('
'
+ .''
+ .'
'
+ );
+
$r->print(<
@@ -2688,34 +2936,35 @@ sub make_script_template {
my ($priv_item, $dummy) = split(/\&/,$priv);
$role_c{$priv_item} = 1;
}
+ my %role_d;
+ @temp = split(/:/,$Apache::lonnet::pr{$role.':d'});
+ foreach my $priv(@temp) {
+ my ($priv_item, $dummy) = split(/\&/,$priv);
+ $role_d{$priv_item} = 1;
+ }
+ my %role_s;
+ @temp = split(/:/,$Apache::lonnet::pr{$role.':s'});
+ foreach my $priv(@temp) {
+ my ($priv_item, $dummy) = split(/\&/,$priv);
+ $role_s{$priv_item} = 1;
+ }
foreach my $priv_item (keys(%full_c)) {
my ($priv, $dummy) = split(/\&/,$priv_item);
- if (exists($role_c{$priv})) {
+ if ((exists($role_c{$priv})) || (exists($role_d{$priv})) ||
+ (exists($role_s{$priv}))) {
$return_script .= "document.form1.$priv"."_c.checked = true;\n";
} else {
$return_script .= "document.form1.$priv"."_c.checked = false;\n";
}
}
- my %role_d;
- @temp = split(/:/,$Apache::lonnet::pr{$role.':d'});
- foreach my $priv(@temp) {
- my ($priv_item, $dummy) = split(/\&/,$priv);
- $role_d{$priv_item} = 1;
- }
foreach my $priv_item (keys(%full_d)) {
my ($priv, $dummy) = split(/\&/,$priv_item);
- if (exists($role_d{$priv})) {
+ if ((exists($role_d{$priv})) || (exists($role_s{$priv}))) {
$return_script .= "document.form1.$priv"."_d.checked = true;\n";
} else {
$return_script .= "document.form1.$priv"."_d.checked = false;\n";
}
}
- my %role_s;
- @temp = split(/:/,$Apache::lonnet::pr{$role.':s'});
- foreach my $priv(@temp) {
- my ($priv_item, $dummy) = split(/\&/,$priv);
- $role_s{$priv_item} = 1;
- }
foreach my $priv_item (keys(%full_s)) {
my ($priv, $dummy) = split(/\&/,$priv_item);
if (exists($role_s{$priv})) {
@@ -2731,7 +2980,7 @@ sub make_script_template {
sub make_button_code {
my ($role) = @_;
my $label = &Apache::lonnet::plaintext($role);
- my $button_code = '';
+ my $button_code = '';
return ($button_code);
}
# ---------------------------------------------------------- Call to definerole
@@ -3136,7 +3385,7 @@ sub print_main_menu {
action => 'upload',
permission => $permission->{'cusr'},
},
- { text => $links{$context}{'singleuser'},
+ { text => $links{$context}{'singleuser'},
help => 'Course_Change_Privileges',
action => 'singleuser',
permission => $permission->{'cusr'},
@@ -3180,7 +3429,7 @@ sub print_main_menu {
{ text => 'Configure User Self-enrollment',
help => 'Course_Self_Enrollment',
action => 'selfenroll',
- permission => $permission->{'cusr'},
+ permission => $permission->{'cusr'},
});
}
push(@courselinks,
@@ -3214,8 +3463,7 @@ sub print_main_menu {
$menu_html.=qq{};
} else {
$menu_html.=
- qq{};
- }
+ qq{}; }
$menu_html.= &mt($menu_item->{'text'}).'';
$menu_html.='';
}
@@ -3609,9 +3857,9 @@ sub visible_in_cat {
dc_chgcat => 'Ask a domain coordinator to change the category assigned to the course, as the one currently assigned is no longer used in the domain',
dc_addcat => 'Ask a domain coordinator to assign a category to the course.',
);
- $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','','');
- $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','','');
- $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','','');
+ $visactions{'unhide'} = &mt('Use [_1]Set course environment[_2] to change the "Exclude from course catalog" setting.','"','"');
+ $visactions{'chgcat'} = &mt('Use [_1]Set course environment[_2] to change the category assigned to the course, as the one currently assigned is no longer used in the domain.','"','"');
+ $visactions{'addcat'} = &mt('Use [_1]Set course environment[_2] to assign a category to the course.','"','"');
if (ref($domconf{'coursecategories'}) eq 'HASH') {
if ($domconf{'coursecategories'}{'togglecats'} eq 'crs') {
$settable{'togglecats'} = 1;
@@ -3621,16 +3869,16 @@ sub visible_in_cat {
}
$cathash = $domconf{'coursecategories'}{'cats'};
}
- if ($settable{'togglecats'} && $settable{'categories'}) {
- $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');
+ if ($settable{'togglecats'} && $settable{'categorize'}) {
+ $cansetvis = &mt('You are able to both assign a course category and choose to exclude this course from the catalog.');
} elsif ($settable{'togglecats'}) {
- $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.');
- } elsif ($settable{'categories'}) {
- $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');
+ $cansetvis = &mt('You are able to choose to exclude this course from the catalog, but only a Domain Coordinator may assign a course category.');
+ } elsif ($settable{'categorize'}) {
+ $cansetvis = &mt('You may assign a course category, but only a Domain Coordinator may choose to exclude this course from the catalog.');
} else {
- $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.');
+ $cansetvis = &mt('Only a Domain Coordinator may assign a course category or choose to exclude this course from the catalog.');
}
-
+
my %currsettings =
&Apache::lonnet::get('environment',['hidefromcat','categories','internal.coursecode'],
$cdom,$cnum);
@@ -3640,7 +3888,7 @@ sub visible_in_cat {
$cathash = $domconf{'coursecategories'}{'cats'};
if (ref($cathash) eq 'HASH') {
if ($cathash->{'instcode::0'} eq '') {
- push(@vismsgs,'dc_addinst');
+ push(@vismsgs,'dc_addinst');
} else {
$visible = 1;
}
@@ -3679,7 +3927,7 @@ sub visible_in_cat {
}
}
if (!$matched) {
- if ($settable{'categories'}) {
+ if ($settable{'categorize'}) {
push(@vismsgs,'chgcat');
} else {
push(@vismsgs,'dc_chgcat');
@@ -3690,9 +3938,9 @@ sub visible_in_cat {
}
} else {
if (ref($cathash) eq 'HASH') {
- if ((keys(%{$cathash}) > 1) ||
+ if ((keys(%{$cathash}) > 1) ||
(keys(%{$cathash}) == 1) && ($cathash->{'instcode::0'} eq '')) {
- if ($settable{'categories'}) {
+ if ($settable{'categorize'}) {
push(@vismsgs,'addcat');
} else {
push(@vismsgs,'dc_addcat');
@@ -4418,10 +4666,30 @@ sub build_search_response {
&Apache::lonuserutils::can_create_user($env{'request.role.domain'},$context);
if ($cancreate) {
my $showdom = &display_domain_info($env{'request.role.domain'});
- $response .= '
'.&mt("To add a new user (you can only create new users in your current role's domain - [_1]):",$env{'request.role.domain'}).'
'.&mt("Set 'Domain/institution to search' to: [_1]",$showdom).'
'.&mt("Set 'Search criteria' to: 'username is ...... in selected LON-CAPA domain'").'
'.&mt('Provide the proposed username').'
'.&mt('Search').'
';
+ $response .= '
'
+ .''.&mt('To add a new user:').''
+ .' '
+ .&mt("(You can only create new users in your current role's domain - [_1])"
+ ,''.$env{'request.role.domain'}.'')
+ .'
'
+ .&mt("Set 'Domain/institution to search' to: [_1]",''.$showdom.'')
+ .'
'
+ .&mt("Set 'Search criteria' to: [_1]username is ..... in selected LON-CAPA domain[_2]",'','')
+ .'
'.&mt("You are not authorized to create new users in your current role's domain - [_1].",$env{'request.role.domain'}).' '.&mt('Contact the helpdesk if you need to create a new user.',$helplink).'
';
+ $response .= '
'
+ .&mt("You are not authorized to create new users in your current role's domain - [_1]."
+ ,''.$env{'request.role.domain'}.'')
+ .' '
+ .&mt('Contact the [_1]helpdesk[_2] if you need to create a new user.'
+ ,' '
+ ,'')
+ .'