added save buttons

This commit is contained in:
Jannover5000r
2026-03-09 16:11:35 +01:00
parent 23fba90476
commit 966872e20b
4 changed files with 39 additions and 1 deletions
+5
View File
@@ -182,6 +182,11 @@
<input type="button" id="clientsave" />
<input type="button" id="clientload" />
</div>
<div id="singlerow">
<input type="button" id="clientdownloadxml" />
<input type="button" id="clientdownloadtxt" />
<input type="button" id="clientloadfromfile" />
</div>
<div id="singlerow">
<input type="button" id="clientlocalsave" />
<input type="button" id="clientlocalload" />
+28 -1
View File
@@ -24,6 +24,9 @@ SQL.IO = function (owner) {
"serverlist",
"clientcopy",
"clientpaste",
"clientdownloadxml",
"clientdownloadtxt",
// "clientloadfromfile",
"serverimport",
];
for (var i = 0; i < ids.length; i++) {
@@ -85,6 +88,9 @@ SQL.IO = function (owner) {
OZ.Event.add(this.dom.serverimport, "click", this.serverimport.bind(this));
OZ.Event.add(this.dom.clientcopy, "click", this.clientcopy.bind(this));
OZ.Event.add(this.dom.clientpaste, "click", this.clientpaste.bind(this));
OZ.Event.add(this.dom.clientdownloadxml, "click", this.clientdownloadxml.bind(this));
OZ.Event.add(this.dom.clientdownloadtxt, "click", this.clientdownloadtxt.bind(this));
// OZ.Event.add(this.dom.clientloadfromfile, "click", this.clientloadfromfile.bind(this));
OZ.Event.add(document, "keydown", this.press.bind(this));
this.build();
};
@@ -184,8 +190,29 @@ SQL.IO.prototype.clientpaste = function () {
}).catch(function(err) {
alert("Failed to paste: " + err);
});
};
};SQL.IO.prototype.promptName = function (title, suffix) {
SQL.IO.prototype.clientdownloadxml = function () {
var xml = this.owner.toXML();
this.downloadFile(xml, "new-database.xml", "application/xml");
};
SQL.IO.prototype.clientdownloadtxt = function () {
var xml = this.owner.toXML();
this.downloadFile(xml, "new-database.txt", "text/plain");
};
SQL.IO.prototype.downloadFile = function (content, filename, mimeType) {
var blob = new Blob([content], { type: mimeType });
var url = URL.createObjectURL(blob);
var a = document.createElement("a");
a.href = url;
a.download = filename;
document.body.appendChild(a);
a.click();
document.body.removeChild(a);
URL.revokeObjectURL(url);
};
SQL.IO.prototype.promptName = function (title, suffix) {
var lastUsedName =
this.owner.getOption("lastUsedName") || this.lastUsedName;
var name = prompt(_(title), lastUsedName);
+3
View File
@@ -78,6 +78,9 @@
<string name="clientload">XML laden</string>
<string name="clientcopy">Ausgabe Speichern</string>
<string name="clientpaste">Kopierten Code einfügen</string>
<string name="clientdownloadxml">als XML speichern</string>
<string name="clientdownloadtxt">als TXT speichern</string>
<string name="clientloadfromfile">Datenbank von Datei laden</string>
<string name="clientlocalsave">In Browser speichern</string>
<string name="clientlocalload">Von Browser laden</string>
<string name="clientlocallist">Von Browser auflisten</string>
+3
View File
@@ -85,6 +85,9 @@
<string name="clientsql">Generate SQL</string>
<string name="clientcopy">Copy Output</string>
<string name="clientpaste">Paste from Clipboard</string>
<string name="clientdownloadxml">Download as XML</string>
<string name="clientdownloadtxt">Download as TXT</string>
<string name="clientloadfromfile">Load Database from file</string>
<string name="backendlabel">Server backend:</string>
<string name="serversave">Save</string>
<string name="quicksave">Quicksave</string>