my @all_relations;
foreach my $p ( @pairs ) {
my $relobj = $collation->relations->get_relationship( @$p );
- push( @all_relations,
- { source => $p->[0], target => $p->[1],
- type => $relobj->type, scope => $relobj->scope } );
+ my $relhash = { source => $p->[0], target => $p->[1],
+ type => $relobj->type, scope => $relobj->scope };
+ $relhash->{'note'} = $relobj->annotation if $relobj->has_annotation;
+ push( @all_relations, $relhash );
}
$c->stash->{'result'} = \@all_relations;
} elsif( $c->request->method eq 'POST' ) {
my $scope = $c->request->param('scope');
my $opts = { 'type' => $relation,
- 'scope' => $scope,
- 'annotation' => $note };
+ 'scope' => $scope };
+ $opts->{'annotation'} = $note if $note;
try {
my @vectors = $collation->add_relationship( $node, $target, $opts );
var relation = relation_manager.create( rel_info.source, rel_info.target, type_index );
relation.data( 'type', rel_info.type );
relation.data( 'scope', rel_info.scope );
+ relation.data( 'note', rel_info.note );
var node_obj = get_node_obj(rel_info.source);
node_obj.set_draggable( false );
node_obj.ellipse.data( 'node_obj', null );
}
}
this.showinfo = function(relation) {
- $('#delete-form-text').html( 'type: ' + relation.data( 'type' ) + '<br/>scope: ' + relation.data( 'scope' ) );
+ var htmlstr = 'type: ' + relation.data( 'type' ) + '<br/>scope: ' + relation.data( 'scope' );
+ if( relation.data( 'note' ) ) {
+ htmlstr = htmlstr + '<br/>note: ' + relation.data( 'note' );
+ }
+ $('#delete-form-text').html( htmlstr );
var points = relation.children('path').attr('d').slice(1).replace('C',' ').split(' ');
var xs = parseFloat( points[0].split(',')[0] );
var xe = parseFloat( points[1].split(',')[0] );
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" );
$( "#delete-form" ).dialog({
autoOpen: false,
- height: 120,
+ height: 135,
width: 160,
modal: false,
buttons: {