/*global define */
define(['jquery', 'underscore', 'backbone'],
function($, _, Backbone) {
'use strict';
// Application Model
// ------------------
var AppModel = Backbone.Model.extend({
// This model contains all of the attributes for the Application
defaults: {
headerType: 'default',
title: "DataONE Data Catalog",
repositoryName: "DataONE Data Catalog",
emailContact: "support@dataone.org",
googleAnalyticsKey: null,
nodeId: "urn:node:CN",
searchMode: MetacatUI.mapKey ? 'map' : 'list',
searchHistory: [],
sortOrder: 'dateUploaded+desc',
page: 0,
pid: null,
previousPid: null,
anchorId: null,
enableUserProfiles: true,
enableUserProfileSettings: true,
profileUsername: null,
maxDownloadSize: 3000000000,
temporaryMessage: null,
temporaryMessageStartTime: null,
temporaryMessageEndTime: null,
temporaryMessageClasses: "warning",
temporaryMessageContainer: "#Navbar",
/**
* Show or hide the source repository logo in the search result rows
* @type {boolean}
*/
displayRepoLogosInSearchResults: true,
/**
* Show or hide the Download button in the search result rows
* @type {boolean}
*/
displayDownloadButtonInSearchResults: false,
// set this variable to true, if the content being published is moderated by the data team.
contentIsModerated: false,
/**
* Flag which, when true shows Whole Tale features in the UI
* @type {Boolean}
*/
showWholeTaleFeatures: false,
/**
* The environments that are exposed to DataONE users
* @type {Array}
*/
taleEnvironments: ["RStudio", "Jupyter Notebook"],
/**
* The Whole Tale endpoint that handles users
* @type {String}
*/
dashboardUrl: 'https://girder.wholetale.org/api/v1/integration/dataone',
baseUrl: window.location.origin || (window.location.protocol + "//" + window.location.host),
// the most likely item to change is the Metacat deployment context
context: '',
d1Service: "/cn/v2",
d1CNBaseUrl: "https://cn.dataone.org",
d1CNService: "/cn/v2",
viewServiceUrl: null,
packageServiceUrl: null,
//publishServiceUrl: null,
authServiceUrl: null,
queryServiceUrl: null,
reserveServiceUrl: null,
/**
* If false, the /monitor/status (the service that returns the status of various DataONE services) will not be used.
* @type {boolean}
*/
enableMonitorStatus: false,
/**
* The URL for the service that returns the status of various DataONE services.
* The only supported status so far is the search index queue -- the number of
* objects that are waiting to be indexed in the Solr search index
* @type {string}
* @readonly
*/
monitorStatusUrl: "",
/** If set to false, some parts of the app will send POST HTTP requests to the
* Solr search index via the `/query/solr` DataONE API.
* Set this configuration to true if using Metacat 2.10.2 or earlier
*/
disableQueryPOSTs: true,
/** If set to true, some parts of the app will use the Solr Join Query syntax
* when sending queries to the `/query/solr` DataONE API.
* If this is not enabled, then some parts of the UI may not work if a query has too
* many characters or has too many boolean clauses. This impacts the "Metrics" tabs of portals/collections,
* at least.
* The Solr Join Query Parser as added in Solr 4.0.0-ALPHA (I believe!): https://archive.apache.org/dist/lucene/solr/4.0.0/changes/Changes.html#4.0.0-alpha.new_features
* About the Solr Join Query Parser: https://lucene.apache.org/solr/guide/8_5/other-parsers.html#join-query-parser
* WARNING: At some point, MetacatUI will deprecate this configuration and will REQUIRE Solr Join Queries
* @type {boolean}
*/
enableSolrJoins: true,
defaultSearchFilters: ["all", "attribute", "annotation", "documents", "creator", "dataYear", "pubYear",
"id", "taxon", "spatial", "dataSource"],
metaServiceUrl: null,
metacatBaseUrl: null,
metacatServiceUrl: null,
//objectServiceUrl: null,
resolveServiceUrl: null,
d1LogServiceUrl: null,
nodeServiceUrl: null,
//orcidBaseUrl: "https://sandbox.orcid.org",
//orcidSearchUrl: null,
accountsUrl: null,
pendingMapsUrl: null,
accountMapsUrl: null,
groupsUrl: null,
signInUrl: null,
signOutUrl: null,
signInUrlOrcid: null,
/**
* Enable DataONE LDAP authentication. If true, users can sign in from an LDAP account that is in the DataONE CN LDAP directory.
* This is not recommended, as DataONE is moving towards supporting only ORCID logins for users.
* This LDAP authentication is separate from the File-based authentication for the Metacat Admin interface.
* @type {boolean}
*/
enableLdapSignIn: false,
signInUrlLdap: null,
tokenUrl: null,
// Metadata quality report services
mdqBaseUrl: "https://docker-ucsb-4.dataone.org:30443/quality",
// suidIds and suiteLables must be specified as a list, even if only one suite is available.
mdqSuiteIds: ["FAIR.suite.1"],
mdqSuiteLabels: ["FAIR Suite v1.0"],
// Quality suites for aggregated quality scores (i.e. metrics tab)
mdqAggregatedSuiteIds: ["FAIR.suite.1"],
mdqAggregatedSuiteLabels: ["FAIR Suite v1.0"],
mdqFormatIds:["eml*", "https://eml*", "*isotc211*"],
// Metrics endpoint url
metricsUrl: 'https://logproc-stage-ucsb-1.test.dataone.org/metrics',
// Metrics Falgs for the /profile view (summary view)
hideSummaryCitationsChart: false,
hideSummaryDownloadsChart: false,
hideSummaryMetadataAssessment: true,
hideSummaryViewsChart: false,
// Metrics flags for the Dataset Landing Page
// Enable these flags to enable metrics display
displayDatasetMetrics: true,
// Controlling individual functionality
// Only works if the parent flags displayDatasetMetrics is enabled
displayDatasetMetricsTooltip: true,
displayDatasetCitationMetric: true,
displayDatasetDownloadMetric: true,
displayDatasetViewMetric: true,
displayDatasetEditButton: false,
displayDatasetQualityMetric: false,
displayDatasetAnalyzeButton: false,
displayMetricModals: true,
displayDatasetControls: true,
/* Hide metrics display for SolrResult models that match the given properties.
* Properties can be functions, which are given the SolrResult model value as a parameter.
* Example:
* {
* formatId: "eml://ecoinformatics.org/eml-2.1.1",
* isPublic: true,
* dateUploaded: function(date){
* return new Date(date) < new Date('1995-12-17T03:24:00');
* }
* }
* This example would hide metrics for any objects that are:
* EML 2.1.1 OR public OR were uploaded before 12/17/1995.
*/
hideMetricsWhen: {
},
isJSONLDEnabled: true,
/**
* If true, users can see a "Publish" button in the MetadataView, which makes the metadata
* document public and gives it a DOI identifier.
* If false, the button will be hidden completely.
* @type {boolean}
*/
enablePublishDOI: false,
/**
* A list of users or groups who exclusively will be able to see and use the "Publish" button,
* which makes the metadata document public and gives it a DOI identifier.
* Anyone not in this list will not be able to see the Publish button.
* `enablePublishDOI` must be set to `true` for this to take effect.
* @type {string[]}
*/
enablePublishDOIForSubjects: [],
// If true, then archived content is available in the search index.
// Set to false if this MetacatUI is using a Metacat version before 2.10.0
archivedContentIsIndexed: true,
/**
* Semantic annotation configuration
* Include your Bioportal api key to show ontology information for metadata annotations
* see: http://bioportal.bioontology.org/account
* @type {string}
*/
bioportalAPIKey: "",
/**
* The Bioportal REST API URL, which is set dynamically only if a bioportalAPIKey is configured
* @readonly
* @type {string}
*/
bioportalSearchUrl: "https://data.bioontology.org/search",
/**
* This attribute stores cache of ontology information that is looked up in Bioportal, so that duplicate REST calls don't need to be made.
* @readonly
* @type {object}
*/
bioportalLookupCache: {},
/**
* Set this option to true to display the annotation icon in search result rows when a dataset has an annotation
* @type {boolean}
*/
showAnnotationIndicator: false,
/**
* If true, users can change the AccessPolicy for their objects.
* @type {boolean}
*/
allowAccessPolicyChanges: false,
/**
* The default Access Policy set on new objects uploaded to the repository.
* Each literal object here gets set directly on an AccessRule model.
* See the AccessRule model list of default attributes for options on what to set here.
* @see {@link AccessRule}
* @type {object}
*/
defaultAccessPolicy: [{
subject: "CN=arctic-data-admins,DC=dataone,DC=org",
read: true,
write: true,
changePermission: true
}],
/**
* The user-facing name for editing the Access Policy. This is displayed as the header of the AccessPolicyView, for example
* @type {string}
*/
accessPolicyName: "Sharing options",
/**
* @type {object}
* @property {boolean} accessRuleOptions.read - If true, users will be able to give others read access to their DataONE objects
* @property {boolean} accessRuleOptions.write - If true, users will be able to give others write access to their DataONE objects
* @property {boolean} accessRuleOptions.changePermission - If true, users will be able to give others changePermission access to their DataONE objects
*/
accessRuleOptions: {
read: true,
write: true,
changePermission: true
},
/**
* @type {object}
* @property {boolean} accessRuleOptionNames.read - The user-facing name of the "read" access in Access Rules
* @property {boolean} accessRuleOptionNames.write - The user-facing name of the "write" access in Access Rules
* @property {boolean} accessRuleOptionNames.changePermission - The user-facing name of the "changePermission" access in Access Rules
*/
accessRuleOptionNames: {
read: "Can view",
write: "Can edit",
changePermission: "Is owner"
},
/**
* Set to false to hide the display of "My Portals", which shows the user's current portals
* @type {boolean}
*/
showMyPortals: false,
/**
* The user-facing term for portals in lower-case and in singular form.
* e.g. "portal"
* @type {string}
*/
portalTermSingular: "portal",
/**
* The user-facing term for portals in lower-case and in plural form.
* e.g. "portals". This allows for portal terms with irregular plurals.
* @type {string}
*/
portalTermPlural: "portals",
/**
* Set to false to prevent ANYONE from creating a new portal.
* @type {boolean}
*/
enableCreatePortals: true,
/**
* Limits only the following people or groups to create new portals.
* @type {string[]}
*/
limitPortalsToSubjects: [],
/**
* The list of labels that should be blacklisted while
* @type {string[]}
*/
portalLabelBlacklist: [
'urn:node:CN', 'CN', 'cn',
'urn:node:CNUNM1', 'CNUNM1', 'cn-unm-1',
'urn:node:CNUCSB1', 'CNUCSB1', 'cn-ucsb-1',
'urn:node:CNORC1', 'CNORC1', 'cn-orc-1',
'urn:node:KNB', 'KNB', 'KNB Data Repository',
'urn:node:ESA', 'ESA', 'ESA Data Registry',
'urn:node:SANPARKS', 'SANPARKS', 'SANParks Data Repository',
'urn:node:ORNLDAAC', 'ORNLDAAC', 'ORNL DAAC',
'urn:node:LTER', 'LTER', 'U.S. LTER Network',
'urn:node:CDL', 'CDL', 'UC3 Merritt',
'urn:node:PISCO', 'PISCO', 'PISCO MN',
'urn:node:ONEShare', 'ONEShare', 'ONEShare DataONE Member Node',
'urn:node:mnORC1', 'mnORC1', 'DataONE ORC Dedicated Replica Server',
'urn:node:mnUNM1', 'mnUNM1', 'DataONE UNM Dedicated Replica Server',
'urn:node:mnUCSB1', 'mnUCSB1', 'DataONE UCSB Dedicated Replica Server',
'urn:node:TFRI', 'TFRI', 'TFRI Data Catalog',
'urn:node:USANPN', 'USANPN', 'USA National Phenology Network',
'urn:node:SEAD', 'SEAD', 'SEAD Virtual Archive',
'urn:node:GOA', 'GOA', 'Gulf of Alaska Data Portal',
'urn:node:KUBI', 'KUBI', 'University of Kansas - Biodiversity Institute',
'urn:node:LTER_EUROPE', 'LTER_EUROPE', 'LTER Europe Member Node',
'urn:node:DRYAD', 'DRYAD', 'Dryad Digital Repository',
'urn:node:CLOEBIRD', 'CLOEBIRD', 'Cornell Lab of Ornithology - eBird',
'urn:node:EDACGSTORE', 'EDACGSTORE', 'EDAC Gstore Repository',
'urn:node:IOE', 'IOE', 'Montana IoE Data Repository',
'urn:node:US_MPC', 'US_MPC', 'Minnesota Population Center',
'urn:node:EDORA', 'EDORA', 'Environmental Data for the Oak Ridge Area (EDORA)',
'urn:node:RGD', 'RGD', 'Regional and Global biogeochemical dynamics Data (RGD)',
'urn:node:GLEON', 'GLEON', 'GLEON Data Repository',
'urn:node:IARC', 'IARC', 'IARC Data Archive',
'urn:node:NMEPSCOR', 'NMEPSCOR', 'NM EPSCoR Tier 4 Node',
'urn:node:TERN', 'TERN', 'TERN Australia',
'urn:node:NKN', 'NKN', 'Northwest Knowledge Network',
'urn:node:USGS_SDC', 'USGS_SDC', 'USGS Science Data Catalog',
'urn:node:NRDC', 'NRDC', 'NRDC DataONE member node',
'urn:node:NCEI', 'NCEI', 'NOAA NCEI Environmental Data Archive',
'urn:node:PPBIO', 'PPBIO', 'PPBio',
'urn:node:NEON', 'NEON', 'NEON Member Node',
'urn:node:TDAR', 'TDAR', 'The Digital Archaeological Record',
'urn:node:ARCTIC', 'ARCTIC', 'Arctic Data Center',
'urn:node:BCODMO', 'BCODMO', 'Biological and Chemical Oceanography Data Management Office (BCO-DMO) ',
'urn:node:GRIIDC', 'GRIIDC', 'Gulf of Mexico Research Initiative Information and Data Cooperative (GRIIDC)',
'urn:node:R2R', 'R2R', 'Rolling Deck to Repository (R2R)',
'urn:node:EDI', 'EDI', 'Environmental Data Initiative',
'urn:node:UIC', 'UIC', 'A Member Node for University of Illinois at Chicago.',
'urn:node:RW', 'RW', 'Research Workspace',
'urn:node:FEMC', 'FEMC', 'Forest Ecosystem Monitoring Cooperative Member Node',
'urn:node:OTS_NDC', 'OTS_NDC', 'Organization for Tropical Studies - Neotropical Data Center',
'urn:node:PANGAEA', 'PANGAEA', 'PANGAEA',
'urn:node:ESS_DIVE', 'ESS_DIVE', 'ESS-DIVE: Deep Insight for Earth Science Data',
'urn:node:CAS_CERN', 'CAS_CERN', 'Chinese Ecosystem Research Network (CERN)',
'urn:node:FIGSHARE_CARY', 'FIGSHARE_CARY', 'Cary Institute of Ecosystem Studies (powered by Figshare)',
'urn:node:IEDA_EARTHCHEM', 'IEDA_EARTHCHEM', 'IEDA EARTHCHEM',
'urn:node:IEDA_USAP', 'IEDA_USAP', 'IEDA USAP',
'urn:node:IEDA_MGDL', 'IEDA_MGDL', 'IEDA MGDL',
'urn:node:METAGRIL', 'METAGRIL', 'metaGRIL',
'urn:node:ARM', 'ARM', 'ARM - Atmospheric Radiation Measurement Research Facility'
],
/**
* A list of unsupported User-Agent regular expressions for browsers that will not work well with MetacatUI.
* A warning message will display on the page for anyone using one of these browsers.
* @type {RegExp[]}
*/
unsupportedBrowsers: [/(?:\b(MS)?IE\s+|\bTrident\/7\.0;.*\s+rv:)(\d+)/]
/**
* The following configuration options are deprecated or experimental and should only be changed by advanced users
*/
/**
* This Bioportal REST API URL is used by the experimental and unsupported AnnotatorView to get multiple ontology class info at once.
* @deprecated
*/
//bioportalBatchUrl: "https://data.bioontology.org/batch",
/**
* This DataONE API Annotator URL is used by the experimental and unsupported AnnotatorView to save an annotation
* @deprecated
*/
//annotatorUrl: null,
},
defaultView: "data",
initialize: function() {
if(!this.get("baseUrl")){
this.set("baseUrl", this.get("d1CNBaseUrl"));
this.set("d1Service", this.get("d1CNService"));
}
this.set('metacatBaseUrl', this.get('baseUrl') + this.get('context'));
this.set('authServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/isAuthorized/');
this.set('queryServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/query/solr/?');
this.set('metaServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/meta/');
//this.set('objectServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/object/');
this.set('resolveServiceUrl', this.get('d1CNBaseUrl') + this.get('d1Service') + '/resolve/');
this.set('nodeServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/node');
this.set("reserveServiceUrl", this.get("d1CNBaseUrl") + this.get("d1CNService") + "/reserve");
//This URL construction needs to be changed since, if enabled, because it is a MN API
if( this.get("enableMonitorStatus") ){
this.set("monitorStatusUrl", this.get('baseUrl') + this.get('context') + this.get('d1Service') + "/monitor/status");
}
// Metadata quality report services
this.set('mdqSuitesServiceUrl', this.get("mdqBaseUrl") + "/suites/");
this.set('mdqRunsServiceUrl', this.get('mdqBaseUrl') + "/runs/");
this.set('mdqScoresServiceUrl', this.get('mdqBaseUrl') + "/scores/");
//The logs index
if(typeof this.get("d1LogServiceUrl") !== "undefined"){
this.set('d1LogServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/query/logsolr/?');
}
//The account management links
if(typeof this.get("accountsUrl") != "undefined"){
this.set("groupsUrl", this.get("baseUrl") + this.get("d1Service") + "/groups/");
this.set("accountsUrl", this.get("baseUrl") + this.get("d1Service") + "/accounts/");
this.set("pendingMapsUrl", this.get("accountsUrl") + "pendingmap/");
this.set("accountsMapsUrl", this.get("accountsUrl") + "map/");
}
//The view service for member node installations of metacatui
this.set('viewServiceUrl', this.get('baseUrl') + this.get('d1CNService') + '/views/metacatui/');
//Authentication / portal URLs
this.set('portalUrl', this.get('d1CNBaseUrl') + '/portal/');
this.set('tokenUrl', this.get('portalUrl') + 'token');
//Annotator API
if(typeof this.get("annotatorUrl") !== "undefined")
this.set('annotatorUrl', this.get('d1CNBaseUrl') + '/portal/annotator');
//The sign-in and out URLs - allow these to be turned off by removing them in the defaults above (hence the check for undefined)
if(typeof this.get("signInUrl") !== "undefined"){
this.set("signInUrl", this.get('portalUrl') + "startRequest?target=");
this.set("signOutUrl", this.get('portalUrl') + "logout");
}
if(typeof this.get("signInUrlOrcid") !== "undefined")
this.set("signInUrlOrcid", this.get('portalUrl') + "oauth?action=start&target=");
if(this.get("enableLdapSignIn") && !this.get("signInUrlLdap")){
this.set("signInUrlLdap", this.get('portalUrl') + "ldap?target=");
}
if(this.get('orcidBaseUrl'))
this.set('orcidSearchUrl', this.get('orcidBaseUrl') + '/v1.1/search/orcid-bio?q=');
//The package service for v2 DataONE API
this.set('packageServiceUrl', this.get('baseUrl') + this.get('d1Service') + '/packages/application%2Fbagit-097/');
//Only use these settings in production
if(this.get("baseUrl").indexOf("search.dataone.org") > -1)
this.set("googleAnalyticsKey", "UA-15017327-17");
//Deprecated -- this is the old bioportal search URL used by the AnnotatorView
/*
if((typeof this.get("bioportalAPIKey") == "string") && this.get("bioportalAPIKey").length)
this.set("bioportalSearchUrl", "?ontologies=ECSO&apikey=" + this.get("bioportalAPIKey") + "&pagesize=1000&suggest=true&q=")
*/
this.on("change:pid", this.changePid);
},
changePid: function(model, name){
this.set("previousPid", model.previous("pid"));
}
});
return AppModel;
});