You are here

function linkit_dashboard_page in Linkit 6

Same name and namespace in other branches
  1. 7.3 linkit.module \linkit_dashboard_page()
  2. 7 linkit.module \linkit_dashboard_page()

Creates the dashboard.

1 string reference to 'linkit_dashboard_page'
linkit_menu in ./linkit.module
Implementation of hook_menu().

File

./linkit.module, line 157
Main file for linkit module.

Code

function linkit_dashboard_page($editor) {
  module_invoke('admin_menu', 'suppress');

  // Add CSS.
  drupal_add_css(drupal_get_path('module', 'linkit') . '/css/linkit.css');

  // Add JS
  static $defualt_settings_added = FALSE;

  // Add default settings
  if (!$defualt_settings_added) {
    $defualt_settings_added = TRUE;
    $settings = array(
      'linkit' => array(
        'ajaxcall' => url('admin/linkit/geteditresult'),
      ),
    );

    // Check if we have IMCE and access to it.
    $imce = module_invoke('imce', 'access');
    if ($imce) {
      $settings['linkit']['IMCEurl'] = url('imce', array(
        'query' => array(
          'app' => 'Linkit|url@edit-link',
        ),
      ));
    }
    drupal_add_js($settings, 'setting');
  }
  drupal_add_js(drupal_get_path('module', 'linkit') . '/linkit.js');
  switch ($editor) {
    case 'wysiwyg_tinymce':

      // Add JavaScript.
      drupal_add_js(wysiwyg_get_path('tinymce') . '/jscripts/tiny_mce/tiny_mce_popup.js');
      drupal_add_js(drupal_get_path('module', 'linkit') . '/editors/tinymce/linkit.js');
      break;
    case 'ckeditor':
    case 'wysiwyg_ckeditor':

      // Add JavaScript.
      drupal_add_js(drupal_get_path('module', 'linkit') . '/editors/ckeditor/linkitDialog.js');
      break;
    case 'fckeditor':
    case 'wysiwyg_fckeditor':

      // Add JavaScript.
      drupal_add_js(drupal_get_path('module', 'linkit') . '/editors/fckeditor/linkit/linkitDialog.js');
      break;
    case 'bueditor':

      // Add JavaScript.
      drupal_add_js(drupal_get_path('module', 'linkit') . '/editors/bueditor/linkit.js');
      break;
  }
  print theme('linkit_dashboard', drupal_get_form('_linkit_form'));
  exit;
}