# hard question : where should we redirect requests to logout if user is not logged in ?
def logout_user (request):
- # xxx check that we're indeed logged in
+ # check that we're indeed logged in
if not request.user.is_authenticated():
return HttpResponseRedirect ('/')
logout(request)
self.filters=filters
self.params=params
self.fields=fields
- # xxx this is unused for now
+ # xxx these are unused for now....
self.sort=sort
self.limit=limit
self.offset=offset
<table class='display' id='hazelnut-{{ domid }}'>
-<thead><tr> {% for subject_field in subject_fields %}
-<th>{{ subject_field }}</th>{% endfor %} {% if checkboxes %}<th>+/-</th>{% endif %}
+<thead><tr> {% for column in columns %}
+<th>{{ column }}</th>{% endfor %} {% if checkboxes %}<th>+/-</th>{% endif %}
</tr></thead>
<tbody>
</tbody>
show : function( ) {
var $this=$(this);
// xxx wtf. why [1] ? would expect 0...
+ if (debug) console.log("Hitting suspicious line in hazelnut.show");
var oTable = $($('.dataTable', $this)[1]).dataTable();
oTable.fnAdjustColumnSizing()
this.options = options;
/* constructor */
this.table = null;
- // xxx thierry : init this here - it was not, I expect this relied on set_query somehow..
+ // xxx thierry : initialize this here - it was not, I expect this relied on set_query somehow..
//this.current_query = null;
this.current_query=manifold.find_query(this.options.query_uuid);
if (debug) console.log("Hazelnut constructor: have set current_query -> " + this.current_query);
// http://datatables.net/forums/discussion/5331/datatables-warning-...-requested-unknown-parameter/p2
aoColumnDefs: [{sDefaultContent: '',aTargets: [ '_all' ]}],
bRetrieve: true,
- // xxx this one causes tables in a 'tabs' that are not exposed at the time this is run to show up empty
+ // WARNING: this one causes tables in a 'tabs' that are not exposed at the time this is run to show up empty
// sScrollX: '100%', /* Horizontal scrolling */
bProcessing: true, /* Loading */
fnRowCallback: function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {
class Hazelnut (Plugin):
- def __init__ (self, query, checkboxes=False, **settings):
+ # set checkboxes if a final column with checkboxes is desired
+ # pass columns as the initial set of columns
+ # if None then this is taken from the query's fields
+ def __init__ (self, query, checkboxes=False, columns=None, **settings):
Plugin.__init__ (self, **settings)
self.query=query
self.checkboxes=checkboxes
+ if columns is not None:
+ self.columns=columns
+ else:
+ self.columns=self.query.fields
def template_file (self):
return "hazelnut.html"
def template_env (self, request):
env={}
env.update(self.__dict__)
- # xxx need to retrieve metadata
-# $subject_keys = Plugins::get_default_fields($query->subject, $is_unique);
-# $fields = Plugins::metadata_get_fields($query->subject);
-# for now I am hard-coding the ones from haze.py
- env['subject_fields']=[ 'network', 'type', 'hostname', 'hrn' ]
+ env['columns']=self.columns
return env
def requirements (self):
# toggled=False,
# this is the query at the core of the slice list
query=main_query,
+ columns=['hrn','hostname'],
),
QueryCode (
page=page,