X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=root%2Fjs%2Frelationship.js;h=e822d70846d717dff217e35738a9dc95e62290b5;hb=f6516f222feb909cd3999fc0ca29ac90311a0266;hp=9782e82a543118a5d6ea0d574a41212cca22e236;hpb=4c5efc084c095e443c7d2efc9624160e855cecb2;p=scpubgit%2Fstemmaweb.git diff --git a/root/js/relationship.js b/root/js/relationship.js index 9782e82..e822d70 100644 --- a/root/js/relationship.js +++ b/root/js/relationship.js @@ -5,6 +5,17 @@ var start_element_height = 0; var reltypes = {}; var readingdata = {}; +function arrayUnique(array) { + var a = array.concat(); + for(var i=0; i cy_min && cy < cy_max) { // we actually heve no real 'selected' state for nodes, except coloring $(this).attr( 'fill', '#ffccff' ); + var this_witnesses = $(this).data( 'node_obj' ).get_witnesses(); + witnesses = arrayUnique( witnesses.concat( this_witnesses ) ); } } }); - // select here + if( $('ellipse[fill="#ffccff"]').size() > 0 ) { + $.each( witnesses, function( index, value ) { + $('#multipleselect-form').append( '' + value + '
' ); + }); + $('#multipleselect-form').dialog( 'open' ); + } self.svg_rect.remove( $('#marquee') ); } }; + this.unselect = function() { + $('ellipse[fill="#ffccff"]').attr( 'fill', '#fff' ); + } + } @@ -678,7 +712,7 @@ $(document).ready(function () { event.preventDefault(); return false; }).mouseup(function (event) { - marquee.hide(); + marquee.select(); $(this).data('down', false); }).mousemove(function (event) { if( timer != null ) { clearTimeout(timer); } @@ -813,6 +847,7 @@ $(document).ready(function () { global: function () { delete_relation( true ); }, delete: function() { delete_relation( false ); } }; + $( "#delete-form" ).dialog({ autoOpen: false, height: 135, @@ -820,8 +855,12 @@ $(document).ready(function () { modal: false, create: function(event, ui) { // TODO What is this logic doing? + // This scales the buttons in the dialog and makes it look proper + // Not sure how essential it is, does anything break if it's not here? var buttonset = $(this).parent().find( '.ui-dialog-buttonset' ).css( 'width', '100%' ); buttonset.find( "button:contains('Cancel')" ).css( 'float', 'right' ); + // A: This makes sure that the pop up delete relation dialogue for a hovered over + // relation auto closes if the user doesn't engage (mouseover) with it. var dialog_aria = $("div[aria-labelledby='ui-dialog-title-delete-form']"); dialog_aria.mouseenter( function() { if( mouseWait != null ) { clearTimeout(mouseWait) }; @@ -852,6 +891,31 @@ $(document).ready(function () { close: function() {} }); + var multipleselect_buttonset = { + cancel: function() { $( this ).dialog( "close" ); }, + button1: function () { }, + button2: function() { } + }; + + $( "#multipleselect-form" ).dialog({ + autoOpen: false, + height: 150, + width: 250, + modal: true, + create: function(event, ui) { + var buttonset = $(this).parent().find( '.ui-dialog-buttonset' ).css( 'width', '100%' ); + buttonset.find( "button:contains('Cancel')" ).css( 'float', 'right' ); + }, + open: function() { + $( this ).dialog( "option", "width", 200 ); + $( this ).dialog( "option", "buttons", + [{ text: "Button_1", click: multipleselect_buttonset['button1'] }, + { text: "Button_2", click: multipleselect_buttonset['button2'] }, + { text: "Cancel", click: multipleselect_buttonset['cancel'] }] ); + }, + close: function() { marquee.unselect(); } + }); + // Helpers for relationship deletion function delete_relation( scopewide ) {