#69 relation colors
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%4082
This commit is contained in:
+9
-8
@@ -1,15 +1,16 @@
|
|||||||
var CONFIG = {
|
var CONFIG = {
|
||||||
AVAILABLE_DBS:["mysql","sqlite","web2py","mssql","postgresql", "oracle", "sqlalchemy", "vfp9"],
|
AVAILABLE_DBS: ["mysql","sqlite","web2py","mssql","postgresql", "oracle", "sqlalchemy", "vfp9"],
|
||||||
DEFAULT_DB:"mysql",
|
DEFAULT_DB: "mysql",
|
||||||
|
|
||||||
AVAILABLE_LOCALES:["en", "fr", "de", "cs", "pl", "pt_BR", "es", "ru", "eo", "ja"],
|
AVAILABLE_LOCALES: ["en", "fr", "de", "cs", "pl", "pt_BR", "es", "ru", "eo", "ja"],
|
||||||
DEFAULT_LOCALE:"en",
|
DEFAULT_LOCALE: "en",
|
||||||
|
|
||||||
AVAILABLE_BACKENDS:["php-mysql","php-blank","php-file","php-sqlite"],
|
AVAILABLE_BACKENDS: ["php-mysql","php-blank","php-file","php-sqlite"],
|
||||||
DEFAULT_BACKEND:["php-mysql"],
|
DEFAULT_BACKEND: ["php-mysql"],
|
||||||
|
|
||||||
RELATION_THICKNESS:2,
|
RELATION_THICKNESS: 2,
|
||||||
RELATION_SPACING:15,
|
RELATION_SPACING: 15,
|
||||||
|
RELATION_COLORS: ["#000","#800","#080","#008","#088","#808","#088"],
|
||||||
|
|
||||||
STATIC_PATH: "",
|
STATIC_PATH: "",
|
||||||
XHR_PATH: ""
|
XHR_PATH: ""
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* (c) 2007 - now() Ondrej Zara, 1.5 */
|
/* (c) 2007 - now() Ondrej Zara, 1.6 */
|
||||||
var OZ = {
|
var OZ = {
|
||||||
$:function(x) { return typeof(x) == "string" ? document.getElementById(x) : x; },
|
$:function(x) { return typeof(x) == "string" ? document.getElementById(x) : x; },
|
||||||
opera:!!window.opera,
|
opera:!!window.opera,
|
||||||
@@ -60,6 +60,7 @@ var OZ = {
|
|||||||
var tmp = function(){};
|
var tmp = function(){};
|
||||||
tmp.prototype = parent.prototype;
|
tmp.prototype = parent.prototype;
|
||||||
this.prototype = new tmp();
|
this.prototype = new tmp();
|
||||||
|
this.prototype.constructor = this;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
c.prototype.bind = function(fnc) { return fnc.bind(this); };
|
c.prototype.bind = function(fnc) { return fnc.bind(this); };
|
||||||
|
|||||||
+13
-6
@@ -346,7 +346,7 @@ SQL.Row.prototype.destroy = function() {
|
|||||||
SQL.Row.prototype.toXML = function() {
|
SQL.Row.prototype.toXML = function() {
|
||||||
var xml = "";
|
var xml = "";
|
||||||
|
|
||||||
var t = this.getTitle().replace(/"/g,""");
|
var t = this.getTitle().replace(/"/g,"""); //"
|
||||||
var nn = (this.data.nll ? "1" : "0");
|
var nn = (this.data.nll ? "1" : "0");
|
||||||
var ai = (this.data.ai ? "1" : "0");
|
var ai = (this.data.ai ? "1" : "0");
|
||||||
xml += '<row name="'+t+'" null="'+nn+'" autoincrement="'+ai+'">\n';
|
xml += '<row name="'+t+'" null="'+nn+'" autoincrement="'+ai+'">\n';
|
||||||
@@ -449,8 +449,9 @@ SQL.Row.prototype.enter = function(e) {
|
|||||||
/* --------------------------- relation (connector) ----------- */
|
/* --------------------------- relation (connector) ----------- */
|
||||||
|
|
||||||
SQL.Relation = OZ.Class().extend(SQL.Visual);
|
SQL.Relation = OZ.Class().extend(SQL.Visual);
|
||||||
|
SQL.Relation._counter = 0;
|
||||||
SQL.Relation.prototype.init = function(owner, row1, row2) {
|
SQL.Relation.prototype.init = function(owner, row1, row2) {
|
||||||
|
this.constructor._counter++;
|
||||||
this.owner = owner;
|
this.owner = owner;
|
||||||
this.row1 = row1;
|
this.row1 = row1;
|
||||||
this.row2 = row2;
|
this.row2 = row2;
|
||||||
@@ -461,12 +462,18 @@ SQL.Relation.prototype.init = function(owner, row1, row2) {
|
|||||||
this.row2.addRelation(this);
|
this.row2.addRelation(this);
|
||||||
|
|
||||||
this.dom = [];
|
this.dom = [];
|
||||||
|
if (CONFIG.RELATION_COLORS) {
|
||||||
|
var colorIndex = this.constructor._counter - 1;
|
||||||
|
var color = CONFIG.RELATION_COLORS[colorIndex % CONFIG.RELATION_COLORS.length];
|
||||||
|
} else {
|
||||||
|
var color = "#000";
|
||||||
|
}
|
||||||
|
|
||||||
if (this.owner.vector == "svg") {
|
if (this.owner.vector == "svg") {
|
||||||
var path = document.createElementNS(this.owner.svgNS, "path");
|
var path = document.createElementNS(this.owner.svgNS, "path");
|
||||||
path.setAttribute("stroke","black");
|
path.setAttribute("stroke", color);
|
||||||
path.setAttribute("stroke-width",CONFIG.RELATION_THICKNESS);
|
path.setAttribute("stroke-width", CONFIG.RELATION_THICKNESS);
|
||||||
path.setAttribute("fill","none");
|
path.setAttribute("fill", "none");
|
||||||
this.owner.dom.svg.appendChild(path);
|
this.owner.dom.svg.appendChild(path);
|
||||||
this.dom.push(path);
|
this.dom.push(path);
|
||||||
} else if (this.owner.vector == "vml") {
|
} else if (this.owner.vector == "vml") {
|
||||||
@@ -476,7 +483,7 @@ SQL.Relation.prototype.init = function(owner, row1, row2) {
|
|||||||
curve.to = "0 0";
|
curve.to = "0 0";
|
||||||
curve.control1 = "10 10";
|
curve.control1 = "10 10";
|
||||||
curve.control2 = "100 300";
|
curve.control2 = "100 300";
|
||||||
curve.strokecolor = "#000";
|
curve.strokecolor = color;
|
||||||
curve.filled = false;
|
curve.filled = false;
|
||||||
this.owner.dom.content.appendChild(curve);
|
this.owner.dom.content.appendChild(curve);
|
||||||
this.dom.push(curve);
|
this.dom.push(curve);
|
||||||
|
|||||||
Reference in New Issue
Block a user