else:
return "%sbeta%s" % (self.tree, self.latestminor)
+ @property
+ def treestring(self):
+ if not self.beta:
+ return self.tree
+ else:
+ return "%s beta" % self.tree
+
def save(self):
# Make sure only one version at a time can be the current one.
# (there may be some small race conditions here, but the likelyhood
from django.http import HttpResponse, Http404, HttpResponseRedirect
from django.template import TemplateDoesNotExist, loader, Context
from django.contrib.auth.decorators import login_required
+from django.db.models import Q
+from django.conf import settings
from decimal import Decimal
+import os
from pgweb.util.decorators import ssl_required
from pgweb.util.contexts import NavContext
def redirect_root(request, version):
return HttpResponseRedirect("/docs/%s/static/" % version)
+def root(request):
+ versions = Version.objects.filter(Q(supported=True) | Q(beta=True,tree__gt=0)).order_by('-tree')
+ return render_to_response('pages/docs.html', {
+ 'versions': versions,
+ }, NavContext(request, 'docs'))
+
+class _VersionPdfWrapper(Version):
+ """
+ A wrapper around a version that knows to look for PDF files, and
+ return their sizes.
+ """
+ def __init__(self, version):
+ self.__version = version
+ self.a4pdf = self._find_pdf('A4')
+ self.uspdf = self._find_pdf('US')
+ def __getattr__(self, name):
+ return getattr(self.__version, name)
+ def _find_pdf(self, pagetype):
+ try:
+ return os.stat('%s/documentation/pdf/%s/postgresql-%s-%s.pdf' % (settings.STATIC_CHECKOUT, self.__version.tree, self.__version.tree, pagetype)).st_size
+ except:
+ return 0
+
+def manuals(request):
+ # We don't include beta's here. Why?
+ versions = Version.objects.filter(supported=True).order_by('-tree')
+ return render_to_response('pages/docs/manuals.html', {
+ 'versions': [_VersionPdfWrapper(v) for v in versions],
+ }, NavContext(request, 'docs'))
+
+def manualarchive(request):
+ versions = Version.objects.filter(beta=False,tree__gt=0).order_by('-tree')
+ return render_to_response('pages/docs/manuals/archive.html', {
+ 'versions': [_VersionPdfWrapper(v) for v in versions],
+ }, NavContext(request, 'docs'))
+
@ssl_required
@login_required
def commentform(request, itemid, version, filename):
SESSION_COOKIE_DOMAIN="www.postgresql.org" # Don't allow access by other postgresql.org sites
SITE_ROOT="http://www.postgresql.org" # Root of working URLs
FTP_PICKLE="/usr/local/pgweb/ftpsite.pickle" # Location of file with current contents from ftp site
+STATIC_CHECKOUT="/usr/local/pgweb-static" # Location of a checked out pgweb-static project
NOTIFICATION_EMAIL="someone@example.com" # Address to send notifications *to*
NOTIFICATION_FROM="someone@example.com" # Address to send notifications *from*
LISTSERVER_EMAIL="someone@example.com" # Address to majordomo
(r'^applications-v2.xml$', 'downloads.views.applications_v2_xml'),
(r'^download/uploadftp/', 'downloads.views.uploadftp'),
+ (r'^docs/$', 'docs.views.root'),
+ (r'^docs/manuals/$', 'docs.views.manuals'),
+ (r'^docs/manuals/archive/$', 'docs.views.manualarchive'),
(r'^docs/(current|devel|\d\.\d)/(static|interactive)/(.*).html?$', 'docs.views.docpage'),
(r'^docs/(current|devel|\d\.\d)/(static|interactive)/$', 'docs.views.docsrootpage'),
(r'^docs/(current|devel|\d\.\d)/$', 'docs.views.redirect_root'),
<dl>
<dt>Online Manuals</dt>
<dd>
- <p><b>9.3 beta</b> (<a href="/docs/9.3/static/index.html">without</a> comments)</p>
- <p><b>9.2</b> (<a href="/docs/9.2/interactive/index.html">with</a>/<a href="/docs/9.2/static/index.html">without</a> comments)</p>
- <p><b>9.1</b> (<a href="/docs/9.1/interactive/index.html">with</a>/<a href="/docs/9.1/static/index.html">without</a> comments)</p>
- <p><b>9.0</b> (<a href="/docs/9.0/interactive/index.html">with</a>/<a href="/docs/9.0/static/index.html">without</a> comments)</p>
- <p><b>8.4</b> (<a href="/docs/8.4/interactive/index.html">with</a>/<a href="/docs/8.4/static/index.html">without</a> comments)</p>
+{%for v in versions%}
+ <p><b>{{v.treestring}}</b> ({%if not v.beta%}<a href="/docs/{{v.tree}}/interactive/index.html">with</a>/{%endif%}<a href="/docs/{{v.tree}}/static/index.html">without</a> comments)</p>
+{%endfor%}
</dd>
<dt>Translated Manuals</dt>
<dd>
<th class="colMid">Online Version</th>
<th class="colLast">Downloadable Version</th>
</tr>
-<tr>
- <td class="colFirst">9.2</td>
+{%for v in versions%}
+<tr{%if forloop.last%} class="lastrow"{%endif%}>
+ <td class="colFirst">{{v.tree}}</td>
<td class="colMid">
<ul>
- <li><a href="/docs/9.2/interactive/index.html">With user comments</a></li>
- <li><a href="/docs/9.2/static/index.html">Without user comments</a></li>
+ <li><a href="/docs/{{v.tree}}/interactive/index.html">With user comments</a></li>
+ <li><a href="/docs/{{v.tree}}/static/index.html">Without user comments</a></li>
</ul>
</td>
<td class="colLast">
<ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.2/postgresql-9.2-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(6.1 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.2/postgresql-9.2-US.pdf">US PDF</a> <span class="txtMediumGrey">(6.2 MB)</span></li>
+ {%if v.a4pdf%}<li>Comprehensive Manual: <a href="/files/documentation/pdf/{{v.tree}}/postgresql-{{v.tree}}-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">({{v.a4pdf|filesizeformat}})</span></li>{%endif%}
+ {%if v.uspdf%}<li>Comprehensive Manual: <a href="/files/documentation/pdf/{{v.tree}}/postgresql-{{v.tree}}-US.pdf">US PDF</a> <span class="txtMediumGrey">({{v.uspdf|filesizeformat}})</span></li>{%endif%}
</ul>
</td>
</tr>
-<tr>
- <td class="colFirst">9.1</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/9.1/interactive/index.html">With user comments</a></li>
- <li><a href="/docs/9.1/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.1/postgresql-9.1-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(5.9 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.1/postgresql-9.1-US.pdf">US PDF</a> <span class="txtMediumGrey">(5.9 MB)</span></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">9.0</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/9.0/interactive/index.html">With user comments</a></li>
- <li><a href="/docs/9.0/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.0/postgresql-9.0-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(5.4 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/9.0/postgresql-9.0-US.pdf">US PDF</a> <span class="txtMediumGrey">(5.5 MB)</span></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">8.4</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/8.4/interactive/index.html">With user comments</a></li>
- <li><a href="/docs/8.4/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.4/postgresql-8.4-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(5.0 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.4/postgresql-8.4-US.pdf">US PDF</a> <span class="txtMediumGrey">(5.1 MB)</span></li>
- </ul>
- </td>
-</tr>
+{%endfor%}
</table>
</div>
<th class="colLast">PDF Version</th>
</tr>
-<tr>
- <td class="colFirst">8.3</td>
+{%for v in versions%}
+<tr{%if forloop.last%} class="lastrow"{%endif%}>
+ <td class="colFirst">{{v.tree}}</td>
<td class="colMid">
<ul>
- <li><a href="/docs/8.3/static/index.html">Without user comments</a></li>
+ <li><a href="/docs/{{v.tree}}/static/index.html">Without user comments</a></li>
</ul>
</td>
<td class="colLast">
<ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.3/postgresql-8.3-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(4.6 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.3/postgresql-8.3-US.pdf">US PDF</a> <span class="txtMediumGrey">(4.6 MB)</span></li>
+ {%if v.a4pdf%}<li>Comprehensive Manual: <a href="/files/documentation/pdf/{{v.tree}}/postgresql-{{v.tree}}-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">({{v.a4pdf|filesizeformat}})</span></li>{%endif%}
+ {%if v.uspdf%}<li>Comprehensive Manual: <a href="/files/documentation/pdf/{{v.tree}}/postgresql-{{v.tree}}-US.pdf">US PDF</a> <span class="txtMediumGrey">({{v.uspdf|filesizeformat}})</span></li>{%endif%}
+ {%if not v.a4pdf and not v4.uspdf%}<li>PDF version noot available</li>{%endif%}
</ul>
</td>
</tr>
-<tr>
- <td class="colFirst">8.2</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/8.2/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.2/postgresql-8.2-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(5.5 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.2/postgresql-8.2-US.pdf">US PDF</a> <span class="txtMediumGrey">(14 MB)</span></li>
- </ul>
- </td>
-</tr>
-
-<tr>
- <td class="colFirst">8.1</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/8.1/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.1/postgresql-8.1-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(12.1 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.1/postgresql-8.1-US.pdf">US PDF</a> <span class="txtMediumGrey">(12.1 MB)</span></li>
- </ul>
- </td>
-</tr>
-
-<tr>
- <td class="colFirst">8.0</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/8.0/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.0/postgresql-8.0-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(9.8 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/8.0/postgresql-8.0-US.pdf">US PDF</a> <span class="txtMediumGrey">(9.9 MB)</span></li>
- </ul>
- </td>
-</tr>
-
-<tr>
- <td class="colFirst">7.4</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/7.4/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/7.4/postgresql-7.4.2-A4.pdf">A4 PDF</a> <span class="txtMediumGrey">(9.0 MB)</span></li>
- <li>Comprehensive Manual: <a href="/files/documentation/pdf/7.4/postgresql-7.4.2-US.pdf">US PDF</a> <span class="txtMediumGrey">(9.1 MB)</span></li>
- </ul>
- </td>
-</tr>
-
-<tr>
- <td class="colFirst">7.3</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/7.3/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Administrators Guide: <a href="/files/documentation/pdf/7.3/admin-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/admin-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>System Catalog Diagram: <a href="/files/documentation/pdf/7.3/catalogs-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/catalogs-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Connection Diagram: <a href="/files/documentation/pdf/7.3/connections-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/connections-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Developers Guide: <a href="/files/documentation/pdf/7.3/developer-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/developer-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Programmers Guide: <a href="/files/documentation/pdf/7.3/programmer-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/programmer-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Reference Guide: <a href="/files/documentation/pdf/7.3/reference-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/reference-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Tutorial: <a href="/files/documentation/pdf/7.3/tutorial-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/tutorial-7.3.2-A4.pdf">A4 PDF</a></li>
- <li>Users Guide: <a href="/files/documentation/pdf/7.3/user-7.3.2-US.pdf">US PDF</a> | <a href="/files/documentation/pdf/7.3/user-7.3.2-A4.pdf">A4 PDF</a></li>
- </ul>
- </td>
-</tr>
-<tr class="lastrow">
- <td class="colFirst">7.2</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/7.2/static/index.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li>Administrators Guide: <a href="/files/documentation/pdf/7.2/admin-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/admin-7.2-A4.pdf">A4</a></li>
- <li>Developers Guide: <a href="/files/documentation/pdf/7.2/developer-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/developer-7.2-A4.pdf">A4</a></li>
- <li>Programmers Guide: <a href="/files/documentation/pdf/7.2/programmer-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/programmer-7.2-A4.pdf">A4</a></li>
- <li>Reference Guide: <a href="/files/documentation/pdf/7.2/reference-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/reference-7.2-A4.pdf">A4</a></li>
- <li>Tutorial: <a href="/files/documentation/pdf/7.2/tutorial-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/tutorial-7.2-A4.pdf">A4</a></li>
- <li>Users Guide: <a href="/files/documentation/pdf/7.2/user-7.2-US.pdf">US</a> <a href="/files/documentation/pdf/7.2/user-7.2-A4.pdf">A4</a></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">7.1</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/7.1/static/postgres.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li><a href="/files/documentation/pdf/7.1/admin.pdf">Administrators Guide</a></li>
- <li><a href="/files/documentation/pdf/7.1/developer.pdf">Developers Guide</a></li>
- <li><a href="/files/documentation/pdf/7.1/programmer.pdf">Programmers Guide</a></li>
- <li><a href="/files/documentation/pdf/7.1/reference.pdf">Reference Guide</a></li>
- <li><a href="/files/documentation/pdf/7.1/tutorial.pdf">Tutorial</a></li>
- <li><a href="/files/documentation/pdf/7.1/user.pdf">Users Guide</a></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">7.0</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/7.0/static/postgres.html">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li><span class="txtMediumGrey">PDF version not available</span></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">6.5</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/6.5/static/postgres.htm">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li><span class="txtMediumGrey">PDF version not available</span></li>
- </ul>
- </td>
-</tr>
-<tr>
- <td class="colFirst">6.4</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/6.4/static/postgres.htm">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li><span class="txtMediumGrey">PDF version not available</span></li>
- </ul>
- </td>
-</tr>
-<tr class="lastrow">
- <td class="colFirst">6.3</td>
- <td class="colMid">
- <ul>
- <li><a href="/docs/6.3/static/book01.htm">Without user comments</a></li>
- </ul>
- </td>
- <td class="colLast">
- <ul>
- <li><span class="txtMediumGrey">PDF version not available</span></li>
- </ul>
- </td>
-</tr>
+{%endfor%}
</table>
</div>
{%endblock%}