| 
      
            Lines 37-42
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 37 | 
                  'koha:biblioserver': { | 
          37 | 
                  'koha:biblioserver': { | 
        
        
          | 38 | 
                      name: _("Local catalog"), | 
          38 | 
                      name: _("Local catalog"), | 
        
        
          | 39 | 
                      recordtype: 'biblio',  | 
          39 | 
                      recordtype: 'biblio',  | 
        
            
               | 
               | 
              40 | 
                          enabled: true,  | 
            
        
          | 40 | 
                      checked: false,  | 
          41 | 
                      checked: false,  | 
        
        
          | 41 | 
                  },  | 
          42 | 
                  },  | 
        
        
          | 42 | 
                  [%- FOREACH batch = editable_batches -%]  | 
          43 | 
                  [%- FOREACH batch = editable_batches -%]  | 
        
  
    | 
      
            Lines 51-56
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 51 | 
                          name: '[% server.servername | html %]',  | 
          52 | 
                          name: '[% server.servername | html %]',  | 
        
        
          | 52 | 
                          recordtype: '[% server.recordtype | html %]',  | 
          53 | 
                          recordtype: '[% server.recordtype | html %]',  | 
        
        
          | 53 | 
                          checked: [% server.checked ? 'true' : 'false' | html %],  | 
          54 | 
                          checked: [% server.checked ? 'true' : 'false' | html %],  | 
        
            
               | 
               | 
              55 | 
                              enabled: true,  | 
            
        
          | 54 | 
                      },  | 
          56 | 
                      },  | 
        
        
          | 55 | 
                  [%- END -%]  | 
          57 | 
                  [%- END -%]  | 
        
        
          | 56 | 
              };  | 
          58 | 
              };  | 
        
  
    | 
      
            Lines 165-181
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 165 | 
           | 
          167 | 
           | 
        
        
          | 166 | 
                  $('#quicksearch .search-box').each( function() { | 
          168 | 
                  $('#quicksearch .search-box').each( function() { | 
        
        
          | 167 | 
                      shortcut.add( 'enter', $.proxy( function() { | 
          169 | 
                      shortcut.add( 'enter', $.proxy( function() { | 
        
          
            
              | 168 | 
                              var terms = [];  | 
              170 | 
                              var terms = {}; | 
            
        
          | 169 | 
           | 
          171 | 
           | 
        
        
          | 170 | 
                          $('#quicksearch .search-box').each( function() { | 
          172 | 
                          $('#quicksearch .search-box').each( function() { | 
        
        
          | 171 | 
                              if ( !this.value ) return;  | 
          173 | 
                              if ( !this.value ) return;  | 
        
        
          | 172 | 
           | 
          174 | 
           | 
        
          
            
              | 173 | 
                                  terms.push( [ $(this).data('qualifier'), this.value ] ); | 
              175 | 
                                  terms[ $(this).data('qualifier') ] = this.value; | 
            
        
          | 174 | 
                          } );  | 
          176 | 
                          } );  | 
        
        
          | 175 | 
           | 
          177 | 
           | 
        
          
            
              | 176 | 
                              if ( !terms.length ) return;  | 
              178 | 
                              if ( $.isEmptyObject(terms) ) return;  | 
            
        
          | 177 | 
           | 
          179 | 
           | 
        
          
            
              | 178 | 
                              if ( Search.Run( z3950Servers, Search.JoinTerms(terms) ) ) { | 
              180 | 
                              if ( Search.Run( z3950Servers, terms ) ) { | 
            
        
          | 179 | 
                              $("#search-overlay").show(); | 
          181 | 
                              $("#search-overlay").show(); | 
        
        
          | 180 | 
                              showResultsBox();  | 
          182 | 
                              showResultsBox();  | 
        
        
          | 181 | 
                          }  | 
          183 | 
                          }  | 
        
  
    | 
      
            Lines 366-371
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 366 | 
                  $( '#save-targets input[data-target-id="' + target_id + '"]' ).closest('li').toggle(enabled); | 
          368 | 
                  $( '#save-targets input[data-target-id="' + target_id + '"]' ).closest('li').toggle(enabled); | 
        
        
          | 367 | 
              }  | 
          369 | 
              }  | 
        
        
          | 368 | 
           | 
          370 | 
           | 
        
            
               | 
               | 
              371 | 
                  function setSearchTargetChecked( server_id, checked ) { | 
            
            
              | 372 | 
                      if ( z3950Servers[server_id] == null ) return;  | 
            
            
              | 373 | 
               | 
            
            
              | 374 | 
                      z3950Servers[server_id].checked = checked;  | 
            
            
              | 375 | 
                      $( '.search-target-list li[data-server-id="' + server_id + '"] input' ).prop('checked', checked); | 
            
            
              | 376 | 
                  }  | 
            
            
              | 377 | 
               | 
            
            
              | 378 | 
                  function setSearchTargetEnabled( server_id, enabled ) { | 
            
            
              | 379 | 
                      if ( !enabled ) { | 
            
            
              | 380 | 
                          setSearchTargetChecked( server_id, false );  | 
            
            
              | 381 | 
                      }  | 
            
            
              | 382 | 
               | 
            
            
              | 383 | 
                      z3950Servers[server_id].enabled = enabled;  | 
            
            
              | 384 | 
                      $( '.search-target-list li[data-server-id="' + server_id + '"]' ).toggle(enabled);  | 
            
            
              | 385 | 
                  }  | 
            
            
              | 386 | 
               | 
            
        
          | 369 | 
              function setSource(parts) { | 
          387 | 
              function setSource(parts) { | 
        
        
          | 370 | 
                  state.backend = parts[0];  | 
          388 | 
                  state.backend = parts[0];  | 
        
        
          | 371 | 
                  state.recordID = parts[1];  | 
          389 | 
                  state.recordID = parts[1];  | 
        
  
    | 
      
            Lines 466-488
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 466 | 
              function showAdvancedSearch() { | 
          484 | 
              function showAdvancedSearch() { | 
        
        
          | 467 | 
                  $('#advanced-search-servers').empty(); | 
          485 | 
                  $('#advanced-search-servers').empty(); | 
        
        
          | 468 | 
                  $.each( z3950Servers, function( server_id, server ) { | 
          486 | 
                  $.each( z3950Servers, function( server_id, server ) { | 
        
            
               | 
               | 
              487 | 
                          if ( !server.enabled ) return;  | 
            
        
          | 469 | 
                      $('#advanced-search-servers').append( '<li data-server-id="' + server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); | 
          488 | 
                      $('#advanced-search-servers').append( '<li data-server-id="' + server_id + '"><label><input class="search-toggle-server" type="checkbox"' + ( server.checked ? ' checked="checked">' : '>' ) + server.name + '</label></li>' ); | 
        
        
          | 470 | 
                  } );  | 
          489 | 
                  } );  | 
        
        
          | 471 | 
                  $('#advanced-search-ui').modal('show'); | 
          490 | 
                  $('#advanced-search-ui').modal('show'); | 
        
        
          | 472 | 
              }  | 
          491 | 
              }  | 
        
        
          | 473 | 
           | 
          492 | 
           | 
        
        
          | 474 | 
              function startAdvancedSearch() { | 
          493 | 
              function startAdvancedSearch() { | 
        
          
            
              | 475 | 
                      var terms = [];  | 
              494 | 
                      var terms = {}; | 
            
        
          | 476 | 
           | 
          495 | 
           | 
        
        
          | 477 | 
                  $('#advanced-search-ui .search-box').each( function() { | 
          496 | 
                  $('#advanced-search-ui .search-box').each( function() { | 
        
        
          | 478 | 
                      if ( !this.value ) return;  | 
          497 | 
                      if ( !this.value ) return;  | 
        
        
          | 479 | 
           | 
          498 | 
           | 
        
          
            
              | 480 | 
                          terms.push( [ $(this).data('qualifier'), this.value ] ); | 
              499 | 
                          terms[ $(this).data('qualifier') ] = this.value; | 
            
        
          | 481 | 
                  } );  | 
          500 | 
                  } );  | 
        
        
          | 482 | 
           | 
          501 | 
           | 
        
          
            
              | 483 | 
                      if ( !terms.length ) return;  | 
              502 | 
                      if ( $.isEmptyObject(terms) ) return;  | 
            
        
          | 484 | 
           | 
          503 | 
           | 
        
          
            
              | 485 | 
                      if ( Search.Run( z3950Servers, Search.JoinTerms(terms) ) ) { | 
              504 | 
                      if ( Search.Run( z3950Servers, terms ) ) { | 
            
        
          | 486 | 
                      $('#advanced-search-ui').modal('hide'); | 
          505 | 
                      $('#advanced-search-ui').modal('hide'); | 
        
        
          | 487 | 
                      $("#search-overlay").show(); | 
          506 | 
                      $("#search-overlay").show(); | 
        
        
          | 488 | 
                      showResultsBox();  | 
          507 | 
                      showResultsBox();  | 
        
  
    | 
      
            Lines 555-573
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 555 | 
                  $.each( data.hits, function( undef, hit ) { | 
          574 | 
                  $.each( data.hits, function( undef, hit ) { | 
        
        
          | 556 | 
                      backends.search.records[ hit.server + ':' + hit.index ] = hit.record;  | 
          575 | 
                      backends.search.records[ hit.server + ':' + hit.index ] = hit.record;  | 
        
        
          | 557 | 
           | 
          576 | 
           | 
        
          
            
              | 558 | 
                          switch ( hit.server ) { | 
              577 | 
                          hit.id = 'search/' + hit.server + ':' + hit.index;  | 
            
            
              | 559 | 
                              case 'koha:biblioserver':  | 
              578 | 
                          if ( hit.server == 'koha:biblioserver' ) { | 
            
            
              | 560 | 
                                  var bibnumField = hit.record.field( bibnumMap[0] );  | 
              579 | 
                              var bibnumField = hit.record.field( bibnumMap[0] );  | 
            
            
              | 561 | 
               | 
               | 
               | 
            
            
              | 562 | 
                                  if ( bibnumField && bibnumField.hasSubfield( bibnumMap[1] ) ) { | 
            
            
              | 563 | 
                                      hit.id = 'catalog/' + bibnumField.subfield( bibnumMap[1] );  | 
            
            
              | 564 | 
                                      break;  | 
            
            
              | 565 | 
                                  }  | 
            
            
              | 566 | 
               | 
            
            
              | 567 | 
                                  // Otherwise, fallthrough  | 
            
        
          | 568 | 
           | 
          580 | 
           | 
        
          
            
              | 569 | 
                              default:  | 
              581 | 
                              if ( bibnumField && bibnumField.hasSubfield( bibnumMap[1] ) ) { | 
            
            
              | 570 | 
                                  hit.id = 'search/' + hit.server + ':' + hit.index;  | 
              582 | 
                                  hit.id = 'catalog/' + bibnumField.subfield( bibnumMap[1] );  | 
            
            
               | 
               | 
              583 | 
                              }  | 
            
            
              | 584 | 
                          } else if ( /^batch:/.test(hit.server) && hit.import_record_id ) { | 
            
            
              | 585 | 
                              hit.id = hit.server + '/' + hit.import_record_id;  | 
            
        
          | 571 | 
                      }  | 
          586 | 
                      }  | 
        
        
          | 572 | 
           | 
          587 | 
           | 
        
        
          | 573 | 
                      var result = '<tr>';  | 
          588 | 
                      var result = '<tr>';  | 
        
  
    | 
      
            Lines 688-696
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 688 | 
                  switch (pref) { | 
          703 | 
                  switch (pref) { | 
        
        
          | 689 | 
                      case 'enabledBatches':  | 
          704 | 
                      case 'enabledBatches':  | 
        
        
          | 690 | 
                          $.each( editable_batches, function( batch_id, batch ) { | 
          705 | 
                          $.each( editable_batches, function( batch_id, batch ) { | 
        
          
            
              | 691 | 
                                  $( '#batches-list li[data-batch-id=' + batch_id + '] input' )[0].checked = Preferences.user.enabledBatches[batch_id];  | 
              706 | 
                                  $( '#batches-table tr[data-batch-id=' + batch_id + '] input.is-save-target' )[0].checked = Preferences.user.enabledBatches[batch_id];  | 
            
        
          | 692 | 
                              setSaveTargetEnabled( 'batch:' + batch_id + '/', Preferences.user.enabledBatches[batch_id] || false );  | 
          707 | 
                              setSaveTargetEnabled( 'batch:' + batch_id + '/', Preferences.user.enabledBatches[batch_id] || false );  | 
        
        
          | 693 | 
                          } );  | 
          708 | 
                          } );  | 
        
            
               | 
               | 
              709 | 
                          case 'enabledSearchBatches':  | 
            
            
              | 710 | 
                              $.each( editable_batches, function( batch_id, batch ) { | 
            
            
              | 711 | 
                                  $( '#batches-table tr[data-batch-id=' + batch_id + '] input.is-searchable' )[0].checked = Preferences.user.enabledSearchBatches[batch_id];  | 
            
            
              | 712 | 
                                  setSearchTargetEnabled( 'batch:' + batch_id, Preferences.user.enabledSearchBatches[batch_id] || false );  | 
            
            
              | 713 | 
                              } );  | 
            
        
          | 694 | 
                      case 'fieldWidgets':  | 
          714 | 
                      case 'fieldWidgets':  | 
        
        
          | 695 | 
                          $( '#set-field-widgets' ).text( value ? _("Show fields verbatim") : _("Show helpers for fixed and coded fields") ); | 
          715 | 
                          $( '#set-field-widgets' ).text( value ? _("Show fields verbatim") : _("Show helpers for fixed and coded fields") ); | 
        
        
          | 696 | 
                          break;  | 
          716 | 
                          break;  | 
        
  
    | 
      
            Lines 719-731
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 719 | 
                              if ( saved_val != null ) setSaveTargetChecked( target_id, saved_val );  | 
          739 | 
                              if ( saved_val != null ) setSaveTargetChecked( target_id, saved_val );  | 
        
        
          | 720 | 
                          } );  | 
          740 | 
                          } );  | 
        
        
          | 721 | 
                          break;  | 
          741 | 
                          break;  | 
        
            
              | 722 | 
                          case 'selected_search_targets':  | 
               | 
               | 
            
            
              | 723 | 
                              $.each( z3950Servers, function( server_id, server ) { | 
            
            
              | 724 | 
                                  var saved_val = Preferences.user.selected_search_targets[server_id];  | 
            
            
              | 725 | 
               | 
            
            
              | 726 | 
                                  if ( saved_val != null ) server.checked = saved_val;  | 
            
            
              | 727 | 
                              } );  | 
            
            
              | 728 | 
                              break;  | 
            
        
          | 729 | 
                  }  | 
          742 | 
                  }  | 
        
        
          | 730 | 
              }  | 
          743 | 
              }  | 
        
        
          | 731 | 
           | 
          744 | 
           | 
        
  
    | 
      
            Lines 750-757
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 750 | 
           | 
          763 | 
           | 
        
        
          | 751 | 
                  switch (pref) { | 
          764 | 
                  switch (pref) { | 
        
        
          | 752 | 
                      case 'enabledBatches':  | 
          765 | 
                      case 'enabledBatches':  | 
        
          
            
              | 753 | 
                              _addLiveHandler( '#batches-list input', 'change', function() { | 
              766 | 
                              _addLiveHandler( '#batches-table input.is-save-target', 'change', function() { | 
            
            
              | 754 | 
                                  Preferences.user.enabledBatches[ $( this ).closest('li').data('batch-id') ] = this.checked; | 
              767 | 
                                  Preferences.user.enabledBatches[ $( this ).closest('tr').data('batch-id') ] = this.checked; | 
            
            
               | 
               | 
              768 | 
                              } );  | 
            
            
              | 769 | 
                              break;  | 
            
            
              | 770 | 
                          case 'enabledSearchBatches':  | 
            
            
              | 771 | 
                              _addLiveHandler( '#batches-table input.is-searchable', 'change', function() { | 
            
            
              | 772 | 
                                  Preferences.user.enabledSearchBatches[ $( this ).closest('tr').data('batch-id') ] = this.checked; | 
            
        
          | 755 | 
                          } );  | 
          773 | 
                          } );  | 
        
        
          | 756 | 
                          break;  | 
          774 | 
                          break;  | 
        
        
          | 757 | 
                      case 'fieldWidgets':  | 
          775 | 
                      case 'fieldWidgets':  | 
        
  
    | 
      
            Lines 908-921
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 908 | 
                  };  | 
          926 | 
                  };  | 
        
        
          | 909 | 
           | 
          927 | 
           | 
        
        
          | 910 | 
                  // Build batch UI  | 
          928 | 
                  // Build batch UI  | 
        
          
            
              | 911 | 
                      var $batch_entry = $( '<li data-batch-id="' + batch.batch_id + '"><input type="checkbox" />' + batch.name + '</li>' );  | 
              929 | 
                      var $batch_entry = $( '<tr data-batch-id="' + batch.batch_id + '"><td>' + batch.name + '</td><td><input type="checkbox" class="is-searchable" /></td><td><input type="checkbox" class="is-save-target" /></td></tr>' );  | 
            
        
          | 912 | 
           | 
          930 | 
           | 
        
          
            
              | 913 | 
                      var $batch_buttons = $('<span class="batch-buttons"></span>').appendTo($batch_entry); | 
              931 | 
                      var $batch_buttons = $('<td class="batch-buttons"></td>').appendTo($batch_entry); | 
            
        
          | 914 | 
                  var $export_button = $( '<button>' + _("Export...") + '</button>' ).appendTo($batch_buttons).click( function() { | 
          932 | 
                  var $export_button = $( '<button>' + _("Export...") + '</button>' ).appendTo($batch_buttons).click( function() { | 
        
          
            
              | 915 | 
                          $('#batches-list .batch-export').hide(); | 
              933 | 
                          $('#batches-table .batch-export').hide(); | 
            
        
          | 916 | 
                      $export_screen.show();  | 
          934 | 
                      $export_screen.show();  | 
        
        
          | 917 | 
                  } );  | 
          935 | 
                  } );  | 
        
        
          | 918 | 
           | 
          936 | 
           | 
        
            
               | 
               | 
              937 | 
                      timestamp_pattern = '\\d{4}(0\\d|1[012])([012]\\d|3[01])(([01]\\d|2[0-3])[0-5]\\d[0-5]\\d)?' | 
            
            
              | 938 | 
               | 
            
        
          | 919 | 
                  var $export_screen = $(  | 
          939 | 
                  var $export_screen = $(  | 
        
        
          | 920 | 
                      '<form class="batch-export form-horizontal" style="display: none">'  | 
          940 | 
                      '<form class="batch-export form-horizontal" style="display: none">'  | 
        
        
          | 921 | 
                      + '<div class="control-group">'  | 
          941 | 
                      + '<div class="control-group">'  | 
        
  
    | 
      
            Lines 923-936
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 923 | 
                      + '<div class="controls"><input class="batch-control-number-start" type="text"> - <input class="batch-control-number-end" type="text"></div>'  | 
          943 | 
                      + '<div class="controls"><input class="batch-control-number-start" type="text"> - <input class="batch-control-number-end" type="text"></div>'  | 
        
        
          | 924 | 
                      + '</div>'  | 
          944 | 
                      + '</div>'  | 
        
        
          | 925 | 
                      + '<label class="control-label">' + _("Timestamp range (YYYYMMDD or YYYMMDDHHMMSS):") + '</label>' | 
          945 | 
                      + '<label class="control-label">' + _("Timestamp range (YYYYMMDD or YYYMMDDHHMMSS):") + '</label>' | 
        
          
            
              | 926 | 
                          + '<div class="controls"><input class="batch-timestamp-start" type="text"> - <input class="batch-timestamp-end" type="text"></div>'  | 
              946 | 
                          + '<div class="controls"><input class="batch-timestamp-start" type="text" pattern="' + timestamp_pattern + '"> - <input class="batch-timestamp-end" type="text" pattern="' + timestamp_pattern + '"></div>'  | 
            
        
          | 927 | 
                      + '</div>'  | 
          947 | 
                      + '</div>'  | 
        
        
          | 928 | 
                      + '<div class="control-group">'  | 
          948 | 
                      + '<div class="control-group">'  | 
        
        
          | 929 | 
                      + '<div class="controls"><button class="batch-export-start">' + _("Start export") + '</div>' | 
          949 | 
                      + '<div class="controls"><button class="batch-export-start">' + _("Start export") + '</div>' | 
        
        
          | 930 | 
                      + '</form>'  | 
          950 | 
                      + '</form>'  | 
        
          
            
              | 931 | 
                      ).appendTo($batch_entry);  | 
              951 | 
                      ).appendTo($batch_buttons);  | 
            
        
          | 932 | 
           | 
          952 | 
           | 
        
          
            
              | 933 | 
                      $export_screen.find('.batch-export-start').click( function() { | 
              953 | 
                      $export_screen.submit( function() { | 
            
        
          | 934 | 
                      function getFormVal(name) { | 
          954 | 
                      function getFormVal(name) { | 
        
        
          | 935 | 
                          return $export_screen.find( '.batch-' + name ).val();  | 
          955 | 
                          return $export_screen.find( '.batch-' + name ).val();  | 
        
        
          | 936 | 
                      }  | 
          956 | 
                      }  | 
        
  
    | 
      
            Lines 945-951
          require( [ 'koha-backend', 'search', 'macros', 'marc-editor', 'marc-record', 'pr
      
      
        Link Here
      
     | 
  
        
          | 945 | 
                      KohaBackend.StartBatchExport( batch.batch_id, options );  | 
          965 | 
                      KohaBackend.StartBatchExport( batch.batch_id, options );  | 
        
        
          | 946 | 
                  } );  | 
          966 | 
                  } );  | 
        
        
          | 947 | 
           | 
          967 | 
           | 
        
          
            
              | 948 | 
                      $('#batches-list').append( $batch_entry ); | 
              968 | 
                      $('#batches-table tbody').append( $batch_entry ); | 
            
        
          | 949 | 
              }  | 
          969 | 
              }  | 
        
        
          | 950 | 
           | 
          970 | 
           | 
        
        
          | 951 | 
              $(document).ready( function() { | 
          971 | 
              $(document).ready( function() { |