? includes/.common.inc.swp
? includes/fields.inc
? modules/calendar.module
? modules/committee.module
? modules/executive.module
? modules/member.module
? modules/organiser.module
? modules/payment.module
? modules/pes.module
? modules/quote.module
? modules/registration.module
? scripts/excludefiles
? scripts/maketags.sh
? sites/uwc.synerger.com
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.512
diff -u -p -r1.512 common.inc
--- includes/common.inc 29 Jan 2006 07:36:29 -0000 1.512
+++ includes/common.inc 2 Feb 2006 06:08:09 -0000
@@ -844,10 +844,10 @@ function format_date($timestamp, $type =
for ($i = 0; $i < $max; $i++) {
$c = $format[$i];
if (strpos('AaDFlM', $c) !== false) {
- $date .= t(gmdate($c, $timestamp));
+ $date .= t(date($c, $timestamp));
}
else if (strpos('BdgGhHiIjLmnsStTUwWYyz', $c) !== false) {
- $date .= gmdate($c, $timestamp);
+ $date .= date($c, $timestamp);
}
else if ($c == 'r') {
$date .= format_date($timestamp - $timezone, 'custom', 'D, d M Y H:i:s O', $timezone);
Index: includes/form.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/form.inc,v
retrieving revision 1.61
diff -u -p -r1.61 form.inc
--- includes/form.inc 27 Jan 2006 15:57:43 -0000 1.61
+++ includes/form.inc 2 Feb 2006 06:08:11 -0000
@@ -482,7 +482,9 @@ function form_options_flatten($array, $r
function theme_select($element) {
$select = '';
$size = $element['#size'] ? ' size="' . $element['#size'] . '"' : '';
- return theme('form_element', $element['#title'], '', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
+ $class = _form_get_class('form-select', $element['#required'], form_get_error($element));
+
+ return theme('form_element', $element['#title'], '', $element['#description'], $element['#id'], $element['#required'], form_get_error($element));
}
function form_select_options($element, $choices = NULL) {
@@ -630,13 +632,20 @@ function theme_date($element) {
* Roll out a single date element.
*/
function expand_date($element) {
- // Default to current date
- if (!isset($element['#value'])) {
- $element['#value'] = array('day' => format_date(time(), 'custom', 'j'),
- 'month' => format_date(time(), 'custom', 'n'),
- 'year' => format_date(time(), 'custom', 'Y'));
+ // Default to current date or if the value is a timestamp set value accordingly
+ if (!is_array($element['#value'])) {
+ $t = (isset($element['#value']) && is_numeric($element['#value'])
+ ? $element['#value'] : time());
+
+ // can't use a non-zero timezone here because date fields don't store time
+ // data to correctly deal with timezones. as a result the date fields will
+ // creep backwards by one day each time form is submitted when the timezone
+ // is positive (i.e east of UTC)
+ $element['#value'] = array('day' => format_date($t, 'custom', 'j', 0),
+ 'month' => format_date($t, 'custom', 'n', 0),
+ 'year' => format_date($t, 'custom', 'Y', 0));
}
-
+
$element['#tree'] = TRUE;
// Determine the order of day, month, year in the site's chosen date format.
@@ -648,6 +657,7 @@ function expand_date($element) {
asort($sort);
$order = array_keys($sort);
+ $error = form_get_error($element);
// Output multi-selector for date
foreach ($order as $type) {
switch ($type) {
@@ -674,6 +684,30 @@ function expand_date($element) {
return $element;
}
+function validate_date($elements, $args)
+{
+ global $form_values;
+
+ $fld = $elements['#parents'][0];
+ $f =& $elements['#value'];
+
+ if (!is_array($f) || !checkdate($f['month'], $f['day'], $f['year']))
+ form_set_error($fld, 'Invalid date');
+}
+
+function shrink_date($elements)
+{
+ global $form_values, $user;
+
+ $fld = $elements['#parents'][0];
+
+ $f =& $form_values[$fld];
+ $val = strtotime("{$f['year']}-{$f['month']}-{$f['day']}");
+ $form_values[$fld] = $val;
+
+ return $elements;
+}
+
/**
* Helper function for usage with drupal_map_assoc to display month names.
*/
Index: modules/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system.module,v
retrieving revision 1.286
diff -u -p -r1.286 system.module
--- modules/system.module 1 Feb 2006 15:34:55 -0000 1.286
+++ modules/system.module 2 Feb 2006 06:08:48 -0000
@@ -76,7 +76,7 @@ function system_elements() {
$type['checkboxes'] = array('#input' => TRUE, '#process' => array('expand_checkboxes' => array()), '#tree' => TRUE);
$type['select'] = array('#input' => TRUE);
$type['weight'] = array('#input' => TRUE, '#delta' => 10, '#default_value' => 0);
- $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array()));
+ $type['date'] = array('#input' => TRUE, '#process' => array('expand_date' => array()), '#after_build' => 'shrink_date', '#validate' => array('validate_date' => ''));
$type['file'] = array('#input' => TRUE, '#size' => 60);
// Form structure