rem
stringlengths
0
126k
add
stringlengths
0
441k
context
stringlengths
15
136k
this.testCount = 16;
worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; }
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
var scriptName = this.name; debugConsole.script.runShaderTestSuite = function ()
if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this))
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
worldScripts[scriptName].runShaderTestSuite();
log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return;
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
this.runShaderTestSuite = function ()
} this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount)
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
if (!player.ship.docked)
if (this.passID == 1)
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return;
this.passID = 2; this.nextTestIndex = 2; testIndex = 1;
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this))
else
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen.");
this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {});
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
this.startTest = function (resonse)
debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config =
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest();
model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return;
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console.");
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("shaderTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK; // Actually run the test. var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
testRig.$registerTest("Quaternion.toString", function () { var q = new Quaternion(1.5, 14, 0, -3); var string = q.toString(); require.value("string", string, "(1.5 + 14i + 0j - 3k)"); }); testRig.$registerTest("Quaternion.toSource", function () { var q = new Quaternion(1.5, 14, 0, -3); var source = q.toSource(); require.value("source", source, "Quaternion(1.5, 14, 0, -3)"); });
this.startUp = function (){ var testRig = worldScripts["oolite-script-test-rig"]; var require = testRig.$require; testRig.$registerTest("Quaternion constructor", function () { var basic = new Quaternion(1, 2, 3, 4); require.instance("basic", basic, Quaternion); var noNew = Quaternion(1, 2, 3, 4); require.instance("noNew", noNew, Quaternion); var fromArray = Quaternion([1, 2, 3, 4]); require.instance("fromArray", fromArray, Quaternion); }); testRig.$registerTest("Quaternion properties", function () { var q = new Quaternion(1, 2, 3, 4); require.quaternion("q", q, [1, 2, 3, 4]); q.w = 5; q.x = 6; q.y = 7; q.z = 8; require.quaternion("q", q, [5, 6, 7, 8]); }); testRig.$registerTest("Quaternion.dot", function () { var q = new Quaternion(Math.random(), Math.random(), Math.random(), Math.random()); var p = new Quaternion(Math.random(), Math.random(), Math.random(), Math.random()); var dotProduct = q.dot(p); require.near("dotProduct", dotProduct, q.w * p.w + q.x * p.x + q.y * p.y + q.z * p.z); }); function quatMult(p, q) { var w = p.w * q.w - p.x * q.x - p.y * q.y - p.z * q.z; var x = p.w * q.x + p.x * q.w + p.y * q.z - p.z * q.y; var y = p.w * q.y + p.y * q.w + p.z * q.x - p.x * q.z; var z = p.w * q.z + p.z * q.w + p.x * q.y - p.y * q.x; return [w, x, y, z]; } testRig.$registerTest("Quaternion.multiply", function () { var q = new Quaternion(Math.random(), Math.random(), Math.random(), Math.random()); var p = new Quaternion(Math.random(), Math.random(), Math.random(), Math.random()); var product = p.multiply(q); require.quaternion("product", product, quatMult(p, q)); }); testRig.$registerTest("Quaternion.normalize", function () { var q = new Quaternion(Math.random(), Math.random(), Math.random(), Math.random()); var normalized = q.normalize(); var weight = Math.sqrt(q.w * q.w + q.x * q.x + q.y * q.y + q.z * q.z); require.quaternion("normalized", normalized, [q.w / weight, q.x / weight, q.y / weight, q.z / weight]); }); testRig.$registerTest("Quaternion.rotate", function () { var angle = (Math.random() - 0.5) * Math.PI * 2; var q = Quaternion.random(); var rotated = q.rotate(Vector3D.randomDirection(), angle); var rotAngle = Math.acos(rotated.dot(q)) * 2; require.near("rotAngle", rotAngle, Math.abs(angle), 1e-4); }); testRig.$registerTest("Quaternion.rotateX", function () { var angle = (Math.random() - 0.5) * Math.PI * 2; var q = Quaternion.random(); var rotated = q.rotateX(angle); var rotAngle = Math.acos(rotated.dot(q)) * 2; require.near("rotAngle", rotAngle, Math.abs(angle), 1e-4); }); testRig.$registerTest("Quaternion.rotateY", function () { var angle = (Math.random() - 0.5) * Math.PI * 2; var q = Quaternion.random(); var rotated = q.rotateY(angle); var rotAngle = Math.acos(rotated.dot(q)) * 2; require.near("rotAngle", rotAngle, Math.abs(angle), 1e-4); }); testRig.$registerTest("Quaternion.rotateZ", function () { var angle = (Math.random() - 0.5) * Math.PI * 2; var q = Quaternion.random(); var rotated = q.rotateZ(angle); var rotAngle = Math.acos(rotated.dot(q)) * 2; require.near("rotAngle", rotAngle, Math.abs(angle), 1e-4); }); testRig.$registerTest("Quaternion.toArray", function () { var q = Quaternion.random(); require.quaternion("q", q, q.toArray()); }); testRig.$registerTest("Quaternion.vectorForward", function () { var q = Quaternion.random(); var vectorForward = q.vectorForward(); var reference = new Vector3D(0, 0, 1).rotateBy(q); require.vector("vectorForward", vectorForward, reference.toArray()); }); testRig.$registerTest("Quaternion.vectorRight", function () { var q = Quaternion.random(); var vectorRight = q.vectorRight(); var reference = new Vector3D(1, 0, 0).rotateBy(q); require.vector("vectorRight", vectorRight, reference.toArray()); }); testRig.$registerTest("Quaternion.vectorUp", function () { var q = Quaternion.random(); var vectorUp = q.vectorUp(); var reference = new Vector3D(0, 1, 0).rotateBy(q); require.vector("vectorUp", vectorUp, reference.toArray()); }); testRig.$registerTest("Quaternion.random", function () { // Doesn’t test distribution, just that results are normalized quaternions. var i; for (i = 0; i < 20; i++) { var random = Quaternion.random(); require.instance("random", random, Quaternion); var normalized = random.normalize(); require.near("normalized", normalized, random.toArray()); } });}
this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED"); // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions);
substitutions.count_string = expandMissionText("oolite_material_test_count_" + debugConsole.maximumShaderMode, substitutions);
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED"); // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + ".");
log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + supportString + ".");
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED"); // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass)
if (this.passID < this.maxPassID)
this.startUp = function(){ delete this.startUp; try { var console = debugConsole; } catch (e) { log("materialTest.error.consoleRequired", "The material test suite requires the debug console to be active."); return; } this.shadyTestCount = 16; this.nonShadyTestCount = 7; this.shadersSupported = (debugConsole.shaderMode != "SHADERS_NOT_SUPPORTED"); // User-callable initiation function. var scriptName = this.name; debugConsole.script.runMaterialTestSuite = function () { worldScripts[scriptName].runMaterialTestSuite(); } this.runMaterialTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the material test suite."); return; } // Show instruction/confirmation screen. var substitutions = { shady_count :this.shadyTestCount, non_shady_count: this.nonShadyTestCount }; substitutions.count_string = expandMissionText(this.shadersSupported ? "oolite_material_test_count_full_shaders" : "oolite_material_test_count_no_shaders", substitutions); var introText = expandMissionText("oolite_material_test_confirmation", substitutions); if (!Mission.runScreen({ title: "Shader test suite", message: introText, choicesKey: "oolite_material_test_confirmation_choices" }, this.startTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.originalDebugFlags = debugConsole.debugFlags; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { log("materialTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); } debugConsole.writeLogMarker(); log("materialTest.start", "Starting material test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"; shaders are " + (this.shadersSupported ? "supported" : "not supported") + "."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; debugConsole.debugFlags = this.originalDebugFlags; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.originalDebugFlags; delete this.shipLaunchedFromStation; } this.settingsByPass = [ {}, { passName: "fixed-function", shaderMode: "SHADERS_OFF", maxIndex: this.nonShadyTestCount, rolePrefix: "oolite_non_shader_test_suite_" }, { passName: "simple", shaderMode: "SHADERS_SIMPLE", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" }, { passName: "full", shaderMode: "SHADERS_FULL", maxIndex: this.shadyTestCount, rolePrefix: "oolite_shader_test_suite_" } ]; this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.settingsByPass[this.passID].maxIndex) { var maxPass = this.shadersSupported ? 3 : 1; if (this.passID < maxPass) { // Switch to next pass. this.passID++; this.nextTestIndex = 2; testIndex = 1; } else { // All passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; log("materialTest.complete", "Shader test suite complete."); debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } var passData = this.settingsByPass[this.passID]; // Create a dummy ship to extract its script_info. var modelName = passData.rolePrefix + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_material_test_suite_label"]; ship.remove(); // Ensure environment is what we need - each time in case user tries to be clever. debugConsole.shaderMode = passData.shaderMode; debugConsole.displayFPS = true; debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK | debugConsole.DEBUG_SHADER_VALIDATION; // Actually run the test. var passNames = ["", "fixed-function", "simple", "full"]; var testLabel = passData.passName + ":" + testIndex; log("materialTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("materialTest.error.missionScreenFailed", "The material test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("materialTest.loaded", "Material test suite is installed. To run the material test, type \"runMaterialTestSuite()\" in the debug console.");};
this.shipLaunchedFromStation = function () { performCleanUp(); }
this.shipLaunchedFromStation = function () { log("shaderTest.cancelled", "Shader test suite cancelled by exiting station."); this.performCleanUp(); }
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Actually run the test. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
debugConsole.debugFlags |= debugConsole.DEBUG_NO_SHADER_FALLBACK;
this.startUp = function(){ if (debugConsole === undefined) { log("shaderTest.error.consoleRequired", "The shader test suite requires the debug console to be active."); } else if (debugConsole.shaderMode == "SHADERS_NOT_SUPPORTED") { log("shaderTest.error.shadersNotSupported", "The shader test suite cannot be used because shaders are not supported."); } else { this.testCount = 16; // User-callable initiation function. var scriptName = this.name; debugConsole.script.runShaderTestSuite = function () { worldScripts[scriptName].runShaderTestSuite(); } this.runShaderTestSuite = function () { if (!player.ship.docked) { debugConsole.consoleMessage("command-error", "You must be docked to run the shader test suite."); return; } // Show instruction/confirmation screen. if (!Mission.runScreen({ title: "Shader test suite", messageKey: "oolite_shader_test_confirmation", choicesKey: "oolite_shader_test_confirmation_choices" }, this.startTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); return; } } // Confirmation screen result callback. this.startTest = function (resonse) { if (resonse != "A_CONTINUE") return; this.originalShaderMode = debugConsole.shaderMode; this.originalDisplayFPS = debugConsole.displayFPS; this.passID = 1; this.nextTestIndex = 1; this.shipLaunchedFromStation = function () { performCleanUp(); } debugConsole.writeLogMarker(); log("shaderTest.start", "Starting shader test suite " + this.version + " under Oolite " + oolite.versionString + " and " + debugConsole.platformDescription + " with OpenGL renderer \"" + debugConsole.glRendererString + "\", vendor \"" + debugConsole.glVendorString + "\"."); this.runNextTest(); } this.performCleanUp = function () { debugConsole.shaderMode = this.originalShaderMode; debugConsole.displayFPS = this.originalDisplayFPS; delete this.passID; delete this.nextTestIndex; delete this.originalShaderMode; delete this.originalDisplayFPS; delete this.shipLaunchedFromStation; } this.runNextTest = function () { var testIndex = this.nextTestIndex++; if (testIndex > this.testCount) { if (this.passID == 1) { // Switch to next pass (full shader mode). this.passID = 2; this.nextTestIndex = 2; testIndex = 1; } else { // Both passes have run, we're done. this.performCleanUp(); var config = { title: "Shader test suite", message: "The test suite is complete.\n\n\n" + "Your OpenGL renderer information is:\n" + "Vendor: “" + debugConsole.glVendorString + "”\n" + "Renderer: “" + debugConsole.glRendererString + "”\n\n" + "This information can also be found in the Oolite log." }; debugConsole.writeLogMarker(); Mission.runScreen(config, function () {}); return; } } // Create a dummy ship to extract its script_info. var modelName = "oolite_shader_test_suite_" + testIndex; var ship = system.addShips(modelName, 1, system.sun.position, 10000)[0]; var testDesc = ship.scriptInfo["oolite_shader_test_suite_label"]; ship.remove(); // Actually run the test. debugConsole.shaderMode = this.passID == 1 ? "SHADERS_SIMPLE" : "SHADERS_FULL"; debugConsole.displayFPS = true; var testLabel = (this.passID == 1 ? "simple" : "full") + "-" + testIndex; log("shaderTest.runTest", "Running test " + testLabel + " (" + testDesc + ")."); var config = { model: modelName, title: "", message: "\n\n\n" + testLabel + "\n" + testDesc }; if (!Mission.runScreen(config, this.runNextTest, this)) { log("shaderTest.error.missionScreenFailed", "The shader test suite failed to run a mission screen."); this.performCleanUp(); return; } } log("shaderTest.loaded", "Shader test OXP is installed. To run the shader test, type \"runShaderTestSuite()\" in the debug console."); }};
log("interfaceTest.loaded", "JavaScript interface test suite is installed; enter ooRunTests() while docked.");
this.startUp = function startUp(){ if (global.consoleMessage === undefined) { this.consoleMessage = function(colorCode, message) { log(message); } }}
a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize", b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top",
h)).match(/^([\d+-.]+)(.*)$/);g[h]={value:i[1],unit:i[2]||"px"}});a.toShow.css({height:0,overflow:"hidden"}).show();a.toHide.filter(":hidden").each(a.complete).end().filter(":visible").animate(e,{step:function(i,h){if(h.prop=="height")f=h.end-h.start===0?0:(h.now-h.start)/(h.end-h.start);a.toShow[0].style[h.prop]=f*g[h.prop].value+g[h.prop].unit},duration:a.duration,easing:a.easing,complete:function(){a.autoHeight||a.toShow.css("height","");a.toShow.css("width",k);a.toShow.css({overflow:d});a.complete()}})}else a.toHide.animate({height:"hide"},
a.originalPosition.left)||null;var h=parseInt(a.element.css("top"),10)+(a.position.top-a.originalPosition.top)||null;a.element.animate(e.extend(f,h&&g?{top:h,left:g}:{}),{duration:c.animateDuration,easing:c.animateEasing,step:function(){var i={width:parseInt(a.element.css("width"),10),height:parseInt(a.element.css("height"),10),top:parseInt(a.element.css("top"),10),left:parseInt(a.element.css("left"),10)};d&&d.length&&e(d[0]).css({width:i.width,height:i.height});a._updateCache(i);a._propagate("resize",b)}})}});e.ui.plugin.add("resizable","containment",{start:function(){var b=e(this).data("resizable"),a=b.element,c=b.options.containment;if(a=c instanceof e?c.get(0):/parent/.test(c)?a.parent().get(0):c){b.containerElement=e(a);if(/document/.test(c)||c==document){b.containerOffset={left:0,top:0};b.containerPosition={left:0,top:0};b.parentData={element:e(document),left:0,top:0,width:e(document).width(),height:e(document).height()||document.body.parentNode.scrollHeight}}else{var d=e(a),f=[];e(["Top",
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide|| this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem,e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
c.fx.stop()},stop:function(){clearInterval(W);W=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===b.elem}).length};c.fn.offset="getBoundingClientRect"in s.documentElement?
$(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop);
$(document).unbind('.orderable');
var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; };
logger.log('store item data', JSON.stringify(itemData))
logger.debug('store item data', JSON.stringify(itemData))
this.storeItemData = function(itemData, callback) { logger.log('store item data', JSON.stringify(itemData)) this._db.saveDoc(itemData, callback) }
try { return utils.string.sprintf('%' + arg, value); } catch (e) { return ''; }
try { return string_utils.sprintf('%' + arg, value); } catch (e) { return ''; }
stringformat: function (value, arg) { // TODO: this filter may not be safe try { return utils.string.sprintf('%' + arg, value); } catch (e) { return ''; } },
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter=Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a,
thisObj.renderSubfeature(param.feature, param.featDiv, val);
thisObj.renderSubfeature(param.feature, param.featDiv, val, param.displayStart, param.displayEnd);
this.subfeatureCallback = function(i, val, param) { thisObj.renderSubfeature(param.feature, param.featDiv, val); };
var submitFn =function(event){ var form = Ext.getCmp('new_ds_form').form; if (form.isValid()){ form.submit(); } }
submitFn:submitFn=function(){ var form = Ext.getCmp("general_settings_form").form; if (form.isValid()) { var undo = C.disableUnchanged(form); form.submit({ waitMsg:'Saving...', success:undo, failure:undo }); }else{ Ext.MessageBox.alert('Errors', 'Please fix the errors noted.'); } },
var submitFn =function(event){ var form = Ext.getCmp('new_ds_form').form; if (form.isValid()){ form.submit(); } }
this.subscribeToItemMutations = function(item, callback) { var itemId = item.getId(); if (!this._mutationSubscriptions[itemId]) { this._mutationSubscriptions[itemId] = {}; } var subId = 'sub' + this._uniqueId++; this._mutationSubscriptions[itemId][subId] = callback; return subId;
this.subscribeToItemMutations = function(itemId, subCallback, snapshotCallback) { var subId = this._itemSubscriberPool.add(itemId, subCallback) this._getItemSnapshot(itemId, snapshotCallback) return subId
this.subscribeToItemMutations = function(item, callback) { var itemId = item.getId(); if (!this._mutationSubscriptions[itemId]) { this._mutationSubscriptions[itemId] = {}; } var subId = 'sub' + this._uniqueId++; this._mutationSubscriptions[itemId][subId] = callback; return subId; }
success: function(result) { Symphony.Language.Dictionary = $.extend(Symphony.Language.Dictionary, result);
success: function() { Symphony.Message.clear('reorder');
success: function(result) { Symphony.Language.Dictionary = $.extend(Symphony.Language.Dictionary, result); },
success: function(result, request) { obj = Ext.util.JSON.decode(result.responseText); username_label = obj['username_label']; password_label = obj['password_label']; login_label = obj['login_label']; if (obj["validSession"] == true) { form.submit(); } else { showLoginForm(); } },
success: function() { form.submit(); },
success: function(result, request) { obj = Ext.util.JSON.decode(result.responseText); // Get localized login form strings from ajax call. // This makes translation easier from scripts using this function username_label = obj['username_label']; password_label = obj['password_label']; login_label = obj['login_label']; if (obj["validSession"] == true) { form.submit(); } else { showLoginForm(); } },
$('input[type=checkbox]#use_date_filters').click(function() { if (!$(this).is(':checked')) { $('form#filters_form_open select[name=start_year]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=start_month]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=start_day]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_year]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_month]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_day]').attr('disabled', 'disabled'); } else { $('form#filters_form_open select[name=start_year]').removeAttr('disabled'); $('form#filters_form_open select[name=start_month]').removeAttr('disabled'); $('form#filters_form_open select[name=start_day]').removeAttr('disabled'); $('form#filters_form_open select[name=end_year]').removeAttr('disabled'); $('form#filters_form_open select[name=end_month]').removeAttr('disabled'); $('form#filters_form_open select[name=end_day]').removeAttr('disabled'); } });
success: function(html) { $(this).html(html); $('input[type=checkbox]#use_date_filters').click(function() { if (!$(this).is(':checked')) { $('form#filters_form_open select[name=start_year]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=start_month]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=start_day]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_year]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_month]').attr('disabled', 'disabled'); $('form#filters_form_open select[name=end_day]').attr('disabled', 'disabled'); } else { $('form#filters_form_open select[name=start_year]').removeAttr('disabled'); $('form#filters_form_open select[name=start_month]').removeAttr('disabled'); $('form#filters_form_open select[name=start_day]').removeAttr('disabled'); $('form#filters_form_open select[name=end_year]').removeAttr('disabled'); $('form#filters_form_open select[name=end_month]').removeAttr('disabled'); $('form#filters_form_open select[name=end_day]').removeAttr('disabled'); } }); }
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=
arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,
k.apply(this,arguments);a[1].mode="hide";return this.effect.apply(this,a)}},__toggle:f.fn.toggle,toggle:function(c){if(l(c)||typeof c==="boolean"||f.isFunction(c))return this.__toggle.apply(this,arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c, a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a+b;return-d/2*(--a*(a-2)-1)+b},easeInCubic:function(c,a,b,d,e){return d*(a/=e)*a*a+b},easeOutCubic:function(c,a,b,d,e){return d*((a=a/e-1)*a*a+1)+b},easeInOutCubic:function(c,a,b,d,e){if((a/=e/2)<1)return d/2*a*a*a+b;return d/2*((a-=2)*a*a+2)+b},easeInQuart:function(c,a,b,d,e){return d*
arguments);else{var a=k.apply(this,arguments);a[1].mode="toggle";return this.effect.apply(this,a)}},cssUnit:function(c){var a=this.css(c),b=[];f.each(["em","px","%","pt"],function(d,e){if(a.indexOf(e)>0)b=[parseFloat(a),e]});return b}});f.easing.jswing=f.easing.swing;f.extend(f.easing,{def:"easeOutQuad",swing:function(c,a,b,d,e){return f.easing[f.easing.def](c,a,b,d,e)},easeInQuad:function(c,a,b,d,e){return d*(a/=e)*a+b},easeOutQuad:function(c,a,b,d,e){return-d*(a/=e)*(a-2)+b},easeInOutQuad:function(c,
f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.4",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==
f.effects.animateClass.apply(this,[{add:c},a,b,d]):this._addClass(c)},_removeClass:f.fn.removeClass,removeClass:function(c,a,b,d){return a?f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this, [{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.6",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.data("ec.storage."+a[b],c[0].style[a[b]])},restore:function(c,a){for(var b=0;b<a.length;b++)a[b]!==null&&c.css(a[b],c.data("ec.storage."+a[b]))},setMode:function(c,a){if(a=="toggle")a=c.is(":hidden")?"show":"hide";return a},getBaseline:function(c,a){var b;switch(c[0]){case "top":b=0;break;case "middle":b=0.5;break;case "bottom":b=1;break;default:b=c[0]/a.height}switch(c[1]){case "left":c=
f.effects.animateClass.apply(this,[{remove:c},a,b,d]):this._removeClass(c)},_toggleClass:f.fn.toggleClass,toggleClass:function(c,a,b,d,e){return typeof a=="boolean"||a===j?b?f.effects.animateClass.apply(this,[a?{add:c}:{remove:c},b,d,e]):this._toggleClass(c,a):f.effects.animateClass.apply(this,[{toggle:c},a,b,d])},switchClass:function(c,a,b,d,e){return f.effects.animateClass.apply(this,[{add:a,remove:c},b,d,e])}});f.extend(f.effects,{version:"1.8.4",save:function(c,a){for(var b=0;b<a.length;b++)a[b]!==
var template = $(source).clone();
var template = $(source).clone(true);
$.fn.symphonyDuplicator = function(custom_settings) { var objects = this; var settings = { instances: '> li:not(.template)', // What children do we use as instances? templates: '> li.template', // What children do we use as templates? headers: '> :first-child', // What part of an instance is the header? orderable: false, // Can instances be ordered? collapsible: false, // Can instances be collapsed? constructable: true, // Allow construction of new instances? destructable: true, // Allow destruction of instances? minimum: 0, // Do not allow instances to be removed below this limit. maximum: 1000, // Do not allow instances to be added above this limit. speed: 'fast', // Control the speed of any animations delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ // Language strings Symphony.Language.add({ 'Add item': false, 'Remove item': false, 'Expand all': false, 'Collapse all': false }); // Collapsible if (settings.collapsible) objects = objects.symphonyCollapsible({ items: '.instance', handles: '.header span' }); // Orderable if (settings.orderable) objects = objects.symphonyOrderable({ items: '.instance', handles: '.header' }); // Duplicator objects = objects.map(function() { var object = this; var templates = []; var widgets = { controls: null, selector: null, constructor: null, topcontrols: null, collapser: null }; var silence = function() { return false; }; // Construct a new instance: var construct = function(source) { var template = $(source).clone(); var instance = prepare(template); widgets.controls.before(instance); object.trigger('construct', [instance]); refresh(true); return instance; }; var destruct = function(source) { var instance = $(source).remove(); object.trigger('destruct', [instance]); refresh(); return instance; }; // Prepare an instance: var prepare = function(source) { var instance = $(source) .addClass('instance expanded'); var header = instance.find(settings.headers) .addClass('header') .wrapInner('<span />'); var destructor = header .append('<a class="destructor" />') .find('a.destructor:first') .text(Symphony.Language.get('Remove item')); header.nextAll().wrapAll('<div class="content" />'); destructor.click(function() { if ($(this).hasClass('disabled')) return; destruct(source); }); header.bind('selectstart', silence); header.mousedown(silence); return instance; }; // Refresh disabled states: var refresh = function(input_focus) { var constructor = settings.constructable; var selector = settings.constructable; var destructor = settings.destructable; var instances = object.children('.instance'); var empty = false; // Update field names: instances.each(function(position) { $(this).find('*[name]').each(function() { var exp = /\[\-?[0-9]+\]/; var name = $(this).attr('name'); if (exp.test(name)) { $(this).attr('name', name.replace(exp, '[' + position + ']')); } }); }); // Give focus to the first input in the first instance if (input_focus) instances.filter(':last').find('input[type!=hidden]:first').focus(); // No templates to add: if (templates.length < 1) { constructor = false; } // Only one template: if (templates.length <= 1) { selector = false; } // Maximum reached? if (settings.maximum <= instances.length) { constructor = false; selector = false; } // Minimum reached? if (settings.minimum >= instances.length) { destructor = false; } if (constructor) widgets.constructor.removeClass('disabled'); else widgets.constructor.addClass('disabled'); if (selector) widgets.selector.removeClass('disabled'); else widgets.selector.addClass('disabled'); if (destructor) instances.find(settings.headers).find('.destructor').removeClass('disabled'); else instances.find(settings.headers).find('.destructor').addClass('disabled'); if (!empty) object.removeClass('empty'); else object.addClass('empty'); if (settings.collapsible) object.collapsible.initialize(); if (settings.orderable) object.orderable.initialize(); }; var collapsingEnabled = function() { widgets.topcontrols.removeClass('hidden'); widgets.collapser.removeClass('disabled'); } var collapsingDisabled = function() { widgets.topcontrols.addClass('hidden'); widgets.collapser.addClass('disabled'); } var toCollapseAll = function() { widgets.collapser .removeClass('compact') .text(Symphony.Language.get('Collapse all')); }; var toExpandAll = function() { widgets.collapser .addClass('compact') .text(Symphony.Language.get('Expand all')); } /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.duplicator = { refresh: function() { refresh(); }, initialize: function() { object.addClass('duplicator'); // Prevent collapsing when ordering stops: object.bind('orderstart', function() { if (settings.collapsible) { object.collapsible.cancel(); } }); // Refresh on reorder: object.bind('orderstop', function() { refresh(); }); // Slide up on collapse: object.bind('collapsestop', function(event, item) { item.find('> .content').show().slideUp(settings.speed); }); // Slide down on expand: object.bind('expandstop', function(event, item) { item.find('> .content').hide().slideDown(settings.speed); }); widgets.controls = object .append('<div class="controls" />') .find('> .controls:last'); widgets.selector = widgets.controls .prepend('<select />') .find('> select:first'); widgets.constructor = widgets.controls .append('<a class="constructor" />') .find('> a.constructor:first') .text(Symphony.Language.get('Add item')); // Prepare instances: object.find(settings.instances).each(function() { var instance = prepare(this); object.trigger('construct', [instance]); }); // Store templates: object.find(settings.templates).each(function(position) { var template = $(this).remove(); var header = template.find(settings.headers).addClass('header'); var option = widgets.selector.append('<option />') .find('option:last'); var header_children = header.children(); if (header_children.length) { header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')'; } else { header_text = header.text(); } option.text(header_text).val(position); // HACK: preselect Text Input for Section editor if (header_text == 'Text Input') option.attr('selected', 'selected'); templates.push(template.removeClass('template')); }); // Construct new template: widgets.constructor.bind('selectstart', silence); widgets.constructor.bind('mousedown', silence); widgets.constructor.bind('click', function() { if ($(this).hasClass('disabled')) return; var position = widgets.selector.val(); if (position >= 0) construct(templates[position]); }); if (settings.collapsible) { widgets.topcontrols = object .prepend('<div class="controls top hidden" />') .find('> .controls:first') .append(widgets.controls .prepend('<a class="collapser disabled" />') .find('> a.collapser:first') .text(Symphony.Language.get('Collapse all')) .clone() ); widgets.collapser = object .find('.controls > .collapser'); if (object.children('.instance').length > 0) { collapsingEnabled(); } object.bind('construct', function() { var instances = object.children('.instance'); if (instances.length > 0) { collapsingEnabled(); } }); object.bind('destruct', function() { var instances = object.children('.instance'); if (instances.length < 1) { collapsingDisabled(); toCollapseAll(); } }); object.bind('collapsestop destruct', function() { if (object.has('.expanded').length == 0) { toExpandAll(); } }); object.bind('expandstop destruct', function() { if (object.has('.collapsed').length == 0) { toCollapseAll(); } }); widgets.collapser.bind('click', function() { var item = $(this); if (item.is('.disabled')) return; object.duplicator[item.is('.compact') ? 'expandAll' : 'collapseAll'](); }); } refresh(); }, expandAll: function() { object.collapsible.expandAll(); toCollapseAll(); }, collapseAll: function() { object.collapsible.collapseAll(); toExpandAll(); } }; if (settings.delay_initialize !== true) { object.duplicator.initialize(); } return object; }); return objects; };
var template = $(this).remove();
var template = $(this).clone(true);
$.fn.symphonyDuplicator = function(custom_settings) { var objects = this; var settings = { instances: '> li:not(.template)', // What children do we use as instances? templates: '> li.template', // What children do we use as templates? headers: '> :first-child', // What part of an instance is the header? orderable: false, // Can instances be ordered? collapsible: false, // Can instances be collapsed? constructable: true, // Allow construction of new instances? destructable: true, // Allow destruction of instances? minimum: 0, // Do not allow instances to be removed below this limit. maximum: 1000, // Do not allow instances to be added above this limit. speed: 'fast', // Control the speed of any animations delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ // Language strings Symphony.Language.add({ 'Add item': false, 'Remove item': false, 'Expand all': false, 'Collapse all': false }); // Collapsible if (settings.collapsible) objects = objects.symphonyCollapsible({ items: '.instance', handles: '.header span' }); // Orderable if (settings.orderable) objects = objects.symphonyOrderable({ items: '.instance', handles: '.header' }); // Duplicator objects = objects.map(function() { var object = this; var templates = []; var widgets = { controls: null, selector: null, constructor: null, topcontrols: null, collapser: null }; var silence = function() { return false; }; // Construct a new instance: var construct = function(source) { var template = $(source).clone(); var instance = prepare(template); widgets.controls.before(instance); object.trigger('construct', [instance]); refresh(true); return instance; }; var destruct = function(source) { var instance = $(source).remove(); object.trigger('destruct', [instance]); refresh(); return instance; }; // Prepare an instance: var prepare = function(source) { var instance = $(source) .addClass('instance expanded'); var header = instance.find(settings.headers) .addClass('header') .wrapInner('<span />'); var destructor = header .append('<a class="destructor" />') .find('a.destructor:first') .text(Symphony.Language.get('Remove item')); header.nextAll().wrapAll('<div class="content" />'); destructor.click(function() { if ($(this).hasClass('disabled')) return; destruct(source); }); header.bind('selectstart', silence); header.mousedown(silence); return instance; }; // Refresh disabled states: var refresh = function(input_focus) { var constructor = settings.constructable; var selector = settings.constructable; var destructor = settings.destructable; var instances = object.children('.instance'); var empty = false; // Update field names: instances.each(function(position) { $(this).find('*[name]').each(function() { var exp = /\[\-?[0-9]+\]/; var name = $(this).attr('name'); if (exp.test(name)) { $(this).attr('name', name.replace(exp, '[' + position + ']')); } }); }); // Give focus to the first input in the first instance if (input_focus) instances.filter(':last').find('input[type!=hidden]:first').focus(); // No templates to add: if (templates.length < 1) { constructor = false; } // Only one template: if (templates.length <= 1) { selector = false; } // Maximum reached? if (settings.maximum <= instances.length) { constructor = false; selector = false; } // Minimum reached? if (settings.minimum >= instances.length) { destructor = false; } if (constructor) widgets.constructor.removeClass('disabled'); else widgets.constructor.addClass('disabled'); if (selector) widgets.selector.removeClass('disabled'); else widgets.selector.addClass('disabled'); if (destructor) instances.find(settings.headers).find('.destructor').removeClass('disabled'); else instances.find(settings.headers).find('.destructor').addClass('disabled'); if (!empty) object.removeClass('empty'); else object.addClass('empty'); if (settings.collapsible) object.collapsible.initialize(); if (settings.orderable) object.orderable.initialize(); }; var collapsingEnabled = function() { widgets.topcontrols.removeClass('hidden'); widgets.collapser.removeClass('disabled'); } var collapsingDisabled = function() { widgets.topcontrols.addClass('hidden'); widgets.collapser.addClass('disabled'); } var toCollapseAll = function() { widgets.collapser .removeClass('compact') .text(Symphony.Language.get('Collapse all')); }; var toExpandAll = function() { widgets.collapser .addClass('compact') .text(Symphony.Language.get('Expand all')); } /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.duplicator = { refresh: function() { refresh(); }, initialize: function() { object.addClass('duplicator'); // Prevent collapsing when ordering stops: object.bind('orderstart', function() { if (settings.collapsible) { object.collapsible.cancel(); } }); // Refresh on reorder: object.bind('orderstop', function() { refresh(); }); // Slide up on collapse: object.bind('collapsestop', function(event, item) { item.find('> .content').show().slideUp(settings.speed); }); // Slide down on expand: object.bind('expandstop', function(event, item) { item.find('> .content').hide().slideDown(settings.speed); }); widgets.controls = object .append('<div class="controls" />') .find('> .controls:last'); widgets.selector = widgets.controls .prepend('<select />') .find('> select:first'); widgets.constructor = widgets.controls .append('<a class="constructor" />') .find('> a.constructor:first') .text(Symphony.Language.get('Add item')); // Prepare instances: object.find(settings.instances).each(function() { var instance = prepare(this); object.trigger('construct', [instance]); }); // Store templates: object.find(settings.templates).each(function(position) { var template = $(this).remove(); var header = template.find(settings.headers).addClass('header'); var option = widgets.selector.append('<option />') .find('option:last'); var header_children = header.children(); if (header_children.length) { header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')'; } else { header_text = header.text(); } option.text(header_text).val(position); // HACK: preselect Text Input for Section editor if (header_text == 'Text Input') option.attr('selected', 'selected'); templates.push(template.removeClass('template')); }); // Construct new template: widgets.constructor.bind('selectstart', silence); widgets.constructor.bind('mousedown', silence); widgets.constructor.bind('click', function() { if ($(this).hasClass('disabled')) return; var position = widgets.selector.val(); if (position >= 0) construct(templates[position]); }); if (settings.collapsible) { widgets.topcontrols = object .prepend('<div class="controls top hidden" />') .find('> .controls:first') .append(widgets.controls .prepend('<a class="collapser disabled" />') .find('> a.collapser:first') .text(Symphony.Language.get('Collapse all')) .clone() ); widgets.collapser = object .find('.controls > .collapser'); if (object.children('.instance').length > 0) { collapsingEnabled(); } object.bind('construct', function() { var instances = object.children('.instance'); if (instances.length > 0) { collapsingEnabled(); } }); object.bind('destruct', function() { var instances = object.children('.instance'); if (instances.length < 1) { collapsingDisabled(); toCollapseAll(); } }); object.bind('collapsestop destruct', function() { if (object.has('.expanded').length == 0) { toExpandAll(); } }); object.bind('expandstop destruct', function() { if (object.has('.collapsed').length == 0) { toCollapseAll(); } }); widgets.collapser.bind('click', function() { var item = $(this); if (item.is('.disabled')) return; object.duplicator[item.is('.compact') ? 'expandAll' : 'collapseAll'](); }); } refresh(); }, expandAll: function() { object.collapsible.expandAll(); toCollapseAll(); }, collapseAll: function() { object.collapsible.collapseAll(); toExpandAll(); } }; if (settings.delay_initialize !== true) { object.duplicator.initialize(); } return object; }); return objects; };
$(this).remove();
$.fn.symphonyDuplicator = function(custom_settings) { var objects = this; var settings = { instances: '> li:not(.template)', // What children do we use as instances? templates: '> li.template', // What children do we use as templates? headers: '> :first-child', // What part of an instance is the header? orderable: false, // Can instances be ordered? collapsible: false, // Can instances be collapsed? constructable: true, // Allow construction of new instances? destructable: true, // Allow destruction of instances? minimum: 0, // Do not allow instances to be removed below this limit. maximum: 1000, // Do not allow instances to be added above this limit. speed: 'fast', // Control the speed of any animations delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ // Language strings Symphony.Language.add({ 'Add item': false, 'Remove item': false, 'Expand all': false, 'Collapse all': false }); // Collapsible if (settings.collapsible) objects = objects.symphonyCollapsible({ items: '.instance', handles: '.header span' }); // Orderable if (settings.orderable) objects = objects.symphonyOrderable({ items: '.instance', handles: '.header' }); // Duplicator objects = objects.map(function() { var object = this; var templates = []; var widgets = { controls: null, selector: null, constructor: null, topcontrols: null, collapser: null }; var silence = function() { return false; }; // Construct a new instance: var construct = function(source) { var template = $(source).clone(); var instance = prepare(template); widgets.controls.before(instance); object.trigger('construct', [instance]); refresh(true); return instance; }; var destruct = function(source) { var instance = $(source).remove(); object.trigger('destruct', [instance]); refresh(); return instance; }; // Prepare an instance: var prepare = function(source) { var instance = $(source) .addClass('instance expanded'); var header = instance.find(settings.headers) .addClass('header') .wrapInner('<span />'); var destructor = header .append('<a class="destructor" />') .find('a.destructor:first') .text(Symphony.Language.get('Remove item')); header.nextAll().wrapAll('<div class="content" />'); destructor.click(function() { if ($(this).hasClass('disabled')) return; destruct(source); }); header.bind('selectstart', silence); header.mousedown(silence); return instance; }; // Refresh disabled states: var refresh = function(input_focus) { var constructor = settings.constructable; var selector = settings.constructable; var destructor = settings.destructable; var instances = object.children('.instance'); var empty = false; // Update field names: instances.each(function(position) { $(this).find('*[name]').each(function() { var exp = /\[\-?[0-9]+\]/; var name = $(this).attr('name'); if (exp.test(name)) { $(this).attr('name', name.replace(exp, '[' + position + ']')); } }); }); // Give focus to the first input in the first instance if (input_focus) instances.filter(':last').find('input[type!=hidden]:first').focus(); // No templates to add: if (templates.length < 1) { constructor = false; } // Only one template: if (templates.length <= 1) { selector = false; } // Maximum reached? if (settings.maximum <= instances.length) { constructor = false; selector = false; } // Minimum reached? if (settings.minimum >= instances.length) { destructor = false; } if (constructor) widgets.constructor.removeClass('disabled'); else widgets.constructor.addClass('disabled'); if (selector) widgets.selector.removeClass('disabled'); else widgets.selector.addClass('disabled'); if (destructor) instances.find(settings.headers).find('.destructor').removeClass('disabled'); else instances.find(settings.headers).find('.destructor').addClass('disabled'); if (!empty) object.removeClass('empty'); else object.addClass('empty'); if (settings.collapsible) object.collapsible.initialize(); if (settings.orderable) object.orderable.initialize(); }; var collapsingEnabled = function() { widgets.topcontrols.removeClass('hidden'); widgets.collapser.removeClass('disabled'); } var collapsingDisabled = function() { widgets.topcontrols.addClass('hidden'); widgets.collapser.addClass('disabled'); } var toCollapseAll = function() { widgets.collapser .removeClass('compact') .text(Symphony.Language.get('Collapse all')); }; var toExpandAll = function() { widgets.collapser .addClass('compact') .text(Symphony.Language.get('Expand all')); } /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.duplicator = { refresh: function() { refresh(); }, initialize: function() { object.addClass('duplicator'); // Prevent collapsing when ordering stops: object.bind('orderstart', function() { if (settings.collapsible) { object.collapsible.cancel(); } }); // Refresh on reorder: object.bind('orderstop', function() { refresh(); }); // Slide up on collapse: object.bind('collapsestop', function(event, item) { item.find('> .content').show().slideUp(settings.speed); }); // Slide down on expand: object.bind('expandstop', function(event, item) { item.find('> .content').hide().slideDown(settings.speed); }); widgets.controls = object .append('<div class="controls" />') .find('> .controls:last'); widgets.selector = widgets.controls .prepend('<select />') .find('> select:first'); widgets.constructor = widgets.controls .append('<a class="constructor" />') .find('> a.constructor:first') .text(Symphony.Language.get('Add item')); // Prepare instances: object.find(settings.instances).each(function() { var instance = prepare(this); object.trigger('construct', [instance]); }); // Store templates: object.find(settings.templates).each(function(position) { var template = $(this).remove(); var header = template.find(settings.headers).addClass('header'); var option = widgets.selector.append('<option />') .find('option:last'); var header_children = header.children(); if (header_children.length) { header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')'; } else { header_text = header.text(); } option.text(header_text).val(position); // HACK: preselect Text Input for Section editor if (header_text == 'Text Input') option.attr('selected', 'selected'); templates.push(template.removeClass('template')); }); // Construct new template: widgets.constructor.bind('selectstart', silence); widgets.constructor.bind('mousedown', silence); widgets.constructor.bind('click', function() { if ($(this).hasClass('disabled')) return; var position = widgets.selector.val(); if (position >= 0) construct(templates[position]); }); if (settings.collapsible) { widgets.topcontrols = object .prepend('<div class="controls top hidden" />') .find('> .controls:first') .append(widgets.controls .prepend('<a class="collapser disabled" />') .find('> a.collapser:first') .text(Symphony.Language.get('Collapse all')) .clone() ); widgets.collapser = object .find('.controls > .collapser'); if (object.children('.instance').length > 0) { collapsingEnabled(); } object.bind('construct', function() { var instances = object.children('.instance'); if (instances.length > 0) { collapsingEnabled(); } }); object.bind('destruct', function() { var instances = object.children('.instance'); if (instances.length < 1) { collapsingDisabled(); toCollapseAll(); } }); object.bind('collapsestop destruct', function() { if (object.has('.expanded').length == 0) { toExpandAll(); } }); object.bind('expandstop destruct', function() { if (object.has('.collapsed').length == 0) { toCollapseAll(); } }); widgets.collapser.bind('click', function() { var item = $(this); if (item.is('.disabled')) return; object.duplicator[item.is('.compact') ? 'expandAll' : 'collapseAll'](); }); } refresh(); }, expandAll: function() { object.collapsible.expandAll(); toCollapseAll(); }, collapseAll: function() { object.collapsible.collapseAll(); toExpandAll(); } }; if (settings.delay_initialize !== true) { object.duplicator.initialize(); } return object; }); return objects; };
Language strings -------------------------------------------------------------------------*/ Symphony.Language.add({ 'Add item': false, 'Remove item': false }); /*-------------------------------------------------------------------------
jQuery.fn.symphonyDuplicator = function(custom_settings) { var objects = this; var settings = { instances: '> li:not(.template)', // What children do we use as instances? templates: '> li.template', // What children do we use as templates? headers: '> :first-child', // What part of an instance is the header? orderable: false, // Can instances be ordered? collapsible: false, // Can instances be collapsed? constructable: true, // Allow construction of new instances? destructable: true, // Allow destruction of instances? minimum: 0, // Do not allow instances to be removed below this limit. maximum: 1000, // Do not allow instances to be added above this limit. speed: 'fast', // Control the speed of any animations delay_initialize: false }; jQuery.extend(settings, custom_settings); /*------------------------------------------------------------------------- Collapsible -------------------------------------------------------------------------*/ if (settings.collapsible) objects = objects.symphonyCollapsible({ items: '.instance', handles: '.header' }); /*------------------------------------------------------------------------- Orderable -------------------------------------------------------------------------*/ if (settings.orderable) objects = objects.symphonyOrderable({ items: '.instance', handles: '.header' }); /*------------------------------------------------------------------------- Duplicator -------------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var templates = []; var widgets = { controls: null, selector: null, constructor: null }; var silence = function() { return false; }; // Construct a new instance: var construct = function(source) { var template = jQuery(source).clone(); var instance = prepare(template); widgets.controls.before(instance); object.trigger('construct', [instance]); refresh(true); return instance; }; var destruct = function(source) { var instance = jQuery(source).remove(); object.trigger('destruct', [instance]); refresh(); return instance; }; // Prepare an instance: var prepare = function(source) { var instance = jQuery(source) .addClass('instance expanded'); var header = instance.find(settings.headers) .addClass('header') .wrapInner('<span />'); var destructor = header .append('<a class="destructor" />') .find('a.destructor:first') .text(Symphony.Language.get('Remove item')); header.nextAll().wrapAll('<div class="content" />'); destructor.click(function() { if (jQuery(this).hasClass('disabled')) return; destruct(source); }); header.bind('selectstart', silence); header.mousedown(silence); return instance; }; // Refresh disabled states: var refresh = function(input_focus) { var constructor = settings.constructable; var selector = settings.constructable; var destructor = settings.destructable; var instances = object.children('.instance'); var empty = false; // Update field names: instances.each(function(position) { jQuery(this).find('*[name]').each(function() { var exp = /\[\-?[0-9]+\]/; var name = jQuery(this).attr('name'); if (exp.test(name)) { jQuery(this).attr('name', name.replace(exp, '[' + position + ']')); } }); }); // Give focus to the first input in the first instance if (input_focus) instances.filter(':last').find('input[type!=hidden]:first').focus(); // No templates to add: if (templates.length < 1) { constructor = false; } // Only one template: if (templates.length <= 1) { selector = false; } // Maximum reached? if (settings.maximum <= instances.length) { constructor = false; selector = false; } // Minimum reached? if (settings.minimum >= instances.length) { destructor = false; } if (constructor) widgets.constructor.removeClass('disabled'); else widgets.constructor.addClass('disabled'); if (selector) widgets.selector.removeClass('disabled'); else widgets.selector.addClass('disabled'); if (destructor) instances.find(settings.headers).find('.destructor').removeClass('disabled'); else instances.find(settings.headers).find('.destructor').addClass('disabled'); if (!empty) object.removeClass('empty'); else object.addClass('empty'); if (settings.collapsible) object.collapsible.initialize(); if (settings.orderable) object.orderable.initialize(); }; /*-------------------------------------------------------------------*/ if (object instanceof jQuery === false) { object = jQuery(object); } object.duplicator = { refresh: function() { refresh(); }, initialize: function() { object.addClass('duplicator'); // Prevent collapsing when ordering stops: object.bind('orderstart', function() { if (settings.collapsible) { object.collapsible.cancel(); } }); // Refresh on reorder: object.bind('orderstop', function() { refresh(); }); // Slide up on collapse: object.bind('collapsestop', function(event, item) { item.find('> .content').show().slideUp(settings.speed); }); // Slide down on expand: object.bind('expandstop', function(event, item) { item.find('> .content').hide().slideDown(settings.speed); }); widgets.controls = object .append('<div class="controls" />') .find('> .controls:last'); widgets.selector = widgets.controls .prepend('<select />') .find('> select:first'); widgets.constructor = widgets.controls .append('<a class="constructor" />') .find('> a.constructor:first') .text(Symphony.Language.get('Add item')); // Prepare instances: object.find(settings.instances).each(function() { var instance = prepare(this); object.trigger('construct', [instance]); }); // Store templates: object.find(settings.templates).each(function(position) { var template = jQuery(this).remove(); var header = template.find(settings.headers).addClass('header'); var option = widgets.selector.append('<option />') .find('option:last'); var header_children = header.children(); if (header_children.length) { header_text = header.get(0).childNodes[0].nodeValue + ' (' + header_children.filter(':eq(0)').text() + ')'; } else { header_text = header.text(); } option.text(header_text).val(position); // HACK: preselect Text Input for Section editor if (header_text == 'Text Input') option.attr('selected', 'selected'); templates.push(template.removeClass('template')); }); // Construct new template: widgets.constructor.bind('selectstart', silence); widgets.constructor.bind('mousedown', silence); widgets.constructor.bind('click', function() { if (jQuery(this).hasClass('disabled')) return; var position = widgets.selector.val(); if (position >= 0) construct(templates[position]); }); refresh(); } }; if (settings.delay_initialize !== true) { object.duplicator.initialize(); } return object; }); return objects; };
state.min = Math.min(b, a + (item.prev().offset().top || -Infinity));
state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity));
jQuery.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; jQuery.extend(settings, custom_settings); /*------------------------------------------------------------------------- Orderable -------------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: jQuery(this).parents(settings.items), min: null, max: null, delta: 0 }; jQuery(document).mousemove(change); jQuery(document).mouseup(stop); jQuery(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; state.min = Math.min(b, a + (item.prev().offset().top || -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { jQuery(document).unbind('mousemove', change); jQuery(document).unbind('mouseup', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof jQuery === false) { object = jQuery(object); } object.orderable = { cancel: function() { jQuery(document).unbind('mousemove', change); jQuery(document).unbind('mouseup', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.find(settings.items).each(function() { var item = jQuery(this); var handle = item.find(settings.handles); handle.unbind('mousedown', start); handle.bind('mousedown', start); }); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
object.find(settings.items).each(function() { var item = $(this); var handle = item.find(settings.handles); handle.unbind('mousedown.orderable', start); handle.bind('mousedown.orderable', start); });
object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start);
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.find(settings.items).each(function() { var item = $(this); var handle = item.find(settings.handles); handle.unbind('mousedown.orderable', start); handle.bind('mousedown.orderable', start); }); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
var start = function() {
var start = function(item) {
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
item: $(this).parents(settings.items),
item: item,
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
return false;
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
$(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop);
$(document).unbind('.orderable');
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start);
object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', function(event) { var target = $(event.target), item = $(this).parents(settings.items); if(!target.is('input, textarea, select')) { start(item); return false; } });
$.fn.symphonyOrderable = function(custom_settings) { var objects = this; var settings = { items: 'li', handles: '*', delay_initialize: false }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = this; var state = null; var start = function() { state = { item: $(this).parents(settings.items), min: null, max: null, delta: 0 }; $(document).bind('mousemove.orderable', change); $(document).bind('mouseup.orderable', stop); $(document).mousemove(); return false; }; var change = function(event) { var item = state.item; var target, next, top = event.pageY; var a = item.height(); var b = item.offset().top; var prev = item.prev(); state.min = Math.min(b, a + (prev.size() > 0 ? prev.offset().top : -Infinity)); state.max = Math.max(a + b, b + (item.next().height() || Infinity)); if (!object.is('.ordering')) { object.addClass('ordering'); item.addClass('ordering'); object.trigger('orderstart', [state.item]); } if (top < state.min) { target = item.prev(settings.items); while (true) { state.delta--; next = target.prev(settings.items); if (next.length === 0 || top >= (state.min -= next.height())) { item.insertBefore(target); break; } target = next; } } else if (top > state.max) { target = item.next(settings.items); while (true) { state.delta++; next = target.next(settings.items); if (next.length === 0 || top <= (state.max += next.height())) { item.insertAfter(target); break; } target = next; } } object.trigger('orderchange', [state.item]); return false; }; var stop = function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('orderstop', [state.item]); state = null; } return false; }; /*-------------------------------------------------------------------*/ if (object instanceof $ === false) { object = $(object); } object.orderable = { cancel: function() { $(document).unbind('mousemove.orderable', change); $(document).unbind('mouseup.orderable', stop); if (state != null) { object.removeClass('ordering'); state.item.removeClass('ordering'); object.trigger('ordercancel', [state.item]); state = null; } }, initialize: function() { object.addClass('orderable'); object.delegate(settings.items + ' ' + settings.handles, 'mousedown.orderable', start); } }; if (settings.delay_initialize !== true) { object.orderable.initialize(); } return object; }); return objects; };
select.click(function() {
select.change(function() {
$.fn.symphonyPickable = function(custom_settings) { var objects = $(this); var settings = { pickables: '.pickable' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ // Pickables var pickables = $(settings.pickables).addClass('.pickable'); // Process pickers return objects.each(function() { var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { pickables.filter('#' + $(this).val()).hide(); }); select.click(function() { pickables.hide().filter('#' + $(this).val()).show(); }).click(); } // Single item else { picker.hide(); pickables.filter('#' + select.val()).removeClass('.pickable'); } }); }
}).click();
}).change();
$.fn.symphonyPickable = function(custom_settings) { var objects = $(this); var settings = { pickables: '.pickable' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ // Pickables var pickables = $(settings.pickables).addClass('.pickable'); // Process pickers return objects.each(function() { var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { pickables.filter('#' + $(this).val()).hide(); }); select.click(function() { pickables.hide().filter('#' + $(this).val()).show(); }).click(); } // Single item else { picker.hide(); pickables.filter('#' + select.val()).removeClass('.pickable'); } }); }
var pickers = $(this); var selectables = $(settings.selectables);
var pickers = jQuery(this); var selectables = jQuery(settings.selectables);
jQuery.fn.symphonyPicker = function(custom_settings) { // Settings var settings = { selectables: '.selectable', handle: 'selectable' }; jQuery.extend(settings, custom_settings); // Elements var pickers = $(this); var selectables = $(settings.selectables); // Process pickers return pickers.each( var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { selectables.filter('#' + $(this).val()).hide(); }); select.click(function() { selectables.hide().filter('#' + $(this).val()).show(); }).click(); }
return pickers.each( var picker = $(this);
return pickers.each(function() { var picker = jQuery(this);
jQuery.fn.symphonyPicker = function(custom_settings) { // Settings var settings = { selectables: '.selectable', handle: 'selectable' }; jQuery.extend(settings, custom_settings); // Elements var pickers = $(this); var selectables = $(settings.selectables); // Process pickers return pickers.each( var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { selectables.filter('#' + $(this).val()).hide(); }); select.click(function() { selectables.hide().filter('#' + $(this).val()).show(); }).click(); }
selectables.filter('#' + $(this).val()).hide();
selectables.filter('#' + jQuery(this).val()).hide();
jQuery.fn.symphonyPicker = function(custom_settings) { // Settings var settings = { selectables: '.selectable', handle: 'selectable' }; jQuery.extend(settings, custom_settings); // Elements var pickers = $(this); var selectables = $(settings.selectables); // Process pickers return pickers.each( var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { selectables.filter('#' + $(this).val()).hide(); }); select.click(function() { selectables.hide().filter('#' + $(this).val()).show(); }).click(); }
selectables.hide().filter('#' + $(this).val()).show();
selectables.hide().filter('#' + jQuery(this).val()).show();
jQuery.fn.symphonyPicker = function(custom_settings) { // Settings var settings = { selectables: '.selectable', handle: 'selectable' }; jQuery.extend(settings, custom_settings); // Elements var pickers = $(this); var selectables = $(settings.selectables); // Process pickers return pickers.each( var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { selectables.filter('#' + $(this).val()).hide(); }); select.click(function() { selectables.hide().filter('#' + $(this).val()).show(); }).click(); }
else { picker.hide(); selectables.filter('#' + select.val()).removeClass(settings.handle); } }); }
jQuery.fn.symphonyPicker = function(custom_settings) { // Settings var settings = { selectables: '.selectable', handle: 'selectable' }; jQuery.extend(settings, custom_settings); // Elements var pickers = $(this); var selectables = $(settings.selectables); // Process pickers return pickers.each( var picker = $(this); var select = picker.find('select'); var options = select.find('option'); // Multiple items if(options.size() > 1) { options.each(function() { selectables.filter('#' + $(this).val()).hide(); }); select.click(function() { selectables.hide().filter('#' + $(this).val()).show(); }).click(); }
object.find(settings.items).live('click', function() {
object.find(settings.items).bind('click', function() {
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).live('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() {
return objects.delegate(settings.items, 'click.tags', function(event) { var item = $(this), object = item.parent(), input = object.parent().find('label input'), value = input.val(), tag = item.attr('class') || item.text();
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text();
if(object.is('.singular')) { input.val(tag); }
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0]
else if(object.is('.inline')) { var start = input[0].selectionStart, end = input[0].selectionEnd, position = 0; if(start > 0) { input.val(value.substring(0, start) + tag + value.substring(end, value.length)); position = start + tag.length;
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
input.focus(); if (object.hasClass('singular')) { input.value = tag;
else { input.val(value + tag); position = value.length + tag.length;
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd;
input[0].selectionStart = position; input[0].selectionEnd = position; }
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length);
else { var exp = new RegExp('^' + tag + '$', 'i'), tags = value.split(/,\s*/), removed = false; for(var index in tags) { if(tags[index].match(exp)) { tags.splice(index, 1); removed = true;
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
else { input.value += tag;
else if(tags[index] == '') { tags.splice(index, 1);
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length;
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false;
if(!removed) { tags.push(tag); }
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object;
input.val(tags.join(', ')); }
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
return objects;
$.fn.symphonyTags = function(custom_settings) { var objects = this; var settings = { items: 'li' }; $.extend(settings, custom_settings); /*-----------------------------------------------------------------------*/ objects = objects.map(function() { var object = $(this); object.find(settings.items).bind('click', function() { var input = $(this).parent().prevAll('label').find('input')[0]; var tag = this.className || $(this).text(); if(input === undefined) { input = $(this).parent().prevAll('#error').find('label input')[0] } input.focus(); // Singular if (object.hasClass('singular')) { input.value = tag; } // Inline else if (object.hasClass('inline')) { var start = input.selectionStart; var end = input.selectionEnd; if (start >= 0) { input.value = input.value.substring(0, start) + tag + input.value.substring(end, input.value.length); } else { input.value += tag; } input.selectionStart = start + tag.length; input.selectionEnd = start + tag.length; } // Multiple else { var exp = new RegExp('^' + tag + '$', 'i'); var tags = input.value.split(/,\s*/); var removed = false; for (var index in tags) { if (tags[index].match(exp)) { tags.splice(index, 1); removed = true; } else if (tags[index] == '') { tags.splice(index, 1); } } if (!removed) tags.push(tag); input.value = tags.join(', '); } }); return object; }); return objects; };
log('syncWindowHistoryFocus for '+name+' ('+aOptions.currentEntry.label+')');
log('syncWindowHistoryFocus for '+name+' ('+aOptions.currentEntry.label+')', 4);
syncWindowHistoryFocus : function(aOptions) { if (!aOptions.currentEntry) throw new Error('currentEntry must be specified!'); if (!aOptions.entries) throw new Error('entries must be specified!'); if (!aOptions.windows) throw new Error('windows must be specified!'); if (aOptions.entries.length != aOptions.windows.length) throw new Error('numbers of entries and windows must be same!'); var name = aOptions.name || 'window'; log('syncWindowHistoryFocus for '+name+' ('+aOptions.currentEntry.label+')'); aOptions.entries.forEach(function(aEntry, aIndex) { var history = this.getHistory(name, aOptions.windows[aIndex]); var currentEntries = history.currentEntries; if (currentEntries.indexOf(aOptions.currentEntry) > -1) { return; } if (currentEntries.indexOf(aEntry) > -1) { log(name+' is synced for '+aIndex+' ('+aEntry.label+')'); history.index--; } }, this); },
log(name+' is synced for '+aIndex+' ('+aEntry.label+')');
log(name+' is synced for '+aIndex+' ('+aEntry.label+')', 5);
syncWindowHistoryFocus : function(aOptions) { if (!aOptions.currentEntry) throw new Error('currentEntry must be specified!'); if (!aOptions.entries) throw new Error('entries must be specified!'); if (!aOptions.windows) throw new Error('windows must be specified!'); if (aOptions.entries.length != aOptions.windows.length) throw new Error('numbers of entries and windows must be same!'); var name = aOptions.name || 'window'; log('syncWindowHistoryFocus for '+name+' ('+aOptions.currentEntry.label+')'); aOptions.entries.forEach(function(aEntry, aIndex) { var history = this.getHistory(name, aOptions.windows[aIndex]); var currentEntries = history.currentEntries; if (currentEntries.indexOf(aOptions.currentEntry) > -1) { return; } if (currentEntries.indexOf(aEntry) > -1) { log(name+' is synced for '+aIndex+' ('+aEntry.label+')'); history.index--; } }, this); },
function tabIndex(buttonId) { return OD.get(buttonId).getElementsByTagName("button")[0].tabIndex; }
function tabIndex(buttonId) { return OUD.get(buttonId).getElementsByTagName("button")[0].tabIndex; }
function tabIndex(buttonId) { return OD.get(buttonId).getElementsByTagName("button")[0].tabIndex; }
t_tag_separator = $j('#tag_separator').val(); t_tag_string = $j('#tag_string'); t_tag_select = $j('#tag_select');
t_tag_separator = $('#tag_separator').val(); t_tag_string = $('#tag_string'); t_tag_select = $('#tag_select');
function tag_string_append( p_string ) { t_tag_separator = $j('#tag_separator').val(); t_tag_string = $j('#tag_string'); t_tag_select = $j('#tag_select'); if ( Trim( p_string ) == '' ) { return; } if ( t_tag_string.val() != '' ) { t_tag_string.val( t_tag_string.val() + t_tag_separator + p_string ); } else { t_tag_string.val( t_tag_string.val() + p_string ); } t_tag_select.val(0);}
offlineIframe.contentWindow.ORBEON.xforms.Document.dispatchEvent("$containing-document$", "xxforms-offline");
offlineIframe.contentWindow.ORBEON.xforms.Document.dispatchEvent("#document", "xxforms-offline");
takeOfflineFromSummary: function(url, formOfflineListener) { ORBEON.xforms.Offline.init(); var formLoadingComplete = false; // Check at a regular interval if the flag is set, when it is load the form in the frame. var formLoadingIntervalID = window.setInterval(function() { if (formLoadingComplete) { window.clearInterval(formLoadingIntervalID); // Load the form in the iframe ORBEON.xforms.Offline.loadFormInIframe(url, function(offlineIframe) { // Wait for the form to be marked as offline before we call the listener var takingFormOfflineIntervalID = window.setInterval(function() { if (! offlineIframe.contentWindow.ORBEON.xforms.Offline.isOnline) { window.clearInterval(takingFormOfflineIntervalID); // Calling listener to notify that the form is now completely offline if (formOfflineListener) formOfflineListener(offlineIframe.contentWindow); } }, 100); // Send offline event to the server offlineIframe.contentWindow.ORBEON.xforms.Document.dispatchEvent("$containing-document$", "xxforms-offline"); }); } }, 100); // We first capture the form ORBEON.xforms.Offline.formStore.capture(url, function (url, success, captureId) { // When capture is done, set a flag. // We need to resort to this trick because the code here does not run the same context and setting src // attribute on the iframe would otherwise fail. formLoadingComplete = true; }); },
ORBEON.xforms.Document.dispatchEvent("$containing-document$", "xxforms-online");
ORBEON.xforms.Document.dispatchEvent("#document", "xxforms-online");
takeOnline: function(beforeOnlineListener) { ORBEON.xforms.Offline.init(); // Update the static state and dynamic state with the one from the database var resultSet = ORBEON.xforms.Offline.gearsDatabase.execute("select form_id, static_state, dynamic_state, offline_events from Offline_Forms where url = ?", [window.location.href]); var formID = resultSet.fieldByName("form_id"); ORBEON.xforms.Globals.formDynamicState[formID].value = resultSet.fieldByName("dynamic_state"); ORBEON.xforms.Globals.formStaticState[formID].value = resultSet.fieldByName("static_state"); // Prepare array with all the events that happened since the form was taken offline // Get all events from the database to create events array var eventsString = resultSet.fieldByName("offline_events"); eventsString = ORBEON.xforms.Offline._decrypt(eventsString, ORBEON.xforms.Offline.getEncryptionKey()); ORBEON.xforms.Offline.lastRequestIsTakeOnline = true; ORBEON.xforms.Offline.isOnline = true; // Need to set this early, otherwise even won't reach the server if (eventsString != "") { var eventsStringArray = eventsString.split(" "); var events = []; for (var eventIndex = 0; eventIndex < eventsStringArray.length; eventIndex++) { var eventString = unescape(eventsStringArray[eventIndex]); // Extract components of event into an array and unescape each one var eventArray = eventString.split(" "); for (var eventComponentIndex = 0; eventComponentIndex < eventArray.length; eventComponentIndex++) eventArray[eventComponentIndex] = unescape(eventArray[eventComponentIndex]); // Create event object events.push(new ORBEON.xforms.Server.Event( ORBEON.util.Dom.getElementById(eventArray[0]), eventArray[1], eventArray[2], eventArray[3], eventArray[4], eventArray[5], eventArray[6] == "1", eventArray[7] == "1")); } // Send all the events back to the server ORBEON.xforms.Server.fireEvents(events, false); } // Tell the server we are going online ORBEON.xforms.Document.dispatchEvent("$containing-document$", "xxforms-online"); // Give a chance to some code to run before the online event is sent to the server if (!YAHOO.lang.isUndefined(beforeOnlineListener)) beforeOnlineListener(window); },
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
{setup:function(){if(this.nodeName.toLowerCase()!=="form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length)return na("submit",this,arguments)});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13)return na("submit",this,arguments)})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};
var thiss = this; thiss.closeAccordionCase(thiss, '_314209', function() { thiss.openAccordionCase(thiss, '_314209', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314209$table-314209-table'); var visibility = YAHOO.util.Dom.getStyle(table, 'visibility'); YAHOO.util.Assert.isTrue(visibility == 'visible' || visibility == 'inherit', 'Visibility should be visible or inherit, not ' + visibility); thiss.closeAccordionCase(thiss, '_314209');
var thiss = this; thiss.closeAccordionCase(thiss, '_314209', function() { thiss.openAccordionCase(thiss, '_314209', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314209$table-314209-table'); var visibility = YAHOO.util.Dom.getStyle(table, 'visibility'); YAHOO.util.Assert.isTrue(visibility == 'visible' || visibility == 'inherit', 'Visibility should be visible or inherit, not ' + visibility); thiss.closeAccordionCase(thiss, '_314209'); });
test314209: function() { var thiss = this; thiss.closeAccordionCase(thiss, '_314209', function() { thiss.openAccordionCase(thiss, '_314209', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314209$table-314209-table'); var visibility = YAHOO.util.Dom.getStyle(table, 'visibility'); YAHOO.util.Assert.isTrue(visibility == 'visible' || visibility == 'inherit', 'Visibility should be visible or inherit, not ' + visibility); // unfortunately, I haven't found any way to check that the table is actually visible! thiss.closeAccordionCase(thiss, '_314209'); }); }); }
}); }
}
test314209: function() { var thiss = this; thiss.closeAccordionCase(thiss, '_314209', function() { thiss.openAccordionCase(thiss, '_314209', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314209$table-314209-table'); var visibility = YAHOO.util.Dom.getStyle(table, 'visibility'); YAHOO.util.Assert.isTrue(visibility == 'visible' || visibility == 'inherit', 'Visibility should be visible or inherit, not ' + visibility); // unfortunately, I haven't found any way to check that the table is actually visible! thiss.closeAccordionCase(thiss, '_314209'); }); }); }
var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true);
var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() {
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
ORBEON.xforms.Document.setValue("show", "false");
ORBEON.xforms.Document.setValue("show", "true");
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted");
var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true);
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
ORBEON.xforms.Document.setValue("show", "true");
ORBEON.xforms.Document.setValue("show", "false");
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
thiss.checkTableStructure(table, 1, true);
YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true);
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
thiss.closeAccordionCase(thiss, '_314415');
thiss.closeAccordionCase(thiss, '_314415'); });
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
}); } ) ; },
} ) ; },
test314415: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314415', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); YAHOO.util.Assert.isNull(table, "The table should have been deleted"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314415-table$_314415-table-table·1'); thiss.checkTableStructure(table, 1, true); thiss.closeAccordionCase(thiss, '_314415'); }); }); }); } ) ; },
var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']);
var link6 = thiss.getPaginateLink(container, 'last >>');
test314422: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314422', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "1000"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-table'); thiss.checkColumnValues(table, 1, false, [0, 1, 2, 3, 4]); var container = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+next >', '+last >>']); var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { // Test the status after clicking on "last" thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']); thiss.closeAccordionCase(thiss, '_314422'); }); }); }); }); }
ORBEON.xforms.Document.setValue("maxLength", "30");
YAHOO.util.UserAction.click(link6, {clientX: 1});
test314422: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314422', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "1000"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-table'); thiss.checkColumnValues(table, 1, false, [0, 1, 2, 3, 4]); var container = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+next >', '+last >>']); var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { // Test the status after clicking on "last" thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']); thiss.closeAccordionCase(thiss, '_314422'); }); }); }); }); }
thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']);
thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']);
test314422: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314422', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "1000"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-table'); thiss.checkColumnValues(table, 1, false, [0, 1, 2, 3, 4]); var container = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+next >', '+last >>']); var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { // Test the status after clicking on "last" thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']); thiss.closeAccordionCase(thiss, '_314422'); }); }); }); }); }
thiss.closeAccordionCase(thiss, '_314422');
thiss.closeAccordionCase(thiss, '_314422'); });
test314422: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314422', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "1000"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-table'); thiss.checkColumnValues(table, 1, false, [0, 1, 2, 3, 4]); var container = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+next >', '+last >>']); var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { // Test the status after clicking on "last" thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']); thiss.closeAccordionCase(thiss, '_314422'); }); }); }); }); }
}); }
}
test314422: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314422', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "1000"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-table'); thiss.checkColumnValues(table, 1, false, [0, 1, 2, 3, 4]); var container = YAHOO.util.Dom.get('my-accordion$_314422-table$_314422-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+3', '+4', '+5', '+6', '+7', '+8', '+next >', '+last >>']); var link6 = thiss.getPaginateLink(container, 'last >>'); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(link6, {clientX: 1}); }, function() { thiss.checkColumnValues(table, 1, false, [35, 36, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '+2', '+3', '+4', '+5', '+6', '+7', '-8', '-next >', '-last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); }, function() { // Test the status after clicking on "last" thiss.checkColumnValues(table, 1, false, [35, 37]); thiss.checkPaginationLinks(container, ['+<< first', '+< prev', '+1', '-2', '-next >', '-last >>']); thiss.closeAccordionCase(thiss, '_314422'); }); }); }); }); }
var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']);
var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() {
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
ORBEON.xforms.Document.setValue("show", "false");
ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true");
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table');
var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table');
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []);
var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']);
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
ORBEON.xforms.Document.setValue("show", "true");
ORBEON.xforms.Document.setValue("show", "false");
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']);
thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']);
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
thiss.closeAccordionCase(thiss, '_314459');
thiss.closeAccordionCase(thiss, '_314459'); });
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
}); },
},
test314459: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314459', function() { ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("maxLength", "30"); ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure var table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); var container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "false"); }, function() { table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, []); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { ORBEON.xforms.Document.setValue("show", "true"); }, function() { // Check the table structure table = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-table'); thiss.checkTableStructure(table, 1, false); container = YAHOO.util.Dom.get('my-accordion$_314459-table$_314459-table-container'); thiss.checkPaginationLinks(container, ['-<< first', '-< prev', '-1', '+2', '+next >', '+last >>']); thiss.closeAccordionCase(thiss, '_314459'); }); }); }); }); },
YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200);
YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200); });
test314466: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314466', function() { var table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); var container = table.parentNode.parentNode; YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable shouldn't be initialized at that point"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$show-314466'), {clientX: 1}); }, function() { thiss.wait(function() { table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); var container = table.parentNode.parentNode; YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable should be initialized at that point"); YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200); }); }); },
}); },
},
test314466: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314466', function() { var table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); var container = table.parentNode.parentNode; YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable shouldn't be initialized at that point"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$show-314466'), {clientX: 1}); }, function() { thiss.wait(function() { table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); var container = table.parentNode.parentNode; YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable should be initialized at that point"); YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200); }); }); },
YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshouldn't be initialized at that point");
var container = table.parentNode.parentNode; YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable shouldn't be initialized at that point");
test314466: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314466', function() { var table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshouldn't be initialized at that point"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$show-314466'), {clientX: 1}); }, function() { thiss.wait(function() { table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshould be initialized at that point"); YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200); }); }); },
YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshould be initialized at that point");
var container = table.parentNode.parentNode; YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(container, 'fr-dt-initialized'), "The datatable should be initialized at that point");
test314466: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314466', function() { var table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); YAHOO.util.Assert.isFalse(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshouldn't be initialized at that point"); ORBEON.util.Test.executeCausingAjaxRequest(thiss, function() { YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$show-314466'), {clientX: 1}); }, function() { thiss.wait(function() { table = YAHOO.util.Dom.get('my-accordion$_314466-table$_314466-table-table'); YAHOO.util.Assert.isTrue(YAHOO.util.Dom.hasClass(table, 'fr-dt-initialized'), "The datatable sshould be initialized at that point"); YAHOO.util.UserAction.click(YAHOO.util.Dom.get('my-accordion$hide-314466'), {clientX: 1}); thiss.closeAccordionCase(thiss, '_314466') }, 200); }); }); },
var thiss = this; thiss.openAccordionCase(thiss, '_314679', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314679$table-314679-table'); thiss.clickAndCheckSortOrder(table, 1, 'descending', ['three', 'two', 'one'], function() { thiss.closeAccordionCase(thiss, '_314679');
var thiss = this; thiss.openAccordionCase(thiss, '_314679', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314679$table-314679-table'); thiss.clickAndCheckSortOrder(table, 1, 'descending', ['three', 'two', 'one'], function() { thiss.closeAccordionCase(thiss, '_314679'); });
test314679: function() { var thiss = this; thiss.openAccordionCase(thiss, '_314679', function() { var table = YAHOO.util.Dom.get('my-accordion$table-314679$table-314679-table'); thiss.clickAndCheckSortOrder(table, 1, 'descending', ['three', 'two', 'one'], function() { thiss.closeAccordionCase(thiss, '_314679'); }); }); }