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

version 1.331, 2010/06/14 09:16:33 version 1.332, 2010/08/13 13:13:26
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 604  c&6&3 Line 605  c&6&3
 c&8&1  c&8&1
 c&8&2  c&8&2
 s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document  s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 s&9&1&sbkm.png&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1  
 ENDMENUITEMS  ENDMENUITEMS
               if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F' && $env{'request.uri'} =~ /^\/res/) {
                   # wishlist is only available for users with access to resource-pool
                   # and links can only be set for resources within the resource-pool
                   $menuitems .= (<<ENDMENUITEMS);
   s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1
   ENDMENUITEMS
               }
   
 my $currentURL = &Apache::loncommon::get_symb();  my $currentURL = &Apache::loncommon::get_symb();
 my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);  my ($symb_old,$symb_old_enc) = &Apache::loncommon::clean_symb($currentURL);
Line 635  ENDREALRES Line 642  ENDREALRES
     $menuitems .= (<<ENDMENUITEMS);      $menuitems .= (<<ENDMENUITEMS);
 s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document  s&8&3&prt.png&prepare[_1]&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 ENDMENUITEMS  ENDMENUITEMS
               if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') {
                   # wishlist is only available for users with access to resource-pool
                   $menuitems .= (<<ENDMENUITEMS);
   s&9&1&wishlist-link.png&set[_1]&wishlistlink[_2]&set_wishlistlink()&Set a link for this resource to wishlist&&1
   ENDMENUITEMS
               }
  }   }
         my $buttons='';          my $buttons='';
         foreach (split(/\n/,$menuitems)) {          foreach (split(/\n/,$menuitems)) {
Line 1101  sub utilityfunctions { Line 1114  sub utilityfunctions {
     my $end_page_bookmark =       my $end_page_bookmark = 
         &Apache::loncommon::end_page({'js_ready' => 1});          &Apache::loncommon::end_page({'js_ready' => 1});
   
       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 $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">'.
                                   &Apache::lonwishlist::getfoldersOption().
                                   '</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)
   
     var currentURL="$currenturl";      var currentURL="$currenturl";
Line 1244  function set_bookmark() { Line 1300  function set_bookmark() {
    bmquery.document.close();     bmquery.document.close();
 }  }
   
   function set_wishlistlink(title, path) {
      if (!title) {
          title=document.title;
      }
      if (!path) {
          path=location.pathname;
      }
      title = title.replace(/^LON-CAPA /,'');
      wishlistlink=window.open('','wishlistNewLink','width=560,height=350,scrollbars=0');
      wishlistlink.document.write(
      '$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();
   }
   
 ENDUTILITY  ENDUTILITY
 }  }
   

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


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