diff options
-rw-r--r-- | core/views/other.py | 20 | ||||
-rw-r--r-- | parsers/logbooks.py | 11 | ||||
-rw-r--r-- | templates/controlPanel.html | 27 | ||||
-rw-r--r-- | urls.py | 8 |
4 files changed, 44 insertions, 22 deletions
diff --git a/core/views/other.py b/core/views/other.py index 9bb9c36..aadb613 100644 --- a/core/views/other.py +++ b/core/views/other.py @@ -148,15 +148,17 @@ def controlpanel(request): def exportlogbook(request,year=None,extension=None): - '''Constructs, from the database, a complete HTML (or TXT) formatted logbook - but TEXT ONLY - for the current year. Formats available are HTML2005 or 2008text + '''Constructs, from the database, a complete HTML formatted logbook - but TEXT ONLY + for the current year. Formats available are HTML2005 or HTML2022 (planned) There are no images stored in the database, so this is only a tool for a first pass, to be followed by extensive hand-editing. - NEED TO ADD IN THE MATERIAL WHIHC IS NOT IN ANY LBE ! e.g. front matter. + NEED TO ADD IN THE MATERIAL WHICH IS NOT IN ANY LBE ! e.g. front matter. - This is the recipient of the POST action os the export form in the control panel + This function DOES NOT WORK. + + This function is the recipient of the POST action os the export form in the control panel ''' def lbeKey(lbe): """This function goes into a lexicogrpahic sort function @@ -178,13 +180,13 @@ def exportlogbook(request,year=None,extension=None): #print(f'Logbook has {len(logbook_entries)} entries in it.') - if extension =='txt': - response = HttpResponse(content_type='text/plain') - style='2008' - else : - extension == 'html' + if extension == 'html2005': response = HttpResponse(content_type='text/html') style='2005' + else : + extension == 'html2022' + response = HttpResponse(content_type='text/html') + style='2022' filename='newlogbook.' + extension template='logbook'+style+'style.'+extension diff --git a/parsers/logbooks.py b/parsers/logbooks.py index 6b6c121..a1dd5ff 100644 --- a/parsers/logbooks.py +++ b/parsers/logbooks.py @@ -680,10 +680,13 @@ def LoadLogbooks(): TROG['pagecache']['expedition'][expo.year] = None # clear cache if expo.year not in nologbook: print((" - Logbook for: " + expo.year)) - numentries = LoadLogbookForExpedition(expo, entries[expo.year]) # this actually loads the logbook for one year - log.write("{} {:5d} should be {}\n".format(expo.year, numentries, entries[expo.year])) - nlbe[expo.year]=numentries - expd[expo.year]= 0 + if expo.year in entries: + numentries = LoadLogbookForExpedition(expo, entries[expo.year]) # this actually loads the logbook for one year + log.write("{} {:5d} should be {}\n".format(expo.year, numentries, entries[expo.year])) + nlbe[expo.year]=numentries + expd[expo.year]= 0 + else: + print((" - No Logbook yet for: " + expo.year)) # catch case when preparing for next expo print("** total trips in ObjStore:", len(trips)) #for i in logdataissues: # print("{:15s}: {}".format(i, logdataissues[i])) diff --git a/templates/controlPanel.html b/templates/controlPanel.html index 8d90315..5d4cac0 100644 --- a/templates/controlPanel.html +++ b/templates/controlPanel.html @@ -20,8 +20,24 @@ </div> {% endif %} -<div style="column-count: 2;"> -{%comment%} +<h3>This control panel is being redeveloped</h3> + +<p>Do not attempt to use any of these 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>The export of logbooks in a standard HTML-like format is very much not working. +</ol> +<p>Today (Jan. 2022) 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>There is currently no feedback here when an import failure occurs - even a catastrophic one. You can see the list of parsing errors on the most recent imports on the <a href="/dataissues">Data Issues</a> page. +<font style="color: silver"> + +<div style="column-count: 2; "> +{% comment %} <form name="reset" method="post" action=""> {% csrf_token %} <h3>Wipe:</h3> @@ -38,7 +54,7 @@ {% 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. +<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> @@ -111,8 +127,8 @@ <p> Output style: <select name="extension"> - <option value="html">.html file - 2005 style</option> - <option value="txt">.txt file with MediaWiki markup</option> + <option value="html2005">.html file - 2005 style</option> + <option value="html2022">.html file - 2022 style</option> </select> </p> <p> @@ -125,4 +141,5 @@ </table> </form> </div> +</font> {% endblock %}
\ No newline at end of file @@ -72,7 +72,7 @@ else: # accounts/reset/done/ [name='password_reset_complete'] trogglepatterns = [ - path('expofiles/', include(expofilesurls)), + path('expofiles/', include(expofilesurls)), # intercepted by Apache, if it is running. path('expofiles', include(expofilesurls)), # curious interaction with the include() here, not just a slash problem. re_path(r'^caves$', caves.caveindex, name="caveindex"), @@ -121,10 +121,10 @@ trogglepatterns = [ re_path(r'^cave/3d/(?P<cave_id>[^/]+)$', caves.cave3d, name="cave3d"), re_path(r'^cave/description/([^/]+)/?$', caves.caveDescription), - re_path(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"), #!!!BAD, local links fail + re_path(r'^cave/(?P<cave_id>[^/]+)/?$', caves.cave, name="cave"), #!!!BAD, local links fail.. to be checked.. re_path(r'^cave/(?P<cave_id>[^/]+)/?(?P<ent_letter>[^/])$', ent), # view_caves.ent re_path(r'^cave/(?P<slug>[^/]+)/edit/$', caves.edit_cave, name="edit_cave"), - re_path(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links may break + re_path(r'^(?P<karea>\d\d\d\d)(?P<subpath>.*)$', cavepage, name="cavepage"), # shorthand /1623/264 BUT url links break! Stop this.. # Note that urls eg '1623/161/l/rl89a.htm' are handled by cavepage which redirects them to 'expopage' # Entrances @@ -213,6 +213,6 @@ urlpatterns = [ # Alias /favicon.ico /home/expo/static/favicon.ico # to be changed # Alias /static/ /home/expo/static/ -# ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi +# ScriptAlias /repositories /home/expo/config/apache/services/hgweb/hgweb.cgi # UPDATE thios for git # ScriptAlias /boe /home/expo/boe/boc/boc.pl # ScriptAlias /boe-lastyear /home/expo/boe/boc-previous/boc.pl |