You are here

function template_preprocess_drupalchat in DrupalChat 6

File

themes/drupalchat.theme.inc, line 2

Code

function template_preprocess_drupalchat(&$variables) {
  drupal_add_css(drupal_get_path('module', 'drupalchat') . '/themes/drupalchat.css');

  //$variables['css']        = drupal_add_css();

  //$variables['styles']     = drupal_get_css();
  drupal_add_js(drupal_get_path('module', 'drupalchat') . '/themes/js/ba-emotify.js');
  drupal_add_js(drupal_get_path('module', 'drupalchat') . '/themes/js/drupalchat.js');
  drupal_add_js(array(
    'drupalchat' => array(
      "polling_method" => variable_get('drupalchat_polling_method', '0'),
    ),
  ), 'setting');
  $opts = array(
    'absolute' => TRUE,
    'language' => '',
  );
  if (variable_get('drupalchat_polling_method', '0') == '0') {
    $process_messages_url = url('drupalchat/process-messages', $opts);
    drupal_add_js(array(
      'drupalchat' => array(
        "refresh_rate" => variable_get('drupalchat_refresh_rate', 2),
      ),
    ), 'setting');
    drupal_add_js(array(
      'drupalchat' => array(
        "send_rate" => variable_get('drupalchat_send_rate', 2),
      ),
    ), 'setting');
  }
  else {
    $process_messages_url = url('drupalchat/process-messages-long-polling', $opts);
    drupal_add_js(array(
      'drupalchat' => array(
        "refresh_rate" => 2,
      ),
    ), 'setting');
    drupal_add_js(array(
      'drupalchat' => array(
        "send_rate" => 2,
      ),
    ), 'setting');
  }
  $store_messages_url = url('drupalchat/store-messages', $opts);
  $load_messages_url = url('drupalchat/load-messages', $opts);
  drupal_add_js(array(
    'drupalchat' => array(
      "process_messages_url" => $process_messages_url,
    ),
  ), 'setting');
  drupal_add_js(array(
    'drupalchat' => array(
      "store_messages_url" => $store_messages_url,
    ),
  ), 'setting');
  drupal_add_js(array(
    'drupalchat' => array(
      "load_messages_url" => $load_messages_url,
    ),
  ), 'setting');
  $smileys_url = url(drupal_get_path('module', 'drupalchat') . '/themes/images/smileys/', $opts);
  drupal_add_js(array(
    'drupalchat' => array(
      "smileys_url" => $smileys_url,
    ),
  ), 'setting');
  global $user;
  drupal_add_js(array(
    'drupalchat' => array(
      "username" => $user->name,
    ),
  ), 'setting');
  drupal_add_js(array(
    'drupalchat' => array(
      "uid" => $user->uid,
    ),
  ), 'setting');
  drupal_add_js(array(
    'drupalchat' => array(
      "current_timestamp" => time(),
    ),
  ), 'setting');

  /*jquery_ui_add('jquery.ui.core');
  jquery_ui_add('jquery.ui.widget');
  jquery_ui_add('jquery.ui.mouse');
  jquery_ui_add('jquery.ui.tabs');
  jquery_ui_add('jquery.ui.sortable');*/
}