####################
ADMINS = (
- # ('Your Name', 'your_email@example.com'),
+ # ('your_name', 'your_email@test.com'),
)
MANAGERS = ADMINS
# Mail configuration
-#EMAIL_HOST = 'tibre.lip6.fr'
-#EMAIL_PORT = 465
-DEFAULT_FROM_EMAIL = "support@myslice.info"
+#DEFAULT_FROM_EMAIL = "root@theseus.ipv6.lip6.fr"
+#EMAIL_HOST_PASSWORD = "mypassword"
+
+EMAIL_HOST = "localhost"
+EMAIL_PORT = 25
+EMAIL_USE_TLS = False
+
+
+
+
DATABASES = {
'default': {
# { 'label':'Tab', 'href': '/tab/'},
# { 'label':'Scroll', 'href': '/scroll/'},
{ 'label':'One Plugin', 'href': '/plugin/'},
- { 'label':'Dashboard', 'href': '/dashboard/'},
+ { 'label':'Dashboard', 'href': '/portal/dashboard/'},
{ 'label':'Slice', 'href': '/slice/'},
]
// complexity here is mostly because a datatables-enabled table cannot
// be updated in a "normal" way using .html()
function update_plugin(e, rows) {
- // e.data is what we passed in second argument to subscribe
- // so here it is the jquery object attached to the plugin <div>
- var $plugindiv=e.data;
- // locate the <table> element; with datatables in the way,
- // this might not be a direct son of the div-plugin
- var $table=$plugindiv.find("table.simplelist").first();
- // also we may or may not have a header
- var $tbody=$table.find("tbody.simplelist").first();
- var use_datatables = $table.hasClass("with-datatables");
- if (debug) messages.debug($plugindiv.attr('id') + " udt= " + use_datatables);
+ // e.data is what we passed in second argument to subscribe
+ // so here it is the jquery object attached to the plugin <div>
+ var $plugindiv = e.data;
+ // locate the <table> element; with datatables in the way,
+ // this might not be a direct son of the div-plugin
+ var $table = $plugindiv.find("table.simplelist").first();
+ // also we may or may not have a header
+ var $tbody = $table.find("tbody.simplelist").first();
+ var use_datatables = $table.hasClass("with-datatables");
+ if (debug)
+ messages.debug($plugindiv.attr('id') + " udt= " + use_datatables);
// clear the spinning wheel: look up an ancestor that has the need-spin class
// do this before we might return
- $plugindiv.closest('.need-spin').spin(false);
+ $plugindiv.closest('.need-spin').spin(false);
if (rows.length == 0) {
- if (use_datatables) datatables_set_message ($table, $tbody, unfold.warning("No result"));
- else regular_set_message ($table, $tbody, unfold.warning("No result"));
+ if (use_datatables)
+ datatables_set_message ($table, $tbody, unfold.warning("No result"));
+ else
+ regular_set_message ($table, $tbody, unfold.warning("No result"));
return;
}
+
if (typeof rows[0].error != 'undefined') {
- var error="ERROR: " + rows[0].error;
- if (use_datatables) datatables_set_message ($table, $tbody, unfold.error(error));
- else regular_set_message ($table, $tbody, unfold.error(error));
+ var error="ERROR: " + rows[0].error;
+ if (use_datatables)
+ datatables_set_message ($table, $tbody, unfold.error(error));
+ else
+ regular_set_message ($table, $tbody, unfold.error(error));
return;
}
+
var options = $plugindiv.data().SimpleList;
- if (use_datatables) datatables_update_table ($table,$tbody,rows,options.key);
- else regular_update_table ($table,$tbody,rows,options.key);
+ if (use_datatables)
+ datatables_update_table($table, $tbody, rows, options.key);
+ else
+ regular_update_table($table, $tbody, rows, options.key);
- }
+ }
// hard-wire a separate presentation depending on the key being used....
function cell(key, value) {
- if (key == 'slice_hrn') {
+ if (key == 'slice.slice_hrn') {
return "<i class='icon-play-circle'></i><a href='/slice/" + value + "'>" + value + "</a>";
} else if (key == 'network_hrn') {
return "<i class='icon-play-circle'></i>" + value ;
}
function regular_update_table ($table, $tbody, rows, key) {
- if (debug) messages.debug('regular_update_table ' + rows.length + " rows");
- var html=$.map(rows, function (row) { return html_row ( cell (key, row[key])); }).join();
- $tbody.html(html);
+ if (debug)
+ messages.debug('regular_update_table ' + rows.length + " rows");
+ var html=$.map(rows, function (row) {
+ value = row;
+ $.each(key.split('.'), function(i, k) {
+ if ($.isArray(value)) {
+ value = $.map(value, function(val, i) { return val[k]});
+ } else {
+ value = value[k];
+ }
+ });
+ if ($.isArray(value)) {
+ x = $.map(value, function(val, i) { return html_row ( cell (key, val)); });
+ return x;
+ } else {
+ return html_row ( cell (key, value));
+ }
+ }).join();
+ $tbody.html(html);
}
function datatables_set_message ($table, $tbody, message) {
- $table.dataTable().fnClearTable();
- $table.dataTable().fnAddData( [ message ] );
- $table.dataTable().fnDraw();
+ $table.dataTable().fnClearTable();
+ $table.dataTable().fnAddData( [ message ] );
+ $table.dataTable().fnDraw();
}
function datatables_update_table ($table, $tbody, rows, key) {
$table.dataTable().fnDraw();
}
- function html_row (cell) { return "<tr><td class='simplelist'>"+cell+"</td></tr>"; }
+ function html_row (cell) {
+ return "<tr><td class='simplelist'>"+cell+"</td></tr>";
+ }
})( jQuery );
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
-# DJANGO_SETTINGS_MODULE="myslice.settings" ./test-send-email.py
+#DJANGO_SETTINGS_MODULE="repos.myslice-django.myslice.settings" ./test-send-email.py
#
-from django.core import mail
+#from django.core import mail
from django.test import TestCase
+from django.conf import settings
+from django.core.mail import EmailMessage
+import myslice.settings
class EmailTest(TestCase):
def test_send_email(self):
- mail.send_mail('Subject here', 'Here is the message.',
- 'support@myslice.info', ['jordan.auge@lip6.fr', 'jordan.auge@free.fr'],
- fail_silently=False)
- print mail.outbox
- self.assertEquals(len(mail.outbox), 1)
- self.assertEquals(mail.outbox[0].subject, 'Subject here')
+ email = EmailMessage('Hello', 'World', to=['jordan.auge@lip6.fr'])
+ email.send()
+
+
+
+
+
from django.conf.urls import patterns, include, url
from portal import views
-from portal.views import UserRegisterView, UserValidateView
+from portal.views import UserRegisterView, UserValidateView, DashboardView
from portal.util import TemplateView
# DEPRECATED #named_register_forms = (
name='user_register_complete'),
# User validation
url(r'^user/validate/?$', UserValidateView.as_view(), name='user_validate'),
+ url(r'^dashboard/?$', DashboardView.as_view(), name='dashboard'),
# Slice request
#url(r'^slice/request/?$', views.slice_request, name='slice_request'),
# Slice confirmation
# this program; see the file COPYING. If not, write to the Free Software
# Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-from django.conf import settings
-from django.contrib.sites.models import RequestSite
-from django.contrib.sites.models import Site
-
-from django.shortcuts import render
-from portal.forms import UserRegisterForm, SliceRequestForm
-from portal.util import RegistrationView, ActivationView
-from portal.models import PendingUser, PendingSlice
-from portal import signals
+from django.conf import settings
+from django.contrib.sites.models import Site, RequestSite
+from django.views.generic import View
+from django.views.generic.base import TemplateView
+from django.shortcuts import render
+from plugins.lists.simplelist import SimpleList
+from portal import signals
+from portal.forms import UserRegisterForm, SliceRequestForm
+from portal.util import RegistrationView, ActivationView
+from portal.models import PendingUser, PendingSlice
+from manifold.core.query import Query
+from unfold.page import Page
+
+class DashboardView(TemplateView):
+ template_name = "dashboard.html"
+
+ def get_context_data(self, **kwargs):
+ user_hrn = 'ple.upmc.jordan_auge'
+
+ page = Page(self.request)
+
+ # Slow...
+ #slice_query = Query().get('slice').filter_by('user.user_hrn', 'contains', user_hrn).select('slice_hrn')
+ slice_query = Query().get('user').filter_by('user_hrn', '==', user_hrn).select('slice.slice_hrn')
+ auth_query = Query().get('network').select('network_hrn')
+ page.enqueue_query(slice_query)
+ page.enqueue_query(auth_query)
+
+ page.expose_queries()
+
+ slicelist = SimpleList(
+ title = None,
+ page = page,
+ key = 'slice.slice_hrn',
+ query = slice_query,
+ )
+
+ authlist = SimpleList(
+ title = None,
+ page = page,
+ key = 'network_hrn',
+ query = auth_query,
+ )
+
+ context = super(DashboardView, self).get_context_data(**kwargs)
+ context['person'] = self.request.user
+ context['networks'] = authlist.render(self.request)
+ context['slices'] = slicelist.render(self.request)
+
+ context.update(page.prelude_env())
+
+ return context
class UserRegisterView(RegistrationView):
"""
# decorator to deflect calls on Plugin to its Prelude through self.page.prelude
def to_prelude (method):
def actual (self, *args, **kwds):
+ if not self.page: # jordan
+ return None
prelude_method=Prelude.__dict__[method.__name__]
return prelude_method(self.page.prelude,*args, **kwds)
return actual
if not domid: domid=self.newdomid()
self.domid=domid
# title is shown when togglable
- if not title: title="Plugin title for %s"%domid
+ #if not title: title="Plugin title for %s"%domid
self.title=title
self.classname=self._py_classname()
self.plugin_classname=self._js_classname()
for (k,v) in self.__dict__.items(): print "dbg %s:%s"%(k,v)
print "%s init dbg .... END"%self.classname
# do this only once the structure is fine
- self.page.record_plugin(self)
+ if self.page: # I assume we can have a None page (Jordan)
+ self.page.record_plugin(self)
def __repr__ (self):
return "[%s]:%s"%(self.classname,self.domid)
def template_file (self): return "undefined_template"
def template_env (self, request): return {}
- def default_togglable (self): return True
+ def default_togglable (self): return False
def default_toggled (self): return 'persistent'
# # tell the framework about requirements (for the document <header>)
<h4 id='show-{{ domid }}' class='plugin-show'{% if not display_show_button %} style='display:none;'{% endif %}><i class="icon-hand-right"></i>
<a href='#' class='plugin-tooltip' data-toggle='tooltip' data-original-title='Show plugin "{{ title }}" ({{ classname }})'>{{ title }}</a></h4>
<h4 id='hide-{{ domid }}' class='plugin-hide'{% if not display_hide_button %} style='display:none;'{% endif %}><i class="icon-hand-down"></i>
+{% if title %}
<a href='#' class='plugin-tooltip' data-toggle='tooltip' data-original-title='Hide plugin "{{ title }}" ({{ classname }})'>{{ title }}</a></h4>
+{% endif %}
{% endif %}{# togglable #}
{% endif %}{# visible #}