Skip to content
Snippets Groups Projects
unl.module 5.12 KiB
Newer Older
function unl_node_prepare($node) {
/**
 * Implementation of hook_wywiwyg_plugin() found in wysiwyg.api.php
 */
function unl_wysiwyg_plugin($editor) {
  switch ($editor) {
    case 'tinymce':
      return array(
        'unl' => array(
          // A URL to the plugin's homepage.
          'url' => 'http://gforge.unl.edu/gf/project/wdn_tinymce/',
           // The full path to the native editor plugin.
          'path' => $editor['library path'] . '/plugins/unl',
          // A list of editor extensions provided by this native plugin.
          // Extensions are not displayed as buttons and touch the editor's
          // internals, so you should know what you are doing.
          'extensions' => array(
            'unl' => 'UNL Extension'
          ),
          // Boolean whether this plugin is a native plugin, i.e. shipped with
          // the editor. Definition must be ommitted for plugins provided by
          // other modules.
          'internal' => TRUE,
          // Boolean whether the editor needs to load this plugin. When TRUE,
          // the editor will automatically load the plugin based on the 'path'
          // variable provided. If FALSE, the plugin either does not need to
          // be loaded or is already loaded by something else on the page.
          // Most plugins should define TRUE here.
          'load' => TRUE,
          // A list of buttons provided by this native plugin. The key has to
          // match the corresponding JavaScript implementation. The value is
          // is displayed on the editor configuration form only.
          'buttons' => array(
            'unlZenBox'   => 'UNL Zen Box',
            'unlZenTable' => 'UNL Zen Table',
            'unlLayout'   => 'UNL Layout',
            'unlTooltip'  => 'UNL Tooltip',
          ),
          // A list of global, native editor configuration settings to
          // override. To be used rarely and only when required.
          'options' => array(
            'skin' => 'unl',
            'table_styles' => 'ZenTable Bright (yellow)=zentable bright;ZenTable Cool (blue)=zentable cool;ZenTable Energetic (orange)=zentable energetic;ZenTable Soothing (green)=zentable soothing;ZenTable Primary (red)=zentable primary;ZenTable Neutral (gray)=zentable neutral;', 'doctype' => '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">',
          ),
        )
        // Wysiwyg wrapper plugin AJAX callback.
        // 'callback' => url('myplugin/browse'),
        // 'icon' => drupal_get_path('module', 'mymodule') . '/myplugin/myplugin.png',
        // Might need to be set later on; after retrieving customized editor
        // layout.
        //'theme_advanced_buttons1' => array(t('Button title (optional)') => 'myplugin'),
      
      );
  }
function unl_permission() {
  return array(
    'unl migration' => array(
      'title'       => t('Migration'),
      'description' => t('Migrate UNL Template based sites to drupal'),
    ), 

    'unl site creation' => array(
      'title'       => t('Site Creation'),
      'description' => t('Create new drupal sites using the UNL profile'),
    )
  );
/**
 * Adds UNL Migration Tool to the Content menu for admin
 */
function unl_menu() {
  $access = array();
  $items['admin/content/unl/migration'] = array(
    'title'            => 'UNL Migration Tool',
    'description'      => 'Migrate a static UNL template page into drupal',
    'access arguments' => array('unl migration'),
    'page callback'    => 'drupal_get_form',
    'page arguments'   => array('unl_migration'),
    'type'             => MENU_LOCAL_TASK,
    'file'             => 'unl_migration.php',
  );
  if (conf_path() == 'sites/default') {
    $items['admin/sites/unl'] = array(
      'title'            => 'UNL Site Creation Tool',
      'description'      => 'Create a new UNL Drupal site',
      'access arguments' => array('unl site creation'),
      'page callback'    => 'drupal_get_form',
      'page arguments'   => array('unl_site_creation'),
      'type'             => MENU_LOCAL_TASK,
      'file'             => 'unl_site_creation.php',
    );
    
    $items['admin/sites/unl/add'] = array(
      'title'       => 'Add',
      'description' => 'Determine access to features by selecting permissions for roles.',
      'type'        => MENU_DEFAULT_LOCAL_TASK,
      'weight'      => -8,
    );
    
    $items['admin/sites/unl/list'] = array(
      'title'            => 'List',
      'description'      => 'List UNL Drupal sites',
      'access arguments' => array('unl site creation'),
      'page callback'    => 'drupal_get_form',
      'page arguments'   => array('unl_site_list'),
      'type'             => MENU_LOCAL_TASK,
      'file'             => 'unl_site_creation.php',
    );
  }
  return $items;
function unl_form_alter(&$form, $form_state, $form_id) {
  // Make new menu items expanded by default.
  if ($form_id == 'menu_edit_item' && $form['mlid']['#value'] == 0) {
    $form['expanded']['#default_value'] = TRUE;
  }
function unl_theme() {
  return array(
    'unl_site_list_table' => array(
      'render element' => 'form'
    )
  );