version 1.925.2.9, 2010/01/16 19:56:54
|
version 1.926, 2009/12/08 14:44:17
|
Line 4467 sub bodytag {
|
Line 4467 sub bodytag {
|
'link' => &designparm($function.'.link',$domain),); |
'link' => &designparm($function.'.link',$domain),); |
@design{keys(%$addentries)} = @$addentries{keys(%$addentries)}; |
@design{keys(%$addentries)} = @$addentries{keys(%$addentries)}; |
|
|
my $custommenu; |
|
if ($env{'environment.remote'} eq 'off') { |
|
$custommenu = &needs_gci_custom(); |
|
} |
|
# role and realm |
# role and realm |
my ($role,$realm) = split(/\./,$env{'request.role'},2); |
my ($role,$realm) = split(/\./,$env{'request.role'},2); |
if ($role eq 'ca') { |
if ($role eq 'ca') { |
Line 4480 sub bodytag {
|
Line 4476 sub bodytag {
|
# realm |
# realm |
if ($env{'request.course.id'}) { |
if ($env{'request.course.id'}) { |
if ($env{'request.role'} !~ /^cr/) { |
if ($env{'request.role'} !~ /^cr/) { |
if (($custommenu) && ($role eq 'cm')) { |
$role = &Apache::lonnet::plaintext($role,&course_type()); |
undef($role); |
|
} else { |
|
$role = &Apache::lonnet::plaintext($role,&course_type()); |
|
} |
|
} |
} |
if ($env{'request.course.sec'}) { |
if ($env{'request.course.sec'}) { |
$role .= (' 'x2).'- '.&mt('section:').' '.$env{'request.course.sec'}; |
$role .= (' 'x2).'- '.&mt('section:').' '.$env{'request.course.sec'}; |
} |
} |
$realm = $env{'course.'.$env{'request.course.id'}.'.description'}; |
$realm = $env{'course.'.$env{'request.course.id'}.'.description'}; |
} else { |
} else { |
if (($custommenu) && ($role eq 'cm')) { |
$role = &Apache::lonnet::plaintext($role); |
undef($role); |
|
} else { |
|
$role = &Apache::lonnet::plaintext($role); |
|
} |
|
} |
} |
|
|
if (!$realm) { $realm=' '; } |
if (!$realm) { $realm=' '; } |
Line 4546 sub bodytag {
|
Line 4534 sub bodytag {
|
# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls |
# $titleinfo = &CSTR_pageheader(); #FIXME: Will be removed once all scripts have their own calls |
# } |
# } |
|
|
my $role_selector; |
|
if (($custommenu) && ($env{'request.course.id'}) && |
|
($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gcitest') && |
|
($env{'request.role'} !~ m{^st\./gcitest/$match_courseid})) { |
|
$role_selector = &Apache::lonmenu::roles_selector( |
|
$env{'course.' . $env{'request.course.id'} . '.domain'}, |
|
$env{'course.' . $env{'request.course.id'} . '.num'} ); |
|
if ($role_selector) { |
|
$role_selector = '<br />'.$role_selector; |
|
} |
|
} |
|
|
|
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { |
if ($dc_info) { |
if ($dc_info) { |
Line 4567 sub bodytag {
|
Line 4545 sub bodytag {
|
return $bodytag; |
return $bodytag; |
} |
} |
|
|
$bodytag .= qq|<div id="LC_nav_bar">$name $role $role_selector</div>|; |
$bodytag .= qq|<div id="LC_nav_bar">$name $role</div>|; |
|
|
$bodytag .= Apache::lonhtmlcommon::scripttag( |
$bodytag .= Apache::lonhtmlcommon::scripttag( |
Apache::lonmenu::utilityfunctions('',$custommenu), 'start'); |
Apache::lonmenu::utilityfunctions(), 'start'); |
|
|
$bodytag .= Apache::lonmenu::primary_menu(); |
$bodytag .= Apache::lonmenu::primary_menu(); |
|
|
Line 4581 sub bodytag {
|
Line 4559 sub bodytag {
|
|
|
#don't show menus for public users |
#don't show menus for public users |
if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){ |
if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){ |
if (($custommenu) && |
$bodytag .= Apache::lonmenu::secondary_menu(); |
($env{'request.role'} !~ m{^st\./gcitest/$match_courseid})) { |
|
$bodytag .= &Apache::lonmenu::gci_secondary_menu(); |
|
} else { |
|
$bodytag .= Apache::lonmenu::secondary_menu(); |
|
} |
|
$bodytag .= Apache::lonmenu::serverform(); |
$bodytag .= Apache::lonmenu::serverform(); |
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); |
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end'); |
if ($env{'request.state'} eq 'construct') { |
if ($env{'request.state'} eq 'construct') { |
Line 5542 table.LC_notify_front_page td {
|
Line 5515 table.LC_notify_front_page td {
|
font-size: 1.2em; |
font-size: 1.2em; |
} |
} |
|
|
.LC_topic_bar img { |
|
vertical-align: bottom; |
|
} |
|
|
|
table.LC_course_group_status { |
table.LC_course_group_status { |
margin: 20px; |
margin: 20px; |
} |
} |
Line 6446 ul.LC_funclist li {
|
Line 6415 ul.LC_funclist li {
|
line-height: 150%; |
line-height: 150%; |
} |
} |
|
|
#gciheader { |
|
float:left; |
|
width:100%; |
|
background:#DAE0D2 url("/gcimenu_bg.gif") repeat-x bottom; |
|
font-size:93%; |
|
line-height:normal; |
|
} |
|
#gciheader ul { |
|
margin:0; |
|
padding:10px 10px 0; |
|
list-style:none; |
|
} |
|
#gciheader li { |
|
float:left; |
|
background:url("/gcimenu_left.gif") no-repeat left top; |
|
margin:0; |
|
padding:0 0 0 9px; |
|
} |
|
#gciheader a { |
|
display:block; |
|
background:url("/gcimenu_right.gif") no-repeat right top; |
|
padding:5px 15px 4px 6px; |
|
} |
|
#gciheader #current { |
|
background-image:url("/gcimenu_left_on.gif"); |
|
} |
|
#gciheader #current a { |
|
background-image:url("/gcimenu_right_on.gif"); |
|
padding-bottom:5px; |
|
} |
|
|
|
END |
END |
} |
} |
Line 10697 sub _add_to_env {
|
Line 10636 sub _add_to_env {
|
} |
} |
} |
} |
|
|
sub new_roles_update { |
|
my $rolecount = 0; |
|
foreach my $envkey (keys(%env)) { |
|
next unless ($envkey =~ /^user\.role\./); |
|
$rolecount ++; |
|
} |
|
my $newrolecount = 0; |
|
if (!$rolecount) { |
|
my %userenv; |
|
foreach my $crstype ('official','unofficial','community') { |
|
$userenv{'canrequest.'.$crstype} = |
|
&Apache::lonnet::usertools_access($env{'user.name'}, |
|
$env{'user.domain'},$crstype,'reload','requestcourses'); |
|
} |
|
my $then=$env{'user.login.time'}; |
|
my $refresh=time; |
|
my (%userroles,%allroles,%allgroups,@newroles); |
|
my %roleshash = |
|
&Apache::lonnet::get_my_roles($env{'user.name'},$env{'user.domain'},'userroles',['active','future','previous'],undef,undef,1); |
|
foreach my $item (keys(%roleshash)) { |
|
my ($uname,$udom,$role,$section) = split(':',$item); |
|
my $where = '/'.$udom.'/'.$uname; |
|
my ($tstart,$tend) = split(':',$roleshash{$item}); |
|
if ($section ne '') { |
|
$where .= '/'.$section; |
|
} |
|
my $spec = $role.'.'.$where; |
|
&Apache::lonnet::set_arearole($role,$where,$tstart,$tend, |
|
$env{'user.domain'},$env{'user.name'}); |
|
$userroles{'user.role.'.$spec} = $tstart.'.'.$tend; |
|
$newrolecount ++; |
|
unless (grep(/^\Q$role\E$/,@newroles)) { |
|
push(@newroles,$role); |
|
} |
|
my $status = |
|
&Apache::lonnet::curr_role_status($tstart,$tend,$refresh,$then); |
|
if ($status eq 'active') { |
|
&Apache::lonnet::gather_roleprivs(\%allroles,\%allgroups,\%userroles, |
|
$where,$role,$tstart,$tend); |
|
} |
|
} |
|
if (@newroles) { |
|
&Apache::lonnet::appenv(\%userroles,[@newroles,'cm']); |
|
my ($author,$adv) = &Apache::lonnet::set_userprivs(\%userroles,\%allroles, |
|
\%allgroups); |
|
$userenv{'user.adv'} = $adv; |
|
$userenv{'user.author'} = $author; |
|
$userenv{'user.refresh.time'} = $refresh; |
|
} |
|
&Apache::lonnet::appenv(\%userenv); |
|
} |
|
return $newrolecount; |
|
} |
|
|
|
# --- Get the symbolic name of a problem and the url |
# --- Get the symbolic name of a problem and the url |
sub get_symb { |
sub get_symb { |
my ($request,$silent) = @_; |
my ($request,$silent) = @_; |
Line 10792 sub clean_symb {
|
Line 10677 sub clean_symb {
|
return ($symb,$enc); |
return ($symb,$enc); |
} |
} |
|
|
sub needs_gci_custom { |
|
my $custommenu; |
|
my $numdc = &check_for_gci_dc(); |
|
unless ($numdc) { |
|
my $then=$env{'user.login.time'}; |
|
my $now = time; |
|
my %cnums = ( |
|
review => '9615072b469884921gcil1', |
|
submit => '1H96711d710194bfegcil1', |
|
); |
|
if ($env{'user.role.st./gci/'.$cnums{'review'}}) { |
|
my ($start,$end) = |
|
split('.',$env{'user.role.st./gci/'.$cnums{'review'}}); |
|
if (((!$start) || ($start && $start <= $now)) && |
|
((!$end) || ($end > $now))) { |
|
$custommenu = 1; |
|
if ($env{'user.role.cc./gci/'.$cnums{'review'}}) { |
|
my ($ccstart,$ccend) = |
|
split('.',$env{'user.role.cc./gci/'.$cnums{'review'}}); |
|
if (((!$start) || ($start && $start <= $now)) && |
|
((!$end) || ($end > $now))) { |
|
$custommenu = ''; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
return $custommenu; |
|
} |
|
|
|
sub check_for_gci_dc { |
|
my $then=$env{'user.login.time'}; |
|
my $numdc = 0; |
|
foreach my $dom ('gci','gcitest') { |
|
if ($env{'user.role.dc./'.$dom.'/'}) { |
|
my $livedc = 1; |
|
my ($tstart,$tend)=split(/\./,$env{'user.role.dc./'.$dom.'/'}); |
|
if ($tstart && $tstart>$then) { $livedc = 0; } |
|
if ($tend && $tend <$then) { $livedc = 0; } |
|
if ($livedc) { |
|
$numdc++; |
|
} |
|
} |
|
} |
|
return $numdc; |
|
} |
|
|
|
sub existing_gcitest_courses { |
|
my ($role) = @_; |
|
my %courses; |
|
my $cdom = 'gcitest'; |
|
my $now = time; |
|
foreach my $envkey (keys(%env)) { |
|
my $cnum; |
|
if ($envkey =~ m{^user\.role\.\Q$role\E\./\Q$cdom\E/($match_courseid)$}) { |
|
$cnum = $1; |
|
} else { |
|
next; |
|
} |
|
my ($tstart,$tend) = split('.',$env{$envkey}); |
|
if (((!$tstart) || ($tstart < $now)) && ((!$tend) || ($tend > $now))) { |
|
my $descr = $env{'course.'.$cdom.'_'.$cnum.'.description'}; |
|
if ($descr ne '') { |
|
$courses{$cdom.'_'.$cnum}{'description'} = $descr; |
|
} |
|
} |
|
} |
|
return %courses; |
|
} |
|
|
|
=pod |
=pod |
|
|
=back |
=back |