--- loncom/interface/lonmenu.pm 2010/01/15 04:12:54 1.309.2.12 +++ loncom/interface/lonmenu.pm 2010/02/10 08:24:31 1.313 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.309.2.12 2010/01/15 04:12:54 raeburn Exp $ +# $Id: lonmenu.pm,v 1.313 2010/02/10 08:24:31 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -131,7 +131,6 @@ use Apache::lonhtmlcommon(); use Apache::loncommon(); use Apache::lonenc(); use Apache::lonlocal; -use Apache::loncoursequeueadmin; use LONCAPA qw(:DEFAULT :match); use HTML::Entities(); @@ -151,6 +150,9 @@ sub prep_menuitem { } else { # textual Link $link = &mt($$menuitem[3]); } + if($$menuitem[4] eq 'newmsg'){ #special style for New Messages + return '
  • '.$link.'
  • '; + } return '
  • '.$link.'
  • '; } @@ -161,7 +163,6 @@ sub prep_menuitem { # entries from mydesk.tab sub primary_menu { my $menu; - my $custommenu = &Apache::loncommon::needs_gci_custom(); # each element of @primary contains following array: # (link url, icon path, alt text, link text, condition) foreach my $menuitem (@primary_menu) { @@ -177,10 +178,6 @@ sub primary_menu { next if $$menuitem[4] eq 'onlypublic'# hide links which are && $env{'user.name'} ne 'public' # only visible to public && $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 && &Apache::loncommon::show_course(); ##term 'Courses' or next if $$menuitem[4] eq 'courses' ##'Roles' wanted @@ -283,45 +280,6 @@ sub secondary_menu { return ""; } -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 .= '
  • '. - $linktext{$item}.'
  • '; - } else { - $tabs .= '
  • '. - $linktext{$item}.'
  • '; - } - } - return '
    '. - '

    '; -} # # This routine returns a translated hash for the menu items in the top inline menu row @@ -335,7 +293,7 @@ sub initlittle { 'roles' => (&Apache::loncommon::show_course()? 'Courses':'Roles'), 'other' => 'Other Roles', - 'docs' => 'Edit Course', + 'docs' => 'Course Editor', 'exit' => 'Logout', 'login' => 'Log In', 'launch' => 'Launch Remote Control', @@ -884,39 +842,29 @@ ENDMENUITEMS my $inlinebuttons=''; if ($addremote) { - #SD START (work in progress!) Apache::lonhtmlcommon::clear_breadcrumb_tools(); - # Arrows for navigation - Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[21] ); - Apache::lonhtmlcommon::add_breadcrumb_tool( 'A', $inlineremote[23] ); - if(hidden_button_check() ne 'yes'){ - # notes - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[93]); - # bookmark - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[91]); - # evaluate - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[81]); - # feedback - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[82]); - # print - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[83]); - # metadata - Apache::lonhtmlcommon::add_breadcrumb_tool( 'B', $inlineremote[63]); - - # ? - Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[61]); - # ? - Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[71]); - # ? - Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[72]); - # ? - Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[73]); - # ? - Apache::lonhtmlcommon::add_breadcrumb_tool( 'C', $inlineremote[92]); + Apache::lonhtmlcommon::add_breadcrumb_tool( + 'navigation', @inlineremote[21,23]); + + if(hidden_button_check() ne 'yes') { + Apache::lonhtmlcommon::add_breadcrumb_tool( + 'tools', @inlineremote[93,91,81,82,83]); + + #publish button in construction space + if ($env{'request.state'} eq 'construct'){ + Apache::lonhtmlcommon::add_breadcrumb_tool( + 'advtools', @inlineremote[63]); + }else{ + Apache::lonhtmlcommon::add_breadcrumb_tool( + 'tools', @inlineremote[63]); + } + + + Apache::lonhtmlcommon::add_breadcrumb_tool( + 'advtools', @inlineremote[61,71,72,73,92]); } - #SD END # # Registered, textual output # if ( $env{'environment.icons'} eq 'iconsonly' ) { # $inlinebuttons = (< @@ -1377,91 +1324,36 @@ sub openmenu { } sub inlinemenu { - my ($context,$switcher) = @_; undef(@inlineremote); undef(%category_members); - my $output; - if (($context eq 'gcicustom') || ($context eq 'gcistudent') || - ($context eq 'gcinorole')) { - $output=''. - ''. - ''; - } else { - my $navtext = &mt('Table of Contents'); - if ($env{'request.role.domain'} eq 'gcitest') { - $navtext = &mt('Display Test Contents'); - } - $output .= '
    '. - '
    '. - '

    '.&mt('Utilities').'

    '. - ''; - if ($context eq 'gcicustom') { - my $createtext = &mt('Create Concept Test'); - if ($switcher) { - $createtext = &mt('Create New Test'); - } - $output .= ''; - } - if ($switcher) { - $output .= ''; - } - $output .= ''. -''; - if ($env{'request.course.id'}) { - if (($context eq 'gcicustom') && (&Apache::lonnet::allowed('mdc',$env{'request.course.id'}))) { - $output.= '
    choose role'.$createtext.'
    choose role'.$switcher.'
    communication'.&mt('Send/Display Messages').'
    user preferences'.&mt('Set my user preferences').'
    '. - '
    course contents'.$navtext.'
    '; - } - } else { - $output.=''; - } - if ($context eq 'gcinorole') { - my $queued = &Apache::loncoursequeueadmin::queued_selfenrollment('notitle'); - if ($queued) { - $output .= ''. - '
    '. - '

    '.&mt('Pending Enrollment Requests').'

    '. - $queued. - '
    '; - } - } - $output.=''; - } else { - # calling rawconfig with "1" will evaluate mydesk.tab, - # even if there is no active remote control - &rawconfig(1); - $output=''; - for (my $col=1; $col<=2; $col++) { - $output.='"; } + $output.="
    '; - for (my $row=1; $row<=8; $row++) { - foreach my $cat (keys(%category_members)) { - if ($category_positions{$cat} ne "$col,$row") { next; } - $output.='
    '; - $output.='

    '.&mt($category_names{$cat}).'

    '; - $output.=''; - 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.='
    '; - $output.='
    '; - } +# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control + &rawconfig(1); + my $output=''; + for (my $col=1; $col<=2; $col++) { + $output.='"; - } - $output.="
    '; + for (my $row=1; $row<=8; $row++) { + foreach my $cat (keys(%category_members)) { + if ($category_positions{$cat} ne "$col,$row") { next; } + #$output.=''; + $output.='
    '; + $output.='

    '.&mt($category_names{$cat}).'

    '; + $output.='
    '.&mt($category_names{$cat}).'
    '; + 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.='
    '; + $output.=''; } - $output.="
    "; + } + $output.="
    "; return $output; } @@ -1756,51 +1648,11 @@ END } sub utilityfunctions { - my ($caller,$custommenu) = @_; + my $caller = shift; unless ($env{'environment.remote'} eq 'off' || $caller eq '/adm/menu') { 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])); if ($currenturl =~ m{^/adm/wrapper/ext/}) { if ($env{'request.external.querystring'}) { @@ -1848,8 +1700,6 @@ return (<