--- loncom/interface/lonmenu.pm 2010/08/13 13:46:18 1.333 +++ loncom/interface/lonmenu.pm 2011/01/13 19:43:12 1.341 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.333 2010/08/13 13:46:18 wenzelju Exp $ +# $Id: lonmenu.pm,v 1.341 2011/01/13 19:43:12 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -214,7 +214,18 @@ sub primary_menu { 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 { $menu .= prep_menuitem($menuitem); } @@ -261,7 +272,8 @@ sub secondary_menu { my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec); my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec); - my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec); + my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec); + my $canvgr = &Apache::lonnet::allowed('vgr', $crs_sec); my $author = getauthor(); my $showlink = &show_return_link(); @@ -281,10 +293,10 @@ sub secondary_menu { && !($env{'request.state'} eq 'construct'); next if $$menuitem[4] =~ /^mdc/ && !$canedit; - next if $$menuitem[4] eq 'mdcCourse' - && $crstype eq 'Community'; - next if $$menuitem[4] eq 'mdcCommunity' - && $crstype ne 'Community'; + next if $$menuitem[4] eq 'nvgr' + && $canvgr; + next if $$menuitem[4] eq 'vgr' + && !$canvgr; next if $$menuitem[4] eq 'cst' && !$canmodifyuser; next if $$menuitem[4] eq 'whn' @@ -525,15 +537,18 @@ 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='.$env{'request.role'}.'&symb='.$env{'request.symb'}.'&origurl='.$resurl; + $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.png','edit[_1]','resource[_2]', - "go('".$cfile."');","Edit this resource"); + $bot,"Edit this resource"); $noeditbutton = 0; } } elsif ($editbutton eq '') { @@ -1104,14 +1119,8 @@ sub utilityfunctions { my $end_page_annotate = &Apache::loncommon::end_page({'js_ready' => 1}); - my $start_page_bookmark = - &Apache::loncommon::start_page('Bookmarks',undef, - {'only_body' => 1, - 'js_ready' => 1, - 'bgcolor' => '#BBBBBB',}); - - 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?'); my $start_page_wishlistlink = &Apache::loncommon::start_page('Set link to wishlist',undef, @@ -1126,6 +1135,10 @@ sub utilityfunctions { # it is split into 3 parts and the inputfields for title and path are left out # these fields are inserted later to set the values for title and path # automatically via JavaScript (document.title and location.pathname) + my %folders = &Apache::lonnet::get('wishlist',['folders']); + if ($folders{'folders'} eq '') { + $folders{'folders'} = ''; + } my $in_page_wishlistlink1 = '

    '.&mt('Set a link to wishlist').'

    '. '
    '. @@ -1143,7 +1156,7 @@ sub utilityfunctions { '

    '. ''. ''. ''. '
    '; @@ -1172,6 +1185,15 @@ function go(url) { } } +function need_switchserver(url) { + if (url!='' && url!= null) { + if (confirm("$confirm_switch")) { + go(url); + } + } + return; +} + function gopost(url,postdata) { if (url!='') { this.document.server.action=url; @@ -1257,13 +1279,6 @@ function group_chat(group) { grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no'); } -function edit_bookmarks() { - go(''); - w_BookmarkPal_flag=1; - bookmarkpal=window.open("/adm/bookmarks", - "BookmarkPal", "width=500,height=505,scrollbars=0"); -} - function annotate() { w_Annotator_flag=1; annotator=window.open('','Annotator','width=365,height=265,scrollbars=0'); @@ -1277,28 +1292,6 @@ function annotate() { annotator.document.close(); } -function set_bookmark() { - go(''); - clienttitle=document.title; - clienthref=location.pathname; - w_bmquery_flag=1; - bmquery=window.open('','bmquery','width=365,height=165,scrollbars=0'); - bmquery.document.write( - '$start_page_bookmark' - +'
    ' - +'
    Link Name:
    ' - +'
    Address:

    ' - +'$end_page_bookmark' ); - bmquery.document.close(); -} - function set_wishlistlink(title, path) { if (!title) { title=document.title; @@ -1328,6 +1321,19 @@ function set_wishlistlink(title, path) { wishlistlink.document.close(); } +function open_Wishlist_Import(rat) { + var newWin; + if (rat) { + newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import&rat='+rat, + 'wishlistImport','scrollbars=1,resizable=1,menubar=0'); + } + else { + newWin = window.open('/adm/wishlist?inhibitmenu=yes&mode=import', + 'wishlistImport','scrollbars=1,resizable=1,menubar=0'); + } + newWin.focus(); +} + ENDUTILITY } @@ -1570,7 +1576,7 @@ function adhocRole(roleitem) { secok = 0; var numrolesec = rolesections[selidx].length; var msgidx = numsec[selidx] - numrolesec; - secchoice = prompt("$lt{'this'}\\n"+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],""); + secchoice = prompt("$lt{'this'} "+secpick[msgidx]+"\\n$lt{'avai'} "+roleseclist[selidx],""); if (secchoice == '') { if (msgidx > 0) { secok = 1;