version 1.311, 2009/07/03 08:18:48
|
version 1.312, 2009/07/31 10:58:57
|
Line 524 sub course_search {
|
Line 524 sub course_search {
|
untie(%hash); |
untie(%hash); |
} |
} |
unless ($totalfound) { |
unless ($totalfound) { |
$r->print('<p>'.&mt('No matches found in resources').'.</p>'); |
$r->print('<p class="LC_info">'.&mt('No matches found in resources.').'</p>'); |
} |
} |
|
|
# Check discussions if requested |
# Check discussions if requested |
Line 599 sub course_search {
|
Line 599 sub course_search {
|
} |
} |
} |
} |
unless ($totaldiscussions) { |
unless ($totaldiscussions) { |
$r->print('<p>'.&mt('No matches found in postings').'.</p>'); |
$r->print('<p class="LC_info">'.&mt('No matches found in postings.').'</p>'); |
} |
} |
} else { |
} else { |
$r->print('<div class="LC_error">'.&mt('An error occurred retrieving information about resources in the course.').'<br />'.&mt('It is recommended that you [_1]re-initialize the course[_2] and then try your search again.','<a href="/adm/roles">','</a>').'</div>'); |
$r->print('<div class="LC_error">'.&mt('An error occurred retrieving information about resources in the course.').'<br />'.&mt('It is recommended that you [_1]re-initialize the course[_2] and then try your search again.','<a href="/adm/roles">','</a>').'</div>'); |
Line 729 $hidden_fields
|
Line 729 $hidden_fields
|
<p> |
<p> |
$lt{'note'}. |
$lt{'note'}. |
</p> |
</p> |
<p> |
|
<table> |
<table> |
<tr><td> |
<tr><td> |
ENDCOURSESEARCH |
ENDCOURSESEARCH |
Line 750 ENDCOURSESEARCH
|
Line 749 ENDCOURSESEARCH
|
<tr><td><label>$relcheckbox $lt{'use'}</label></td><td></td></tr> |
<tr><td><label>$relcheckbox $lt{'use'}</label></td><td></td></tr> |
<tr><td><label>$crscheckbox $lt{'full'}</label></td><td></td></tr> |
<tr><td><label>$crscheckbox $lt{'full'}</label></td><td></td></tr> |
<tr><td><label>$discheckbox $lt{'disc'}</label></td><td></td></tr> |
<tr><td><label>$discheckbox $lt{'disc'}</label></td><td></td></tr> |
</table><p> |
</table> |
<input type="submit" name="coursesubmit" value='$lt{'srch'}' /> |
<p> |
|
<input type="submit" name="coursesubmit" value='$lt{'srch'}' /> |
</p> |
</p> |
</center> |
</center> |
</form> |
</form> |
Line 2761 sub display_results {
|
Line 2761 sub display_results {
|
## |
## |
my $viewfunction = $Views{$env{'form.viewselect'}}; |
my $viewfunction = $Views{$env{'form.viewselect'}}; |
if (!defined($viewfunction)) { |
if (!defined($viewfunction)) { |
$r->print("Internal Error - Bad view selected.\n"); |
$r->print('<p class="LC_error">' |
|
.&mt('Internal Error - Bad view selected.') |
|
.'</p>'."\n"); |
$r->rflush(); |
$r->rflush(); |
return; |
return; |
} |
} |
Line 2778 sub display_results {
|
Line 2780 sub display_results {
|
if ($env{'form.catalogmode'} eq 'import') { |
if ($env{'form.catalogmode'} eq 'import') { |
if (! tie(%groupsearch_db,'GDBM_File',$diropendb, |
if (! tie(%groupsearch_db,'GDBM_File',$diropendb, |
&GDBM_WRCREAT(),0640)) { |
&GDBM_WRCREAT(),0640)) { |
$r->print('Unable to save import results.</form>'. |
$r->print('<p class="LC_error">'. |
|
&mt('Unable to save import results.'). |
|
'</p>'. |
|
'</form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
$r->rflush(); |
$r->rflush(); |
return; |
return; |
Line 2792 sub display_results {
|
Line 2797 sub display_results {
|
## Get the number of results |
## Get the number of results |
my $total_results = &Apache::lonmysql::number_of_rows($table); |
my $total_results = &Apache::lonmysql::number_of_rows($table); |
if (! defined($total_results)) { |
if (! defined($total_results)) { |
$r->print("A MySQL error has occurred.</form>". |
$r->print('<p class="LC_error">'. |
|
&mt('A MySQL error has occurred.'). |
|
'</p>'. |
|
'</form>'. |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
&Apache::lonnet::logthis("lonmysql was unable to determine the number". |
&Apache::lonnet::logthis("lonmysql was unable to determine the number". |
" of rows in table ".$table); |
" of rows in table ".$table); |
Line 2919 sub display_results {
|
Line 2927 sub display_results {
|
); |
); |
if ($total_results == 0) { |
if ($total_results == 0) { |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2" />'. |
$r->print('<meta HTTP-EQUIV="Refresh" CONTENT="2" />'. |
'<h3>'.&mt('There are currently no results').'.</h3>'. |
'<p class="LC_info">'.&mt('There are currently no results').'.</p>'. |
"</form>". |
"</form>". |
&Apache::loncommon::end_page()); |
&Apache::loncommon::end_page()); |
return; |
return; |
} else { |
} else { |
$r->print('<center>'. |
$r->print('<div>'. |
mt('Results [_1] to [_2] out of [_3]', |
mt('Results [_1] to [_2] out of [_3]', |
$min,$max,$total_results). |
$min,$max,$total_results). |
"</center>\n"); |
"</div>\n"); |
} |
} |
## |
## |
## Get results from MySQL table |
## Get results from MySQL table |
Line 2957 sub display_results {
|
Line 2965 sub display_results {
|
if ($area eq 'portfolio') { |
if ($area eq 'portfolio') { |
$tabletype = 'portfolio_search'; |
$tabletype = 'portfolio_search'; |
} |
} |
|
$r->print(&Apache::loncommon::start_data_table()); |
foreach my $row (@Results) { |
foreach my $row (@Results) { |
if ($connection->aborted()) { |
if ($connection->aborted()) { |
&cleanup(); |
&cleanup(); |
return; |
return; |
} |
} |
my %Fields = %{&parse_row($tabletype,@$row)}; |
my %Fields = %{&parse_row($tabletype,@$row)}; |
my $output="<p>\n"; |
my $output; |
if (! defined($Fields{'title'}) || $Fields{'title'} eq '') { |
if (! defined($Fields{'title'}) || $Fields{'title'} eq '') { |
$Fields{'title'} = 'Untitled'; |
$Fields{'title'} = 'Untitled'; |
} |
} |
Line 2972 sub display_results {
|
Line 2981 sub display_results {
|
# Render the result into html |
# Render the result into html |
$output.= &$viewfunction($prefix,%Fields); |
$output.= &$viewfunction($prefix,%Fields); |
# Print them out as they come in. |
# Print them out as they come in. |
$r->print($output); |
$r->print(&Apache::loncommon::start_data_table_row() |
|
.'<td>' |
|
.$output |
|
.'</td>' |
|
.&Apache::loncommon::end_data_table_row() |
|
); |
$r->rflush(); |
$r->rflush(); |
} |
} |
|
$r->print(&Apache::loncommon::end_data_table()); |
if (@Results < 1) { |
if (@Results < 1) { |
$r->print(&mt("There were no results matching your query")); |
$r->print('<p class="LC_info">' |
|
.&mt('There were no results matching your query.') |
|
.'</p>'); |
} else { |
} else { |
$r->print |
$r->print |
('<center>'. |
('<center>'. |
Line 3395 sub detailed_citation_view {
|
Line 3412 sub detailed_citation_view {
|
my $jumpurl=$values{'url'}; |
my $jumpurl=$values{'url'}; |
$jumpurl=~s|^/ext/|http://|; |
$jumpurl=~s|^/ext/|http://|; |
$result .= '<b>'.$prefix. |
$result .= '<b>'.$prefix. |
'<img src="'.&Apache::loncommon::icon($values{'url'}).'" />'.' '. |
'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.' '. |
'<a href="'.$jumpurl.'?inhibitmenu=yes" '. |
'<a href="'.$jumpurl.'?inhibitmenu=yes" '. |
'target="preview">'.$values{'title'}."</a></b>\n"; |
'target="preview">'.$values{'title'}."</a></b>\n"; |
$result .= "<p>\n"; |
$result .= "<p>\n"; |
Line 3487 sub detailed_citation_view {
|
Line 3504 sub detailed_citation_view {
|
if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { |
if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { |
$result .= '<p>'.$values{'shortabstract'}.'</p>'; |
$result .= '<p>'.$values{'shortabstract'}.'</p>'; |
} |
} |
$result .= '<hr />'."\n"; |
|
return $result; |
return $result; |
} |
} |
|
|
sub detailed_citation_preview { |
sub detailed_citation_preview { |
my ($prefix,%values)=@_; |
my ($prefix,%values)=@_; |
return '<table><tr><td>'. |
return &detailed_citation_view($prefix,%values). |
&detailed_citation_view($prefix,%values). |
|
'</td><td>'. |
'</td><td>'. |
&Apache::lonindexer::showpreview($values{'url'}). |
&Apache::lonindexer::showpreview($values{'url'}); |
'</td></tr></table><hr />'; |
|
} |
} |
|
|
|
|
Line 3514 sub detailed_citation_preview {
|
Line 3528 sub detailed_citation_preview {
|
sub summary_view { |
sub summary_view { |
my ($prefix,%values) = @_; |
my ($prefix,%values) = @_; |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $icon=&Apache::loncommon::icon($values{'url'}); |
my $result=qq{$prefix<img src="$icon" />}; |
my $result=qq{$prefix<img src="$icon" alt="" />}; |
if (exists($env{'form.sortfield'}) && |
if (exists($env{'form.sortfield'}) && |
$env{'form.sortfield'} !~ /^(default| |
$env{'form.sortfield'} !~ /^(default| |
author| |
author| |
Line 3533 sub summary_view {
|
Line 3547 sub summary_view {
|
|
|
$result.=<<END; |
$result.=<<END; |
<a href="$jumpurl?inhibitmenu=yes" |
<a href="$jumpurl?inhibitmenu=yes" |
target='preview'>$values{'title'}</a> <br /> |
target="preview">$values{'title'}</a><br /> |
$link <br /> |
$link<br /> |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'extrashow'} |
$values{'extrashow'} |
</p> |
|
<hr /> |
|
END |
END |
return $result; |
return $result; |
} |
} |
|
|
sub summary_preview { |
sub summary_preview { |
my ($prefix,%values)=@_; |
my ($prefix,%values)=@_; |
return '<table><tr><td>'. |
return &summary_view($prefix,%values). |
&summary_view($prefix,%values). |
|
'</td><td>'. |
'</td><td>'. |
&Apache::lonindexer::showpreview($values{'url'}). |
&Apache::lonindexer::showpreview($values{'url'}); |
'</td></tr></table><hr />'; |
|
} |
} |
|
|
###################################################################### |
###################################################################### |
Line 3583 sub compact_view {
|
Line 3593 sub compact_view {
|
$result.=' <span class="LC_nobreak">'. |
$result.=' <span class="LC_nobreak">'. |
'<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'. |
'<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'. |
&HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '. |
&HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '. |
$link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />'; |
$link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')'; |
return $result; |
return $result; |
} |
} |
|
|
Line 3623 sub fielded_format_view {
|
Line 3633 sub fielded_format_view {
|
$jumpurl=~s|^/ext/|http://|; |
$jumpurl=~s|^/ext/|http://|; |
|
|
my $result=<<END; |
my $result=<<END; |
$prefix <img src="$icon" /> |
$prefix <img src="$icon" alt="" /> |
<dl> |
<dl> |
<dt>URL:</dt> |
<dt>URL:</dt> |
<dd><a href="$jumpurl?inhibitmenu=yes" |
<dd><a href="$jumpurl?inhibitmenu=yes" |
Line 3649 END
|
Line 3659 END
|
} |
} |
$result .= "</dl>\n"; |
$result .= "</dl>\n"; |
$result .= $values{'extrashow'}; |
$result .= $values{'extrashow'}; |
$result .= '<hr />'."\n"; |
|
return $result; |
return $result; |
} |
} |
|
|
Line 3723 $prefix
|
Line 3732 $prefix
|
$xml |
$xml |
</pre> |
</pre> |
$values{'extrashow'} |
$values{'extrashow'} |
<hr /> |
|
END |
END |
return $result; |
return $result; |
} |
} |
Line 3763 sub output_unparsed_phrase_error {
|
Line 3771 sub output_unparsed_phrase_error {
|
my ($r,$closebutton,$parms,$hidden_fields,$field)=@_; |
my ($r,$closebutton,$parms,$hidden_fields,$field)=@_; |
my $errorstring; |
my $errorstring; |
if ($field eq 'basicexp') { |
if ($field eq 'basicexp') { |
$errorstring = &mt('Unable to understand the search phrase <i>[_1]</i>. Please modify your search.',$env{'form.basicexp'}); |
$errorstring = &mt('Unable to understand the search phrase [_1]. Please modify your search.' |
|
,'<i>'.$env{'form.basicexp'}.'</i>'); |
} else { |
} else { |
$errorstring = &mt('Unable to understand the search phrase <b>[_1]</b>:<i>[_2]</i>.',$field,$env{'form.'.$field}); |
$errorstring = &mt('Unable to understand the search phrase [_1]: [_2]' |
|
,'<i>'.$field.'</i>' |
|
,$env{'form.'.$field}); |
} |
} |
my $heading = &mt('Unparsed Field'); |
my $heading = &mt('Unparsed Field'); |
my $revise = &mt('Revise search request'); |
my $revise = &mt('Revise search request'); |
Line 3779 $hidden_fields
|
Line 3790 $hidden_fields
|
$closebutton |
$closebutton |
<hr /> |
<hr /> |
<h2>$heading</h2> |
<h2>$heading</h2> |
<p> |
<p class="LC_warning"> |
$errorstring |
$errorstring |
</p> |
</p> |
<p> |
<p> |
Line 3811 $parms is extra information to include i
|
Line 3822 $parms is extra information to include i
|
###################################################################### |
###################################################################### |
sub output_blank_field_error { |
sub output_blank_field_error { |
my ($r,$closebutton,$parms,$hidden_fields)=@_; |
my ($r,$closebutton,$parms,$hidden_fields)=@_; |
my $errormsg = &mt('You did not fill in enough information for the search to be started. You need to fill in relevant fields on the search page in order for a query to be processed.'); |
my $errormsg = &mt('You did not fill in enough information for the search to be started. You need to fill in relevant fields on the search page in order for a query to be processed.'); |
my $revise = &mt('Revise Search Request'); |
my $revise = &mt('Revise Search Request'); |
my $heading = &mt('Unactionable Search Queary'); |
my $heading = &mt('Unactionable Search Queary'); |
my $start_page = &Apache::loncommon::start_page('Search'); |
my $start_page = &Apache::loncommon::start_page('Search'); |
Line 3823 $hidden_fields
|
Line 3834 $hidden_fields
|
$closebutton |
$closebutton |
<hr /> |
<hr /> |
<h2>$heading</h2> |
<h2>$heading</h2> |
<p> |
<p class="LC_warning"> |
$errormsg |
$errormsg |
</p> |
</p> |
<p> |
<p> |
Line 3858 sub output_date_error {
|
Line 3869 sub output_date_error {
|
# make query information persistent to allow for subsequent revision |
# make query information persistent to allow for subsequent revision |
my $start_page = &Apache::loncommon::start_page('Search'); |
my $start_page = &Apache::loncommon::start_page('Search'); |
my $end_page = &Apache::loncommon::end_page(); |
my $end_page = &Apache::loncommon::end_page(); |
|
my $heading = &mt('Error'); |
$r->print(<<RESULTS); |
$r->print(<<RESULTS); |
$start_page |
$start_page |
<form method="post" action="/adm/searchcat"> |
<form method="post" action="/adm/searchcat"> |
Line 3865 $hidden_fields
|
Line 3877 $hidden_fields
|
<input type='button' value='Revise search request' |
<input type='button' value='Revise search request' |
onClick='this.form.submit();' /> |
onClick='this.form.submit();' /> |
$closebutton |
$closebutton |
|
</form> |
<hr /> |
<hr /> |
<h3>Error</h3> |
<h3>$heading</h3> |
<p> |
<p class="LC_error"> |
$message |
$message |
</p> |
</p> |
$end_page |
$end_page |