nblgeoweb VIP
Total posts: 178
06 Jan 2016 01:19

I have a couple suggestions for the csv formatter in Cobalt.

It would be handy if the mime-type set in formatter_csv.php was text/csv instead of text/plain. The reason for the change is that it seems most browsers will prompt to save the csv as a file using that mime-type. Text/plain just displays in the browser which is not that usefull for csv data.

The default name for saving that csv data is whatever the last part of the URL was. A handier default name could be set by adding Content-Disposition to the header. With both changes to formatter_csv.php my code looks like the following:

        function sendHeader()
        {
                header('Content-type: text/csv; charset=utf-8');
                header('Content-Disposition: attachment; filename="export.csv"; charset=utf-8');
        }

Last Modified: 15 Jan 2016


Sergey
Total posts: 13,748
12 Jan 2016 10:07

you can always right click and sale link as... SO current method of display allow you to save it immediately to file. But If I add those lines, it will not be possible just to see text for copy/paste withut saving anything.


pepperstreet VIP
Total posts: 3,837
12 Jan 2016 11:27

Although it is called formatter, isn't download the most typical use case? I mean, the behavior user's might expect?


BTW, is formatter used to read Cobalt data from another application/webservice?
Would a default download break such functionality?


Sergey
Total posts: 13,748
15 Jan 2016 10:39

pepperstreet BTW, is formatter used to read Cobalt data from another application/webservice?

No.

pepperstreet Would a default download break such functionality?

No.

Powered by Cobalt