1 | |
---|
2 | /** |
---|
3 | * @fileOverview This is based on mdservice/mdservice_ui.js, but removed all unused code. |
---|
4 | * This is the main file, contains main app function (jquery-initialization). |
---|
5 | * The app main function runs setup functionality, which covers this domains: |
---|
6 | * <dl> |
---|
7 | * <dt>the variable initialization<dt> |
---|
8 | * <dd>functions from mdservice_searchclause.js, mdservice_widget.js, mdservice_ui_helpers.js</dd> |
---|
9 | * <dt>loadData()</dt> |
---|
10 | * <dd>loading data from repository and creating particular client-side representations - functions from <a>mdservice_ui_load.js</a></dd> |
---|
11 | * <dt>creating of ui-layout</dt> |
---|
12 | * <dd>i.e. split UI to individual panes - functions from mdservice_ui_layout.js</dd> |
---|
13 | * <dt>addFunctionality()</dt> |
---|
14 | * <dd>bind handlers to events of ui-elements (function directly in mdservice_ui.js)</dd> |
---|
15 | * </dl> |
---|
16 | * @author |
---|
17 | * @version |
---|
18 | */ |
---|
19 | |
---|
20 | |
---|
21 | var index_container_selector = "#index-container"; |
---|
22 | var graph_container_selector = '#infovis'; |
---|
23 | var navi_container_selector = '#navigate'; |
---|
24 | var detail_container_selector = "#detail-container"; |
---|
25 | var detail_info_holder_selector = '#detail-info-holder'; |
---|
26 | |
---|
27 | var graph_container = null; |
---|
28 | var index_container = null; |
---|
29 | |
---|
30 | |
---|
31 | $(function(){ |
---|
32 | // turn on debugging (see jquery.xslTransform.js) |
---|
33 | var DEBUG = false; |
---|
34 | |
---|
35 | // check for jQuery |
---|
36 | try{ |
---|
37 | jQuery; |
---|
38 | }catch(e){ |
---|
39 | alert('You need to include jQuery!'); |
---|
40 | } |
---|
41 | |
---|
42 | graph_container = $(graph_container_selector); |
---|
43 | |
---|
44 | /////// INIT VARIABLE SETTINGS |
---|
45 | url_params = getUrlVars(); |
---|
46 | // workspace = new Workspace(); |
---|
47 | |
---|
48 | // create widgets |
---|
49 | /* columns_widget = new ListWidget($('#columns-widget'), "columns"); |
---|
50 | collections_widget = new ListWidget($('#collections-widget'), "collections"); |
---|
51 | listwidgetset.add(columns_widget); |
---|
52 | listwidgetset.add(collections_widget); |
---|
53 | */ |
---|
54 | //////////// LOAD DATA |
---|
55 | // loadData(); |
---|
56 | |
---|
57 | |
---|
58 | // loading userdocs as welcome info |
---|
59 | $(graph_container).load(userdocs_file + " div.document"); |
---|
60 | |
---|
61 | loadDetailInfo (); |
---|
62 | |
---|
63 | initGraph(); |
---|
64 | |
---|
65 | |
---|
66 | addFunctionality(); |
---|
67 | |
---|
68 | ////////////// CREATE UI-LAYOUT |
---|
69 | createBlock('base',''); |
---|
70 | createLayouts('base'); |
---|
71 | |
---|
72 | |
---|
73 | |
---|
74 | }); |
---|
75 | |
---|
76 | |
---|
77 | /** |
---|
78 | * This function is called during the initialization sequence and binds event-handlers to events of ui-elements. |
---|
79 | * @function |
---|
80 | */ |
---|
81 | function addFunctionality(){ |
---|
82 | |
---|
83 | $("#input-filter-index").live('change', function(event) { |
---|
84 | filterIndex ($(this).val()); |
---|
85 | }); |
---|
86 | |
---|
87 | /*fillOpts(navi_container_selector); |
---|
88 | $("#navigate .slider").slider(); |
---|
89 | */ |
---|
90 | $("#navigate").QueryInput({params: opts, |
---|
91 | onValueChanged: renderGraph |
---|
92 | }); |
---|
93 | |
---|
94 | /* $('#infovis-wrapper').resizable( { |
---|
95 | start: function(event, ui) { |
---|
96 | graph_container.hide(); |
---|
97 | }, |
---|
98 | stop: function(event, ui) { |
---|
99 | graph_container.show(); |
---|
100 | renderGraph(); |
---|
101 | } |
---|
102 | } |
---|
103 | );*/ |
---|
104 | |
---|
105 | /*$('#input-link').live("mousedown", function(event) { |
---|
106 | console.log(this); |
---|
107 | $(this).attr("target", "_blank"); |
---|
108 | $(this).attr("href", generateLink()); |
---|
109 | }); |
---|
110 | */ |
---|
111 | $('#input-download').live("mousedown", genDownload); |
---|
112 | |
---|
113 | $(".detail-caller").live("click", function(event) { |
---|
114 | //console.log(this); |
---|
115 | event.preventDefault(); |
---|
116 | $(this).parent().find('.detail').toggle(); |
---|
117 | }); |
---|
118 | |
---|
119 | $(".node-item .detail a").live("click", function(event) { |
---|
120 | event.preventDefault(); |
---|
121 | key = $(this).attr("data-key"); |
---|
122 | console.log(key); |
---|
123 | selectNodeByKey([key]); |
---|
124 | |
---|
125 | }); |
---|
126 | |
---|
127 | |
---|
128 | $("a.scan").live("click", function(event) { |
---|
129 | console.log(this); |
---|
130 | event.preventDefault(); |
---|
131 | url = $(this).attr("href"); |
---|
132 | $(this).parent().find('.node-detail').html("loading"); |
---|
133 | $(this).parent().find('.node-detail').load(url + " div.content"); |
---|
134 | }); |
---|
135 | |
---|
136 | |
---|
137 | } |
---|