[ic] downloading a file that has values passed to it

Ed LaFrance interchange-users@interchange.redhat.com
Tue Oct 23 14:48:00 2001


At 11:05 AM 10/23/2001 -0700, you wrote:
>Here is what I'm trying to do....
>
> From behind the UI I've added a link on the customer_view page the
>properties are
>
>[calc]
>$Scratch->{mv_deliver} .= 'backup/vcard.vcf';
>  return;
>[/calc]
>
>with
>
>[page href="ui/backup/vcard.vcf"
>  form="
>   customer=[cgi customer]
>   mv_data_file=backup/vcard.vcf
>   mv_todo=deliver"
>
>]Download vcard file</a>
>
>
>everything seems to work fine
>
>The page that I'm trying to download has....
>
>[calc]
>  if($CGI->{customer}) {
>   $CGI->{item_id} = $CGI->{customer};
>  }
>  if(! $CGI->{item_id} and $Session->{arg}) {
>   $CGI->{item_id} = $CGI->{customer} = $Session->{arg};
>  }
>return;
>[/calc]
>
>[update values]
>[loop list="[value-extended customer]"]
>
>BEGIN:VCARD
>VERSION:2.1
>N:[loop-data catalogreq lastname];[loop-data catalogreq firstname]
>FN: [loop-data catalogreq contact]
>ORG; [loop-data catalogreq institut]
>TITLE; [loop-data catalogreq title]
>NOTE; ENCODING=QUOTED PRINTABLE: [loop-data catalogreq notes]=0D=0A
>TEL;WORK;VOICE: [loop-data catalogreq phone1]
>TEL;WORK;FAX: [loop-data catalogreq fax]
>ADR;WORK:;;[loop-data catalogreq address1];[loop-data catalogreq
>city];[loop-data catalogreq state] [loop-data catalogreq zip];;[loop-data
>catalogreq country]
>LABEL;WORK;ENCODING=QUOTED-PRINTABLE:[loop-data catalogreq
>address1]=0D=0A[loop-data catalogreq city], [loop-data catalogreq state]
>[loop-data catalogreq zip]=0D=0A[loop-data country]
>URL:<LINK TYPE='GENERIC" VALUE="HTTP://[loop-data catalogreq
>website]">HTTP://[loop-data catalogreq website]</LINK>
>EMAIL; PREF; INTERNET:[loop-data catalogreq email]
>REV;VALUE DATE]
>END:VCARD
>
>[/loop]
>
>Is what I want to happen is the user clicks on the "download vcard file" and
>the vcard is downloaded with all the user information it. I believe that
>this is a much faster way of transfer user information then the marketing
>department would be able to email from the client app.
>
>The output that I'm getting is [loop-data catreq...] in the fields. Obviosly
>the data isn't getting filed in before download. Any Info would help
>
>THX N ADV.
>J. Scott Andreas :)

It looks like deliver does not parse the contents of the file - it just 
sends to to the requestor. Makes sense when you think about it; it would 
not do to have IC trying to parse binaries and the like.

I suggest you first parse the vcard template and save the results to a 
temporary file (hint: [log] with interpolate=1 option) - the session ID 
could be used for the source file name. Then deliver that file, and 
periodically delete the temporary files with a cron job, or you could use 
unlink in a usertag or in [perl global=1].

- Ed L.



===============================================================
New Media E.M.S.               Software Solutions for Business
463 Main St., Suite D          eCommerce | Consulting | Hosting
Placerville, CA  95667         edl@newmediaems.com
(530) 622-9421                 http://www.newmediaems.com
(866) 519-4680 Toll-Free       (530) 622-9426 Fax
===============================================================