diff -urp sites/all/modules/availability_calendars.orig/availability_calendars.css sites/all/modules/availability_calendars/availability_calendars.css --- sites/all/modules/availability_calendars.orig/availability_calendars.css 2009-09-14 02:07:53.000000000 +0200 +++ sites/all/modules/availability_calendars/availability_calendars.css 2009-11-24 09:38:49.000000000 +0100 @@ -20,7 +20,7 @@ td.calnote { } td.calother { - background: #fff; + background: #fff; } td.calavailable { @@ -46,10 +46,20 @@ td.keystatus { } div.month_title{ + width: 200px; margin: 6px 6px 0; border-bottom:1px solid #ddd; } div.calmonth-wrapper { float:left; +} + +input.delete-label { + background-color: #c0c0c0; +} + +input.new-label { + border: 2px solid #4685c6; + background-color: #cbe5ff; } \ No newline at end of file diff -urp sites/all/modules/availability_calendars.orig/availability_calendars.info sites/all/modules/availability_calendars/availability_calendars.info --- sites/all/modules/availability_calendars.orig/availability_calendars.info 2009-10-10 14:02:55.000000000 +0200 +++ sites/all/modules/availability_calendars/availability_calendars.info 2009-11-24 09:04:35.000000000 +0100 @@ -2,10 +2,11 @@ name = Availability Calendars description = Allows for availability information to be displayed using calendars on specified content types. core = 6.x +dependencies[] = ahah_helper -; Information added by drupal.org packaging script on 2009-10-10 -version = "6.x-1.x-dev" +; Information added by drupal.org packaging script on 2009-09-01 +version = "6.x-1.2" core = "6.x" project = "availability_calendars" -datestamp = "1255176175" +datestamp = "1251821405" diff -urp sites/all/modules/availability_calendars.orig/availability_calendars.install sites/all/modules/availability_calendars/availability_calendars.install --- sites/all/modules/availability_calendars.orig/availability_calendars.install 2009-09-23 10:33:03.000000000 +0200 +++ sites/all/modules/availability_calendars/availability_calendars.install 2009-11-24 09:04:42.000000000 +0100 @@ -1,5 +1,5 @@ 'The table for calendar days.', + 'description' => t('The table for calendar days.'), 'fields' => array( 'nid' => array( - 'description' => 'The primary identifier for a node.', + 'description' => t('The primary identifier for a node.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'year' => array( - 'description' => 'The number of the year.', + 'description' => t('The number of the year.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'month' => array( - 'description' => 'The number of the month.', + 'description' => t('The number of the month.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'day' => array( - 'description' => 'The number of the day.', + 'description' => t('The number of the day.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'status' => array( - 'description' => 'The status.', + 'description' => t('The status.'), 'type' => 'int', 'unsigned' => TRUE ) @@ -50,39 +50,48 @@ function availability_calendars_schema() ); $schema['availability_calendars_week'] = array( - 'description' => 'The table for calendar days.', + 'description' => t('The table for calendar days.'), 'fields' => array( 'nid' => array( - 'description' => 'The primary identifier for a node.', + 'description' => t('The primary identifier for a node.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'year' => array( - 'description' => 'The number of the year.', + 'description' => t('The number of the year.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'month' => array( - 'description' => 'The number of the month.', + 'description' => t('The number of the month.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'week' => array( - 'description' => 'The number of the week.', + 'description' => t('The number of the week.'), 'type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE ), 'note' => array( - 'description' => 'The status.', + 'description' => t('The status.'), 'type' => 'varchar', 'length' => 64 ) ) ); + + $schema['availability_calendars_labels'] = array( + 'description' => 'Store custom labels for Availability Calendars', + 'fields' => array( + 'lid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'label' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255) + ), + 'primary key' => array('lid') + ); return $schema; } @@ -107,3 +116,22 @@ function availability_calendars_uninstal drupal_set_message(t('Availability Calendars module uninstalled successfully.'), 'warning'); } + +/** + * Implementation of hook_update_version + */ +function availability_calendars_update_6112() { + $ret = array(); + + $table = array( + 'description' => 'Store custom labels for Availability Calendars', + 'fields' => array( + 'lid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE), + 'label' => array('type' => 'varchar', 'not null' => TRUE, 'length' => 255) + ), + 'primary key' => array('lid') + ); + + db_create_table($ret, 'availability_calendars_labels', $table); + return $ret; +} \ No newline at end of file diff -urp sites/all/modules/availability_calendars.orig/availability_calendars.module sites/all/modules/availability_calendars/availability_calendars.module --- sites/all/modules/availability_calendars.orig/availability_calendars.module 2009-10-10 06:21:51.000000000 +0200 +++ sites/all/modules/availability_calendars/availability_calendars.module 2009-11-24 10:15:45.000000000 +0100 @@ -1,5 +1,5 @@ array('availability_calendars_admin_submit') + ); + ahah_helper_register($form, $form_state); + + $form['availability_calendars'] = array( + '#prefix' => '
', + '#suffix' => '
', + '#type' => 'fieldset', + '#title' => 'Availability Calendars Settings', + '#tree' => TRUE + ); + + $form['availability_calendars']['display'] = array( '#type' => 'fieldset', '#title' => t('View settings'), '#description' => t('Check where you want availability calendars to be displayed. If you choose none of the suggested places below you will need to output it manually using %func function.', array('%func' => 'theme_availability_calendars_node()')) ); - $form['display']['availability_calendars_display_nodeview'] = array( + $form['availability_calendars']['display']['availability_calendars_display_nodeview'] = array( '#type' => 'checkbox', '#title' => t('Node view page'), '#default_value' => variable_get('availability_calendars_display_nodeview', TRUE) ); - $form['display']['availability_calendars_display_monthcount'] = array( + $form['availability_calendars']['display']['availability_calendars_display_monthcount'] = array( '#type' => 'textfield', '#title' => t('Number of months to display'), '#default_value' => variable_get('availability_calendars_display_monthcount', 12), '#description' => t("Your calendars will show this number of months to all users except those with the 'edit own availability calendars' or 'edit availability calendars' who will always see 3 extra months on the calendars they can edit. This is to allow them to enter information into future calendars before it is made publicly available.") ); - //TODO: add status codes and css classes in here + // labels from the database, if this is the first load, otherwise, use the form input + $labels = array(); + $names = array(); // for sorting later + $db_labels = availability_calendars_custom_options(); + if (!$form_state['storage']){ + foreach ($db_labels as $id => $label){ + $labels[] = array('id' => $id, 'label' => $label, 'title' => $label); + $names[$label] = count($labels) - 1; + } + } else { + $new_id = -1; + foreach ($form_state['storage']['availability_calendars']['display_labels'] as $k => $v){ + if ($k == 'add_label') + continue; + + $new = ((int) $k < 1); + $label = NULL; + if (!$v) { // user has emptied this field to indicate removal + if (!$new) { // skip newly added ones that never made it to the database + $label = array('id' => $k, 'label' => $v, 'delete' => TRUE, 'title' => '[deleted] ' . $db_labels[$k]); + } + } else { + $id = ($new)? $new_id-- : $k; + $label = array('id' => $id, 'label' => $v, 'new' => $new, 'title' => (($new)? '[new] ' : '') . $v); + } + + if ($label){ + $labels[] = $label; + $names[$v] = count($labels) - 1; + } + } + } + + $a = array_keys($names); + $sorted_labels = array(); + sort($a); + + foreach ($a as $name){ + $sorted_labels[] = $labels[$names[$name]]; + } + + $form['availability_calendars']['display_labels'] = array( + '#type' => 'fieldset', + '#title' => t('Custom Availability Key'), + '#collapsible' => TRUE, + '#description' => t("You can create custom availability labels here. Add a new item and enter it's label. A CSS class will automatically be generated from this label. If you define no labels, the default set will be used. If you define at least one label, the default set will be ignored, and you must re-define any labels you wish to use from the default set.") + ); + + foreach ($sorted_labels as $label){ + $form['availability_calendars']['display_labels'][$label['id']] = availability_calendars_label_form_field($label); + } + // one for new labels + $form['availability_calendars']['display_labels']['new'] = availability_calendars_label_form_field(array( + 'id' => 'new', + 'name' => '' + )); + + $form['availability_calendars']['display_labels']['add_label'] = array( + '#type' => 'button', + '#value' => t('Add new label'), + '#ahah' => array( + 'path' => ahah_helper_path(array('availability_calendars')), + 'wrapper' => 'availability-calendars-wrapper' + ) + ); + + if ($sorted_labels){ + $options = array(); + foreach ($sorted_labels as $label){ + $options[$label['id']] = $label['label']; + } + + $form['availability_calendars']['default_label'] = array( + '#type' => 'fieldset', + '#title' => 'Default Option', + 'default_label' => array( + '#type' => 'select', + '#options' => $options, + '#default_value' => variable_get('availability_calendars_default_option', '') + ) + ); + } + + //TODO: add css classes in here + + $form['save'] = array( + '#type' => 'submit', + '#value' => t('Save'), + ); + + return $form; +} + +function availability_calendars_admin_submit($form_id, &$form) { + if ($form['clicked_button']['#id'] != 'edit-save') + return; - return system_settings_form($form); + $values = $form['values']['availability_calendars']; + $nkey = 'availability_calendars_display_nodeview'; + $mkey = 'availability_calendars_display_monthcount'; + $dkey = 'availability_calendars_default_option'; + variable_set($nkey, $values['display'][$nkey]); + variable_set($mkey, $values['display'][$mkey]); + variable_set($dkey, $values['default_label']['default_label']); + + $delete_ids = array(); + $new_labels = array(); + $labels = array(); + $existing = availability_calendars_custom_options('label'); + + foreach ($values['display_labels'] as $id => $label){ + if ($id == 'add_label') + continue; + + $new = ((int) $id < 1); + + if (!$label) { // user has emptied this field to indicate removal + if ((int) $id) + $delete_ids[] = $id; + } else { + if ($new && !in_array($label, $existing)) + $new_labels[] = $label; + else + $labels[] = array('lid' => $id, 'label' => $label); + } + } + + if ($delete_ids) + db_query("DELETE FROM {availability_calendars_labels} WHERE lid IN(" . join(',', $delete_ids) . ")"); + + foreach ($new_labels as $label) { + db_query("INSERT INTO {availability_calendars_labels} (label) VALUES ('%s')", $label); + } + foreach ($labels as $label) { + db_query("UPDATE {availability_calendars_labels} SET label = '%s' WHERE lid = %d", $label['label'], $label['lid']); + } +} + +/** + * Get a field definition for a calendar key label. + * + * @param $label + * An array containing label info, as: array('id' => $id, 'name' => $name, ['delete' => TRUE], ['new' => TRUE | FALSE]) + * + * @return + * An array with a Form field definition + */ +function availability_calendars_label_form_field($label) { + $class = ''; + if (isset($label['delete']) && $label['delete'] == TRUE) { + $class = 'delete-label'; + } + if (isset($label['new']) && $label['new'] == TRUE) { + $class = 'new-label'; + } + + $field = array( + '#type' => 'textfield', + '#title' => $label['title'], + '#default_value' => $label['label'], + '#description' => t("You may change the name of this label, or delete it. To delete this label, clear this field, and then save. The CSS class for this label is: '%css'", array('%css' => availability_calendars_option_css($label['label']))), + '#attributes' => array('class' => $class) + ); + + return $field; } /** @@ -137,16 +310,10 @@ function availability_calendars_page($ni } } -/** - * Callback function to produce the node edit form. - */ function availability_calendars_node_edit() { return drupal_get_form('availability_calendars_node_edit_form'); } -/** - * Creates the node edit form. - */ function availability_calendars_node_edit_form() { $nid = check_plain(arg(1)); $year = check_plain(arg(2)); @@ -183,13 +350,13 @@ function availability_calendars_node_edi for ($week = 1; $week <= $month_meta['weeksinmonth']; $week++) { $form['week-'. $week] = array( '#type' => 'fieldset', - '#title' => t('Week @week', array('@week' => $week)), + '#title' => 'Week '. $week, ); $form['week-'. $week]['note-'. $week] = array( '#type' => 'textfield', - '#title' => t('Note'), + '#title' => 'Note', '#default_value' => $notes[$week], - '#description' => t('This will be displayed beside the week in the calendar. It could include, for example, a weekly price.'), + '#description' => 'This will be displayed beside the week in the calendar. It could include, for example, a weekly price.', ); if ($week == 1) { $daysinweekremaining = 7 - $month_meta['firstday']; @@ -197,12 +364,23 @@ function availability_calendars_node_edi else { $daysinweekremaining = 7; } + + $options = array('-1' => 'select availability'); + $db_options = availability_calendars_options(); + foreach ($db_options as $id => $label) + $options[$id] = $label; + + $day_state = $day_status[$day]; + if (!$day_state) + $day_state = variable_get('availability_calendars_default_option', 0); + error_log($day_state); + while ($daysinweekremaining > 0 && $day <= $month_meta['daysinmonth']) { $form['week-'. $week]['day-'. $day] = array( '#type' => 'select', '#title' => date('l d F', strtotime("$year-$month-$day")), - '#options' => availability_calendars_options(), - '#default_value' => $day_status[$day] + '#options' => $options, + '#default_value' => $day_state ); $day++; $daysinweekremaining--; @@ -217,9 +395,6 @@ function availability_calendars_node_edi return $form; } -/** - * Callback function for submitting a node edit form. - */ function availability_calendars_node_edit_form_submit($form, &$form_state) { $nid = check_plain($form_state['values']['nid']); $year = check_plain($form_state['values']['year']); @@ -241,6 +416,7 @@ function availability_calendars_node_edi // save $days $day = 1; $nomoredays = FALSE; + $days = array(); while (!$nomoredays) { if (isset($form_state['values']['day-'. $day])) { $days[$day] = $form_state['values']['day-'. $day]; @@ -261,7 +437,7 @@ function availability_calendars_node_edi db_query('INSERT INTO {availability_calendars_day} (nid, year, month, day, status) VALUES (%d, %d, %d, %d, %d)', $nid, $year, $month, $day, $status); } - drupal_set_message(t('Availability information saved.')); + drupal_set_message('Availability information saved.'); } /** @@ -271,11 +447,11 @@ function availability_calendars_theme() return array('availability_calendars_node' => array( 'arguments' => array('node' => NULL, 'year' => 2008, 'month' => 01, 'monthstodisplay' => 12) - ), - 'availability_calendars_month' => array( + ), + 'availability_calendars_month' => array( 'arguments' => array('node' => NULL, 'year' => 2008, 'month' => 01, 'startofweek' => NULL, 'booked' => NULL, 'firstletter' => NULL) - ) - ); + ) + ); } @@ -287,8 +463,18 @@ function availability_calendars_theme() */ function theme_availability_calendars_node($node, $year = 2008, $month = 01, $monthstodisplay = 12) { + drupal_add_css(drupal_get_path('module', 'availability_calendars') .'/availability_calendars.css'); $rows = array(); + // Fill availability array + /* foreach ($node->availability_dates as $k => $v) { + foreach ($v as $i) { + $booked[date("Y", $i['date'])][date("m", $i['date'])][date("d", $i['date'])] = 1; + } + } */ + + + // Calendar code based on example at http://evolt.org/node/60673 : $day = 1; @@ -297,8 +483,26 @@ function theme_availability_calendars_no $firstletter = variable_get('availability_calendars_'. $node->nid .'_firstletter', 0); // Create our key for the availability calendar if the node has it set to do so - if($showkey == 1) { - $output .= availability_calendars_key(); + if($showkey == 1) { //use all the same classes for cells and table, so it styles the same as the calendars + $keytitle = '
'.t('Key').'
'; + $headers = array( + t('Color'), + t('Availability') + ); + + $rows = array(); + $options = availability_calendars_options(); + + foreach ($options as $id => $label){ + $css = availability_calendars_option_css($label); + $rows[] = array( + array('data' => ' ', 'class' => $css), + array('data' => t($label), 'class' => 'keystatus') + ); + } + + $key = theme_table($headers, $rows, array('class' => 'cal')); + $output .= '
'.$keytitle.$key.'
'; } $monthsremaining = $monthstodisplay; @@ -317,43 +521,19 @@ function theme_availability_calendars_no $monthsremaining = 3; while ($monthsremaining > 0) { $output .= theme('availability_calendars_month', $node, $year, $month, $startofweek, $booked, $firstletter); - $monthsremaining--; + $monthsremaining--; $month++; if ($month > 12) { $month = 1; - $year++; + $year++; } - } + } } return $output; -} -/** - * Creates a key for our calendars. - **/ -function availability_calendars_key() { - //use all the same classes for cells and table, so it styles the same as the calendars - $keytitle = '
'.t('Key').'
'; - $headers = array( - t('Color'), - t('Availability') - ); - $rows = array( // keystatus class used to allow better styling of the status column - array(array('data' => ' ', 'class' => 'calavailable'), - array('data' => t('Available'), 'class' => 'keystatus')), - array(array('data' => ' ', 'class' => 'calnotavailable'), - array('data' => t('Fully booked'), 'class' => 'keystatus')), - array(array('data' => ' ', 'class' => 'calnotavailableprov'), - array('data' => t('Provisionally booked'), 'class' => 'keystatus')) - ); - $key = theme_table($headers, $rows, array('class' => 'cal')); - return '
'.$keytitle.$key.'
'; } -/** - * month_meta(). - */ function availability_calendars_month_meta($year, $month, $startofweek) { $month_meta['daysinmonth'] = date("t", mktime(0, 0, 0, $month, 1, $year)); $month_meta['firstday'] = date("w", mktime(0, 0, 0, $month, 1, $year)) + $startofweek; @@ -361,24 +541,20 @@ function availability_calendars_month_me $month_meta['weeksinmonth'] = ceil($tempDays / 7); // Stop empty weeks occuring at start of month - if ($month_meta['firstday'] > 6) { - $month_meta['firstday'] = $month_meta['firstday'] - 7; - $month_meta['weeksinmonth'] --; + if ($month_meta['firstday'] > 6) { + $month_meta['firstday'] = $month_meta['firstday'] - 7; + $month_meta['weeksinmonth'] --; } return $month_meta; } -/** - * Implementation of hook_theme(). - * produces our calendars on the viewing of an availability_calendars enabled node. - */ function theme_availability_calendars_month($node, $year, $month, $startofweek, $booked, $firstletter) { $month_meta = availability_calendars_month_meta($year, $month, $startofweek); /* here we list all the days of the week, an array of 14 (two full weeks) so that if users select monday as the first day we still get a full week in our following loop */ $days = array( 13 => t('Mon'), - 12 => t('Tue'), + 12 =>t('Tue'), 11 => t('Wed'), 10 => t('Thu'), 9 => t('Fri'), @@ -392,19 +568,22 @@ function theme_availability_calendars_mo 1 => t('Sat'), 0 => t('Sun'), ); + + $states = availability_calendars_custom_options(); + for ($j=0;$j<$month_meta['weeksinmonth'];$j++) { for ($i=0;$i<7;$i++) { $counter++; $week[$j][$i] = $counter; // offset the days $week[$j][$i] -= $month_meta['firstday']; - if (($week[$j][$i] < 1) || ($week[$j][$i] > $month_meta['daysinmonth'])) { + if (($week[$j][$i] < 1) || ($week[$j][$i] > $month_meta['daysinmonth'])) { $week[$j][$i] = ""; } } } if (user_access('edit availability calendars')) { //month_title has the edit link if permissable - $month_title = t("@date", array('@date' => format_date(mktime(12, 0, 0, $month, 1, $year), 'custom', 'F Y'))).' '.l(t('edit'), 'availability-calendars/'. $node->nid .'/'. date('Y/m', mktime(0, 0, 0, $month, 1, $year)) .'/edit', array('query' => 'destination=node/'. $node->nid)); + $month_title = t("@date", array('@date' => format_date(mktime(12, 0, 0, $month, 1, $year), 'custom', 'F Y'))).' '.l('edit', 'availability-calendars/'. $node->nid .'/'. date('Y/m', mktime(0, 0, 0, $month, 1, $year)) .'/edit', array('query' => 'destination=node/'. $node->nid)); } else { // no edit link $month_title = t("@date", array('@date' => format_date(mktime(12, 0, 0, $month, 1, $year), 'custom', 'F Y'))); @@ -436,15 +615,12 @@ function theme_availability_calendars_mo for ($i=0; $i<7; $i++) { // if there's a date, it's part of this month if ($week[$key][$i]) { - if ($day_status[$week[$key][$i]] == 1) { // booked - array_push($cells, array('data' => $week[$key][$i], 'class' => 'calnotavailable')); - } - elseif ($day_status[$week[$key][$i]] == 2) { // provisionally booked - array_push($cells, array('data' => $week[$key][$i], 'class' => 'calnotavailableprov')); - } - else { // available - array_push($cells, array('data' => $week[$key][$i], 'class' => 'calavailable')); - } + $day_state = $day_status[$week[$key][$i]]; + if (!$day_state) + $day_state = variable_get('availability_calendars_default_option', 0); + + $class = availability_calendars_option_css($states[$day_state]); + array_push($cells, array('data' => $week[$key][$i], 'class' => $class)); } else { // empty, typically row 1 or 5 in a month array_push($cells, array('data' => $number, 'class' => 'calother')); @@ -463,20 +639,74 @@ function theme_availability_calendars_mo } /** - * availability_calendars status options. + * Get labels for calendars. If none have been defined by the administrator, return the default set. + * + * @return + * An array of labels, in the form array(label_id => t('label name')) */ function availability_calendars_options() { - // TODO: make these configurable - return array( - 0 => t('Available'), - 1 => t('Fully booked'), - 2 => t('Provisionally booked') - ); + $labels = availability_calendars_custom_options(); + + if (!$labels) { + $labels = array( + 0 => t('Available'), + 1 => t('Fully booked'), + 2 => t('Provisionally booked') + ); + } + + return $labels; } /** - * Implementation of hook_form_alter(). - * All form alterations needed for the calendars. + * Get custom labels for calendars, or an empty array if none have been set. + * + * @param $field + * Optionally, the field you'd like to retrieve + * + * @return + * An array of labels, in the form array(label_id => t('label name')) + * If $field is set to 'label' or 'lid', returns an array of those field values + */ +function availability_calendars_custom_options($field = 'all') { + $result = db_query("SELECT * FROM availability_calendars_labels ORDER BY label"); + + $labels = array(); + $row = NULL; + while ($row = db_fetch_array($result)) { + if ($field != 'all'){ + $labels[] = ($field == 'label')? t($row['label']) : $row[$field]; + } else { + $labels[$row['lid']] = t($row['label']); + } + } + + return $labels; +} + +/** + * Get the CSS class for this option label + * + * @param $label + * The label for this option + * + * @return + * A string representing a CSS class. For backwards compatibility, default values get their historical css class + */ +function availability_calendars_option_css($label) { + if ($label == 'Available') + return 'calavailable'; + if ($label == 'Fully booked') + return 'calnotavailable'; + if ($lable == 'Provisionally booked') + return 'calnotavailableprov'; + + return str_replace(" ", "-", strtolower($label)); +} + + +/** + * Implementation of hook_form_alter(); */ function availability_calendars_form_alter(&$form, &$form_state, $form_id) { global $user; @@ -490,12 +720,15 @@ function availability_calendars_form_alt '#collapsed' => !variable_get('availability_calendars_'. $form['#node_type']->type, 0), ); $form['availability_calendars']['availability_calendars'] = array( - '#type' => 'checkbox', + '#type' => 'radios', '#title' => t('Availability calendar support'), '#default_value' => variable_get('availability_calendars_'. $form['#node_type']->type, 0), + '#options' => array( + 0 => t('Disabled'), + 1 => t('Enabled') + ), '#description' => t('Enable or disable availability support for this content type. If enabled, node owner will be able to specify node availability.'), ); - // TODO: add options for status' here } // Alter node edit form if availability support is enabled for that content type @@ -590,42 +823,3 @@ function availability_calendars_save(&$n function availability_calendars_enabled($node_type) { return variable_get('availability_calendars_'. $node_type, 0); } - -/** - * All block functions - */ - -/** - * Implementation of hook_block(). - * - * Generates block for the legend to be shown in when on availability calendar nodes - */ -function availability_calendars_block($op = 'list', $delta = 0, $edit = array()) { - // The $op parameter determines what piece of information is being requested. - switch ($op) { - case 'list': - $blocks['key']['info'] = t('Availability Calendar Key'); - return $blocks; - case 'configure': - break; - case 'save': - break; - case 'view': - switch ($delta) { - case 'key': - $block = availability_calendars_block_key(); - break; - } - return $block; - } -} - -/** - * Produce the actual availabilty_calendars key for the block. - */ -function availability_calendars_block_key() { - $block = array(); - $block['subject'] = variable_get('availability_calendars_title', t('Availability Key')); - $block['content'] = availability_calendars_key(); - return($block); -} \ No newline at end of file Only in sites/all/modules/availability_calendars.orig/: translations