--- loncom/interface/lonmenu.pm 2010/03/03 21:33:15 1.315 +++ loncom/interface/lonmenu.pm 2010/03/10 21:25:50 1.316 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.315 2010/03/03 21:33:15 droeschl Exp $ +# $Id: lonmenu.pm,v 1.316 2010/03/10 21:25:50 droeschl Exp $ # # Copyright Michigan State University Board of Trustees # @@ -28,8 +28,6 @@ # # There is one parameter controlling the action of this module: # -# environment.remote - if this is 'on', the routines controll the remote -# control, otherwise they render the main window controls; =head1 NAME @@ -124,22 +122,8 @@ and in the body of the document =item unloadevents() -=item startupremote() - -=item setflags() - -=item maincall() - -=item load_remote_msg() - =item get_menu_name() -=item reopenmenu() - -=item open() - -Open the menu - =item clear() =item switch() @@ -156,10 +140,6 @@ The javascript is usually similar to "go =item rawconfig() -=item close() - -=item footer() - =item utilityfunctions() =item serverform() @@ -205,10 +185,10 @@ sub prep_menuitem { } else { # textual Link $link = &mt($$menuitem[3]); } - if($$menuitem[4] eq 'newmsg'){ #special style for New Messages - return '
  • '.$link.'
  • '; - } - return '
  • '.$link.'
  • '; + return '
  • $link
  • |; } # primary_menu() evaluates @primary_menu and returns XHTML for the menu @@ -357,11 +337,6 @@ sub registerurl { if ($env{'request.state'} eq 'construct') { $force_title=&Apache::lonxml::display_title(); } - if (($env{'environment.remote'} eq 'off') || - ((($env{'request.publicaccess'}) || - (!&Apache::lonnet::is_on_map( - &unescape($env{'request.noversionuri'})))) && - (!$forcereg))) { return $result .'' .$force_title; - } -# Graphical display after login only - if ($env{'request.registered'} && !$forcereg) { return ''; } - $result.=&innerregister($forcereg); - return $result.$force_title; } sub innerregister { my ($forcereg,$titletable,$bread_crumbs) = @_; - my $result = ''; my ($uname,$thisdisfn); my $const_space = ($env{'request.state'} eq 'construct'); my $is_const_dir = 0; @@ -388,23 +357,9 @@ sub innerregister { $env{'request.registered'} = 1; - my $noremote = ($env{'environment.remote'} eq 'off'); - undef(@inlineremote); - my $reopen=&Apache::lonmenu::reopenmenu(); - - my $newmail=''; - - if (&Apache::lonmsg::newmail() && !$noremote) { - # We have new mail and remote is up - $newmail= 'swmenu.setstatus("you have","messages");'; - } - - my ($breadcrumb,$separator); - if ($noremote - && ($env{'request.symb'}) - && ($env{'request.course.id'})) { + if ( $env{'request.symb'} && $env{'request.course.id'} ) { my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'}; @@ -434,22 +389,11 @@ sub innerregister { &Apache::lonhtmlcommon::clear_breadcrumbs(); &Apache::lonhtmlcommon::add_breadcrumb(@crumbs); #$breadcrumb .= &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); - unless (($env{'request.state'} eq 'edit') || ($newmail) || - ($env{'request.state'} eq 'construct') || - ($env{'form.register'})) { - $separator = &Apache::loncommon::head_subbox(); - } - # } - if ($env{'request.state'} eq 'construct') { - $newmail = $titletable; - } - my $timesync = ( $noremote ? '' : 'swmenu.syncclock(1000*'.time.');' ); - my $tablestart = ( $noremote ? '' : ''); - my $tableend = ( $noremote ? '
    ' : ''); # ============================================================================= # ============================ This is for URLs that actually can be registered - if (($env{'request.noversionuri'}!~m{^/(res/)*adm/}) || ($forcereg)) { + return '' unless ( ($env{'request.noversionuri'}!~m{^/(res/)*adm/}) + || $forcereg ); # -- This applies to homework problems for users with grading privileges my $crs='/'.$env{'request.course.id'}; if ($env{'request.course.sec'}) { @@ -619,14 +563,12 @@ 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 '' ) { # @@ -656,13 +598,6 @@ if(length($annotation) > 0){ $menuitems.="&anno-[_1]&tations[_1]&annotate()&"; $menuitems.="Make notes and annotations about this resource&&1\n"; - unless ($noremote) { - my $showreqcrs = &check_for_rcrs(); - if ($showreqcrs) { - $menuitems.="s&8&1&rcrs.gif&request[_1]&course[_16]". - "&go('/adm/requestcourse')&Course requests\n"; - } - } unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) { $menuitems.=(< -#$inlineremote[21] $inlineremote[23] -#ENDARROWSINLINE -# if ( &hidden_button_check() ne 'yes' ) { -# $inlinebuttons .= (< -#ENDINLINEICONS -# } -# } else { # not iconsonly -# if ( $inlineremote[21] ne '' || $inlineremote[23] ne '' ) { -# $inlinebuttons = (<$inlineremote[21] $inlineremote[23] -#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"; -#$inlineremote["${row}1"]$inlineremote["${row}2"]$inlineremote["${row}3"] -#ENDLINE -# } -# } -# } -# } - } - $breadcrumb = &Apache::lonhtmlcommon::breadcrumbs(undef,undef,0); - $result =(< -// BEGIN LON-CAPA Internal - -$timesync -$breadcrumb - - - -$newmail - - - -ENDREGTEXT -# Registered, graphical output - } else { - my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$env{'request.noversionuri'}))[0])); - $requri=&Apache::lonenc::check_encrypt(&unescape($requri)); - my $cursymb=&Apache::lonenc::check_encrypt($env{'request.symb'}); - my $navstatus=&get_nav_status(); - my $clearcstr; - - if ($env{'user.adv'}) { $clearcstr='clearbut(6,1)'; } - $result = (< -// - -ENDREGTHIS - } -# ============================================================================= - } else { -# ========================================== This can or will not be registered - if ($noremote) { -# Not registered - $result= (< -// - -ENDDONOTREGTHIS - } -# ============================================================================= - } - return $result; + return Apache::lonhtmlcommon::scripttag('', 'start') + . Apache::lonhtmlcommon::breadcrumbs(undef,undef,0) + . Apache::lonhtmlcommon::scripttag('', 'end'); } sub is_course_upload { @@ -925,176 +715,22 @@ sub unloadevents() { return 'LONCAPAstale();'; } - -sub startupremote { - my ($lowerurl)=@_; - if ($env{'environment.remote'} eq 'off') { - return (''); - } -# -# The Remote actually gets launched! -# - my $configmenu=&rawconfig(); - my $esclowerurl=&escape($lowerurl); - my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited'); - return(< -// - -ENDREMOTESTARTUP -} - -sub setflags() { - return(< -// - -ENDSETFLAGS -} - -sub maincall() { - if ($env{'environment.remote'} eq 'off') { return ''; } - return(< -// - -ENDMAINCALL -} - -sub load_remote_msg { - my ($lowerurl)=@_; - - if ($env{'environment.remote'} eq 'off') { return ''; } - - my $esclowerurl=&escape($lowerurl); - my $link=&mt('[_1]Continue[_2] on in Inline Menu mode' - ,'' - ,''); - return(< -
    - -
    -

    -

    $link

    -ENDREMOTEFORM -} - sub get_menu_name { my $hostid = $Apache::lonnet::perlvar{'lonHostID'}; $hostid =~ s/\W//g; return 'LCmenu'.$hostid; } - -sub reopenmenu { - if ($env{'environment.remote'} eq 'off') { return ''; } - my $menuname = &get_menu_name(); - my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); - return('window.open('.$nothing.',"'.$menuname.'","",false);'); -} - - -sub open { - my $returnval=''; - if ($env{'environment.remote'} eq 'off') { - return - ''; - } - my $menuname = &get_menu_name(); - -# unless (shift eq 'unix') { -# resizing does not work on linux because of virtual desktop sizes -# $returnval.=(< -ENDOPEN - return ''; -} - - # ================================================================== Raw Config +#SD +#this is called by +#lonmenu +# sub clear { my ($row,$col)=@_; - unless ($env{'environment.remote'} eq 'off') { - if (($row<1) || ($row>13)) { return ''; } - return "\n".qq(window.status+='.';swmenu.clearbut($row,$col);); - } else { - $inlineremote[10*$row+$col]=''; - return ''; - } + $inlineremote[10*$row+$col]=''; + return ''; } # ============================================ Switch a button or create a link @@ -1108,22 +744,11 @@ sub switch { $top=&mt($top); $bot=&mt($bot); $desc=&mt($desc); - if (($env{'environment.remote'} ne 'off') || ($env{'environment.icons'} eq 'classic')) { - $img=&mt($img); - } my $idx=10*$row+$col; $category_members{$cat}.=':'.$idx; - unless ($env{'environment.remote'} eq 'off') { - if (($row<1) || ($row>13)) { return ''; } -# Remote - return "\n". - qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc");); - } else { # Inline Remote - if ($env{'environment.icons'} ne 'classic') { - $img=~s/\.gif$/\.png/; - } + $img=~s/\.gif$/\.png/; if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; $text=~s/\s*\-\s*//gs; @@ -1153,6 +778,7 @@ sub switch { } } else { # Inline Menu +#SD look here if ($env{'environment.icons'} eq 'iconsonly') { $inlineremote[$idx]=''.$pic.''; } else { @@ -1161,7 +787,6 @@ sub switch { ''.$desc.''; } } - } return ''; } @@ -1179,13 +804,6 @@ sub secondlevel { return $output; } -sub openmenu { - my $menuname = &get_menu_name(); - if ($env{'environment.remote'} eq 'off') { return ''; } - my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); - return "window.open(".$nothing.",'".$menuname."');"; -} - sub inlinemenu { undef(@inlineremote); undef(%category_members); @@ -1228,13 +846,7 @@ sub rawconfig { # my $textualoverride=shift; my $output=''; - unless ($env{'environment.remote'} eq 'off') { - $output.= - "window.status='Opening Remote Control';var swmenu=".&openmenu(). -"\nwindow.status='Configuring Remote Control ';"; - } else { - unless ($textualoverride) { return ''; } - } + return '' unless $textualoverride; my $uname=$env{'user.name'}; my $udom=$env{'user.domain'}; my $adv=$env{'user.adv'}; @@ -1408,13 +1020,6 @@ sub rawconfig { $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat); } } - unless ($env{'environment.remote'} eq 'off') { - $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';"; - if (&Apache::lonmsg::newmail()) { - $output.='swmenu.setstatus("you have","messages");'; - } - } - return $output; } @@ -1440,34 +1045,8 @@ sub check_for_rcrs { return $showreqcrs; } -# ======================================================================= Close - -sub close { - if ($env{'environment.remote'} eq 'off') { return ''; } - my $menuname = &get_menu_name(); - return(< -// - -ENDCLOSE -} - # ====================================================================== Footer -sub footer { - -} - sub nav_control_js { my $nav=($env{'environment.remotenavmap'} eq 'on'); return (<