diff --git a/src/main/webapp/scripts/globals.js b/src/main/webapp/scripts/globals.js index 2078683f8872b2fe38d7dcf25a654f553a0b2eee..57e89054b6a21acbfc01cf32180796e55444bd09 100644 --- a/src/main/webapp/scripts/globals.js +++ b/src/main/webapp/scripts/globals.js @@ -445,7 +445,7 @@ function toNumber( val, strip, force, dec ){ // chop off after 2nd decimal, if present val = val.split('.'); - val = val[0]+ '.' +val[1]; + val = (val.length === 1) ? val[0] : val[0]+ '.' +val[1]; } diff --git a/src/main/webapp/scripts/xnat/app/customPage.js b/src/main/webapp/scripts/xnat/app/customPage.js index c259fc6d1f6f5a2e87a8cab4f4f7120e18fb3b65..3dd20bd8b1991bb92b18a88ce9aa0d7f614722a3 100644 --- a/src/main/webapp/scripts/xnat/app/customPage.js +++ b/src/main/webapp/scripts/xnat/app/customPage.js @@ -12,12 +12,12 @@ else { return factory(NS); } -}('XNAT.app.customPage', function(NS, undefined){ +}('app.customPage', function(NS, undefined){ // setExtendedObject() hasn't been tested yet - //var customPage = setExtendedObject(XNAT, NS); + // var customPage = setExtendedObject(XNAT, NS); - var customPage = getObject(eval(NS)||{}); + var customPage = getObject(eval('XNAT.'+NS)||{}); customPage.getName = function(){ var name = getQueryStringValue('view'); @@ -45,26 +45,31 @@ url: XNAT.url.rootUrl(path), dataType: 'html', success: function(content){ - $container.html(content); + $container.html(content) } }) } var setPaths = function(pg, prefixes){ var paths = []; + pg = pg.replace(/^\/+|\/+$/g, ''); // remove leading and trailing slashes [].concat(prefixes).forEach(function(prefix){ + paths.push(prefix + '/' + pg + '/content.jsp'); paths.push(prefix + '/' + pg + '.jsp'); + paths.push(prefix + '/' + pg + '/content.html'); paths.push(prefix + '/' + pg + '.html'); + // paths.push(prefix + '/' + pg + '/'); // that could be dangerous }); return paths; }; - pagePaths = setPaths(name, ['/pages']); + pagePaths = setPaths(name, ['/page', '/pages']); // if we're using a theme, check that theme's folder if (XNAT.theme){ themePaths = setPaths(name, [ '/themes/' + XNAT.theme, + '/themes/' + XNAT.theme + '/page', '/themes/' + XNAT.theme + '/pages' ]); pagePaths = themePaths.concat(pagePaths); diff --git a/src/main/webapp/scripts/xnat/ui/table.js b/src/main/webapp/scripts/xnat/ui/table.js index b693362d6da1c8a39f9d6eedcc80df522f6dc829..5f55ba2a5df1862327cbb918857b3863235d1d95 100644 --- a/src/main/webapp/scripts/xnat/ui/table.js +++ b/src/main/webapp/scripts/xnat/ui/table.js @@ -274,6 +274,17 @@ var XNAT = getObject(XNAT||{}); return this; }; + + Table.p.render = function(element){ + if (element){ + $$(element).empty().append(this.table); + } + return this.table; + }; + + Table.p.html = function(){ + return this.table.outerHTML; + }; table = function(data, opts){ if (!opts){ diff --git a/src/main/webapp/xnat-templates/screens/pages/hello.vm b/src/main/webapp/xnat-templates/screens/pages/hello.vm index be45d32347447fdfdc9f7cfd3d87655fc30d5afa..a961ac89eaf526ebe57884a4718158c2f8c4e6ed 100644 --- a/src/main/webapp/xnat-templates/screens/pages/hello.vm +++ b/src/main/webapp/xnat-templates/screens/pages/hello.vm @@ -1 +1,8 @@ -<h1>Hello.</h1> \ No newline at end of file +## The content of any page in the *templates/pages folder +## will be accessible at /app/template/Page.vm?view=name, +## where the 'name' query string parameter is the name of +## the file without the .vm extension. This is intended +## to be used for page content that relies solely on XNAT's +## REST service for receiving and sending data. + +<h1>Hello.</h1>