Forked from
UNL Information Services / UNL-CMS
909 commits behind the upstream repository.
-
Tim Steiner authored
Second, the CAS module will always use SSL when validating a user's ticket. Third, if a user has any roles other than Anonymous or Authenticated User, they will be given SSL links while "mortal" users will use plain http. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@227 20a16fea-79d4-4915-8869-1ea9d5ebf173
Tim Steiner authoredSecond, the CAS module will always use SSL when validating a user's ticket. Third, if a user has any roles other than Anonymous or Authenticated User, they will be given SSL links while "mortal" users will use plain http. git-svn-id: file:///tmp/wdn_thm_drupal/branches/drupal-7.x@227 20a16fea-79d4-4915-8869-1ea9d5ebf173
unl.module 6.06 KiB
<?php
function unl_node_prepare($node) {
$node->menu['expanded'] = 1;
}
/**
* 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;
}
if ($form_id == 'system_site_information_settings') {
$form['site_information']['https'] = array(
'#type' => 'checkbox',
'#title' => 'SSL Enabled',
'#default_value' => variable_get('https', FALSE),
);
$form['#submit'][] = 'unl_system_settings_form_submit';
}
}
function unl_system_settings_form_submit($form, &$form_state) {
variable_set('https', (bool) $form_state['values']['https']);
}
function unl_theme() {
return array(
'unl_site_list_table' => array(
'render element' => 'form'
)
);
}
function unl_url_outbound_alter(&$path, &$options, $original_path) {
$path_parts = parse_url($path);
if (isset($path_parts['scheme']) || $path == 'user/cas') {
return;
}
$user = $GLOBALS['user'];
$user_roles = array_keys($user->roles);
$generic_user = TRUE;
foreach ($user_roles as $user_role) {
if (in_array($user_role, array(DRUPAL_ANONYMOUS_RID, DRUPAL_AUTHENTICATED_RID))) {
continue;
}
$generic_user = FALSE;
}
$options['https'] = (bool) (variable_get('https', 0) && !$generic_user);
}