/[drupal]/contributions/modules/yui_calendar/yuicalendar.module
ViewVC logotype

Diff of /contributions/modules/yui_calendar/yuicalendar.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.9, Fri Oct 19 17:52:35 2007 UTC revision 1.9.2.1, Wed Mar 19 20:23:07 2008 UTC
# Line 16  Line 16 
16   *   *
17   * Capture author date fields and add the YUI calendar to them.   * Capture author date fields and add the YUI calendar to them.
18   */   */
19  function yuicalendar_form_alter($form_id, &$form) {  function yuicalendar_form_alter(&$form, $form_state, $form_id) {
20    if ($form_id === 'comment_form' && isset($form['admin']) && isset($form['admin']['date'])) {    if ($form_id === 'comment_form' && isset($form['admin']) && isset($form['admin']['date'])) {
21      $form['admin']['author']['#weight'] = -4;      $form['admin']['author']['#weight'] = -4;
22      yuicalendar_build_form($form['admin'], 'date', strtotime($form['admin']['date']['#default_value']), -3, variable_get('yuicalendar_edit_drop_down', '1'), NULL);      yuicalendar_build_form($form['admin'], 'date', strtotime($form['admin']['date']['#default_value']), -3, variable_get('yuicalendar_edit_drop_down', '1'), NULL);
# Line 24  function yuicalendar_form_alter($form_id Line 24  function yuicalendar_form_alter($form_id
24    elseif (isset($form['type']) && $form['type']['#value'].'_node_form' === $form_id && isset($form['author']) && isset($form['author']['date'])) {    elseif (isset($form['type']) && $form['type']['#value'].'_node_form' === $form_id && isset($form['author']) && isset($form['author']['date'])) {
25      yuicalendar_build_form($form['author'], 'date', $form['created']['#value'], 5, variable_get('yuicalendar_edit_drop_down', '1'), NULL);      yuicalendar_build_form($form['author'], 'date', $form['created']['#value'], 5, variable_get('yuicalendar_edit_drop_down', '1'), NULL);
26    }    }
27      $form['yuicalendar'] = Array('#type' => 'weight');
28    }
29    
30    function yuicalendar_nodeapi($node, $op) {
31      switch ($op) {
32        case 'validate':
33          if (isset($node->yuicalendar)) {
34            yuicalendar_load();
35          }
36      }
37  }  }
38    
39  /**  /**
# Line 78  function yuicalendar_build_form(&$form, Line 88  function yuicalendar_build_form(&$form,
88      $years[$year] = $year;      $years[$year] = $year;
89      $year--;      $year--;
90    }    }
91    
92    $form[$id . '-year'] = Array(    $form[$id . '-year'] = Array(
93      '#type' => 'select',      '#type' => 'select',
94      '#weight' => $weight + .05,      '#weight' => $weight + .05,
# Line 136  function yuicalendar_admin_settings() { Line 147  function yuicalendar_admin_settings() {
147  /**  /**
148   * Implemention of hook_menu().   * Implemention of hook_menu().
149   */   */
150  function yuicalendar_menu($may_cache) {  function yuicalendar_menu() {
151    if (!$may_cache) {      $items['admin/settings/yuicalendar'] = array(
     // Nothing yet.  
   }  
   else {  
     $items[] = array(  
     'path' => 'admin/settings/yuicalendar',  
152      'title' => t('YUI Calendar Settings'),      'title' => t('YUI Calendar Settings'),
153      'callback' => 'drupal_get_form',      'page callback' => 'drupal_get_form',
154      'callback arguments' => 'yuicalendar_admin_settings',      'page arguments' => array('yuicalendar_admin_settings'),
155      'access' => user_access('access administration pages'),      'access callback' => 'user_access',
156        'access arguments' => array('access administration pages'),
157      'type' => MENU_NORMAL_ITEM,      'type' => MENU_NORMAL_ITEM,
158      );      );
   }  
159    
160    return $items;    return $items;
161  }  }

Legend:
Removed from v.1.9  
changed lines
  Added in v.1.9.2.1

  ViewVC Help
Powered by ViewVC 1.1.2