'required' => '0',
'min_ver' => '0.614',
},
+ 'UUID' => {
+ 'usage' => 'Professional cataloging interface',
+ 'required' => '1',
+ 'min_ver' => '0.05',
+ },
};
1;
_framework_mappings[frameworkcode][tagnum] = $.extend( {}, taginfo, { subfields: subfields } );
} );
-
- console.dir( _framework_kohafields );
}
_importFramework( '', defaultFramework.framework );
$.each( _frameworks[frameworkcode], function( undef, tag ) {
var tagnum = tag[0], taginfo = tag[1];
- if ( taginfo[field] == value ) result[tagnum] = true;
+ if ( taginfo[field] == value && taginfo.tab != '-1' ) result[tagnum] = true;
} );
return result;
if ( change.from.ch == change.to.ch - 1 && cm.findMarksAt( { line: change.from.line, ch: change.from.ch + 1 } ).length ) {
change.cancel();
- } else if ( change.from.ch == change.to.ch && cm.findMarksAt(change.from).length && !change.text[0].match(/^[$|ǂ‡]$/) ) {
+ } else if ( change.from.ch == change.to.ch && cm.findMarksAt(change.from).length && !change.text[0] == '‡' ) {
change.cancel();
}
}
for (var line = origin; line <= newTo.line; line++) {
if ( Preferences.user.fieldWidgets ) Widget.UpdateLine( cm.marceditor, line );
- if ( change.origin != 'setValue' && change.origin != 'marcWidgetPrefill' && change.origin != 'widget.clearToText' ) cm.addLineClass( line, 'wrapper', 'modified-line' );
+ if ( change.origin != 'setValue' && change.origin != 'marcWidgetPrefill' && change.origin != 'widget.clearToText' ) {
+ cm.addLineClass( line, 'wrapper', 'modified-line' );
+ editor.modified = true;
+ }
}
}
// make it be the double cross.
var cur = cm.getCursor();
- cm.replaceRange( "$", cur, null );
+ cm.replaceRange( "‡", cur, null );
},
};
this.contentsStart = start;
this.code = '@';
} else {
- this.contentsStart = start + 3;
+ this.contentsStart = start + 2;
this.code = this.field.contents.substr( this.start + 1, 1 );
}
var result = '';
$.each( this.getSubfields(), function() {
- if ( this.code != '@' ) result += '$' + this.code + ' ';
+ if ( this.code != '@' ) result += '‡' + this.code;
result += this.getText();
} );
return result;
},
setText: function( text ) {
- var indicator_match = /^([_ 0-9])([_ 0-9])\$/.exec( text );
+ var indicator_match = /^([_ 0-9])([_ 0-9])\‡/.exec( text );
if ( indicator_match ) {
text = text.substr(2);
this.setIndicator1( indicator_match[1] );
if ( this.isControlField ) throw new FieldError('Cannot add subfields to control field');
this._invalidateSubfields();
- this.cm.replaceRange( '$' + code + ' ', { line: this.line }, null, 'marcAware' );
+ this.cm.replaceRange( '‡' + code, { line: this.line }, null, 'marcAware' );
var subfields = this.getSubfields();
return subfields[ subfields.length - 1 ];
var subfields = this.getSubfields();
this._invalidateSubfields();
- this.cm.replaceRange( '$' + code + ' ', { line: this.line, ch: subfields[position] ? subfields[position].start : null }, null, 'marcAware' );
+ this.cm.replaceRange( '‡' + code, { line: this.line, ch: subfields[position] ? subfields[position].start : null }, null, 'marcAware' );
subfields = this.getSubfields();
return subfields[ position ];
displayRecord: function( record ) {
this.cm.setValue( TextMARC.RecordToText(record) );
+ this.modified = false;
},
getRecord: function() {
if ( tagNumber < '010' ) return { tagNumber: tagNumber, contents: contents }; // No current subfield
- var matcher = /[$|ǂ‡]([a-z0-9%]) /g;
+ var matcher = /‡([a-z0-9%])/g;
var match;
var subfields = [];
* along with Koha; if not, see <http://www.gnu.org/licenses>.
*/
-// Expected format: 245 _ 1 $a Pizza |c 34ars
+// Expected format: 245 _ 1 ‡aPizza ‡c34ars
CodeMirror.defineMode( 'marc', function( config, modeConfig ) {
modeConfig.nonRepeatableTags = modeConfig.nonRepeatableTags || {};
// matching.
if ( stream.match( /[ \t]+$/ ) ) {
return 'end-space';
- } else if ( stream.match( /[^ \t$|ǂ‡]+/ ) || stream.match( /[ \t]+/ ) ) {
+ } else if ( stream.match( /[^ \t‡]+/ ) || stream.match( /[ \t]+/ ) ) {
return;
}
}
- if ( stream.eat( /[$|ǂ‡]/ ) ) {
+ if ( stream.eat( '‡' ) ) {
var subfieldCode;
- if ( ( subfieldCode = stream.eat( /[a-zA-Z0-9%]/ ) ) && stream.eat( ' ' ) ) {
+ if ( ( subfieldCode = stream.eat( /[a-zA-Z0-9%]/ ) ) ) {
state.subfieldCode = subfieldCode;
if ( state.seenSubfields[state.subfieldCode] && ( modeConfig.nonRepeatableSubfields[state.tagNumber] || {} )[state.subfieldCode] ) {
return 'bad-subfieldcode';
},
loadISO2709: function(data) {
- // The underlying offsets work on bytes, not characters
- data = _encode_utf8(data);
+ // The underlying offsets work on bytes, not characters, so we have to encode back into
+ // UTF-8 before we try to use the directory.
+ //
+ // The substr is a performance optimization; we can only load the first record, so we
+ // extract only the first record. We may get some of the next record, because the substr
+ // happens before UTF-8 encoding, but that won't cause any issues.
+ data = _encode_utf8(data.substr(0, parseInt(data.substr(0, 5))));
this._fieldlist.length = 0;
this.leader(data.substr(0, 24));
*/
define( [ 'marc-record' ], function( MARC ) {
- // Convert any characters for display
- function _sanitize( text ) {
- return text.replace( '$', '{dollar}' );
- }
-
- // Undo conversion
- function _desanitize( text ) {
- return text.replace( '{dollar}', '$' );
- }
return {
RecordToText: function( record ) {
var lines = [];
var field = fields[i];
if ( field.isControlField() ) {
- lines.push( field.tagnumber() + ' ' + _sanitize( field.subfield( '@' ) ) );
+ lines.push( field.tagnumber() + ' ' + field.subfield('@') );
} else {
var result = [ field.tagnumber() + ' ' ];
result.push( field.indicator(1) == ' ' ? '_' : field.indicator(1), ' ' );
$.each( field.subfields(), function( i, subfield ) {
- result.push( '$' + subfield[0] + ' ' + _sanitize( subfield[1] ) );
+ result.push( '‡' + subfield[0] + subfield[1] );
} );
lines.push( result.join('') );
tagNumber = tagNumber[1];
if ( tagNumber < '010' ) {
- var field = new MARC.Field( tagNumber, ' ', ' ', [ [ '@', _desanitize( line.substring( 4 ) ) ] ] );
+ var field = new MARC.Field( tagNumber, ' ', ' ', [ [ '@', line.substring( 4 ) ] ] );
field.sourceLine = i;
record.addField( field );
} else {
var field = new MARC.Field( tagNumber, ( indicators[1] == '_' ? ' ' : indicators[1] ), ( indicators[2] == '_' ? ' ' : indicators[2] ), [] );
- var matcher = /[$|ǂ‡]([a-zA-Z0-9%]) /g;
+ var matcher = /‡([a-zA-Z0-9%])/g;
var match;
var subfields = [];
$.each( subfields, function( i, subfield ) {
var next = subfields[ i + 1 ];
- field.addSubfield( [ subfield.code, _desanitize( line.substring( subfield.ch + 3, next ? next.ch : line.length ) ) ] );
+ field.addSubfield( [ subfield.code, line.substring( subfield.ch + 3, next ? next.ch : line.length ) ] );
} );
field.sourceLine = i;
} else {
for ( var i = 0; i < info.subfields.length; i++ ) {
var next = ( i < info.subfields.length - 1 ) ? info.subfields[i + 1].ch : end;
- subfields.push( { code: info.subfields[i].code, from: info.subfields[i].ch + 3, to: next } );
+ subfields.push( { code: info.subfields[i].code, from: info.subfields[i].ch + 2, to: next } );
}
// If not a fixed field, and we didn't find any subfields, we need to throw in the
// '@' subfield so we can properly remove it
padding-bottom: 0;
}
+#shortcuts-container {
+ font-size: 12px;
+}
+
/*> MARC editor */
#editor .CodeMirror {
line-height: 1.2;
.cm-subfieldcode {
background-color: #F4F4F4;
color: #187848;
- border-radius: 3px 8px 8px 3px;
+ border-radius: 3px;
border-right: 2px solid white;
font-weight: bold;
+ padding-left: 3px;
+ padding-right: 3px;
margin-right: -2px;
}
$('#searchresults thead tr').append('<th>' + _("Tools") + '</th>');
+ var bibnumMap = KohaBackend.GetSubfieldForKohaField('biblio.biblionumber');
$.each( data.hits, function( undef, hit ) {
backends.search.records[ hit.server + ':' + hit.index ] = hit.record;
- hit.id = 'search/' + hit.server + ':' + hit.index;
+
+ switch ( hit.server ) {
+ case 'koha:biblioserver':
+ var bibnumField = hit.record.field( bibnumMap[0] );
+
+ if ( bibnumField && bibnumField.hasSubfield( bibnumMap[1] ) ) {
+ hit.id = 'catalog/' + bibnumField.subfield( bibnumMap[1] );
+ break;
+ }
+
+ // Otherwise, fallthrough
+
+ default:
+ hit.id = 'search/' + hit.server + ':' + hit.index;
+ }
var result = '<tr>';
result += '<td class="sourcecol">' + z3950Servers[ hit.server ].name + '</td>';
} );
result += '<td class="toolscol"><ul><li><a href="#" class="marc-link">' + _("View MARC") + '</a></li>';
- result += '<li><a href="#" class="open-link">' + _("Import") + '</a></li>';
+ result += '<li><a href="#" class="open-link">' + ( hit.server == 'koha:biblioserver' ? _("Edit") : _("Import") ) + '</a></li>';
if ( state.canSave ) result += '<li><a href="#" class="substitute-link" title="' + _("Replace the current record's contents") + '">' + _("Substitute") + '</a></li>';
result += '</ul></td></tr>';
var modified = macro.modified && new Date(macro.modified);
$li.find( '.macro-info' ).append(
'<li><span class="label">' + _("Last changed:") + '</span>' +
- ( modified ? modified.toLocaleFormat() : _("never") ) + '</li>'
+ ( modified ? ( modified.toLocaleDateString() + ', ' + modified.toLocaleTimeString() ) : _("never") ) + '</li>'
);
$('#macro-list').append($li);
} );
if ( !subfield ) return;
var subfieldinfo = taginfo.subfields[ subfield.code ];
- $('#status-subfield-info').html( '<strong>$' + subfield.code + ':</strong> ' );
+ $('#status-subfield-info').html( '<strong>‡' + subfield.code + ':</strong> ' );
if ( subfieldinfo ) {
$('#status-subfield-info').append( subfieldinfo.lib );
if ( error.subfield == '@' ) {
editor.addError( error.line, _("Missing control field contents") );
} else {
- editor.addError( error.line, _("Missing mandatory subfield: $") + error.subfield );
+ editor.addError( error.line, _("Missing mandatory subfield: ‡") + error.subfield );
}
break;
case 'unrepeatableTag':
editor.addError( error.line, _("Tag ") + error.tag + _(" cannot be repeated") );
break;
case 'unrepeatableSubfield':
- editor.addError( error.line, _("Subfield $") + error.subfield + _(" cannot be repeated") );
+ editor.addError( error.line, _("Subfield ‡") + error.subfield + _(" cannot be repeated") );
break;
case 'itemTagUnsupported':
editor.addError( error.line, _("Item tags cannot currently be saved") );
return '<div id="alerts-container"><ul>' + prevAlerts.join('') + '</ul></div>';
},
});
+
+ $('#show-shortcuts').popover({
+ html: true,
+ placement: 'bottom',
+ content: function() {
+ return '<div id="shortcuts-container">' + $('#shortcuts-contents').html() + '</div>';
+ },
+ });
+
$('#new-record' ).click( function() {
+ if ( editor.modified && !confirm( _("Are you sure you want to erase your changes?") ) ) return;
+
openRecord( 'new/', editor );
return false;
} );
no: "Don't enable"
- the advanced cataloging editor.
- "<br/> NOTE:"
- - This feature is currently experimental, and may have bugs that cause corruption of records. Please help us test it and report any bugs, but do so at your own risk.
+ - This feature is currently experimental, and may have bugs that cause corruption of records. It also does not include any support for UNIMARC or NORMARC fixed fields. Please help us test it and report any bugs, but do so at your own risk.
<li><a class="set-font" style="font-family: peep" href="#">peep</a></li>
</ul>
</div>
- <button class="btn btn-small" id="show-alerts" title="Previous alerts"><i class="icon-info-sign"></i> Alerts <span class="caret"></span></button>
+ <button class="btn btn-small" id="show-alerts" title="Previous alerts"><i class="icon-bell"></i> Alerts <span class="caret"></span></button>
+ <button class="btn btn-small" id="show-shortcuts" title="Supported keyboard shortcuts"><i class="icon-list-alt"></i> Keyboard shortcuts <span class="caret"></span></button>
</div>
[%# CodeMirror instance will be inserted here %]
<div id="statusbar">
</div>
</div>
+<div id="shortcuts-contents">
+<table class="table table-condensed">
+ <thead>
+ <tr>
+ <th>Shortcut</th>
+ <th>Behavior</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>Ctrl-D</td>
+ <td>Insert delimiter (‡)</td>
+ </tr>
+ <tr>
+ <td>Ctrl-H</td>
+ <td>Get help on current subfield</td>
+ </tr>
+ <tr>
+ <td>Ctrl-S</td>
+ <td>Save record</td>
+ </tr>
+ <tr>
+ <td>Ctrl-X</td>
+ <td>Delete current field</td>
+ </tr>
+ <tr>
+ <td>Ctrl-Shift-X</td>
+ <td>Delete current field</td>
+ </tr>
+ <tr>
+ <td>Enter</td>
+ <td>New field on next line</td>
+ </tr>
+ <tr>
+ <td>Shift-Enter</td>
+ <td>Insert line break</td>
+ </tr>
+ <tr>
+ <td>Tab</td>
+ <td>Move to next position</td>
+ </tr>
+ <tr>
+ <td>Shift-Tab</td>
+ <td>Move to previous position</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
</div>
[% PROCESS 'cateditor-ui.inc' %]