--- loncom/interface/loncommon.pm 2005/05/26 20:49:23 1.262
+++ loncom/interface/loncommon.pm 2006/04/10 19:54:54 1.329
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.262 2005/05/26 20:49:23 albertel Exp $
+# $Id: loncommon.pm,v 1.329 2006/04/10 19:54:54 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -58,7 +58,6 @@ use strict;
use Apache::lonnet;
use GDBM_File;
use POSIX qw(strftime mktime);
-use Apache::Constants qw(:common :http :methods);
use Apache::lonmenu();
use Apache::lonlocal;
use HTML::Entities;
@@ -152,19 +151,20 @@ BEGIN {
my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors';
opendir(DIR,$designdir);
while ($filename=readdir(DIR)) {
+ if ($filename!~/\.tab$/) { next; }
my ($domain)=($filename=~/^(\w+)\./);
- {
- my $designfile = $designdir.'/'.$filename;
- if ( open (my $fh,"<$designfile") ) {
- while (<$fh>) {
- next if /^\#/;
- chomp;
- my ($key,$val)=(split(/\=/,$_));
- if ($val) { $designhash{$domain.'.'.$key}=$val; }
- }
- close($fh);
- }
- }
+ {
+ my $designfile = $designdir.'/'.$filename;
+ if ( open (my $fh,"<$designfile") ) {
+ while (<$fh>) {
+ next if /^\#/;
+ chomp;
+ my ($key,$val)=(split(/\=/,$_));
+ if ($val) { $designhash{$domain.'.'.$key}=$val; }
+ }
+ close($fh);
+ }
+ }
}
closedir(DIR);
@@ -330,7 +330,10 @@ sub storeresurl {
sub studentbrowser_javascript {
unless (
(($env{'request.course.id'}) &&
- (&Apache::lonnet::allowed('srm',$env{'request.course.id'})))
+ (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+ || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ '/'.$env{'request.course.sec'})
+ ))
|| ($env{'request.role'}=~/^(au|dc|su)/)
) { return ''; }
return (<<'ENDSTDBRW');
@@ -361,7 +364,9 @@ ENDSTDBRW
sub selectstudent_link {
my ($form,$unameele,$udomele)=@_;
if ($env{'request.course.id'}) {
- unless (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) {
+ if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+ && !&Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+ '/'.$env{'request.course.sec'})) {
return '';
}
return "
var stdeditbrowser;
- function opencrsbrowser(formname,uname,udom,desc,extra_element) {
+ function opencrsbrowser(formname,uname,udom,desc,extra_element,multflag) {
var url = '/adm/pickcourse?';
var filter;
if (filter != null) {
@@ -402,6 +407,9 @@ sub coursebrowser_javascript {
url += '&domainfilter='+extra_element;
}
}
+ if (multflag !=null && multflag != '') {
+ url += '&multiple='+multflag;
+ }
var title = 'Course_Browser';
var options = 'scrollbars=1,resizable=1,menubar=0';
options += ',width=700,height=600';
@@ -413,11 +421,36 @@ ENDSTDBRW
}
sub selectcourse_link {
- my ($form,$unameele,$udomele,$desc,$extra_element)=@_;
+ my ($form,$unameele,$udomele,$desc,$extra_element,$multflag)=@_;
return "".&mt('Select Course')."";
+ '","'.$udomele.'","'.$desc.'","'.$extra_element.'","'.$multflag.'");'."'>".&mt('Select Course')."";
}
+sub check_uncheck_jscript {
+ my $jscript = <<"ENDSCRT";
+function checkAll(field) {
+ if (field.length > 0) {
+ for (i = 0; i < field.length; i++) {
+ field[i].checked = true ;
+ }
+ } else {
+ field.checked = true
+ }
+}
+
+function uncheckAll(field) {
+ if (field.length > 0) {
+ for (i = 0; i < field.length; i++) {
+ field[i].checked = false ;
+ } } else {
+ field.checked = false ;
+ }
+}
+ENDSCRT
+ return $jscript;
+}
+
+
=pod
=item * linked_select_forms(...)
@@ -673,7 +706,6 @@ sub help_open_menu {
foreach (\$color,\$function,\$topic,\$component_help,\$faq,\$bug,\$origurl) {
$$_ = &Apache::lonnet::escape($$_);
}
-
if (!$stayOnPage) {
$link = "javascript:helpMenu('open')";
} else {
@@ -684,8 +716,8 @@ sub help_open_menu {
my $template;
if ($text ne "") {
$template .=
- "
".
- "$text";
+ "".
+ "$text";
}
my $nothing=&Apache::lonhtmlcommon::javascript_nothing();
my $html=&Apache::lonxml::xmlbegin();
@@ -713,9 +745,9 @@ function helpMenu(target) {
return;
}
function writeHelp(caller) {
- caller.document.write('$htmlLON-CAPA Help Menu')
- caller.document.write("")
- caller.document.write(" |
|