Diff for /loncom/interface/lonmenu.pm between versions 1.309.2.23 and 1.315.2.1

version 1.309.2.23, 2010/12/05 19:44:36 version 1.315.2.1, 2010/05/26 19:50:46
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()
   
 =item initlittle()  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 menubuttons()  =item secondary_menu()
   
 This gets called at the top of the body section  Same as primary_menu() but operates on @secondary_menu.
   
 =item show_return_link()  =item show_return_link()
   
Line 131  use Apache::lonhtmlcommon(); Line 186  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 151  sub prep_menuitem { Line 205  sub prep_menuitem {
     } else {             # textual Link      } else {             # textual Link
         $link = &mt($$menuitem[3]);          $link = &mt($$menuitem[3]);
     }      }
     return '<li><a'       if($$menuitem[4] eq 'newmsg'){   #special style for New Messages
            # highlighting for new messages          return '<li><a href="'.$$menuitem[0].'"><span class="LC_new_message">'.$link.'</span></a></li>';
            . ( $$menuitem[4] eq 'newmsg' ? ' class="LC_new_message"' : '')       }
            . qq| 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 164  sub prep_menuitem { Line 218  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();  
     my %allnums = &Apache::loncommon::get_faculty_cnums();  
     # 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,$faculty);      my $public;
     if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))      if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public'))
         || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {          || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) {
         $public = 1;          $public = 1;
     } elsif (ref($allnums{$env{'user.domain'}}) eq 'HASH') {  
         $faculty = 1;  
     }      }
     foreach my $menuitem (@primary_menu) {      foreach my $menuitem (@primary_menu) {
         # evaluate conditions           # evaluate conditions 
Line 183  sub primary_menu { Line 232  sub primary_menu {
                 && &Apache::lonmsg::mynewmail();       # whether a new msg                   && &Apache::lonmsg::mynewmail();       # whether a new msg 
         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                   && $public;                            ##who should not see all
                                                        ##links                                                         ##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                  && !$public;                           # only visible to public
                                                        # users                                                         # users
         next if    $$menuitem[4]        eq 'ci'  
                 && (!$custommenu || $env{'request.role'} =~ m{^st\./\w+citest/});  
         next if    $$menuitem[4]        eq 'home'  
                 && (($custommenu) || ($env{'user.domain'} =~ /^\w+citest$/) ||   
                     ($faculty && !$numdc));  
         next if    $$menuitem[4]        eq 'citest'  
                 && ($faculty || ($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
                 && !&Apache::loncommon::show_course(); ##                  && !&Apache::loncommon::show_course(); ##
           
               
         if ($$menuitem[3] eq 'Help') { # special treatment for helplink          if ($$menuitem[3] eq 'Help') { # special treatment for helplink
             if ($public) {              $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
                 my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};  
                 my $defdom = &Apache::lonnet::default_login_domain();  
                 my $to = &Apache::loncommon::build_recipient_list(undef,  
                                                                   'helpdeskmail',  
                                                                   $defdom,$origmail);  
                 if ($to ne '') {  
                     $menu .= &prep_menuitem($menuitem);  
                 }  
             } else {  
                 $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';  
             }  
         } else {          } else {
             $menu .= &prep_menuitem($menuitem);              my @items = @{$menuitem};
               $items[0] = 'javascript:'.$menuitem->[0].';';
               $menu .= &prep_menuitem(\@items);
         }          }
     }      }
   
Line 241  sub secondary_menu { Line 270  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 272  sub secondary_menu { Line 295  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 318  sub secondary_menu { Line 340  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;  
     my $inventory;  
     if ($env{'user.domain'} =~ /^(\w+ci)test$/) {  
         $inventory = $1;  
     } else {  
         $inventory = $env{'user.domain'};  
     }  
     my %allnums = &Apache::loncommon::get_faculty_cnums();  
     if (($inventory ne '') && (ref($allnums{$inventory}) eq 'HASH')) {  
         foreach my $key (%{$allnums{$inventory}}) {  
             $courses{$inventory.'_'.$key} = $allnums{$inventory}->{$key};  
         }  
     }  
   
     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/ci_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  
 # Probably should be in mydesk.tab  
   
 #SD this sub is deprecated - don't use it  
 sub initlittle {  
     return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',  
        'nav' => 'Course Contents',  
        'main' => 'Main Menu',  
                                        'roles' => (&Apache::loncommon::show_course()?  
                                                     'Courses':'Roles'),  
                                        'other' => 'Other Roles',  
                                        'docs' => 'Edit Course',  
                                        'exit' => 'Logout',  
                                        'login' => 'Log In',  
        'launch' => 'Launch Remote Control',  
                                        'groups' => 'Groups',  
                                        'gdoc' => 'Community Documents',  
                                        );  
 }  
   
 #SD this sub is deprecated - don't use it  
 #SD functionality is covered by new loncommon::bodytag and primary_menu(), secondary_menu()  
 sub menubuttons {  
     my $forcereg=shift;  
     my $titletable=shift;  
 #  
 # Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes"  
 #  
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'},  
     ['inhibitmenu']);  
     if (($env{'form.inhibitmenu'} eq 'yes') ||  
         ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }  
   
     if ($env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }  
   
     my %lt=&initlittle();  
     my $navmaps='';  
     my $reloadlink='';  
     my $docs='';  
     my $groups='';  
     my $roles='<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';  
     my $role_selector;  
     my $showgroups=0;  
     my ($cnum,$cdom);  
 #  
 # if the URL is hidden, symbs and the non-versioned version of the URL would be encrypted  
 #  
     my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));  
     my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));  
   
     my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");  
     $logo = '<a href="/adm/about.html"><img src="'.  
  $logo.'" alt="LON-CAPA Logo" class="LC_noBorder" /></a>';  
   
     if ($env{'request.state'} eq 'construct') {  
 #  
 # We are in construction space  
 #  
         if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {  
             my $returnurl = $env{'request.filename'};  
             $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:;  
             $escurl = &escape($returnurl);  
         }  
     }  
     if ($env{'request.course.id'}) {  
 #  
 # We are in a course  
 #  
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};  
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};  
         my %coursegroups;  
         my $viewgrps_permission =  
     &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));  
         if (!$viewgrps_permission) {  
             %coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$cdom,$cnum);  
  }  
         if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {  
             $showgroups = 1;  
         }  
         $role_selector = &roles_selector($cdom,$cnum);  
         if ($role_selector) {  
             $roles = '<span class="LC_nobreak">'.$role_selector.'&nbsp;&nbsp;<a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></span>';  
         }  
     }  
   
     if ($env{'environment.remote'} eq 'off') {  
 # Remote Control is switched off  
 # figure out colors  
         my %lt=&initlittle();  
   
         my $domain=&Apache::loncommon::determinedomain();  
         my $function=&Apache::loncommon::get_users_function();  
         my $link=&Apache::loncommon::designparm($function.'.link',$domain);  
         my $alink=&Apache::loncommon::designparm($function.'.alink',$domain);  
         my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);  
         my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);  
   
         if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {  
             return (<<ENDINLINEMENU);  
             <ol class="LC_primary_menu LC_right">  
                 <li>$logo</li>  
                 <li><a href="/adm/roles" target="_top">$lt{'login'}</a></li>  
             </ol>  
             <hr />  
 ENDINLINEMENU  
         }  
         $roles = '<a href="/adm/roles" target="_top">'.$lt{'roles'}.'</a>';  
 # Do we have a NAV link?  
         if ($env{'request.course.id'}) {  
     my $link='/adm/navmaps?postdata='.$escurl.'&amp;postsymb='.  
  $escsymb;  
     if ($env{'environment.remotenavmap'} eq 'on') {  
  $link="javascript:gonav('".$link."')";  
     }  
     $navmaps=(<<ENDNAV);  
 <li><a href="$link" target="_top">$lt{'nav'}</a></li>  
 ENDNAV  
             my $is_community =   
                 (&Apache::loncommon::course_type() eq 'Community');  
     if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {  
                 my $text = ($is_community) ? $lt{'gdoc'} : $lt{'docs'};  
  $docs=(<<ENDDOCS);  
 <li><a href="/adm/coursedocs" target="_top">$text</a></li>  
 ENDDOCS  
             }  
             if ($showgroups) {  
                 $groups =(<<ENDGROUPS);  
 <li><a href="/adm/coursegroups" target="_top">$lt{'groups'}</a></li>  
 ENDGROUPS  
             }  
     if (&show_return_link()) {  
                 my $escreload=&escape('return:');  
                 $reloadlink=(<<ENDRELOAD);  
 <li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>  
 ENDRELOAD  
             }  
             if ($role_selector) {  
             #$roles = '<td>'.$role_selector.'</td><td><a href="/adm/roles" target="_top">'.$lt{'other'}.'</a></td>';  
  $role_selector = '<li>'.$role_selector.'</li>';  
             }  
         }  
  if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {  
     my $escreload=&escape('return:');  
     $reloadlink=(<<ENDCRELOAD);  
 <li><a href="/adm/flip?postdata=$escreload" target="_top">$lt{'ret'}</a></li>  
 ENDCRELOAD  
         }  
     my $reg     = $forcereg ? &innerregister($forcereg,$titletable) : '';  
     my $form    = &serverform();  
     my $utility = &utilityfunctions();  
   
     #Prepare the message link that indicates the arrival of new mail  
     my $messagelink = &Apache::lonmsg::mynewmail() ? "Message (new)" : "Message";  
        $messagelink = '<a href="javascript:go(\'/adm/communicate\');">'  
                       . mt($messagelink) .'</a>';  
   
     my $helplink = &Apache::loncommon::top_nav_help('Help');  
  return (<<ENDINLINEMENU);  
 <script type="text/javascript">  
 // <![CDATA[  
 // BEGIN LON-CAPA Internal  
 $utility  
 // ]]>  
 </script>  
 <ol class="LC_primary_menu LC_right">  
  <li>$logo</li>  
  <li>$messagelink</li>  
  <li>$roles</li>  
  <li>$helplink</li>  
  <li><a href="/adm/logout" target="_top">$lt{'exit'}</a></li>  
 </ol>  
 <ul id="LC_secondary_menu">  
 <li><a href="/adm/menu" target="_top">$lt{'main'}</a></li>  
 $reloadlink  
 $navmaps  
 $docs  
 $groups  
 $role_selector  
 </ul>  
 $form  
 <script type="text/javascript">  
 // END LON-CAPA Internal  
 </script>  
 $reg  
 ENDINLINEMENU  
     } else {  
  return '';  
     }  
 }  
   
 sub show_return_link {  sub show_return_link {
     return unless ($env{'request.course.id'});  
     if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})      if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
         || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {          || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
   
         return if ($env{'form.register'});          return if ($env{'form.register'});
     }      }
     return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&      return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
Line 654  sub innerregister { Line 430  sub innerregister {
         my @crumbs;          my @crumbs;
         unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')          unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps')
                 && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {                  && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) {
             my $link = "javascript:gopost('/adm/navmaps','')";              @crumbs = ({text  => $contentstext,
             if ($env{'environment.remotenavmap'} eq 'on') {                          href  => "Javascript:gopost('/adm/navmaps','')"});
                 $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  => '...',
Line 905  $menuitems.="Make notes and annotations Line 676  $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|viewclasslist|portfolio)(\?|$)/) {
  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 945  ENDMENUITEMS Line 716  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 1005  ENDMENUITEMS Line 776  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 1431  sub openmenu { Line 1201  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'} !~ /^\w+citest$/) {  
             $canreq =  
                 &Apache::lonnet::check_can_request($env{'user.domain'}.'test',\%can_request,\%request_domains);  
             $createtext = &mt('Create Concept Test');  
             if ($numcourses) {  
                 $createtext = &mt('Create New Test');  
             }              }
         }           }
         if ($env{'request.course.id'}) {           $output.="</td>";
             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'} =~ /^\w+citest$/) {  
                     $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.="</tr></table>";  
     }      }
       $output.="</tr></table>";
     return $output;      return $output;
 }  }
   
Line 1891  END Line 1525  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'} !~ /^\w+citest$/)) {  
             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';  
         }  
         my %allnums = &Apache::loncommon::get_faculty_cnums();  
         my $udom = $env{'user.domain'};  
         my %crs_by_caller;  
         if (ref($allnums{$udom}) eq 'HASH') {  
             foreach my $key (keys(%{$allnums{$udom}})) {  
                 $crs_by_caller{$allnums{$udom}->{$key}} = 'st./'.$udom.'/'.$key.'=1';  
             }  
         }  
         $gcimenujs = <<"ENDCUSTOM";  
   
 function switchpage(caller) {  
     if (caller == 'review') {  
         document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'review'};  
     }  
     if (caller == 'submit') {  
         document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'submit'};  
     }  
     if (caller == 'createtest') {  
         document.location.href = '$createtesturl';  
     }  
     if (caller == 'managetest') {  
         document.location.href = '$managetesturl';  
     }  
     if (caller == 'tutorial') {  
         document.location.href = '/adm/roles?selectrole=1&'.$crs_by_caller{'tutorial'};  
     }  
     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 1994  return (<<ENDUTILITY) Line 1577  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 2004  function go(url) { Line 1585  function go(url) {
    }     }
 }  }
   
   function gotop(url) {
       if (url!='' && url!= null) {
           top.location.href = url;
       }
   }
   
 function gopost(url,postdata) {  function gopost(url,postdata) {
    if (url!='') {     if (url!='') {
       this.document.server.action=url;        this.document.server.action=url;
Line 2093  function edit_bookmarks() { Line 1680  function edit_bookmarks() {
    go('');     go('');
    w_BookmarkPal_flag=1;     w_BookmarkPal_flag=1;
    bookmarkpal=window.open("/adm/bookmarks",     bookmarkpal=window.open("/adm/bookmarks",
                "BookmarkPal", "width=400,height=505,scrollbars=0");                 "BookmarkPal", "width=500,height=505,scrollbars=0");
 }  }
   
 function annotate() {  function annotate() {
Line 2180  sub hidden_button_check { Line 1767  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.23  
changed lines
  Added in v.1.315.2.1


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