--- loncom/interface/loncommon.pm 2007/12/21 05:13:07 1.626
+++ 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.626 2007/12/21 05:13:07 raeburn 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)
.' |
';
}
@@ -3667,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()
@@ -3755,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$/) {
@@ -3777,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);
@@ -3968,10 +4004,10 @@ ENDROLE
$lastitem = $thisdisfn;
}
$titleinfo =
- &Apache::loncommon::help_open_menu('','',3,'Authoring').
- 'Construction Space: '.
- '