/[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

Contents of /koha/koha-rfid.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 70 - (show annotations)
Thu Feb 11 18:48:19 2010 UTC (14 years, 2 months ago) by dpavlin
File MIME type: application/javascript
File size: 1302 byte(s)
colorize book according to security status (red/green)

1
2 // XXX dpavlin: RFID support for Koha
3
4 function rfid_scan(data,textStatus) {
5 // console.debug( 'rfid_scan', data, textStatus );
6
7 var span = $('span#rfid');
8 if ( span.size() == 0 ) {
9 $('ul#i18nMenu').append('<li><span id=rfid>RFID reader found<span>');
10 span = $('span#rfid');
11 }
12
13 if ( data.tags ) {
14 if ( data.tags.length === 1 ) {
15 var t = data.tags[0];
16 if ( span.text() != t.content ) {
17 if ( t.content.substr(0,3) == '130' ) {
18 var color = 'blue';
19 if ( t.security.toUpperCase() == 'DA' ) color = 'red';
20 if ( t.security.toUpperCase() == 'D7' ) color = 'green';
21 span.text( t.content ).css('color', color);
22 $('input[name=barcode]').val( t.content );
23 } else {
24 span.text( t.content ).css('color', 'yellow' );
25 $('input[name=findborrower]').val( t.content );
26 }
27 }
28 } else {
29 var error = data.tags.length + ' tags near reader: ';
30 $.each( data.tags, function(i,tag) { error += tag.content + ' '; } );
31 span.text( error ).css( 'color', 'red' );
32 }
33 } else {
34 span.text( 'no tags in range' ).css('color','gray');
35 }
36
37 window.setTimeout( function() {
38 $.getJSON("http://localhost:9000/scan?callback=?", rfid_scan);
39 }, 1000 ); // 1000ms
40 }
41
42 $(document).ready( function() {
43 $.getJSON("http://localhost:9000/scan?callback=?", rfid_scan);
44 });

  ViewVC Help
Powered by ViewVC 1.1.26