X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Fcomponentload.js;h=3bb43a93fac8d49bdc4351a76b53ebf095030234;hb=be536c891e67a3143aeef68e97ae3c351fc22149;hp=4c17616f99503d1d2ce91e95b0796f9d01784fbf;hpb=ab0d1218acaa11e308f261bc450e0c5ac4e6d135;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/componentload.js b/root/js/componentload.js index 4c17616..3bb43a9 100644 --- a/root/js/componentload.js +++ b/root/js/componentload.js @@ -47,10 +47,12 @@ function loadTradition( textid, textname, editable ) { $('#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. @@ -73,6 +75,9 @@ function loadTradition( textid, textname, editable ) { 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' ); }); } @@ -88,7 +93,12 @@ function load_textinfo() { // 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(); @@ -124,7 +134,10 @@ function load_stemma( idx ) { 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 ); @@ -383,10 +396,13 @@ $(document).ready( function() { // 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');