summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorexpo <expo@expobox.potato.hut>2013-08-01 17:00:01 +0200
committerexpo <expo@expobox.potato.hut>2013-08-01 17:00:01 +0200
commitdf8618d0f0c7df09a90ecad9ef7885ee4da39e01 (patch)
tree4410fef6482a3c913386d2bef909d3688ddc52ad
parent64f4e122a519ed1a1c3b462f20a41af555a42cec (diff)
downloadtroggle-df8618d0f0c7df09a90ecad9ef7885ee4da39e01.tar.gz
troggle-df8618d0f0c7df09a90ecad9ef7885ee4da39e01.tar.bz2
troggle-df8618d0f0c7df09a90ecad9ef7885ee4da39e01.zip
Prospecting guide and images and few minor other things.
-rw-r--r--.hgignore1
-rw-r--r--core/admin.py1
-rw-r--r--core/imageposcalc.odsbin0 -> 11110 bytes
-rw-r--r--core/models.py70
-rw-r--r--core/views_caves.py233
-rw-r--r--core/views_survex.py5
-rw-r--r--localsettingsubuntu.py16
-rw-r--r--settings.py4
-rw-r--r--templates/cave_entrances.html4
-rw-r--r--templates/prospecting.html68
-rw-r--r--urls.py2
11 files changed, 354 insertions, 50 deletions
diff --git a/.hgignore b/.hgignore
index ad091eb..cb29426 100644
--- a/.hgignore
+++ b/.hgignore
@@ -6,3 +6,4 @@ db*
localsettings.py
*~
parsing_log.txt
+troggle
diff --git a/core/admin.py b/core/admin.py
index 0192807..0c8b605 100644
--- a/core/admin.py
+++ b/core/admin.py
@@ -120,6 +120,7 @@ admin.site.register(LogbookEntry, LogbookEntryAdmin)
admin.site.register(QM, QMAdmin)
admin.site.register(Survey, SurveyAdmin)
admin.site.register(ScannedImage)
+admin.site.register(SurvexStation)
admin.site.register(SurvexScansFolder)
admin.site.register(SurvexScanSingle)
diff --git a/core/imageposcalc.ods b/core/imageposcalc.ods
new file mode 100644
index 0000000..0cc2135
--- /dev/null
+++ b/core/imageposcalc.ods
Binary files differ
diff --git a/core/models.py b/core/models.py
index e064814..a3bd832 100644
--- a/core/models.py
+++ b/core/models.py
@@ -249,7 +249,7 @@ class LogbookEntry(TroggleModel):
filename = models.CharField(max_length=200,null=True)
class Meta:
- verbose_name_plural = "Logbook Entries"
+ verbose_name_plural = "Logbook Entries"
# several PersonTrips point in to this object
ordering = ('-date',)
@@ -397,11 +397,14 @@ class Cave(TroggleModel):
#href = models.CharField(max_length=100)
+
+ class Meta:
+ ordering = ('kataster_code', 'unofficial_number')
def hassurvey(self):
if not self.underground_centre_line:
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 "Missing"
@@ -501,8 +504,17 @@ class Cave(TroggleModel):
u8 = u.encode("utf-8")
f.write(u8)
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):
areaname, code = reference.split("-", 1)
@@ -539,7 +551,7 @@ class Entrance(TroggleModel):
('P?', 'Paint (?)'),
('T', 'Tag'),
('T?', 'Tag (?)'),
- ('R', 'Retagged'),
+ ('R', 'Needs Retag'),
('S', 'Spit'),
('S?', 'Spit (?)'),
('U', 'Unmarked'),
@@ -548,7 +560,7 @@ class Entrance(TroggleModel):
marking_comment = models.TextField(blank=True,null=True)
FINDABLE_CHOICES = (
('?', 'To be confirmed ...'),
- ('S', 'Surveyed'),
+ ('S', 'Coordinates'),
('L', 'Lost'),
('R', 'Refindable'))
findability = models.CharField(max_length=1, choices=FINDABLE_CHOICES, blank=True, null=True)
@@ -575,21 +587,46 @@ class Entrance(TroggleModel):
def find_location(self):
+ r = {'': 'To be entered ',
+ '?': 'To be confirmed:',
+ 'S': '',
+ 'L': 'Lost:',
+ 'R': 'Refindable:'}[self.findability]
+ if self.tag_station:
+ try:
+ s = SurvexStation.objects.lookup(self.tag_station)
+ 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:
+ try:
+ s = SurvexStation.objects.lookup(self.exact_station)
+ 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:
+ try:
+ s = SurvexStation.objects.lookup(self.other_station)
+ 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:
+ return r + self.bearings
+ return r
+
+ def best_station(self):
if self.tag_station:
- s = SurvexStation.objects.lookup(self.tag_station)
- return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+ return self.tag_station
if self.exact_station:
- s = SurvexStation.objects.lookup(self.exact_station)
- return "%0.0fE %0.0fN %0.0fAlt" % (s.x, s.y, s.z)
+ return self.exact_station
if 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)
- if self.bearings:
- return self.bearings
+ return self.other_station
def has_photo(self):
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"
else:
return "Missing"
@@ -607,6 +644,9 @@ class Entrance(TroggleModel):
def tag(self):
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):
diff --git a/core/views_caves.py b/core/views_caves.py
index 16dbaac..7a266b5 100644
--- a/core/views_caves.py
+++ b/core/views_caves.py
@@ -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
import troggle.core.models as models
import troggle.settings as settings
@@ -8,10 +11,13 @@ from django.forms.models import modelformset_factory
from django import forms
from django.core.urlresolvers import reverse
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
import re, urlparse
from django.shortcuts import get_object_or_404
+import settings
+
+import Image, ImageDraw, ImageFont, string, os, sys
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."""
@@ -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()]})
areanames = [
- #('', 'Location unclear'),
+ ('', 'Location unclear'),
('1a', '1a &ndash; Plateau: around Top Camp'),
('1b', '1b &ndash; Western plateau near 182'),
('1c', '1c &ndash; Eastern plateau near 204 walk-in path'),
('1d', '1d &ndash; Further plateau around 76'),
('2a', '2a &ndash; Southern Schwarzmooskogel near 201 path and the Nipple'),
('2b', '2b &ndash; Eish&ouml;hle area'),
+ ('2b or 4 (unclear)', '2b or 4 (unclear)'),
('2c', '2c &ndash; Kaninchenh&ouml;hle area'),
('2d', '2d &ndash; Steinbr&uuml;ckenh&ouml;hle area'),
('3', '3 &ndash; Br&auml;uning Alm'),
('4', '4 &ndash; Kratzer valley'),
('5', '5 &ndash; Schwarzmoos-Wildensee'),
('6', '6 &ndash; Far plateau'),
+ ('1626 or 6 (borderline)', '1626 or 6 (borderline)'),
('7', '7 &ndash; Egglgrube'),
('8a', '8a &ndash; Loser south face'),
('8b', '8b &ndash; Loser below Dimmelwand'),
@@ -274,8 +282,221 @@ areanames = [
def prospecting(request):
+ #for key, name in areanames:
+ # print key, Area.objects.get(short_name = key)
+ areas = []
for key, name in areanames:
- print key, Area.objects.get(short_name = key)
- areas = [ (name, Area.objects.get(short_name = key)) for key, name in areanames ]
- return render_with_context(request,'prospecting.html', {"areas": areas})
+ a = Area.objects.get(short_name = key)
+ caves = list(a.cave_set.all())
+ 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)
diff --git a/core/views_survex.py b/core/views_survex.py
index cf3b556..3c53625 100644
--- a/core/views_survex.py
+++ b/core/views_survex.py
@@ -243,7 +243,8 @@ def identifycavedircontents(gcavedir):
else:
subsvx.append(nf)
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()
#assert primesvx, (gcavedir, subsvx)
if primesvx:
@@ -317,4 +318,4 @@ def survexcavesingle(request, survex_cave):
- \ No newline at end of file
+
diff --git a/localsettingsubuntu.py b/localsettingsubuntu.py
index 5a1f944..fcc8a73 100644
--- a/localsettingsubuntu.py
+++ b/localsettingsubuntu.py
@@ -2,13 +2,13 @@ import sys
# link localsettings to this file for use on expo computer in austria
DATABASES = {
- 'default': {
- 'ENGINE': 'django.db.backends.mysql', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
- 'NAME': 'troggle', # Or path to database file if using sqlite3.
- 'USER': 'expo', # Not used with sqlite3.
- 'PASSWORD': 'gosser', # 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.
+ 'default': {
+ 'ENGINE': 'django.db.backends.mysql', # 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
+ 'NAME' : 'troggle', # Or path to database file if using sqlite3.
+ 'USER' : 'expo', # Not used with sqlite3.
+ 'PASSWORD' : 'gosser', # 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.
}
}
@@ -30,7 +30,7 @@ SURVEY_SCANS = 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://expoweb/"
diff --git a/settings.py b/settings.py
index 47d48ae..0032c2a 100644
--- a/settings.py
+++ b/settings.py
@@ -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.
TEMPLATE_LOADERS = (
- 'django.template.loaders.filesystem.load_template_source',
- 'django.template.loaders.app_directories.load_template_source',
+ 'django.template.loaders.filesystem.Loader',
+ 'django.template.loaders.app_directories.Loader',
# 'django.template.loaders.eggs.load_template_source',
)
diff --git a/templates/cave_entrances.html b/templates/cave_entrances.html
index 3a75a02..5b70196 100644
--- a/templates/cave_entrances.html
+++ b/templates/cave_entrances.html
@@ -46,13 +46,13 @@
<dt>Location</dt><dd>{{ ent.entrance.northing|safe }}, {{ ent.entrance.easting|safe }}, {{ ent.entrance.alt|safe }}m</dd>
{% endif %}
{% 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 %}
{% if ent.entrance.bearings %}
<dt>Bearings</dt><dd>{{ ent.entrance.bearings|safe }}</dd>
{% endif %}
{% 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 %}
{% if ent.entrance.other_station %}
<dt>Other Station</dt><dd>{{ ent.entrance.other_station|safe }}
diff --git a/templates/prospecting.html b/templates/prospecting.html
index 0d7a0d6..a2ab512 100644
--- a/templates/prospecting.html
+++ b/templates/prospecting.html
@@ -11,18 +11,18 @@
<li>For more info on each cave, see the links to detailed description pages.</li>
</ul>
-{% for name, area in areas %}
+{% for name, area, caves in areas %}
<h2>{{name|safe}}</h2>
- <table border=\"1\" width="100%">
- <col><col><col><col><col><col><col><col><col width="45%">
+ <table border="1" width="100%">
+ <col><col><col><col><col><col><col><col><col>
<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>
<tbody>
- {% for cave in area.cave_set.all %}
+ {% for cave in caves %}
{% if cave.singleentrance %}
<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.kataster_code }}</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.has_photo }} </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>
+ {% 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 %}
<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.kataster_code }}</td>
<td>{{ cave.hassurveydata }}</td>
@@ -46,20 +65,39 @@
<td></td>
<td></td>
</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 %}
<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></td>
<td></td>
<td></td>
<td>{{ caveandentrance.entrance.marking_val }}</td>
<td>{{ caveandentrance.entrance.has_photo }} </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>
+ <td>{{ caveandentrance.entrance.find_location|safe }}</td>
</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 %}
{% endif %}
{% endfor %}
diff --git a/urls.py b/urls.py
index 106195d..fb2f698 100644
--- a/urls.py
+++ b/urls.py
@@ -139,6 +139,8 @@ actualurlpatterns = patterns('',
(r'^photos/(?P<path>.*)$', 'django.views.static.serve',
{'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',
# {'document_root': settings.PHOTOS_ROOT, 'show_indexes':True}),