Gargaj / wuhu

Lightweight Party Management System
http://wuhu.function.hu/
Other
41 stars 26 forks source link

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

Open tditlu opened 5 years ago

tditlu commented 5 years ago

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

Gargaj commented 5 years ago

I'll check this out over the weekend.

Gargaj commented 5 years ago

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 commented 5 years ago

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

tditlu commented 5 years ago

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

Gargaj commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.