[cig-commits] r11962 - in cs/portal/trunk/northridge/SeismoWebPortal: . static templates/SeismoWebPortal
leif at geodynamics.org
leif at geodynamics.org
Tue May 13 11:43:08 PDT 2008
Author: leif
Date: 2008-05-13 11:43:08 -0700 (Tue, 13 May 2008)
New Revision: 11962
Modified:
cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py
cs/portal/trunk/northridge/SeismoWebPortal/static/style.css
cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html
cs/portal/trunk/northridge/SeismoWebPortal/views.py
Log:
Allow Mineos models to be downloaded.
Modified: cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py 2008-05-13 18:11:45 UTC (rev 11961)
+++ cs/portal/trunk/northridge/SeismoWebPortal/mezzanine.py 2008-05-13 18:43:08 UTC (rev 11962)
@@ -20,7 +20,8 @@
creatable = True
uploadable = False
- downloadable = False
+ downloadableAsText = False
+ downloadableAsKML = False
duplicatable = True
@classmethod
@@ -400,7 +401,8 @@
FileFormat = fformats.CMTSolutionFormat
uploadable = True
- downloadable = True
+ downloadableAsText = True
+ downloadableAsKML = True
duplicatable = property(lambda self: bool(self.obj.singleSource))
@classmethod
@@ -518,7 +520,8 @@
Model = models.Source
FileFormat = fformats.CMTSolutionFormat
- downloadable = True
+ downloadableAsText = True
+ downloadableAsKML = True
def postDeleteRedirect(self):
return "/specfem3dglobe/?class=Event&object=%d" % self.obj.event.id
@@ -598,7 +601,8 @@
creatable = False
uploadable = True
- downloadable = True
+ downloadableAsText = True
+ downloadableAsKML = True
duplicatable = False
def downloadAsText(self, request):
@@ -707,12 +711,19 @@
creatable = False
uploadable = True
+ downloadableAsText = True
duplicatable = False
def update(self, request):
return super(MineosModel, self).update(request, follow = dict(data = False))
+ def downloadAsText(self, request):
+ response = HttpResponse(mimetype='text/plain')
+ response['Content-Disposition'] = 'attachment; filename=%s' % self.obj.name
+ response.write(self.obj.data)
+ return response
+
class MineosParameters(Object):
Model = models.MineosParameters
Modified: cs/portal/trunk/northridge/SeismoWebPortal/static/style.css
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/static/style.css 2008-05-13 18:11:45 UTC (rev 11961)
+++ cs/portal/trunk/northridge/SeismoWebPortal/static/style.css 2008-05-13 18:43:08 UTC (rev 11962)
@@ -133,9 +133,12 @@
border: 1px solid black;
}
+.actionMenu .actionMenuContent li {
+ white-space: nowrap;
+}
+
.actionMenu .actionMenuContent li a {
display: block;
- white-space: nowrap;
padding-left: 1ex;
padding-right: 1ex;
}
@@ -145,6 +148,11 @@
background-color: black;
}
+.actionMenuItem {
+ display: block;
+ padding-left: 1ex;
+ padding-right: 1ex;
+}
.actionButton {
border: 1px solid black;
Modified: cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html 2008-05-13 18:11:45 UTC (rev 11961)
+++ cs/portal/trunk/northridge/SeismoWebPortal/templates/SeismoWebPortal/pluggable.html 2008-05-13 18:43:08 UTC (rev 11962)
@@ -131,8 +131,20 @@
</dt>
<dd class="actionMenuContent">
<ul>
- <li><a href="/specfem3dglobe/?class={{klass}}&object={{object.id}}&action=downloadAsText"><img src="/specfem3dglobe/icons/document.gif" width=32 height=32> Text</a></li>
- <li><a href="/specfem3dglobe/?class={{klass}}&object={{object.id}}&action=downloadAsKML"><img src="/specfem3dglobe/pics/kml.icon.gif"> Google Earth Map</a></li>
+ <li>
+ {% if downloadableAsText %}
+ <a href="/specfem3dglobe/?class={{klass}}&object={{object.id}}&action=downloadAsText"><img src="/specfem3dglobe/icons/document.gif" width=32 height=32> Text</a>
+ {% else %}
+ <span class="actionMenuItem disabled"><img src="/specfem3dglobe/icons/document.gif" width=32 height=32> Text</span>
+ {% endif %}
+ </li>
+ <li>
+ {% if downloadableAsKML %}
+ <a href="/specfem3dglobe/?class={{klass}}&object={{object.id}}&action=downloadAsKML"><img src="/specfem3dglobe/pics/kml.icon.gif"> Google Earth Map</a>
+ {% else %}
+ <span class="actionMenuItem disabled"><img src="/specfem3dglobe/pics/kml.icon.gif"> Google Earth Map</span>
+ {% endif %}
+ </li>
<li><span class="actionMenuItem disabled"><img src="/specfem3dglobe/pics/adobe-pdf.icon.gif"> PDF</span></li>
<li><span class="actionMenuItem disabled"><img src="/specfem3dglobe/images/ps.gif"> PostScript</span></li>
</ul>
Modified: cs/portal/trunk/northridge/SeismoWebPortal/views.py
===================================================================
--- cs/portal/trunk/northridge/SeismoWebPortal/views.py 2008-05-13 18:11:45 UTC (rev 11961)
+++ cs/portal/trunk/northridge/SeismoWebPortal/views.py 2008-05-13 18:43:08 UTC (rev 11962)
@@ -43,6 +43,8 @@
creatable = False
uploadable = False
downloadable = False
+ downloadableAsText = False
+ downloadableAsKML = False
duplicatable = False
klass = None
@@ -77,7 +79,9 @@
raise Http404
obj = Class(objId)
- downloadable = obj.downloadable
+ downloadableAsText = obj.downloadableAsText
+ downloadableAsKML = obj.downloadableAsKML
+ downloadable = downloadableAsText or downloadableAsKML
duplicatable = obj.duplicatable
if action is None:
@@ -112,6 +116,8 @@
creatable = creatable,
uploadable = uploadable,
downloadable = downloadable,
+ downloadableAsText = downloadableAsText,
+ downloadableAsKML = downloadableAsKML,
duplicatable = duplicatable,
))
response.write(t.render(c))
More information about the cig-commits
mailing list