From 7c0791973ba8e1be12b612c3069da7e5c980cdc8 Mon Sep 17 00:00:00 2001 From: substantialnoninfringinguser Date: Wed, 13 May 2009 05:28:57 +0100 Subject: [PATCH] [svn] Added some actual funtionality to virtual survey binder. Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8155 by aaron @ 1/15/2009 11:21 PM --- expo/models.py | 4 +- parsers/surveys.py | 8 +- templates/survey.html | 221 +++++++++++++++++++++++++----------------- 3 files changed, 138 insertions(+), 95 deletions(-) diff --git a/expo/models.py b/expo/models.py index a75e8ed..e5eb87c 100644 --- a/expo/models.py +++ b/expo/models.py @@ -1,4 +1,5 @@ import urllib +import string from django.forms import ModelForm from django.db import models from django.contrib import admin @@ -319,8 +320,9 @@ class ScannedImage(models.Model): #object_id = models.PositiveIntegerField() #location = generic.GenericForeignKey('content_type', 'object_id') + #This is an ugly hack to deal with the #s in our survey scan paths. The correct thing is to write a custom file storage backend which calls urlencode on the name for making file.url but not file.path. def correctURL(self): - return urllib.quote(self.file.url) + return string.replace(self.file.url,r'#',r'%23') def __str__(self): return get_scan_path(self,'') diff --git a/parsers/surveys.py b/parsers/surveys.py index ea661a6..22b1767 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -1,9 +1,9 @@ import sys import os import types -#sys.path.append('C:\\Expo\\expoweb') -#from troggle import * -#os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings' +sys.path.append('C:\\Expo\\expoweb') +from troggle import * +os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings' import troggle.settings as settings import troggle.expo.models as models @@ -74,7 +74,7 @@ def parseSurveyScans(year): survey=models.Survey.objects.filter(wallet_number=surveyNumber, expedition_year=year)[0] scanObj = models.ScannedImage( - file=os.path.join(yearPath, surveyFolder, scan), + file=os.path.join(year.year, surveyFolder, scan), contents=scanType, number_in_wallet=scanNumber, survey=survey diff --git a/templates/survey.html b/templates/survey.html index 00d296e..5d9a447 100644 --- a/templates/survey.html +++ b/templates/survey.html @@ -3,9 +3,9 @@ Untitled Document - + + + + - - - +
-

Survey Stages for {{ current_survey }}

-
- + {% for survey in surveys %} + + {% endfor %} - -
- - - - + + +
+ + + +
-
-
-
- scanned notes thumbnails, date scanned, by who, etc -

- There are {{ notes|length }} notes. - {% for noteItem in notes %} -
- Item number: {{ noteItem.number_in_wallet }} - {{ noteItem.file.correctURL }} - - {% endfor %} -

-
- survex file editor, keeping file in original structure -
- who entered by -
-
- centreline -
-
- scanned sketch thumbnails, date scanned, by who - {% for noteItems in notes %} - {{ noteItem }} - {% endfor %} -
-
- link to tunnel xml file. potentially instance of tunnel applet... -
-
- link to main sketch file -
- -
-
- + + +
+
+
+ There are {{ notes|length }} notes files for {{ current_survey }}. + {% for noteItem in notes %} +
+

+ {{ noteItem.file.correctURL }} +

+ File at: + + {{ noteItem.file.name }} +
+ Scanned by: {{ noteItem.scanned_by }}
+ On: {{ noteItem.scanned_on }}
+

+
+ {% endfor %} + +
+ +
survex file editor, keeping file in original structure
+ who entered by
+
centreline
+
+ There are {{ planSketches|length }} plan sketch files for {{ current_survey }}. + + {% for sketchItem in planSketches %} +
+

+ {{ sketchItem.file.correctURL }} +

+ File at: + + {{ sketchItem.file.name }} +
+ Scanned by: {{ sketchItem.scanned_by }}
+ On: {{ sketchItem.scanned_on }}
+

+
+ {% endfor %} + +
+
link to tunnel xml file. potentially instance of tunnel applet...
+
link to main sketch file
+ +
+
+