--- loncom/interface/lonsearchcat.pm 2007/05/02 01:33:49 1.286 +++ loncom/interface/lonsearchcat.pm 2009/07/03 08:18:48 1.311 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Search Catalog # -# $Id: lonsearchcat.pm,v 1.286 2007/05/02 01:33:49 albertel Exp $ +# $Id: lonsearchcat.pm,v 1.311 2009/07/03 08:18:48 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -138,7 +138,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','titleelement','area']); + 'cleargroupsort','titleelement','area','inhibitmenu']); ## ## 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 @@ -190,9 +190,10 @@ sub handler { } &Apache::lonhtmlcommon::add_breadcrumb ({href=>'/adm/searchcat?'. - 'catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + &Apache::loncommon::inhibit_menu_check(). + '&catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"$crumb_text", target=>'_top', bug=>'Searching',}); @@ -258,11 +259,14 @@ sub handler { if (exists($env{'form.area'})) { $hidden_fields .= &hidden_field('area'); } + if (exists($env{'form.inhibitmenu'})) { + $hidden_fields .= &hidden_field('inhibitmenu'); + } ## ## Configure dynamic components of interface ## if ($env{'form.catalogmode'} eq 'interactive') { - $closebutton=" END } else { @@ -308,18 +313,20 @@ END $srchtype = 'Portfolio'; } &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/searchcat?phase=disp_adv&'. - 'catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). + '&phase=disp_adv'. + '&catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"Advanced $srchtype Search", bug=>'Searching',}); } elsif ($env{'form.searchmode'} eq 'course search') { &Apache::lonhtmlcommon::add_breadcrumb - ({href=>'/adm/searchcat?phase=disp_adv&'. + ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). + '&phase=disp_adv'. 'catalogmode='.$env{'form.catalogmode'}. - '&launch='.$env{'form.launch'}. - '&mode='.$env{'form.mode'}, + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, text=>"Course Search", bug=>'Searching',}); } @@ -481,7 +488,20 @@ sub course_search { my $discuss=$env{'form.crsdiscuss'}; my @allwords=($search_string,@New_Words); $totalfound=0; - $r->print(&Apache::loncommon::start_page('Course Search'). + + &Apache::lonhtmlcommon::add_breadcrumb + ({href=>'/adm/searchcat?'.&Apache::loncommon::inhibit_menu_check(). + '&phase=disp_adv'. + 'catalogmode='.$env{'form.catalogmode'}. + '&launch='.$env{'form.launch'}. + '&mode='.$env{'form.mode'}, + text=>"Course Search", + bug=>'Searching',}); + $r->print(&Apache::loncommon::start_page('Course Search')); + $r->print(&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', + $env{'form.catalogmode'} ne 'import')); + + $r->print( '
'. $pretty_search_string.'
'. '
'.&mt('Course content').':
'); @@ -512,72 +532,77 @@ sub course_search { my $totaldiscussions = 0; $r->print('

'.&mt('Discussion postings').':
'); my $navmap = Apache::lonnavmaps::navmap->new(); - my @allres=$navmap->retrieveResources(); - my %discussiontime = &Apache::lonnet::dump('discussiontimes', - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}); - foreach my $resource (@allres) { - my $result = ''; - my $applies = 0; - my $symb = $resource->symb(); - my $ressymb = $symb; - if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) { - $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; - unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { - $ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; + if (defined($navmap)) { + my @allres=$navmap->retrieveResources(); + my %discussiontime = &Apache::lonnet::dump('discussiontimes', + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); + foreach my $resource (@allres) { + my $result = ''; + my $applies = 0; + my $symb = $resource->symb(); + my $ressymb = $symb; + if ($symb =~ m#(___adm/$LONCAPA::domain_re/$LONCAPA::username_re)/(\d+)/bulletinboard$#) { + $ressymb = 'bulletin___'.$2.$1.'/'.$2.'/bulletinboard'; + unless ($ressymb =~ m#bulletin___\d+___adm/wrapper#) { + $ressymb=~s#(bulletin___\d+___)#$1adm/wrapper/#; + } } - } - if (defined($discussiontime{$ressymb})) { - my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'}, - $env{'course.'.$env{'request.course.id'}.'.domain'}, - $env{'course.'.$env{'request.course.id'}.'.num'}); - if ($contrib{'version'}) { - for (my $id=1;$id<=$contrib{'version'};$id++) { - unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) { - if ($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 (defined($discussiontime{$ressymb})) { + my %contrib = &Apache::lonnet::restore($ressymb,$env{'request.course.id'}, + $env{'course.'.$env{'request.course.id'}.'.domain'}, + $env{'course.'.$env{'request.course.id'}.'.num'}); + if ($contrib{'version'}) { + for (my $id=1;$id<=$contrib{'version'};$id++) { + unless (($contrib{'hidden'}=~/\.$id\./) || ($contrib{'deleted'}=~/\.$id\./)) { + if ($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; + } } + $applies = &checkwords($result,$applies,@allwords); } - $applies = &checkwords($result,$applies,@allwords); } } } - } # Does this discussion apply? - if ($applies) { - my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb); - my $disctype = &mt('resource'); - if ($url =~ m#/bulletinboard$#) { - if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) { - $url =~s#^adm/wrapper##; + if ($applies) { + my ($map,$ind,$url)=&Apache::lonnet::decode_symb($ressymb); + my $disctype = &mt('resource'); + if ($url =~ m#/bulletinboard$#) { + if ($url =~m#^adm/wrapper/adm/.*/bulletinboard$#) { + $url =~s#^adm/wrapper##; + } + $disctype = &mt('discussion board'); + } else { + $url = '/res/'.$url; } - $disctype = &mt('bulletin board'); - } else { - $url = '/res/'.$url; - } - if ($url =~ /\?/) { - $url .= '&symb='; + if ($url =~ /\?/) { + $url .= '&symb='; + } else { + $url .= '?symb='; + } + $url .= &escape($resource->symb()); + my $title = $resource->compTitle(); + $r->print('
'. + ($title?$title:$url).'  - '. + $disctype.'
'); + $totaldiscussions++; } else { - $url .= '?symb='; + $r->print(' .'); } - $url .= &escape($resource->symb()); - my $title = $resource->compTitle(); - $r->print('
'. - ($title?$title:$url).'  - '.$disctype.'
'); - $totaldiscussions++; - } else { - $r->print(' .'); } - } - unless ($totaldiscussions) { - $r->print('

'.&mt('No matches found in postings').'.

'); + unless ($totaldiscussions) { + $r->print('

'.&mt('No matches found in postings').'.

'); + } + } else { + $r->print('
'.&mt('An error occurred retrieving information about resources in the course.').'
'.&mt('It is recommended that you [_1]re-initialize the course[_2] and then try your search again.','','').'
'); } } @@ -678,7 +703,7 @@ sub print_basic_search_form { my $bread_crumb = &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic', $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 if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) { $scrout .= &setup_basic_search($r,'res',$hidden_fields,$closebutton); @@ -692,7 +717,7 @@ sub print_basic_search_form { 'note' => 'Enter terms or phrases, then press "Search" below', 'use' => 'use related words', 'full' =>'fulltext search (time consuming)', - 'disc' => 'search discussion postings (resources and bulletin boards)', + 'disc' => 'search discussion postings (resources and discussion boards)', ); $scrout.=(< @@ -753,20 +778,16 @@ sub setup_basic_search { $r->dir_config('lonDefDomain')), $r->dir_config('lonDefDomain')). ''; - if ($area eq 'res') { - $inclext= ''; - } $adv_search_link = ''.&mt('Advanced Search').''; # $scrout.='
'. ''.&searchhelp().''.''. ''. - ''.(' 'x3).$adv_search_link.''.'
'. - ''.(' 'x1).$userelatedwords.''.'
'. - ''.(' 'x1).$onlysearchdomain.''.'
'. - ''.(' 'x1).$inclext.''.'
'. + ''.(' 'x3).$adv_search_link.''.'
'. + ''.(' 'x1).$userelatedwords.''.'
'. + ''.(' 'x1).$onlysearchdomain.''.'
'. + ''.(' 'x1).$inclext.''.'
'. '
'. ''.$/; # @@ -861,7 +882,7 @@ ENDHEADER ''; my %fields=&Apache::lonmeta::fieldnames(); # - $scrout .= '

'.&mt('Standard [_1] Metadata',$srchtype).'

'; + $scrout .= '

'.&mt("Standard $srchtype Metadata").'

'; $scrout .= "\n"; $scrout .= '\n"; @@ -892,7 +913,7 @@ ENDHEADER $env{'form.'.$field.'_related'}, 50); if ($related_word_search{$field}) { - $scrout .= 'related words'; + $scrout .= &mt('related words'); } else { $scrout .= ''.$/; # # Misc metadata @@ -1037,6 +1053,7 @@ ENDHEADER # Creation/Modification date limits $scrout .= '

'.&mt('Creation and Modification dates').'

'; $scrout .= "\n
 '. (' 'x2).&searchhelp()."
 '; } @@ -918,12 +939,7 @@ ENDHEADER &titlefield(&mt('Domains')).''. &Apache::loncommon::domain_select('domains', $env{'form.domains'},1). - '
' - } + '
'; $scrout .= '
\n"; + $scrout .= "\n"; my $cafter = &Apache::lonhtmlcommon::date_setter('advsearch', # formname 'creationdate1', # fieldname @@ -1055,10 +1072,10 @@ ENDHEADER '', # state 1, # no_hh_mm_ss ); - $scrout .= &mt(''. - ''. - ''. - '',$cafter,$cbefore); + $scrout .= '' + .'' + .'' + .''; my $lafter = &Apache::lonhtmlcommon::date_setter('advsearch', 'revisiondate1', @@ -1077,10 +1094,10 @@ ENDHEADER '', # state 1, # no_hh_mm_ss ); - $scrout .= &mt(''. - ''. - ''. - '',$lafter,$lbefore); + $scrout .= '' + .'' + .'' + .''; $scrout.="
 ".&mt('Month[_1]Day[_2]Year',' 'x14,' 'x6)."
Created between[_1]
and [_2]
'.&mt('Created between').''.$cafter.'
'.&mt('and').''.$cbefore.'
Last modified between [_1]
and[_2]
'.&mt('Last modified between').''.$lafter.'
'.&mt('and').''.$lbefore.'
\n"; $scrout.=<'.$/; + $scrout .= (' 'x2) + .&mt('[_1] Records per Page',$countselect) + .''.$/; return $scrout; } @@ -1395,7 +1413,7 @@ sub parse_advanced_search { 'lastrevisiondatestart_month','lastrevisiondatestart_day', 'lastrevisiondatestart_year','lastrevisiondateend_month', 'lastrevisiondateend_day','lastrevisiondateend_year') { - $env{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\'.]//g; + $env{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\'.\*]//g; } foreach ('mode','form','element') { # is this required? Hmmm. @@ -1640,7 +1658,7 @@ sub parse_advanced_search { # if (@queries) { if ($env{'form.area'} eq 'portfolio') { - $query ="SELECT pm.*,pa.keynum,pa.scope FROM portfolio_metadata pm, portfolio_access pa, portfolio_addedfields pf WHERE (pm.url = pa.url AND pf.url = pm.url AND (pa.start < NOW() AND (pa.end IS NULL OR pa.end > NOW())) AND (".join(') AND (',@queries).'))'; + $query ="SELECT pm.*,pa.keynum,pa.scope FROM portfolio_metadata pm, portfolio_access pa, portfolio_addedfields pf WHERE (pm.url = pa.url AND pf.url = pm.url AND (pa.start < UTC_TIMESTAMP() AND (pa.end IS NULL OR pa.end > UTC_TIMESTAMP())) AND (".join(') AND (',@queries).'))'; } else { $query="SELECT * FROM metadata WHERE (".join(") AND (",@queries).')'; } @@ -1703,7 +1721,7 @@ sub parse_basic_search { # # Clean up fields for safety for my $field ('basicexp') { - $env{"form.$field"}=~s/[^\w\s\'\"\!\(\)\-]//g; + $env{"form.$field"}=~s/[^\w\s\'\"\!\(\)\-\*]//g; } foreach ('mode','form','element') { # is this required? Hmmm. @@ -1742,7 +1760,7 @@ sub parse_basic_search { #} my $final_query; if ($env{'form.area'} eq 'portfolio') { - $final_query = 'SELECT pm.*,pa.keynum,pa.scope FROM portfolio_metadata pm, portfolio_access pa WHERE (pm.url = pa.url AND (pa.start < NOW() AND (pa.end IS NULL OR pa.end > NOW())) AND '.join(" AND ",@Queries).')'; + $final_query = 'SELECT pm.*,pa.keynum,pa.scope FROM portfolio_metadata pm, portfolio_access pa WHERE (pm.url = pa.url AND (pa.start < UTC_TIMESTAMP() AND (pa.end IS NULL OR pa.end > UTC_TIMESTAMP())) AND '.join(" AND ",@Queries).')'; } else { $final_query = 'SELECT * FROM metadata WHERE '.join(" AND ",@Queries); } @@ -2118,6 +2136,10 @@ sub copyright_check { ($env{'user.domain'} ne $resdom)) { return 0; } + # Check for custom rights + if ($Metadata->{'copyright'} eq 'custom') { + return &Apache::lonnet::customaccess('bre',$Metadata->{'url'}); + } return 1; } @@ -2231,16 +2253,15 @@ sub print_sort_form { END - my $start_page = &Apache::loncommon::start_page('Results',$js, - {'no_title' => 1}); + my $start_page = &Apache::loncommon::start_page('Results',$js); my $breadcrumbs= &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', $env{'form.catalogmode'} ne 'import'); @@ -2265,14 +2286,11 @@ END # } # $result.="\n"; my $revise = &revise_button(); - $result.=< -There are $total_results matches to your query. $revise -

-Search: $pretty_query_string -

- -END + $result.='

' + .&mt('There are [_1] matches to your query.',$total_results) + .' '.$revise.'

' + .'

'.&mt('Search: ').$pretty_query_string + .'

'; $r->print($result.&Apache::loncommon::end_page()); return; } @@ -2444,13 +2462,14 @@ Returns: html string for a 'revise searc ###################################################################### ###################################################################### sub revise_button { + my $revisetext = &mt('Revise search'); my $revise_phase = 'disp_basic'; $revise_phase = 'disp_adv' if ($env{'form.searchmode'} eq 'advanced'); my $newloc = '/adm/searchcat'. '?persistent_db_id='.$env{'form.persistent_db_id'}. - '&cleargroupsort=1'. - '&phase='.$revise_phase; - my $result = qq{ }; return $result; } @@ -2480,16 +2499,13 @@ sub run_search { # # Print run_search header # - my $start_page = &Apache::loncommon::start_page('Search Status',undef, - {'no_title' => 1}); + my $start_page = &Apache::loncommon::start_page('Search Status',undef); my $breadcrumbs = &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching', $env{'form.catalogmode'} ne 'import'); $r->print(< - END # Remove leading and trailing
$pretty_string =~ s:^\s*
::i; @@ -2500,7 +2516,7 @@ END pop(@Lines); } if (@Lines > 2) { - $pretty_string = join '
',(@Lines[0..2],'....
'); + $pretty_string = join '
',(@Lines[0..2],'...
'); } $r->print(&mt("Search: [_1]",$pretty_string)); $r->rflush(); @@ -2555,18 +2571,22 @@ END my $server; my $status; my $revise = &revise_button(); - $r->print(< -StatusTotal MatchesTime Remaining - - - - -$revise - - - -END + $r->print('
'."\n". + ''."\n". + '' + .'' + .'' + .&Apache::loncommon::end_data_table_header_row() + .&Apache::loncommon::start_data_table_row() + .'' + .'' + .'' + .&Apache::loncommon::end_data_table_row() + .&Apache::loncommon::end_data_table() + .'
'."\n". + &Apache::loncommon::start_data_table()); + $r->print(&Apache::loncommon::start_data_table_header_row() + .''.&mt('Status').''.&mt('Total Matches').''.&mt('Time Remaining').' '.$revise.'
'); $r->rflush(); &reset_timing(); &update_seconds($r); @@ -2638,8 +2658,6 @@ END my %Fields = &parse_raw_result($result,$server,$tabletype); $Fields{'hostname'} = $server; # - # Skip if external and we did not want that - next if ((! $env{'form.inclext'}) && ($Fields{'url'}=~/^\/ext\//)); # Skip based on copyright next if (! ©right_check(\%Fields)); @@ -2893,7 +2911,7 @@ sub display_results { ## Output links (if necessary) for 'prev' and 'next' pages. $r->print ('
'. - ''.$sortform.''. + ''.$sortform.''. ''. &prev_next_buttons($min,$env{'form.show'},$total_results). ''. @@ -2964,8 +2982,8 @@ sub display_results { ('
'. &prev_next_buttons($min,$env{'form.show'},$total_results, "table=".$env{'form.table'}. - "&phase=results". - "&persistent_db_id=". + "&phase=results". + "&persistent_db_id=". $env{'form.persistent_db_id'}) ."
\n" ); @@ -2997,8 +3015,8 @@ sub catalogmode_output { $title=~ s/\'/\\\'/g; if ($env{'form.catalogmode'} eq 'interactive') { $output.=< + END } @@ -3007,7 +3025,7 @@ END $groupsearch_db{"pre_${fnum}_title"}=$title; $output.=< - END @@ -3234,6 +3252,7 @@ function changeURL(val) { SCRIPT } } + my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check(); $js.=< @@ -3271,10 +3290,10 @@ END } sub results_link { - my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. - "&persistent_db_id=".$env{'form.persistent_db_id'}; - my $results_link = $basic_link."&phase=results". - "&pause=1"."&start=1"; + my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. + "&persistent_db_id=".$env{'form.persistent_db_id'}; + my $results_link = $basic_link."&phase=results". + "&pause=1"."&start=1"; return $results_link; } @@ -3282,9 +3301,9 @@ sub results_link { ###################################################################### sub print_frames_interface { my $r = shift; - my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. - "&persistent_db_id=".$env{'form.persistent_db_id'}; - my $run_search_link = $basic_link."&phase=run_search"; + my $basic_link = "/adm/searchcat?"."&table=".$env{'form.table'}. + "&persistent_db_id=".$env{'form.persistent_db_id'}; + my $run_search_link = $basic_link."&phase=run_search"; my $results_link = &results_link(); my $js = < @@ -3377,7 +3396,7 @@ sub detailed_citation_view { $jumpurl=~s|^/ext/|http://|; $result .= ''.$prefix. ''.' '. - ''.$values{'title'}."\n"; $result .= "

\n"; $result .= ''.$values{'author'}.','. @@ -3444,11 +3463,8 @@ sub detailed_citation_view { if (exists($field->{'type'}) && $field->{'type'} eq 'list') { $result .= ''.&mt($field->{'translate'}).''; foreach my $item (split(',',$values{$field->{'name'}})){ - $result .= - &Apache::lonhtmlcommon::crumbs(&Apache::lonnet::clutter($item), - 'preview', - '', - (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1); + $item = &Apache::lonnet::clutter($item); + $result .= &display_url($item,[2,0,1]); } } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){ $result.= &mt($field->{'translate'}, @@ -3456,15 +3472,7 @@ sub detailed_citation_view { $values{$field->{'name'}}))."
\n"; } else { if ($field->{'special'} eq 'url link') { - if ($jumpurl=~/^http\:\/\//) { - $result.=''.$jumpurl.''; - } else { - $result .= - &Apache::lonhtmlcommon::crumbs($jumpurl, - 'preview', - '', - (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),3,0,1); - } + $result .= &display_url($jumpurl,[3,0,1]); } else { $result.= &mt($field->{'translate'}, $values{$field->{'name'}}); @@ -3479,7 +3487,7 @@ sub detailed_citation_view { if (exists($values{'shortabstract'}) && $values{'shortabstract'} ne '') { $result .= '

'.$values{'shortabstract'}.'

'; } - $result .= '
'."\n"; + $result .= '
'."\n"; return $result; } @@ -3520,24 +3528,18 @@ sub summary_view { $result .= ' '.$tmp.' '; } my $jumpurl=$values{'url'}; - my $link; - if ($jumpurl=~m|^/ext/|) { - $jumpurl=~s|^/ext/|http://|; - $link='
'.$jumpurl.''; - } else { - $link=&Apache::lonhtmlcommon::crumbs($jumpurl, - 'preview', - '', - (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),2,0,1); - } + $jumpurl=~s|^/ext/|http://|; + my $link = &display_url($jumpurl,[2,0,1]); + $result.=<$values{'title'}$link +$values{'title'}
+$link
$values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}
$values{'copyrighttag'}
$values{'extrashow'}

-
+
END return $result; } @@ -3565,30 +3567,42 @@ sub summary_preview { sub compact_view { my ($prefix,%values) = @_; my $jumpurl=$values{'url'}; - my $link; - if ($jumpurl=~m|^/ext/|) { - $jumpurl=~s|^/ext/|http://|; - $link=''.$jumpurl.''; - } else { - $link=&Apache::lonhtmlcommon::crumbs($jumpurl, - 'preview', - '', - (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1,1,1).' '; - } + $jumpurl=~s|^/ext/|http://|; + + my $link = &display_url($jumpurl,[1,1,1]); + my $result = - $prefix.''; + $prefix.''; if (exists($env{'form.sortfield'}) && $env{'form.sortfield'} !~ /^(default|author|url|title)$/) { my $tmp = $values{$env{'form.sortfield'}}; if (! defined($tmp)) { $tmp = 'undefined'; } $result .= ' '.$tmp.' '; } - $result.=' '. - $values{'title'}.''.(' 'x2).$link. - ''.$values{'author'}.' ('.$values{'domain'}.')
'; + $jumpurl = &HTML::Entities::encode($jumpurl,'<>&"'); + $result.=' '. + ''. + &HTML::Entities::encode($values{'title'},'<>&"').' '. + $link.' '.$values{'author'}.' ('.$values{'domain'}.')
'; return $result; } +sub display_url { + my ($url,$crumb_args) = @_; + my $link; + if ($url=~m|^/ext/|) { + $url=~s|^/ext/|http://|; + $link=''.$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}).' '; + } + return $link; +} ###################################################################### ###################################################################### @@ -3612,7 +3626,7 @@ sub fielded_format_view { $prefix
URL:
-
$values{'url'}
END foreach my $field ('title','author','domain','subject','keywords','notes', @@ -3635,7 +3649,7 @@ END } $result .= "
\n"; $result .= $values{'extrashow'}; - $result .= '
'."\n"; + $result .= '
'."\n"; return $result; } @@ -3709,7 +3723,7 @@ $prefix $xml $values{'extrashow'} -
+
END return $result; } @@ -3769,7 +3783,7 @@ $closebutton $errorstring

-$revise +$revise

$end_page ENDPAGE @@ -3813,7 +3827,7 @@ $closebutton $errormsg

-$revise  +$revise 

$end_page ENDPAGE