t2-web 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,104 @@
1
+ (function($) {
2
+ $.fn.tipsy = function(options) {
3
+
4
+ options = $.extend({}, $.fn.tipsy.defaults, options);
5
+
6
+ return this.each(function() {
7
+
8
+ var opts = $.fn.tipsy.elementOptions(this, options);
9
+
10
+ $(this).hover(function() {
11
+
12
+ $.data(this, 'cancel.tipsy', true);
13
+
14
+ var tip = $.data(this, 'active.tipsy');
15
+ if (!tip) {
16
+ tip = $('<div class="tipsy"><div class="tipsy-inner"/></div>');
17
+ tip.css({position: 'absolute', zIndex: 100000});
18
+ $.data(this, 'active.tipsy', tip);
19
+ }
20
+
21
+ if ($(this).attr('title') || typeof($(this).attr('original-title')) != 'string') {
22
+ $(this).attr('original-title', $(this).attr('title') || '').removeAttr('title');
23
+ }
24
+
25
+ var title;
26
+ if (typeof opts.title == 'string') {
27
+ title = $(this).attr(opts.title == 'title' ? 'original-title' : opts.title);
28
+ } else if (typeof opts.title == 'function') {
29
+ title = opts.title.call(this);
30
+ }
31
+
32
+ tip.find('.tipsy-inner')[opts.html ? 'html' : 'text'](title || opts.fallback);
33
+
34
+ var pos = $.extend({}, $(this).offset(), {width: this.offsetWidth, height: this.offsetHeight});
35
+ tip.get(0).className = 'tipsy'; // reset classname in case of dynamic gravity
36
+ tip.remove().css({top: 0, left: 0, visibility: 'hidden', display: 'block'}).appendTo(document.body);
37
+ var actualWidth = tip[0].offsetWidth, actualHeight = tip[0].offsetHeight;
38
+ var gravity = (typeof opts.gravity == 'function') ? opts.gravity.call(this) : opts.gravity;
39
+
40
+ switch (gravity.charAt(0)) {
41
+ case 'n':
42
+ tip.css({top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-north');
43
+ break;
44
+ case 's':
45
+ tip.css({top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2}).addClass('tipsy-south');
46
+ break;
47
+ case 'e':
48
+ tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth}).addClass('tipsy-east');
49
+ break;
50
+ case 'w':
51
+ tip.css({top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width}).addClass('tipsy-west');
52
+ break;
53
+ }
54
+
55
+ if (opts.fade) {
56
+ tip.css({opacity: 0, display: 'block', visibility: 'visible'}).animate({opacity: 0.8});
57
+ } else {
58
+ tip.css({visibility: 'visible'});
59
+ }
60
+
61
+ }, function() {
62
+ $.data(this, 'cancel.tipsy', false);
63
+ var self = this;
64
+ setTimeout(function() {
65
+ if ($.data(this, 'cancel.tipsy')) return;
66
+ var tip = $.data(self, 'active.tipsy');
67
+ if (opts.fade) {
68
+ tip.stop().fadeOut(function() { $(this).remove(); });
69
+ } else {
70
+ tip.remove();
71
+ }
72
+ }, 100);
73
+
74
+ });
75
+
76
+ });
77
+
78
+ };
79
+
80
+ // Overwrite this method to provide options on a per-element basis.
81
+ // For example, you could store the gravity in a 'tipsy-gravity' attribute:
82
+ // return $.extend({}, options, {gravity: $(ele).attr('tipsy-gravity') || 'n' });
83
+ // (remember - do not modify 'options' in place!)
84
+ $.fn.tipsy.elementOptions = function(ele, options) {
85
+ return $.metadata ? $.extend({}, options, $(ele).metadata()) : options;
86
+ };
87
+
88
+ $.fn.tipsy.defaults = {
89
+ fade: false,
90
+ fallback: '',
91
+ gravity: 'n',
92
+ html: false,
93
+ title: 'title'
94
+ };
95
+
96
+ $.fn.tipsy.autoNS = function() {
97
+ return $(this).offset().top > ($(document).scrollTop() + $(window).height() / 2) ? 's' : 'n';
98
+ };
99
+
100
+ $.fn.tipsy.autoWE = function() {
101
+ return $(this).offset().left > ($(document).scrollLeft() + $(window).width() / 2) ? 'e' : 'w';
102
+ };
103
+
104
+ })(jQuery);
@@ -0,0 +1,25 @@
1
+ function getSampleOutput(t2_server, uuid, output, wid, wkf_version) {
2
+ // t2 server REST call to sample output
3
+ var httpcall = "http://" + document.location.host + "/t2web/run/" + uuid + "/output/" + output +
4
+ "?server=" + t2_server + "&wid=" + wid + "&wkf_version=" + wkf_version;
5
+ // ajax request
6
+ $.get(httpcall, function (result) {
7
+ window.frames['data-display'].document.documentElement.innerHTML = result;
8
+ });
9
+
10
+ }
11
+
12
+ function checkRunStatus(t2_server, uuid) {
13
+ // t2 server REST call to uuid's status
14
+ var httpcall = "http://" + document.location.host + "/runs/" + uuid + "/status?server=" + t2_server;
15
+
16
+ // ajax request
17
+ $.get(httpcall, function (result) {
18
+ if (result == 'Finished') {
19
+ window.frames['data-navigation'].document.documentElement.innerHTML = results_navigation;
20
+ clearInterval(runStatusIntervalId);
21
+ }
22
+ });
23
+
24
+ }
25
+
@@ -0,0 +1,173 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Workflow: #{@my_exp_wkf.title}
5
+ %link(rel="stylesheet" href="/css/form.css")
6
+ %link(rel="stylesheet" href="/css/tipsy.css")
7
+ %script{:type => "text/javascript", :src => "/scripts/jquery-1.6.1.js"}
8
+ %script{:type => "text/javascript", :src => "/scripts/jquery.tipsy.js"}
9
+ %script{:type => "text/javascript", :src => "/scripts/form.js"}
10
+
11
+ %body
12
+
13
+ = generate_header_table(@my_exp_wkf, @my_exp_usr)
14
+
15
+ -# TODO: should move coding to controller and not use haml's "-" for logic inside the template!!!
16
+ -#header
17
+ %table.header
18
+ %tr
19
+ %td
20
+ %img{:src => "/images/nbic_logo.gif", :alt => "NBIC logo"}
21
+ %td
22
+ %table.header-title
23
+ %tr
24
+ %td.header-title Workflow: #{@my_exp_wkf.title}
25
+ - if #{@my_exp_wkf.user.name}
26
+ %tr
27
+ %td.right workflow by #{@my_exp_wkf.user.name}
28
+ %td
29
+ %img.right{:src => "/images/lumc_logo2.png", :alt => "LUMC logo"}
30
+
31
+ %br
32
+ #inputs
33
+ %form{:id => "workflow-form", :action => "/t2web/enact", :method => "post"}
34
+ %table.inputs
35
+ - if @my_exp_wkf.inputs.size >=1
36
+ %tr
37
+ %th.inputs
38
+ Configure Workflow Inputs
39
+ - @my_exp_wkf.inputs.each do |input|
40
+ %tr
41
+ %td.inputs
42
+ %div{:id => "#{input.name}-placeholder"}
43
+ Upload file?
44
+ %input{:id => "#{input.name}-checkbox", :type => "checkbox", :onclick => "toggleManualFileInput('#{input.name}')", :name => "upload-checkbox-#{input.name}", :value => "yes"}
45
+ %br
46
+ %br
47
+ %tr
48
+ %td.inputs
49
+ %input{:type => "hidden", :name => "wid", :value => "#{@wid}" }
50
+ %input{:type => "hidden", :name => "wkf_version", :value => "#{@wkf_version}" }
51
+ %input{:type => "hidden", :name => "server", :value => "#{@t2_server}" }
52
+ %input{:type => "submit", :value => "Execute", :class => "button"}
53
+ - if @my_exp_wkf.inputs.size >=1
54
+ - @my_exp_wkf.inputs.each do |input|
55
+ -# TODO: make helper create_input_tooltip(input) to return proper tooltip html string!!!
56
+ - if input.descriptions.size >=1
57
+ - input_label_tooltip = generate_label_tooltip(input)
58
+ - input_textarea_tooltip = ""
59
+ - if input.examples.size >=1
60
+ - input_textarea_tooltip = generate_textarea_tooltip(input)
61
+ %div{:id => "#{input.name}-upload-form-div"}
62
+ -#%form{:id => "#{input.name}-upload-form", :enctype => "multipart/form-data", :target => "hidden-iframe", :action => "/t2web/upload", :method => "post"}
63
+ %form{:id => "#{input.name}-upload-form", :enctype => "multipart/form-data"}
64
+ %label{:for => "#{input.name}-upload-label", :title => "#{input_label_tooltip}"} Select file for #{input.name}
65
+ %input{:type => "file", :name => "file", :onchange => "uploadFile('#{input.name}')"}
66
+ %div{:id => "#{input.name}-manual-group"}
67
+ %label{:for => "#{input.name}-label", :title => "#{input_label_tooltip}"} Enter #{input.name}:
68
+ %br
69
+ %textarea{:name => "#{input.name}-input", :rows => 3, :cols => 50, :title => "#{input_textarea_tooltip}"}
70
+ - if input.examples.size >= 1
71
+ = CGI::unescapeHTML(input.examples[0])
72
+ %iframe{:id => "hidden-iframe", :name => "hidden-iframe", :src => "#", :style => "width:0;height:0;border:0px solid #fff;"}
73
+
74
+ %br
75
+ #description
76
+ %table.inputs
77
+ %tr
78
+ %th.inputs
79
+ Workflow Description
80
+ %tr
81
+ %td.inputs
82
+ = @my_exp_wkf.description
83
+
84
+ -# %br
85
+ -# %br
86
+ -#inputs
87
+ - if @my_exp_wkf.inputs.size >=1
88
+ %table.inputs
89
+ %tr
90
+ %th.inputs
91
+ Input
92
+ %th.inputs
93
+ Description
94
+ %th.inputs
95
+ Examples
96
+ - @my_exp_wkf.inputs.each do |input|
97
+ %tr
98
+ %td.inputs
99
+ = input.name
100
+ %td.inputs
101
+ - if input.descriptions.size >=1
102
+ - input.descriptions.each do |descr|
103
+ = descr
104
+ %br
105
+ %td.inputs
106
+ - if input.examples.size >=1
107
+ - input.examples.each do |ex|
108
+ = ex
109
+ %br
110
+
111
+ %br
112
+ %br
113
+ #outputs
114
+ - if @my_exp_wkf.outputs.size >=1
115
+ %table.inputs
116
+ %tr
117
+ %th.inputs
118
+ Output
119
+ %th.inputs
120
+ Description
121
+ %th.inputs
122
+ Examples
123
+ - @my_exp_wkf.outputs.each do |output|
124
+ %tr
125
+ %td.inputs
126
+ = output.name
127
+ %td.inputs
128
+ - if output.descriptions.size >=1
129
+ - output.descriptions.each do |descr|
130
+ = descr
131
+ %br
132
+ %td.inputs
133
+ - if output.examples.size >=1
134
+ - if output.examples.size >=1
135
+ - output.examples.each do |ex|
136
+ = ex
137
+ %br
138
+
139
+ %br
140
+ %br
141
+ #note
142
+ %table.inputs
143
+ %tr
144
+ %th.inputs
145
+ %th.inputs
146
+ Please Note
147
+ %th.inputs
148
+ %tr
149
+ %td.inputs
150
+ %img{:src => "/images/info.png", :alt => "Important!" }
151
+ %td.inputs
152
+ Some workflows are not up-to-date or have dependencies that cannot be met by the specific Taverna server that you specified during generation of this tool. You can make sure that the workflow is valid by running it in the Taverna Workbench first to confirm that it works before running it via the Web.
153
+ %tr
154
+ %td.inputs
155
+ %img{:src => "/images/info.png", :alt => "Important!" }
156
+ %td.inputs
157
+ There might be some repetitions in the workflow description in some of the generated workflows. This is due to a backwards compatibility issue on the myExperiment repository which keeps the old descriptions to make sure that no information is lost.
158
+ %tr
159
+ %td.inputs
160
+ %img{:src => "/images/info.png", :alt => "Important!" }
161
+ %td.inputs
162
+ For more information on this workflow please visit the
163
+ %a{ :href => "http://www.myExperiment.org/workflows/#{@wid}" } myExperiment website
164
+ - if #{@my_exp_wkf.user.email}
165
+ %tr
166
+ %td.inputs
167
+ %img{:src => "/images/info.png", :alt => "Important!" }
168
+ %td.inputs
169
+ For questions/comments you can also contact the workflow creator at:
170
+ %a{ :href => "mailto:#{@my_exp_usr.email}" } #{@my_exp_usr.email}
171
+
172
+ %br
173
+ %br
@@ -0,0 +1,28 @@
1
+ !!!
2
+ %html
3
+ %head
4
+ %title Results:
5
+ %link(rel="stylesheet" href="/css/results.css")
6
+ %script{:type => "text/javascript", :src => "/scripts/jquery-1.6.1.js"}
7
+ %script{:type => "text/javascript"}
8
+ :plain
9
+ var runStatusIntervalId = 0;
10
+ var results_navigation = "";
11
+ $(document).ready(function() {
12
+ // calculate results_navigation here since helpers seem unavailable in results.js!?
13
+ results_navigation = "#{generate_data_navigation_frame(@my_exp_wkf, @run_uuid, @wid, @wkf_version, @t2_server, true)}";
14
+ window.frames['header'].document.write("#{generate_header_frame(@my_exp_wkf, @my_exp_usr).gsub!(/\n/, "")}");
15
+ window.frames['data-navigation'].document.write("#{generate_data_navigation_frame(@my_exp_wkf, @run_uuid, @wid, @wkf_version, @t2_server, false)}");
16
+ runStatusIntervalId = window.setInterval( "checkRunStatus('#{@t2_server}', '#{@run_uuid}')", 5000);
17
+ });
18
+ %script{:type => "text/javascript", :src => "/scripts/results.js"}
19
+
20
+ -# we use border for FF and framespacing for IE
21
+ %frameset{ :rows => "113px, *", :border => "1", :framespacing => "1" }
22
+ %noframes
23
+ To be viewed properly, this page requires frames.
24
+ %frame{ :name => "header", :id => "header" }
25
+ %frameset{ :cols => "250px, *", :border => "6", :framespacing => "6" }
26
+ %frame{ :name => "data-navigation", :id => "data-navigation" }
27
+ %frame{ :name => "data-display", :id => "data-display" }
28
+
metadata ADDED
@@ -0,0 +1,165 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: t2-web
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 5
10
+ version: 0.0.5
11
+ platform: ruby
12
+ authors:
13
+ - Kostas Karasavvas
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain: []
17
+
18
+ date: 2012-03-06 00:00:00 Z
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: sinatra
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ~>
27
+ - !ruby/object:Gem::Version
28
+ hash: 19
29
+ segments:
30
+ - 1
31
+ - 2
32
+ - 6
33
+ version: 1.2.6
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: haml
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ hash: 7
45
+ segments:
46
+ - 3
47
+ - 1
48
+ - 2
49
+ version: 3.1.2
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ - !ruby/object:Gem::Dependency
53
+ name: rest-client
54
+ prerelease: false
55
+ requirement: &id003 !ruby/object:Gem::Requirement
56
+ none: false
57
+ requirements:
58
+ - - ~>
59
+ - !ruby/object:Gem::Version
60
+ hash: 9
61
+ segments:
62
+ - 1
63
+ - 6
64
+ - 3
65
+ version: 1.6.3
66
+ type: :runtime
67
+ version_requirements: *id003
68
+ - !ruby/object:Gem::Dependency
69
+ name: t2-server
70
+ prerelease: false
71
+ requirement: &id004 !ruby/object:Gem::Requirement
72
+ none: false
73
+ requirements:
74
+ - - ~>
75
+ - !ruby/object:Gem::Version
76
+ hash: 5
77
+ segments:
78
+ - 0
79
+ - 6
80
+ - 1
81
+ version: 0.6.1
82
+ type: :runtime
83
+ version_requirements: *id004
84
+ - !ruby/object:Gem::Dependency
85
+ name: myexperiment-rest
86
+ prerelease: false
87
+ requirement: &id005 !ruby/object:Gem::Requirement
88
+ none: false
89
+ requirements:
90
+ - - ~>
91
+ - !ruby/object:Gem::Version
92
+ hash: 19
93
+ segments:
94
+ - 0
95
+ - 3
96
+ - 0
97
+ version: 0.3.0
98
+ type: :runtime
99
+ version_requirements: *id005
100
+ description: WS (with libs) that generates a Web UI form for a Taverna2 workflow and then enacts it to a T2 server.
101
+ email: kostas.karasavvas@nbic.nl
102
+ executables:
103
+ - t2_webapp.rb
104
+ extensions: []
105
+
106
+ extra_rdoc_files:
107
+ - README
108
+ - LICENSE
109
+ - CHANGES
110
+ files:
111
+ - LICENSE
112
+ - README
113
+ - CHANGES
114
+ - Rakefile
115
+ - bin/t2_webapp.rb
116
+ - public/scripts/results.js
117
+ - public/scripts/form.js
118
+ - public/scripts/jquery-1.6.1.js
119
+ - public/scripts/jquery.tipsy.js
120
+ - public/css/results_header.css
121
+ - public/css/tipsy.css
122
+ - public/css/form.css
123
+ - public/css/results_navigation.css
124
+ - public/images/nbic_logo.gif
125
+ - public/images/snake_transparent.gif
126
+ - public/images/tipsy.gif
127
+ - public/images/info.png
128
+ - public/images/lumc_logo2.png
129
+ - views/results.haml
130
+ - views/form.haml
131
+ homepage:
132
+ licenses: []
133
+
134
+ post_install_message:
135
+ rdoc_options: []
136
+
137
+ require_paths:
138
+ - lib
139
+ required_ruby_version: !ruby/object:Gem::Requirement
140
+ none: false
141
+ requirements:
142
+ - - ">="
143
+ - !ruby/object:Gem::Version
144
+ hash: 3
145
+ segments:
146
+ - 0
147
+ version: "0"
148
+ required_rubygems_version: !ruby/object:Gem::Requirement
149
+ none: false
150
+ requirements:
151
+ - - ">="
152
+ - !ruby/object:Gem::Version
153
+ hash: 3
154
+ segments:
155
+ - 0
156
+ version: "0"
157
+ requirements: []
158
+
159
+ rubyforge_project:
160
+ rubygems_version: 1.7.2
161
+ signing_key:
162
+ specification_version: 3
163
+ summary: WS (with libs) that generates a Web UI form for a Taverna2 workflow and then enacts it to a T2 server.
164
+ test_files: []
165
+