--- loncom/interface/loncommon.pm 2005/11/15 15:14:17 1.288 +++ loncom/interface/loncommon.pm 2005/11/15 20:46:40 1.293 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.288 2005/11/15 15:14:17 raeburn Exp $ +# $Id: loncommon.pm,v 1.293 2005/11/15 20:46:40 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -380,7 +380,7 @@ sub coursebrowser_javascript { 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) { @@ -403,6 +403,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'; @@ -414,9 +417,9 @@ 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 { @@ -2775,8 +2778,8 @@ sub bodytag { h1, h2, h3, th { font-family: Arial, Helvetica, sans-serif } a:focus { color: red; background: yellow } table.thinborder { border-collapse: collapse; } -table.thinborder tr th { border-style: solid; border-width: 1px} -table.thinborder tr td { border-style: solid; border-width: 1px} +table.thinborder tr th, table.thinborder tr td { border-style: solid; border-width: 1px} +form, .inline { display: inline; } .center { text-align: center; } 0) { - unless(grep/^$$classlist{$student}[$idx{section}]$/,@{$sections}) { - next; - } - } + if ((ref($sections) eq 'ARRAY') && (@{$sections} > 0)) { + unless(grep(/^\Q$$classlist{$student}[$idx{section}]\E$/, + @{$sections})) { + next; + } } if (defined($$types{'active'})) { if ($$classlist{$student}[$idx{status}] eq 'Active') { @@ -3164,16 +3166,13 @@ sub get_course_users { my $match = 0; my ($role,$user) = ($person =~ /^([^:]*):([^:]+:[^:]+)/); $user =~ s/:$//; - if (($role) && (grep(/^$role$/,@{$roles}))) { + if (($role) && (grep(/^\Q$role\E$/,@{$roles}))) { my ($uname,$udom,$usec) = split(/:/,$user); - unless ($usec eq '') { - if (defined($sections) && (ref($sections) eq 'ARRAY')) { - if (@{$sections} > 0) { - unless(grep/^$usec$/,@{$sections}) { - next; - } - } - } + if ($usec ne '' && (ref($sections) eq 'ARRAY') && + @{$sections} > 0) { + unless(grep(/^\Q$usec\E$/,@{$sections})) { + next; + } } if ($uname ne '' && $udom ne '') { my $status = &check_user_status($udom,$uname,$cdom,$cnum,$role); @@ -3183,25 +3182,23 @@ sub get_course_users { $match = 1; } } - if ($match && defined($userdata)) { - unless(exists($$userdata{$uname.':'.$udom})) { - &get_user_info($udom,$uname,\%idx,$userdata); - } + if ($match && defined($userdata) && + !exists($$userdata{$uname.':'.$udom})) { + &get_user_info($udom,$uname,\%idx,$userdata); } } } } - if (grep/^ow$/,@{$roles}) { + if (grep(/^ow$/,@{$roles})) { if ((defined($cdom)) && (defined($cnum))) { my %csettings = &Apache::lonnet::get('environment',['internal.courseowner'],$cdom,$cnum); if ( defined($csettings{'internal.courseowner'}) ) { my $owner = $csettings{'internal.courseowner'}; @{$$users{'ow'}{$owner.':'.$cdom}} = 'any'; - if (defined($userdata)) { - unless(exists($$userdata{$owner.':'.$cdom})) { - &get_user_info($cdom,$owner,\%idx,$userdata); - } - } + if (defined($userdata) && + !exists($$userdata{$owner.':'.$cdom})) { + &get_user_info($cdom,$owner,\%idx,$userdata); + } } } } @@ -3211,19 +3208,10 @@ sub get_course_users { sub get_user_info { my ($udom,$uname,$idx,$userdata) = @_; - my %userinfo = &Apache::lonnet::get('environment',['firstname','middlename','lastname','generation','id'],$udom,$uname); - if (grep/^(con_lost|error|no_such_host)/,keys(%userinfo)) { - &Apache::lonnet::logthis('get_user_info error for '.$uname.':'.$udom); - $$userdata{$uname.':'.$udom}[$$idx{udom}] = $udom; - $$userdata{$uname.':'.$udom}[$$idx{uname}] = $uname; - } else { - $userinfo{fullname} = &Apache::lonnet::format_name(@userinfo{qw/firstname middlename lastname generation/},'lastname'); - $userinfo{uname} = $uname; - $userinfo{udom} = $udom; - foreach my $item (qw/uname udom id fullname/) { - $$userdata{$uname.':'.$udom}[$$idx{$item}] = $userinfo{$item}; - } - } + $$userdata{$uname.':'.$udom}[$$idx{fullname}] = + &plainname($uname,$udom,'lastname'); + $$userdata{$uname.':'.$udom}[$$idx{uname}] = $uname; + $$userdata{$uname.':'.$udom}[$$idx{uname}] = $udom; return; } @@ -3365,6 +3353,7 @@ sub no_cache { sub content_type { my ($r,$type,$charset) = @_; + &no_cache($r); if ($env{'browser.mathml'} && $type eq 'text/html') { $type='text/xml'; } unless ($charset) { $charset=&Apache::lonlocal::current_encoding;