Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1203 closed enhancement (fixed)

Widget - Customised OtherAction menu and Metadata menu

Reported by: fgravin Owned by: geonetwork-devel@…
Priority: major Milestone: v2.10.0 RC0
Component: General Version: v2.8.0RC2
Keywords: Cc:

Description

Give possibility to add customised actions in otherAction menu (MetadataResultsToolbar) and MetadataMenu (MetadataResultsView).

  • otherActionMenu

Pass customOtherActions attribute to the GeoNetwork.MetadataResultsToolbar as a Menu.Item type (array of actions, action, etc..)

Exemple :

        var extractAction = new Ext.Action({
            text: 'Extract Data',
            handler: extractMetadata
        });
        
        var visuAction = new Ext.Action({
            text: 'Visualize data',
            handler: extractMetadata
        });
        
        tBar = new GeoNetwork.MetadataResultsToolbar({
            catalogue: catalogue,
            searchFormCmp: Ext.getCmp('searchForm'),
            sortByCmp: Ext.getCmp('E_sortBy'),
            metadataResultsView: metadataResultsView,
            permalinkProvider: permalinkProvider,
            customOtherActions: [extractAction,visuAction]
        });
  • Add custom Action

Pass addCustomAction parameter as a function to the GeoNetwork.MetadataResultsView. This function will be called on MetadataMenu init method.

Exemple :

            addCustomAction: function() {
            	var id = this.record.get('id');
            	
            	var extractAction = new Ext.Action({
                    text: 'Extract Data',
                    handler: function() {
                    	extractMetadata(id);
                    }
                });
                var visuAction = new Ext.Action({
                    text: 'Visualize data',
                    handler: function() {
                    	extractMetadata(id);
                    }
                });
            	this.insert(0,visuAction);
            	this.insert(0,extractAction);
            }
  • Completly change configuration

If you want to completly change the MetadaMenu configuration (remove component, change order, add submenus etc..), you can override composeMenu() method of GeoNetwork.MetadataMenu

            this.contextMenu = new GeoNetwork.MetadataMenu({
                floating: true,
                catalogue: catalogue,
                record: record,
                resultsView: dv,
                composeMenu: function(){
                    this.add(this.editAction);
                    this.add(this.deleteAction);
                    this.add(this.duplicateAction);
                    this.add(this.adminAction);
                    this.add(this.categoryAction);
                    this.add(this.createChildAction);
                    this.add(this.statusAction);
                    this.add(this.versioningAction);
                    
                }
            });

Change History (2)

comment:1 by fgravin, 12 years ago

Resolution: fixed
Status: newclosed
Type: defectenhancement

comment:2 by ianwallen, 12 years ago

Fixed in master commit commit 616039ee8bb50b646a663b7841d905621dc98df7

Note: See TracTickets for help on using tickets.