2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2025-12-16 15:47:03 +00:00

Merge branch 'master' of ssh://expo.survex.com/~/troggle

# Conflicts:
#	README.txt
This commit is contained in:
Sam Wenham
2019-07-29 11:36:24 +01:00
7 changed files with 28 additions and 14 deletions

View File

@@ -21,6 +21,8 @@ Troggle itself
Choose a directory where you will keep troggle, and git clone Troggle into it using the following command: Choose a directory where you will keep troggle, and git clone Troggle into it using the following command:
git clone git://expo.survex.com/troggle git clone git://expo.survex.com/troggle
or more reliably
git clone ssh://expo@expo.survex.com/home/expo/troggle
If you want to work on the source code and be able to commit, your account will need to be added to the troggle project members list. Contact wookey at wookware dot org to get this set up. If you want to work on the source code and be able to commit, your account will need to be added to the troggle project members list. Contact wookey at wookware dot org to get this set up.

View File

@@ -165,4 +165,4 @@ def editflatpage(request, path):
class FlatPageForm(forms.Form): class FlatPageForm(forms.Form):
title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'})) title = forms.CharField(widget=forms.TextInput(attrs={'size':'60'}))
html = forms.CharField(widget=forms.Textarea()) html = forms.CharField(widget=TinyMCE(attrs={'cols': 80, 'rows': 20}))

View File

@@ -47,13 +47,13 @@ MEDIA_URL = URL_ROOT + DIR_ROOT + 'site_media/'
MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/' MEDIA_ROOT = REPOS_ROOT_PATH + '/troggle/media/'
MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/' MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/'
STATIC_URL = URL_ROOT STATIC_URL = "/static/"
STATIC_ROOT = DIR_ROOT STATIC_ROOT = "/expo/static"
JSLIB_URL = URL_ROOT + 'javascript/' JSLIB_URL = URL_ROOT + 'javascript/'
TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/'
TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + '/tinymce_media/' TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
PYTHON_PATH + "templates", PYTHON_PATH + "templates",

View File

@@ -52,8 +52,8 @@ MEDIA_ADMIN_DIR = '/usr/lib/python2.7/site-packages/django/contrib/admin/media/'
JSLIB_URL = URL_ROOT + 'javascript/' JSLIB_URL = URL_ROOT + 'javascript/'
TINY_MCE_MEDIA_ROOT = '/usr/share/tinymce/www/' TINY_MCE_MEDIA_ROOT = STATIC_ROOT + '/tiny_mce/'
TINY_MCE_MEDIA_URL = URL_ROOT + DIR_ROOT + 'tinymce_media/' TINY_MCE_MEDIA_URL = STATIC_ROOT + '/tiny_mce/'
TEMPLATE_DIRS = ( TEMPLATE_DIRS = (
PYTHON_PATH + "templates", PYTHON_PATH + "templates",

View File

@@ -28,6 +28,7 @@ from utils import save_carefully
def GetTripPersons(trippeople, expedition, logtime_underground): def GetTripPersons(trippeople, expedition, logtime_underground):
res = [ ] res = [ ]
author = None author = None
round_bracket_regex = re.compile(r"[\(\[].*?[\)\]]")
for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople): for tripperson in re.split(r",|\+|&|&(?!\w+;)| and ", trippeople):
tripperson = tripperson.strip() tripperson = tripperson.strip()
mul = re.match(r"<u>(.*?)</u>$(?i)", tripperson) mul = re.match(r"<u>(.*?)</u>$(?i)", tripperson)
@@ -35,6 +36,7 @@ def GetTripPersons(trippeople, expedition, logtime_underground):
tripperson = mul.group(1).strip() tripperson = mul.group(1).strip()
if tripperson and tripperson[0] != '*': if tripperson and tripperson[0] != '*':
#assert tripperson in personyearmap, "'%s' << %s\n\n %s" % (tripperson, trippeople, personyearmap) #assert tripperson in personyearmap, "'%s' << %s\n\n %s" % (tripperson, trippeople, personyearmap)
tripperson = re.sub(round_bracket_regex, "", tripperson).strip()
personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower()) personyear = GetPersonExpeditionNameLookup(expedition).get(tripperson.lower())
if not personyear: if not personyear:
print(" - No name match for: '%s'" % tripperson) print(" - No name match for: '%s'" % tripperson)

View File

@@ -4,6 +4,8 @@ from django.conf import settings
import troggle.core.models as models import troggle.core.models as models
import csv, re, datetime, os, shutil import csv, re, datetime, os, shutil
from utils import save_carefully from utils import save_carefully
from HTMLParser import HTMLParser
from unidecode import unidecode
def saveMugShot(mugShotPath, mugShotFilename, person): def saveMugShot(mugShotPath, mugShotFilename, person):
if mugShotFilename.startswith(r'i/'): #if filename in cell has the directory attached (I think they all do), remove it if mugShotFilename.startswith(r'i/'): #if filename in cell has the directory attached (I think they all do), remove it
@@ -132,11 +134,12 @@ def GetPersonExpeditionNameLookup(expedition):
print("Calculating GetPersonExpeditionNameLookup for " + expedition.year) print("Calculating GetPersonExpeditionNameLookup for " + expedition.year)
personexpeditions = models.PersonExpedition.objects.filter(expedition=expedition) personexpeditions = models.PersonExpedition.objects.filter(expedition=expedition)
htmlparser = HTMLParser()
for personexpedition in personexpeditions: for personexpedition in personexpeditions:
possnames = [ ] possnames = [ ]
f = personexpedition.person.first_name.lower() f = unidecode(htmlparser.unescape(personexpedition.person.first_name.lower()))
l = personexpedition.person.last_name.lower() l = unidecode(htmlparser.unescape(personexpedition.person.last_name.lower()))
full = personexpedition.person.fullname.lower() full = unidecode(htmlparser.unescape(personexpedition.person.fullname.lower()))
if l: if l:
possnames.append(f + " " + l) possnames.append(f + " " + l)
possnames.append(f + " " + l[0]) possnames.append(f + " " + l[0])
@@ -154,6 +157,8 @@ def GetPersonExpeditionNameLookup(expedition):
possnames.append(personexpedition.nickname.lower() + " " + l) possnames.append(personexpedition.nickname.lower() + " " + l)
if str(personexpedition.nickname.lower() + " " + l[0]) not in possnames: if str(personexpedition.nickname.lower() + " " + l[0]) not in possnames:
possnames.append(personexpedition.nickname.lower() + " " + l[0]) possnames.append(personexpedition.nickname.lower() + " " + l[0])
if str(personexpedition.nickname.lower() + l[0]) not in possnames:
possnames.append(personexpedition.nickname.lower() + l[0])
for possname in possnames: for possname in possnames:
if possname in res: if possname in res:

View File

@@ -3,6 +3,11 @@
{% block extrahead %} {% block extrahead %}
{% load csrffaker %} {% load csrffaker %}
<script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script> <script src="{{ settings.TINY_MCE_MEDIA_URL }}tiny_mce.js" type="text/javascript"></script>
<script type="text/javascript">
tinyMCE.init({
mode : "textareas"
});
</script>
{% endblock %} {% endblock %}
{% block body %} {% block body %}
<h1>Edit {{ path }}</h1> <h1>Edit {{ path }}</h1>