Skip to content

Commit

Permalink
added some licenses
Browse files Browse the repository at this point in the history
  • Loading branch information
nrox committed Aug 15, 2013
1 parent e8a9d9a commit 3329199
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 25 deletions.
8 changes: 4 additions & 4 deletions public/assembler/database.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function ServedDatabase(staticComponents) {
};
this.localDatabase = {};
this.publicUsers = [
'public', 'Public', 'Vendor', 'Commercial', 'Store', 'Shop', 'Database', 'Abstract', 'Components', 'Basic', 'Geometry',
'Learning', 'Tutorials', 'Examples', 'Demos', 'Assembler', 'Assemblino', 'Tests', 'Trash', 'Robots'
'public','Public','Vendor','Commercial','Store','Shop','Database','Abstract','Components','Basic','Geometric',
'Learning','Tutorial','Tutorials','Example','Examples', 'Demos','Assembler','Assemblino','Tests','Trash','Robots','Desktop','Local','Server'
];
}

Expand Down Expand Up @@ -300,8 +300,8 @@ ServedDatabase.prototype.getUsername = function () {
return this.sessionInfo.user;
};

ServedDatabase.prototype.userIsPublic = function () {
return this.publicUsers.indexOf(this.sessionInfo.user) > -1;
ServedDatabase.prototype.userIsPublic = function (user) {
return this.publicUsers.indexOf(user || this.sessionInfo.user) > -1;
};

ServedDatabase.prototype.isDesktopFile = function (name) {
Expand Down
69 changes: 51 additions & 18 deletions public/assembler/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ OperationsManager.prototype.parseComments = function (obj) {
if (typeof obj === 'string') {
info = obj;
} else {
if (typeof obj !== 'object'){
if (typeof obj !== 'object') {
obj = this.servedDatabase.get(obj) || this.servedDatabase.getByName(obj);
}
if (!obj) return "";
Expand Down Expand Up @@ -230,7 +230,7 @@ OperationsManager.prototype.failureReport = function () {

OperationsManager.prototype.editComponent = function (obj, preCompiledObject) {
if (!obj) return;
if (preCompiledObject === undefined && this.servedDatabase.updateObjectFromDesktopFile(obj)){
if (preCompiledObject === undefined && this.servedDatabase.updateObjectFromDesktopFile(obj)) {
return;
}
var _this = this;
Expand All @@ -245,7 +245,7 @@ OperationsManager.prototype.editComponent = function (obj, preCompiledObject) {
this.editor.object = obj;
TRACKER.clear(obj.name);
resetNextInt();
if (preCompiledObject===undefined){
if (preCompiledObject === undefined) {
preCompiledObject = codeObject(obj.code, null, obj.name);
}
if (preCompiledObject) {
Expand Down Expand Up @@ -276,7 +276,7 @@ OperationsManager.prototype.editComponent = function (obj, preCompiledObject) {
this.last_change = obj.last_change;
this.normalizePointer();
this.menus.updateOptions();
if(preCompiledObject) {
if (preCompiledObject) {
preCompiledObject.addToScene(this.simulator,
function () {
_this.simulator.runProgram = !!_this.getOption('autoStart');
Expand Down Expand Up @@ -390,11 +390,11 @@ OperationsManager.prototype.newComponent = function (type) {
settings.options.codeEditor = true;
settings.options.renderInterval = 250;
settings.options.simulationQuality = 2;
} else if (type == 'System'){
} else if (type == 'System') {
settings.options.codeEditor = true;
settings.options.renderInterval = 200;
settings.options.simulationQuality = 5;
} else if (type == 'Assemble'){
} else if (type == 'Assemble') {
settings.options.codeEditor = false;
settings.options.renderInterval = 150;
settings.options.simulationQuality = 10;
Expand Down Expand Up @@ -499,7 +499,7 @@ OperationsManager.prototype.updateContentOptions = function () {
};

OperationsManager.prototype.updateAllControllerOptions = function () {
var relevant = ['isEnabled','rpm','angle','position']; //this declaration should be somewhere in actuators.js
var relevant = ['isEnabled', 'rpm', 'angle', 'position']; //this declaration should be somewhere in actuators.js
var _this = this;
var fixedConnectors = _.filter(Assemblino.simulator.connectors, function (c) {
return c.isConnected && c.isFixed;
Expand All @@ -526,13 +526,45 @@ var lastSettings = {};

OperationsManager.prototype.autoLoad = function () {
var id = uriParameter('id') || uriParameter('name') || this.localDatabase.lastEdited || this.servedDatabase.getInfo('lastEdited');
var obj = this.servedDatabase.get(id) || this.servedDatabase.getByName(id);
if (obj) {
this.editComponent(obj);
Assemblino.menus.toggleSymbol(false, "");
var dependencies = uriParameter('dependencies');
if (dependencies) {
if (Assemblino.database.getUsername()){
Assemblino.database.sessionInfo.user = "";
jQuery.ajax("/logout.html", {
cache: false,
type: 'GET',
success: function(){
notify('To inspect shared components you were automatically logged you out as a security procedure.');
window.location.reload();
}
});
return;
}
jQuery.ajax("/show/" + dependencies + ".json", {
cache: false,
type: 'GET',
success: process
});
} else {
this.menus.toggleUserUXControls(false);
Assemblino.menus.toggleSymbol(true, "Done!");
process(null);
}
function process(json) {
if (json){
_.map(json, function(o,i){
if (!Assemblino.database.get(o.id)) {
Assemblino.database.set(o);
Assemblino.menus.addComponentToGui(o);
}
});
}
var obj = Assemblino.database.get(id) || Assemblino.database.getByName(id);
if (obj) {
Assemblino.manager.editComponent(obj);
Assemblino.menus.toggleSymbol(false, "");
} else {
Assemblino.menus.toggleUserUXControls(false);
Assemblino.menus.toggleSymbol(true, "Done!");
}
}
};

Expand All @@ -547,7 +579,7 @@ OperationsManager.prototype.insertComponentAsChild = function (obj) {
//this forces the name to be the first item
var settings = _.extend({name: ""}, lastSettings[obj.name] || o.getOptions() || {});
settings.name = nextName(settings.name || obj.name);
while(_this.hasObject(settings.name, _this.getObjectName())) {
while (_this.hasObject(settings.name, _this.getObjectName())) {
settings.name = nextName(settings.name);
}
_.map(o.getSettings(), function (v, k) {
Expand Down Expand Up @@ -599,7 +631,7 @@ OperationsManager.prototype.cloneComponent = function (name) {
var objectConstructor = _this.content.declarations[name].object;
var obj = this.servedDatabase.getByName(objectConstructor);
settings.name = nextName(settings.name || obj.name);
while(_this.hasObject(settings.name, _this.getObjectName())) {
while (_this.hasObject(settings.name, _this.getObjectName())) {
settings.name = nextName(settings.name);
}
var o = codeObject(obj.code, null, obj.name);
Expand Down Expand Up @@ -657,6 +689,7 @@ OperationsManager.prototype.updateOnSceneComponent = function (key) {
}
});
var oldName = settings.name;

function updateComponent() {
var newSettings = _this.menus.popMenuValues(settings);
var chosenName = newSettings.name;
Expand Down Expand Up @@ -708,7 +741,7 @@ OperationsManager.prototype.changeConnection = function (fixed, moved, type) {
settings = _.defaults(settings, defaults);
settings = _.pick(settings, 'name', 'type', _.keys(defaults));
_.defaults(settings, {name: nextName('CONTROL')});
while (this.hasObject(settings.name, this.getObjectName())){
while (this.hasObject(settings.name, this.getObjectName())) {
settings.name = nextName(settings.name);
}
var types = _.intersection(fixed.options.accept, moved.options.accept, Assemblino.actuators.getConstraintKeys());
Expand All @@ -718,7 +751,7 @@ OperationsManager.prototype.changeConnection = function (fixed, moved, type) {
settings = Assemblino.menus.popMenuValues(settings);
var curName = fixed.controller.settings.options.name;
var newName = settings.name;
if (curName!=newName && _this.object.getController(newName)){
if (curName != newName && _this.object.getController(newName)) {
notify('The controller name ' + newName + ' is taken. Please choose other one.');
return;
}
Expand Down Expand Up @@ -759,6 +792,6 @@ _.extend(OperationsManager.prototype, _.pick(Assemble.prototype, [
'declarationCode', 'physicCode', 'connectCode', 'connectStateCode',
'removeConnectionsToOrFrom',
'hasObject', 'renameKey', 'insert', 'makeKey',
'appendConnectOperation','removeConnectOperation','getConnectOperation'
'appendConnectOperation', 'removeConnectOperation', 'getConnectOperation'
]));

12 changes: 11 additions & 1 deletion public/assembler/menus.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,20 @@ Menu.prototype.makePublic = function () {
data = temporaryCanvas.toDataURL();
$(temporaryImage).remove();
$(temporaryCanvas).remove();
var dependencies = _.compact(_.map(Assemblino.manager.getOption('dependencies'), function(dname){
var obj = Assemblino.database.getByName(dname);
if (Assemblino.database.userIsPublic(obj.username)){
return undefined;
} else {
return obj.id;
}
}));
dependencies.push(Assemblino.manager.getObjectId());
Assemblino.database.makePublic({
picture: data,
time: formatedTime(),
id: Assemblino.manager.getObjectId(),
dependencies: dependencies,
name: Assemblino.manager.getObjectName(),
parameters: Assemblino.manager.object.getOptions(),
path: (Assemblino.manager.owner || "") + "/" + Assemblino.manager.getOption('folder') + "/" + Assemblino.manager.getObjectName(),
Expand Down Expand Up @@ -905,7 +915,7 @@ Menu.prototype.addSettingsControls = function (sim) {
}
}
);
if (Assemblino.database.getUsername() && Assemblino.database.userIsPublic() && !DESKTOP_OPTIONS.enabled) {
if (Assemblino.database.getUsername() && isChrome() && !DESKTOP_OPTIONS.enabled) {
organ.add({'Share': function () {
_this.makePublic();
}}, 'Share');
Expand Down
2 changes: 1 addition & 1 deletion public/cbundle/_public.js

Large diffs are not rendered by default.

12 changes: 11 additions & 1 deletion public/datgui/dat.gui.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,16 @@
* http://www.apache.org/licenses/LICENSE-2.0
*/

/**
* This file was changed by Nuno Rocha, 2013
*
* - Added jQuery methods to manage events, in order to clean some leaks
* - A lot of CSS was isolated to a proper file, instead of being mixed with javascript
* - Some other small changes.
*
*/


/** @namespace */
var dat = dat || {};

Expand Down Expand Up @@ -3674,4 +3684,4 @@ dat.GUI = dat.gui.GUI = (function (css, saveDialogueContents, styleSheet, contro
})(dat.dom.dom,
dat.utils.common),
dat.dom.dom,
dat.utils.common);
dat.utils.common);
23 changes: 23 additions & 0 deletions public/static/codemirror/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Copyright (C) 2013 by Marijn Haverbeke <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

Please note that some subdirectories of the CodeMirror distribution
include their own LICENSE files, and are released under different
licences.
21 changes: 21 additions & 0 deletions public/static/jquery/MIT-LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Copyright 2013 jQuery Foundation and other contributors
http://jquery.com/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
5 changes: 5 additions & 0 deletions public/three.js/TrackballControls.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
* @author Eberhard Graether / http://egraether.com/
*/

/**
* Some small changes by Nuno Rocha, 2013
*
*/

//uses global variable IS_DRAGGING

THREE.TrackballControls = function ( object, domElement ) {
Expand Down
21 changes: 21 additions & 0 deletions public/three.js/three.js.license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2010-2013 three.js authors

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
21 changes: 21 additions & 0 deletions public/three.js/threeCSG.license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License

Copyright (c) 2012 Chandler Prall. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

0 comments on commit 3329199

Please sign in to comment.