version 1.1410, 2023/07/06 17:16:35
|
version 1.1418, 2023/11/17 17:02:20
|
Line 437 sub studentbrowser_javascript {
|
Line 437 sub studentbrowser_javascript {
|
<script type="text/javascript" language="Javascript"> |
<script type="text/javascript" language="Javascript"> |
// <![CDATA[ |
// <![CDATA[ |
var stdeditbrowser; |
var stdeditbrowser; |
function openstdbrowser(formname,uname,udom,clicker,roleflag,ignorefilter,courseadv) { |
function openstdbrowser(formname,uname,udom,clicker,roleflag,ignorefilter,courseadv,uident) { |
var url = '/adm/pickstudent?'; |
var url = '/adm/pickstudent?'; |
var filter; |
var filter; |
if (!ignorefilter) { |
if (!ignorefilter) { |
Line 458 sub studentbrowser_javascript {
|
Line 458 sub studentbrowser_javascript {
|
} |
} |
} |
} |
if ((courseadv == 'only') || (courseadv == 'none')) { url+="&courseadv="+courseadv; } |
if ((courseadv == 'only') || (courseadv == 'none')) { url+="&courseadv="+courseadv; } |
|
if (uident !== '') { url+="&identelement="+uident; } |
var title = 'Student_Browser'; |
var title = 'Student_Browser'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
var options = 'scrollbars=1,resizable=1,menubar=0'; |
options += ',width=700,height=600'; |
options += ',width=700,height=600'; |
Line 489 ENDRESBRW
|
Line 490 ENDRESBRW
|
} |
} |
|
|
sub selectstudent_link { |
sub selectstudent_link { |
my ($form,$unameele,$udomele,$courseadv,$clickerid)=@_; |
my ($form,$unameele,$udomele,$courseadv,$clickerid,$identelem)=@_; |
my $callargs = "'".&Apache::lonhtmlcommon::entity_encode($form)."','". |
my $callargs = "'".&Apache::lonhtmlcommon::entity_encode($form)."','". |
&Apache::lonhtmlcommon::entity_encode($unameele)."','". |
&Apache::lonhtmlcommon::entity_encode($unameele)."','". |
&Apache::lonhtmlcommon::entity_encode($udomele)."'"; |
&Apache::lonhtmlcommon::entity_encode($udomele)."'"; |
Line 506 sub selectstudent_link {
|
Line 507 sub selectstudent_link {
|
$callargs .= ",'','','$courseadv'"; |
$callargs .= ",'','','$courseadv'"; |
} elsif ($courseadv eq 'condition') { |
} elsif ($courseadv eq 'condition') { |
$callargs .= ",'','','$courseadv'"; |
$callargs .= ",'','','$courseadv'"; |
|
} elsif ($identelem ne '') { |
|
$callargs .= ",'','',''"; |
|
} |
|
if ($identelem ne '') { |
|
$callargs .= ",'".&Apache::lonhtmlcommon::entity_encode($identelem)."'"; |
} |
} |
return '<span class="LC_nobreak">'. |
return '<span class="LC_nobreak">'. |
'<a href="javascript:openstdbrowser('.$callargs.');">'. |
'<a href="javascript:openstdbrowser('.$callargs.');">'. |
Line 6455 sub CSTR_pageheader {
|
Line 6461 sub CSTR_pageheader {
|
return $output; |
return $output; |
} |
} |
|
|
|
sub nocodemirror { |
|
my $nocodem = $env{'environment.nocodemirror'}; |
|
unless ($nocodem) { |
|
my %domdefs = &Apache::lonnet::get_domain_defaults($env{'user.domain'}); |
|
if ($domdefs{'nocodemirror'}) { |
|
$nocodem = 'yes'; |
|
} |
|
} |
|
if ($nocodem eq 'yes') { |
|
return 1; |
|
} |
|
return; |
|
} |
|
|
|
sub permitted_editors { |
|
my ($is_author,$is_coauthor,$auname,$audom,%editors); |
|
if ($env{'request.role'} =~ m{^au\./}) { |
|
$is_author = 1; |
|
} elsif ($env{'request.role'} =~ m{^(?:ca|aa)\./($match_domain)/($match_username)}) { |
|
($audom,$auname) = ($1,$2); |
|
if (($audom ne '') && ($auname ne '')) { |
|
if (($env{'user.domain'} eq $audom) && |
|
($env{'user.name'} eq $auname)) { |
|
$is_author = 1; |
|
} else { |
|
$is_coauthor = 1; |
|
} |
|
} |
|
} elsif ($env{'request.course.id'}) { |
|
if ($env{'request.editurl'} =~ m{^/priv/($match_domain)/($match_username)/}) { |
|
($audom,$auname) = ($1,$2); |
|
} elsif ($env{'request.uri'} =~ m{^/priv/($match_domain)/($match_username)/}) { |
|
($audom,$auname) = ($1,$2); |
|
} |
|
if (($audom ne '') && ($auname ne '')) { |
|
if (($env{'user.domain'} eq $audom) && |
|
($env{'user.name'} eq $auname)) { |
|
$is_author = 1; |
|
} else { |
|
$is_coauthor = 1; |
|
} |
|
} |
|
} |
|
if ($is_author) { |
|
if (exists($env{'environment.editors'})) { |
|
map { $editors{$_} = 1; } split(/,/,$env{'environment.editors'}); |
|
} else { |
|
%editors = ( edit => 1, |
|
xml => 1, |
|
); |
|
} |
|
} elsif ($is_coauthor) { |
|
if (exists($env{"environment.internal.editors./$audom/$auname"})) { |
|
map { $editors{$_} = 1; } split(/,/,$env{"environment.internal.editors./$audom/$auname"}); |
|
} else { |
|
%editors = ( edit => 1, |
|
xml => 1, |
|
); |
|
} |
|
} else { |
|
%editors = ( edit => 1, |
|
xml => 1, |
|
); |
|
} |
|
return %editors; |
|
} |
|
|
############################################### |
############################################### |
############################################### |
############################################### |
|
|
Line 6849 ENDJS
|
Line 6922 ENDJS
|
$endbodytag; |
$endbodytag; |
} |
} |
} |
} |
|
if ((ref($args) eq 'HASH') && ($args->{'dashjs'})) { |
|
$endbodytag = &Apache::lonhtmlcommon::dash_to_minus_js().$endbodytag; |
|
} |
return $endbodytag; |
return $endbodytag; |
} |
} |
|
|
Line 17051 sub construct_course {
|
Line 17127 sub construct_course {
|
$cenv{'internal.defaultcredits'} = $args->{'defaultcredits'}; |
$cenv{'internal.defaultcredits'} = $args->{'defaultcredits'}; |
} |
} |
my @badclasses = (); # Used to accumulate sections/crosslistings that did not pass classlist access check for course owner. |
my @badclasses = (); # Used to accumulate sections/crosslistings that did not pass classlist access check for course owner. |
|
my @oklcsecs = (); # Used to accumulate LON-CAPA sections for validated institutional sections. |
if ($args->{'crssections'}) { |
if ($args->{'crssections'}) { |
$cenv{'internal.sectionnums'} = ''; |
$cenv{'internal.sectionnums'} = ''; |
if ($args->{'crssections'} =~ m/,/) { |
if ($args->{'crssections'} =~ m/,/) { |
Line 17064 sub construct_course {
|
Line 17141 sub construct_course {
|
my $class = $args->{'crscode'}.$sec; |
my $class = $args->{'crscode'}.$sec; |
my $addcheck = &Apache::lonnet::auto_new_course($$crsunum,$$crsudom,$class,$cenv{'internal.courseowner'}); |
my $addcheck = &Apache::lonnet::auto_new_course($$crsunum,$$crsudom,$class,$cenv{'internal.courseowner'}); |
$cenv{'internal.sectionnums'} .= $item.','; |
$cenv{'internal.sectionnums'} .= $item.','; |
unless ($addcheck eq 'ok') { |
if ($addcheck eq 'ok') { |
|
unless (grep(/^\Q$gp\E$/,@oklcsecs)) { |
|
push(@oklcsecs,$gp); |
|
} |
|
} else { |
push(@badclasses,$class); |
push(@badclasses,$class); |
} |
} |
} |
} |
Line 17092 sub construct_course {
|
Line 17173 sub construct_course {
|
my ($xl,$gp) = split/:/,$item; |
my ($xl,$gp) = split/:/,$item; |
my $addcheck = &Apache::lonnet::auto_new_course($$crsunum,$$crsudom,$xl,$cenv{'internal.courseowner'}); |
my $addcheck = &Apache::lonnet::auto_new_course($$crsunum,$$crsudom,$xl,$cenv{'internal.courseowner'}); |
$cenv{'internal.crosslistings'} .= $item.','; |
$cenv{'internal.crosslistings'} .= $item.','; |
unless ($addcheck eq 'ok') { |
if ($addcheck eq 'ok') { |
|
unless (grep(/^\Q$gp\E$/,@oklcsecs)) { |
|
push(@oklcsecs,$gp); |
|
} |
|
} else { |
push(@badclasses,$xl); |
push(@badclasses,$xl); |
} |
} |
} |
} |
Line 17155 sub construct_course {
|
Line 17240 sub construct_course {
|
if ($args->{'no_end_date'}) { |
if ($args->{'no_end_date'}) { |
$args->{'endaccess'} = 0; |
$args->{'endaccess'} = 0; |
} |
} |
|
# If an official course with institutional sections is created by cloning |
|
# an existing course, section-specific hiding of course totals in student's |
|
# view of grades as copied from cloned course, will be checked for valid |
|
# sections. |
|
if (($can_clone && $cloneid) && |
|
($cenv{'internal.coursecode'} ne '') && |
|
($cenv{'grading'} eq 'standard') && |
|
($cenv{'hidetotals'} ne '') && |
|
($cenv{'hidetotals'} ne 'all')) { |
|
my @hidesecs; |
|
my $deletehidetotals; |
|
if (@oklcsecs) { |
|
foreach my $sec (split(/,/,$cenv{'hidetotals'})) { |
|
if (grep(/^\Q$sec$/,@oklcsecs)) { |
|
push(@hidesecs,$sec); |
|
} |
|
} |
|
if (@hidesecs) { |
|
$cenv{'hidetotals'} = join(',',@hidesecs); |
|
} else { |
|
$deletehidetotals = 1; |
|
} |
|
} else { |
|
$deletehidetotals = 1; |
|
} |
|
if ($deletehidetotals) { |
|
delete($cenv{'hidetotals'}); |
|
&Apache::lonnet::del('environment',['hidetotals'],$$crsudom,$$crsunum); |
|
} |
|
} |
$cenv{'internal.autostart'}=$args->{'enrollstart'}; |
$cenv{'internal.autostart'}=$args->{'enrollstart'}; |
$cenv{'internal.autoend'}=$args->{'enrollend'}; |
$cenv{'internal.autoend'}=$args->{'enrollend'}; |
$cenv{'default_enrollment_start_date'}=$args->{'startaccess'}; |
$cenv{'default_enrollment_start_date'}=$args->{'startaccess'}; |
Line 17515 sub init_user_environment {
|
Line 17630 sub init_user_environment {
|
|
|
my $public=($username eq 'public' && $domain eq 'public'); |
my $public=($username eq 'public' && $domain eq 'public'); |
|
|
my ($filename,$cookie,$userroles,$firstaccenv,$timerintenv); |
my ($filename,$cookie,$userroles,$firstaccenv,$timerintenv, |
|
$coauthorenv); |
my $now=time; |
my $now=time; |
|
|
if ($public) { |
if ($public) { |
Line 17581 sub init_user_environment {
|
Line 17697 sub init_user_environment {
|
|
|
# Initialize roles |
# Initialize roles |
|
|
($userroles,$firstaccenv,$timerintenv) = |
($userroles,$firstaccenv,$timerintenv,$coauthorenv) = |
&Apache::lonnet::rolesinit($domain,$username,$authhost); |
&Apache::lonnet::rolesinit($domain,$username,$authhost); |
} |
} |
# ------------------------------------ Check browser type and MathML capability |
# ------------------------------------ Check browser type and MathML capability |
Line 17659 sub init_user_environment {
|
Line 17775 sub init_user_environment {
|
my %is_adv = ( is_adv => $env{'user.adv'} ); |
my %is_adv = ( is_adv => $env{'user.adv'} ); |
my %domdef = &Apache::lonnet::get_domain_defaults($domain); |
my %domdef = &Apache::lonnet::get_domain_defaults($domain); |
|
|
foreach my $tool ('aboutme','blog','webdav','portfolio','timezone') { |
foreach my $tool ('aboutme','blog','webdav','portfolio','portaccess','timezone') { |
$userenv{'availabletools.'.$tool} = |
$userenv{'availabletools.'.$tool} = |
&Apache::lonnet::usertools_access($username,$domain,$tool,'reload', |
&Apache::lonnet::usertools_access($username,$domain,$tool,'reload', |
undef,\%userenv,\%domdef,\%is_adv); |
undef,\%userenv,\%domdef,\%is_adv); |
} |
} |
Line 17672 sub init_user_environment {
|
Line 17788 sub init_user_environment {
|
\%userenv,\%domdef,\%is_adv); |
\%userenv,\%domdef,\%is_adv); |
} |
} |
|
|
|
if ((ref($userroles) eq 'HASH') && ($userroles->{'user.author'}) && |
|
(exists($userroles->{"user.role.au./$domain/"}))) { |
|
if ($userenv{'authoreditors'}) { |
|
$userenv{'editors'} = $userenv{'authoreditors'}; |
|
} elsif ($domdef{'editors'} ne '') { |
|
$userenv{'editors'} = $domdef{'editors'}; |
|
} else { |
|
$userenv{'editors'} = 'edit,xml'; |
|
} |
|
} |
|
|
$userenv{'canrequest.author'} = |
$userenv{'canrequest.author'} = |
&Apache::lonnet::usertools_access($username,$domain,'requestauthor', |
&Apache::lonnet::usertools_access($username,$domain,'requestauthor', |
'reload','requestauthor', |
'reload','requestauthor', |
Line 17728 sub init_user_environment {
|
Line 17855 sub init_user_environment {
|
if (ref($timerintenv) eq 'HASH') { |
if (ref($timerintenv) eq 'HASH') { |
&_add_to_env(\%disk_env,$timerintenv); |
&_add_to_env(\%disk_env,$timerintenv); |
} |
} |
|
if (ref($coauthorenv) eq 'HASH') { |
|
if (keys(%{$coauthorenv})) { |
|
&_add_to_env(\%disk_env,$coauthorenv); |
|
} |
|
} |
if (ref($args->{'extra_env'})) { |
if (ref($args->{'extra_env'})) { |
&_add_to_env(\%disk_env,$args->{'extra_env'}); |
&_add_to_env(\%disk_env,$args->{'extra_env'}); |
} |
} |