Diff for /loncom/interface/lonmenu.pm between versions 1.344 and 1.349

version 1.344, 2011/01/18 19:52:46 version 1.349, 2011/05/27 18:39:20
Line 155  use Apache::lonenc(); Line 155  use Apache::lonenc();
 use Apache::lonlocal;  use Apache::lonlocal;
 use LONCAPA qw(:DEFAULT :match);  use LONCAPA qw(:DEFAULT :match);
 use HTML::Entities();  use HTML::Entities();
   use Apache::lonwishlist();
   
 use vars qw(@desklines %category_names %category_members %category_positions   use vars qw(@desklines %category_names %category_members %category_positions 
             $readdesk @primary_menu @secondary_menu);              $readdesk @primary_menu @secondary_menu);
Line 358  sub innerregister { Line 359  sub innerregister {
   
     undef(@inlineremote);      undef(@inlineremote);
   
       my $resurl; 
     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());          (my $mapurl, my $rid, $resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
         my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};          my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
   
         my $maptitle = &Apache::lonnet::gettitle($mapurl);          my $maptitle = &Apache::lonnet::gettitle($mapurl);
Line 530  sub innerregister { Line 532  sub innerregister {
                         }                          }
                     }                      }
                     $editbutton=&switch                      $editbutton=&switch
                        ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',                         ('','',6,1,'pcstr.png','Edit','resource[_2]',
                         $bot,"Edit this resource");                          $bot,"Edit this resource");
                     $noeditbutton = 0;                      $noeditbutton = 0;
                 }                  }
Line 546  sub innerregister { Line 548  sub innerregister {
                         my $cfile = &edit_course_upload($file,$cnum,$cdom);                          my $cfile = &edit_course_upload($file,$cnum,$cdom);
                         if ($cfile) {                          if ($cfile) {
                             $editbutton=&switch                              $editbutton=&switch
                                         ('','',6,1,'pcstr.png','edit[_1]',                                          ('','',6,1,'pcstr.png','Edit',
                                          'resource[_2]',"go('".$cfile."');",                                           'resource[_2]',"go('".$cfile."');",
                                          'Edit this resource');                                           'Edit this resource');
                         }                          }
Line 554  sub innerregister { Line 556  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  # Prepare the rest of the buttons
Line 681  ENDMENUITEMS Line 695  ENDMENUITEMS
             #publish button in construction space              #publish button in construction space
             if ($env{'request.state'} eq 'construct'){              if ($env{'request.state'} eq 'construct'){
                 &Apache::lonhtmlcommon::add_breadcrumb_tool(                  &Apache::lonhtmlcommon::add_breadcrumb_tool(
                      'advtools', @inlineremote[63]);                       'advtools', $inlineremote[63]);
             } else {              } else {
                 &Apache::lonhtmlcommon::add_breadcrumb_tool(                  &Apache::lonhtmlcommon::add_breadcrumb_tool(
                      'tools', @inlineremote[63]);                       'tools', $inlineremote[63]);
             }              }
                           
             unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {              unless ($env{'request.noversionuri'}=~ m{^/adm/(navmaps|viewclasslist)(\?|$)}) {
Line 1105  sub utilityfunctions { Line 1119  sub utilityfunctions {
     my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.      my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
                          &mt('Switch server?');                           &mt('Switch server?');
   
     my $start_page_wishlistlink =   
         &Apache::loncommon::start_page('Set link to wishlist',undef,  
        {'only_body' => 1,  
  'js_ready'  => 1,  
  'bgcolor'   => '#FFFFFF',});  
   
     my $warningLink = &mt('You must insert a title!');  
   
     # HTML-Markup for 'Set a link for this resource to wishlist'  
     # this is written via JavaScript document.write (function set_wishlistlink)   
     # 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'} = '<option value="" selected="selected">('.&mt('Top level').')</option>';  
     }  
     my $in_page_wishlistlink1 = '<h1>'.&mt('Set a link to wishlist').'</h1>'.  
                                 '<form method="post" name="newlink" action="/adm/wishlist?mode=set" '.  
                                 'onsubmit="return newlinksubmit();" >'.  
                                 &Apache::lonhtmlcommon::start_pick_box().  
                                 &Apache::lonhtmlcommon::row_title(&mt('Link Title'));  
   
     my $in_page_wishlistlink2 = &Apache::lonhtmlcommon::row_closure().  
                                 &Apache::lonhtmlcommon::row_title(&mt('Path'));  
   
     my $in_page_wishlistlink3 = &Apache::lonhtmlcommon::row_closure().  
                                 &Apache::lonhtmlcommon::row_title(&mt('Note')).  
                                 '<textarea name="note" rows="3" cols="35" style="width:100%"></textarea>'.  
                                 &Apache::lonhtmlcommon::row_closure(1).  
                                 &Apache::lonhtmlcommon::end_pick_box().  
                                 '<br/><br/>'.  
                                 '<input type="submit" value="'.&mt('Save in').'" />'.  
                                 '<select name="folders">'.  
                                 $folders{'folders'}.  
                                 '</select>'.  
                                 '<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'.  
                                 '</form>';  
   
     # remove all \n for inserting on javascript document.write  
     $in_page_wishlistlink1 =~ s/\n//g;  
     $in_page_wishlistlink2 =~ s/\n//g;  
     $in_page_wishlistlink3 =~ s/\n//g;  
   
     my $end_page_wishlistlink =   
         &Apache::loncommon::end_page({'js_ready' => 1});  
   
 return (<<ENDUTILITY)  return (<<ENDUTILITY)
   
Line 1276  function annotate() { Line 1244  function annotate() {
 }  }
   
 function set_wishlistlink(title, path) {  function set_wishlistlink(title, path) {
    if (!title) {      if (!title) {
        title=document.title;          title = document.title;
    }          title = title.replace(/^LON-CAPA /,'');
    if (!path) {      }
        path=location.pathname;      if (!path) {
    }          path = location.pathname;
    title = title.replace(/^LON-CAPA /,'');      }
    wishlistlink=window.open('','wishlistNewLink','width=560,height=350,scrollbars=0');      Win = window.open('/adm/wishlist?mode=newLink&setTitle='+title+'&setPath='+path,
    wishlistlink.document.write(                        'wishlistNewLink','width=560,height=350,scrollbars=0');
    '$start_page_wishlistlink'  
    +'<script type="text\/javascript">'  
    +'function newlinksubmit(){'  
    +'var title = document.getElementsByName("title")[0].value;'  
    +'if (!title) {'  
    +'alert("$warningLink");'  
    +'return false;}'  
    +'return true;}'  
    +'<\/scr'+'ipt>'  
    +'$in_page_wishlistlink1'  
    +'<input type="text" name="title" size="45" value="'+title+'"/>'  
    +'$in_page_wishlistlink2'  
    +'<input type="text" name="path" size="45" value="'+path+'" '  
    +'readonly="readonly" style="background-color: #DDDDDD"/>'  
    +'$in_page_wishlistlink3'  
    +'$end_page_wishlistlink' );  
    wishlistlink.document.close();  
 }  }
   
 function open_Wishlist_Import(rat) {  function open_Wishlist_Import(rat) {

Removed from v.1.344  
changed lines
  Added in v.1.349


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