ba60780fa3
git-svn-id: http://google-refine.googlecode.com/svn/trunk@996 7d457c2a-affb-35e4-300a-418c747d4874
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
var html = "text/html";
|
|
var encoding = "UTF-8";
|
|
var ClientSideResourceManager = Packages.com.metaweb.gridworks.ClientSideResourceManager;
|
|
|
|
/*
|
|
* Function invoked to initialize the extension.
|
|
*/
|
|
function init() {
|
|
// Packages.java.lang.System.err.println("Initializing sample extension");
|
|
// Packages.java.lang.System.err.println(module.getMountPoint());
|
|
|
|
// Script files to inject into /project page
|
|
ClientSideResourceManager.addPaths(
|
|
"project/scripts",
|
|
module,
|
|
[
|
|
"scripts/project-injection.js"
|
|
]
|
|
);
|
|
|
|
// Style files to inject into /project page
|
|
ClientSideResourceManager.addPaths(
|
|
"project/styles",
|
|
module,
|
|
[
|
|
"styles/project-injection.less"
|
|
]
|
|
);
|
|
}
|
|
|
|
/*
|
|
* Function invoked to handle each request in a custom way.
|
|
*/
|
|
function process(path, request, response) {
|
|
// Analyze path and handle this request yourself.
|
|
|
|
if (path == "/" || path == "") {
|
|
var context = {};
|
|
// here's how to pass things into the .vt templates
|
|
context.someList = ["Superior","Michigan","Huron","Erie","Ontario"];
|
|
context.someString = "foo";
|
|
context.someInt = Packages.com.metaweb.gridworks.sampleExtension.SampleUtil.stringArrayLength(context.someList);
|
|
|
|
send(request, response, "index.vt", context);
|
|
}
|
|
}
|
|
|
|
function send(request, response, template, context) {
|
|
butterfly.sendTextFromTemplate(request, response, context, template, encoding, html);
|
|
}
|