Integration of plugin buttons in result panel
Change-Id: I74c8264f02a64c6f339dbb46295d6be92807d833
diff --git a/dev/js/src/init.js b/dev/js/src/init.js
index 82d9de9..0b31e23 100644
--- a/dev/js/src/init.js
+++ b/dev/js/src/init.js
@@ -84,6 +84,8 @@
// What should be visible in the beginning?
var show = KorAP.session.get('show') || {};
+
+ KorAP.Panel = KorAP.Panel || {}
/**
* Release notifications
@@ -268,7 +270,7 @@
if (matchCount > 0)
resultPanel.addAlignAction();
-
+ KorAP.Panel['result'] = resultPanel;
/*
* Toggle the Virtual Corpus builder
*/
@@ -390,7 +392,6 @@
if (sform && vcView) {
// The views are below the query bar
sform.insertBefore(queryPanel.element(), vcView);
- KorAP.Panel = KorAP.Panel || {};
KorAP.Panel['query'] = queryPanel;
}
diff --git a/dev/js/src/panel/result.js b/dev/js/src/panel/result.js
index 978a1b6..02c6e53 100644
--- a/dev/js/src/panel/result.js
+++ b/dev/js/src/panel/result.js
@@ -23,6 +23,21 @@
// Initialize panel
_init : function (opened) {
this._opened = opened;
+
+
+ // If plugins are enabled, add all buttons for the result panel
+ if (KorAP.Plugin) {
+ var resultButtons = KorAP.Plugin.buttonGroup("result");
+
+ // Add all result buttons in order
+ for (i in resultButtons) {
+ this.actions.add.apply(this.actions, resultButtons[i]);
+ };
+
+ KorAP.Plugin.clearButtonGroup("result");
+ };
+
+
return this;
},
@@ -82,6 +97,8 @@
this.button.toggleClass("left", "right");
};
});
+
+
}
}
});
diff --git a/dev/js/src/plugin/server.js b/dev/js/src/plugin/server.js
index 69318b0..163a315 100644
--- a/dev/js/src/plugin/server.js
+++ b/dev/js/src/plugin/server.js
@@ -31,7 +31,8 @@
// List of panels with static buttons, i.e.
// panels that occur only once.
var buttonsSingle = {
- query : []
+ query : [],
+ result : []
}
// This is a counter to limit acceptable incoming messages
@@ -117,10 +118,9 @@
throw new Error("Embedding of plugin is no object");
var panel = embed["panel"];
-
+
if (!panel || !(buttons[panel] || buttonsSingle[panel]))
throw new Error("Panel for plugin is invalid");
-
var onClick = embed["onClick"];
// Needs to be localized as well