--- loncom/interface/lonsearchcat.pm 2003/09/22 00:48:32 1.186 +++ loncom/interface/lonsearchcat.pm 2003/12/11 20:59:54 1.194 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.186 2003/09/22 00:48:32 www Exp $ +# $Id: lonsearchcat.pm,v 1.194 2003/12/11 20:59:54 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -200,7 +200,7 @@ sub handler { &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['catalogmode','launch','acts','mode','form','element','pause', 'phase','persistent_db_id','table','start','show', - 'cleargroupsort']); + 'cleargroupsort','titleelement']); ## ## The following is a trick - we wait a few seconds if asked to so ## the daemon running the search can get ahead of the daemon @@ -282,6 +282,10 @@ END $hidden_fields .= ''."\n"; } + if (exists($ENV{'form.titleelement'})) { + $hidden_fields .= ''."\n"; + } if (exists($ENV{'form.mode'})) { $hidden_fields .= ''."\n"; @@ -441,7 +445,7 @@ sub course_search { } &untiehash(); unless ($totalfound) { - $r->print('

No resources found.

'); + $r->print('

'.&mt('No resources found').'.

'); } # =================================================== Done going through course $r->print(''); @@ -541,14 +545,15 @@ sub print_basic_search_form{ $bodytag ENDDOCUMENT if (&Apache::lonnet::allowed('bre',$ENV{'request.role.domain'})) { + my $CatalogSearch=&mt('Catalog Search'); + my $Statement=&mt('Enter terms or phrases separated by AND, OR, or NOT then press SEARCH below'); $scrout.=(<Catalog Search +

$CatalogSearch

$hidden_fields

-Enter terms or phrases separated by AND, OR, or NOT -then press SEARCH below. +$Statement.

@@ -559,41 +564,49 @@ ENDDOCUMENT my $relatedcheckbox = &simplecheckbox('related',$ENV{'form.related'}); my $domain = $r->dir_config('lonDefDomain'); my $domaincheckbox = &simplecheckbox('domains',$domain); + my $srch=&mt('Search'); + my $header=&mt('Advanced Search'); + my $userelatedwords=&mt('use related words'); + my $onlysearchdomain=&mt('only search domain'); $scrout.=< - - +href="/adm/searchcat?phase=disp_adv&catalogmode=$ENV{'form.catalogmode'}&launch=$ENV{'form.launch'}&mode=$ENV{'form.mode'}" +>$header + +
Advanced Search
$relatedcheckbox use related words$domaincheckbox only search domain $domain
$relatedcheckbox $userelatedwords$domaincheckbox $onlysearchdomain $domain

  +   $closebutton END - $scrout.=&selectbox(undef,'viewselect', + $scrout.=&selectbox('View','viewselect', $ENV{'form.viewselect'}, undef,undef,undef, sort(keys(%Views))); - $scrout.=&selectbox(undef,'show', + $scrout.=&selectbox('Per Page','show', $ENV{'form.show'}, undef,undef,undef, (10,20,50,100)); $scrout.=< ENDDOCUMENT } if ($ENV{'request.course.id'}) { + my %lt=&Apache::lonlocal::texthash( + 'srch' => 'Search', + 'header' => 'Course Search', + 'note' => 'Enter terms or phrases, then press "Search" below', + ); $scrout.=(< -

Course Search

+

$lt{'header'}

$hidden_fields

-Enter terms or phrases, then press SEARCH below. +$lt{'note'}.

@@ -610,7 +623,7 @@ ENDCOURSESEARCH
$relcheckbox use related words
$crscheckbox fulltext search (time consuming)

ENDENDCOURSE } @@ -682,8 +695,8 @@ ENDHEADER undef,undef,undef, (10,20,50,100)); $scrout.=' '. - 'Per Page'; - $scrout.="Related
Words\n"; + ''.&mt('Per Page').''; + $scrout.="".&mt('Related').'
'.&mt('Words')."\n"; $scrout.=&searchphrasefield_with_related('title', 'title' , $ENV{'form.title'}); $scrout.=&searchphrasefield('author', 'author' ,$ENV{'form.author'}); @@ -1058,7 +1071,7 @@ field heading. ############################################### sub fieldtitle { - my $title = uc(shift()); + my $title = uc(&mt(shift())); return ''.$title. ': '; } @@ -1153,7 +1166,7 @@ END my $i = 1; foreach (qw/January February March April May June July August September October November December /){ - $month .="\n"; + $month .="\n"; $i++; } $month.="\n"; @@ -1241,12 +1254,12 @@ sub selectbox { foreach (@idlist) { $selout.=''; } elsif ($_ eq $default and /^$anyvalue$/) { - $selout.=' selected >'.$anytag.''; + $selout.=' selected >'.&mt($anytag).''; } - else {$selout.='>'.&{$functionref}($_).'';} + else {$selout.='>'.&mt(&{$functionref}($_)).'';} } return $selout.''.(defined($title)?'

':' '); } @@ -1841,8 +1854,8 @@ sub ensure_db_and_table { sub print_sort_form { my ($r,$pretty_query_string) = @_; ## - my %SortableFields = - (id => 'Default', + my %SortableFields=&Apache::lonlocal::texthash( + id => 'Default', title => 'Title', author => 'Author', subject => 'Subject', @@ -1854,7 +1867,7 @@ sub print_sort_form { copyright => 'Copyright', hostname => 'Host', creationdate => 'Creation Date', - lastrevisiondate => 'Revision Date', + lastrevisiondate => 'Revision Date' ); ## my $table = $ENV{'form.table'}; @@ -2108,7 +2121,7 @@ END if (@Lines > 2) { $pretty_string = join '
',(@Lines[0..2],'....
'); } - $r->print("Search: ".$pretty_string); + $r->print(&mt("Search").": ".$pretty_string); $r->rflush(); # # Determine the servers we need to contact. @@ -2174,7 +2187,7 @@ END if (@Servers_to_contact) { # Contact one server my $server = shift(@Servers_to_contact); - &update_status($r,'contacting '.$server); + &update_status($r,&mt('contacting').' '.$server); my $reply=&Apache::lonnet::metadata_query($query,$customquery, $customshow,[$server]); ($server) = keys(%$reply); @@ -2186,7 +2199,7 @@ END # left to contact. if (scalar (keys(%Server_status))) { &update_status($r, - 'waiting on '.(join(' ',keys(%Server_status)))); + &mt('waiting on').' '.(join(' ',keys(%Server_status)))); } sleep(1); } @@ -2203,12 +2216,12 @@ END $status=~/^([\.\w]+)$/; my $datafile=$r->dir_config('lonDaemons').'/tmp/'.$1; if (-e $datafile && ! -e "$datafile.end") { - &update_status($r,'Receiving results from '.$server); + &update_status($r,&mt('Receiving results from').' '.$server); next; } last if ($connection->aborted()); if (-e "$datafile.end") { - &update_status($r,'Reading results from '.$server); + &update_status($r,&mt('Reading results from').' '.$server); if (-z "$datafile") { delete($Server_status{$server}); next; @@ -2263,7 +2276,7 @@ END &update_seconds($r,$time_remaining); } } - &update_status($r,'Search Complete'.$server); + &update_status($r,&mt('Search Complete').$server); &update_seconds($r,0); &Apache::lonmysql::disconnect_from_db(); # We have run out of time or run out of servers to talk to and @@ -2408,7 +2421,7 @@ sub display_results { ); if ($total_results == 0) { $r->print(''. - '

There are currently no results.

'. + '

'.&mt('There are currently no results').'.

'. "
"); return; } else { @@ -2439,7 +2452,7 @@ sub display_results { $r->rflush(); } if (@Results < 1) { - $r->print("There were no results matching your query"); + $r->print(&mt("There were no results matching your query")); } else { $r->print ('
'. @@ -2682,8 +2695,16 @@ Checked for existance & 'edit' mode. =item 'form.form' +Contains the name of the form that has the input fields to set + =item 'form.element' +the name of the input field to put the URL into + +=item 'form.titleelement' + +the name of the input field to put the title into + =back =cut @@ -2720,14 +2741,31 @@ SCRIPT } elsif ($ENV{'form.mode'} eq 'edit') { my $form = $ENV{'form.form'}; my $element = $ENV{'form.element'}; + my $titleelement = $ENV{'form.titleelement'}; + my $changetitle; + if (!$titleelement) { + $changetitle='function changeTitle(val) {}'; + } else { + $changetitle=< function select_data(title,url) { changeURL(url); + changeTitle(title); parent.close(); } -function changeTitle(val) { -} +$changetitle function changeURL(val) { if (parent.targetwin.document) { parent.targetwin.document.forms["$form"].elements["$element"].value=val; @@ -2845,8 +2883,9 @@ extra custom metadata to show. ###################################################################### sub detailed_citation_view { my ($prefix,%values) = @_; + my $icon=&Apache::loncommon::icon($values{'url'}); my $result=<$prefix$prefix$values{'title'}

$values{'author'}, $values{'owner'}
@@ -2879,8 +2918,9 @@ END ###################################################################### sub summary_view { my ($prefix,%values) = @_; + my $icon=&Apache::loncommon::icon($values{'url'}); my $result=<$values{'author'}
$values{'title'}
$values{'owner'} -- $values{'lastrevisiondate'}
@@ -2905,8 +2945,9 @@ END ###################################################################### sub compact_view { my ($prefix,%values) = @_; + my $icon=&Apache::loncommon::icon($values{'url'}); my $result=< +$prefix $values{'title'} $values{'author'}
END @@ -2927,8 +2968,9 @@ END ###################################################################### sub fielded_format_view { my ($prefix,%values) = @_; + my $icon=&Apache::loncommon::icon($values{'url'}); my $result=< URL: $values{'url'}
@@ -3148,7 +3190,6 @@ sub start_fresh_session { sub cleanup { if (tied(%groupsearch_db)) { - &Apache::lonnet::logthis('Cleanup searchcat: groupsearch_db'); unless (untie(%groupsearch_db)) { &Apache::lonnet::logthis('Failed cleanup searchcat: groupsearch_db'); }