X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=stemmaweb%2Froot%2Fjs%2Frelationship.js;fp=stemmaweb%2Froot%2Fjs%2Frelationship.js;h=a73147434acb9ec9ce8c25aad3e4f4f34aa87cfb;hb=4aed7cc51a1239fd06e7e85481f0545749dfe75b;hp=8f308dbc74b9932c43c05a3eb26d9f345c30c0c2;hpb=3ba238d4d8d644980a0ce64131bce27213cc7981;p=scpubgit%2Fstemmatology.git diff --git a/stemmaweb/root/js/relationship.js b/stemmaweb/root/js/relationship.js index 8f308db..a731474 100644 --- a/stemmaweb/root/js/relationship.js +++ b/stemmaweb/root/js/relationship.js @@ -52,8 +52,8 @@ function node_dblclick_listener( evt ) { // Set the easy properties first $('#reading-form').dialog( 'option', 'title', 'Reading information for "' + reading_info['text'] + '"' ); $('#reading_id').val( reading_id ); - $('#reading_is_nonsense').val( reading_info['is_nonsense'] ); - $('#reading_grammar_invalid').val( reading_info['grammar_invalid'] ); + $('#reading_is_nonsense').attr( 'checked', reading_info['is_nonsense'] ); + $('#reading_grammar_invalid').attr( 'checked', reading_info['grammar_invalid'] ); // Use .text as a backup for .normal_form var normal_form = reading_info['normal_form']; if( !normal_form ) { @@ -80,7 +80,6 @@ function morphology_form ( lexlist ) { morphoptions.push( tagstr ); }); var formtag = 'morphology_' + idx; - //forminput.autocomplete('search', ''); var formstr = ''; if( lex['form'] ) { formstr = stringify_wordform( lex['form'] ); @@ -132,6 +131,26 @@ function color_inactive ( el ) { }); } +function relemmatize () { + // Send the reading for a new lemmatization and reopen the form. + var reading_id = $('#reading_id').val() + ncpath = getReadingURL( reading_id ); + form_values = { + 'normal_form': $('#reading_normal_form').val(), + 'relemmatize': 1 }; + var jqjson = $.post( ncpath, form_values, function( data ) { + // Update the form with the return + if( 'id' in data ) { + // We got back a good answer. Stash it + readingdata[reading_id] = data; + // and regenerate the morphology form. + morphology_form( data['lexemes'] ); + } else { + alert("Could not relemmatize as requested: " + data['error']); + } + }); +} + // Initialize the SVG once it exists function svgEnlargementLoaded() { //Give some visual evidence that we are working @@ -726,8 +745,8 @@ $(document).ready(function () { var reading_id = $('#reading_id').val() form_values = { 'id' : reading_id, - 'is_nonsense': $('#reading_is_nonsense').val(), - 'grammar_invalid': $('#reading_grammar_invalid').val(), + 'is_nonsense': $('#reading_is_nonsense').is(':checked'), + 'grammar_invalid': $('#reading_grammar_invalid').is(':checked'), 'normal_form': $('#reading_normal_form').val() }; // Add the morphology values $('.reading_morphology').each( function() { @@ -753,27 +772,6 @@ $(document).ready(function () { } }, create: function() { - // $('#reading_relemmatize').button(); - $('#reading_relemmatize').click( function () { - // Send the reading for a new lemmatization and reopen the form. - alert( "Got a click function for relemmatize button" ); - var reading_id = $('#reading_id').val() - ncpath = getReadingURL( reading_id ); - form_values = { - 'normal_form': $('#reading_normal_form').val(), - 'relemmatize': 1 }; - var jqjson = $.post( ncpath, form_values, function( data ) { - // Update the form with the return - if( 'reading_id' in data ) { - // We got back a good answer. Stash it - readingdata[reading_id] = data; - // and regenerate the morphology form. - morphology_form( data['lexemes'] ); - } // else throw an error with what is in ['error'] - }); - // Prevent submit - return false; - }); }, open: function() { $(".ui-widget-overlay").css("background", "none");