--- loncom/interface/lonmenu.pm 2009/11/30 06:23:32 1.307 +++ loncom/interface/lonmenu.pm 2011/06/16 22:55:17 1.315.2.12 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.307 2009/11/30 06:23:32 raeburn Exp $ +# $Id: lonmenu.pm,v 1.315.2.12 2011/06/16 22:55:17 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -42,17 +42,72 @@ 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() -=item menubuttons() +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 -This gets called at the top of the body section +=item secondary_menu() + +Same as primary_menu() but operates on @secondary_menu. =item show_return_link() @@ -150,7 +205,10 @@ sub prep_menuitem { } else { # textual Link $link = &mt($$menuitem[3]); } - return '
  • '.$link.'
  • '; + return '
  • $link
  • |; } # primary_menu() evaluates @primary_menu and returns XHTML for the menu @@ -162,6 +220,11 @@ sub primary_menu { my $menu; # each element of @primary contains following array: # (link url, icon path, alt text, link text, condition) + my $public; + if ((($env{'user.name'} eq 'public') && ($env{'user.domain'} eq 'public')) + || (($env{'user.name'} eq '') && ($env{'user.domain'} eq ''))) { + $public = 1; + } foreach my $menuitem (@primary_menu) { # evaluate conditions next if ref($menuitem) ne 'ARRAY'; # @@ -169,39 +232,76 @@ sub primary_menu { && &Apache::lonmsg::mynewmail(); # whether a new msg next if $$menuitem[4] eq 'newmsg' # arrived or not && !&Apache::lonmsg::mynewmail(); # - next if $$menuitem[4] !~ /public/ ##we've a public user, - && $env{'user.name'} eq 'public' ##who should not see all - && $env{'user.domain'} eq 'public'; ##links - 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] !~ /public/ ##we've a public user, + && $public; ##who should not see all + ##links + next if $$menuitem[4] eq 'onlypublic'# hide links which are + && !$public; # only visible to public + # users 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 && !&Apache::loncommon::show_course(); ## - - + + if ($$menuitem[3] eq 'Help') { # special treatment for helplink - $menu .= '
  • '.&Apache::loncommon::top_nav_help('Help').'
  • '; + if ($public) { + 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 .= '
  • '.&Apache::loncommon::top_nav_help('Help').'
  • '; + } } else { - my @items = @{$menuitem}; - $items[0] = 'javascript:'.$menuitem->[0].';'; - $menu .= &prep_menuitem(\@items); + $menu .= &prep_menuitem($menuitem); } } return "
      $menu
    "; } +#returns hashref {user=>'',dom=>''} containing: +# own name, domain if user is au +# name, domain of parent author if user is ca or aa +#empty return if user is not an author or not on homeserver +# +#TODO this should probably be moved somewhere more central +#since it can be used by different parts of the system +sub getauthor{ + return unless $env{'request.role'}=~/^(ca|aa|au)/; #nothing to do if user isn't some kind of author + + #co- or assistent author? + my ($dom, $user) = ($env{'request.role'} =~ /^(?:ca|aa)\.\/($match_domain)\/($match_username)$/) + ? ($1, $2) #domain, username of the parent author + : @env{ ('request.role.domain', 'user.name') }; #own domain, username + + # current server == home server? + my $home = &Apache::lonnet::homeserver($user,$dom); + foreach (&Apache::lonnet::current_machine_ids()){ + return {user => $user, dom => $dom} if $_ eq $home; + } + + # if wrong server + return; +} + sub secondary_menu { my $menu; my $crstype = &Apache::loncommon::course_type(); - my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); - my $canviewgrps = &Apache::lonnet::allowed('vcg', $env{'request.course.id'} - . ($env{'request.course.sec'} ? "/$env{'request.course.sec'}" - : '')); + my $crs_sec = $env{'request.course.id'} . ($env{'request.course.sec'} + ? "/$env{'request.course.sec'}" + : ''); + my $canedit = &Apache::lonnet::allowed('mdc', $env{'request.course.id'}); + my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec); + my $author = getauthor(); + my $showlink = &show_return_link(); my %groups = &Apache::lonnet::get_active_groups( $env{'user.domain'}, $env{'user.name'}, @@ -211,6 +311,7 @@ sub secondary_menu { # evaluate conditions next if ref($menuitem) ne 'ARRAY'; next if $$menuitem[4] ne 'always' + && $$menuitem[4] ne 'author' && !$env{'request.course.id'}; next if $$menuitem[4] eq 'showreturn' && !$showlink @@ -232,6 +333,8 @@ sub secondary_menu { next if $$menuitem[4] =~ /showgroups$/ && !$canviewgrps && !%groups; + next if $$menuitem[4] eq 'author' + && !$author; if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) { # special treatment for role selector @@ -273,203 +376,18 @@ sub secondary_menu { $menu =~ s/\[url\]/$escurl/g; $menu =~ s/\[symb\]/$escsymb/g; } + $menu =~ s/\[uname\]/$$author{user}/g; + $menu =~ s/\[udom\]/$$author{dom}/g; return ""; } +sub show_return_link { + if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)}) + || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) { -# -# 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=''.$lt{'roles'}.''; - 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 = 'LON-CAPA Logo'; - - 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 = ''.$role_selector.'  '.$lt{'other'}.''; - } - } - - 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 (< -
  • $logo
  • -
  • $lt{'login'}
  • - -
    -ENDINLINEMENU - } - $roles = ''.$lt{'roles'}.''; -# Do we have a NAV link? - if ($env{'request.course.id'}) { - my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='. - $escsymb; - if ($env{'environment.remotenavmap'} eq 'on') { - $link="javascript:gonav('".$link."')"; - } - $navmaps=(<$lt{'nav'} -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=(<$text -ENDDOCS - } - if ($showgroups) { - $groups =(<$lt{'groups'} -ENDGROUPS - } - if (&show_return_link()) { - my $escreload=&escape('return:'); - $reloadlink=(<$lt{'ret'} -ENDRELOAD - } - if ($role_selector) { - #$roles = ''.$role_selector.''.$lt{'other'}.''; - $role_selector = '
  • '.$role_selector.'
  • '; - } - } - if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) { - my $escreload=&escape('return:'); - $reloadlink=(<$lt{'ret'} -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 = '' - . mt($messagelink) .''; - - my $helplink = &Apache::loncommon::top_nav_help('Help'); - return (< -// - -
      -
    1. $logo
    2. -
    3. $messagelink
    4. -
    5. $roles
    6. -
    7. $helplink
    8. -
    9. $lt{'exit'}
    10. -
    -
      -
    • $lt{'main'}
    • -$reloadlink -$navmaps -$docs -$groups -$role_selector -
    -$form - -$reg -ENDINLINEMENU - } else { - return ''; + return if ($env{'form.register'}); } -} - -sub show_return_link { return (($env{'request.noversionuri'}=~m{^/(res|public)/} && $env{'request.symb'} eq '') || @@ -478,7 +396,7 @@ sub show_return_link { (($env{'request.noversionuri'}=~/^\/adm\//) && ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && ($env{'request.noversionuri'}!~ - m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) + m[^/adm/.*/(smppg|bulletinboard)($|\?)]) )); } @@ -512,7 +430,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'); @@ -535,12 +453,12 @@ sub innerregister { $newmail= 'swmenu.setstatus("you have","messages");'; } - my ($breadcrumb,$separator); + my ($breadcrumb,$separator,$resurl); if ($noremote && ($env{'request.symb'}) && ($env{'request.course.id'})) { - my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); + (my $mapurl, my $rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'}; my $maptitle = &Apache::lonnet::gettitle($mapurl); @@ -551,9 +469,16 @@ sub innerregister { } else { $contentstext = &mt('Course Contents'); } - my @crumbs = ({text => $contentstext, - href => "Javascript:gonav('/adm/navmaps')"}); - + my @crumbs; + unless (($forcereg) && ($env{'request.noversionuri'} eq '/adm/navmaps') + && ($mapurl eq $env{'course.'.$env{'request.course.id'}.'.url'})) { + my $navhref = "javascript:gopost('/adm/navmaps','')"; + if ($env{'environment.remotenavmap'} eq 'on') { + $navhref = "javascript:gonav('/adm/navmaps');"; + } + @crumbs = ({text => $contentstext, + href => $navhref}); + } if ($mapurl ne $env{'course.'.$env{'request.course.id'}.'.url'}) { push(@crumbs, {text => '...', no_mt => 1}); @@ -567,6 +492,7 @@ 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') || @@ -574,6 +500,11 @@ sub innerregister { $separator = &Apache::loncommon::head_subbox(); } # + } elsif (!$const_space){ + #a situation when we're looking at a resource outside of context of a + #course or construction space (e.g. with cumulative rights) + &Apache::lonhtmlcommon::clear_breadcrumbs(); + &Apache::lonhtmlcommon::add_breadcrumb({text => 'View Resource'}); } if ($env{'request.state'} eq 'construct') { $newmail = $titletable; @@ -667,6 +598,8 @@ sub innerregister { my $cfuname=''; my $cfudom=''; my $uploaded; + my $switchserver=''; + my $home; if ($env{'request.filename'}) { my $file=&Apache::lonnet::declutter($env{'request.filename'}); if (defined($cnum) && defined($cdom)) { @@ -677,18 +610,20 @@ sub innerregister { # Check that the user has permission to edit this resource ($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1); if (defined($cfudom)) { - my $home=&Apache::lonnet::homeserver($cfuname,$cfudom); + $home=&Apache::lonnet::homeserver($cfuname,$cfudom); my $allowed=0; my @ids=&Apache::lonnet::current_machine_ids(); foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } } if ($allowed) { $cfile=$file; + } else { + $switchserver=$file; } } } } # Finally, turn the button on or off - if ($cfile && !$const_space) { + if (($cfile || $switchserver) && !$const_space) { my $nocrsedit; # Suppress display where CC has switched to student role. if ($env{'request.course.id'}) { @@ -700,9 +635,19 @@ sub innerregister { if ($nocrsedit) { $editbutton=&clear(6,1); } else { + my $bot = "go('$cfile')"; + if ($switchserver) { + if ( $env{'request.symb'} && $env{'request.course.id'} ) { + my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread()); + $cfile = '/adm/switchserver?otherserver='.$home.'&role='. + &HTML::Entities::encode($env{'request.role'},'"<>&').'&symb='. + &HTML::Entities::encode($env{'request.symb'},'"<>&'); + $bot = "need_switchserver('$cfile');"; + } + } $editbutton=&switch ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]', - "go('".$cfile."');","Edit this resource"); + $bot,"Edit this resource"); $noeditbutton = 0; } } elsif ($editbutton eq '') { @@ -725,6 +670,18 @@ sub innerregister { } } } + if ($env{'request.course.id'}) { + if ($resurl eq "public/$cdom/$cnum/syllabus") { + if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) { + if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { + $editbutton=&switch('','',6,1,'pcstr.png','Edit', + 'resource[_2]', + "go('/adm/courseprefs?phase=display&actions=courseinfo')", + 'Edit this resource'); + } + } + } + } ### ### # Prepare the rest of the buttons @@ -753,12 +710,32 @@ 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 '' ) { # # We are in a course and looking at a registred URL # Should probably be in mydesk.tab # + + my %icon_text; + if ($noremote) { + %icon_text = &Apache::lonlocal::texthash ( + annotate => 'Notes', + bookmark => 'Bookmark', + catalog => 'Info', + evaluate => 'Evaluate', + feedback => 'Communicate', + printout => 'Print', + ); + } $menuitems=(< 0){ $menuitems.="anot.gif"; } $menuitems.="&anno-[_1]&tations[_1]&annotate()&"; -$menuitems.="Make notes and annotations about this resource&&1\n"; +$menuitems.="Make notes and annotations about this resource&&1&$icon_text{'annotate'}\n"; unless ($noremote) { my $showreqcrs = &check_for_rcrs(); @@ -789,21 +766,26 @@ $menuitems.="Make notes and annotations "&go('/adm/requestcourse')&Course requests\n"; } } - unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { + unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) { if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) { + my $tail; + unless ($env{'request.state'} eq 'construct') { + $tail = '&&&'.$icon_text{'catalog'}; + } $menuitems.=(< @@ -1239,7 +1211,7 @@ sub clear { # The javascript is usually similar to "go('/adm/roles')" or "cstrgo(..)". sub switch { - my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak)=@_; + my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat,$nobreak,$inlinetools)=@_; $act=~s/\$uname/$uname/g; $act=~s/\$udom/$udom/g; $top=&mt($top); @@ -1249,7 +1221,9 @@ sub switch { $img=&mt($img); } my $idx=10*$row+$col; - $category_members{$cat}.=':'.$idx; + if ($cat ne '') { + $category_members{$cat}.=':'.$idx; + } unless ($env{'environment.remote'} eq 'off') { if (($row<1) || ($row>13)) { return ''; } @@ -1293,9 +1267,13 @@ sub switch { if ($env{'environment.icons'} eq 'iconsonly') { $inlineremote[$idx]=''.$pic.''; } else { + my $icon_text = $desc; + if ($inlinetools) { + $icon_text = $inlinetools.' '; + } $inlineremote[$idx]= ''.$pic. - ''.$desc.''; + ''.$icon_text.' '; } } } @@ -1328,15 +1306,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})) { @@ -1395,6 +1373,13 @@ sub rawconfig { my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line); $prt=~s/\$uname/$uname/g; $prt=~s/\$udom/$udom/g; + if ($env{'environment.remotenavmap'} eq 'on') { + unless ($env{'environment.remote'} eq 'on') { + if ($img eq 'nav.gif') { + $act = "gonav('/adm/navmaps','')"; + } + } + } if ($prt =~ /\$crs/) { next unless ($env{'request.course.id'}); next if ($crstype eq 'Community'); @@ -1691,6 +1676,9 @@ sub utilityfunctions { my $end_page_bookmark = &Apache::loncommon::end_page({'js_ready' => 1}); + my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'. + &mt('Switch server?'); + return (< 0) { secok = 1;