--- loncom/interface/loncommon.pm 2007/11/13 01:47:56 1.613
+++ loncom/interface/loncommon.pm 2008/03/18 23:00:51 1.636.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.613 2007/11/13 01:47:56 albertel Exp $
+# $Id: loncommon.pm,v 1.636.2.3 2008/03/18 23:00:51 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -472,7 +472,10 @@ sub setsec_javascript {
my ($sec_element,$formname) = @_;
my $setsections = qq|
function setSect(sectionlist) {
- var sectionsArray = sectionlist.split(",");
+ var sectionsArray = new Array();
+ if ((sectionlist != '') && (typeof sectionlist != "undefined")) {
+ sectionsArray = sectionlist.split(",");
+ }
var numSections = sectionsArray.length;
document.$formname.$sec_element.length = 0;
if (numSections == 0) {
@@ -779,10 +782,10 @@ sub helpLatexCheatsheet {
}
return '
'.
$addOther .
- &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols',
+ &Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'),
undef,undef,600)
.' | '.
- &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols',
+ &Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'),
undef,undef,600)
.' |
';
}
@@ -1942,6 +1945,11 @@ sub authform_kerberos {
if (defined($in{'curr_authtype'})) {
if ($in{'curr_authtype'} eq 'krb') {
$krbcheck = ' checked="on"';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $krbcheck = '';
+ }
+ }
if (defined($in{'curr_kerb_ver'})) {
if ($in{'curr_krb_ver'} eq '5') {
$check5 = ' checked="on"';
@@ -2039,6 +2047,11 @@ sub authform_internal{
if ($in{'curr_authtype'} eq 'int') {
if ($can_assign{'int'}) {
$intcheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $intcheck = '';
+ }
+ }
if (defined($in{'curr_autharg'})) {
$intarg = $in{'curr_autharg'};
}
@@ -2073,6 +2086,7 @@ sub authform_internal{
$result = &mt
('[_1] Internally authenticated (with initial password [_2])',
''.$autharg);
+ $result.="';
return $result;
}
@@ -2088,6 +2102,11 @@ sub authform_local{
if ($in{'curr_authtype'} eq 'loc') {
if ($can_assign{'loc'}) {
$loccheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $loccheck = '';
+ }
+ }
if (defined($in{'curr_autharg'})) {
$locarg = $in{'curr_autharg'};
}
@@ -2137,6 +2156,11 @@ sub authform_filesystem{
if ($in{'curr_authtype'} eq 'fsys') {
if ($can_assign{'fsys'}) {
$fsyscheck = 'checked="on" ';
+ if (defined($in{'mode'})) {
+ if ($in{'mode'} eq 'modifyuser') {
+ $fsyscheck = '';
+ }
+ }
} else {
$result = &mt('Currently Filesystem Authenticated.');
return $result;
@@ -3646,45 +3670,78 @@ sub get_domainconf {
my %domconfig = &Apache::lonnet::get_dom('configuration',
['login','rolecolors'],$udom);
- my %designhash;
+ my (%designhash,%legacy);
if (keys(%domconfig) > 0) {
if (ref($domconfig{'login'}) eq 'HASH') {
- foreach my $key (keys(%{$domconfig{'login'}})) {
- $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key};
+ if (keys(%{$domconfig{'login'}})) {
+ foreach my $key (keys(%{$domconfig{'login'}})) {
+ $designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key};
+ }
+ } else {
+ $legacy{'login'} = 1;
}
+ } else {
+ $legacy{'login'} = 1;
}
if (ref($domconfig{'rolecolors'}) eq 'HASH') {
- foreach my $role (keys(%{$domconfig{'rolecolors'}})) {
- if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') {
- foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) {
- $designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item};
+ if (keys(%{$domconfig{'rolecolors'}})) {
+ foreach my $role (keys(%{$domconfig{'rolecolors'}})) {
+ if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') {
+ foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) {
+ $designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item};
+ }
}
}
+ } else {
+ $legacy{'rolecolors'} = 1;
}
+ } else {
+ $legacy{'rolecolors'} = 1;
}
- } else {
- my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
- my $designfile = $designdir.'/'.$udom.'.tab';
- if (-e $designfile) {
- if ( open (my $fh,"<$designfile") ) {
- while (my $line = <$fh>) {
- next if ($line =~ /^\#/);
- chomp($line);
- my ($key,$val)=(split(/\=/,$line));
- if ($val) { $designhash{$udom.'.'.$key}=$val; }
+ if (keys(%legacy) > 0) {
+ my %legacyhash = &get_legacy_domconf($udom);
+ foreach my $item (keys(%legacyhash)) {
+ if ($item =~ /^\Q$udom\E\.login/) {
+ if ($legacy{'login'}) {
+ $designhash{$item} = $legacyhash{$item};
+ }
+ } else {
+ if ($legacy{'rolecolors'}) {
+ $designhash{$item} = $legacyhash{$item};
+ }
}
- close($fh);
}
}
- if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') {
- $designhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif";
- }
+ } else {
+ %designhash = &get_legacy_domconf($udom);
}
&Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash,
$cachetime);
return %designhash;
}
+sub get_legacy_domconf {
+ my ($udom) = @_;
+ my %legacyhash;
+ my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
+ my $designfile = $designdir.'/'.$udom.'.tab';
+ if (-e $designfile) {
+ if ( open (my $fh,"<$designfile") ) {
+ while (my $line = <$fh>) {
+ next if ($line =~ /^\#/);
+ chomp($line);
+ my ($key,$val)=(split(/\=/,$line));
+ if ($val) { $legacyhash{$udom.'.'.$key}=$val; }
+ }
+ close($fh);
+ }
+ }
+ if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') {
+ $legacyhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif";
+ }
+ return %legacyhash;
+}
+
=pod
=item * &domainlogo()
@@ -3734,10 +3791,10 @@ Returns: value of designparamter $which
sub designparm {
my ($which,$domain)=@_;
if ($env{'browser.blackwhite'} eq 'on') {
- if ($which=~/\.(font|alink|vlink|link)$/) {
+ if ($which=~/\.(font|alink|vlink|link|textcol)$/) {
return '#000000';
}
- if ($which=~/\.(pgbg|sidebg)$/) {
+ if ($which=~/\.(pgbg|sidebg|bgcol)$/) {
return '#FFFFFF';
}
if ($which=~/\.tabbg$/) {
@@ -3756,7 +3813,7 @@ sub designparm {
$output = $defaultdesign{$which};
}
if (($which =~ /^(student|coordinator|author|admin)\.img$/) ||
- ($which =~ /login\.(img|logo|domlogo)/)) {
+ ($which =~ /login\.(img|logo|domlogo|login)/)) {
if ($output =~ m{^/(adm|res)/}) {
if ($output =~ m{^/res/}) {
my $local_name = &Apache::lonnet::filelocation('',$output);
@@ -3947,10 +4004,10 @@ ENDROLE
$lastitem = $thisdisfn;
}
$titleinfo =
- &Apache::loncommon::help_open_menu('','',3,'Authoring').
- 'Construction Space: '.
- '