modulejs.define('info', ['$', 'config'], function ($, config) { var testsTemp = '
' + '
', testTemp = '
  • ' + '' + '' + '
    ' + '
  • ', loginTemp = '
    ' + '' + 'login' + 'logout' + '
    ' + 'The preset password is the empty string, so just hit login. ' + 'You might change it in the index file if you want to keep these informations private!' + '
    ' + '
    ', setup = config.setup, addTests = function () { var addTest = function (label, info, passed, result) { $(testTemp) .find('.label') .text(label) .end() .find('.result') .addClass(passed ? 'passed' : 'failed') .text(result ? result : (passed ? 'yes' : 'no')) .end() .find('.info') .html(info) .end() .appendTo('#tests'); }; $(testsTemp).appendTo('body'); addTest( 'Server software', 'Server is one of apache, lighttpd, nginx or cherokee', setup.HAS_SERVER, setup.SERVER_NAME + ' ' + setup.SERVER_VERSION ); addTest( 'PHP version', 'PHP version >= ' + setup.MIN_PHP_VERSION, setup.HAS_PHP_VERSION, setup.PHP_VERSION ); addTest( 'Cache directory', 'Web server has write access', setup.HAS_WRITABLE_CACHE ); addTest( 'Image thumbs', 'PHP GD extension with JPEG support available', setup.HAS_PHP_JPG ); addTest( 'Use EXIF thumbs', 'PHP EXIF extension available', setup.HAS_PHP_EXIF ); addTest( 'Movie thumbs', 'Command line program avconv or ffmpeg available', setup.HAS_CMD_AVCONV || setup.HAS_CMD_FFMPEG ); addTest( 'PDF thumbs', 'Command line program convert available', setup.HAS_CMD_CONVERT ); addTest( 'Shell tar', 'Command line program tar available', setup.HAS_CMD_TAR ); addTest( 'Shell zip', 'Command line program zip available', setup.HAS_CMD_ZIP ); addTest( 'Shell du', 'Command line program du available', setup.HAS_CMD_DU ); }, addLogin = function () { var request = function (data) { $.ajax({ url: 'server/php/index.php', type: 'POST', dataType: 'JSON', data: data }) .always(function () { window.location.reload(); }); }, onLogin = function () { request({ 'action': 'login', 'pass': $('#pass').val() }); }, onLogout = function () { request({ 'action': 'logout' }); }, onKeydown = function (event) { if (event.which === 13) { onLogin(); } }; $(loginTemp).appendTo('body'); if (setup.AS_ADMIN) { $('#pass').remove(); $('#login').remove(); $('#logout').on('click', onLogout); } else { $('#pass').on('keydown', onKeydown).focus(); $('#login').on('click', onLogin); $('#logout').remove(); } if (setup.HAS_CUSTOM_PASSHASH) { $('#hint').remove(); } }, init = function () { $('Index: ') .appendTo('body') .find('.value').text(setup.INDEX_HREF); if (setup.AS_ADMIN) { addTests(); } addLogin(); }; init(); });