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:

Methods

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:

createWholeTaleButton()

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

findEntityDetailsContainer(model, elopt) → {Element}

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
el Element <optional>
The DOM element to exclusivly search inside.
Source:
Returns:
- The DOM element that describbbes the given data entity.
Type
Element

generateGeoJSONPoint(north, east)

Generate a GeoJSON Point object
Parameters:
Name Type Description
north number North bounding coordinate
east number East bounding coordinate Example: { "type": "Point", "coordinates": [ -105.01621, 39.57422 ]}
Source:

generateGeoJSONPolygon(north, east, south, west)

Generate a GeoJSON Polygon object from
Parameters:
Name Type Description
north number North bounding coordinate
east number East bounding coordinate
south number South bounding coordinate
west number West bounding coordinate Example: { "type": "Polygon", "coordinates": [[ [ 100, 0 ], [ 101, 0 ], [ 101, 1 ], [ 100, 1 ], [ 100, 0 ] ]}
Source:

generateGeoJSONString(north, east, south, west)

Creates a (hopefully) valid geoJSON string from the a set of bounding coordinates from the Solr index (north, east, south, west). This function produces either a GeoJSON Point or Polygon depending on whether the north and south bounding coordinates are the same. Part of the reason for factoring this out, in addition to code organization issues, is that the GeoJSON spec requires us to modify the raw result from Solr when the coverage crosses -180W which is common for datasets that cross the Pacific Ocean. In this case, We need to convert the east bounding coordinate from degrees west to degrees east. e.g., if the east bounding coordinate is 120 W and west bounding coordinate is 140 E, geoJSON requires we specify 140 E as 220
Parameters:
Name Type Description
north number North bounding coordinate
east number East bounding coordinate
south number South bounding coordinate
west number West bounding coordinate
Source:

generateJSONLD()

Generate Schema.org-compliant JSONLD for the model bound to the view into the head tag of the page by `insertJSONLD`. Note: `insertJSONLD` should be called to do the actual inserting into the DOM.
Source:

generateSchemaOrgGeo()

Generate a Schema.org/Place/geo from bounding coordinates Either generates a GeoCoordinates (when the north and east coords are the same) or a GeoShape otherwise.
Source:

generateSchemaOrgIdentifier(identifier)

Generate a Schema.org/identifier from the model's id Tries to use the PropertyValue pattern when the identifier is a DOI and falls back to a Text value otherwise
Parameters:
Name Type Description
identifier string The raw identifier
Source:

getAuthorText()

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:

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

getCanonicalDOIIRI(identifier:) → {string|null}

Create a canonical IRI for a DOI given a random DataONE identifier.
Parameters:
Name Type Description
identifier: string The identifier to (possibly) create the IRI for.
Source:
Returns:
Returns null when matching the identifier to a DOI regex fails or a string when the match is successful Useful for describing resources identified by DOIs in linked open data contexts or possibly also useful for comparing two DOIs for equality. Note: Really could be generalized to more identifier schemes.
Type
string | null

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()

Generate a string appropriate to be used as the publication date in a dataset citation.
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

getPublisherText()

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:

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:

insertJSONLD(json)

Insert Schema.org-compliant JSONLD for the model bound to the view into the head tag of the page (at the end).
Parameters:
Name Type Description
json object JSON-LD to insert into the page Some notes: - Checks if the JSONLD already exists from the previous data view - If not create a new script tag and append otherwise replace the text for the script
Source:
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
metadata_pid string The new metadata PID
data_pid string Optional. A data PID that's part of the package metadata_pid exists within.
Source:

previewData()

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)
Source:

renderAltIdentifierHelpText() → {jQuery}

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

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: