我是Pentaho的新手并尝试在Pentaho的index.jsp中创建alert(some_msg_from_datasource)
。但我无法弄清楚如何从这里访问Pentaho变量。这就是我所拥有的
<head> ... <script type="text/javascript">
var Home = null;
pen.require(["home/home",
"common-ui/util/ContextProvider"], function(pentahoHome, ContextProvider) {
Home = pentahoHome;
// Define properties for loading context
var contextConfig = [{
path: "properties/config",
post: function(context, loadedMap) {
context.config = loadedMap;
}
}, {
path: "properties/messages",
post: function(context, loadedMap) {
context.i18n = loadedMap;
}
}];
// Define permissions
ContextProvider.addProperty("canCreateContent", <%=canCreateContent%>);
ContextProvider.addProperty("hasAnalyzerPlugin", <%=pluginIds.contains("analyzer")%>);
ContextProvider.addProperty("hasDataAccess", false); // default
// BISERVER-8631 - Manage datasources only available to roles/users with appropriate permissions
var serviceUrl = Home.getUrlBase() + "plugin/data-access/api/permissions/hasDataAccess";
Home.getContent(serviceUrl, function(result) {
ContextProvider.addProperty("hasDataAccess", result);
ContextProvider.get(Home.init, contextConfig); // initialize
}, function(error) {
console.log(error);
ContextProvider.get(Home.init, contextConfig); // log error and initialize anyway
});
});
</script> </head>
对于身体:
<body data-spy="scroll" data-target=".sidebar" onload="onBodyLoad()">
<script>
function onBodyLoad(){
alert("MOTD: " + the_motd_from_a_pentaho_var);
}
</script>
我假设我需要webcontext,但我不理解head-scripts以及如何让它运行。 Tbh我甚至不完全理解头部的语法。请帮忙:(