8 %# This file is deprecated.
11 <& /util/import_javascript.mas, classes => [ 'CXGN.List' ] &>
18 # make a hash of relationship_type => {
19 # upstream => \@list_of_objects
20 # downstream => \@list_of_objects
23 push @{$rels{$_->[0]}{$_->[1]}}, $_->[2]
25 ( map [ $m->scomp('/chado/cvterm_link.mas', cvterm => $_->type, inflect => ( $_->type->name =~ /_of$/ ? 'PL_N' : 'PL_V' ) ), 'downstream', $_->subject ], $principle->search_related("${relationship_name}_objects",undef, { prefetch => ['type','subject'] }) ),
26 ( map [ $m->scomp('/chado/cvterm_link.mas', cvterm => $_->type ), 'upstream', $_->object ], $principle->search_related("${relationship_name}_subjects",undef,{ prefetch => ['type','object'] }) ),
29 my $type = $principle->type ? $m->scomp('/chado/cvterm_link.mas', cvterm => $principle->type) : 'dataset';
35 % my $item_list_menu_div;
38 % for my $reltype ( sort keys %rels ) {
39 % my $updown = $rels{$reltype};
40 % for my $direction ( 'upstream', 'downstream' ) {
41 % if( my $objects = $updown->{$direction} ) {
42 % $item_list_div = "item_list_".$unique_num;
43 % $item_list_menu_div = "item_list_menu_".$unique_num;
45 % my ($is,$are) = $reltype =~ /\w+[ _]of/i ? (' is a',' are') : ('','');
47 <&| /page/info_section.mas,
48 title => $direction eq 'upstream' ? qq|$object_type_text this $type$is $reltype| : qq|$object_type_text that$are $reltype this $type|,
51 <div class="row well well-sm">
57 <div class="row well well-sm">
58 <div id="<% $item_list_div %>"></div>
59 Add items to a list:<br/><br/>
60 <div id="<% $item_list_menu_div %>"></div>
67 % my @items = map { $_->uniquename() } @$objects;
69 % push @item_json, JSON::Any->new->encode(\@items);
71 % $unique_num = $unique_num + 1;
77 % my $item_json_array = JSON::Any->new->encode(\@item_json);
81 jQuery(document).ready( function() {
82 var items = eval(<% $item_json_array %>);
83 var arrayLength = items.length;
85 for (var i = 0; i < arrayLength; i++) {
86 var item_list = "item_list_"+i;
87 var item_list_div = "#"+item_list;
88 var item_list_menu = "item_list_menu_"+i;
89 var item_list_menu_div = "#"+item_list_menu;
90 if (jQuery.cookie("sgn_session_id") && items.length > 0) {
91 var current_item = eval(items[i]).join("\n");
92 jQuery(item_list_div).hide();
93 jQuery(item_list_div).html(current_item);
95 addToListMenu(item_list_menu, item_list, 'div');
98 jQuery(item_list_menu_div).html('Log in to use lists.');