Diff for /loncom/interface/lonsearchcat.pm between versions 1.281 and 1.286

version 1.281, 2007/03/12 17:06:15 version 1.286, 2007/05/02 01:33:49
Line 379  END Line 379  END
                                      $errorstring);                                       $errorstring);
   
     my $msg =       my $msg = 
  'Unable to create table in which to store search results. '.   'Unable to create table in which to save search results. '.
  'The search has been aborted.';   'The search has been aborted.';
     &Apache::loncommon::simple_error_page($r,'Search Error',      &Apache::loncommon::simple_error_page($r,'Search Error',
   $msg);    $msg);
Line 388  END Line 388  END
         delete($env{'form.launch'});          delete($env{'form.launch'});
         if (! &make_form_data_persistent($r,$persistent_db_file)) {          if (! &make_form_data_persistent($r,$persistent_db_file)) {
     my $msg=      my $msg=
  'Unable to properly store search information. '.   'Unable to properly save search information. '.
  'The search has been aborted.';   'The search has been aborted.';
     &Apache::loncommon::simple_error_page($r,'Search Error',      &Apache::loncommon::simple_error_page($r,'Search Error',
   $msg);    $msg);
Line 750  sub setup_basic_search { Line 750  sub setup_basic_search {
                        '</label>';                         '</label>';
     $onlysearchdomain = '<label>'.&mt('[_1] only search domain [_2]',      $onlysearchdomain = '<label>'.&mt('[_1] only search domain [_2]',
       &Apache::lonhtmlcommon::checkbox('domains',$env{'form.domains'},        &Apache::lonhtmlcommon::checkbox('domains',$env{'form.domains'},
                                        $r->dir_config('lonDefDomain'))).                                         $r->dir_config('lonDefDomain')),
         $r->dir_config('lonDefDomain')).
                         '</label>';                          '</label>';
     if ($area eq 'res') {      if ($area eq 'res') {
         $inclext= '<label>'.&mt('[_1] include external resources',          $inclext= '<label>'.&mt('[_1] include external resources',
Line 763  sub setup_basic_search { Line 764  sub setup_basic_search {
                        '&launch='.$env{'form.launch'}.                         '&launch='.$env{'form.launch'}.
                        '&mode='.$env{'form.mode'}.                         '&mode='.$env{'form.mode'}.
                        '&area='.$area.                         '&area='.$area.
                          '&form='.$env{'form.form'}.
                          '&titleelement='.$env{'form.titleelement'}.
                          '&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 986  ENDHEADER Line 990  ENDHEADER
                description=>'Network-wide number of accesses (hits)',},                 description=>'Network-wide number of accesses (hits)',},
              { name=>'stdno',               { name=>'stdno',
                description=>                 description=>
                'Total number of students who have worked on this problem',},                 'Statistics calculated for number of students',},
              { name => 'avetries',               { name => 'avetries',
                description=>'Average number of tries till solved',},                 description=>'Average number of tries till solved',},
              { name => 'difficulty',               { name => 'difficulty',
Line 1391  sub parse_advanced_search { Line 1395  sub parse_advanced_search {
    'lastrevisiondatestart_month','lastrevisiondatestart_day',     'lastrevisiondatestart_month','lastrevisiondatestart_day',
    'lastrevisiondatestart_year','lastrevisiondateend_month',     'lastrevisiondatestart_year','lastrevisiondateend_month',
    'lastrevisiondateend_day','lastrevisiondateend_year') {     'lastrevisiondateend_day','lastrevisiondateend_year') {
  $env{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\']//g;   $env{'form.'.$field}=~s/[^\w\/\s\(\)\=\-\"\'.]//g;
     }      }
     foreach ('mode','form','element') {      foreach ('mode','form','element') {
  # is this required?  Hmmm.   # is this required?  Hmmm.
Line 1854  sub process_phrase_input { Line 1858  sub process_phrase_input {
             $item[1];              $item[1];
         }          }
     term:      term:
         /[\w\Q:!@#$%^&*()+_=|{}<>,.;\\\/?\E]+/ {          /[\w\Q:!@#$%^&*()+_=|{}<>,.;\\\/?\E\-]+/ {
             $item[1];              $item[1];
         }          }
 ENDGRAMMAR  ENDGRAMMAR
Line 2142  sub ensure_db_and_table { Line 2146  sub ensure_db_and_table {
     ##      ##
     if (! defined($table) || $table eq '' || $table =~ /\D/ ) {      if (! defined($table) || $table eq '' || $table =~ /\D/ ) {
         $r->print("Unable to retrieve search results.  ".          $r->print("Unable to retrieve search results.  ".
                   "Unable to determine the table results were stored in.  ".                    "Unable to determine the table results were saved in.  ".
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
         return undef;          return undef;
     }      }
Line 2152  sub ensure_db_and_table { Line 2156  sub ensure_db_and_table {
     my $connection_result = &Apache::lonmysql::connect_to_db();      my $connection_result = &Apache::lonmysql::connect_to_db();
     if (!defined($connection_result)) {      if (!defined($connection_result)) {
         $r->print("Unable to connect to the MySQL database where your results".          $r->print("Unable to connect to the MySQL database where your results".
                   " are stored.".                    " are saved.".
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
         &Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".          &Apache::lonnet::logthis("lonsearchcat: unable to get lonmysql to".
                                  " connect to database.");                                   " connect to database.");
Line 2518  END Line 2522  END
     # Check on the mysql table we will use to store results.      # Check on the mysql table we will use to store results.
     my $table =$env{'form.table'};      my $table =$env{'form.table'};
     if (! defined($table) || $table eq '' || $table =~ /\D/ ) {      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.".                    "The search has been aborted.".
   &Apache::loncommon::end_page());    &Apache::loncommon::end_page());
         return;          return;
Line 2756  sub display_results { Line 2760  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 store import results.</form>'.              $r->print('Unable to save import results.</form>'.
       &Apache::loncommon::end_page());        &Apache::loncommon::end_page());
             $r->rflush();              $r->rflush();
             return;              return;

Removed from v.1.281  
changed lines
  Added in v.1.286


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>