From 28145f910c4179f8e84aa7fa3e250dea292439c5 Mon Sep 17 00:00:00 2001
From: Zachary Sloan
Date: Fri, 17 Oct 2014 20:34:38 +0000
Subject: Added reference, policies, and links pages

Improved the appearance of the header menu and "title bar"
---
 wqflask/base/data_set.py                           |  2 +
 wqflask/secure_server.py                           |  2 +-
 .../wqflask/static/packages/bootstrap/css/docs.css | 11 ++---
 wqflask/wqflask/templates/base.html                |  4 +-
 wqflask/wqflask/templates/search_result_page.html  | 49 +++++++++++++++++++++-
 wqflask/wqflask/user_manager.py                    | 17 ++++++++
 wqflask/wqflask/views.py                           | 12 ++++++
 7 files changed, 87 insertions(+), 10 deletions(-)

diff --git a/wqflask/base/data_set.py b/wqflask/base/data_set.py
index 3fb7203d..685cd648 100755
--- a/wqflask/base/data_set.py
+++ b/wqflask/base/data_set.py
@@ -699,6 +699,8 @@ class PhenotypeDataSet(DataSet):
 
             if not this_trait.year.isdigit():
                 this_trait.pubmed_text = "N/A"
+            else:
+                this_trait.pubmed_text = this_trait.year
 
             if this_trait.pubmed_id:
                 this_trait.pubmed_link = webqtlConfig.PUBMEDLINK_URL % this_trait.pubmed_id
diff --git a/wqflask/secure_server.py b/wqflask/secure_server.py
index d5f1a291..5595aad9 100755
--- a/wqflask/secure_server.py
+++ b/wqflask/secure_server.py
@@ -72,7 +72,7 @@ if __name__ == '__main__':
 
 
     app.run(host='0.0.0.0',
-        port=app.config['SERVER_PORT'],
+        port=5002,
         use_debugger=False,
         threaded=True,
         use_reloader=True)
diff --git a/wqflask/wqflask/static/packages/bootstrap/css/docs.css b/wqflask/wqflask/static/packages/bootstrap/css/docs.css
index 967989a7..7af23b4c 100755
--- a/wqflask/wqflask/static/packages/bootstrap/css/docs.css
+++ b/wqflask/wqflask/static/packages/bootstrap/css/docs.css
@@ -27,7 +27,8 @@ h3 code {
 -------------------------------------------------- */
 
 body > .navbar {
-  font-size: 13px;
+  font-size: 16px;
+  font-weight: bold;
 }
 
 /* Change the docs' brand */
@@ -89,7 +90,7 @@ hr.soften {
 ------------------------- */
 .jumbotron {
   position: relative;
-  padding: 40px 0;
+  padding: 0px 0;
   color: #fff;
   text-align: center;
   text-shadow: 0 1px 3px rgba(0,0,0,.4), 0 0 30px rgba(0,0,0,.075);
@@ -112,7 +113,7 @@ hr.soften {
   line-height: 1;
 }
 .jumbotron p {
-  font-size: 24px;
+  font-size: 20px;
   font-weight: 300;
   line-height: 30px;
   margin-bottom: 30px;
@@ -238,7 +239,7 @@ hr.soften {
   border-bottom: 1px solid #ddd;
 }
 .subhead h1 {
-  font-size: 60px;
+  font-size: 40px;
 }
 .subhead p {
   margin-bottom: 20px;
@@ -925,7 +926,7 @@ form.bs-docs-example {
 
   /* Downsize the jumbotrons */
   .jumbotron h1 {
-    font-size: 60px;
+    font-size: 40px;
   }
   .jumbotron p,
   .jumbotron .btn {
diff --git a/wqflask/wqflask/templates/base.html b/wqflask/wqflask/templates/base.html
index 48078670..b989294a 100755
--- a/wqflask/wqflask/templates/base.html
+++ b/wqflask/wqflask/templates/base.html
@@ -77,7 +77,7 @@
                         <li class="active">
                             <a href="/">Home</a>
                         </li>
-                        <li class="dropdown">
+                        <!--<li class="dropdown">
                         <a id="drop1" href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                             Search <b class="caret"></b>
                         </a>
@@ -87,7 +87,7 @@
                                 <li class="divider"></li>
                                 <li><a tabindex="-1" href="/webqtl/main.py?FormID=geneWiki">Gene Wiki</a></li>
                             </ul>
-                        </li>
+                        </li>-->
                         <li class="">
                             <a href="#">Help</a>
                         </li>
diff --git a/wqflask/wqflask/templates/search_result_page.html b/wqflask/wqflask/templates/search_result_page.html
index 286ead6c..efd5ddcf 100755
--- a/wqflask/wqflask/templates/search_result_page.html
+++ b/wqflask/wqflask/templates/search_result_page.html
@@ -110,12 +110,57 @@
     <script language="javascript" type="text/javascript" src="/static/packages/DT_bootstrap/DT_bootstrap.js"></script>
     <script language="javascript" type="text/javascript" src="/static/packages/TableTools/media/js/TableTools.min.js"></script>
     <script type="text/javascript" charset="utf-8">
+        function getValue(x) {
+            if (x.indexOf('input') >= 0) {
+                if ($(x).val() == 'x') {
+                    return 0
+                }
+                else {
+                   return parseFloat($(x).val());
+                }
+            }
+            return parseFloat(x);
+        }
+            
+        jQuery.fn.dataTableExt.oSort['cust-txt-asc'] = function (a, b) {
+            var x = getValue(a);
+            var y = getValue(b);
+            return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+        };
+            
+        jQuery.fn.dataTableExt.oSort['cust-txt-desc'] = function (a, b) {
+            var x = getValue(a);
+            var y = getValue(b);
+            return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+        };
+
         $(document).ready( function () {
             console.time("Creating table");
             $('#trait_table').dataTable( {
                 //"sDom": "<<'span3'l><'span3'T><'span4'f>'row-fluid'r>t<'row-fluid'<'span6'i><'span6'p>>",
-                "sDom": "lftipr",
-                "iDisplayLength": 50,
+                "aoColumns": [
+                    { "bSortable": false },
+                    { "sType": "natural" },
+                    { "sType": "natural", 
+                      "sWidth": "35%"  },
+                    { "sType": "natural",
+                      "sWidth": "20%"  },
+                    { "sType": "natural" },
+                    { "sType": "cust-txt" },
+                    { "sType": "natural" },
+                ],
+                "columns": [
+                    { "width": "50%" },
+                    null,
+                    null,
+                    null,
+                    null,
+                    null,
+                    null
+                ],
+                "sDom": "ftir",
+                "iDisplayLength": -1,
+                "autoWidth": true,
                 "bLengthChange": true,
                 "bDeferRender": true,
                 "bSortClasses": false
diff --git a/wqflask/wqflask/user_manager.py b/wqflask/wqflask/user_manager.py
index 12ff851e..e16a397d 100755
--- a/wqflask/wqflask/user_manager.py
+++ b/wqflask/wqflask/user_manager.py
@@ -299,6 +299,23 @@ class ForgotPasswordEmail(VerificationEmail):
     key_prefix = "forgot_password_code"
     subject = "GeneNetwork password reset"
 
+    def __init__(self, user):
+        verification_code = str(uuid.uuid4())
+        key = self.key_prefix + ":" + verification_code
+
+        data = json.dumps(dict(id=user.id,
+                               timestamp=timestamp())
+                          )
+
+        Redis.set(key, data)
+        #two_days = 60 * 60 * 24 * 2
+        Redis.expire(key, THREE_DAYS)
+        to = user.email_address
+        subject = self.subject
+        body = render_template(self.template_name,
+                               verification_code = verification_code)
+        send_email(to, subject, body)
+
 
 class Password(object):
     def __init__(self, unencrypted_password, salt, iterations, keylength, hashfunc):
diff --git a/wqflask/wqflask/views.py b/wqflask/wqflask/views.py
index 51b9cb0c..59dcee51 100755
--- a/wqflask/wqflask/views.py
+++ b/wqflask/wqflask/views.py
@@ -145,6 +145,18 @@ def whats_new_page():
         print("\nnews_item is: %s\n" % (news_item))
     return render_template("whats_new.html", news_items=news_items)
 
+@app.route("/reference")
+def reference_page():
+    return render_template("reference.html")
+
+@app.route("/policies")
+def policies_page():
+    return render_template("policies.html")
+
+@app.route("/links")
+def links_page():
+    return render_template("links.html")
+
 @app.route('/export_trait_csv', methods=('POST',))
 def export_trait_excel():
     """Excel file consisting of the sample data from the trait data and analysis page"""
-- 
cgit v1.2.3