rbbt-views 1.0.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (177) hide show
  1. data/lib/rbbt/workflow/rest.rb +365 -95
  2. data/lib/rbbt/workflow/rest/client.rb +2 -0
  3. data/lib/rbbt/workflow/rest/entity.rb +82 -76
  4. data/lib/rbbt/workflow/rest/finder.rb +78 -0
  5. data/lib/rbbt/workflow/rest/helpers.rb +288 -47
  6. data/lib/rbbt/workflow/rest/notes.rb +125 -0
  7. data/lib/rbbt/workflow/rest/render.rb +280 -240
  8. data/lib/rbbt/workflow/rest/util.rb +47 -31
  9. data/share/views/compass/_base.sass +0 -8
  10. data/share/views/compass/colors.sass +10 -0
  11. data/share/views/compass/colors/ventana_azul.sass +5 -0
  12. data/share/views/compass/compass.config +2 -1
  13. data/share/views/compass/details.sass +50 -0
  14. data/share/views/compass/dom.sass +64 -0
  15. data/share/views/compass/embedded.sass +111 -0
  16. data/share/views/compass/entities.sass +8 -0
  17. data/share/views/compass/error.sass +13 -0
  18. data/share/views/compass/finder.sass +42 -0
  19. data/share/views/compass/fonts.sass +8 -0
  20. data/share/views/compass/form.sass +49 -1
  21. data/share/views/compass/header.sass +68 -0
  22. data/share/views/compass/{main.sass → helpers.sass} +53 -21
  23. data/share/views/compass/layout.sass +31 -199
  24. data/share/views/compass/lists.sass +128 -0
  25. data/share/views/compass/menu.sass +35 -0
  26. data/share/views/compass/notes.sass +52 -0
  27. data/share/views/compass/sizes.sass +8 -0
  28. data/share/views/compass/tables.sass +22 -0
  29. data/share/views/compass/wait.sass +9 -0
  30. data/share/views/edit_list.haml +41 -30
  31. data/share/views/entity/GOTerm.haml +4 -3
  32. data/share/views/entity/Gene.haml +8 -1
  33. data/share/views/entity/GenomicMutation.haml +4 -1
  34. data/share/views/entity/KeggPathway.haml +1 -1
  35. data/share/views/entity/MutatedIsoform.haml +68 -11
  36. data/share/views/entity/NCIBioCartaPathway.haml +2 -3
  37. data/share/views/entity/NCINaturePathway.haml +3 -3
  38. data/share/views/entity/NCIReactomePathway.haml +2 -3
  39. data/share/views/entity/PfamDomain.haml +2 -0
  40. data/share/views/entity/Transcript.haml +10 -0
  41. data/share/views/entity_list/Default.haml +4 -0
  42. data/share/views/entity_list/Default/compare_to_other_lists.haml +41 -0
  43. data/share/views/entity_list/Default/entity_links.haml +6 -0
  44. data/share/views/entity_list/Default/find_in_other_lists.haml +36 -0
  45. data/share/views/error.haml +6 -1
  46. data/share/views/find.haml +10 -0
  47. data/share/views/form.haml +1 -1
  48. data/share/views/info.haml +1 -1
  49. data/share/views/js/_action_setup.js +250 -0
  50. data/share/views/js/_basic.js +269 -0
  51. data/share/views/js/_cytoscape.js +44 -0
  52. data/share/views/js/_details.js +239 -0
  53. data/share/views/js/_dom_updates.js +384 -0
  54. data/share/views/js/_embedded.js +95 -0
  55. data/share/views/js/_images.js +20 -0
  56. data/share/views/js/_layout.js +21 -0
  57. data/share/views/js/_lists.js +224 -0
  58. data/share/views/js/_table.js +36 -0
  59. data/share/views/js/_workflow.js +42 -0
  60. data/share/views/js/app.js +0 -570
  61. data/share/views/js/fix_tablesorter_scientific.js +25 -0
  62. data/share/views/js/json2.js +487 -0
  63. data/share/views/layout.haml +8 -98
  64. data/share/views/notes.haml +15 -0
  65. data/share/views/partials/_form.haml +22 -7
  66. data/share/views/partials/_job_control.haml +8 -8
  67. data/share/views/partials/_list_control.haml +32 -0
  68. data/share/views/partials/_list_header.haml +6 -0
  69. data/share/views/partials/_note_list.haml +64 -0
  70. data/share/views/partials/_result_table.haml +12 -7
  71. data/share/views/partials/_result_table_controls.haml +11 -5
  72. data/share/views/partials/_table.haml +24 -6
  73. data/share/views/partials/layout/_coda.haml +10 -0
  74. data/share/views/partials/layout/_details.haml +25 -0
  75. data/share/views/partials/layout/_head.haml +22 -0
  76. data/share/views/partials/layout/_header.haml +29 -0
  77. data/share/views/partials/layout/_menu.haml +20 -0
  78. data/share/views/partials/layout/_resources.haml +41 -0
  79. data/share/views/public/background.png +0 -0
  80. data/share/views/public/plugins/cytoscape-web/LICENSE.txt +504 -0
  81. data/share/views/public/plugins/cytoscape-web/README.txt +213 -0
  82. data/share/views/public/plugins/cytoscape-web/js/AC_OETags.js +1 -0
  83. data/share/views/public/plugins/cytoscape-web/js/cytoscapeweb.js +1 -0
  84. data/share/views/public/plugins/cytoscape-web/js/json2.js +1 -0
  85. data/share/views/public/plugins/cytoscape-web/swf/CytoscapeWeb.swf +0 -0
  86. data/share/views/public/plugins/cytoscape-web/swf/playerProductInstall.swf +0 -0
  87. data/share/views/public/plugins/fancybox/CHANGELOG.md +68 -0
  88. data/share/views/public/plugins/fancybox/README.md +220 -0
  89. data/share/views/public/plugins/fancybox/css/blank.gif +0 -0
  90. data/share/views/public/plugins/fancybox/css/fancybox_loading.gif +0 -0
  91. data/share/views/public/plugins/fancybox/css/fancybox_sprite.png +0 -0
  92. data/share/views/public/plugins/fancybox/css/jquery.fancybox.css +234 -0
  93. data/share/views/public/plugins/fancybox/helpers/fancybox_buttons.png +0 -0
  94. data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-buttons.css +85 -0
  95. data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-buttons.js +115 -0
  96. data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-media.js +85 -0
  97. data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-thumbs.css +54 -0
  98. data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-thumbs.js +157 -0
  99. data/share/views/public/plugins/fancybox/js/jquery.fancybox.js +1463 -0
  100. data/share/views/public/plugins/fancybox/js/jquery.mousewheel-3.0.6.pack.js +13 -0
  101. data/share/views/public/plugins/fancybox/lib/jquery-1.7.2.min.js +4 -0
  102. data/share/views/public/plugins/featuredimagezoomer/css/featuredimagezoomer.css +8 -0
  103. data/share/views/public/plugins/featuredimagezoomer/images/spinningred.gif +0 -0
  104. data/share/views/public/plugins/featuredimagezoomer/js/featuredimagezoomer.js +245 -0
  105. data/share/views/public/plugins/jquery-ui.hitarea.js +173 -0
  106. data/share/views/public/plugins/jquery/js/jquery-1.8.0.min.js +2 -0
  107. data/share/views/public/plugins/tablesorter/addons/pager/jquery.tablesorter.pager.css +25 -0
  108. data/share/views/public/plugins/tablesorter/addons/pager/jquery.tablesorter.pager.js +184 -0
  109. data/share/views/public/plugins/tablesorter/build.xml +26 -0
  110. data/share/views/public/plugins/tablesorter/build/ParseMaster.js +106 -0
  111. data/share/views/public/plugins/tablesorter/build/js.jar +0 -0
  112. data/share/views/public/plugins/tablesorter/build/jsmin.js +316 -0
  113. data/share/views/public/plugins/tablesorter/build/min.js +5 -0
  114. data/share/views/public/plugins/tablesorter/build/pack.js +5 -0
  115. data/share/views/public/plugins/tablesorter/build/packer.js +316 -0
  116. data/share/views/public/plugins/tablesorter/build/writeFile.js +19 -0
  117. data/share/views/public/plugins/tablesorter/changelog +41 -0
  118. data/share/views/public/plugins/tablesorter/docs/assets/ajax-content.html +43 -0
  119. data/share/views/public/plugins/tablesorter/docs/css/jq.css +29 -0
  120. data/share/views/public/plugins/tablesorter/docs/example-ajax.html +119 -0
  121. data/share/views/public/plugins/tablesorter/docs/example-empty-table.html +75 -0
  122. data/share/views/public/plugins/tablesorter/docs/example-extending-defaults.html +109 -0
  123. data/share/views/public/plugins/tablesorter/docs/example-meta-headers.html +108 -0
  124. data/share/views/public/plugins/tablesorter/docs/example-meta-parsers.html +105 -0
  125. data/share/views/public/plugins/tablesorter/docs/example-meta-sort-list.html +107 -0
  126. data/share/views/public/plugins/tablesorter/docs/example-option-debug.html +116 -0
  127. data/share/views/public/plugins/tablesorter/docs/example-option-digits.html +106 -0
  128. data/share/views/public/plugins/tablesorter/docs/example-option-sort-force.html +107 -0
  129. data/share/views/public/plugins/tablesorter/docs/example-option-sort-key.html +108 -0
  130. data/share/views/public/plugins/tablesorter/docs/example-option-sort-list.html +108 -0
  131. data/share/views/public/plugins/tablesorter/docs/example-option-sort-order.html +108 -0
  132. data/share/views/public/plugins/tablesorter/docs/example-option-text-extraction.html +85 -0
  133. data/share/views/public/plugins/tablesorter/docs/example-options-headers.html +118 -0
  134. data/share/views/public/plugins/tablesorter/docs/example-pager.html +329 -0
  135. data/share/views/public/plugins/tablesorter/docs/example-parsers.html +112 -0
  136. data/share/views/public/plugins/tablesorter/docs/example-trigger-sort.html +113 -0
  137. data/share/views/public/plugins/tablesorter/docs/example-triggers.html +336 -0
  138. data/share/views/public/plugins/tablesorter/docs/example-update-cell.html +118 -0
  139. data/share/views/public/plugins/tablesorter/docs/example-widgets.html +383 -0
  140. data/share/views/public/plugins/tablesorter/docs/img/external.png +0 -0
  141. data/share/views/public/plugins/tablesorter/docs/index.html +576 -0
  142. data/share/views/public/plugins/tablesorter/docs/js/docs.js +23 -0
  143. data/share/views/public/plugins/tablesorter/docs/js/examples.js +29 -0
  144. data/share/views/public/plugins/tablesorter/jquery-latest.js +154 -0
  145. data/share/views/public/plugins/tablesorter/jquery.metadata.js +122 -0
  146. data/share/views/public/plugins/tablesorter/jquery.tablesorter.js +1031 -0
  147. data/share/views/public/plugins/tablesorter/jquery.tablesorter.min.js +4 -0
  148. data/share/views/public/plugins/tablesorter/tests/assets/ajax-content.html +28 -0
  149. data/share/views/public/plugins/tablesorter/tests/cell.metadata.html +112 -0
  150. data/share/views/public/plugins/tablesorter/tests/checkbox.html +117 -0
  151. data/share/views/public/plugins/tablesorter/tests/colspan.html +149 -0
  152. data/share/views/public/plugins/tablesorter/tests/demo.html +353 -0
  153. data/share/views/public/plugins/tablesorter/tests/index.html +22 -0
  154. data/share/views/public/plugins/tablesorter/tests/large.html +30 -0
  155. data/share/views/public/plugins/tablesorter/tests/lockedOrder.html +355 -0
  156. data/share/views/public/plugins/tablesorter/tests/metadata.html +320 -0
  157. data/share/views/public/plugins/tablesorter/tests/multiple-headers.html +67 -0
  158. data/share/views/public/plugins/tablesorter/tests/pager.html +553 -0
  159. data/share/views/public/plugins/tablesorter/themes/blue/asc.gif +0 -0
  160. data/share/views/public/plugins/tablesorter/themes/blue/bg.gif +0 -0
  161. data/share/views/public/plugins/tablesorter/themes/blue/blue.zip +0 -0
  162. data/share/views/public/plugins/tablesorter/themes/blue/desc.gif +0 -0
  163. data/share/views/public/plugins/tablesorter/themes/blue/style.css +39 -0
  164. data/share/views/public/plugins/tablesorter/themes/green/asc.png +0 -0
  165. data/share/views/public/plugins/tablesorter/themes/green/bg.png +0 -0
  166. data/share/views/public/plugins/tablesorter/themes/green/desc.png +0 -0
  167. data/share/views/public/plugins/tablesorter/themes/green/green.zip +0 -0
  168. data/share/views/public/plugins/tablesorter/themes/green/style.css +39 -0
  169. data/share/views/public/plugins/wz_jsgraphics.js +1108 -0
  170. data/share/views/public/tmp/foo +0 -0
  171. data/share/views/result.haml +6 -1
  172. data/share/views/step_error.haml +5 -0
  173. data/share/views/user_lists.haml +8 -7
  174. data/share/views/wait.haml +40 -2
  175. metadata +302 -106
  176. data/share/views/compass/screen.sass +0 -8
  177. data/share/views/public/plugins/jquery/js/jquery-1.6.2.min.js +0 -18
@@ -1,11 +1,10 @@
1
1
  %h3= entity.name
2
2
 
3
- - genes_in_pathway = entity.genes.ensembl
3
+ - genes_in_pathway = Gene.setup(entity.genes.ensembl, "Ensembl Gene ID", entity.organism)
4
4
 
5
5
  %dl
6
-
7
6
  %dt
8
7
  All Genes in pathway
9
- == (#{ genes_in_pathway.ensembl.list_link :length, "Genes in pathway #{entity.name}"})
8
+ == (#{ genes_in_pathway.list_link :length, "Genes in pathway #{entity.name}"})
10
9
  %dd= genes_in_pathway.link * ", "
11
10
 
@@ -1,11 +1,11 @@
1
1
  %h3= entity.name
2
2
 
3
- - genes_in_pathway = entity.genes.ensembl
3
+ - genes_in_pathway = Gene.setup(entity.genes.ensembl, "Ensembl Gene ID", entity.organism)
4
4
 
5
5
  %dl
6
-
7
6
  %dt
8
7
  All Genes in pathway
9
- == (#{ genes_in_pathway.ensembl.list_link :length, "Genes in pathway #{entity.name}"})
8
+ == (#{ genes_in_pathway.list_link :length, "Genes in pathway #{entity.name}"})
10
9
  %dd= genes_in_pathway.link * ", "
11
10
 
11
+
@@ -1,11 +1,10 @@
1
1
  %h3= entity.name
2
2
 
3
- - genes_in_pathway = entity.genes.ensembl
3
+ - genes_in_pathway = Gene.setup(entity.genes.ensembl, "Ensembl Gene ID", entity.organism)
4
4
 
5
5
  %dl
6
-
7
6
  %dt
8
7
  All Genes in pathway
9
- == (#{ genes_in_pathway.ensembl.list_link :length, "Genes in pathway #{entity.name}"})
8
+ == (#{ genes_in_pathway.list_link :length, "Genes in pathway #{entity.name}"})
10
9
  %dd= genes_in_pathway.link * ", "
11
10
 
@@ -1 +1,3 @@
1
1
  %h3= entity.name
2
+
3
+ %a(href="http://pfam.sanger.ac.uk/family/#{entity}") PFAM
@@ -0,0 +1,10 @@
1
+ %h3= entity
2
+
3
+ %dl
4
+ %dt Exons
5
+ %dd= entity.exons.sort * ", "
6
+
7
+ %p
8
+ %a(href="http://jun2011.archive.ensembl.org/Homo_sapiens/Transcript/Summary?t=#{entity}")= entity
9
+
10
+ %img(src="#{entity.protein.ensembl_protein_image_url}")
@@ -1 +1,5 @@
1
+ = workflow_partial('partials/_list_header', :id => id, :entity_type => entity_type, :format => format)
2
+
3
+ %p== #{list.length} elements
4
+
1
5
  = (list.respond_to?(:link)? list.link : list) * ", "
@@ -0,0 +1,41 @@
1
+ - other_list ||= nil
2
+
3
+ - if other_list and not other_list.empty?
4
+ %header== Compare list #{ id } with list #{other_list}
5
+ - else
6
+ %header== Compare list #{ id } with other lists
7
+
8
+ %form(action="#{File.join('/entity_list_action', entity_type, 'compare_to_other_lists', id)}" method='post')
9
+ %label Compare to:
10
+ %select.loaded_lists(name="other_list" type=entity_type)
11
+ %input(type='submit')
12
+
13
+ - if not other_list.nil? and not other_list.empty?
14
+ - other = Entity::REST.load_list(entity_type, other_list, user)
15
+ - exclusive = list.remove other
16
+ - common = list.subset other
17
+ - union = list.annotate(list + other).uniq
18
+ %dl
19
+ %dt Exclusive
20
+ %dd
21
+ - if exclusive.any?
22
+ = exclusive.list_link :length, "(#{ id } - #{ other_list })"
23
+ - else
24
+ None
25
+
26
+ %dt Common
27
+ %dd
28
+ - if common.any?
29
+ = common.list_link :length, "(#{ id } AND #{ other_list })"
30
+ - else
31
+ None
32
+
33
+ %dt Union
34
+ %dd
35
+ - if union.any?
36
+ = union.list_link :length, "(#{ id } + #{ other_list })"
37
+ - else
38
+ None
39
+
40
+
41
+
@@ -0,0 +1,6 @@
1
+ %header== Entities in list #{ id }
2
+ - list = list.name.compact.sort if list.respond_to?(:name) and defined? sort and sort
3
+ - list = list.ensembl if list.respond_to? :ensembl
4
+
5
+ = (list.respond_to?(:link) ? list.link : list) * ", "
6
+
@@ -0,0 +1,36 @@
1
+ - lists ||= nil
2
+
3
+ %header.find_genes_in_other_lists Find genes in other loaded lists
4
+
5
+ - if lists.nil?
6
+ :javascript
7
+ var entity_type = '#{entity_type}';
8
+ var lists = saved_lists()[entity_type];
9
+ var url = '#{File.join('/entity_list_action', entity_type, 'find_in_other_lists', id)}' + "?lists=" + lists.join("|");
10
+ var header = $('header.find_genes_in_other_lists')
11
+
12
+ if ( header.parent('.embedded').length != 0){
13
+ var embedded = header.parent('.embedded').first();
14
+ embedded.attr('href', url);
15
+ $('header.find_genes_in_other_lists').after('<a class="find_genes_in_other_lists" href="' + url + '">Compare with ' + lists.length + ' lists</a>')
16
+ $('a.find_genes_in_other_lists').click(function(){
17
+ replace_object(embedded, false);
18
+ return false;
19
+ })
20
+ }else{
21
+ window.location = url
22
+ }
23
+
24
+ - else
25
+ %dl
26
+ - lists.split("|").each do |list_name|
27
+ - other_list = Entity::REST.load_list(entity_type, list_name, user).subset(list)
28
+ %dt
29
+ Subset of
30
+ = other_list.list_link :length, "Common between #{id} and #{list_name}"
31
+ common elements with list
32
+ %a(href="http://cotos:1900/entity_list/#{ entity_type }/#{ list_name }")=list_name
33
+ %dd
34
+ = other_list.link * ", "
35
+
36
+
@@ -1,2 +1,7 @@
1
- %span.error=step.messages.last
1
+ %header.error Error
2
+ %span.error= escape_html message
3
+ - if defined? backtrace and backtrace
4
+ %ul.backtrace
5
+ - backtrace.each do |line|
6
+ %li.message= escape_html line
2
7
 
@@ -0,0 +1,10 @@
1
+
2
+ %form.find(method='POST' action='/find')
3
+ %label Find
4
+ %input#find(type='text' name='term')
5
+ #find_wrapper
6
+
7
+ %style
8
+ :sass
9
+ :javascript
10
+
@@ -11,4 +11,4 @@
11
11
  %h3 Other jobs
12
12
  %a.replace(href="/#{File.join(workflow.to_s, task, 'jobs')}") jobs
13
13
 
14
- = workflow_partial('partials/_form', :inputs => inputs, :input_types => input_types, :input_defaults => input_defaults, :input_descriptions => input_descriptions, :values => params, :id => id, :jobname => export != :exec, :email => export == :asynchronous, :klass => 'task' )
14
+ = workflow_partial('partials/_form', :inputs => inputs, :input_options => input_options, :input_types => input_types, :input_defaults => input_defaults, :input_descriptions => input_descriptions, :values => params, :id => id, :jobname => export != :exec, :email => export == :asynchronous, :klass => 'task' )
@@ -1,4 +1,4 @@
1
- %dl
1
+ %dl.info
2
2
  - info.each do |key, value|
3
3
  %dt= key
4
4
  %dd
@@ -0,0 +1,250 @@
1
+ function rbbt_action_setup(){
2
+ rbbt_table_setup();
3
+
4
+ $('a.replace, a.check_replace').not('[class*=rbbt_action_setup]').each(function(){
5
+ var link = $(this);
6
+ if ($.inArray(unescape(link.attr('href')), closed_sections) != -1){
7
+ // I don't know what these clases are repeated and I have to remove them
8
+ // twice
9
+ link.removeClass('replace');
10
+ link.removeClass('replace');
11
+ link.removeClass('check_replace');
12
+ link.removeClass('check_replace');
13
+ link.addClass('closed_replace');
14
+ link.addClass('closed_replace');
15
+ }
16
+ });
17
+
18
+ $('a.replace').not('[class*=rbbt_action_setup]').each(function(){
19
+ replace_object($(this));
20
+ }).addClass('rbbt_action_setup');
21
+
22
+ $('a.check_replace').not('[class*=rbbt_action_setup]').each(function(){
23
+ replace_object($(this), 'check');
24
+ }).addClass('rbbt_action_setup');
25
+
26
+ $('a.closed_replace').not('[class*=rbbt_action_setup]').each(function(){
27
+ var obj = $(this);
28
+ if (obj.find('span[class*=status]').length == 0){
29
+ obj.after($("<a class='start_checked'>open</a>"));
30
+ }else{
31
+ obj.after($("<a class='start_checked'>open</a>"));
32
+ }
33
+ }).addClass('rbbt_action_setup');
34
+
35
+
36
+ $('div.toggle').each(function(){
37
+ var toggle = $(this);
38
+ var content = toggle.html();
39
+ var title_text = toggle.attr('title');
40
+
41
+ var title = "<dt>" + title_text + "</dt>";
42
+ var description = "<dd>" + content + "</dd>";
43
+ var dl = $("<dl class='toggle'>" + title + description + "</dl>");
44
+
45
+ toggle.replaceWith(dl);
46
+ dl.find('title').click(function(){
47
+ var dt = $(this)
48
+ var dl = dt.parent('dl');
49
+ var dd = dl.find('>dd').first();
50
+ dd.toggle();
51
+ if (dd.visible()){
52
+ dt.addClass('opened');
53
+ }else{
54
+ dt.removeClass('opened');
55
+ }
56
+ rbbt_action_setup();
57
+ });
58
+ dl.find('title > dd').hide();
59
+ })
60
+
61
+ $('dl.toggle > dt').not('[class*=rbbt_action_setup]').click(function(){
62
+ var dl = $(this).parent('dl');
63
+ var dd = dl.find('>dd');
64
+ var dt = dl.find('>dt');
65
+
66
+ dd.toggle();
67
+
68
+ if (dd.is(':visible')){
69
+ dt.addClass('opened');
70
+ }else{
71
+ dt.removeClass('opened');
72
+ }
73
+
74
+ rbbt_action_setup();
75
+
76
+ }).addClass('rbbt_action_setup');
77
+
78
+ $('dl.toggle > dd').not('[class*=rbbt_action_setup]').each(function(){
79
+ $(this).hide();
80
+ }).addClass('rbbt_action_setup');
81
+
82
+ $('div.embedded form').not('[class*=rbbt_action_setup]').submit(function(){
83
+ var form = $(this);
84
+ var embedded = form.parents('div.embedded').first();
85
+
86
+ var params = "";
87
+
88
+ form.find('input').not('[type=submit]').not('[type=radio]').each(function(){
89
+ var input = $(this)
90
+ if (params.length > 0){ params += '&'}
91
+ params += input.attr('name') + "=" + input.val();
92
+ })
93
+
94
+ form.find('input[type=radio]:checked').each(function(){
95
+ var input = $(this)
96
+ if (params.length > 0){ params += '&'}
97
+ params += input.attr('name') + "=" + input.val();
98
+ })
99
+
100
+ form.find('select').not('[type=submit]').each(function(){
101
+ var select = $(this)
102
+ var option = select.find('option:selected');
103
+ if (params.length > 0){ params += '&'}
104
+ params += select.attr('name') + "=" + option.val();
105
+ })
106
+
107
+ form.find('textarea').each(function(){
108
+ var input = $(this)
109
+ if (params.length > 0){ params += '&'}
110
+ params += input.attr('name') + "=" + escape(input.val());
111
+ })
112
+
113
+ params = params
114
+
115
+ var url = embedded.attr('target');
116
+
117
+ if (url.indexOf('?') == -1){
118
+ url = url + '?' + params;
119
+ }else{
120
+ url = url.replace(/\?.*/, '?' + params);
121
+ }
122
+
123
+ embedded.attr('target', url)
124
+
125
+ replace_object(embedded);
126
+
127
+ return false;
128
+ }).addClass('rbbt_action_setup');
129
+
130
+ $('a.delete_embedded').not('[class*=rbbt_action_setup]').click(function(){
131
+ var link = $(this);
132
+ var embedded = link.parents('.embedded').first();
133
+ if (embedded.hasClass('contracted_embedded')){
134
+ expand_embedded(embedded)
135
+ }
136
+ replace_object(embedded, 'delete');
137
+ return false;
138
+ }).addClass('rbbt_action_setup');
139
+
140
+
141
+ $('a.reload_embedded').not('[class*=rbbt_action_setup]').click(function(){
142
+ var link = $(this);
143
+ var embedded = link.parents('.embedded').first();
144
+ if (embedded.hasClass('contracted_embedded')){
145
+ expand_embedded(embedded)
146
+ }
147
+ replace_object(embedded, 'reload');
148
+ return false;
149
+ }).addClass('rbbt_action_setup');
150
+
151
+ $('a.toggle_embedded').not('[class*=rbbt_action_setup]').click(function(){
152
+ var link = $(this);
153
+ var embedded = link.parents('.embedded').first();
154
+ var header = embedded.find('header').first();
155
+
156
+ if (embedded.attr('attr-save') == null){
157
+ contract_embedded(embedded)
158
+ }else{
159
+ expand_embedded(embedded)
160
+ }
161
+ return false;
162
+ }).addClass('rbbt_action_setup');
163
+
164
+ $('a.abort_embedded').not('[class*=rbbt_action_setup]').click(function(e){
165
+ var abort_link = $(this);
166
+ var link = abort_link.prev('a');
167
+ if (link.length == 0){ link = abort_link.prev('.embedded')};
168
+ replace_object(link, 'abort');
169
+ abort_link.remove();
170
+ return false;
171
+ }).addClass('rbbt_action_setup');
172
+
173
+
174
+ $('a.retry_error').not('[class*=rbbt_action_setup]').click(function(e){
175
+ var retry_link = $(this);
176
+ var link = retry_link.prev('a');
177
+ if (link.length == 0){ link = retry_link.prev('.embedded')};
178
+ replace_object(link, 'reload');
179
+ retry_link.remove();
180
+ return false;
181
+ }).addClass('rbbt_action_setup');
182
+
183
+
184
+ $('a.start_checked').not('[class*=rbbt_action_setup]').click(function(e){
185
+ var start_link = $(this);
186
+ var link = start_link.prev('a');
187
+ replace_object(link);
188
+ start_link.remove();
189
+ return false;
190
+ }).addClass('rbbt_action_setup');
191
+
192
+ $('a.select_list').not('[class*=rbbt_action_setup]').click(function(){
193
+ var link = $(this);
194
+ var list_id = link.attr('attr-list')
195
+ var type = link.attr('attr-list-type')
196
+
197
+ select_list(type, list_id)
198
+ return false;
199
+ }).addClass('rbbt_action_setup');
200
+
201
+ $('a.remove_list').not('[class*=rbbt_action_setup]').click(function(){
202
+ var link = $(this);
203
+ var list_id = link.attr('attr-list');
204
+ var type = link.attr('attr-list-type')
205
+
206
+ remove_list(type, list_id);
207
+
208
+ return false;
209
+ }).addClass('rbbt_action_setup');
210
+
211
+
212
+ $('a.load_entity_list').not('[class*=rbbt_action_setup]').click(function(){
213
+ var link = $(this);
214
+ var list_id = link.attr('attr-list');
215
+ var type = link.attr('attr-list-type');
216
+
217
+ load_list(type, list_id);
218
+ return false;
219
+ }).addClass('rbbt_action_setup');
220
+
221
+ $('a.open_edit_controls').not('[class*=rbbt_action_setup]').click(function(){
222
+ var link = $(this);
223
+
224
+ var edit_controls = link.next('.edit_controls')
225
+ edit_controls.toggle();
226
+
227
+ return false;
228
+ }).addClass('rbbt_action_setup');
229
+
230
+ $('a.clear_selected').not('[class*=rbbt_action_setup]').click(function(){
231
+ $('a.selected_entity').removeClass('selected_entity');
232
+ select_cytoscape([]);
233
+ return false;
234
+ }).addClass('rbbt_action_setup');
235
+
236
+ $('a.update_list_viewer').not('[class*=rbbt_action_setup]').click(function(){
237
+ update_saved_lists()
238
+ return false;
239
+ }).addClass('rbbt_action_setup');
240
+
241
+
242
+ update_list_selectors();
243
+
244
+ zoomable_images($('#main'));
245
+ zoomable_images($('#details'));
246
+
247
+ update_dom()
248
+ }
249
+
250
+
@@ -0,0 +1,269 @@
1
+ if(!Array.indexOf){
2
+ Array.prototype.indexOf = function(obj){
3
+ for(var i=0; i<this.length; i++){
4
+ if(this[i]==obj){
5
+ return i;
6
+ }
7
+ }
8
+ return -1;
9
+ }
10
+ }
11
+
12
+ Array.prototype.remove = function(elem) {
13
+ var match = -1;
14
+
15
+ while( (match = this.indexOf(elem)) > -1 ) {
16
+ this.splice(match, 1);
17
+ }
18
+ };
19
+
20
+ Array.prototype.uniq = function() {
21
+ var myarray = this;
22
+
23
+ new_arr = myarray.filter(function(elem, pos) {
24
+ return myarray.indexOf(elem) == pos;
25
+ })
26
+
27
+ return new_arr
28
+ };
29
+
30
+
31
+ $.fn.getClassInList = function(list){
32
+ for(var i = 0; i < list.length; i++)
33
+ {
34
+ if($(this).hasClass(list[i]))
35
+ return list[i];
36
+ }
37
+ return "";
38
+ }
39
+
40
+ //{{{ URL PARAMETER CONTROL
41
+
42
+ function add_parameters(url, parameters){
43
+ var string;
44
+
45
+ if ( typeof(parameters) == 'string' || typeof(parameters) == 'String'){
46
+ string = parameters;
47
+ }else{
48
+ var pairs = [];
49
+ for (parameter in parameters){
50
+ pairs.push(parameter + "=" + parameters[parameter]);
51
+ }
52
+ string = pairs.join("&");
53
+ }
54
+
55
+ if (string.length == 0){return(url)}
56
+
57
+ if (url.indexOf('?') == -1){
58
+ return url + '?' + string;
59
+ }else{
60
+ return url + '&' + string;
61
+ }
62
+ }
63
+
64
+ function remove_parameter(url, parameter){
65
+ if (url.match("&" + parameter)){
66
+ return url.replace("&" + parameter + "=", '&REMOVE=').replace(/REMOVE=[^?]+/, '').replace(/\?&/, '?').replace(/&&/, '&').replace(/[?&]$/, '');
67
+ }else{
68
+ return url.replace("?" + parameter + "=", '?REMOVE=').replace(/REMOVE=[^?]+/, '').replace(/\?&/, '?').replace(/&&/, '&').replace(/[?&]$/, '');
69
+ }
70
+ }
71
+
72
+ //{{{ Entity ID
73
+
74
+ function id_for_entity(entity_format, entity, id){
75
+ if (entity_format == null){
76
+ return('entity_id=' + id);
77
+ }else{
78
+ return((entity_format.toLowerCase().replace(/[^\w]/g, "_") + "=" + entity));
79
+ }
80
+ }
81
+ //{{{ REPLACE OBJECTS
82
+
83
+ function replace_object(obj, update, href){
84
+
85
+ if (href == null || href == undefined || href == ""){href = obj.attr('href');}
86
+ if (href == null || href == undefined || href == ""){href = obj.attr('target');}
87
+ if (href == null || href == undefined || href == ""){href = obj.attr('url');}
88
+
89
+ obj.attr('href', href);
90
+
91
+ if (update == 'reload'){
92
+ href = add_parameters(href, "_update=reload")
93
+ }
94
+
95
+ if (update == 'delete'){
96
+ href = add_parameters(href, "_update=delete")
97
+ }
98
+
99
+ if (update == 'abort'){
100
+ href = add_parameters(href, "_update=abort")
101
+ }
102
+
103
+ if (update == 'check'){
104
+ href = add_parameters(href, "_update=check")
105
+ }
106
+
107
+
108
+ $.ajax(href,{
109
+ cache: false,
110
+ beforeSend: function(){obj.addClass("reloading")},
111
+ complete: function(){
112
+ obj.removeClass("reloading");
113
+ if (update == 'delete' || update == 'abort'){
114
+ window.location = window.location;
115
+ }
116
+ },
117
+ error: function( req, text, error ) {
118
+ obj.removeClass("reloading");
119
+ obj.addClass("error");
120
+ if (obj.find('span[class*=status]').length == 0){
121
+ obj.html(obj.html() + "<span class='status'>error</status>")
122
+ }else{
123
+ obj.after($("<a class='retry_error'>retry</a>")).find('span[class*=status]').first().html("error")
124
+ }
125
+
126
+ if (obj.next('a.retry_error').length == 0 && obj.next().next('a.retry_error').length == 0){
127
+ obj.after($("<a class='retry_error'>retry</a>"))
128
+ rbbt_action_setup();
129
+ }
130
+
131
+ obj.next('a.abort_embedded').remove();
132
+ obj.next().next('a.abort_embedded').remove();
133
+
134
+ rbbt_action_setup();
135
+ },
136
+ 299: function( req, text, error ) {
137
+ obj.removeClass("reloading");
138
+ obj.addClass("error");
139
+ if (obj.find('span[class*=status]').length == 0){
140
+ obj.html(obj.html() + "<span class='status'>aborted</status>").after($("<a class='retry_error'>retry</a>"))
141
+ }else{
142
+ obj.after($("<a class='retry_error'>retry</a>")).find('span[class*=status]').first().html("abort")
143
+ }
144
+ rbbt_action_setup();
145
+ },
146
+ success: function( data, stat, req ) {
147
+ if (req.status == 202){
148
+ obj.addClass("reloading");
149
+
150
+ var status_span;
151
+
152
+ if ($(data).find('span.status').length > 0){
153
+ status_span = "<span class='status'>" + $(data).find('span.status').html() + '</span>';
154
+ }else{
155
+ if ($('<div>').html(data).find('span.status')){
156
+ status_span = data;
157
+ }else{
158
+ status_span = "<span class='status'>waiting</span>";
159
+ }
160
+ }
161
+
162
+ if (obj.find('span[class*=status]').length == 0){
163
+ obj.html(obj.html() + status_span)
164
+ }else{
165
+ obj.find('span[class*=status]').first().replaceWith($(status_span))
166
+ }
167
+
168
+ if (update == 'check'){
169
+ obj.removeClass("reloading");
170
+ obj.addClass("check");
171
+ if (obj.find('span[class*=status]').length == 0){
172
+ obj.after($("<a class='start_checked'>start</a>"));
173
+ }else{
174
+ obj.after($("<a class='start_checked'>start</a>"));
175
+ }
176
+ rbbt_action_setup();
177
+ }else{
178
+
179
+ if (obj.next('a.abort_embedded').length == 0 && obj.next().next('a.abort_embedded').length == 0){
180
+ obj.after($("<a class='abort_embedded'>abort</a>"))
181
+ rbbt_action_setup();
182
+ }
183
+
184
+ window.setTimeout(function(){replace_object(obj)}, 7000)
185
+ }
186
+ }else{
187
+ var html = '<div class="embedded" target="' + remove_parameter(remove_parameter(req.getResponseHeader("AJAX-URL"), '_'), "_update") + '">' + data + '</div>';
188
+ var embedded = $(html);
189
+ embedded.addClass(obj.attr('class'));
190
+ embedded.removeClass('replace');
191
+ embedded.removeClass('rbbt_action_setup');
192
+ embedded.removeClass("reloading");
193
+
194
+ obj.next('a.abort_embedded').remove();
195
+ obj.next().next('a.abort_embedded').remove();
196
+
197
+ obj.replaceWith(embedded);
198
+ remove_closed_section(embedded);
199
+ rbbt_action_setup();
200
+ }
201
+
202
+ }
203
+ });
204
+ }
205
+
206
+ // MISC
207
+
208
+ function set_page_title(){
209
+ var header = $('#main header')
210
+
211
+ if (header.length > 0){
212
+ var title = header.first().text()
213
+ document.title = title
214
+ }
215
+ }
216
+
217
+ function contract_ellipsis(elem, max){
218
+ if (undefined === max) { max = 5 };
219
+ var text;
220
+ var elements;
221
+ var type;
222
+
223
+ if (elem.text() == elem.html()){
224
+ type = 'text';
225
+ text = elem.text();
226
+ elements = text.split(', ');
227
+ }else{
228
+ type = 'html';
229
+ elements = elem.children();
230
+ }
231
+
232
+ if (elements.length > max + 2){
233
+ if (type == 'html'){
234
+ elements.removeClass('rbbt_action_setup')
235
+ }
236
+ var rest = elements.length - max;
237
+ var ellipsis = "... (<a href=# class='open_ellipsis'>" + rest + " more</a>)";
238
+ var end_span = $("<span class='ellipsis' attr-text='" + escape(elem.html()) + "'>" + ellipsis + "</span>");
239
+ var new_content;
240
+
241
+ if (type == 'text'){
242
+ new_content = elements.slice(0, max).join(", ");
243
+ elem.text(new_content);
244
+ }else{
245
+ var links = [];
246
+ var head = elements.slice(0, max);
247
+ head.each(function(){ links.push(this.outerHTML)})
248
+ new_content = links.join(", ");
249
+ elem.html(new_content);
250
+ }
251
+
252
+ end_span.appendTo(elem);
253
+
254
+ return(true);
255
+ }else{
256
+ return(false);
257
+ }
258
+ }
259
+
260
+ function restore_ellipsis(elem){
261
+ var span = elem.find('span.ellipsis')
262
+ if (span.length == 1){
263
+ var html = span.attr('attr-text');
264
+ elem.html(unescape(html));
265
+ }
266
+ rbbt_action_setup();
267
+ }
268
+
269
+