Hi Toni,
I have no problem in sharing the code, as long as you promise to bear with me about the code quality!
I'm also sending it to the list, as it may be of interest for other countries.
There are some requirements, though. You'll need a local copy of the database, which you can get using the MonumentsAPI 'dump' module.
Hopefully, these are the steps you need:
0. Download the code from here:
http://www.wikilovesmonuments.org.pt/tools/juri-demo/tools/juri/juri-demo.zi...
1. review header.inc/header.php and footer.inc/footer.php as it is fit to our layout;
2. Create a database where you should create the structure you'll find inside the ZIP (MySQL sql file): juri-tables.sql
3. review DB configuration at tools/plist/myconfig.php to point to your DB.
4. Load the images into the table 'statisticsct2': you can use the script in tools/stats to fetch them from the MonumentsAPI (set the country to Andorra only to be faster, and run it multiple times until you get a single dot - that should be the last image to fetch)
5. Create juris like this (for each juri): INSERT INTO juri VALUES('Your Juri Name', UUID(), NULL);
You will use the generated UUID() as a token to access the juri profile, as in: http://yourdomain/tools/juri/?level=1&token= (followed by the UUID)
To get them: SELECT * FROM juri;
6. When you have all your juri loaded, run 'php -f _sorteio.php' (tools/juri) which will random sort the images for each one (and put a reference for it at 'juri_selection'). Don't forget to change "Portugal" to "Andorra" in the code.
And - hopefully - that'll be it. "_sorteio.php" puts images in "bucket 1", the juri will demote the image to "bucket 0" if not interested, and promote to "bucket 2" if it's interesting.
If you want the simplify the URL for the juri, such as http://juri.wikilovesmonuments.org.pt/TOKEN here's what your Apache should be doing:
RewriteCond %{HTTP_HOST} ^juri.wikilovesmonuments.org.pt [NC] RewriteRule ^/(.*) http://yourdomain/tools/juri/?level=1&token=$1 [R,L]
PS: I've setup a demo at: http://www.wikilovesmonuments.org.pt/tools/juri-demo/tools/juri/
(nice photos by the way, congratulations!)
But the thumbnailing server at Commons seemed to be facing problems, I hope this enough to set it up.
Ermmm, the demo doesn't make sense without the tokens. Here:
+------------------+--------------------------------------+----+ | nome | token | id | +------------------+--------------------------------------+----+ | Your Juri Name | a47c93a8-f05c-11e0-a298-003048f0198a | 9 | | Your Juri Name 2 | fe8f16b6-f05e-11e0-a298-003048f0198a | 10 | +------------------+--------------------------------------+----+
Nuno Tavares wrote:
Ermmm, the demo doesn't make sense without the tokens. Here:
+------------------+--------------------------------------+----+ | nome | token | id | +------------------+--------------------------------------+----+ | Your Juri Name | a47c93a8-f05c-11e0-a298-003048f0198a | 9 | | Your Juri Name 2 | fe8f16b6-f05e-11e0-a298-003048f0198a | 10 | +------------------+--------------------------------------+----+
So you access with
http://www.wikilovesmonuments.org.pt/tools/juri-demo/tools/juri/?token=a47c9... or
http://www.wikilovesmonuments.org.pt/tools/juri-demo/tools/juri/?token=fe8f1...
I don't think i would have come with that concept, but I think i'll reuse it. I'll probably change the AJAX method from GET to POST, though. Maybe the usernames shouldn't be shown in the gallery? That way the juries would concentrate on the images themselves.
Platonides, I never know when you're sending a compliment or just making fun of my code :-))) The usernames were actually a request (I'd prefer them anonymous as well).
You can do whatever you want with the code in your own case. Just remember WLM-PT did it, but only if you're going to speak well about it :P
By the way, in the version in the ZIP you will find image distortion because of width+height constraints. That's because I'm not analysing the images dimensions beforehand. If you want to avoid distortion, just constraint by height, it seems to be the best approach (will break if you get an horizontal panoramic photo, though...)
I've made a small fix, please update (same location).
Nuno Tavares wrote:
Platonides, I never know when you're sending a compliment or just making fun of my code :-))) The usernames were actually a request (I'd prefer them anonymous as well).
You can do whatever you want with the code in your own case. Just remember WLM-PT did it, but only if you're going to speak well about it :P
Hehe, that would be an attribution-if-talking-well license :-)
Not intended for the jury, but I had made some galleries for the different monuments. Here is the most photographied one: http://toolserver.org/~platonides/wlm/gallery.php?bic=RI-51-0003813 (and as you see, I showed the usernames there)
Um forte abraço
wikilovesmonuments@lists.wikimedia.org