# HG changeset patch # User Paul Boddie # Date 1204478560 -3600 # Node ID b74505d8ed1930f6047826a36d473a4c69112897 # Parent dfc1fd6a3298cfc301e1c7901ed1a3acb243abd9 Removed the VotingStars macro. Added logo suggestions as static images. diff -r dfc1fd6a3298 -r b74505d8ed19 macros/VotingStars.py --- a/macros/VotingStars.py Sun Mar 02 03:08:36 2008 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,144 +0,0 @@ -#format python -# -*- coding: iso-8859-1 -*- -''' - MoinMoin - VotingStars Macro - Author: Travis Bailey - Date: February 2006 - - Purpose: - This macro allows ratings of items using stars (based on Vote macro) - Usage: - [[VotingStars(UniqueName)]] - e.g. 1. NiceShop [[VotingStars(shop1)]] - 1. EvenNicerShop [[VotingStars(shop2)]] - Tested: - Firefox 1.5 MoinMoin 1.5.1 Python 2.3 - - I basically just slapped this together from the Vote1_3.py script and the - RatingStars.py script. I wanted to get the benefits of both. I wanted a - Utility to only allow Registered users to submit, allow them to change - their vote, and to average the results. - - So basically it uses the Vote1_3.py code to track one vote per user. - It averages the total stars given and then displays the number of average - number of rated stars. - - You can have multiple VotingStars on one page (so long as the UniqueNames are unique) - Changing the UniqueName creates a new vote. - Make sure not to conflict with any Vote names you are using - - VotingStars data is stored in data_dir/pages/pagename/votes - (i.e. alongside the attachments directory for a page). -''' -import os, pickle -from MoinMoin import wikiutil -from MoinMoin.util import filesys - -def makeFilename(thisPage, voteName): - votesDir = thisPage.getPagePath("votes") - if not os.path.exists(votesDir): - filesys.makeDirs(votesDir) - voteName = wikiutil.quoteWikinameFS(voteName) + '.pik' - return os.path.join(votesDir, voteName) - -def loadVotes(thisPage, voteName): - votesFile = makeFilename(thisPage, voteName) - try: - f = open(votesFile, 'r') - return pickle.load(f) - except: # XXX - return {} - -def saveVotes(thisPage, voteName, votes): - votesFile = makeFilename(thisPage, voteName) - f = open(votesFile, 'w') - pickle.dump(votes, f) - -def countVotes(votes): - results = {} - for v in votes.values(): - results.setdefault(v, 0) - results[v] += 1 - return results - -def execute(macro, args): - fmt = macro.formatter - - args = args.split(",") - args = map(unicode.strip, args) - - if len(args) < 1: - return fmt.rawHTML('
[[Vote: Insufficient macro arguments]]
') - - pageName = args[0] - voteName = pageName - candidates = ['1','2','3','4','5'] - src_litstar = '/wiki/modern/img/star_on.png' - src_unlitstar = '/wiki/modern/img/star_off.png' - - form = macro.form - request = macro.request - if request.user.valid: - voter = request.user.name - else: - voter = '' - thisPage = fmt.page - votes = loadVotes(thisPage, voteName) - - # votes are stored in a dictionary as {user: candidate} to avoid duplicate votes - # (a voter could switch their vote but this UI doesn't expose that facility) - if form.has_key('vote') and form.has_key('voteName') and voter: - if form['voteName'][0] == voteName: - votes[voter] = form['vote'][0] - try: - saveVotes(thisPage, voteName, votes) - except: # XXX - return fmt.rawHTML('
[[Vote: failed to store vote]]
') - - # generate dictionary {candidate: numvotes} - results = countVotes(votes) - onestar = results.setdefault(candidates[0],0) - twostar = results.setdefault(candidates[1],0) - threestar = results.setdefault(candidates[2],0) - fourstar = results.setdefault(candidates[3],0) - fivestar = results.setdefault(candidates[4],0) - counts = (onestar+twostar+threestar+fourstar+fivestar) - - if counts == 0: - average = 0 - else: - average = (onestar*1+twostar*2+threestar*3+fourstar*4+fivestar*5)/counts - - hasVoted = voter in votes - - # spit out votes table (as part of a form if the user hasn't voted yet) - html = [] - - if voter: - html.append(''' -
\n - \n - - ''' % { - 'formname': voteName, - 'url': thisPage.url(request), - 'voteName': voteName, - } - ) - btnstar = '\n' - for i in range(1,6): - if i <= average: - html.append(btnstar % {'isrc':src_litstar, 'form':voteName, 'value': i}) - if i > average: - html.append(btnstar % {'isrc':src_unlitstar, 'form':voteName, 'value': i}) - if average == 0: - html.append(' No Rating') - #else: - # html.append(' %(avg)s ' % { 'avg': average }) - html.append('
') - else: - html.append('Please log in to vote.') - - return fmt.rawHTML(''.join(html)) - -# vim: tabstop=4 expandtab shiftwidth=4 diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008-104x80.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008-104x80.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008-fullsize.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008-fullsize.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008-v1.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008-v1.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008-v2.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008-v2.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008-v3.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008-v3.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/EuroPython-Logo-2008.png Binary file themes/ep2008/img/logo/EuroPython-Logo-2008.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/epc_regebro_1.png Binary file themes/ep2008/img/logo/epc_regebro_1.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/epc_regebro_1_thumb.png Binary file themes/ep2008/img/logo/epc_regebro_1_thumb.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/epc_regebro_2.png Binary file themes/ep2008/img/logo/epc_regebro_2.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/epc_regebro_2_thumb.png Binary file themes/ep2008/img/logo/epc_regebro_2_thumb.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/europython-112x80.png Binary file themes/ep2008/img/logo/europython-112x80.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/europython.png Binary file themes/ep2008/img/logo/europython.png has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_01-80x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_01-80x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_01.jpg Binary file themes/ep2008/img/logo/logoEPC2008_01.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_02-80x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_02-80x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_02.jpg Binary file themes/ep2008/img/logo/logoEPC2008_02.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_03-80x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_03-80x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_03.jpg Binary file themes/ep2008/img/logo/logoEPC2008_03.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_04-80x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_04-80x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_04.jpg Binary file themes/ep2008/img/logo/logoEPC2008_04.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_11-70x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_11-70x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_11.jpg Binary file themes/ep2008/img/logo/logoEPC2008_11.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_12-70x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_12-70x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_12.jpg Binary file themes/ep2008/img/logo/logoEPC2008_12.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_13-70x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_13-70x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_13.jpg Binary file themes/ep2008/img/logo/logoEPC2008_13.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_14-70x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_14-70x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_14.jpg Binary file themes/ep2008/img/logo/logoEPC2008_14.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_15-70x80.jpg Binary file themes/ep2008/img/logo/logoEPC2008_15-70x80.jpg has changed diff -r dfc1fd6a3298 -r b74505d8ed19 themes/ep2008/img/logo/logoEPC2008_15.jpg Binary file themes/ep2008/img/logo/logoEPC2008_15.jpg has changed