mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-19 13:17:08 +00:00
cp simples
This commit is contained in:
@@ -122,43 +122,6 @@ def controlpanel(request):
|
|||||||
"""
|
"""
|
||||||
jobs_completed = []
|
jobs_completed = []
|
||||||
|
|
||||||
def process_imports():
|
|
||||||
"""databaseReset.py - CHECK THIS IS ALL CORRECT& CURRENT IF YOU RE-ENABLE IT
|
|
||||||
jq.enq("reinit",reinit_db)
|
|
||||||
jq.enq("caves",import_caves)
|
|
||||||
jq.enq("users",import_users)
|
|
||||||
jq.enq("people",import_people)
|
|
||||||
jq.enq("scans",import_surveyscans)
|
|
||||||
jq.enq("logbooks",import_logbooks)
|
|
||||||
jq.enq("QMs",import_QMs)
|
|
||||||
jq.enq("drawings",import_drawingsfiles)
|
|
||||||
jq.enq("survex",import_survex)
|
|
||||||
"""
|
|
||||||
if request.POST.get("import_caves", False):
|
|
||||||
import_caves()
|
|
||||||
jobs_completed.append("Caves")
|
|
||||||
if request.POST.get("import_people", False):
|
|
||||||
import_people()
|
|
||||||
|
|
||||||
jobs_completed.append("People")
|
|
||||||
if request.POST.get("import_surveyscans", False):
|
|
||||||
import_surveyscans()
|
|
||||||
jobs_completed.append("Scans")
|
|
||||||
if request.POST.get("import_logbooks", False):
|
|
||||||
import_logbooks()
|
|
||||||
jobs_completed.append("Logbooks")
|
|
||||||
if request.POST.get("import_QMs", False):
|
|
||||||
import_QMs()
|
|
||||||
jobs_completed.append("QMs")
|
|
||||||
if request.POST.get("import_drawingsfiles", False):
|
|
||||||
import_drawingsfiles()
|
|
||||||
jobs_completed.append("Drawings")
|
|
||||||
if request.POST.get("import_survex", False):
|
|
||||||
import_survex()
|
|
||||||
jobs_completed.append("Survex")
|
|
||||||
|
|
||||||
print("", flush=True)
|
|
||||||
|
|
||||||
if not request.user.is_superuser: # expoadmin is both .is_staff and ._is_superuser
|
if not request.user.is_superuser: # expoadmin is both .is_staff and ._is_superuser
|
||||||
return render(
|
return render(
|
||||||
request,
|
request,
|
||||||
@@ -168,20 +131,11 @@ def controlpanel(request):
|
|||||||
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
if request.method == "POST":
|
return render(
|
||||||
# reinit_db()
|
request,
|
||||||
process_imports()
|
"controlPanel.html",
|
||||||
return render(
|
{"expeditions": Expedition.objects.all(), "year": current_expo()},
|
||||||
request,
|
)
|
||||||
"controlPanel.html",
|
|
||||||
{"expeditions": Expedition.objects.all(), "jobs_completed": jobs_completed, "year": current_expo()},
|
|
||||||
)
|
|
||||||
else:
|
|
||||||
return render(
|
|
||||||
request,
|
|
||||||
"controlPanel.html",
|
|
||||||
{"expeditions": Expedition.objects.all(), "jobs_completed": jobs_completed, "year": current_expo()},
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def exportlogbook(request, year=None):
|
def exportlogbook(request, year=None):
|
||||||
|
|||||||
@@ -1,35 +1,15 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
|
|
||||||
|
|
||||||
{% if jobs_completed %}
|
|
||||||
<div class="noticeBox">
|
|
||||||
Just finished running:
|
|
||||||
<ul>
|
|
||||||
{% for job in jobs_completed %}
|
|
||||||
<li>{{ job }}</li>
|
|
||||||
{% endfor %}
|
|
||||||
</ul>
|
|
||||||
See <a href="/dataissues">Data Issues</a> report
|
|
||||||
<br>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<!--
|
|
||||||
{% if error %}
|
|
||||||
<div class="noticeBox">
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
|
||||||
-->
|
|
||||||
<img class = "onright" alt="troggle logo" src="/handbook/troggle/tricky-troggle.jpg">
|
<img class = "onright" alt="troggle logo" src="/handbook/troggle/tricky-troggle.jpg">
|
||||||
<h3>Troggle Administration Utilities</h3>
|
<h3>Troggle Administration Utilities</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="/logreport/{{year}}">Delete logbook entry</a> -Online logbook suffers duplicate entries <span style="color:red">{{error}}</span>
|
<li><a href="/logreport/{{year}}">Delete logbook entry</a> -Online logbook suffers duplicate entries <span style="color:red">{{error}}</span>
|
||||||
<li><a href="/pathsreport">Folder paths used</a> -folders settings used by this troggle installation
|
<li><a href="/pathsreport">Folder paths used</a> -folders settings used by this troggle installation
|
||||||
<li><a href="/cave_data/cavealiases.txt_edit">Edit cave aliases</a> -edit historical cave aliases to current names
|
<li><a href="/cave_data/cavealiases.txt_edit">Edit cave aliases</a> -edit historical cave aliases to current names
|
||||||
<li><a href="/aliases/2023">Expoer name aliases</a> -short names recognised by troggle
|
<li><a href="/aliases/{{year}}">Expoer name aliases</a> -short names recognised by troggle
|
||||||
<li><a href="/dataissues">Data Issues on Imports</a> - warnings and errors from the recent data import
|
<li><a href="/dataissues">Data Issues on Imports</a> - warnings and errors from the recent data import
|
||||||
<li><a href="/survexfilewild/2023">Wild survex files</a> - survex files containing blocks with no related wallet
|
<li><a href="/survexfilewild/{{year}}">Wild survex files</a> - survex files containing blocks with no related wallet
|
||||||
<li><a href="/survexdir">Survex Directories</a> - Every Cave has an associated directory and a Primary survex file
|
<li><a href="/survexdir">Survex Directories</a> - Every Cave has an associated directory and a Primary survex file
|
||||||
<li><a href="/surveximport">Survex import record</a> - indented *include and begin/end tree<br /><li><a href="/survexdebug">Survex debug report</a> - warnings and details<br />
|
<li><a href="/surveximport">Survex import record</a> - indented *include and begin/end tree<br /><li><a href="/survexdebug">Survex debug report</a> - warnings and details<br />
|
||||||
<li><a href="/therionissues">Therion Import issues</a> - warnings from the recent data import<br /><br />
|
<li><a href="/therionissues">Therion Import issues</a> - warnings from the recent data import<br /><br />
|
||||||
@@ -37,133 +17,5 @@
|
|||||||
</ul>
|
</ul>
|
||||||
<h3>This control panel is/will/maybe being redeveloped</h3>
|
<h3>This control panel is/will/maybe being redeveloped</h3>
|
||||||
|
|
||||||
<!--
|
|
||||||
<p>Do not attempt to use any of these import functions as they are in active development.
|
|
||||||
<ol>
|
|
||||||
<li>Importing things in the wrong order will screw-up the database links and break things.
|
|
||||||
<li>We are working on an on-line importer for new logbook entries - with syntax checking.
|
|
||||||
<li>We are working on an on-line importer for new survex files - with syntax checking
|
|
||||||
<li>Logbooks can only be <em>exported</em> in the current format.
|
|
||||||
</ol>
|
|
||||||
<p>Today (Jan. 2023) we use the <a href="/handbook/troggle/trogimport.html">databaseReset program</a> to import from the master files. This is run on the server itself only by nerds who remotely log in to the server using ssh.
|
|
||||||
|
|
||||||
<p>Before you even think about doing database imports, you should understand the implications on everyone else. See <a href="/handbook/troggle/trogindex.html">the Troggle documentation</a>.
|
|
||||||
<p>As soon as you can cope, you should read the source code for
|
|
||||||
<a href="http://expo.survex.com/repositories/troggle/.git/tree/databaseReset.py">databaseReset</a> to see what it does, as the details are not documented anywhere else yet. But at least the code is quite well commented.
|
|
||||||
|
|
||||||
<p>The logbook export capability wass used to convert an archaic logbook into the current logbook format. It exports the logbook entries in the database into a new file, with the entries in date order. But there is no use for this capability now (Jan. 2023).
|
|
||||||
|
|
||||||
<div style="column-count: 2; ">
|
|
||||||
<font style="color: silver">
|
|
||||||
{% comment %}
|
|
||||||
<form name="reset" method="post" action="">
|
|
||||||
{% csrf_token %}
|
|
||||||
<h3>Wipe:</h3>
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>Wipe entire database and recreate tables: </td>
|
|
||||||
<td><input type="checkbox" name="reload_db" /></td>
|
|
||||||
<td>
|
|
||||||
<input type="submit" id="Import" value="I really want to delete all information in troggle, and accept all responsibility.">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
{% endcomment %}
|
|
||||||
|
|
||||||
<h3>Import (on top of existing data):</h3>
|
|
||||||
<p>To get a fully-functioning system, all these imports must be done and in this order.
|
|
||||||
<form name="import" method="post" action="">
|
|
||||||
{% csrf_token %}
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th colspan="2">Import from master files</th>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all caves </td>
|
|
||||||
<td><input type="checkbox" name="import_caves"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all people </td>
|
|
||||||
<td><input type="checkbox" name="import_people"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all surveys scans </td>
|
|
||||||
<td><input type="checkbox" name="import_surveyscans"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all logbooks</td>
|
|
||||||
<td><input type="checkbox" name="import_logbooks"/></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>QMs (from old csv files)</td>
|
|
||||||
<td><input type="checkbox" name="import_QMs" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all drawings files</td>
|
|
||||||
<td><input type="checkbox" name="import_drawingsfiles" /></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>all survex data (10 minutes)</td>
|
|
||||||
<td><input type="checkbox" name="import_survex" /></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
<p>
|
|
||||||
<input type="submit" id="Import" value="Import">
|
|
||||||
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
|
|
||||||
|
|
||||||
<p></font>
|
|
||||||
|
|
||||||
<hr />
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!--
|
|
||||||
<h3>Export Logbook to a different format:</h3>
|
|
||||||
<p>This creates 'logbook-new-format.html' in the years/<year>/ folder
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
|
|
||||||
<th>Export and Download</th>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<form name="export" method="POST" action={% url "exportlogbook" %}>
|
|
||||||
{% csrf_token %}
|
|
||||||
<p>Download a logbook file which is dynamically generated by Troggle.</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Expedition year:
|
|
||||||
<select name="year">
|
|
||||||
{% for expedition in expeditions %}
|
|
||||||
<option value="{{expedition}}"> {{expedition}} </option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Output style:
|
|
||||||
<select name="extension">
|
|
||||||
<option value="html2005">.html file - 2005 style</option>
|
|
||||||
</select>
|
|
||||||
</p>
|
|
||||||
<p>
|
|
||||||
<input name="download_logbook" type="submit" value="Download logbook" />
|
|
||||||
</p>
|
|
||||||
</form>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
<p>
|
|
||||||
<p>
|
|
||||||
<p>
|
|
||||||
</div>
|
|
||||||
</font>
|
|
||||||
-->
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user