[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm
raeburn
lon-capa-cvs-allow@mail.lon-capa.org
Fri, 21 Dec 2007 05:19:05 -0000
raeburn Fri Dec 21 00:19:05 2007 EDT
Modified files:
/loncom/interface loncommon.pm
Log:
&user_picker() takes two additional arguments - $cancreate,$usertype.
- if $cancreate is true, "Make new user" button is displayed, otherwise
aapropriate message is displayed depending on restrictions which apply to
user creation for current context.
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.626 loncom/interface/loncommon.pm:1.627
--- loncom/interface/loncommon.pm:1.626 Fri Dec 21 00:13:07 2007
+++ loncom/interface/loncommon.pm Fri Dec 21 00:19:04 2007
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.626 2007/12/21 05:13:07 raeburn Exp $
+# $Id: loncommon.pm,v 1.627 2007/12/21 05:19:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -6236,7 +6236,7 @@
}
sub user_picker {
- my ($dom,$srch,$forcenewuser,$caller) = @_;
+ my ($dom,$srch,$forcenewuser,$caller,$cancreate,$usertype) = @_;
my $currdom = $dom;
my %curr_selected = (
srchin => 'dom',
@@ -6330,7 +6330,16 @@
if ($forcenewuser) {
if (ref($srch) eq 'HASH') {
if ($srch->{'srchby'} eq 'uname' && $srch->{'srchtype'} eq 'exact' && $srch->{'srchin'} eq 'dom' && $srch->{'srchdomain'} eq $env{'request.role.domain'}) {
- $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';
+ if ($cancreate) {
+ $new_user_create = '<p> <input type="submit" name="forcenew" value="'.&HTML::Entities::encode(&mt('Make new user "[_1]"',$srchterm),'<>&"').'" onclick="javascript:setSearch(\'1\','.$caller.');" /> </p>';
+ } else {
+ my $helplink = ' href="javascript:helpMenu('."'display'".')"';
+ my %usertypetext = (
+ official => 'institutional',
+ unofficial => 'non-institutional',
+ );
+ $new_user_create = '<br /><span class="LC_warning">'.&mt("You are not authorized to create new $usertypetext{$usertype} users in this domain.").' '.&mt('Contact the <a[_1]>helpdesk</a> for assistance.',$helplink).'</span><br /><br />';
+ }
}
}