diff --git a/src/_h5ai/css/inc/splash.less b/src/_h5ai/css/inc/splash.less index 19518c7d..d3de8b1c 100644 --- a/src/_h5ai/css/inc/splash.less +++ b/src/_h5ai/css/inc/splash.less @@ -89,6 +89,18 @@ html.h5ai-splash { margin-top: 0.6em; line-height: 1.4em; } + .test-label { + + } + .test-result { + font-weight: bold; + &.test-passed { + color: #5a5; + } + &.test-failed { + color: #a55; + } + } pre.prettyprint.nice, code.prettyprint.nice { font-family: "Ubuntu Mono", Ubuntu, Arial, sans; font-size: 0.95em; diff --git a/src/_h5ai/index.html b/src/_h5ai/index.html index 9d6c85b9..aa7dda15 100644 --- a/src/_h5ai/index.html +++ b/src/_h5ai/index.html @@ -21,11 +21,10 @@

h5ai

+

· version %BUILD_VERSION% ·

-

- h5ai %BUILD_VERSION% is provided under the terms of the MIT License. -

+

Links

-
-
-		
-
diff --git a/src/_h5ai/js/inc/H5ai.js b/src/_h5ai/js/inc/H5ai.js index b8d30320..1bc727c6 100644 --- a/src/_h5ai/js/inc/H5ai.js +++ b/src/_h5ai/js/inc/H5ai.js @@ -97,6 +97,8 @@ // @include "Html.js" // @include "Extended.js" + // @include "splash.js" + $(init); }(jQuery, H5AI_CONFIG)); diff --git a/src/_h5ai/js/inc/splash.js b/src/_h5ai/js/inc/splash.js index b0ea78a0..44a4a5e2 100644 --- a/src/_h5ai/js/inc/splash.js +++ b/src/_h5ai/js/inc/splash.js @@ -1,8 +1,6 @@ -(function (window, $) { +(function ($, h5ai) { 'use strict'; -/*jslint browser: true, confusion: true, white: true */ -/*global jQuery */ var deobfuscate = function () { @@ -15,16 +13,55 @@ $this.replaceWith($a); }); }, - configFile = function () { + handleChecksResponse = function (response) { - $('#config-file').text(JSON.stringify(H5AI_CONFIG.options)); + if (response) { + $('#test-php .test-result').addClass('test-passed').text('passed'); + if (response.zips === 0) { + $('#test-zips .test-result').addClass('test-passed').text('passed'); + } else { + $('#test-zips .test-result').addClass('test-failed').text('failed (' + response.zips + ')'); + } + if (response.thumbs === 0) { + $('#test-thumbs .test-result').addClass('test-passed').text('passed'); + } else { + $('#test-thumbs .test-result').addClass('test-failed').text('failed (' + response.thumbs + ')'); + } + } else { + $('#test-php .test-result').addClass('test-failed').text('failed'); + $('#test-zips .test-result').addClass('test-failed').text('failed'); + $('#test-thumbs .test-result').addClass('test-failed').text('failed'); + } + }, + checks = function () { + + $.ajax({ + url: h5ai.core.api(), + data: { + action: 'checks' + }, + type: 'POST', + dataType: 'json', + success: function (response) { + + handleChecksResponse(response); + }, + error: function () { + + handleChecksResponse(); + } + }); }, init = function () { - deobfuscate(); - configFile(); + h5ai.isSplash = $('html').hasClass('h5ai-splash'); + + if (h5ai.isSplash) { + deobfuscate(); + checks(); + } }; $(init); -}(window, jQuery)); \ No newline at end of file +}(jQuery, h5ai)); \ No newline at end of file diff --git a/src/_h5ai/js/scripts.js b/src/_h5ai/js/scripts.js index 2a89352f..3482f896 100644 --- a/src/_h5ai/js/scripts.js +++ b/src/_h5ai/js/scripts.js @@ -17,7 +17,3 @@ // h5ai // ---- // @include "inc/H5ai.js" - -// info -// ---- -// @include "inc/splash.js" diff --git a/src/_h5ai/php/api.php b/src/_h5ai/php/api.php index 0edbd45a..23cf57d9 100644 --- a/src/_h5ai/php/api.php +++ b/src/_h5ai/php/api.php @@ -1,7 +1,7 @@ open($zipFile, ZIPARCHIVE::CREATE)) { + return 2; + } + + $zip->addEmptyDir("/"); + $zip->close(); + + if (filesize($zipFile) === 0) { + return 3; + } + } catch (Exception $e) { + return 4; + }; + + return 0; + } + + function checkGdSupport () { + + if (GD_VERSION == "GD_VERSION") { + return 1; + } + + return 0; + } + + $response = array('zips' => checkZipSupport(), 'thumbs' => checkGdSupport()); + echo json_encode($response); +} + + else { fail(1, "unsupported 'action' specified"); }