Will Moore
$ omero config append omero.web.open_with '["My viewer", "url_name"]'
reverse(url_name)
to try to generate url.
$ omero config append omero.web.open_with '["OMERO.figure", "new_figure",
{"objects": ["images", "dataset"],
"target": "tab"
}]'
$ omero config append omero.web.open_with '["OMERO.figure", "new_figure",
{"script": "figure/openwith.js", "target": "tab"}]'
// openwith.js
var isEnabled = function(selected) {
// return boolean - should 'Open With' be enabled
// with the currently 'selected' objects?
return true;
};
var handleAction = function(selected, url) {
// handle selected objects
};
// helpers for applying handlers to Open With 'OMERO.figure'
OME.setOpenWithEnabledHandler("OMERO.figure", isEnabled);
OME.setOpenWithActionHandler("OMERO.figure", handleAction);
// openwith.js
var isEnabled = function(selected) {
var allImagesSmall = selected.reduce(function(prev, s){
// We don't support 'Big' images over 3k x 3k
var smallImg = (s.type === 'image' && s.sizeX * s.sizeY < 9000000);
// We support OMERO.figure files (annotations with correct namespace)
var figureFile = (s.type === 'fileannotation' &&
s.ns === 'omero.web.figure.json');
return prev & (smallImg || figureFile);
}, true);
return allImagesSmall;
};
var handleAction = function(selected, url) {
// if we have a figure file, handle it
if (selected[0].type === "fileannotation") {
// url is for figure/new/ but for files we want figure/file/:id
window.open(url.replace('new', 'file') + selected[0].id + "/",
'_blank');
return false;
}
// Otherwise, return true and default behaviour will handle it...
return true;
};
OME.setOpenWithEnabledHandler("OMERO.figure", isEnabled);
OME.setOpenWithActionHandler("OMERO.figure", handleAction);
// openwith.js
var isEnabled = function(selected) {
// Only enabled for single objects...
if (selected.length !== 1) return false;
// ... where name is a number (E.g. Gene ID)
var name = selected[0].name;
return (parseInt(name, 10) == name);
};
var handleAction = function(selected, url) {
// Url includes selected 'name' which is an Gene ID
var name = selected[0].name;
// E.g. open http://www.ncbi.nlm.nih.gov/protein/000397
window.open(url + name, 'new');
};
OME.setOpenWithEnabledHandler("GenBank Protein", isEnabled);
OME.setOpenWithActionHandler("GenBank Protein", handleAction);
{
'images': [
{'id': 123, 'name': 'myImage.dv'...}
],
'count': 3152
}
# If it's just a selection change,
# simply highlight (don't re-render whole panel)
if (parentId === newParentId
&& event.type !== "load_node"
&& event.type !== "delete_node") {
highlightSelectedThumbs(selected);
return;
}
if (parentId === newParentId
+ && event.type !== "copy_node"
+ && event.type !== "create_node"
&& event.type !== "load_node"
&& event.type !== "delete_node"
&& event.type !== "refreshThumb" {
< ImageIcon >
render: function() {
var image = this.props.image,
cls = [];
if (image.selected) {cls.push('ui-selected')};
if (image.fsSelected) {cls.push('fs-selected')};
return (
< li className={"row " + cls.join(" ")} >
< img width={this.props.iconSize + "px"}
...