version 1.301, 2008/12/11 14:55:15
|
version 1.309, 2009/07/02 17:05:31
|
Line 191 sub handler {
|
Line 191 sub handler {
|
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/searchcat?'. |
({href=>'/adm/searchcat?'. |
&Apache::loncommon::inhibit_menu_check(). |
&Apache::loncommon::inhibit_menu_check(). |
'&catalogmode='.$env{'form.catalogmode'}. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}, |
'&mode='.$env{'form.mode'}, |
text=>"$crumb_text", |
text=>"$crumb_text", |
target=>'_top', |
target=>'_top', |
bug=>'Searching',}); |
bug=>'Searching',}); |
Line 314 END
|
Line 314 END
|
} |
} |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). |
({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). |
'&phase=disp_adv'. |
'&phase=disp_adv'. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}, |
'&mode='.$env{'form.mode'}, |
text=>"Advanced $srchtype Search", |
text=>"Advanced $srchtype Search", |
bug=>'Searching',}); |
bug=>'Searching',}); |
} elsif ($env{'form.searchmode'} eq 'course search') { |
} elsif ($env{'form.searchmode'} eq 'course search') { |
&Apache::lonhtmlcommon::add_breadcrumb |
&Apache::lonhtmlcommon::add_breadcrumb |
({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). |
({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). |
'&phase=disp_adv'. |
'&phase=disp_adv'. |
'catalogmode='.$env{'form.catalogmode'}. |
'catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}, |
'&mode='.$env{'form.mode'}, |
text=>"Course Search", |
text=>"Course Search", |
bug=>'Searching',}); |
bug=>'Searching',}); |
} |
} |
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'}) { |
if ($contrib{$id.':message'}) { |
$result .= $contrib{$id.':message'}; |
$result .= $contrib{$id.':message'}; |
|
} |
|
if ($contrib{$id,':attachmenturl'}) { |
|
if ($contrib{$id,':attachmenturl'} =~ m-/([^/]+)$-) { |
|
$result .= $1; |
|
} |
} |
|
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 762 sub setup_basic_search {
|
Line 767 sub setup_basic_search {
|
'</label>'; |
'</label>'; |
$adv_search_link = '<a href="/adm/searchcat?'. |
$adv_search_link = '<a href="/adm/searchcat?'. |
&Apache::loncommon::inhibit_menu_check(). |
&Apache::loncommon::inhibit_menu_check(). |
'&phase=disp_adv'. |
'&phase=disp_adv'. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&catalogmode='.$env{'form.catalogmode'}. |
'&launch='.$env{'form.launch'}. |
'&launch='.$env{'form.launch'}. |
'&mode='.$env{'form.mode'}. |
'&mode='.$env{'form.mode'}. |
'&area='.$area. |
'&area='.$area. |
'&form='.$env{'form.form'}. |
'&form='.$env{'form.form'}. |
'&titleelement='.$env{'form.titleelement'}. |
'&titleelement='.$env{'form.titleelement'}. |
'&element='.$env{'form.element'}. |
'&element='.$env{'form.element'}. |
'">'.&mt('Advanced Search').'</a>'; |
'">'.&mt('Advanced Search').'</a>'; |
# |
# |
$scrout.='<form name="loncapa_search" method="post" '. |
$scrout.='<form name="loncapa_search" method="post" '. |
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 1168 sub viewoptions {
|
Line 1173 sub viewoptions {
|
undef, |
undef, |
(10,20,50,100,1000,10000)); |
(10,20,50,100,1000,10000)); |
$scrout .= (' 'x2) |
$scrout .= (' 'x2) |
.'<span class="LC_nobreak">' |
|
.&mt('[_1] Records per Page',$countselect) |
.&mt('[_1] Records per Page',$countselect) |
.'</span>'.$/; |
.'</span>'.$/; |
return $scrout; |
return $scrout; |
Line 2236 sub print_sort_form {
|
Line 2240 sub print_sort_form {
|
<script type="text/javascript"> |
<script type="text/javascript"> |
function change_sort() { |
function change_sort() { |
var newloc = "/adm/searchcat?phase=results"; |
var newloc = "/adm/searchcat?phase=results"; |
newloc += "&persistent_db_id=$env{'form.persistent_db_id'}"; |
newloc += "&persistent_db_id=$env{'form.persistent_db_id'}"; |
newloc += "&sortby="; |
newloc += "&sortby="; |
newloc += document.forms.statusform.elements.sortby.value; |
newloc += document.forms.statusform.elements.sortby.value; |
parent.resultsframe.location= newloc; |
parent.resultsframe.location= newloc; |
} |
} |
</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 2451 sub revise_button {
|
Line 2454 sub revise_button {
|
$revise_phase = 'disp_adv' if ($env{'form.searchmode'} eq 'advanced'); |
$revise_phase = 'disp_adv' if ($env{'form.searchmode'} eq 'advanced'); |
my $newloc = '/adm/searchcat'. |
my $newloc = '/adm/searchcat'. |
'?persistent_db_id='.$env{'form.persistent_db_id'}. |
'?persistent_db_id='.$env{'form.persistent_db_id'}. |
'&cleargroupsort=1'. |
'&cleargroupsort=1'. |
'&phase='.$revise_phase; |
'&phase='.$revise_phase; |
my $result = qq{<input type="button" value="$revisetext" name="revise"} . |
my $result = qq{<input type="button" value="$revisetext" name="revise"} . |
qq{ onClick="parent.location='$newloc';" /> }; |
qq{ onClick="parent.location='$newloc';" /> }; |
return $result; |
return $result; |
Line 2483 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 2967 sub display_results {
|
Line 2969 sub display_results {
|
('<center>'. |
('<center>'. |
&prev_next_buttons($min,$env{'form.show'},$total_results, |
&prev_next_buttons($min,$env{'form.show'},$total_results, |
"table=".$env{'form.table'}. |
"table=".$env{'form.table'}. |
"&phase=results". |
"&phase=results". |
"&persistent_db_id=". |
"&persistent_db_id=". |
$env{'form.persistent_db_id'}) |
$env{'form.persistent_db_id'}) |
."</center>\n" |
."</center>\n" |
); |
); |
Line 3258 SCRIPT
|
Line 3260 SCRIPT
|
} |
} |
function select_group() { |
function select_group() { |
parent.window.location= |
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; |
parent.statusframe.document.forms.statusform.elements.acts.value; |
} |
} |
</script> |
</script> |
Line 3275 END
|
Line 3277 END
|
} |
} |
|
|
sub results_link { |
sub results_link { |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
my $results_link = $basic_link."&phase=results". |
my $results_link = $basic_link."&phase=results". |
"&pause=1"."&start=1"; |
"&pause=1"."&start=1"; |
return $results_link; |
return $results_link; |
} |
} |
|
|
Line 3286 sub results_link {
|
Line 3288 sub results_link {
|
###################################################################### |
###################################################################### |
sub print_frames_interface { |
sub print_frames_interface { |
my $r = shift; |
my $r = shift; |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
"&persistent_db_id=".$env{'form.persistent_db_id'}; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $run_search_link = $basic_link."&phase=run_search"; |
my $results_link = &results_link(); |
my $results_link = &results_link(); |
my $js = <<JS; |
my $js = <<JS; |
<script type="text/javascript"> |
<script type="text/javascript"> |
Line 3472 sub detailed_citation_view {
|
Line 3474 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 align="left" width="200" noshade />'."\n"; |
$result .= '<hr />'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 3524 $values{'author'}, $values{'owner'} -- $
|
Line 3526 $values{'author'}, $values{'owner'} -- $
|
$values{'copyrighttag'}<br /> |
$values{'copyrighttag'}<br /> |
$values{'extrashow'} |
$values{'extrashow'} |
</p> |
</p> |
<hr align='left' width='200' noshade /> |
<hr /> |
END |
END |
return $result; |
return $result; |
} |
} |
Line 3557 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'}}; |
Line 3634 END
|
Line 3636 END
|
} |
} |
$result .= "</dl>\n"; |
$result .= "</dl>\n"; |
$result .= $values{'extrashow'}; |
$result .= $values{'extrashow'}; |
$result .= '<hr align="left" width="200" noshade />'."\n"; |
$result .= '<hr />'."\n"; |
return $result; |
return $result; |
} |
} |
|
|
Line 3708 $prefix
|
Line 3710 $prefix
|
$xml |
$xml |
</pre> |
</pre> |
$values{'extrashow'} |
$values{'extrashow'} |
<hr align='left' width='200' noshade /> |
<hr /> |
END |
END |
return $result; |
return $result; |
} |
} |
Line 3768 $closebutton
|
Line 3770 $closebutton
|
$errorstring |
$errorstring |
</p> |
</p> |
<p> |
<p> |
<a href="/adm/searchcat?$parms&persistent_db_id=$env{'form.persistent_db_id'}">$revise</a> |
<a href="/adm/searchcat?$parms&persistent_db_id=$env{'form.persistent_db_id'}">$revise</a> |
</p> |
</p> |
$end_page |
$end_page |
ENDPAGE |
ENDPAGE |
Line 3812 $closebutton
|
Line 3814 $closebutton
|
$errormsg |
$errormsg |
</p> |
</p> |
<p> |
<p> |
<a href="/adm/searchcat?$parms&persistent_db_id=$env{'form.persistent_db_id'}">$revise</a> |
<a href="/adm/searchcat?$parms&persistent_db_id=$env{'form.persistent_db_id'}">$revise</a> |
</p> |
</p> |
$end_page |
$end_page |
ENDPAGE |
ENDPAGE |