EMAIL_PORT = 25
EMAIL_USE_TLS = False
-
-
-
-
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'mysql', 'sqlite3' or 'oracle'.
# URL prefix for static files.
# Example: "http://media.lawrence.com/static/"
-STATIC_URL = '/all-static/'
+# thierry STATIC_URL = '/all-static/'
+STATIC_URL = '/static/'
# Additional locations of static files
STATICFILES_DIRS = (
# Put strings here, like "/home/html/static" or "C:/www/django/static".
# Always use forward slashes, even on Windows.
# Don't forget to use absolute paths, not relative paths.
- os.path.join(ROOT,'all-static'),
+ # thierry os.path.join(ROOT,'all-static'),
+ ('js', os.path.join(ROOT,'manifold/js')),
+ ('js', os.path.join(ROOT,'unfold/js')),
+ ('js', os.path.join(ROOT,'auth/js')),
+ ('css', os.path.join(ROOT,'manifold/css')),
+ ('css', os.path.join(ROOT,'unfold/css')),
+ ('css', os.path.join(ROOT,'views/css')),
+ ('img', os.path.join(ROOT,'views/img')),
)
+# Needed by PluginFinder
+PLUGIN_DIR = os.path.join(ROOT,'plugins')
+# ThirdPartyFinder
+THIRDPARTY_DIR = os.path.join(ROOT, 'third-party')
+
# List of finder classes that know how to find static files in
# various locations.
STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.FileSystemFinder',
'django.contrib.staticfiles.finders.AppDirectoriesFinder',
+ 'unfold.static.PluginFinder',
+ 'unfold.static.ThirdPartyFinder',
# 'django.contrib.staticfiles.finders.DefaultStorageFinder',
)
+TEMPLATE_CONTEXT_PROCESSORS = (
+ 'django.core.context_processors.static',
+)
+
# Make this unique, and don't share it with anybody.
SECRET_KEY = 't%n(3h)&r^n8(+8)(sp29t^$c2#t(m3)e2!02l8w1#36tl#t27'
from django.conf.urls import patterns, include, url
+from django.conf import settings
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
url(r'^portal/', include('portal.urls')),
# Debug
url(r'^debug/', include('debug_platform.urls')),
+ # Static files
+ (r'^static/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.STATIC_ROOT}),
+
)
manifold.raise_event(self.options.query_uuid, this.checked?FIELD_ADDED:FIELD_REMOVED, this.value);
});
- /* The following code adds an expandable column for the table */
+ /* The following code adds an expandable column for the table
// XXX Why isn't it done statically ?
var nCloneTh = document.createElement( 'th' );
var nCloneTd = document.createElement( 'td' );
this.el('table tbody tr').each(function() {
this.insertBefore(nCloneTd.cloneNode( true ), this.childNodes[0]);
});
+ */
// We are currently using a DataTable display, but another browsing component could be better
//jQuery('#'+this.options.plugin_uuid+'-table').dataTable...
bInfo : false,
sScrollX : '100%', // Horizontal scrolling
sScrollY : '200px',
- bJQueryUI : true, // Use jQuery UI
+ //bJQueryUI : true, // Use jQuery UI
bProcessing : true, // Loading
aaSorting : [[ 1, "asc" ]], // sort by column fields on load
aoColumnDefs: [
EOF; -->
<div>
- <table id='{{domid}}__table' class='display'>
+ <table id='{{domid}}__table' class='display' width='95%'>
<thead>
<tr>
+ <th class='center'>Info</th>
<th class='center'>Field</th>
<th class='center'>Resource</th>
<th class='center'>Type</th>
{% for field in fields %}
<tr>
- <td class='center'><b> {{ field.name }}</b></td>
- <td class='center'> {{ field.resource_type }}</td>
- <td class='center'> {{ field.type }}</td>
- <td class='center'> {{ field.filter_input }}</td>
+ <td class='center'><span class='ui-icon ui-icon-triangle-1-e' style='cursor:pointer'></span></td>
+ <td class='center'>{{ field.name }}</td>
+ <td class='center'>{{ field.resource_type }}</td>
+ <td class='center'>{{ field.type }}</td>
+ <td class='center'>{{ field.filter_input }}</td>
<td class='center'>
<input class='queryeditor-check' id='{{domid}}__check__{{ field.name }}' name='{{ field.header }}' type='checkbox' autocomplete='off' value='{{ field.name }}' {% if field.checked %} checked {% endif %}></input>
</td>
</tbody>
</table>
</div>
-
--- /dev/null
+import os
+from django.conf import settings
+from django.utils.datastructures import SortedDict
+from django.contrib.staticfiles.finders import BaseFinder, FileSystemFinder
+from django.core.files.storage import FileSystemStorage
+
+class PluginFinder(FileSystemFinder):
+ """
+ A static files finder that looks in the directory of each plugin as
+ specified in the source_dir attribute of the given storage class.
+ """
+ def __init__(self, *args, **kwargs):
+ # The list of plugins that are handled
+ self.locations = []
+ # Mapping of plugin module paths to storage instances
+ self.storages = SortedDict()
+ plugins_dir = self.get_immediate_subdirs(settings.PLUGIN_DIR)
+ for root in plugins_dir:
+ if not os.path.exists(root) or not os.path.isdir(root):
+ continue
+ if ('', root) not in self.locations:
+ self.locations.append(('', root))
+ for _, root in self.locations:
+ filesystem_storage = FileSystemStorage(location=root)
+ filesystem_storage.prefix = ''
+ self.storages[root] = filesystem_storage
+
+ def get_immediate_subdirs(self, dir):
+ return [os.path.join(dir, name, 'static') for name in os.listdir(dir)
+ if os.path.isdir(os.path.join(dir, name))]
+
+class ThirdPartyFinder(BaseFinder):
+ """
+ A static files inder that looks in the directory of each third-party
+ resources and tries to preserve the location of each file
+ """
+ # third-party/MODULE/path/to/js
+ extensions = {
+ # PREFIX : EXTENSIONS
+ '' : ('.html',),
+ 'js' : ('.js',),
+ 'css': ('.css',),
+ 'img': ('.png', '.ico',),
+ }
+
+ def find(self, search_path, all=False):
+ """
+ Given a relative file path this ought to find an
+ absolute file path.
+
+ If the ``all`` parameter is ``False`` (default) only
+ the first found file path will be returned; if set
+ to ``True`` a list of all found files paths is returned.
+ """
+ matches = []
+ #all_extensions = reduce(lambda x,y : x + y, extensions.values())
+
+ for (path, dirs, files) in os.walk(settings.THIRDPARTY_DIR):
+ for file in files:
+ name, extension = os.path.splitext(file)
+
+ for type, extensions in self.extensions.items():
+ if not extension in extensions:
+ continue
+ if search_path == os.path.join(type, file):
+ matched_path = os.path.join(path, file)
+ if not all:
+ return matched_path
+ matches.append(matched_path)
+ return matches
+
+ def list(self, ignore_patterns):
+ """
+ Given an optional list of paths to ignore, this should return
+ a two item iterable consisting of the relative path and storage
+ instance.
+ """
+ for (path, dirs, files) in os.walk(settings.THIRDPARTY_DIR):
+ for file in files:
+ name, extension = os.path.splitext(file)
+
+ for type, extensions in self.extensions.items():
+ if not extension in extensions:
+ continue
+ filesystem_storage = FileSystemStorage(location=path)
+ filesystem_storage.prefix = type
+ yield file, filesystem_storage
+
+class BaseFinder(object):
+ """
+ A base file finder to be used for custom staticfiles finder classes.
+ """
+
+ def list(self, ignore_patterns):
+ """
+ Given an optional list of paths to ignore, this should return
+ a two item iterable consisting of the relative path and storage
+ instance.
+ """
+ raise NotImplementedError()
+