pandora_cms/static/js/localInit.cms.js

64 lines
1.9 KiB
JavaScript
Raw Normal View History

2018-08-08 10:59:08 +00:00
2018-08-08 11:01:52 +00:00
pandora.localInit = function() {
2018-08-08 10:59:08 +00:00
var plugins = [];
if (pandora.user.level == 'admin') {
plugins.push(ExtrasMenu());
}
plugins.length && load();
function load() {
patchReload();
plugins.forEach(function(plugin) { plugin.load() });
}
function patchReload() {
var reload = pandora.$ui.appPanel.reload;
pandora.$ui.appPanel.reload = function() {
reload();
load();
}
}
function ExtrasMenu() {
var that = {};
var css = {
//margin: '2px',
},
$item = Ox.MenuButton({
items: [
{id: 'rename', title: 'Rename Keyword...'},
{id: 'manage', title: 'Manage Keywords...'},
2018-08-10 10:39:23 +00:00
{id: 'correlations', title: 'Show Correlations...'},
{id: 'ontology', title: 'Open Ontology Graph'},
2018-08-08 10:59:08 +00:00
],
style: 'rounded',
title: 'set',
tooltip: Ox._('Extras'),
type: 'image'
}).css(css).bindEvent({
click: function(data) {
if (data.id == 'rename') {
pandora.ui.renameKeywordDialog().open()
} else if (data.id == 'manage') {
pandora.ui.manageKeywordsDialog().open()
2018-08-10 10:59:28 +00:00
} else if (data.id == 'correlations') {
2018-08-10 10:39:23 +00:00
pandora.ui.correlationsDialog().open()
2018-08-08 10:59:08 +00:00
} else if (data.id == 'ontology') {
pandora.openLink('/static/ontology/');
2018-08-08 10:59:08 +00:00
}
},
}),
plugins = [];
that.load = function() {
pandora.$ui.mainMenu.find('.OxExtras').prepend($item);
pandora.$ui.extraItem = $item;
};
return that;
}
}