END
- my $scrout= &Apache::loncommon::start_page('Advanced Catalog Search');
- $scrout .= <<"ENDHEADER";
-$bread_crumb
-';
+
$scrout .= &Apache::loncommon::end_page();
$r->print($scrout);
return;
@@ -1074,17 +906,20 @@ sub viewoptions {
if (! defined($env{'form.viewselect'})) {
$env{'form.viewselect'}='detailed';
}
- $scrout.=&Apache::lonmeta::selectbox('viewselect',
- $env{'form.viewselect'},
- \&viewoptiontext,
- sort(keys(%Views)));
- $scrout.= ' ';
+ $scrout .= ''
+ .&mt('Type:').' '
+ .&Apache::lonmeta::selectbox('viewselect',
+ $env{'form.viewselect'},
+ \&viewoptiontext,
+ sort(keys(%Views)))
+ .'';
my $countselect = &Apache::lonmeta::selectbox('show',
$env{'form.show'},
undef,
(10,20,50,100,1000,10000));
- $scrout .= (' 'x2).&mt('[_1] Records per Page',$countselect).
- ''.$/;
+ $scrout .= ' '
+ .&mt('Records per Page:').' '.$countselect
+ .''.$/;
return $scrout;
}
@@ -1310,7 +1145,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.
@@ -1343,6 +1178,17 @@ sub parse_advanced_search {
$fillflag++;
}
}
+ if ($env{'form.area'} eq 'portfolio') {
+ # Added metadata fields
+ for (my $i=0; $i<$env{'form.numaddedfields'} ; $i++) {
+ my $field = $env{'form.addedfield_'.$i};
+ $field =~ s/^\s*(\S*)\s*$/$1/;
+ $field =~ s/\W/_/g;
+ if ($field ne '') {
+ $fillflag++;
+ }
+ }
+ }
if (! $fillflag) {
&output_blank_field_error($r,$closebutton,
'phase=disp_adv',$hidden_fields);
@@ -1429,29 +1275,56 @@ sub parse_advanced_search {
&Apache::loncommon::copyrightdescription($env{'form.copyright'}).
" \n";
}
- #
- # Statistics
- foreach my $field (@StatsFields,@EvalFields) {
- my ($min,$max);
- if (exists($env{'form.'.$field.'_min'}) &&
- $env{'form.'.$field.'_min'} ne '') {
- $min = $env{'form.'.$field.'_min'};
- }
- if (exists($env{'form.'.$field.'_max'}) &&
- $env{'form.'.$field.'_max'} ne '') {
- $max = $env{'form.'.$field.'_max'};
- }
- next if (! defined($max) && ! defined($min));
- if (defined($min) && defined($max)) {
- ($min,$max) = sort {$a <=>$b} ($min,$max);
- }
- if (defined($min) && $min =~ /^(\d+\.\d+|\d+|\.\d+)$/) {
- push(@queries,'('.$field.'>'.$min.')');
- $pretty_search_string.=$font.$field.'>'.$min.' ';
- }
- if (defined($max) && $max =~ /^(\d+\.\d+|\d+|\.\d+)$/) {
- push(@queries,'('.$field.'<'.$max.')');
- $pretty_search_string.=$font.$field.'<'.$max.' ';
+ if ($env{'form.area'} eq 'portfolio') {
+ #
+ # Added metadata fields
+ for (my $i=0; $i<$env{'form.numaddedfields'} ; $i++) {
+ my $field = $env{'form.addedfield_'.$i};
+ $field =~ s/^\s*(\S*)\s*$/$1/;
+ $field =~ s/\W/_/g;
+ $field =~ tr/A-Z/a-z/;
+ if ($field ne '') {
+ my $value = $env{'form.addedvalues_'.$i};
+ if ($value ne '') {
+ $value =~ s/'/''/g; #' stupid emacs
+ my ($error,$query) =
+ &process_phrase_input($value,0,'pf.value');
+ if (!defined($error)) {
+ push(@queries,"pf.field = '$field' AND $query");
+ $pretty_search_string .=
+ $font.$field.': '.
+ $env{'form.addedvalues_'.$i}.' ';
+ }
+ } else {
+ push(@queries,"pf.field = '$field' AND pf.value IS NULL");
+ }
+ }
+ }
+ } else {
+ #
+ # Statistics
+ foreach my $field (@StatsFields,@EvalFields) {
+ my ($min,$max);
+ if (exists($env{'form.'.$field.'_min'}) &&
+ $env{'form.'.$field.'_min'} ne '') {
+ $min = $env{'form.'.$field.'_min'};
+ }
+ if (exists($env{'form.'.$field.'_max'}) &&
+ $env{'form.'.$field.'_max'} ne '') {
+ $max = $env{'form.'.$field.'_max'};
+ }
+ next if (! defined($max) && ! defined($min));
+ if (defined($min) && defined($max)) {
+ ($min,$max) = sort {$a <=>$b} ($min,$max);
+ }
+ if (defined($min) && $min =~ /^(\d+\.\d+|\d+|\.\d+)$/) {
+ push(@queries,'('.$field.'>'.$min.')');
+ $pretty_search_string.=$font.$field.'>'.$min.' ';
+ }
+ if (defined($max) && $max =~ /^(\d+\.\d+|\d+|\.\d+)$/) {
+ push(@queries,'('.$field.'<'.$max.')');
+ $pretty_search_string.=$font.$field.'<'.$max.' ';
+ }
}
}
#
@@ -1516,7 +1389,11 @@ sub parse_advanced_search {
}
#
if (@queries) {
- $query="SELECT * FROM metadata WHERE (".join(") AND (",@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 < 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).')';
+ }
} elsif ($customquery) {
$query = '';
}
@@ -1540,21 +1417,19 @@ sub parse_domain_restrictions {
$domain_hash{$_}++;
}
if ($domain_hash{'any'}) {
- $pretty_domains_string = "In all LON-CAPA domains.";
+ $pretty_domains_string = &mt("in all LON-CAPA domains.");
} else {
if (@allowed_domains > 1) {
- $pretty_domains_string = "In LON-CAPA domains:";
+ $pretty_domains_string = &mt("in LON-CAPA domains:");
} else {
- $pretty_domains_string = "In LON-CAPA domain ";
+ $pretty_domains_string = &mt("in LON-CAPA domain ");
}
foreach (sort @allowed_domains) {
$pretty_domains_string .= "".$_." ";
}
- foreach (keys(%Apache::lonnet::libserv)) {
- if (exists($domain_hash{$Apache::lonnet::hostdom{$_}})) {
- push @$libraries_to_query,$_;
- }
- }
+ my %servers = &Apache::lonnet::get_unique_servers(\@allowed_domains,
+ 'library');
+ $libraries_to_query = [keys(%servers)];
}
return ($libraries_to_query,
$pretty_domains_string);
@@ -1578,7 +1453,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.
@@ -1596,10 +1471,13 @@ sub parse_basic_search {
}
my $pretty_search_string=$search_string;
my @Queries;
- my $searchfield = 'concat_ws(" ",'.join(',',
- ('title','author','subject',
- 'notes','abstract','keywords')
- ).')';
+ my @fields = ('title','author','subject','notes','abstract','keywords');
+ my $searchfield;
+ if ($env{'form.area'} eq 'portfolio') {
+ $searchfield = 'concat_ws(" ",pm.'.join(',pm.',@fields).')';
+ } else {
+ $searchfield = 'concat_ws(" ",'.join(',',@fields).')';
+ }
my ($error,$SQLQuery) = &process_phrase_input($search_string,
$env{'form.related'},
$searchfield);
@@ -1612,14 +1490,22 @@ sub parse_basic_search {
#foreach my $q (@Queries) {
# &Apache::lonnet::logthis(' '.$q);
#}
- my $final_query = 'SELECT * FROM metadata WHERE '.join(" AND ",@Queries);
+ 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 < 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);
+ }
#
+ if ($env{'form.related'}) {
+ $pretty_search_string.=' '.&mt('(including related words)');
+ }
if (defined($pretty_domains_string) && $pretty_domains_string ne '') {
$pretty_search_string .= ' '.$pretty_domains_string;
}
$pretty_search_string .= " \n";
$pretty_search_string =~ s:^ and ::;
- #&Apache::lonnet::logthis('simple search final query = '.$/.$final_query);
+ &Apache::lonnet::logthis('simple search final query = '.$/.$final_query);
return ($final_query,$pretty_search_string,
$libraries_to_query);
}
@@ -1722,7 +1608,7 @@ sub process_phrase_input {
$item[1];
}
term:
- /[\w\Q:!@#$%^&*()+_=|{}<>,.;\\\/?\E]+/ {
+ /[\w\Q:!@#$%^&*()+_=|{}<>,.;\\\/?\E\-]+/ {
$item[1];
}
ENDGRAMMAR
@@ -1982,6 +1868,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;
}
@@ -2009,9 +1899,13 @@ sub ensure_db_and_table {
## Sanity check the table id.
##
if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
- $r->print("Unable to retrieve search results. ".
- "Unable to determine the table results were stored in. ".
- &Apache::loncommon::end_page());
+ $r->print(&Apache::loncommon::start_page(&mt('Error'))
+. '
table: |'.$table.'|
' # SB
+ .'
'
+ .&mt('Unable to retrieve search results. '
+ .'Unable to determine the table results were saved in.')
+ .&Apache::loncommon::end_page()
+ );
return undef;
}
##
@@ -2020,7 +1914,7 @@ sub ensure_db_and_table {
my $connection_result = &Apache::lonmysql::connect_to_db();
if (!defined($connection_result)) {
$r->print("Unable to connect to the MySQL database where your results".
- " are stored.".
+ " are saved.".
&Apache::loncommon::end_page());
&Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".
" connect to database.");
@@ -2093,6 +1987,7 @@ sub print_sort_form {
}
my $js =<
+//
END
- my $start_page = &Apache::loncommon::start_page('Results',$js,
- {'only_body' => 1});
+ my $start_page = &Apache::loncommon::start_page('Results',$js);
my $breadcrumbs=
&Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
$env{'form.catalogmode'} ne 'import');
@@ -2114,7 +2009,7 @@ $start_page
$breadcrumbs
-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;
}
@@ -2173,7 +2065,7 @@ my @Fullindicies;
Creates the table of search results by calling lonmysql. Stores the
table id in $env{'form.table'}
-Inputs: none.
+Inputs: search area - either res or portfolio
Returns: the identifier of the table on success, undef on error.
@@ -2182,8 +2074,9 @@ Returns: the identifier of the table on
######################################################################
######################################################################
sub set_up_table_structure {
+ my ($tabletype) = @_;
my ($datatypes,$fullindicies) =
- &LONCAPA::lonmetadata::describe_metadata_storage();
+ &LONCAPA::lonmetadata::describe_metadata_storage($tabletype);
# Copy the table description before modifying it...
@Datatypes = @{$datatypes};
unshift(@Datatypes,{name => 'id',
@@ -2196,7 +2089,12 @@ sub set_up_table_structure {
}
sub create_results_table {
- &set_up_table_structure();
+ my ($area) = @_;
+ if ($area eq 'portfolio') {
+ &set_up_table_structure('portfolio_search');
+ } else {
+ &set_up_table_structure('metadata');
+ }
my $table = &Apache::lonmysql::create_table
( { columns => \@Datatypes,
FULLTEXT => [{'columns' => \@Fullindicies},],
@@ -2240,16 +2138,28 @@ Returns: Nothing.
sub update_count_status {
my ($r,$text) = @_;
$text =~ s/\'/\\\'/g;
- $r->print
- ("\n");
+ $r->print(<
+SCRIPT
+
$r->rflush();
}
sub update_status {
my ($r,$text) = @_;
$text =~ s/\'/\\\'/g;
- $r->print
- ("\n");
+ $r->print(<
+SCRIPT
+
$r->rflush();
}
@@ -2276,9 +2186,14 @@ sub update_seconds {
my ($r) = @_;
my $time = &time_left();
if (($last_time-$time) > 0) {
- $r->print("\n");
+ $r->print(<
+SCRIPT
+
$r->rflush();
}
$last_time = $time;
@@ -2302,14 +2217,15 @@ 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{ };
+ '&cleargroupsort=1'.
+ '&phase='.$revise_phase;
+ my $result = qq{ };
return $result;
}
@@ -2328,22 +2244,23 @@ results into MySQL.
######################################################################
######################################################################
sub run_search {
- my ($r,$query,$customquery,$customshow,$serverlist,$pretty_string) = @_;
-
+ my ($r,$query,$customquery,$customshow,$serverlist,
+ $pretty_string,$area) = @_;
+ my $tabletype = 'metadata';
+ if ($area eq 'portfolio') {
+ $tabletype = 'portfolio_search';
+ }
my $connection = $r->connection;
#
# Print run_search header
#
- my $start_page = &Apache::loncommon::start_page('Search Status',undef,
- {'only_body' => 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;
@@ -2354,7 +2271,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();
@@ -2368,14 +2285,15 @@ END
@Servers_to_contact = ($serverlist);
}
} else {
- @Servers_to_contact = sort(keys(%Apache::lonnet::libserv));
+ my %all_library_servers = &Apache::lonnet::unique_library();
+ @Servers_to_contact = sort(keys(%all_library_servers));
}
my %Server_status;
#
# Check on the mysql table we will use to store results.
my $table =$env{'form.table'};
if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
- $r->print("Unable to determine table id to store search results in.".
+ $r->print("Unable to determine table id to save search results in.".
"The search has been aborted.".
&Apache::loncommon::end_page());
return;
@@ -2404,21 +2322,26 @@ END
##
## Prepare for the big loop.
my $hitcountsum;
+ my %matches;
my $server;
my $status;
my $revise = &revise_button();
- $r->print(<
-
'
+ .&mt('Internal Error - Bad view selected.')
+ .'
'."\n");
$r->rflush();
return;
}
@@ -2606,7 +2535,10 @@ sub display_results {
if ($env{'form.catalogmode'} eq 'import') {
if (! tie(%groupsearch_db,'GDBM_File',$diropendb,
&GDBM_WRCREAT(),0640)) {
- $r->print('Unable to store import results.'.
+ $r->print('
'.
+ &mt('Unable to save import results.').
+ '
'.
+ ''.
&Apache::loncommon::end_page());
$r->rflush();
return;
@@ -2620,7 +2552,10 @@ sub display_results {
## Get the number of results
my $total_results = &Apache::lonmysql::number_of_rows($table);
if (! defined($total_results)) {
- $r->print("A MySQL error has occurred.".
+ $r->print('
'.
+ &mt('A MySQL error has occurred.').
+ '
'.
+ ''.
&Apache::loncommon::end_page());
&Apache::lonnet::logthis("lonmysql was unable to determine the number".
" of rows in table ".$table);
@@ -2651,7 +2586,8 @@ sub display_results {
$r->print(&hidden_field('table').
&hidden_field('phase').
&hidden_field('persistent_db_id').
- &hidden_field('start')
+ &hidden_field('start').
+ &hidden_field('area')
);
#
# Build sorting selector
@@ -2672,6 +2608,16 @@ sub display_results {
{key =>'lowestgradelevel'},
{key =>'highestgradelevel'},
{key =>'standards',desc=>'Standards'},
+ );
+ if ($area eq 'portfolio') {
+ push(@fields,
+ (
+ {key => 'scope'},
+ {key => 'keynum'},
+ ));
+ } else {
+ push(@fields,
+ (
{key =>'count',desc=>'Number of accesses'},
{key =>'stdno',desc=>'Students Attempting'},
{key =>'avetries',desc=>'Average Number of Tries'},
@@ -2682,7 +2628,8 @@ sub display_results {
{key =>'correct',desc=>'Evaluation: Material is Correct'},
{key =>'helpful',desc=>'Evaluation: Material is Helpful'},
{key =>'depth',desc=>'Evaluation: Material has Depth'},
- );
+ ));
+ }
my %fieldnames = &Apache::lonmeta::fieldnames();
my @field_order;
foreach my $field_data (@fields) {
@@ -2699,7 +2646,13 @@ sub display_results {
my %sort_fields = map {$_->{'key'},$_->{'desc'}} @fields;
$sort_fields{'select_form_order'} = \@field_order;
$env{'form.sortorder'} = 'desc' if (! exists($env{'form.sortorder'}));
- $env{'form.sortfield'} = 'count' if (! exists($env{'form.sortfield'}));
+ if (! exists($env{'form.sortfield'})) {
+ if ($area eq 'portfolio') {
+ $env{'form.sortfield'} = 'owner';
+ } else {
+ $env{'form.sortfield'} = 'count';
+ }
+ }
if (! exists($env{'form.sortorder'})) {
if ($env{'form.sortfield'}=~/^(count|stdno|disc|clear|technical|correct|helpful)$/) {
$env{'form.sortorder'}='desc';
@@ -2707,37 +2660,40 @@ sub display_results {
$env{'form.sortorder'}='asc';
}
}
- my $sortform = &mt('Sort by [_1] [_2]',
- &Apache::loncommon::select_form($env{'form.sortfield'},
+ my $sortform = ''
+ .&mt('Sort by:').' '
+ .&Apache::loncommon::select_form($env{'form.sortfield'},
'sortfield',
- %sort_fields),
- &Apache::loncommon::select_form($env{'form.sortorder'},
+ \%sort_fields)
+ .' '
+ .&Apache::loncommon::select_form($env{'form.sortorder'},
'sortorder',
- (asc =>&mt('Ascending'),
+ {asc =>&mt('Ascending'),
desc=>&mt('Descending')
- ))
- );
+ })
+ .'';
##
- ## Output links (if necessary) for 'prev' and 'next' pages.
- $r->print
- ('
'.
mt('Results [_1] to [_2] out of [_3]',
$min,$max,$total_results).
- "\n");
+ "
\n");
}
##
## Get results from MySQL table
@@ -2763,13 +2719,18 @@ sub display_results {
my @Results = &Apache::lonmysql::get_rows($table,$sort_command);
##
## Loop through the results and output them.
+ my $tabletype = 'metadata';
+ if ($area eq 'portfolio') {
+ $tabletype = 'portfolio_search';
+ }
+ $r->print(&Apache::loncommon::start_data_table());
foreach my $row (@Results) {
if ($connection->aborted()) {
&cleanup();
return;
}
- my %Fields = %{&parse_row(@$row)};
- my $output="
\n";
+ my %Fields = %{&parse_row($tabletype,@$row)};
+ my $output;
if (! defined($Fields{'title'}) || $Fields{'title'} eq '') {
$Fields{'title'} = 'Untitled';
}
@@ -2778,21 +2739,27 @@ sub display_results {
# Render the result into html
$output.= &$viewfunction($prefix,%Fields);
# Print them out as they come in.
- $r->print($output);
+ $r->print(&Apache::loncommon::start_data_table_row()
+ .'
'
+ .$output
+ .'
'
+ .&Apache::loncommon::end_data_table_row()
+ );
$r->rflush();
}
+ $r->print(&Apache::loncommon::end_data_table());
if (@Results < 1) {
- $r->print(&mt("There were no results matching your query"));
+ $r->print('
'
+ .&mt('There were no results matching your query.')
+ .'
\n"
- );
+ );
}
$r->print("".&Apache::loncommon::end_page());
$r->rflush();
@@ -2821,8 +2788,8 @@ sub catalogmode_output {
$title=~ s/\'/\\\'/g;
if ($env{'form.catalogmode'} eq 'interactive') {
$output.=<
+
END
}
@@ -2831,8 +2798,8 @@ END
$groupsearch_db{"pre_${fnum}_title"}=$title;
$output.=<
-
+
END
}
@@ -2852,10 +2819,10 @@ Parse a row returned from the database.
######################################################################
######################################################################
sub parse_row {
- my @Row = @_;
+ my ($tabletype,@Row) = @_;
my %Fields;
if (! scalar(@Datatypes)) {
- &set_up_table_structure();
+ &set_up_table_structure($tabletype);
}
for (my $i=0;$i<=$#Row;$i++) {
$Fields{$Datatypes[$i]->{'name'}}=&unescape($Row[$i]);
@@ -2891,12 +2858,13 @@ The 'title' field is set to "Untitled" i
###########################################################
###########################################################
sub parse_raw_result {
- my ($result,$hostname) = @_;
+ my ($result,$hostname,$tabletype) = @_;
# conclude from self to others regarding fields
my %Fields=&LONCAPA::lonmetadata::metadata_col_to_hash
- (map {
+ ($tabletype,
+ map {
&unescape($_);
- } (split(/\,/,$result)) );
+ } (split(/\,/,$result)) );
return %Fields;
}
@@ -3000,6 +2968,7 @@ sub search_results_header {
if (! exists($env{'form.mode'}) || $env{'form.mode'} ne 'edit') {
$js.=<
SCRIPT
} elsif ($env{'form.mode'} eq 'edit') {
@@ -3039,6 +3009,7 @@ END
$js.=<
SCRIPT
}
}
+ my $inhibit_menu = "&".&Apache::loncommon::inhibit_menu_check();
$js.=<
+SCRIPT
+
+ # HTML-Markup for 'Set a link for this resource to wishlist'
+ # this is written via JavaScript document.write (function set_wishlistlink)
+ # it is split into 3 parts and the inputfields for title and path are left out
+ # these fields are inserted later to set the values for title and path
+ # automatically via JavaScript (document.title and location.pathname)
+ my %folders = &Apache::lonnet::get('wishlist',['folders']);
+ if ($folders{'folders'} eq '') {
+ $folders{'folders'} = '';
+ }
+ my $start_page_wishlistlink =
+ &Apache::loncommon::start_page('Set link to wishlist',undef,
+ {'only_body' => 1,
+ 'js_ready' => 1,
+ 'bgcolor' => '#FFFFFF',});
+
+ my $warningLink = &mt('You must insert a title!');
+
+ my $in_page_wishlistlink1 = '
'.&mt('Set a link to wishlist').'
'.
+ '';
+
+ # remove all \n for inserting on javascript document.write
+ $in_page_wishlistlink1 =~ s/\n//g;
+ $in_page_wishlistlink2 =~ s/\n//g;
+ $in_page_wishlistlink3 =~ s/\n//g;
+
+ my $end_page_wishlistlink =
+ &Apache::loncommon::end_page({'js_ready' => 1});
+
+ # Add JavaScript-function to set link for a ressource to wishlist
+ $js.=<
SCRIPT
@@ -3093,23 +3151,11 @@ END
return $result;
}
-######################################################################
-######################################################################
-sub search_status_header {
- my $start_page = &Apache::loncommon::start_page('Search Status',undef,
- {'only_body' => 1});
- return <Search Status
-Sending search request to LON-CAPA servers.
-ENDSTATUS
-}
-
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;
}
@@ -3117,14 +3163,16 @@ 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 = <
+//
JS
@@ -3209,11 +3257,15 @@ sub detailed_citation_view {
my ($prefix,%values) = @_;
my $result;
my $jumpurl=$values{'url'};
- $jumpurl=~s/^\/ext\//http\:\/\//;
+ $jumpurl=~s|^/ext/|http://|;
$result .= ''.$prefix.
- ''.' '.
- ''.$values{'title'}."\n";
+ ''.' '.
+ ''.$values{'title'}."\n".
+ ''.
+ '';
$result .= "
END
foreach my $field ('title','author','domain','subject','keywords','notes',
'mimetag','language','creationdate','lastrevisiondate',
@@ -3457,7 +3531,6 @@ END
}
$result .= "
\n";
$result .= $values{'extrashow'};
- $result .= ''."\n";
return $result;
}
@@ -3531,7 +3604,6 @@ $prefix
$xml
$values{'extrashow'}
-
END
return $result;
}
@@ -3571,9 +3643,12 @@ sub output_unparsed_phrase_error {
my ($r,$closebutton,$parms,$hidden_fields,$field)=@_;
my $errorstring;
if ($field eq 'basicexp') {
- $errorstring = &mt('Unable to understand the search phrase [_1]. Please modify your search.',$env{'form.basicexp'});
+ $errorstring = &mt('Unable to understand the search phrase [_1]. Please modify your search.'
+ ,''.$env{'form.basicexp'}.'');
} else {
- $errorstring = &mt('Unable to understand the search phrase [_1]:[_2].',$field,$env{'form.'.$field});
+ $errorstring = &mt('Unable to understand the search phrase [_1]: [_2]'
+ ,''.$field.''
+ ,$env{'form.'.$field});
}
my $heading = &mt('Unparsed Field');
my $revise = &mt('Revise search request');
@@ -3587,11 +3662,11 @@ $hidden_fields
$closebutton
$end_page
ENDPAGE
@@ -3619,23 +3694,32 @@ $parms is extra information to include i
######################################################################
sub output_blank_field_error {
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 $heading = &mt('Unactionable Search Queary');
+ my $heading = &mt('Unactionable Search Query');
my $start_page = &Apache::loncommon::start_page('Search');
my $end_page = &Apache::loncommon::end_page();
+ if ($closebutton) {
+ $closebutton = '
$end_page
ENDPAGE
@@ -3666,16 +3750,18 @@ sub output_date_error {
# make query information persistent to allow for subsequent revision
my $start_page = &Apache::loncommon::start_page('Search');
my $end_page = &Apache::loncommon::end_page();
+ my $heading = &mt('Error');
$r->print(<
$hidden_fields
+onclick='this.form.submit();' />
$closebutton
+
-