Re: Adding a List Information Cookie

 
From: "Ken Dow" <me@PROTECTED>
Date: December 9th 2008
Thanks Justin, that's exactly what I needed. The only change was that to clear the cookie I had to use

-value => '',

instead of

-value => undef,

Otherwise it retained the last value. Now off to FCK to implement custom directories....

On 8-Dec-08, at 10:01 PM, Justin J wrote:


I'd like DaDa to store the name of the list being edited in a cookie so FCK can use that for user-specific file upload directories, templates, etc. I'm comfortable with PHP but It's been a long time since I've done any Perl coding, and it was pretty basic then. Any pointers on the most elegant way to extend DaDa to include a new cookie would be most welcome � thanks.

Here's some ideas,

To just have Dada Mail store a new cookie, you can try tweaking the login subroutine in the mail.cgi file. Here's the lines to look for:

           print $q->header(-cookie  => [$dumb_cookie, $login_cookie],
                             -nph     => $DADA::Config::NPH,
                             -Refresh =>'0; URL=' . $referer);

You can just add another cookie to the end of that, like this:

   my $fckeditor_cookie = $q->cookie(
-name => 'dada_mail_list',
-value => $admin_list,
%DADA::Config::COOKIE_PARAMS,
  );

           print $q->header(-cookie  => [$dumb_cookie, $login_cookie, $fckeditor_cookie],
                             -nph     => $DADA::Config::NPH,
                             -Refresh =>'0; URL=' . $referer);


Then, just make sure to clear it out when you're done, find these lines the logout subroutine, also in the mail.cgi file:

       print $q->header(-COOKIE       => $logout_cookie,
                             -nph     => $DADA::Config::NPH,
                             -Refresh =>'0; URL=' . $location,
                           );

and just add another cookie with no real value:


   my $fckeditor_cookie = $q->cookie(
-name => 'dada_mail_list',
-value => undef,
%DADA::Config::COOKIE_PARAMS,
  );

       print $q->header(-COOKIE       => [$logout_cookie, $fckeditor_cookie],
                             -nph     => $DADA::Config::NPH,
                             -Refresh =>'0; URL=' . $location,
                           )

If you do a little test:

#!/usr/bin/perl -w
use strict;
use CGI;
my $q = new CGI;

my $fckeditor_cookie = $q->cookie(
-name => 'dada_mail_list',
-value => 'mylist',
);
print $q->header(-cookie  => [$fckeditor_cookie]);

Looks like the headers return looks something like this:

Set-Cookie: dada_mail_list=mylist; path=/
Date: Tue, 09 Dec 2008 02:34:27 GMT
Content-Type: text/html; charset=ISO-8859-1

So, that looks easy enough to parse out.



--
Justin J.

Dada Mail -  Write Once: Distribute Everywhere Software
url: http://dadamailproject.com

Demo:
http://demo.dadamailproject.com

Seen Dada Mail 3?
http://dadamailproject.com/features/3_0/

On Dec 8, 2008, at 2:45 PM, Ken Dow wrote:

Hi,

I'd like DaDa to store the name of the list being edited in a cookie so FCK can use that for user-specific file upload directories, templates, etc. I'm comfortable with PHP but It's been a long time since I've done any Perl coding, and it was pretty basic then. Any pointers on the most elegant way to extend DaDa to include a new cookie would be most welcome � thanks.

--
Cheers
Ken

skype: thekenshow

Don't worry, it will.
- Picasso, on being told that his portrait of Gertrude Stein didn't resemble her
Post:
mailto:dadadev@PROTECTED

Unsubscribe:
http://dadamailproject.com/cgi-bin/dada/mail.cgi/u/dadadev/

List Information:
http://dadamailproject.com/cgi-bin/dada/mail.cgi/list/dadadev

Archive:
http://dadamailproject.com/cgi-bin/dada/mail.cgi/archive/dadadev




--

Post:<mailto:dadadev@PROTECTED>

Unsubscribe:
<http://dadamailproject.com/cgi-bin/dada/mail.cgi/u/dadadev/>

List Information:<http://dadamailproject.com/cgi-bin/dada/mail.cgi/list/dadadev>

Archive:<http://dadamailproject.com/cgi-bin/dada/mail.cgi/archive/dadadev>=

--

Ken


skype: thekenshow


You're not good enough to think you're not good enough.

- Clarissa Pinkola Estes



Post:
mailto:[list_settings.discussion_pop_email]

Unsubscribe:
http://dadamailproject.com/cgi-bin/dada/mail.cgi/u/[list]/

List Information:
[PROGRAM_URL]/list/[list_settings.list]

Archive:
[PROGRAM_URL]/archive/[list_settings.list]

  • This mailing list is a public mailing list - anyone may join or leave, at any time.
  • This mailing list is a group discussion list (unmoderated)
  • Start a new thread, email: dadadev@dadamailproject.com

This is the developer discussion mailing list for Dada Mail.

If you are just looking for support Dada Mail, consult the message boards at:

https://forum.dadamailproject.com

Documentation for Dada Mail:

https://dadamailproject.com/d

Specifically, see the Error FAQ:

https://dadamailproject.com/d/FAQ-errors.pod.html

To post to this list, send a message to:

mailto:dadadev@dadamailproject.com

All subscribers of this list may post to the list itself.

Topics that are welcome:

  • Constructive critiques on the program (I like, "x", but, "y" needs some work - here's an idea on how to make this better...)
  • Bug/Error reports
  • Bug fixes
  • Request For Comments on any changes to the program
  • Help customizing Dada Mail for your own needs
  • Patches
  • Language Translations
  • Support Documentation/Doc editing, FAQ's, etc.
  • Discussion of any changes that you would like to be committed to the next version of Dada Mail -

Dada Mail is on Github:

https://github.com/justingit/dada-mail/

If you would like to fork, branch, send over PRs, open up issues, etc.

Privacy Policy:

This Privacy Policy is for this mailing list, and this mailing list only.

Email addresses collection through this mailing list are used explicitly to work within this email discussion list.

We only collect email addresses through our Closed-Loop Opt-In system.

We don't use your email address for any other purpose.

We won't be sharing your email address with any other entity.

Unsubscription can be done at any time. Please contact us at: justin@dadamailproject.com for any help regarding your subscription, including removal from the mailing list.

All mailing list messages sent from us will include a subscription removal link, which will allow you to remove yourself from this mailing list automatically, and permanently.

All consent to use your email address for any other purpose stated at the time of the mailing list subscription will also be revoked upon mailing list removal.