'.$user_quota_text);
+ if ($user_tools_text ne '') {
+ $r->print($user_tools_text);
+ }
+ if ($env{'form.action'} eq 'singlestudent') {
+ $r->print(&date_sections_select($context,$newuser,$formname));
+ }
+ } elsif ($user_tools_text ne '') {
+ $r->print('
'.$user_tools_text);
if ($env{'form.action'} eq 'singlestudent') {
$r->print(&date_sections_select($context,$newuser,$formname));
}
@@ -833,10 +927,10 @@ ENDNOPORTPRIV
$addrolesdisplay = $add_domainroles;
}
$r->print(&course_level_dc($env{'request.role.domain'},'Course'));
- $r->print('
'."\n");
+ $r->print('
'."\n");
} elsif ($context eq 'author') {
if ($addrolesdisplay) {
- $r->print('
print('
print(' onClick="auth_check()" \>'."\n");
} else {
@@ -848,7 +942,7 @@ ENDNOPORTPRIV
}
} else {
$r->print(&course_level_table(%inccourses));
- $r->print('
'."\n");
+ $r->print('
'."\n");
}
}
$r->print(&Apache::lonhtmlcommon::echo_form_input(['phase','userrole','ccdomain','prevphase','currstate','ccuname','ccdomain']));
@@ -967,7 +1061,7 @@ sub display_existing_roles {
if (defined($coursedata{'description'})) {
$carea=$coursedata{'description'}.
'
'.&mt('Domain').': '.$coursedom.(' 'x8).
- &Apache::loncommon::syllabuswrapper('Syllabus',$coursedir,$coursedom);
+ &Apache::loncommon::syllabuswrapper(&mt('Syllabus'),$coursedir,$coursedom);
$sortkey.="\0".$coursedata{'description'};
$class=$coursedata{'type'};
} else {
@@ -1396,10 +1490,12 @@ sub modify_login_block {
}
sub personal_data_display {
- my ($ccuname,$ccdomain,$newuser,$context,$inst_results) = @_;
+ my ($ccuname,$ccdomain,$newuser,$context,$inst_results,$rolesarray) = @_;
my ($output,$showforceid,%userenv,%canmodify);
my @userinfo = ('firstname','middlename','lastname','generation',
'permanentemail','id');
+ my $rowcount = 0;
+ my $editable = 0;
if (!$newuser) {
# Get the users information
%userenv = &Apache::lonnet::get('environment',
@@ -1407,7 +1503,10 @@ sub personal_data_display {
'permanentemail','id'],$ccdomain,$ccuname);
%canmodify =
&Apache::lonuserutils::can_modify_userinfo($context,$ccdomain,
- \@userinfo);
+ \@userinfo,$rolesarray);
+ } elsif ($context eq 'selfcreate') {
+ %canmodify = &selfcreate_canmodify($context,$ccdomain,\@userinfo,
+ $inst_results,$rolesarray);
}
my %lt=&Apache::lonlocal::texthash(
'pd' => "Personal Data",
@@ -1416,7 +1515,7 @@ sub personal_data_display {
'lastname' => "Last Name",
'generation' => "Generation",
'permanentemail' => "Permanent e-mail address",
- 'id' => "ID/Student Number",
+ 'id' => "Student/Employee ID",
'lg' => "Login Data"
);
my %textboxsize = (
@@ -1432,40 +1531,93 @@ sub personal_data_display {
&Apache::lonhtmlcommon::start_pick_box();
foreach my $item (@userinfo) {
my $rowtitle = $lt{$item};
+ my $hiderow = 0;
if ($item eq 'generation') {
$rowtitle = $genhelp.$rowtitle;
}
- $output .= &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n";
+ my $row = &Apache::lonhtmlcommon::row_title($rowtitle,undef,'LC_oddrow_value')."\n";
if ($newuser) {
if (ref($inst_results) eq 'HASH') {
if ($inst_results->{$item} ne '') {
- $output .= '
'.$inst_results->{$item};
+ $row .= '
'.$inst_results->{$item};
} else {
- $output .= '
';
+ if ($context eq 'selfcreate') {
+ if ($canmodify{$item}) {
+ $row .= '
';
+ $editable ++;
+ } else {
+ $hiderow = 1;
+ }
+ } else {
+ $row .= '
';
+ }
}
} else {
- $output .= '
';
+ if ($context eq 'selfcreate') {
+ if ($canmodify{$item}) {
+ $row .= '
';
+ $editable ++;
+ } else {
+ $hiderow = 1;
+ }
+ } else {
+ $row .= '
';
+ }
}
} else {
if ($canmodify{$item}) {
- $output .= '
';
+ $row .= '
';
} else {
- $output .= $userenv{$item};
+ $row .= $userenv{$item};
}
if ($item eq 'id') {
$showforceid = $canmodify{$item};
}
}
- $output .= &Apache::lonhtmlcommon::row_closure(1);
+ $row .= &Apache::lonhtmlcommon::row_closure(1);
+ if (!$hiderow) {
+ $output .= $row;
+ $rowcount ++;
+ }
}
$output .= &Apache::lonhtmlcommon::end_pick_box();
if (wantarray) {
- return ($output,$showforceid);
+ if ($context eq 'selfcreate') {
+ return($output,$rowcount,$editable);
+ } else {
+ return ($output,$showforceid);
+ }
} else {
return $output;
}
}
+sub selfcreate_canmodify {
+ my ($context,$dom,$userinfo,$inst_results,$rolesarray) = @_;
+ if (ref($inst_results) eq 'HASH') {
+ my @inststatuses = &get_inststatuses($inst_results);
+ if (@inststatuses == 0) {
+ @inststatuses = ('default');
+ }
+ $rolesarray = \@inststatuses;
+ }
+ my %canmodify =
+ &Apache::lonuserutils::can_modify_userinfo($context,$dom,$userinfo,
+ $rolesarray);
+ return %canmodify;
+}
+
+sub get_inststatuses {
+ my ($insthashref) = @_;
+ my @inststatuses = ();
+ if (ref($insthashref) eq 'HASH') {
+ if (ref($insthashref->{'inststatus'}) eq 'ARRAY') {
+ @inststatuses = @{$insthashref->{'inststatus'}};
+ }
+ }
+ return @inststatuses;
+}
+
# ================================================================= Phase Three
sub update_user_data {
my ($r,$context) = @_;
@@ -1587,6 +1739,7 @@ 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 @usertools = ('aboutme','blog','portfolio');
if ($env{'form.makeuser'}) {
$r->print('
'.&mt('Creating new account.').' ');
# Check for the authentication mode and password
@@ -1646,26 +1799,34 @@ sub update_user_data {
$r->print(&mt('Generating user').': '.$result);
$uhome = &Apache::lonnet::homeserver($env{'form.ccuname'},
$env{'form.ccdomain'});
- if (($uhome ne 'no_host') && ($env{'form.customquota'} == 1)) {
- my (%changeHash,$newportfolioquota);
- if ($env{'form.portfolioquota'} eq '') {
- $newportfolioquota = 0;
- } else {
- $newportfolioquota = $env{'form.portfolioquota'};
- $newportfolioquota =~ s/[^\d\.]//g;
+ my (%changeHash,%newcustom,%changed);
+ 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;
+ }
+ $changed{'quota'} = "a_admin($newcustom{'quota'},\%changeHash);
}
- my $quotachanged = "a_admin($newportfolioquota,\%changeHash);
- if ($quotachanged) {
+ foreach my $item (@usertools) {
+ if ($env{'form.custom'.$item} == 1) {
+ $newcustom{$item} = $env{'form.tools_'.$item};
+ $changed{$item} = &tool_admin($item,$newcustom{$item},\%changeHash);
+ }
+ }
+ 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'};
- my $quotachgresult =
- &Apache::lonnet::put('environment',\%changeHash,
- $env{'form.ccdomain'},$env{'form.ccuname'});
- }
+ my $chgresult =
+ &Apache::lonnet::put('environment',\%changeHash,
+ $env{'form.ccdomain'},$env{'form.ccuname'});
+ }
}
$r->print('
'.&mt('Home server').': '.$uhome.' '.
&Apache::lonnet::hostname($uhome));
@@ -1698,7 +1859,8 @@ sub update_user_data {
# Check for need to change
my %userenv = &Apache::lonnet::get
('environment',['firstname','middlename','lastname','generation',
- 'id','permanentemail','portfolioquota','inststatus'],
+ 'id','permanentemail','portfolioquota','inststatus','tools.aboutme',
+ 'tools.blog','tools.portfolio'],
$env{'form.ccdomain'},$env{'form.ccuname'});
my ($tmp) = keys(%userenv);
if ($tmp =~ /^(con_lost|error)/i) {
@@ -1789,7 +1951,7 @@ sub update_user_data {
$env{'form.c'.$item} = $userenv{$item};
}
}
- # Check to see if we can change the ID/student number
+ # Check to see if we can change the Student/Employee ID
my $forceid = $env{'form.forceid'};
my $recurseid = $env{'form.recurseid'};
my (%alerts,%rulematch,%idinst_results,%curr_rules,%got_rules);
@@ -1800,7 +1962,10 @@ sub update_user_data {
(!$forceid)) {
if ($env{'form.cid'} ne $uidhash{$env{'form.ccuname'}}) {
$env{'form.cid'} = $userenv{'id'};
- $no_forceid_alert = &mt('New student/employeeID does not match existing ID for this user.').'
'.&mt('Change is not permitted without checking the \'Force ID change\' checkbox on the previous page.').'
'."\n";
+ $no_forceid_alert = &mt('New Student/Employee ID does not match existing ID for this user.')
+ .'
'
+ .&mt("Change is not permitted without checking the 'Force ID change' checkbox on the previous page.")
+ .'
'."\n";
}
}
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -1820,14 +1985,17 @@ sub update_user_data {
}
my ($quotachanged,$oldportfolioquota,$newportfolioquota,
$inststatus,$oldisdefault,$newisdefault,$olddefquotatext,
- $newdefquotatext);
+ $newdefquotatext,%oldaccess,%oldaccesstext,%newaccess,%newaccesstext);
my ($defquota,$settingstatus) =
&Apache::loncommon::default_quota($env{'form.ccdomain'},$inststatus);
- my $showquota;
+ my ($showquota,$showtools);
if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
$showquota = 1;
}
- my %changeHash;
+ if (&Apache::lonnet::allowed('mut',$env{'form.ccdomain'})) {
+ $showtools = 1;
+ }
+ my (%changeHash,%changed);
$changeHash{'portfolioquota'} = $userenv{'portfolioquota'};
if ($userenv{'portfolioquota'} ne '') {
$oldportfolioquota = $userenv{'portfolioquota'};
@@ -1839,10 +2007,10 @@ sub update_user_data {
$newportfolioquota =~ s/[^\d\.]//g;
}
if ($newportfolioquota != $oldportfolioquota) {
- $quotachanged = "a_admin($newportfolioquota,\%changeHash);
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
}
} else {
- $quotachanged = "a_admin('',\%changeHash);
+ $changed{'quota'} = "a_admin('',\%changeHash);
$newportfolioquota = $defquota;
$newisdefault = 1;
}
@@ -1856,7 +2024,7 @@ sub update_user_data {
$newportfolioquota = $env{'form.portfolioquota'};
$newportfolioquota =~ s/[^\d\.]//g;
}
- $quotachanged = "a_admin($newportfolioquota,\%changeHash);
+ $changed{'quota'} = "a_admin($newportfolioquota,\%changeHash);
} else {
$newportfolioquota = $defquota;
$newisdefault = 1;
@@ -1868,6 +2036,74 @@ sub update_user_data {
if ($newisdefault) {
$newdefquotatext = &get_defaultquota_text($settingstatus);
}
+
+ foreach my $tool (@usertools) {
+ if ($userenv{'tools.'.$tool} ne '') {
+ $oldaccess{$tool} = &mt('custom');
+ if ($userenv{'tools_'.$tool}) {
+ $oldaccesstext{$tool} = &mt("availability set to 'on'");
+ } else {
+ $oldaccesstext{$tool} = &mt("availability set to 'off'");
+ }
+ $changeHash{'tools.'.$tool} = $userenv{'tools.'.$tool};
+ if ($env{'form.custom'.$tool} == 1) {
+ if ($env{'form.tools_'.$tool} ne $userenv{'tools.'.$tool}) {
+ $changed{$tool} = &tool_admin($tool,$env{'form.tools_'.$tool},
+ \%changeHash);
+ if ($changed{$tool}) {
+ $newaccess{$tool} = &mt('custom');
+ if ($env{'form.tools_'.$tool}) {
+ $newaccesstext{$tool} = &mt("availability set to 'on'");
+ } else {
+ $newaccesstext{$tool} = &mt("availability set to 'off'");
+ }
+ } else {
+ $newaccess{$tool} = $oldaccess{$tool};
+ if ($userenv{'tools.'.$tool}) {
+ $newaccesstext{$tool} = &mt("availability set to 'on'");
+ } else {
+ $newaccesstext{$tool} = &mt("availability set to 'off'");
+ }
+ }
+ } else {
+ $newaccess{$tool} = $oldaccess{$tool};
+ $newaccesstext{$tool} = $oldaccesstext{$tool};
+ }
+ } else {
+ $changed{$tool} = &tool_admin($tool,'',\%changeHash);
+ print STDERR "for $tool - changed is $changed{$tool}\n";
+ if ($changed{$tool}) {
+ $newaccess{$tool} = &mt('default');
+ } else {
+ $newaccess{$tool} = $oldaccess{$tool};
+ if ($userenv{'tools.'.$tool}) {
+ $newaccesstext{$tool} = &mt("availability set to 'on'");
+ } else {
+ $newaccesstext{$tool} = &mt("availability set to 'off'");
+ }
+ }
+ }
+ } else {
+ $oldaccess{$tool} = &mt('default');
+ if ($env{'form.custom'.$tool} == 1) {
+ $changed{$tool} = &tool_admin($tool,$env{'form.tools_'.$tool},
+ \%changeHash);
+ if ($changed{$tool}) {
+ $newaccess{$tool} = &mt('custom');
+ if ($env{'form.tools_'.$tool}) {
+ $newaccesstext{$tool} = &mt("availability set to 'on'");
+ } else {
+ $newaccesstext{$tool} = &mt("availability set to 'off'");
+ }
+ } else {
+ $newaccess{$tool} = $oldaccess{$tool};
+ }
+ } else {
+ $newaccess{$tool} = $oldaccess{$tool};
+ }
+ }
+ }
+
if ($env{'form.cfirstname'} ne $userenv{'firstname'} ||
$env{'form.cmiddlename'} ne $userenv{'middlename'} ||
$env{'form.clastname'} ne $userenv{'lastname'} ||
@@ -1876,18 +2112,33 @@ sub update_user_data {
$env{'form.cpermanentemail'} ne $userenv{'permanentemail'} ) {
$namechanged = 1;
}
- if ($namechanged || $quotachanged) {
+ 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'};
- my ($quotachgresult,$namechgresult);
- if ($quotachanged) {
- $quotachgresult =
+ my ($chgresult,$namechgresult);
+ if (keys(%changed) > 0) {
+ $chgresult =
&Apache::lonnet::put('environment',\%changeHash,
$env{'form.ccdomain'},$env{'form.ccuname'});
+ if ($chgresult eq 'ok') {
+ my %newenvhash;
+ my $hashid="$env{'form.ccuname'}:$env{'form.ccdomain'}";
+ foreach my $key (keys(%changed)) {
+ if ($key ne 'quota') {
+ &Apache::lonnet::devalidate_cache_new('usertools.'.$key,$hashid);
+ $newenvhash{'environment.tools.'.$key} =
+ $changeHash{'tools.'.$key};
+ }
+ }
+ if (($env{'user.name'} eq $env{'form.ccuname'}) &&
+ ($env{'user.domain'} eq $env{'form.ccdomain'})) {
+ &Apache::lonnet::appenv(\%newenvhash);
+ }
+ }
}
if ($namechanged) {
# Make the change
@@ -1906,19 +2157,22 @@ sub update_user_data {
);
}
if (($namechanged && $namechgresult eq 'ok') ||
- ($quotachanged && $quotachgresult 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",
- 'mddl' => "middle",
- 'lst' => "last",
- 'gen' => "generation",
- 'id' => "ID/Student number",
- 'mail' => "permanent e-mail",
- 'disk' => "disk space allocated to portfolio files",
- 'prvs' => "Previous",
- 'chto' => "Changed To"
+ 'uic' => "User Information Changed",
+ 'frst' => "First",
+ 'mddl' => "Middle",
+ 'lst' => "Last",
+ 'gen' => "Generation",
+ 'id' => "Student/Employee ID",
+ 'mail' => "Permanent E-mail",
+ 'disk' => "Disk space allocated to portfolio files",
+ 'blog' => "Blog Availability",
+ 'aboutme' => "Home Page Availability",
+ 'portfolio' => "Portfolio Availability",
+ 'prvs' => "Previous",
+ 'chto' => "Changed To"
);
$r->print('
'.$lt{'uic'}.' '.
&Apache::loncommon::start_data_table().
@@ -1936,6 +2190,12 @@ END
$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");
@@ -1951,10 +2211,16 @@ END
$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'}
+
$lt{'chto'}
$env{'form.cfirstname'}
$env{'form.cmiddlename'}
$env{'form.clastname'}
@@ -1966,6 +2232,12 @@ END
$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().'
');
if ($env{'form.cid'} ne $userenv{'id'}) {
@@ -1994,12 +2266,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' => "ID/Student number",
- '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");
$userenv{'firstname'} $userenv{'middlename'} $userenv{'lastname'} $userenv{'generation'}
@@ -2008,8 +2283,14 @@ END
$r->print(' ['.$lt{'mail'}.': '.
$userenv{'permanentemail'}.']');
}
+ if ($showtools) {
+ foreach my $item (@usertools) {
+ $r->print(' ['.$lt{$item}.': '.$newaccess{$item}.' '.
+ $newaccesstext{$item}.']'."\n");
+ }
+ }
if ($showquota) {
- $r->print(' ['.$lt{'disk'}.': '.$oldportfolioquota.' Mb '.
+ $r->print(' ['.$lt{'disk'}.': '.$oldportfolioquota.' Mb '.
$olddefquotatext.']');
}
$r->print(' ');
@@ -2040,8 +2321,10 @@ END
$r->print('
'.$rolestr.' '.
&mt('Contact your
helpdesk for more information.',"javascript:helpMenu('display')").'
');
}
- $r->print($no_forceid_alert.
- &Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules));
+ $r->print('
'
+ .$no_forceid_alert
+ .&Apache::lonuserutils::print_namespacing_alerts($env{'form.ccdomain'},\%alerts,\%curr_rules)
+ .' ');
}
if ($env{'form.action'} eq 'singlestudent') {
&enroll_single_student($r,$uhome,$amode,$genpwd,$now,$newuser,$context);
@@ -2069,7 +2352,10 @@ END
if ($env{'form.popup'}) {
$r->print('
'.&mt('Close window').'
');
} else {
- $r->print('
'.&mt('Modify this user: ([_1]) ',$userinfo).' '.(' 'x5).''.&mt('Create/Modify Another User').'
');
+ $r->print('
'
+ .&mt('Modify this user: [_1]',''.$env{'form.ccuname'}.':'.$env{'form.ccdomain'}.' ('.$userinfo.') ').' '
+ .(' 'x5).''
+ .&mt('Create/Modify Another User').'
');
}
}
$r->print(&Apache::loncommon::end_page());
@@ -2180,8 +2466,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)) {
@@ -2194,8 +2480,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');
}
@@ -2424,12 +2710,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;
@@ -2539,7 +2840,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));
@@ -2559,10 +2860,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(<
@@ -2622,34 +2928,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})) {
@@ -2665,7 +2972,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
@@ -3070,7 +3377,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'},
@@ -3114,7 +3421,7 @@ sub print_main_menu {
{ text => 'Configure User Self-enrollment',
help => 'Course_Self_Enrollment',
action => 'selfenroll',
- permission => $permission->{'cusr'},
+ permission => $permission->{'cusr'},
});
}
push(@courselinks,
@@ -3127,12 +3434,12 @@ sub print_main_menu {
help => 'Course_User_Logs',
action => 'changelogs',
permission => $permission->{'cusr'},
- },
- { text => 'View Log-in History',
- help => 'Course_User_Logins',
- action => 'logins',
- permission => $permission->{'cusr'},
- });
+ },);
+# { text => 'View Log-in History',
+# help => 'Course_User_Logins',
+# action => 'logins',
+# permission => $permission->{'cusr'},
+# });
push(@menu,@courselinks);
}
my $menu_html = '';
@@ -3148,8 +3455,7 @@ sub print_main_menu {
$menu_html.=qq{};
} else {
$menu_html.=
- qq{ };
- }
+ qq{ }; }
$menu_html.= &mt($menu_item->{'text'}).' ';
$menu_html.='';
}
@@ -3175,14 +3481,203 @@ sub print_selfenroll_menu {
my $groupslist = &Apache::lonuserutils::get_groupslist();
my $setsec_js =
&Apache::lonuserutils::setsections_javascript($formname,$groupslist);
+ my %alerts = &Apache::lonlocal::texthash(
+ acto => 'Activation of self-enrollment was selected for the following domain(s)',
+ butn => 'but no user types have been checked.',
+ wilf => "Please uncheck 'activate' or check at least one type.",
+ );
+ my $selfenroll_js = <<"ENDSCRIPT";
+function update_types(caller,num) {
+ var delidx = getIndexByName('selfenroll_delete');
+ var actidx = getIndexByName('selfenroll_activate');
+ if (caller == 'selfenroll_all') {
+ var selall;
+ for (var i=0; i 0) {
+ var msg = "$alerts{'acto'}\\n";
+ var loopend = needaction.length -1;
+ if (loopend > 0) {
+ for (var m=0; m'."\n".
- $setsec_js."\n".
+ $setsec_js."\n".$selfenroll_js."\n".
''."\n".
- ''.$lt->{'selfenroll'}.' '."\n".
- '