Index: ldapdata.theme.inc =================================================================== --- ldapdata.theme.inc (revision 6) +++ ldapdata.theme.inc (working copy) @@ -47,6 +47,9 @@ $ret = strpos($value, '://') ? $value : "http://$value"; $ret = "$ret"; break; + case 'date': + $ret = format_date(strtotime($value), 'medium'); + break; case 'txt': default: $ret = $value; Index: ldapdata.module =================================================================== --- ldapdata.module (revision 6) +++ ldapdata.module (working copy) @@ -416,6 +416,10 @@ foreach ($edit as $edit_attr => $edit_val) { // Preventing a POST data injection: we check allowance to write value. if (array_search($edit_attr, $editables) !== FALSE) { + if ( is_array($edit_val) && array_key_exists('day',$edit_val) && array_key_exists('month',$edit_val) && array_key_exists('year',$edit_val) ) { + # date field support, LDAP GeneralizedTime format (YYYYMMDD, 19920125 = 25 Jan 1992) + $edit_val = sprintf('%04d%02d%02d',$edit_val['year'],$edit_val['month'],$edit_val['day']); + } $writeout[$edit_attr] = $edit_val; $edit[$edit_attr] = NULL; } @@ -534,6 +538,16 @@ '#description' => array_shift($info), ); break; + case 'date': + $value = array( 'year'=>(int)substr($value,0,4), 'month'=>(int)substr($value,4,2), 'day'=>(int)substr($value,6,2) ); + $form = array( + '#type' => 'date', + '#title' => array_shift($info), + '#default_value' => $value, + '#description' => array_shift($info), + '#required' => array_shift($info), + ); + break; } return $form; }