Coder Social home page Coder Social logo

wolfsblvt / advancedpolls Goto Github PK

View Code? Open in Web Editor NEW
11.0 11.0 13.0 308 KB

Advances the core poll system of phpBB with new features like hiding votes till end, showing poll voters, limiting the votes and more.

License: GNU General Public License v2.0

HTML 6.50% PHP 83.83% CSS 0.35% Shell 1.75% JavaScript 7.56%

advancedpolls's People

Contributors

galixte avatar javiexin avatar mauron avatar phpbb-es avatar scrutinizer-auto-fixer avatar tatiana5 avatar wolfsblvt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

advancedpolls's Issues

language/ru/info_acp_advancedpolls.php

'Расширенные опросы', 'AP_SETTINGS_ACP' => 'Настройки', ``` 'AP_TITLE' => 'Расширенные опросы', 'AP_TITLE_EXPLAIN' => 'Расширяет систему опросов PHPBB с новыми функциями, такими как не скрытие голосований до конца опроса, просмотр пользователей, которые проголосовали, ограничение голосования и мн. др.', 'AP_COPYRIGHT' => '© 2015 Wolfsblvt (www.pinkes-forum.de) [Больше расширений Wolfsblvt]', 'AP_SETTINGS' => 'Настройки расширенных опросов', 'AP_ACT_VOTES_HIDE' => 'Включить скрытие голосований', 'AP_ACT_VOTES_HIDE_EXPLAIN' => 'Включает опцию для выбора, чтобы голосования до конца опроса будут скрыты', 'AP_ACT_VOTERS_SHOW' => 'Включить просмотр пользователей, которые проголосовали', 'AP_ACT_VOTERS_SHOW_EXPLAIN' => 'Включает опцию для выбора, чтобы пользователи, которые проголосовали, отображались для каждой опции голосования', 'AP_ACT_VOTERS_LIMIT' => 'Включить ограничение голосования', 'AP_ACT_VOTERS_LIMIT_EXPLAIN' => 'Включает опцию для выбора, чтобы только те пользователи могли голосовать, которые уже ответили в этой теме', 'AP_DEFAULT_VOTES_HIDE' => 'По умолчанию выбрано значение для "Скрытие голосований"', 'AP_DEFAULT_VOTERS_SHOW' => 'По умолчанию выбрано значение для «Просмотр пользователей, которые проголосовали"', 'AP_DEFAULT_VOTERS_LIMIT' => 'По умолчанию выбрано значение для "Ограничение голосования"', ``` ));

Adjust permissions

Permission u_see_voters is global, cannot be set by forum. It should be possible to have this extra granularity. So, we should remove u_see_voters permission, and replace it with local permission f_seevoters, make appropriate checks and changes to code, and register a new event to properly classify this permission as a "Forum/Poll" category permission.

"I don't want to vote" option

For some polls, you don't want to vote, or you even cant.
It is not good that you have to click on "see results" every time then if you want to see the results.

Also there could be problems with things like the Portal extensions where polls are shown where you haven't voted. The will not vanish there.

Scoring polls

Add functionality to allow for polls to attach different votes to several options. For example, give 10 points, to at most 4 options, with at most 4 points per option, out of a total of 15 options...
This will allow "contest" votings.

language/ru/advancedpolls.php

'Расширенные опросы', ``` 'AP_VOTES_HIDDEN' => 'Голосования скрыты', 'AP_POLL_RUN_TILL_APPEND' => ' До этого момента, все голоса будут скрыты', 'AP_VOTERS' => 'Пользователи, которые проголосовали', 'AP_NONE' => 'Отсутствует', 'AP_POLL_CANT_VOTE' => 'Вы не можете голосовать в этом опросе. Причина', 'AP_POLL_REASON_NOT_POSTED' => 'Вы ещё ни одного сообщения не написали в этой теме', 'AP_POLL_VOTES_ARE_VISIBLE' => 'Обратите внимание, если вы проголосуете, ваш голос будет виден', 'AP_POLL_VOTES_HIDE' => 'Скрыть голосования', 'AP_POLL_VOTES_HIDE_EXPLAIN' => 'Если эта опция включена, голосования будут скрыты до тех пор, пока опрос не будет окончен
Эта опция работает только тогда, если в этом голосовании установлена дата окончания опроса', 'AP_POLL_VOTERS_SHOW' => 'Показать список пользователей, которые проголосовали', 'AP_POLL_VOTERS_SHOW_EXPLAIN' => 'Если эта опция включена, пользователи, которые проголосовали, будут отображаться для всех с соответствующими правами в опциях
Обратите внимание, что это остаётся скрытым, если голосования должны быть скрыты', 'AP_POLL_VOTERS_LIMIT' => 'Ограничить голосования', 'AP_POLL_VOTERS_LIMIT_EXPLAIN' => 'Если эта опция включена, только те пользователи смогут голосовать, которые уже ответили в этой теме', ``` ));

None bug

When changing votes on choice where are showed other votes, then string "None" is added after voters. When done multiple times it leads for example to this: "Voters: UshirewNone, None, biosek"

No vote behaviour activation

The "no vote" behaviour is currently not controlled by an ACP switch, there should be a way to disable this new behaviour.

Also, if you hit the "no vote" link, there is no way to vote later, and that might not be the desired situation.

And, if you do vote on a poll, and changes are allowed for that poll, it should be possible to remove the vote completely, not only change to a different value.

Clean up template code (mainly viewtopic)

Simplify the template modifications by utilizing new events in viewtopic poll block (to be proposed):
Remove the use of "overall_header" event when more specific events may be used.
Remove the need for some JS code by asking for new events or template modifications.
Simplify the PHP code to remove generating HTML "hacks" and moving that to (new) template events.

Allow incremental voting

Activates the possibility to vote incrementally, while you have not exhausted your available voting capabilities. Specially relevant with scoring polls.

Add default setting for the phpBB core options

This should be part of this extension.
Most of the times I am using "allow change of vote" in my forum. I want to activate this by default, cause users generally forget that.

So if this extension advances the core system, it should be possible to set the default the core options too.

Checklist of Scrutinizer issues

We will ignore the ACP things for now, I will rework that.
There are some issues in core\advancedpolls.php though:

Scrutinizer Issues - core\advancedpolls.php

  • The parameter $poll is not used and could be removed.
  • The variable $post_data does not exist. Did you forget to declare it?
  • It seems like you are calling the size function count() as part of the test condition (Note: Do "$i = 0, $count = count(....) in the declaration part)
  • Travis Error: Line 91 | ERROR | Whitespace found at end of line (Link)

@javiexin Can you fix those issues in an additional branch? Should be fast to do, and maybe you will learn something there :P

Add some basic tests

I don't know if I want this extension to be fully covered by tests, but a few easy tests would help a lot.

Improper message after poll ended

After a poll has ended, the message "Please note that if you vote, your vote will be visible." should not show up any longer. In fact, the message should only be shown if the user is (still) able to cast a vote (so, if the poll does not allow vote changes and the user has voted, this should not show either, even if the poll has not ended).

Rework ACP module with acpmagic

I am currently in the development of a tool wich will make creation of an ACP module much easier. I will add this to this extension as well. Just to keep that up to date. so advancedpolls_module.php does not need any rework at the current place.

Leftovers after extension removal

After extension is disabled and data removed, the database shows that the table columns inserted by the "migration" schema files are still present. Might be lack of revert code for those. The config variables are deleted properly, without revert code.

Update ajax/js with new functionality

Specifically, updating the AJAX/JS functionality to support reordering after voting if results are to be shown. Not immediate, needs prior work. But this will have to be completed.

Non voters counter

Nullifying the vote by looking at poll results is good, yet wouldn't be possible to show a non voters counter and even their nicknames if the show voters option is enabled?

Relative date for expiring

Hello,
I appreciate the absolute expiring time implemented in Advanced polls, yet I think it would be handy to have it relative instead, by adding a drop-down menu to specify if specified expiration number is 'days' or 'hours'.
Would it be harder to implement it that way?

Anyway, if you don't want (or can't) sort it that way, could you at least make faster to specify an absolute date/time, for example by adding the 'Today' link to autocompile year, month and day with current date and/or use some drop-down menus instead of number fields?

Specify poll end date/time

Currently, the only way to specify the poll duration is by a number of days since posting the poll. This is not too granular, and limits the possibility to specify precisely when a poll ends, such as Midnight on Sunday, or so...
There should be a way to specify the poll end date/time in a more precise way, when publishing the poll.

Inconsistent messages when guest votes exist

If a poll has guest votes, the messages that show with "Show poll voters" may be inconsistent. For example, a poll may have a number of "guest" votes, and no registered voters, then the message will show as "Voters: None" and have a number of votes. Similarly, if you vote on such a poll, the new message will show "Voters: None, user".

Global poll visibility & change configuration options

Suggestion: we could use just one drop-down or radio-button control to specify the poll visibility, and another control to specify vote change possibilities, greatly simplifying the posting options while being much more complete.

Visibility options:

  • Public: results are always shown (new option)
  • Default: results are shown after first vote, or when poll has ended
  • Vote completed: results are shown after last vote, or when poll has ended (new option)
  • Private: results are shown only when poll has ended (same as "hidden" today)

Vote change options:

  • No change: you vote once and only once, nothing can be changed after
  • Incremental voting: you may vote as many times as you want while you have pending votes to send (for polls with multiple options to choose, or scoring polls), but once you send a vote you cannot change it (same as "incremental" today)
  • Change: you may change your vote as many times as you want while the poll is open

Two things that are "kind of" here as well are:

  • No-vote: could be an option to visibility (another level?), or an ACP control to change "vote peeking" into no-vote (as it is now)
  • Remove vote: could be an option to change votes (another level?), or an ACP control to add this to "Change votes"

We could also save in storage, by having a single DB field for each of these, rather than multiple binary fields.

What do you think? I can implement this if it makes sense.

Functionality to let people decide to be excluded from show voters

There may be users, who don't want their vote to be displayed for all others. They should have the chance to exclude their votes.

It needs to be considered to als add an option to deactivate this choice for specific polls, and maybe even a switch in ACP for admin to decide if the voters that don't want their vote to be shown should be fully hidden or listed with names below the votes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.