Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Calendar Script CommunityCustomizationPlugins (Moderators: scott, DanO, Marty)CSXport Plug-In (export events to a delimted file)
Pages: [1] 2   Go Down
Print
Author Topic: CSXport Plug-In (export events to a delimted file)  (Read 1740 times)
0 Members and 1 Guest are viewing this topic.
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« on: December 30, 2002, 07:10:00 PM »

Just completed a beta version of a new CSXport plug in.  As its name implies, it will enable you to export events as a delimited file and save/open the file on your desktop.

From the admin control panel, you can choose which fields from your Events and Schedule DB's will be exported (and which fields won't). You can also set the delimiter to TAB, COMMA or PIPE.

The function appears at the top of the SEARCH RESULTS page. If there are "No Matches", the link will not appear.  The plug in uses the same results from a "just completed" search to populate the exported file.

You can check it out at http://www.estigoy.com/csremind/calendar.cgi   . Click on "Search" and find some events (just enter the letter 't' in the Title field). On the results page, you'll notice the CSXport link at the top.

If you go to the control panel, select CSXport Setup to play with the parameters.

Epoch's are converted to YYYYMMDD. All other data is left unchanged.

I'm packaging it up and will release it (in beta) soon.

- Michael

------------------
   michael@estigoy.com    
http://www.estigoy.com/csremind  

[This message has been edited by michaelest (edited December 30, 2002).]

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: December 30, 2002, 07:32:00 PM »

Sounds useful.

Dan O.

------------------

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #2 on: December 31, 2002, 12:46:00 PM »

       
quote:
I gotta work on not opening this window - didn't have time to address this yet.

I would think just not opening a new window with your JavaScript code would do that. Just using a window.location.href = "http://...csx_export=yes&ids=5+6" should work provided your mod is returning the proper HTTP headers to initiate the download (like it appears to be).

     

quote:
window.open('h t t p ://www.estigoy.com/csremind/calendar.cgi?command=search&view=Search&csx_export=yes&ids=5 6', 'csxport',

I think you're going to run into problems with the space between the events IDs (highlighted above) in some browsers though.

Dan O.

[This message has been edited by DanO (edited December 31, 2002).]

Logged
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #3 on: December 31, 2002, 01:21:00 PM »

Dan O,

Thanks for the feedback and tips.  

Explorer, NS7.0, and Opera 6.5 tend to do o.k., but NS4.7 doesn't like the spaces.  I orignally had the ID's listed as a visual reference to the info I should be expecting in the data file, and, well, just left it there.

I tried the window.location and it still results in a new window.  I was hopeful though.

The way the script works, it first parses the initial search returns to get a list of the matching event ID's.  The actual data for the events, doesn't get parsed until the user clicks on the link and sends the parameter back to the script(&csr_export=yes). This results in a new window. I use a new window because I do not want to lose the current state of the screen output.

I have to separately parse the DBfiles (to address the arbitrary field selections, and to get information not normally displayed in the typical results), generate temp file, and then pass a reference to a supporting script (which initiates a new session/new mime type). I can't change mime types in the current session since that is already declared as "text/html" and the browser will parse all output generated by the script as a web page.

I'm just getting started with perl and javascript and welcome the information.

Your feedback and existing plug ins have aided immensely in creating these.

Thanks,

Michael

------------------
   michael@estigoy.com    
http://www.estigoy.com/csremind  

[This message has been edited by michaelest (edited December 31, 2002).]

Logged

michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #4 on: December 31, 2002, 04:21:00 PM »

Here's the beta package.  Should work o.k. as an admin tool.  Still some items to polish up for end user experience (or not?).

Let me know if you run into any problems.

Read the release notes in the package.
-Not tested in a Windows Server environment.  
-Not Netscape 4.7 friendly yet.
-Internet Explorer, Netscape7.0 and Opera 6.5 seem to work fine.
http://www.estigoy.com/csremind/csxport06b.zip  

- Michael

------------------
   michael@estigoy.com    
http://www.estigoy.com/csremind  

[This message has been edited by michaelest (edited January 01, 2003).]

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #5 on: December 31, 2002, 04:26:00 PM »

** I can't change mime types in the current session since that is already declared as "text/html" and the browser will parse all output generated by the script as a web page. **

There is a variable $no_header in calendar.pl that negates output of the standard Content-type headers. In fact it is used by the script when called via SSI.

I would think it should be possible to set that variable to 1 and add a routine to output the appropriate headers to initialize downloading of whatever is output after that? That way the download box would popup and the current calendar view not be affected.

Dan O.

------------------

Logged
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #6 on: January 01, 2003, 10:35:00 PM »

Dan O.,

What a great tip!  

I was able to implement it, but it took me awhile to figure out the correct method.  New beta available at http://www.estigoy.com/csremind/csxport06b.zip  .

However, I still need a secondary script.  Since CSX is an "AFTER" routine, I had to create a small script that executed at the getInput() stage, prior to the $no_header/$no_session variables being set.

I took me a bit longer than I thought it would, but with window.location=href and the new routine executing at the getInput stage, I was able to pull it off.

Thanks again for your assistance!

- Michael

------------------
  michael@estigoy.com  
http://www.estigoy.com/csremind  

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #7 on: January 02, 2003, 02:28:00 PM »

Did you implement the mod at your site yet? I tried it searching for just "t" like before and clicked on the "Click to export and save results as a text file" link. The download box came up without effecting the current calendar.

I downloaded the file which was titled "event.txt" in the download box but it is an HTML page with the calendar display but with the error message:  

quote:
Search query must not be blank!
Error requiring custom function file '/u/web/estigo/csremind/calendarscript/plugins/csxport/display_after_search.pl'. The error is: [Can't modify constant item in list assignment at /u/web/estigo/csremind/calendarscript/plugins/csxport/display_after_search.pl line 156, near "))" Compilation failed in require at (eval 5) line 1. ]

Dan O.

PS. You might also want to consider sending a header to suggest the file name to be saved and incorporate the date into it somehow. Eg. file-01022003.txt

[This message has been edited by DanO (edited January 02, 2003).]

Logged
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #8 on: January 02, 2003, 02:45:00 PM »

I was screwing around with another test.

Try it again. should work fine (even in Netscape 4.7).

BTW, I added a "get all" keyword feature.  
If you enter '!allevents' in either the title or description,  All Events (within the date restrictions) can be exported (note: the search results will be null, but the link at the top will say "export all to file").

There's one other issue I'm working on, and it has to do with retrieving ALL occurrences of an event.  Right now, csxport only retrieves the first occurrence.

- Michael

------------------
  michael@estigoy.com  
http://www.estigoy.com/csremind  

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #9 on: January 02, 2003, 07:07:00 PM »

** Try it again **

Seems to work now Ok. Good work!

When you're working on the ALL occurrences, how about the file name thing I mentioned. I know it's a little thing but while you're there...  

Dan O.

[This message has been edited by DanO (edited January 02, 2003).]

Logged
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #10 on: January 02, 2003, 07:34:00 PM »

Name thingy completed.  Filename = MMDDYYYY.txt.

Good idea.

Still working on all occurrences, although it seems as though this is a bug that Matt might be working on?  I've read some earlier posts and responses - CS doesn't include the recurring events in the search results if the first occurrence of the event falls outside of the date boundaries. If this is already being looked at, maybe I should just wait?  

07b available at http://www.estigoy.com/csremind/csxport07b.zip   .

- Michael

------------------
   michael@estigoy.com    
http://www.estigoy.com/csremind  

[This message has been edited by michaelest (edited January 02, 2003).]

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #11 on: January 02, 2003, 08:07:00 PM »

Great! That was fast.

I just noticed a couple of other things that could use some work before a final release.

It looks like you're just printing the link from the script but that causes it to be printed at the very top of the calendar page, even before the <HTML> tag. That really isn't really good. I believe there is a method that if used will print the code in an appropriate place in the page code, maybe something like:

$Template::userMessage .= $link_code_here. "<B>";

Secondly, since the download popup box is displaying and the calendar is not being replaced when that link is clicked, the link doesn't need to be JavaScript any more. Just a thought.

Keep up the good work!

Dan O.


[This message has been edited by DanO (edited January 03, 2003).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #12 on: January 04, 2003, 05:38:00 PM »

On looking at your code and thinking about it more, writing the results to a file could be problematic on calendars where multiple people could be searching at the same time, one overwriting the other. Not to mention the clean-up problems you stated still had to be worked out.

I think the display_before_search.pl calendar script hook would be better suited and outputting the results directly to the browser a better way to go.

I have some ideas on implementing that if you're interested in hearing them.

Dan O.

------------------

Logged
michaelest
New Member
*

Karma: 0
Offline Offline

Posts: 0

Cagerattler


WWW
« Reply #13 on: January 07, 2003, 02:15:00 PM »

Dan O., I sent you a message via email in response to the above.

I'm also wrapping up some new fixes and mods to the CSXport plug in - ETA 2 days.  There was a time bug (I was using local and should have used gmtime in a a sub) and I've managed to get All Occurrences of an Event to be returned as well.

I'll pick up our discussion in a couple of days.

Thanks,

Michael

------------------
  michael@estigoy.com  
http://www.estigoy.com/csremind  

Logged

DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #14 on: January 07, 2003, 05:59:00 PM »

** I've managed to get All Occurrences of an Event to be returned as well. **

Great. I look forward to seeing how you accomplished that.

Dan O.

------------------

Logged
Pages: [1] 2   Go Up
Print
Jump to: