Diff for /loncom/interface/lonsearchcat.pm between versions 1.266 and 1.267

version 1.266, 2006/06/08 07:20:41 version 1.267, 2006/06/08 13:56:31
Line 215  sub handler { Line 215  sub handler {
     untie %groupsearch_db if (tied(%groupsearch_db));      untie %groupsearch_db if (tied(%groupsearch_db));
     if (($env{'form.cleargroupsort'} eq '1') ||       if (($env{'form.cleargroupsort'} eq '1') || 
         (($env{'form.launch'} eq '1') &&           (($env{'form.launch'} eq '1') && 
          ($env{'form.catalogmode'} eq 'groupsearch'))) {           ($env{'form.catalogmode'} eq 'import'))) {
  if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) {   if (tie(%groupsearch_db,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) {
     &start_fresh_session();      &start_fresh_session();
     untie %groupsearch_db;      untie %groupsearch_db;
Line 260  sub handler { Line 260  sub handler {
             $closebutton .="onClick='self.close()'";              $closebutton .="onClick='self.close()'";
         }          }
         $closebutton .=">\n";          $closebutton .=">\n";
     } elsif ($env{'form.catalogmode'} eq 'groupsearch') {      } elsif ($env{'form.catalogmode'} eq 'import') {
         $closebutton="<input type='button' name='close' value='CLOSE' ";          $closebutton="<input type='button' name='close' value='CLOSE' ";
         if ($env{'form.phase'} =~ /(results|run_search)/) {          if ($env{'form.phase'} =~ /(results|run_search)/) {
     $closebutton .="onClick='parent.close()'";      $closebutton .="onClick='parent.close()'";
Line 660  Prints the form for the basic search.  S Line 660  Prints the form for the basic search.  S
 ######################################################################  ######################################################################
 sub print_basic_search_form {  sub print_basic_search_form {
     my ($r,$closebutton,$hidden_fields) = @_;      my ($r,$closebutton,$hidden_fields) = @_;
     my $result = ($env{'form.catalogmode'} ne 'groupsearch');      my $result = ($env{'form.catalogmode'} ne 'import');
     my $bread_crumb =      my $bread_crumb =
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic',          &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Basic',
     $env{'form.catalogmode'} ne 'groupsearch');      $env{'form.catalogmode'} ne 'import');
     my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb;      my $scrout = &Apache::loncommon::start_page('Search').$bread_crumb;
     if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {      if (&Apache::lonnet::allowed('bre',$env{'request.role.domain'})) {
         # Define interface components          # Define interface components
Line 794  sub print_advanced_search_form{ Line 794  sub print_advanced_search_form{
     my ($r,$closebutton,$hidden_fields) = @_;      my ($r,$closebutton,$hidden_fields) = @_;
     my $bread_crumb =       my $bread_crumb = 
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Advanced',          &Apache::lonhtmlcommon::breadcrumbs('Searching','Search_Advanced',
     $env{'form.catalogmode'} ne 'groupsearch');      $env{'form.catalogmode'} ne 'import');
     my %lt=&Apache::lonlocal::texthash('srch' => 'Search',      my %lt=&Apache::lonlocal::texthash('srch' => 'Search',
        'reset' => 'Reset',         'reset' => 'Reset',
        'help' => 'Help');         'help' => 'Help');
Line 2107  END Line 2107  END
     {'only_body' => 1});      {'only_body' => 1});
     my $breadcrumbs=      my $breadcrumbs=
         &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',          &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
     $env{'form.catalogmode'} ne 'groupsearch');      $env{'form.catalogmode'} ne 'import');
   
     my $result = <<END;      my $result = <<END;
 $start_page  $start_page
 $breadcrumbs  $breadcrumbs
 <form name="statusform" action="" method="POST">  <form name="statusform" action="" method="post" target="_top">
 <input type="hidden" name="Queue" value="" />  <input type="hidden" name="Queue" value="" />
 END  END
   
Line 2337  sub run_search { Line 2337  sub run_search {
     {'only_body' => 1});      {'only_body' => 1});
     my $breadcrumbs =      my $breadcrumbs =
  &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',   &Apache::lonhtmlcommon::breadcrumbs('Searching','Searching',
     $env{'form.catalogmode'} ne 'groupsearch');      $env{'form.catalogmode'} ne 'import');
     $r->print(<<END);      $r->print(<<END);
 $start_page  $start_page
 $breadcrumbs  $breadcrumbs
Line 2527  END Line 2527  END
     # results to get, so let the client know the top frame needs to be      # results to get, so let the client know the top frame needs to be
     # loaded from /adm/searchcat      # loaded from /adm/searchcat
     $r->print(&Apache::loncommon::end_page());      $r->print(&Apache::loncommon::end_page());
 #    if ($env{'form.catalogmode'} ne 'groupsearch') {  #    if ($env{'form.catalogmode'} ne 'import') {
         $r->print("<script>".          $r->print("<script>".
                       "window.location='/adm/searchcat?".                        "window.location='/adm/searchcat?".
                       "phase=sort&".                        "phase=sort&".
Line 2594  sub display_results { Line 2594  sub display_results {
     }      }
     ##      ##
     ## $checkbox_num is a count of the number of checkboxes output on the       ## $checkbox_num is a count of the number of checkboxes output on the 
     ## page this is used only during catalogmode=groupsearch.      ## page this is used only during catalogmode=import.
     my $checkbox_num = 0;      my $checkbox_num = 0;
     ##      ##
     ## Get the catalog controls setup      ## Get the catalog controls setup
     ##      ##
     my $action = "/adm/searchcat?phase=results";      my $action = "/adm/searchcat?phase=results";
     ##      ##
     ## Deal with groupsearch by opening the groupsearch db file.      ## Deal with import by opening the import db file.
     if ($env{'form.catalogmode'} eq 'groupsearch') {      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 store import results.</form>'.
Line 2825  onClick="javascript:select_data('$title' Line 2825  onClick="javascript:select_data('$title'
 </font>  </font>
 END  END
         }          }
     } elsif ($env{'form.catalogmode'} eq 'groupsearch') {      } elsif ($env{'form.catalogmode'} eq 'import') {
         $groupsearch_db{"pre_${fnum}_link"}=$url;          $groupsearch_db{"pre_${fnum}_link"}=$url;
         $groupsearch_db{"pre_${fnum}_title"}=$title;          $groupsearch_db{"pre_${fnum}_title"}=$title;
         $output.=<<END;          $output.=<<END;
Line 2964  The following environment variables are Line 2964  The following environment variables are
   
 =item 'form.catalogmode'   =item 'form.catalogmode' 
   
 Checked for 'interactive' and 'groupsearch'.  Checked for 'interactive' and 'import'.
   
 =item 'form.mode'  =item 'form.mode'
   
Line 3056  function changeURL(val) { Line 3056  function changeURL(val) {
 SCRIPT  SCRIPT
         }          }
     }      }
     $js.=<<SCRIPT if $env{'form.catalogmode'} eq 'groupsearch';      $js.=<<SCRIPT if $env{'form.catalogmode'} eq 'import';
 <script type="text/javascript">  <script type="text/javascript">
     function queue(checkbox_num,val) {      function queue(checkbox_num,val) {
         if (document.forms.results.returnvalues.length != "undefined" &&          if (document.forms.results.returnvalues.length != "undefined" &&
Line 3076  SCRIPT Line 3076  SCRIPT
     }      }
     function select_group() {      function select_group() {
  parent.window.location=   parent.window.location=
     "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=groupsearch&acts="+      "/adm/groupsort?mode=$env{'form.mode'}&catalogmode=import&acts="+
     parent.statusframe.document.forms.statusform.elements.Queue.value;      parent.statusframe.document.forms.statusform.elements.Queue.value;
     }      }
 </script>  </script>
Line 3086  SCRIPT Line 3086  SCRIPT
      {'only_body' =>1});       {'only_body' =>1});
     my $result=<<END;      my $result=<<END;
 $start_page  $start_page
 <form name="results" method="post" action="/adm/searchcat" >  <form name="results" method="post" action="/adm/searchcat">
 <input type="hidden" name="Queue" value="" />  
 $importbutton  $importbutton
 END  END
     return $result;      return $result;
Line 3211  sub detailed_citation_view { Line 3210  sub detailed_citation_view {
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s/^\/ext\//http\:\/\//;      $jumpurl=~s/^\/ext\//http\:\/\//;
     $result .= '<b>'.$prefix.      $result .= '<b>'.$prefix.
         '<img src="'.&Apache::loncommon::icon($values{'url'}).' " />'.'&nbsp;'.          '<img src="'.&Apache::loncommon::icon($values{'url'}).'" />'.'&nbsp;'.
         '<a href="'.$jumpurl.'" '.          '<a href="'.$jumpurl.'" '.
         'target="search_preview">'.$values{'title'}."</a></b>\n";          'target="search_preview">'.$values{'title'}."</a></b>\n";
     $result .= "<p>\n";      $result .= "<p>\n";
Line 3277  sub detailed_citation_view { Line 3276  sub detailed_citation_view {
         next if (! exists($values{$field->{'name'}}) ||          next if (! exists($values{$field->{'name'}}) ||
                  $values{$field->{'name'}} eq '');                   $values{$field->{'name'}} eq '');
         if (exists($field->{'type'}) && $field->{'type'} eq 'list') {          if (exists($field->{'type'}) && $field->{'type'} eq 'list') {
             $result .= '<b>'.&mt($field->{'translate'}).'</b><ul>';              $result .= '<b>'.&mt($field->{'translate'}).'</b>';
             foreach my $item (split(',',$values{$field->{'name'}})){              foreach my $item (split(',',$values{$field->{'name'}})){
                 $result .= '<li>'.                  $result .= 
                     '<a target="search_preview" '.    &Apache::lonhtmlcommon::crumbs($item,
                     'href="'.$jumpurl.'">'.$item.'</a></li>';    (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
     '/res',
     (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1);
             }              }
             $result .= '</ul>';  
         } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){          } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
             $result.= &mt($field->{'translate'},              $result.= &mt($field->{'translate'},
                           sprintf($field->{'format'},                            sprintf($field->{'format'},
                                   $values{$field->{'name'}}))."<br />\n";                                    $values{$field->{'name'}}))."<br />\n";
         } else {          } else {
             if ($field->{'special'} eq 'url link') {              if ($field->{'special'} eq 'url link') {
                 $result.=                   $result.=
                      &mt($field->{'translate'},    &Apache::lonhtmlcommon::crumbs($jumpurl,
                          '<a href="'.$jumpurl.'" '.    (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
                          'target="search_preview">'.    '',
                          $values{$field->{'name'}}.    (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1);
                          '</a>');  
             } else {              } else {
                 $result.= &mt($field->{'translate'},                  $result.= &mt($field->{'translate'},
                               $values{$field->{'name'}});                                $values{$field->{'name'}});
Line 3352  sub summary_view { Line 3351  sub summary_view {
     }      }
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s/^\/ext\//http\:\/\//;      $jumpurl=~s/^\/ext\//http\:\/\//;
       my $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
     (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
     '',
     (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1);
   
     $result.=<<END;      $result.=<<END;
 <a href="$jumpurl"   <a href="$jumpurl" 
    target='search_preview'>$values{'title'}</a><br />     target='search_preview'>$values{'title'}</a>$link
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />  $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
 $values{'copyrighttag'}<br />  $values{'copyrighttag'}<br />
 $values{'extrashow'}  $values{'extrashow'}
Line 3389  sub compact_view { Line 3392  sub compact_view {
     my ($prefix,%values) = @_;      my ($prefix,%values) = @_;
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s/^\/ext\//http\:\/\//;      $jumpurl=~s/^\/ext\//http\:\/\//;
       my $link=&Apache::lonhtmlcommon::crumbs($jumpurl,
     (($env{'form.catalogmode'} eq 'import')?'_top':'preview'),
     '',
     (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),1);
     my $result =       my $result = 
         $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">';          $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'">';
     if (exists($env{'form.sortfield'}) &&       if (exists($env{'form.sortfield'}) && 
Line 3399  sub compact_view { Line 3405  sub compact_view {
         $result .= '&nbsp;'.$tmp.'&nbsp;';          $result .= '&nbsp;'.$tmp.'&nbsp;';
     }      }
     $result.='&nbsp;<a href="'.$jumpurl.'" target="search_preview">'.      $result.='&nbsp;<a href="'.$jumpurl.'" target="search_preview">'.
         $values{'title'}.'</a>'.('&nbsp;'x2).          $values{'title'}.'</a>'.('&nbsp;'x2).$link.
         '<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';          '<b>'.$values{'author'}.'</b> ('.$values{'domain'}.')<br />';
     return $result;      return $result;
 }  }

Removed from v.1.266  
changed lines
  Added in v.1.267


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