mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-26 01:01:53 +00:00
flatpages to expopages
This commit is contained in:
parent
577bd51613
commit
3452c2c5d4
@ -55,7 +55,7 @@ def expofilesdir(request, dirpath, filepath):
|
|||||||
fileitems.append((Path(urlpath) / f.parts[-1], str(f.parts[-1]), getmimetype(f)))
|
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 })
|
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,
|
'''Either renders an HTML page from expoweb with all the menus,
|
||||||
or serves an unadorned binary file with mime type
|
or serves an unadorned binary file with mime type
|
||||||
|
|
||||||
@ -174,7 +174,7 @@ def getmimetype(path):
|
|||||||
|
|
||||||
@login_required_if_public
|
@login_required_if_public
|
||||||
@ensure_csrf_cookie
|
@ensure_csrf_cookie
|
||||||
def editflatpage(request, path):
|
def editexpopage(request, path):
|
||||||
try:
|
try:
|
||||||
r = Cave.objects.get(url = path)
|
r = Cave.objects.get(url = path)
|
||||||
return troggle.core.views_caves.editCave(request, r.cave.slug)
|
return troggle.core.views_caves.editCave(request, r.cave.slug)
|
||||||
@ -241,7 +241,7 @@ def editflatpage(request, path):
|
|||||||
else:
|
else:
|
||||||
body = "### File not found ###\n" + str(filepath)
|
body = "### File not found ###\n" + str(filepath)
|
||||||
flatpageForm = FlatPageForm({"html": body, "title": "Missing"})
|
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):
|
class FlatPageForm(forms.Form):
|
||||||
title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'}))
|
title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'}))
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
{{ body|safe }}
|
{{ body|safe }}
|
||||||
{% if homepage %}
|
{% if homepage %}
|
||||||
{% if editable %}
|
{% if editable %}
|
||||||
<a href="{% url "editflatpage" path %}">Edit</a>
|
<a href="{% url "editexpopage" path %}">Edit</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if not has_menu %}
|
{% if not has_menu %}
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
<li><a href="/index.htm">Home</a></li>
|
<li><a href="/index.htm">Home</a></li>
|
||||||
<li><a href="/infodx.htm">Main Index</a></li>
|
<li><a href="/infodx.htm">Main Index</a></li>
|
||||||
<li><a href="/handbook/index.htm">Handbook</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="/pubs.htm">Reports</a></li>
|
||||||
<li><a href="/areas.htm">Areas</a></li>
|
<li><a href="/areas.htm">Areas</a></li>
|
||||||
<li><a href="/caves">Caves</a></li>
|
<li><a href="/caves">Caves</a></li>
|
||||||
@ -11,7 +11,7 @@
|
|||||||
<li><form name=P method=get action="/search" target="_top">
|
<li><form name=P method=get action="/search" target="_top">
|
||||||
<input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus>
|
<input id="omega-autofocus" type=search name=P value="testing" size=8 autofocus>
|
||||||
<input type=submit value="Search"></li>
|
<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 %}
|
{% if cave_editable %}<li><a href="{% url "edit_cave" cave_editable %}" class="editlink"><strong>Edit this cave</strong></a></li>{% endif %}
|
||||||
</ul>
|
</ul>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
{% block title %}Page not found {{ path }}{% endblock %}
|
{% block title %}Page not found {{ path }}{% endblock %}
|
||||||
{% block body %}
|
{% block body %}
|
||||||
<h1>Page not found {{ path }}</h1>
|
<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>
|
<p>
|
||||||
or 'Edit this page' in the menu on the left to create this page if you aare logged in.
|
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.
|
<p>If you can't see that option in the menu, then you are not logged in and you can't create anything.
|
||||||
|
23
urls.py
23
urls.py
@ -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_other import troggle404
|
||||||
from troggle.core.views_caves import ent, prospecting_image
|
from troggle.core.views_caves import ent, prospecting_image
|
||||||
from troggle.core.views_statistics import pathsreport, stats
|
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
|
"""This sets the actualurlpatterns[] and urlpatterns[] lists which django uses
|
||||||
to resolve urls - in both directions as these are declarative.
|
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:
|
if settings.EXPOFILESREMOTE:
|
||||||
expofilesurls = [
|
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:
|
else:
|
||||||
expofilesurls = [
|
expofilesurls = [
|
||||||
url(r'^/*(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES
|
url(r'^(?P<filepath>.*)$', expofilessingle, name="single"), # local copy of EXPOFILES
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
actualurlpatterns = [
|
trogglepatterns = [
|
||||||
url(r'^expofiles', include(expofilesurls)),
|
url(r'^expofiles/', include(expofilesurls)),
|
||||||
|
|
||||||
url(r'^troggle$', views_other.frontpage, name="frontpage"), # control panel. Shows recent actions.
|
url(r'^troggle$', views_other.frontpage, name="frontpage"), # control panel. Shows recent actions.
|
||||||
url(r'^caves$', views_caves.caveindex, name="caveindex"),
|
url(r'^caves$', views_caves.caveindex, name="caveindex"),
|
||||||
@ -142,18 +142,19 @@ actualurlpatterns = [
|
|||||||
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
|
# {'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/(?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/(?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'^(.*)_edit$', editexpopage, name="editexpopage"),
|
||||||
url(r'^(.*)$', flatpage, name="flatpage"), # CATCHALL assumed relative to EXPOWEB, some expofiles getting here..
|
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 = [
|
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.
|
# When apache is running these prempt Django so Django never sees them.
|
||||||
|
Loading…
Reference in New Issue
Block a user