2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00
troggle/templates/survey.html
substantialnoninfringinguser d25fd97864 [svn] My crusade to make our project more Djangoic.
Got rid of the url tags in template, replaced them with get_absolute_url method calls where possible. Adding get_absolute_url in models enables direct link to the public model views in admin. The use of get_absolute_url, which is the correct Django way of doing things, eliminates any need for the redundant "href" fields we were using. Those fields now need to be deleted from the models and from the parsers.

Made the context processor to pass settings to all templates actually work, although this was a little uglier than expected. I had to put in a new render_response to replace render_to_response. This is because Django uses Context, not RequestContext by default. I wish they would change this, it's annoying. Anyway, I deleted all the manual settings passing in the views.

I also eliminated a couple of unnecessary methods and stuff like that.
Copied from http://cucc@cucc.survex.com/svn/trunk/expoweb/troggle/, rev. 8244 by aaron @ 2/16/2009 8:31 AM
2009-05-13 05:52:15 +01:00

226 lines
8.5 KiB
HTML

{% extends "base.html" %}
{% load wiki_markup %}
{% block title %}CUCC Virtual Survey Binder: {{ current_expedition }}{{ current_survey }}{%endblock%}
{% block head %}
<link rel="stylesheet" type="text/css" href="{{ settings.MEDIA_URL }}css/nav.css" />
<!--<style type="text/css">
h4 { text-align:right; text-decoration:underline }
select { margin:0.5em }
</style>-->
<script language="javascript">
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 %}
<div id="currentLocation">
CUCC Expo virtual survey binder:
{% if current_survey %}
{{current_survey}}
{% else %}
{{current_year }}
{% endif %}
</div>
{% block nav %}
<div id="nav">
<br />
<h3>Choose a year</h3>
<center>
<select id="expeditionChooser" class="centre" onChange="redirectYear()">
{% for expedition in expeditions %}
<option label="{{ expedition }}" value="{{ expedition }}" {% ifequal expedition current_expedition %}selected{% endifequal %}>
{{ expedition }}
</option>
{% endfor %}
</select>
</center>
<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 %}
survey progress table </div>
</div>
<h3>Choose a wallet number </h3>
<center>
<select id="surveyChooser" class="centre" onChange="redirectSurvey()">
<option label="show all" value="">
{% for survey in current_expedition.survey_set.all %}
</option>
<option label="{{ survey }}" value="{{ survey.wallet_number }}"
{% ifequal survey current_survey %}
selected
{% endifequal %}>
{{ survey }}
</option>
{% endfor %}
<option label="add" value="add">
</select>
</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 %}
scanned notes </div>
<div id="survexFile" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% 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 %}
printed centreline </div>
<div id="scannedPassageSketch" class="menuBarItem" onMouseOver="highlight(this)" onMouseOut="unhighlight(this)" onClick="toggle(this)"> {% 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>
</div>
</div>
{% endblock %}
{% block content %}
<div id="mainContent">
<div id="progressTableContent" class="behind" style="overflow:auto">
<h3>Survey progress table for {{ current_expedition }}</h3>
{% if current_expedition.survey_set.all %} <!-- if there are any surveys in the expedition, make the table -->
<table class="centre">
<tr>
<th> </th>
{% for survey in current_expedition.survey_set.all %}
<th> {{ survey.wallet_number }} </th>
{% endfor %} </tr>
<tr>
<td> Notes </td>
{% for survey in current_expedition.survey_set.all %}
<td> {% if survey.notes %}
&#10003;
{% endif %} </td>
{% endfor %} </tr>
<tr>
<td> Survex file </td>
{% for survey in current_expedition.survey_set.all %}
<td> {% if survey.survex_file %}
&#10003;
{% endif %} </td>
{% endfor %} </tr>
<tr>
<td> Plans </td>
{% for survey in current_expedition.survey_set.all %}
<td> {% if survey.plans %}
&#10003;
{% endif %} </td>
{% endfor %} </tr>
<tr>
<td> Elevations </td>
{% for survey in current_expedition.survey_set.all %}
<td> {% if survey.elevations %}
&#10003;
{% endif %} </td>
{% endfor %} </tr>
</table>
{% else %}
<center>[ There are no surveys in the database for this year. Put link in to add one. ]</center>
{% endif %}
</div>
<div id="notesContent" class="behind">
<h3>Scanned notes for {{ current_survey }}.</h3>
{% for noteItem in notes %}
<div class="figure">
<p> <img src="{{ noteItem.correctURL }}" class="thumbnail">
<p> File at: <a href="{{ noteItem.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> </div>
</div>
<br class="clearfloat" />
<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">
<h3>Scanned plan sketch files for {{ current_survey }}.</h3>
{% for sketchItem in planSketches %}
<div class="figure">
<p> <img src="{{ sketchItem.correctURL }}" class="thumbnail" />
<p> File at: <a href="{{ sketchItem.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 sketch. </a> </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" />
{% endblock %}