replace the default URL that is set by attachmentEditor with the local file URL

This commit is contained in:
Javier Abadia 2014-04-27 03:07:14 +02:00
parent 611d509fb0
commit 02f913bb43

View File

@ -11,6 +11,7 @@ define([
"dojo/_base/array",
"dojo/dom-attr",
"dojo/dom-style",
"dojo/query",
"esri/layers/GraphicsLayer",
"esri/graphic",
@ -18,7 +19,7 @@ define([
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleFillSymbol"],
function(editsStore, AttachmentsStore,
Evented,Deferred,all,declare,array,domAttr,domStyle,
Evented,Deferred,all,declare,array,domAttr,domStyle,query,
GraphicsLayer,Graphic,SimpleMarkerSymbol,SimpleLineSymbol,SimpleFillSymbol)
{
return declare([Evented],
@ -239,6 +240,11 @@ define([
// and each input can contain multiple files BUT here we call the callback and
// resolve the deferred with the FIRST of the files
// In practice, popups only have one input, and it doesn't allow multiple files
// replace the default URL that is set by attachmentEditor with the local file URL
var attachmentUrl = this._url.path + "/" + objectId + "/attachments/" + attachmentId;
var attachmentElement = query("[href=" + attachmentUrl + "]");
attachmentElement.attr("href", file.url);
}
else
{
@ -246,7 +252,7 @@ define([
errback && errback(returnValue);
deferred.reject(returnValue);
}
});
}.bind(this));
},this);
}.bind(this));
return deferred;