Diff for /loncom/interface/lonmenu.pm between versions 1.309.2.19 and 1.314

version 1.309.2.19, 2010/11/30 05:51:55 version 1.314, 2010/02/24 17:38:52
Line 42  Coordinates the response to clicking an Line 42  Coordinates the response to clicking an
 This is part of the LearningOnline Network with CAPA project  This is part of the LearningOnline Network with CAPA project
 described at http://www.lon-capa.org.  described at http://www.lon-capa.org.
   
   =head1 GLOBAL VARIABLES
   
   =over
   
   =item @desklines
   
   Each element of this array contains a line of mydesk.tab that doesn't start with
   cat, prim or scnd. 
   It gets filled in the BEGIN block of this module.
   
   =item %category_names
   
   The keys of this hash are the abbreviations used in mydesk.tab in those lines that 
   start with cat, the values are strings representing titles. 
   It gets filled in the BEGIN block of this module.
   
   =item %category_members
   
   TODO 
   
   =item %category_positions
   
   The keys of this hash are the abbreviations used in mydesk.tab in those lines that
   start with cat, its values are position vectors (column, row). 
   It gets filled in the BEGIN block of this module.
   
   =item $readdesk
   
   Indicates that mydesk.tab has been read. 
   It is set to 'done' in the BEGIN block of this module.
   
   =item @primary_menu
   
   The elements of this array reference arrays that are made up of the components
   of those lines of mydesk.tab that start with prim.
   It is used by primary_menu() to generate the corresponding menu.
   It gets filled in the BEGIN block of this module.
   
   =item @secondary_menu
   
   The elements of this array reference arrays that are made up of the components
   of those lines of mydesk.tab that start with scnd.
   It is used by secondary_menu() to generate the corresponding menu.
   It gets filled in the BEGIN block of this module.
   
   =back
   
 =head1 SUBROUTINES  =head1 SUBROUTINES
   
 =over  =over
   
 Little texts  =item prep_menuitems(\@menuitem)
   
   This routine wraps a menuitem in proper HTML. It is used by primary_menu() and 
   secondary_menu().
   
   =item primary_menu()
   
   This routine evaluates @primary_menu and returns XHTML for the menu
   that contains following links: About, Message, Roles, Help, Logout
   @primary_menu is filled within the BEGIN block of this module with 
   entries from mydesk.tab 
   
   =item secondary_menu()
   
 =item initlittle()  Same as primary_menu() but operates on @secondary_menu.
   
   =item DEPRECATED: initlittle()
   
   This routine returns a translated hash for the menu items in the top inline 
   menu row
   
 =item menubuttons()  =item menubuttons()
   
Line 131  use Apache::lonhtmlcommon(); Line 195  use Apache::lonhtmlcommon();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::loncoursequeueadmin;  
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities();  use HTML::Entities();
   
Line 164  sub prep_menuitem { Line 227  sub prep_menuitem {
 # entries from mydesk.tab  # entries from mydesk.tab
 sub primary_menu {  sub primary_menu {
     my $menu;      my $menu;
     my $custommenu = &Apache::loncommon::needs_gci_custom();  
     my $numdc = &Apache::loncommon::check_for_gci_dc();  
     # each element of @primary contains following array:      # each element of @primary contains following array:
     # (link url, icon path, alt text, link text, condition)      # (link url, icon path, alt text, link text, condition)
     my $public;  
     if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))  
         || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {  
         $public = 1;  
     }  
     foreach my $menuitem (@primary_menu) {      foreach my $menuitem (@primary_menu) {
         # evaluate conditions           # evaluate conditions 
         next if    ref($menuitem)       ne 'ARRAY';    #          next if    ref($menuitem)       ne 'ARRAY';    #
Line 181  sub primary_menu { Line 237  sub primary_menu {
         next if    $$menuitem[4]        eq 'newmsg'    # arrived or not          next if    $$menuitem[4]        eq 'newmsg'    # arrived or not
                 && !&Apache::lonmsg::mynewmail();      #                   && !&Apache::lonmsg::mynewmail();      # 
         next if    $$menuitem[4]        !~ /public/    ##we've a public user,           next if    $$menuitem[4]        !~ /public/    ##we've a public user, 
                 && $public;                            ##who should not see all                   && $env{'user.name'}    eq 'public'    ##who should not see all 
                                                        ##links                  && $env{'user.domain'}  eq 'public';   ##links
         next if    $$menuitem[4]        eq 'onlypublic'# hide links which are           next if    $$menuitem[4]        eq 'onlypublic'# hide links which are 
                 && !$public;                           # only visible to public                  && $env{'user.name'}    ne 'public'    # only visible to public
                                                        # users                  && $env{'user.domain'}  ne 'public';   # users
         next if    $$menuitem[4]        eq 'gci'  
                 && (!$custommenu || $env{'request.role'} =~ m{^st\./gcitest/});  
         next if    $$menuitem[4]        eq 'home'  
                 && (($custommenu) || ($env{'user.domain'} eq 'gcitest') ||   
                     (($env{'user.domain'} eq 'gci') && !$numdc));  
         next if    $$menuitem[4]        eq 'gcitest'  
                 && (($env{'user.domain'} eq 'gci') || ($env{'request.role'} eq 'cm'));  
         next if    $$menuitem[4]        eq 'roles'     # hide links which are  
                 && $custommenu;                        # not visible when GCI  
         next if    $$menuitem[4]        eq 'courses'   # tabbed interface in use  
                 && $custommenu;                        #   
         next if    $$menuitem[4]        eq 'roles'     ##show links depending on          next if    $$menuitem[4]        eq 'roles'     ##show links depending on
                 && &Apache::loncommon::show_course();  ##term 'Courses' or                   && &Apache::loncommon::show_course();  ##term 'Courses' or 
         next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted          next if    $$menuitem[4]        eq 'courses'   ##'Roles' wanted
Line 229  sub secondary_menu { Line 274  sub secondary_menu {
                      $env{'user.domain'}, $env{'user.name'},                       $env{'user.domain'}, $env{'user.name'},
                      $env{'course.' . $env{'request.course.id'} . '.domain'},                       $env{'course.' . $env{'request.course.id'} . '.domain'},
                      $env{'course.' . $env{'request.course.id'} . '.num'});                       $env{'course.' . $env{'request.course.id'} . '.num'});
     my $custommenu = &Apache::loncommon::needs_gci_custom();  
     my $numdc = &Apache::loncommon::check_for_gci_dc();  
     my $role = $env{'request.role'};  
     foreach my $menuitem (@secondary_menu) {      foreach my $menuitem (@secondary_menu) {
         # evaluate conditions           # evaluate conditions 
         next if    ref($menuitem)  ne 'ARRAY';          next if    ref($menuitem)  ne 'ARRAY';
         next if    $$menuitem[4]   eq 'showmenu'          next if    $$menuitem[4]   ne 'always'
                 && ($custommenu || (!$numdc && $role eq 'cm'));  
         next if    $$menuitem[4]   ne 'showmenu'  
                 && $$menuitem[4]   ne 'author'  
                 && !$env{'request.course.id'};                  && !$env{'request.course.id'};
         next if    $$menuitem[4]   eq 'showreturn'          next if    $$menuitem[4]   eq 'showreturn'
                 && !$showlink                  && !$showlink
Line 260  sub secondary_menu { Line 299  sub secondary_menu {
         next if    $$menuitem[4]   =~ /showgroups$/          next if    $$menuitem[4]   =~ /showgroups$/
                 && !$canviewgrps                  && !$canviewgrps
                 && !%groups;                  && !%groups;
         next if   $$menuitem[4]  eq 'showroles'  
                 && ($custommenu || !$numdc || ($numdc && $env{'request.noversionuri'} eq '/adm/roles'));          if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
         if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'} && !$custommenu) {  
             # special treatment for role selector              # special treatment for role selector
             my $roles_selector = &roles_selector(              my $roles_selector = &roles_selector(
                         $env{'course.' . $env{'request.course.id'} . '.domain'},                          $env{'course.' . $env{'request.course.id'} . '.domain'},
Line 306  sub secondary_menu { Line 344  sub secondary_menu {
     return "<ul id=\"LC_secondary_menu\">$menu</ul>";      return "<ul id=\"LC_secondary_menu\">$menu</ul>";
 }  }
   
 sub gci_secondary_menu {  
     my %courses = (  
         'review' => 'gci_9615072b469884921gcil1',  
         'submit' => 'gci_1H96711d710194bfegcil1',  
         'tutorial' => 'gci_5422913620b814c90gcil1',  
     );  
     my %linktext = (  
         'review'      => 'Review Questions',  
         'submit'      => 'Submit Questions',  
         'managetest'  => 'Manage Tests',  
         'tutorial'    => 'Tutorials',  
     );  
     my %links = (  
                   'managetest' => '/adm/menu',  
                 );  
     my $current = 'managetest';  
     if ($env{'form.destinationurl'} eq '/adm/gci_info') {  
         undef($current);  
     }  
     foreach my $key (keys(%courses)) {  
         $links{$key} = "javascript:switchpage('$key');";  
         if ($env{'request.course.id'} eq $courses{$key}) {  
             if ($env{'environment.remotenavmap'} eq 'on') {  
                 $links{$key} = "javascript:gonav('/adm/navmaps')";  
             } else {  
                 $links{$key} = '/adm/navmaps';  
             }  
             $current = $key;  
             $links{'managetest'} = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';  
         }  
     }  
     my @menutabs = ('review','submit','managetest','tutorial');  
     my $tabs;  
     foreach my $item (@menutabs) {  
         if ($item eq $current) {  
             $tabs .= '<li id="current"><a href="'.$links{$item}.'">'.  
                      $linktext{$item}.'</a></li>';  
         } else {  
             $tabs .= '<li><a href="'.$links{$item}.'">'.  
                      $linktext{$item}.'</a></li>';  
         }  
     }  
     return '<div id="gciheader">'.  
            '<ul>'.$tabs.'</ul></div><br />';  
 }  
   
 #  #
 # This routine returns a translated hash for the menu items in the top inline menu row  # This routine returns a translated hash for the menu items in the top inline menu row
Line 364  sub initlittle { Line 357  sub initlittle {
                                        'roles' => (&Apache::loncommon::show_course()?                                         'roles' => (&Apache::loncommon::show_course()?
                                                     'Courses':'Roles'),                                                      'Courses':'Roles'),
                                        'other' => 'Other Roles',                                         'other' => 'Other Roles',
                                        'docs' => 'Edit Course',                                         'docs' => 'Course Editor',
                                        'exit' => 'Logout',                                         'exit' => 'Logout',
                                        'login' => 'Log In',                                         'login' => 'Log In',
        'launch' => 'Launch Remote Control',         'launch' => 'Launch Remote Control',
Line 544  ENDINLINEMENU Line 537  ENDINLINEMENU
 }  }
   
 sub show_return_link {  sub show_return_link {
     return unless ($env{'request.course.id'});  
     if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})  
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {  
         return if ($env{'form.register'});  
     }  
     return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&      return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
      $env{'request.symb'} eq '')       $env{'request.symb'} eq '')
     ||      ||
Line 557  sub show_return_link { Line 545  sub show_return_link {
     (($env{'request.noversionuri'}=~/^\/adm\//) &&      (($env{'request.noversionuri'}=~/^\/adm\//) &&
      ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&       ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
      ($env{'request.noversionuri'}!~       ($env{'request.noversionuri'}!~
       m[^/adm/.*/(smppg|bulletinboard)($|\?)])        m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
      ));       ));
 }  }
   
Line 630  sub innerregister { Line 618  sub innerregister {
         } else {          } else {
             $contentstext = &mt('Course Contents');              $contentstext = &mt('Course Contents');
         }          }
         my @crumbs;          my @crumbs = ({text  => $contentstext, 
         unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')                         href  => "Javascript:gonav('/adm/navmaps')"});
                 && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {  
             my $link = "javascript:gopost('/adm/navmaps','')";  
             if ($env{'environment.remotenavmap'} eq 'on') {  
                 $link = "javascript:gonav('/adm/navmaps','')"  
             }  
             @crumbs = ({text  => Apache::loncommon::course_type()  
                                 . ' Contents',  
                         href  => $link});  
         }  
         if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {           if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { 
             push(@crumbs, {text  => '...',              push(@crumbs, {text  => '...',
                            no_mt => 1});                             no_mt => 1});
Line 884  $menuitems.="Make notes and annotations Line 864  $menuitems.="Make notes and annotations
                                 "&go('/adm/requestcourse')&Course requests\n";                                  "&go('/adm/requestcourse')&Course requests\n";
                 }                  }
             }              }
             unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|portfolio)(\?|$)/) {              unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
  if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {   if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
     $menuitems.=(<<ENDREALRES);      $menuitems.=(<<ENDREALRES);
 s&6&3&catalog.gif&catalog[_2]&info[_1]&catalog_info()&Show Metadata  s&6&3&catalog.gif&catalog[_2]&info[_1]&catalog_info()&Show Metadata
Line 924  ENDMENUITEMS Line 904  ENDMENUITEMS
     my $addremote=0;      my $addremote=0;
     foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }      foreach (@inlineremote) { if ($_ ne '') { $addremote=1; last;} }
     my $inlinebuttons='';      my $inlinebuttons='';
   
     if ($addremote) {      if ($addremote) {
   
         Apache::lonhtmlcommon::clear_breadcrumb_tools();          Apache::lonhtmlcommon::clear_breadcrumb_tools();
   
             Apache::lonhtmlcommon::add_breadcrumb_tool(              Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'navigation', @inlineremote[21,23]);                  'navigation', @inlineremote[21,23]);
   
         if(hidden_button_check() ne 'yes') {          if(hidden_button_check() ne 'yes') {
             Apache::lonhtmlcommon::add_breadcrumb_tool(              Apache::lonhtmlcommon::add_breadcrumb_tool(
                 'tools', @inlineremote[93,91,81,82,83]);                  'tools', @inlineremote[93,91,81,82,83]);
Line 943  ENDMENUITEMS Line 923  ENDMENUITEMS
                 Apache::lonhtmlcommon::add_breadcrumb_tool(                  Apache::lonhtmlcommon::add_breadcrumb_tool(
                      'tools', @inlineremote[63]);                       'tools', @inlineremote[63]);
             }              }
               
   
             unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {              Apache::lonhtmlcommon::add_breadcrumb_tool(
                 Apache::lonhtmlcommon::add_breadcrumb_tool(                  'advtools', @inlineremote[61,71,72,73,92]);
                     'advtools', @inlineremote[61,71,72,73,92]);  
             }  
         }          }
   
 #       # Registered, textual output  #       # Registered, textual output
Line 984  ENDMENUITEMS Line 963  ENDMENUITEMS
 #            }  #            }
 #        }  #        }
     }      }
         #SD see below  
         $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);          $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script type="text/javascript">  <script type="text/javascript">
Line 1410  sub openmenu { Line 1388  sub openmenu {
 }  }
   
 sub inlinemenu {  sub inlinemenu {
     my ($context) = @_;  
     undef(@inlineremote);      undef(@inlineremote);
     undef(%category_members);      undef(%category_members);
     my $output;  # calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control
     if ($context eq 'gcicustom') {      &rawconfig(1);
         my (%can_request,%request_domains,$canreq,$createtext);      my $output='<table><tr>';
         my $role = 'st';      for (my $col=1; $col<=2; $col++) {
         my $custommenu = &Apache::loncommon::needs_gci_custom();          $output.='<td class="LC_mainmenu_col_fieldset">';
         if ($custommenu) {          for (my $row=1; $row<=8; $row++) {
             $role = 'cc';              foreach my $cat (keys(%category_members)) {
         }                 if ($category_positions{$cat} ne "$col,$row") { next; }
         my %courses = &Apache::loncommon::existing_gcitest_courses($role);                 #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';
         my $numcourses = keys(%courses);                 $output.='<div class="LC_Box LC_400Box">';
         my ($switcher_js,$switcher);         $output.='<h3 class="LC_hcell">'.&mt($category_names{$cat}).'</h3>';
         my $formname = 'testpicker';                 $output.='<table>';
         if ($numcourses > 0) {                 my %active=();
             $switcher = &Apache::loncommon::gcitest_switcher($role,$formname,%courses);                 foreach my $menu_item (split(/\:/,$category_members{$cat})) {
             my $current;                    if ($inlineremote[$menu_item]) {
             my $cid = $env{'request.course.id'};                       $active{$menu_item}=1;
             if ($cid) {                    }
                 $current = $role.'./'.$env{'course.'.$cid.'.domain'}.                 }  
                            '/'.$env{'course.'.$cid.'.num'};                 foreach my $item (sort(keys(%active))) {
             }                    $output.=$inlineremote[$item];
             $switcher_js = &Apache::loncommon::gcitest_switcher_js($current,$numcourses,$formname);                 }
             if ($switcher_js) {                 $output.='</table>';
                 $switcher_js= <<"ENDSCRIPT";                 $output.='</div>';
 <script type="text/javascript">  
 // <![CDATA[  
   
 $switcher_js  
   
 // ]]>  
 </script>  
   
 ENDSCRIPT  
             }  
             $switcher = $switcher_js.$switcher;  
         }  
         if ($env{'user.domain'} eq 'gci') {  
             $canreq =  
                 &Apache::lonnet::check_can_request('gcitest',\%can_request,\%request_domains);  
             $createtext = &mt('Create Concept Test');  
             if ($numcourses) {  
                 $createtext = &mt('Create New Test');  
             }  
         }  
         if ($env{'request.course.id'}) {  
             if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {  
                 my $navlink;  
                 if ($env{'environment.remotenavmap'} eq 'on') {  
                     $navlink = "javascript:gonav('/adm/navmaps')";  
                 } else {  
                     $navlink = '/adm/navmaps';  
                 }  
                 $output .=   
                   '<br /><br clear="all" /><div class="LC_Box LC_GCI_Menu">'.  
                   '<h3 class="LC_hcell">'.&mt('Management').'</h3>'.  
                   '<div class="LC_GCI_Menu_left">'.  
                   '<dl class="LC_GCI_Menu">'.  
                   '<dt><a href="'.$navlink.'">'.&mt('Concept Test Contents').'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/nav.png\');"><a class="LC_menubuttons_link" href="'.$navlink.'">'.&mt('Display the table of contents for your Concept Test.').'</a></dd>'.  
                   '<dt><a href="/adm/coursedocs">'.&mt('Assemble Concept Test').'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/docs.png\');"><a class="LC_menubuttons_link" href="/adm/coursedocs">'.&mt('If no students have attempted the Concept Test you will be able to modify it. You can also change the start and end date of the test itself.').'</a></dd>'.  
                   '<dt><a href="/adm/createuser">'.&mt('Enrollment and Student Activity').'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/cprv.png\');"><a class="LC_menubuttons_link" href="/adm/createuser">'.&mt('Display or download a course roster, and view information about completion status and last login. You can also add new students, or change access dates for existing students.').'</a></dd></dl></div>'.  
                   '<div class="LC_GCI_Menu_right"><dl class="LC_GCI_Menu">'.  
                   '<dt><a href="/adm/whatsnew">'.&mt("What's New?").'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/new.png\');"><a class="LC_menubuttons_link" href="/adm/whatsnew">'.&mt('View information about changes in your Concept Test course.').'</a></dd>'.  
                   '<dt><a href="/adm/printout">'.&mt('Prepare Printable Concept Test').'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/prnt.png\');"><a class="LC_menubuttons_link" href="/adm/printout">'.&mt('Create a PDF which you can send to a printer to create a hardcopy of the Concept Test.').'</a></dd>'.  
                   '<dt><a href="/adm/statistics">'.&mt('Concept Test Statistics').'</a></dt>'.  
                   '<dd style="background-image:url(\'/res/adm/pages/chrt.png\');"><a class="LC_menubuttons_link" href="/adm/statistics">'.&mt('After the closing date of the Concept Test you can view and download statistics for the test, as well as anonymized submission data.').'</a></dd>';  
                 if ($canreq) {  
                     $output .= '<dt><a href="javascript:switchpage('."'createtest'".');">'.&mt('Create New Test').'</a></dt>'.  
                                '<dd style="background-image:url(\'/res/adm/pages/rcrs.png\');"><a class="LC_menubuttons_link" href="javascript:switchpage('."'createtest'".');">'.  
                                &mt('Create a new Concept Test Course Container. Choose GCI questions  to include in the test and upload a student roster.').'</a></dd>';  
                 }  
                 $output .= '</dl></div></div><br clear="all"/>';  
             } else {  
                 my $navtext = &mt('Table of Contents');  
                 my $navdesc = &mt('Display Table of Contents for Geoscience Concept Inventory');  
                 if ($env{'request.role.domain'} eq 'gcitest') {  
                     $navtext = &mt('Display Test Contents');  
                     $navdesc = &mt('Display the table of contents for this Concept Test');  
                 }  
                 my $navlink;  
                 if ($env{'environment.remotenavmap'} eq 'on') {  
                     $navlink = "javascript:gonav('/adm/navmaps');"  
                 } else {  
                     $navlink = '/adm/navmaps';  
                 }  
                 $output .=   
                            '<div class="LC_Box LC_GCI_Menu">'.  
                            '<h3 class="LC_hcell">'.&mt('Utilities').'</h3>'.  
                            '<div class="LC_GCI_Menu_left">'.  
                            '<dl class="LC_GCI_Menu">'.  
                            '<dt><a href="'.$navlink.'">'.$navtext.'</dt>'.  
                            '<dd style="background-image:url(\'/res/adm/pages/nav.png\');">'.  
                            '<a class="LC_menubuttons_link" href="'.$navlink.'">'.$navdesc.'</a></dd></dl></div>';  
                 if ($canreq) {  
                     $output .= '<div class="LC_GCI_Menu_right">'.  
                                '<dl class="LC_GCI_Menu">'.  
                                '<dt><a href="javascript:switchpage('."'createtest'".');">'.$createtext.'</a></dt>'.  
                                '<dd style="background-image:url(\'/res/adm/pages/rcrs.png\');"><a class="LC_menubuttons_link" href="javascript:switchpage('."'createtest'".');">'.&mt('Create a new Concept Test Course Container').'</a>. '.&mt('Choose GCI questions to include in the test and upload a student roster.').'</dd></dl></div>';  
                 }  
                 $output .= '</div><br clear="all"/>';  
             }  
         } elsif ($switcher || $canreq) {  
             $output .= '<br /><br />'.  
                        '<div class="LC_Box LC_GCI_Menu">'.  
                        '<h3 class="LC_hcell">'.&mt('Utilities').'</h3>'.  
                        '<div class="LC_GCI_Menu_left">'.  
                        '<dl class="LC_GCI_Menu">';  
             if ($canreq) {  
                 $output .= '<dt><a href="javascript:switchpage('."'createtest'".');">'.$createtext.'</a></dt>'.  
                            '<dd style="background-image:url(\'/res/adm/pages/rcrs.png\');"><a class="LC_menubuttons_link" href="javascript:switchpage('."'createtest'".');">'.&mt('Create a new Concept Test Course Container. Choose GCI questions to include in the test and upload a student roster.').'</a></dd></dl></div>';  
                 if ($switcher) {  
                     $output .= '<div class="LC_GCI_Menu_right">'.  
                                '<dl class="LC_GCI_Menu">';  
                 }  
             }  
             if ($switcher) {  
                 $output .= '<dt>'.&mt('Select Concept Test').'</dt>'.  
                            '<dd style="background-image:url(\'/res/adm/pages/roles.png\');">'.$switcher.'<br /><br /></dd></dl></div>';  
             }  
             $output .= '</div><br clear="all"/>';  
         }  
     } elsif ($context eq 'gcinorole') {  
         my $queued =  &Apache::loncoursequeueadmin::queued_selfenrollment('notitle');  
         if ($queued) {  
             $output .=   
                        '<div class="LC_Box">'.  
                        '<h3 class="LC_hcell">'.&mt('Pending Enrollment Requests').'</h3>'.  
                        $queued.  
                        '</div>';  
         }  
     } else {  
         # calling rawconfig with "1" will evaluate mydesk.tab,   
         # even if there is no active remote control  
         &rawconfig(1);  
         $output='<table><tr>';  
         for (my $col=1; $col<=2; $col++) {  
             $output.='<td class="LC_mainmenu_col_fieldset">';  
             for (my $row=1; $row<=8; $row++) {  
                 foreach my $cat (keys(%category_members)) {  
                     if ($category_positions{$cat} ne "$col,$row") { next; }  
                     $output.='<div class="LC_Box LC_400Box">';  
             $output.='<h3 class="LC_hcell">'.&mt($category_names{$cat}).'</h3>';  
                     $output.='<table>';  
                     my %active=();  
                     foreach my $menu_item (split(/\:/,$category_members{$cat})) {  
                         if ($inlineremote[$menu_item]) {  
                             $active{$menu_item}=1;  
                         }  
                     }  
                     foreach my $item (sort(keys(%active))) {  
                         $output.=$inlineremote[$item];  
                     }  
                     $output.='</table>';  
                     $output.='</div>';  
                 }  
             }              }
             $output.="</td>";           }
         }           $output.="</td>";
         $output.="</tr></table>";  
     }      }
       $output.="</tr></table>";
     return $output;      return $output;
 }  }
   
Line 1870  END Line 1712  END
 }  }
   
 sub utilityfunctions {  sub utilityfunctions {
     my ($caller,$custommenu) = @_;      my $caller = shift;
     unless ($env{'environment.remote'} eq 'off' ||       unless ($env{'environment.remote'} eq 'off' || 
             $caller eq '/adm/menu') {               $caller eq '/adm/menu') { 
             return ''; }              return ''; }
                    
     my $gcimenujs;  
     if ($custommenu) {  
         my %concepttests = &Apache::loncommon::existing_gcitest_courses('cc');  
         my $managetesturl = '/adm/menu';  
         my $createtesturl = '/adm/requestcourse';  
         if (($env{'request.course.id'}) &&  
             ($env{'course.'.$env{'request.course.id'}.'.domain'} eq 'gci')) {  
             my @items = keys(%concepttests);  
             if (@items== 1) {  
                 my $newrole = $items[0];  
                 $newrole =~ s{_}{/};  
                 $managetesturl = '/adm/roles?selectrole=1&cc./'.$newrole.'=1';  
             } else {  
                 $managetesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';  
             }  
         }  
         if ($env{'request.course.id'}) {  
             $createtesturl = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2frequestcourse';  
         }  
         $gcimenujs = <<"ENDCUSTOM";  
   
 function switchpage(caller) {  
     if (caller == 'review') {  
         document.location.href = '/adm/roles?selectrole=1&st./gci/9615072b469884921gcil1=1';  
     }  
     if (caller == 'submit') {  
         document.location.href = '/adm/roles?selectrole=1&st./gci/1H96711d710194bfegcil1=1';  
     }  
     if (caller == 'createtest') {  
         document.location.href = '$createtesturl';  
     }  
     if (caller == 'managetest') {  
         document.location.href = '$managetesturl';  
     }  
     if (caller == 'tutorial') {  
         document.location.href = '/adm/roles?selectrole=1&st./gci/5422913620b814c90gcil1=1';  
     }  
     return;  
 }  
   
 ENDCUSTOM  
     }  
          
     my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));      my $currenturl=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0]));
     if ($currenturl =~ m{^/adm/wrapper/ext/}) {      if ($currenturl =~ m{^/adm/wrapper/ext/}) {
         if ($env{'request.external.querystring'}) {          if ($env{'request.external.querystring'}) {
Line 1965  return (<<ENDUTILITY) Line 1764  return (<<ENDUTILITY)
 $nav_control  $nav_control
 $dc_popup_cid  $dc_popup_cid
   
 $gcimenujs  
   
 function go(url) {  function go(url) {
    if (url!='' && url!= null) {     if (url!='' && url!= null) {
        currentURL = null;         currentURL = null;
Line 2157  sub hidden_button_check { Line 1954  sub hidden_button_check {
         return;          return;
     }      }
     if ($env{'request.role.adv'}) {      if ($env{'request.role.adv'}) {
         unless (&Apache::loncommon::needs_gci_custom()) {          return;
             return;  
         }  
     }      }
     my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');      my $buttonshide = &Apache::lonnet::EXT('resource.0.buttonshide');
     return $buttonshide;       return $buttonshide; 

Removed from v.1.309.2.19  
changed lines
  Added in v.1.314


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>