changeset 39:d2c45f4ba57e

add downloads.html
author souliane <souliane@mailoo.org>
date Tue, 27 Jan 2015 18:23:39 +0100
parents e501f5ff7191
children dfe7139dae0a
files README sat_website/local_settings.py sat_website/utils.py sat_website/views.py templates/sat_website/downloads.html
diffstat 5 files changed, 136 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/README	Tue Jan 27 12:17:09 2015 +0100
+++ b/README	Tue Jan 27 18:23:39 2015 +0100
@@ -35,31 +35,30 @@
 
 The following values can be set in site's settings.py:
 
-    # this link should point to a SàT archive in the form sat-version.tar.bz2
-    SAT_LINK_PATH = '/path/to/sat_link.tar.bz2'
+    # External URL pointing the projects archives directory
+    PROJECTS_EXTERNAL_PATH = 'ftp://ftp.goffi.org'
+
+    # Internal path to the projects archives directory
+    PROJECTS_INTERNAL_PATH = '/var/www/projects'
 
-    # this prefix will be joined to the filename pointed by the previous link
-    SAT_DL_PREFIX = 'ftp://ftp.goffi.org/sat'
+    # List of couples with the project directory name and the project name (set to None if it's the same)
+    PROJECTS_NAMES = [('sat', None), ('sat_media', None), ('urwid-satext', 'urwid_satext'), ('sat_pubsub', None), ('libervia', None)]
 
-    # if set, this link will be used instead of the joined dl_prefix + filename
-    SAT_DL_PATH = 'ftp://ftp.goffi.org/sat/sat.tar.bz2'
+    # Extension used to name the project archives
+    ARCHIVE_SUFFIX = '.tar.bz2'
 
     # URL to Libervia online demo
     LIBERVIA_DEMO_URL = 'https://www.libervia.org'
 
-    # Actual number of members
+    # Actual and target number of members
     ASSO_MEMBERS_ACTUAL = 3400
-
-    # Target number of members
     ASSO_MEMBERS_TARGET = 6000
 
-    # Available amount to finance the association (in euros)
+    # Actual and target amount to finance the association (in euros)
     ASSO_FINANCE_ACTUAL = 40000
-
-    # Target amount to finance the association (in euros)
     ASSO_FINANCE_TARGET = 60000
 
-    # Subscription amounts defined in the Rules of Procedure
+    # Subscription amounts as defined in the Rules of Procedure
     ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
 
 
--- a/sat_website/local_settings.py	Tue Jan 27 12:17:09 2015 +0100
+++ b/sat_website/local_settings.py	Tue Jan 27 18:23:39 2015 +0100
@@ -97,13 +97,28 @@
 
 # Options for SàT website (see README)
 
-SAT_LINK_PATH = '/srv/ftp/sat/sat.tar.bz2'
-SAT_DL_PREFIX = 'ftp://ftp.goffi.org/sat'
-#SAT_DL_PATH = 'ftp://ftp.goffi.org/sat/sat.tar.bz2'
+# External URL pointing the projects archives directory
+PROJECTS_EXTERNAL_PATH = 'ftp://ftp.goffi.org'
+
+# Internal path to the the projects archives directory
+PROJECTS_INTERNAL_PATH = '/var/www/projects'
+
+# List of couples with the project directory name and the project name (set to None if it's the same)
+PROJECTS_NAMES = [('sat', None), ('sat_media', None), ('urwid-satext', 'urwid_satext'), ('sat_pubsub', None), ('libervia', None)]
+
+# Extension used to name the project archives
+ARCHIVE_SUFFIX = '.tar.bz2'
+
+# URL to Libervia online demo
 LIBERVIA_DEMO_URL = 'https://www.libervia.org'
 
+# Actual and target number of members
 ASSO_MEMBERS_ACTUAL = 3400
 ASSO_MEMBERS_TARGET = 6000
-ASSO_FINANCE_ACTUAL = 34000
+
+# Actual and target amount to finance the association (in euros)
+ASSO_FINANCE_ACTUAL = 40000
 ASSO_FINANCE_TARGET = 60000
+
+# Subscription amounts as defined in the Rules of Procedure
 ASSO_SUBSCR_AMOUNTS = (0, 10, 20, 30, 50, 80, 100)
--- a/sat_website/utils.py	Tue Jan 27 12:17:09 2015 +0100
+++ b/sat_website/utils.py	Tue Jan 27 18:23:39 2015 +0100
@@ -20,24 +20,33 @@
 along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
 """
 
-from os.path import basename,realpath,join
+from os.path import basename, realpath, join
 from django.conf import settings
+from collections import OrderedDict
+
+
+def get_projects_infos(infos):
+    """Return a dict binding project names to a tuple containing:
+        - the external download path
+        - the version number
+        - a short description about the project archive
+        
+    @param infos: dict binding project names to a short description
 
-def get_latest_sat():
-    """Return a tuple with download path of latest SàT version, and version number"""
-    try:
-        path = settings.SAT_LINK_PATH
-        real_path = realpath(path)
-        filename = basename(real_path)
-        version = filename[4:-8] #filename must be in the form of sat-version.tar.bz2
-        if hasattr(settings, "SAT_DL_PATH"):
-            dl_path = settings.SAT_DL_PATH
-        else:
-            dl_path = join(settings.SAT_DL_PREFIX, filename)
-    except AttributeError:
-        return (None, None)
-    
-    return (dl_path, version)
+    @return: dict {unicode: (unicode, unicode, unicode)
+    """
+    result = OrderedDict()
+    for dir, name in settings.PROJECTS_NAMES:
+        if not name:
+            name = dir
+        path = join(dir, name) + settings.ARCHIVE_SUFFIX  # e.g urwid-satext/urwid_satext.tar.bz2
+        int_path = join(settings.PROJECTS_INTERNAL_PATH, path)  # this is a symbolic link
+        # base name of the real path MUST look like: <project>-<version><ARCHIVE_SUFFIX>
+        version = basename(realpath(int_path))[len(name) + 1:-len(settings.ARCHIVE_SUFFIX)]
+        ext_path = join(settings.PROJECTS_EXTERNAL_PATH, path)
+        result[name] = (ext_path, version, infos[name] if name in infos else '')
+
+    return result
 
 def get_libervia_demo_url():
     """Return the URL to Libervia online demo"""
--- a/sat_website/views.py	Tue Jan 27 12:17:09 2015 +0100
+++ b/sat_website/views.py	Tue Jan 27 18:23:39 2015 +0100
@@ -53,6 +53,12 @@
 
 CATEGORIES_HIDDEN = ('adhesion_form', 'thank_you')
 
+PROJECTS_INFOS = {'sat': _(u'contains the backend, Primitivus and Jp'),
+                  'sat_media': _(u'Images and other media needed to launch SàT'),
+                  'urwid_satext': _(u'console display library needed by Primitivus'),
+                  'sat_pubsub': _(u'PubSub server component needed for SàT experimental blogging features'),
+                  'libervia': _(u'Libervia frontend (web server and client)'),
+                  }
 
 def overview(request):
     return render_to_response('sat_website/overview.html')
@@ -79,9 +85,7 @@
     elif category == "social_contract":
         context["SOCIAL_CONTRACT"] = social_contract.get_social_contract()
     elif category == "downloads":
-        latest_dl_path, latest_version = utils.get_latest_sat()
-        context["latest_dl_path"] = latest_dl_path
-        context["latest_version"] = latest_version
+        context["projects_infos"] = utils.get_projects_infos(PROJECTS_INFOS)
     elif category == "adhesion":
         context.update(utils.get_asso_finance_status())
     elif category == "adhesion_form":
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/templates/sat_website/downloads.html	Tue Jan 27 18:23:39 2015 +0100
@@ -0,0 +1,73 @@
+{% extends "sat_website/category.html" %}
+
+{% comment %}
+SàT website: Salut à Toi's presentation website
+Copyright (C) 2012  Jérôme Poisson (goffi@goffi.org)
+
+This file is part of SàT website.
+
+SàT website is free software: you can redistribute it and/or modify
+it under the terms of the GNU Affero General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+Foobar is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+GNU Affero General Public License for more details.
+
+You should have received a copy of the GNU Affero General Public License
+along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+{% endcomment %}
+
+{% load i18n %}
+{% load staticfiles %}
+{% load utils %}
+
+{% block headline %}{% trans "Downloads" %}{% endblock %}
+{% block subtext %}{% trans "The archives containing the source code" %}{% endblock %}
+{% block main_container %}
+
+<div class="row">
+    <h5 class="alert alert-info">
+        {% trans "Information" %}
+    </h5>
+    <div class="info">
+        <p>{% trans "This page allows you to download SàT and its related projects source code. There is not (yet) an  installer to double click to make it work out of the box." %}</p>
+        <p>{% trans "We are thinking about a way to allow everybody to easily install SàT at home, but for now it will seem difficult to the persons who are not familiar with GNU/Linux operating systems. For the Windows and MacOS users, the best way to test SàT for now is to visit our demonstration website running Libervia." %}</p>
+        <p><a class="btn btn-default" target="#" href="{{ libervia_demo_url }}" role="button">{% trans "Libervia demo" %}</a></p>
+    </div>
+</div>
+<div class="row">
+	<h5 class="alert alert-success">
+	    {% trans "Latest development versions" %}
+	</h5>
+    <div class="info row">
+		{% for project, infos in projects_infos.items %}
+	        <div class='col-md-6'>
+	            <a href="{{ infos.0 }}">{% blocktrans with project=project version=infos.1 %}Download {{ project }} {{ version }}{% endblocktrans %}</a>
+	        </div>
+	        <div class='col-md-6'>
+	            {{ infos.2 }}
+	        </div>
+		{% endfor %}
+    </div>
+    <div class="info">
+        <p>{% trans "When not trivial (e.g. sat_media just needs to be extracted somewhere), the installation procedure is described in the INSTALL file that you will find in the package." %}</p>
+    </div>
+</div>
+<div class="row">
+    <h5 class="alert alert-success">
+        {% trans "Other sources of installation" %}
+    </h5>
+    <div class="info">
+        <p>{% trans "To ease the procedure, you can also install the last SàT packages from PyPI, the Python Package Index." %}</p>
+        <p><a class="btn btn-default" target="#" href="https://pypi.python.org/pypi/sat" role="button">{% trans "Visit PyPI" %}</a></p>
+        <p>{% trans "Thanks to the maintainers of SàT packages, you might even find some really easy to install packages in your distribution repositories!" %}</p>
+        <p><a class="btn btn-default" target="#" href="https://packages.debian.org/source/sid/salutatoi" role="button">{% trans "Packages in Debian sid" %}</a></p>
+        <p>{% trans "Some complementary information are given on the wiki." %}</p>
+		<p><a class="btn btn-default" target="#" href="http://wiki.goffi.org/wiki/Salut_%C3%A0_Toi/en#Latest_release" role="button">{% trans "Visit the wiki" %}</a></p>
+        </p>
+    </div>
+</div>
+{% endblock %}