summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--databaseReset.py4
-rw-r--r--expo/views_other.py27
-rw-r--r--media/css/main3.css6
-rw-r--r--parsers/QMs.py18
-rw-r--r--templates/base.html6
-rw-r--r--templates/controlPanel.html46
-rw-r--r--templates/survey.html68
-rw-r--r--urls.py7
8 files changed, 96 insertions, 86 deletions
diff --git a/databaseReset.py b/databaseReset.py
index 77a7b8a..748d0e3 100644
--- a/databaseReset.py
+++ b/databaseReset.py
@@ -65,10 +65,6 @@ def export_cavetab():
tocavetab.writeCaveTab(outfile)
outfile.close()
-def export_qms(): #finish this. need cave chooser
- from export import toqms
- outfile=file(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'w')
- outfile.close()
diff --git a/expo/views_other.py b/expo/views_other.py
index 1b3b64f..8f3af0d 100644
--- a/expo/views_other.py
+++ b/expo/views_other.py
@@ -8,6 +8,7 @@ import randSent
from django.http import HttpResponse, HttpResponseRedirect
from django.core.urlresolvers import reverse
from troggle.alwaysUseRequestContext import render_response # see views_logbooks for explanation on this.
+from expo.models import *
def showrequest(request):
return HttpResponse(request.GET)
@@ -69,12 +70,32 @@ def controlPanel(request):
else:
return HttpResponseRedirect(reverse('auth_login'))
- return render_response(request,'controlPanel.html', )
+ return render_response(request,'controlPanel.html', {'caves':Cave.objects.all()} )
def downloadCavetab(request):
from export import tocavetab
response = HttpResponse(mimetype='text/csv')
- response['Content-Disposition'] = 'attachment; filename=CAVEETAB2.CSV'
+ response['Content-Disposition'] = 'attachment; filename=CAVETAB2.CSV'
tocavetab.writeCaveTab(response)
return response
- \ No newline at end of file
+
+def downloadSurveys(request):
+ from export import tosurveys
+ response = HttpResponse(mimetype='text/csv')
+ response['Content-Disposition'] = 'attachment; filename=Surveys.csv'
+ tosurveys.writeCaveTab(response)
+ return response
+
+def downloadQMs(request):
+ if request.method=='GET':
+ try:
+ cave=Cave.objects.get(kataster_number=request.GET['cave_id'])
+ except Cave.DoesNotExist:
+ cave=Cave.objects.get(name=cave_id)
+
+ from export import toqms
+
+ response = HttpResponse(mimetype='text/csv')
+ response['Content-Disposition'] = 'attachment; filename=qm.csv'
+ toqms.writeQmTable(response,cave)
+ return response \ No newline at end of file
diff --git a/media/css/main3.css b/media/css/main3.css
index d875da9..384d9b3 100644
--- a/media/css/main3.css
+++ b/media/css/main3.css
@@ -230,6 +230,12 @@ a.redtext:link {
border-bottom-width: thin;
border-left-width: thin;
}
+
+.menuBarItem : hover {
+ background: "rgb(125, 125, 125)";
+}
+
+
.behind {
display: none;
}
diff --git a/parsers/QMs.py b/parsers/QMs.py
index 3eddfa5..732e913 100644
--- a/parsers/QMs.py
+++ b/parsers/QMs.py
@@ -1,11 +1,11 @@
# -*- coding: UTF-8 -*-
import csv
-import settings
+from django.conf import settings
from expo.models import QM, LogbookEntry, Cave
from datetime import *
from troggle.save_carefully import save_carefully
-import re
+import re, os
def deleteQMs():
QM.objects.all().delete()
@@ -23,15 +23,14 @@ def parseCaveQMs(cave,inputFile):
try:
hauchHl=Cave.objects.get(official_name="Hauchhöhle")
except Cave.DoesNotExist:
- print "Steinbruckenhoehle is not in the database. Please run parsers.cavetab first."
+ print "Hauchhoele is not in the database. Please run parsers.cavetab first."
return
elif cave =='kh':
try:
kh=Cave.objects.get(official_name="Kaninchenhöhle")
except Cave.DoesNotExist:
- print "Steinbruckenhoehle is not in the database. Please run parsers.cavetab first."
- for file in inputFile:
- parse_KH_QMs(kh, inputFile=file)
+ print "KH is not in the database. Please run parsers.cavetab first."
+ parse_KH_QMs(kh, inputFile=inputFile)
return
qmPath = settings.EXPOWEB+inputFile
@@ -108,13 +107,10 @@ def parse_KH_QMs(kh, inputFile):
'nearest_station':res['nearest_station'],
'location_description':res['description']
}
-
- if
-
+
save_carefully(QM,lookupArgs,nonLookupArgs)
-parseCaveQMs(cave='kh', inputFile=r"smkridge/161/qmtodo.htm")
parseCaveQMs(cave='stein',inputFile=r"smkridge/204/qm.csv")
parseCaveQMs(cave='hauch',inputFile=r"smkridge/234/qm.csv")
-
+parseCaveQMs(cave='kh', inputFile="smkridge/161/qmtodo.htm") \ No newline at end of file
diff --git a/templates/base.html b/templates/base.html
index 5615a8e..de1f73c 100644
--- a/templates/base.html
+++ b/templates/base.html
@@ -7,13 +7,13 @@
<script src="{{ settings.MEDIA_URL }}js/jquery.js" type="text/javascript"></script>
<script src="{{ settings.MEDIA_URL }}js/jquery.quicksearch.js" type="text/javascript"></script>
<script src="{{ settings.MEDIA_URL }}js/base.js" type="text/javascript"></script>
-<script>
- contentHeight();
+<script language="javascript">
+window.onload = contentHeight;
</script>
{% block head %}{% endblock %}
</head>
-<body onLoad="contentHeight()">
+<body>
<div id="header">
<h1>CUCC Expeditions to Austria: 1976 - 2009</h1>
diff --git a/templates/controlPanel.html b/templates/controlPanel.html
index 028b7f2..bce56f8 100644
--- a/templates/controlPanel.html
+++ b/templates/controlPanel.html
@@ -42,18 +42,56 @@
</form>
</td>
<td>
- <form name="export" method="get" action={% url downloadcavetab %}>
+ <form name="export" method="get" action="{% url downloadcavetab %}">
<p>Download a CAVETAB2.CSV file which is dynamically generated by Troggle.</p>
<input name="download_cavetab" type="submit" value="Download CAVETAB2.CSV" />
</form>
</td>
</tr>
+
+<tr>
+ <td>
+ surveys to Surveys.csv
+ </td>
+ <td>
+ <form name="export" method="post" action="">
+ <p>Overwrite the existing Surveys.csv file with one generated by Troggle.</p>
+ <input disabled name="export_surveys" type="submit" value="Update {{settings.SURVEYS}}noinfo/Surveys.csv" />
+ </form>
+ </td>
+ <td>
+ <form name="export" method="get" action={% url downloadsurveys %}>
+ <p>Download a Surveys.csv file which is dynamically generated by Troggle.</p>
+ <input disabled name="download_surveys" type="submit" value="Download Surveys.csv" />
+ </form>
+ </td>
+</tr>
+<tr>
<td>qms to qms.csv</td><td>
- <input name="export_cavetab" type="submit" value="Update qms file for" disabled />
- <input name="export_cavetab_view" type="submit" value="Download file" disabled />
+ <form name="export_qms" method="get" action="downloadqms">
+
+<!--This is for choosing caves by area (drilldown).
+
+ <select id="qmcaveareachooser" class="searchable" >
+ </select>
+
+ -->
+
+ Choose a cave.
+ <select name="cave_id" id="qmcavechooser">
+
+ {% for cave in caves %}
+ <option value="{{cave.kataster_number}}">{{cave}}
+ </option>
+ {% endfor %}
+
+ </select>
+
+ <input type="submit" value="Download"/>
+ </form>
</td></tr>
</table>
</form>
-{% endblock %} \ No newline at end of file
+{% endblock %} \ No newline at end of file
diff --git a/templates/survey.html b/templates/survey.html
index a0395b6..9d677e5 100644
--- a/templates/survey.html
+++ b/templates/survey.html
@@ -11,57 +11,7 @@
blankColor = "rgb(153, 153, 153)"
highlightedColor = "rgb(125, 125, 125)"
chosenColor = "rgb(255, 255, 255)"
- mnuItmLst=document.getElementsByClassName("menuBarItem")
- function highlight(div){
- for (var i = 0, divIter; divIter = mnuItmLst[i]; i++) {
- /*loop though all menuitems. blank them except ones that are toggled on*/
- if (divIter.style.backgroundColor!=chosenColor){
- divIter.style.backgroundColor=blankColor;
- }
- }
- /*highlight the mouseovered div unless it is toggled on*/
- if (div.style.backgroundColor!=chosenColor){
- div.style.backgroundColor=highlightedColor;
- }
- }
-
- function unhighlight(div){
- /*highlight the mouseovered div unless it is the chosen one*/
- if (div.style.backgroundColor!=chosenColor){
- div.style.backgroundColor=blankColor;
- }
- }
-
- function toggle(div){
- if (document.getElementById(div.id+"Content").style.display="none"){
- document.getElementById(div.id+"Content").style.display="block";
- div.style.backgroundColor=chosenColor;
- }
- else {
- document.getElementById(div.id+"Content").style.display="none";
- div.style.backgroundColor=blankColor;
- }
- }
-
-/* function choose(div){
- for (var i = 0, divIter; divIter = mnuItmLst[i]; i++) {
- document.getElementById(divIter.id+"Content").style.display="none";
- }
- document.getElementById(div.id+"Content").style.display="block";
- for (var i = 0, divIter; divIter = mnuItmLst[i]; i++) {
- document.getElementById(divIter.id).style.backgroundColor=blankColor;
- }
- div.style.backgroundColor=chosenColor;
- document.getElementById(progressTableContent).style.display="none";
- }*/
-
- function redirectSurvey(){
- window.location = "{% url survey %}" + '/' + document.getElementById("expeditionChooser").value + "%23" + document.getElementById("surveyChooser").value;
- }
-
- function redirectYear(){
- window.location = "{% url survey %}" + '/' + document.getElementById("expeditionChooser").value + "%23";
- }
+
</script>
{% endblock %}
@@ -95,7 +45,7 @@
<div>
<!-- <h4>Click to toggle:</h4>-->
- <div id="progressTable" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% if current_expedition.survey_set.all %}&#10003;{% endif %}
+ <div id="progressTable" class="menuBarItem" > {% if current_expedition.survey_set.all %}&#10003;{% endif %}
survey progress table </div>
</div>
@@ -120,16 +70,16 @@
</center>
<!-- <h4>Click to toggle:</h4>-->
<div id="surveyWalletNav">
- <div id="notes" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% if notes %}&#10003;{% endif %}
+ <div id="notes" class="menuBarItem" > {% if notes %}&#10003;{% endif %}
scanned notes </div>
- <div id="survexFile" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% if current_survey.survex_file %}&#10003;{% endif %}
+ <div id="survexFile" class="menuBarItem" > {% if current_survey.survex_file %}&#10003;{% endif %}
survex file </div>
- <div id="printedCentreline" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% if current_survey.centreline_printed_on %}&#10003;{% endif %}
+ <div id="printedCentreline" class="menuBarItem" > {% if current_survey.centreline_printed_on %}&#10003;{% endif %}
printed centreline </div>
- <div id="scannedPassageSketch" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% if planSketches %}&#10003;{% endif %}
+ <div id="scannedPassageSketch" class="menuBarItem" > {% if planSketches %}&#10003;{% endif %}
scanned passage sketch </div>
- <div id="tunnelXMLfile" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)">tunnel xml file</div>
- <div id="mainSketchIntegration" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)">add to main sketch</div>
+ <div id="tunnelXMLfile" class="menuBarItem" >tunnel xml file</div>
+ <div id="mainSketchIntegration" class="menuBarItem" >add to main sketch</div>
</div>
</div>
{% endblock %}
@@ -191,7 +141,7 @@
</p>
</div>
{% endfor %}
- <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned notes page. </a> </div>
+ <div class="figure"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/" target="_blank"> <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" /> Add a new scanned notes page. </a> </div>
</div>
<br class="clearfloat" />
<div id="survexFileContent" class="behind"> survex file editor, keeping file in original structure <br />
diff --git a/urls.py b/urls.py
index fdead4d..8ae9ca7 100644
--- a/urls.py
+++ b/urls.py
@@ -38,7 +38,6 @@ urlpatterns = patterns('',
url(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent),
#(r'^cave/(?P<cave_id>[^/]+)/edit/$', edit_cave),
#(r'^cavesearch', caveSearch),
- url(r'^cave/(?P<cave_id>[^/]+)(?P<subcave>/.*)/?$', subcave, name="subcave"),
url(r'^survex/(.*?)\.index$', views_survex.index, name="survexindex"),
@@ -60,7 +59,11 @@ urlpatterns = patterns('',
url(r'^survey/(?P<year>\d\d\d\d)\#(?P<wallet_number>\d*)$', survey, name="survey"),
url(r'^controlpanel/?$', views_other.controlPanel, name="controlpanel"),
- url(r'^cavetab/?$', views_other.downloadCavetab, name="downloadcavetab"),
+ url(r'^CAVETAB2\.CSV/?$', views_other.downloadCavetab, name="downloadcavetab"),
+ url(r'^Surveys\.csv/?$', views_other.downloadSurveys, name="downloadsurveys"),
+ url(r'^cave/(?P<cave_id>[^/]+)/qm\.csv/?$', views_other.downloadQMs, name="downloadqms"),
+ (r'^downloadqms$', views_other.downloadQMs),
+ url(r'^cave/(?P<cave_id>[^/]+)(?P<subcave>/.*)/?$', subcave, name="subcave"),
(r'^admin/doc/?', include('django.contrib.admindocs.urls')),
(r'^admin/(.*)', admin.site.root),