Contact form block

Contact form block

Daryl Hawes發表於
Number of replies: 101
I did a little modification to a script posted by n hansen to make a site admin contact block.
See this thread in the activity fourm:
http://moodle.org/mod/forum/discuss.php?d=12404&parent=59834
評比平均分數: -
In reply to Daryl Hawes

Re: Contact form block

Art Lader發表於

That is great. 微笑

Can teachers add this block to their courses so that students can easily contact them?

-- Art

In reply to Art Lader

Re: Contact form block

Daryl Hawes發表於
An interesting idea indeed. I suppose this could be coded in with relative ease.
I believe it is first and foremost intended as a way for casual visitors to your site to easily get a message to the site administrator (can't creat account, found a problem, think it looks great, etc).
In reply to Daryl Hawes

Re: Contact form block

Art Lader發表於

Well, thanks for considering adding this functionality! (If you are considering it.)

-- Art

In reply to Art Lader

Re: Contact form block

Daryl Hawes發表於
Art,
OK I have tried to add it. I would appreciate you testing it. It seems to work for me but my testing is a bit contrived (and these changes further test the differences between standard blocks and my implementation).
This should allow the block to be displayed on the main site index page along with course pages of weeks, topics and social formats. If the request/comment from froms the main site index page the email goes to the site admin only. If the request/comment comes from a course page the email should go to the site admin and also to every registered teacher of that course.
If it works for you I will add a cross post in the other forum to note the newer package here.
In reply to Daryl Hawes

Re: Contact form block

Chardelle Busch發表於
Core developers的相片

Hi Daryl,

I saw the post from the other discussion first and posted there, only to read further in my email and see this thread and find that Art had beat me to the punch regarding adding this to a course.

I just tested this script--when I hit the continue link I got the That's an invalid course id error.  Also, I only received one email to the admin address, and not one to the teacher's email address.  Other than that it worked. 

Here's another suggestion:  Have you seen Jan Dierckx random quote block--(http://moodle.org/mod/forum/discuss.php?d=10851) he has added the ability to change the settings for a block.  For example you can change the block name.  This way, on the sitepage the block could be named Leave a Comment, and within a course it could be named "Ask a Question".  Then the submit value could be a generic one.  (Not sure if you would be able to have a different submit value for each block (or a different email message). 

Chardelle

In reply to Chardelle Busch

Re: Contact form block

Art Lader發表於

Hi,

I had exactly the same results, Chardelle. It certainly looks like it is going to be a nice module.

One more little thing: The block was a little too wide for my theme.

Thanks to everyone for working on this!

-- Art

In reply to Art Lader

Re: Contact form block

Daryl Hawes發表於
Can you maybe post a screen shot. I tried to remove all the width specific code from the block itself and it looks rather small on my test site.
I'll try to post another updated version tonight.
In reply to Daryl Hawes

Re: Contact form block

Art Lader發表於
Screenshot attached.  微笑
附件 contact_block.gif
In reply to Art Lader

Re: Contact form block

Daryl Hawes發表於
This would be a good admin setting for this block - the width of the input field.
It was 25. I have changed it to 20 with the files in update 4. If you would like to try other values open the file block_contact_form and edit the size value on the line that matches this:
$this->content->text .= '<input type="text" name="name" size="20" /> <br />';
In reply to Art Lader

Re: Contact form block

Ger Tielemans發表於

Art, which tool do you use to get these cut-off borders?

In reply to Ger Tielemans

Re: Contact form block

Chardelle Busch發表於
Core developers的相片

Hi Daryl and n,

It appears that my site is not picking up on the "if in a course" part of the code and that is why I am having the above problems.  I realized this when after looking at the code I noticed that one of you had added a different title (Ask a Question) if in a course.  When I add the block to a course, it still comes up as Contact.  So..... that's what is happening, the question remains as to why.

Chardelle

In reply to Chardelle Busch

Re: Contact form block

Daryl Hawes發表於
What was the url that the continue link tries to take you to? id=0 maybe?
In reply to Daryl Hawes

Re: Contact form block

Art Lader發表於
In reply to Art Lader

Re: Contact form block

Daryl Hawes發表於
OK. Here is a new one which is really update #4.

This one attempts to resolve the id=Object link you are seeing.

It has different titles for the site page versus the course pages: Leave a Comment and Ask a Question. The form submit button is now the generic text - "Submit".

I added an extra as well to match the way the blog comments work. If the user is logged in the name and email fields for the form are pre-populated.

Happy testing - moodle on....
In reply to Daryl Hawes

Re: Contact form block

Art Lader發表於

Yep,

Works great. Our teachers will like it a lot, I think. 微笑

(The only thing that is a little odd is that clicking on "continue" does not now cause an error message, but does cause you to leave the course and go to the front page of the site.)

Thanks!

-- Art

In reply to Art Lader

Re: Contact form block

N Hansen發表於
Art-Taking you to the front page of the site was my original design, as I intended to use this on the front page of my site only.

I'd like to add some more comments, now that I have installed the block.

1-If you are logged into your site, the "submit" button is not centered in the block. I do like the way it fills in the name and email automatically.

2-If you are not logged into the site, there are layout issues-a box is displayed inside a box in the block. The submit button is not centered.

3-It is quite illogical to expect people to enter their name and then click "submit" before getting to the full form. No website comments form elsewhere works like that and people are going to be put off by it. Why should they have to give their name first before seeing the form? Either you ask them for nothing at all or you ask them for everything up front, which would take too much space.

4-Comment number 3 is why I originally envisioned this as an activity, and why I posted it in the module forum, not the block forum. You could link to it from the site menu, or you could link to it from inside a course. There are certain things that are more appropriate as activities and others more appropriate as blocks, and I think this is one of the former. A block should be used for something that as a whole should take up a limited amount of space.
In reply to Art Lader

Re: Contact form block

Tareque Chowdhury發表於
Do you know where I need to see the students comment (contact form)
In reply to Tareque Chowdhury

Re: Contact form block

Sean S發表於
Will this block work with 1.5?
In reply to Sean S

Re: Contact form block

Daryl Hawes發表於
There is both a 1.5 and a 1.4 version of the block in cvs:/contrib
In reply to Daryl Hawes

Re: Contact form block

Nikki Macfarlane發表於
Daryl,

I hav edownloaded this and it is working great on my site main page. However, it is not appearing at all in my available blocks on the course pages. Any ideas on how I get it included there as well?

Also, when the thankyou page comes up it includes the characters and at the beginning and end of the message and at the beginning anf end of the continue link. I tried to find this in the code but could not - any ideas on how I can take these characters out?
In reply to Nikki Macfarlane

Contact form block security issue

N Hansen發表於
Another issue has arisen with the contact block that I am using a workaround for but it would be nice if it were actually solved. This is a security issue. Because the block page does not show up in the logs at all, this block could be used to send harrassing emails without any way of tracing who sent them. I am not using this as a block per se and I've made sure that all of my links to the page go through a web link resource, so if it is an anonymous user, their ip is then recorded in the logs because resource links are recorded. But presumably, if someone had the direct address of the page they could use it to send emails to the admin without any record of who sent them. Ideally, either the email sent would include the ip address of the person who sent it, or use of the contact form page would be included in the logs.
In reply to N Hansen

Re: Contact form block security issue

Jan Dierckx發表於
The tell a friend script has the same flaws. You can access the code which sends the email directly without having filled out the form. That way one could write a script which sends a lot of harrassing emails. I don't think it's a problem if you're dealing with adults, but I would not want my students to send out harrassing emails that seem to come from our school. Accessing the code directly also allows inclusion of javascript / images / etc..

 
In reply to Jan Dierckx

Re: Contact form block security issue

N Hansen發表於
That isn't what I was talking about. What I was thinking of was that a student could log in as a guest or not even log in at all and send harrassing or threatening emails to the teacher or admin and there would be no way to trace where it came from.

As for adults, the reason this problem came to my attention is because I received a rather nasty email (nasty about a third party, not me) in response to a discussion I had been having on another board that involved the third party, from some anonymous person who sent it to me through the contact form. Because they clicked through the resource link, I was able to tell what their ip address was, but that wouldn't have happened if I had a direct link. And more importantly, this certainly was an adult who sent it, because there aren't any children on said board and I traced their ip to a certain American unversity. Don't think that adults aren't capable of harrassment.
In reply to N Hansen

Re: Contact form block security issue

Jan Dierckx發表於
Nicole, I think we are talking about the same issue. Let me rephrase it in your words. Using the tell a friend script ... "a student could log in as a guest or not even log in at all and send harrassing or threatening emails to the teacher or admin and there would be no way to trace where it came from."
The only difference is that using the tell a friend script the same student could send hundreds of them with a single mouse click.
(I am kind of hoping that this would be the difference between adults and kids: the former quitting after having sent one email.)


In reply to Jan Dierckx

Re: Contact form block security issue

N Hansen發表於
The tell-a-friend form script isn' t even included in the contrib for download, but the contact form is, and many people may be using it on their sites. The point is also that the contact form is designed to send messages internally. If someone wants to use the tell-a-friend form to anonymously send messages to the world, that isn't my business entirely. Sure, I wouldn't want them using it that way but they would find another way to send a message anonymously through some other site to to someone that has nothing to do with the site-believe me there are a lot of sites out there other than the Moodle sites. And you would know if they were using the tell-a-friend form to do this immediately because copies of the emails are sent to the admin. Considering that here in the US we hear stories of students threatening their teachers and one another with grave bodily harm, sometimes via the internet, every week, my point was that the contact form could be an easy way for a student to do this. They wouldn't need to know a teacher's email or an admin's email, they just fill in the form and push a button.
In reply to N Hansen

Re: Contact form block security issue

Daryl Hawes發表於
"And you would know if they were using the tell-a-friend form to do this immediately because copies of the emails are sent to the admin"
Configure your v1.5 contact block and enable the CC Admin option. This is not new code, it's been there in the 1.5 version since it was put in contrib.
So the contact form block now logs the user's IP address and can optionally CC the site administrator on all messages. Anything it's missing?
In reply to Daryl Hawes

Re: Contact form block security issue

W Page發表於

Hi N and Daryl!

Thanks for this interaction and collaboration on the Contact Block.  It is just in time for me.  I intend to use it on a site I am working on.  One more feature not to worry about. 微笑

WP1

In reply to Nikki Macfarlane

Re: Contact form block

Daryl Hawes發表於
The cvs:/contrib/block_contact_form_1.5 folder has been updated with some tweaks for you to test.

For Nicole I have added logging - now when someone sends a message with the form their ip address along with to/from and the subject get logged.

For Nikki I have fixed the applicable formats so that it should now appear in courses again (this block was ready before 1.5 went final and Jon made a small feature tweak along the way which I had to correct for).

Also Nikki - are you sure that you copied the lang/en contents into your moodle/lang/en folder? The "blah" output you are seeing means that a translation for a string cannot be found and I verified that all the strings thanks.php looks for are present in lang/en/block_contact_form.php
In reply to Daryl Hawes

Re: Contact form block

Nikki Macfarlane發表於
Thanks Daryl. You were right, I had not uploaded the lang/en file correctly. It is now working great! Thanks!

I now have the contact block on my course pages as well which is brilliant. one small thing I would like to change though, just not sure how I do it.

The email sent from teh course page currently goes to all the teachers for that course. I would like to amend it so it only goes to the teacher assigned for the group the student is in. Otherwise the teachers are going to get hundreds of emails from students they are not looking after.

I had a look and can see where the code looks up the teachers assigned to the course. I was thinking I would need to do something like:

- find the teachers for the course (as is done now)
- find the group id for the courseid
- find the group id for the student
- find the group id for the teachers
- send the teacher the email when the group id for the student and the group id for the teacher match

Does this sound right? I had a go but the coding is just too complex for me! Any ideas welcomed!

One other thing. The contact form seems to be working without producing any errors but when I go to the admin page it gives me an error message:

"Version mismatch: block contact_form can't downgrade 2004102400 -> 20050701!"

Is there anywhere that I can find the correct version of the block so I do not get this error?

Thanks, Nikki
In reply to Nikki Macfarlane

Re: Contact form block

Daryl Hawes發表於

The email sent from teh course page currently goes to all the teachers for that course. I would like to amend it so it only goes to the teacher assigned for the group the student is in. Otherwise the teachers are going to get hundreds of emails from students they are not looking after.
[...]
Does this sound right? I had a go but the coding is just too complex for me! Any ideas welcomed!


It sounds right to me. The only thing I would add then is on the config form add an option for "teachers in user's group". If the course allows anonymous access the guest user may not be in any group of course.


"Version mismatch: block contact_form can't downgrade 2004102400 -> 20050701!"

Is there anywhere that I can find the correct version of the block so I do not get this error?


Thanks for pointing this out. I made a mistake in updating the version number for the block on the last fix. I have sent a change in to cvs contrib. If you would simply like to edit your file modify block_contact_form.php to say version 2005070100 instead of 20050701.
In reply to Daryl Hawes

Re: Contact form block

Tim Allen發表於
This is an excellent block, thanks a lot Daryl for updating it. 微笑

I'd just like to report a little bug - when I try to change a setting via the configuration --> modules page, I get the following error message:

Sorry, but your session key could not be confirmed to carry out this action. This security feature prevents against accidental or malicious execution of important functions in your name. Please make sure you really wanted to execute this function.

This occurs when trying to change any of the settings on that page.

Tim.
In reply to Tim Allen

Re: Contact form block

Daryl Hawes發表於
I've added sesskey references to all forms and links in the hopes this problem goes away for you. Please check out the latest revision (as listed below):

config_global.html new revision: 1.3
config_instance.html new revision: 1.2
form.html new revision: 1.2
thanks.php new revision: 1.3
In reply to Daryl Hawes

Re: Contact form block

Tim Allen發表於
Hi Daryl,

Thanks a lot for addressing this so soon, this seems to have solved the problem.  approve

Much appreciated,
Tim.
In reply to Tim Allen

Re: Contact form block

Chardelle Busch發表於
Core developers的相片
Hi Daryl,

I was wanting to add a dropdown box to select a subject (see example screenshot).

Would you know offhand if there would be some code I could add so the subject would insert the selection? If not, no big deal, just thought I would ask.

Thx,
Chardelle
附件 subject.gif
In reply to Chardelle Busch

Re: Contact form block

Daryl Hawes發表於
In the form.html file replace this line:
<input type="text" name="subject" size="25" maxlength="200" <?php if( isset($subject)){ echo 'value="'. $subject .'"';}?>/>

with your drop down menu line - something like the following untested pseudocode:
<?php

$options = array('Technical Support' => 'Technical Support', 'Ask the Teacher' => 'Ask the Teacher', 'Ask the TA' => 'Ask the TA', 'Comment' => 'Comment');

choose_from_menu ($options, 'subject');
?>
In reply to Daryl Hawes

Re: Contact form block

Daniele Cordella發表於
Core developers的相片 Plugin developers的相片
I have seen that by calling the form from a course the user get a page with breadcrumb incorrect.
Instead of nameOfTheSite >> nameOfTheCourse >> contact_form the user only gets nameOfTheSite >> contact_form. How can it be corrected?

Is it possible to have a way to select in the form the teacher to contact? Something like what you proposed for the subject field?

Thank you in advance. 
In reply to Daryl Hawes

Re: Contact form block

N Hansen發表於
Wow, go to bed and wake up find this already integrated! smile Now, I would rather add it as an activity to the main menu rather than as a block. Is this a possibility? And by the way, I'll test it on my site and I'll also be posting the tell-a-friend script shortly, if someone wants to find a way to incorporate that as well.
In reply to Daryl Hawes

Re: Contact form block

Bhupinder Singh發表於

Hi Daryl,

I tried to install the block.

I got an error.

Warning: file(c:\program files\easyphp1-7\www\moodle/blocks/__MACOSX/block___MACOSX.php): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\moodle\lib\blocklib.php on line 21

Can you help me resolve this.

I must have gone wrong somewhere,sad

Garry

In reply to Bhupinder Singh

Re: Contact form block

Simon Williams發表於
I get the same error - I have tried several times - has anyone resolved this?sad
In reply to Simon Williams

Re: Contact form block

N Hansen發表於
In 1.5, the contact block comes in the standard Moodle package I believe. You shouldn't have to add it from CVS. Perhaps you are adding it over the original files and messing things up that way?
In reply to N Hansen

Re: Contact form block

Simon Williams發表於
I dont think it comes standard.

I did realise that it works when sourced from the CVS rather than a zip file I spotted in the forum.

I hadnt used a CVS before so that was a learning curve in itself!

Thanks for responding.

-S
In reply to Daryl Hawes

Re: Contact form block

W Page發表於
Hello Everyone!

I have been out most the day working on a Discussion for class.  The development of this block/module has been amazing.  "N" stirred it and "Daryl" cooked it. 微笑

Just a few thoughts [Some which may seem more than necessary.  Also they may be looked at as future features.]
  1. The contact feature should be
    1. A block with a link that can be placed on the site page and into individual courses along with the blog page Daryl, of course. 微笑, AND/OR
    2. A link which can be added near the bottom of the site menu block via some type of toggle switch [similar to the new topic feature] from the  Site Settings page.  This should also be handled in a course vis the Course Settings page.  This instead of an entire separate block. OR
    3. A block with a "dropdown" menu of contacts, textarea.
  2. There should be an option to have the Contact form display as a
    1. PopUp Window [If as a popup, there should be some text to indicate that is what the link is going to do so popup blockers can be disabled for this], OR
    2. As a module.
  3. The Contact form should have a "dropdown" menu allowing the student and teacher to contact neccessary folk *,
    1. Teacher - Admin, Tech Help, Other Teachers in the Course [Individual / Group], Other Teachers on the Site [Individual / Group], etc...
    2. Student - Admin, Tech Help, Teachers [Individual / Group], etc...
  4. The ability to place an address and telephone number and fax number might also be nice on the form as well.
  5. The email addresses should not be readable by a search "spider".  鬼臉   I think Martin and Mike have some code from the MoodleWiki to deal with this.
  6. E-mail address of the sender
    1. Course participant - should be automatically placed in the contact form. 
    2. Site Visitor - Area to place e-mail address.

* I am dealing from a purely educational view here.  The Business people might need descriptions such as, Admin, Sales, WebMaster, Inquiry, HelpDesk.  A GUI dealing with all this might be helpful.

The contact form by NukeStyles.com [Yes, I know one of those phpNUKE script sites, but, a very good one] has a nice contact script.  I will post an image for an example of some of the things I am referring to.

Alas, I am tired now because of so much work I did for the Contact feature!!! 微笑

WP1


附件 contact_example_01.gif
In reply to W Page

Re: Contact form block (version 5)

N Hansen發表於
 OK-This is version 5 (for those of you trying to keep track...). I fixed a couple things here-these will affect the appearance of the block. I've changed the name of the block slightly, and got rid of the name field that appeared and simply have the button. I also got rid of the box within the block problem.
In reply to N Hansen

Magic Trick with the Contact Block

N Hansen發表於
I have figured out a way to convert the contact block into a main menu item. You must have the block installed on your Moodle, however, you do not need to actually add it to your main page. What you can do is create a label in your main menu. This label should consist of the relevant icon you wish to use for the contact page (to make it look like other items on the main menu), plus a piece of text you wish to use to link to the contact form. Link this text to the relevant contact form page in your Moodle, and you can access the contact block without the block at all! I presume this could be added as a link to the bottom of every page of your site if you wanted to do so as well.
In reply to N Hansen

Re: Magic Trick with the Contact Block

Daryl Hawes發表於
Excellent. When I woke up today I was planning on adding back in your note on how to add the script as a site activity (or label, or any link) to the readme file. You have already discovered that this can be done easily. Nice job.
In reply to Daryl Hawes

Re: Magic Trick with the Contact Block

Chardelle Busch發表於
Core developers的相片

I thought I heard little elves tapping away in the night. 

Thanks n, it appears you have answered all of the issues except for one.   When added to a course, the code does not pick up the teacher's email address, it is still sent to the admin address.  Daryl, did you ever get this worked out?

Also, when added to a course, I myself would delete the "Us", since for a course with only one teacher/facilitator the "Us" makes no sense. (Like I mentioned above, it would be nice to be able to have a different submit value for each block--e.g. Send Us an Email, Ask-a-Question, Submit a Comment...but like I said, not sure if this would be possible?????)  Maybe this differentiaiton issue could be addressed somehow with WPs drop-down menu idea above.

Thanks you guys

Chardelle

In reply to Chardelle Busch

Re: Magic Trick with the Contact Block

Daryl Hawes發表於
Hi Chardelle,
It appears I did not get the teacher email problem worked out. As far as I can tell the code is OK and it sends email to both the admin and the teacher on my test site as of update 4. There might be some case I am unaware of though which would cause it to fail on your site (?)

Regarding custom text for the submit button - just use a link instead. In n's first post there was a readme file that outlined how to make a link to the contact form from the site front page. The block is just a button doing the same thing rather than a link (I had wanted to put the full form there, but it doesn't fit well in that context).
In the short term I suggest installing the block but not adding it to your site/course. Instead add a new activity/resource link. In addition you could modify the moodle footer.
The link you create should simply point to the form.php file - so yoursite.com/moodle/blocks/contact_form/form.php is the link substituting your url to moodle 微笑


Original instructions:

*In your Main Menu on your site, choose "Add a resource" and then "Link to a file or Web site."

*In the "Summary," type the text you want to appear before the feedback form.

*In "Location," enter the path to form.php.

*Choose "Same window" and then "Save Changes."

*Your form should now work.


In reply to Daryl Hawes

Re: Magic Trick with the Contact Block

Chardelle Busch發表於
Core developers的相片

Hi Daryl,

Yes, adding it as a link instead of a block on the site homepage is probably the best way to go.  But, it needs to be added as a linked label, like n suggested, because it is picking up the theme.  If you add it as a resource link, then it brings up the theme with the form so you end up with a header above the form giving you two headers on the page. 

Now, as for adding it to a course.  Still not quite there yet, maybe someone else can test it to see if they get an email to the teacher's email address-I just don't and haven't figured out why yet.  Also, after submitting, and then clicking continue, it takes you back to the site homepage, rather than back to the course homepage.  (By the way, I am using version 5 that n posted above.

Chardelle

In reply to Chardelle Busch

Re: Magic Trick with the Contact Block

N Hansen發表於
Correct me if I am wrong, but for contacting the teacher, couldn't you use the dialogue module? I liked WP1's suggestion best, that there be a drop-down list that people can choose who to send the email to. You could, on a small site, even include all the teachers in this list. It would be kind of nice if people considering enrolling in a particular course were able to contact the instructor in advance with any questions they might have.
In reply to N Hansen

Re: Magic Trick with the Contact Block

N Hansen發表於
Actually, I should correct what I said, now that I have tried implementing this fully I realized it is better not to use a label, as getting the icon in the proper place becomes a problem then, but rather to add a resource, choose "link to a file or website," and then input the page address of the form, and then choose to open in the same window, but without frames. 
In reply to N Hansen

Yet Another Magic Trick

N Hansen發表於
This is going to be the last one for a while...I promise (suddenly remembered I have to go to work this morning to meet some people!). I've just been on a roll the last couple days...In any case, say you want to use your contact form for a specific purpose. In my case, I want to make an instance of the contact form that people can use to submit suggestions of courses they would like to see on my web site. I want the subject line to be automatically filled in. So what I did when I created the resource was to modify the page address slightly:

http://www.mysite.com/blocks/contact_form/form.php?subject=Course Suggestion

Then it automatically fills in the subject field.
In reply to N Hansen

Re: Yet Another Magic Trick

Chardelle Busch發表於
Core developers的相片

Great tricks n,

I don't know why I didn't try setting it to no frames.  That works great.  And the subject field idea is a good one also.  But, I still would like to get the within a course code working. Especially as a way for students to easily send a message if they are having problems.  I wouldn't use the dialogue for this for these reasons.  1) It is better to have this link in a block--and be separate from course content--rather than stuck somewhere within a topic.  2) I think that the dialogue module would be too inviting for students to feel they can continue and on-going dialogue with a teacher  (and thus take up too much of the teacher's time).  The way my courses are setup, the dialogue feature is reserved only for those who pay to have a one-on-one dialogue--not for general use.  A better alternative than dialogue is to set up a FAQ glossary.  But I still like the Ask-A-Question idea the best--just need to get it working.

Chardelle

In reply to Chardelle Busch

Re: Yet Another Magic Trick

N Hansen發表於
Daryl will have to help out with that one because I didn't write that part of the code. An alternative would be to link to it as a resource as I described and then just call the link "Ask a question." But I bet Daryl can fix the code so that it works.
In reply to N Hansen

Yet another code trick

Daryl Hawes發表於
Hello folks,
I went ahead and made modifications to the block that should allow it to work properly in a course now. Eagle eye Dan Marsden found a problem and also tested the update.
I put it in cvs in the contrib section (cvs:/contrib).
cvs:/contrib/contact_block
In reply to Daryl Hawes

Re: Yet another code trick

Chardelle Busch發表於
Core developers的相片

Hi Daryl,

It's not in cvs contrib.  Could you check on this.  I'm ready to give it a test.  And thanks to Dan too.

Chardelle

In reply to Chardelle Busch

Re: Yet another code trick

Daryl Hawes發表於
Chardelle,
It takes up to 5 hours I believe for cvs additions to synchronize with public cvs. Please try again in a bit.
In reply to Daryl Hawes

Contact form block

Jon Bolton發表於
Testers的相片
Nice block, installed very well on my site.  Just a couple of observations...

1. Regardless of whether someone is logged in or not, or whether they have chosen to keep their email address private, the "From" address used by the Contact Form is the default noreply address set in the Config->Variables page.  It would be helpful if this could be set to show the email address of the sender.

2. When the form is submitted, the "Continue" link points to http://domain/course/view.php?id=1 - which forces the log in page in you're not logged in.  It would be helpful if this could just return to the site main page (or even better would be a configurable 'return to' page).

3. The code in block_contact_form.php suggests that the name of the block is different depending on whether the block is on the front page or within a course...

    function CourseBlock_contact_form($course) {
        if(!isset($course) || $course != 1){
            //we're displaying on the site page
            $this->title = 'Contact Us'; //get_string('activities');
        } else {
            // we're in a course
            $this->title = 'Ask a Question'; //get_string('activities');

But it didn't make any difference for me :-(
In reply to Jon Bolton

Re: Contact form block

Chardelle Busch發表於
Core developers的相片

Hi Daryl,

Getting soooooo close.  I echo what Jon says above-- but at least for the first time from within a course it sent email to both admin and teacher, and it took me back to the course--yeah.

I also want to add a couple of things.

1.  I am not sure an admin would really even want to get a copy of the email from within a course .  Also, there is no way for the admin to tell where that email came from (what course or the site homepage) unless a subject line is pre-filled. 

2.  This is pickily wickily--will you please capitalize the "page titles" (contact form, thank you) so that they are consistent with the rest of the nav bar.

Thanks

Chardelle

In reply to Chardelle Busch

Re: Contact form block

W Page發表於
Hi Chardelle & Daryl,

Maybe a hidden subject field could be place in the code which is coded to say somthing like,

Contact Mail from Course BlaBlaBla.

The sender would not see it but it could be used to notify the receiver about the mail.

WP1

In reply to W Page

Re: Contact form block

Chardelle Busch發表於
Core developers的相片

Dan,

Just tried the code change and its good.  Now the block has a different name when in a course. 

Now, would you know what code I could add that would send the email only to the teacher when the block is in a course and not to the admin.

WP,

That might work, but I just don't see why an admin would want to get a bunch of emails from students asking the teacher questions about a course.

Thanks,

Chardelle

In reply to Jon Bolton

Re: Contact form block

Dan Marsden發表於
Core developers的相片 Particularly helpful Moodlers的相片 Peer reviewers的相片 Plugin developers的相片 Plugins guardians的相片 Testers的相片 Translators的相片

HI Jon,
I had a quick chat with Daryl - this line:
if(!isset($course) || $course != 1){
should be:
if(isset($course) && $course->id == 1){

he will commit the change to cvs sometime tomorrow.

微笑

Dan

In reply to Jon Bolton

Re: Contact form block

Daryl Hawes發表於
Once again tremendous thanks to Dan Marsden. He was able to test my changes as I made them. His help saved tons of time by catching type-o problems and helping to avoid guesswork.
I have posted the changes noted below to cvs. Mind you that there is about a 5 hour sync period before the changes are public.


Jon said: 1. Regardless of whether someone is logged in or not, or whether they have chosen to keep their email address private, the "From" address used by the Contact Form is the default noreply address set in the Config->Variables page.  It would be helpful if this could be set to show the email address of the sender.

[EDITED:] Actually this is expected behavior. The headers of the email should be from the site admin. The email of the user who is sending the message is listed in the body of the email, not in the header.


Jon said: 2. When the form is submitted, the "Continue" link points to http://domain/course/view.php?id=1 - which forces the log in page in you're not logged in.  It would be helpful if this could just return to the site main page (or even better would be a configurable 'return to' page).

I have changed the continue link to take you back to the course only if the courseid is valid (not 1 - 1 means site) and back to the site otherwise.


Jon said: 3. The code in block_contact_form.php suggests that the name of the block is different depending on whether the block is on the front page or within a course...

Fixed as Dan noted.


Chardelle said: 1.  I am not sure an admin would really even want to get a copy of the email from within a course .  Also, there is no way for the admin to tell where that email came from (what course or the site homepage) unless a subject line is pre-filled. 

I added a new config option to allow the admin to select whether or not to receive emails from within courses.
To get to the admin configuration for this block visit yoursite.edu/moodle/admin then click blocks and click the settings link for the "Ask a question" block.


Chardelle said: 2.  This is pickily wickily--will you please capitalize the "page titles" (contact form, thank you) so that they are consistent with the rest of the nav bar.

Done.


WP1 said:Maybe a hidden subject field could be place in the code which is coded to say somthing like,
Contact Mail from Course BlaBlaBla.


Good idea. The subject line is now prefaced by the course short name in square brackets.ie "[EN101] Can I take that quiz again?"
In reply to Daryl Hawes

Re: Contact form block

W Page發表於
"[EN101] Can I take that quiz again?" Daryl Hawes

微笑 微笑  大笑

In reply to W Page

Re: Contact form block

Daryl Hawes發表於
Rather well put, no?
Could also try "[MATH101] 2+2=5 was wrong? I need a new teacher!"
Then there's the fabulous "[CSC101] Some array's start at 0, some at 1. Let's just split the difference and start all arrays at .5."
In reply to Daryl Hawes

Re: Yet another code trick

Daryl Hawes發表於
The link I provided was indeed wrong. The correct cvs link, once moodle is renamed to doodle or anonymous cvs starts working again, is at:
cvs:/contrib/contact_form
In reply to N Hansen

Re: Contact form block (version 5)

Bhupinder Singh發表於

Hi Hansen,

I tried to install the block.

I got an error.

Warning: file(c:\program files\easyphp1-7\www\moodle/blocks/__MACOSX/block___MACOSX.php): failed to open stream: No such file or directory in c:\program files\easyphp1-7\www\moodle\lib\blocklib.php on line 21

Can you help me resolve this.

I must have gone wrong somewhere,sad

Garry

In reply to Bhupinder Singh

Re: Contact form block (version 5)

Karrie V發表於

I have gotten this error lately every time I try to install a block.  If you figure out the answer please keep me up to date on what to do to fix it.

Thanks!

Karrie

In reply to N Hansen

Re: Contact form block (version 5)

Bhupinder Singh發表於

Hi Daryl,

I am in a problem and look for some help.

I tries installing the contavt Block. (v.5).

Nothing happens after following the Readme.

I am certain that I am missing out on somthing.

Can you help me with the instructions and guide me on the procedure.

Thanks Once Again.

Garry

In reply to Daryl Hawes

Re: Contact form block

Bhupinder Singh發表於

Hi Daryl,

Can you help a little. I am stuck thoughtful

There are many post and getting to the last Zip File is difficult.

Can you advise where the latest zip is. A fresh upload will be welcome by all.smile

I am having porblems the link to my post is Re: Contact form block (version 5)

Look forward for your help.

The block looks excitng and I look forward to using the same.

Garry

In reply to Bhupinder Singh

Re: Contact form block

Daryl Hawes發表於
No one should be using any form of any posted zip file.
The contact form is now in the contrib section and many fixes went into it that were not posted as a zip file.

cvs:/contrib/

Daryl
In reply to Daryl Hawes

Re: Contact form block

Bhupinder Singh發表於

I have added the contact form via the CVS route the creation was successful.

However The form does not display.

I muts be wrong somewhere can you help me.

Thanks in advance.

Garry

In reply to Daryl Hawes

Re: Contact form block

g k發表於

This is a great block.

I am the administrator of the moodle site at my school.  However, when I place this block on teacher courses, all of the emails come to me. 

How could I make the email come to the teacher in the specific course?

In reply to g k

Re: Contact form block

Daryl Hawes發表於
Visit your site admin configuration for this block.
First open yoursite.edu/moodle/admin then click blocks and click the settings link for the "Ask a question" block.
Now change the option of sending email to admins and teachers to just sending emails to teachers.
Please let us know if that is now working for you so that we can find the problem.
In reply to Daryl Hawes

Re: Contact form block

Chardelle Busch發表於
Core developers的相片

Hi Daryl,

I hate to do this but.......

The continue link when not logged in, is still taking me to the login page rather than back to the site index.  Maybe because course/view.php is in the link Moodle thinks you need to login?

} else {
    $continuepage = $CFG->wwwroot . '/course/view.php?&amp;id='. $fromcourse;

Also, about line 10 in form.php, "contact form" didn't get capitalized. 

Other than that everything works fine. 

(And as to the above post--I think the option to send emails only to teachers is the default--so it should be working -- make sure you are using version 1.2 of the contact form)

In reply to Chardelle Busch

Re: Contact form block

Daryl Hawes發表於
Also, about line 10 in form.php, "contact form" didn't get capitalized. 

The fix is now in cvs. Thank you for catching it.

The continue link when not logged in, is still taking me to the login page rather than back to the site index

It is definitely because course/view.php enforces login. IMHO it should not force login if the course being viewed is the site page. Since it does I added code to try to redirect to $CFG->wwwroot if there was no course specified.
Perhaps your site course id is not 1.
What is the URL that the continue link points to when a guest in an anonymous accessible course sends a message?
In reply to Daryl Hawes

Re: Contact form block

Daryl Hawes發表於
I left some unclosed tags in that last message 傷心 I didn't catch it in time to edit the post. Closing them in this post.
In reply to Daryl Hawes

Re: Contact form block

Jon Bolton發表於
Testers的相片
Found the problem with being returned to login.  The site index is course 1 by default. 

In thanks.php, change line 13 from

if(!is_numeric($fromcourse) || $fromcourse == 0){

to

if(!is_numeric($fromcourse) || $fromcourse == 1){
In reply to Jon Bolton

Re: Contact form block

Daryl Hawes發表於
Jon,
The fix is in cvs. Great catch. This is a type-o that we missed. The check is correct in form.php. Try using Jon's fix Chardelle 微笑
In reply to Daryl Hawes

Re: Contact form block -- Holy cow!

Art Lader發表於

I have to say that I find the level of cooperation and collaboration that has gone into the evolution of this block wonderful. If only every organization I belonged to worked like this! big grin

-- Art

In reply to Art Lader

Re: Contact form block -- Holy cow!

N Hansen發表於
Art, I spent a year working on the development of a Web site and that experience was amazingly cooperative and collaborative. It really was a once-in-a-lifetime kind of experience. I'm actually still employed at the same job but it has evolved into other things and it just isn't the same.  I think we must have really been doing something right from a design perspective, because we got a huge amount of attention and honors from the Web design world as a superb model of Web design, whereas I can count the number of our academic colleagues who ever sent us any praise on our Web site on one hand (but then people in my field tend to be too jealous to be praising others' work).
In reply to Art Lader

Re: Contact form block -- Holy cow!

Philip A. Thompsen發表於
I would like to try this block on my site, but I haven't been able to find it via CVS. Could you possibly post the latest version again as an attachment to this forum?
In reply to Philip A. Thompsen

Re: Contact form block -- Holy cow!

N Hansen發表於
And does anyone know what has happened to CVS? Why did it suddenly become inaccessible? Any idea how soon it will be accessible again?
In reply to N Hansen

Re: Contact form block -- Holy cow!

Tim Allen發表於

Hi n,

The sf.net site status page says this:

"( 2004-09-17 10:27:57 - Project CVS Service )   As of 2004-09-17 there is a problem with the CVS host serving anonymous CVS, nightly tarballs and ViewCVS for projects that start with the letters m, n, p, q, t, y and z. We currently do not have an estimate on when they will be back up. "

We'll probably just have to be patient and wait for it to be fixed.  mixed 

In reply to Philip A. Thompsen

Re: Contact form block -- Holy cow!

Tim Allen發表於

You can get it here: http://moodle.org/download.php/modules/contact_form.zip.  Not sure if it is the most recent version though...

HTH 微笑

In reply to Tim Allen

Re: Contact form block -- Holy cow!

Sean S發表於
Does this work with 1.4.4? also when I go up a directory to http://moodle.org/download.php/modules/ the contact form.zip file isn't listed, any idea why?
In reply to Sean S

Re: Contact form block -- Holy cow!

Tim Allen發表於

the contact form.zip file isn't listed, any idea why?

Probably because no blocks are listed there - we're all waiting for the promised block repository.  smile

I just installed it but there is the infamous sesskey problem when I try to change the settings to use a link instead of a button for the "contact me".  However, it actually works apart from that - emails are successfully sent. 

Tim.

In reply to Art Lader

Re: Contact form block -- Holy cow!

N Hansen發表於
If you enjoyed participating in the development of the contact form block, here's another one for you to try your hands at!
In reply to Daryl Hawes

Re: Contact form block

Richard Crawford發表於
Hey, Daryl.

This has actually proven to be a pretty useful little block for us. We have two versions: contact_admin_support (for issues relating to logins, enrollment keys, etc.) and contact_tech_support (for specific website related issues). We had to tweak the tech_support block just a little bit because we don't have an actual tech_support user account, just an e-mail address for our webmaster.

Thanks!
In reply to Richard Crawford

Re: Contact form block

Daryl Hawes發表於
You mean Nicole Hanson and Daryl since I added to the work that she started 微笑
Glad you are finding it of use.
Daryl
In reply to Daryl Hawes

Re: Contact form block

Daniele Cordella發表於
Core developers的相片 Plugin developers的相片
Please let me understand.
I am a bit confused.
Where can I find the last release of the contact_form?
What does it contain?
I found in cvs:/contrib/
block_contact_form.php
config.html
form.php
readme.txt
thanks.php
db/mysql.php
db/postgres7.php
db/mysql.sql
db/postgres7.sql
and somewhere else I found the same list of files with the following addendum too
config_global.html
config_instance.html
form.html

Then I have a problem: I move the contact_form folder into the /moodle/block folder and I go to the administrator page of Moodle but nothing happens and the block doesn't appear in a corse addBlock dropDown menu.

Can anybody explain me where I fail?
Thank you in advance.
Sorry for the too elementary question.
In reply to Daniele Cordella

Re: Contact form block

mandy honeyman發表於
Hello,

I too was trying to add this from cvs and have failed - nothing happens when I go to mysite/admin - (this is probably me because I haven't used cvs like this before), but nevertheless.....

I assumed that the correct files were in block_contact_form_1.5 not contact_form (in which the files are currently 17 months old, whereas the others are 7 months old). Is this right?

cheers
Mandy
In reply to mandy honeyman

Re: Contact form block

Bill Fullbrook發表於

A newbie to moodle and another one who would like some help with this block. I too have tried adding it from CVS too but there is no mysql with the 7 month old files and the 17 month old ones don't appear to  work with 1.5. Any ideas?

Cheers

Bill