--- loncom/interface/lonmenu.pm 2009/11/18 11:47:33 1.304 +++ loncom/interface/lonmenu.pm 2010/02/24 17:38:52 1.314 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.304 2009/11/18 11:47:33 droeschl Exp $ +# $Id: lonmenu.pm,v 1.314 2010/02/24 17:38:52 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,13 +42,77 @@ Coordinates the response to clicking an This is part of the LearningOnline Network with CAPA project 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 =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 initlittle() +=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() + +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() @@ -150,6 +214,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.'
  • '; } @@ -290,7 +357,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', @@ -512,7 +579,7 @@ sub registerurl { } sub innerregister { - my ($forcereg, $titletable) = @_; + my ($forcereg,$titletable,$bread_crumbs) = @_; my $result = ''; my ($uname,$thisdisfn); my $const_space = ($env{'request.state'} eq 'construct'); @@ -753,6 +820,14 @@ 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 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'}) && $env{'request.symb'} ne '' ) { # @@ -831,39 +906,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 = (< @@ -906,11 +970,11 @@ ENDMENUITEMS $timesync $breadcrumb - - - + + + $newmail - + @@ -1328,15 +1392,15 @@ sub inlinemenu { undef(%category_members); # calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control &rawconfig(1); - my $output=''; + my $output='
    '; for (my $col=1; $col<=2; $col++) { $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.='
    '; + $output.='

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

    '; $output.='
    '.&mt($category_names{$cat}).'
    '; my %active=(); foreach my $menu_item (split(/\:/,$category_members{$cat})) { @@ -1453,15 +1517,31 @@ sub rawconfig { } } elsif ($pro =~ /^courseenv_(.*)$/) { my $key = $1; - if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && - ($crstype ne 'Community')) { - $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); + if ($crstype ne 'Community') { + my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key}; + 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_(.*)$/) { my $key = $1; - if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && - ($crstype eq 'Community')) { - $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat); + if ($crstype eq 'Community') { + my $coursepref = $env{'course.'.$env{'request.course.id'}.'.'.$key}; + 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_(.*)$/) { # Check for permissions inside of a course @@ -1606,6 +1686,31 @@ function gonav(url) { 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 ='$lt{'less'}'; + return; +} + +function hideCourseID() { + document.getElementById('dccid').style.display='none'; + document.getElementById('dccidtext').innerHTML ='$lt{'more'}'; + return; +} + +END + +} + sub utilityfunctions { my $caller = shift; unless ($env{'environment.remote'} eq 'off' || @@ -1623,6 +1728,13 @@ sub utilityfunctions { my $currentsymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); 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 = &Apache::loncommon::start_page('Annotator',undef, {'only_body' => 1, @@ -1650,6 +1762,7 @@ return (<