More work on the sample extension
git-svn-id: http://google-refine.googlecode.com/svn/trunk@974 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
17f1dc2e6f
commit
7ba97c61ad
46
extensions/sample-extension/module/MOD-INF/controller.js
Normal file
46
extensions/sample-extension/module/MOD-INF/controller.js
Normal file
@ -0,0 +1,46 @@
|
||||
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 == "") {
|
||||
send(request, response, "index.vt", context);
|
||||
}
|
||||
}
|
||||
|
||||
function send(request, response, template, context) {
|
||||
butterfly.sendTextFromTemplate(request, response, context, template, encoding, html);
|
||||
}
|
@ -0,0 +1,3 @@
|
||||
description = Gridworks Sample Extension
|
||||
|
||||
templating.macros = macros.vm
|
21
extensions/sample-extension/module/index.vt
Normal file
21
extensions/sample-extension/module/index.vt
Normal file
@ -0,0 +1,21 @@
|
||||
#*
|
||||
* Access this page at the URL /extensions/sample/
|
||||
*#
|
||||
<html>
|
||||
<head>
|
||||
<title>Sample Extension</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Sample Extension</h1>
|
||||
|
||||
<p>If an extension needs its own page, then this is such an example.
|
||||
However, mostly, extensions only need to inject their own scripts
|
||||
and styles into the /project page.
|
||||
</p>
|
||||
|
||||
<p>Here is a sample list using a veloci-macro:</p>
|
||||
|
||||
#set( $greatlakes = ["Superior","Michigan","Huron","Erie","Ontario"] )
|
||||
#makeAList( $greatlakes )
|
||||
</body>
|
||||
</html>
|
14
extensions/sample-extension/module/macros.vm
Normal file
14
extensions/sample-extension/module/macros.vm
Normal file
@ -0,0 +1,14 @@
|
||||
#*
|
||||
This file contains common velocity macros used in all .vt files.
|
||||
For Velocity documentation, see:
|
||||
|
||||
http://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html
|
||||
*#
|
||||
|
||||
#macro( makeAList $list )
|
||||
<ul>
|
||||
#foreach($item in $list)
|
||||
<li>$item</li>
|
||||
#end
|
||||
</ul>
|
||||
#end
|
@ -0,0 +1,3 @@
|
||||
// This file is added to the /project page
|
||||
|
||||
var SampleExtension = {};
|
@ -0,0 +1,5 @@
|
||||
// LESS styles
|
||||
// For documentation, see http://lesscss.org/
|
||||
|
||||
@color: blue;
|
||||
|
@ -21,6 +21,9 @@ butterfly.url = /
|
||||
|
||||
butterfly.modules.path = modules
|
||||
butterfly.modules.path = ../../extensions/
|
||||
# Add more paths here if your extensions live elsewhere.
|
||||
# Relative paths are relative to gridworks/main/webapp/
|
||||
|
||||
butterfly.modules.wirings = WEB-INF/modules.properties
|
||||
|
||||
# ---------- Clustering ----
|
||||
|
@ -4,4 +4,9 @@
|
||||
|
||||
core = /
|
||||
|
||||
# Sample extension's wirings
|
||||
# client-side resources of this module will be accessible under this URL path
|
||||
sample-extension = /extensions/sample/
|
||||
|
||||
jython = /extensions/jython/
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user