var action = {name: "save", key: key, value: value};
// save it in our action log for replaying when we // go back online
dojox.off.sync.actions.add(action);
// also add it to our offline, downloaded data// do an update if this fileName is already in useif(dojox.sql("SELECT * FROM DOCUMENTS WHERE fileName = ?", key).length){
dojox.sql("UPDATE DOCUMENTS SET content = ? WHERE fileName = ?",
value, key);
for(var i = 0; i <this._documents.length; i++){if(this._documents[i].fileName == key){this._documents[i].content = value;
break;
}}}else{
dojox.sql("INSERT INTO DOCUMENTS (fileName, content) VALUES (?, ?)",
key, value);
this._documents.push({fileName: key, content: value});
}// update our UIthis._printStatus("Saved '" + key + "'");
this._addKey(key);
this._printAvailableKeys();