Helpful Docs to read before posting: (All Docs) | Config Docs | General FAQ | Mailing List Sending FAQ | Error FAQ

Default Text in the FCKeditor enabled HTML text box

Make Dada Mail do cool things with a bit of tweaking of the underlying code

Default Text in the FCKeditor enabled HTML text box

Postby justin » Fri Sep 05, 2008 12:09 pm

These are some simple directions to have default text in the, "HTML Version" of your, "Mailing List Message" screen, if you have FCKeditor enabled.

These directions are going to be specific to Dada Mail 3.0 and may not work with future versions.

First, get the FCKeditor installed.

Once you do that, you can add default text that appears in the FCKeditor text box by editing the Dada Mail template named, "FCKeditor_default_value_widget.tmpl". Whatever HTML you place in this file will show as the default value in your, "HTML Version" mailing list message text box.

A few things to note:

Make sure the content of this file is, all on one line

You're also going to have escape any characters that would trip up javascript - things like single quotes need to be escaped, simply by placing a "\" character before the single quote:

Replace:

Code: Select all
'


With:

Code: Select all
\'



If you do have a complex HTML message with a full:

Code: Select all
<html>
<head>

</head>

<body>

</body>

</html>


Type structure, you may find that you'll have problem with random Javascript (created by Dada Mail) getting inserted into your text and breaking FCKeditor.

The fix to this is a little bit of a hack - what I do is make sure my beginning <head> tag is all in CAPS:

Code: Select all
<HEAD>


and then, sadly, you have to tweak the following file:

dada/DADA/perllib/CGI/Ajax.pm

find the following lines:



Code: Select all
    # see if we can match on <head>
        @shtml = $mhtml =~ /(.*)(<\s*head[^>]*>?)(.*)/is;


(it's in the, "insert_js_in_head" method)

and change them to:

Code: Select all
    # see if we can match on <head>
    @shtml = $mhtml =~ /(.*)(<\s*head[^>]*>?)(.*)/s; # CHANGED!


And that problem will go right away.

Give it a try;
User avatar
justin
 
Posts: 5451
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Re: Default Text in the FCKeditor enabled HTML text box

Postby phovsho » Sat Feb 14, 2009 12:04 pm

This is great! Is possible to have different default texts (essentially newsletter templates) for each list on a single DADA install or would I need to create a separate install for each list?
Oh, and should I instead work with FCKtemplates.xml instead? But still again, would I need separate installs for each list? I am assuming if not clients would see eachothers' saved templates.
phovsho
 
Posts: 2
Joined: Tue Feb 10, 2009 7:21 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby justin » Sat Feb 14, 2009 3:33 pm

I'm not sure quite how you'd do that, sadly,
User avatar
justin
 
Posts: 5451
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Re: Default Text in the FCKeditor enabled HTML text box

Postby RTtucson » Sun Apr 12, 2009 10:33 am

Great hack. I've got the default html set up for 'Send a List Message', but I'm wondering if there's a way to do the same thing for the 'Scheduled Mailings' page?

Thanks.
RTtucson
 
Posts: 12
Joined: Sat Apr 11, 2009 2:25 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby admin » Tue Apr 14, 2009 4:28 am

Probably something similar can be used, although the template for this plugin is embedded in the plugin itself. search for, "FCK" in the source code and see if you can find a similar string. I'll post more detailed instructions on what to do when I get back on Thursday,
admin
Site Admin
 
Posts: 20
Joined: Wed Feb 13, 2008 8:18 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby RTtucson » Wed Apr 15, 2009 2:58 pm

Thanks for your help, Justin.

In the FCKeditor_default_js_options.js file, this line sets the default HTML value:
oFCKeditor.Value = '<!-- tmpl_include FCKeditor_default_value_widget.tmpl -->';

On line 1521 of the scheduled_mailings.pl file, this line looks like it should do the same:
oFCKeditor.Value = '$Default_Text';

But my attempts to replace the Default_Text variable with either an include file or just by pasting the html into the variable itself didn't work.

So I think I'm getting close, but haven't quite figured it out.

Thanks again for your help, Justin.

- Robert
RTtucson
 
Posts: 12
Joined: Sat Apr 11, 2009 2:25 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby justin » Thu Apr 16, 2009 1:01 am

After a little investigating, here's what you want to change:

Code: Select all
my %d_form_vals = (
      message_name           => 'scheduled mailing',
      active                  => 0,
      mailing_date            => time,
      repeat_times            => 1,
      repeat_label            => 'days',
      repeat_mailing          => 0,
      only_send_to_list_owner => 0,
      archive_mailings        => 0,
      only_send_if_diff       => 0,
      self_destruct           => 0,
      
      headers       =>
      
         {

            'Reply-To'        => undef,
            'Return-Path'     => undef,
            Precedence      => undef,
            'X-Priority'    => undef,
            Subject         => undef,
            
         },
            
      PlainText_ver => {
                     source                    => 'from_text',
                     use_email_template        => 1,
                     only_send_if_defined      => 0,
                     grab_headers_from_message => 0,
                     
                   },
      HTML_ver      => {             
                     source                    => 'from_text',
                     use_email_template        => 1,
                     only_send_if_defined      => 0,
                     grab_headers_from_message => 0,
                      
                   },
      attachments            => [],
      partial_sending_params => [
                              # { field_name => '', field_comparison_type => '', field_value => '' },
                            ],
                     
   );


What you'll need to do is add a new key, "text" in the, HTML hashref, like this:




Code: Select all
my %d_form_vals = (
      message_name           => 'scheduled mailing',
      active                  => 0,
      mailing_date            => time,
      repeat_times            => 1,
      repeat_label            => 'days',
      repeat_mailing          => 0,
      only_send_to_list_owner => 0,
      archive_mailings        => 0,
      only_send_if_diff       => 0,
      self_destruct           => 0,
      
      headers       =>
      
         {

            'Reply-To'        => undef,
            'Return-Path'     => undef,
            Precedence      => undef,
            'X-Priority'    => undef,
            Subject         => undef,
            
         },
            
      PlainText_ver => {
                     source                    => 'from_text',
                     use_email_template        => 1,
                     only_send_if_defined      => 0,
                     grab_headers_from_message => 0,
                     
                   },
      HTML_ver      => {             
                     source                    => 'from_text',
                     use_email_template        => 1,
                     only_send_if_defined      => 0,
                     grab_headers_from_message => 0,




                                                   # New stuff!
                                                   text => 'Here's the default value!',


                      
                   },
      attachments            => [],
      partial_sending_params => [
                              # { field_name => '', field_comparison_type => '', field_value => '' },
                            ],
                     
   );



Just notice the,

Code: Select all
                                                   # New stuff!
                                                   text => 'Here's the default value!',


part, that's different in that second code example.
User avatar
justin
 
Posts: 5451
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Re: Default Text in the FCKeditor enabled HTML text box

Postby RTtucson » Thu Apr 16, 2009 11:38 am

That did the trick! Thank you.

- Robert
RTtucson
 
Posts: 12
Joined: Sat Apr 11, 2009 2:25 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby newagekat » Wed Apr 29, 2009 7:50 pm

Justin:

I purchased DadaMail v3.0 and have installed FCKeditor v2.6.4

here are my issues:

when I first installed the FCKeditor, which I've used in the past on various CMS, I can browse an image and upload it to a directory on the server. I was not able to do this in Dada Mail. Any suggestions?

When I added my default text (full html structure) in FCKeditor_default_value_widget.tmpl and the relevant change in dada/DADA/perllib/CGI/Ajax.pm. the HTML version window does not expand at all.

If I just add my default text, this made the editor disappears, but it did show my default text plus a fnky error: '; oFCKeditor.Create() ; //--> .

lastly, how do I make the HTML version window in send list message the default one that opens?

I have an image of what the HTML send massage textarea looks like: Image

Any assistance is much appreciated.

kp
newagekat
 
Posts: 6
Joined: Wed Apr 29, 2009 6:43 pm

Re: Default Text in the FCKeditor enabled HTML text box

Postby justin » Wed Apr 29, 2009 9:37 pm

when I first installed the FCKeditor, which I've used in the past on various CMS, I can browse an image and upload it to a directory on the server. I was not able to do this in Dada Mail. Any suggestions?


Try the FAQ:

http://dadamailproject.com/support/docu ... _fckeditor

When I added my default text (full html structure) in FCKeditor_default_value_widget.tmpl and the relevant change in dada/DADA/perllib/CGI/Ajax.pm. the HTML version window does not expand at all.

If I just add my default text, this made the editor disappears, but it did show my default text plus a fnky error: '; oFCKeditor.Create() ; //--> .


Double-check you followed the instructions on this thread closely - it is a, "hack" . But if you can make the simplest case which doesn't work, I'll try to debug it with you.
User avatar
justin
 
Posts: 5451
Joined: Wed Feb 13, 2008 8:41 pm
Location: Denver, CO

Next

Return to Dada Mail Hacks

Who is online

Users browsing this forum: No registered users and 1 guest

cron
Loading