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.
- data/lib/rbbt/workflow/rest.rb +365 -95
- data/lib/rbbt/workflow/rest/client.rb +2 -0
- data/lib/rbbt/workflow/rest/entity.rb +82 -76
- data/lib/rbbt/workflow/rest/finder.rb +78 -0
- data/lib/rbbt/workflow/rest/helpers.rb +288 -47
- data/lib/rbbt/workflow/rest/notes.rb +125 -0
- data/lib/rbbt/workflow/rest/render.rb +280 -240
- data/lib/rbbt/workflow/rest/util.rb +47 -31
- data/share/views/compass/_base.sass +0 -8
- data/share/views/compass/colors.sass +10 -0
- data/share/views/compass/colors/ventana_azul.sass +5 -0
- data/share/views/compass/compass.config +2 -1
- data/share/views/compass/details.sass +50 -0
- data/share/views/compass/dom.sass +64 -0
- data/share/views/compass/embedded.sass +111 -0
- data/share/views/compass/entities.sass +8 -0
- data/share/views/compass/error.sass +13 -0
- data/share/views/compass/finder.sass +42 -0
- data/share/views/compass/fonts.sass +8 -0
- data/share/views/compass/form.sass +49 -1
- data/share/views/compass/header.sass +68 -0
- data/share/views/compass/{main.sass → helpers.sass} +53 -21
- data/share/views/compass/layout.sass +31 -199
- data/share/views/compass/lists.sass +128 -0
- data/share/views/compass/menu.sass +35 -0
- data/share/views/compass/notes.sass +52 -0
- data/share/views/compass/sizes.sass +8 -0
- data/share/views/compass/tables.sass +22 -0
- data/share/views/compass/wait.sass +9 -0
- data/share/views/edit_list.haml +41 -30
- data/share/views/entity/GOTerm.haml +4 -3
- data/share/views/entity/Gene.haml +8 -1
- data/share/views/entity/GenomicMutation.haml +4 -1
- data/share/views/entity/KeggPathway.haml +1 -1
- data/share/views/entity/MutatedIsoform.haml +68 -11
- data/share/views/entity/NCIBioCartaPathway.haml +2 -3
- data/share/views/entity/NCINaturePathway.haml +3 -3
- data/share/views/entity/NCIReactomePathway.haml +2 -3
- data/share/views/entity/PfamDomain.haml +2 -0
- data/share/views/entity/Transcript.haml +10 -0
- data/share/views/entity_list/Default.haml +4 -0
- data/share/views/entity_list/Default/compare_to_other_lists.haml +41 -0
- data/share/views/entity_list/Default/entity_links.haml +6 -0
- data/share/views/entity_list/Default/find_in_other_lists.haml +36 -0
- data/share/views/error.haml +6 -1
- data/share/views/find.haml +10 -0
- data/share/views/form.haml +1 -1
- data/share/views/info.haml +1 -1
- data/share/views/js/_action_setup.js +250 -0
- data/share/views/js/_basic.js +269 -0
- data/share/views/js/_cytoscape.js +44 -0
- data/share/views/js/_details.js +239 -0
- data/share/views/js/_dom_updates.js +384 -0
- data/share/views/js/_embedded.js +95 -0
- data/share/views/js/_images.js +20 -0
- data/share/views/js/_layout.js +21 -0
- data/share/views/js/_lists.js +224 -0
- data/share/views/js/_table.js +36 -0
- data/share/views/js/_workflow.js +42 -0
- data/share/views/js/app.js +0 -570
- data/share/views/js/fix_tablesorter_scientific.js +25 -0
- data/share/views/js/json2.js +487 -0
- data/share/views/layout.haml +8 -98
- data/share/views/notes.haml +15 -0
- data/share/views/partials/_form.haml +22 -7
- data/share/views/partials/_job_control.haml +8 -8
- data/share/views/partials/_list_control.haml +32 -0
- data/share/views/partials/_list_header.haml +6 -0
- data/share/views/partials/_note_list.haml +64 -0
- data/share/views/partials/_result_table.haml +12 -7
- data/share/views/partials/_result_table_controls.haml +11 -5
- data/share/views/partials/_table.haml +24 -6
- data/share/views/partials/layout/_coda.haml +10 -0
- data/share/views/partials/layout/_details.haml +25 -0
- data/share/views/partials/layout/_head.haml +22 -0
- data/share/views/partials/layout/_header.haml +29 -0
- data/share/views/partials/layout/_menu.haml +20 -0
- data/share/views/partials/layout/_resources.haml +41 -0
- data/share/views/public/background.png +0 -0
- data/share/views/public/plugins/cytoscape-web/LICENSE.txt +504 -0
- data/share/views/public/plugins/cytoscape-web/README.txt +213 -0
- data/share/views/public/plugins/cytoscape-web/js/AC_OETags.js +1 -0
- data/share/views/public/plugins/cytoscape-web/js/cytoscapeweb.js +1 -0
- data/share/views/public/plugins/cytoscape-web/js/json2.js +1 -0
- data/share/views/public/plugins/cytoscape-web/swf/CytoscapeWeb.swf +0 -0
- data/share/views/public/plugins/cytoscape-web/swf/playerProductInstall.swf +0 -0
- data/share/views/public/plugins/fancybox/CHANGELOG.md +68 -0
- data/share/views/public/plugins/fancybox/README.md +220 -0
- data/share/views/public/plugins/fancybox/css/blank.gif +0 -0
- data/share/views/public/plugins/fancybox/css/fancybox_loading.gif +0 -0
- data/share/views/public/plugins/fancybox/css/fancybox_sprite.png +0 -0
- data/share/views/public/plugins/fancybox/css/jquery.fancybox.css +234 -0
- data/share/views/public/plugins/fancybox/helpers/fancybox_buttons.png +0 -0
- data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-buttons.css +85 -0
- data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-buttons.js +115 -0
- data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-media.js +85 -0
- data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-thumbs.css +54 -0
- data/share/views/public/plugins/fancybox/helpers/jquery.fancybox-thumbs.js +157 -0
- data/share/views/public/plugins/fancybox/js/jquery.fancybox.js +1463 -0
- data/share/views/public/plugins/fancybox/js/jquery.mousewheel-3.0.6.pack.js +13 -0
- data/share/views/public/plugins/fancybox/lib/jquery-1.7.2.min.js +4 -0
- data/share/views/public/plugins/featuredimagezoomer/css/featuredimagezoomer.css +8 -0
- data/share/views/public/plugins/featuredimagezoomer/images/spinningred.gif +0 -0
- data/share/views/public/plugins/featuredimagezoomer/js/featuredimagezoomer.js +245 -0
- data/share/views/public/plugins/jquery-ui.hitarea.js +173 -0
- data/share/views/public/plugins/jquery/js/jquery-1.8.0.min.js +2 -0
- data/share/views/public/plugins/tablesorter/addons/pager/jquery.tablesorter.pager.css +25 -0
- data/share/views/public/plugins/tablesorter/addons/pager/jquery.tablesorter.pager.js +184 -0
- data/share/views/public/plugins/tablesorter/build.xml +26 -0
- data/share/views/public/plugins/tablesorter/build/ParseMaster.js +106 -0
- data/share/views/public/plugins/tablesorter/build/js.jar +0 -0
- data/share/views/public/plugins/tablesorter/build/jsmin.js +316 -0
- data/share/views/public/plugins/tablesorter/build/min.js +5 -0
- data/share/views/public/plugins/tablesorter/build/pack.js +5 -0
- data/share/views/public/plugins/tablesorter/build/packer.js +316 -0
- data/share/views/public/plugins/tablesorter/build/writeFile.js +19 -0
- data/share/views/public/plugins/tablesorter/changelog +41 -0
- data/share/views/public/plugins/tablesorter/docs/assets/ajax-content.html +43 -0
- data/share/views/public/plugins/tablesorter/docs/css/jq.css +29 -0
- data/share/views/public/plugins/tablesorter/docs/example-ajax.html +119 -0
- data/share/views/public/plugins/tablesorter/docs/example-empty-table.html +75 -0
- data/share/views/public/plugins/tablesorter/docs/example-extending-defaults.html +109 -0
- data/share/views/public/plugins/tablesorter/docs/example-meta-headers.html +108 -0
- data/share/views/public/plugins/tablesorter/docs/example-meta-parsers.html +105 -0
- data/share/views/public/plugins/tablesorter/docs/example-meta-sort-list.html +107 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-debug.html +116 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-digits.html +106 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-sort-force.html +107 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-sort-key.html +108 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-sort-list.html +108 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-sort-order.html +108 -0
- data/share/views/public/plugins/tablesorter/docs/example-option-text-extraction.html +85 -0
- data/share/views/public/plugins/tablesorter/docs/example-options-headers.html +118 -0
- data/share/views/public/plugins/tablesorter/docs/example-pager.html +329 -0
- data/share/views/public/plugins/tablesorter/docs/example-parsers.html +112 -0
- data/share/views/public/plugins/tablesorter/docs/example-trigger-sort.html +113 -0
- data/share/views/public/plugins/tablesorter/docs/example-triggers.html +336 -0
- data/share/views/public/plugins/tablesorter/docs/example-update-cell.html +118 -0
- data/share/views/public/plugins/tablesorter/docs/example-widgets.html +383 -0
- data/share/views/public/plugins/tablesorter/docs/img/external.png +0 -0
- data/share/views/public/plugins/tablesorter/docs/index.html +576 -0
- data/share/views/public/plugins/tablesorter/docs/js/docs.js +23 -0
- data/share/views/public/plugins/tablesorter/docs/js/examples.js +29 -0
- data/share/views/public/plugins/tablesorter/jquery-latest.js +154 -0
- data/share/views/public/plugins/tablesorter/jquery.metadata.js +122 -0
- data/share/views/public/plugins/tablesorter/jquery.tablesorter.js +1031 -0
- data/share/views/public/plugins/tablesorter/jquery.tablesorter.min.js +4 -0
- data/share/views/public/plugins/tablesorter/tests/assets/ajax-content.html +28 -0
- data/share/views/public/plugins/tablesorter/tests/cell.metadata.html +112 -0
- data/share/views/public/plugins/tablesorter/tests/checkbox.html +117 -0
- data/share/views/public/plugins/tablesorter/tests/colspan.html +149 -0
- data/share/views/public/plugins/tablesorter/tests/demo.html +353 -0
- data/share/views/public/plugins/tablesorter/tests/index.html +22 -0
- data/share/views/public/plugins/tablesorter/tests/large.html +30 -0
- data/share/views/public/plugins/tablesorter/tests/lockedOrder.html +355 -0
- data/share/views/public/plugins/tablesorter/tests/metadata.html +320 -0
- data/share/views/public/plugins/tablesorter/tests/multiple-headers.html +67 -0
- data/share/views/public/plugins/tablesorter/tests/pager.html +553 -0
- data/share/views/public/plugins/tablesorter/themes/blue/asc.gif +0 -0
- data/share/views/public/plugins/tablesorter/themes/blue/bg.gif +0 -0
- data/share/views/public/plugins/tablesorter/themes/blue/blue.zip +0 -0
- data/share/views/public/plugins/tablesorter/themes/blue/desc.gif +0 -0
- data/share/views/public/plugins/tablesorter/themes/blue/style.css +39 -0
- data/share/views/public/plugins/tablesorter/themes/green/asc.png +0 -0
- data/share/views/public/plugins/tablesorter/themes/green/bg.png +0 -0
- data/share/views/public/plugins/tablesorter/themes/green/desc.png +0 -0
- data/share/views/public/plugins/tablesorter/themes/green/green.zip +0 -0
- data/share/views/public/plugins/tablesorter/themes/green/style.css +39 -0
- data/share/views/public/plugins/wz_jsgraphics.js +1108 -0
- data/share/views/public/tmp/foo +0 -0
- data/share/views/result.haml +6 -1
- data/share/views/step_error.haml +5 -0
- data/share/views/user_lists.haml +8 -7
- data/share/views/wait.haml +40 -2
- metadata +302 -106
- data/share/views/compass/screen.sass +0 -8
- data/share/views/public/plugins/jquery/js/jquery-1.6.2.min.js +0 -18
@@ -0,0 +1,95 @@
|
|
1
|
+
//{{{ CLOSED SECTIONS
|
2
|
+
|
3
|
+
if ($.cookie('closed_sections') == null){
|
4
|
+
$.cookie('closed_sections', '[]', {path: '/', expires: 30})
|
5
|
+
}
|
6
|
+
|
7
|
+
var closed_sections = JSON.parse($.cookie('closed_sections'))
|
8
|
+
|
9
|
+
if (! Array === closed_sections){
|
10
|
+
closed_sections = [];
|
11
|
+
}
|
12
|
+
|
13
|
+
function add_closed_section(embedded){
|
14
|
+
var target;
|
15
|
+
if (undefined === embedded.attr('target')){
|
16
|
+
target = unescape(embedded.attr('href'));
|
17
|
+
}else{
|
18
|
+
target = unescape(embedded.attr('target'));
|
19
|
+
}
|
20
|
+
closed_sections.push(target);
|
21
|
+
$.cookie('closed_sections', JSON.stringify(closed_sections), {path: '/', expires: 30});
|
22
|
+
}
|
23
|
+
|
24
|
+
function remove_closed_section(embedded){
|
25
|
+
var target;
|
26
|
+
if (undefined === embedded.attr('target')){
|
27
|
+
target = unescape(embedded.attr('href'));
|
28
|
+
}else{
|
29
|
+
target = unescape(embedded.attr('target'));
|
30
|
+
}
|
31
|
+
|
32
|
+
closed_sections.remove(target);
|
33
|
+
$.cookie('closed_sections', JSON.stringify(closed_sections), {path: '/', expires: 30});
|
34
|
+
}
|
35
|
+
|
36
|
+
//{{{ EMBEDDED CONTROL
|
37
|
+
|
38
|
+
function expand_embedded(embedded){
|
39
|
+
var header = embedded.find('header').first();
|
40
|
+
embedded.html(embedded.attr('attr-save'));
|
41
|
+
embedded.attr('attr-save', null);
|
42
|
+
embedded.removeClass('contracted_embedded');
|
43
|
+
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
44
|
+
remove_closed_section(embedded);
|
45
|
+
rbbt_action_setup();
|
46
|
+
}
|
47
|
+
|
48
|
+
function contract_embedded(embedded){
|
49
|
+
var header = embedded.find('header').first();
|
50
|
+
embedded.attr('attr-save', embedded.html());
|
51
|
+
embedded.html(header.html());
|
52
|
+
embedded.addClass('contracted_embedded');
|
53
|
+
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
54
|
+
add_closed_section(embedded);
|
55
|
+
rbbt_action_setup();
|
56
|
+
}
|
57
|
+
|
58
|
+
//{{{ CALL ACTION
|
59
|
+
|
60
|
+
var call_entity_action_url_template = '/entity_action/TYPE_FORMAT/ACTION/ENTITY'
|
61
|
+
|
62
|
+
function entity_action_url(type, action, entity, params){
|
63
|
+
var type_format;
|
64
|
+
var format;
|
65
|
+
if (undefined === params) format = undefined;
|
66
|
+
else format = params['format'];
|
67
|
+
|
68
|
+
if (undefined === format || format == null){
|
69
|
+
type_format = type;
|
70
|
+
}else{
|
71
|
+
type_format = type + ":" + format;
|
72
|
+
}
|
73
|
+
|
74
|
+
var url = call_entity_action_url_template
|
75
|
+
.replace("TYPE_FORMAT", type_format)
|
76
|
+
.replace("ACTION", action)
|
77
|
+
.replace("ENTITY", entity)
|
78
|
+
|
79
|
+
url = add_parameters(url, params);
|
80
|
+
|
81
|
+
return(url);
|
82
|
+
}
|
83
|
+
|
84
|
+
function replace_with(obj, url, update){
|
85
|
+
obj.attr('href', url);
|
86
|
+
obj.attr('target', url);
|
87
|
+
obj.attr('url', url);
|
88
|
+
replace_object(obj, update, url)
|
89
|
+
}
|
90
|
+
|
91
|
+
function replace_with_action(obj, type, action, entity, params){
|
92
|
+
var url = entity_action_url(type, action, entity, params);
|
93
|
+
replace_with(obj, url);
|
94
|
+
}
|
95
|
+
|
@@ -0,0 +1,20 @@
|
|
1
|
+
function clean_zoomable_images(elem){
|
2
|
+
if (undefined === elem){
|
3
|
+
$('div.magnifyarea, div.zoomstatus, div.zoomtracker').remove();
|
4
|
+
}else{
|
5
|
+
elem.find('div.magnifyarea, div.zoomstatus, div.zoomtracker').remove();
|
6
|
+
}
|
7
|
+
}
|
8
|
+
|
9
|
+
function zoomable_images(elem){
|
10
|
+
clean_zoomable_images(elem);
|
11
|
+
if (undefined === elem){
|
12
|
+
$('.zoomable_image > img').addimagezoom({zoomrange: [2,25], magnifiersize: [300,300], curshade: true, container: $('#main')});
|
13
|
+
}else{
|
14
|
+
elem.find('.zoomable_image > img').addimagezoom({zoomrange: [2,25], magnifiersize: [300,300], curshade: true, container: elem});
|
15
|
+
}
|
16
|
+
$('div.zoomtracker').click(function(){
|
17
|
+
var url = $(this).prev().prev().find('img').attr('src');
|
18
|
+
window.open(url, '_blank');
|
19
|
+
})
|
20
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
// Set page title
|
2
|
+
function rbbt_setup_layout(){
|
3
|
+
set_page_title();
|
4
|
+
|
5
|
+
hide_details();
|
6
|
+
|
7
|
+
$('#hide_details').click(hide_details);
|
8
|
+
$('#toggle_expand_details').click(toggle_expand_details);
|
9
|
+
$('#back_details').click(back_details);
|
10
|
+
$('#reload_details').click(reload_details);
|
11
|
+
$('#save_details').click(save_details);
|
12
|
+
$('#link_details').click(link_details);
|
13
|
+
|
14
|
+
var details_history = [];
|
15
|
+
|
16
|
+
update_saved_lists();
|
17
|
+
|
18
|
+
rbbt_action_setup();
|
19
|
+
}
|
20
|
+
|
21
|
+
|
@@ -0,0 +1,224 @@
|
|
1
|
+
//{{{ LIST MANAGEMENT
|
2
|
+
|
3
|
+
var entity_lists = {}
|
4
|
+
|
5
|
+
function saved_lists(){
|
6
|
+
return JSON.parse($.cookie('saved_lists'))
|
7
|
+
}
|
8
|
+
|
9
|
+
function remove_list(type, list){
|
10
|
+
var lists = saved_lists();
|
11
|
+
if (lists == null) { lists = {}; };
|
12
|
+
if (lists[type] == null) { lists[type] = [] };
|
13
|
+
|
14
|
+
var elems = lists[type]
|
15
|
+
if (elems != null){
|
16
|
+
var index = elems.indexOf(list);
|
17
|
+
|
18
|
+
if (index != -1){ elems.splice(index, 1);}
|
19
|
+
|
20
|
+
if (elems.length > 0){
|
21
|
+
lists[type] = elems;
|
22
|
+
}else{
|
23
|
+
delete lists[type]
|
24
|
+
}
|
25
|
+
|
26
|
+
$.cookie('saved_lists', JSON.stringify(lists), {path: "/", expires: 30})
|
27
|
+
|
28
|
+
if (window.entity_lists && $.inArray(entity_lists, type) && $.inArray(entity_lists[type], list)){
|
29
|
+
delete entity_lists[type][list]
|
30
|
+
}
|
31
|
+
|
32
|
+
if (window.entity_lists && $.inArray(entity_lists, type) && entity_lists[type].length == 0){
|
33
|
+
delete entity_lists[type]
|
34
|
+
}
|
35
|
+
|
36
|
+
}
|
37
|
+
|
38
|
+
update_list_viewer()
|
39
|
+
}
|
40
|
+
|
41
|
+
function load_list(type, list){
|
42
|
+
var lists = saved_lists();
|
43
|
+
if (lists == null) { lists = {}; };
|
44
|
+
if (lists[type] == null) { lists[type] = [] };
|
45
|
+
lists[type].push(list);
|
46
|
+
$.cookie('saved_lists', JSON.stringify(lists), {path: "/", expires: 30})
|
47
|
+
add_entity_list(type, list);
|
48
|
+
}
|
49
|
+
|
50
|
+
function record_list(type, list_id, list){
|
51
|
+
if (entity_lists[type] == null){
|
52
|
+
entity_lists[type] = {}
|
53
|
+
}
|
54
|
+
entity_lists[type][list_id] = list;
|
55
|
+
}
|
56
|
+
|
57
|
+
function update_list_viewer(){
|
58
|
+
var list_html = ""
|
59
|
+
list_html += "<div id='entity_list_menu'>"
|
60
|
+
list_html += "<a href='/entity_list/user'>your lists</a>\n"
|
61
|
+
list_html += "<a href='/entity_list/public'>public lists</a>\n"
|
62
|
+
list_html += "<a class='clear_selected' href='#clear_selected'>clear selected</a>\n"
|
63
|
+
list_html += "<a class='update_list_viewer' href='#update_list_viewer'>update</a>\n"
|
64
|
+
list_html += "</div>"
|
65
|
+
list_html += "<h5 class='loaded_lists'>Loaded lists</h5>\n"
|
66
|
+
list_html += "<dl class='entity_list_types'>\n"
|
67
|
+
$.each(entity_lists, function(type, lists){
|
68
|
+
list_html += "<dt>" + type + "</dt>\n"
|
69
|
+
list_html += "<dd>\n"
|
70
|
+
list_html += "<ul class='entity_list'>"
|
71
|
+
$.each(lists, function(name, elems){
|
72
|
+
if (elems == null){
|
73
|
+
list_html += "<li>"
|
74
|
+
|
75
|
+
list_html += "<span class='error_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
76
|
+
list_html += "error"
|
77
|
+
list_html += "</span>" + "\n"
|
78
|
+
|
79
|
+
|
80
|
+
list_html += "<a href='#remove_list' class='remove_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
81
|
+
list_html += "remove"
|
82
|
+
list_html += "</a>" + "\n"
|
83
|
+
|
84
|
+
list_html += "<a href='/entity_list/" + type + "/" + name + "' class='view_list' attr-list-type='" + type + "'>"
|
85
|
+
list_html += name
|
86
|
+
list_html += "</a>" + "\n"
|
87
|
+
|
88
|
+
}else{
|
89
|
+
list_html += "<li>"
|
90
|
+
|
91
|
+
list_html += "<a href='#select_list' class='select_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
92
|
+
list_html += 'select'
|
93
|
+
list_html += "</a>" + "\n"
|
94
|
+
|
95
|
+
list_html += "<a href='#remove_list' class='remove_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
96
|
+
list_html += "remove"
|
97
|
+
list_html += "</a>" + "\n"
|
98
|
+
|
99
|
+
list_html += "<a href='/entity_list/" + type + "/" + name + "' class='view_list' attr-list-type='" + type + "'>"
|
100
|
+
list_html += name
|
101
|
+
list_html += "</a>" + "\n"
|
102
|
+
|
103
|
+
list_html += "</li>"
|
104
|
+
}
|
105
|
+
})
|
106
|
+
list_html += "</ul>"
|
107
|
+
list_html += "</dd>\n"
|
108
|
+
})
|
109
|
+
$('#lists').html(list_html);
|
110
|
+
rbbt_action_setup();
|
111
|
+
}
|
112
|
+
|
113
|
+
function update_list_selectors(){
|
114
|
+
$.each(entity_lists, function(type, lists){
|
115
|
+
$('select.loaded_lists[type=' + type + ']').each(function(){
|
116
|
+
var select = $(this);
|
117
|
+
select.find('option[class*=automatic_load]').remove();
|
118
|
+
|
119
|
+
if (select.attr('attr-allow-empty') == 'true'){
|
120
|
+
var option = $('<option value="none" class="loaded">none</option>')
|
121
|
+
select.append(option);
|
122
|
+
}
|
123
|
+
|
124
|
+
var selected = null;
|
125
|
+
|
126
|
+
if (select.attr('attr-selected') != undefined ){
|
127
|
+
selected = select.attr('attr-selected');
|
128
|
+
}
|
129
|
+
|
130
|
+
$.each(lists, function(name, elems){
|
131
|
+
var option = null;
|
132
|
+
if (selected == null || name != selected){
|
133
|
+
option = $('<option class="automatic_load" value="' + name + '">' + name + '</option>');
|
134
|
+
}else{
|
135
|
+
option = $('<option class="automatic_load" selected=selected value="' + name + '">' + name + '</option>');
|
136
|
+
}
|
137
|
+
select.append(option);
|
138
|
+
return true
|
139
|
+
})
|
140
|
+
})
|
141
|
+
});
|
142
|
+
}
|
143
|
+
|
144
|
+
function add_entity_list(type, list_id, async){
|
145
|
+
if (async === undefined) asyn = true
|
146
|
+
$.ajax({
|
147
|
+
url: "/entity_list/" + type + "/" + list_id + '?_format=json',
|
148
|
+
dataType: 'json',
|
149
|
+
async: async,
|
150
|
+
success: function(data){
|
151
|
+
record_list(type, list_id, data);
|
152
|
+
update_list_viewer();
|
153
|
+
update_list_selectors();
|
154
|
+
},
|
155
|
+
error: function(data){
|
156
|
+
remove_list(type, list_id);
|
157
|
+
}
|
158
|
+
});
|
159
|
+
}
|
160
|
+
|
161
|
+
|
162
|
+
function select_list(type, list_id){
|
163
|
+
if (entity_lists[type] === undefined){
|
164
|
+
add_entity_list(type, list_id, false)
|
165
|
+
}
|
166
|
+
|
167
|
+
var list = entity_lists[type][list_id];
|
168
|
+
|
169
|
+
if (list === undefined){
|
170
|
+
add_entity_list(type, list_id, false)
|
171
|
+
list = entity_lists[type][list_id]
|
172
|
+
}
|
173
|
+
|
174
|
+
$.each(list, function(id, data){
|
175
|
+
var entity = data[0];
|
176
|
+
var info = data[1];
|
177
|
+
var format = info["format"];
|
178
|
+
var id = info["id"];
|
179
|
+
var entity_id = id_for_entity(format, entity, id);
|
180
|
+
$('.entity[' + entity_id + ']').addClass("selected_entity");
|
181
|
+
})
|
182
|
+
|
183
|
+
select_cytoscape(list);
|
184
|
+
}
|
185
|
+
|
186
|
+
function update_saved_lists(){
|
187
|
+
var _saved_lists = saved_lists();
|
188
|
+
|
189
|
+
if (_saved_lists == null){ _saved_lists = []; }
|
190
|
+
|
191
|
+
update_list_viewer();
|
192
|
+
|
193
|
+
$.each(_saved_lists, function(type, lists){
|
194
|
+
$.each(lists, function(id, list){
|
195
|
+
add_entity_list(type, list)
|
196
|
+
})
|
197
|
+
})
|
198
|
+
}
|
199
|
+
|
200
|
+
//{{{ Cytoscape lists
|
201
|
+
function select_cytoscape_visualization(list, cytoscape_visualization){
|
202
|
+
var visual_style_bypass = {nodes:{}};
|
203
|
+
$.each(list, function(id, data){
|
204
|
+
var entity = data[0];
|
205
|
+
var info = data[1];
|
206
|
+
var format = info["format"];
|
207
|
+
var id = info["id"];
|
208
|
+
visual_style_bypass['nodes'][entity] = { borderWidth: 5}
|
209
|
+
})
|
210
|
+
|
211
|
+
cytoscape_visualization.visualStyleBypass(visual_style_bypass);
|
212
|
+
}
|
213
|
+
|
214
|
+
function select_cytoscape(list){
|
215
|
+
if (typeof(cytoscape_visualization) !== 'undefined'){
|
216
|
+
select_cytoscape_visualization(list, cytoscape_visualization);
|
217
|
+
}
|
218
|
+
if (typeof(cytoscape_pathway_visualization) !== 'undefined'){
|
219
|
+
select_cytoscape_visualization(list, cytoscape_pathway_visualization);
|
220
|
+
}
|
221
|
+
}
|
222
|
+
|
223
|
+
|
224
|
+
|
@@ -0,0 +1,36 @@
|
|
1
|
+
//{{{ TABLE CONTROL
|
2
|
+
|
3
|
+
function rbbt_table_setup(){
|
4
|
+
$('table form.table_controls').not('[class*=rbbt_table_setup]').each(function(){
|
5
|
+
var form = $(this);
|
6
|
+
var embedded_div = $(this).parents("div.embedded").first()
|
7
|
+
if (embedded_div.html() != null){
|
8
|
+
var href = embedded_div.attr('target')
|
9
|
+
form.find(".change_page").click(function(){
|
10
|
+
var pfield = form.find(".pfield").first().val();
|
11
|
+
var pnum = form.find(".pnum").first().val();
|
12
|
+
var psize = form.find(".psize").first().val();
|
13
|
+
var change = $(this).val();
|
14
|
+
$.ajax({
|
15
|
+
cache: false,
|
16
|
+
url: add_parameters(href, "_pfield=" + pfield + "&_pnum=" + pnum + "&_psize=" + psize + "&_paginate=" + change),
|
17
|
+
success: function(data){
|
18
|
+
embedded_div.html(data);
|
19
|
+
rbbt_action_setup();
|
20
|
+
}
|
21
|
+
})
|
22
|
+
return false;
|
23
|
+
})
|
24
|
+
}
|
25
|
+
}).addClass('rbbt_table_setup');
|
26
|
+
}
|
27
|
+
|
28
|
+
function fix_long_table_cells(table, max){
|
29
|
+
var update = false;
|
30
|
+
table.find('td').each(function(){
|
31
|
+
update = contract_ellipsis($(this), max) || update;
|
32
|
+
});
|
33
|
+
rbbt_action_setup();
|
34
|
+
}
|
35
|
+
|
36
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
//{{{ WORKFLOW MANAGEMENT
|
2
|
+
|
3
|
+
function exec_job(workflow, task, params, format){
|
4
|
+
params = $.extend({}, params);
|
5
|
+
|
6
|
+
mime_type = params.download_mime_type;
|
7
|
+
params.download_mime_type = undefined;
|
8
|
+
|
9
|
+
if (undefined === params._format){
|
10
|
+
params._format = format;
|
11
|
+
}
|
12
|
+
|
13
|
+
format = params._format;
|
14
|
+
|
15
|
+
if (format == null){
|
16
|
+
format = "json";
|
17
|
+
params._format = json;
|
18
|
+
}
|
19
|
+
|
20
|
+
url = ["", workflow, task].join("/")
|
21
|
+
response = $.ajax(url, {
|
22
|
+
cache: false,
|
23
|
+
async: false,
|
24
|
+
type: 'POST',
|
25
|
+
data: params,
|
26
|
+
timeout: 20000
|
27
|
+
})
|
28
|
+
|
29
|
+
if (format == "json")
|
30
|
+
return JSON.parse(response.responseText);
|
31
|
+
|
32
|
+
if (format == "raw"){
|
33
|
+
if (undefined === mime_type){
|
34
|
+
mime_type = 'application/octet-stream';
|
35
|
+
}
|
36
|
+
data_uri_header = 'data:' + mime_type;
|
37
|
+
window.open(data_uri_header + ',' + encodeURIComponent(response.responseText));
|
38
|
+
}else
|
39
|
+
response.responseText;
|
40
|
+
}
|
41
|
+
|
42
|
+
|
data/share/views/js/app.js
CHANGED
@@ -1,572 +1,2 @@
|
|
1
|
-
$.fn.getClassInList = function(list){
|
2
|
-
for(var i = 0; i < list.length; i++)
|
3
|
-
{
|
4
|
-
if($(this).hasClass(list[i]))
|
5
|
-
return list[i];
|
6
|
-
}
|
7
|
-
return "";
|
8
|
-
}
|
9
1
|
|
10
|
-
function add_parameters(url, parameters){
|
11
|
-
if (url.indexOf('?') == -1){
|
12
|
-
return url + '?' + parameters;
|
13
|
-
}else{
|
14
|
-
return url + '&' + parameters;
|
15
|
-
}
|
16
|
-
}
|
17
|
-
|
18
|
-
// DETAILS
|
19
|
-
|
20
|
-
function show_details(){
|
21
|
-
var main_size = $(window).height() - $('#details').outerHeight() - $('#details_controls').outerHeight() - $('#header').outerHeight() - 45;
|
22
|
-
scroll(0,0);
|
23
|
-
$('#details').show();
|
24
|
-
$('#details_controls').show();
|
25
|
-
$('#main').css('height', main_size).addClass('contracted');
|
26
|
-
$('#menu').css('height', main_size + $('#details').outerHeight() + $('#details_controls').outerHeight()).addClass('contracted');
|
27
|
-
return false;
|
28
|
-
}
|
29
|
-
|
30
|
-
function hide_details(){
|
31
|
-
details_history = [];
|
32
|
-
$('#main').show();
|
33
|
-
$('#details').hide().removeClass('expanded');
|
34
|
-
$('#details').attr('href', null);
|
35
|
-
$('#details_controls').hide();
|
36
|
-
$('#main').css('height', '100%').removeClass('contracted');
|
37
|
-
$('#menu').css('height', '100%').removeClass('contracted');
|
38
|
-
return false;
|
39
|
-
}
|
40
|
-
|
41
|
-
function toggle_details(){
|
42
|
-
if ($('#details').is(":visible")){
|
43
|
-
hide_details;
|
44
|
-
}else{
|
45
|
-
show_details;
|
46
|
-
}
|
47
|
-
return false;
|
48
|
-
}
|
49
|
-
|
50
|
-
function toggle_expand_details(){
|
51
|
-
if ($('#details').hasClass('expanded')){
|
52
|
-
contract_details();
|
53
|
-
}else{
|
54
|
-
expand_details();
|
55
|
-
}
|
56
|
-
return false
|
57
|
-
}
|
58
|
-
|
59
|
-
function expand_details(){
|
60
|
-
var url = $('#details').attr('url');
|
61
|
-
if (url == null) return false;
|
62
|
-
|
63
|
-
$.ajax(add_parameters(url, '_size=normal&_cache_type=memory'), {
|
64
|
-
cache: false,
|
65
|
-
success: function(data){
|
66
|
-
$('#details').html(data).attr('url', url);
|
67
|
-
$('#main').hide()
|
68
|
-
$('#details').addClass("expanded")
|
69
|
-
show_details();
|
70
|
-
rbbt_action_setup();
|
71
|
-
},
|
72
|
-
error: function(){
|
73
|
-
$('#details').html("<span class='details_error'>Error loading " + href + "</span>");
|
74
|
-
}
|
75
|
-
})
|
76
|
-
|
77
|
-
return false
|
78
|
-
}
|
79
|
-
|
80
|
-
function contract_details(){
|
81
|
-
var url = $('#details').attr('url');
|
82
|
-
if (url == null) return false;
|
83
|
-
|
84
|
-
$.ajax(add_parameters(url, '_size=small&_cache_type=memory'), {
|
85
|
-
cache: false,
|
86
|
-
success: function(data){
|
87
|
-
$('#details').html(data).attr('url', url);
|
88
|
-
$('#main').show()
|
89
|
-
$('#details').removeClass("expanded")
|
90
|
-
show_details();
|
91
|
-
rbbt_action_setup();
|
92
|
-
},
|
93
|
-
error: function(){
|
94
|
-
$('#details').html("<span class='details_error'>Error loading " + href + "</span>");
|
95
|
-
}
|
96
|
-
})
|
97
|
-
|
98
|
-
return false
|
99
|
-
}
|
100
|
-
|
101
|
-
function back_details(){
|
102
|
-
var url = details_history.pop();
|
103
|
-
if (url != null && url != undefined ){
|
104
|
-
|
105
|
-
if ($('#details').hasClass("expanded")){
|
106
|
-
size = "normal";
|
107
|
-
}else{
|
108
|
-
size = "small";
|
109
|
-
}
|
110
|
-
|
111
|
-
$.ajax(add_parameters(url, '_size=' + size + "&_cache_type=memory"), {
|
112
|
-
cache: false,
|
113
|
-
success: function(data){
|
114
|
-
$('#details').html(data).attr('url', url);
|
115
|
-
rbbt_action_setup();
|
116
|
-
},
|
117
|
-
error: function(){
|
118
|
-
$('#details').html("<span class='details_error'>Error loading " + href + "</span>");
|
119
|
-
}
|
120
|
-
})
|
121
|
-
}
|
122
|
-
return false;
|
123
|
-
}
|
124
|
-
|
125
|
-
// REPLACE OBJECTS
|
126
|
-
|
127
|
-
function replace_object(obj, update){
|
128
|
-
var href = obj.attr('href');
|
129
|
-
|
130
|
-
|
131
|
-
if (href == null || href == undefined || href == ""){href = obj.attr('target');}
|
132
|
-
if (href == null || href == undefined || href == ""){href = obj.attr('url');}
|
133
|
-
|
134
|
-
if (update == 'reload'){
|
135
|
-
href = add_parameters(href, "_update=reload")
|
136
|
-
}
|
137
|
-
|
138
|
-
if (update == 'check'){
|
139
|
-
href = add_parameters(href, "_update=check")
|
140
|
-
}
|
141
|
-
|
142
|
-
$.ajax(href,{
|
143
|
-
cache: false,
|
144
|
-
beforeSend: function(){obj.addClass("reloading")},
|
145
|
-
complete: function(){obj.removeClass("reloading")},
|
146
|
-
error: function( req, text, error ) {
|
147
|
-
obj.removeClass("reloading");
|
148
|
-
obj.addClass("error");
|
149
|
-
if (obj.find('span[class*=cache_status]').length == 0){
|
150
|
-
obj.html(obj.html() + "<span class='cache_status'>error</status>").after($("<a class='retry_error'>retry</a>"))
|
151
|
-
}else{
|
152
|
-
obj.after($("<a class='retry_error'>retry</a>")).find('span[class*=cache_status]').first().html("error")
|
153
|
-
}
|
154
|
-
rbbt_action_setup();
|
155
|
-
},
|
156
|
-
success: function( data, stat, req ) {
|
157
|
-
if (req.status == 202){
|
158
|
-
obj.addClass("reloading");
|
159
|
-
|
160
|
-
if (obj.find('span[class*=cache_status]').length == 0){
|
161
|
-
obj.html(obj.html() + data)
|
162
|
-
}else{
|
163
|
-
obj.find('span[class*=cache_status]').first().replaceWith($(data))
|
164
|
-
}
|
165
|
-
|
166
|
-
if (update == 'check'){
|
167
|
-
obj.removeClass("reloading");
|
168
|
-
obj.addClass("check");
|
169
|
-
if (obj.find('span[class*=cache_status]').length == 0){
|
170
|
-
obj.after($("<a class='start_checked'>start</a>"));
|
171
|
-
}else{
|
172
|
-
obj.after($("<a class='start_checked'>start</a>"));
|
173
|
-
}
|
174
|
-
rbbt_action_setup();
|
175
|
-
}else{
|
176
|
-
window.setTimeout(function(){replace_object(obj)}, 7000)
|
177
|
-
}
|
178
|
-
}else{
|
179
|
-
var html = '<div class="embedded" target="' + req.getResponseHeader("AJAX-URL") + '">' + data + '</div>';
|
180
|
-
var embedded = $(html);
|
181
|
-
embedded.addClass(obj.attr('class'));
|
182
|
-
embedded.removeClass('replace');
|
183
|
-
embedded.removeClass('rbbt_action_setup');
|
184
|
-
embedded.removeClass("reloading");
|
185
|
-
obj.replaceWith(embedded);
|
186
|
-
rbbt_action_setup();
|
187
|
-
}
|
188
|
-
|
189
|
-
},
|
190
|
-
});
|
191
|
-
}
|
192
|
-
|
193
|
-
function expand_embedded(embedded){
|
194
|
-
var header = embedded.find('header').first();
|
195
|
-
embedded.html(embedded.attr('attr-save'));
|
196
|
-
embedded.attr('attr-save',null);
|
197
|
-
embedded.removeClass('contracted_embedded');
|
198
|
-
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
199
|
-
rbbt_action_setup();
|
200
|
-
}
|
201
|
-
|
202
|
-
function contract_embedded(embedded){
|
203
|
-
var header = embedded.find('header').first();
|
204
|
-
embedded.attr('attr-save', embedded.html());
|
205
|
-
embedded.html(header.html());
|
206
|
-
embedded.addClass('contracted_embedded');
|
207
|
-
embedded.removeClass('rbbt_action_setup').find('.rbbt_action_setup').removeClass('rbbt_action_setup');
|
208
|
-
rbbt_action_setup();
|
209
|
-
}
|
210
|
-
|
211
|
-
//-- LIST MANAGEMENT
|
212
|
-
|
213
|
-
var entity_lists = {}
|
214
|
-
|
215
|
-
function saved_lists(){
|
216
|
-
return JSON.parse($.cookie('saved_lists'))
|
217
|
-
}
|
218
|
-
|
219
|
-
function remove_list(type, list){
|
220
|
-
var lists = saved_lists();
|
221
|
-
if (lists == null) { lists = {}; };
|
222
|
-
if (lists[type] == null) { lists[type] = [] };
|
223
|
-
|
224
|
-
var elems = lists[type]
|
225
|
-
if (elems != null){
|
226
|
-
var index = elems.indexOf(list);
|
227
|
-
|
228
|
-
if (index != -1){ elems.splice(index, 1);}
|
229
|
-
|
230
|
-
if (elems.length > 0){
|
231
|
-
lists[type] = elems;
|
232
|
-
}else{
|
233
|
-
delete lists[type]
|
234
|
-
}
|
235
|
-
|
236
|
-
delete entity_lists[type][list]
|
237
|
-
if (entity_lists[type].length == 0){
|
238
|
-
delete entity_lists[type]
|
239
|
-
}
|
240
|
-
}
|
241
|
-
|
242
|
-
$.cookie('saved_lists', JSON.stringify(lists), {path: "/"})
|
243
|
-
|
244
|
-
update_list_viewer()
|
245
|
-
}
|
246
|
-
|
247
|
-
function load_list(type, list){
|
248
|
-
var lists = saved_lists();
|
249
|
-
if (lists == null) { lists = {}; };
|
250
|
-
if (lists[type] == null) { lists[type] = [] };
|
251
|
-
lists[type].push(list);
|
252
|
-
$.cookie('saved_lists', JSON.stringify(lists), {path: "/"})
|
253
|
-
add_entity_list(type, list);
|
254
|
-
}
|
255
|
-
|
256
|
-
function record_list(type, list_id, list){
|
257
|
-
if (entity_lists[type] == null){
|
258
|
-
entity_lists[type] = {}
|
259
|
-
}
|
260
|
-
entity_lists[type][list_id] = list;
|
261
|
-
}
|
262
|
-
|
263
|
-
function update_list_viewer(){
|
264
|
-
var list_html = ""
|
265
|
-
list_html += "<a href='/entity_list/user'>your lists</a>\n"
|
266
|
-
list_html += "<a href='/entity_list/public'>public lists</a>\n"
|
267
|
-
list_html += "<a class='clear_selected' href='#clear_selected'>clear selected</a>\n"
|
268
|
-
list_html += "<h5 class='loaded_lists'>Loaded lists</h5>\n"
|
269
|
-
list_html += "<dl class='entity_list_types'>\n"
|
270
|
-
$.each(entity_lists, function(type, lists){
|
271
|
-
list_html += "<dt>" + type + "</dt>\n"
|
272
|
-
list_html += "<dd>\n"
|
273
|
-
list_html += "<ul class='entity_list'>"
|
274
|
-
$.each(lists, function(name, elems){
|
275
|
-
list_html += "<li>"
|
276
|
-
|
277
|
-
list_html += "<a href='#select_list' class='select_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
278
|
-
list_html += 'select'
|
279
|
-
list_html += "</a>" + "\n"
|
280
|
-
|
281
|
-
list_html += "<a href='#remove_list' class='remove_list' attr-list-type='" + type + "' attr-list='" + name + "'>"
|
282
|
-
list_html += "remove"
|
283
|
-
list_html += "</a>" + "\n"
|
284
|
-
|
285
|
-
list_html += "<a href='/entity_list/" + type + "/" + name + "' class='view_list' attr-list-type='" + type + "'>"
|
286
|
-
list_html += name
|
287
|
-
list_html += "</a>" + "\n"
|
288
|
-
|
289
|
-
list_html += "</li>"
|
290
|
-
})
|
291
|
-
list_html += "</ul>"
|
292
|
-
list_html += "</dd>\n"
|
293
|
-
})
|
294
|
-
$('#lists').html(list_html);
|
295
|
-
rbbt_action_setup();
|
296
|
-
}
|
297
|
-
|
298
|
-
function update_list_selectors(){
|
299
|
-
$.each(entity_lists, function(type, lists){
|
300
|
-
$('select.loaded_lists[type=' + type + ']').each(function(){
|
301
|
-
var select = $(this);
|
302
|
-
select.find('option').remove();
|
303
|
-
$.each(lists, function(name, elems){
|
304
|
-
var option = $('<option value="' + name + '">' + name + '</option>')
|
305
|
-
select.append(option);
|
306
|
-
return true
|
307
|
-
})
|
308
|
-
})
|
309
|
-
});
|
310
|
-
}
|
311
|
-
|
312
|
-
function add_entity_list(type, list_id){
|
313
|
-
$.getJSON(
|
314
|
-
"/entity_list/" + type + "/" + list_id + '?_format=json',
|
315
|
-
function(data){
|
316
|
-
record_list(type, list_id, data);
|
317
|
-
update_list_viewer();
|
318
|
-
update_list_selectors();
|
319
|
-
})
|
320
|
-
}
|
321
|
-
|
322
|
-
function id_for_entity(entity_format, entity){
|
323
|
-
return((entity_format.toLowerCase().replace(/[^\w]/g, "_") + "=" + entity));
|
324
|
-
}
|
325
|
-
|
326
|
-
function select_list(type, list_id){
|
327
|
-
var list = entity_lists[type][list_id];
|
328
|
-
var entity;
|
329
|
-
|
330
|
-
$.each(list, function(id, data){
|
331
|
-
var id = data[0];
|
332
|
-
var info = data[1];
|
333
|
-
var format = info["format"];
|
334
|
-
var entity_id = id_for_entity(format, id);
|
335
|
-
$('.entity[' + entity_id + ']').addClass("selected_entity");
|
336
|
-
})
|
337
|
-
}
|
338
|
-
|
339
|
-
//-- SETUP FUNCTIOS
|
340
|
-
|
341
|
-
function rbbt_table_setup(){
|
342
|
-
//$('table.sorted, table.results_tsv_table').not('[class*=table_sorted]').tablesorter({textExtraction:"complex", widgets: ['zebra']}).addClass('table_sorted');
|
343
|
-
$('table form.table_controls').not('[class*=rbbt_table_setup]').each(function(){
|
344
|
-
var form = $(this);
|
345
|
-
var embedded_div = $(this).parents("div.embedded").first()
|
346
|
-
if (embedded_div.html() != null){
|
347
|
-
var href = embedded_div.attr('target')
|
348
|
-
form.find(".change_page").click(function(){
|
349
|
-
var pfield = form.find(".pfield").first().val();
|
350
|
-
var pnum = form.find(".pnum").first().val();
|
351
|
-
var psize = form.find(".psize").first().val();
|
352
|
-
var change = $(this).val();
|
353
|
-
$.ajax({
|
354
|
-
cache: false,
|
355
|
-
url: add_parameters(href, "_pfield=" + pfield + "&_pnum=" + pnum + "&_psize=" + psize + "&_paginate=" + change),
|
356
|
-
success: function(data){
|
357
|
-
embedded_div.html(data);
|
358
|
-
rbbt_action_setup();
|
359
|
-
}
|
360
|
-
})
|
361
|
-
return false;
|
362
|
-
})
|
363
|
-
}
|
364
|
-
}).addClass('rbbt_table_setup');
|
365
|
-
}
|
366
|
-
|
367
|
-
function rbbt_action_setup(){
|
368
|
-
rbbt_table_setup();
|
369
|
-
|
370
|
-
$('.toggle').not('[class*=rbbt_action_setup]').each(function(){
|
371
|
-
var toggle = $(this);
|
372
|
-
var content = toggle.html();
|
373
|
-
var title_text = toggle.attr('title');
|
374
|
-
|
375
|
-
var title = "<dt>" + title_text + "</dt>";
|
376
|
-
var description = "<dd>" + content + "</dd>";
|
377
|
-
var dl = "<dl>" + title + description + "</dl>";
|
378
|
-
|
379
|
-
toggle.html(dl);
|
380
|
-
}).addClass('rbbt_action_setup').find('> dl').each(function(){ $(this).find('>dd').hide()}).find('>dt').click(function(){
|
381
|
-
var dl = $(this).parent('dl');
|
382
|
-
dl.find('>dd').toggle();
|
383
|
-
});
|
384
|
-
|
385
|
-
$('a.replace').not('[class*=rbbt_action_setup]').each(function(){
|
386
|
-
replace_object($(this));
|
387
|
-
}).addClass('rbbt_action_setup');
|
388
|
-
|
389
|
-
$('a.check_replace').not('[class*=rbbt_action_setup]').each(function(){
|
390
|
-
replace_object($(this), 'check');
|
391
|
-
}).addClass('rbbt_action_setup');
|
392
|
-
|
393
|
-
|
394
|
-
$('a.entity').not('[class*=rbbt_action_setup]').click(function(){
|
395
|
-
var link = $(this);
|
396
|
-
var href = link.attr('href')
|
397
|
-
|
398
|
-
if ($('#details').hasClass("expanded")){
|
399
|
-
size = "normal";
|
400
|
-
}else{
|
401
|
-
size = "small";
|
402
|
-
}
|
403
|
-
|
404
|
-
show_details();
|
405
|
-
$('#details').html("<span class='details_loading'>Loading " + href + "</span>").addClass("loading").removeClass("error");
|
406
|
-
|
407
|
-
$.ajax(add_parameters(href, '_size=' + size + '&_cache_type=memory'), {
|
408
|
-
cache: false,
|
409
|
-
success: function(data){
|
410
|
-
var old_url = $('#details').attr('url');
|
411
|
-
if (old_url != null && old_url != undefined ){
|
412
|
-
details_history.push(old_url);
|
413
|
-
}
|
414
|
-
$('#details').html(data).attr('url', href).removeClass("loading").removeClass("error");
|
415
|
-
show_details();
|
416
|
-
rbbt_action_setup();
|
417
|
-
},
|
418
|
-
error: function(){
|
419
|
-
show_details();
|
420
|
-
$('#details').html("<span class='details_error'>Error loading " + href + "</span>").removeClass("loading").addClass("error");
|
421
|
-
}
|
422
|
-
})
|
423
|
-
|
424
|
-
return false;
|
425
|
-
}).addClass('rbbt_action_setup');
|
426
|
-
|
427
|
-
$('.DELETE,.POST').not('[class*=rbbt_action_setup]').click(function() {
|
428
|
-
//if(confirm('Are you sure?')) {
|
429
|
-
if(true) {
|
430
|
-
var link = $(this);
|
431
|
-
var target_id = link.attr('rel')
|
432
|
-
var href = link.attr('href');
|
433
|
-
|
434
|
-
$.ajax({cache: false, url:href, data:{ _method: $(this).getClassInList(['POST', 'DELETE'])}, type:"post", asyn:false, success: function(){if (target_id != null){ link.remove(); $("#" + target_id).remove();}}})
|
435
|
-
}
|
436
|
-
return false;
|
437
|
-
}).addClass('rbbt_action_setup');
|
438
|
-
|
439
|
-
$('div.embedded form').not('[class*=rbbt_action_setup]').submit(function(){
|
440
|
-
var form = $(this);
|
441
|
-
var embedded = form.parents('div.embedded').first();
|
442
|
-
|
443
|
-
var params = "";
|
444
|
-
|
445
|
-
form.find('input').not('[type=submit]').each(function(){
|
446
|
-
var input = $(this)
|
447
|
-
if (params.length > 0){ params += '&'}
|
448
|
-
params += input.attr('name') + "=" + input.val();
|
449
|
-
})
|
450
|
-
|
451
|
-
form.find('select').not('[type=submit]').each(function(){
|
452
|
-
var select = $(this)
|
453
|
-
var option = select.find('option:selected');
|
454
|
-
if (params.length > 0){ params += '&'}
|
455
|
-
params += select.attr('name') + "=" + option.val();
|
456
|
-
})
|
457
|
-
|
458
|
-
|
459
|
-
params = params
|
460
|
-
|
461
|
-
var url = embedded.attr('target');
|
462
|
-
url = url.replace(/\?.*/, '?' + params)
|
463
|
-
|
464
|
-
embedded.attr('target', url)
|
465
|
-
|
466
|
-
replace_object(embedded);
|
467
|
-
|
468
|
-
return false;
|
469
|
-
}).addClass('rbbt_action_setup');
|
470
|
-
|
471
|
-
$('.embedded > header').not('[class*=rbbt_action_setup]').each(function(){
|
472
|
-
var header = $(this);
|
473
|
-
var embedded = header.parent('.embedded');
|
474
|
-
var href = embedded.attr('target');
|
475
|
-
|
476
|
-
if (header.find('ul.embedded_control').length == 0){
|
477
|
-
var html = header.html();
|
478
|
-
html = html + '<ul class="embedded_control"><li><a class="toggle_embedded">toggle</a></li><li><a class="reload_embedded">reload</a></li><li><a class="link_embedded" href="'+ href + '">link</a></li></ul>'
|
479
|
-
header.html(html);
|
480
|
-
}
|
481
|
-
|
482
|
-
header.addClass('rbbt_action_setup')
|
483
|
-
|
484
|
-
rbbt_action_setup();
|
485
|
-
}).addClass('rbbt_action_setup');
|
486
|
-
|
487
|
-
$('a.reload_embedded').not('[class*=rbbt_action_setup]').click(function(){
|
488
|
-
var link = $(this);
|
489
|
-
var embedded = link.parents('.embedded').first();
|
490
|
-
if (embedded.hasClass('contracted_embedded')){
|
491
|
-
expand_embedded(embedded)
|
492
|
-
}
|
493
|
-
replace_object(embedded, 'reload');
|
494
|
-
return false;
|
495
|
-
}).addClass('rbbt_action_setup');
|
496
|
-
|
497
|
-
$('a.toggle_embedded').not('[class*=rbbt_action_setup]').click(function(){
|
498
|
-
var link = $(this);
|
499
|
-
var embedded = link.parents('.embedded').first();
|
500
|
-
var header = embedded.find('header').first();
|
501
|
-
|
502
|
-
if (embedded.attr('attr-save') == null){
|
503
|
-
contract_embedded(embedded)
|
504
|
-
}else{
|
505
|
-
expand_embedded(embedded)
|
506
|
-
}
|
507
|
-
return false;
|
508
|
-
}).addClass('rbbt_action_setup');
|
509
|
-
|
510
|
-
$('a.retry_error').not('[class*=rbbt_action_setup]').click(function(e){
|
511
|
-
var retry_link = $(this);
|
512
|
-
var link = retry_link.prev('a');
|
513
|
-
if (link.length == 0){ link = retry_link.prev('.embedded')};
|
514
|
-
replace_object(link, 'reload');
|
515
|
-
retry_link.remove();
|
516
|
-
return false;
|
517
|
-
}).addClass('rbbt_action_setup');
|
518
|
-
|
519
|
-
|
520
|
-
$('a.start_checked').not('[class*=rbbt_action_setup]').click(function(e){
|
521
|
-
var retry_link = $(this);
|
522
|
-
var link = retry_link.prev('a');
|
523
|
-
replace_object(link);
|
524
|
-
retry_link.remove();
|
525
|
-
return false;
|
526
|
-
}).addClass('rbbt_action_setup');
|
527
|
-
|
528
|
-
$('a.select_list').not('[class*=rbbt_action_setup]').click(function(){
|
529
|
-
var link = $(this);
|
530
|
-
var list_id = link.attr('attr-list')
|
531
|
-
var type = link.attr('attr-list-type')
|
532
|
-
|
533
|
-
select_list(type, list_id)
|
534
|
-
return false;
|
535
|
-
}).addClass('rbbt_action_setup');
|
536
|
-
|
537
|
-
$('a.remove_list').not('[class*=rbbt_action_setup]').click(function(){
|
538
|
-
var link = $(this);
|
539
|
-
var list_id = link.attr('attr-list');
|
540
|
-
var type = link.attr('attr-list-type')
|
541
|
-
|
542
|
-
remove_list(type, list_id);
|
543
|
-
|
544
|
-
return false;
|
545
|
-
}).addClass('rbbt_action_setup');
|
546
|
-
|
547
|
-
|
548
|
-
$('a.load_entity_list').not('[class*=rbbt_action_setup]').click(function(){
|
549
|
-
var link = $(this);
|
550
|
-
var list_id = link.attr('attr-list');
|
551
|
-
var type = link.attr('attr-list-type');
|
552
|
-
|
553
|
-
load_list(type, list_id);
|
554
|
-
return false;
|
555
|
-
}).addClass('rbbt_action_setup');
|
556
|
-
|
557
|
-
$('a.open_edit_controls').not('[class*=rbbt_action_setup]').click(function(){
|
558
|
-
var link = $(this);
|
559
|
-
|
560
|
-
var edit_controls = link.next('.edit_controls')
|
561
|
-
edit_controls.toggle();
|
562
|
-
|
563
|
-
return false;
|
564
|
-
}).addClass('rbbt_action_setup');
|
565
|
-
|
566
|
-
$('a.clear_selected').not('[class*=rbbt_action_setup]').click(function(){
|
567
|
-
$('a.selected_entity').removeClass('selected_entity')
|
568
|
-
}).addClass('rbbt_action_setup');
|
569
|
-
|
570
|
-
update_list_selectors();
|
571
|
-
}
|
572
2
|
|