From 9534bd8881c1fdbe22d8193f1e676f224cc3b93b Mon Sep 17 00:00:00 2001 From: expo Date: Sun, 7 Aug 2011 16:11:35 +0200 Subject: [PATCH 01/13] Make caveindex link to urls in the original hierachy such that their hyperlinks and images work. --- templates/caveindex.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/caveindex.html b/templates/caveindex.html index 8f16e87..42322d3 100644 --- a/templates/caveindex.html +++ b/templates/caveindex.html @@ -10,7 +10,7 @@

Notable caves

@@ -19,7 +19,7 @@ @@ -29,7 +29,7 @@ From e9fdea80c051fe9c33cde9c99aed931ab423da2b Mon Sep 17 00:00:00 2001 From: expo Date: Sun, 7 Aug 2011 16:12:52 +0200 Subject: [PATCH 02/13] Changed ubuntu local settings to be applicable to the expo machine --- localsettingsubuntu.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/localsettingsubuntu.py b/localsettingsubuntu.py index 79d5db9..0a1d5e8 100644 --- a/localsettingsubuntu.py +++ b/localsettingsubuntu.py @@ -1,9 +1,10 @@ +import sys # link localsettings to this file for use on expo computer in austria DATABASE_ENGINE = 'mysql' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'. DATABASE_NAME = 'troggle' # Or path to database file if using sqlite3. -DATABASE_USER = 'troggler3' # Not used with sqlite3. -DATABASE_PASSWORD = 'ggg' # Not used with sqlite3. +DATABASE_USER = 'expo' # Not used with sqlite3. +DATABASE_PASSWORD = 'gosser' # Not used with sqlite3. DATABASE_HOST = '' # Set to empty string for localhost. Not used with sqlite3. DATABASE_PORT = '' # Set to empty string for default. Not used with sqlite3. @@ -42,10 +43,10 @@ TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/' TEMPLATE_DIRS = ( - "/home/goatchurch/expoweb/troggle/templates", + "/home/expo/expofiles/troggle/templates", # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". # Always use forward slashes, even on Windows. # Don't forget to use absolute paths, not relative paths. ) -LOGFILE = '/home/expo/expofiles/expoweb/parsing_log.txt' +LOGFILE = '/home/expo/expofiles/troggle/parsing_log.txt' From e820a516de956ca959c369a5f2f9d641254b0186 Mon Sep 17 00:00:00 2001 From: Martin Green Date: Sun, 7 Aug 2011 17:30:18 +0100 Subject: [PATCH 03/13] bug fix for edit link for index files --- flatpages/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flatpages/views.py b/flatpages/views.py index e9db223..eed5f38 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -45,7 +45,7 @@ def flatpage(request, path): except IOError: try: o = open(os.path.normpath(settings.EXPOWEB + path + "index.htm"), "rb") - path = path + "index.html" + path = path + "index.htm" except IOError: raise Http404 else: From 5f5359f93373145f035fefd884c401732e3dd63b Mon Sep 17 00:00:00 2001 From: Martin Green Date: Sun, 7 Aug 2011 19:17:27 +0100 Subject: [PATCH 04/13] Changed regex for finding head and body of flat pages. --- flatpages/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/flatpages/views.py b/flatpages/views.py index eed5f38..f411bfa 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -15,7 +15,6 @@ import os import re def flatpage(request, path): - print "gggggg", path try: r = Redirect.objects.get(originalURL = path) return HttpResponseRedirect(r.newURL) # Redirect after POST @@ -103,7 +102,7 @@ def editflatpage(request, path): except IOError: raise Http404 html = o.read() - m = re.search(r"(.*).*(.*)", html, re.DOTALL) + m = re.search(r"(.*).*]*>(.*)", html, re.DOTALL) if m: head, body = m.groups() if re.search(r"iso-8859-1", html): From d8fe39ae86989d99da3e66ef88dc754e56139d2d Mon Sep 17 00:00:00 2001 From: Martin Green Date: Mon, 8 Aug 2011 08:51:12 +0100 Subject: [PATCH 05/13] Allow the viewing of noinfo caves on non public website without login --- core/views_caves.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/core/views_caves.py b/core/views_caves.py index 4a79652..9fcf9b4 100644 --- a/core/views_caves.py +++ b/core/views_caves.py @@ -30,39 +30,39 @@ def caveindex(request): def cave(request, cave_id='', offical_name=''): cave=getCave(cave_id) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave, 'cavepage': True}) else: return render_with_context(request,'cave.html', {'cave': cave, 'cavepage': True}) def caveEntrance(request, slug): cave = Cave.objects.get(slug = slug) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave}) else: return render_with_context(request,'cave_entrances.html', {'cave': cave}) def caveDescription(request, slug): cave = Cave.objects.get(slug = slug) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave}) else: return render_with_context(request,'cave_uground_description.html', {'cave': cave}) def caveQMs(request, slug): cave = Cave.objects.get(slug = slug) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave}) else: return render_with_context(request,'cave_qms.html', {'cave': cave}) def caveLogbook(request, slug): cave = Cave.objects.get(slug = slug) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave}) else: return render_with_context(request,'cave_logbook.html', {'cave': cave}) def caveSlug(request, slug): cave = Cave.objects.get(slug = slug) - if cave.non_public and not request.user.is_authenticated(): + if cave.non_public and settings.PUBLIC_SITE and not request.user.is_authenticated(): return render_with_context(request,'nonpublic.html', {'instance': cave}) else: return render_with_context(request,'cave.html', {'cave': cave}) From 13fe89af9fe03382b25079f159c2bff27df32c0d Mon Sep 17 00:00:00 2001 From: Martin Green Date: Mon, 8 Aug 2011 09:51:47 +0100 Subject: [PATCH 06/13] Allow for editing flatpage titles, and made a common uneditable list of links. --- flatpages/views.py | 32 ++++++++++++++++++++++-------- templates/cavebase.html | 7 +------ templates/dataformat/flatfile.html | 4 +++- templates/editflatpage.html | 2 +- templates/flatpage.html | 6 +++--- templates/menu.html | 12 +++++++++++ 6 files changed, 44 insertions(+), 19 deletions(-) create mode 100644 templates/menu.html diff --git a/flatpages/views.py b/flatpages/views.py index f411bfa..1a445ea 100644 --- a/flatpages/views.py +++ b/flatpages/views.py @@ -35,6 +35,7 @@ def flatpage(request, path): if path.startswith("noinfo") and settings.PUBLIC_SITE and not request.user.is_authenticated(): + print "flat path noinfo", path return HttpResponseRedirect(reverse("auth_login") + '?next=%s' % request.path) if path.endswith("/") or path == "": @@ -56,17 +57,22 @@ def flatpage(request, path): html = o.read() m = re.search(r"(.*).*(.*)", html, re.DOTALL) - mwithid = re.search(r'(.*).*(.*)', html, re.DOTALL) if m: head, body = m.groups() - bodyid = None - elif mwithid: - head, bodyid, body = mwithid.groups() else: return HttpResponse(html + "Page could not be split into header and body") + m = re.search(r"(.*)", head, re.DOTALL) + if m: + title, = m.groups() + else: + title = "" + linksmatch = re.match('(.*)