--- loncom/interface/loncommon.pm 2002/09/13 20:46:09 1.67
+++ loncom/interface/loncommon.pm 2003/02/13 18:11:26 1.79
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.67 2002/09/13 20:46:09 www Exp $
+# $Id: loncommon.pm,v 1.79 2003/02/13 18:11:26 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
@@ -311,7 +309,44 @@ 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";
+}
###############################################################
@@ -483,6 +518,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;
@@ -493,7 +531,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
{
@@ -503,14 +541,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;
}
@@ -802,7 +842,7 @@ sub authform_internal{
onclick="javascript:changed_radio('int',$args{'formname'});" />
Internally authenticated (with initial password
+ onchange="javascript:changed_text('int',$args{'formname'});" />)
END
return $result;
}
@@ -838,7 +878,7 @@ sub authform_filesystem{
onclick="javascript:changed_radio('fsys',$in{'formname'});" />
Filesystem authenticated (with initial password
+ onchange="javascript:changed_text('fsys',$in{'formname'});">)
END
return $result;
}
@@ -981,7 +1021,7 @@ sub nickname {
my ($uname,$udom)=@_;
my %names=&Apache::lonnet::get('environment',
['nickname','firstname','middlename','lastname','generation'],$udom,$uname);
- my $name=&Apache::lonnet::unescape($names{'nickname'});
+ my $name=$names{'nickname'};
if ($name) {
$name='"'.$name.'"';
} else {
@@ -1000,7 +1040,7 @@ sub screenname {
my ($uname,$udom)=@_;
my %names=
&Apache::lonnet::get('environment',['screenname'],$udom,$uname);
- return &Apache::lonnet::unescape($names{'screenname'});
+ return $names{'screenname'};
}
# ------------------------------------------------------------- Message Wrapper
@@ -1010,18 +1050,26 @@ sub messagewrapper {
return
"$link";
}
+# --------------------------------------------------------------- Notes Wrapper
+
+sub noteswrapper {
+ my ($link,$un,$do)=@_;
+ return
+"$link";
+}
# ------------------------------------------------------------- Aboutme Wrapper
sub aboutmewrapper {
- my ($link,$un,$do)=@_;
- return "$link";
+ my ($link,$username,$domain)=@_;
+ return "$link";
}
# ------------------------------------------------------------ Syllabus Wrapper
sub syllabuswrapper {
- my ($link,$un,$do)=@_;
+ my ($link,$un,$do,$tf)=@_;
+ if ($tf) { $link=''.$link.''; }
return "$link";
}
@@ -1222,6 +1270,22 @@ sub maketime {
}
+#########################################
+#
+# Retro-fixing of un-backward-compatible time format
+
+sub unsqltime {
+ my $timestamp=shift;
+ if ($timestamp=~/^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {
+ $timestamp=&maketime(
+ 'year'=>$1,'month'=>$2,'day'=>$3,
+ 'hours'=>$4,'minutes'=>$5,'seconds'=>$6);
+ }
+ return $timestamp;
+}
+
+#########################################
+
sub findallcourses {
my %courses=();
my $now=time;
@@ -1283,7 +1347,8 @@ sub domainlogo {
my $domain = &determinedomain(shift);
# See if there is a logo
if (-e '/home/httpd/html/adm/lonDomLogos/'.$domain.'.gif') {
- return '';
+ return '';
} elsif(exists($Apache::lonnet::domaindescription{$domain})) {
return $Apache::lonnet::domaindescription{$domain};
} else {
@@ -1382,12 +1447,15 @@ $addentries>
END
if ($bodyonly) {
return $bodytag;
+ } elsif ($ENV{'browser.interface'} eq 'textual') {
+ return $bodytag.'LON-CAPA: '.$title.
+ '
Main Menu
';
} else {
return(<
- |
+
$messages |