diff --git a/expo/context.py b/expo/context.py index 06215ce..bb38a84 100644 --- a/expo/context.py +++ b/expo/context.py @@ -1,4 +1,5 @@ from django.conf import settings +from expo.models import Expedition -def settings_context(request): - return { 'settings':settings } \ No newline at end of file +def troggle_context(request): + return { 'settings':settings, 'Expedition':Expedition } \ No newline at end of file diff --git a/expo/models.py b/expo/models.py index 74a26d4..798fa35 100644 --- a/expo/models.py +++ b/expo/models.py @@ -21,7 +21,7 @@ class TroggleModel(models.Model): return self._meta.object_name def get_admin_url(self): - return settings.URL_ROOT + "/admin/expo/" + self.object_name.lower() + "/" + str(self.pk) + return settings.URL_ROOT + "/admin/expo/" + self.object_name().lower() + "/" + str(self.pk) class Meta: abstract = True diff --git a/expo/views_caves.py b/expo/views_caves.py index 691cdcb..51c9e11 100644 --- a/expo/views_caves.py +++ b/expo/views_caves.py @@ -93,4 +93,3 @@ def survey(request,year,wallet_number): elevationSketches=current_survey.scannedimage_set.filter(contents='elevation') return render_response(request,'survey.html', locals()) - diff --git a/expo/views_other.py b/expo/views_other.py index 8f3af0d..4cbf786 100644 --- a/expo/views_other.py +++ b/expo/views_other.py @@ -60,17 +60,20 @@ def calendar(request,year): return render_response(request,'calendar.html', locals()) def controlPanel(request): - message = "no test message" #reverse('personn', kwargs={"name":"hkjhjh"}) + jobs_completed=[] if request.method=='POST': if request.user.is_superuser: - for item in request.POST: - if item!='item': + importlist=['import_people', 'import_cavetab', 'import_logbooks', 'import_surveys', 'import_QMs'] + databaseReset.make_dirs() + for item in importlist: + if item in request.POST: print "running"+ " databaseReset."+item+"()" exec "databaseReset."+item+"()" + jobs_completed.append(item) else: return HttpResponseRedirect(reverse('auth_login')) - return render_response(request,'controlPanel.html', {'caves':Cave.objects.all()} ) + return render_response(request,'controlPanel.html', {'caves':Cave.objects.all(),'jobs_completed':jobs_completed}) def downloadCavetab(request): from export import tocavetab @@ -98,4 +101,9 @@ def downloadQMs(request): response = HttpResponse(mimetype='text/csv') response['Content-Disposition'] = 'attachment; filename=qm.csv' toqms.writeQmTable(response,cave) - return response \ No newline at end of file + return response + +def ajax_test(request): + post_text = request.POST['post_data'] + return HttpResponse("{'response_text': '"+post_text+" recieved.'}", + mimetype="application/json") \ No newline at end of file diff --git a/media/css/dropdownNavStyle.css b/media/css/dropdownNavStyle.css index b3cf2b4..8ac9849 100644 --- a/media/css/dropdownNavStyle.css +++ b/media/css/dropdownNavStyle.css @@ -20,7 +20,7 @@ ul.dropdown li.hover a { color: black; background:gray;} */ ul.dropdown ul { width: 220px; visibility: hidden; position: absolute; bottom: 100%; left: 0px; margin-left:0px; padding-left: 0px; background:none} ul.dropdown ul li { font-weight: normal; color: black; background: none; border-bottom: 1px solid #ccc; float: none; padding:0px; margin:0px} - +ul.dropdown ul li:hover, ul.dropdown ul li a:hover { color:white;} /* IE 6 & 7 Needs Inline Block */ ul.dropdown ul li a { border-right: none; width: 100%; display: inline-block; color: black;} diff --git a/media/css/main3.css b/media/css/main3.css index 77657a0..2105050 100644 --- a/media/css/main3.css +++ b/media/css/main3.css @@ -199,24 +199,7 @@ a.redtext:link { } -.redtext -.menuBarItem { - font-variant: small-caps; - text-align: right; - border-top-style: none; - border-right-style: none; - border-bottom-style: none; - border-left-style: none; - border-top-width: thin; - border-right-width: thin; - border-bottom-width: thin; - border-left-width: thin; -} - -.menuBarItem : hover { - background: "rgb(125, 125, 125)"; -} .behind { @@ -327,9 +310,11 @@ h1 { #footerLinks{ position:fixed; bottom:0px; - padding: 0; - margin-left:130px; - margin-right:130px; + padding: 0px; + margin-left: 130px; + margin-right: 130px; + margin-bottom: 0px; + } /*.fadeIn { diff --git a/media/css/nav.css b/media/css/nav.css index 1c97c51..81f7918 100644 --- a/media/css/nav.css +++ b/media/css/nav.css @@ -1,12 +1,37 @@ div#nav { position:fixed; width: 12em; - background: rgb(153, 153, 153); + background: none; margin-top: 0px; - margin-left: 120px; - border-top: thin black solid; + margin-left: 130px; + border-right: thin black solid; + border-left: thin black solid; + border-bottom: thin black solid; + border-top: none; } div#content { padding-left:240px; +} + +.menuBarItem { + font-variant: small-caps; + text-align: right; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + border-top-width: thin; + border-right-width: thin; + border-bottom-width: thin; + border-left-width: thin; +} + +.menuBarItem:hover { + background:#333; +} + +.menuBarItem.on { + background:#333; + color:#999; } \ No newline at end of file diff --git a/media/js/base.js b/media/js/base.js index 7a7ed5e..62a72f4 100644 --- a/media/js/base.js +++ b/media/js/base.js @@ -16,7 +16,7 @@ function setMaxHeight(group, target) { } -/*This is the jquery comment stuff */ +/*This is the jquery stuff */ $(document).ready(function() { $('.searchable li').quicksearch({ @@ -42,12 +42,13 @@ $(".toggleMenu").click(function () { $(".toggleMenu").toggle(); }); -$(".nav").css('opacity','7') $(".footer").hide(); $(".fadeIn").hide(); setTimeout("$('.leftMargin.fadeIn').fadeIn(3000);",1000); setTimeout("$('.rightMargin.fadeIn').fadeIn(3000);",2000); - +$("a.closeDiv").click(function () { + $(this).parent().hide(); + }); /*$("#footerLinks").hover( function() {$(".footer").fadeIn("slow")}, diff --git a/parsers/QMs.py b/parsers/QMs.py index 732e913..571ec28 100644 --- a/parsers/QMs.py +++ b/parsers/QMs.py @@ -34,7 +34,7 @@ def parseCaveQMs(cave,inputFile): return qmPath = settings.EXPOWEB+inputFile - qmCSVContents = open(qmPath,'r') + qmCSVContents = open(qmPath,'rU') dialect=csv.Sniffer().sniff(qmCSVContents.read()) qmCSVContents.seek(0,0) qmReader = csv.reader(qmCSVContents,dialect=dialect) diff --git a/parsers/cavetab.py b/parsers/cavetab.py index 2dc071c..89e7728 100644 --- a/parsers/cavetab.py +++ b/parsers/cavetab.py @@ -137,7 +137,7 @@ def html_to_wiki(text): return out def LoadCaveTab(logfile=None): - cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV")) + cavetab = open(os.path.join(settings.EXPOWEB, "noinfo", "CAVETAB2.CSV"),'rU') caveReader = csv.reader(cavetab) caveReader.next() # Strip out column headers diff --git a/parsers/people.py b/parsers/people.py index 2950fb7..cd9a661 100644 --- a/parsers/people.py +++ b/parsers/people.py @@ -25,18 +25,22 @@ def saveMugShot(mugShotPath, mugShotFilename, person): mugShotFilename=mugShotFilename[2:] else: mugShotFilename=mugShotFilename # just in case one doesn't - - mugShotObj = models.Photo( - caption="Mugshot for "+person.first_name+" "+person.last_name, - is_mugshot=True, - file=mugShotFilename, + + dummyObj=models.Photo(file=mugShotFilename) + + #Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py + if not os.path.exists(dummyObj.file.path): + shutil.copy(mugShotPath, dummyObj.file.path) + + mugShotObj, created = save_carefully( + models.Photo, + lookupAttribs={'is_mugshot':True, 'file':mugShotFilename}, + nonLookupAttribs={'caption':"Mugshot for "+person.first_name+" "+person.last_name} ) - shutil.copy(mugShotPath, mugShotObj.file.path) #Put a copy of the file in the right place. mugShotObj.file.path is determined by the django filesystemstorage specified in models.py - - mugShotObj.save() - mugShotObj.contains_person.add(person) - mugShotObj.save() + if created: + mugShotObj.contains_person.add(person) + mugShotObj.save() def parseMugShotAndBlurb(personline, header, person): #create mugshot Photo instance @@ -46,10 +50,11 @@ def parseMugShotAndBlurb(personline, header, person): saveMugShot(mugShotPath=mugShotPath, mugShotFilename=mugShotFilename, person=person) elif mugShotPath[-3:]=='htm': #if person has an html page, find the image(s) and add it. Also, add the text from the html page to the "blurb" field in his model instance. personPageOld=open(mugShotPath,'r').read() - person.blurb=re.search('
.*