2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 15:21:52 +00:00

Removed conversion to wiki, replaced Surveystation models with text, added area 1623 to all relevant caves.

This commit is contained in:
Martin Green 2011-07-11 00:15:59 +01:00
parent 8578a3097a
commit 65c55f0f21
10 changed files with 237 additions and 110 deletions

View File

@ -7,6 +7,8 @@ from django.core import management
from django.db import connection from django.db import connection
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.http import HttpResponse from django.http import HttpResponse
from django.core.urlresolvers import reverse
import flatpages.models
@ -59,6 +61,7 @@ def import_logbooks():
def import_survex(): def import_survex():
import parsers.survex import parsers.survex
parsers.survex.LoadAllSurvexBlocks() parsers.survex.LoadAllSurvexBlocks()
parsers.survex.LoadPos()
def import_QMs(): def import_QMs():
import parsers.QMs import parsers.QMs
@ -91,6 +94,7 @@ def reset():
""" """
reload_db() reload_db()
make_dirs() make_dirs()
pageredirects()
import_cavetab() import_cavetab()
import_people() import_people()
import_surveyscans() import_surveyscans()
@ -98,7 +102,8 @@ def reset():
import_logbooks() import_logbooks()
import_QMs() import_QMs()
import_tunnelfiles() import_tunnelfiles()
#import_surveys()
import_surveys()
import_descriptions() import_descriptions()
parse_descriptions() parse_descriptions()
@ -170,6 +175,11 @@ def dumplogbooks():
f.write(unicode(output).encode( "utf-8" )) f.write(unicode(output).encode( "utf-8" ))
f.close() f.close()
def pageredirects():
for oldURL, newURL in [("indxal.htm", reverse("caveindex"))]:
f = flatpages.models.Redirect(originalURL = oldURL, newURL = newURL)
f.save()
if __name__ == "__main__": if __name__ == "__main__":
import core.models import core.models
import sys import sys
@ -177,6 +187,11 @@ if __name__ == "__main__":
resetdesc() resetdesc()
elif "scans" in sys.argv: elif "scans" in sys.argv:
import_surveyscans() import_surveyscans()
elif "caves" in sys.argv:
reload_db()
make_dirs()
pageredirects()
import_cavetab()
elif "QMs" in sys.argv: elif "QMs" in sys.argv:
import_QMs() import_QMs()
elif "tunnel" in sys.argv: elif "tunnel" in sys.argv:

View File

@ -3,7 +3,8 @@ import troggle.core.models as models
from django.conf import settings from django.conf import settings
import csv, time, re, os, logging import csv, time, re, os, logging
from utils import save_carefully from utils import save_carefully
from utils import html_to_wiki from django.core.urlresolvers import reverse
import flatpages.models
##format of CAVETAB2.CSV is ##format of CAVETAB2.CSV is
KatasterNumber = 0 KatasterNumber = 0
@ -54,6 +55,7 @@ Findability = 44
FindabilityComment = 45 FindabilityComment = 45
def LoadCaveTab(): def LoadCaveTab():
cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU') cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU')
caveReader = csv.reader(cavetab) caveReader = csv.reader(cavetab)
caveReader.next() # Strip out column headers caveReader.next() # Strip out column headers
@ -79,11 +81,11 @@ def LoadCaveTab():
def addToArgs(CSVname, modelName): def addToArgs(CSVname, modelName):
if line[CSVname]: if line[CSVname]:
args[modelName] = html_to_wiki(line[CSVname]) args[modelName] = line[CSVname]
def addToDefaultArgs(CSVname, modelName): #This has to do with the non-destructive import. These arguments will be passed as the "default" dictionary in a get_or_create def addToDefaultArgs(CSVname, modelName): #This has to do with the non-destructive import. These arguments will be passed as the "default" dictionary in a get_or_create
if line[CSVname]: if line[CSVname]:
defaultArgs[modelName] = html_to_wiki(line[CSVname]) defaultArgs[modelName] = line[CSVname]
# The attributes added using "addToArgs" will be used to look up an existing cave. Those added using "addToDefaultArgs" will not. # The attributes added using "addToArgs" will be used to look up an existing cave. Those added using "addToDefaultArgs" will not.
addToArgs(KatasterNumber, "kataster_number") addToArgs(KatasterNumber, "kataster_number")
@ -103,6 +105,7 @@ def LoadCaveTab():
addToDefaultArgs(Extent, "extent") addToDefaultArgs(Extent, "extent")
addToDefaultArgs(SurvexFile, "survex_file") addToDefaultArgs(SurvexFile, "survex_file")
addToDefaultArgs(Notes, "notes") addToDefaultArgs(Notes, "notes")
addToDefaultArgs(AutogenFile, "url")
if line[Area] == "1626": if line[Area] == "1626":
if line[KatasterNumber] != "": if line[KatasterNumber] != "":
args["slug"] = line[Area] + "-" + line[KatasterNumber] args["slug"] = line[Area] + "-" + line[KatasterNumber]
@ -140,6 +143,7 @@ def LoadCaveTab():
newArea = models.Area(short_name = line[Area], parent = area1623) newArea = models.Area(short_name = line[Area], parent = area1623)
newArea.save() newArea.save()
newCave.area.add(newArea) newCave.area.add(newArea)
newCave.area.add(area1623)
elif created: elif created:
newCave.area.add(area1623) newCave.area.add(area1623)
@ -153,6 +157,7 @@ def LoadCaveTab():
logging.info("Added unofficial name "+str(newUnofficialName)+" to cave "+str(newCave)+"\n") logging.info("Added unofficial name "+str(newUnofficialName)+" to cave "+str(newCave)+"\n")
if created and line[MultipleEntrances] == '' or \ if created and line[MultipleEntrances] == '' or \
line[MultipleEntrances] == 'entrance' or \ line[MultipleEntrances] == 'entrance' or \
line[MultipleEntrances] == 'last entrance': line[MultipleEntrances] == 'last entrance':
@ -165,10 +170,10 @@ def LoadCaveTab():
def addToArgs(CSVname, modelName): def addToArgs(CSVname, modelName):
if line[CSVname]: if line[CSVname]:
args[modelName] = html_to_wiki(line[CSVname]) args[modelName] = line[CSVname]
def addToArgsViaDict(CSVname, modelName, dictionary): def addToArgsViaDict(CSVname, modelName, dictionary):
if line[CSVname]: if line[CSVname]:
args[modelName] = dictionary[html_to_wiki(line[CSVname])] args[modelName] = dictionary[line[CSVname]]
addToArgs(EntranceName, 'name') addToArgs(EntranceName, 'name')
addToArgs(Explorers, 'explorers') addToArgs(Explorers, 'explorers')
addToArgs(Map, 'map_description') addToArgs(Map, 'map_description')
@ -188,6 +193,7 @@ def LoadCaveTab():
"Unmarked": "U", "Unmarked": "U",
"": "?", "": "?",
}) })
addToArgs(MarkingComment, 'marking_comment') addToArgs(MarkingComment, 'marking_comment')
addToArgsViaDict(Findability, 'findability', {"Surveyed": "S", addToArgsViaDict(Findability, 'findability', {"Surveyed": "S",
"Lost": "L", "Lost": "L",
@ -200,20 +206,15 @@ def LoadCaveTab():
addToArgs(Northing, 'northing') addToArgs(Northing, 'northing')
addToArgs(Altitude, 'alt') addToArgs(Altitude, 'alt')
addToArgs(DescriptionOfOtherPoint, 'other_description') addToArgs(DescriptionOfOtherPoint, 'other_description')
def addToArgsSurveyStation(CSVname, modelName): addToArgs(TagPoint, 'tag_station')
if line[CSVname]: addToArgs(ExactEntrance, 'exact_station')
surveyPoint = models.SurveyStation(name = line[CSVname]) addToArgs(OtherPoint, 'other_station')
surveyPoint.save()
args[modelName] = surveyPoint
addToArgsSurveyStation(TagPoint, 'tag_station')
addToArgsSurveyStation(ExactEntrance, 'exact_station')
addToArgsSurveyStation(OtherPoint, 'other_station')
addToArgs(OtherPoint, 'other_description') addToArgs(OtherPoint, 'other_description')
if line[GPSpreSA]: if line[GPSpreSA]:
addToArgsSurveyStation(GPSpreSA, 'other_station') addToArgs(GPSpreSA, 'other_station')
args['other_description'] = 'pre selective availability GPS' args['other_description'] = 'pre selective availability GPS'
if line[GPSpostSA]: if line[GPSpostSA]:
addToArgsSurveyStation(GPSpostSA, 'other_station') addToArgs(GPSpostSA, 'other_station')
args['other_description'] = 'post selective availability GPS' args['other_description'] = 'post selective availability GPS'
addToArgs(Bearings, 'bearings') addToArgs(Bearings, 'bearings')
args['slug'] = newCave.slug + entrance_letter args['slug'] = newCave.slug + entrance_letter
@ -227,6 +228,8 @@ def LoadCaveTab():
newCaveAndEntrance.save() newCaveAndEntrance.save()
logging.info("Added CaveAndEntrance "+str(newCaveAndEntrance)+"\n") logging.info("Added CaveAndEntrance "+str(newCaveAndEntrance)+"\n")
f = flatpages.models.EntranceRedirect(originalURL = line[AutogenFile], entrance = newEntrance)
f.save()
# lookup function modelled on GetPersonExpeditionNameLookup # lookup function modelled on GetPersonExpeditionNameLookup

View File

@ -92,6 +92,7 @@ INSTALLED_APPS = (
'troggle.registration', 'troggle.registration',
'troggle.profiles', 'troggle.profiles',
'troggle.core', 'troggle.core',
'troggle.flatpages',
'troggle.imagekit', 'troggle.imagekit',
) )

View File

@ -1,7 +1,7 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html lang="en"> <html lang="en">
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/main3.css" title="eyeCandy"/> <link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/main3.css" title="eyeCandy"/>
<link rel="alternate stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/mainplain.css" title="plain"/> <link rel="alternate stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/mainplain.css" title="plain"/>
<link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/dropdownNavStyle.css" /> <link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/dropdownNavStyle.css" />

View File

@ -1,10 +1,92 @@
{% extends "cavebase.html" %} {% extends "cavebase.html" %}
{% load wiki_markup %}
{% block editLink %}| <a href={{cave.get_admin_url}}>Edit cave {{cave|wiki_to_html_short}}</a>{% endblock %}
{% block content %}
{% block contentheader %}
<table id="cavepage">
<tr>
<th id="kat_no">
{% if cave.kataster_number %}
{{ cave.kataster_number|safe }}
{% if cave.entrancelist %}
- {{ cave.entrancelist|safe }}
{% endif %}
{% if cave.unofficial_number %}
<br />({{ cave.unofficial_number|safe }})
{% endif %}
{% endif %}
</th>
<th id="name">
{{ cave.official_name|safe }}
</th>
<th id="status">
{{ cave.kataster_code|safe }}
</th>
</tr>
</table>
{% block related %} {% block related %}
<h2>All logbook entries regarding this cave ({{cave.logbookentry_set.count}})</h2> {% endblock %}{% endblock %}
<table>
<div id="tabs">
<ul>
<li><a href="#entrances">Entrances</a></li>
<li><a href="#cave">Cave</a></li>
<li><a href="#logbook">Logbook</a></li>
<li><a href="#qms">QMs</a></li>
</ul>
<div id="entrances">
<p>{% if cave.entrances %}
<h2>Entrances</h2>
{% for ent in cave.entrances %}
<a href = "./{{ ent.entrance_letter|safe }}">{{ ent.entrance_letter|safe }}</a>
{% if ent.entrance.marking %}
Marking: {{ ent.entrance.marking_val|safe }}
{% endif %}
<br>
{% endfor %}
{% endif %}</p>
</div>
<div id="cave">
<p>{% if cave.explorers %}
<h2>Explorers</h2>
{{ cave.explorers|safe }}
{% endif %}
{% if cave.underground_description %}
<h2>Underground Description</h2>
{{ cave.underground_description|safe }}
{% endif %}
{% if cave.equipment %}
<h2>Equipment</h2>
{{ cave.equipment|safe }}
{% endif %}
{% if cave.references %}
<h2>References</h2>
{{ cave.references|safe }}
{% endif %}
{% if cave.survey %}
<h2>Survey</h2>
{{ cave.survey|safe }}
{% endif %}
{% if cave.kataster_status %}
<h2>Kataster_status</h2>
{{ cave.kataster_status|safe }}
{% endif %}
{% if cave.underground_centre_line %}
<h2>Underground Centre Line</h2>
{{ cave.underground_centre_line|safe }}
{% endif %}
{% if cave.survex_file %}
<h2>Survex File</h2>
{{ cave.survex_file|safe }}
{% endif %}
{% if cave.notes %}
<h2>Notes</h2>
{{ cave.notes|safe }}
{% endif %}</p>
</div>
<div id="logbook">
<p>
<table>
{% for logbookentry in cave.logbookentry_set.all %} {% for logbookentry in cave.logbookentry_set.all %}
{% if logbookentry.title %} {% if logbookentry.title %}
<tr> <tr>
@ -14,59 +96,10 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</table> </table>
{% endblock %} </p>
</div>
{% block content %} <div id="qms">
<p>{% if cave.get_QMs %}
{% if cave.entrances %}
<h2>Entrances</h2>
{% for ent in cave.entrances %}
<a href = "./{{ ent.entrance_letter|wiki_to_html_short }}">{{ ent.entrance_letter|wiki_to_html_short }}</a>
{% if ent.entrance.marking %}
Marking: {{ ent.entrance.marking_val|wiki_to_html_short }}
{% endif %}
<br>
{% endfor %}
{% endif %}
{% if cave.explorers %}
<h2>Explorers</h2>
{{ cave.explorers|wiki_to_html }}
{% endif %}
{% if cave.underground_description %}
<h2>Underground Description</h2>
{{ cave.underground_description|wiki_to_html }}
{% endif %}
{% if cave.equipment %}
<h2>Equipment</h2>
{{ cave.equipment|wiki_to_html }}
{% endif %}
{% if cave.references %}
<h2>References</h2>
{{ cave.references|wiki_to_html }}
{% endif %}
{% if cave.survey %}
<h2>Survey</h2>
{{ cave.survey|wiki_to_html }}
{% endif %}
{% if cave.kataster_status %}
<h2>Kataster_status</h2>
{{ cave.kataster_status|wiki_to_html }}
{% endif %}
{% if cave.underground_centre_line %}
<h2>Underground Centre Line</h2>
{{ cave.underground_centre_line|wiki_to_html }}
{% endif %}
{% if cave.survex_file %}
<h2>Survex File</h2>
{{ cave.survex_file|wiki_to_html }}
{% endif %}
{% if cave.notes %}
<h2>Notes</h2>
{{ cave.notes|wiki_to_html }}
{% endif %}
{% if cave.get_QMs %}
<h2>Question marks</h2> <h2>Question marks</h2>
<h3>Extant</h3> <h3>Extant</h3>
<ul id="cavelist"> <ul id="cavelist">
@ -85,5 +118,9 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
</ul> </ul>
{% endif %} {% endif %}</p>
</div>
</div>
{% endblock %} {% endblock %}

View File

@ -1,28 +1,26 @@
{% extends "base.html" %} <html>
{% load wiki_markup %} <head>
{% block title %}{{ cave.official_name|wiki_to_html_short }}{% endblock %} <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{% block title %}{{ cave.official_name|safe }}{% endblock %}
{% block contentheader %} </title>
<table id="cavepage"> <link rel="stylesheet" type="text/css" href="/css/main2.css" />
<tr> <link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/redmond/jquery-ui-1.8.14.custom.css" />
<th id="kat_no"> <script src="{{ settings.MEDIA_URL }}js/jquery.js" type="text/javascript"></script>
{% if cave.kataster_number %} <script src="{{ settings.MEDIA_URL }}js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
{{ cave.kataster_number|wiki_to_html_short }} <script type="text/javascript">
{% if cave.entrancelist %} $(function() {
- {{ cave.entrancelist|wiki_to_html_short }} $( "#tabs" ).tabs();
{% endif %} });
{% if cave.unofficial_number %} </script>
<br />({{ cave.unofficial_number|wiki_to_html_short }}) </head>
{% endif %} <body>
{% endif %} {% block content %}{% endblock %}
</th> {% block menu %}
<th id="name"> <ul id="links">
{{ cave.official_name|wiki_to_html_short }} <li>Back to <a href="/index.htm">Expedition home page</a></li>
</th> <li>Back to <a href="http://cucc.survex.com/">CUCC home page</a></li>
<th id="status"> </ul>
{{ cave.kataster_code|wiki_to_html_short }}
</th>
</tr>
</table>
{% endblock %} {% endblock %}
</body>
</html>

View File

@ -1,22 +1,36 @@
{% extends "base.html" %} {% extends "cavebase.html" %}
{% load wiki_markup %} {% load wiki_markup %}
{% block title %}Cave Index{% endblock %} {% block title %}Cave Index{% endblock %}
{% block content %} {% block content %}
<h1>Cave Index</h1>
<h3>Notable caves</h3> <h3>Notable caves</h3>
<ul> <ul>
{% for cave in notablecaves %} {% for cave in notablecaves %}
<li> <a href="{{ cave.get_absolute_url }}">{{cave.official_name|wiki_to_html_short}} ({{cave}})</a> </li> <li> <a href="{{ cave.get_absolute_url }}">{% if cave.kataster_number %}{{ cave.kataster_number }}{% else %}{{cave.unofficial_number }}{%endif %} {{cave.official_name|safe}}</a> </li>
{% endfor %} {% endfor %}
</ul> </ul>
<h3>All caves</h3> <h3>1623</h3>
<ul class="searchable"> <ul class="searchable">
{% for cave in caves %} {% for cave in caves1623 %}
<li> <a href="{{ cave.get_absolute_url }}">{{cave.official_name|wiki_to_html_short}} ({{cave}})</a> </li>
<li> <a href="{{ cave.get_absolute_url }}">{% if cave.kataster_number %}{{ cave.kataster_number }}{% else %}{{cave.unofficial_number }}{%endif %} {{cave.official_name|safe}}</a> </li>
{% endfor %}
</ul>
<h3>1626</h3>
<ul class="searchable">
{% for cave in caves1626 %}
<li> <a href="{{ cave.get_absolute_url }}">{% if cave.kataster_number %}{{ cave.kataster_number }}{% else %}{{cave.unofficial_number }}{%endif %} {{cave.official_name|safe}}</a> </li>
{% endfor %} {% endfor %}
</ul> </ul>

19
templates/editcave.html Normal file
View File

@ -0,0 +1,19 @@
{% extends "base.html" %}
{% load csrffaker %}
{% block title %}Logbook {{logbookentry.id}}{% endblock %}
{% block head %}
<link rel="stylesheet" href="{{ settings.MEDIA_URL }}css/ui-lightness/jquery-ui-1.8.12.custom.css" type="text/css" media="all" />
<script src="{{ settings.MEDIA_URL }}js/jquery-ui-1.8.12.custom.min.js" type="text/javascript"></script>
<script src="{{ settings.MEDIA_URL }}js/jquery.formset.min.js" type="text/javascript"></script>
<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>
{{ tripForm.media }}
{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
{{ form }}
<p><input type="submit" value="Sumbit" /></p>
</form>
{% endblock %}

View File

@ -0,0 +1,40 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{% block title %}{% endblock %}
</title>
<link rel="stylesheet" type="text/css" href="../css/main2.css" />
</head>
<body>
<div id="mainmenu">
<ul>
<li><a href="/index.htm">Expo web home</a></li>
<li><a href="/intro.html">Introduction</a></li>
<li><a href="/infodx.htm">Main index</a></li>
<li><a href="/indxal.htm">Cave index</a></li>
{% if cavepage %}
<ul>
<li><a href="{% url survexcaveslist %}">All Survex</a></li>
<li><a href="{% url surveyscansfolders %}">Scans</a></li>
<li><a href="{% url tunneldata %}">Tunneldata</a></li>
<li><a href="{% url survexcavessingle 161 %}">161</a></li>
<li><a href="{% url survexcavessingle 204 %}">204</a></li>
<li><a href="{% url survexcavessingle 258 %}">258</a></li>
<li><a href="{% url expedition 2009 %}">Expo2009</a></li>
<li><a href="{% url expedition 2010 %}">Expo2010</a></li>
<li><a href="{% url expedition 2011 %}">Expo2011</a></li>
<li><a href="/admin">Django admin</a></li>
</ul>
{% endif %}
<li><a href="/handbook/index.htm">Expedition handbook</a></li>
<li><a href="/pubs.htm">Published reports</a></li>
<li><a href="/areas.htm">Area description</a></li>
<li><a href="/">CUCC website</a></li>
</ul>
</div>
{% block content %}{% endblock %}
</body>
</html>

View File

@ -2,7 +2,7 @@
<head> <head>
{{ head|safe }} {{ head|safe }}
</head> </head>
<body> <body{% if bodyid %} id="{{ bodyid }}"{% endif %}>
{{ body|safe }} {{ body|safe }}
{% if editable %}<a href="{% url editflatpage path %}">Edit</a>{% endif %} {% if editable %}<a href="{% url editflatpage path %}">Edit</a>{% endif %}
</body> </body>