Lines 47-53
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
47 |
|
47 |
|
48 |
if ( change.from.ch == change.to.ch - 1 && cm.findMarksAt( { line: change.from.line, ch: change.from.ch + 1 } ).length ) { |
48 |
if ( change.from.ch == change.to.ch - 1 && cm.findMarksAt( { line: change.from.line, ch: change.from.ch + 1 } ).length ) { |
49 |
change.cancel(); |
49 |
change.cancel(); |
50 |
} else if ( change.from.ch == change.to.ch && cm.findMarksAt(change.from).length && !change.text[0].match(/^[$|ǂ‡]$/) ) { |
50 |
} else if ( change.from.ch == change.to.ch && cm.findMarksAt(change.from).length && !change.text[0] == '‡' ) { |
51 |
change.cancel(); |
51 |
change.cancel(); |
52 |
} |
52 |
} |
53 |
} |
53 |
} |
Lines 68-74
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
68 |
|
68 |
|
69 |
for (var line = origin; line <= newTo.line; line++) { |
69 |
for (var line = origin; line <= newTo.line; line++) { |
70 |
if ( Preferences.user.fieldWidgets ) Widget.UpdateLine( cm.marceditor, line ); |
70 |
if ( Preferences.user.fieldWidgets ) Widget.UpdateLine( cm.marceditor, line ); |
71 |
if ( change.origin != 'setValue' && change.origin != 'marcWidgetPrefill' && change.origin != 'widget.clearToText' ) cm.addLineClass( line, 'wrapper', 'modified-line' ); |
71 |
if ( change.origin != 'setValue' && change.origin != 'marcWidgetPrefill' && change.origin != 'widget.clearToText' ) { |
|
|
72 |
cm.addLineClass( line, 'wrapper', 'modified-line' ); |
73 |
editor.modified = true; |
74 |
} |
72 |
} |
75 |
} |
73 |
} |
76 |
} |
74 |
|
77 |
|
Lines 206-212
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
206 |
// make it be the double cross. |
209 |
// make it be the double cross. |
207 |
var cur = cm.getCursor(); |
210 |
var cur = cm.getCursor(); |
208 |
|
211 |
|
209 |
cm.replaceRange( "$", cur, null ); |
212 |
cm.replaceRange( "‡", cur, null ); |
210 |
}, |
213 |
}, |
211 |
}; |
214 |
}; |
212 |
|
215 |
|
Lines 244-250
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
244 |
this.contentsStart = start; |
247 |
this.contentsStart = start; |
245 |
this.code = '@'; |
248 |
this.code = '@'; |
246 |
} else { |
249 |
} else { |
247 |
this.contentsStart = start + 3; |
250 |
this.contentsStart = start + 2; |
248 |
this.code = this.field.contents.substr( this.start + 1, 1 ); |
251 |
this.code = this.field.contents.substr( this.start + 1, 1 ); |
249 |
} |
252 |
} |
250 |
|
253 |
|
Lines 350-356
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
350 |
var result = ''; |
353 |
var result = ''; |
351 |
|
354 |
|
352 |
$.each( this.getSubfields(), function() { |
355 |
$.each( this.getSubfields(), function() { |
353 |
if ( this.code != '@' ) result += '$' + this.code + ' '; |
356 |
if ( this.code != '@' ) result += '‡' + this.code; |
354 |
|
357 |
|
355 |
result += this.getText(); |
358 |
result += this.getText(); |
356 |
} ); |
359 |
} ); |
Lines 358-364
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
358 |
return result; |
361 |
return result; |
359 |
}, |
362 |
}, |
360 |
setText: function( text ) { |
363 |
setText: function( text ) { |
361 |
var indicator_match = /^([_ 0-9])([_ 0-9])\$/.exec( text ); |
364 |
var indicator_match = /^([_ 0-9])([_ 0-9])\‡/.exec( text ); |
362 |
if ( indicator_match ) { |
365 |
if ( indicator_match ) { |
363 |
text = text.substr(2); |
366 |
text = text.substr(2); |
364 |
this.setIndicator1( indicator_match[1] ); |
367 |
this.setIndicator1( indicator_match[1] ); |
Lines 398-404
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
398 |
if ( this.isControlField ) throw new FieldError('Cannot add subfields to control field'); |
401 |
if ( this.isControlField ) throw new FieldError('Cannot add subfields to control field'); |
399 |
|
402 |
|
400 |
this._invalidateSubfields(); |
403 |
this._invalidateSubfields(); |
401 |
this.cm.replaceRange( '$' + code + ' ', { line: this.line }, null, 'marcAware' ); |
404 |
this.cm.replaceRange( '‡' + code, { line: this.line }, null, 'marcAware' ); |
402 |
var subfields = this.getSubfields(); |
405 |
var subfields = this.getSubfields(); |
403 |
|
406 |
|
404 |
return subfields[ subfields.length - 1 ]; |
407 |
return subfields[ subfields.length - 1 ]; |
Lines 410-416
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
410 |
|
413 |
|
411 |
var subfields = this.getSubfields(); |
414 |
var subfields = this.getSubfields(); |
412 |
this._invalidateSubfields(); |
415 |
this._invalidateSubfields(); |
413 |
this.cm.replaceRange( '$' + code + ' ', { line: this.line, ch: subfields[position] ? subfields[position].start : null }, null, 'marcAware' ); |
416 |
this.cm.replaceRange( '‡' + code, { line: this.line, ch: subfields[position] ? subfields[position].start : null }, null, 'marcAware' ); |
414 |
subfields = this.getSubfields(); |
417 |
subfields = this.getSubfields(); |
415 |
|
418 |
|
416 |
return subfields[ position ]; |
419 |
return subfields[ position ]; |
Lines 501-506
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
501 |
|
504 |
|
502 |
displayRecord: function( record ) { |
505 |
displayRecord: function( record ) { |
503 |
this.cm.setValue( TextMARC.RecordToText(record) ); |
506 |
this.cm.setValue( TextMARC.RecordToText(record) ); |
|
|
507 |
this.modified = false; |
504 |
}, |
508 |
}, |
505 |
|
509 |
|
506 |
getRecord: function() { |
510 |
getRecord: function() { |
Lines 530-536
define( [ 'marc-record', 'koha-backend', 'preferences', 'text-marc', 'widget' ],
Link Here
|
530 |
|
534 |
|
531 |
if ( tagNumber < '010' ) return { tagNumber: tagNumber, contents: contents }; // No current subfield |
535 |
if ( tagNumber < '010' ) return { tagNumber: tagNumber, contents: contents }; // No current subfield |
532 |
|
536 |
|
533 |
var matcher = /[$|ǂ‡]([a-z0-9%]) /g; |
537 |
var matcher = /‡([a-z0-9%])/g; |
534 |
var match; |
538 |
var match; |
535 |
|
539 |
|
536 |
var subfields = []; |
540 |
var subfields = []; |