$('#open_stemma_add').show();
$('#open_stemma_edit').show();
$('#open_textinfo_edit').show();
+ $('#relatebutton_label').text('View collation and edit relationships');
} else {
$('#open_stemma_add').hide();
$('#open_stemma_edit').hide();
$('#open_textinfo_edit').hide();
+ $('#relatebutton_label').text('View collation and relationships');
}
// Then get and load the actual content.
load_stemma( selectedStemmaID );
// Set up the relationship mapper button
$('#run_relater').attr( 'action', _get_url([ "relation", textid ]) );
+ // Set up the download button
+ $('#dl_tradition').attr( 'href', _get_url([ "download", textid ]) );
+ $('#dl_tradition').attr( 'download', selectedTextInfo.name + '.xml' );
});
}
// Who the owner is
$('#owner_id').empty().append('no one');
if( selectedTextInfo.owner ) {
- $('#owner_id').empty().append( selectedTextInfo.owner );
+ var owneremail = selectedTextInfo.owner;
+ var chop = owneremail.indexOf( '@' );
+ if( chop > -1 ) {
+ owneremail = owneremail.substr( 0, chop + 1 ) + '...';
+ }
+ $('#owner_id').empty().append( owneremail );
}
// Whether or not it is public
$('#not_public').empty();
selectedStemmaID = idx;
show_stemmapager();
if( idx > -1 ) {
- loadSVG( stemmata[idx] );
+ // Load the SVG and identifier of the stemma
+ var stemmadata = stemmata[idx];
+ loadSVG( stemmadata['svg'] );
+ $('#stemma_identifier').empty().text( stemmadata['name'] );
// Stexaminer submit action
var stexpath = _get_url([ "stexaminer", selectedTextID, idx ]);
$('#run_stexaminer').attr( 'action', stexpath );
// We received a stemma SVG string in return.
// Update the current stemma sequence number
selectedStemmaID = data.stemmaid;
- // Stash the answer in our SVG array
- stemmata[selectedStemmaID] = data.stemmasvg;
+ delete data.stemmaid;
+ // Stash the answer in the appropriate spot in our stemma array
+ stemmata[selectedStemmaID] = data;
// Display the new stemma
load_stemma( selectedStemmaID );
+ // Show the edit button, in case this was the first new stemma
+ $('#open_stemma_edit').show();
// Reenable the button and close the form
$(evt.target).button("enable");
$('#stemma-edit-dialog').dialog('close');