--- loncom/interface/lonsearchcat.pm 2009/10/22 13:48:55 1.317 +++ 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.317 2009/10/22 13:48:55 bisitz Exp $ +# $Id: lonsearchcat.pm,v 1.325 2010/08/13 13:32:36 wenzelju Exp $ # # Copyright Michigan State University Board of Trustees # @@ -118,8 +118,6 @@ sub handler { # This is set and used in &handler() and is also used in # &output_results(). - my $loaderror=&Apache::lonnet::overloaderror($r); - if ($loaderror) { return $loaderror; } # my $closebutton; # button that closes the search window # This button is different for the RAT compared to @@ -324,7 +322,7 @@ END &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). '&phase=disp_adv'. - 'catalogmode='.$env{'form.catalogmode'}. + '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. '&mode='.$env{'form.mode'}, text=>"Course Search", @@ -492,7 +490,7 @@ sub course_search { &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). '&phase=disp_adv'. - 'catalogmode='.$env{'form.catalogmode'}. + '&catalogmode='.$env{'form.catalogmode'}. '&launch='.$env{'form.launch'}. '&mode='.$env{'form.mode'}, text=>"Course Search", @@ -770,14 +768,26 @@ sub setup_basic_search { portfolio => 'Portfolio Search', ); my ($userelatedwords,$onlysearchdomain,$inclext,$adv_search_link,$scrout); - $userelatedwords = ''; - $onlysearchdomain = ''; + + $userelatedwords = ''; + + $onlysearchdomain = ''; + $adv_search_link = '".$_." "; } - my %servers = &Apache::lonnet::get_servers(\@allowed_domains, + my %servers = &Apache::lonnet::get_unique_servers(\@allowed_domains, 'library'); $libraries_to_query = [keys(%servers)]; } @@ -2286,8 +2296,8 @@ sub print_sort_form { // &mt('Ascending'), + {asc =>&mt('Ascending'), desc=>&mt('Descending') - )) + }) .''; ## ## Display links for 'prev' and 'next' pages (if necessary) and Display Options @@ -3347,13 +3357,92 @@ SCRIPT } function select_group() { parent.window.location= - "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import$inhibit_menu&acts="+ + "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import$inhibit_menu&acts="+ parent.statusframe.document.forms.statusform.elements.acts.value; } // ]]> 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'}.'
'; @@ -3541,7 +3634,7 @@ sub detailed_citation_view { $result .= ''.&mt($field->{'translate'}).''; foreach my $item (split(',',$values{$field->{'name'}})){ $item = &Apache::lonnet::clutter($item); - $result .= &display_url($item,[2,0,1]); + $result .= '
'.&display_url($item,1).'
'; } } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ $result.= &mt($field->{'translate'}, @@ -3549,7 +3642,7 @@ sub detailed_citation_view { $values{$field->{'name'}}))."
\n"; } else { if ($field->{'special'} eq 'url link') { - $result .= &display_url($jumpurl,[3,0,1]); + $result .= '
'.&display_url($jumpurl,1).'
'; } else { $result.= &mt($field->{'translate'}, $values{$field->{'name'}}); @@ -3603,11 +3696,18 @@ sub summary_view { } my $jumpurl=$values{'url'}; $jumpurl=~s|^/ext/|http://|; - my $link = &display_url($jumpurl,[2,0,1]); + 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'}
@@ -3639,7 +3739,7 @@ sub compact_view { my $jumpurl=$values{'url'}; $jumpurl=~s|^/ext/|http://|; - my $link = &display_url($jumpurl,[1,1,1]); + my $link = &display_url($jumpurl,1); my $result = $prefix.''; @@ -3653,12 +3753,17 @@ sub compact_view { $result.=' '. ''. &HTML::Entities::encode($values{'title'},'<>&"').' '. + ''. + ''. + ''. $link.' '.$values{'author'}.' ('.$values{'domain'}.')'; return $result; } sub display_url { - my ($url,$crumb_args) = @_; + my ($url,$skiplast) = @_; my $link; if ($url=~m|^/ext/|) { $url=~s|^/ext/|http://|; @@ -3666,10 +3771,12 @@ sub display_url { } elsif ($url=~m{^(http://|/uploaded/)}) { $link=''.$url.''; } else { - $link=&Apache::lonhtmlcommon::crumbs($url, - 'preview', - '', - (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),@{$crumb_args}).' '; + $link=&Apache::lonhtmlcommon::crumbs( + $url, + 'preview', + '', + (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''), + $skiplast).' '; } return $link; } @@ -3692,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',