[views] Add startup view
authorVincent Michel <vincent.michel@logilab.fr>
Tue, 11 Dec 2012 18:11:48 +0100
changeset 6 d09e976ac97f
parent 5 61ce8151fd22
child 7 b790dac9b452
[views] Add startup view
views/startup.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/views/startup.py	Tue Dec 11 18:11:48 2012 +0100
@@ -0,0 +1,91 @@
+# -*- coding: utf-8 -*-
+# copyright 2012 LOGILAB S.A. (Paris, FRANCE), all rights reserved.
+# contact http://www.logilab.fr -- mailto:contact@logilab.fr
+#
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU Lesser General Public License as published by the Free
+# Software Foundation, either version 2.1 of the License, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Lesser General Public License along
+# with this program. If not, see <http://www.gnu.org/licenses/>.
+
+"""cubicweb-brainomics views/forms/actions/components for web ui"""
+
+from logilab.mtconverter import xml_escape
+
+from cubicweb.web.views.startup import IndexView
+
+
+class BrainomicsIndexView(IndexView):
+
+    def call(self, **kwargs):
+        self.w(u'<div class="span12">')
+        self.w(u'<div class="row-fluid">')
+        url = self._cw.data_url('images/subject.png')
+        href = self._cw.build_url(rql='Any X WHERE X is Subject')
+        self.w(u'<div class="span3"><h2>Subjects</h2><a href="%s"><img width="200" src="%s"/></a></div>'
+               % (href, url))
+        url = self._cw.data_url('images/images.png')
+        href = self._cw.build_url(rql='Any X WHERE X is Scan')
+        self.w(u'<div class="span3"><h2>Images</h2><a href="%s"><img width="200" src="%s"/></a></div>'
+               % (href, url))
+        url = self._cw.data_url('images/genetics.png')
+        href = self._cw.build_url(rql='Any X WHERE X is GenomicMeasure')
+        self.w(u'<div class="span3"><h2>Genetics</h2><a href="%s"><img width="200" src="%s"/></a></div>'
+               % (href, url))
+        url = self._cw.data_url('images/questionnaire.png')
+        href = self._cw.build_url(rql='Any X WHERE X is QuestionnaireRun')
+        self.w(u'<div class="span3"><h2>Questionnaires</h2><a href="%s"><img width="200" src="%s"/></a></div>'
+               % (href, url))
+        self.w(u'</div>')
+        self.w(u'</div>')
+        self.w(u'</div>')
+        self.w(u'<div class="span12">')
+        self.w(u'<div class="row-fluid">')
+        self.w(u'<div class="page-header"><h1>%s<small>%s</small></h1></div>'
+               % (self._cw._('What is it?'), self._cw._(' And who are we?')))
+        self.w(u"""<p>The BRAINOMICS project is one of the projects chosen by the Agence nationale de la recherche (ANR) in the bioinformatics call of the Investissements d'avenir program. This website is a demonstration of the project based on the Localizer data (courtesy of P. Pinel, S. Dehaene, T. Bourgeron and D. Lebihan) and allows complex query and various visualization of the data.
+This demo is for now only accessible on the Neurospin network.</p>
+<p>This prototype was developed by V. Michel, Y. Schwartz, D. Papadopoulos and V. Frouin</p>
+<p><span class="badge badge-important">Important: This website is still a demo. Be kind (and comments welcome :))!</span></p>
+<p> <strong>Feel free to play with it (use the RQL input bar at the top of the page)!</strong></p>
+""")
+        self.w(u'''<ul>
+<li>Query all the subjects of the database
+<pre>Any S WHERE S is Subject</pre></li>
+<li>Query all the subjects of the database, with an age greater than 30
+<pre>Any S WHERE S is Subject, S age > 30</pre></li>
+<li>Query all the subjects of the database, with an age greater than 30, and that are female
+<pre>Any S WHERE S is Subject, S age > 30, S gender "female"</pre></li>
+<li>Query all the scans of subjects with an age greater than 30
+<pre>Any X WHERE S is Subject, S age > 30, X is Scan, X concerns S</pre></li>
+<li>Query all subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question
+of the Localizer questionnary (Question number 2), and return both subject identifier and score
+<pre>Any I,V WHERE S is Subject, S identifier I, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer, 
+     A questionnaire_run X, A question Q, Q text "algebre", A value V, A value > 4</pre></li>
+<li>Query all the Cmap scans of subjects with an age greater than 25, and that have a score greater than 4.O for the "algebre" question
+of the Localizer questionnary (Question number 2)
+<pre>Any SA WHERE S is Subject, S age > 25, X is QuestionnaireRun, X concerns S, A is Answer, 
+     A questionnaire_run X, A question Q, Q text "algebre", A value > 4, SA is Scan, SA concerns S, SA type "c map"</pre></li>
+
+<li>Query all the Tmap scans for the "auditory calculation" contrast of subjects along with their Genomics data, when we have acquired data for Snps on the gene "CFB":
+<pre>Any S,SCF,FGEN WHERE S is Subject, SC is Scan, SC type "t map", SC label "auditory calculation", SC concerns S, 
+SC filepath SCF, GEN is GenomicMeasure, GEN filepath FGEN, GEN concerns S, GEN platform P, P related_snps SN, G is Gene, 
+G name "CFB", G start_position GSA, G stop_position GSO, SN position SP HAVING SP > GSA, SP < GSO</pre></li>
+</ul>''')
+        self.w(u'''<p> <strong>You want more !!!??? Go to the <a href="%s">schema page to see the structure of the data !</a></strong></p>'''
+% self._cw.build_url('schema'))
+        self.w(u'</div>')
+        self.w(u'</div>')
+
+
+def registration_callback(vreg):
+    vreg.register_and_replace(BrainomicsIndexView, IndexView)
+    from cubes.orbui.views.orbui_components import ApplLogoOrbui
+    vreg.unregister(ApplLogoOrbui)