diff --git a/src/main/webapp/page/spawn/content.jsp b/src/main/webapp/page/spawn/content.jsp new file mode 100644 index 0000000000000000000000000000000000000000..2daf703abcb2c9cb2d2d2eb646b706369fa5cd71 --- /dev/null +++ b/src/main/webapp/page/spawn/content.jsp @@ -0,0 +1,32 @@ +<%@ page session="true" contentType="text/html" pageEncoding="UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="pg" tagdir="/WEB-INF/tags/page" %> +<%--<%@ taglib prefix="sp" tagdir="/WEB-INF/tags/spawner" %>--%> + +<c:if test="${empty hasInit}"> + <pg:init> + <c:if test="${empty hasVars}"> + <pg:jsvars/> + </c:if> + </pg:init> +</c:if> + +<c:set var="MSG"> + Playground clossed. +</c:set> + +<pg:restricted msg="${MSG}"> + + <c:set var="_siteRoot" value="${sessionScope.siteRoot}"/> + + <!-- playground for XNAT.spawner methods --> + + <div id="spawn-container"></div> + + <script src="${_siteRoot}/scripts/xnat/spawner.js"></script> + + <script> + + </script> + +</pg:restricted> \ No newline at end of file diff --git a/src/main/webapp/page/spawn/index.jsp b/src/main/webapp/page/spawn/index.jsp new file mode 100644 index 0000000000000000000000000000000000000000..5659c18f4be818d4533ac704e92e4ad1e3ddf430 --- /dev/null +++ b/src/main/webapp/page/spawn/index.jsp @@ -0,0 +1,11 @@ +<%@ page session="true" contentType="text/html" pageEncoding="UTF-8" language="java" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> +<%@ taglib prefix="pg" tagdir="/WEB-INF/tags/page" %> + +<pg:wrapper> + <pg:xnat> + + <jsp:include page="content.jsp"/> + + </pg:xnat> +</pg:wrapper> diff --git a/src/main/webapp/scripts/xnat/spawner.js b/src/main/webapp/scripts/xnat/spawner.js new file mode 100644 index 0000000000000000000000000000000000000000..49249c0f14abcd2f0a76b08491a26906e4900d6e --- /dev/null +++ b/src/main/webapp/scripts/xnat/spawner.js @@ -0,0 +1,45 @@ +/*! + * Spawn UI elements using the Spawner service + */ + +var XNAT = getObject(XNAT); + +(function(factory){ + if (typeof define === 'function' && define.amd) { + define(factory); + } + else if (typeof exports === 'object') { + module.exports = factory(); + } + else { + return factory(); + } +}(function(){ + + var undefined, + spawner = getObject(XNAT.spawner||{}); + + function Spawner(obj){ + extend(true, this, obj); + this.spawned = null; + this.children = {}; + } + + Spawner.p = Spawner.prototype; + + Spawner.p.init = function(obj){ + + }; + + Spawner.p.render = function($container){ + $$($container).append(this.spawned); + return this; + }; + + spawner.spawn = function(obj){ + return new Spawner(obj); + }; + + return XNAT.spawner = spawner; + +}));