--- loncom/interface/loncommon.pm 2002/08/27 16:49:20 1.61
+++ loncom/interface/loncommon.pm 2003/05/13 00:52:46 1.99
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.61 2002/08/27 16:49:20 www Exp $
+# $Id: loncommon.pm,v 1.99 2003/05/13 00:52:46 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -27,9 +27,7 @@
#
# YEAR=2001
# 2/13-12/7 Guy Albertelli
-# 12/11,12/12,12/17 Scott Harrison
# 12/21 Gerd Kortemeyer
-# 12/21 Scott Harrison
# 12/25,12/28 Gerd Kortemeyer
# YEAR=2002
# 1/4 Gerd Kortemeyer
@@ -81,8 +79,9 @@ use strict;
use Apache::lonnet();
use GDBM_File;
use POSIX qw(strftime mktime);
-use Apache::Constants qw(:common);
+use Apache::Constants qw(:common :http :methods);
use Apache::lonmsg();
+use Apache::lonmenu();
my $readit;
=pod
@@ -98,6 +97,10 @@ my %cprtag;
my %fe; my %fd;
my %category_extensions;
+# ---------------------------------------------- Designs
+
+my %designhash;
+
# ---------------------------------------------- Thesaurus variables
=pod
@@ -148,8 +151,8 @@ BEGIN {
while (<$fh>) {
next if /^\#/;
chomp;
- my ($key,$val)=(split(/\s+/,$_,2));
- $language{$key}=$val;
+ my ($key,$two,$country,$three,$enc,$val)=(split(/\t/,$_));
+ $language{$key}=$val.' - '.$enc;
}
}
}
@@ -166,6 +169,30 @@ BEGIN {
}
}
}
+
+# -------------------------------------------------------------- domain designs
+
+ my $filename;
+ my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
+ opendir(DIR,$designdir);
+ while ($filename=readdir(DIR)) {
+ my ($domain)=($filename=~/^(\w+)\./);
+ {
+ my $fh=Apache::File->new($designdir.'/'.$filename);
+ if ($fh) {
+ while (<$fh>) {
+ next if /^\#/;
+ chomp;
+ my ($key,$val)=(split(/\=/,$_));
+ if ($val) { $designhash{$domain.'.'.$key}=$val; }
+ }
+ }
+ }
+
+ }
+ closedir(DIR);
+
+
# ------------------------------------------------------------- file categories
{
my $fh=Apache::File->new($Apache::lonnet::perlvar{'lonTabDir'}.
@@ -283,7 +310,74 @@ sub browser_and_searcher_javascript {
END
}
+sub studentbrowser_javascript {
+ unless ($ENV{'request.course.id'}) { return ''; }
+ unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
+ return '';
+ }
+ return (<<'ENDSTDBRW');
+
+ENDSTDBRW
+}
+
+sub selectstudent_link {
+ my ($form,$unameele,$udomele)=@_;
+ unless ($ENV{'request.course.id'}) { return ''; }
+ unless (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'})) {
+ return '';
+ }
+ return "Select User";
+}
+
+sub coursebrowser_javascript {
+ return (<<'ENDSTDBRW');
+
+ENDSTDBRW
+}
+sub selectcourse_link {
+ my ($form,$unameele,$udomele)=@_;
+ return "Select Course";
+}
###############################################################
@@ -455,6 +549,9 @@ sub help_open_topic {
my ($topic, $text, $stayOnPage, $width, $height) = @_;
$text = "" if (not defined $text);
$stayOnPage = 0 if (not defined $stayOnPage);
+ if ($ENV{'browser.interface'} eq 'textual') {
+ $stayOnPage=1;
+ }
$width = 350 if (not defined $width);
$height = 400 if (not defined $height);
my $filename = $topic;
@@ -465,7 +562,7 @@ sub help_open_topic {
if (!$stayOnPage)
{
- $link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height'))";
+ $link = "javascript:void(open('/adm/help/${filename}.hlp', 'Help_for_$topic', 'menubar=0,toolbar=1,scrollbars=1,width=$width,height=$height,resizable=yes'))";
}
else
{
@@ -475,14 +572,16 @@ sub help_open_topic {
# Add the text
if ($text ne "")
{
- $template .= "$text ";
+ $template .=
+ "
".
+ "$text";
}
# Add the graphic
$template .= <<"ENDTEMPLATE";
-
+
ENDTEMPLATE
-
+ if ($text ne '') { $template.=' |
' };
return $template;
}
@@ -532,18 +631,48 @@ sub get_domains {
=pod
-=item select_dom_form($defdom,$name)
+=item select_form($defdom,$name,%hash)
+
+Returns a string containing a