[LON-CAPA-cvs] cvs: loncom(GCI_1) /interface loncreateuser.pm
raeburn
raeburn@source.lon-capa.org
Mon, 14 Sep 2009 17:21:27 -0000
This is a MIME encoded message
--raeburn1252948887
Content-Type: text/plain
raeburn Mon Sep 14 17:21:27 2009 EDT
Modified files: (Branch: GCI_1)
/loncom/interface loncreateuser.pm
Log:
- loncreateuser.pm for GCI_1 updated to 2.8.X
- Reversing changes in 1.265 (not included in 2.8.X).
- Backport 1.269, 1.270, 1.271, 1.272, 1.273, 1.281, 1.283, 1.287.
--raeburn1252948887
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20090914172127.txt"
Index: loncom/interface/loncreateuser.pm
diff -u loncom/interface/loncreateuser.pm:1.268 loncom/interface/loncreateuser.pm:1.268.4.1
--- loncom/interface/loncreateuser.pm:1.268 Sun Dec 14 14:36:18 2008
+++ loncom/interface/loncreateuser.pm Mon Sep 14 17:21:26 2009
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Create a user
#
-# $Id: loncreateuser.pm,v 1.268 2008/12/14 14:36:18 raeburn Exp $
+# $Id: loncreateuser.pm,v 1.268.4.1 2009/09/14 17:21:26 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -213,7 +213,6 @@
$tool_on = '';
}
}
- $curr_access = &Apache::lonnet::usertools_access($ccuname,$ccdomain,$item);
$output .= ' <tr class="LC_info_row">'."\n".
' <td>'.$lt{$item}.'</td>'."\n".
' </tr>'."\n".
@@ -770,8 +769,9 @@
my $authtype = $rules->{$matchedrule}{'authtype'};
if ($authtype !~ /^(krb4|krb5|int|fsys|loc)$/) {
$r->print(&Apache::lonuserutils::set_login($ccdomain,$authformkrb,$authformint,$authformloc));
- } else {
+ } else {
my $authparm = $rules->{$matchedrule}{'authparm'};
+ $authmsg = $rules->{$matchedrule}{'authmsg'};
if ($authtype =~ /^krb(4|5)$/) {
my $ver = $1;
if ($authparm ne '') {
@@ -780,7 +780,6 @@
<input type="hidden" name="krbver" value="$ver" />
<input type="hidden" name="krbarg" value="$authparm" />
KERB
- $authmsg = $rules->{$matchedrule}{'authmsg'};
}
} else {
$fixedauth =
@@ -789,8 +788,16 @@
$fixedauth .=
'<input type="hidden" name="'.$authtype.'arg" value="'.$authparm.'" />'."\n";
} else {
- $varauth =
+ if ($authtype eq 'int') {
+ $varauth = '<br />'.
+&mt('[_1] Internally authenticated (with initial password [_2])','','<input type="password" size="10" name="intarg" value="" />')."<label><input type=\"checkbox\" name=\"visible\" onClick='if (this.checked) { this.form.intarg.type=\"text\" } else { this.form.intarg.type=\"password\" }' />".&mt('Visible input').'</label>';
+ } elsif ($authtype eq 'loc') {
+ $varauth = '<br />'.
+&mt('[_1] Local Authentication with argument [_2]','','<input type="text" name="'.$authtype.'arg" value="" />')."\n";
+ } else {
+ $varauth =
'<input type="text" name="'.$authtype.'arg" value="" />'."\n";
+ }
}
}
}
@@ -1554,11 +1561,15 @@
}
} else {
if ($context eq 'selfcreate') {
- if ($canmodify{$item}) {
- $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
- $editable ++;
+ if (($item eq 'permanentemail') && ($newuser eq 'email')) {
+ $row .= $ccuname;
} else {
- $hiderow = 1;
+ if ($canmodify{$item}) {
+ $row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
+ $editable ++;
+ } else {
+ $hiderow = 1;
+ }
}
} else {
$row .= '<input type="text" name="c'.$item.'" size="'.$textboxsize{$item}.'" value="" />';
@@ -1680,8 +1691,8 @@
}
if ( $env{'form.ccuname'} ne
&LONCAPA::clean_username($env{'form.ccuname'}) ) {
- $r->print($error.&mt('Invalid login name').'. '.
- &mt('Only letters, numbers, periods, dashes, @, and underscores are valid').'.'.
+ $r->print($error.&mt('Invalid login name.').' '.
+ &mt('Only letters, numbers, periods, dashes, @, and underscores are valid.').
$end.$rtnlink);
return;
}
@@ -1691,8 +1702,8 @@
}
if ( $env{'form.ccdomain'} ne
&LONCAPA::clean_domain($env{'form.ccdomain'}) ) {
- $r->print($error.&mt ('Invalid domain name').'. '.
- &mt('Only letters, numbers, periods, dashes, and underscores are valid').'.'.
+ $r->print($error.&mt ('Invalid domain name.').' '.
+ &mt('Only letters, numbers, periods, dashes, and underscores are valid.').
$end.$rtnlink);
return;
}
@@ -2071,7 +2082,6 @@
}
} else {
$changed{$tool} = &tool_admin($tool,'',\%changeHash);
- print STDERR "for $tool - changed is $changed{$tool}\n";
if ($changed{$tool}) {
$newaccess{$tool} = &mt('default');
} else {
@@ -2125,18 +2135,20 @@
&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);
+ my %newenvhash;
+ foreach my $key (keys(%changed)) {
+ if ($key ne 'quota') {
+ $newenvhash{'environment.tools.'.$key} =
+ $changeHash{'tools.'.$key};
+ $newenvhash{'environment.availabletools.'.$key} =
+ $changeHash{'tools.'.$key};
+ }
+ }
+ if (keys(%newenvhash)) {
+ &Apache::lonnet::appenv(\%newenvhash);
+ }
}
}
}
@@ -2928,34 +2940,35 @@
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})) {
@@ -3364,127 +3377,101 @@
listusers => 'Display Co-authors and Manage Multiple Users',
},
course => {
- upload => 'File of Course Users',
- singleuser => 'Single Course User',
- listusers => 'Course User Lists',
+ upload => 'Upload a File of Course Users',
+ singleuser => 'Add/Modify a Single Course User',
+ listusers => 'Display Class Lists and Manage Multiple Users',
},
);
- my @menu = ( {categorytitle => 'Add Users',
- items =>
- [{
- linktext => $links{$context}{'upload'},
- icon => 'sctr.png',
- #help => 'Course_Create_Class_List',
- url => '/adm/createuser?action=upload',
- permission => $permission->{'cusr'},
- linktitle => 'Upload a CSV or a text file containing users.',
- },
- {
- linktext => $links{$context}{'singleuser'},
- icon => 'edit-redo.png',
- #help => 'Course_Change_Privileges',
- url => '/adm/createuser?action=singleuser',
- permission => $permission->{'cusr'},
- linktitle => 'Add a user with a certain role to this course.',
- }]},
- {categorytitle => 'Administration',
- items =>
- [{
- linktext => $links{$context}{'listusers'},
- icon => 'edit-find.png',
- #help => 'Course_View_Class_List',
- url => '/adm/createuser?action=listusers',
- permission => ($permission->{'view'} || $permission->{'cusr'}),
- linktitle => 'Show and manage users of this course.',
- }]},
- {categorytitle => 'Configuration',
- items =>
- [
- ]},
- );
-
- if ($context eq 'domain'){
-
- push(@{ $menu[1]->{items} },
- { linktext => 'Custom Roles',
- icon => 'emblem-photos.png',
- #help => 'Course_Editing_Custom_Roles',
- url => '/adm/createuser?action=custom',
- permission => $permission->{'custom'},
- linktitle => 'Configure a custom role.',
- });
-
- }elsif ($context eq 'course'){
- my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
-
- push(@{ $menu[0]->{items} },
- { linktext => 'Single Student',
- #help => 'Course_Add_Student',
- icon => 'list-add.png',
- url => '/adm/createuser?action=singlestudent',
- permission => $permission->{'cusr'},
- linktitle => 'Add a user with the role student to this course.',
- });
-
- push(@{ $menu[1]->{items} },
- { linktext => 'Drop Students',
- icon => 'edit-undo.png',
- #help => 'Course_Drop_Student',
- url => '/adm/createuser?action=drop',
- permission => $permission->{'cusr'},
- linktitle =>'Remove a student from this course.',
- },
- { linktext => 'Custom Roles',
- icon => 'emblem-photos.png',
- #help => 'Course_Editing_Custom_Roles',
- url => '/adm/createuser?action=custom',
- permission => $permission->{'custom'},
- linktitle => 'Configure a custom role.',
- });
-
- if (!exists($permission->{'cusr_section'})){
-
- push(@{ $menu[2]->{items} },
- { linktext => 'Automated Enrollment',
- icon => 'roles.png',
- #help => 'Course_Automated_Enrollment',
- permission => (&Apache::lonnet::auto_run($cnum,$cdom)
- && $permission->{'cusr'}),
- url => '/adm/populate',
- linktitle => 'Automated enrollment manager.',
- },
- { linktext => 'User Self-Enrollment',
- icon => 'cstr.png',
- #help => 'Course_Self_Enrollment',
- url => '/adm/createuser?action=selfenroll',
- permission => $permission->{'cusr'},
- linktitle => 'Configure user self enrollment.',
- });
-
- }
-
- push(@{ $menu[2]->{items} },
- { linktext => 'Course Groups',
- icon => 'conf.png',
- #help => 'Course_Manage_Group',
- url => '/adm/coursegroups?refpage=cusr',
- permission => $permission->{'grp_manage'},
- linktitle => 'Manage course groups.',
- },
- { linktext => 'Change Logs',
- 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);
+ my @menu =
+ (
+ { text => $links{$context}{'upload'},
+ help => 'Course_Create_Class_List',
+ action => 'upload',
+ permission => $permission->{'cusr'},
+ },
+ { text => $links{$context}{'singleuser'},
+ help => 'Course_Change_Privileges',
+ action => 'singleuser',
+ permission => $permission->{'cusr'},
+ },
+ { text => $links{$context}{'listusers'},
+ help => 'Course_View_Class_List',
+ action => 'listusers',
+ permission => ($permission->{'view'} || $permission->{'cusr'}),
+ },
+ );
+ if ($context eq 'domain' || $context eq 'course') {
+ my $customlink = { text => 'Edit Custom Roles',
+ help => 'Course_Editing_Custom_Roles',
+ action => 'custom',
+ permission => $permission->{'custom'},
+ };
+ push(@menu,$customlink);
+ }
+ if ($context eq 'course') {
+ my ($cnum,$cdom) = &Apache::lonuserutils::get_course_identity();
+ my @courselinks =
+ (
+ { text => 'Enroll a Single Student',
+ help => 'Course_Add_Student',
+ action => 'singlestudent',
+ permission => $permission->{'cusr'},
+ },
+ { text => 'Drop Students',
+ help => 'Course_Drop_Student',
+ action => 'drop',
+ permission => $permission->{'cusr'},
+ });
+ if (!exists($permission->{'cusr_section'})) {
+ push(@courselinks,
+ { text => 'Automated Enrollment Manager',
+ help => 'Course_Automated_Enrollment',
+ permission => (&Apache::lonnet::auto_run($cnum,$cdom)
+ && $permission->{'cusr'}),
+ url => '/adm/populate',
+ },
+ { text => 'Configure User Self-enrollment',
+ help => 'Course_Self_Enrollment',
+ action => 'selfenroll',
+ permission => $permission->{'cusr'},
+ });
+ }
+ push(@courselinks,
+ { text => 'Manage Course Groups',
+ help => 'Course_Manage_Group',
+ permission => $permission->{'grp_manage'},
+ url => '/adm/coursegroups?refpage=cusr',
+ },
+ { text => 'View Change Logs',
+ help => 'Course_User_Logs',
+ action => 'changelogs',
+ permission => $permission->{'cusr'},
+ },);
# { text => 'View Log-in History',
# help => 'Course_User_Logins',
# action => 'logins',
# permission => $permission->{'cusr'},
# });
+ push(@menu,@courselinks);
+ }
+ my $menu_html = '';
+ foreach my $menu_item (@menu) {
+ next if (! $menu_item->{'permission'});
+ $menu_html.='<p>';
+ if (exists($menu_item->{'help'})) {
+ $menu_html.=
+ &Apache::loncommon::help_open_topic($menu_item->{'help'});
+ }
+ $menu_html.='<font size="+1">';
+ if (exists($menu_item->{'url'})) {
+ $menu_html.=qq{<a href="$menu_item->{'url'}">};
+ } else {
+ $menu_html.=
+ qq{<a href="/adm/createuser?action=$menu_item->{'action'}">}; }
+ $menu_html.= &mt($menu_item->{'text'}).'</a></font>';
+ $menu_html.='</p>';
+ }
+ return $menu_html;
}
sub restore_prev_selections {
@@ -3687,9 +3674,10 @@
my ($visible,$cansetvis,$vismsgs,$visactions) = &visible_in_cat($cdom,$cnum);
if (ref($visactions) eq 'HASH') {
if ($visible) {
- $output .= '<p>'.$visactions->{'vis'}.'</p>';
+ $output .= '<p class="LC_info">'.$visactions->{'vis'}.'</p>';
} else {
- $output .= $visactions->{'miss'}.'<br />'.$visactions->{'yous'}.
+ $output .= '<p class="LC_warning">'.$visactions->{'miss'}.'</p>'
+ .$visactions->{'yous'}.
'<p>'.$visactions->{'gen'}.'<br />'.$visactions->{'coca'};
if (ref($vismsgs) eq 'ARRAY') {
$output .= '<br />'.$visactions->{'make'}.'<ul>';
--raeburn1252948887--