Skip to content
This repository has been archived by the owner on Oct 2, 2018. It is now read-only.

Commit

Permalink
Add Deleting and Renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
Joshua Smith committed Apr 29, 2013
1 parent f71b203 commit f455733
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion js/firetext.js
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ function showAllDocs() {
document.getElementById("showAll").style.display = "none";
}

/* Create, Load, & Save
/* File IO
------------------------*/
function createFromDialog() {
var filename = document.getElementById('createDialogFileName').value;
Expand Down Expand Up @@ -365,6 +365,26 @@ function loadFile(filename, filetype, callback) {
};
}

function deleteFile(name) {
var path = ('Documents/'+name);
var req = storage.delete(path);
req.onsuccess = function () {
// Code to show a deleted banner
}
req.onerror = function () {
// Code to show an error banner (the alert is temporary)
alert('Delete unsuccessful :(\n\nInfo for gurus:\n"' + this.error.name + '"');
}
}

function renameFile(name, type, newname) {
loadFile(name, type, function(result) {
var fullName = (name + type);
saveFile(name, type, result, false);
deleteFile(fullName);
});
}

/* Format
------------------------*/
function formatDoc(sCmd, sValue) {
Expand Down

0 comments on commit f455733

Please sign in to comment.