comments for next steps

This commit is contained in:
Javier Abadia 2014-04-05 17:18:29 +02:00
parent d6b6af7c0b
commit 381a18a161

View File

@ -123,13 +123,16 @@ define([
6. update a new attachment
concerns:
- should the key in the db be the objectId or the attachmentId?
- manage the relationship between offline features and attachments: what if the user wants to add
an attachment to a feature that is still offline? we need to keep track of objectids so that when
the feature is sent to the server and receives a final objectid we replace the temporary negative id
by its final objectid
- what if the user deletes an offline feature that had offline attachments? we need to discard the attachment
pending tasks:
- delete attachment
- send attachments to server when reconnecting
*/
//
@ -150,6 +153,7 @@ define([
}
else
{
// will only return LOCAL attachments
var deferred = new Deferred();
this.attachmentsStore.getAttachmentsByFeatureId(this.url, objectId, function(attachments)
{
@ -184,8 +188,6 @@ define([
// read file from input into variable
this._readFilesFromForm(formNode, function(files)
{
// callback is called once for each input[type=file] node in formNode
// and each input node might contain several files
console.log(files);
console.assert(files.length == 1, "we don't support multiple files (yet?)");
files.forEach(function(file)
@ -278,9 +280,11 @@ define([
}
else
{
console.log("deleteAttachments() - OFFLINE", objectId, attachmentsIds);
// TODO
// case 1.- it is a new attachment
// case 2.- it is an already existing attachment
}
}
@ -541,6 +545,8 @@ define([
_optimizeEditsQueue: function()
{
// TODO: take care of attachments
// console.log("edits:", editsStore._retrieveEditsQueue().map(function(e){return this.getReadableEdit(e)},this));
var optimizedEdits = {};
var editCount = editsStore.pendingEditsCount();
@ -599,6 +605,8 @@ define([
_replayStoredEdits: function(callback)
{
// TODO: take care of attachments
if( editsStore.hasPendingEdits() )
{
//