Diff for /loncom/interface/lonsearchcat.pm between versions 1.318 and 1.325

version 1.318, 2009/10/23 16:55:15 version 1.325, 2010/08/13 13:32:36
Line 118  sub handler { Line 118  sub handler {
                       # This is set and used in &handler() and is also used in                         # This is set and used in &handler() and is also used in 
                       # &output_results().                        # &output_results().
   
     my $loaderror=&Apache::lonnet::overloaderror($r);  
     if ($loaderror) { return $loaderror; }  
     #      #
     my $closebutton;  # button that closes the search window       my $closebutton;  # button that closes the search window 
                       # This button is different for the RAT compared to                        # This button is different for the RAT compared to
Line 324  END Line 322  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=>"Course Search",                    text=>"Course Search",
Line 492  sub course_search { Line 490  sub 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",
Line 1735  sub parse_domain_restrictions { Line 1733  sub parse_domain_restrictions {
         foreach (sort @allowed_domains) {          foreach (sort @allowed_domains) {
             $pretty_domains_string .= "<b>".$_."</b> ";              $pretty_domains_string .= "<b>".$_."</b> ";
         }          }
  my %servers = &Apache::lonnet::get_servers(\@allowed_domains,   my %servers = &Apache::lonnet::get_unique_servers(\@allowed_domains,
    'library');     'library');
  $libraries_to_query = [keys(%servers)];   $libraries_to_query = [keys(%servers)];
     }      }
Line 2298  sub print_sort_form { Line 2296  sub print_sort_form {
 // <![CDATA[  // <![CDATA[
     function change_sort() {      function change_sort() {
         var newloc = "/adm/searchcat?phase=results";          var newloc = "/adm/searchcat?phase=results";
         newloc += "&amp;persistent_db_id=$env{'form.persistent_db_id'}";          newloc += "&persistent_db_id=$env{'form.persistent_db_id'}";
         newloc += "&amp;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;
     }      }
Line 2593  END Line 2591  END
             @Servers_to_contact = ($serverlist);              @Servers_to_contact = ($serverlist);
         }          }
     } else {      } else {
  my %all_library_servers = &Apache::lonnet::all_library();   my %all_library_servers = &Apache::lonnet::unique_library();
         @Servers_to_contact = sort(keys(%all_library_servers));          @Servers_to_contact = sort(keys(%all_library_servers));
     }      }
     my %Server_status;      my %Server_status;
Line 2972  sub display_results { Line 2970  sub display_results {
                   .&mt('Sort by:').' '                    .&mt('Sort by:').' '
                   .&Apache::loncommon::select_form($env{'form.sortfield'},                    .&Apache::loncommon::select_form($env{'form.sortfield'},
                                                       'sortfield',                                                        'sortfield',
                                                       %sort_fields)                                                        \%sort_fields)
                   .' '                    .' '
                   .&Apache::loncommon::select_form($env{'form.sortorder'},                    .&Apache::loncommon::select_form($env{'form.sortorder'},
                                                       'sortorder',                                                        'sortorder',
                                                       (asc =>&mt('Ascending'),                                                        {asc =>&mt('Ascending'),
                                                        desc=>&mt('Descending')                                                         desc=>&mt('Descending')
                                                        ))                                                         })
                   .'</span>';                    .'</span>';
     ##      ##
     ## Display links for 'prev' and 'next' pages (if necessary) and Display Options      ## Display links for 'prev' and 'next' pages (if necessary) and Display Options
Line 3359  SCRIPT Line 3357  SCRIPT
     }      }
     function select_group() {      function select_group() {
  parent.window.location=   parent.window.location=
     "/adm/groupsort?mode=$env{'form.mode'}&amp;catalogmode=import$inhibit_menu&amp;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>
 SCRIPT  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 $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 = '<h1>'.&mt('Set a link to wishlist').'</h1>'.
                                   '<form method="post" name="newlink" action="/adm/wishlist?mode=set" '.
                                   'onsubmit="return newlinksubmit();" >'.
                                   &Apache::lonhtmlcommon::start_pick_box().
                                   &Apache::lonhtmlcommon::row_title(&mt('Link Title'));
   
       my $in_page_wishlistlink2 = &Apache::lonhtmlcommon::row_closure().
                                   &Apache::lonhtmlcommon::row_title(&mt('Path'));
   
       my $in_page_wishlistlink3 = &Apache::lonhtmlcommon::row_closure().
                                   &Apache::lonhtmlcommon::row_title(&mt('Note')).
                                   '<textarea name="note" rows="3" cols="35" style="width:100%"></textarea>'.
                                   &Apache::lonhtmlcommon::row_closure(1).
                                   &Apache::lonhtmlcommon::end_pick_box().
                                   '<br/><br/>'.
                                   '<input type="submit" value="'.&mt('Save in').'" />'.
                                   '<select name="folders">'.
                                   &Apache::lonwishlist::getfoldersOption().
                                   '</select>'.
                                   '<input type="button" value="'.&mt('cancel').'" onclick="javascript:window.close();" />'.
                                   '</form>';
   
       # 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;
   <script type="text/javascript">
   // <![CDATA[
   function set_wishlistlink(title, path){
      if(!title){
          title=document.title;
      }
      if(!path){
          path=location.pathname;
      }
      wishlistlink=window.open('','wishlistNewLink','width=560,height=350,scrollbars=0');
      wishlistlink.document.write(
      '$start_page_wishlistlink'
      +'<script type="text\/javascript">'
      +'function newlinksubmit(){'
      +'var title = document.getElementsByName("title")[0].value;'
      +'if (!title) {'
      +'alert("$warningLink");'
      +'return false;}'
      +'return true;}'
      +'<\/scr'+'ipt>'
      +'$in_page_wishlistlink1'
      +'<input type="text" name="title" size="45" value="'+title+'"/>'
      +'$in_page_wishlistlink2'
      +'<input type="text" name="path" size="45" value="'+path+'" '
      +'readonly="readonly" style="background-color: #DDDDDD"/>'
      +'$in_page_wishlistlink3'
      +'$end_page_wishlistlink' );
      wishlistlink.document.close();
   }
   
   // ]]>
   </script>
   SCRIPT
   
     my $start_page  = &Apache::loncommon::start_page(undef,$js,      my $start_page  = &Apache::loncommon::start_page(undef,$js,
      {'only_body' =>1});       {'only_body' =>1});
     my $result=<<END;      my $result=<<END;
Line 3486  sub detailed_citation_view { Line 3563  sub detailed_citation_view {
     $result .= '<b>'.$prefix.      $result .= '<b>'.$prefix.
         '<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.'&nbsp;'.          '<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />'.'&nbsp;'.
         '<a href="'.$jumpurl.'?inhibitmenu=yes" '.          '<a href="'.$jumpurl.'?inhibitmenu=yes" '.
         'target="preview">'.$values{'title'}."</a></b>\n";          'target="preview">'.$values{'title'}."</a></b>\n".
           '<a href="javascript:;" onclick="set_wishlistlink('."'$values{'title'}','$jumpurl'".')" '.
           'title="'.&mt('Set link to wishlist').'">'.
           '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.
           'alt="set wishlistlink" style="width:22px;"/></a>';
     $result .= "<p>\n";      $result .= "<p>\n";
     $result .= '<b>'.$values{'author'}.'</b>,'.      $result .= '<b>'.$values{'author'}.'</b>,'.
         ' <i>'.$values{'owner'}.'</i><br />';          ' <i>'.$values{'owner'}.'</i><br />';
Line 3553  sub detailed_citation_view { Line 3634  sub detailed_citation_view {
             $result .= '<b>'.&mt($field->{'translate'}).'</b>';              $result .= '<b>'.&mt($field->{'translate'}).'</b>';
             foreach my $item (split(',',$values{$field->{'name'}})){              foreach my $item (split(',',$values{$field->{'name'}})){
                 $item = &Apache::lonnet::clutter($item);                  $item = &Apache::lonnet::clutter($item);
                 $result .= &display_url($item,[2,0,1]);                  $result .= '<br />'.&display_url($item,1).'<br />';
             }              }
         } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){          } elsif (exists($field->{'format'}) && $field->{'format'} ne ''){
             $result.= &mt($field->{'translate'},              $result.= &mt($field->{'translate'},
Line 3561  sub detailed_citation_view { Line 3642  sub detailed_citation_view {
                                   $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 .= &display_url($jumpurl,[3,0,1]);                  $result .= '<br />'.&display_url($jumpurl,1).'<br />';
             } else {              } else {
                 $result.= &mt($field->{'translate'},                  $result.= &mt($field->{'translate'},
                               $values{$field->{'name'}});                                $values{$field->{'name'}});
Line 3615  sub summary_view { Line 3696  sub summary_view {
     }      }
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
     my $link = &display_url($jumpurl,[2,0,1]);      my $link = '<br />'.&display_url($jumpurl,1).'<br />';
   
       my $titleWL = &mt('Set link to wishlist');
     $result.=<<END;      $result.=<<END;
 <a href="$jumpurl?inhibitmenu=yes"   <a href="$jumpurl?inhibitmenu=yes" 
    target="preview">$values{'title'}</a><br />     target="preview">$values{'title'}</a>
   <a href="javascript:;" onclick="set_wishlistlink('$values{'title'}','$jumpurl')" 
      title="$titleWL">
      <img class="LC_icon" src="/res/adm/pages/wishlist.png"
           alt="set wishlistlink" style="width:22px;"/>
   </a>
   <br />
 $link<br />  $link<br />
 $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />  $values{'author'}, $values{'owner'} -- $values{'lastrevisiondate'}<br />
 $values{'copyrighttag'}<br />  $values{'copyrighttag'}<br />
Line 3651  sub compact_view { Line 3739  sub compact_view {
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
   
     my $link = &display_url($jumpurl,[1,1,1]);      my $link = &display_url($jumpurl,1);
           
     my $result =       my $result = 
         $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />';          $prefix.'<img src="'.&Apache::loncommon::icon($values{'url'}).'" alt="" />';
Line 3665  sub compact_view { Line 3753  sub compact_view {
     $result.=' <span class="LC_nobreak">'.      $result.=' <span class="LC_nobreak">'.
  '<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.   '<a href="'.$jumpurl.'?inhibitmenu=yes" target="preview">'.
         &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.          &HTML::Entities::encode($values{'title'},'<>&"').'</a></span> '.
           '<a href="javascript:;" onclick="set_wishlistlink('."'$values{'title'}','$jumpurl'".')" '.
           'title="'.&mt('Set link to wishlist').'">'.
           '<img class="LC_icon" src="/res/adm/pages/wishlist.png" '.
           'alt="set wishlistlink" style="width:22px;"/>'.
           '</a>'.
  $link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')';   $link.' <b>'.$values{'author'}.'</b> ('.$values{'domain'}.')';
     return $result;      return $result;
 }  }
   
 sub display_url {  sub display_url {
     my ($url,$crumb_args) = @_;      my ($url,$skiplast) = @_;
     my $link;      my $link;
     if ($url=~m|^/ext/|) {      if ($url=~m|^/ext/|) {
  $url=~s|^/ext/|http://|;   $url=~s|^/ext/|http://|;
Line 3678  sub display_url { Line 3771  sub display_url {
     } elsif ($url=~m{^(http://|/uploaded/)}) {      } elsif ($url=~m{^(http://|/uploaded/)}) {
  $link='<span class="LC_filename">'.$url.'</span>';   $link='<span class="LC_filename">'.$url.'</span>';
     } else {      } else {
         $link=&Apache::lonhtmlcommon::crumbs($url,          $link=&Apache::lonhtmlcommon::crumbs(
   'preview',                    $url,
   '',                    'preview',
   (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),@{$crumb_args}).' ';                    '',
                     (($env{'form.catalogmode'} eq 'import')?'parent.statusframe.document.forms.statusform':''),
                     $skiplast).' ';
     }      }
     return $link;      return $link;
 }  }
Line 3704  sub fielded_format_view { Line 3799  sub fielded_format_view {
     my $jumpurl=$values{'url'};      my $jumpurl=$values{'url'};
     $jumpurl=~s|^/ext/|http://|;      $jumpurl=~s|^/ext/|http://|;
   
       my $titleWL = ('Set link to wishlist');
     my $result=<<END;      my $result=<<END;
 $prefix <img src="$icon" alt="" />  $prefix <img src="$icon" alt="" />
 <dl>  <dl>
 <dt>URL:</dt>  <dt>URL:</dt>
     <dd><a href="$jumpurl?inhibitmenu=yes"       <dd><a href="$jumpurl?inhibitmenu=yes" 
          target='preview'>$values{'url'}</a></dd>           target='preview'>$values{'url'}</a>
            <a href="javascript:;" onclick="set_wishlistlink('$values{'title'}','$jumpurl')"
               title="$titleWL">
               <img class="LC_icon" src="/res/adm/pages/wishlist.png"
               alt="set wishlistlink" style="width:22px;"/>
            </a>
       </dd>
 END  END
     foreach my $field ('title','author','domain','subject','keywords','notes',      foreach my $field ('title','author','domain','subject','keywords','notes',
                        'mimetag','language','creationdate','lastrevisiondate',                         'mimetag','language','creationdate','lastrevisiondate',

Removed from v.1.318  
changed lines
  Added in v.1.325


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