[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
This commit is contained in:
substantialnoninfringinguser 2009-05-13 05:28:57 +01:00
parent 0ec2b1c4f2
commit 7c0791973b
3 changed files with 138 additions and 95 deletions

View File

@ -1,4 +1,5 @@
import urllib import urllib
import string
from django.forms import ModelForm from django.forms import ModelForm
from django.db import models from django.db import models
from django.contrib import admin from django.contrib import admin
@ -319,8 +320,9 @@ class ScannedImage(models.Model):
#object_id = models.PositiveIntegerField() #object_id = models.PositiveIntegerField()
#location = generic.GenericForeignKey('content_type', 'object_id') #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): def correctURL(self):
return urllib.quote(self.file.url) return string.replace(self.file.url,r'#',r'%23')
def __str__(self): def __str__(self):
return get_scan_path(self,'') return get_scan_path(self,'')

View File

@ -1,9 +1,9 @@
import sys import sys
import os import os
import types import types
#sys.path.append('C:\\Expo\\expoweb') sys.path.append('C:\\Expo\\expoweb')
#from troggle import * from troggle import *
#os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings' os.environ['DJANGO_SETTINGS_MODULE']='troggle.settings'
import troggle.settings as settings import troggle.settings as settings
import troggle.expo.models as models 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] survey=models.Survey.objects.filter(wallet_number=surveyNumber, expedition_year=year)[0]
scanObj = models.ScannedImage( scanObj = models.ScannedImage(
file=os.path.join(yearPath, surveyFolder, scan), file=os.path.join(year.year, surveyFolder, scan),
contents=scanType, contents=scanType,
number_in_wallet=scanNumber, number_in_wallet=scanNumber,
survey=survey survey=survey

View File

@ -20,6 +20,9 @@ body {
border: 1px solid #000000; border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */ text-align: left; /* this overrides the text-align: center on the body element. */
} }
.thumbnail {
width: 300px;
}
.twoColHybLtHdr #header { .twoColHybLtHdr #header {
background: #DDDDDD; background: #DDDDDD;
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */ padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear beneath it. If an image is used in the #header instead of text, you may want to remove the padding. */
@ -28,7 +31,6 @@ body {
margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */ margin: 0; /* zeroing the margin of the last element in the #header div will avoid margin collapse - an unexplainable space between divs. If the div has a border around it, this is not necessary as that also avoids the margin collapse */
padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */ padding: 10px 0; /* using padding instead of margin will allow you to keep the element away from the edges of the div */
} }
/* Tips for sidebar1: /* Tips for sidebar1:
1. Since we are working in relative units, it's best not to use padding on the sidebar. It will be added to the overall width for standards compliant browsers creating an unknown actual width. 1. Since we are working in relative units, it's best not to use padding on the sidebar. It will be added to the overall width for standards compliant browsers creating an unknown actual width.
2. Since em units are used for the sidebar value, be aware that its width will vary with different default text sizes. 2. Since em units are used for the sidebar value, be aware that its width will vary with different default text sizes.
@ -44,7 +46,6 @@ body {
margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */ margin-left: 10px; /* the left and right margin should be given to every element that will be placed in the side columns */
margin-right: 10px; margin-right: 10px;
} }
/* Tips for mainContent: /* Tips for mainContent:
1. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends. 1. The space between the mainContent and sidebar1 is created with the left margin on the mainContent div. No matter how much content the sidebar1 div contains, the column space will remain. You can remove this left margin if you want the #mainContent div's text to fill the #sidebar1 space when the content in #sidebar1 ends.
2. Be aware it is possible to cause float drop (the dropping of the non-floated mainContent area below the sidebar) if an element wider than it can contain is placed within the mainContent div. WIth a hybrid layout (percentage-based overall width with em-based sidebar), it may not be possible to calculate the exact width available. If the user's text size is larger than average, you will have a wider sidebar div and thus, less room in the mainContent div. You should be aware of this limitation - especially if the client is adding content with Contribute. 2. Be aware it is possible to cause float drop (the dropping of the non-floated mainContent area below the sidebar) if an element wider than it can contain is placed within the mainContent div. WIth a hybrid layout (percentage-based overall width with em-based sidebar), it may not be possible to calculate the exact width available. If the user's text size is larger than average, you will have a wider sidebar div and thus, less room in the mainContent div. You should be aware of this limitation - especially if the client is adding content with Contribute.
@ -61,7 +62,6 @@ body {
margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */ margin: 0; /* zeroing the margins of the first element in the footer will avoid the possibility of margin collapse - a space between divs */
padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */ padding: 10px 0; /* padding on this element will create space, just as the the margin would have, without the margin collapse issue */
} }
/* Miscellaneous classes for reuse */ /* Miscellaneous classes for reuse */
.fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */ .fltrt { /* this class can be used to float an element right in your page. The floated element must precede the element it should be next to on the page. */
float: right; float: right;
@ -92,15 +92,32 @@ body {
.behind { .behind {
display: none; display: none;
} }
div.figure {
float: left;
width: 25%;
border: thin silver solid;
margin: 0.5em;
padding: 0.5em;
}
div.figure p {
text-align: left;
font-size: smaller;
text-indent: 0;
}
img.thumbnail {
width: 100%;
}
--> -->
</style><!--[if IE]> </style>
<!--[if IE]>
<style type="text/css"> <style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */ /* place css fixes for all versions of IE in this conditional comment */
.twoColHybLtHdr #sidebar1 { padding-top: 30px; } .twoColHybLtHdr #sidebar1 { padding-top: 30px; }
.twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; } .twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */ /* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */
</style> </style>
<![endif]--></head> <![endif]-->
</head>
<script language="javascript"> <script language="javascript">
mnuItmLst=document.getElementsByClassName("menuBarItem") mnuItmLst=document.getElementsByClassName("menuBarItem")
function highlight(div){ function highlight(div){
@ -130,84 +147,108 @@ body {
} }
function redirect(surveyPK){ function redirect(surveyPK){
window.location = "{{ settings.URL_ROOT }}survey/" + surveyPK window.location = "{{ settings.URL_ROOT }}/survey/" + surveyPK
} }
</script> </script>
<body class="twoColHybLtHdr"> <body class="twoColHybLtHdr">
<div id="header"> <div id="header">
<h1>CUCC Expo</h1> <h1>CUCC Expo virtual survey binder</h1>
<!-- end #header --></div> <!-- end #header -->
</div>
<div id="sidebar1"> <div id="sidebar1">
<h3>Survey Stages for {{ current_survey }}</h3> <h3>Survey Stages for {{ current_survey }}</h3>
<br /> <br />
<select id="surveyChooser" onchange="redirect(this.value)"> <select id="surveyChooser" onchange="redirect(this.value)">
{% for survey in surveys %} {% for survey in surveys %}
<option label="{{ survey }}" value="{{ survey.pk }}">{{ survey }}</option> <option label="{{ survey }}" value="{{ survey.pk }}"
{% endfor %} {% ifequal survey current_survey %}
</select> selected
<div id="status"> {% endifequal %} >
<div id="notes" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {{ survey }}
{% if notes %}&#10003;{% endif %} </option>
scanned notes
</div> {% endfor %}
<div id="survexFile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">
{% if current_survey.survex_file %}&#10003;{% endif %} </select>
survex file
</div> <div id="status">
<div id="printedCentreline" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> <div id="notes" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if notes %}&#10003;{% endif %}
{% if current_survey.centreline_printed_on %}&#10003;{% endif %} scanned notes </div>
printed centreline <div id="survexFile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if current_survey.survex_file %}&#10003;{% endif %}
</div> survex file </div>
<div id="scannedPassageSketch" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> <div id="printedCentreline" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if current_survey.centreline_printed_on %}&#10003;{% endif %}
{% if planSketches %}&#10003;{% endif %} printed centreline </div>
scanned passage sketch <div id="scannedPassageSketch" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if planSketches %}&#10003;{% endif %}
</div> scanned passage sketch </div>
<div id="tunnelXMLfile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">tunnel xml file</div> <div id="tunnelXMLfile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">tunnel xml file</div>
<div id="mainSketchIntegration" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">add to main sketch</div> <div id="mainSketchIntegration" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">add to main sketch</div>
</div> </div>
<!-- end #sidebar1 --></div>
<!-- end #sidebar1 -->
</div>
<div id="mainContent"> <div id="mainContent">
<div id="notesContent" class="behind"> <div id="notesContent" class="behind">
scanned notes thumbnails, date scanned, by who, etc There are {{ notes|length }} notes files for {{ current_survey }}.
<p>
There are {{ notes|length }} notes.
{% for noteItem in notes %} {% for noteItem in notes %}
<br /> <div class="figure">
Item number: {{ noteItem.number_in_wallet }} <p>
{{ noteItem.file.correctURL }} {{ noteItem.file.correctURL }} <img src="{{ noteItem.correctURL }}" class="thumbnail">
<img src="{{ noteItem.file.correctURL }}" /> <p>
File at:
<a href="{{ noteItem.file.correctUrl }}">
{{ noteItem.file.name }}
</a> <br />
Scanned by: {{ noteItem.scanned_by }} <br />
On: {{ noteItem.scanned_on }} <br />
</p></p>
</div>
{% endfor %} {% 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> (to be improved)
</div> </div>
<div id="survexFileContent" class="behind">
survex file editor, keeping file in original structure
<br />
who entered by
</div>
<div id="printedCentrelineContent" class="behind">
centreline
</div> </div>
<div id="survexFileContent" class="behind"> survex file editor, keeping file in original structure <br />
who entered by </div>
<div id="printedCentrelineContent" class="behind"> centreline </div>
<div id="scannedPassageSketchContent" class="behind"> <div id="scannedPassageSketchContent" class="behind">
scanned sketch thumbnails, date scanned, by who There are {{ planSketches|length }} plan sketch files for {{ current_survey }}.
{% for noteItems in notes %}
{{ noteItem }} {% for sketchItem in planSketches %}
<div class="figure">
<p>
{{ sketchItem.file.correctURL }} <img src="{{ sketchItem.correctURL }}" class="thumbnail">
<p>
File at:
<a href="{{ sketchItem.file.correctUrl }}">
{{ sketchItem.file.name }}
</a> <br />
Scanned by: {{ sketchItem.scanned_by }} <br />
On: {{ sketchItem.scanned_on }} <br />
</p></p>
</div>
{% endfor %} {% endfor %}
</div> <div class="figure">
<div id="tunnelXMLfileContent" class="behind"> <a href="{{ settings.URL_ROOT }}admin/expo/scannedimage/add/">
link to tunnel xml file. potentially instance of tunnel applet... <img src="{{ settings.URL_ROOT }}{{ settings.ADMIN_MEDIA_PREFIX }}img/admin/icon_addlink.gif" />
</div> Add a new scanned notes page.
<div id="mainSketchIntegrationContent" class="behind"> </a> (to be improved)
link to main sketch file
</div>
<!-- end #mainContent --></div> </div>
</div>
<div id="tunnelXMLfileContent" class="behind"> link to tunnel xml file. potentially instance of tunnel applet... </div>
<div id="mainSketchIntegrationContent" class="behind"> link to main sketch file </div>
<!-- end #mainContent -->
</div>
<br class="clearfloat" /> <br class="clearfloat" />
<div id="footer"> </div>
<p>Footer</p>
<!-- end #footer --></div>
</body> </body>
</html> </html>