Class: MetadataView

MetadataView()

A human-readable view of a science metadata file

Screenshot

Constructor

new MetadataView()

Source:

Extends

  • Backbone.View

Members

alternativeIdentifierHelpText :string

Text to display in the help tooltip for the alternative identifier field, if the field is present.
Type:
  • string
Since:
  • 2.26.0
Source:

events

Source:

Methods

addInfoIcon(iconType, iconClass, baseClass, titleText) → {HTMLElement}

Add an info icon to the metadata controls panel.
Parameters:
Name Type Description
iconType string The type of icon to add.
iconClass string The class
baseClass string The base class
titleText string The text to display when the icon is hovered over.
Since:
  • 2.32.0
Source:
Returns:
The icon element that was added to the view.
Type
HTMLElement

alterMarkup()

Make minor modifications to the HTML returned from the view service
Source:

checkForProv()

Check if the DataPackage provenance parsing has completed. If it has, draw provenance charts. If it hasn't start the parseProv function. The view must have the DataPackage collection set as view.dataPackage for this function to run.
Source:

checkWritePermissions()

Check whether the user has write permissions on the resource map and the EML. Once the permission checks have finished, continue with the functions that depend on them.
Source:

closePopovers(e)

Close any active popovers when the user clicks outside of them
Parameters:
Name Type Description
e Event The click event
Source:

createAnnotationViews()

Insert the interactive annoation views
Source:

createWholeTaleButton()

Creates a button which the user can click to launch the package in Whole Tale
Source:

drawProvCharts(collection)

Renders ProvChartViews on the page to display provenance on a package level and on an individual object level. This function looks at four sources for the provenance - the package sources, the package derivations, member sources, and member derivations
Parameters:
Name Type Description
collection DataPackage The DataPackage collection to render provenance for
Source:

findEntityDetailsContainer(model, containerElopt) → {Element|null}

Finds the element in the rendered metadata that describes the given data entity.
Parameters:
Name Type Attributes Description
model DataONEObject | SolrResult | string Either a model that represents the data object or the identifier of the data object
containerEl Element <optional>
The DOM element to exclusivly search inside.
Source:
Returns:
- The DOM element that describes the given data entity or null if it cannot be found.
Type
Element | null

getAuthorText() → {string}

Generate a string appropriate to go into the author/creator portion of a dataset citation from the value stored in the underlying model's origin field.
Source:
Returns:
- A string of author names, formatted for citation
Type
string

getBoundsZoomLevel(bounds, mapDim) → {number}

Returns the zoom level that will display the given bounding box at the given dimensions.
Parameters:
Name Type Description
bounds LatLngBounds The bounding box to display.
mapDim object The dimensions of the map.
Properties
Name Type Description
height number The height of the map.
width number The width of the map.
Since:
  • 2.27.0
Source:
Returns:
The zoom level.
Type
number

getDataPackage(pid)

Retrieve the resource map given its PID, and when it's fetched, check for write permissions, then check for private members in the package table view, if there is one.
Parameters:
Name Type Description
pid string The PID of the resource map
Source:

getDatePublishedText() → {string}

Generate a string appropriate to be used as the publication date in a dataset citation.
Source:
Returns:
- A string of the publication date, formatted for citation
Type
string

getEntityName(containerEl) → {string}

Get the name of the entity in the given container element
Parameters:
Name Type Description
containerEl Element The DOM element that contains the entity name
Source:
Returns:
- The name of the entity
Type
string

getEntityNames(packageModels)

Get the names of the entities in this package
Parameters:
Name Type Description
packageModels Array An array of models in this package
Source:

getGoogleMapsUrl(latLngCEN, bounds) → {string}

Returns a URL to a Google Maps instance that is centered on the given coordinates and zoomed to the appropriate level to display the given bounding box.
Parameters:
Name Type Description
latLngCEN LatLng The center point of the map.
bounds LatLngBounds The bounding box to display.
Since:
  • 2.27.0
Source:
Returns:
The URL to the Google Maps instance.
Type
string

getPackageDetails(packageIDs)

Retrieves and processes the details of the specified data packages.
Parameters:
Name Type Description
packageIDs Array.<string> An array of package IDs to retrieve details for. If the array is empty or not provided, it processes the current metadata document as a standalone package.
Source:

getPublisherText() → {string}

Generate a string appropriate to be used in the publisher portion of a dataset citation. This method falls back to the node ID when the proper node name cannot be fetched from the app's NodeModel instance.
Source:
Returns:
- A string of the publisher name, formatted for citation
Type
string

hasEntityDetails() → {boolean}

Checks if the metadata has entity details sections
Source:
Returns:
- True if the metadata has entity details sections
Type
boolean

hideEditorControls()

Hide the editor controls
Source:

hideLoading()

Hide the loading message
Source:

hideSaving()

Activate the save button after the save process
Source:

highlightNode(e)

When the user clicks on a node in the provenance chart, highlight the node and its metadata section
Parameters:
Name Type Description
e Event The click event
Source:

initialize(options)

Initialize the MetadataView
Parameters:
Name Type Description
options object Object containing the view's options
Properties
Name Type Attributes Description
pid string <optional>
The identifier of the metadata object to render
el string <optional>
The jQuery selector for the element in which to render the view
Source:

insertBreadcrumbs()

Add breadcrumbs to the page to show the user where they are in the app
Source:

insertCitation()

Insert the citation header into the view
Source:

insertCitationMetaTags()

Insert citation information as meta tags into the head of the page Currently supports Highwire Press style tags (citation_) which is supposedly what Google (Scholar), Mendeley, and Zotero support.
Source:

insertDataSource()

Show a logo for the repository that hosts this metadata
Source:

insertMarkdownViews()

Insert the markdown views
Source:

insertMetricsControls()

Insert the Metric Stats
Source:

insertPackageDetails(packageModels, options) → {MetadataView|null}

Inserts a table with all the data package member information and sends the call to display annotations
Parameters:
Name Type Description
packageModels Array An array of Package models
options object An object with options for rendering the package table
Source:
Returns:
Returns this view object
Type
MetadataView | null

insertPackageTable(packageModel, options)

Inserts a package table into the view.
Parameters:
Name Type Description
packageModel object The package model.
options object The options for the package table.
Properties
Name Type Description
title string The title of the package table.
disablePackageDownloads boolean Whether to disable package downloads.
nested boolean Whether the package table is nested.
Source:
Inserts parent package links into the view for nested packages.
Parameters:
Name Type Description
packageModel PackageModel The package model containing the parent package metadata.
Source:

insertSpatialCoverageMap(customCoordinatesopt) → {boolean}

Shows a map with the bounding coordinates of the spatial coverage of the dataset.
Parameters:
Name Type Attributes Description
customCoordinates Array <optional>
An array of custom coordinates to use for the map in the order of [north, south, east, west].
Source:
Returns:
Returns false if the map could not be inserted.
Type
boolean
Navigate to a new /view URL with a fragment Used in getModel() when the pid originally passed into MetadataView is not a metadata PID but is, instead, a data PID. getModel() does the work of finding an appropriate metadata PID for the data PID and this method handles re-routing to the correct URL.
Parameters:
Name Type Description
metadataPid string The new metadata PID
dataPid string Optional. A data PID that's part of the package metadataPid exists within.
Source:

noMetadata(solrResultModel)

When the given ID from the URL is a resource map that has no metadata, render metadata from the index instead.
Parameters:
Name Type Description
solrResultModel SolrResult The SolrResult model for the resource map
Source:

onClose()

Actions to perform when the view is closed
Source:

previewData(e) → {boolean}

When the "Metadata" button in the table is clicked while we are on the Metadata view, we want to scroll to the anchor tag of this data object within the page instead of navigating to the metadata page again, which refreshes the page and re-renders (more loading time)
Parameters:
Name Type Description
e Event The click event
Source:
Returns:
- Returns false if the click event should not be followed
Type
boolean

publish(event)

Publish the data package with a DOI
Parameters:
Name Type Description
event Event The click event
Source:

redrawProvCharts()

Step through all prov charts and re-render each one that has been marked for re-rendering.
Source:

removeCitation()

Deprecated:
  • Yes
Source:

render()

Source:

renderAltIdentifierHelpText() → {jQuery|null}

Inserts an info icon next to the alternate identifier field, if it exists. The icon will display a tooltip with the help text for the field.
Since:
  • 2.26.0
Source:
Returns:
The jQuery object for the icon element.
Type
jQuery | null

renderDataInteractionButtons(solrResult, container)

Insert the buttons to download and view the data object
Parameters:
Name Type Description
solrResult SolrResult The SolrResult model for the object
container Element The DOM element that contains the object's metadata
Since:
  • 2.32.0
Source:

renderInfoIcons()

Add the info icons to the metadata controls panel. Shows if the dataset is private or archived.
Since:
  • 2.32.0
Source:

renderMetadata()

Render the main components of the metadata view. Insert HTML from the view service or fallback to rendering from the index. Insert breadcrumbs, citation, data source logo, metadata controls, and metadata metrics.
Source:

renderMetadataFromIndex()

If there is no view service available, then display the metadata fields from the index
Source:
Remove ecogrid links and replace them with workable links
Source:

saveError(errorMsg)

When the data package collection fails to save, tell the user
Parameters:
Name Type Description
errorMsg string The error message to display
Source:

saveProv()

If provenance relationships have been modified by the provenance editor (in ProvChartView), then update the ORE Resource Map and save it to the server.
Source:

saveSuccess(savedObject)

When the data package collection saves successfully, tell the user
Parameters:
Name Type Description
savedObject DataPackage The object that was saved
Source:

scrollToFragment()

Try to scroll to the section on a page describing the identifier in the fragment/hash portion of the current page. This function depends on there being an `id` dataset attribute on an element on the page set to an XML-safe version of the value in the fragment/hash. Used to provide direct links to sub-resources on a page.
Source:

showEditorControls()

Show the editor controls
Source:

showError(msg)

Show an error message to the user
Parameters:
Name Type Description
msg string The error message to display
Source:

showIsPrivate()

When the metadata object is private, display a message to the user
Source:

showLatestVersion()

Lokup the latest version of the PID and display a link to it
Source:

showLoading(message)

Indicate that the metadata is being loaded
Parameters:
Name Type Description
message string The message to display while loading
Source:

showNotFound()

When the metadata object doesn't exist, display a message to the user
Source:

showSaving()

Inactivate the save button during the save process
Source:

storeEntityPIDs(entityEl, entityId)

Store PIDs for each entity as an array on the view (this.entities)
Parameters:
Name Type Description
entityEl HTMLElement An element that contains the entity PID as a data-id attribute. Used if the entity PID is not provided.
entityId string The identifier for the entity.
Source: