Choose scope for new timeline:
"; + + title = $('#timelineModal')[0].dataset.title; + let timelineScopes = getTimelineScopes(); + let scopes = timelineScopes.scopes; + streamId = timelineScopes.streamId; + + for (let index = 0; index < scopes.length; index++) { + let scope = scopes[index]; + let label = scope.label; + // Add mediaobject title for the option representing the current section + if (scope.tags.includes('current-section')) { + label = `${title} - ${label}`; + } + if (scope.tracks > 1) { + label += " (" + scope.tracks + " tracks)"; + } + checked = (index == scopes.length - 1) ? 'checked' : ''; + bodyText += "#{note_types[note_type]}
" if i==0 and note_type!='general' - note_string += "#{note}" - end - end - note_string - end - - def gather_notes_of_type media_object, type - media_object.note.present? ? media_object.note.select{|n| n[:type]==type}.collect{|n|n[:note]} : [] - end - - def display_collection(media_object) - link_to(media_object.collection.name, collection_path(media_object.collection.id)) - end - - def display_unit(media_object) - link_to(media_object.collection.unit, collections_path(filter: media_object.collection.unit)) - end - - def display_language media_object - media_object.language.collect{|l|l[:text]}.uniq - end - - def display_related_item media_object - media_object.related_item_url.collect{ |r| link_to( r[:label], r[:url]) } - end - - def display_series media_object - media_object.series.collect { |s| link_to(s, blacklight_path({ "f[collection_ssim][]" => media_object.collection.name, "f[series_ssim][]" => s }))} - end - - def display_rights_statement media_object - return nil unless media_object.rights_statement.present? - label = ModsDocument::RIGHTS_STATEMENTS[media_object.rights_statement] - return nil unless label.present? - link = link_to label, media_object.rights_statement, target: '_blank' - content_tag(:dt, 'Rights Statement') + content_tag(:dd) { link } - end - - def current_quality stream_info - available_qualities = Array(stream_info[:stream_flash]).collect {|s| s[:quality]} - available_qualities += Array(stream_info[:stream_hls]).collect {|s| s[:quality]} - available_qualities.uniq! - quality ||= session[:quality] if session['quality'].present? && available_qualities.include?(session[:quality]) - quality ||= Settings.streaming.default_quality if available_qualities.include?(Settings.streaming.default_quality) - quality ||= available_qualities.first - quality - end - - def is_current_section? section - @currentStream && ( section.id == @currentStream.id ) - end - - def show_progress?(sections) - encode_gids = sections.collect { |mf| "gid://ActiveEncode/#{mf.encoder_class}/#{mf.workflow_id}" } - ActiveEncode::EncodeRecord.where(global_id: encode_gids).any? { |encode| encode.state.to_s.upcase != 'COMPLETED' } - end - - def any_failed?(sections) - encode_gids = sections.collect { |mf| "gid://ActiveEncode/#{mf.encoder_class}/#{mf.workflow_id}" } - ActiveEncode::EncodeRecord.where(global_id: encode_gids).any? { |encode| encode.state.to_s.upcase == 'FAILED' } - end - - def parse_section section, node, index - sectionnode = section.structuralMetadata.xpath('//Item') - if sectionnode.children.present? - tracknumber = 0 - contents = '' - sectionnode.children.each do |node| - next if node.blank? - st, tracknumber = parse_node section, node, tracknumber - contents+=st - end - else - contents, tracknumber = parse_node section, sectionnode.first, index - end - return contents, tracknumber - end - - def parse_node section, node, tracknumber - if node.name.upcase=="DIV" - contents = '' - node.children.each do |n| - next if n.blank? - nodecontent, tracknumber = parse_node section, n, tracknumber - contents+=nodecontent - end - return "
#{note_types[note_type]}
" if i==0 and note_type!='general' + note_string += "#{note}" + end + end + note_string + end + + def gather_notes_of_type media_object, type + media_object.note.present? ? media_object.note.select{|n| n[:type]==type}.collect{|n|n[:note]} : [] + end + + def display_collection(media_object) + link_to(media_object.collection.name, collection_path(media_object.collection.id)) + end + + def display_unit(media_object) + link_to(media_object.collection.unit, collections_path(filter: media_object.collection.unit)) + end + + def display_language media_object + media_object.language.collect{|l|l[:text]}.uniq + end + + def display_related_item media_object + media_object.related_item_url.collect{ |r| link_to( r[:label], r[:url]) } + end + + def display_series media_object + media_object.series.collect { |s| link_to(s, blacklight_path({ "f[collection_ssim][]" => media_object.collection.name, "f[series_ssim][]" => s }))} + end + + def display_rights_statement media_object + return nil unless media_object.rights_statement.present? + label = ModsDocument::RIGHTS_STATEMENTS[media_object.rights_statement] + return nil unless label.present? + link = link_to label, media_object.rights_statement, target: '_blank' + content_tag(:dt, 'Rights Statement') + content_tag(:dd) { link } + end + + def current_quality stream_info + available_qualities = Array(stream_info[:stream_flash]).collect {|s| s[:quality]} + available_qualities += Array(stream_info[:stream_hls]).collect {|s| s[:quality]} + available_qualities.uniq! + quality ||= session[:quality] if session['quality'].present? && available_qualities.include?(session[:quality]) + quality ||= Settings.streaming.default_quality if available_qualities.include?(Settings.streaming.default_quality) + quality ||= available_qualities.first + quality + end + + def is_current_section? section + @currentStream && ( section.id == @currentStream.id ) + end + + def show_progress?(sections) + encode_gids = sections.collect { |mf| "gid://ActiveEncode/#{mf.encoder_class}/#{mf.workflow_id}" } + ActiveEncode::EncodeRecord.where(global_id: encode_gids).any? { |encode| encode.state.to_s.upcase != 'COMPLETED' } + end + + def any_failed?(sections) + encode_gids = sections.collect { |mf| "gid://ActiveEncode/#{mf.encoder_class}/#{mf.workflow_id}" } + ActiveEncode::EncodeRecord.where(global_id: encode_gids).any? { |encode| encode.state.to_s.upcase == 'FAILED' } + end + + def parse_section section, node, index + sectionnode = section.structuralMetadata.xpath('//Item') + if sectionnode.children.present? + tracknumber = 0 + contents = '' + sectionnode.children.each do |node| + next if node.blank? + st, tracknumber = parse_node section, node, tracknumber + contents+=st + end + else + contents, tracknumber = parse_node section, sectionnode.first, index + end + return contents, tracknumber + end + + def parse_node section, node, tracknumber + if node.name.upcase=="DIV" + contents = '' + node.children.each do |n| + next if n.blank? + nodecontent, tracknumber = parse_node section, n, tracknumber + contents+=nodecontent + end + return "