version 1.300, 2008/10/16 22:58:15
|
version 1.307, 2009/05/15 14:48:42
|
Line 519 sub course_search {
|
Line 519 sub course_search {
|
my $totaldiscussions = 0; |
my $totaldiscussions = 0; |
$r->print('<br /><br /><b>'.&mt('Discussion postings').':</b><br />'); |
$r->print('<br /><br /><b>'.&mt('Discussion postings').':</b><br />'); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my $navmap = Apache::lonnavmaps::navmap->new(); |
my @allres=$navmap->retrieveResources(); |
if (defined($navmap)) { |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
my @allres=$navmap->retrieveResources(); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
my %discussiontime = &Apache::lonnet::dump('discussiontimes', |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
foreach my $resource (@allres) { |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
my $result = ''; |
foreach my $resource (@allres) { |
my $applies = 0; |
my $result = ''; |
my $symb = $resource->symb(); |
my $applies = 0; |
my $ressymb = $symb; |
my $symb = $resource->symb(); |
if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) { |
my $ressymb = $symb; |
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) { |
unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { |
$ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; |
$ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; |
unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { |
|
$ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; |
|
} |
} |
} |
} |
if (defined($discussiontime{$ressymb})) { |
if (defined($discussiontime{$ressymb})) { |
my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'}, |
my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.domain'}, |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
$env{'course.'.$env{'request.course.id'}.'.num'}); |
if ($contrib{'version'}) { |
if ($contrib{'version'}) { |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
for (my $id=1;$id<=$contrib{'version'};$id++) { |
unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) { |
unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) { |
if ($contrib{$id.':subject'}) { |
if ($contrib{$id.':subject'}) { |
$result .= $contrib{$id.':subject'}; |
$result .= $contrib{$id.':subject'}; |
|
} |
|
if ($contrib{$id.':message'}) { |
|
$result .= $contrib{$id.':message'}; |
|
} |
|
if ($contrib{$id,':attachmenturl'}) { |
|
if ($contrib{$id,':attachmenturl'} =~ m-/([^/]+)$-) { |
|
$result .= $1; |
|
} |
} |
|
if ($contrib{$id.':message'}) { |
|
$result .= $contrib{$id.':message'}; |
|
} |
|
if ($contrib{$id,':attachmenturl'}) { |
|
if ($contrib{$id,':attachmenturl'} =~ m-/([^/]+)$-) { |
|
$result .= $1; |
|
} |
|
} |
|
$applies = &checkwords($result,$applies,@allwords); |
} |
} |
$applies = &checkwords($result,$applies,@allwords); |
|
} |
} |
} |
} |
} |
} |
} |
|
# Does this discussion apply? |
# Does this discussion apply? |
if ($applies) { |
if ($applies) { |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb); |
my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb); |
my $disctype = &mt('resource'); |
my $disctype = &mt('resource'); |
if ($url =~ m#/bulletinboard$#) { |
if ($url =~ m#/bulletinboard$#) { |
if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) { |
if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) { |
$url =~s#^adm/wrapper##; |
$url =~s#^adm/wrapper##; |
|
} |
|
$disctype = &mt('discussion board'); |
|
} else { |
|
$url = '/res/'.$url; |
} |
} |
$disctype = &mt('bulletin board'); |
if ($url =~ /\?/) { |
} else { |
$url .= '&symb='; |
$url = '/res/'.$url; |
} else { |
} |
$url .= '?symb='; |
if ($url =~ /\?/) { |
} |
$url .= '&symb='; |
$url .= &escape($resource->symb()); |
|
my $title = $resource->compTitle(); |
|
$r->print('<br /><a href="'.$url.'" target="cat">'. |
|
($title?$title:$url).'</a> - '. |
|
$disctype.'<br />'); |
|
$totaldiscussions++; |
} else { |
} else { |
$url .= '?symb='; |
$r->print(' .'); |
} |
} |
$url .= &escape($resource->symb()); |
|
my $title = $resource->compTitle(); |
|
$r->print('<br /><a href="'.$url.'" target="cat">'. |
|
($title?$title:$url).'</a> - '.$disctype.'<br />'); |
|
$totaldiscussions++; |
|
} else { |
|
$r->print(' .'); |
|
} |
} |
} |
unless ($totaldiscussions) { |
unless ($totaldiscussions) { |
$r->print('<p>'.&mt('No matches found in postings').'.</p>'); |
$r->print('<p>'.&mt('No matches found in postings').'.</p>'); |
} |
|
} 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>'); |
} |
} |
} |
} |
|
|
Line 685 sub print_basic_search_form {
|
Line 690 sub print_basic_search_form {
|
my $bread_crumb = |
my $bread_crumb = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', |
$env{'form.catalogmode'} ne 'import'); |
$env{'form.catalogmode'} ne 'import'); |
my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb; |
my $scrout = &Apache::loncommon::start_page('Content Library').$bread_crumb; |
# Search form for resource space |
# Search form for resource space |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { |
if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { |
$scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton); |
$scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton); |
Line 699 sub print_basic_search_form {
|
Line 704 sub print_basic_search_form {
|
'note' => 'Enter terms or phrases, then press "Search" below', |
'note' => 'Enter terms or phrases, then press "Search" below', |
'use' => 'use related words', |
'use' => 'use related words', |
'full' =>'fulltext search (time consuming)', |
'full' =>'fulltext search (time consuming)', |
'disc' => 'search discussion postings (resources and bulletin boards)', |
'disc' => 'search discussion postings (resources and discussion boards)', |
); |
); |
$scrout.=(<<ENDCOURSESEARCH); |
$scrout.=(<<ENDCOURSESEARCH); |
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
<form name="loncapa_search" method="post" action="/adm/searchcat"> |
Line 794 sub setup_basic_search {
|
Line 799 sub setup_basic_search {
|
'<br />'. |
'<br />'. |
'<font size="-1">'.&searchhelp().'</font>'.'</td>'. |
'<font size="-1">'.&searchhelp().'</font>'.'</td>'. |
'<td><font size="-1">'. |
'<td><font size="-1">'. |
'<nobr>'.(' 'x3).$adv_search_link.'</nobr>'.'<br />'. |
'<span class="LC_nobreak">'.(' 'x3).$adv_search_link.'</span>'.'<br />'. |
'<nobr>'.(' 'x1).$userelatedwords.'</nobr>'.'<br />'. |
'<span class="LC_nobreak">'.(' 'x1).$userelatedwords.'</span>'.'<br />'. |
'<nobr>'.(' 'x1).$onlysearchdomain.'</nobr>'.'<br />'. |
'<span class="LC_nobreak">'.(' 'x1).$onlysearchdomain.'</span>'.'<br />'. |
'<nobr>'.(' 'x1).$inclext.'</nobr>'.'<br />'. |
'<span class="LC_nobreak">'.(' 'x1).$inclext.'</span>'.'<br />'. |
'</font></td>'. |
'</font></td>'. |
'</tr>'.$/; |
'</tr>'.$/; |
# |
# |
Line 1154 Outputs: text for box with view options
|
Line 1159 Outputs: text for box with view options
|
###################################################################### |
###################################################################### |
###################################################################### |
###################################################################### |
sub viewoptions { |
sub viewoptions { |
my $scrout; |
my $scrout = '<span class="LC_nobreak">'; |
if (! defined($env{'form.viewselect'})) { |
if (! defined($env{'form.viewselect'})) { |
$env{'form.viewselect'}='detailed'; |
$env{'form.viewselect'}='detailed'; |
} |
} |
Line 1167 sub viewoptions {
|
Line 1172 sub viewoptions {
|
$env{'form.show'}, |
$env{'form.show'}, |
undef, |
undef, |
(10,20,50,100,1000,10000)); |
(10,20,50,100,1000,10000)); |
$scrout .= (' 'x2).&mt('[_1] Records per Page',$countselect). |
$scrout .= (' 'x2) |
'</nobr>'.$/; |
.&mt('[_1] Records per Page',$countselect) |
|
.'</span>'.$/; |
return $scrout; |
return $scrout; |
} |
} |
|
|
Line 2242 sub print_sort_form {
|
Line 2248 sub print_sort_form {
|
</script> |
</script> |
END |
END |
|
|
my $start_page = &Apache::loncommon::start_page('Results',$js, |
my $start_page = &Apache::loncommon::start_page('Results',$js); |
{'no_title' => 1}); |
|
my $breadcrumbs= |
my $breadcrumbs= |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
$env{'form.catalogmode'} ne 'import'); |
$env{'form.catalogmode'} ne 'import'); |
Line 2481 sub run_search {
|
Line 2486 sub run_search {
|
# |
# |
# Print run_search header |
# Print run_search header |
# |
# |
my $start_page = &Apache::loncommon::start_page('Search Status',undef, |
my $start_page = &Apache::loncommon::start_page('Search Status',undef); |
{'no_title' => 1}); |
|
my $breadcrumbs = |
my $breadcrumbs = |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', |
$env{'form.catalogmode'} ne 'import'); |
$env{'form.catalogmode'} ne 'import'); |
Line 2894 sub display_results {
|
Line 2898 sub display_results {
|
## Output links (if necessary) for 'prev' and 'next' pages. |
## Output links (if necessary) for 'prev' and 'next' pages. |
$r->print |
$r->print |
('<table width="100%"><tr><td width="25%" align="right">'. |
('<table width="100%"><tr><td width="25%" align="right">'. |
'<nobr>'.$sortform.'</nobr>'. |
'<span class="LC_nobreak">'.$sortform.'</span>'. |
'</td><td width="25%" align="right">'. |
'</td><td width="25%" align="right">'. |
&prev_next_buttons($min,$env{'form.show'},$total_results). |
&prev_next_buttons($min,$env{'form.show'},$total_results). |
'</td><td align="right">'. |
'</td><td align="right">'. |
Line 3555 sub compact_view {
|
Line 3559 sub compact_view {
|
my $link = &display_url($jumpurl,[1,1,1]); |
my $link = &display_url($jumpurl,[1,1,1]); |
|
|
my $result = |
my $result = |
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">'; |
$prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'; |
if (exists($env{'form.sortfield'}) && |
if (exists($env{'form.sortfield'}) && |
$env{'form.sortfield'} !~ /^(default|author|url|title)$/) { |
$env{'form.sortfield'} !~ /^(default|author|url|title)$/) { |
my $tmp = $values{$env{'form.sortfield'}}; |
my $tmp = $values{$env{'form.sortfield'}}; |