.. -*- coding: utf-8 -*-
.. :Project:   SoL
.. :Created:   mer 25 dic 2013 12:22:28 CET
.. :Author:    Lele Gaifax <lele@metapensiero.it>
.. :License:   GNU General Public License version 3 or later
.. :Copyright: © 2013, 2014, 2016, 2026 Lele Gaifax
..

Other windows
=============

.. _countdown:

.. figure:: countdown.png

   The countdown window.

Countdown
---------

This page shows a simple *countdown* widget that at determined states emits different *alarms*
(using SoundManager_): it's driven by the values :guilabel:`duration` and :guilabel:`prealarm`
of :ref:`tourney <tourneys management>`.

The countdown may be started (or restarted again) with the first button; alternatively you can
use the second button that will start the countdown after 15 seconds, so you can reach your own
table in time.

Close the countdown window or click on the third button when done: to prevent accidental
close, it asks for an explicit confirmation.

.. hint:: Given that the start time is sent back to ``SoL`` and stored in the database, should the
          computer be restarted for any reason, the countdown will be restored from the same
          instant.

          This allows also to open multiple instances of the countdown, possibly from different
          computers, for example when you would like to show the same countdown in a different
          room. Of course in this case the countdown must be started on one single host, while
          on the others it will sufficient to show the new one **after** the countdown has been
          started.

.. _soundmanager: http://schillmania.com/projects/soundmanager2/

.. _dashboard:

.. figure:: dashboard.png

   The live dashboard.

Dashboard
---------

This page is meant to be shown on a big screen at the venue, for example on a projector or on a
TV in the corridor: it shows the *countdown* of the current round, the boards being played with
their scores, updated as soon as they are entered (also with the *digital* scorecards, while
being played), and the ranking. When the finals are being played it shows the games of
each of them, and once the tourney is over its final results.

It is opened with the :guilabel:`Dashboard` action of the :ref:`tourneys management <tourneys
other actions>`, or from the :guilabel:`Dashboard` window in the :ref:`matches panel <matches
panel>`, and it does not require any login, so it can be shown on any computer.

Its contents are driven by the tourney: the countdown by its :guilabel:`duration` and
:guilabel:`prealarm`, the “*Round 3 / 8*” in the header by its :guilabel:`max rounds` (when not
set, the number of rounds is known only for *knockout* and *round-robin* tourneys), and the
estimated start of the next round by its :guilabel:`break duration`. The *message to the
players*, shown below the header, and an explicit start time for the next round are set in the
:guilabel:`Dashboard` window of the :ref:`matches panel <matches panel>`.

A QR code leading to the ``Lit`` page of the tourney is shown in the bottom right corner during
the first two rounds: click on it to hide it.

Clicking on the logo in the top left corner, or pressing the :kbd:`Space` key, opens the
*settings* of the screen, that affect only the screen itself and are remembered by the
browser: the zoom, the number of columns, the QR code and which club emblem shows in the
header. The same can be done with some keys:

:kbd:`+` and :kbd:`-`
  Zoom in and out, :kbd:`0` resets the zoom.

:kbd:`[` and :kbd:`]`
  Decrease and increase the number of columns used for the boards and the players,
  :kbd:`\\` resets it to automatic.

:kbd:`Esc`
  Closes the settings.

The zoom can also be adjusted with the buttons that appear in the middle of the bottom bar when
the mouse is over it: clicking on the percentage resets it.

A few more options can be given in the address of the page, for example
``…/dashboard?qr=0&poll=5``:

``qr``
  ``1`` always shows the QR code, ``0`` never shows it.

``poll``
  How often the page checks for changes, in seconds: by default every 10 seconds, at least
  every 5.

``logo``
  The address of an image shown in the header in place of the club emblem, for example the
  logo of the association organizing the event.

.. hint:: Everything shown comes from the database and the page checks for changes every few
          seconds, so it is possible to open the dashboard on several screens, possibly in
          different rooms, all showing the same thing: should a screen be restarted for any
          reason, just open the page again.

.. _upload:

.. figure:: upload.png
   :figclass: float-right

   The upload window.

Upload
------

This very simple window allows the upload of whole tourneys data, as exported by another
instance of ``SoL``. The new data won't clobber existing information though, only missing fields
will be updated of any existing entity.

Anybody can upload ``.sol`` (or ``.sol.gz``, the compressed version) archives. All
authenticated users but `guest` can upload ``.zip`` files with tourneys data, players emblems
and clubs portraits.

.. topic:: Exporting data

   Tourneys data can be exported with the :guilabel:`download` button on :ref:`tourneys
   <tourneys management>` and :ref:`championships <championships management>` windows: they are
   (possibly compressed) simple text files, in YAML__ format, which may be reloaded on another
   ``SoL`` instance or archived for security purposes. The archive created in this way contains all
   the specified tourneys as well as the data pertaining to all involved players, clubs and
   championships. It does **not** contain neither the emblems nor the portraits pictures.

   There is another way to export the whole database, that is *all* tourneys and *all* players
   (also those who never played) **and all** the referenced images. By visiting the URL::

     http://localhost:6996/bio/backup

   ``SoL`` will give you a ``ZIP`` archive containing all the above, that can be uploaded into
   another instance of ``SoL``, effectively copying/updating almost all the information and related
   images stored on the source. This is clearly a much bigger archive that the one created with
   the method above, and should be used only migrating the whole database to a newer version of
   ``SoL``, or when you want copy all the images at once.

__ http://www.yaml.org/
