From c357a916b55192b0bfdb29d9e26c6e3c5dbb342b Mon Sep 17 00:00:00 2001 From: Roy Williams <roy@caltech.edu> Date: Mon, 25 Aug 2014 11:28:53 -0700 Subject: [PATCH] roys version of embb --- django.wsgi | 8 +- gracedb/admin.py | 7 +- gracedb/models.py | 120 +++++++- gracedb/settings | 1 - gracedb/urls.py | 3 + gracedb/views.py | 39 +++ ligoauth/middleware/auth.py | 5 +- manage.py | 2 + settings.py | 181 ++++++++++++ {settings => settingsdir}/__init__.py | 0 {settings => settingsdir}/branson.py | 0 {settings => settingsdir}/default.py | 0 {settings => settingsdir}/development.py | 0 {settings => settingsdir}/development_er2.py | 0 {settings => settingsdir}/production.py | 0 {settings => settingsdir}/stage.py | 0 templates/forbidden.html | 2 +- templates/gracedb/event_detail.html | 272 ++++++++++++++++++- urls.py | 6 +- 19 files changed, 626 insertions(+), 20 deletions(-) delete mode 120000 gracedb/settings create mode 100644 settings.py rename {settings => settingsdir}/__init__.py (100%) rename {settings => settingsdir}/branson.py (100%) rename {settings => settingsdir}/default.py (100%) rename {settings => settingsdir}/development.py (100%) rename {settings => settingsdir}/development_er2.py (100%) rename {settings => settingsdir}/production.py (100%) rename {settings => settingsdir}/stage.py (100%) diff --git a/django.wsgi b/django.wsgi index 31d11ce1d..bfd45820e 100644 --- a/django.wsgi +++ b/django.wsgi @@ -2,12 +2,14 @@ import os import sys os.environ['DJANGO_SETTINGS_MODULE'] = 'settings' +os.environ['MPLCONFIGDIR']='/tmp/' # Sandbox libs here, if required. # -sys.path.append('/home/lars/wsgi-sandbox/lib/python2.6') -sys.path.append('/home/lars/wsgi-sandbox/lib/python2.6/site-packages') -sys.path.append('/home/gracedb/graceproj') +sys.path.append('/home/jkanner/djangoenv/lib/python2.7/site-packages') +sys.path.append('/home/jkanner/djangoenv/lib/python2.7') +sys.path.append('/home/roywilliams/gracedbdev') +sys.path.append('/home/roywilliams') # Scott's Shib app uses loggers. import logging diff --git a/gracedb/admin.py b/gracedb/admin.py index bc37adcea..8e5a94080 100644 --- a/gracedb/admin.py +++ b/gracedb/admin.py @@ -1,5 +1,5 @@ -from models import Event, EventLog, Group +from models import Event, EventLog, EMBBEventLog, Group from models import Label, Labelling, Tag from django.contrib import admin @@ -22,6 +22,10 @@ class EventLogAdmin(admin.ModelAdmin): list_display = [ 'event', 'issuer', 'filename', 'comment' ] search_fields = [ 'event__id', 'issuer__name', 'filename', 'comment'] +#class EMBBEventLogAdmin(admin.ModelAdmin): +# list_display = [ 'event' ] +# search_fields = [ 'event__id'] + class LabellingAdmin(admin.ModelAdmin): list_display = [ 'event', 'label', 'creator' ] search_fields = [ 'event__id', 'label__name', 'creator__name' ] @@ -32,6 +36,7 @@ class TagAdmin(admin.ModelAdmin): admin.site.register(Event, EventAdmin) admin.site.register(EventLog, EventLogAdmin) +#admin.site.register(EMBBEventLog, EMBBEventLogAdmin) admin.site.register(Group) admin.site.register(Label, LabelAdmin) admin.site.register(Labelling, LabellingAdmin) diff --git a/gracedb/models.py b/gracedb/models.py index 64db85b57..9999fcf6a 100644 --- a/gracedb/models.py +++ b/gracedb/models.py @@ -48,7 +48,6 @@ schema_version = "1.1" #def __unicode__(self): #return self.name - class Group(models.Model): name = models.CharField(max_length=20) def __unicode__(self): @@ -113,6 +112,7 @@ class Event(models.Model): def weburl(self): # XXX Not good. But then, it never was. + return "https://losc-gracedb.ligo.org/gracedb/events/%s" % self.graceid() return "https://gracedb.ligo.org/gracedb-files/%s" % self.graceid() return "https://ldas-jobs.phys.uwm.edu/gracedb/data/%s" % self.graceid() @@ -273,6 +273,124 @@ class EventLog(models.Model): # in the views that use it and give an informative error message. raise Exception("Too many attempts to save log message. Something is wrong.") +class EMFacility(models.Model): + name = models.CharField(max_length=200, unique=True) + shortName = models.CharField(max_length=20, unique=True) + + # XXX what else? Possibly the liason. These can be populated + # automatically from the gw-astronomy COManage-provisioned LDAP. + liason = models.ForeignKey(DjangoUser) + + # XXX Characteristics needed to produce pointings? + + def __unicode__(self): + return self.name + +EMSPECTRUM = ( +('em.gamma', 'Gamma rays part of the spectrum'), +('em.gamma.soft', 'Soft gamma ray (120 - 500 keV)'), +('em.gamma.hard', 'Hard gamma ray (>500 keV)'), +('em.X-ray', 'X-ray part of the spectrum'), +('em.X-ray.soft', 'Soft X-ray (0.12 - 2 keV)'), +('em.X-ray.medium', 'Medium X-ray (2 - 12 keV)'), +('em.X-ray.hard', 'Hard X-ray (12 - 120 keV)'), +('em.UV', 'Ultraviolet part of the spectrum'), +('em.UV.10-50nm', 'Ultraviolet between 10 and 50 nm'), +('em.UV.50-100nm', 'Ultraviolet between 50 and 100 nm'), +('em.UV.100-200nm', 'Ultraviolet between 100 and 200 nm'), +('em.UV.200-300nm', 'Ultraviolet between 200 and 300 nm'), +('em.UV.FUV', 'Far-Infrared, 30-100 microns'), +('em.opt', 'Optical part of the spectrum'), +('em.opt.U', 'Optical band between 300 and 400 nm'), +('em.opt.B', 'Optical band between 400 and 500 nm'), +('em.opt.V', 'Optical band between 500 and 600 nm'), +('em.opt.R', 'Optical band between 600 and 750 nm'), +('em.opt.I', 'Optical band between 750 and 1000 nm'), +('em.IR', 'Infrared part of the spectrum'), +('em.IR.NIR', 'Near-Infrared, 1-5 microns'), +('em.IR.J', 'Infrared between 1.0 and 1.5 micron'), +('em.IR.H', 'Infrared between 1.5 and 2 micron'), +('em.IR.K', 'Infrared between 2 and 3 micron'), +('em.IR.MIR', 'Medium-Infrared, 5-30 microns'), +('em.IR.3-4um', 'Infrared between 3 and 4 micron'), +('em.IR.4-8um', 'Infrared between 4 and 8 micron'), +('em.IR.8-15um', 'Infrared between 8 and 15 micron'), +('em.IR.15-30um', 'Infrared between 15 and 30 micron'), +('em.IR.30-60um', 'Infrared between 30 and 60 micron'), +('em.IR.60-100um', 'Infrared between 60 and 100 micron'), +('em.IR.FIR', 'Far-Infrared, 30-100 microns'), +('em.mm', 'Millimetric part of the spectrum'), +('em.mm.1500-3000GHz', 'Millimetric between 1500 and 3000 GHz'), +('em.mm.750-1500GHz', 'Millimetric between 750 and 1500 GHz'), +('em.mm.400-750GHz', 'Millimetric between 400 and 750 GHz'), +('em.mm.200-400GHz', 'Millimetric between 200 and 400 GHz'), +('em.mm.100-200GHz', 'Millimetric between 100 and 200 GHz'), +('em.mm.50-100GHz', 'Millimetric between 50 and 100 GHz'), +('em.mm.30-50GHz', 'Millimetric between 30 and 50 GHz'), +('em.radio', 'Radio part of the spectrum'), +('em.radio.12-30GHz', 'Radio between 12 and 30 GHz'), +('em.radio.6-12GHz', 'Radio between 6 and 12 GHz'), +('em.radio.3-6GHz', 'Radio between 3 and 6 GHz'), +('em.radio.1500-3000MHz','Radio between 1500 and 3000 MHz'), +('em.radio.750-1500MHz','Radio between 750 and 1500 MHz'), +('em.radio.400-750MHz', 'Radio between 400 and 750 MHz'), +('em.radio.200-400MHz', 'Radio between 200 and 400 MHz'), +('em.radio.100-200MHz', 'Radio between 100 and 200 MHz'), +('em.radio.20-100MHz', 'Radio between 20 and 100 MHz'), +) + +class EMBBEventLog(models.Model): + """EMBB EventLog: A multi-purpose annotation for EM followup. + + A rectangle on the sky, equatorially aligned, + that has or will be imaged that is related to an event""" + + # The gracedb event that this Eel relates to + event = models.ForeignKey(Event) + + # The responsible author of this communication + submitter = models.ForeignKey(DjangoUser) # from a table of people + + # The instrument used or intended for the imaging implied by this footprint + facility = models.ForeignKey(EMFacility) # from a table of facilities + + # Facility-local identifier for this footprint + footprintID= models.CharField(max_length=200,null=True) + # Now the global ID is a concatenation: facilityName#footprintID + + # the EM waveband used for the imaging as below + waveband = models.CharField(max_length=25, choices=EMSPECTRUM) + + # The center of the rectangular foorprint, right ascension and declination + # in J2000 in decimal degrees + ra = models.FloatField(null=True) + dec = models.FloatField(null=True) + + # The width and height (RA range and Dec range) in decimal degrees + raWidth = models.FloatField(null=True) + decWidth = models.FloatField(null=True) + + # The GPS time of the middle of of the imaging time + gpstime = models.PositiveIntegerField(null=True) + + # The duration of the imaging in seconds + duration = models.PositiveIntegerField(null=True) + + # Event Log status + EEL_STATUS_CHOICES = (('FO','FOOTPRINT'), ('SO','SOURCE'), ('CO','COMMENT'), ('CI','CIRCULAR')) + eel_status = models.CharField(max_length=2, choices=EEL_STATUS_CHOICES) + + # Observation status. If OBSERVATION, then there is a good chance of good image + OBS_STATUS_CHOICES = (('OB','OBSERVATION'), ('TE','TEST'), ('PR','PREDICTION')) + obs_status = models.CharField(max_length=2, choices=OBS_STATUS_CHOICES) + + # This field is natural language for human + comment = models.TextField(null=True) + + # This field is formal struct by a syntax TBD + # for example {"phot.mag.limit": 22.3} + extra_info_dict = models.TextField(null=True) + class Labelling(models.Model): event = models.ForeignKey(Event) label = models.ForeignKey(Label) diff --git a/gracedb/settings b/gracedb/settings deleted file mode 120000 index 1aea006e6..000000000 --- a/gracedb/settings +++ /dev/null @@ -1 +0,0 @@ -/home/bmoe/gracedb/settings \ No newline at end of file diff --git a/gracedb/urls.py b/gracedb/urls.py index 0636ffce0..62a4daadd 100644 --- a/gracedb/urls.py +++ b/gracedb/urls.py @@ -14,10 +14,13 @@ urlpatterns = patterns('gracedb.views', url (r'^skyalert/(?P<graceid>[GEHT]\d+)', 'skyalert', name="skyalert"), url (r'^neighbors/(?P<graceid>[GEHT]\d+)/\(?(?P<delta1>[-+]?\d+)(,(?P<delta2>[-+]?\d+)\)?)?', 'neighbors', name="neighbors"), url (r'^(?P<graceid>[GEHT]\d+)$', 'view', name="view2"), + url (r'^skymapViewer/(?P<graceid>[GEHT]\d+)$', 'skymap_view', name="skymap_view"), url (r'^(?P<graceid>[GEHT]\d+)/files/(?P<filename>.*)$', download, name="file"), url (r'^(?P<graceid>[GEHT]\d+)/log/(?P<num>([\d]*|preview))$', 'logentry', name="logentry"), url (r'^(?P<graceid>[GEHT]\d+)/log/(?P<num>\d+)/tag/(?P<tagname>\w+)$', 'taglogentry', name="taglogentry"), +# RDW Aug 2014 +#(r'^admin/', include(admin.site.urls)), # (r'^view/(?P<uid>[\w\d]+)', 'view'), # (r'^edit/(?P<uid>[\w\d]+)', 'edit'), diff --git a/gracedb/views.py b/gracedb/views.py index 464b556ec..c556b8e35 100644 --- a/gracedb/views.py +++ b/gracedb/views.py @@ -1235,3 +1235,42 @@ def performance(request): context, context_instance=RequestContext(request)) +def skymap_view(request, graceid): + filename=request.GET.get('filename','skymap.json') + file_version=request.GET.get('version', None) + viewer=request.GET.get('viewer','aladin') + + context = {} + try: + event = Event.getByGraceid(graceid) + except Event.DoesNotExist: + raise Http404 + + if viewer not in ['aladin','wwt',]: + return HttpResponseBadRequest("Unsupported viewer. Choices are 'aladin' or 'wwt'.") + + # Now look for the JSON skymap contours file. + if file_version: + filename += ',%s' % file_version + filepath = os.path.join(event.datadir(), filename) + + content = None + if not os.path.exists(filepath): + response = HttpResponseNotFound("File and/or version does not exist") + elif not os.access(filepath, os.R_OK): + response = HttpResponseNotFound("File not readable") + elif os.path.isfile(filepath): + f = open(filepath, "r") + content = f.read() + # XXX Removing the newlines is necessary for some reason. + content = content.replace('\n','') + f.close() + + context['content'] = content + context['graceid'] = graceid + # I wonder if there is a nicer way to get it into the context + context['SKYMAP_VIEWER_MEDIA_URL'] = settings.SKYMAP_VIEWER_MEDIA_URL; + return render_to_response( + 'gracedb/%s_skymap_viewer.html' % viewer, context, + context_instance=RequestContext(request)) + diff --git a/ligoauth/middleware/auth.py b/ligoauth/middleware/auth.py index cf5ac5248..60f2a18de 100644 --- a/ligoauth/middleware/auth.py +++ b/ligoauth/middleware/auth.py @@ -51,12 +51,13 @@ class LigoAuthMiddleware: # An authenticated LIGO user will have one of these set. remote_user = request.META.get('REMOTE_USER') + message = remote_user dn = cert_dn_from_request(request) if remote_user: user = authenticate(principal=remote_user) if not (user and user.is_authenticated()): - # XXX THIS SHOULD NEVER HAPPEN + message += "THIS SHOULD NEVER HAPPEN" pass if not user and dn: @@ -88,7 +89,7 @@ class LigoAuthMiddleware: return HttpResponseForbidden("{ 'error': '%s' }" % message) return render_to_response( 'forbidden.html', - {}, + {'error': message}, context_instance=RequestContext(request)) class RemoteUserBackend(DefaultRemoteUserBackend): diff --git a/manage.py b/manage.py index aac8ce41a..91df9cd1c 100755 --- a/manage.py +++ b/manage.py @@ -1,5 +1,6 @@ #!/usr/bin/env python from django.core.management import execute_manager +import os try: @@ -10,4 +11,5 @@ except ImportError: sys.exit(1) if __name__ == "__main__": + os.environ.setdefault("DJANGO_SETTINGS_MODULE", "settings") execute_manager(settings) diff --git a/settings.py b/settings.py new file mode 100644 index 000000000..8318e6ff8 --- /dev/null +++ b/settings.py @@ -0,0 +1,181 @@ +# XXX I know import * is ugly, but I want the stuff from logSettings to be +# in this namespace. +# from logSettings import * + +CONFIG_NAME = "Roy" + +DEBUG = True +TEMPLATE_DEBUG = DEBUG +# LOG_ROOT = '/home/jkanner/logs' +# LOGGING={} + +DATABASES = { + 'default' : { + 'NAME' : 'gracedb', + 'ENGINE' : 'django.db.backends.mysql', + 'USER' : 'jkanner', + 'PASSWORD' : 'batman', + } +} + +ROOT_URLCONF = 'urls' + +MEDIA_URL = "/gracedb-static/" + +SKYMAP_VIEWER_MEDIA_URL = "/skymap-viewer/" + +GRACEDB_DATA_DIR = "/home/roywilliams/gracedbData" +MPLCONFIGDIR = "/home/jkanner/mplconfig" + +ALERT_EMAIL_FROM = "Dev Alert <root@losc-gracedb.ligo.org>" +ALERT_EMAIL_TO = [ + "Roy Williams <roy@caltech.edu>", + ] +ALERT_EMAIL_BCC = ["roy@caltech.edu"] + +ALERT_TEST_EMAIL_FROM = "Dev Test Alert <root@losc-gracedb.ligo.org>" +ALERT_TEST_EMAIL_TO = [ + "Roy Williams <roy@caltech.edu>", + ] + + +BLESSED_TAGS = [ + 'analyst_comments', + 'psd', + 'data_quality', + 'sky_loc', + 'background', + 'ext_coinc', + 'strain', + 'tfplots', + 'sig_info', + 'audio', + ] + + +# Don't sent out non-test XMPP alerts on dev box! +XMPP_ALERT_CHANNELS = [ + 'test_omega', + 'test_mbtaonline', + 'test_cwb', + 'test_lowmass', + ] + +# SkyAlert +SKYALERT_IVORN_PATTERN = "ivo://ligo.org/gracedb#%s-dev" + +# Latency histograms. Where they go and max latency to bin. +LATENCY_REPORT_DEST_DIR = "/home/jkanner/data/latency" +LATENCY_REPORT_WEB_PAGE_FILE_PATH = LATENCY_REPORT_DEST_DIR + "/latency.inc" + +# Uptime reporting +UPTIME_REPORT_DIR = "/home/jkanner/data/uptime" + + +SITE_ID = 4 + +TEMPLATE_DIRS = ( + # Put strings here, like "/home/html/django_templates" or "C:/www/django/templates". + # Always use forward slashes, even on Windows. + # Don't forget to use absolute paths, not relative paths. + "/home/roywilliams/gracedbdev/templates", +) + +MIDDLEWARE_CLASSES = [ + 'middleware.accept.AcceptMiddleware', + 'middleware.cli.CliExceptionMiddleware', + 'django.middleware.common.CommonMiddleware', + 'django.contrib.sessions.middleware.SessionMiddleware', + 'django.contrib.messages.middleware.MessageMiddleware', +# 'django.contrib.auth.middleware.AuthenticationMiddleware', +# 'ligodjangoauth.LigoShibbolethMiddleware', + 'ligoauth.middleware.auth.LigoAuthMiddleware', + 'maintenancemode.middleware.MaintenanceModeMiddleware', + 'debug_toolbar.middleware.DebugToolbarMiddleware', +] + +AUTHENTICATION_BACKENDS = ( +# 'gracedb.middleware.auth.LigoAuthBackend', + 'ligoauth.middleware.auth.LigoX509Backend', + 'ligoauth.middleware.auth.LigoShibBackend', +# 'ligoauth.middleware.auth.RemoteUserBackend', +# 'ligodjangoauth.LigoShibbolethAuthBackend', +# 'django.contrib.auth.backends.ModelBackend', +) + + +TEMPLATE_CONTEXT_PROCESSORS = ( + #"django.core.context_processors.auth", + # replaced by... + "django.contrib.auth.context_processors.auth", + "django.core.context_processors.debug", + "django.core.context_processors.i18n", + "django.core.context_processors.media", + "django.core.context_processors.static", + "django.core.context_processors.request", + "gracedb.middleware.auth.LigoAuthContext", + 'middleware.debug.LigoDebugContext', +) + + +INSTALLED_APPS = ( + 'django.contrib.auth', + 'django.contrib.admin', + 'django.contrib.contenttypes', + 'django.contrib.sessions', + 'django.contrib.sites', + 'django.contrib.staticfiles', + 'gracedb', + 'userprofile', + 'ligoauth', + 'rest_framework', + 'south', + 'debug_toolbar', +) + +INTERNAL_IPS = ( + '129.89.61.55', +) + + +x = """ HACH HACK HACK +LOG_ROOT = '/home/jkanner/logs' +LOG_FILE_SIZE = 1024*1024 # 1 MB +LOG_FILE_BAK_CT = 3 + +LOGGING = { + 'version': 1, + 'disable_existing_loggers' : True, + 'formatters': { + 'simple': { + 'format': '%(asctime)s: %(message)s', + 'datefmt': '%Y-%m-%dT%H:%M:%S', + }, + }, + 'handlers': { + 'null': { + 'level':'DEBUG', + 'class':'django.utils.log.NullHandler', + }, + 'performance_file': { + 'class': 'logging.handlers.RotatingFileHandler', + 'formatter': 'simple', + 'filename': '%s/gracedb_performance.log' % LOG_ROOT, + 'maxBytes': LOG_FILE_SIZE, + 'backupCount': LOG_FILE_BAK_CT, + }, + }, + 'loggers': { + 'django': { + 'handlers': ['null'], + 'propagate': True, + 'level': 'INFO', + }, + 'middleware': { + 'handlers': ['performance_file'], + 'propagate': True, + 'level': 'INFO', + }, + }, +} +""" diff --git a/settings/__init__.py b/settingsdir/__init__.py similarity index 100% rename from settings/__init__.py rename to settingsdir/__init__.py diff --git a/settings/branson.py b/settingsdir/branson.py similarity index 100% rename from settings/branson.py rename to settingsdir/branson.py diff --git a/settings/default.py b/settingsdir/default.py similarity index 100% rename from settings/default.py rename to settingsdir/default.py diff --git a/settings/development.py b/settingsdir/development.py similarity index 100% rename from settings/development.py rename to settingsdir/development.py diff --git a/settings/development_er2.py b/settingsdir/development_er2.py similarity index 100% rename from settings/development_er2.py rename to settingsdir/development_er2.py diff --git a/settings/production.py b/settingsdir/production.py similarity index 100% rename from settings/production.py rename to settingsdir/production.py diff --git a/settings/stage.py b/settingsdir/stage.py similarity index 100% rename from settings/stage.py rename to settingsdir/stage.py diff --git a/templates/forbidden.html b/templates/forbidden.html index e383758b9..64e1485fc 100644 --- a/templates/forbidden.html +++ b/templates/forbidden.html @@ -6,6 +6,6 @@ {% block heading %}Forbidden{{ object.graceid }}{% endblock %} {% block content %} - <p>The item you requested is not for you.</p> {{ message|safe }} + <p>You are {{ error }} and the item you requested is not for you.</p> {{ message|safe }} {% endblock %} diff --git a/templates/gracedb/event_detail.html b/templates/gracedb/event_detail.html index 517b78954..8858761f1 100644 --- a/templates/gracedb/event_detail.html +++ b/templates/gracedb/event_detail.html @@ -30,6 +30,10 @@ // Generate an array, the elements of which contain the inner html for each thematic digest //------------------------------------------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------------------------------------------ + + function divFunction() { + } + function getDigests() { var digests = new Array(); {% for tag in object.getAvailableTags %} @@ -505,7 +509,7 @@ <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojox/editor/plugins/resources/css/CollapsibleToolbar.css" /> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojox/editor/plugins/resources/css/Blockquote.css" /> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dojox/editor/plugins/resources/css/Smiley.css" /> - <style> +<style> @import "https://ajax.googleapis.com/ajax/libs/dojo/1.7.1/dijit/themes/tundra/tundra.css"; a:hover .dojoxEnlarge { display: block !important; @@ -596,8 +600,9 @@ {% endblock %} </div> -<!-- Neighbors Support refresh_neighbors() function --> -<script type="text/javascript"> +<p> + <!-- Neighbors Support refresh_neighbors() function --> + <script type="text/javascript"> var refresh_neighbors= function() { alert("NOT SET YET"); }; require(["dojo/dom", "dojo/html", "dojo/request", "dojo/domReady!"], function (dom, html, request) { @@ -623,21 +628,270 @@ }); require(["dijit/InlineEditBox", "dijit/form/NumberSpinner", "dijit/form/TextBox"]); -</script> + </script> + + {% include "gracedb/neighbors_frag.html" %} +</p> + + <!-- Single Inspiral Data --> + + + <div id="bulletin_board" data-dojo-type="dijit/TitlePane" + data-dojo-props="title: 'EM Follow-up Bulletin Board', open: false"> + + <script> + require(["dojo/dom-construct", "dojo/dom", "dojo/on", "dojo/domReady!"], + function(domConstruct, dom, on){ + on(dom.byId("button2"), "click", function(){ + var subm = document.getElementById('submitter').value; + var faci = document.getElementById('facility').value; + var filt = document.getElementById('filter').value; + var rahh = document.getElementById('ra1').value; + var ramm = document.getElementById('ra2').value; + var rass = document.getElementById('ra3').value; + var decl = document.getElementById('dec').value; + var tsta = document.getElementById('ts').value; + var tend = document.getElementById('te').value; + var lima = document.getElementById('lm').value; + var comm = document.getElementById('cm').value; + var tgla = document.getElementById('tgla').value; + var tgln = document.getElementById('tgln').value; + var tela = document.getElementById('tela').value; + var teln = document.getElementById('teln').value; + + var row = domConstruct.toDom("<tr><td>" + "" + + "</td><td>" + subm + + "</td><td>" + faci + + "</td><td>" + filt + + "</td><td>" + rahh + "hh" + ramm + "mm" + rass + "ss" + + "</td><td>" + decl + + "</td><td>" + tsta + + "</td><td>" + tend + + "</td><td>" + lima + + "</td><td>" + comm + + "</td><td>" + tgla + + "</td><td>" + tgln + + "</td><td>" + tela + + "</td><td>" + teln + + "</td></tr>"); + domConstruct.place(row, "bb_log"); + }); + }); + </script> + + + + + <div data-dojo-type="dijit/form/Form" id="myForm" + data-dojo-id="myForm" encType="multipart/form-data" action="" + method=""> + <script> + require(["dojo/parser", "dijit/form/Form", "dijit/form/Button", "dijit/form/ValidationTextBox", "dijit/form/DateTextBox"]); + </script> + + <script type="dojo/on" data-dojo-event="reset"> + return confirm('Press OK to reset widget values'); + </script> + + <script type="dojo/on" data-dojo-event="submit"> + if(this.validate()){ + return confirm('Form is valid, press OK to submit'); + }else{ + alert('Form contains invalid data. Please correct first'); + return false; + } + return true; + </script> + + Make a Bulletin Board Entry Here + + <table id="subcontent" width="430" BORDER="1"> + <tr> + <td width="150"><label for="submitter">Submitter:</label> + </td> + <td width="250"><input type="text" id="submitter" + name="submitter" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /></td> + </tr> + + <tr> + <td><label for="facility">Facility:</label> + </td> + <td><input type="text" id="facility" name="facility" + size="45" data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td><label for="filter">Filter Name:</label> + </td> + <td><input type="text" id="filter" name="filter" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td><label for="ra">RA (Right Ascention):</label></td> + <td><input type="number" id="ra1" name="ra1" value="00" style="width: 3em;" min="0" + max="23" data-dojo-type="dijit/form/ValidationTextBox" required="true" + data-dojo-props="regExp:'\\d{2}', invalidMessage:'Two digit number only.'" /> + <label for="ra1">hh</label> + <input type="number" id="ra2" name="ra2" value="00" style="width: 3em;" min="0" + max="59" data-dojo-type="dijit/form/ValidationTextBox" required="true" + data-dojo-props="regExp:'\\d{2}', invalidMessage:'Two digit number only.'" /> + <label for="ra2">mm</label> + <input type="number" id="ra3" name="ra3" value="00" style="width: 3em;" min="0" + max="59" data-dojo-type="dijit/form/ValidationTextBox" required="true" + data-dojo-props="regExp:'\\d{2}', invalidMessage:'Two digit number only.'" /> + <label for="ra3">ss</label> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Dec (Declination):</label> + </td> + <td><input type="text" ID="dec" name="dec" size="45" required="true" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Time Start:</label> + </td> + <td><input type="TIME" ID="ts" name="ts" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Time End:</label> + </td> + <td><input type="TIME" ID="te" name="te" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Limiting Mag:</label> + </td> + <td><input type="text" ID="lm" name="lm" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Comments:</label> + </td> + <td><input type="text" ID="cm" name="cm" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Target Galactic Lat:</label> + </td> + <td><input type="text" ID="tgla" name="tgla" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Target Galactic Lon:</label> + </td> + <td><input type="text" ID="tgln" name="tgln" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="150"><label for="ra">Target Ecliptic Lat:</label> + </td> + <td><input type="text" ID="tela" name="tela" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + + <tr> + <td width="200"><label for="ra">Target Ecliptic Lon:</label> + </td> + <td><input type="text" ID="teln" name="teln" size="45" + data-dojo-type="dijit/form/ValidationTextBox" /> + </td> + </tr> + </table> + + <!-- <button data-dojo-type="dijit/form/Button" type="button" id="button2">Get Values from form!</button> + why data-dojo-type doesn't work here?--> + <button id="button2" type="button">Add a row</button> + <button type="submit" + name="submitButton" value="Submit" >Submit</button> + <button type="reset">Reset</button> + </div> + + <!-- Bulletin Board Log --> + + <div data-dojo-type="dijit/TitlePane" + data-dojo-props="title: 'Bulletin Board Log', open: false"> + <table id="bb_2" class="event" border="1"> + <thead> + <tr> + <th>id</th> + <th>Submitter</th> + <th>Facility</th> + <th>Filter</th> + <th>RA</th> + <th>DEC</th> + <th> + <form> + <select onchange="changeTime(this, 'gps')"><option + value="gps" selected>GPS Time</option> + <option value="llo">LLO Local</option> + <option value="lho">LHO Local</option> + <option value="virgo">Virgo Local</option> + <option value="utc">UTC</option> + </select> + </form> Time Start</th> + <th> + <form> + <select onchange="changeTime(this, 'created')"><option + value="gps">GPS Time</option> + <option value="llo">LLO Local</option> + <option value="lho">LHO Local</option> + <option value="virgo">Virgo Local</option> + <option value="utc" selected>UTC</option> + </select> + </form> Time End</th> + <th>Limiting Mag</th> + <th>Comments</th> + <th>Target Galactic Lat</th> + <th>Target Galactic Lon</th> + <th>Target Ecliptic Lat</th> + <th>Target Ecliptic Lon</th> + </tr> + </thead> + + <tbody id="bb_log" > + </tbody> + + </table> + </div> +</div> -{% include "gracedb/neighbors_frag.html" %} +<p> </p> <div id="annotations" class="content-area"> <div id="new_log_entry_form"> <noscript> <h3>Create a new log entry</h3> <form id="newlog" action="{% url logentry object.graceid "" %}" method="POST"> - <textarea id="newlogtext" name="comment" style="width:300px;display:block"></textarea> - <input type="submit" value="Submit"/> + <p> + <textarea id="newlogtext" name="comment" style="width:300px;display:block"></textarea> + <input type="submit" value="Submit"/> + </p> </form> </noscript> - </div> + </div> <h3 id="logmessagetitle">Event Log Messages</h3> <div id="previewer"></div> @@ -645,3 +899,5 @@ </div> {% endblock %} + +<!-- Single Inspiral Data --> diff --git a/urls.py b/urls.py index 53b23fa36..01f0eed25 100644 --- a/urls.py +++ b/urls.py @@ -3,8 +3,8 @@ from django.conf.urls.defaults import * from django.conf import settings # Uncomment the next two lines to enable the admin: -from django.contrib import admin -admin.autodiscover() +#from django.contrib import admin +#admin.autodiscover() from gracedb.feeds import EventFeed, feedview @@ -41,7 +41,7 @@ urlpatterns = patterns('', # to INSTALLED_APPS to enable admin documentation: # (r'^admin/doc/', include('django.contrib.admindocs.urls')), - url(r'^admin/', include(admin.site.urls)), +# url(r'^admin/', include(admin.site.urls)), # For development only. And only for old Django versions (like 1.2) (r'^gracedb-static/(?P<path>.*)$', 'django.views.static.serve', -- GitLab