From: Tara L Andrews Date: Sat, 28 Apr 2012 19:53:16 +0000 (+0200) Subject: suppress relationship drawing on out-of-range nodes on global rel creation X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=988c76194e582e2a91a2d076060bc58619c28fdf;p=scpubgit%2Fstemmatology.git suppress relationship drawing on out-of-range nodes on global rel creation --- diff --git a/stemmaweb/root/js/relationship.js b/stemmaweb/root/js/relationship.js index ed1b150..bd78e31 100644 --- a/stemmaweb/root/js/relationship.js +++ b/stemmaweb/root/js/relationship.js @@ -485,11 +485,15 @@ $(document).ready(function () { $(':button :contains("Ok")').attr("disabled", true); var jqjson = $.post( ncpath, form_values, function(data) { $.each( data, function(item, source_target) { - var relation = relation_manager.create( source_target[0], source_target[1], $('#rel_type').attr('selectedIndex') ); - relation.data( 'type', $('#rel_type :selected').text() ); - relation.data( 'scope', $('#scope :selected').text() ); - relation.data( 'note', $('#note').val() ); - relation_manager.toggle_active( relation.children('title').text() ); + var source_found = get_ellipse( source_target[0] ); + var target_found = get_ellipse( source_target[1] ); + if( source_found.size() && target_found.size() ) { + var relation = relation_manager.create( source_target[0], source_target[1], $('#rel_type').attr('selectedIndex') ); + relation.data( 'type', $('#rel_type :selected').text() ); + relation.data( 'scope', $('#scope :selected').text() ); + relation.data( 'note', $('#note').val() ); + relation_manager.toggle_active( relation.children('title').text() ); + } }); $( "#dialog-form" ).dialog( "close" ); }, 'json' );