--- loncom/interface/loncreateuser.pm 2006/06/29 17:38:44 1.126
+++ loncom/interface/loncreateuser.pm 2006/11/21 21:38:44 1.134
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.126 2006/06/29 17:38:44 albertel Exp $
+# $Id: loncreateuser.pm,v 1.134 2006/11/21 21:38:44 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -116,6 +116,20 @@ sub authorpriv {
return 1;
}
+# ====================================================
+
+sub portfolio_quota {
+ my ($ccuname,$ccdomain) = @_;
+ my %lt = &Apache::lonlocal::texthash(
+ 'disk' => "Disk space allocated to user's portfolio files",
+ );
+ my $output = '
'.$lt{'disk'}.'
'.
+ ' Mb';
+ return $output;
+}
+
# =================================================================== Phase one
sub print_username_entry_form {
@@ -313,18 +327,27 @@ sub print_user_modification_page {
alert("Section designations do not apply to Course Coordinator roles.\\nA course coordinator role will be added with access to all sections.");
section = "";
}
+ var coursename = "_$dcdom"+"_"+course+"_"+userrole
var numcourse = getIndex(document.cu.dccourse);
if (numcourse == "-1") {
alert("There was a problem with your course selection");
return
}
- else {
- var coursename = "_$dcdom"+"_"+course+"_"+userrole
- document.cu.elements[numcourse].name = "act"+coursename
- document.cu.elements[numcourse+5].name = "sec"+coursename
- document.cu.elements[numcourse+5].value = section
- document.cu.elements[numcourse+7].name = "start"+coursename
- document.cu.elements[numcourse+8].name = "end"+coursename
+ else {
+ document.cu.elements[numcourse].name = "act"+coursename;
+ var numnewsec = getIndex(document.cu.newsec);
+ if (numnewsec != "-1") {
+ document.cu.elements[numnewsec].name = "sec"+coursename;
+ document.cu.elements[numnewsec].value = section;
+ }
+ var numstart = getIndex(document.cu.start);
+ if (numstart != "-1") {
+ document.cu.elements[numstart].name = "start"+coursename;
+ }
+ var numend = getIndex(document.cu.end);
+ if (numend != "-1") {
+ document.cu.elements[numend].name = "end"+coursename
+ }
}
}
document.cu.submit();
@@ -340,7 +363,7 @@ sub print_user_modification_page {
}
function setType() {
- var crstype = 'Course'
+ var crstype = document.cu.crstype.options[document.cu.crstype.selectedIndex].value;
rolevals = new Array("$rolevalslist");
if (crstype == 'Group') {
if (document.cu.currsec.options[0].text == "$pickcrsfirst") {
@@ -378,7 +401,6 @@ ENDSCRIPT
var str = document.cu.elements[i].name;
var checkcurr = str.match(re1);
if (checkcurr != null) {
- var re2 = /^currsec_[a-zA-Z0-9]+_[a-zA-Z0-9]+_(\\w+)\$/;
if (document.cu.elements[i-1].checked == true) {
var re2 = /^currsec_[a-zA-Z0-9]+_[a-zA-Z0-9]+_(\\w+)\$/;
match = re2.exec(str);
@@ -439,8 +461,8 @@ ENDSCRIPT
}
}
}
- document.cu.elements[i+2].value = sections;
}
+ document.cu.elements[i+2].value = sections;
}
}
}
@@ -493,6 +515,11 @@ ENDFORMINFO
'hs' => "Home Server",
'lg' => "Login Data"
);
+ my $portfolioform;
+ if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
+ # Current user has quota modification privileges
+ $portfolioform = &portfolio_quota($ccuname,$ccdomain);
+ }
my $genhelp=&Apache::loncommon::help_open_topic('Generation');
&initialize_authen_forms();
$r->print(< "ERROR",
@@ -795,7 +825,7 @@ $lt{'uuas'} ($currentauth). $lt{'sldb'}.
$authformloc
ENDBADAUTH
} else {
- # This user is not allowed to modify the users
+ # This user is not allowed to modify the user's
# authentication scheme, so just notify them of the problem
my %lt=&Apache::lonlocal::texthash(
'err' => "ERROR",
@@ -804,9 +834,6 @@ ENDBADAUTH
);
$r->print(<
-
$lt{'err'}:
$lt{'uuas'} ($currentauth). $lt{'adcs'}.
@@ -837,7 +864,7 @@ ENDBADAUTH
"
$authformint
$authformfsys
";
}
$authformcurrent.=' (will override current values) ';
- if (&Apache::lonnet::allowed('mau',$env{'request.role.domain'})) {
+ if (&Apache::lonnet::allowed('mau',$ccdomain)) {
# Current user has login modification privileges
my %lt=&Apache::lonlocal::texthash(
'ccld' => "Change Current Login Data",
@@ -855,6 +882,23 @@ $loginscript
$lt{'enld'}
$authform_other
ENDOTHERAUTHS
+ } else {
+ if (&Apache::lonnet::allowed('mau',$env{'request.role.domain'})) {
+ my %lt=&Apache::lonlocal::texthash(
+ 'ccld' => "Change Current Login Data",
+ 'yodo' => "You do not have privileges to modify the authentication configuration for this user.",
+ 'ifch' => "If a change is required, contact a domain coordinator for the domain",
+ );
+ $r->print(<
+
$lt{'ccld'}
+$lt{'yodo'} $lt{'ifch'}: $ccdomain
+ENDNOPRIV
+ }
+ }
+ if (&Apache::lonnet::allowed('mpq',$env{'request.role.domain'})) {
+ # Current user has quota modification privileges
+ $r->print(&portfolio_quota($ccuname,$ccdomain));
}
} ## End of "check for bad authentication type" logic
} ## End of new user/old user logic
@@ -1103,8 +1147,8 @@ ENDMODIFYUSERHEAD
if (! $env{'form.makeuser'} ) {
# Check for need to change
my %userenv = &Apache::lonnet::get
- ('environment',['firstname','middlename','lastname','generation'],
- $env{'form.ccdomain'},$env{'form.ccuname'});
+ ('environment',['firstname','middlename','lastname','generation',
+ 'portfolioquota'],$env{'form.ccdomain'},$env{'form.ccuname'});
my ($tmp) = keys(%userenv);
if ($tmp =~ /^(con_lost|error)/i) {
%userenv = ();
@@ -1114,13 +1158,31 @@ ENDMODIFYUSERHEAD
# Strip leading and trailing whitespace
$env{'form.c'.$_} =~ s/(\s+$|^\s+)//g;
}
+ my ($quotachanged,$namechanged,$oldportfolioquota);
+ my %changeHash;
+ if (exists($userenv{'portfolioquota'})) {
+ $oldportfolioquota = $userenv{'portfolioquota'};
+ if (exists($env{'form.portfolioquota'})) {
+ if ($env{'form.portfolioquota'} ne $userenv{'portfolioquota'}) {
+ if (&Apache::lonnet::allowed('mpq',$env{'form.ccdomain'})) {
+ # Current user has quota modification privileges
+ $quotachanged = 1;
+ $changeHash{'portfolioquota'} = $env{'form.portfolioquota'};
+ }
+ }
+ }
+ } else {
+ $oldportfolioquota = &default_quota($env{'form.ccdomain'});
+ }
if (&Apache::lonnet::allowed('mau',$env{'form.ccdomain'}) &&
($env{'form.cfirstname'} ne $userenv{'firstname'} ||
$env{'form.cmiddlename'} ne $userenv{'middlename'} ||
$env{'form.clastname'} ne $userenv{'lastname'} ||
$env{'form.cgeneration'} ne $userenv{'generation'} )) {
+ $namechanged = 1;
+ }
+ if ($namechanged) {
# Make the change
- my %changeHash;
$changeHash{'firstname'} = $env{'form.cfirstname'};
$changeHash{'middlename'} = $env{'form.cmiddlename'};
$changeHash{'lastname'} = $env{'form.clastname'};
@@ -1136,6 +1198,7 @@ ENDMODIFYUSERHEAD
'mddl' => "middle",
'lst' => "last",
'gen' => "generation",
+ 'disk' => "disk space allocated to portfolio files",
'prvs' => "Previous",
'chto' => "Changed To"
);
@@ -1146,17 +1209,21 @@ ENDMODIFYUSERHEAD
$lt{'frst'}
$lt{'mddl'}
$lt{'lst'}
-
$lt{'gen'}
+
$lt{'gen'}
+
$lt{'disk'}
$lt{'prvs'}
$userenv{'firstname'}
$userenv{'middlename'}
$userenv{'lastname'}
-
$userenv{'generation'}
+
$userenv{'generation'}
+
$oldportfolioquota
+
$lt{'chto'}
$env{'form.cfirstname'}
$env{'form.cmiddlename'}
$env{'form.clastname'}
-
$env{'form.cgeneration'}
+
$env{'form.cgeneration'}
+
$env{'form.portfolioquota'} Mb
END
} else { # error occurred
@@ -1165,18 +1232,30 @@ END
$env{'form.ccdomain'}."");
}
} else { # End of if ($env ... ) logic
+ my $putresult;
+ if ($quotachanged) {
+ $putresult = &Apache::lonnet::put
+ ('environment',\%changeHash,
+ $env{'form.ccdomain'},$env{'form.ccuname'});
+ }
# They did not want to change the users name but we can
# still tell them what the name is
my %lt=&Apache::lonlocal::texthash(
'usr' => "User",
'id' => "in domain",
- 'gen' => "Generation"
+ 'gen' => "Generation",
+ 'disk' => "Disk space allocated to user's portfolio files",
);
- $r->print(<<"END");
+ $r->print(<<"END");