--- loncom/interface/lonsearchcat.pm 2010/06/06 02:40:30 1.324 +++ loncom/interface/lonsearchcat.pm 2010/08/13 13:32:36 1.325 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.324 2010/06/06 02:40:30 raeburn Exp $ +# $Id: lonsearchcat.pm,v 1.325 2010/08/13 13:32:36 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -3364,6 +3364,85 @@ 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 $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}); + + # 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(); +} + +// ]]> + +SCRIPT + my $start_page = &Apache::loncommon::start_page(undef,$js, {'only_body' =>1}); my $result=<'.' '. ''.$values{'title'}."\n"; + 'target="preview">'.$values{'title'}."\n". + ''. + ''; $result .= "

\n"; $result .= ''.$values{'author'}.','. ' '.$values{'owner'}.'
'; @@ -3615,9 +3698,16 @@ sub summary_view { $jumpurl=~s|^/ext/|http://|; my $link = '
'.&display_url($jumpurl,1).'
'; + my $titleWL = &mt('Set link to wishlist'); $result.=<$values{'title'}
+ target="preview">$values{'title'} + + set wishlistlink + +
$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
$values{'copyrighttag'}
@@ -3663,6 +3753,11 @@ sub compact_view { $result.=' '. ''. &HTML::Entities::encode($values{'title'},'<>&"').' '. + ''. + ''. + ''. $link.' '.$values{'author'}.' ('.$values{'domain'}.')'; return $result; } @@ -3704,12 +3799,19 @@ sub fielded_format_view { my $jumpurl=$values{'url'}; $jumpurl=~s|^/ext/|http://|; + my $titleWL = ('Set link to wishlist'); my $result=<

URL:
$values{'url'}
+ target='preview'>$values{'url'} + + set wishlistlink + + END foreach my $field ('title','author','domain','subject','keywords','notes', 'mimetag','language','creationdate','lastrevisiondate',