[LON-CAPA-cvs] cvs: loncom(GCI_3) /interface lonmainmenu.pm lonmenu.pm
raeburn
raeburn@source.lon-capa.org
Tue, 05 Jan 2010 15:27:31 -0000
This is a MIME encoded message
--raeburn1262705251
Content-Type: text/plain
raeburn Tue Jan 5 15:27:31 2010 EDT
Modified files: (Branch: GCI_3)
/loncom/interface lonmainmenu.pm lonmenu.pm
Log:
Customization for GCI_3
- Custom Main Menu for students in GCI Concept Tests.
--raeburn1262705251
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20100105152731.txt"
Index: loncom/interface/lonmainmenu.pm
diff -u loncom/interface/lonmainmenu.pm:1.8.4.5 loncom/interface/lonmainmenu.pm:1.8.4.6
--- loncom/interface/lonmainmenu.pm:1.8.4.5 Tue Dec 15 05:17:52 2009
+++ loncom/interface/lonmainmenu.pm Tue Jan 5 15:27:31 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# displays the main menu
#
-# $Id: lonmainmenu.pm,v 1.8.4.5 2009/12/15 05:17:52 raeburn Exp $
+# $Id: lonmainmenu.pm,v 1.8.4.6 2010/01/05 15:27:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -67,15 +67,19 @@
$utility
</script>
ENDSCRIPT
- } elsif ($custommenu) {
+ } elsif (($custommenu) || ($env{'user.domain'} eq 'gcitest')) {
+ my $role = 'st';
+ if ($custommenu) {
+ $role = 'cc';
+ }
my $switcher_js;
- my %courses = &Apache::loncommon::existing_gcitest_courses();
+ my %courses = &Apache::loncommon::existing_gcitest_courses($role);
my $numcourses = keys(%courses);
if ($numcourses > 0) {
- $switcher = &gcitest_switcher(%courses);
+ $switcher = &gcitest_switcher($role,%courses);
my $current;
if ($env{'request.course.id'}) {
- $current = 'cc./'.$env{'course.'.$env{'request.course.id'}.'.domain'}.
+ $current = $role.'./'.$env{'course.'.$env{'request.course.id'}.'.domain'}.
'/'.$env{'course.'.$env{'request.course.id'}.'.num'};
}
$switcher_js = &gcitest_switcher_js($current,$numcourses);
@@ -101,6 +105,8 @@
{'bread_crumbs' => 1}));
if ($custommenu) {
$r->print(&Apache::lonmenu::inlinemenu('gcicustom',$switcher).$form);
+ } elsif ($env{'user.domain'} eq 'gcitest') {
+ $r->print(&Apache::lonmenu::inlinemenu('gcistudent',$switcher).$form);
} else {
$r->print(&Apache::lonmenu::inlinemenu().$form);
}
@@ -109,7 +115,7 @@
}
sub gcitest_switcher {
- my (%courses) = @_;
+ my ($role,%courses) = @_;
my $output;
my %Sortby;
foreach my $course (sort(keys(%courses))) {
@@ -141,7 +147,7 @@
foreach my $item (@sorted_courses) {
foreach my $course (@{$Sortby{$item}}) {
my ($cdom,$cnum) = split('_',$course);
- $output .= '<option value="cc./'.$cdom.'/'.$cnum.'">'.$courses{$course}{'description'}.'</option>';
+ $output .= '<option value="'.$role.'./'.$cdom.'/'.$cnum.'">'.$courses{$course}{'description'}.'</option>';
}
}
$output .= '</select><input type="hidden" name="selectrole" value="" /></form>';
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.309.2.6 loncom/interface/lonmenu.pm:1.309.2.7
--- loncom/interface/lonmenu.pm:1.309.2.6 Tue Jan 5 13:18:11 2010
+++ loncom/interface/lonmenu.pm Tue Jan 5 15:27:31 2010
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.309.2.6 2010/01/05 13:18:11 raeburn Exp $
+# $Id: lonmenu.pm,v 1.309.2.7 2010/01/05 15:27:31 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1380,29 +1380,40 @@
undef(@inlineremote);
undef(%category_members);
my $output;
- if ($context eq 'gcicustom') {
- my $createtext = &mt('Create Concept Test');
- if ($switcher) {
- $createtext = &mt('Create New Test');
- }
+ if (($context eq 'gcicustom') || ($context eq 'gcistudent')) {
$output='<table><tr>'.
'<td class="LC_mainmenu_col_fieldset">'.
'<div class="LC_Box LC_400Box">'.
'<h3 class="LC_hcell">'.&mt('Utilities').'</h3>'.
- '<table><tr><td align="left"><a href="javascript:switchpage('."'createtest'".');"><img alt="choose role" src="/res/adm/pages/rcrs.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:switchpage('."'createtest'".');"><span class="LC_menubuttons_inline_text">'.$createtext.'</span></a></td></tr>';
+ '<table>';
+ if ($context eq 'gcicustom') {
+ my $createtext = &mt('Create Concept Test');
+ if ($switcher) {
+ $createtext = &mt('Create New Test');
+ }
+ $output .= '<tr><td align="left"><a href="javascript:switchpage('."'createtest'".');"><img alt="choose role" src="/res/adm/pages/rcrs.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:switchpage('."'createtest'".');"><span class="LC_menubuttons_inline_text">'.$createtext.'</span></a></td></tr>';
+ }
if ($switcher) {
$output .= '<tr><td align="left"><a href="javascript:courseswitcher('."'icon'".');"><img alt="choose role" src="/res/adm/pages/roles.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="2">'.$switcher.'</td></tr>';
}
- $output .= '<tr><td align="left"><a href="javascript:go('."'/adm/communicate'".');"><img alt="communication" src="/res/adm/pages/com.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/communicate'".');"><span class="LC_menubuttons_inline_text">'.&mt('Send/Display Messages').'</span></a></td></tr></table></div></td>';
- if (($env{'request.course.id'}) &&
- (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
- $output.= '<td class="LC_mainmenu_col_fieldset">'.
- '<div class="LC_Box LC_400Box">'.
- '<h3 class="LC_hcell">'.&mt('Test Management').'</h3>'.
- '<table><tr><td align="left"><a href="javascript:gonav('."'/adm/navmaps'".');"><img alt="course contents" src="/res/adm/pages/nav.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:gonav('."'/adm/navmaps'".');"><span class="LC_menubuttons_inline_text">Concept Test Contents</span></a></td></tr>'."\n".
- '<tr><td align="left"><a href="javascript:go('."'/adm/coursedocs'".');"><img alt="assemble test" src="/res/adm/pages/docs.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/coursedocs'".');"><span class="LC_menubuttons_inline_text">Assemble Concept Test</span></a></td></tr>'."\n".
- '<tr><td align="left"><a href="javascript:go('."'/adm/createuser'".');"><img alt="user privs" src="/res/adm/pages/cprv.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/createuser'".');"><span class="LC_menubuttons_inline_text">'.&mt('Manage Enrollment').'</span></a></td></tr>'."\n".
- '<tr><td align="left"><a href="javascript:go('."'/adm/whatsnew'".');"><img alt="what is new" src="/res/adm/pages/new.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/whatsnew'".');"><span class="LC_menubuttons_inline_text">'.&mt("What's New?").'</span></a></td></tr></table></div></td>';
+ $output .= '<tr><td align="left"><a href="javascript:go('."'/adm/communicate'".');"><img alt="communication" src="/res/adm/pages/com.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/communicate'".');"><span class="LC_menubuttons_inline_text">'.&mt('Send/Display Messages').'</span></a></td></tr>';
+ if ($env{'request.course.id'}) {
+ if (($context eq 'gcicustom') && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) {
+ $output.= '</td></tr></table></div></td>'.
+ '<td class="LC_mainmenu_col_fieldset">'.
+ '<div class="LC_Box LC_400Box">'.
+ '<h3 class="LC_hcell">'.&mt('Test Management').'</h3>'.
+ '<table><tr><td align="left"><a href="javascript:gonav('."'/adm/navmaps'".');"><img alt="course contents" src="/res/adm/pages/nav.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:gonav('."'/adm/navmaps'".');"><span class="LC_menubuttons_inline_text">Concept Test Contents</span></a></td></tr>'."\n".
+ '<tr><td align="left"><a href="javascript:go('."'/adm/coursedocs'".');"><img alt="assemble test" src="/res/adm/pages/docs.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/coursedocs'".');"><span class="LC_menubuttons_inline_text">Assemble Concept Test</span></a></td></tr>'."\n".
+ '<tr><td align="left"><a href="javascript:go('."'/adm/createuser'".');"><img alt="user privs" src="/res/adm/pages/cprv.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/createuser'".');"><span class="LC_menubuttons_inline_text">'.&mt('Manage Enrollment').'</span></a></td></tr>'."\n".
+ '<tr><td align="left"><a href="javascript:go('."'/adm/whatsnew'".');"><img alt="what is new" src="/res/adm/pages/new.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/whatsnew'".');"><span class="LC_menubuttons_inline_text">'.&mt("What's New?").'</span></a></td></tr></table></div></td>';
+ } else {
+ my $navtext = &mt('Table of Contents');
+ if ($env{'request.role.domain'} eq 'gcitest') {
+ $navtext = &mt('Display Test Contents');
+ }
+ $output .= '<tr><td align="left"><a href="javascript:gonav('."'/adm/navmaps'".');"><img alt="course contents" src="/res/adm/pages/nav.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:gonav('."'/adm/navmaps'".');"><span class="LC_menubuttons_inline_text">'.$navtext.'</span></a></td></tr></table></div></td>';
+ }
}
$output.='</tr></table>';
} else {
--raeburn1262705251--