Export plugin patch to save exported URL

Community plugins and extensions
Post Reply
User avatar
jdap
Posts: 34
Joined: Thu Feb 20, 2014 10:35 pm

Export plugin patch to save exported URL

Post by jdap »

Hi all,

For those familiar with the export plugin, you know that it saves the rendered files to disk with timestamped names. The names are unique enough that you could not infer them.

The export plugin can be configured to either open a new window to the exported asset, or not. However, the URL of the exported asset by the "print server" (as it is called in the docs) is never saved. Therefore it is impossible to reference the exported asset URL from your application.

I have modified gnt-all-debug.js to save the exported URL. Attached is patch file add_exportedURL_gnt-all-debug-v2.2.16.patch, which will add exportedURL to gnt-all-debug.js.

My use of it is to add a listener for the hidedialogwindow event, and in that listener I reference the exportedURL property. Basically I provide a "Download here!" link.

If you're curious, this was necessary because Safari blocks either all pop-up windows or no pop-up windows.
Attachments
add_exportedURL_gnt-all-debug-v2.2.16.patch.txt
(253 Bytes) Downloaded 393 times

User avatar
arcady
Core Developer
Core Developer
Posts: 2477
Joined: Wed Mar 20, 2013 6:57 am

Re: Export plugin patch to save exported URL

Post by arcady »

Ok, so basically you needed to reach decoded server response in hidedialogwindow event. :)
We'll add the response as a last argument to these 3 events: updateprogressbar, hidedialogwindow, showdialogerror.

Considering you patch please beware of our future upgrades since they can override it. :)
If I were you I would make my own class instead of changing original code. It could look like this:

Code: Select all

Ext.define('MyExport', {
    extend : 'Sch.plugin.Export', // or `Gnt.plugin.Export` if you use it for gantt

    onSuccess : function (response, callback, errback) {
        try {
            result = Ext.JSON.decode(response.responseText);
        } catch (e) {
        }

        this.exportedURL = result.url;

        this.callParent(arguments);
    }
})

User avatar
jdap
Posts: 34
Joined: Thu Feb 20, 2014 10:35 pm

Re: Export plugin patch to save exported URL

Post by jdap »

arcady, that is exactly what I needed. Thank you!

Post Reply