if( stemmata.length ) {
selectedStemmaID = 0;
load_stemma( selectedStemmaID, basepath );
- }
+ } else {
+ $('#open_stemma_edit').hide();
+ $('#run_stexaminer').hide();
+ show_stemmapager(); // to grey out both buttons
+ }
// Set up the relationship mapper button
$('#run_relater').attr( 'action', basepath + "/relation/" + textid );
});
}
}
+function show_stemmapager () {
+ $('.pager_left_button').unbind('click').css( 'opacity', '0.5' );
+ $('.pager_right_button').unbind('click').css( 'opacity', '0.5' );
+ if( selectedStemmaID > 0 ) {
+ $('.pager_left_button').click( function () {
+ load_stemma( selectedStemmaID - 1 );
+ }).css( 'opacity' , '1.0' );
+ }
+ if( selectedStemmaID + 1 < stemmata.length ) {
+ $('.pager_right_button').click( function () {
+ load_stemma( selectedStemmaID + 1 );
+ }).css( 'opacity' , '1.0' );
+ }
+}
+
+
function load_stemma( idx ) {
+ // Load the stemma at idx
+ selectedStemmaID = idx;
if( idx > -1 ) {
- selectedStemmaID = idx;
$('#stemma_graph').empty();
$('#stemma_graph').append( stemmata[idx] );
+ show_stemmapager();
// Stexaminer submit action
var stexpath = basepath + "/stexaminer/" + selectedTextID + "/" + idx;
$('#run_stexaminer').attr( 'action', stexpath );
uploader.bind('FileUploaded', function(up, file, ret) {
var result = parseResponse( ret.response );
if( result.id ) {
- $('#upload-collation-dialog').dialog( 'option', 'buttons').cancel();
+ $('#upload-collation-dialog').dialog('close');
refreshDirectory();
loadTradition( result.id, result.name, 1 );
} else if( result.error ) {
<div id="textinfo_container_buttons">
<form id="stemma_pager" action="" method="GET" name="stemma_pager">
<div id="stemma_pager_buttons">
- <div class="pager_left_button" id="stemma_pager_left_button" onClick="$('#stemma_pager').submit()"></div>
- <div class="pager_right_button" id="stemma_pager_right_button" onClick="$('#stemma_pager').submit()"></div>
+ <div class="pager_left_button" id="stemma_pager_left_button"></div>
+ <div class="pager_right_button" id="stemma_pager_right_button"></div>
</div>
</form>
<form id="open_stemma_add" action="" method="GET" name="add_new_stemma">