Almirah 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,324 +1,306 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fileutils'
2
- require_relative "doc_fabric"
3
- require_relative "navigation_pane"
4
- require_relative "doc_types/traceability"
5
- require_relative "doc_types/coverage"
6
- require_relative "doc_types/index"
7
- require_relative "search/specifications_db"
8
-
9
- class Project
10
-
11
- attr_accessor :specifications
12
- attr_accessor :protocols
13
- attr_accessor :traceability_matrices
14
- attr_accessor :coverage_matrices
15
- attr_accessor :specifications_dictionary
16
- attr_accessor :index
17
- attr_accessor :project
18
- attr_accessor :configuration
19
-
20
- def initialize(configuration)
21
- @configuration = configuration
22
- @specifications = Array.new
23
- @protocols = Array.new
24
- @traceability_matrices = Array.new
25
- @coverage_matrices = Array.new
26
- @specifications_dictionary = Hash.new
27
- @index = nil
28
- @project = self
29
- FileUtils.remove_dir(@configuration.project_root_directory + "/build", true)
30
- copy_resources
4
+ require_relative 'doc_fabric'
5
+ require_relative 'navigation_pane'
6
+ require_relative 'doc_types/traceability'
7
+ require_relative 'doc_types/index'
8
+ require_relative 'search/specifications_db'
9
+
10
+ class Project # rubocop:disable Metrics/ClassLength,Style/Documentation
11
+ attr_accessor :specifications, :protocols, :traceability_matrices, :coverage_matrices, :specifications_dictionary,
12
+ :index, :project, :configuration
13
+
14
+ def initialize(configuration)
15
+ @configuration = configuration
16
+ @specifications = []
17
+ @protocols = []
18
+ @traceability_matrices = []
19
+ @coverage_matrices = []
20
+ @specifications_dictionary = {}
21
+ @covered_specifications_dictionary = {}
22
+ @index = nil
23
+ @project = self
24
+ FileUtils.remove_dir("#{@configuration.project_root_directory}/build", true)
25
+ copy_resources
26
+ end
27
+
28
+ def copy_resources
29
+ # scripts
30
+ gem_root = File.expand_path './../..', File.dirname(__FILE__)
31
+ src_folder = "#{gem_root}/lib/almirah/templates/scripts"
32
+ dst_folder = "#{@configuration.project_root_directory}/build/scripts"
33
+ FileUtils.mkdir_p(dst_folder)
34
+ FileUtils.copy_entry(src_folder, dst_folder)
35
+ # css
36
+ src_folder = "#{gem_root}/lib/almirah/templates/css"
37
+ dst_folder = "#{@configuration.project_root_directory}/build/css"
38
+ FileUtils.mkdir_p(dst_folder)
39
+ FileUtils.copy_entry(src_folder, dst_folder)
40
+ end
41
+
42
+ def specifications_and_protocols # rubocop:disable Metrics/MethodLength
43
+ parse_all_specifications
44
+ parse_all_protocols
45
+ link_all_specifications
46
+ link_all_protocols
47
+ check_wrong_specification_referenced
48
+ create_index
49
+ render_all_specifications(@specifications)
50
+ render_all_specifications(@traceability_matrices)
51
+ render_all_specifications(@coverage_matrices)
52
+ render_all_protocols
53
+ render_index
54
+ create_search_data
55
+ end
56
+
57
+ def specifications_and_results(test_run) # rubocop:disable Metrics/MethodLength
58
+ parse_all_specifications
59
+ parse_test_run test_run
60
+ link_all_specifications
61
+ link_all_protocols
62
+ check_wrong_specification_referenced
63
+ create_index
64
+ render_all_specifications(@specifications)
65
+ render_all_specifications(@traceability_matrices)
66
+ render_all_specifications(@coverage_matrices)
67
+ render_all_protocols
68
+ render_index
69
+ create_search_data
70
+ end
71
+
72
+ def transform(file_extension)
73
+ transform_all_specifications file_extension
74
+ end
75
+
76
+ def transform_all_specifications(_file_extension)
77
+ path = @configuration.project_root_directory
78
+
79
+ # find all specifications
80
+ Dir.glob("#{path}/specifications/**/*.md").each do |f|
81
+ puts f
82
+ # make a copy with another extention to preserve the content
83
+ f_directory = File.dirname(f)
84
+ f_name = File.basename(f, File.extname(f)).downcase + '._md'
85
+ FileUtils.copy_file(f, "#{f_directory}/#{f_name}")
86
+ # transform the original one
87
+ # but do nothing for now - TODO
31
88
  end
89
+ end
32
90
 
33
- def copy_resources
34
- # scripts
35
- gem_root = File.expand_path './../..', File.dirname(__FILE__)
36
- src_folder = gem_root + "/lib/almirah/templates/scripts"
37
- dst_folder = @configuration.project_root_directory + "/build/scripts"
38
- FileUtils.mkdir_p(dst_folder)
39
- FileUtils.copy_entry( src_folder, dst_folder )
40
- # css
41
- src_folder = gem_root + "/lib/almirah/templates/css"
42
- dst_folder = @configuration.project_root_directory + "/build/css"
43
- FileUtils.mkdir_p(dst_folder)
44
- FileUtils.copy_entry( src_folder, dst_folder )
91
+ def parse_all_specifications
92
+ path = @configuration.project_root_directory
93
+ # do a lasy pass first to get the list of documents id
94
+ Dir.glob("#{path}/specifications/**/*.md").each do |f|
95
+ DocFabric.add_lazy_doc_id(f)
45
96
  end
46
-
47
- def specifications_and_protocols
48
-
49
- parse_all_specifications
50
- parse_all_protocols
51
- link_all_specifications
52
- link_all_protocols
53
- check_wrong_specification_referenced
54
- create_index
55
- render_all_specifications(@specifications)
56
- render_all_specifications(@traceability_matrices)
57
- render_all_specifications(@coverage_matrices)
58
- render_all_protocols
59
- render_index
60
- create_search_data
97
+ # parse documents in the second pass
98
+ Dir.glob("#{path}/specifications/**/*.md").each do |f| # rubocop:disable Style/CombinableLoops
99
+ doc = DocFabric.create_specification(f)
100
+ @specifications.append(doc)
101
+ @specifications_dictionary[doc.id.to_s.downcase] = doc
61
102
  end
103
+ end
62
104
 
63
- def specifications_and_results( test_run )
64
-
65
- parse_all_specifications
66
- parse_test_run test_run
67
- link_all_specifications
68
- link_all_protocols
69
- check_wrong_specification_referenced
70
- create_index
71
- render_all_specifications(@specifications)
72
- render_all_specifications(@traceability_matrices)
73
- render_all_specifications(@coverage_matrices)
74
- render_all_protocols
75
- render_index
76
- create_search_data
105
+ def parse_all_protocols
106
+ path = @configuration.project_root_directory
107
+ Dir.glob("#{path}/tests/protocols/**/*.md").each do |f|
108
+ doc = DocFabric.create_protocol(f)
109
+ @protocols.append(doc)
77
110
  end
111
+ end
78
112
 
79
- def transform( file_extension )
80
- transform_all_specifications file_extension
113
+ def parse_test_run(test_run)
114
+ path = @configuration.project_root_directory
115
+ Dir.glob("#{path}/tests/runs/#{test_run}/**/*.md").each do |f|
116
+ doc = DocFabric.create_protocol(f)
117
+ @protocols.append(doc)
81
118
  end
119
+ end
82
120
 
83
- def transform_all_specifications( file_extension )
84
-
85
- path = @configuration.project_root_directory
86
-
87
- # find all specifications
88
- Dir.glob( "#{path}/specifications/**/*.md" ).each do |f|
89
- puts f
90
- # make a copy with another extention to preserve the content
91
- f_directory = File.dirname(f)
92
- f_name = File.basename(f, File.extname(f)).downcase + "._md"
93
- FileUtils.copy_file( f, "#{f_directory}/#{f_name}")
94
- # transform the original one
95
- # but do nothing for now - TODO
96
- end
121
+ def link_all_specifications # rubocop:disable Metrics/MethodLength
122
+ comb_list = @specifications.combination(2)
123
+ comb_list.each do |c|
124
+ link_two_specifications(c[0], c[1])
125
+ # puts "Link: #{c[0].id} - #{c[1].id}"
97
126
  end
98
-
99
- def parse_all_specifications
100
- path = @configuration.project_root_directory
101
- # do a lasy pass first to get the list of documents id
102
- Dir.glob( "#{path}/specifications/**/*.md" ).each do |f|
103
- DocFabric.add_lazy_doc_id(f)
104
- end
105
- # parse documents in the second pass
106
- Dir.glob( "#{path}/specifications/**/*.md" ).each do |f|
107
- doc = DocFabric.create_specification(f)
108
- @specifications.append(doc)
109
- @specifications_dictionary[doc.id.to_s.downcase] = doc
110
- end
127
+ # separatelly create design inputs treceability
128
+ @configuration.get_design_inputs.each do |i|
129
+ next unless @specifications_dictionary.key? i.to_s.downcase
130
+
131
+ document = @specifications_dictionary[i.to_s.downcase]
132
+ if document
133
+ doc = DocFabric.create_traceability_document(document, nil)
134
+ @traceability_matrices.append doc
135
+ end
111
136
  end
112
-
113
- def parse_all_protocols
114
- path = @configuration.project_root_directory
115
- Dir.glob( "#{path}/tests/protocols/**/*.md" ).each do |f|
116
- puts "Prot: " + f
117
- doc = DocFabric.create_protocol(f)
118
- @protocols.append(doc)
137
+ end
138
+
139
+ def link_all_protocols # rubocop:disable Metrics/MethodLength
140
+ @protocols.each do |p|
141
+ @specifications.each do |s|
142
+ if p.up_link_docs.key?(s.id.to_s)
143
+ link_protocol_to_spec(p, s)
144
+ @covered_specifications_dictionary[s.id.to_s] = s
119
145
  end
146
+ end
120
147
  end
121
-
122
- def parse_test_run( test_run )
123
- path = @configuration.project_root_directory
124
- Dir.glob( "#{path}/tests/runs/#{test_run}/**/*.md" ).each do |f|
125
- puts "Run: " + f
126
- doc = DocFabric.create_protocol(f)
127
- @protocols.append(doc)
128
- end
148
+ # create coverage documents
149
+ @covered_specifications_dictionary.each do |_key, value|
150
+ doc = DocFabric.create_coverage_matrix(value)
151
+ @coverage_matrices.append doc
129
152
  end
153
+ end
130
154
 
131
- def link_all_specifications
132
- combList = @specifications.combination(2)
133
- combList.each do |c|
134
- link_two_specifications(c[0], c[1])
135
- # puts "Link: #{c[0].id} - #{c[1].id}"
136
- end
137
- # separatelly create design inputs treceability
138
- @configuration.get_design_inputs.each do |i|
139
- if @specifications_dictionary.has_key? i.to_s.downcase
140
- document = @specifications_dictionary[i.to_s.downcase]
141
- if document
142
- trx = Traceability.new document, nil, true
143
- @traceability_matrices.append trx
144
- end
145
- end
146
- end
147
- end
155
+ def check_wrong_specification_referenced # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
156
+ available_specification_ids = {}
148
157
 
149
- def link_all_protocols
150
- @protocols.each do |p|
151
- @specifications.each do |s|
152
- if p.up_link_docs.has_key?(s.id.to_s)
153
- link_protocol_to_spec(p,s)
154
- end
155
- end
156
- end
158
+ @specifications.each do |s|
159
+ available_specification_ids[s.id.to_s.downcase] = s
157
160
  end
158
161
 
159
- def check_wrong_specification_referenced
162
+ @specifications.each do |s| # rubocop:disable Style/CombinableLoops
163
+ s.up_link_docs.each do |key, _value|
164
+ next if available_specification_ids.key?(key)
160
165
 
161
- available_specification_ids = Hash.new
166
+ # now key points to the doc_id that does not exist
167
+ wrong_doc_id = key
168
+ # find the item that reference to it
169
+ s.controlled_items.each do |item|
170
+ next if item.up_link_ids.nil?
162
171
 
163
- @specifications.each do |s|
164
- available_specification_ids[ s.id.to_s.downcase ] = s
165
- end
172
+ item.up_link_ids.each do |up_link_id|
173
+ next unless tmp = /^([a-zA-Z]+)-\d+/.match(up_link_id) # SRS
166
174
 
167
- @specifications.each do |s|
168
- s.up_link_docs.each do |key, value|
169
- unless available_specification_ids.has_key?(key)
170
- # now key points to the doc_id that does not exist
171
- wrong_doc_id = key
172
- # find the item that reference to it
173
- s.controlled_items.each do |item|
174
- unless item.up_link_ids.nil?
175
- item.up_link_ids.each do |up_link_id|
176
- if tmp = /^([a-zA-Z]+)[-]\d+/.match(up_link_id) # SRS
177
- if tmp[1].downcase == wrong_doc_id
178
- # we got it finally!
179
- s.wrong_links_hash[ up_link_id.to_s ] = item
180
- end
181
- end
182
- end
183
- end
184
- end
185
- end
175
+ if tmp[1].downcase == wrong_doc_id
176
+ # we got it finally!
177
+ s.wrong_links_hash[up_link_id.to_s] = item
186
178
  end
179
+ end
187
180
  end
181
+ end
188
182
  end
189
-
190
- def link_two_specifications(doc_A, doc_B)
191
-
192
- if doc_B.up_link_docs.has_key?(doc_A.id.to_s)
193
- top_document = doc_A
194
- bottom_document = doc_B
195
- elsif doc_A.up_link_docs.has_key?(doc_B.id.to_s)
196
- top_document = doc_B
197
- bottom_document = doc_A
198
- else
199
- return # no links
200
- end
201
- #puts "Link: #{doc_A.id} - #{doc_B.id}"
202
- bottom_document.controlled_items.each do |item|
203
-
204
- if item.up_link_ids
205
- item.up_link_ids.each do |up_lnk|
206
-
207
- if top_document.dictionary.has_key?(up_lnk.to_s)
208
-
209
- topItem = top_document.dictionary[up_lnk.to_s]
210
-
211
- unless topItem.down_links
212
- topItem.down_links = Array.new
213
- top_document.items_with_downlinks_number += 1 # for statistics
214
- end
215
- topItem.down_links.append(item)
216
- else
217
- # check if there is a non existing link with the right doc_id
218
- if tmp = /^([a-zA-Z]+)[-]\d+/.match(up_lnk) # SRS
219
- if tmp[1].downcase == top_document.id.downcase
220
- bottom_document.wrong_links_hash[ up_lnk ] = item
221
- end
222
- end
223
- end
224
- end
225
- end
183
+ end
184
+
185
+ def link_two_specifications(doc_a, doc_b) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
186
+ if doc_b.up_link_docs.key?(doc_a.id.to_s)
187
+ top_document = doc_a
188
+ bottom_document = doc_b
189
+ elsif doc_a.up_link_docs.key?(doc_b.id.to_s)
190
+ top_document = doc_b
191
+ bottom_document = doc_a
192
+ else
193
+ return # no links
194
+ end
195
+ # puts "Link: #{doc_a.id} - #{doc_b.id}"
196
+ bottom_document.controlled_items.each do |item|
197
+ next unless item.up_link_ids
198
+
199
+ item.up_link_ids.each do |up_lnk|
200
+ if top_document.dictionary.key?(up_lnk.to_s)
201
+
202
+ top_item = top_document.dictionary[up_lnk.to_s]
203
+
204
+ unless top_item.down_links
205
+ top_item.down_links = []
206
+ top_document.items_with_downlinks_number += 1 # for statistics
207
+ end
208
+ top_item.down_links.append(item)
209
+ elsif tmp = /^([a-zA-Z]+)-\d+/.match(up_lnk)
210
+ # check if there is a non existing link with the right doc_id
211
+ if tmp[1].downcase == top_document.id.downcase
212
+ bottom_document.wrong_links_hash[up_lnk] = item
213
+ end # SRS
226
214
  end
227
- # create treceability document
228
- trx = Traceability.new top_document, bottom_document, false
229
- @traceability_matrices.append trx
215
+ end
230
216
  end
231
-
232
- def link_protocol_to_spec(protocol, specification)
233
-
234
- top_document = specification
235
- bottom_document = protocol
236
-
237
- bottom_document.controlled_items.each do |item|
238
-
239
- if top_document.dictionary.has_key?(item.up_link.to_s)
240
-
241
- topItem = top_document.dictionary[item.up_link.to_s]
242
-
243
- unless topItem.coverage_links
244
- topItem.coverage_links = Array.new
245
- top_document.items_with_coverage_number += 1 # for statistics
246
- end
247
- topItem.coverage_links.append(item)
248
- end
217
+ # create treceability document
218
+ doc = DocFabric.create_traceability_document(top_document, bottom_document)
219
+ @traceability_matrices.append doc
220
+ end
221
+
222
+ def link_protocol_to_spec(protocol, specification) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
223
+ top_document = specification
224
+ bottom_document = protocol
225
+
226
+ bottom_document.controlled_items.each do |item|
227
+ next unless item.up_link_ids
228
+
229
+ item.up_link_ids.each do |up_lnk|
230
+ if top_document.dictionary.key?(up_lnk.to_s)
231
+
232
+ top_item = top_document.dictionary[up_lnk.to_s]
233
+
234
+ unless top_item.coverage_links
235
+ top_item.coverage_links = []
236
+ top_document.items_with_coverage_number += 1 # for statistics
237
+ end
238
+ top_item.coverage_links.append(item)
239
+ elsif tmp = /^([a-zA-Z]+)-\d+/.match(up_lnk)
240
+ # check if there is a non existing link with the right doc_id
241
+ if tmp[1].downcase == top_document.id.downcase
242
+ bottom_document.wrong_links_hash[up_lnk] = item
243
+ end # SRS
249
244
  end
250
- # create coverage document
251
- trx = Coverage.new top_document
252
- @coverage_matrices.append trx
245
+ end
253
246
  end
247
+ end
254
248
 
255
- def create_index
256
- @index = Index.new( @project )
257
- end
249
+ def create_index
250
+ @index = Index.new(@project)
251
+ end
258
252
 
259
- def render_all_specifications(spec_list)
253
+ def render_all_specifications(spec_list) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
254
+ path = @configuration.project_root_directory
260
255
 
261
- path = @configuration.project_root_directory
256
+ FileUtils.mkdir_p("#{path}/build/specifications")
262
257
 
263
- FileUtils.mkdir_p(path + "/build/specifications")
264
-
265
- spec_list.each do |doc|
258
+ spec_list.each do |doc|
259
+ doc.to_console
266
260
 
267
- doc.to_console
261
+ img_src_dir = "#{path}/specifications/#{doc.id}/img"
262
+ img_dst_dir = "#{path}/build/specifications/#{doc.id}/img"
268
263
 
269
- img_src_dir = path + "/specifications/" + doc.id + "/img"
270
- img_dst_dir = path + "/build/specifications/" + doc.id + "/img"
271
-
272
- FileUtils.mkdir_p(img_dst_dir)
264
+ FileUtils.mkdir_p(img_dst_dir)
273
265
 
274
- if File.directory?(img_src_dir)
275
- FileUtils.copy_entry( img_src_dir, img_dst_dir )
276
- end
266
+ FileUtils.copy_entry(img_src_dir, img_dst_dir) if File.directory?(img_src_dir)
277
267
 
278
- # create a sidebar first
279
- nav_pane = NavigationPane.new(doc)
280
- doc.to_html( nav_pane, "#{path}/build/specifications/" )
281
- end
268
+ nav_pane = NavigationPane.new(doc)
269
+ doc.to_html(nav_pane, "#{path}/build/specifications/")
282
270
  end
271
+ end
283
272
 
284
- def render_all_protocols
285
-
286
- # create a sidebar first
287
- # nav_pane = NavigationPane.new(@specifications)
273
+ def render_all_protocols
274
+ path = @configuration.project_root_directory
288
275
 
289
- path = @configuration.project_root_directory
276
+ FileUtils.mkdir_p("#{path}/build/tests/protocols")
290
277
 
291
- FileUtils.mkdir_p(path + "/build/tests/protocols")
292
-
293
- @protocols.each do |doc|
278
+ @protocols.each do |doc|
279
+ img_src_dir = "#{path}/tests/protocols/#{doc.id}/img"
280
+ img_dst_dir = "#{path}/build/tests/protocols/#{doc.id}/img"
294
281
 
295
- img_src_dir = path + "/tests/protocols/" + doc.id + "/img"
296
- img_dst_dir = path + "/build/tests/protocols/" + doc.id + "/img"
297
-
298
- FileUtils.mkdir_p(img_dst_dir)
282
+ FileUtils.mkdir_p(img_dst_dir)
299
283
 
300
- if File.directory?(img_src_dir)
301
- FileUtils.copy_entry( img_src_dir, img_dst_dir )
302
- end
284
+ FileUtils.copy_entry(img_src_dir, img_dst_dir) if File.directory?(img_src_dir)
303
285
 
304
- doc.to_html( nil, "#{path}/build/tests/protocols/" )
305
- end
286
+ nav_pane = NavigationPane.new(doc)
287
+ doc.to_html(nav_pane, "#{path}/build/tests/protocols/")
306
288
  end
289
+ end
307
290
 
308
- def render_index
309
-
310
- path = @configuration.project_root_directory
291
+ def render_index
292
+ path = @configuration.project_root_directory
311
293
 
312
- doc = @index
313
- doc.to_console
294
+ doc = @index
295
+ doc.to_console
314
296
 
315
- doc.to_html("#{path}/build/")
316
- end
297
+ doc.to_html("#{path}/build/")
298
+ end
317
299
 
318
- def create_search_data
319
- db = SpecificationsDb.new @specifications
320
- data_path = @configuration.project_root_directory + "/build/data"
321
- FileUtils.mkdir_p(data_path)
322
- db.save(data_path)
323
- end
324
- end
300
+ def create_search_data
301
+ db = SpecificationsDb.new @specifications
302
+ data_path = "#{@configuration.project_root_directory}/build/data"
303
+ FileUtils.mkdir_p(data_path)
304
+ db.save(data_path)
305
+ end
306
+ end
@@ -10,8 +10,8 @@
10
10
  <body>
11
11
  <div id="top_nav">
12
12
  <a id="home_menu_item" href="javascript:void(0)" onclick="navigate_to_home()"><span><i class="fa fa-home" aria-hidden="true"></i></span>&nbsp;Home</a>
13
- <a id="index_menu_item" href="javascript:void(0)" onclick="navigate_to_home()" style="display: none;"><span><i class="fa fa-chevron-left" aria-hidden="true"></i></span>&nbsp;Index</a>
14
- <a id="document_tree_menu_item" href="javascript:void(0)" onclick="openNav()" style="display: none;"><span><i class="fa fa-bars" aria-hidden="true"></i></span>&nbsp;Document Tree</a>
13
+ <a id="index_menu_item" href="javascript:void(0)" onclick="navigate_to_home()" style="display: none;"><span><i class="fa fa-info" aria-hidden="true"></i></span>&nbsp;Index</a>
14
+ <a id="document_tree_menu_item" href="javascript:void(0)" onclick="openNav()" style="display: none;" title="Navigation Pane"><span><i class="fa fa-folder-open-o" aria-hidden="true"></i></span></a>
15
15
  <input type="text" id="searchInput" placeholder="Search.." style="display: none;">
16
16
  <a class="split">{{DOCUMENT_TITLE}}</a>
17
17
  </div>
@@ -19,7 +19,7 @@
19
19
  <div id="main">
20
20
  <div id="closed_nav_pane" href="javascript:void(0)" onclick="openNav()">
21
21
  </div>
22
- <div id="nav_pane" onclick="closeNav()">
22
+ <div id="nav_pane">
23
23
  {{NAV_PANE}}
24
24
  </div>
25
25
  <div id="content" href="javascript:void(0)" onclick="closeNav()">
@@ -50,11 +50,27 @@ function openNav() {
50
50
  required_id = "DLS_" + id_parts[1];
51
51
  document.getElementById(required_id).style.display = 'block';
52
52
  }
53
+ function coverageLink_OnClick(clicked){
54
+ clicked.style.display = 'none';
55
+ id_parts = clicked.id.split("_");
56
+ required_id = "COVS_" + id_parts[1];
57
+ document.getElementById(required_id).style.display = 'block';
58
+ }
59
+ function upLink_OnClick(clicked){
60
+ clicked.style.display = 'none';
61
+ id_parts = clicked.id.split("_");
62
+ required_id = "ULS_" + id_parts[1];
63
+ document.getElementById(required_id).style.display = 'block';
64
+ }
53
65
 
54
66
  function navigate_to_home(){
55
67
  if (document.title != "Document Index")
56
68
  {
69
+ if (document.URL.includes('protocols')){
70
+ window.location.href = "./../../../index.html";
71
+ }else{
57
72
  window.location.href = "./../../index.html";
73
+ }
58
74
  }else{
59
75
  window.location.href = "./index.html";
60
76
  }
@@ -75,4 +91,22 @@ function openNav() {
75
91
  function modal_close_OnClick(clicked){
76
92
  var modal = document.getElementById('image_modal_div');
77
93
  modal.style.display = "none";
94
+ }
95
+
96
+ // Navigation Pane Expand/Collapse
97
+ function nav_toggle_expand_list(el, e){
98
+ var children = el.children;
99
+ e.stopPropagation();
100
+ for (var i = 0; i < children.length; i++) {
101
+ var list_item = children[i];
102
+ if (list_item.tagName == "UL"){
103
+ if (list_item.style.display != "none"){
104
+ list_item.style.display = "none";
105
+ }else{
106
+ list_item.style.display = "block";
107
+ }
108
+ }else if (list_item.tagName == "SPAN"){
109
+ list_item.firstChild.classList.toggle("fa-plus-square-o");
110
+ }
111
+ }
78
112
  }