[svn r8155] Added some actual funtionality to virtual survey binder.

This commit is contained in:
aaron 2009-01-16 00:21:55 +01:00
parent 95d6ae7011
commit 0404030f87
3 changed files with 138 additions and 95 deletions

View File

@ -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,'')

View File

@ -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

View File

@ -3,9 +3,9 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
<style type="text/css">
<!--
body {
font: 100% Verdana, Arial, Helvetica, sans-serif;
background: #666666;
margin: 0; /* it's good practice to zero the margin and padding of the body element to account for differing browser defaults */
@ -13,29 +13,31 @@ body {
text-align: center; /* this centers the container in IE 5* browsers. The text is then set to the left aligned default in the #container selector */
color: #000000;
}
.twoColHybLtHdr #container {
.twoColHybLtHdr #container {
width: 80%; /* this will create a container 80% of the browser width */
background: #FFFFFF;
margin: 0 auto; /* the auto margins (in conjunction with a width) center the page */
border: 1px solid #000000;
text-align: left; /* this overrides the text-align: center on the body element. */
}
.twoColHybLtHdr #header {
background: #DDDDDD;
}
.thumbnail {
width: 300px;
}
.twoColHybLtHdr #header {
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. */
}
}
.twoColHybLtHdr #header h1 {
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 */
}
/* 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.
2. Since em units are used for the sidebar value, be aware that its width will vary with different default text sizes.
3. Space between the side of the div and the elements within it can be created by placing a left and right margin on those elements as seen in the ".twoColHybLtHdr #sidebar1 p" rule.
*/
.twoColHybLtHdr #sidebar1 {
float: left;
float: left;
width: 12em; /* since this element is floated, a width must be given */
background: #EBEBEB; /* the background color will be displayed for the length of the content in the column, but no further */
padding: 15px 0; /* top and bottom padding create visual space within this div */
@ -44,24 +46,22 @@ body {
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;
}
/* 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.
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.
3. In the Internet Explorer Conditional Comment below, the zoom property is used to give the mainContent "hasLayout." This may help avoid several IE-specific bugs.
*/
.twoColHybLtHdr #mainContent {
.twoColHybLtHdr #mainContent {
margin: 0 20px 0 13em; /* the right margin can be given in percentages or pixels. It creates the space down the right side of the page. */
}
.twoColHybLtHdr #footer {
}
.twoColHybLtHdr #footer {
padding: 0 10px; /* this padding matches the left alignment of the elements in the divs that appear above it. */
background:#DDDDDD;
}
}
.twoColHybLtHdr #footer p {
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 */
}
/* 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. */
float: right;
@ -73,9 +73,9 @@ body {
}
.clearfloat { /* this class should be placed on a div or break element and should be the final element before the close of a container that should fully contain a float */
clear:both;
height:0;
font-size: 1px;
line-height: 0px;
height:0;
font-size: 1px;
line-height: 0px;
}
.menuBarItem {
font-variant: small-caps;
@ -92,15 +92,32 @@ body {
.behind {
display: none;
}
-->
</style><!--[if IE]>
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 type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColHybLtHdr #sidebar1 { padding-top: 30px; }
.twoColHybLtHdr #mainContent { zoom: 1; padding-top: 15px; }
/* the above proprietary zoom property gives IE the hasLayout it may need to avoid several bugs */
</style>
<![endif]--></head>
<![endif]-->
</head>
<script language="javascript">
mnuItmLst=document.getElementsByClassName("menuBarItem")
function highlight(div){
@ -130,84 +147,108 @@ body {
}
function redirect(surveyPK){
window.location = "{{ settings.URL_ROOT }}survey/" + surveyPK
window.location = "{{ settings.URL_ROOT }}/survey/" + surveyPK
}
</script>
<body class="twoColHybLtHdr">
<div id="header">
<h1>CUCC Expo</h1>
<!-- end #header --></div>
<div id="header">
<h1>CUCC Expo virtual survey binder</h1>
<!-- end #header -->
</div>
<div id="sidebar1">
<h3>Survey Stages for {{ current_survey }}</h3>
<br />
<select id="surveyChooser" onchange="redirect(this.value)">
{% for survey in surveys %}
<option label="{{ survey }}" value="{{ survey.pk }}">{{ survey }}</option>
<h3>Survey Stages for {{ current_survey }}</h3>
<br />
<select id="surveyChooser" onchange="redirect(this.value)">
{% for survey in surveys %}
<option label="{{ survey }}" value="{{ survey.pk }}"
{% ifequal survey current_survey %}
selected
{% endifequal %} >
{{ survey }}
</option>
{% endfor %}
</select>
<div id="status">
<div id="notes" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">
{% if notes %}&#10003;{% endif %}
scanned notes
</div>
<div id="survexFile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">
{% if current_survey.survex_file %}&#10003;{% endif %}
survex file
</div>
<div id="printedCentreline" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">
{% if current_survey.centreline_printed_on %}&#10003;{% endif %}
printed centreline
</div>
<div id="scannedPassageSketch" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)">
{% if planSketches %}&#10003;{% endif %}
scanned passage sketch
</div>
</select>
<div id="status">
<div id="notes" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if notes %}&#10003;{% endif %}
scanned notes </div>
<div id="survexFile" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if current_survey.survex_file %}&#10003;{% endif %}
survex file </div>
<div id="printedCentreline" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if current_survey.centreline_printed_on %}&#10003;{% endif %}
printed centreline </div>
<div id="scannedPassageSketch" class="menuBarItem" onmouseover="highlight(this)" onmouseout="unhighlight(this)" onclick="choose(this)"> {% if planSketches %}&#10003;{% endif %}
scanned passage sketch </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>
<!-- end #sidebar1 --></div>
<div id="mainContent">
<div id="notesContent" class="behind">
scanned notes thumbnails, date scanned, by who, etc
<p>
There are {{ notes|length }} notes.
{% for noteItem in notes %}
<br />
Item number: {{ noteItem.number_in_wallet }}
{{ noteItem.file.correctURL }}
<img src="{{ noteItem.file.correctURL }}" />
{% endfor %}
</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">
scanned sketch thumbnails, date scanned, by who
{% for noteItems in notes %}
{{ noteItem }}
{% endfor %}
</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" />
<div id="footer">
<p>Footer</p>
<!-- end #footer --></div>
<!-- end #sidebar1 -->
</div>
<div id="mainContent">
<div id="notesContent" class="behind">
There are {{ notes|length }} notes files for {{ current_survey }}.
{% for noteItem in notes %}
<div class="figure">
<p>
{{ noteItem.file.correctURL }} <img src="{{ noteItem.correctURL }}" class="thumbnail">
<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 %}
<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 id="scannedPassageSketchContent" class="behind">
There are {{ planSketches|length }} plan sketch files for {{ current_survey }}.
{% 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 %}
<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="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" />
</div>
</body>
</html>