Plugins can be used to extend the functionality of biblios. Biblios loads all plugins defined and enabled in the biblios.xml configuration file.
Plugin configuration
Each plugin should have a stanza like this in the biblios.xml configuration file under the <plugins> section:
<plugin> <name>CouchDb Network</name> <type>externalInterface</type> <file>plugins/bibliosCouch/bibliosCouch.js</file> <initcall></initcall> <enabled>1</enabled> <allowDelete>0</allowDelete> <allowModify>0</allowModify> </plugin>
Loading plugins
During the main biblios application loading, biblios uses the Jquery $.getScript(filename) method to dynamically load the plugin into the browser.
biblios.app events
Plugins may listen for events that the main biblios.app application fires upon doing certain actions. To listen for an event, do something like the following:
function addSomethingToSendMenu(menuID) {
// add an extjs menu item to menuID here
}
biblios.app.on('updatesendmenu', addSomethingToSendMenu);
biblios.app events are documented in ui/js/biblios.js. They are:
beforesearch
params:
searchWhere: array of target(s) being searched
searchQuery: search query being sent to targets
searchcomplete
remoterecordretrieve
params: xml document of retrieved record
beforeeditrecord
params: xml string of record to edit, editor id where record is to be opened
beforesaverecord
params:
savefileid: savefile where record is to be saved
editorid: editor id where record is being saved from
offset: offset used for record retrieval from pazpar2 (optional)
saverecordcomplete
params:
savefileid: id of save file where record was saved
xml: xml string of record saved
beforesendrecord
params:
loc: location record is being saved to
xmldoc: xml document of record being saved
editorid: id of editor record is being saved from
sendrecordcomplete
params:
loc: location where record was (attempted to be) saved
xmldoc: xml document of record as returned from remote server
status: status of request to server
updatesendmenu
params:
menu: Ext menu component being updated
updatesavemenu
params:
menu: Ext menu component being updated
beforerecordexport
params:
record: xml string of record being exported
Interacting with biblios UI components
Plugins can use ExtJS methods to interact with biblios UI components.
An example might be adding a folder to the left hand sidebar.
// resourcesPanel is the extjs component id of the left hand biblios sidebar
Ext.getCmp('resourcesPanel').items.get(0).items.add(
new Ext.tree.TreePanel({
id: 'myNewFolder'
,autoScroll:true
,leaf:false
,root: new Ext.tree.AsyncTreeNode({
text:'My New Folder'
,leaf:true
,icon: libPath + 'lib/extjs2/resources/images/default/tree/folder-open.gif'
,listeners: {
click: function(n,e) {
// do something use when the user clicks us
}
}
,loader: new Ext.tree.TreeLoader({
}) //couchdb loader
}) // couchdb root
})
);
// force biblios' sidebar to display the new folder
Ext.getCmp('resourcesPanel').doLayout();
See the following list of biblios UI components for a list of possible components to interact with.
biblios User Interface Elements by id
Principal biblios extjs components by id
Biblio tab
Bibliographic tab: Ext.getCmp('bibliotab')
- Search grid: Ext.getCmp('searchgrid')
- Save grid: Ext.getCmp('savegrid')
- Editors panel in side bar: Ext.getCmp('editingTreePanel')
- Searching panel in side bar: Ext.getCmp('TargetsTreePanel')
- Facets tree panel: Ext.getCmp('facetsTreePanel')
- Folders panel in side bar: Ext.getCmp('FoldersTreePanel')
Options tab
Options tab: Ext.getCmp('optionstab')
- Search targets grid: Ext.getCmp('searchtargetsgrid')
- Send targets grid: Ext.getCmp('sendtargetsgrid')
- Macros grid: Ext.getCmp('macrosgrid')