Interface - wouso.interface module
The interface module should be aware of:
Applications (games) should use interface specific methods of displaying content in the base template/context, controlling sidebar, putting game specific boxes in sidebar, header, footer, or any other zone defined by the interface module.
Each game can register a sidebar box, by overriding the get_sidebar_widget class method. It should use render_string defined in wouso.interface and a template extending sidebar_widget.html.
Searching for users should be done in this module.
Static pages include: Game Story, Manual and Credits. This should be stored externally as plain-text/markdown files and served by a interface view.
Needs design: storage, visibility (menus?) - adding links to pages to site_base footer.
A wall page that displays actions made on the site. For example: “Bob challenged Alice and lost”.
The module should register for events send by different other modules and log the data (in the database) that would be displayed on the wall.
Activity(id, timestamp, user_from_id, user_to_id, message_string, arguments, game_id)
Note: must be called with the _same_ arguments as the original to work
Returns the game name
Returns the game url
Return all game activity, ordered by timestamp, newest first
Return all group activity
Return an user’s activity.
Return all group activity
Callback function for addActivity signal
Sending events from games:
from wouso.interface.activity import signals
# games/quest/models.py
signal_msg = u"%s has finished quest %s" % (self, self.current_quest.title)
signals.addActivity.send(sender=None, user_from=self, user_to=self, \
message=signal_msg, game=QuestGame.get_instance())
# games/qotd/views.py
if qotd.answers[choice].correct:
signal_msg = '%s has given a correct answer to %s'
else:
signal_msg = '%s has given a wrong answer to %s'
signal_msg = signal_msg % (request.user.get_profile(), \
QotdGame.get_instance()._meta.verbose_name)
signals.addActivity.send(sender=None, user_from=request.user.get_profile(), \
user_to=request.user.get_profile(), \
message=signal_msg, game=QotdGame.get_instance())
Returns a list of apps defined inside the wouso.interface module.
Return a list of static pages ordered by position, for rendering in footer
Provide game context render_to_string, used by widget generators
Make all configuration settings available as config_name and also define some game context
Generate header and footer bar contents.
For each registered game, get a widget to be displayed in sidebar @remark This design needs to be analysed. @todo ordering, using config
Returns a ‘sidebar’ list containing html boxes.
Returns activity for main wall, paginated.
First page shown
Perform instant search
Perform regular search by either first or last name
Get one user, based on his/her name
Show the UI template. The rest is Javascript