Print To; Save As; etc.

Archived from the Xataface Users forum.

dwisn — Mon Jan 22, 2007 1:17 pm

before I go hacking my way through SQL, and since I haven’t found any code in the forums ( at least where/what I have searched on ):

Does anyone have any code for Saving the output of “found records” into a file of any sort? I know Dadabik has an “Export to CSV”, just wondered if anyone has written anything -

In advance,
I thank you -
dan


shannah — Mon Jan 22, 2007 3:19 pm

Hi Dan,

People have been asking for this one for a while and its so easy to do, so I thought I’d just whip it up. Download the new release of Dataface 0.6.11 at http://sourceforge.net/project/showfiles.php?group_id=153729&package_id=170571&release_id=480550

If you don’t want to have to upgrade the whole thing, you could actually just copy the actions.ini file and the actions/export_csv.php file into your dataface distribution and it should work ok.

Only tested on PHP 5 so far.

-Steve


shannah — Mon Jan 22, 2007 3:20 pm

Oh.. yeah..
The way it works is:

In the List view and related records list view, you’ll notice a little icon that looks like a spread sheet in the upper right corner of the result set. Click on that to export the results to CSV format.

Best regards

Steve


dwisn — Mon Jan 22, 2007 3:45 pm

Hi Dan,

People have been asking for this one for a while and its so easy to do, so I thought I’d just whip it up. Download the new release of Dataface 0.6.11 at [http://sourceforge.net/project/showfiles.php?group_id=153729&package_id=170571&release_id=480550](http://sourceforge.net/project/showfiles.php?group_id=153729&package_id=170571&release_id=480550)


dwisn — Mon Jan 22, 2007 3:45 pm

Hi Dan,

People have been asking for this one for a while and its so easy to do, so I thought I’d just whip it up. Download the new release of Dataface 0.6.11 at [http://sourceforge.net/project/showfiles.php?group_id=153729&package_id=170571&release_id=480550](http://sourceforge.net/project/showfiles.php?group_id=153729&package_id=170571&release_id=480550)


dwisn — Mon Jan 22, 2007 4:25 pm

If you don’t want to have to upgrade the whole thing, you could actually just copy the actions.ini file and the actionsexport_csv.php file into your dataface distribution and it should work ok.

1 ( one) error in export_csv.php

TOP line missing an “f”

php<br /if ( !function_exists(‘putcsv’) ){

should be
if ( !function_exists(‘fputcsv’) ){ ( I think )

Though now I’m getting:
Fatal error: Class ‘actions_find’ not found in ~/dataface-0.6.11/Dataface/Application.php on line 763

trying to work through it
dan


dwisn — Mon Jan 22, 2007 4:35 pm

If you don’t want to have to upgrade the whole thing, you could actually just copy the actions.ini file and the actionsexport_csv.php file into your dataface distribution and it should work ok.


dwisn — Tue Jan 23, 2007 8:05 am

#1 ) Thanks again Steve, you saved my butt
#2 ) I promise, I’ll start learning framework….

&3 ) For anyone having issues using MS IE and trying to download across SSL and having problems… I found a fix that works…

For a per-computer setting, locate the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
On the Edit menu, click Add Value, and then add the following registry values:
“BypassSSLNoCacheCheck”=Dword:00000001

PER USER SETTING
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings
“BypassSSLNoCacheCheck”=Dword:00000001


shannah — Tue Jan 23, 2007 12:31 pm

Wow… thanks for finding this fix… I can safely say that I never would have found that.

-Steve


dwisn — Tue Jan 23, 2007 1:04 pm

The MS IE fix? Its official @ http://support.microsoft.com/kb/323308


danny — Wed May 23, 2007 2:55 am

Hi Steve,

just was wondering if there«s an export function too. But found the solution (just like so many more before) on your site. It«s awesome how one person is managing such an impressive support! Thanx a lot!

But one suggestion about this feature (export): I believe it would be better placed beside the import-action (in the actions row). Why “hide” such a useful function…

Daniel


shannah — Wed May 23, 2007 8:26 am

Hi Daniel,

You an move the export function to be beside the import function by adding the following to your application’s actions.ini file (if you’re using Dataface 0.7)

[export_csv > export_csv]
category=table_actions

What this does is override the export_csv action to be in the “table_actions” category.Ê The “category” is what dataface uses to know where to display different actions.

Best regards
steve


danny — Thu May 24, 2007 12:59 am

Works perfectly! Thanx a lot, Steve.
I«m very curious about all the other features not documented yet


danw — Tue Jul 21, 2009 7:20 am

dwisn wrote: #1 ) Thanks again Steve, you saved my butt
#2 ) I promise, I’ll start learning framework….

&3 ) For anyone having issues using MS IE and trying to download across SSL and having problems… I found a fix that works…

For a per-computer setting, locate the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
On the Edit menu, click Add Value, and then add the following registry values:
“BypassSSLNoCacheCheck”=Dword:00000001

PER USER SETTING
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings
“BypassSSLNoCacheCheck”=Dword:00000001

I HAVE AN UPDATE.. TESTED ACROSS SSL XP ServicePack 3 07/19/2009

In ~/actions

file export_csv.php

current lines:

header(“Content-type: text/csv; charset={$app->_conf[‘oe’]}”);

header(‘Content-disposition: attachment; filename=”’.$query[‘-table’].’_results_‘.date(‘Y_m_d_H_i_s’).’.csv”’);

add:

header(“Content-type: text/csv; charset={$app->_conf[‘oe’]}”);

header(“Pragma: public”);

header(‘Content-disposition: attachment; filename=”’.$query[‘-table’].’_results_‘.date(‘Y_m_d_H_i_s’).’.csv”’);

and this solved the issue. you should not have to edit within regedit


shannah — Tue Jul 21, 2009 12:01 pm

Thanks for the tip. I have added this to the issue tracker so that it will be fixed when I get a chance.

http://bugs.weblite.ca/view.php?id=562

-Steve


danny — Wed May 23, 2007 2:55 am

Hi Steve,

just was wondering if there«s an export function too. But found the solution (just like so many more before) on your site. It«s awesome how one person is managing such an impressive support! Thanx a lot!

But one suggestion about this feature (export): I believe it would be better placed beside the import-action (in the actions row). Why “hide” such a useful function…

Daniel


shannah — Wed May 23, 2007 8:26 am

Hi Daniel,

You an move the export function to be beside the import function by adding the following to your application’s actions.ini file (if you’re using Dataface 0.7)

[export_csv > export_csv]
category=table_actions

What this does is override the export_csv action to be in the “table_actions” category.Ê The “category” is what dataface uses to know where to display different actions.

Best regards
steve


danny — Thu May 24, 2007 12:59 am

Works perfectly! Thanx a lot, Steve.
I«m very curious about all the other features not documented yet


danw — Tue Jul 21, 2009 7:20 am

dwisn wrote: #1 ) Thanks again Steve, you saved my butt
#2 ) I promise, I’ll start learning framework….

&3 ) For anyone having issues using MS IE and trying to download across SSL and having problems… I found a fix that works…

For a per-computer setting, locate the following registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
On the Edit menu, click Add Value, and then add the following registry values:
“BypassSSLNoCacheCheck”=Dword:00000001

PER USER SETTING
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet
Settings
“BypassSSLNoCacheCheck”=Dword:00000001

I HAVE AN UPDATE.. TESTED ACROSS SSL XP ServicePack 3 07/19/2009

In ~/actions

file export_csv.php

current lines:

header(“Content-type: text/csv; charset={$app->_conf[‘oe’]}”);

header(‘Content-disposition: attachment; filename=”’.$query[‘-table’].’_results_‘.date(‘Y_m_d_H_i_s’).’.csv”’);

add:

header(“Content-type: text/csv; charset={$app->_conf[‘oe’]}”);

header(“Pragma: public”);

header(‘Content-disposition: attachment; filename=”’.$query[‘-table’].’_results_‘.date(‘Y_m_d_H_i_s’).’.csv”’);

and this solved the issue. you should not have to edit within regedit


shannah — Tue Jul 21, 2009 12:01 pm

Thanks for the tip. I have added this to the issue tracker so that it will be fixed when I get a chance.

http://bugs.weblite.ca/view.php?id=562

-Steve