version 1.627, 2007/12/21 05:19:04
|
version 1.636.2.3, 2008/03/18 23:00:51
|
Line 472 sub setsec_javascript {
|
Line 472 sub setsec_javascript {
|
my ($sec_element,$formname) = @_; |
my ($sec_element,$formname) = @_; |
my $setsections = qq| |
my $setsections = qq| |
function setSect(sectionlist) { |
function setSect(sectionlist) { |
var sectionsArray = sectionlist.split(","); |
var sectionsArray = new Array(); |
|
if ((sectionlist != '') && (typeof sectionlist != "undefined")) { |
|
sectionsArray = sectionlist.split(","); |
|
} |
var numSections = sectionsArray.length; |
var numSections = sectionsArray.length; |
document.$formname.$sec_element.length = 0; |
document.$formname.$sec_element.length = 0; |
if (numSections == 0) { |
if (numSections == 0) { |
Line 779 sub helpLatexCheatsheet {
|
Line 782 sub helpLatexCheatsheet {
|
} |
} |
return '<table><tr><td>'. |
return '<table><tr><td>'. |
$addOther . |
$addOther . |
&Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols', |
&Apache::loncommon::help_open_topic("Greek_Symbols",&mt('Greek Symbols'), |
undef,undef,600) |
undef,undef,600) |
.'</td><td>'. |
.'</td><td>'. |
&Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols', |
&Apache::loncommon::help_open_topic("Other_Symbols",&mt('Other Symbols'), |
undef,undef,600) |
undef,undef,600) |
.'</td></tr></table>'; |
.'</td></tr></table>'; |
} |
} |
Line 3667 sub get_domainconf {
|
Line 3670 sub get_domainconf {
|
|
|
my %domconfig = &Apache::lonnet::get_dom('configuration', |
my %domconfig = &Apache::lonnet::get_dom('configuration', |
['login','rolecolors'],$udom); |
['login','rolecolors'],$udom); |
my %designhash; |
my (%designhash,%legacy); |
if (keys(%domconfig) > 0) { |
if (keys(%domconfig) > 0) { |
if (ref($domconfig{'login'}) eq 'HASH') { |
if (ref($domconfig{'login'}) eq 'HASH') { |
foreach my $key (keys(%{$domconfig{'login'}})) { |
if (keys(%{$domconfig{'login'}})) { |
$designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; |
foreach my $key (keys(%{$domconfig{'login'}})) { |
|
$designhash{$udom.'.login.'.$key}=$domconfig{'login'}{$key}; |
|
} |
|
} else { |
|
$legacy{'login'} = 1; |
} |
} |
|
} else { |
|
$legacy{'login'} = 1; |
} |
} |
if (ref($domconfig{'rolecolors'}) eq 'HASH') { |
if (ref($domconfig{'rolecolors'}) eq 'HASH') { |
foreach my $role (keys(%{$domconfig{'rolecolors'}})) { |
if (keys(%{$domconfig{'rolecolors'}})) { |
if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') { |
foreach my $role (keys(%{$domconfig{'rolecolors'}})) { |
foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) { |
if (ref($domconfig{'rolecolors'}{$role}) eq 'HASH') { |
$designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item}; |
foreach my $item (keys(%{$domconfig{'rolecolors'}{$role}})) { |
|
$designhash{$udom.'.'.$role.'.'.$item}=$domconfig{'rolecolors'}{$role}{$item}; |
|
} |
} |
} |
} |
} |
|
} else { |
|
$legacy{'rolecolors'} = 1; |
} |
} |
|
} else { |
|
$legacy{'rolecolors'} = 1; |
} |
} |
} else { |
if (keys(%legacy) > 0) { |
my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors'; |
my %legacyhash = &get_legacy_domconf($udom); |
my $designfile = $designdir.'/'.$udom.'.tab'; |
foreach my $item (keys(%legacyhash)) { |
if (-e $designfile) { |
if ($item =~ /^\Q$udom\E\.login/) { |
if ( open (my $fh,"<$designfile") ) { |
if ($legacy{'login'}) { |
while (my $line = <$fh>) { |
$designhash{$item} = $legacyhash{$item}; |
next if ($line =~ /^\#/); |
} |
chomp($line); |
} else { |
my ($key,$val)=(split(/\=/,$line)); |
if ($legacy{'rolecolors'}) { |
if ($val) { $designhash{$udom.'.'.$key}=$val; } |
$designhash{$item} = $legacyhash{$item}; |
|
} |
} |
} |
close($fh); |
|
} |
} |
} |
} |
if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') { |
} else { |
$designhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif"; |
%designhash = &get_legacy_domconf($udom); |
} |
|
} |
} |
&Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash, |
&Apache::lonnet::do_cache_new('domainconfig',$udom,\%designhash, |
$cachetime); |
$cachetime); |
return %designhash; |
return %designhash; |
} |
} |
|
|
|
sub get_legacy_domconf { |
|
my ($udom) = @_; |
|
my %legacyhash; |
|
my $designdir=$Apache::lonnet::perlvar{'lonTabDir'}.'/lonDomColors'; |
|
my $designfile = $designdir.'/'.$udom.'.tab'; |
|
if (-e $designfile) { |
|
if ( open (my $fh,"<$designfile") ) { |
|
while (my $line = <$fh>) { |
|
next if ($line =~ /^\#/); |
|
chomp($line); |
|
my ($key,$val)=(split(/\=/,$line)); |
|
if ($val) { $legacyhash{$udom.'.'.$key}=$val; } |
|
} |
|
close($fh); |
|
} |
|
} |
|
if (-e '/home/httpd/html/adm/lonDomLogos/'.$udom.'.gif') { |
|
$legacyhash{$udom.'.login.domlogo'} = "/adm/lonDomLogos/$udom.gif"; |
|
} |
|
return %legacyhash; |
|
} |
|
|
=pod |
=pod |
|
|
=item * &domainlogo() |
=item * &domainlogo() |
Line 3755 Returns: value of designparamter $which
|
Line 3791 Returns: value of designparamter $which
|
sub designparm { |
sub designparm { |
my ($which,$domain)=@_; |
my ($which,$domain)=@_; |
if ($env{'browser.blackwhite'} eq 'on') { |
if ($env{'browser.blackwhite'} eq 'on') { |
if ($which=~/\.(font|alink|vlink|link)$/) { |
if ($which=~/\.(font|alink|vlink|link|textcol)$/) { |
return '#000000'; |
return '#000000'; |
} |
} |
if ($which=~/\.(pgbg|sidebg)$/) { |
if ($which=~/\.(pgbg|sidebg|bgcol)$/) { |
return '#FFFFFF'; |
return '#FFFFFF'; |
} |
} |
if ($which=~/\.tabbg$/) { |
if ($which=~/\.tabbg$/) { |
Line 3777 sub designparm {
|
Line 3813 sub designparm {
|
$output = $defaultdesign{$which}; |
$output = $defaultdesign{$which}; |
} |
} |
if (($which =~ /^(student|coordinator|author|admin)\.img$/) || |
if (($which =~ /^(student|coordinator|author|admin)\.img$/) || |
($which =~ /login\.(img|logo|domlogo)/)) { |
($which =~ /login\.(img|logo|domlogo|login)/)) { |
if ($output =~ m{^/(adm|res)/}) { |
if ($output =~ m{^/(adm|res)/}) { |
if ($output =~ m{^/res/}) { |
if ($output =~ m{^/res/}) { |
my $local_name = &Apache::lonnet::filelocation('',$output); |
my $local_name = &Apache::lonnet::filelocation('',$output); |
Line 3968 ENDROLE
|
Line 4004 ENDROLE
|
$lastitem = $thisdisfn; |
$lastitem = $thisdisfn; |
} |
} |
$titleinfo = |
$titleinfo = |
&Apache::loncommon::help_open_menu('','',3,'Authoring'). |
&Apache::loncommon::help_open_menu('','',3,'Authoring') |
'<b>Construction Space</b>: '. |
.'<b>'.&mt('Construction Space').'</b>: ' |
'<form name="dirs" method="post" action="'.$formaction |
.'<form name="dirs" method="post" action="'.$formaction.'"' |
.'" target="_top"><tt><b>' |
.' target="_top"><tt><b>' |
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<font size=\"+1\">$lastitem</font></b></tt><br />" |
.&Apache::lonhtmlcommon::crumbs($uname.'/'.$parentpath,'_top','/priv','','+1',1)."<font size=\"+1\">$lastitem</font></b></tt><br />" |
.&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') |
.&Apache::lonhtmlcommon::select_recent('construct','recent','this.form.action=this.form.recent.value;this.form.submit()') |
.'</form>' |
.'</form>' |
Line 4094 sub make_attr_string {
|
Line 4130 sub make_attr_string {
|
|
|
Returns a uniform footer for LON-CAPA web pages. |
Returns a uniform footer for LON-CAPA web pages. |
|
|
Inputs: none |
Inputs: 1 - optional reference to an args hash |
|
If in the hash, key for noredirectlink has a value which evaluates to true, |
|
a 'Continue' link is not displayed if the page contains an |
|
internal redirect in the <head></head> section, |
|
i.e., $env{'internal.head.redirect'} exists |
|
|
=cut |
=cut |
|
|
sub endbodytag { |
sub endbodytag { |
|
my ($args) = @_; |
my $endbodytag='</body>'; |
my $endbodytag='</body>'; |
$endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag; |
$endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag; |
if ( exists( $env{'internal.head.redirect'} ) ) { |
if ( exists( $env{'internal.head.redirect'} ) ) { |
$endbodytag= |
if (!(ref($args) eq 'HASH' && $args->{'noredirectlink'})) { |
"<br /><a href=\"$env{'internal.head.redirect'}\">". |
$endbodytag= |
&mt('Continue').'</a>'. |
"<br /><a href=\"$env{'internal.head.redirect'}\">". |
$endbodytag; |
&mt('Continue').'</a>'. |
|
$endbodytag; |
|
} |
} |
} |
return $endbodytag; |
return $endbodytag; |
} |
} |
Line 4368 td.LC_menubuttons_img {
|
Line 4411 td.LC_menubuttons_img {
|
} |
} |
.LC_new_mail { |
.LC_new_mail { |
font-family: $sans; |
font-family: $sans; |
|
background: $tabbg; |
font-weight: bold; |
font-weight: bold; |
} |
} |
|
|
Line 4454 table.LC_aboutme_port tr.LC_even_row td
|
Line 4498 table.LC_aboutme_port tr.LC_even_row td
|
table.LC_data_table tr.LC_data_table_highlight td { |
table.LC_data_table tr.LC_data_table_highlight td { |
background-color: $data_table_darker; |
background-color: $data_table_darker; |
} |
} |
|
table.LC_data_table tr td.LC_leftcol_header { |
|
background-color: $data_table_head; |
|
font-weight: bold; |
|
} |
table.LC_data_table tr.LC_empty_row td, |
table.LC_data_table tr.LC_empty_row td, |
table.LC_nested tr.LC_empty_row td { |
table.LC_nested tr.LC_empty_row td { |
background-color: #FFFFFF; |
background-color: #FFFFFF; |
Line 4943 span.LC_cusr_emph {
|
Line 4991 span.LC_cusr_emph {
|
font-style: italic; |
font-style: italic; |
} |
} |
|
|
|
span.LC_cusr_subheading { |
|
font-weight: normal; |
|
font-size: 85%; |
|
} |
|
|
table.LC_docs_documents { |
table.LC_docs_documents { |
background: #BBBBBB; |
background: #BBBBBB; |
border-width: 0px; |
border-width: 0px; |
Line 5470 sub end_page {
|
Line 5523 sub end_page {
|
if ($args->{'frameset'}) { |
if ($args->{'frameset'}) { |
$result .= '</frameset>'; |
$result .= '</frameset>'; |
} else { |
} else { |
$result .= &endbodytag(); |
$result .= &endbodytag($args); |
} |
} |
$result .= "\n</html>"; |
$result .= "\n</html>"; |
|
|
Line 5848 previous, future, or all.
|
Line 5901 previous, future, or all.
|
6. reference to results object (hash of hashes). |
6. reference to results object (hash of hashes). |
7. reference to optional userdata hash |
7. reference to optional userdata hash |
8. reference to optional statushash |
8. reference to optional statushash |
|
9. flag if privileged users (except those set to unhide in |
|
course settings) should be excluded |
Keys of top level results hash are roles. |
Keys of top level results hash are roles. |
Keys of inner hashes are username:domain, with |
Keys of inner hashes are username:domain, with |
values set to access type. |
values set to access type. |
Line 5864 of the possibility of multiple values fo
|
Line 5919 of the possibility of multiple values fo
|
############################################### |
############################################### |
|
|
sub get_course_users { |
sub get_course_users { |
my ($cdom,$cnum,$types,$roles,$sections,$users,$userdata,$statushash) = @_; |
my ($cdom,$cnum,$types,$roles,$sections,$users,$userdata,$statushash,$hidepriv) = @_; |
my %idx = (); |
my %idx = (); |
my %seclists; |
my %seclists; |
|
|
Line 5940 sub get_course_users {
|
Line 5995 sub get_course_users {
|
active => 'Active', |
active => 'Active', |
future => 'Future', |
future => 'Future', |
); |
); |
|
my %nothide; |
|
if ($hidepriv) { |
|
my %coursehash=&Apache::lonnet::coursedescription($cdom.'_'.$cnum); |
|
foreach my $user (split(/\s*\,\s*/,$coursehash{'nothideprivileged'})) { |
|
if ($user !~ /:/) { |
|
$nothide{join(':',split(/[\@]/,$user))}=1; |
|
} else { |
|
$nothide{$user} = 1; |
|
} |
|
} |
|
} |
foreach my $person (sort(keys(%coursepersonnel))) { |
foreach my $person (sort(keys(%coursepersonnel))) { |
my $match = 0; |
my $match = 0; |
my $secmatch = 0; |
my $secmatch = 0; |
Line 5973 sub get_course_users {
|
Line 6039 sub get_course_users {
|
$usec = 'none'; |
$usec = 'none'; |
} |
} |
if ($uname ne '' && $udom ne '') { |
if ($uname ne '' && $udom ne '') { |
|
if ($hidepriv) { |
|
if ((&Apache::lonnet::privileged($uname,$udom)) && |
|
(!$nothide{$uname.':'.$udom})) { |
|
next; |
|
} |
|
} |
if ($end > 0 && $end < $now) { |
if ($end > 0 && $end < $now) { |
$status = 'previous'; |
$status = 'previous'; |
} elsif ($start > $now) { |
} elsif ($start > $now) { |
Line 7598 a hash ref describing the data to be sto
|
Line 7670 a hash ref describing the data to be sto
|
|
|
Returns: both routines return nothing |
Returns: both routines return nothing |
|
|
|
=back |
|
|
=cut |
=cut |
|
|
####################################################### |
####################################################### |
Line 7753 sub build_recipient_list {
|
Line 7827 sub build_recipient_list {
|
|
|
sub commit_customrole { |
sub commit_customrole { |
my ($udom,$uname,$url,$three,$four,$five,$start,$end) = @_; |
my ($udom,$uname,$url,$three,$four,$five,$start,$end) = @_; |
my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.'@'.$three.' in '.$url. |
my $output = &mt('Assigning custom role').' "'.$five.'" by '.$four.':'.$three.' in '.$url. |
($start?', '.&mt('starting').' '.localtime($start):''). |
($start?', '.&mt('starting').' '.localtime($start):''). |
($end?', ending '.localtime($end):'').': <b>'. |
($end?', ending '.localtime($end):'').': <b>'. |
&Apache::lonnet::assigncustomrole( |
&Apache::lonnet::assigncustomrole( |
Line 7816 sub commit_studentrole {
|
Line 7890 sub commit_studentrole {
|
my $secchange = 0; |
my $secchange = 0; |
my $expire_role_result; |
my $expire_role_result; |
my $modify_section_result; |
my $modify_section_result; |
unless ($oldsec eq '-1') { |
if ($oldsec ne '-1') { |
unless ($sec eq $oldsec) { |
if ($oldsec ne $sec) { |
$secchange = 1; |
$secchange = 1; |
|
my $now = time; |
my $uurl='/'.$cid; |
my $uurl='/'.$cid; |
$uurl=~s/\_/\//g; |
$uurl=~s/\_/\//g; |
if ($oldsec) { |
if ($oldsec) { |
$uurl.='/'.$oldsec; |
$uurl.='/'.$oldsec; |
} |
} |
$oldsecurl = $uurl; |
$oldsecurl = $uurl; |
$expire_role_result = &Apache::lonnet::assignrole($udom,$uname,$uurl,'st',time); |
$expire_role_result = |
|
&Apache::lonnet::assignrole($udom,$uname,$uurl,'st',$now); |
|
if ($env{'request.course.sec'} ne '') { |
|
if ($expire_role_result eq 'refused') { |
|
my @roles = ('st'); |
|
my @statuses = ('previous'); |
|
my @roledoms = ($one); |
|
my $withsec = 1; |
|
my %roleshash = |
|
&Apache::lonnet::get_my_roles($uname,$udom,'userroles', |
|
\@statuses,\@roles,\@roledoms,$withsec); |
|
if (defined ($roleshash{$two.':'.$one.':st:'.$oldsec})) { |
|
my ($oldstart,$oldend) = |
|
split(':',$roleshash{$two.':'.$one.':st:'.$oldsec}); |
|
if ($oldend > 0 && $oldend <= $now) { |
|
$expire_role_result = 'ok'; |
|
} |
|
} |
|
} |
|
} |
$result = $expire_role_result; |
$result = $expire_role_result; |
} |
} |
} |
} |
Line 7833 sub commit_studentrole {
|
Line 7927 sub commit_studentrole {
|
$modify_section_result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,'','',$cid); |
$modify_section_result = &Apache::lonnet::modify_student_enrollment($udom,$uname,undef,undef,undef,undef,undef,$sec,$end,$start,'','',$cid); |
if ($modify_section_result =~ /^ok/) { |
if ($modify_section_result =~ /^ok/) { |
if ($secchange == 1) { |
if ($secchange == 1) { |
$$logmsg .= &mt('Section for [_1] switched from old section: [_2] to new section: [_3].',$uname,$oldsec,$sec).$linefeed; |
if ($sec eq '') { |
|
$$logmsg .= &mt('Section for [_1] switched from (possibly expired) old section: [_2] to student role without a section.',$uname,$oldsec).$linefeed; |
|
} else { |
|
$$logmsg .= &mt('Section for [_1] switched from (possibly expired) old section: [_2] to new section: [_3].',$uname,$oldsec,$sec).$linefeed; |
|
} |
} elsif ($oldsec eq '-1') { |
} elsif ($oldsec eq '-1') { |
$$logmsg .= &mt('New student role for [_1] in section [_2] in course [_3].',$uname,$sec,$cid).$linefeed; |
if ($sec eq '') { |
|
$$logmsg .= &mt('New student role without a section for [_1] in course [_2].',$uname,$cid).$linefeed; |
|
} else { |
|
$$logmsg .= &mt('New student role for [_1] in section [_2] in course [_3].',$uname,$sec,$cid).$linefeed; |
|
} |
} else { |
} else { |
$$logmsg .= &mt('Student [_1] assigned to unchanged section [_2] in course [_3].',$uname,$sec,$cid).$linefeed; |
if ($sec eq '') { |
|
$$logmsg .= &mt('Student [_1] assigned to course [_2] without a section.',$uname,$cid).$linefeed; |
|
} else { |
|
$$logmsg .= &mt('Student [_1] assigned to section [_2] in course [_3].',$uname,$sec,$cid).$linefeed; |
|
} |
} |
} |
} else { |
} else { |
$$logmsg .= &mt('Error when attempting section change for [_1] from old section [_2] to new section: [_3] in course [_4] -error:',$uname,$oldsec,$sec,$cid).' '.$modify_section_result.$linefeed; |
if ($secchange) { |
|
$$logmsg .= &mt('Error when attempting section change for [_1] from old section "[_2]" to new section: "[_3]" in course [_4] -error:',$uname,$oldsec,$sec,$cid).' '.$modify_section_result.$linefeed; |
|
} else { |
|
$$logmsg .= &mt('Error when attempting to modify role for [_1] for section: "[_2]" in course [_3] -error:',$uname,$sec,$cid).' '.$modify_section_result.$linefeed; |
|
} |
} |
} |
$result = $modify_section_result; |
$result = $modify_section_result; |
} elsif ($secchange == 1) { |
} elsif ($secchange == 1) { |
$$logmsg .= &mt('Error when attempting to expire role for [_1] in old section [_2] in course [_3] -error: ',$uname,$oldsec,$cid).' '.$expire_role_result.$linefeed; |
if ($oldsec eq '') { |
|
$$logmsg .= &mt('Error when attempting to expire existing role without a section for [_1] in course [_3] -error: ',$uname,$cid).' '.$expire_role_result.$linefeed; |
|
} else { |
|
$$logmsg .= &mt('Error when attempting to expire existing role for [_1] in section [_2] in course [_3] -error: ',$uname,$oldsec,$cid).' '.$expire_role_result.$linefeed; |
|
} |
if ($expire_role_result eq 'refused') { |
if ($expire_role_result eq 'refused') { |
my $newsecurl = '/'.$cid; |
my $newsecurl = '/'.$cid; |
$newsecurl =~ s/\_/\//g; |
$newsecurl =~ s/\_/\//g; |
Line 7978 sub construct_course {
|
Line 8092 sub construct_course {
|
$cenv{'url'}=$oldcenv{'url'}; |
$cenv{'url'}=$oldcenv{'url'}; |
# Restore title |
# Restore title |
$cenv{'description'}=$oldcenv{'description'}; |
$cenv{'description'}=$oldcenv{'description'}; |
# restore grading mode |
|
if (defined($oldcenv{'grading'})) { |
|
$cenv{'grading'}=$oldcenv{'grading'}; |
|
} |
|
# Mark as cloned |
# Mark as cloned |
$cenv{'clonedfrom'}=$cloneid; |
$cenv{'clonedfrom'}=$cloneid; |
delete($cenv{'default_enrollment_start_date'}); |
# Need to clone grading mode |
delete($cenv{'default_enrollment_end_date'}); |
my %newenv=&Apache::lonnet::get('environment',['grading'],$$crsudom,$$crsunum); |
|
$cenv{'grading'}=$newenv{'grading'}; |
|
# Do not clone these environment entries |
|
&Apache::lonnet::del('environment', |
|
['default_enrollment_start_date', |
|
'default_enrollment_end_date', |
|
'question.email', |
|
'policy.email', |
|
'comment.email', |
|
'pch.users.denied', |
|
'plc.users.denied'], |
|
$$crsudom,$$crsunum); |
} |
} |
|
|
# |
# |
Line 8073 sub construct_course {
|
Line 8194 sub construct_course {
|
} |
} |
if ($args->{'notify_dc'}) { |
if ($args->{'notify_dc'}) { |
if ($uname ne '') { |
if ($uname ne '') { |
push(@notified,$uname.'@'.$udom); |
push(@notified,$uname.':'.$udom); |
} |
} |
} |
} |
if (@notified > 0) { |
if (@notified > 0) { |