Merge branch 'master' into storage

This commit is contained in:
Ondrej Zara
2015-11-09 09:09:46 +01:00
3 changed files with 12 additions and 21 deletions
+4
View File
@@ -53,6 +53,10 @@ var SQL = {
unsubscribe: function(message, subscriber) { unsubscribe: function(message, subscriber) {
var index = this._subscribers[message].indexOf(subscriber); var index = this._subscribers[message].indexOf(subscriber);
if (index > -1) { this._subscribers[message].splice(index, 1); } if (index > -1) { this._subscribers[message].splice(index, 1); }
},
escape: function(str) {
return str.replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;");
} }
} }
+6 -5
View File
@@ -143,7 +143,8 @@ SQL.Row.prototype.buildEdit = function() {
elms.push(["null",this.dom.nll]); elms.push(["null",this.dom.nll]);
this.dom.comment = OZ.DOM.elm("span",{className:"comment"}); this.dom.comment = OZ.DOM.elm("span",{className:"comment"});
this.dom.comment.innerHTML = this.data.comment; this.dom.comment.innerHTML = "";
this.dom.comment.appendChild(document.createTextNode(this.data.comment));
this.dom.commentbtn = OZ.DOM.elm("input"); this.dom.commentbtn = OZ.DOM.elm("input");
this.dom.commentbtn.type = "button"; this.dom.commentbtn.type = "button";
@@ -180,7 +181,8 @@ SQL.Row.prototype.changeComment = function(e) {
var c = prompt(_("commenttext"),this.data.comment); var c = prompt(_("commenttext"),this.data.comment);
if (c === null) { return; } if (c === null) { return; }
this.data.comment = c; this.data.comment = c;
this.dom.comment.innerHTML = this.data.comment; this.dom.comment.innerHTML = "";
this.dom.comment.appendChild(document.createTextNode(this.data.comment));
} }
SQL.Row.prototype.expand = function() { SQL.Row.prototype.expand = function() {
@@ -336,7 +338,7 @@ SQL.Row.prototype.toXML = function() {
} else if (d != "CURRENT_TIMESTAMP") { } else if (d != "CURRENT_TIMESTAMP") {
d = q+d+q; d = q+d+q;
} }
xml += "<default>"+d+"</default>"; xml += "<default>"+SQL.escape(d)+"</default>";
} }
for (var i=0;i<this.relations.length;i++) { for (var i=0;i<this.relations.length;i++) {
@@ -346,8 +348,7 @@ SQL.Row.prototype.toXML = function() {
} }
if (this.data.comment) { if (this.data.comment) {
var escaped = this.data.comment.replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;"); xml += "<comment>"+SQL.escape(this.data.comment)+"</comment>\n";
xml += "<comment>"+escaped+"</comment>\n";
} }
xml += "</row>\n"; xml += "</row>\n";
+2 -16
View File
@@ -133,7 +133,7 @@ SQL.Table.prototype.addKey = function(name) {
return k; return k;
} }
SQL.Table.prototype.removeKey = function(i) { SQL.Table.prototype.removeKey = function(k) {
var idx = this.keys.indexOf(k); var idx = this.keys.indexOf(k);
if (idx == -1) { return; } if (idx == -1) { return; }
k.destroy(); k.destroy();
@@ -245,8 +245,7 @@ SQL.Table.prototype.toXML = function() {
} }
var c = this.getComment(); var c = this.getComment();
if (c) { if (c) {
c = c.replace(/&/g, "&amp;").replace(/>/g, "&gt;").replace(/</g, "&lt;"); xml += "<comment>"+SQL.escape(c)+"</comment>\n";
xml += "<comment>"+c+"</comment>\n";
} }
xml += "</table>\n"; xml += "</table>\n";
return xml; return xml;
@@ -294,19 +293,6 @@ SQL.Table.prototype.findNamedRow = function(n) { /* return row with a given name
return false; return false;
} }
SQL.Table.prototype.addKey = function(type, name) {
var i = new SQL.Key(this, type, name);
this.keys.push(i);
return i;
}
SQL.Table.prototype.removeKey = function(i) {
var idx = this.keys.indexOf(i);
if (idx == -1) { return; }
i.destroy();
this.keys.splice(idx,1);
}
SQL.Table.prototype.setComment = function(c) { SQL.Table.prototype.setComment = function(c) {
this.data.comment = c; this.data.comment = c;
this.dom.title.title = this.data.comment; this.dom.title.title = this.data.comment;