summaryrefslogtreecommitdiffstats
path: root/templates/cave_fix.html
blob: a29eed833de3fc9dd42d6b2d998ca1f98cb6e022 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
{% extends "base.html" %}
{% block title %}Cave fix misplaced images and descriptive files
<!-- cave_kataster.html - this text visible because this template has been included -->
{% endblock %}

{% block content %}



<h2>Cave fix misplaced images and descriptive files</h2>

<form action="{% url 'fix' areacode %}" method="post">
<p>

{% csrf_token %}
{{form.as_p}}
	<button  class="fancybutton"  style="padding: 0.5em 25px; font-size: 100%;" type = "submit" >
		See what the edits look like &rarr;
	</button>	

<div style="color:red; font-weight: bold; font-size: large">
{{warning|safe}}<p>
{{error|safe}}</div>

<h3>Rename the cave description directories in <var>expoweb<a href="/{{areacode|safe}}">{{areacode|safe}}</a></var></h3>
<p>
<ul style="list-style: disc">
<li> Edit all the '<samp>href=</samp>' and '<samp>src=</samp>' <small>URLS</small> (if they exist) inside all the <samp>cave_data</samp> and <samp>entrance_data</samp> files descriptive text to refer to the new directory
<li> Rename the directory (if it exists) inside the areacode directory, e.g. rename <samp>/{{areacode}}/{{cave.unofficial_number}}/</samp> as <samp>/{{areacode}}/<span style="color:blue">{{knum}}</span>/</samp> (if <span style="color:blue">{{knum}}</span> is the correct new kataster number). Do this last.
</ul>
In 1623 there are <strike>82</strike> 69 cave description sub-files, i.e. single pages with a larger image and caption using the t/i/l convention, are not in <br>
<samp><b>1623/[cave]/l/*.html</b></samp> but are directly in <br />
<samp><b>1623/l/[cave]*.html</b></samp>  <br>
due to early versions of Martin's image insertion tool for editing cave descriptions. 21 of these <strike>do</strike> did not even have filenames beginning with [cave], the cave unofficial identifier, but are all digits. They seem to be all 2023 discoveries or caves which have had images added to their descriptions in 2023.
<p><b><samp>
{% if misplaced %}
<samp><b>1623/l/ :</samp></b><br />
{% endif %}
{{misplaced|safe}}
</samp></b><br />
If we don't edit these, things will still work, i.e. cave description images will still appear, but the names of the files no longer match the new kataster name of the cave. Fixing this - so that these files are stored together with the rest of the stuff just for that cave - could be included in in this renaming tool, but is perhaps better done as another job - which needs doing as troggle does some weird perversions to display these images. Some of these caves may never be katastered.
<p>




<h3>Move and edit the .html files in <var>expoweb/i,l,t</var></h3>
<div style="font-family: monospace; font-weight: bold;">
{{cave_data|safe}}<br />
&nbsp;&nbsp;&nbsp;<span style="color:grey">&lt;kataster_number&gt;</span><span style="color:grey">&lt;/kataster_number&gt;</span> 
<br />
&nbsp;&nbsp;&nbsp;
&rarr;
<span style="color:grey">&lt;kataster_number&gt;</span><span style="color:blue">{{knum}}</span><span style="color:grey">&lt;/kataster_number&gt;</span> 

<br />
&nbsp;&nbsp;&nbsp;<span style="color:grey">&lt;survex_file&gt;</span>{{cave.survex_file}}
<span style="color:grey">&lt;/survex_file&gt;</span> 
<br />
&nbsp;&nbsp;&nbsp;
&rarr;
<span style="color:grey">&lt;survex_file&gt;</span><span style="color:blue">caves-{{areacode}}/{{knum}}/{{knum}}.svx</span>
<span style="color:grey">&lt;/survex_file&gt;</span> 


<p>
{% for e in entrance_data %}
{{e|safe}}</br />
{% endfor %}
</div>

<ul style="list-style: disc">

<li> Edit the '<samp>kataster'number</samp>' field inside the <samp>cave_data</samp> file.
<li> Edit the '<samp>survex_file</samp>' field inside the <samp>cave_data</samp> file.
<li> Edit the '<samp>entranceslug</samp>' field inside each '<samp>entrance</samp>' field in the <samp>cave_data</samp> file.
<li> Rename all the files listed above - always do this <b>last</b> otherwise it is hard to automatically discover which edits have not been done.
</ul>




<h3>Finally</h3>
<ul style="list-style: disc">
<li><samp>cd loser<br />
git add *<br />
git commit -m 'Moving misplaced files  {{cave.slug|safe}} in <span style="color:blue">{{areacode |safe}}</span>'<br />
git pull<br />
git push<br />
cd ../expoweb<br />
git add *<br />
git commit -m 'Moving misplaced files  {{cave.slug|safe}} in <span style="color:blue">{{areacode |safe}}</span>'<br />
git pull<br />
git push<br />
</samp>
<li>It is then vital to do a complete databaseReset as troggle has internally indexed all those {{cave.slug}} files, the indexes are now out of date and horrible things will happen when people try to use troggle with any cave that has been altered:<br />
<samp>uv run databaseReset reset <span style="color:blue">M{{areacode}}</span></samp><br />
OR we can do an online rename of the "Cave" object in the database [code yet to be written] by pressing the button above [button not yet implemented].
<li>Look in the reset import warnings and errors report to see if anything has gone wrong:
<var><a href="http://expo.survex.com/dataissues">expo.survex.com/dataissues</a></var><br />
(in fact, look at this before you do any of this, so you can see what chnages.)
</ul>

<h3>Ideal scenario</h3>
<p>
<p>Ideally you do this renumbering on a standalone instance of troggle running on a <var> &#9874; <a href="/handbook/troggle/troglaptop.html">troggle development laptop</a></var> and you don't push any of the git commits to the server until you have got all the niggles out of the conversion, i.e. the databaseReset runs locally without any warnings or errors introduced by your renaming <em>and</em> 'cavern' runs without any new survex errors.

<h3>Copy this script and edit it to match the directory names on your PC</h3>
<textarea id="script" name="script" rows="{{rows}}" cols="110" style="font-size:small; font-weight: bold; background-color: LemonChiffon">
{{script}}
</textarea>

<br />
<!-- duplicate button at bottom of long page -->
	<button  class="fancybutton"  style="padding: 0.5em 25px; font-size: 100%;" type = "submit" >
		See what the edits look like &rarr;
	</button>	
</form>
<div style="color:red; font-weight: bold; font-size: large">
{{warning|safe}}<p>
{{error|safe}}</div>
{% endblock %}