Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2005-12-04 12:00:08

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Plugin Request: improving zem_contact for money

OK, here is my attempt to modify zem_contact for you to download [updated].

Edit: This file is not a self-contained plugin. It’s just new code to replace the existing plugin coding.

This version only contains a new tag to create a drop-down select box for visitors to choose the recipient of the email; if this works as intended, I will look at incorporating creativesplash’s modifications in as well. Because I had to modify the mailto validation a bit, I’ve run out of time tonight.

Here’s how it works:

  • there is now a new tag called “zem_contact_select_mailto”. It accepts similar attributes as “zem_contact_select” but with a new attribute called ‘addresses’.
  • for example, if you use <code><zem_contact_select_mailto list=“John, Jane” addresses=“john@doe.com,jane@doe.com” /></code>, then the contact form will include a drop-down box allowing the visitor to choose John or Jane. The mailto address for the form is the respective selection from ‘addresses’ ie. if they choose the first name, the first email address is chosen.
  • if you don’t use either the mailto attribute on <code><zem_contact></code> or <code><zem_contact_select_mailto /></code>, then the form is replaced by an error message.
  • you must have exactly the same number of items in the list of names and the list of addresses. My attempt to do some error checking if the names and addresses don’t match has failed!

I have tested it with two email addresses and it works; I’ll add my work address so I can test it some more. I would be grateful if you could test it with multiple email addresses. Also, if anyone is an expert I would appreciate a review of my coding to make sure I haven’t made any horrendous PHP mistakes.

Thanks to zem for a great plugin, thanks to everyone else for the ideas.

Last edited by aslsw66 (2005-12-09 10:44:31)

Offline

#32 2005-12-04 12:17:33

creativesplash
Member
From: Coimbatore, India
Registered: 2005-01-19
Posts: 283
Website

Re: Plugin Request: improving zem_contact for money

Wow Anura, that’s fantastic news! I’ll surely test this out as soon as possible!

<blockquote>
aslsw66 saiys > I will look at incorporating creativesplash’s modifications..
</blockquote>
Its not fair on my part to call the modifications mine, as I picked it up from different threads in this forum. :)


“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”

— Albert Einstein

Offline

#33 2005-12-06 12:35:13

alexandra
Member
From: Cologne, Germany
Registered: 2004-04-02
Posts: 1,370

Re: Plugin Request: improving zem_contact for money

I would really like helping testing it but i can not even install zems original plugin.
(Notice: unserialize(): Argument is not a string in /www/…/textpattern/include/txp_plugin.php on line 152)

@ aslsw66 – would it be possible to turn your code into a plugin?

Offline

#34 2005-12-06 12:45:53

Neko
Member
Registered: 2004-03-18
Posts: 458

Re: Plugin Request: improving zem_contact for money

Can you make it work with an image submit button rather than the default submit button?

I can contribuite too with a few dollars.

Offline

#35 2005-12-06 12:57:21

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Plugin Request: improving zem_contact for money

alexandra,

Sorry, but I’m really feeling my way with this at the moment. Beause I’m modding zem’s plugin for my own benefit (and anyone else’s who cares to take an interest), I’m not really sure what the correct thing to do here is. Do I release this as my own plugin (crediting zem of course)? Or ask zem to re-release his own?

everyone else,

I’ve modified my version [updated] of the plugin in again (again, this is the code to replace an existing install of the plugin). In addition to the new tags above, I have now:

  • added a new attribute called “mailsubject”. This defines the subject line for the email sent,
  • added a new attribute called “thankslocation”. You can use this attribute to redirect to a thank you page; the location is added to the end of the site url, and
  • fixed the checkbox issue mentioned in this thread.

I’ve also included many of the other fixes mentioned in that thread, but these are issues that are outstanding:

  • checking XHTML compliance of each element when used. This is something I’m more comfortable with so I’ll move on to this tomorrow,
  • internationalisation. I note that boblet has created a hack for this but frankly
    1. I’m not really sure of what the issues with internationalisation are. In Australia we are just so far away!
    2. I’m not sure that boblets approach of additional tags is the best way to go. Wouldn’t it be better to set something in the admin sitde?
    3. fpradignac posted an issue in this thread about his provider not accepting the email header. Again, I’m a bit in the dark about how much of an issue this is, or whether the suggest solution works for everyone else.

Thoughts, problems, answers are all welcome.

My journey to an improved zem_contact continues! Once again, I’m merely peeking over the shoulder of a giant (ie. zem and others) to glimpse what is possible.

Last edited by aslsw66 (2005-12-09 10:44:50)

Offline

#36 2005-12-06 12:59:24

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Plugin Request: improving zem_contact for money

neko,

Anything is possible of course! But in this case, I remember from sometime ago a web accessibility consultant advised against images for submit buttons. Let me do some research on the benefits/pitfalls and think about is some more.

Offline

#37 2005-12-06 13:33:13

creativesplash
Member
From: Coimbatore, India
Registered: 2005-01-19
Posts: 283
Website

Re: Plugin Request: improving zem_contact for money

<blockquote>
@ aslsw66 – would it be possible to turn your code into a plugin?
</blockquote>

Wasnt there an online plugin generator somewhere?


“Take a point, stretch it into a line, curl it into a circle, twist it into a sphere, and punch through the sphere.”

— Albert Einstein

Offline

#38 2005-12-06 13:59:36

Jeremie
Member
From: Provence, France
Registered: 2004-08-11
Posts: 1,578
Website

Re: Plugin Request: improving zem_contact for money

Neko wrote:
Can you make it work with an image submit button rather than the default submit button?
I can contribuite too with a few dollars.

This is a CSS job, and nothing else.

Offline

#39 2005-12-06 19:14:52

Neko
Member
Registered: 2004-03-18
Posts: 458

Re: Plugin Request: improving zem_contact for money

> Jeremie wrote:

This is a CSS job, and nothing else.

You could even look smarter if you actually posted the code or a link. I know you can!

Offline

#40 2005-12-07 17:46:55

kemie
Plugin Author
From: mexico<-->sweden
Registered: 2004-05-20
Posts: 495
Website

Re: Plugin Request: improving zem_contact for money

if you can assign a class to the button of, say, “button”, it could go something like

<code>.button{
background-image:url(path/to/image.jpg);
width:80px;/* change these 2 values to the width and height of your image */
height:30px;
border:none;
text-indent: -9000px; /* remove the text on the button by indenting it out of the visible area */
}</code>

untested code, but should work at least with some modifications

Last edited by kemie (2005-12-07 17:49:55)


~~~~~~~~~~~~~| monolinea.com | pixilate.com | istockphoto.com/kemie |~~~~~~~~~~~~~

Offline

#41 2005-12-07 20:01:30

Neko
Member
Registered: 2004-03-18
Posts: 458

Re: Plugin Request: improving zem_contact for money

Thanks Kemie, I really appreciate it.

Offline

#42 2005-12-07 20:46:01

hakjoon
Member
From: Arlington, VA
Registered: 2004-07-29
Posts: 1,634
Website

Re: Plugin Request: improving zem_contact for money

If you can’t assign a class directly this javascript will assign a class of the input type to the input. That way you can specifically affect them using input.text, input.checkbox, input.radio. This makes it so you can affect only text inputs without worrying about giving your checkboxes borders (which happens in IE)

<pre><code>
function setInputClasses(form) { var aInputs = form.getElementsByTagName(“input”); for(var i = 0; i < aInputs.length; i++) { var inputClass = aInputs[i].className + “ “ + aInputs[i].type; aInputs[i].className = inputClass; } return true;
}
</code></pre>

It expects the form it is supposed to operate on to be passed in as an object (say for example as the result of a getElementById)


Shoving is the answer – pusher robot

Offline

#43 2005-12-07 22:21:13

Neko
Member
Registered: 2004-03-18
Posts: 458

Re: Plugin Request: improving zem_contact for money

Sweet! Thanks a lot. :)

-N.

Offline

#44 2005-12-09 10:52:22

aslsw66
Member
From: Canberra, Australia
Registered: 2004-08-04
Posts: 342
Website

Re: Plugin Request: improving zem_contact for money

OK, the next version of my modified zem_contact is here. As usual, this is replacement code for the original.

In this version, I have:

  • checked the XHTML sent to the browser. It seemed to be OK anyway,
  • spaced the XHTML out a bit to make it a bit more readable. I’m an (x)HTML field and I like my code to be readable,
  • added in the zem_contact_secret field. It takes two attributes: ‘name’ is the name and id of the field, ‘default’ is the value passed back. I removed all the other attributes like size, required etc because they don’t make much sense in the context of a hidden field.

Unless someone can offer some more guidance, I’m going to drop internationalisation and also the issue of headers sent by the email.

Comments, problems, suggestions all welcome.

Offline

#45 2005-12-09 16:06:57

fpradignac
Plugin Author
From: France near Cognac
Registered: 2005-01-29
Posts: 359
Website

Re: Plugin Request: improving zem_contact for money

> aslsw66 wrote:

> Unless someone can offer some more guidance, I’m going to drop internationalisation and also the issue of headers sent by the email.

Well it seems to become a vey cool plugin.

Thanks aslsw66,
françois.


françois

Offline

Board footer

Powered by FluxBB