You are here

function date_popup_settings in Date 7.2

Same name and namespace in other branches
  1. 6.2 date_popup/date_popup.module \date_popup_settings()
  2. 7.3 date_popup/date_popup.module \date_popup_settings()
  3. 7 date_popup/date_popup.module \date_popup_settings()

General configuration form for controlling the Date Popup behaviour.

1 string reference to 'date_popup_settings'
date_popup_menu in date_popup/date_popup.module
Implements hook_menu().

File

date_popup/date_popup.module, line 873
A module to enable jQuery calendar and time entry popups.

Code

function date_popup_settings() {
  $wvega_available = date_popup_get_wvega_path();
  $preferred_timepicker = date_popup_get_preferred_timepicker();
  $form['#prefix'] = t('<p>The Date Popup module allows for manual time entry or use of a jQuery timepicker plugin. The Date module comes with a default jQuery timepicker which is already installed. The module also supports a dropdown timepicker that must be downloaded separately. The dropdown timepicker will not appear as an option until the code is available in the libraries folder. If you do not want to use a jQuery timepicker, you can choose the "Manual time entry" option below and users will get a regular textfield instead.</p>');
  $form['date_popup_timepicker'] = array(
    '#type' => 'select',
    '#options' => array(
      'default' => t('Use default jQuery timepicker'),
      'wvega' => t('Use dropdown timepicker'),
      'none' => t('Manual time entry, no jQuery timepicker'),
    ),
    '#title' => t('Timepicker'),
    '#default_value' => variable_get('date_popup_timepicker', $preferred_timepicker),
  );
  if (!$wvega_available) {
    $form['#prefix'] .= t('<p>To install the dropdown timepicker, create a <code>!directory</code> directory in your site installation. Then visit <a href="@download">@download</a>, download the latest copy and unzip it. You will see files with names like jquery.timepicker-1.1.2.js and jquery.timepicker-1.1.2.css. Rename them to jquery.timepicker.js and jquery.timepicker.css and copy them into <code>!directory</code>.</p>', array(
      '!directory' => 'sites/all/libraries/wvega-timepicker',
      '@download' => 'https://github.com/wvega/timepicker/archives/master',
    ));
    unset($form['date_popup_timepicker']['#options']['wvega']);
  }
  $css = <<<EOM
/* ___________ IE6 IFRAME FIX ________ */
.ui-datepicker-cover {
  display: none; /*sorry for IE5*/
  display/**/: block; /*sorry for IE5*/
  position: absolute; /*must have*/
  z-index: -1; /*must have*/
  filter: mask(); /*must have*/
  top: -4px; /*must have*/
  left: -4px; /*must have*/ /* LTR */
  width: 200px; /*must have*/
  height: 200px; /*must have*/
}
EOM;
  $form['#suffix'] = t('<p>The Date Popup calendar includes some css for IE6 that breaks css validation. Since IE 6 is now superceded by IE 7, 8, and 9, the special css for IE 6 has been removed from the regular css used by the Date Popup. If you find you need that css after all, you can add it back in your theme. Look at the way the Garland theme adds special IE-only css in in its page.tpl.php file. The css you need is:</p>') . '<blockquote><PRE>' . $css . '</PRE></blockquote>';
  return system_settings_form($form);
}