From: Tara L Andrews
' );
+ //add intersection of witnesses sets to the multi select form and open it
+ $('#detach_collated_form').empty();
+ $.each( readings, function( index, value ) {
+ $('#detach_collated_form').append( $('').attr(
+ "type", "hidden").attr("name", "readings[]").attr(
+ "value", value ) );
+ });
+ $.each( witnesses, function( index, value ) {
+ $('#detach_collated_form').append(
+ '' + value + '
' );
});
+ $('#multiple_selected_readings').attr('value', readings.join(',') );
$('#multipleselect-form').dialog( 'open' );
}
self.svg_rect.remove( $('#marquee') );
@@ -1044,18 +1043,23 @@ $(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) {
+ buttons: {
+ Cancel: function() { $( this ).dialog( "close" ); },
+ Detach: function ( evt ) {
+ $(evt.target).button("disable");
+ var form_values = $('#detach_collated_form').serialize();
+ ncpath = getTextURL( 'duplicate' );
+ var jqjson = $.post( ncpath, form_values, function(data) {
+ detach_node( data );
+ $(evt.target).button("enable");
+ });
+ }
+ }, create: function(event, ui) {
var buttonset = $(this).parent().find( '.ui-dialog-buttonset' ).css( 'width', '100%' );
buttonset.find( "button:contains('Cancel')" ).css( 'float', 'right' );
},
@@ -1066,6 +1070,7 @@ $(document).ready(function () {
{ text: "Button_2", click: multipleselect_buttonset['button2'] },
{ text: "Cancel", click: multipleselect_buttonset['cancel'] }] );
$(".ui-widget-overlay").css("background", "none");
+ $('#multipleselect-form-status').empty();
$("#dialog_overlay").show();
$("#dialog_overlay").height( $("#enlargement_container").height() );
$("#dialog_overlay").width( $("#enlargement_container").innerWidth() );
@@ -1075,7 +1080,25 @@ $(document).ready(function () {
marquee.unselect();
$("#dialog_overlay").hide();
}
- });
+ }).ajaxError( function(event, jqXHR, ajaxSettings, thrownError) {
+ if( ajaxSettings.url == getTextURL('duplicate')
+ && ajaxSettings.type == 'POST' && jqXHR.status == 403 ) {
+ var error;
+ if( jqXHR.responseText.indexOf('do not have permission to modify') > -1 ) {
+ error = 'You are not authorized to modify this tradition. (Try logging in again?)';
+ } else {
+ try {
+ var errobj = jQuery.parseJSON( jqXHR.responseText );
+ error = errobj.error + 'The relationship cannot be made.
Error: ' + error ); + } + $(event.target).parent().find('.ui-button').button("enable"); + }); + // Helpers for relationship deletion