Class: EML211EditorView

EML211EditorView()

A view of a form for creating and editing EML 2.1.1 documents

Constructor

new EML211EditorView()

Source:

Extends

Members

accessPolicyControlContainer :string

The selector for the HTML element that will contain a button/link/control for opening the AccessPolicyView modal window. If this element doesn't exist on the page, then the AccessPolicyView will be inserted into the `accessPolicyViewContainer` directly, rather than a modal window.
Type:
  • string
Inherited From:
Source:

accessPolicyModalID :string

The text to use in the editor submit button
Type:
  • string
Inherited From:
Source:

accessPolicyViewContainer :string

The selector for the HTML element that will contain the AccessPolicyView. If this element doesn't exist on the page, then the AccessPolicyView will not be inserted into the page. If a `accessPolicyControlContainer` element is on the page, then this element will contain the modal window element.
Type:
  • string
Inherited From:
Source:

dataPackageView :DataPackageView

The data package view
Type:
Source:

editorSubmitMessageTemplate

References to templates for this view. HTML files are converted to Underscore.js templates
Overrides:
Source:

el :string|DOMElement

The element this view is contained in. A jQuery selector or the element itself.
Type:
  • string | DOMElement
Inherited From:
Source:

events :Object

The events this view will listen to and the associated function to call. This view will inherit events from the parent class, EditorView.
Type:
  • Object
Overrides:
Source:

pid :string

The identifier of the root package EML being rendered
Type:
  • string
Source:

submitButtonText :string

The text to use in the editor submit button
Type:
  • string
Overrides:
Source:

subviews :Array.<Backbone.Views>

A list of the subviews of the editor
Type:
  • Array.<Backbone.Views>
Source:

Methods

canClose() → {boolean}

Checks if there are unsaved changes in this Editor that should prevent closing of this view. This function is also executed by the AppView, which controls the top-level navigation.
Inherited From:
Source:
Returns:
Returns true if this view should be closed. False if it should remain opened and active.
Type
boolean

cancel()

Cancel all edits in the editor by simply re-rendering the view
Inherited From:
Source:

checkValidity()

Check the validity of this view's model
Inherited From:
Source:

clearOldDrafts()

Clear older drafts by iterating over the sorted list of drafts stored by LocalForage and removing any beyond a hardcoded limit.
Source:

createDataPackage()

Creates a DataPackage collection for this EML211EditorView and sets it on the MetacatUI global object (as `rootDataPackage`)
Source:

createModel()

Create a new EML model for this view
Source:

createRootDataPackage(models, attributesopt)

Creates a DataPackage collection for this Editor view, and saves it as the Root Data Package of the app. This centralizes the DataPackage creation so listeners and other functionality is always performed
Parameters:
Name Type Attributes Description
models Array.<DataONEObject> | Array.<ScienceMetadata> | Array.<EML211> An array of models to add to the collection
attributes object <optional>
A literal object of attributes to pass to the DataPackage.initialize() function
Since:
  • 2.17.1
Source:

disableControls(messageopt)

Disable the Save button and display a message to explain why
Parameters:
Name Type Attributes Description
message string <optional>
A short text message to display in the Save button
Since:
  • 2.17.1
Inherited From:
Source:

enableControls()

Enable the Save button. Resets any changes made in EditorView#disableControls
Since:
  • 2.17.1
Inherited From:
Source:

fetchModel()

Fetch the metadata model
Source:

getConfirmCloseMessage() → {string}

This function is called whenever the user is about to leave this view.
Inherited From:
Source:
Returns:
The message that asks the user if they are sure they want to close this view
Type
string

getDataPackage(scimetaModel)

Get the data package (resource map) associated with the EML. Save it to MetacatUI.rootDataPackage. The metadata model must already be synced, and the user must be authorized to edit the EML before this function can run.
Parameters:
Name Type Description
scimetaModel Model The science metadata model for which to find the associated data package
Source:

getErrorListItem(error) → {string}

Creates an HTML string to display this error message on the page. Errors can be strings, arrays of strings, arrays of literal objects with string values, or a literal object with strings as the values.
Parameters:
Name Type Description
error string | Array.<string> | object A single error message in string format or a collection of error strings as an array or object
Since:
  • 2.18.0
Inherited From:
Source:
Returns:
The error message HTML
Type
string

getLatestResourceMap()

Get the latest version of the resource map model stored in MetacatUI.rootDataPackage.packageModel. When the newest resource map is synced, the "dataPackageFound" event will be triggered.
Source:

getRequiredFields()

Gets the EML required fields, as configured in the AppConfig#emlEditorRequiredFields, and adds possible other special fields that may be configured elsewhere. (e.g. the AppConfig#customEMLMethods)
Overrides:
Source:

handleFileLoadError(item)

Handle "fileLoadError" events by alerting the user and removing the row from the data package table.
Parameters:
Name Type Description
item DataONEObject The model item passed by the fileLoadError event
Source:

handleFileReadError(item)

Handle "fileReadError" events by alerting the user and removing the row from the data package table.
Parameters:
Name Type Description
item DataONEObject The model item passed by the fileReadError event
Source:

handleSaveCancel()

Trigger a save error with a message that the save was cancelled
Inherited From:
Source:

hasUnsavedChanges() → {boolean}

Returns true if there are unsaved changes in this Editor This function should be extended by each subclass of EditorView to check for unsaved changes for that model type
Overrides:
Source:
Returns:
Type
boolean

hideControls()

Hide the editor footer controls (Save bar)
Inherited From:
Source:

hideLoading(container)

Remove the styles set in showLoading()
Parameters:
Name Type Description
container string | DOMElement The element the loading message is conttained in. Either a jQuery selector or the element itself.
Inherited From:
Source:

hideSaving()

Remove the styles set in showSaving()
Inherited From:
Source:

initialize()

Initialize a new EML211EditorView - called post constructor
Source:

isAccessPolicyEditEnabled() → {boolean}

Checks if the Access Policy editor is enabled in this instance of MetacatUI for the type of object being edited.
Since:
  • 2.15.0
Overrides:
Source:
Returns:
Type
boolean

notAuthorized()

Shows a message if the user is not authorized to edit this package
Source:

onClose()

Perform clean-up functions when this view is about to be removed from the page or navigated away from.
Overrides:
Source:

removeValidation()

Removes all the validation error styling and messaging from this view
Inherited From:
Source:

render()

Render the view
Overrides:
Source:

renderAccessPolicy(model)

Renders the AccessPolicyView
Parameters:
Name Type Description
model Backbone.Model Optional. The Model to render the AccessPolicy of. If not passed, method uses the Editor's model
Inherited From:
Source:

renderAccessPolicyControl()

Adds a Share button for editing the access policy
Inherited From:
Source:

renderDataPackage()

Render the Data Package View and insert it into this view
Source:

renderDataPackageItem()

Renders the data package section of the EML211EditorView
Source:

renderEditorComponents()

Render the editor components (data package view and metadata view), or, if not authorized, render the not authorized message.
Source:

renderEditorControls()

Adds top-level control elements to this editor.
Inherited From:
Source:

renderMember()

Calls the appropriate render method depending on the model type
Source:

renderMetadata()

Renders the metadata section of the EML211EditorView
Source:

renderRequiredIcons(requiredFields)

Shows the required icons for the sections and fields that must be completed in this editor.
Parameters:
Name Type Description
requiredFields object A literal object that specified which fields should be required. The keys on the object map to model attributes, and the value is true if required, false if optional.
Inherited From:
Source:

save(e)

Saves all edits in the collection
Parameters:
Name Type Description
e Event The DOM Event that triggerd this function
Overrides:
Source:

saveDraft()

Save a draft of the parent EML model
Source:

saveError(errorMsg)

When the data package collection fails to save, tell the user
Parameters:
Name Type Description
errorMsg string The error message from the failed save() function
Overrides:
Source:

saveSuccess(savedObject)

When the data package collection saves successfully, tell the user
Parameters:
Name Type Description
savedObject DataPackage | DataONEObject The model or collection that was just saved
Overrides:
Source:

setListeners()

Set listeners on the view's model for various reasons. This function centralizes all the listeners so that when/if the view's model is replaced, the listeners would be reset.
Overrides:
Source:

showAccessPolicyModal(e:)

Show the AccessPolicy view in a modal dialog This method calls the superclass method, feeding it the identifier associated with the row in the package table that was clicked. The reason for this is so the AccessPolicyView can be used for single objects (like in the Portal editor) or an entire Collection of objects, like in the EML editor: The superclass impelements the generic behavior and the subclass tweaks it.
Parameters:
Name Type Description
e: EventHandler The click event
Overrides:
Source:

showControls()

Show the editor footer controls (Save bar)
Inherited From:
Source:

showEntity(e)

Show the entity editor
Parameters:
Name Type Description
e Event The DOM Event that triggerd this function
Source:

showLatestVersion()

Find the most recently updated version of the metadata
Source:

showLoading(container, message)

Style the view to show that it is loading
Parameters:
Name Type Description
container string | DOMElement The element to put the loading styling in. Either a jQuery selector or the element itself.
message string | DOMElement The message to display next to the loading icon. Either a jQuery selector or the element itself.
Inherited From:
Source:

showNotFound()

Called when there is no object found with this ID
Inherited From:
Source:

showSaving()

Change the styling of this view to show that the object is in the process of saving
Inherited From:
Source:

showSignIn()

Show Sign In buttons
Inherited From:
Source:

showValidation()

Show any errors that occured when trying to save changes
Overrides:
Source:

toggleControls()

Toggle the editor footer controls (Save bar)
Source:

toggleEnableControls()

Toggles whether the Save controls for the Editor are enabled or disabled based on various attributes of the DataPackage and its models.
Since:
  • 2.17.1
Source:

updateLoadingText(message)

Update the text that is shown below the spinner while the editor is loading
Parameters:
Name Type Description
message string The message to display
Source: