GeoNetwork.Catalogue

Extends
xtype
gn_catalogue
class GeoNetwork.GeoNetwork(config)

Create a GeoNetwork catalogue client.

Catalogue client is recommended to be running on the same host as the catalogue in order to be used without a proxy for XHR requests. Catalogue could run with a proxy but some functionnalities will not be able because they require a continuity in the session (often broken by the use of a proxy).

If the application need both cross domain and local domain XHR Request configure OpenLayers.ProxyHost with the following:

OpenLayers.ProxyHost = function(url) {
  if (url.indexOf(window.location.host)!=-1) {
    return url;
  } else {
    return OpenLayers.ProxyHostURL + encodeURIComponent(url);
  }
};

To be improved & discussed :

  • i18n : generate from GeoNetwork file ?
  • memory usage (eg. destroy calls)
  • massive action : hack made embedded existing HTML page in a panel

and overriding JS in Old.js

  • search form : remote & Z39.50
  • global var named catalogue required (eg. Templates) should be improved, How ?
  • add more events to component in order to reduce dependencies
  • session state ? using localStorage or cookie ?

Example Use

Sample code to create a GeoNetwork catalogue connection on the same host as the web page (ig. http://localhost/geonetwork will be the default connection url):

var catalogue = new GeoNetwork.Catalogue({
  metadataStore : GeoNetwork.data.MetadataResultsStore(),
  summaryStore : GeoNetwork.data.MetadataSummaryStore()
});

Config Options

Configuration properties in addition to those listed for Ext.util.Observable.

adminAppUrl

String URL to the administration interface TODO : should we go to admin service by default ?

hostUrl
String Optional GeoNetwork host name.

Default value is web page host name.

api: example
var catalogue = new GeoNetwork.Catalogue({
    hostUrl : 'http://www.fao.org/',
    servlet : 'geonetwork'
});
mdDisplayPanelId

String Optional identifier of a panel to use to display metadata

mdOverlayedCmpId

String Not used for now

mdStore

GeoNetwork.data.MetadataResultsStore A store holding search results (see GeoNetwork.data.MetadataResultsStore )

resultsView

String Optional metadata results view panel

servlet

String Optional GeoNetwork servlet name. Default value is geonetwork.

statusBarId

String Optional identifier of an Ext.Element or a DOM element to be use to display status information.

summaryStore

GeoNetwork.data.MetadataSummaryStore The store for search summary results (see GeoNetwork.data.MetadataSummaryStore ).

Public Properties

Public properties in addition to those listed for Ext.util.Observable.

Catalogue.identifiedUser

Object Current user information and role.

Catalogue.LANG

String Default language

Catalogue.SERVERURL

String GeoNetwork catalogue host URL.

Catalogue.services

Object The list of GeoNetwork services

Catalogue.startRecord

Number Index of the first record for current search

Catalogue.URL

String GeoNetwork catalogue URL.

Catalogue.windowName

String Name of popup windows

FIXME : this is always the same, assumming the main app will always popup in the same window. Maybe that’s not a good idea in order to allow multi editors for example.

Catalogue.windowOption

String Configuration of popup windows

Public Methods

Public methods in addition to those listed for Ext.util.Observable.

Catalogue.admin()

Open the administration interface according to adminAppUrl properties.

Catalogue.checkError()

Check if catalogue started correctly

Parameters:successCb – A callback to run on success. Argument this and response are passed as parameters.
Catalogue.csvExport()

Export current selection in CSV format.

Catalogue.cswSearch()
Parameters:
  • formIdString An Ext.Form identifier
  • onSuccessFunction or null A function to trigger in case of success (Ext.emptyFn by default)
  • onFailureFunction or null A function to trigger in case of failure (Ext.emptyFn by default)
  • startRecordNumber or null The start record for the search (Default is 1). The number of records returned by a search is defined by an E_hits_per_page field defined in the form. If not default value is used.

Run a CSW search operation using GeoNetwork csw service. Initialize results and summary stores.

Catalogue.doAction()
Parameters:
  • urlString The service URL to call
  • paramsObject The service parameters
  • msgSuccessString Optional popup title on success
  • msgFailureString Optional popup title on failure
  • onSuccessFunction Optional function to trigger on success
  • onFailureFunction Optional function to trigger on failure

Method called to run a GeoNetwork service and popup a message after success and failure.

TODO : create a status or popup bar object to display info

Catalogue.getInfo()
Parameters:refreshboolean force refreshing the catalog info if not available.

Return catalogue information (site name, organization, id, casEnabled).

Catalogue.getInspireInfo()

Return catalogue inspire information (enable, enableSearchPanel).

Catalogue.isAdmin()

Return true if current user is an admin

Catalogue.isIdentified()

FIXME : return Object

Catalogue.isLoggedIn()

Get the xml.info for me. If user is not identified response xml will have a me element with an authenticated attribute. If catalogue URL is wrong, response status is 404 (check catalogue URL). In case of exception continue catalogue connection validation using the xml.main.error service (@see checkError).

Catalogue.isReadOnly()

Return true if GN is is read-only mode

Catalogue.kvpSearch()
Parameters:
  • queryString A KVP search string (eg. any=africa to do a full text search for africa). All GeoNetwork search terms could be used.
  • onSuccessFunction or null A function to trigger in case of success (Ext.emptyFn by default).
  • onFailureFunction or null A function to trigger in case of failure (Ext.emptyFn by default).
  • startRecordNumber or null The start record for the search (Default is 1). The number of records returned by a search is defined by an E_hits_per_page field defined in the form. If not default value is used.
  • updateStoreBoolean true to update catalogue attached stores.
  • asyncBoolean false to run in synchrone mode. Default is true.

Run a search operation based on KVP query using GeoNetwork xml.search service. Initialize results and summary stores. KVP search could be used in fast mode in order to quickly populate a summary store (for a TagCloud for example).

Catalogue.login()
Parameters:
  • usernameString The user name
  • passwordString The password for the user

Log in to the catalogue.

Fires the afterLogin or afterBadLogin events
TODO : GeoNetwork does not return any information about the
user. Those information are required in the client side.
Catalogue.logout()

Log out from the catalogue.

Fires the afterLogout or afterBadLogout events
Catalogue.massiveOp()
Parameters:type – Type of massive operation. One of NewOwner, Categories, Delete, Privileges

Load massive operation in a window align to top and centered.

TODO : Could we have a window like a modal box ? no bottom borders.

FIXME : Need work on GeoNetwork side to fix JS calls

Catalogue.mefExport()

Export current selection in MEF format.

Catalogue.metadataAdmin()

Metadata admin form for privileges

Catalogue.metadataCategory()

Metadata admin form for categories

Catalogue.metadataCreateChild()
Parameters:uuidString Uuid of the metadata to duplicate

Create a child metadata record from an existing one

Catalogue.metadataDelete()
Parameters:uuidString Uuid of the metadata

Delete metadata record.

Catalogue.metadataDuplicate()
Parameters:uuidString Uuid of the metadata to duplicate

Create a metadata by duplication of an existing one

Catalogue.metadataDuplicateWithSchema()
Parameters:schemaString Schema

Create a metadata record in one of the schema

Catalogue.metadataEdit()
Parameters:uuidString Uuid of the metadata record to edit

Open a metadata editor.

FIXME : metadata.edit service does not support uuid param

Catalogue.metadataMEF()
Parameters:uuidString uuid of the metadata to export in MEF format

Open new window to retrieve MEF file for the metadata record

Catalogue.metadataPrepareDownload()

Prepare download metadata popup

Catalogue.metadataRate()
Parameters:
  • uuidString Metadata identifier
  • ratingNumber Rate

Update metadata record rating information

Catalogue.metadataSelect()
Parameters:uuidsArray(String) A list of uuids to select.

Add uuids to current user selection.

Catalogue.metadataSelectAll()
Parameters:onSuccessFunction A function to trigger in case of success.

Select all records in current search.

Catalogue.metadataSelectNone()
Parameters:onSuccessFunction A function to trigger in case of success.

Remove all records in current selection.

Catalogue.metadataShow()
Parameters:uuidString uuid of the metadata to dislay

Display a metadata record in a Ext.Panel or a Ext.Window. Defined GeoNetwork.defaultViewMode variable to change default view mode. If not set, simple mode is used.

Define metadataShowFn in order to override metadata show default behavior:

this.metadataShowFn(uuid, record, url, maximized, width, height);
Catalogue.metadataStatus()

Change status for this metadata

Catalogue.metadataVersioning()

Active versioning for this metadata

Catalogue.metadataXMLShow()
Parameters:uuidString uuid of the metadata to dislay

Display a metadata record in a new window in XML format

Catalogue.onAfterBadLogin()
Parameters:eObject

The “onAfterBadLogin” listener.

Catalogue.onAfterBadLogout()
Parameters:eObject

The “onAfterBadLogout” listener.

Catalogue.onAfterDelete()
Parameters:eObject

The “onAfterDelete” listener.

Listeners will be called with the following arguments:

  • this : GeoNetwork.Catalogue
Catalogue.onAfterLogin()
Parameters:eObject

The “onAfterLogin” listener.

Listeners will be called with the following arguments:

  • this : GeoNetwork.Catalogue
  • user : Current user FIXME
Catalogue.onAfterLogout()
Parameters:eObject

The “onAfterLogout” listener.

Catalogue.onAfterRating()
Parameters:eObject

The “onAfterDelete” listener.

Listeners will be called with the following arguments:

  • this : GeoNetwork.Catalogue
Catalogue.parseError()

Parse a GeoNetwork startup error exception.

Parameters:xml – The xml error
Catalogue.pdfExport()
Parameters:
  • sortFieldString sort field name
  • sortOrderString sort order

Export current selection in PDF format.

Catalogue.search()
Parameters:
  • formIdString An Ext.Form identifier.
  • onSuccessFunction or null A function to trigger in case of success (Ext.emptyFn by default).
  • onFailureFunction or null A function to trigger in case of failure (Ext.emptyFn by default).
  • startRecordNumber or null The start record for the search (Default is 1). The number of records returned by a search is defined by an E_hits_per_page field defined in the form. If not default value is used.
  • updateStoreBoolean false to not update catalogue stores. Default to true.
  • metadataStoreGeoNetwork.data.MetadataResultsStore or GeoNetwork.data.MetadataResultsFastStore the metadata store to use. If undefined, catalogue metadata store
  • summaryStoreGeoNetwork.data.MetadataSummaryStore the summary store to use. If undefined, the catalogue summary store.
  • asyncBoolean false to run in synchrone mode. Default is true.

Run a search operation using GeoNetwork xml.search service. Initialize results and summary stores.

Catalogue.showError()

Display an alert message box.

Parameters:
  • title – The message box title
  • msg – The message in the box