Diff for /loncom/interface/lonmenu.pm between versions 1.298 and 1.309.2.14

version 1.298, 2009/10/30 00:19:49 version 1.309.2.14, 2010/08/09 23:39:43
Line 131  use Apache::lonhtmlcommon(); Line 131  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 150  sub prep_menuitem { Line 151  sub prep_menuitem {
     } else {             # textual Link      } else {             # textual Link
         $link = &mt($$menuitem[3]);          $link = &mt($$menuitem[3]);
     }      }
     return '<li><a href="'.$$menuitem[0].'" target="_top">'.$link.'</a></li>';      return '<li><a href="'.$$menuitem[0].'">'.$link.'</a></li>';
 }  }
   
 # primary_menu() evaluates @primary_menu and returns XHTML for the menu  # primary_menu() evaluates @primary_menu and returns XHTML for the menu
Line 160  sub prep_menuitem { Line 161  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();
     # 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)
     foreach my $menuitem (@primary_menu) {      foreach my $menuitem (@primary_menu) {
Line 175  sub primary_menu { Line 177  sub primary_menu {
         next if    $$menuitem[4]        eq 'onlypublic'# hide links which are           next if    $$menuitem[4]        eq 'onlypublic'# hide links which are 
                 && $env{'user.name'}    ne 'public'    # only visible to public                  && $env{'user.name'}    ne 'public'    # only visible to public
                 && $env{'user.domain'}  ne 'public';   # users                  && $env{'user.domain'}  ne 'public';   # users
           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 230  sub secondary_menu { Line 236  sub secondary_menu {
         next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/           next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/ 
                 && $crstype ne 'Community';                  && $crstype ne 'Community';
         next if    $$menuitem[4]   =~ /showgroups$/          next if    $$menuitem[4]   =~ /showgroups$/
                 && $canviewgrps                  && !$canviewgrps
                 && !%groups;                  && !%groups;
   
         if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {          if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
Line 277  sub secondary_menu { Line 283  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',
       );
       my %linktext = (
           'review'      => 'Review Questions',
           'submit'      => 'Submit Questions',
           'managetest'  => 'Manage Tests',
       );
       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}) {
               $links{$key} = '/adm/navmaps';
               $current = $key;
               $links{'managetest'} = '/adm/roles?selectrole=1&cm=1&orgurl=%2fadm%2fmenu';
           }
       }
       my @menutabs = ('review','submit','managetest');
       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 512  sub registerurl { Line 557  sub registerurl {
 }  }
   
 sub innerregister {  sub innerregister {
     my ($forcereg, $titletable) = @_;      my ($forcereg,$titletable,$bread_crumbs) = @_;
     my $result = '';      my $result = '';
     my ($uname,$thisdisfn);      my ($uname,$thisdisfn);
     my $const_space = ($env{'request.state'} eq 'construct');      my $const_space = ($env{'request.state'} eq 'construct');
Line 545  sub innerregister { Line 590  sub innerregister {
   
         my $maptitle = &Apache::lonnet::gettitle($mapurl);          my $maptitle = &Apache::lonnet::gettitle($mapurl);
         my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());          my $restitle = &Apache::lonnet::gettitle(&Apache::lonnet::symbread());
         my @crumbs = ({text  => "Course Contents",           my $contentstext;
           if ($env{'course.'.$env{'request.course.id'}.'.type'} eq 'Community') {
               $contentstext = &mt('Community Contents');
           } else {
               $contentstext = &mt('Course Contents');
           }
           my @crumbs = ({text  => $contentstext, 
                        href  => "Javascript:gonav('/adm/navmaps')"});                         href  => "Javascript:gonav('/adm/navmaps')"});
   
         if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) {           if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { 
Line 561  sub innerregister { Line 612  sub innerregister {
   
         &Apache::lonhtmlcommon::clear_breadcrumbs();          &Apache::lonhtmlcommon::clear_breadcrumbs();
         &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);          &Apache::lonhtmlcommon::add_breadcrumb(@crumbs);
         $breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);          #$breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
  unless (($env{'request.state'} eq 'edit') || ($newmail) ||   unless (($env{'request.state'} eq 'edit') || ($newmail) ||
  ($env{'request.state'} eq 'construct') ||   ($env{'request.state'} eq 'construct') ||
  ($env{'form.register'})) {   ($env{'form.register'})) {
Line 683  sub innerregister { Line 734  sub innerregister {
             }              }
             # Finally, turn the button on or off              # Finally, turn the button on or off
             if ($cfile && !$const_space) {              if ($cfile && !$const_space) {
                 $editbutton=&switch                  my $nocrsedit;
                     ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',                  # Suppress display where CC has switched to student role.
                   if ($env{'request.course.id'}) {
                       unless(&Apache::lonnet::allowed('mdc',
                                                       $env{'request.course.id'})) {
                           $nocrsedit = 1;
                       }
                   }
                   if ($nocrsedit) {
                       $editbutton=&clear(6,1);
                   } else {
                       $editbutton=&switch
                          ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");                       "go('".$cfile."');","Edit this resource");
                 $noeditbutton = 0;                      $noeditbutton = 0;
                   }
             } elsif ($editbutton eq '') {              } elsif ($editbutton eq '') {
                 $editbutton=&clear(6,1);                  $editbutton=&clear(6,1);
             }              }
Line 735  s&7&1&del.gif&delete[_1]&resource[_2]&go Line 798  s&7&1&del.gif&delete[_1]&resource[_2]&go
 s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document  s&7&2&prt.gif&prepare[_1]&printout[_1]&gocstr('/adm/printout','/~$uname/$cleandisfn')&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
             }              }
               if ($noremote) {
                   if (ref($bread_crumbs) eq 'ARRAY') {
                       &Apache::lonhtmlcommon::clear_breadcrumbs();
                       foreach my $crumb (@{$bread_crumbs}){
                           &Apache::lonhtmlcommon::add_breadcrumb($crumb);
                       }
                   }
               }
         } elsif ( defined($env{'request.course.id'}) &&           } elsif ( defined($env{'request.course.id'}) && 
  $env{'request.symb'} ne '' ) {   $env{'request.symb'} ne '' ) {
 #  #
Line 811  ENDMENUITEMS Line 882  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) {
             # Registered, textual output  
                     if ($env{'environment.icons'} eq 'iconsonly') {          #SD START (work in progress!)
                         $inlinebuttons=(<<ENDARROWSINLINE);          Apache::lonhtmlcommon::clear_breadcrumb_tools();
 <tr><td>          # Arrows for navigation
 $inlineremote[21] $inlineremote[23]          Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[21] );
 ENDARROWSINLINE          Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[23] );
                         if (&hidden_button_check() ne 'yes') {          if(hidden_button_check() ne 'yes'){
                             $inlinebuttons .= (<<ENDINLINEICONS);              # notes
 $inlineremote[61] $inlineremote[63]              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[93]);
 $inlineremote[71] $inlineremote[72] $inlineremote[73]              # bookmark
 $inlineremote[81] $inlineremote[82] $inlineremote[83]              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[91]);
 $inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>              # evaluate
 ENDINLINEICONS              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[81]);
                         }              # feedback
                     } else {              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[82]);
  if ($inlineremote[21] ne '' || $inlineremote[23] ne '') {              # print
     $inlinebuttons=(<<ENDFIRSTLINE);              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[83]);
 <tr><td>$inlineremote[21]</td><td>&nbsp;</td><td>$inlineremote[23]</td></tr>              # metadata
 ENDFIRSTLINE              Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[63]);
                         }  
                         if (&hidden_button_check() ne 'yes') {               # ?
     foreach my $row (6..9) {              Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[61]);
  if ($inlineremote[${row}.'1'] ne ''              # ?
     || $inlineremote[$row.'2'] ne ''              Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[71]);
     || $inlineremote[$row.'3'] ne '') {              # ?
     $inlinebuttons .= <<"ENDLINE";              Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[72]);
 <tr><td>$inlineremote["${row}1"]</td><td>$inlineremote["${row}2"]</td><td>$inlineremote["${row}3"]</td></tr>              # ?
 ENDLINE              Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[73]);
  }              # ?
     }              Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[92]);
  }  
     }          }
     }  
           #SD END
   #       # Registered, textual output
   #        if ( $env{'environment.icons'} eq 'iconsonly' ) {
   #            $inlinebuttons = (<<ENDARROWSINLINE);
   #<tr><td>
   #$inlineremote[21] $inlineremote[23]
   #ENDARROWSINLINE
   #            if ( &hidden_button_check() ne 'yes' ) {
   #                $inlinebuttons .= (<<ENDINLINEICONS);
   #$inlineremote[61] $inlineremote[63]
   #$inlineremote[71] $inlineremote[72] $inlineremote[73]
   #$inlineremote[81] $inlineremote[82] $inlineremote[83]
   #$inlineremote[91] $inlineremote[92] $inlineremote[93]</td></tr>
   #ENDINLINEICONS
   #            }
   #        } else { # not iconsonly
   #            if ( $inlineremote[21] ne '' || $inlineremote[23] ne '' ) {
   #                $inlinebuttons = (<<ENDFIRSTLINE);
   #<tr><td>$inlineremote[21]</td><td>&nbsp;</td><td>$inlineremote[23]</td></tr>
   #ENDFIRSTLINE
   #            }
   #            if ( &hidden_button_check() ne 'yes' ) {
   #                foreach my $row ( 6 .. 9 ) {
   #                    if (   $inlineremote[ ${row} . '1' ] ne ''
   #                        || $inlineremote[ $row . '2' ] ne ''
   #                        || $inlineremote[ $row . '3' ] ne '' )
   #                    {
   #                        $inlinebuttons .= <<"ENDLINE";
   #<tr><td>$inlineremote["${row}1"]</td><td>$inlineremote["${row}2"]</td><td>$inlineremote["${row}3"]</td></tr>
   #ENDLINE
   #                    }
   #                }
   #            }
   #        }
       }
           #SD see below
           $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0);
     $result =(<<ENDREGTEXT);      $result =(<<ENDREGTEXT);
 <script type="text/javascript">  <script type="text/javascript">
 // BEGIN LON-CAPA Internal  // BEGIN LON-CAPA Internal
 </script>  </script>
 $timesync  $timesync
 $breadcrumb  $breadcrumb
 $tablestart  <!-- $tablestart -->
 $inlinebuttons  <!-- $inlinebuttons -->
 $tableend  <!-- $tableend -->
 $newmail  $newmail
 $separator  <!-- $separator -->
 <script type="text/javascript">  <script type="text/javascript">
 // END LON-CAPA Internal  // END LON-CAPA Internal
 </script>  </script>
Line 1213  sub switch { Line 1321  sub switch {
        my $pic=         my $pic=
    '<img alt="'.$text.'" src="'.     '<img alt="'.$text.'" src="'.
    &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).     &Apache::loncommon::lonhttpdurl('/res/adm/pages/'.$img).
    '" align="'.($nobreak==3?'right':'left').'" class="LC_noBorder" />';     '" align="'.($nobreak==3?'right':'left').'" class="LC_icon" />';
        if ($env{'browser.interface'} eq 'faketextual') {         if ($env{'browser.interface'} eq 'faketextual') {
 # Main Menu  # Main Menu
    if ($nobreak==3) {     if ($nobreak==3) {
Line 1239  sub switch { Line 1347  sub switch {
               $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';                $inlineremote[$idx]='<a title="'.$desc.'" href="javascript:'.$act.';">'.$pic.'</a>';
            } else {             } else {
       $inlineremote[$idx]=        $inlineremote[$idx]=
    '<a class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.     '<a title="'.$desc.'" class="LC_menubuttons_link" href="javascript:'.$act.';">'.$pic.
    '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';     '<span class="LC_menubuttons_inline_text">'.$desc.'</span></a>';
            }             }
        }         }
Line 1269  sub openmenu { Line 1377  sub openmenu {
 }  }
   
 sub inlinemenu {  sub inlinemenu {
       my ($context,$switcher) = @_;
     undef(@inlineremote);      undef(@inlineremote);
     undef(%category_members);      undef(%category_members);
 # calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control      my $output;
     &rawconfig(1);      if (($context eq 'gcicustom') || ($context eq 'gcistudent') ||
     my $output='<table id="LC_mainmenu"><tr>';          ($context eq 'gcinorole')) {
     for (my $col=1; $col<=2; $col++) {          $output='<table><tr>'.
         $output.='<td class="LC_mainmenu_col_fieldset">';                  '<td class="LC_mainmenu_col_fieldset">'.
         for (my $row=1; $row<=8; $row++) {                  '<div class="LC_Box LC_400Box">'.
             foreach my $cat (keys(%category_members)) {                  '<h3 class="LC_hcell">'.&mt('Utilities').'</h3>'.
                if ($category_positions{$cat} ne "$col,$row") { next; }                  '<table>';
                #$output.='<table><tr><td colspan="4" class="LC_menubuttons_category">'.&mt($category_names{$cat}).'</td></tr>';          if ($context eq 'gcicustom') {
                $output.='<div class="LC_Box">';              my $createtext = &mt('Create Concept Test');
        $output.='<h4 class="LC_hcell">'.&mt($category_names{$cat}).'</h4>';              if ($switcher) {
                $output.='<table>';                  $createtext = &mt('Create New Test');
                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 .= '<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>';
          $output.="</td>";          }
           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>'.
   '<tr><td align="left"><a href="javascript:go('."'/adm/preferences'".');"><img alt="user preferences" src="/res/adm/pages/pref.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/preferences'".');"><span class="LC_menubuttons_inline_text">'.&mt('Set my user preferences').'</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('Enrollment and Student Activity').'</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>'.
                            '<tr><td align="left"><a href="javascript:go('."'/adm/printout'".');"><img alt="print concept test" src="/res/adm/pages/prnt.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/printout'".');"><span class="LC_menubuttons_inline_text">'.&mt("Prepare Printable Concept Test").'</span></a></td></tr>'.
                            '<tr><td align="left"><a href="javascript:go('."'/adm/statistics'".');"><img alt="Test Statistics" src="/res/adm/pages/chrt.png" align="left" class="LC_icon" /></a></td><td class="LC_menubuttons_text" colspan="3"><a class="LC_menubuttons_link" href="javascript:go('."'/adm/statistics'".');"><span class="LC_menubuttons_inline_text">'.&mt("Concept Test Statistics").'</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>';
               }
           } else {
               $output.='</td></tr></table></div></td>';
           }
           if ($context eq 'gcinorole') {
               my $queued =  &Apache::loncoursequeueadmin::queued_selfenrollment('notitle');
               if ($queued) {
                   $output .= '<td class="LC_mainmenu_col_fieldset">'.
                              '<div class="LC_Box LC_400Box">'.
                              '<h3 class="LC_hcell">'.&mt('Pending Enrollment Requests').'</h3>'.
                              $queued.
                              '</td></tr></table></div></td>';
               }
           }
           $output.='</tr></table>';
       } 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.="</tr></table>";
     }      }
     $output.="</tr></table>";  
     return $output;      return $output;
 }  }
   
Line 1398  sub rawconfig { Line 1562  sub rawconfig {
             }              }
         } elsif ($pro =~ /^courseenv_(.*)$/) {          } elsif ($pro =~ /^courseenv_(.*)$/) {
             my $key = $1;              my $key = $1;
             if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&               if ($crstype ne 'Community') {
                 ($crstype ne 'Community')) {                  my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);                  if ($key eq 'canuse_pdfforms') {
                       if ($env{'request.course.id'} && $coursepref eq '') {
                           my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
                           $coursepref = $domdefs{'canuse_pdfforms'};
                       }
                   }
                   if ($coursepref) { 
                       $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
                   }
             }              }
         } elsif ($pro =~ /^communityenv_(.*)$/) {          } elsif ($pro =~ /^communityenv_(.*)$/) {
             my $key = $1;              my $key = $1;
             if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) &&               if ($crstype eq 'Community') {
                 ($crstype eq 'Community')) {                  my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key};
                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);                  if ($key eq 'canuse_pdfforms') {
                       if ($env{'request.course.id'} && $coursepref eq '') {
                           my %domdefs = &Apache::lonnet::get_domain_defaults($env{'course.'.$env{'request.course.id'}.'.domain'});
                           $coursepref = $domdefs{'canuse_pdfforms'};
                       }
                   }
                   if ($coursepref) { 
                       $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
                   }
             }              }
         } elsif ($pro =~ /^course_(.*)$/) {          } elsif ($pro =~ /^course_(.*)$/) {
             # Check for permissions inside of a course              # Check for permissions inside of a course
Line 1551  function gonav(url) { Line 1731  function gonav(url) {
 NAVCONTROL  NAVCONTROL
 }  }
   
   sub dc_popup_js {
       my %lt = &Apache::lonlocal::texthash(
                                             more => '(More ...)',
                                             less => '(Less ...)',
                                           );
       return <<"END";
   
   function showCourseID() {
       document.getElementById('dccid').style.display='block';
       document.getElementById('dccid').style.textAlign='left';
       document.getElementById('dccid').style.textFace='normal';
       document.getElementById('dccidtext').innerHTML ='<a href="javascript:hideCourseID();">$lt{'less'}</a>';
       return;
   }
   
   function hideCourseID() {
       document.getElementById('dccid').style.display='none';
       document.getElementById('dccidtext').innerHTML ='<a href="javascript:showCourseID()">$lt{'more'}</a>';
       return;
   }
   
   END
   
   }
   
 sub utilityfunctions {  sub utilityfunctions {
     my $caller = shift;      my ($caller,$custommenu) = @_;
     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';
       }
       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 1568  sub utilityfunctions { Line 1813  sub utilityfunctions {
     my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});      my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'});
     my $nav_control=&nav_control_js();      my $nav_control=&nav_control_js();
   
       my $dc_popup_cid;
       if ($env{'user.adv'} && exists($env{'user.role.dc./'.
                           $env{'course.'.$env{'request.course.id'}.
                                    '.domain'}.'/'})) {
           $dc_popup_cid = &dc_popup_js();
       }
   
     my $start_page_annotate =       my $start_page_annotate = 
         &Apache::loncommon::start_page('Annotator',undef,          &Apache::loncommon::start_page('Annotator',undef,
        {'only_body' => 1,         {'only_body' => 1,
Line 1595  return (<<ENDUTILITY) Line 1847  return (<<ENDUTILITY)
     var currentSymb="$currentsymb";      var currentSymb="$currentsymb";
   
 $nav_control  $nav_control
   $dc_popup_cid
   
   $gcimenujs
   
 function go(url) {  function go(url) {
    if (url!='' && url!= null) {     if (url!='' && url!= null) {
Line 1786  sub hidden_button_check { Line 2041  sub hidden_button_check {
         return;          return;
     }      }
     if ($env{'request.role.adv'}) {      if ($env{'request.role.adv'}) {
         return;          unless (&Apache::loncommon::needs_gci_custom()) {
               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.298  
changed lines
  Added in v.1.309.2.14


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