diff options
-rw-r--r-- | core/views_expo.py | 6 | ||||
-rw-r--r-- | templates/editexpopage.html (renamed from templates/editflatpage.html) | 0 | ||||
-rw-r--r-- | templates/flatpage.html | 2 | ||||
-rw-r--r-- | templates/menu.html | 4 | ||||
-rw-r--r-- | templates/pagenotfound.html | 2 | ||||
-rw-r--r-- | urls.py | 23 |
6 files changed, 19 insertions, 18 deletions
diff --git a/core/views_expo.py b/core/views_expo.py index d43cf19..fb4c06c 100644 --- a/core/views_expo.py +++ b/core/views_expo.py @@ -55,7 +55,7 @@ def expofilesdir(request, dirpath, filepath): fileitems.append((Path(urlpath) / f.parts[-1], str(f.parts[-1]), getmimetype(f))) return render(request, 'dirdisplay.html', { 'filepath': urlpath, 'fileitems':fileitems, 'diritems': diritems,'settings': settings }) -def flatpage(request, path): +def expopage(request, path): '''Either renders an HTML page from expoweb with all the menus, or serves an unadorned binary file with mime type @@ -174,7 +174,7 @@ def getmimetype(path): @login_required_if_public @ensure_csrf_cookie -def editflatpage(request, path): +def editexpopage(request, path): try: r = Cave.objects.get(url = path) return troggle.core.views_caves.editCave(request, r.cave.slug) @@ -241,7 +241,7 @@ def editflatpage(request, path): else: body = "### File not found ###\n" + str(filepath) flatpageForm = FlatPageForm({"html": body, "title": "Missing"}) - return render(request, 'editflatpage.html', {'path': path, 'form': flatpageForm, }) + return render(request, 'editexpopage.html', {'path': path, 'form': flatpageForm, }) class FlatPageForm(forms.Form): title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) diff --git a/templates/editflatpage.html b/templates/editexpopage.html index 606a47c..606a47c 100644 --- a/templates/editflatpage.html +++ b/templates/editexpopage.html diff --git a/templates/flatpage.html b/templates/flatpage.html index ebe5b1b..cf6d860 100644 --- a/templates/flatpage.html +++ b/templates/flatpage.html @@ -5,7 +5,7 @@ {{ body|safe }} {% if homepage %} {% if editable %} - <a href="{% url "editflatpage" path %}">Edit</a> + <a href="{% url "editexpopage" path %}">Edit</a> {% endif %} {% else %} {% if not has_menu %} diff --git a/templates/menu.html b/templates/menu.html index e36136f..f9fdf4c 100644 --- a/templates/menu.html +++ b/templates/menu.html @@ -3,7 +3,7 @@ <li><a href="/index.htm">Home</a></li> <li><a href="/infodx.htm">Main Index</a></li> <li><a href="/handbook/index.htm">Handbook</a></li> -<li><a href="/handbook//computing/onlinesystems.html">Online systems</a></li> +<li><a href="/handbook/computing/onlinesystems.html">Online systems</a></li> <li><a href="/pubs.htm">Reports</a></li> <li><a href="/areas.htm">Areas</a></li> <li><a href="/caves">Caves</a></li> @@ -11,7 +11,7 @@ <li><form name=P method=get action="/search" target="_top"> <input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus> <input type=submit value="Search"></li> -{% if editable %}<li><a href="{% url "editflatpage" path %}" class="editlink"><strong>Edit this page</strong></a></li>{% endif %} +{% if editable %}<li><a href="{% url "editexpopage" path %}" class="editlink"><strong>Edit this page</strong></a></li>{% endif %} {% if cave_editable %}<li><a href="{% url "edit_cave" cave_editable %}" class="editlink"><strong>Edit this cave</strong></a></li>{% endif %} </ul> {% endif %} diff --git a/templates/pagenotfound.html b/templates/pagenotfound.html index 2791dd9..9d54ae6 100644 --- a/templates/pagenotfound.html +++ b/templates/pagenotfound.html @@ -2,7 +2,7 @@ {% block title %}Page not found {{ path }}{% endblock %} {% block body %} <h1>Page not found {{ path }}</h1> -<p>Probably a mistake. But you can use <a href="{%url "editflatpage" path %}">this link</a> +<p>Probably a mistake. But you can use <a href="{%url "editexpopage" path %}">this link</a> <p> or 'Edit this page' in the menu on the left to create this page if you aare logged in. <p>If you can't see that option in the menu, then you are not logged in and you can't create anything. @@ -10,7 +10,7 @@ from troggle.core import views_other, views_caves, views_logbooks, views_statist from troggle.core.views_other import troggle404 from troggle.core.views_caves import ent, prospecting_image from troggle.core.views_statistics import pathsreport, stats -from troggle.core.views_expo import expofiles_redirect, expofilessingle, flatpage, editflatpage +from troggle.core.views_expo import expofiles_redirect, expofilessingle, expopage, editexpopage """This sets the actualurlpatterns[] and urlpatterns[] lists which django uses to resolve urls - in both directions as these are declarative. @@ -33,16 +33,16 @@ The API urls return TSV or JSON and are new in July 2020. if settings.EXPOFILESREMOTE: expofilesurls = [ - url(r'^/*(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles + url(r'^(?P<path>.*)$', expofiles_redirect, name="expofiles_redirect"), # to expo.survex.com/expofiles ] else: expofilesurls = [ - url(r'^/*(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES + url(r'^(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES ] -actualurlpatterns = [ - url(r'^expofiles', include(expofilesurls)), +trogglepatterns = [ + url(r'^expofiles/', include(expofilesurls)), url(r'^troggle$', views_other.frontpage, name="frontpage"), # control panel. Shows recent actions. url(r'^caves$', views_caves.caveindex, name="caveindex"), @@ -142,18 +142,19 @@ actualurlpatterns = [ # {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), # url(r'^site_media/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS - url(r'^(site_media/.*)$', flatpage, name="flatpage"), # MEDIA_ROOT: CSS and JS + url(r'^(site_media/.*)$', expopage, name="expopage"), # MEDIA_ROOT: CSS and JS # url(r'^static/(?P<filepath>.*)$', view_surveys.expofilessingle, name="single"), # MEDIA_ROOT: CSS and JS - url(r'^(static/.*)$', flatpage, name="flatpage"), # STATIC: CSS and JS + url(r'^(static/.*)$', expopage, name="expopage"), # STATIC: CSS and JS - url(r'^(.*)_edit$', editflatpage, name="editflatpage"), - url(r'^(.*)$', flatpage, name="flatpage"), # CATCHALL assumed relative to EXPOWEB, some expofiles getting here.. + url(r'^(.*)_edit$', editexpopage, name="editexpopage"), + url(r'^(.*)$', expopage, name="expopage"), # CATCHALL assumed relative to EXPOWEB ] -#Allow DIR_ROOT prefix to all urls +# do not allow DIR_ROOT prefix to all urls urlpatterns = [ - url('^%s' % settings.DIR_ROOT, include(actualurlpatterns)) + # url('^%s' % settings.DIR_ROOT, include(trogglepatterns)) + url('', include(trogglepatterns)) ] # When apache is running these prempt Django so Django never sees them. |