Prospecting guide and images and few minor other things.

This commit is contained in:
expo 2013-08-01 17:00:01 +02:00
parent 64f4e122a5
commit df8618d0f0
11 changed files with 354 additions and 50 deletions

View File

@ -6,3 +6,4 @@ db*
localsettings.py localsettings.py
*~ *~
parsing_log.txt parsing_log.txt
troggle

View File

@ -120,6 +120,7 @@ admin.site.register(LogbookEntry, LogbookEntryAdmin)
admin.site.register(QM, QMAdmin) admin.site.register(QM, QMAdmin)
admin.site.register(Survey, SurveyAdmin) admin.site.register(Survey, SurveyAdmin)
admin.site.register(ScannedImage) admin.site.register(ScannedImage)
admin.site.register(SurvexStation)
admin.site.register(SurvexScansFolder) admin.site.register(SurvexScansFolder)
admin.site.register(SurvexScanSingle) admin.site.register(SurvexScanSingle)

BIN
core/imageposcalc.ods Normal file

Binary file not shown.

View File

@ -398,10 +398,13 @@ class Cave(TroggleModel):
#href = models.CharField(max_length=100) #href = models.CharField(max_length=100)
class Meta:
ordering = ('kataster_code', 'unofficial_number')
def hassurvey(self): def hassurvey(self):
if not self.underground_centre_line: if not self.underground_centre_line:
return "No" return "No"
if (self.underground_centre_line.find("<img") > -1 or self.underground_centre_line.find("<a") > -1): if (self.survey.find("<img") > -1 or self.survey.find("<a") > -1 or self.survey.find("<IMG") > -1 or self.survey.find("<A") > -1):
return "Yes" return "Yes"
return "Missing" return "Missing"
@ -502,7 +505,16 @@ class Cave(TroggleModel):
f.write(u8) f.write(u8)
f.close() f.close()
def getArea(self):
areas = self.area.all()
lowestareas = list(areas)
for area in areas:
if area.parent in areas:
try:
lowestareas.remove(area.parent)
except:
pass
return lowestareas[0]
def getCaveByReference(reference): def getCaveByReference(reference):
areaname, code = reference.split("-", 1) areaname, code = reference.split("-", 1)
@ -539,7 +551,7 @@ class Entrance(TroggleModel):
('P?', 'Paint (?)'), ('P?', 'Paint (?)'),
('T', 'Tag'), ('T', 'Tag'),
('T?', 'Tag (?)'), ('T?', 'Tag (?)'),
('R', 'Retagged'), ('R', 'Needs Retag'),
('S', 'Spit'), ('S', 'Spit'),
('S?', 'Spit (?)'), ('S?', 'Spit (?)'),
('U', 'Unmarked'), ('U', 'Unmarked'),
@ -548,7 +560,7 @@ class Entrance(TroggleModel):
marking_comment = models.TextField(blank=True,null=True) marking_comment = models.TextField(blank=True,null=True)
FINDABLE_CHOICES = ( FINDABLE_CHOICES = (
('?', 'To be confirmed ...'), ('?', 'To be confirmed ...'),
('S', 'Surveyed'), ('S', 'Coordinates'),
('L', 'Lost'), ('L', 'Lost'),
('R', 'Refindable')) ('R', 'Refindable'))
findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True) findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True)
@ -575,21 +587,46 @@ class Entrance(TroggleModel):
def find_location(self): def find_location(self):
r = {'': 'To be entered ',
'?': 'To be confirmed:',
'S': '',
'L': 'Lost:',
'R': 'Refindable:'}[self.findability]
if self.tag_station: if self.tag_station:
try:
s = SurvexStation.objects.lookup(self.tag_station) s = SurvexStation.objects.lookup(self.tag_station)
return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z) return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
except:
return r + "%s Tag Station not in dataset" % self.tag_station
if self.exact_station: if self.exact_station:
try:
s = SurvexStation.objects.lookup(self.exact_station) s = SurvexStation.objects.lookup(self.exact_station)
return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z) return r + "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
except:
return r + "%s Exact Station not in dataset" % self.tag_station
if self.other_station: if self.other_station:
try:
s = SurvexStation.objects.lookup(self.other_station) s = SurvexStation.objects.lookup(self.other_station)
return "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description) return r + "%0.0fE %0.0fN %0.0fAlt %s" % (s.x, s.y, s.z, self.other_description)
except:
return r + "%s Other Station not in dataset" % self.tag_station
if self.FINDABLE_CHOICES == "S":
r += "ERROR, Entrance has been surveyed but has no survex point"
if self.bearings: if self.bearings:
return self.bearings return r + self.bearings
return r
def best_station(self):
if self.tag_station:
return self.tag_station
if self.exact_station:
return self.exact_station
if self.other_station:
return self.other_station
def has_photo(self): def has_photo(self):
if self.photo: if self.photo:
if (self.photo.find("<img") > -1 or self.photo.find("<a") > -1): if (self.photo.find("<img") > -1 or self.photo.find("<a") > -1 or self.photo.find("<IMG") > -1 or self.photo.find("<A") > -1):
return "Yes" return "Yes"
else: else:
return "Missing" return "Missing"
@ -608,6 +645,9 @@ class Entrance(TroggleModel):
def tag(self): def tag(self):
return SurvexStation.objects.lookup(self.tag_station) return SurvexStation.objects.lookup(self.tag_station)
def needs_surface_work(self):
return self.findability != "S" or not self.has_photo or self.marking != "T"
def get_absolute_url(self): def get_absolute_url(self):
ancestor_titles='/'.join([subcave.title for subcave in self.get_ancestors()]) ancestor_titles='/'.join([subcave.title for subcave in self.get_ancestors()])

View File

@ -1,4 +1,7 @@
from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area #!/usr/bin/python
# -*- coding: utf-8 -*-
from troggle.core.models import CaveSlug, Cave, CaveAndEntrance, Survey, Expedition, QM, CaveDescription, EntranceSlug, Entrance, Area, SurvexStation
from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm from troggle.core.forms import CaveForm, CaveAndEntranceFormSet, VersionControlCommentForm, EntranceForm, EntranceLetterForm
import troggle.core.models as models import troggle.core.models as models
import troggle.settings as settings import troggle.settings as settings
@ -8,10 +11,13 @@ from django.forms.models import modelformset_factory
from django import forms from django import forms
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from utils import render_with_context # see views_logbooks for explanation on this. from utils import render_with_context # see views_logbooks for explanation on this.
from django.http import HttpResponseRedirect from django.http import HttpResponse, HttpResponseRedirect
from django.conf import settings from django.conf import settings
import re, urlparse import re, urlparse
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
import settings
import Image, ImageDraw, ImageFont, string, os, sys
def getCave(cave_id): def getCave(cave_id):
"""Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm.""" """Returns a cave object when given a cave name or number. It is used by views including cavehref, ent, and qm."""
@ -249,19 +255,21 @@ def get_qms(request, caveslug):
return render_with_context(request,'options.html', {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]}) return render_with_context(request,'options.html', {"items": [(e.entrance.slug(), e.entrance.slug()) for e in cave.entrances()]})
areanames = [ areanames = [
#('', 'Location unclear'), ('', 'Location unclear'),
('1a', '1a &ndash; Plateau: around Top Camp'), ('1a', '1a &ndash; Plateau: around Top Camp'),
('1b', '1b &ndash; Western plateau near 182'), ('1b', '1b &ndash; Western plateau near 182'),
('1c', '1c &ndash; Eastern plateau near 204 walk-in path'), ('1c', '1c &ndash; Eastern plateau near 204 walk-in path'),
('1d', '1d &ndash; Further plateau around 76'), ('1d', '1d &ndash; Further plateau around 76'),
('2a', '2a &ndash; Southern Schwarzmooskogel near 201 path and the Nipple'), ('2a', '2a &ndash; Southern Schwarzmooskogel near 201 path and the Nipple'),
('2b', '2b &ndash; Eish&ouml;hle area'), ('2b', '2b &ndash; Eish&ouml;hle area'),
('2b or 4 (unclear)', '2b or 4 (unclear)'),
('2c', '2c &ndash; Kaninchenh&ouml;hle area'), ('2c', '2c &ndash; Kaninchenh&ouml;hle area'),
('2d', '2d &ndash; Steinbr&uuml;ckenh&ouml;hle area'), ('2d', '2d &ndash; Steinbr&uuml;ckenh&ouml;hle area'),
('3', '3 &ndash; Br&auml;uning Alm'), ('3', '3 &ndash; Br&auml;uning Alm'),
('4', '4 &ndash; Kratzer valley'), ('4', '4 &ndash; Kratzer valley'),
('5', '5 &ndash; Schwarzmoos-Wildensee'), ('5', '5 &ndash; Schwarzmoos-Wildensee'),
('6', '6 &ndash; Far plateau'), ('6', '6 &ndash; Far plateau'),
('1626 or 6 (borderline)', '1626 or 6 (borderline)'),
('7', '7 &ndash; Egglgrube'), ('7', '7 &ndash; Egglgrube'),
('8a', '8a &ndash; Loser south face'), ('8a', '8a &ndash; Loser south face'),
('8b', '8b &ndash; Loser below Dimmelwand'), ('8b', '8b &ndash; Loser below Dimmelwand'),
@ -274,8 +282,221 @@ areanames = [
def prospecting(request): def prospecting(request):
#for key, name in areanames:
# print key, Area.objects.get(short_name = key)
areas = []
for key, name in areanames: for key, name in areanames:
print key, Area.objects.get(short_name = key) a = Area.objects.get(short_name = key)
areas = [ (name, Area.objects.get(short_name = key)) for key, name in areanames ] caves = list(a.cave_set.all())
return render_with_context(request,'prospecting.html', {"areas": areas}) caves.sort(caveCmp)
areas.append((name, a, caves))
return render_with_context(request, 'prospecting.html', {"areas": areas})
# Parameters for big map and zoomed subarea maps:
# big map first (zoom factor ignored)
maps = {
# id left top right bottom zoom
# G&K G&K G&K G&K factor
"all": [33810.4, 85436.5, 38192.0, 81048.2, 0.35,
"All"],
"40": [36275.6, 82392.5, 36780.3, 81800.0, 3.0,
"Eish&ouml;hle"],
"76": [35440.0, 83220.0, 36090.0, 82670.0, 1.3,
"Eislufth&ouml;hle"],
"204": [36354.1, 84154.5, 37047.4, 83300, 3.0,
"Steinbr&uuml;ckenh&ouml;hle"],
"tc": [35230.0, 82690.0, 36110.0, 82100.0, 3.0,
"Near Top Camp"],
"grieß":
[36000.0, 86300.0, 38320.0, 84400.0, 4.0,
"Grießkogel Area"],
}
for n in maps.keys():
L, T, R, B, S, name = maps[n]
W = (R-L)/2
H = (T-B)/2
for i in range(2):
for j in range(2):
maps["%s%i%i" % (n, i, j)] = [L + i * W, T - j * H, L + (i + 1) * W, T - (j + 1) * H, S, name]
# Keys in the order in which we want the maps output
mapcodes = ["all", "grieß","40", "76", "204", "tc"]
# Field codes
L = 0
T = 1
R = 2
B = 3
ZOOM = 4
DESC = 5
areacolours = {
'1a' : '#00ffff',
'1b' : '#ff00ff',
'1c' : '#ffff00',
'1d' : '#ffffff',
'2a' : '#ff0000',
'2b' : '#00ff00',
'2c' : '#008800',
'2d' : '#ff9900',
'3' : '#880000',
'4' : '#0000ff',
'6' : '#000000', # doubles for surface fixed pts, and anything else
'7' : '#808080'
}
for FONT in [
"/usr/share/fonts/truetype/freefont/FreeSans.ttf",
"/usr/X11R6/lib/X11/fonts/truetype/arial.ttf",
"C:\WINNT\Fonts\ARIAL.TTF"
]:
if os.path.isfile(FONT): break
TEXTSIZE = 16
CIRCLESIZE =8
LINEWIDTH = 2
myFont = ImageFont.truetype(FONT, TEXTSIZE)
def mungecoord(x, y, mapcode, img):
# Top of Zinken is 73 1201 = dataset 34542 81967
# Top of Hinter is 1073 562 = dataset 36670 83317
# image is 1417 by 2201
# FACTOR1 = 1000.0 / (36670.0-34542.0)
# FACTOR2 = (1201.0-562.0) / (83317 - 81967)
# FACTOR = (FACTOR1 + FACTOR2)/2
# The factors aren't the same as the scanned map's at a slight angle. I
# can't be bothered to fix this. Since we zero on the Hinter it makes
# very little difference for caves in the areas round 76 or 204.
# xoffset = (x - 36670)*FACTOR
# yoffset = (y - 83317)*FACTOR
# return (1073 + xoffset, 562 - yoffset)
m = maps[mapcode]
factorX, factorY = img.size[0] / (m[R] - m[L]), img.size[1] / (m[T] - m[B])
return ((x - m[L]) * factorX, (m[T] - y) * factorY)
COL_TYPES = {True: "red",
False: "#dddddd",
"Reference": "#dddddd"}
def plot(surveypoint, number, point_type, label, mapcode, draw, img):
try:
ss = SurvexStation.objects.lookup(surveypoint)
E, N = ss.x, ss.y
shortnumber = number.replace("&mdash;","")
(x,y) = map(int, mungecoord(E, N, mapcode, img))
#imgmaps[maparea].append( [x-4, y-SIZE/2, x+4+draw.textsize(shortnumber)[0], y+SIZE/2, shortnumber, label] )
draw.rectangle([(x+CIRCLESIZE, y-TEXTSIZE/2), (x+CIRCLESIZE*2+draw.textsize(shortnumber)[0], y+TEXTSIZE/2)], fill="#ffffff")
draw.text((x+CIRCLESIZE * 1.5,y-TEXTSIZE/2), shortnumber, fill="#000000")
draw.ellipse([(x-CIRCLESIZE,y-CIRCLESIZE),(x+CIRCLESIZE,y+CIRCLESIZE)], fill=COL_TYPES[point_type], outline="#000000")
except:
pass
def prospecting_image(request, name):
mainImage = Image.open(os.path.join(settings.SURVEY_SCANS, "location_maps", "pguidemap.jpg"))
if settings.PUBLIC_SITE and not request.user.is_authenticated():
mainImage = Image.new("RGB", mainImage.size, '#ffffff')
m = maps[name]
#imgmaps = []
if name == "all":
img = mainImage
else:
M = maps['all']
W, H = mainImage.size
l = int((m[L] - M[L]) / (M[R] - M[L]) * W)
t = int((m[T] - M[T]) / (M[B] - M[T]) * H)
r = int((m[R] - M[L]) / (M[R] - M[L]) * W)
b = int((m[B] - M[T]) / (M[B] - M[T]) * H)
img = mainImage.crop((l, t, r, b))
w = int(round(m[ZOOM] * (m[R] - m[L]) / (M[R] - M[L]) * W))
h = int(round(m[ZOOM] * (m[B] - m[T]) / (M[B] - M[T]) * H))
img = img.resize((w, h), Image.BICUBIC)
draw = ImageDraw.Draw(img)
draw.setfont(myFont)
if name == "all":
for maparea in maps.keys():
if maparea == "all":
continue
localm = maps[maparea]
l,t = mungecoord(localm[L], localm[T], "all", img)
r,b = mungecoord(localm[R], localm[B], "all", img)
text = maparea + " map"
textlen = draw.textsize(text)[0] + 3
draw.rectangle([l, t, l+textlen, t+TEXTSIZE+2], fill='#ffffff')
draw.text((l+2, t+1), text, fill="#000000")
#imgmaps.append( [l, t, l+textlen, t+SIZE+2, "submap" + maparea, maparea + " subarea map"] )
draw.line([l, t, r, t], fill='#777777', width=LINEWIDTH)
draw.line([l, b, r, b], fill='#777777', width=LINEWIDTH)
draw.line([l, t, l, b], fill='#777777', width=LINEWIDTH)
draw.line([r, t, r, b], fill='#777777', width=LINEWIDTH)
draw.line([l, t, l+textlen, t], fill='#777777', width=LINEWIDTH)
draw.line([l, t+TEXTSIZE+2, l+textlen, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
draw.line([l, t, l, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
draw.line([l+textlen, t, l+textlen, t+TEXTSIZE+2], fill='#777777', width=LINEWIDTH)
#imgmaps[maparea] = []
# Draw scale bar
m100 = int(100 / (m[R] - m[L]) * img.size[0])
draw.line([10, TEXTSIZE*3, 10, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
draw.line([10, TEXTSIZE*2, 10+m100, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
draw.line([10+m100, TEXTSIZE * 3, 10+m100, TEXTSIZE*2], fill='#000000', width=LINEWIDTH)
label = "100m"
draw.text([10 + (m100 - draw.textsize(label)[0]) / 2, TEXTSIZE/2], label, fill='#000000')
plot("laser.0_7", "BNase", "Reference", "Br&auml;uning Nase laser point", name, draw, img)
plot("226-96", "BZkn", "Reference", "Br&auml;uning Zinken trig point", name, draw, img)
plot("vd1","VD1","Reference", "VD1 survey point", name, draw, img)
plot("laser.kt114_96","HSK","Reference", "Hinterer Schwarzmooskogel trig point", name, draw, img)
plot("2000","Nipple","Reference", "Nipple (Wei&szlig;e Warze)", name, draw, img)
plot("3000","VSK","Reference", "Vorderer Schwarzmooskogel summit", name, draw, img)
plot("topcamp", "TC", "Reference", "Top Camp", name, draw, img)
plot("laser.0", "LSR0", "Reference", "Laser Point 0", name, draw, img)
plot("laser.0_1", "LSR1", "Reference", "Laser Point 0/1", name, draw, img)
plot("laser.0_3", "LSR3", "Reference", "Laser Point 0/3", name, draw, img)
plot("laser.0_5", "LSR5", "Reference", "Laser Point 0/5", name, draw, img)
plot("225-96", "BAlm", "Reference", "Br&auml;uning Alm trig point", name, draw, img)
for entrance in Entrance.objects.all():
station = entrance.best_station()
if station:
#try:
areaName = entrance.caveandentrance_set.all()[0].cave.getArea().short_name
plot(station, "%s-%s" % (areaName, str(entrance)[5:]), entrance.needs_surface_work(), str(entrance), name, draw, img)
#except:
# pass
for (N, E, D, num) in [(35975.37, 83018.21, 100,"177"), # Calculated from bearings
(35350.00, 81630.00, 50, "71"), # From Auer map
(36025.00, 82475.00, 50, "146"), # From mystery map
(35600.00, 82050.00, 50, "35"), # From Auer map
(35650.00, 82025.00, 50, "44"), # From Auer map
(36200.00, 82925.00, 50, "178"), # Calculated from bearings
(35232.64, 82910.37, 25, "181"), # Calculated from bearings
(35323.60, 81357.83, 50, "74") # From Auer map
]:
(N,E,D) = map(float, (N, E, D))
maparea = Cave.objects.get(kataster_number = num).getArea().short_name
lo = mungecoord(N-D, E+D, name, img)
hi = mungecoord(N+D, E-D, name, img)
lpos = mungecoord(N-D, E, name, img)
draw.ellipse([lo,hi], outline="#000000")
draw.ellipse([lo[0]+1, lo[1]+1, hi[0]-1, hi[1]-1], outline=areacolours[maparea])
draw.ellipse([lo[0]+2, lo[1]+2, hi[0]-2, hi[1]-2], outline=areacolours[maparea])
draw.rectangle([lpos[0],lpos[1]-TEXTSIZE/2, lpos[0] + draw.textsize(name)[0], lpos[1]+TEXTSIZE/2], fill="#ffffff")
draw.text((lpos[0], lpos[1]-TEXTSIZE/2), num, fill="#000000")
response = HttpResponse(content_type = "image/png")
del draw
img.save(response, "PNG")
return response
STATIONS = {}
poslineregex = re.compile("^\(\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*),\s*([+-]?\d*\.\d*)\s*\)\s*([^\s]+)$")
def LoadPos():
call([settings.CAVERN, "--output=%s/all.3d" % settings.SURVEX_DATA, "%s/all.svx" % settings.SURVEX_DATA])
call([settings.THREEDTOPOS, '%sall.3d' % settings.SURVEX_DATA], cwd = settings.SURVEX_DATA)
posfile = open("%sall.pos" % settings.SURVEX_DATA)
posfile.readline()#Drop header
for line in posfile.readlines():
r = poslineregex.match(line)
if r:
x, y, z, name = r.groups()
STATIONS[name] = (x, y, z)

View File

@ -243,7 +243,8 @@ def identifycavedircontents(gcavedir):
else: else:
subsvx.append(nf) subsvx.append(nf)
else: else:
assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f) pass
#assert re.match(".*?(?:.3d|.log|.err|.txt|.tmp|.diff|.e?spec|~)$", f), (gcavedir, f)
subsvx.sort() subsvx.sort()
#assert primesvx, (gcavedir, subsvx) #assert primesvx, (gcavedir, subsvx)
if primesvx: if primesvx:

View File

@ -3,12 +3,12 @@ import sys
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'. 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
'NAME': 'troggle', # Or path to database file if using sqlite3. 'NAME' : 'troggle', # Or path to database file if using sqlite3.
'USER': 'expo', # Not used with sqlite3. 'USER' : 'expo', # Not used with sqlite3.
'PASSWORD': 'gosser', # Not used with sqlite3. 'PASSWORD' : 'gosser', # Not used with sqlite3.
'HOST': '', # Set to empty string for localhost. Not used with sqlite3. 'HOST' : '', # Set to empty string for localhost. Not used with sqlite3.
'PORT': '', # Set to empty string for default. Not used with sqlite3. 'PORT' : '', # Set to empty string for default. Not used with sqlite3.
} }
} }
@ -30,7 +30,7 @@ SURVEY_SCANS = REPOS_ROOT_PATH + 'expoimages/'
FILES = REPOS_ROOT_PATH + 'expoimages' FILES = REPOS_ROOT_PATH + 'expoimages'
PYTHON_PATH = REPOS_ROOT_PATH + 'hg/troggle/' PYTHON_PATH = REPOS_ROOT_PATH + 'troggle/'
#URL_ROOT = 'http://127.0.0.1:8000' #URL_ROOT = 'http://127.0.0.1:8000'
URL_ROOT = "http://expoweb/" URL_ROOT = "http://expoweb/"

View File

@ -52,8 +52,8 @@ SECRET_KEY = 'a#vaeozn0)uz_9t_%v5n#tj)m+%ace6b_0(^fj!355qki*v)j2'
# List of callables that know how to import templates from various sources. # List of callables that know how to import templates from various sources.
TEMPLATE_LOADERS = ( TEMPLATE_LOADERS = (
'django.template.loaders.filesystem.load_template_source', 'django.template.loaders.filesystem.Loader',
'django.template.loaders.app_directories.load_template_source', 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source', # 'django.template.loaders.eggs.load_template_source',
) )

View File

@ -46,13 +46,13 @@
<dt>Location</dt><dd>{{ ent.entrance.northing|safe }}, {{ ent.entrance.easting|safe }}, {{ ent.entrance.alt|safe }}m</dd> <dt>Location</dt><dd>{{ ent.entrance.northing|safe }}, {{ ent.entrance.easting|safe }}, {{ ent.entrance.alt|safe }}m</dd>
{% endif %} {% endif %}
{% if ent.entrance.tag_station %} {% if ent.entrance.tag_station %}
<dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }}{{ ent.entrance.tag.y|safe }}, {{ ent.entrance.tag.x|safe }}, {{ ent.entrance.tag.z|safe }}m</dd> <dt>Tag Location</dt><dd>{{ ent.entrance.tag_station }} {{ ent.entrance.tag.y|safe }}, {{ ent.entrance.tag.x|safe }}, {{ ent.entrance.tag.z|safe }}m</dd>
{% endif %} {% endif %}
{% if ent.entrance.bearings %} {% if ent.entrance.bearings %}
<dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd> <dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd>
{% endif %} {% endif %}
{% if ent.entrance.exact_station %} {% if ent.entrance.exact_station %}
<dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }} {{ ent.exact_location.tag.y|safe }}, {{ ent.entrance.exact_location.x|safe }}, {{ ent.entrance.exact_location.z|safe }}m</dd> <dt>Exact Station</dt><dd>{{ ent.entrance.exact_station|safe }} {{ ent.entrance.exact_location.y|safe }}, {{ ent.entrance.exact_location.x|safe }}, {{ ent.entrance.exact_location.z|safe }}m</dd>
{% endif %} {% endif %}
{% if ent.entrance.other_station %} {% if ent.entrance.other_station %}
<dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }} <dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }}

View File

@ -11,18 +11,18 @@
<li>For more info on each cave, see the links to detailed description pages.</li> <li>For more info on each cave, see the links to detailed description pages.</li>
</ul> </ul>
{% for name, area in areas %} {% for name, area, caves in areas %}
<h2>{{name|safe}}</h2> <h2>{{name|safe}}</h2>
<table border=\"1\" width="100%"> <table border="1" width="100%">
<col><col><col><col><col><col><col><col><col width="45%"> <col><col><col><col><col><col><col><col><col>
<thead> <thead>
<tr><th>Cave Number</th><th>Name</th><th>Finished</th><th>Survey<br>Data</th><th>Survey<br>Drawn</th><th>Marked</th><th>Photo</th><th>Position</th><th>Location</th></tr> <tr><th>Cave Number</th><th>Name</th><th>Finished</th><th>Survey<br>Data</th><th>Survey<br>Drawn</th><th>Marked</th><th>Photo</th><th>Position</th></tr>
</thead> </thead>
<tbody> <tbody>
{% for cave in area.cave_set.all %} {% for cave in caves %}
{% if cave.singleentrance %} {% if cave.singleentrance %}
<tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}> <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
<td>{{ cave }}</td> <td><a href="/{{ cave.url }}">{{ cave }}</a></td>
<td>{{ cave.official_name|safe }}</td> <td>{{ cave.official_name|safe }}</td>
<td>{{ cave.kataster_code }}</td> <td>{{ cave.kataster_code }}</td>
<td>{{ cave.hassurveydata }}</td> <td>{{ cave.hassurveydata }}</td>
@ -30,13 +30,32 @@
<td>{{ cave.caveandentrance_set.all.0.entrance.marking_val }}</td> <td>{{ cave.caveandentrance_set.all.0.entrance.marking_val }}</td>
<td>{{ cave.caveandentrance_set.all.0.entrance.has_photo }} </td> <td>{{ cave.caveandentrance_set.all.0.entrance.has_photo }} </td>
<td>{{ cave.caveandentrance_set.all.0.entrance.find_location }}</td> <td>{{ cave.caveandentrance_set.all.0.entrance.find_location }}</td>
<td>{% if cave.caveandentrance_set.all.0.entrance.location_description %}Location: {{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.map_description %}Map: {{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.approach %}Approach: {{ cave.caveandentrance_set.all.0.entrance.approach|safe }}{% endif %}</td>
</tr> </tr>
{% if cave.caveandentrance_set.all.0.entrance.location_description %}
<tr><th>Location</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.map_description %}
<tr><th>Map</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.approach %}
<tr><th>Approach</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.approach|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.findability_description %}
<tr><th>Findability</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.findability_description|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.marking_comment %}
<tr><th>Marking</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.marking_comment|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.entrance_description %}
<tr><th>Ent Desc</th><td colspan="9">{{ cave.caveandentrance_set.all.0.entrance.entrance_description|safe }}</td></tr>
{% endif %}
{% if cave.underground_description %}
<tr><th>Under Desc</th><td colspan="9">{{ cave.underground_description|truncatewords_html:80 }}</td></tr>
{% endif %}
{% else %} {% else %}
<tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}> <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
<td>{{ cave }}</td> <td><a href="/{{ cave.url }}">{{ cave }}</a></td>
<td>{{ cave.official_name|safe }}</td> <td>{{ cave.official_name|safe }}</td>
<td>{{ cave.kataster_code }}</td> <td>{{ cave.kataster_code }}</td>
<td>{{ cave.hassurveydata }}</td> <td>{{ cave.hassurveydata }}</td>
@ -46,9 +65,12 @@
<td></td> <td></td>
<td></td> <td></td>
</tr> </tr>
{% if cave.underground_description %}
<tr><th>Under Desc</th><td colspan="9">{{ cave.underground_description|truncatewords_html:80 }}</td></tr>
{% endif %}
{% for caveandentrance in cave.caveandentrance_set.all %} {% for caveandentrance in cave.caveandentrance_set.all %}
<tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}> <tr{% if cave.ours %} class="ours"{% else %} class="notours"{% endif %}>
<td>{{ caveandentrance.entrance_letter}}</td> <td><a href="/{{ cave.url }}">{{ caveandentrance.entrance_letter}}</a></td>
<td>{{ caveandentrance.entrance.name|safe }}</td> <td>{{ caveandentrance.entrance.name|safe }}</td>
<td></td> <td></td>
<td></td> <td></td>
@ -56,10 +78,26 @@
<td>{{ caveandentrance.entrance.marking_val }}</td> <td>{{ caveandentrance.entrance.marking_val }}</td>
<td>{{ caveandentrance.entrance.has_photo }} </td> <td>{{ caveandentrance.entrance.has_photo }} </td>
<td>{{ caveandentrance.entrance.find_location|safe }}</td> <td>{{ caveandentrance.entrance.find_location|safe }}</td>
<td>{% if cave.caveandentrance_set.all.0.entrance.location_description %}Location: {{ cave.caveandentrance_set.all.0.entrance.location_description|safe }}{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.map_description %}Map: {{ cave.caveandentrance_set.all.0.entrance.map_description|safe }}{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.approach %}Approach: {{ cave.caveandentrance_set.all.0.entrance.approach|safe }}{% endif %}</td>
</tr> </tr>
<tr>
{% if caveandentrance.entrance.location_description %}
<tr><td>Location</td><td colspan="9">{{ caveandentrance.entrance.location_description|safe }}</td></tr>
{% endif %}
{% if caveandentrance.entrance.map_description %}
<tr><td>Map</td><td colspan="9">{{ caveandentrance.entrance.map_description|safe }}</td></tr>
{% endif %}
{% if caveandentrance.entrance.approach %}
<tr><td>Approach</td><td colspan="9">{{ caveandentrance.entrance.approach|safe }}</td></tr>
{% endif %}
{% if caveandentrance.entrance.findability_description %}
<tr><th>Findability</th><td colspan="9">{{ caveandentrance.entrance.findability_description|safe }}</td></tr>
{% endif %}
{% if caveandentrance.entrance.marking_comment %}
<tr><th>Marking</th><td colspan="9">{{ caveandentrance.entrance.marking_comment|safe }}</td></tr>
{% endif %}
{% if cave.caveandentrance_set.all.0.entrance.entrance_description %}
<tr><th>Ent Desc</th><td colspan="9">{{ caveandentrance.entrance.entrance_description|safe }}</td></tr>
{% endif %}
{% endfor %} {% endfor %}
{% endif %} {% endif %}
{% endfor %} {% endfor %}

View File

@ -140,6 +140,8 @@ actualurlpatterns = patterns('',
(r'^photos/(?P<path>.*)$', 'django.views.static.serve', (r'^photos/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),
url(r'^prospecting/(?P<name>[^.]+).png$', prospecting_image, name="prospecting_image"),
# (r'^gallery/(?P<path>.*)$', 'django.views.static.serve', # (r'^gallery/(?P<path>.*)$', 'django.views.static.serve',
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}), # {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),