Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2011-01-05 06:40:46

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

[MOD] Poll Mod - 1.3.3

This mod will allow you to add polls of any complexity to the first post in a topic.

Thanks to kg for "Simple Poll".

http://fluxbb.org/resources/mods/poll-mod/
-----------------------------
Language: Russian/English/French/Polish/Dutch

80731694.th.gif 16619443.th.gif 33302430.th.gif 51914167.th.gif 91857416.th.gif e22abf1454866bdbedf17512f008c20a.jpg 74d1c68b95b9cac305a5c579a6005da3.jpg

-----------------------------
Attention!  (FIX in v.1.3.0)
If in your config $db_type = 'mysql';, that in a topic-poll will be visible only poll !!!

Note for merge topics: Poll from the second subject (which is deleted) will be gone.

Last edited by Visman (2013-08-18 10:37:43)

Offline

#2 2011-01-31 02:55:23

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

Up.
The file readme.txt is changed only.

Offline

#3 2011-02-10 17:56:02

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

Up.
For FluxBB 1.4.4
The file readme.txt is changed only.

Offline

#4 2011-02-18 14:55:15

jojaba
Member
From: Obersoultzbach, Elsaß, France
Registered: 2009-12-04
Posts: 473
Website

Re: [MOD] Poll Mod - 1.3.3

Visman wrote:

Up.
For FluxBB 1.4.4
The file readme.txt is changed only.

I just installed your great mod on my local 1.4.4 installation. I can confirm that it works on 1.4.4 version of FluxBB. Only the lines number that you have to search to add the code must be changed...
Can I ask how long a question can be ? 256 characters ?
Here's the French translation:

<?php

// Language definitions used in ap_polls.php
$lang_ap_polls = array(

// Form
'Form legend'                =>    'Sondage',
'Form enable'                =>    'Ajouter un sondage à cette discussion',
'Form question'                =>    'Question',
'Form choice'                =>    'Choix %d',
'Form promoted'                =>  'Sondage apprécié',

// Validation
'No question'                =>    'Aucune question n\'a été fournie',
'Question too long'            =>    'La question est trop longue',
'Choice too long'            =>    'Le choix %d est trop long',
'Not enough choices'        =>    'Il n\'y a pas suffisamment de choix',

// Voting form
'Vote total'                =>    'Nombre de votes&#160;: %d',
'Vote button'                =>    'Voter !'
);

Last questions:

  • if I installed your mod on a 1.4.0 version and want to update to FluxBB 1.4.4, will the poll results be kept? Something else that I should know if updated to the last fluxBB release?

  • I can't find the admin page... hmm

Thanks in advance smile

Last edited by jojaba (2011-02-18 15:03:55)


Localize Mozilla extensions on BabelZilla

Offline

#5 2011-02-18 16:02:28

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

to jojaba:
>Can I ask how long a question can be ? 256 characters ?
max = 250 characters (VARCHAR(255)).

>Here's the French translation:
There other language files. It is file for Simple Poll!? It is other mod!!!

>will the poll results be kept?
Yes. The standard script of updating doesn't touch the data from this mod

>I can't find the admin page...
plugins/AP_Poll.php

Offline

#6 2011-02-18 18:57:01

jojaba
Member
From: Obersoultzbach, Elsaß, France
Registered: 2009-12-04
Posts: 473
Website

Re: [MOD] Poll Mod - 1.3.3

Visman wrote:

>Here's the French translation:
There other language files. It is file for Simple Poll!? It is other mod!!!

ops! Your right, I used the "simple poll mod" not yours. Sorry for that!
The translation of your mod:
admin_plugin_poll.php

'Plugin title'    =>    'Sondage',
'Explanation 1'    =>    'Le plugin permet d\'adapter les sondages aux besoins de vos forums.',
'Explanation 2'    =>    'Vous pouvez activer/désactiver les sondages sur vos forums, régler le nombre de questions, des réponses et d\'autres paramètres.',
'Form title'    =>    'Options',
'Show text button'    =>    'Enregistrer les modifications',
'Plugin redirect'    =>    'Options mis à jour. Redirection …',
'Legend1'    =>    'Options générales',
'Legend3'    =>    'Options supplémentaires',
'Q1' => 'Utiliser les sondages sur ces forums.',
'Q2' => 'Nombre maximal de questions dans un sondage. <strong>Il est recommandé de définir un nombre une fois !</strong>',
'Q3' => 'Nombre de réponses maximal dans une question. <strong>Il est recommandé de définir un nombre une fois !</strong>',
'Q4' => 'Temps d\'édition d\'un sondage (en minutes). <strong>0 - sans limite de temps.</strong>',
'Q5' => 'Poll to which set it is possible to hide results of poll. <strong>Joins in poll.</strong>',
'Q6' => 'Les invités voient les résultats du vote.',

Sorry, I didn't understand the Q5 string!

poll.php

'Form legend'    =>    'Sondage',
'Form enable'    =>    'Ajouter un sondage à cette discussion',
'Form question'    =>    'Question %d',
'Form choice'    =>    'Choix %d',
'Form type'    => 'Le nombre maximal de choix pour une réponse&#160;:',
'Form result'    => 'Masquer le résultat du vote à partir de %d voix',

'No question'    =>    'Aucune question n\'a été fournie',
'Question too long'    =>    'La question %d est trop longue',
'Choice too long'    =>    'Question %d&#160;: choix %d est trop long',
'Not enough choices'    =>    'Question %d&#160;: pas suffisamment de choix fournis',
'Max variant'    =>    'Question %d&#160;: le nombre maximal de variantes de choix pour une réponse devrait être supérieur à 0 et inférieur au nombre de réponses',
'Possible choose'    => 'Il est possible de choisir %d questions',

'M0' => 'Vous avez voté',
'M1' => 'Le sondage est fermé',
'M2' => 'Les résultats du sondage sont masqués après %d voix',
'M3' => 'Les invités ne peuvent voter',
'M4' => 'Les résultats du sondage sont masqués pour les invités',

'Vote total'    =>    'Votes totaux&#160;: %d',
'Vote button'    =>    'Voter&#160;!',
'Votes'    =>    'voix',
'View'    =>    'Afficher les résultats',

Localize Mozilla extensions on BabelZilla

Offline

#7 2011-02-19 07:36:41

kg
Member
Registered: 2010-07-15
Posts: 35

Re: [MOD] Poll Mod - 1.3.3

Nice to see people carrying on the work and making it better big_smile

Offline

#8 2011-02-22 06:03:16

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

People, In what folder to store a cache of polls?
1. in /cache
2. in /cache/polls
3. in another?

to jojaba: q5
We specify number. While answers to poll less than this number, results of poll are closed.

Offline

#9 2011-02-22 11:15:47

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,719
Website

Re: [MOD] Poll Mod - 1.3.3

Since there will probably be quite a few polls, I'd vote for the subfolder (/cache/polls).


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#10 2011-02-22 12:36:22

Oldskool
Former Developer
From: Netherlands
Registered: 2008-12-28
Posts: 154
Website

Re: [MOD] Poll Mod - 1.3.3

Franz wrote:

Since there will probably be quite a few polls, I'd vote for the subfolder (/cache/polls).

Agreed, this seems like the most logical path and it keeps things structured.

Offline

#11 2011-02-27 04:15:48

jojaba
Member
From: Obersoultzbach, Elsaß, France
Registered: 2009-12-04
Posts: 473
Website

Re: [MOD] Poll Mod - 1.3.3

Visman wrote:

to jojaba: q5
We specify number. While answers to poll less than this number, results of poll are closed.

Thanks wink

'Q5' => 'Poll to which set it is possible to hide results of poll. <strong>Joins in poll.</strong>',

Translation:

'Q5' => 'Nombre de votes à partir duquel seront dévoilés les résultats du sondage (masqués tant que ce nombre n\'est pas atteint). <strong>Résultats divulgués.</strong>',

Not sure I'm right... If some French user could confirm this translation... hmm


Localize Mozilla extensions on BabelZilla

Offline

#12 2011-02-27 05:01:37

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

The web translator so has written to me wink

'Q5' => 'Le nombre de voix, jusqu\'à l\'ensemble de qui on peut cacher les résultats du sondage. <strong>On peut choisir dans le sondage.</strong>',

To versions 1.1.0 so has written.

Offline

#13 2011-02-27 09:32:50

adaur
Developer
From: France
Registered: 2010-01-07
Posts: 843
Website

Re: [MOD] Poll Mod - 1.3.3

@Jojaba: ok for the 1st part, but I don't understand what means "Joins in poll".


FeatherBB - A simple and lightweight new generation forum system
Based on FluxBB, written in PHP, using Slim Framework for a proper OOP-MVC architecture.

Offline

#14 2011-02-28 08:21:33

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

Version 1.1.0

Added use of a cache for polls (-1 query).
Added French. Thanks to jojaba.

Offline

#15 2011-02-28 10:03:09

jojaba
Member
From: Obersoultzbach, Elsaß, France
Registered: 2009-12-04
Posts: 473
Website

Re: [MOD] Poll Mod - 1.3.3

Visman wrote:

The web translator so has written to me wink

'Q5' => 'Le nombre de voix, jusqu\'à l\'ensemble de qui on peut cacher les résultats du sondage. <strong>On peut choisir dans le sondage.</strong>',

Sorry to say that but, that's nonsense, I mean that this doesn't mean anything (as usual with Web translators wink ).


Localize Mozilla extensions on BabelZilla

Offline

#16 2011-02-28 10:04:43

jojaba
Member
From: Obersoultzbach, Elsaß, France
Registered: 2009-12-04
Posts: 473
Website

Re: [MOD] Poll Mod - 1.3.3

adaur wrote:

@Jojaba: ok for the 1st part, but I don't understand what means "Joins in poll".

Thanks for that confirmation. smile


Localize Mozilla extensions on BabelZilla

Offline

#17 2011-02-28 10:50:20

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

jojaba wrote:

Sorry to say that but, that's nonsense, I mean that this doesn't mean anything (as usual with Web translators wink ).

In the following version I will change for your variant wink

Offline

#18 2011-03-19 10:21:38

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: [MOD] Poll Mod - 1.3.3

when i enable poll mod i can create a topic with a poll but its not visible: the result of the poll or the option to choose an option on viewtopic.php any guess whats wrong ?

Offline

#19 2011-03-19 11:03:44

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

link to your forum?

Offline

#20 2011-03-19 11:11:25

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: [MOD] Poll Mod - 1.3.3

Offline

#21 2011-03-19 11:58:23

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

All has made it?

#
#---------[ 33. OPEN ]--------------------------------------------------------
#

viewtopic.php

#
#---------[ 34. FIND ]--------------------------------------------------------
#

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

#
#---------[ 35. REPLACE WITH ]------------------------------------------------
#

require PUN_ROOT.'include/poll.php';

if (poll_post('poll_submit') != null)
{
    poll_vote($id, $pun_user['id']);

    header('Location: viewtopic.php?id='.$id.((isset($_GET['p']) && $_GET['p'] > 1) ? '&p='.intval($_GET['p']) : ''));
    exit;
}

// Fetch some info about the topic
if (!$pun_user['is_guest'])
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, t.poll_type, t.poll_time, t.poll_term, t.poll_kol, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, s.user_id AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'topic_subscriptions AS s ON (t.id=s.topic_id AND s.user_id='.$pun_user['id'].') LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());
else
    $result = $db->query('SELECT t.subject, t.closed, t.num_replies, t.sticky, t.first_post_id, t.poll_type, t.poll_time, t.poll_term, t.poll_kol, f.id AS forum_id, f.forum_name, f.moderators, fp.post_replies, 0 AS is_subscribed FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id='.$pun_user['g_id'].') WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.id='.$id.' AND t.moved_to IS NULL') or error('Unable to fetch topic info', __FILE__, __LINE__, $db->error());

#
#---------[ 36. FIND ]--------------------------------------------------------
#

                        <?php echo $cur_post['message']."\n" ?>

#
#---------[ 37. AFTER, ADD ]--------------------------------------------------
#

<?php if ($cur_post['id'] == $cur_topic['first_post_id']) poll_display_topic($id, $pun_user['id'], $p); ?>

#
#---------[ 38. SAVE ]--------------------------------------------------------
#

viewtopic.php

#
#---------[ 39. OPEN ]--------------------------------------------------------
#

Offline

#22 2011-03-19 12:06:18

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

in poll.php for test

// результат голосования в теме ************************************************
function poll_display_topic($tid, $uid, $p = 0)
{
    global $pun_config;

    if ($pun_config['o_poll_enabled'] != '1') return;

    $top = poll_topic($tid);
    if ($top[0] == 0) return;
        
    $top[4] = $p;
    $info = poll_info($tid, $uid);
    poll_display($tid, $uid, $info, $top);
}

// отображаем результат голосования ********************************************
function poll_display($tid, $uid, $info, $top)
{

    global $db, $lang_poll, $pun_config, $lang_common;

    if (is_null($info)) return;

->

// результат голосования в теме ************************************************
function poll_display_topic($tid, $uid, $p = 0)
{
    global $pun_config;

    if ($pun_config['o_poll_enabled'] != '1') echo 'Poll disabled';

    $top = poll_topic($tid);
    if ($top[0] == 0) echo 'No poll';
        
    $top[4] = $p;
    $info = poll_info($tid, $uid);
    poll_display($tid, $uid, $info, $top);
}

// отображаем результат голосования ********************************************
function poll_display($tid, $uid, $info, $top)
{

    global $db, $lang_poll, $pun_config, $lang_common;

    if (is_null($info)) echo 'No data';
echo 'INFO='.var_export($info, true);

Offline

#23 2011-03-19 12:18:38

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: [MOD] Poll Mod - 1.3.3

when i edit the post i dont see that ive made a poll before its not saving that i made poll

Offline

#24 2011-03-19 12:25:20

jejeje
Member
Registered: 2011-03-18
Posts: 288
Website

Re: [MOD] Poll Mod - 1.3.3

ok now its saving my option but not showing the poll

Offline

#25 2011-03-19 12:41:49

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,383
Website

Re: [MOD] Poll Mod - 1.3.3

The test information in the first message isn't printed - Function poll_display_topic means isn't caused from a file viewtopic.php.

See log of errors.

Last edited by Visman (2011-03-19 12:42:36)

Offline

Board footer

Powered by FluxBB