1. Chris Mutel
  2. brightway2-ui

Commits

Chris Mutel  committed 33a26c8

Added jquery file tree test

  • Participants
  • Parent commits 886ff2f
  • Branches default

Comments (0)

Files changed (36)

File MANIFEST.in

View file
 include *.txt
-recursive-include bw2ui/*.py
+recursive-include bw2ui *.py
 recursive-include bw2ui/web *.css
 recursive-include bw2ui/web *.png
+recursive-include bw2ui/web *.gif
 recursive-include bw2ui/web *.jpg
 recursive-include bw2ui/web *.ico
 recursive-include bw2ui/web *.js
+recursive-include bw2ui/web *.html

File bw2ui/web/app.py

View file
 from utils import get_job_id, get_job, set_job_status, json_response
 import itertools
 import math
+import multiprocessing
 import numpy as np
+import os
+import platform
+import requests
+import urllib2
+
 
 app = Flask(__name__)
 
         abort(500)
 
 ###################
+### File Picker ###
+###################
+
+
+@app.route("/filepicker")
+def fp_test():
+    return render_template("fp.html")
+
+
+@app.route("/fp-api", methods=["POST"])
+def fp_api():
+    path = urllib2.unquote(request.form["dir"])
+    try:
+        root, dirs, files = os.walk(path).next()
+    except StopIteration:
+        # Only files from now on...
+        root, dirs = path, []
+        files = os.listdir(root)
+    data = []
+    files = [x for x in files if x[0] != "."]
+    if len(files) > 20:
+        files = files[:20] + ["(and %s more files...)" % (len(files) - 20)]
+    for dir_name in dirs:
+        if dir_name[0] == ".":
+            continue
+        data.append({
+            "dir": True,
+            "path": os.path.join(root, dir_name),
+            "name": dir_name
+            })
+    for file_name in files:
+        data.append({
+            "dir": False,
+            "ext": file_name.split(".")[-1].lower(),
+            "path": os.path.join(root, file_name),
+            "name": file_name
+            })
+    return render_template("fp-select.html", dirtree=data)
+
+###################
 ### Basic views ###
 ###################
 
 
 @app.route('/')
 def index():
+    if config.is_temp_dir and not config.p["temp_dir_ok"]:
+        redirect(url_for('start_bw'))
+    dbs = [{
+        "name": key,
+        "number": value["number"],
+        "version": value["version"]
+        } for key, value in databases.iteritems()]
+    ms = [{
+        "name": " - ".join(key),
+        "unit": value["unit"],
+        "num_cfs": value["num_cfs"]
+    } for key, value in methods.iteritems()]
     context = {
-        'databases': databases,
-        'methods': methods,
+        'databases': dbs,
+        'methods': ms,
         'config': config
         }
-    if config.is_temp_dir:
-        context["redirect"] = url_for(start_bw)
     return render_template("index.html", **context)
 
 
+@app.route('/settings', methods=["GET", "POST"])
+def change_settings():
+    if request.method == "GET":
+        context = {
+            "config": config,
+            "cpu_count": multiprocessing.cpu_count(),
+            "current_cpu_count": config.p.get("cpu_count",
+                multiprocessing.cpu_count()),
+        }
+        return render_template("settings.html", **context)
+    else:
+        return ""
+
+
+@app.route('/install-biosphere')
+def install_biosphere():
+    # Download and format data
+    keys, values = JsonWrapper.loads(requests.get("http://mutel.org/biosphere.json").content)
+    data = dict(zip([tuple(x) for x in keys], values))
+    biosphere = Database.register(
+        format=["Handmade", -1],
+        depends=[],
+        num_processes=len(data),
+        version=1,
+        )
+    biosphere.write(data)
+    biosphere.process()
+    return "1"
+
+    windows = platform.system == "Windows"
+
+
+@app.route('/installing-biosphere')
+def installing_biosphere():
+    pass
+
+
 @app.route('/start', methods=["GET", "POST"])
 def start_bw():
     """Start Brightway"""
-    job_id = get_job_id()
+    # job_id = get_job_id()
     if request.method == "GET":
         pass
     elif not request.form["confirm"] == "false":
-        return redirect(url_for(index) + "?temp_dir_ok=True")
+        return redirect(url_for('index') + "?temp_dir_ok=1")
     # Starting Brightway
     # If POST[action] = "get_biosphere":
     set_job_status(job_id, {"action": "biosphere-import", "finished": False})
     DatabaseImporter().importer(biosphere)
     set_job_status(job_id, {"action": "biosphere-import", "finished": True})
 
+    """
+    Hi! It looks like you are start Brightway2 for the first time.
+
+    You are currently saving your work in a temporary directory that can be deleted at any time. You can let Brightway2 create a workspace in your home directory, or you can specify a different directory by typing in the full path below:
+    """
+
+    """
+    OK, now its time to retrieve generic biosphere data. Click on the button below, and be patient...
+    """
+
+
     # Step two
     # Import IA methods
     # Can also be from dropbox

File bw2ui/web/static/css/base.css

View file
   padding-top: 10px;
   padding-bottom: 10px;
 }
+
+table.dataTable tr.row_selected td {
+    background-color: salmon !important;
+}
+
+/*http://stackoverflow.com/questions/8594974/jquery-datatabels-jquery-ui-theme-arrows-wrap-on-th*/
+table thead th span.css_right {
+  float: right;
+}

File bw2ui/web/static/jqueryFileTree/images/application.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/code.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/css.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/db.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/directory.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/doc.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/file.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/film.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/flash.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/folder_open.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/html.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/java.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/linux.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/music.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/pdf.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/php.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/picture.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/ppt.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/psd.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/ruby.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/script.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/spinner.gif

Added
New image

File bw2ui/web/static/jqueryFileTree/images/txt.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/xls.png

Added
New image

File bw2ui/web/static/jqueryFileTree/images/zip.png

Added
New image

File bw2ui/web/static/jqueryFileTree/jqueryFileTree.css

View file
+UL.jqueryFileTree {
+	font-family: Verdana, sans-serif;
+	font-size: 11px;
+	line-height: 18px;
+	padding: 0px;
+	margin: 0px;
+}
+
+UL.jqueryFileTree LI {
+	list-style: none;
+	padding: 0px;
+	padding-left: 20px;
+	margin: 0px;
+	white-space: nowrap;
+}
+
+UL.jqueryFileTree A {
+	color: #333;
+	text-decoration: none;
+	display: block;
+	padding: 0px 2px;
+}
+
+UL.jqueryFileTree A:hover {
+	background: #BDF;
+}
+
+/* Core Styles */
+.jqueryFileTree LI.directory { background: url(images/directory.png) left top no-repeat; }
+.jqueryFileTree LI.expanded { background: url(images/folder_open.png) left top no-repeat; }
+.jqueryFileTree LI.file { background: url(images/file.png) left top no-repeat; }
+.jqueryFileTree LI.wait { background: url(images/spinner.gif) left top no-repeat; }
+/* File Extensions*/
+.jqueryFileTree LI.ext_3gp { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_afp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_afpa { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_asp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_aspx { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_avi { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_bat { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_bmp { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_c { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cfm { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cgi { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_com { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_cpp { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_css { background: url(images/css.png) left top no-repeat; }
+.jqueryFileTree LI.ext_doc { background: url(images/doc.png) left top no-repeat; }
+.jqueryFileTree LI.ext_exe { background: url(images/application.png) left top no-repeat; }
+.jqueryFileTree LI.ext_gif { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_fla { background: url(images/flash.png) left top no-repeat; }
+.jqueryFileTree LI.ext_h { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_htm { background: url(images/html.png) left top no-repeat; }
+.jqueryFileTree LI.ext_html { background: url(images/html.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jar { background: url(images/java.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jpg { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_jpeg { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_js { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_lasso { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_log { background: url(images/txt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_m4p { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mov { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mp3 { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mp4 { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mpg { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_mpeg { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ogg { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pcx { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pdf { background: url(images/pdf.png) left top no-repeat; }
+.jqueryFileTree LI.ext_php { background: url(images/php.png) left top no-repeat; }
+.jqueryFileTree LI.ext_png { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ppt { background: url(images/ppt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_psd { background: url(images/psd.png) left top no-repeat; }
+.jqueryFileTree LI.ext_pl { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_py { background: url(images/script.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rb { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rbx { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rhtml { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_rpm { background: url(images/linux.png) left top no-repeat; }
+.jqueryFileTree LI.ext_ruby { background: url(images/ruby.png) left top no-repeat; }
+.jqueryFileTree LI.ext_sql { background: url(images/db.png) left top no-repeat; }
+.jqueryFileTree LI.ext_swf { background: url(images/flash.png) left top no-repeat; }
+.jqueryFileTree LI.ext_tif { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_tiff { background: url(images/picture.png) left top no-repeat; }
+.jqueryFileTree LI.ext_txt { background: url(images/txt.png) left top no-repeat; }
+.jqueryFileTree LI.ext_vb { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_wav { background: url(images/music.png) left top no-repeat; }
+.jqueryFileTree LI.ext_wmv { background: url(images/film.png) left top no-repeat; }
+.jqueryFileTree LI.ext_xls { background: url(images/xls.png) left top no-repeat; }
+.jqueryFileTree LI.ext_xml { background: url(images/code.png) left top no-repeat; }
+.jqueryFileTree LI.ext_zip { background: url(images/zip.png) left top no-repeat; }

File bw2ui/web/static/jqueryFileTree/jqueryFileTree.js

View file
+// jQuery File Tree Plugin
+//
+// Version 1.01
+//
+// Cory S.N. LaViska
+// A Beautiful Site (http://abeautifulsite.net/)
+// 24 March 2008
+//
+// Visit http://abeautifulsite.net/notebook.php?article=58 for more information
+//
+// Usage: $('.fileTreeDemo').fileTree( options, callback )
+//
+// Options:  root           - root folder to display; default = /
+//           script         - location of the serverside AJAX file to use; default = jqueryFileTree.php
+//           folderEvent    - event to trigger expand/collapse; default = click
+//           expandSpeed    - default = 500 (ms); use -1 for no animation
+//           collapseSpeed  - default = 500 (ms); use -1 for no animation
+//           expandEasing   - easing function to use on expand (optional)
+//           collapseEasing - easing function to use on collapse (optional)
+//           multiFolder    - whether or not to limit the browser to one subfolder at a time
+//           loadMessage    - Message to display while initial tree loads (can be HTML)
+//
+// History:
+//
+// 1.01 - updated to work with foreign characters in directory/file names (12 April 2008)
+// 1.00 - released (24 March 2008)
+//
+// TERMS OF USE
+// 
+// This plugin is dual-licensed under the GNU General Public License and the MIT License and
+// is copyright 2008 A Beautiful Site, LLC. 
+//
+if(jQuery) (function($){
+	
+	$.extend($.fn, {
+		fileTree: function(o, h) {
+			// Defaults
+			if( !o ) var o = {};
+			if( o.root == undefined ) o.root = '/';
+			if( o.script == undefined ) o.script = 'jqueryFileTree.php';
+			if( o.folderEvent == undefined ) o.folderEvent = 'click';
+			if( o.expandSpeed == undefined ) o.expandSpeed= 500;
+			if( o.collapseSpeed == undefined ) o.collapseSpeed= 500;
+			if( o.expandEasing == undefined ) o.expandEasing = null;
+			if( o.collapseEasing == undefined ) o.collapseEasing = null;
+			if( o.multiFolder == undefined ) o.multiFolder = true;
+			if( o.loadMessage == undefined ) o.loadMessage = 'Loading...';
+			
+			$(this).each( function() {
+				
+				function showTree(c, t) {
+					$(c).addClass('wait');
+					$(".jqueryFileTree.start").remove();
+					$.post(o.script, { dir: t }, function(data) {
+						$(c).find('.start').html('');
+						$(c).removeClass('wait').append(data);
+						if( o.root == t ) $(c).find('UL:hidden').show(); else $(c).find('UL:hidden').slideDown({ duration: o.expandSpeed, easing: o.expandEasing });
+						bindTree(c);
+					});
+				}
+				
+				function bindTree(t) {
+					$(t).find('LI A').bind(o.folderEvent, function() {
+						if( $(this).parent().hasClass('directory') ) {
+							if( $(this).parent().hasClass('collapsed') ) {
+								// Expand
+								if( !o.multiFolder ) {
+									$(this).parent().parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
+									$(this).parent().parent().find('LI.directory').removeClass('expanded').addClass('collapsed');
+								}
+								$(this).parent().find('UL').remove(); // cleanup
+								// showTree( $(this).parent(), escape($(this).attr('rel').match( /.*\// )) );
+								// RE breaks everything!?
+								showTree( $(this).parent(), escape($(this).attr('rel')) );
+								$(this).parent().removeClass('collapsed').addClass('expanded');
+							} else {
+								// Collapse
+								$(this).parent().find('UL').slideUp({ duration: o.collapseSpeed, easing: o.collapseEasing });
+								$(this).parent().removeClass('expanded').addClass('collapsed');
+							}
+						} else {
+							h($(this).attr('rel'));
+						}
+						return false;
+					});
+					// Prevent A from triggering the # on non-click events
+					if( o.folderEvent.toLowerCase != 'click' ) $(t).find('LI A').bind('click', function() { return false; });
+				}
+				// Loading message
+				$(this).html('<ul class="jqueryFileTree start"><li class="wait">' + o.loadMessage + '<li></ul>');
+				// Get the initial file list
+				showTree( $(this), escape(o.root) );
+			});
+		}
+	});
+	
+})(jQuery);

File bw2ui/web/templates/base.html

View file
 	<!--[if lt IE 8]><link rel="stylesheet" href="{{ url_for('static', filename="blueprint/ie.css") }}" type="text/css" media="screen, projection"><![endif]-->
 	<link rel="stylesheet" href="{{ url_for('static', filename="css/base.css") }}" type="text/css" media="screen, projection">
 	<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro' rel='stylesheet' type='text/css'>
-	<script src="http://yui.yahooapis.com/3.8.0/build/yui/yui-min.js"></script>
+	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
+	<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
+	<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.min.js"></script>
+	<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/css/jquery.dataTables.css" type="text/css" media="screen, projection">
+	<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/flick/jquery-ui.css" type="text/css" media="screen, projection">
 	<script src="http://d3js.org/d3.v2.min.js"></script>
 	{% block extrahead %}{% endblock %}
 </head>
-<body class="yui3-skin-sam">
-	<div class="container">{% block header %}<h1><span id="brightway">Brightway</span><span id="two">2</span> web</h1><hr>{% endblock %}
-		{% block body %}{% endblock %}</div>
+<body>
+	<div class="container">
+		{% block header %}<h1><span id="brightway">Brightway</span><span id="two">2</span> web</h1><hr>{% endblock %}
+		{% block body %}{% endblock %}
+	</div>
 </body>
 </html>

File bw2ui/web/templates/fp-select.html

View file
+<ul class="jqueryFileTree" style="display: none;">
+    {% for o in dirtree %}<li class="{% if o.dir %}directory collapsed{% else %}file ext_{{o.ext}}{% endif %}"><a href="#" rel="{{ o.path }}">{{ o.name }}</a></li>
+    {% endfor %}
+</ul>

File bw2ui/web/templates/fp.html

View file
+{% extends "base.html" %}
+
+{% block extrahead %}
+<link rel="stylesheet" href="{{ url_for('static', filename="jqueryFileTree/jqueryFileTree.css") }}" type="text/css" media="screen, projection">
+<script src="{{ url_for('static', filename="jqueryFileTree/jqueryFileTree.js") }}"></script>
+{% endblock %}
+
+{% block body %}
+<h1>Filepicker test</h1>
+
+<p>Note: Not all files are shown! You are selecting a directory, not files...</p>
+
+<p>Selected element: <span id="fp-selected">None yet...</span></p>
+
+<div id="fp"></div>
+
+
+<script type="text/javascript">      
+$(document).ready( function() {        
+  $('#fp').fileTree({
+    root: '/', 
+    script: '/fp-api', 
+    folderEvent: 'click', 
+    multiFolder: false 
+    }, 
+    function(file) { 
+      console.log(file);
+    }
+  );        
+
+  $("#fp .directory").click(function () {
+    console.log($(this).attr('rel'));
+    $("#fp-selected").text($(this).attr('rel'));
+  });
+});
+</script>
+{% endblock %}

File bw2ui/web/templates/index.html

View file
 {% extends "base.html" %}
 
+{% block extrahead %}
+<link rel="stylesheet" href="{{ url_for('static', filename="css/index.css") }}" type="text/css" media="screen, projection">
+{% endblock %}
+
 {% block body %}
-<h3>Data directory is <i>{{ config.dir }}</i></h3>
-<div class="span-10">
-    <h2>Databases</h2>
-    <div id="db-table"></div>
+<div class="span-11 colborder">
+    <h2>Installed databases</h2>
+    <p>(click on a database to get more options)</p>
+    <table id="installed-databases">
+        <thead>
+            <tr>
+                <th>Name</th>
+                <th>Version</th>
+                <th># activities</th>
+            </tr>
+        </thead>
+        <tbody>{% for row in databases %}
+            <tr>
+                <td>{{row.name}}</td>
+                <td>{{row.version}}</td>
+                <td>{{row.number}}</td>
+            </tr>{% endfor %}
+        </tbody>
+    </table>
 </div>
-<div class="span-14 last">
-    <h2>Impact assessment methods</h2>
-    <div id="ia-table"></div>
+<div class="span-12 last">
+    <p>Data directory is <i>{{ config.dir }}</i></p>
 </div>
-<a href="/hist">
-    <button>Dynamic hist</button>
-</a>
-<a href="/lca">
-    <button>LCA calculation</button>
-</a>
-<a href="/hinton">
-    <button>Hinton demo</button>
-</a>
+<div class="span-6">
+    <a href="/lca"><button>Calculate LCA</button></a><br>
+    <a href="/settings"><button>Manage Brightway2</button></a><br>
+    <a href="https://brightway2.readthedocs.org/en/latest/"><button>Documentation</button></a>
+</div>
+<div class="span-6 last">
+    <a href="/import/database"><button>Import database</button></a><br>
+    <!-- <a href="/export/database"><button>Export database</button></a><br> -->
+    <a href="/filepicker"><button>Filepicker test</button></a><br>
+    <a href="/import/method"><button>Import LCIA method</button></a>
+</div>
+<hr>
+<h2>Installed LCIA methods</h2>
+<p>(click on a method to get more options)</p>
+<table id="installed-methods">
+    <thead>
+        <tr>
+            <th>Name</th>
+            <th>Unit</th>
+            <th># CFs</th>
+        </tr>
+    </thead>
+    <tbody>{% for row in methods %}
+        <tr>
+            <td>{{row.name}}</td>
+            <td>{{row.unit}}</td>
+            <td>{{row.num_cfs}}</td>
+        </tr>{% endfor %}
+    </tbody>
+</table>
 
 <script type="text/javascript">
-YUI().use('datatable-sort', 'datatable-scroll', function (Y) {
-    var inv_data = [
-        {% for db in databases.list %}{ name: "{{db}}", version: {{databases[db]["version"]}}, num: {{databases[db]["number"]}} }{% if loop.last %}{% else %},{% endif %}
-        {% endfor %}
-        ];
-
-    var db_table = new Y.DataTable({
-        columns: [
-            {key: "name", sortable: true}, 
-            {key: "version", sortable: true}, 
-            {key: "num", label: "# datasets", sortable: true}
-            ],
-        data: inv_data,
-        scrollable: true,
-        height: "200px"
-    });
-
-    db_table.render("#db-table");
+$('#installed-databases').dataTable({
+    "bLengthChange": false,
+    "bJQueryUI": true
 });
-
-YUI().use('datatable-sort', 'datatable-scroll', function (Y) {
-    var ia_data = [
-        {% for name in methods.list %}{ name: "{{ ' : '.join(name) }}", unit: "{{methods[name]["unit"]}}", num: {{methods[name]["num_cfs"]}} }{% if loop.last %}{% else %},{% endif %}
-        {% endfor %}
-        ];
-
-    var ia_table = new Y.DataTable({
-        columns: [
-            {key: "name", sortable: true}, 
-            {key: "unit", sortable: true}, 
-            {key: "num", label: "# CFs", sortable: true}
-            ],
-        data: ia_data,
-        scrollable: true,
-        height: "200px"
-    });
-
-    ia_table.render("#ia-table");
+$('#installed-methods').dataTable({
+    "bJQueryUI": true
 });
 </script>
-
 {% endblock %}

File bw2ui/web/templates/select.html

View file
 {% extends "base.html" %}
 
-{% block extrahead %}
-<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
-<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
-<script src="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/jquery.dataTables.min.js"></script>
-<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.0/themes/ui-lightness/jquery-ui.css" type="text/css" media="screen, projection">
-<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/datatables/1.9.4/css/jquery.dataTables.css" type="text/css" media="screen, projection">
-<style type="text/css">
-    table.dataTable tr.row_selected td {
-        background-color: salmon !important;
-    }
-</style>
-{% endblock %}
-
 {% block body %}
 <h1>Define the functional unit to assess</h1>
 <div class="span-7 colborder">
 <script>
 $(document).ready(function() {
     $("#activity-input").prop('disabled', true);
-    $('#selected-activities').dataTable();
-    $('#lcia_methods').dataTable();
+    $('#selected-activities').dataTable({
+        "bJQueryUI": true
+    });
+    $('#lcia_methods').dataTable({
+        "bJQueryUI": true
+    });
     $('#selected-activities').dataTable().fnSetColumnVis(4, false);
 
     $('input[name=database-select]:radio').change(function () {

File setup.py

View file
-from distutils.core import setup
+from setuptools import setup
 
 setup(
   name='bw2ui',
     "static/blueprint/*.css",
     "static/blueprint/plugins/buttons/*.css",
     "static/blueprint/plugins/fancy-type/*.css",
+    "static/jqueryFileTree/*.css",
+    "static/jqueryFileTree/*.js",
+    "static/jqueryFileTree/images/*.png",
+    "static/jqueryFileTree/images/*.gif",
     "static/img/*.png",
     "static/img/*.ico",
     "static/img/*.jpg",