summaryrefslogtreecommitdiff
path: root/roundcubemail/program/steps
diff options
context:
space:
mode:
authorthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-05 09:36:16 +0000
committerthomasb <thomasb@208e9e7b-5314-0410-a742-e7e81cd9613c>2011-10-05 09:36:16 +0000
commitdf198feaa4b97a87a87eaa1e41b77686af62e88f (patch)
tree4934ead98f36dda9121f3776fcf7328c6e45692e /roundcubemail/program/steps
parentfd8fee161edd62de88e5e101e2cc35f44b8c30ac (diff)
Attach jquery UI date pickers to contact fields of type 'date'
git-svn-id: https://svn.roundcube.net/trunk@5308 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
-rw-r--r--roundcubemail/program/steps/addressbook/func.inc14
1 files changed, 14 insertions, 0 deletions
diff --git a/roundcubemail/program/steps/addressbook/func.inc b/roundcubemail/program/steps/addressbook/func.inc
index dd8856a90..fc559e6ae 100644
--- a/roundcubemail/program/steps/addressbook/func.inc
+++ b/roundcubemail/program/steps/addressbook/func.inc
@@ -422,6 +422,7 @@ function rcmail_get_type_label($type)
function rcmail_contact_form($form, $record, $attrib = null)
{
global $RCMAIL, $CONFIG;
+ static $jqueryui_loaded = 0;
// Allow plugins to modify contact form content
$plugin = $RCMAIL->plugins->exec_hook('contact_form', array(
@@ -608,6 +609,19 @@ function rcmail_contact_form($form, $record, $attrib = null)
if ($colprop['subtypes'] || $colprop['limit'] != 1)
$colprop['array'] = true;
+ // load jquery UI datepickert for date fields
+ if ($colprop['type'] == 'date') {
+ if (!$jqueryui_loaded++) {
+ $RCMAIL->plugins->load_plugin('jqueryui');
+ $RCMAIL->output->set_env('date_format', strtr($RCMAIL->config->get('date_format', 'Y-m-d'), array('y'=>'y', 'Y'=>'yy', 'm'=>'mm', 'n'=>'m', 'd'=>'dd', 'j'=>'d')));
+ foreach (array('jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec') as $month)
+ $month_names[] = rcube_label($month);
+ $RCMAIL->output->set_env('month_names', $month_names);
+ }
+ $colprop['class'] .= ($colprop['class'] ? ' ' : '') . 'datepicker';
+ $val = format_date($val, $RCMAIL->config->get('date_format', 'Y-m-d'));
+ }
+
$val = rcmail_get_edit_field($col, $val, $colprop, $colprop['type']);
$coltypes[$field]['count']++;
}