<commit_before>var g = require('lib/globals');
var tableView = Ti.UI.createTableView();
var data = [];
var index = [];

exports.window = function() {
  var instance = Ti.UI.createWindow({
    title: 'Sessions',
    backgroundColor: '#eeeeee',
    barColor: '#3b587b'
  });
  instance.orientationModes = [Ti.UI.PORTRAIT];
  
  // Android Specific Code
  if (globals.osname === 'android') {
    instance.backgroundColor = "#111111";
    instance.activity.onCreateOptionsMenu = function(e) {
      var menu = e.menu;
      var menuItem = menu.add({title:"Refresh"});
      menuItem.addEventListener("click", function(e) {
        Ti.App.fireEvent('events.update');
      });
    };
  }
  
  // iPhone Specific Code
  if (globals.osname === 'iphone' || globals.osname === 'ipad') {
    var refresh = Ti.UI.createButton({
      systemButton:Ti.UI.iPhone.SystemButton.REFRESH
    });
    refresh.addEventListener('click', function(e) {
      Ti.App.fireEvent('events.update', {prune: true});
    });
    instance.rightNavButton = refresh;
  }
  
  var search = Ti.UI.createSearchBar();
  tableView.data = getSessionData();
  tableView.search = search;
  tableView.index = index;
  instance.add(tableView);
  
  instance.addEventListener('focus', function(e) {
    Ti.App.fireEvent('events.update');
  });
  instance.addEventListener('click', function(e) {
    Ti.App.fireEvent('session.click', {nid: e.row.node.nid});
  });
  
  return instance;
};

Ti.App.addEventListener('sessions.updateTableView', function(e) {
  var sessionData = getSessionData();
  tableView.setData(sessionData);
});

function getSessionData() {
  var events = g.slcdbGetSessions(),
      data = [],
      row = '',
      title = '';
  for (var i = 0, node; node = events[i]; i++) {
    // no download, dont show
    if (node.download == 'None') continue;
    title = globals.html_decode(node.title);
    speaker = node.speaker;
    room = node.room;
    category = globals.html_decode(node.track);
    row = Ti.UI.createTableViewRow({
      backgroundColor: '#eeeeee',
      layout: 'absolute',
      height: 98
    });
    row.notes = node.notes;
    row.node = node;
    
    notesImage = Ti.UI.createImageView({<commit_msg>fixes for incorrect var names<commit_after>var g = require('lib/globals');
var tableView = Ti.UI.createTableView();
var data = [];
var index = [];

exports.window = function() {
  var instance = Ti.UI.createWindow({
    title: 'Sessions',
    backgroundColor: '#eeeeee',
    barColor: '#3b587b'
  });
  instance.orientationModes = [Ti.UI.PORTRAIT];
  
  // Android Specific Code
  if (g.osname === 'android') {
    instance.backgroundColor = "#111111";
    instance.activity.onCreateOptionsMenu = function(e) {
      var menu = e.menu;
      var menuItem = menu.add({title:"Refresh"});
      menuItem.addEventListener("click", function(e) {
        Ti.App.fireEvent('events.update');
      });
    };
  }
  
  // iPhone Specific Code
  if (g.osname === 'iphone' || g.osname === 'ipad') {
    var refresh = Ti.UI.createButton({
      systemButton:Ti.UI.iPhone.SystemButton.REFRESH
    });
    refresh.addEventListener('click', function(e) {
      Ti.App.fireEvent('events.update', {prune: true});
    });
    instance.rightNavButton = refresh;
  }
  
  var search = Ti.UI.createSearchBar();
  tableView.data = getSessionData();
  tableView.search = search;
  tableView.index = index;
  instance.add(tableView);
  
  instance.addEventListener('focus', function(e) {
    Ti.App.fireEvent('events.update');
  });
  instance.addEventListener('click', function(e) {
    Ti.App.fireEvent('session.click', {nid: e.row.node.nid});
  });
  
  return instance;
};

Ti.App.addEventListener('sessions.updateTableView', function(e) {
  var sessionData = getSessionData();
  tableView.setData(sessionData);
});

function getSessionData() {
  var events = g.slcdbGetSessions(),
      data = [],
      row = '',
      title = '';
  for (var i = 0, node; node = events[i]; i++) {
    // no download, dont show
    if (node.download == 'None') continue;
    title = g.html_decode(node.title);
    speaker = node.speaker;
    room = node.room;
    category = g.html_decode(node.track);
    row = Ti.UI.createTableViewRow({
      backgroundColor: '#eeeeee',
      layout: 'absolute',
      height: 98
    });
    row.notes = node.notes;
    row.node = node;
    
    notesImage = Ti.UI.createImageView({
{'fraction_non_alphanumeric': 0.16217450890817725, 'fraction_numerical': 0.005938784833257195, 'mean_word_length': 3.1984659635666346, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6942495', 'n_tokens_mistral': 1447, 'n_tokens_neox': 1410, 'n_words': 269}