Difference between revisions of "Extension Packages"
m (Typo correction - reposityory -> repository) |
|||
(7 intermediate revisions by 5 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:Contribute]] | |
− | An extension package is a .tgz file containing multiple files which adds a suite of functionality when unpacked in the /opt/eprint3 directory. | + | [[Category:Plugins]] |
+ | An extension package is a .tgz file containing multiple files which adds a suite of functionality when unpacked in the /opt/eprint3/archives/ARCHIVE_ID/ directory. | ||
An extension can be as simple as a plugin plus a css file or add a whole exciting suite of new features. | An extension can be as simple as a plugin plus a css file or add a whole exciting suite of new features. | ||
Line 6: | Line 7: | ||
Things you might want to put into an eprints extension package: | Things you might want to put into an eprints extension package: | ||
− | * Plugins: | + | * Plugins: archives/ARCHIVE_ID/cfg/plugins/EPrints/Plugin/... |
* Themes: lib/themes/... | * Themes: lib/themes/... | ||
− | * scripts: bin/... | + | * scripts: archives/ARCHIVE_ID/bin/... |
− | * CGI scripts: cgi/... | + | * CGI scripts: archives/ARCHIVE_ID/cgi/... |
− | * autocompletion scripts: cgi/users/lookup/... | + | * autocompletion scripts: archives/ARCHIVE_ID/cgi/users/lookup/... |
− | * phrase files for use by plugins or scripts: | + | * phrase files for use by plugins or scripts: archives/ARCHIVE_ID/cfg/lang/.../phrases/... |
− | * images, icons, javascript and css files to support your plugins or scripts: | + | * images, icons, javascript and css files to support your plugins or scripts: archives/ARCHIVE_ID/cfg/static/... |
Other things you might want to include are... | Other things you might want to include are... | ||
Line 18: | Line 19: | ||
* repository specific phrase files | * repository specific phrase files | ||
* autocompletion data files | * autocompletion data files | ||
− | |||
− | |||
The handy thing is that plugins are autoloaded, .xml files in the phrases directory are autoloaded and .pl files in the archive cfg.d are autoloaded. So if you want to give your plugin some config options, you could just give a .pl file to copy into the cfg.d/ dir looking something like. | The handy thing is that plugins are autoloaded, .xml files in the phrases directory are autoloaded and .pl files in the archive cfg.d are autoloaded. So if you want to give your plugin some config options, you could just give a .pl file to copy into the cfg.d/ dir looking something like. | ||
Line 25: | Line 24: | ||
$c->{extension}->{my_cool_extension}->{option_1} = 1; | $c->{extension}->{my_cool_extension}->{option_1} = 1; | ||
$c->{extension}->{my_cool_extension}->{keep_alive} = "always"; | $c->{extension}->{my_cool_extension}->{keep_alive} = "always"; | ||
+ | |||
+ | And access it in your code like: | ||
+ | |||
+ | $option_1 = $plugin->{repository}->conf( "extension", "my_cool_extension", "option_1" ) | ||
etc. | etc. | ||
You could use a shorter path in the $c datastructure, but try and make sure it's distinct to your extension so clashes don't happen. | You could use a shorter path in the $c datastructure, but try and make sure it's distinct to your extension so clashes don't happen. | ||
+ | |||
+ | $c->{PreviewPlus_alignment} = "vertical"; | ||
+ | |||
+ | and then | ||
+ | |||
+ | $option_1 = $plugin->{repository}->conf( "PreviewPlus_alignment" ); |
Latest revision as of 15:27, 8 November 2023
An extension package is a .tgz file containing multiple files which adds a suite of functionality when unpacked in the /opt/eprint3/archives/ARCHIVE_ID/ directory.
An extension can be as simple as a plugin plus a css file or add a whole exciting suite of new features.
Things you might want to put into an eprints extension package:
- Plugins: archives/ARCHIVE_ID/cfg/plugins/EPrints/Plugin/...
- Themes: lib/themes/...
- scripts: archives/ARCHIVE_ID/bin/...
- CGI scripts: archives/ARCHIVE_ID/cgi/...
- autocompletion scripts: archives/ARCHIVE_ID/cgi/users/lookup/...
- phrase files for use by plugins or scripts: archives/ARCHIVE_ID/cfg/lang/.../phrases/...
- images, icons, javascript and css files to support your plugins or scripts: archives/ARCHIVE_ID/cfg/static/...
Other things you might want to include are...
- configuration files
- repository specific phrase files
- autocompletion data files
The handy thing is that plugins are autoloaded, .xml files in the phrases directory are autoloaded and .pl files in the archive cfg.d are autoloaded. So if you want to give your plugin some config options, you could just give a .pl file to copy into the cfg.d/ dir looking something like.
$c->{extension}->{my_cool_extension}->{option_1} = 1; $c->{extension}->{my_cool_extension}->{keep_alive} = "always";
And access it in your code like:
$option_1 = $plugin->{repository}->conf( "extension", "my_cool_extension", "option_1" )
etc.
You could use a shorter path in the $c datastructure, but try and make sure it's distinct to your extension so clashes don't happen.
$c->{PreviewPlus_alignment} = "vertical";
and then
$option_1 = $plugin->{repository}->conf( "PreviewPlus_alignment" );