--- loncom/interface/loncommon.pm 2009/12/03 17:15:37 1.924
+++ loncom/interface/loncommon.pm 2009/12/14 22:40:45 1.925.2.4
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# a pile of common routines
#
-# $Id: loncommon.pm,v 1.924 2009/12/03 17:15:37 bisitz Exp $
+# $Id: loncommon.pm,v 1.925.2.4 2009/12/14 22:40:45 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -4467,6 +4467,10 @@ sub bodytag {
'link' => &designparm($function.'.link',$domain),);
@design{keys(%$addentries)} = @$addentries{keys(%$addentries)};
+ my $custommenu;
+ if ($env{'environment.remote'} eq 'off') {
+ $custommenu = &needs_gci_custom();
+ }
# role and realm
my ($role,$realm) = split(/\./,$env{'request.role'},2);
if ($role eq 'ca') {
@@ -4476,14 +4480,22 @@ sub bodytag {
# realm
if ($env{'request.course.id'}) {
if ($env{'request.role'} !~ /^cr/) {
- $role = &Apache::lonnet::plaintext($role,&course_type());
+ if (($custommenu) && ($role eq 'cm')) {
+ undef($role);
+ } else {
+ $role = &Apache::lonnet::plaintext($role,&course_type());
+ }
}
if ($env{'request.course.sec'}) {
$role .= (' 'x2).'- '.&mt('section:').' '.$env{'request.course.sec'};
}
$realm = $env{'course.'.$env{'request.course.id'}.'.description'};
} else {
- $role = &Apache::lonnet::plaintext($role);
+ if (($custommenu) && ($role eq 'cm')) {
+ undef($role);
+ } else {
+ $role = &Apache::lonnet::plaintext($role);
+ }
}
if (!$realm) { $realm=' '; }
@@ -4534,7 +4546,16 @@ sub bodytag {
# $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')) {
+ $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 = '
'.$role_selector;
+ }
+ }
if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) {
if ($dc_info) {
@@ -4545,10 +4566,10 @@ sub bodytag {
return $bodytag;
}
- $bodytag .= qq|
$name $role
|;
+ $bodytag .= qq|$name $role $role_selector
|;
$bodytag .= Apache::lonhtmlcommon::scripttag(
- Apache::lonmenu::utilityfunctions(), 'start');
+ Apache::lonmenu::utilityfunctions('',$custommenu), 'start');
$bodytag .= Apache::lonmenu::primary_menu();
@@ -4559,7 +4580,11 @@ sub bodytag {
#don't show menus for public users
if($env{'user.name'} ne 'public' && $env{'user.domain'} ne 'public'){
- $bodytag .= Apache::lonmenu::secondary_menu();
+ if ($custommenu) {
+ $bodytag .= &Apache::lonmenu::gci_secondary_menu();
+ } else {
+ $bodytag .= Apache::lonmenu::secondary_menu();
+ }
$bodytag .= Apache::lonmenu::serverform();
$bodytag .= Apache::lonhtmlcommon::scripttag('', 'end');
if ($env{'request.state'} eq 'construct') {
@@ -5628,12 +5653,12 @@ span.LC_prior_string,
span.LC_prior_custom,
span.LC_prior_reaction,
span.LC_prior_math {
- font-family: monospace;
+ font-family: $mono;
white-space: pre;
}
span.LC_prior_string {
- font-family: monospace;
+ font-family: $mono;
white-space: pre;
}
@@ -6321,11 +6346,6 @@ table.LC_tableOfContent a {
text-decoration: none;
}
-table.LC_tableBrowseRes tr.LC_trOdd,
-table.LC_tableOfContent tr.LC_trOdd {
- background-color: #EEEEEE;
-}
-
table.LC_tableOfContent img {
border: none;
height: 1.3em;
@@ -6424,6 +6444,36 @@ ul.LC_funclist li {
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
}
@@ -10686,6 +10736,76 @@ sub clean_symb {
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 %courses;
+ my $cdom = 'gcitest';
+ my $role = 'cc';
+ 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
=back