Diff for /loncom/interface/lonmenu.pm between versions 1.332 and 1.341

version 1.332, 2010/08/13 13:13:26 version 1.341, 2011/01/13 19:43:12
Line 155  use Apache::lonhtmlcommon(); Line 155  use Apache::lonhtmlcommon();
 use Apache::loncommon();  use Apache::loncommon();
 use Apache::lonenc();  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonwishlist();  
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities();  use HTML::Entities();
   
Line 215  sub primary_menu { Line 214  sub primary_menu {
                   
                           
         if ($$menuitem[3] eq 'Help') { # special treatment for helplink          if ($$menuitem[3] eq 'Help') { # special treatment for helplink
             $menu .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';              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 .= '<li>'.&Apache::loncommon::top_nav_help('Help').'</li>';
               }
         } else {          } else {
             $menu .= prep_menuitem($menuitem);              $menu .= prep_menuitem($menuitem);
         }          }
Line 262  sub secondary_menu { Line 272  sub secondary_menu {
     my $canviewgrps   = &Apache::lonnet::allowed('vcg', $crs_sec);       my $canviewgrps   = &Apache::lonnet::allowed('vcg', $crs_sec); 
     my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);       my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec); 
     my $canviewwnew   = &Apache::lonnet::allowed('whn', $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 $author        = getauthor();
   
     my $showlink = &show_return_link();      my $showlink = &show_return_link();
Line 282  sub secondary_menu { Line 293  sub secondary_menu {
                 && !($env{'request.state'} eq 'construct');                  && !($env{'request.state'} eq 'construct');
         next if    $$menuitem[4]   =~ /^mdc/          next if    $$menuitem[4]   =~ /^mdc/
                 && !$canedit;                  && !$canedit;
         next if    $$menuitem[4]  eq 'mdcCourse'          next if    $$menuitem[4]  eq 'nvgr'
                 && $crstype eq 'Community';                  && $canvgr;
         next if    $$menuitem[4]  eq 'mdcCommunity'          next if    $$menuitem[4]  eq 'vgr'
                 && $crstype ne 'Community';                  && !$canvgr;
         next if    $$menuitem[4]   eq 'cst'          next if    $$menuitem[4]   eq 'cst'
                 && !$canmodifyuser;                  && !$canmodifyuser;
         next if    $$menuitem[4]   eq 'whn'          next if    $$menuitem[4]   eq 'whn'
Line 526  sub innerregister { Line 537  sub innerregister {
                 if ($nocrsedit) {                  if ($nocrsedit) {
                     $editbutton=&clear(6,1);                      $editbutton=&clear(6,1);
                 } else {                  } else {
                       my $bot = "go('$cfile')";
                     if ($switchserver) {                      if ($switchserver) {
                         if ( $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());                              $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.
                             $cfile = '/adm/switchserver?otherserver='.$home.'&amp;role='.$env{'request.role'}.'&amp;symb='.$env{'request.symb'}.'&amp;origurl='.$resurl;                                       &HTML::Entities::encode($env{'request.role'},'"<>&').'&amp;symb='.
                                        &HTML::Entities::encode($env{'request.symb'},'"<>&');
                               $bot = "need_switchserver('$cfile');";
                         }                          }
                     }                      }
                     $editbutton=&switch                      $editbutton=&switch
                        ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',                         ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");                          $bot,"Edit this resource");
                     $noeditbutton = 0;                      $noeditbutton = 0;
                 }                  }
             } elsif ($editbutton eq '') {              } elsif ($editbutton eq '') {
Line 1105  sub utilityfunctions { Line 1119  sub utilityfunctions {
     my $end_page_annotate =       my $end_page_annotate = 
         &Apache::loncommon::end_page({'js_ready' => 1});          &Apache::loncommon::end_page({'js_ready' => 1});
   
     my $start_page_bookmark =       my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
         &Apache::loncommon::start_page('Bookmarks',undef,                           &mt('Switch server?');
        {'only_body' => 1,  
  'js_ready'  => 1,  
  'bgcolor'   => '#BBBBBB',});  
   
     my $end_page_bookmark =   
         &Apache::loncommon::end_page({'js_ready' => 1});  
   
     my $start_page_wishlistlink =       my $start_page_wishlistlink = 
         &Apache::loncommon::start_page('Set link to wishlist',undef,          &Apache::loncommon::start_page('Set link to wishlist',undef,
Line 1127  sub utilityfunctions { Line 1135  sub utilityfunctions {
     # it is split into 3 parts and the inputfields for title and path are left out      # 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      # these fields are inserted later to set the values for title and path
     # automatically via JavaScript (document.title and location.pathname)       # automatically via JavaScript (document.title and location.pathname) 
       my %folders = &Apache::lonnet::get('wishlist',['folders']);
       if ($folders{'folders'} eq '') {
           $folders{'folders'} = '<option value="" selected="selected">('.&mt('Top level').')</option>';
       }
     my $in_page_wishlistlink1 = '<h1>'.&mt('Set a link to wishlist').'</h1>'.      my $in_page_wishlistlink1 = '<h1>'.&mt('Set a link to wishlist').'</h1>'.
                                 '<form method="post" name="newlink" action="/adm/wishlist?mode=set" '.                                  '<form method="post" name="newlink" action="/adm/wishlist?mode=set" '.
                                 'onsubmit="return newlinksubmit();" >'.                                  'onsubmit="return newlinksubmit();" >'.
Line 1144  sub utilityfunctions { Line 1156  sub utilityfunctions {
                                 '<br/><br/>'.                                  '<br/><br/>'.
                                 '<input type="submit" value="'.&mt('Save in').'" />'.                                  '<input type="submit" value="'.&mt('Save in').'" />'.
                                 '<select name="folders">'.                                  '<select name="folders">'.
                                 &Apache::lonwishlist::getfoldersOption().                                  $folders{'folders'}.
                                 '</select>'.                                  '</select>'.
                                 '<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'.                                  '<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'.
                                 '</form>';                                  '</form>';
Line 1173  function go(url) { Line 1185  function go(url) {
    }     }
 }  }
   
   function need_switchserver(url) {
       if (url!='' && url!= null) {
           if (confirm("$confirm_switch")) {
               go(url); 
           }
       }
       return;
   }
   
 function gopost(url,postdata) {  function gopost(url,postdata) {
    if (url!='') {     if (url!='') {
       this.document.server.action=url;        this.document.server.action=url;
Line 1258  function group_chat(group) { Line 1279  function group_chat(group) {
    grpchat=window.open(url,winName,'height=320,width=280,resizable=yes,location=no,menubar=no,toolbar=no');     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() {  function annotate() {
    w_Annotator_flag=1;     w_Annotator_flag=1;
    annotator=window.open('','Annotator','width=365,height=265,scrollbars=0');     annotator=window.open('','Annotator','width=365,height=265,scrollbars=0');
Line 1278  function annotate() { Line 1292  function annotate() {
    annotator.document.close();     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'  
    +'<center><form method="post"'  
    +' name="newlink" action="/adm/bookmarks" target="bmquery" '  
    +'> <table width="340" height="150" '  
    +'bgcolor="#FFFFFF" align="center"><tr><td>Link Name:<br /><input '  
    +'type="text" name="title" size="45" value="'+clienttitle+'" />'  
    +'<br />Address:<br /><input type="text" name="address" size="45" '  
    +'value="'+clienthref+'" /><br /><center><input type="submit" '  
    +'value="Save" /> <input type="button" value="Close" '  
    +'onclick="javascript:window.close();" /></center></td>'  
    +'</tr></table></form></center>'  
    +'$end_page_bookmark' );  
    bmquery.document.close();  
 }  
   
 function set_wishlistlink(title, path) {  function set_wishlistlink(title, path) {
    if (!title) {     if (!title) {
        title=document.title;         title=document.title;
Line 1329  function set_wishlistlink(title, path) { Line 1321  function set_wishlistlink(title, path) {
    wishlistlink.document.close();     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  ENDUTILITY
 }  }
   
Line 1571  function adhocRole(roleitem) { Line 1576  function adhocRole(roleitem) {
             secok = 0;              secok = 0;
             var numrolesec = rolesections[selidx].length;              var numrolesec = rolesections[selidx].length;
             var msgidx = numsec[selidx] - numrolesec;              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 (secchoice == '') {
                 if (msgidx > 0) {                  if (msgidx > 0) {
                     secok = 1;                      secok = 1;

Removed from v.1.332  
changed lines
  Added in v.1.341


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>