summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorondrej.zara <none@none>2011-04-22 09:15:10 +0000
committerondrej.zara <none@none>2011-04-22 09:15:10 +0000
commitd96248cded5924ffb735adb8c83aa52f450d420e (patch)
tree0e2c8340654c8753b5bbdf946a495202a5b69746
parent9a004f1c60ac700318a33c60a3aaf3bbe4b2a404 (diff)
downloadwwwsqldesigner-d96248cded5924ffb735adb8c83aa52f450d420e.zip
wwwsqldesigner-d96248cded5924ffb735adb8c83aa52f450d420e.tar.gz
wwwsqldesigner-d96248cded5924ffb735adb8c83aa52f450d420e.tar.bz2
issue #114 - option to show field size in table
--HG-- extra : convert_revision : svn%3Ab267cdba-c1da-11dd-874b-8bacd04a0a74/trunk%40123
-rw-r--r--index.html8
-rw-r--r--js/wwwsqldesigner.js15
-rw-r--r--locale/cs.xml2
-rw-r--r--locale/en.xml2
4 files changed, 21 insertions, 6 deletions
diff --git a/index.html b/index.html
index 1088971..43e49bc 100644
--- a/index.html
+++ b/index.html
@@ -119,6 +119,14 @@
<input type="checkbox" id="optionvector" />
</td>
</tr>
+ <tr>
+ <td>
+ * <label id="showsize" for="optionshowsize"></label>
+ </td>
+ <td>
+ <input type="checkbox" id="optionshowsize" />
+ </td>
+ </tr>
</tbody>
</table>
diff --git a/js/wwwsqldesigner.js b/js/wwwsqldesigner.js
index 00b17f5..2cee59c 100644
--- a/js/wwwsqldesigner.js
+++ b/js/wwwsqldesigner.js
@@ -113,7 +113,10 @@ SQL.Row.prototype.setTitle = function(t) {
var tt = r.row2.getTitle().replace(new RegExp(old,"g"),t);
if (tt != r.row2.getTitle()) { r.row2.setTitle(tt); }
}
- SQL.Visual.prototype.setTitle.apply(this, [t]);
+
+ var title = t;
+ if (SQL.Designer.getOption("showsize") && this.data.size) { title += " (" + this.data.size + ")"; }
+ SQL.Visual.prototype.setTitle.apply(this, [title]);
}
SQL.Row.prototype.click = function(e) { /* clicked on row */
@@ -238,7 +241,6 @@ SQL.Row.prototype.collapse = function() {
if (!this.expanded) { return; }
this.expanded = false;
- this.setTitle(this.dom.name.value);
var data = {
type: this.dom.type.selectedIndex,
def: this.dom.def.value,
@@ -251,6 +253,7 @@ SQL.Row.prototype.collapse = function() {
this.dom.content.style.display = "none";
this.dom.title.style.display = "block";
this.update(data);
+ this.setTitle(this.dom.name.value);
/* gecko hack */
this.owner.moveBy(1,1);
this.owner.moveBy(-1,-1);
@@ -388,7 +391,6 @@ SQL.Row.prototype.toXML = function() {
SQL.Row.prototype.fromXML = function(node) {
var name = node.getAttribute("name");
- this.setTitle(name);
var obj = { type:0, size:"" };
obj.nll = (node.getAttribute("null") == "1");
@@ -425,6 +427,7 @@ SQL.Row.prototype.fromXML = function(node) {
}
this.update(obj);
+ this.setTitle(name);
}
SQL.Row.prototype.isPrimary = function() {
@@ -2180,8 +2183,9 @@ SQL.Options.prototype.build = function() {
this.dom.optionpattern = OZ.$("optionpattern");
this.dom.optionhide = OZ.$("optionhide");
this.dom.optionvector = OZ.$("optionvector");
+ this.dom.optionshowsize = OZ.$("optionshowsize");
- var ids = ["language","db","snap","pattern","hide","vector","optionsnapnotice","optionpatternnotice","optionsnotice"];
+ var ids = ["language","db","snap","pattern","hide","vector","showsize","optionsnapnotice","optionpatternnotice","optionsnotice","optionshowsize"];
for (var i=0;i<ids.length;i++) {
var id = ids[i];
var elm = OZ.$(id);
@@ -2219,6 +2223,7 @@ SQL.Options.prototype.save = function() {
this.owner.setOption("pattern",this.dom.optionpattern.value);
this.owner.setOption("hide",this.dom.optionhide.checked ? "1" : "");
this.owner.setOption("vector",this.dom.optionvector.checked ? "1" : "");
+ this.owner.setOption("showsize",this.dom.optionshowsize.checked ? "1" : "");
}
SQL.Options.prototype.click = function() {
@@ -2227,6 +2232,7 @@ SQL.Options.prototype.click = function() {
this.dom.optionpattern.value = this.owner.getOption("pattern");
this.dom.optionhide.checked = this.owner.getOption("hide");
this.dom.optionvector.checked = this.owner.getOption("vector");
+ this.dom.optionshowsize.checked = this.owner.getOption("showsize");
}
/* ------------------ minimize/restore bar ----------- */
@@ -2450,6 +2456,7 @@ SQL.Designer.prototype.getOption = function(name) {
case "staticpath": return CONFIG.STATIC_PATH || "";
case "xhrpath": return CONFIG.XHR_PATH || "";
case "snap": return 0;
+ case "showsize": return 0;
case "pattern": return "%R_%T";
case "hide": return false;
case "vector": return true;
diff --git a/locale/cs.xml b/locale/cs.xml
index 4af7dca..923a24e 100644
--- a/locale/cs.xml
+++ b/locale/cs.xml
@@ -53,7 +53,7 @@
<string name="optionpatternnotice">%T = primární tabulka, %R = primární klíč, %t = cizí tabulka</string>
<string name="hide">Schovat spojovníky při tažení tabulkou?</string>
<string name="vector">Vykreslovat oblé spojovníky (pakliže to prohlížeč podporuje)?</string>
-
+ <string name="showsize">Zobrazovat velikost polí v tabulce?</string>
<!-- keys -->
<string name="tablekeys">Klíče</string>
diff --git a/locale/en.xml b/locale/en.xml
index 4eb1af4..f254645 100644
--- a/locale/en.xml
+++ b/locale/en.xml
@@ -53,7 +53,7 @@
<string name="optionpatternnotice">%T = primary table, %R = primary key, %t = foreign table</string>
<string name="hide">Hide connectors on table drag?</string>
<string name="vector">Draw smooth connectors (if supported by browser)?</string>
-
+ <string name="showsize">Show field size in table design?</string>
<!-- keys -->
<string name="tablekeys">Keys</string>