File attachment control's 'Download' link

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

File attachment control's 'Download' link

Karthi
Hi,

Is it possible to customize (or modify) the file attachment control's 'download' hyper link?
This is required for user to be able  to download attachment from the form while editing the saved form. The file is uploaded to another server.

Right now, I am modifying the file attachment's XML model to point to the server url where the file was previously uploaded. But, this is not working as 'download' link is referring to Orbeon's dynamically generated file download URL.
Eg:  
<ReferenceDocument filename="test.jpg" mediatype="img" size="n" >http://localhost:8080/app/downloadAttachment?docid=100 </ReferenceDocument>

PS: the download link is not reflecting the URL that I have given in XML model.

Thanks,
Karthi
Reply | Threaded
Open this post in threaded view
|

Re: File attachment control's 'Download' link

Alessandro  Vernet
Administrator
Hi Karthi,

Even if the file is on another server, the URL requested by the browser will still point to Orbeon Forms, which will make the request to the other server from "the server side". Does that somehow cause any problem for you?

Alex

On Sun, Sep 11, 2016 at 10:19 PM, Karthi <[hidden email]> wrote:
Hi,

Is it possible to customize (or modify) the file attachment control's
'download' hyper link?
This is required for user to be able  to download attachment from the form
while editing the saved form. The file is uploaded to another server.

Right now, I am modifying the file attachment's XML model to point to the
server url where the file was previously uploaded. But, this is not working
as 'download' link is referring to Orbeon's dynamically generated file
download URL.
Eg:
<ReferenceDocument filename="test.jpg" mediatype="img" size="n"
>http://localhost:8080/app/downloadAttachment?docid=100 </ReferenceDocument>

PS: the download link is not reflecting the URL that I have given in XML
model.

Thanks,
Karthi

--
View this message in context: http://discuss.orbeon.com/File-attachment-control-s-Download-link-tp4661761.html
Sent from the Orbeon Forms community mailing list mailing list archive at Nabble.com.

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].

--
You received this message because you are subscribed to the Google Groups "Orbeon Forms" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: File attachment control's 'Download' link

Karthi
Hi Alex,

Here the problem is that I want to replace the default Orbeon generated URL with the our application URL.
Can we configure HTTP Service for the download link in attachment control ?

thanks,
Reply | Threaded
Open this post in threaded view
|

Re: File attachment control's 'Download' link

Alessandro  Vernet
Administrator
Hi Karthi,

If you'd like to change the URL, you can do so by modifying the content of the XML data. When the data is saved, the URL is relative and points back to the persistence API, e.g. /fr/service/persistence/crud/orbeon/your-app/your-form/123/456.bin, but you can change it to some other location of your choice. Is this something that could work for you?

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: File attachment control's 'Download' link

Karthi
Hi Alex,
Thanks .

Since we are using "Orbeon form embedding" integration approach, we have implemented this using JavaScript. JQuery locate all the form IDs and modify the HREF of all download links that requires to point to application URL.

$("a[id*='ReferenceDocument-control']").each(function(i){
                if($(this).text() == "Download" && docMetaArrayVal[i] != 0){
    var docId = docMetaArrayVal[i];
    $(this).attr("href", "/download?docMetadataId="+docId);
    }
            });

PS: docMetaArrayVal[i]  is application specific id that we need in the URL.
Reply | Threaded
Open this post in threaded view
|

Re: File attachment control's 'Download' link

Alessandro  Vernet
Administrator
Hi Karthi,

Great, I'm glad you find a suitable solution to this one.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet