mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2024-11-22 07:11:52 +00:00
Survex files subdirectories displayed differently
This commit is contained in:
parent
213ada4ae9
commit
8723d62add
@ -368,8 +368,8 @@ def survexcaveslist(request):
|
||||
lsurvdirobj = [ ]
|
||||
for lsubsvx in dsubsvx:
|
||||
lsurvdirobj.append(("caves-1623/"+cavedir+"/"+subdir+"/"+lsubsvx, lsubsvx))
|
||||
if len(dsubsvx) > 1:
|
||||
subsurvdirs.append((lsurvdirobj[0], lsurvdirobj[1:]))
|
||||
if len(dsubsvx) >= 1:
|
||||
subsurvdirs.append((subdir,lsurvdirobj[0], lsurvdirobj[0:])) # list now includes the first item too
|
||||
subdircaves.append((cavedir, (survdirobj[0], survdirobj[1:]), subsurvdirs))
|
||||
|
||||
# multifile caves
|
||||
@ -381,27 +381,31 @@ def survexcaveslist(request):
|
||||
|
||||
return render_to_response('svxfilecavelist.html', {'settings': settings, "onefilecaves":onefilecaves, "multifilecaves":multifilecaves, "subdircaves":subdircaves })
|
||||
|
||||
|
||||
# parsing all the survex files of a single cave and showing that it's consistent and can find all the files and people
|
||||
|
||||
# currently not showing Explorers or Titles. link test from SurvexFile page is "dates and explorers"
|
||||
# Should explicity fix the kataster number thing.
|
||||
def survexcavesingle(request, survex_cave):
|
||||
print(">>>", survex_cave)
|
||||
'''parsing all the survex files of a single cave and showing that it's consistent and can find all
|
||||
the files and people. Currently not showing Explorers or Titles. link test from SurvexFile page
|
||||
is "dates and explorers". Should explicity fix the kataster number thing.
|
||||
'''
|
||||
sc = survex_cave
|
||||
breload = False
|
||||
if breload:
|
||||
parsers.survex.ReloadSurvexCave(survex_cave) # does not exit now, needs re-writing to work.
|
||||
parsers.survex.ReloadSurvexCave(sc) # does not exit now, needs re-writing to work.
|
||||
try:
|
||||
cave = Cave.objects.get(kataster_number=survex_cave)
|
||||
for survexdirectory in cave.survexdirectory_set.all:
|
||||
print(">>> >>>", survexdirectory, flush=True)
|
||||
cave = Cave.objects.get(kataster_number=sc)
|
||||
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
|
||||
except ObjectDoesNotExist:
|
||||
# can get here if the survex file is in a directory labelled with unofficial number not kataster number.
|
||||
cave = Cave.objects.get(unofficial_number=survex_cave)
|
||||
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
|
||||
# should produce useful error message for person trying to upload or manage survex files
|
||||
# maybe - and _ mixed up, or CUCC-2017- instead of 2017-CUCC-, or CUCC2015DL01 ??
|
||||
for unoff in [sc, sc.replace('-','_'), sc.replace('_','-')]:
|
||||
try:
|
||||
cave = Cave.objects.get(unofficial_number=unoff)
|
||||
return render_to_response('svxcavesingle.html', {'settings': settings, "cave":cave })
|
||||
except ObjectDoesNotExist:
|
||||
continue
|
||||
return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })
|
||||
|
||||
except:
|
||||
raise Http404()
|
||||
return render_to_response('svxcavesingle404.html', {'settings': settings, "cave":sc })
|
||||
|
||||
|
||||
|
||||
|
83
templates/svxcavesingle404.html
Normal file
83
templates/svxcavesingle404.html
Normal file
@ -0,0 +1,83 @@
|
||||
{% extends "base.html" %}
|
||||
{% load wiki_markup %}
|
||||
{% load link %}
|
||||
|
||||
{% block title %}List of survex files{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<h1>Surveys for cave - Cave not found</h1>
|
||||
|
||||
<h3>Cave number looked for: '{{cave}}'</h3>
|
||||
<h3>kataster number like this not found</h3>
|
||||
<h3>unofficial number like this not found</h3>
|
||||
|
||||
<p>
|
||||
{% for survexdirectory in cave.survexdirectory_set.all %}
|
||||
<a href="#T_{{survexdirectory.primarysurvexfile.path}}">{{survexdirectory.path}}</a>
|
||||
{% endfor %}
|
||||
</p>
|
||||
|
||||
{% for survexdirectory in cave.survexdirectory_set.all %}
|
||||
<h3 id="T_{{survexdirectory.primarysurvexfile.path}}">{{survexdirectory.path}}</h3>
|
||||
|
||||
<table>
|
||||
<tr><th>Survex file</th><th>Block</th><th>Date</th><th>Explorers</th><th>length</th><th>Titles</th><th>Scans</th></tr>
|
||||
|
||||
{% for survexfile in survexdirectory.survexfile_set.all %}
|
||||
<tr>
|
||||
{% if survexfile.exists %}
|
||||
<td rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
{% else %}
|
||||
<td class="survexnewfile" rowspan="{{survexfile.survexblock_set.all|length|plusone}}">
|
||||
{% endif %}
|
||||
|
||||
{% ifequal survexfile survexdirectory.primarysurvexfile %}
|
||||
<a href="{% url "svx" survexfile.path %}"><b>{{survexfile.path}}</b></a>
|
||||
{% else %}
|
||||
<a href="{% url "svx" survexfile.path %}">{{survexfile.path}}</a>
|
||||
{% endifequal %}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% for survexblock in survexfile.survexblock_set.all %}
|
||||
<tr>
|
||||
<td style="width:10 em">{{survexblock.name}}</td>
|
||||
<td style="white-space:nowrap">
|
||||
{% if survexblock.expedition %}
|
||||
<a href="{{survexblock.expedition.get_absolute_url}}">{{survexblock.date|date:"D d M Y"}}</a>
|
||||
{% else %}
|
||||
<!--{{survexblock.date}}-->
|
||||
{% endif %}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% for personrole in survexblock.survexpersonrole_set.all %}
|
||||
{% if personrole.personexpedition %}
|
||||
<a href="{{personrole.personexpedition.get_absolute_url}}">{{personrole.personname}}</a>
|
||||
{% else %}
|
||||
{{personrole.personname}}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</td>
|
||||
|
||||
<td style="padding-right: 3px; text-align:right">{{survexblock.legslength|stringformat:".1f"}}</td>
|
||||
|
||||
<td style="padding-left: 3px;">
|
||||
{{survexblock.title}}
|
||||
</td>
|
||||
|
||||
<td>
|
||||
{% if survexblock.scansfolder %}
|
||||
<b><a href="{{survexblock.scansfolder.get_absolute_url}}">{{survexblock.scansfolder.walletname}}</a></b>
|
||||
{% endif %}
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
</table>
|
||||
|
||||
{% endfor %}
|
||||
|
||||
{% endblock %}
|
||||
|
@ -23,9 +23,9 @@
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
{% for primarycavefile, subcavefiles in subsurvdirs %}
|
||||
{% for name, primarycavefile, subcavefiles in subsurvdirs %}
|
||||
<tr>
|
||||
<td><a href="{% url "svx" primarycavefile.0 %}">{{primarycavefile.1}}</a></td>
|
||||
<td><a href="{% url "svx" primarycavefile.0 %}">{{name}}</a></td>
|
||||
<td>
|
||||
{% for cavepath, cavename in subcavefiles %}
|
||||
<a href="{% url "svx" cavepath %}">{{cavename}}</a>
|
||||
|
6
urls.py
6
urls.py
@ -7,7 +7,7 @@ from django.contrib import admin
|
||||
from django.urls import reverse, resolve
|
||||
|
||||
from troggle.core import views_other, views_caves, views_logbooks, views_statistics, views_survex, view_surveys
|
||||
#from troggle.core.views_other import logbook_entry_suggestions
|
||||
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 flatpages import views as flatviews
|
||||
@ -25,6 +25,7 @@ which is vital to writing code for the webapp. So the URL dispatch is declarativ
|
||||
The API urls return TSV or JSON and are new in July 2020.
|
||||
"""
|
||||
|
||||
#handler404 = 'troggle.core.views_other.troggle404' # can't get this to work. but 404.html is default anyway
|
||||
|
||||
# Many of these patterns do not work because troggle spent many years broken and we have
|
||||
# not yet restored all the functions. Some may have never been fully implemented in
|
||||
@ -102,7 +103,7 @@ actualurlpatterns = [
|
||||
url(r'^survexfile/(?P<survex_file>.*?)\.log$', views_survex.svxraw),
|
||||
url(r'^survexfile/(?P<survex_file>.*?)\.err$', views_survex.err),
|
||||
|
||||
url(r'^survexfile/caves', views_survex.survexcaveslist, name="survexcaveslist"),
|
||||
url(r'^survexfile/caves/$', views_survex.survexcaveslist, name="survexcaveslist"),
|
||||
url(r'^survexfile/(?P<survex_cave>.*)$', views_survex.survexcavesingle, name="survexcavessingle"),
|
||||
url(r'^survexfileraw/(?P<survex_file>.*?)\.svx$', views_survex.svxraw, name="svxraw"),
|
||||
|
||||
@ -146,6 +147,7 @@ actualurlpatterns = [
|
||||
urlpatterns = [
|
||||
url('^%s' % settings.DIR_ROOT, include(actualurlpatterns))
|
||||
]
|
||||
|
||||
# When apache is running these prempt Django so Django never sees them.
|
||||
|
||||
# NEW apache configurations suggested as of 20 March 2021:
|
||||
|
Loading…
Reference in New Issue
Block a user