Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to include QR Code when printing vote keys #37

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open

Add ability to include QR Code when printing vote keys #37

wants to merge 6 commits into from

Conversation

tditlu
Copy link
Contributor

@tditlu tditlu commented Mar 3, 2019

Only minor changes made to the core, everything else in a plugin

@Gargaj
Copy link
Owner

Gargaj commented Mar 6, 2019

I'll check this out over the weekend.

@Gargaj
Copy link
Owner

Gargaj commented Mar 9, 2019

Okay I checked this out; takes ages to generate the votekey page (I'm running it on a Raspberry Pi) and I think it's because it's all tables? Wouldn't it be easier to have an qrcodevotekeys/image.php?url=... that just serves up the images? Or at least have an option for it?

Another thing is that I think we had a misunderstanding; I meant that the QR should be a substitution token like {%VOTEKEY%} on www_admin/votekeys.php so that people can arrange them any way they want and add text around it.

(If you don't wanna deal with these that's fine by me, I can go and do these adjustments myself.)

@tditlu
Copy link
Contributor Author

tditlu commented Mar 10, 2019

Can do the table to image option, but the votekey-thingey you have to elaborate some more... ;)

?>
<span class="qrcode">
<?php echo qrcodevotekeys_generate_html($votekey); ?>
<?php echo qrcodevotekeys_generate_html($args['votekey']); ?>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hook is sending votekey in an args array

@tditlu
Copy link
Contributor Author

tditlu commented Mar 10, 2019

I have added ability to change how the QR code is generated, I also found a bug, see above

@Gargaj
Copy link
Owner

Gargaj commented Mar 10, 2019

Can do the table to image option, but the votekey-thingey you have to elaborate some more... ;)

Yeah, what I meant was rather than having the votekeys_print_votekey_* hooks print directly, they should offer the user new {%...%} tokens so that they can format the votekey+QR any way they want.

Basically something like:

  print("<li>");
  $html = str_replace("{%VOTEKEY%}", $t->votekey, $format);
  run_hook("votekeys_print_votekey_after", array("html" => &$html)); // this code can do even more replacements
  echo $html;
  print("</li>");

... and then add a hook to the admin to notify the user of more {%...%} tokens. That way the user can shuffle the {%VOTEKEY%} and e.g. {%QRIMG%} tags around, add custom text, custom markup, formatting, and so on.

Does that make sense?

@tditlu
Copy link
Contributor Author

tditlu commented Mar 11, 2019

Yes, now i understand, but if a user then has set the votekey format (votekeys_format) in settings to something like <h1>{%VOTEKEY%}</h1>, then the string sent into the QR Code genarator would include HTML, or?

@tditlu
Copy link
Contributor Author

tditlu commented Mar 11, 2019

Yes, now I understand, but if a user then has set the votekey format (votekeys_format) in settings to something like <h1>{%VOTEKEY%}</h1>, then the string sent into the QR Code genarator would include HTML, or?

Or do you mean that you have to add {%QRIMG%} to votekeys_format to get the plugin to work?

@Gargaj
Copy link
Owner

Gargaj commented Mar 12, 2019

The latter; meaning that if the user wants their QR code on the votekey, they can change it to something like {%QRIMG%}<br/>{%VOTEKEY%}, or switch the two if they want the key above the votekey, or completely remove the votekey, etc etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants