Commit 76917b69 authored by GROSS-AMBLARD David's avatar GROSS-AMBLARD David
Browse files

Merge branch...

Merge branch '119-blockly-monter-un-blockly-dans-headwork-n-importe-quelle-page-sur-le-modele-de-drawartifact-php' into 'master'

Resolve "[Blockly] Monter un blockly dans HEADWORK (n’importe quelle page, sur le modele de drawArtifact.php)"

Closes #119

See merge request druid/headwork!67
parents ec7be05c 7e64dcf3
<?php
require_once("config.php");
/**
* HW library
*
......
<?php
/*
<!DOCTYPE html>
......@@ -39,6 +40,7 @@
integrity="sha512-gZwIG9x3wUXg2hdXF6+rVkLF/0Vi9U8D2Ntg4Ga5I5BZpVkVxlJWbSQtXPSiUTtC0TjtGOmxa1AJPuV0CPthew=="
crossorigin=""></script>
<script src='cytoscape.min.js'></script>
<style>
#cy {
width: 600px;
......@@ -119,6 +121,7 @@ function drawArtifact($conn,$artifactid){
</div>
<script type="text/javascript">
EOF;
$VIEW['MAIN'].="var jsonString=`".$jsonString."`;";
$VIEW['MAIN'].="var jsonStringSugarFree=`".$jsonStringSugarFree."`;";
......@@ -398,6 +401,7 @@ evt.target.animate({
var toggleElement = document.getElementById('toggleId');
cy.on('click', 'edge', function(evt){
sugaryToggleFunction();
evt.target.animate({
......
......@@ -32,6 +32,7 @@ require("show-pages.php");
require("artifacts.php");
require("show-artifact.php");
require("drawArtifact.php");
require("workflowdesign.php");
session_start();
......@@ -161,9 +162,9 @@ switch ($mode) {
startArtifact($conn, $_GET['artifactid'],$_SESSION['id']);
showTasks($conn);
break;
case "embark":
embark($conn);
break;
case "workflowdesign":
workflowdesign($conn);
break;
case "addArtifact":
addArtifact($conn,$_POST['artifact']);
break;
......
# Changes
## 1.8.3
- [`6af2d0c`](https://github.com/sinonjs/commons/commit/6af2d0cf33e9fd1e4aaef5308fd16a9cd78a5782)
Bump y18n from 4.0.0 to 4.0.1 (dependabot[bot])
>
> Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
> - [Release notes](https://github.com/yargs/y18n/releases)
> - [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
> - [Commits](https://github.com/yargs/y18n/commits)
>
> Signed-off-by: dependabot[bot] <support@github.com>
_Released on 2021-04-08._
## 1.8.2
- [`6b7a796`](https://github.com/sinonjs/commons/commit/6b7a796ffc088b43dc283cc4477a7d641720dc96)
Add .d.ts files to package (Morgan Roderick)
>
> In order to improve the experience of TypeScript users, we are compiling
> `.d.ts` files from the JSDoc and distributing them with the package
>
_Released on 2021-01-13._
## 1.8.1
- [`07b9e7a`](https://github.com/sinonjs/commons/commit/07b9e7a1d784771273a9a58d74945bbc7319b5d4)
Optimize npm package size (Uladzimir Havenchyk)
_Released on 2020-07-17._
## 1.8.0
- [`4282205`](https://github.com/sinonjs/commons/commit/4282205343a4dcde2a35ccf2a8c2094300dad369)
Emit deprecationg warnings in node, and keep console info in browsers (mshaaban0)
_Released on 2020-05-20._
## 1.7.2
- [`76ad9c1`](https://github.com/sinonjs/commons/commit/76ad9c16bad29f72420ed55bdf45b65d076108c8)
Fix generators causing exceptions in function-name (Sebastian Mayr)
_Released on 2020-04-08._
## 1.7.1
- [`0486d25`](https://github.com/sinonjs/commons/commit/0486d250ecec9b5f9aa2210357767e413f4162d3)
Upgrade eslint-config-sinon, add eslint-plugin-jsdoc (Morgan Roderick)
>
> This adds linting of jsdoc
>
_Released on 2020-02-19._
BSD 3-Clause License
Copyright (c) 2018, Sinon.JS
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# commons
[![CircleCI](https://circleci.com/gh/sinonjs/commons.svg?style=svg)](https://circleci.com/gh/sinonjs/commons)
[![codecov](https://codecov.io/gh/sinonjs/commons/branch/master/graph/badge.svg)](https://codecov.io/gh/sinonjs/commons)
<a href="CODE_OF_CONDUCT.md"><img src="https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg" alt="Contributor Covenant" /></a>
Simple functions shared among the sinon end user libraries
## Rules
- Follows the [Sinon.JS compatibility](https://github.com/sinonjs/sinon/blob/master/CONTRIBUTING.md#compatibility)
- 100% test coverage
- Code formatted using [Prettier](https://prettier.io)
- No side effects welcome! (only pure functions)
- No platform specific functions
- One export per file (any bundler can do tree shaking)
"use strict";
var every = require("./prototypes/array").every;
/**
* @private
*/
function hasCallsLeft(callMap, spy) {
if (callMap[spy.id] === undefined) {
callMap[spy.id] = 0;
}
return callMap[spy.id] < spy.callCount;
}
/**
* @private
*/
function checkAdjacentCalls(callMap, spy, index, spies) {
var calledBeforeNext = true;
if (index !== spies.length - 1) {
calledBeforeNext = spy.calledBefore(spies[index + 1]);
}
if (hasCallsLeft(callMap, spy) && calledBeforeNext) {
callMap[spy.id] += 1;
return true;
}
return false;
}
/**
* A Sinon proxy object (fake, spy, stub)
*
* @typedef {object} SinonProxy
* @property {Function} calledBefore - A method that determines if this proxy was called before another one
* @property {string} id - Some id
* @property {number} callCount - Number of times this proxy has been called
*/
/**
* Returns true when the spies have been called in the order they were supplied in
*
* @param {SinonProxy[] | SinonProxy} spies An array of proxies, or several proxies as arguments
* @returns {boolean} true when spies are called in order, false otherwise
*/
function calledInOrder(spies) {
var callMap = {};
// eslint-disable-next-line no-underscore-dangle
var _spies = arguments.length > 1 ? arguments : spies;
return every(_spies, checkAdjacentCalls.bind(null, callMap));
}
module.exports = calledInOrder;
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var calledInOrder = require("./called-in-order");
var sinon = require("@sinonjs/referee-sinon").sinon;
var testObject1 = {
someFunction: function() {
return;
}
};
var testObject2 = {
otherFunction: function() {
return;
}
};
var testObject3 = {
thirdFunction: function() {
return;
}
};
function testMethod() {
testObject1.someFunction();
testObject2.otherFunction();
testObject2.otherFunction();
testObject2.otherFunction();
testObject3.thirdFunction();
}
describe("calledInOrder", function() {
beforeEach(function() {
sinon.stub(testObject1, "someFunction");
sinon.stub(testObject2, "otherFunction");
sinon.stub(testObject3, "thirdFunction");
testMethod();
});
afterEach(function() {
testObject1.someFunction.restore();
testObject2.otherFunction.restore();
testObject3.thirdFunction.restore();
});
describe("given single array argument", function() {
describe("when stubs were called in expected order", function() {
it("returns true", function() {
assert.isTrue(
calledInOrder([
testObject1.someFunction,
testObject2.otherFunction
])
);
assert.isTrue(
calledInOrder([
testObject1.someFunction,
testObject2.otherFunction,
testObject2.otherFunction,
testObject3.thirdFunction
])
);
});
});
describe("when stubs were called in unexpected order", function() {
it("returns false", function() {
assert.isFalse(
calledInOrder([
testObject2.otherFunction,
testObject1.someFunction
])
);
assert.isFalse(
calledInOrder([
testObject2.otherFunction,
testObject1.someFunction,
testObject1.someFunction,
testObject3.thirdFunction
])
);
});
});
});
describe("given multiple arguments", function() {
describe("when stubs were called in expected order", function() {
it("returns true", function() {
assert.isTrue(
calledInOrder(
testObject1.someFunction,
testObject2.otherFunction
)
);
assert.isTrue(
calledInOrder(
testObject1.someFunction,
testObject2.otherFunction,
testObject3.thirdFunction
)
);
});
});
describe("when stubs were called in unexpected order", function() {
it("returns false", function() {
assert.isFalse(
calledInOrder(
testObject2.otherFunction,
testObject1.someFunction
)
);
assert.isFalse(
calledInOrder(
testObject2.otherFunction,
testObject1.someFunction,
testObject3.thirdFunction
)
);
});
});
});
});
"use strict";
var functionName = require("./function-name");
/**
* Returns a display name for a value from a constructor
*
* @param {object} value A value to examine
* @returns {(string|null)} A string or null
*/
function className(value) {
return (
(value.constructor && value.constructor.name) ||
// The next branch is for IE11 support only:
// Because the name property is not set on the prototype
// of the Function object, we finally try to grab the
// name from its definition. This will never be reached
// in node, so we are not able to test this properly.
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/name
(typeof value.constructor === "function" &&
/* istanbul ignore next */
functionName(value.constructor)) ||
null
);
}
module.exports = className;
"use strict";
/* eslint-disable no-empty-function */
var assert = require("@sinonjs/referee").assert;
var className = require("./class-name");
describe("className", function() {
it("returns the class name of an instance", function() {
// Because eslint-config-sinon disables es6, we can't
// use a class definition here
// https://github.com/sinonjs/eslint-config-sinon/blob/master/index.js
// var instance = new (class TestClass {})();
var instance = new (function TestClass() {})();
var name = className(instance);
assert.equals(name, "TestClass");
});
it("returns 'Object' for {}", function() {
var name = className({});
assert.equals(name, "Object");
});
it("returns null for an object that has no prototype", function() {
var obj = Object.create(null);
var name = className(obj);
assert.equals(name, null);
});
it("returns null for an object whose prototype was mangled", function() {
// This is what Node v6 and v7 do for objects returned by querystring.parse()
function MangledObject() {}
MangledObject.prototype = Object.create(null);
var obj = new MangledObject();
var name = className(obj);
assert.equals(name, null);
});
});
/* eslint-disable no-console */
"use strict";
/**
* Returns a function that will invoke the supplied function and print a
* deprecation warning to the console each time it is called.
*
* @param {Function} func
* @param {string} msg
* @returns {Function}
*/
exports.wrap = function(func, msg) {
var wrapped = function() {
exports.printWarning(msg);
return func.apply(this, arguments);
};
if (func.prototype) {
wrapped.prototype = func.prototype;
}
return wrapped;
};
/**
* Returns a string which can be supplied to `wrap()` to notify the user that a
* particular part of the sinon API has been deprecated.
*
* @param {string} packageName
* @param {string} funcName
* @returns {string}
*/
exports.defaultMsg = function(packageName, funcName) {
return (
packageName +
"." +
funcName +
" is deprecated and will be removed from the public API in a future version of " +
packageName +
"."
);
};
/**
* Prints a warning on the console, when it exists
*
* @param {string} msg
* @returns {undefined}
*/
exports.printWarning = function(msg) {
/* istanbul ignore next */
if (typeof process === "object" && process.emitWarning) {
// Emit Warnings in Node
process.emitWarning(msg);
} else if (console.info) {
console.info(msg);
} else {
console.log(msg);
}
};
/* eslint-disable no-console */
"use strict";
var assert = require("@sinonjs/referee-sinon").assert;
var sinon = require("@sinonjs/referee-sinon").sinon;
var deprecated = require("./deprecated");
var msg = "test";
describe("deprecated", function() {
describe("defaultMsg", function() {
it("should return a string", function() {
assert.equals(
deprecated.defaultMsg("sinon", "someFunc"),
"sinon.someFunc is deprecated and will be removed from the public API in a future version of sinon."
);
});
});
describe("printWarning", function() {
beforeEach(function() {
sinon.replace(process, "emitWarning", sinon.fake());
});
afterEach(sinon.restore);
describe("when `process.emitWarning` is defined", function() {
it("should call process.emitWarning with a msg", function() {
deprecated.printWarning(msg);
assert.calledOnceWith(process.emitWarning, msg);
});
});
describe("when `process.emitWarning` is undefined", function() {
beforeEach(function() {
sinon.replace(console, "info", sinon.fake());
sinon.replace(console, "log", sinon.fake());
process.emitWarning = undefined;
});
afterEach(sinon.restore);
describe("when `console.info` is defined", function() {
it("should call `console.info` with a message", function() {
deprecated.printWarning(msg);
assert.calledOnceWith(console.info, msg);
});
});
describe("when `console.info` is undefined", function() {
it("should call `console.log` with a message", function() {
console.info = undefined;
deprecated.printWarning(msg);
assert.calledOnceWith(console.log, msg);
});
});
});
});
describe("wrap", function() {
var method = sinon.fake();
var wrapped;
beforeEach(function() {
wrapped = deprecated.wrap(method, msg);
});
it("should return a wrapper function", function() {
assert.match(wrapped, sinon.match.func);
});
it("should assign the prototype of the passed method", function() {
assert.equals(method.prototype, wrapped.prototype);
});
context("when the passed method has falsy prototype", function() {
it("should not be assigned to the wrapped method", function() {
method.prototype = null;
wrapped = deprecated.wrap(method, msg);
assert.match(wrapped.prototype, sinon.match.object);
});
});
context("when invoking the wrapped function", function() {
before(function() {
sinon.replace(deprecated, "printWarning", sinon.fake());
wrapped({});
});
it("should call `printWarning` before invoking", function() {
assert.calledOnceWith(deprecated.printWarning, msg);
});
it("should invoke the passed method with the given arguments", function() {
assert.calledOnceWith(method, {});
});
});
});
});
"use strict";
/**
* Returns true when fn returns true for all members of obj.
* This is an every implementation that works for all iterables
*
* @param {object} obj
* @param {Function} fn
* @returns {boolean}
*/
module.exports = function every(obj, fn) {
var pass = true;
try {
// eslint-disable-next-line @sinonjs/no-prototype-methods/no-prototype-methods
obj.forEach(function() {
if (!fn.apply(this, arguments)) {
// Throwing an error is the only way to break `forEach`
throw new Error();
}
});
} catch (e) {
pass = false;
}
return pass;
};