Volební kalkulačka
- Vue.js
- /vue/ - project
- /www/cs/ - web
- každá kalkulačka je samostatný adresář ("subprojekt")
- API a ukládání hlasování stále používá starší (php) verzi
- PHP
- /www/ - web i project
- každá kalkulačka je samostatný adresář ("subprojekt")
- PHP >=5.3
- Smarty 3
- Python 3 (optional, for updating only)
execallowed for PHP (optional, for updating only)
- copy
local_settings-example.jsonintolocal_settings.jsonand set it correctly, this file needs to be readable by www server - set
smarty/templates_cwritable and readable by www server - create new file
www/result.txtand set it writable by www server (e.g., chown user:www-data, chmod 620)
- make directory
www/new-appand copy into it contents fromwww/existing-app - make directory
smarty/templates/new-app-templatesand copy into it contents fromsmarty/templates/existing-app-templates
- set up frontpage (
www/index.phporwww/index.htmlmanually)
- basic settings for the new-app are in
www/new-app/settings.json, correct them - it is possible to rewrite general settings (from
www/local_settings.json) for whole site by these settings
- default background image for the new app is set in
www/new-app/settings.json
Several languages are supported (using parameter ?lang=xx in the address, xx is the ISO code). These needs to be set up in www/new-app/settings.json and the files www/new-app/texts_xx.csv must exist.
Updating process may be different for any calculator
- set
www/new-app/backend/writable by www server - set correct values in
www/new-app/backend/settings.jsonUpdate is done by accessinghttp(s)://(server_name)/new-app/backend/update.php
(TODO)
A questionaire may be set to be shown before the app:
- direct traffic to
(server)/new-app/research/(or some part of the traffic) - set data and texts in
www/new-app/research/data.php - create file
www/new-app/research/research.txtand set it writable by www server (e.g., chown user:www-data) - only subset of question type may be used (see files
smarty/templates/research.tplandsmarty/templates/research-(type).tpl) - enable caching:
Completely custom part (block) may be specified below the results in the file smarty/new-app-template/match-lower.tpl. Leave it blank if nothing is required.
Custom CSS may be set in www/new-app/settings.json
It s possible to customize the calculator (if allowed in www/new-app/settings.json), quickly or with whole custom css:
bg: url-encoded link to background picture (e.g.,http(s)://(server_name)/new-app/?bg=http%3A%2F%2Fexample.com%2Fpicture.jpg)navbar: url-encoded html color of the upper navbar (e.g.,http(s)://(server_name)/new-app/?navbar=%23CC00FFor?navbar=red)css: url-encoded link to custom css (e.g.,http(s)://(server_name)/new-app/?css=http%3A%2F%2Fexample.com%2Fcustom.css)
Caching for the app (the test part, not results) is available. Enable (or disable) it:
- nncomment line
include ("cache.php");inwww/new-app/index.php - set
www/new-app/cache/writable and readable by www server (e.g.,sudo chown user:www-data cache) - length of cache may be set in
www/new-app/cache.php
- set it in
www/new-app/settings.json - create new file
www/new-app/click.txtand set it writable by www server (e.g., chown user:www-data, chmod 620)