--- loncom/interface/lonsearchcat.pm 2011/01/17 20:18:02 1.327 +++ loncom/interface/lonsearchcat.pm 2011/01/27 14:38:44 1.328 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.327 2011/01/17 20:18:02 www Exp $ +# $Id: lonsearchcat.pm,v 1.328 2011/01/27 14:38:44 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -78,6 +78,7 @@ use HTML::Entities(); use Parse::RecDescent; use Apache::lonnavmaps; use Apache::lonindexer(); +use Apache::lonwishlist(); use LONCAPA; ###################################################################### @@ -3058,83 +3059,17 @@ SCRIPT SCRIPT - # 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'} = ''; - } - 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!'); - - my $in_page_wishlistlink1 = '

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

'. - '
'. - &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')). - ''. - &Apache::lonhtmlcommon::row_closure(1). - &Apache::lonhtmlcommon::end_pick_box(). - '

'. - ''. - ''. - ''. - '
'; - - # 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}); + my $wishlistpopup; + if (&Apache::lonwishlist::getWishlist() ne 'error') { + $wishlistpopup = &Apache::lonwishlist::makePopUpNewLink(); + } # Add JavaScript-function to set link for a ressource to wishlist $js.=< // ' - +'function newlinksubmit(){' - +'var title = document.getElementsByName("title")[0].value;' - +'if (!title) {' - +'alert("$warningLink");' - +'return false;}' - +'return true;}' - +'<\/scr'+'ipt>' - +'$in_page_wishlistlink1' - +'' - +'$in_page_wishlistlink2' - +'' - +'$in_page_wishlistlink3' - +'$end_page_wishlistlink' ); - wishlistlink.document.close(); + $wishlistpopup; } // ]]>