Firefox PHP

Topic Poll Module

Posted by Maurice Makaay 
All files from this thread

File Name File Size   Posted by Date  
topic_poll-1.0.11.tar.gz 78.6 KB open | download Maurice Makaay 07/14/2008 Read message
topic_poll-1.0.11.zip 94.7 KB open | download Maurice Makaay 07/14/2008 Read message
Topic Poll Module
September 06, 2006 04:02PM
This module makes it possible to add polls to forum topics. For each
forum the administrator can configure who can create polls. Some of the features:

  • Admin interface that allows for a specific configuration for each forum;
  • CSS based styles, each forum can have its own style;
  • Revoking votes for registered users who have voted;
  • Polls can be for registered users only or for all visitors (including anonymous visitors). For anonymous users, vote tracking is done using a combination of cookies and IP-address blocking;
  • It is possible to hide all thread replies until the visitor casts a vote.
  • Easy poll editor for users, implemented as a separate screen in the posting process.

You can test-drive this poll module at my development site. You can create a new topic and add a poll at: http://phorum-dev.gitaar.net/phorum_trunk/posting.php?17

Changelog:
----------

2008-07-14 v1.0.11

    - Added a new option to the settings for a poll, to make it possible to
      hide all thread reply messages until the visitor casts a vote.

2008-01-01 v1.0.10

    - It is now possible to not add an icon to the subjects in the list
      page for threads that have a poll in them, but instead setup some
      template variables. This way, it's possibly to fully control the
      way in which polls are indicated in the message list page. See the help
      information in the module admin settings for info about this feature.

    - Added a Latin American Spanish translation.
      Thanks to Phorum user "marcelarr".

    - Added a Ukrainian translation.
      Thanks to Phorum user "tadjik".

2007-11-19 v1.0.9

    - Reset the $messages array in the read hook, so each() will get the
      first message in the array. This didn't work correctly if some
      previous read hook from another module iterated over the $messages
      array as well.

2007-08-17 v1.0.8

    - Copied templates/default to templates/emerald to match the default
      fall back template for Phorum 5.2.

2007-07-13 v1.0.7

    - Fixed a compatibility issue for using this module in combination
      with Phorum version 5.1.23. From here on, 5.1.23 is also the minimal
      version for which the module will work.

2007-06-19 v1.0.6

    - Fixed a bug in the feed message rendering.

    - Added an option in the poll editor for displaying the poll before
      or after the message body.

    - Included updated French language file by Fran.

2007-05-01 v1.0.5

    - Fixed a typo in the Dutch language file.

2007-04-06 v1.0.4

    - If a topic is closed, then the poll is closed too now.

2007-02-22 v1.0.3

    - Fix for finding the raw_datestamp on 5.1 systems, in case the
      messages in the format message array are from multiple forums.

2007-01-19 v1.0.2

    - Added German translation (thanks Netwalker!).

    - Added French translation (thanks Fran!).

    - Changed the maximum width for the score bars to 95% instead of 100%,
      to provide some extra space for styling the bars.

    - Fixed a bug which could cause failure to draw the graph after
      editing the poll form (showing only some undefined index
      warnings instead).

    - Added a simple rendering to the format hook for displaying polls
      inside RSS/ATOM feeds. In the feed, the poll will show up as the
      poll question.

2006-09-07 v1.0.1

    - The preview of the poll in the admin interface (for selecting a
      style) resulted into a nested form (voting form within the admin
      form). A change was made, so the poll now doesn't start a
      new form if it's in the admin interface.

2006-09-06 v1.0.0

    - Initial revision

[/code]


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 13 time(s). Last edit at 07/14/2008 05:59AM by Maurice Makaay.
Attachments:
open | download - topic_poll-1.0.11.tar.gz (78.6 KB)
open | download - topic_poll-1.0.11.zip (94.7 KB)
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 06, 2006 07:32PM
I dont know if it's a bug or not, but I had to make 2 changes in settings.editforum.php to be able to update settings per forum:

Change line 95:
$frm =& new PhorumInputForm ("", "post", "Save settings");
TO
$frm =& new PhorumInputForm (htmlspecialchars($_SERVER["PHP_SELF"]), "post", "Save settings");

& comment out line 187:
// $frm->addmessage($messages[1]["body"]);

things work fine.. otherwise, it wont let me submit..
The first problem is ovious..it's submit action is nothing, which is what it does.
the 2nd has to do with nested forms.. the function: phorum_mod_topic_poll_format wraps the output (messages[1]["body"]) with a form tag, so this creates nested forms which seem to be causing some diffuculty.

of course, without it, you dont get the fancy preview which is nice to have to see what the templates look like.

my guess is that you modified phorum_mod_topic_poll_format to add the form open/close tags after testing editforms.. either that or something just weird on mine.

I just upgraded to 5.1.16 this morning, all else seems fine.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 06, 2006 09:14PM
I'm really wondering about that PHP_SELF change you did. I think that every module that I have running on my system has "" at that spot. Also the default Phorum modules (like the smileys module) are using this syntax. The following code is at the start of PhorumInputForm.php:
   $this->_action = ( empty( $action ) ) ? $_SERVER["PHP_SELF"] : $action;
So the form class is already using PHP_SELF if no action URL is given. The only difference would be the htmlspecialchars() that you added. Do you really have an URL in PHP_SELF that doesn't work unescaped?

Additionally, even if this resulted in an empty action, I don't know any browsers that really would trip over an empty action="" field in the <form> tag. If you can vote in a poll, then that's the proof for that, because the voting form has an empty action for the form.

Sidenote: I changed =& to =, because =& is of no use anymore in recent PHP versions.

The nested forms have always been there and I have tested the module extensively on my own system before releasing it, only I never had any problems with this (and wasn't aware of the nesting either). Maybe that your browser did handle the form differently than mine? Anyway, I wrote a fix for those nested forms. I'll upload the new 1.0.1 version to the first message in the thread.

Thanks for testing this out.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 07, 2006 05:15AM
works fine with me :) but first thing I did was translating the language file. have fun with it ;)

mmakaay: removed the attachment. It's now part of the distribution.



Edited 1 time(s). Last edit at 01/19/2007 05:44PM by mmakaay.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 10, 2006 05:23AM
well. I uploaded the 1.0.1 version and all is well.

I thought the previous issue might have been browser related, but I tried it on a couple browsers....it's possible it was server related, but then I'd have had troubles all over the place.. so maybe it was just an anomoly? but all is well now.

Thanks much,
Keith



Edited 1 time(s). Last edit at 09/10/2006 05:24AM by freedman.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 17, 2006 04:57AM
Hello,
I've tried your poll module on your test site... it's just what I was looking for :-)

I've installed it on my localhost following the readme instructions. I've turned the poll mod to "on" and when I go to the settings, I see the list of my forums.
But when I click on the "configure" button, I receive the following error message :-(
Quote

Failed to write a compiled template to C:\Windows\Temp/tpl-default-topic_poll::voting_results-toplevel-0b3863d9d685013651d75177f851a863.php. This is probably caused by the file permissions on your cache directory.
I've take a look to this temp directory, there are a lot of other "tpl-default-..." generated by phorum or the mods.
Are the file permissions different for topic poll module and for the rest of the phorum ? Or is it something else ? Maybe I forgot something ?

I use WinXP SP2, easyPHP 1.8.0.1, mysql, phorum version 5.1.16a, and I tried with Firefox 1.5.0.7 and IE 6.0

Thanks
Fran.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 17, 2006 06:27AM
There should be no difference, since it's the webserver that has to write the file. But apparently Windows does not like the colon (:) in a filename :-(

Can you try changing the file common.php? Around line 671, you'll find the following code:
        // not there, look for a template
        $tplfile = "$tpl.tpl";
        $safetemplate = str_replace("-", "_", $PHORUM["template"]);
        if ($module !== NULL) $page = "$module::$page";
        $safepage = str_replace("-", "_", $page);
Change this to (the changed part is green):
        // not there, look for a template
        $tplfile = "$tpl.tpl";
        $safetemplate = str_replace(array("-",":"), array("_","_"), $PHORUM["template"]);
        if ($module !== NULL) $page = "$module::$page";
        $safepage = str_replace(array("-",":"), array("_","_"), $page);
I think that should fix your problem. Please let me know if it does, then I'll include the fix for the next release.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce



Edited 1 time(s). Last edit at 09/17/2006 06:51AM by mmakaay.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 17, 2006 07:53AM
I've made the change in common.php and it works fine now.
Thanks :-)

PS: I've made a translation of the language file in french "pour nos amis francophones" (see attachment french.php)

mmakaay: removed the attachment. It's now part of the distribution.



Edited 1 time(s). Last edit at 01/19/2007 05:45PM by mmakaay.
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
September 17, 2006 02:22PM
Merci bien, notre ami(e?) Belgique! I'll add the translation to the next release of the module!


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Topic Poll Module (only for Phorum 5.1.16 and higher)
October 25, 2006 06:19PM
Hi,

I just intalled that Poll module and it work almost perfectly...

Here is the 2 problem I have :

First, in the admin module section, I see 2 "Topic Poll Module". The second works but not the first. I have incorrectly installed at first. I think I removed all the files before I correctly installed, but apparently I might forgot a few. Any suggestion? OK disregard the first problem. I did find the files and removed them. Now I only see 1 "Topic Poll Module" and it's the good one.

Second, I have intalled the french.php file but I only see the English version. What is wrong?

Thanks,

Yves



Edited 1 time(s). Last edit at 10/25/2006 06:26PM by Yes.
Sorry, only registered users may post in this forum.

Click here to login