/[RFID]/koha/koha-rfid.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /koha/koha-rfid.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 69 by dpavlin, Thu Feb 11 18:40:24 2010 UTC revision 72 by dpavlin, Thu Feb 11 20:59:42 2010 UTC
# Line 1  Line 1 
1    
2  // XXX dpavlin: RFID support for Koha  // XXX dpavlin: RFID support for Koha
3    
4    function rfid_secure(barcode,sid,val) {
5            console.debug('rfid_secure', barcode, sid, val);
6            $('table tr td a:contains(130)').each( function(i,o) {
7                    var possible = $(o).text();
8    console.debug(i,o,possible, barcode);
9                    if ( possible == barcode ) {
10                            $.getJSON( 'http://localhost:9000/secure.js?' + sid + '=' + val + ';callback=?' )
11                    }
12            });
13    }
14    
15  function rfid_scan(data,textStatus) {  function rfid_scan(data,textStatus) {
16  //      console.debug( 'rfid_scan', data, textStatus );  //      console.debug( 'rfid_scan', data, textStatus );
17    
# Line 12  function rfid_scan(data,textStatus) { Line 23  function rfid_scan(data,textStatus) {
23    
24          if ( data.tags ) {          if ( data.tags ) {
25                  if ( data.tags.length === 1 ) {                  if ( data.tags.length === 1 ) {
26                          var numbers = data.tags[0].content;                          var t = data.tags[0];
27                          if ( span.text() != numbers ) {                          if ( span.text() != t.content ) {
28                                  if ( numbers.substr(0,3) == '130' ) {                                  if ( t.content.substr(0,3) == '130' ) {
29                                          span.text( numbers ).css('color', 'blue');                                          var color = 'blue';
30                                          $('input[name=barcode]').val( numbers );                                          if ( t.security.toUpperCase() == 'DA' ) color = 'red';
31                                            if ( t.security.toUpperCase() == 'D7' ) color = 'green';
32                                            span.text( t.content ).css('color', color);
33                                            $('input[name=barcode]').val( t.content );
34    
35                                            var url = document.location.toString();
36                                            if ( url.substr(-14,14) == 'circulation.pl' )
37                                                     rfid_secure( t.content, t.sid, 'D7' );
38                                            if ( url.substr(-10,10) == 'returns.pl' )
39                                                     rfid_secure( t.content, t.sid, 'DA' );
40    
41                                  } else {                                  } else {
42                                          span.text( numbers ).css('color', 'yellow' );                                          span.text( t.content ).css('color', 'blue' );
43                                          $('input[name=findborrower]').val( numbers );                                          $('input[name=findborrower]').val( t.content );
44                                  }                                  }
45                          }                          }
46                  } else {                  } else {
# Line 27  function rfid_scan(data,textStatus) { Line 48  function rfid_scan(data,textStatus) {
48                          $.each( data.tags, function(i,tag) { error += tag.content + ' '; } );                          $.each( data.tags, function(i,tag) { error += tag.content + ' '; } );
49                          span.text( error ).css( 'color', 'red' );                          span.text( error ).css( 'color', 'red' );
50                  }                  }
51    
52          } else {          } else {
53                  span.text( 'no tags in range' ).css('color','gray');                  span.text( 'no tags in range' ).css('color','gray');
54          }          }

Legend:
Removed from v.69  
changed lines
  Added in v.72

  ViewVC Help
Powered by ViewVC 1.1.26