[LON-CAPA-cvs] cvs: loncom /interface loncommon.pm /lonnet/perl lonnet.pm
raeburn
raeburn@source.lon-capa.org
Fri, 24 Sep 2010 03:15:05 -0000
raeburn Fri Sep 24 03:15:05 2010 EDT
Modified files:
/loncom/interface loncommon.pm
/loncom/lonnet/perl lonnet.pm
Log:
- Efficiency.
- Speed up retrieval of user tool access settings and course request settings
during &init_user_environment().
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.979 loncom/interface/loncommon.pm:1.980
--- loncom/interface/loncommon.pm:1.979 Tue Aug 24 09:11:37 2010
+++ loncom/interface/loncommon.pm Fri Sep 24 03:14:58 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.979 2010/08/24 09:11:37 wenzelju Exp $
+# $Id: loncommon.pm,v 1.980 2010/09/24 03:14:58 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4699,7 +4699,7 @@
sub dc_courseid_toggle {
my ($dc_info) = @_;
- return ' <span id="dccidtext" class="LC_cusr_subheading">'.
+ return ' <span id="dccidtext" class="LC_cusr_subheading LC_nobreak">'.
'<a href="javascript:showCourseID();">'.
&mt('(More ...)').'</a></span>'.
'<div id="dccid" class="LC_dccid">'.$dc_info.'</div>';
@@ -10649,15 +10649,20 @@
$env{'browser.interface'}=$form->{'interface'};
}
+ my %is_adv = ( is_adv => &Apache::lonnet::is_advanced_user($domain,$username) );
+ my %domdef = &Apache::lonnet::get_domain_defaults($domain);
+
foreach my $tool ('aboutme','blog','portfolio') {
$userenv{'availabletools.'.$tool} =
- &Apache::lonnet::usertools_access($username,$domain,$tool,'reload');
+ &Apache::lonnet::usertools_access($username,$domain,$tool,'reload',
+ undef,\%userenv,\%domdef,\%is_adv);
}
foreach my $crstype ('official','unofficial','community') {
$userenv{'canrequest.'.$crstype} =
&Apache::lonnet::usertools_access($username,$domain,$crstype,
- 'reload','requestcourses');
+ 'reload','requestcourses',
+ \%userenv,\%domdef,\%is_adv);
}
$env{'user.environment'} = "$lonids/$cookie.id";
Index: loncom/lonnet/perl/lonnet.pm
diff -u loncom/lonnet/perl/lonnet.pm:1.1083 loncom/lonnet/perl/lonnet.pm:1.1084
--- loncom/lonnet/perl/lonnet.pm:1.1083 Wed Aug 25 16:34:36 2010
+++ loncom/lonnet/perl/lonnet.pm Fri Sep 24 03:15:04 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network
# TCP networking package
#
-# $Id: lonnet.pm,v 1.1083 2010/08/25 16:34:36 raeburn Exp $
+# $Id: lonnet.pm,v 1.1084 2010/09/24 03:15:04 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4920,7 +4920,7 @@
}
sub usertools_access {
- my ($uname,$udom,$tool,$action,$context) = @_;
+ my ($uname,$udom,$tool,$action,$context,$userenvref,$domdefref,$is_advref)=@_;
my ($access,%tools);
if ($context eq '') {
$context = 'tools';
@@ -4962,9 +4962,14 @@
$toolstatus = $env{'environment.'.$context.'.'.$tool};
$inststatus = $env{'environment.inststatus'};
} else {
- my %userenv = &userenvironment($udom,$uname,$context.'.'.$tool,'inststatus');
- $toolstatus = $userenv{$context.'.'.$tool};
- $inststatus = $userenv{'inststatus'};
+ if (ref($userenvref) eq 'HASH') {
+ $toolstatus = $userenvref->{$context.'.'.$tool};
+ $inststatus = $userenvref->{'inststatus'};
+ } else {
+ my %userenv = &userenvironment($udom,$uname,$context.'.'.$tool,'inststatus');
+ $toolstatus = $userenv{$context.'.'.$tool};
+ $inststatus = $userenv{'inststatus'};
+ }
}
if ($toolstatus ne '') {
@@ -4976,8 +4981,17 @@
return $access;
}
- my $is_adv = &is_advanced_user($udom,$uname);
- my %domdef = &get_domain_defaults($udom);
+ my ($is_adv,%domdef);
+ if (ref($is_advref) eq 'HASH') {
+ $is_adv = $is_advref->{'is_adv'};
+ } else {
+ $is_adv = &is_advanced_user($udom,$uname);
+ }
+ if (ref($domdefref) eq 'HASH') {
+ %domdef = %{$domdefref};
+ } else {
+ %domdef = &get_domain_defaults($udom);
+ }
if (ref($domdef{$tool}) eq 'HASH') {
if ($is_adv) {
if ($domdef{$tool}{'_LC_adv'} ne '') {