Version Description
- Bug Fix: Stopped Field Options from loosing data
- Bug Fix: API will now work with looped posts
Download this release
Release Info
Developer | elliotcondon |
Plugin | Advanced Custom Fields |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.0.2
- acf.php +7 -2
- core/acf_post_type.php +4 -3
- core/admin_head.php +21 -13
- core/api.php +63 -22
- core/fields/date_picker/date_picker.php +59 -0
- core/fields/date_picker/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- core/fields/date_picker/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- core/fields/date_picker/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- core/fields/date_picker/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- core/fields/date_picker/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- core/fields/date_picker/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- core/fields/date_picker/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- core/fields/date_picker/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- core/fields/date_picker/images/ui-icons_217bc0_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_2e83ff_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_469bdd_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_6da8d5_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_cd0a0a_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_d8e7f3_256x240.png +0 -0
- core/fields/date_picker/images/ui-icons_f9bd01_256x240.png +0 -0
- core/fields/date_picker/jquery.ui.datepicker.js +1773 -0
- core/fields/date_picker/style.date_picker.css +362 -0
- core/fields/file.php +50 -0
- core/input_meta_box.php +58 -4
- css/style.input.css +53 -1
- js/functions.fields.js +5 -28
- js/functions.input.js +73 -1
- readme.txt +15 -3
acf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
|
6 |
-
Version: 1.0.
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
@@ -36,7 +36,7 @@ class Acf
|
|
36 |
$this->dir = plugins_url('',__FILE__);
|
37 |
$this->siteurl = get_bloginfo('url');
|
38 |
$this->wpadminurl = admin_url();
|
39 |
-
$this->version = '1.0.
|
40 |
|
41 |
// set text domain
|
42 |
load_plugin_textdomain('acf', false, $this->path.'/lang' );
|
@@ -201,17 +201,21 @@ class Acf
|
|
201 |
include('core/fields/textarea.php');
|
202 |
include('core/fields/wysiwyg.php');
|
203 |
include('core/fields/image.php');
|
|
|
204 |
include('core/fields/select.php');
|
205 |
include('core/fields/checkbox.php');
|
206 |
include('core/fields/page_link.php');
|
|
|
207 |
|
208 |
$array['text'] = new Text();
|
209 |
$array['textarea'] = new Textarea();
|
210 |
$array['wysiwyg'] = new Wysiwyg();
|
211 |
$array['image'] = new Image($this->dir);
|
|
|
212 |
$array['select'] = new Select();
|
213 |
$array['checkbox'] = new Checkbox();
|
214 |
$array['page_link'] = new Page_link();
|
|
|
215 |
|
216 |
return $array;
|
217 |
}
|
@@ -506,6 +510,7 @@ class Acf
|
|
506 |
{
|
507 |
if($_GET['post_type'] != 'acf'){return false;}
|
508 |
|
|
|
509 |
echo '<link rel="stylesheet" href="'.$this->dir.'/css/style.info.css" type="text/css" media="all" />';
|
510 |
echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.info.js"></script>';
|
511 |
include('core/info_meta_box.php');
|
3 |
Plugin Name: Advanced Custom Fields
|
4 |
Plugin URI: http://plugins.elliotcondon.com/advanced-custom-fields/
|
5 |
Description: Completely Customise your edit pages with an assortment of field types: Wysiwyg, text, image, select, checkbox and more! Hide unwanted metaboxes and assign to any edit page!
|
6 |
+
Version: 1.0.2
|
7 |
Author: Elliot Condon
|
8 |
Author URI: http://www.elliotcondon.com/
|
9 |
License: GPL
|
36 |
$this->dir = plugins_url('',__FILE__);
|
37 |
$this->siteurl = get_bloginfo('url');
|
38 |
$this->wpadminurl = admin_url();
|
39 |
+
$this->version = '1.0.2';
|
40 |
|
41 |
// set text domain
|
42 |
load_plugin_textdomain('acf', false, $this->path.'/lang' );
|
201 |
include('core/fields/textarea.php');
|
202 |
include('core/fields/wysiwyg.php');
|
203 |
include('core/fields/image.php');
|
204 |
+
include('core/fields/file.php');
|
205 |
include('core/fields/select.php');
|
206 |
include('core/fields/checkbox.php');
|
207 |
include('core/fields/page_link.php');
|
208 |
+
include('core/fields/date_picker/date_picker.php');
|
209 |
|
210 |
$array['text'] = new Text();
|
211 |
$array['textarea'] = new Textarea();
|
212 |
$array['wysiwyg'] = new Wysiwyg();
|
213 |
$array['image'] = new Image($this->dir);
|
214 |
+
$array['file'] = new File($this->dir);
|
215 |
$array['select'] = new Select();
|
216 |
$array['checkbox'] = new Checkbox();
|
217 |
$array['page_link'] = new Page_link();
|
218 |
+
$array['date_picker'] = new Date_picker($this->dir);
|
219 |
|
220 |
return $array;
|
221 |
}
|
510 |
{
|
511 |
if($_GET['post_type'] != 'acf'){return false;}
|
512 |
|
513 |
+
echo "<style type='text/css'>.row-actions span.inline, .row-actions span.view { display: none; }</style>";
|
514 |
echo '<link rel="stylesheet" href="'.$this->dir.'/css/style.info.css" type="text/css" media="all" />';
|
515 |
echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.info.js"></script>';
|
516 |
include('core/info_meta_box.php');
|
core/acf_post_type.php
CHANGED
@@ -16,7 +16,8 @@ $labels = array(
|
|
16 |
$supports = array(
|
17 |
'title',
|
18 |
'revisions',
|
19 |
-
'custom-fields'
|
|
|
20 |
);
|
21 |
|
22 |
register_post_type('acf', array(
|
@@ -24,8 +25,8 @@ register_post_type('acf', array(
|
|
24 |
'public' => false,
|
25 |
'show_ui' => true,
|
26 |
'_builtin' => false,
|
27 |
-
'capability_type' => '
|
28 |
-
'hierarchical' =>
|
29 |
'rewrite' => array("slug" => "acf"),
|
30 |
'query_var' => "acf",
|
31 |
'supports' => $supports,
|
16 |
$supports = array(
|
17 |
'title',
|
18 |
'revisions',
|
19 |
+
'custom-fields',
|
20 |
+
'page-attributes'
|
21 |
);
|
22 |
|
23 |
register_post_type('acf', array(
|
25 |
'public' => false,
|
26 |
'show_ui' => true,
|
27 |
'_builtin' => false,
|
28 |
+
'capability_type' => 'page',
|
29 |
+
'hierarchical' => true,
|
30 |
'rewrite' => array("slug" => "acf"),
|
31 |
'query_var' => "acf",
|
32 |
'supports' => $supports,
|
core/admin_head.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
global $post;
|
4 |
|
5 |
// shows hidden custom fields
|
6 |
-
echo "<style type='text/css'>#postcustom .hidden { display: table-row; }</style
|
7 |
|
8 |
// add metabox, style and javascript to acf page
|
9 |
//if($_GET['post_type'] == 'acf')
|
@@ -37,11 +37,15 @@ elseif(get_post_type($post) == 'acf')
|
|
37 |
else
|
38 |
{
|
39 |
// any other edit page
|
40 |
-
$acfs =
|
41 |
'numberposts' => -1,
|
42 |
-
'post_type' => 'acf'
|
|
|
43 |
));
|
44 |
|
|
|
|
|
|
|
45 |
if($acfs)
|
46 |
{
|
47 |
foreach($acfs as $acf)
|
@@ -90,19 +94,23 @@ else
|
|
90 |
|
91 |
if($add_box == true)
|
92 |
{
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.input.js" ></script>';
|
97 |
-
|
98 |
-
add_meta_box('acf_input', get_the_title($acf->ID), array($this, '_input_meta_box'), get_post_type($post), 'normal', 'high', array('acf' => $acf));
|
99 |
-
|
100 |
-
// only add 1 metabox
|
101 |
-
break;
|
102 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
103 |
}
|
104 |
|
105 |
-
}
|
106 |
}
|
107 |
|
108 |
?>
|
3 |
global $post;
|
4 |
|
5 |
// shows hidden custom fields
|
6 |
+
//echo "<style type='text/css'>#postcustom .hidden { display: table-row; }</style>";
|
7 |
|
8 |
// add metabox, style and javascript to acf page
|
9 |
//if($_GET['post_type'] == 'acf')
|
37 |
else
|
38 |
{
|
39 |
// any other edit page
|
40 |
+
$acfs = get_pages(array(
|
41 |
'numberposts' => -1,
|
42 |
+
'post_type' => 'acf',
|
43 |
+
'sort_column' => 'menu_order',
|
44 |
));
|
45 |
|
46 |
+
// blank array to hold acfs
|
47 |
+
$add_acf = array();
|
48 |
+
|
49 |
if($acfs)
|
50 |
{
|
51 |
foreach($acfs as $acf)
|
94 |
|
95 |
if($add_box == true)
|
96 |
{
|
97 |
+
// add acf to array
|
98 |
+
$add_acf[] = $acf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
99 |
}
|
100 |
+
|
101 |
+
}// end foreach
|
102 |
+
|
103 |
+
if(!empty($add_acf))
|
104 |
+
{
|
105 |
+
// add these acf's to the page
|
106 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.global.css" />';
|
107 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->dir.'/css/style.input.css" />';
|
108 |
+
echo '<script type="text/javascript" src="'.$this->dir.'/js/functions.input.js" ></script>';
|
109 |
+
|
110 |
+
add_meta_box('acf_input', 'ACF Fields', array($this, '_input_meta_box'), get_post_type($post), 'normal', 'high', array('acfs' => $add_acf));
|
111 |
}
|
112 |
|
113 |
+
}// end if
|
114 |
}
|
115 |
|
116 |
?>
|
core/api.php
CHANGED
@@ -31,7 +31,7 @@ class acf_object
|
|
31 |
* @since 1.0.0
|
32 |
*
|
33 |
---------------------------------------------------------------------------------------------*/
|
34 |
-
function get_acf()
|
35 |
{
|
36 |
global $acf;
|
37 |
global $wpdb;
|
@@ -43,38 +43,79 @@ function get_acf()
|
|
43 |
}
|
44 |
|
45 |
$results = array();
|
46 |
-
$acf_id = get_post_meta($post_id, '_acf_id', true);
|
47 |
|
48 |
-
$fields =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
|
50 |
-
|
|
|
|
|
|
|
|
|
|
|
51 |
{
|
52 |
-
|
|
|
53 |
|
54 |
-
|
|
|
55 |
{
|
56 |
-
|
57 |
-
$field['value'] = get_post_meta($post_id, '_acf_'.$field['name'], true);
|
58 |
-
|
59 |
-
// if field has a format function, format the value
|
60 |
-
if($acf->fields[$field['type']]->has_format_value())
|
61 |
-
{
|
62 |
-
$field['value'] = $acf->fields[$field['type']]->format_value($field['value']);
|
63 |
-
}
|
64 |
-
|
65 |
-
// add name + value to variables array
|
66 |
-
$variables[$field['name']] = $field['value'];
|
67 |
-
|
68 |
}
|
69 |
|
70 |
-
|
|
|
71 |
|
72 |
}
|
73 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
74 |
{
|
75 |
-
|
76 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
77 |
}
|
78 |
|
79 |
|
|
|
80 |
?>
|
31 |
* @since 1.0.0
|
32 |
*
|
33 |
---------------------------------------------------------------------------------------------*/
|
34 |
+
function get_acf($post_id = false)
|
35 |
{
|
36 |
global $acf;
|
37 |
global $wpdb;
|
43 |
}
|
44 |
|
45 |
$results = array();
|
46 |
+
$acf_id = explode(',',get_post_meta($post_id, '_acf_id', true));
|
47 |
|
48 |
+
$fields = array();
|
49 |
+
|
50 |
+
// checkpoint
|
51 |
+
|
52 |
+
if(empty($acf_id)){return null;}
|
53 |
+
|
54 |
+
foreach($acf_id as $id)
|
55 |
+
{
|
56 |
+
$this_fields = $acf->get_fields($id);
|
57 |
+
if(empty($this_fields)){return null;}
|
58 |
+
foreach($this_fields as $this_field)
|
59 |
+
{
|
60 |
+
$fields[] = $this_field;
|
61 |
+
}
|
62 |
+
}
|
63 |
|
64 |
+
// checkpoint
|
65 |
+
if(empty($fields)){return null;}
|
66 |
+
|
67 |
+
$variables = array();
|
68 |
+
|
69 |
+
foreach($fields as $field)
|
70 |
{
|
71 |
+
// get value
|
72 |
+
$field['value'] = get_post_meta($post_id, '_acf_'.$field['name'], true);
|
73 |
|
74 |
+
// if field has a format function, format the value
|
75 |
+
if($acf->fields[$field['type']]->has_format_value())
|
76 |
{
|
77 |
+
$field['value'] = $acf->fields[$field['type']]->format_value($field['value']);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
}
|
79 |
|
80 |
+
// add name + value to variables array
|
81 |
+
$variables[$field['name']] = $field['value'];
|
82 |
|
83 |
}
|
84 |
+
|
85 |
+
return new acf_object($variables);
|
86 |
+
|
87 |
+
|
88 |
+
}
|
89 |
+
|
90 |
+
// get fields
|
91 |
+
function get_fields()
|
92 |
+
{
|
93 |
+
return get_acf();
|
94 |
+
}
|
95 |
+
|
96 |
+
// get field
|
97 |
+
function get_field($field_name)
|
98 |
+
{
|
99 |
+
global $acf_fields;
|
100 |
+
global $post;
|
101 |
+
|
102 |
+
if(empty($acf_fields))
|
103 |
{
|
104 |
+
$acf_fields = array();
|
105 |
+
|
106 |
+
//echo 'acf_fields is empty';
|
107 |
+
$acf_fields[$post->ID] = get_acf();
|
108 |
+
}
|
109 |
+
|
110 |
+
return $acf_fields[$post->ID]->$field_name;
|
111 |
+
}
|
112 |
+
|
113 |
+
// the field
|
114 |
+
function the_field($field_name)
|
115 |
+
{
|
116 |
+
echo get_field($field_name);
|
117 |
}
|
118 |
|
119 |
|
120 |
+
|
121 |
?>
|
core/fields/date_picker/date_picker.php
ADDED
@@ -0,0 +1,59 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class Date_picker
|
4 |
+
{
|
5 |
+
var $name;
|
6 |
+
var $title;
|
7 |
+
var $plugin_dir;
|
8 |
+
|
9 |
+
function Date_picker($plugin_dir)
|
10 |
+
{
|
11 |
+
$this->name = 'date_picker';
|
12 |
+
$this->title = 'Date Picker';
|
13 |
+
$this->plugin_dir = $plugin_dir;
|
14 |
+
}
|
15 |
+
|
16 |
+
function html($options)
|
17 |
+
{
|
18 |
+
echo '<link rel="stylesheet" type="text/css" href="'.$this->plugin_dir.'/core/fields/date_picker/style.date_picker.css" />';
|
19 |
+
echo '<script type="text/javascript" src="'.$this->plugin_dir.'/core/fields/date_picker/jquery.ui.datepicker.js" ></script>';
|
20 |
+
echo '<input type="hidden" value="'.$options['options']['date_format'].'" name="date_format" />';
|
21 |
+
echo '<input type="text" value="'.$options['value'].'" id="'.$options['id'].'" class="acf_datepicker" name="'.$options['name'].'" />';
|
22 |
+
|
23 |
+
}
|
24 |
+
|
25 |
+
function has_options()
|
26 |
+
{
|
27 |
+
return true;
|
28 |
+
}
|
29 |
+
|
30 |
+
function options($key, $options)
|
31 |
+
{
|
32 |
+
?>
|
33 |
+
<table class="acf_input">
|
34 |
+
<tr>
|
35 |
+
<td class="label">
|
36 |
+
<label for="">Date format</label>
|
37 |
+
</td>
|
38 |
+
<td>
|
39 |
+
<input type="text" name="acf[fields][<?php echo $key; ?>][options][date_format]" id="" value="<?php echo $options['date_format']; ?>" />
|
40 |
+
<p class="description">eg. dd/mm/yy. read more about <a href="http://docs.jquery.com/UI/Datepicker/formatDate">formatDate</a></p>
|
41 |
+
</td>
|
42 |
+
</tr>
|
43 |
+
</table>
|
44 |
+
<?php
|
45 |
+
}
|
46 |
+
|
47 |
+
function has_format_value()
|
48 |
+
{
|
49 |
+
return true;
|
50 |
+
}
|
51 |
+
|
52 |
+
function format_value($value)
|
53 |
+
{
|
54 |
+
|
55 |
+
}
|
56 |
+
|
57 |
+
}
|
58 |
+
|
59 |
+
?>
|
core/fields/date_picker/images/ui-bg_flat_0_aaaaaa_40x100.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_flat_55_fbec88_40x100.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_glass_75_d0e5f5_1x400.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_glass_85_dfeffc_1x400.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_glass_95_fef1ec_1x400.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_inset-hard_100_f5f8f9_1x100.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-bg_inset-hard_100_fcfdfd_1x100.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_217bc0_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_2e83ff_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_469bdd_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_6da8d5_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_cd0a0a_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_d8e7f3_256x240.png
ADDED
Binary file
|
core/fields/date_picker/images/ui-icons_f9bd01_256x240.png
ADDED
Binary file
|
core/fields/date_picker/jquery.ui.datepicker.js
ADDED
@@ -0,0 +1,1773 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI Datepicker 1.8.11
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Datepicker
|
9 |
+
*
|
10 |
+
* Depends:
|
11 |
+
* jquery.ui.core.js
|
12 |
+
*/
|
13 |
+
(function( $, undefined ) {
|
14 |
+
|
15 |
+
$.extend($.ui, { datepicker: { version: "1.8.11" } });
|
16 |
+
|
17 |
+
var PROP_NAME = 'datepicker';
|
18 |
+
var dpuuid = new Date().getTime();
|
19 |
+
|
20 |
+
/* Date picker manager.
|
21 |
+
Use the singleton instance of this class, $.datepicker, to interact with the date picker.
|
22 |
+
Settings for (groups of) date pickers are maintained in an instance object,
|
23 |
+
allowing multiple different settings on the same page. */
|
24 |
+
|
25 |
+
function Datepicker() {
|
26 |
+
this.debug = false; // Change this to true to start debugging
|
27 |
+
this._curInst = null; // The current instance in use
|
28 |
+
this._keyEvent = false; // If the last event was a key event
|
29 |
+
this._disabledInputs = []; // List of date picker inputs that have been disabled
|
30 |
+
this._datepickerShowing = false; // True if the popup picker is showing , false if not
|
31 |
+
this._inDialog = false; // True if showing within a "dialog", false if not
|
32 |
+
this._mainDivId = 'ui-datepicker-div'; // The ID of the main datepicker division
|
33 |
+
this._inlineClass = 'ui-datepicker-inline'; // The name of the inline marker class
|
34 |
+
this._appendClass = 'ui-datepicker-append'; // The name of the append marker class
|
35 |
+
this._triggerClass = 'ui-datepicker-trigger'; // The name of the trigger marker class
|
36 |
+
this._dialogClass = 'ui-datepicker-dialog'; // The name of the dialog marker class
|
37 |
+
this._disableClass = 'ui-datepicker-disabled'; // The name of the disabled covering marker class
|
38 |
+
this._unselectableClass = 'ui-datepicker-unselectable'; // The name of the unselectable cell marker class
|
39 |
+
this._currentClass = 'ui-datepicker-current-day'; // The name of the current day marker class
|
40 |
+
this._dayOverClass = 'ui-datepicker-days-cell-over'; // The name of the day hover marker class
|
41 |
+
this.regional = []; // Available regional settings, indexed by language code
|
42 |
+
this.regional[''] = { // Default regional settings
|
43 |
+
closeText: 'Done', // Display text for close link
|
44 |
+
prevText: 'Prev', // Display text for previous month link
|
45 |
+
nextText: 'Next', // Display text for next month link
|
46 |
+
currentText: 'Today', // Display text for current month link
|
47 |
+
monthNames: ['January','February','March','April','May','June',
|
48 |
+
'July','August','September','October','November','December'], // Names of months for drop-down and formatting
|
49 |
+
monthNamesShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'], // For formatting
|
50 |
+
dayNames: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], // For formatting
|
51 |
+
dayNamesShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'], // For formatting
|
52 |
+
dayNamesMin: ['Su','Mo','Tu','We','Th','Fr','Sa'], // Column headings for days starting at Sunday
|
53 |
+
weekHeader: 'Wk', // Column header for week of the year
|
54 |
+
dateFormat: 'mm/dd/yy', // See format options on parseDate
|
55 |
+
firstDay: 0, // The first day of the week, Sun = 0, Mon = 1, ...
|
56 |
+
isRTL: false, // True if right-to-left language, false if left-to-right
|
57 |
+
showMonthAfterYear: false, // True if the year select precedes month, false for month then year
|
58 |
+
yearSuffix: '' // Additional text to append to the year in the month headers
|
59 |
+
};
|
60 |
+
this._defaults = { // Global defaults for all the date picker instances
|
61 |
+
showOn: 'focus', // 'focus' for popup on focus,
|
62 |
+
// 'button' for trigger button, or 'both' for either
|
63 |
+
showAnim: 'fadeIn', // Name of jQuery animation for popup
|
64 |
+
showOptions: {}, // Options for enhanced animations
|
65 |
+
defaultDate: null, // Used when field is blank: actual date,
|
66 |
+
// +/-number for offset from today, null for today
|
67 |
+
appendText: '', // Display text following the input box, e.g. showing the format
|
68 |
+
buttonText: '...', // Text for trigger button
|
69 |
+
buttonImage: '', // URL for trigger button image
|
70 |
+
buttonImageOnly: false, // True if the image appears alone, false if it appears on a button
|
71 |
+
hideIfNoPrevNext: false, // True to hide next/previous month links
|
72 |
+
// if not applicable, false to just disable them
|
73 |
+
navigationAsDateFormat: false, // True if date formatting applied to prev/today/next links
|
74 |
+
gotoCurrent: false, // True if today link goes back to current selection instead
|
75 |
+
changeMonth: false, // True if month can be selected directly, false if only prev/next
|
76 |
+
changeYear: false, // True if year can be selected directly, false if only prev/next
|
77 |
+
yearRange: 'c-10:c+10', // Range of years to display in drop-down,
|
78 |
+
// either relative to today's year (-nn:+nn), relative to currently displayed year
|
79 |
+
// (c-nn:c+nn), absolute (nnnn:nnnn), or a combination of the above (nnnn:-n)
|
80 |
+
showOtherMonths: false, // True to show dates in other months, false to leave blank
|
81 |
+
selectOtherMonths: false, // True to allow selection of dates in other months, false for unselectable
|
82 |
+
showWeek: false, // True to show week of the year, false to not show it
|
83 |
+
calculateWeek: this.iso8601Week, // How to calculate the week of the year,
|
84 |
+
// takes a Date and returns the number of the week for it
|
85 |
+
shortYearCutoff: '+10', // Short year values < this are in the current century,
|
86 |
+
// > this are in the previous century,
|
87 |
+
// string value starting with '+' for current year + value
|
88 |
+
minDate: null, // The earliest selectable date, or null for no limit
|
89 |
+
maxDate: null, // The latest selectable date, or null for no limit
|
90 |
+
duration: 'fast', // Duration of display/closure
|
91 |
+
beforeShowDay: null, // Function that takes a date and returns an array with
|
92 |
+
// [0] = true if selectable, false if not, [1] = custom CSS class name(s) or '',
|
93 |
+
// [2] = cell title (optional), e.g. $.datepicker.noWeekends
|
94 |
+
beforeShow: null, // Function that takes an input field and
|
95 |
+
// returns a set of custom settings for the date picker
|
96 |
+
onSelect: null, // Define a callback function when a date is selected
|
97 |
+
onChangeMonthYear: null, // Define a callback function when the month or year is changed
|
98 |
+
onClose: null, // Define a callback function when the datepicker is closed
|
99 |
+
numberOfMonths: 1, // Number of months to show at a time
|
100 |
+
showCurrentAtPos: 0, // The position in multipe months at which to show the current month (starting at 0)
|
101 |
+
stepMonths: 1, // Number of months to step back/forward
|
102 |
+
stepBigMonths: 12, // Number of months to step back/forward for the big links
|
103 |
+
altField: '', // Selector for an alternate field to store selected dates into
|
104 |
+
altFormat: '', // The date format to use for the alternate field
|
105 |
+
constrainInput: true, // The input is constrained by the current date format
|
106 |
+
showButtonPanel: false, // True to show button panel, false to not show it
|
107 |
+
autoSize: false // True to size the input for the date format, false to leave as is
|
108 |
+
};
|
109 |
+
$.extend(this._defaults, this.regional['']);
|
110 |
+
this.dpDiv = $('<div id="' + this._mainDivId + '" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>');
|
111 |
+
}
|
112 |
+
|
113 |
+
$.extend(Datepicker.prototype, {
|
114 |
+
/* Class name added to elements to indicate already configured with a date picker. */
|
115 |
+
markerClassName: 'hasDatepicker',
|
116 |
+
|
117 |
+
/* Debug logging (if enabled). */
|
118 |
+
log: function () {
|
119 |
+
if (this.debug)
|
120 |
+
console.log.apply('', arguments);
|
121 |
+
},
|
122 |
+
|
123 |
+
// TODO rename to "widget" when switching to widget factory
|
124 |
+
_widgetDatepicker: function() {
|
125 |
+
return this.dpDiv;
|
126 |
+
},
|
127 |
+
|
128 |
+
/* Override the default settings for all instances of the date picker.
|
129 |
+
@param settings object - the new settings to use as defaults (anonymous object)
|
130 |
+
@return the manager object */
|
131 |
+
setDefaults: function(settings) {
|
132 |
+
extendRemove(this._defaults, settings || {});
|
133 |
+
return this;
|
134 |
+
},
|
135 |
+
|
136 |
+
/* Attach the date picker to a jQuery selection.
|
137 |
+
@param target element - the target input field or division or span
|
138 |
+
@param settings object - the new settings to use for this date picker instance (anonymous) */
|
139 |
+
_attachDatepicker: function(target, settings) {
|
140 |
+
// check for settings on the control itself - in namespace 'date:'
|
141 |
+
var inlineSettings = null;
|
142 |
+
for (var attrName in this._defaults) {
|
143 |
+
var attrValue = target.getAttribute('date:' + attrName);
|
144 |
+
if (attrValue) {
|
145 |
+
inlineSettings = inlineSettings || {};
|
146 |
+
try {
|
147 |
+
inlineSettings[attrName] = eval(attrValue);
|
148 |
+
} catch (err) {
|
149 |
+
inlineSettings[attrName] = attrValue;
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
var nodeName = target.nodeName.toLowerCase();
|
154 |
+
var inline = (nodeName == 'div' || nodeName == 'span');
|
155 |
+
if (!target.id) {
|
156 |
+
this.uuid += 1;
|
157 |
+
target.id = 'dp' + this.uuid;
|
158 |
+
}
|
159 |
+
var inst = this._newInst($(target), inline);
|
160 |
+
inst.settings = $.extend({}, settings || {}, inlineSettings || {});
|
161 |
+
if (nodeName == 'input') {
|
162 |
+
this._connectDatepicker(target, inst);
|
163 |
+
} else if (inline) {
|
164 |
+
this._inlineDatepicker(target, inst);
|
165 |
+
}
|
166 |
+
},
|
167 |
+
|
168 |
+
/* Create a new instance object. */
|
169 |
+
_newInst: function(target, inline) {
|
170 |
+
var id = target[0].id.replace(/([^A-Za-z0-9_-])/g, '\\\\$1'); // escape jQuery meta chars
|
171 |
+
return {id: id, input: target, // associated target
|
172 |
+
selectedDay: 0, selectedMonth: 0, selectedYear: 0, // current selection
|
173 |
+
drawMonth: 0, drawYear: 0, // month being drawn
|
174 |
+
inline: inline, // is datepicker inline or not
|
175 |
+
dpDiv: (!inline ? this.dpDiv : // presentation div
|
176 |
+
$('<div class="' + this._inlineClass + ' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))};
|
177 |
+
},
|
178 |
+
|
179 |
+
/* Attach the date picker to an input field. */
|
180 |
+
_connectDatepicker: function(target, inst) {
|
181 |
+
var input = $(target);
|
182 |
+
inst.append = $([]);
|
183 |
+
inst.trigger = $([]);
|
184 |
+
if (input.hasClass(this.markerClassName))
|
185 |
+
return;
|
186 |
+
this._attachments(input, inst);
|
187 |
+
input.addClass(this.markerClassName).keydown(this._doKeyDown).
|
188 |
+
keypress(this._doKeyPress).keyup(this._doKeyUp).
|
189 |
+
bind("setData.datepicker", function(event, key, value) {
|
190 |
+
inst.settings[key] = value;
|
191 |
+
}).bind("getData.datepicker", function(event, key) {
|
192 |
+
return this._get(inst, key);
|
193 |
+
});
|
194 |
+
this._autoSize(inst);
|
195 |
+
$.data(target, PROP_NAME, inst);
|
196 |
+
},
|
197 |
+
|
198 |
+
/* Make attachments based on settings. */
|
199 |
+
_attachments: function(input, inst) {
|
200 |
+
var appendText = this._get(inst, 'appendText');
|
201 |
+
var isRTL = this._get(inst, 'isRTL');
|
202 |
+
if (inst.append)
|
203 |
+
inst.append.remove();
|
204 |
+
if (appendText) {
|
205 |
+
inst.append = $('<span class="' + this._appendClass + '">' + appendText + '</span>');
|
206 |
+
input[isRTL ? 'before' : 'after'](inst.append);
|
207 |
+
}
|
208 |
+
input.unbind('focus', this._showDatepicker);
|
209 |
+
if (inst.trigger)
|
210 |
+
inst.trigger.remove();
|
211 |
+
var showOn = this._get(inst, 'showOn');
|
212 |
+
if (showOn == 'focus' || showOn == 'both') // pop-up date picker when in the marked field
|
213 |
+
input.focus(this._showDatepicker);
|
214 |
+
if (showOn == 'button' || showOn == 'both') { // pop-up date picker when button clicked
|
215 |
+
var buttonText = this._get(inst, 'buttonText');
|
216 |
+
var buttonImage = this._get(inst, 'buttonImage');
|
217 |
+
inst.trigger = $(this._get(inst, 'buttonImageOnly') ?
|
218 |
+
$('<img/>').addClass(this._triggerClass).
|
219 |
+
attr({ src: buttonImage, alt: buttonText, title: buttonText }) :
|
220 |
+
$('<button type="button"></button>').addClass(this._triggerClass).
|
221 |
+
html(buttonImage == '' ? buttonText : $('<img/>').attr(
|
222 |
+
{ src:buttonImage, alt:buttonText, title:buttonText })));
|
223 |
+
input[isRTL ? 'before' : 'after'](inst.trigger);
|
224 |
+
inst.trigger.click(function() {
|
225 |
+
if ($.datepicker._datepickerShowing && $.datepicker._lastInput == input[0])
|
226 |
+
$.datepicker._hideDatepicker();
|
227 |
+
else
|
228 |
+
$.datepicker._showDatepicker(input[0]);
|
229 |
+
return false;
|
230 |
+
});
|
231 |
+
}
|
232 |
+
},
|
233 |
+
|
234 |
+
/* Apply the maximum length for the date format. */
|
235 |
+
_autoSize: function(inst) {
|
236 |
+
if (this._get(inst, 'autoSize') && !inst.inline) {
|
237 |
+
var date = new Date(2009, 12 - 1, 20); // Ensure double digits
|
238 |
+
var dateFormat = this._get(inst, 'dateFormat');
|
239 |
+
if (dateFormat.match(/[DM]/)) {
|
240 |
+
var findMax = function(names) {
|
241 |
+
var max = 0;
|
242 |
+
var maxI = 0;
|
243 |
+
for (var i = 0; i < names.length; i++) {
|
244 |
+
if (names[i].length > max) {
|
245 |
+
max = names[i].length;
|
246 |
+
maxI = i;
|
247 |
+
}
|
248 |
+
}
|
249 |
+
return maxI;
|
250 |
+
};
|
251 |
+
date.setMonth(findMax(this._get(inst, (dateFormat.match(/MM/) ?
|
252 |
+
'monthNames' : 'monthNamesShort'))));
|
253 |
+
date.setDate(findMax(this._get(inst, (dateFormat.match(/DD/) ?
|
254 |
+
'dayNames' : 'dayNamesShort'))) + 20 - date.getDay());
|
255 |
+
}
|
256 |
+
inst.input.attr('size', this._formatDate(inst, date).length);
|
257 |
+
}
|
258 |
+
},
|
259 |
+
|
260 |
+
/* Attach an inline date picker to a div. */
|
261 |
+
_inlineDatepicker: function(target, inst) {
|
262 |
+
var divSpan = $(target);
|
263 |
+
if (divSpan.hasClass(this.markerClassName))
|
264 |
+
return;
|
265 |
+
divSpan.addClass(this.markerClassName).append(inst.dpDiv).
|
266 |
+
bind("setData.datepicker", function(event, key, value){
|
267 |
+
inst.settings[key] = value;
|
268 |
+
}).bind("getData.datepicker", function(event, key){
|
269 |
+
return this._get(inst, key);
|
270 |
+
});
|
271 |
+
$.data(target, PROP_NAME, inst);
|
272 |
+
this._setDate(inst, this._getDefaultDate(inst), true);
|
273 |
+
this._updateDatepicker(inst);
|
274 |
+
this._updateAlternate(inst);
|
275 |
+
inst.dpDiv.show();
|
276 |
+
},
|
277 |
+
|
278 |
+
/* Pop-up the date picker in a "dialog" box.
|
279 |
+
@param input element - ignored
|
280 |
+
@param date string or Date - the initial date to display
|
281 |
+
@param onSelect function - the function to call when a date is selected
|
282 |
+
@param settings object - update the dialog date picker instance's settings (anonymous object)
|
283 |
+
@param pos int[2] - coordinates for the dialog's position within the screen or
|
284 |
+
event - with x/y coordinates or
|
285 |
+
leave empty for default (screen centre)
|
286 |
+
@return the manager object */
|
287 |
+
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
|
288 |
+
var inst = this._dialogInst; // internal instance
|
289 |
+
if (!inst) {
|
290 |
+
this.uuid += 1;
|
291 |
+
var id = 'dp' + this.uuid;
|
292 |
+
this._dialogInput = $('<input type="text" id="' + id +
|
293 |
+
'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
|
294 |
+
this._dialogInput.keydown(this._doKeyDown);
|
295 |
+
$('body').append(this._dialogInput);
|
296 |
+
inst = this._dialogInst = this._newInst(this._dialogInput, false);
|
297 |
+
inst.settings = {};
|
298 |
+
$.data(this._dialogInput[0], PROP_NAME, inst);
|
299 |
+
}
|
300 |
+
extendRemove(inst.settings, settings || {});
|
301 |
+
date = (date && date.constructor == Date ? this._formatDate(inst, date) : date);
|
302 |
+
this._dialogInput.val(date);
|
303 |
+
|
304 |
+
this._pos = (pos ? (pos.length ? pos : [pos.pageX, pos.pageY]) : null);
|
305 |
+
if (!this._pos) {
|
306 |
+
var browserWidth = document.documentElement.clientWidth;
|
307 |
+
var browserHeight = document.documentElement.clientHeight;
|
308 |
+
var scrollX = document.documentElement.scrollLeft || document.body.scrollLeft;
|
309 |
+
var scrollY = document.documentElement.scrollTop || document.body.scrollTop;
|
310 |
+
this._pos = // should use actual width/height below
|
311 |
+
[(browserWidth / 2) - 100 + scrollX, (browserHeight / 2) - 150 + scrollY];
|
312 |
+
}
|
313 |
+
|
314 |
+
// move input on screen for focus, but hidden behind dialog
|
315 |
+
this._dialogInput.css('left', (this._pos[0] + 20) + 'px').css('top', this._pos[1] + 'px');
|
316 |
+
inst.settings.onSelect = onSelect;
|
317 |
+
this._inDialog = true;
|
318 |
+
this.dpDiv.addClass(this._dialogClass);
|
319 |
+
this._showDatepicker(this._dialogInput[0]);
|
320 |
+
if ($.blockUI)
|
321 |
+
$.blockUI(this.dpDiv);
|
322 |
+
$.data(this._dialogInput[0], PROP_NAME, inst);
|
323 |
+
return this;
|
324 |
+
},
|
325 |
+
|
326 |
+
/* Detach a datepicker from its control.
|
327 |
+
@param target element - the target input field or division or span */
|
328 |
+
_destroyDatepicker: function(target) {
|
329 |
+
var $target = $(target);
|
330 |
+
var inst = $.data(target, PROP_NAME);
|
331 |
+
if (!$target.hasClass(this.markerClassName)) {
|
332 |
+
return;
|
333 |
+
}
|
334 |
+
var nodeName = target.nodeName.toLowerCase();
|
335 |
+
$.removeData(target, PROP_NAME);
|
336 |
+
if (nodeName == 'input') {
|
337 |
+
inst.append.remove();
|
338 |
+
inst.trigger.remove();
|
339 |
+
$target.removeClass(this.markerClassName).
|
340 |
+
unbind('focus', this._showDatepicker).
|
341 |
+
unbind('keydown', this._doKeyDown).
|
342 |
+
unbind('keypress', this._doKeyPress).
|
343 |
+
unbind('keyup', this._doKeyUp);
|
344 |
+
} else if (nodeName == 'div' || nodeName == 'span')
|
345 |
+
$target.removeClass(this.markerClassName).empty();
|
346 |
+
},
|
347 |
+
|
348 |
+
/* Enable the date picker to a jQuery selection.
|
349 |
+
@param target element - the target input field or division or span */
|
350 |
+
_enableDatepicker: function(target) {
|
351 |
+
var $target = $(target);
|
352 |
+
var inst = $.data(target, PROP_NAME);
|
353 |
+
if (!$target.hasClass(this.markerClassName)) {
|
354 |
+
return;
|
355 |
+
}
|
356 |
+
var nodeName = target.nodeName.toLowerCase();
|
357 |
+
if (nodeName == 'input') {
|
358 |
+
target.disabled = false;
|
359 |
+
inst.trigger.filter('button').
|
360 |
+
each(function() { this.disabled = false; }).end().
|
361 |
+
filter('img').css({opacity: '1.0', cursor: ''});
|
362 |
+
}
|
363 |
+
else if (nodeName == 'div' || nodeName == 'span') {
|
364 |
+
var inline = $target.children('.' + this._inlineClass);
|
365 |
+
inline.children().removeClass('ui-state-disabled');
|
366 |
+
}
|
367 |
+
this._disabledInputs = $.map(this._disabledInputs,
|
368 |
+
function(value) { return (value == target ? null : value); }); // delete entry
|
369 |
+
},
|
370 |
+
|
371 |
+
/* Disable the date picker to a jQuery selection.
|
372 |
+
@param target element - the target input field or division or span */
|
373 |
+
_disableDatepicker: function(target) {
|
374 |
+
var $target = $(target);
|
375 |
+
var inst = $.data(target, PROP_NAME);
|
376 |
+
if (!$target.hasClass(this.markerClassName)) {
|
377 |
+
return;
|
378 |
+
}
|
379 |
+
var nodeName = target.nodeName.toLowerCase();
|
380 |
+
if (nodeName == 'input') {
|
381 |
+
target.disabled = true;
|
382 |
+
inst.trigger.filter('button').
|
383 |
+
each(function() { this.disabled = true; }).end().
|
384 |
+
filter('img').css({opacity: '0.5', cursor: 'default'});
|
385 |
+
}
|
386 |
+
else if (nodeName == 'div' || nodeName == 'span') {
|
387 |
+
var inline = $target.children('.' + this._inlineClass);
|
388 |
+
inline.children().addClass('ui-state-disabled');
|
389 |
+
}
|
390 |
+
this._disabledInputs = $.map(this._disabledInputs,
|
391 |
+
function(value) { return (value == target ? null : value); }); // delete entry
|
392 |
+
this._disabledInputs[this._disabledInputs.length] = target;
|
393 |
+
},
|
394 |
+
|
395 |
+
/* Is the first field in a jQuery collection disabled as a datepicker?
|
396 |
+
@param target element - the target input field or division or span
|
397 |
+
@return boolean - true if disabled, false if enabled */
|
398 |
+
_isDisabledDatepicker: function(target) {
|
399 |
+
if (!target) {
|
400 |
+
return false;
|
401 |
+
}
|
402 |
+
for (var i = 0; i < this._disabledInputs.length; i++) {
|
403 |
+
if (this._disabledInputs[i] == target)
|
404 |
+
return true;
|
405 |
+
}
|
406 |
+
return false;
|
407 |
+
},
|
408 |
+
|
409 |
+
/* Retrieve the instance data for the target control.
|
410 |
+
@param target element - the target input field or division or span
|
411 |
+
@return object - the associated instance data
|
412 |
+
@throws error if a jQuery problem getting data */
|
413 |
+
_getInst: function(target) {
|
414 |
+
try {
|
415 |
+
return $.data(target, PROP_NAME);
|
416 |
+
}
|
417 |
+
catch (err) {
|
418 |
+
throw 'Missing instance data for this datepicker';
|
419 |
+
}
|
420 |
+
},
|
421 |
+
|
422 |
+
/* Update or retrieve the settings for a date picker attached to an input field or division.
|
423 |
+
@param target element - the target input field or division or span
|
424 |
+
@param name object - the new settings to update or
|
425 |
+
string - the name of the setting to change or retrieve,
|
426 |
+
when retrieving also 'all' for all instance settings or
|
427 |
+
'defaults' for all global defaults
|
428 |
+
@param value any - the new value for the setting
|
429 |
+
(omit if above is an object or to retrieve a value) */
|
430 |
+
_optionDatepicker: function(target, name, value) {
|
431 |
+
var inst = this._getInst(target);
|
432 |
+
if (arguments.length == 2 && typeof name == 'string') {
|
433 |
+
return (name == 'defaults' ? $.extend({}, $.datepicker._defaults) :
|
434 |
+
(inst ? (name == 'all' ? $.extend({}, inst.settings) :
|
435 |
+
this._get(inst, name)) : null));
|
436 |
+
}
|
437 |
+
var settings = name || {};
|
438 |
+
if (typeof name == 'string') {
|
439 |
+
settings = {};
|
440 |
+
settings[name] = value;
|
441 |
+
}
|
442 |
+
if (inst) {
|
443 |
+
if (this._curInst == inst) {
|
444 |
+
this._hideDatepicker();
|
445 |
+
}
|
446 |
+
var date = this._getDateDatepicker(target, true);
|
447 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
448 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
449 |
+
extendRemove(inst.settings, settings);
|
450 |
+
// reformat the old minDate/maxDate values if dateFormat changes and a new minDate/maxDate isn't provided
|
451 |
+
if (minDate !== null && settings['dateFormat'] !== undefined && settings['minDate'] === undefined)
|
452 |
+
inst.settings.minDate = this._formatDate(inst, minDate);
|
453 |
+
if (maxDate !== null && settings['dateFormat'] !== undefined && settings['maxDate'] === undefined)
|
454 |
+
inst.settings.maxDate = this._formatDate(inst, maxDate);
|
455 |
+
this._attachments($(target), inst);
|
456 |
+
this._autoSize(inst);
|
457 |
+
this._setDateDatepicker(target, date);
|
458 |
+
this._updateDatepicker(inst);
|
459 |
+
}
|
460 |
+
},
|
461 |
+
|
462 |
+
// change method deprecated
|
463 |
+
_changeDatepicker: function(target, name, value) {
|
464 |
+
this._optionDatepicker(target, name, value);
|
465 |
+
},
|
466 |
+
|
467 |
+
/* Redraw the date picker attached to an input field or division.
|
468 |
+
@param target element - the target input field or division or span */
|
469 |
+
_refreshDatepicker: function(target) {
|
470 |
+
var inst = this._getInst(target);
|
471 |
+
if (inst) {
|
472 |
+
this._updateDatepicker(inst);
|
473 |
+
}
|
474 |
+
},
|
475 |
+
|
476 |
+
/* Set the dates for a jQuery selection.
|
477 |
+
@param target element - the target input field or division or span
|
478 |
+
@param date Date - the new date */
|
479 |
+
_setDateDatepicker: function(target, date) {
|
480 |
+
var inst = this._getInst(target);
|
481 |
+
if (inst) {
|
482 |
+
this._setDate(inst, date);
|
483 |
+
this._updateDatepicker(inst);
|
484 |
+
this._updateAlternate(inst);
|
485 |
+
}
|
486 |
+
},
|
487 |
+
|
488 |
+
/* Get the date(s) for the first entry in a jQuery selection.
|
489 |
+
@param target element - the target input field or division or span
|
490 |
+
@param noDefault boolean - true if no default date is to be used
|
491 |
+
@return Date - the current date */
|
492 |
+
_getDateDatepicker: function(target, noDefault) {
|
493 |
+
var inst = this._getInst(target);
|
494 |
+
if (inst && !inst.inline)
|
495 |
+
this._setDateFromField(inst, noDefault);
|
496 |
+
return (inst ? this._getDate(inst) : null);
|
497 |
+
},
|
498 |
+
|
499 |
+
/* Handle keystrokes. */
|
500 |
+
_doKeyDown: function(event) {
|
501 |
+
var inst = $.datepicker._getInst(event.target);
|
502 |
+
var handled = true;
|
503 |
+
var isRTL = inst.dpDiv.is('.ui-datepicker-rtl');
|
504 |
+
inst._keyEvent = true;
|
505 |
+
if ($.datepicker._datepickerShowing)
|
506 |
+
switch (event.keyCode) {
|
507 |
+
case 9: $.datepicker._hideDatepicker();
|
508 |
+
handled = false;
|
509 |
+
break; // hide on tab out
|
510 |
+
case 13: var sel = $('td.' + $.datepicker._dayOverClass + ':not(.' +
|
511 |
+
$.datepicker._currentClass + ')', inst.dpDiv);
|
512 |
+
if (sel[0])
|
513 |
+
$.datepicker._selectDay(event.target, inst.selectedMonth, inst.selectedYear, sel[0]);
|
514 |
+
else
|
515 |
+
$.datepicker._hideDatepicker();
|
516 |
+
return false; // don't submit the form
|
517 |
+
break; // select the value on enter
|
518 |
+
case 27: $.datepicker._hideDatepicker();
|
519 |
+
break; // hide on escape
|
520 |
+
case 33: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
521 |
+
-$.datepicker._get(inst, 'stepBigMonths') :
|
522 |
+
-$.datepicker._get(inst, 'stepMonths')), 'M');
|
523 |
+
break; // previous month/year on page up/+ ctrl
|
524 |
+
case 34: $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
525 |
+
+$.datepicker._get(inst, 'stepBigMonths') :
|
526 |
+
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
527 |
+
break; // next month/year on page down/+ ctrl
|
528 |
+
case 35: if (event.ctrlKey || event.metaKey) $.datepicker._clearDate(event.target);
|
529 |
+
handled = event.ctrlKey || event.metaKey;
|
530 |
+
break; // clear on ctrl or command +end
|
531 |
+
case 36: if (event.ctrlKey || event.metaKey) $.datepicker._gotoToday(event.target);
|
532 |
+
handled = event.ctrlKey || event.metaKey;
|
533 |
+
break; // current on ctrl or command +home
|
534 |
+
case 37: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? +1 : -1), 'D');
|
535 |
+
handled = event.ctrlKey || event.metaKey;
|
536 |
+
// -1 day on ctrl or command +left
|
537 |
+
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
538 |
+
-$.datepicker._get(inst, 'stepBigMonths') :
|
539 |
+
-$.datepicker._get(inst, 'stepMonths')), 'M');
|
540 |
+
// next month/year on alt +left on Mac
|
541 |
+
break;
|
542 |
+
case 38: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, -7, 'D');
|
543 |
+
handled = event.ctrlKey || event.metaKey;
|
544 |
+
break; // -1 week on ctrl or command +up
|
545 |
+
case 39: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, (isRTL ? -1 : +1), 'D');
|
546 |
+
handled = event.ctrlKey || event.metaKey;
|
547 |
+
// +1 day on ctrl or command +right
|
548 |
+
if (event.originalEvent.altKey) $.datepicker._adjustDate(event.target, (event.ctrlKey ?
|
549 |
+
+$.datepicker._get(inst, 'stepBigMonths') :
|
550 |
+
+$.datepicker._get(inst, 'stepMonths')), 'M');
|
551 |
+
// next month/year on alt +right
|
552 |
+
break;
|
553 |
+
case 40: if (event.ctrlKey || event.metaKey) $.datepicker._adjustDate(event.target, +7, 'D');
|
554 |
+
handled = event.ctrlKey || event.metaKey;
|
555 |
+
break; // +1 week on ctrl or command +down
|
556 |
+
default: handled = false;
|
557 |
+
}
|
558 |
+
else if (event.keyCode == 36 && event.ctrlKey) // display the date picker on ctrl+home
|
559 |
+
$.datepicker._showDatepicker(this);
|
560 |
+
else {
|
561 |
+
handled = false;
|
562 |
+
}
|
563 |
+
if (handled) {
|
564 |
+
event.preventDefault();
|
565 |
+
event.stopPropagation();
|
566 |
+
}
|
567 |
+
},
|
568 |
+
|
569 |
+
/* Filter entered characters - based on date format. */
|
570 |
+
_doKeyPress: function(event) {
|
571 |
+
var inst = $.datepicker._getInst(event.target);
|
572 |
+
if ($.datepicker._get(inst, 'constrainInput')) {
|
573 |
+
var chars = $.datepicker._possibleChars($.datepicker._get(inst, 'dateFormat'));
|
574 |
+
var chr = String.fromCharCode(event.charCode == undefined ? event.keyCode : event.charCode);
|
575 |
+
return event.ctrlKey || event.metaKey || (chr < ' ' || !chars || chars.indexOf(chr) > -1);
|
576 |
+
}
|
577 |
+
},
|
578 |
+
|
579 |
+
/* Synchronise manual entry and field/alternate field. */
|
580 |
+
_doKeyUp: function(event) {
|
581 |
+
var inst = $.datepicker._getInst(event.target);
|
582 |
+
if (inst.input.val() != inst.lastVal) {
|
583 |
+
try {
|
584 |
+
var date = $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
|
585 |
+
(inst.input ? inst.input.val() : null),
|
586 |
+
$.datepicker._getFormatConfig(inst));
|
587 |
+
if (date) { // only if valid
|
588 |
+
$.datepicker._setDateFromField(inst);
|
589 |
+
$.datepicker._updateAlternate(inst);
|
590 |
+
$.datepicker._updateDatepicker(inst);
|
591 |
+
}
|
592 |
+
}
|
593 |
+
catch (event) {
|
594 |
+
$.datepicker.log(event);
|
595 |
+
}
|
596 |
+
}
|
597 |
+
return true;
|
598 |
+
},
|
599 |
+
|
600 |
+
/* Pop-up the date picker for a given input field.
|
601 |
+
@param input element - the input field attached to the date picker or
|
602 |
+
event - if triggered by focus */
|
603 |
+
_showDatepicker: function(input) {
|
604 |
+
input = input.target || input;
|
605 |
+
if (input.nodeName.toLowerCase() != 'input') // find from button/image trigger
|
606 |
+
input = $('input', input.parentNode)[0];
|
607 |
+
if ($.datepicker._isDisabledDatepicker(input) || $.datepicker._lastInput == input) // already here
|
608 |
+
return;
|
609 |
+
var inst = $.datepicker._getInst(input);
|
610 |
+
if ($.datepicker._curInst && $.datepicker._curInst != inst) {
|
611 |
+
$.datepicker._curInst.dpDiv.stop(true, true);
|
612 |
+
}
|
613 |
+
var beforeShow = $.datepicker._get(inst, 'beforeShow');
|
614 |
+
extendRemove(inst.settings, (beforeShow ? beforeShow.apply(input, [input, inst]) : {}));
|
615 |
+
inst.lastVal = null;
|
616 |
+
$.datepicker._lastInput = input;
|
617 |
+
$.datepicker._setDateFromField(inst);
|
618 |
+
if ($.datepicker._inDialog) // hide cursor
|
619 |
+
input.value = '';
|
620 |
+
if (!$.datepicker._pos) { // position below input
|
621 |
+
$.datepicker._pos = $.datepicker._findPos(input);
|
622 |
+
$.datepicker._pos[1] += input.offsetHeight; // add the height
|
623 |
+
}
|
624 |
+
var isFixed = false;
|
625 |
+
$(input).parents().each(function() {
|
626 |
+
isFixed |= $(this).css('position') == 'fixed';
|
627 |
+
return !isFixed;
|
628 |
+
});
|
629 |
+
if (isFixed && $.browser.opera) { // correction for Opera when fixed and scrolled
|
630 |
+
$.datepicker._pos[0] -= document.documentElement.scrollLeft;
|
631 |
+
$.datepicker._pos[1] -= document.documentElement.scrollTop;
|
632 |
+
}
|
633 |
+
var offset = {left: $.datepicker._pos[0], top: $.datepicker._pos[1]};
|
634 |
+
$.datepicker._pos = null;
|
635 |
+
//to avoid flashes on Firefox
|
636 |
+
inst.dpDiv.empty();
|
637 |
+
// determine sizing offscreen
|
638 |
+
inst.dpDiv.css({position: 'absolute', display: 'block', top: '-1000px'});
|
639 |
+
$.datepicker._updateDatepicker(inst);
|
640 |
+
// fix width for dynamic number of date pickers
|
641 |
+
// and adjust position before showing
|
642 |
+
offset = $.datepicker._checkOffset(inst, offset, isFixed);
|
643 |
+
inst.dpDiv.css({position: ($.datepicker._inDialog && $.blockUI ?
|
644 |
+
'static' : (isFixed ? 'fixed' : 'absolute')), display: 'none',
|
645 |
+
left: offset.left + 'px', top: offset.top + 'px'});
|
646 |
+
if (!inst.inline) {
|
647 |
+
var showAnim = $.datepicker._get(inst, 'showAnim');
|
648 |
+
var duration = $.datepicker._get(inst, 'duration');
|
649 |
+
var postProcess = function() {
|
650 |
+
$.datepicker._datepickerShowing = true;
|
651 |
+
var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
|
652 |
+
if( !! cover.length ){
|
653 |
+
var borders = $.datepicker._getBorders(inst.dpDiv);
|
654 |
+
cover.css({left: -borders[0], top: -borders[1],
|
655 |
+
width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()});
|
656 |
+
}
|
657 |
+
};
|
658 |
+
inst.dpDiv.zIndex($(input).zIndex()+1);
|
659 |
+
if ($.effects && $.effects[showAnim])
|
660 |
+
inst.dpDiv.show(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
|
661 |
+
else
|
662 |
+
inst.dpDiv[showAnim || 'show']((showAnim ? duration : null), postProcess);
|
663 |
+
if (!showAnim || !duration)
|
664 |
+
postProcess();
|
665 |
+
if (inst.input.is(':visible') && !inst.input.is(':disabled'))
|
666 |
+
inst.input.focus();
|
667 |
+
$.datepicker._curInst = inst;
|
668 |
+
}
|
669 |
+
},
|
670 |
+
|
671 |
+
/* Generate the date picker content. */
|
672 |
+
_updateDatepicker: function(inst) {
|
673 |
+
var self = this;
|
674 |
+
var borders = $.datepicker._getBorders(inst.dpDiv);
|
675 |
+
inst.dpDiv.empty().append(this._generateHTML(inst));
|
676 |
+
var cover = inst.dpDiv.find('iframe.ui-datepicker-cover'); // IE6- only
|
677 |
+
if( !!cover.length ){ //avoid call to outerXXXX() when not in IE6
|
678 |
+
cover.css({left: -borders[0], top: -borders[1], width: inst.dpDiv.outerWidth(), height: inst.dpDiv.outerHeight()})
|
679 |
+
}
|
680 |
+
inst.dpDiv.find('button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a')
|
681 |
+
.bind('mouseout', function(){
|
682 |
+
$(this).removeClass('ui-state-hover');
|
683 |
+
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).removeClass('ui-datepicker-prev-hover');
|
684 |
+
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).removeClass('ui-datepicker-next-hover');
|
685 |
+
})
|
686 |
+
.bind('mouseover', function(){
|
687 |
+
if (!self._isDisabledDatepicker( inst.inline ? inst.dpDiv.parent()[0] : inst.input[0])) {
|
688 |
+
$(this).parents('.ui-datepicker-calendar').find('a').removeClass('ui-state-hover');
|
689 |
+
$(this).addClass('ui-state-hover');
|
690 |
+
if(this.className.indexOf('ui-datepicker-prev') != -1) $(this).addClass('ui-datepicker-prev-hover');
|
691 |
+
if(this.className.indexOf('ui-datepicker-next') != -1) $(this).addClass('ui-datepicker-next-hover');
|
692 |
+
}
|
693 |
+
})
|
694 |
+
.end()
|
695 |
+
.find('.' + this._dayOverClass + ' a')
|
696 |
+
.trigger('mouseover')
|
697 |
+
.end();
|
698 |
+
var numMonths = this._getNumberOfMonths(inst);
|
699 |
+
var cols = numMonths[1];
|
700 |
+
var width = 17;
|
701 |
+
if (cols > 1)
|
702 |
+
inst.dpDiv.addClass('ui-datepicker-multi-' + cols).css('width', (width * cols) + 'em');
|
703 |
+
else
|
704 |
+
inst.dpDiv.removeClass('ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4').width('');
|
705 |
+
inst.dpDiv[(numMonths[0] != 1 || numMonths[1] != 1 ? 'add' : 'remove') +
|
706 |
+
'Class']('ui-datepicker-multi');
|
707 |
+
inst.dpDiv[(this._get(inst, 'isRTL') ? 'add' : 'remove') +
|
708 |
+
'Class']('ui-datepicker-rtl');
|
709 |
+
if (inst == $.datepicker._curInst && $.datepicker._datepickerShowing && inst.input &&
|
710 |
+
// #6694 - don't focus the input if it's already focused
|
711 |
+
// this breaks the change event in IE
|
712 |
+
inst.input.is(':visible') && !inst.input.is(':disabled') && inst.input[0] != document.activeElement)
|
713 |
+
inst.input.focus();
|
714 |
+
// deffered render of the years select (to avoid flashes on Firefox)
|
715 |
+
if( inst.yearshtml ){
|
716 |
+
var origyearshtml = inst.yearshtml;
|
717 |
+
setTimeout(function(){
|
718 |
+
//assure that inst.yearshtml didn't change.
|
719 |
+
if( origyearshtml === inst.yearshtml ){
|
720 |
+
inst.dpDiv.find('select.ui-datepicker-year:first').replaceWith(inst.yearshtml);
|
721 |
+
}
|
722 |
+
origyearshtml = inst.yearshtml = null;
|
723 |
+
}, 0);
|
724 |
+
}
|
725 |
+
},
|
726 |
+
|
727 |
+
/* Retrieve the size of left and top borders for an element.
|
728 |
+
@param elem (jQuery object) the element of interest
|
729 |
+
@return (number[2]) the left and top borders */
|
730 |
+
_getBorders: function(elem) {
|
731 |
+
var convert = function(value) {
|
732 |
+
return {thin: 1, medium: 2, thick: 3}[value] || value;
|
733 |
+
};
|
734 |
+
return [parseFloat(convert(elem.css('border-left-width'))),
|
735 |
+
parseFloat(convert(elem.css('border-top-width')))];
|
736 |
+
},
|
737 |
+
|
738 |
+
/* Check positioning to remain on screen. */
|
739 |
+
_checkOffset: function(inst, offset, isFixed) {
|
740 |
+
var dpWidth = inst.dpDiv.outerWidth();
|
741 |
+
var dpHeight = inst.dpDiv.outerHeight();
|
742 |
+
var inputWidth = inst.input ? inst.input.outerWidth() : 0;
|
743 |
+
var inputHeight = inst.input ? inst.input.outerHeight() : 0;
|
744 |
+
var viewWidth = document.documentElement.clientWidth + $(document).scrollLeft();
|
745 |
+
var viewHeight = document.documentElement.clientHeight + $(document).scrollTop();
|
746 |
+
|
747 |
+
offset.left -= (this._get(inst, 'isRTL') ? (dpWidth - inputWidth) : 0);
|
748 |
+
offset.left -= (isFixed && offset.left == inst.input.offset().left) ? $(document).scrollLeft() : 0;
|
749 |
+
offset.top -= (isFixed && offset.top == (inst.input.offset().top + inputHeight)) ? $(document).scrollTop() : 0;
|
750 |
+
|
751 |
+
// now check if datepicker is showing outside window viewport - move to a better place if so.
|
752 |
+
offset.left -= Math.min(offset.left, (offset.left + dpWidth > viewWidth && viewWidth > dpWidth) ?
|
753 |
+
Math.abs(offset.left + dpWidth - viewWidth) : 0);
|
754 |
+
offset.top -= Math.min(offset.top, (offset.top + dpHeight > viewHeight && viewHeight > dpHeight) ?
|
755 |
+
Math.abs(dpHeight + inputHeight) : 0);
|
756 |
+
|
757 |
+
return offset;
|
758 |
+
},
|
759 |
+
|
760 |
+
/* Find an object's position on the screen. */
|
761 |
+
_findPos: function(obj) {
|
762 |
+
var inst = this._getInst(obj);
|
763 |
+
var isRTL = this._get(inst, 'isRTL');
|
764 |
+
while (obj && (obj.type == 'hidden' || obj.nodeType != 1 || $.expr.filters.hidden(obj))) {
|
765 |
+
obj = obj[isRTL ? 'previousSibling' : 'nextSibling'];
|
766 |
+
}
|
767 |
+
var position = $(obj).offset();
|
768 |
+
return [position.left, position.top];
|
769 |
+
},
|
770 |
+
|
771 |
+
/* Hide the date picker from view.
|
772 |
+
@param input element - the input field attached to the date picker */
|
773 |
+
_hideDatepicker: function(input) {
|
774 |
+
var inst = this._curInst;
|
775 |
+
if (!inst || (input && inst != $.data(input, PROP_NAME)))
|
776 |
+
return;
|
777 |
+
if (this._datepickerShowing) {
|
778 |
+
var showAnim = this._get(inst, 'showAnim');
|
779 |
+
var duration = this._get(inst, 'duration');
|
780 |
+
var postProcess = function() {
|
781 |
+
$.datepicker._tidyDialog(inst);
|
782 |
+
this._curInst = null;
|
783 |
+
};
|
784 |
+
if ($.effects && $.effects[showAnim])
|
785 |
+
inst.dpDiv.hide(showAnim, $.datepicker._get(inst, 'showOptions'), duration, postProcess);
|
786 |
+
else
|
787 |
+
inst.dpDiv[(showAnim == 'slideDown' ? 'slideUp' :
|
788 |
+
(showAnim == 'fadeIn' ? 'fadeOut' : 'hide'))]((showAnim ? duration : null), postProcess);
|
789 |
+
if (!showAnim)
|
790 |
+
postProcess();
|
791 |
+
var onClose = this._get(inst, 'onClose');
|
792 |
+
if (onClose)
|
793 |
+
onClose.apply((inst.input ? inst.input[0] : null),
|
794 |
+
[(inst.input ? inst.input.val() : ''), inst]); // trigger custom callback
|
795 |
+
this._datepickerShowing = false;
|
796 |
+
this._lastInput = null;
|
797 |
+
if (this._inDialog) {
|
798 |
+
this._dialogInput.css({ position: 'absolute', left: '0', top: '-100px' });
|
799 |
+
if ($.blockUI) {
|
800 |
+
$.unblockUI();
|
801 |
+
$('body').append(this.dpDiv);
|
802 |
+
}
|
803 |
+
}
|
804 |
+
this._inDialog = false;
|
805 |
+
}
|
806 |
+
},
|
807 |
+
|
808 |
+
/* Tidy up after a dialog display. */
|
809 |
+
_tidyDialog: function(inst) {
|
810 |
+
inst.dpDiv.removeClass(this._dialogClass).unbind('.ui-datepicker-calendar');
|
811 |
+
},
|
812 |
+
|
813 |
+
/* Close date picker if clicked elsewhere. */
|
814 |
+
_checkExternalClick: function(event) {
|
815 |
+
if (!$.datepicker._curInst)
|
816 |
+
return;
|
817 |
+
var $target = $(event.target);
|
818 |
+
if ($target[0].id != $.datepicker._mainDivId &&
|
819 |
+
$target.parents('#' + $.datepicker._mainDivId).length == 0 &&
|
820 |
+
!$target.hasClass($.datepicker.markerClassName) &&
|
821 |
+
!$target.hasClass($.datepicker._triggerClass) &&
|
822 |
+
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI))
|
823 |
+
$.datepicker._hideDatepicker();
|
824 |
+
},
|
825 |
+
|
826 |
+
/* Adjust one of the date sub-fields. */
|
827 |
+
_adjustDate: function(id, offset, period) {
|
828 |
+
var target = $(id);
|
829 |
+
var inst = this._getInst(target[0]);
|
830 |
+
if (this._isDisabledDatepicker(target[0])) {
|
831 |
+
return;
|
832 |
+
}
|
833 |
+
this._adjustInstDate(inst, offset +
|
834 |
+
(period == 'M' ? this._get(inst, 'showCurrentAtPos') : 0), // undo positioning
|
835 |
+
period);
|
836 |
+
this._updateDatepicker(inst);
|
837 |
+
},
|
838 |
+
|
839 |
+
/* Action for current link. */
|
840 |
+
_gotoToday: function(id) {
|
841 |
+
var target = $(id);
|
842 |
+
var inst = this._getInst(target[0]);
|
843 |
+
if (this._get(inst, 'gotoCurrent') && inst.currentDay) {
|
844 |
+
inst.selectedDay = inst.currentDay;
|
845 |
+
inst.drawMonth = inst.selectedMonth = inst.currentMonth;
|
846 |
+
inst.drawYear = inst.selectedYear = inst.currentYear;
|
847 |
+
}
|
848 |
+
else {
|
849 |
+
var date = new Date();
|
850 |
+
inst.selectedDay = date.getDate();
|
851 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
852 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
853 |
+
}
|
854 |
+
this._notifyChange(inst);
|
855 |
+
this._adjustDate(target);
|
856 |
+
},
|
857 |
+
|
858 |
+
/* Action for selecting a new month/year. */
|
859 |
+
_selectMonthYear: function(id, select, period) {
|
860 |
+
var target = $(id);
|
861 |
+
var inst = this._getInst(target[0]);
|
862 |
+
inst._selectingMonthYear = false;
|
863 |
+
inst['selected' + (period == 'M' ? 'Month' : 'Year')] =
|
864 |
+
inst['draw' + (period == 'M' ? 'Month' : 'Year')] =
|
865 |
+
parseInt(select.options[select.selectedIndex].value,10);
|
866 |
+
this._notifyChange(inst);
|
867 |
+
this._adjustDate(target);
|
868 |
+
},
|
869 |
+
|
870 |
+
/* Restore input focus after not changing month/year. */
|
871 |
+
_clickMonthYear: function(id) {
|
872 |
+
var target = $(id);
|
873 |
+
var inst = this._getInst(target[0]);
|
874 |
+
if (inst.input && inst._selectingMonthYear) {
|
875 |
+
setTimeout(function() {
|
876 |
+
inst.input.focus();
|
877 |
+
}, 0);
|
878 |
+
}
|
879 |
+
inst._selectingMonthYear = !inst._selectingMonthYear;
|
880 |
+
},
|
881 |
+
|
882 |
+
/* Action for selecting a day. */
|
883 |
+
_selectDay: function(id, month, year, td) {
|
884 |
+
var target = $(id);
|
885 |
+
if ($(td).hasClass(this._unselectableClass) || this._isDisabledDatepicker(target[0])) {
|
886 |
+
return;
|
887 |
+
}
|
888 |
+
var inst = this._getInst(target[0]);
|
889 |
+
inst.selectedDay = inst.currentDay = $('a', td).html();
|
890 |
+
inst.selectedMonth = inst.currentMonth = month;
|
891 |
+
inst.selectedYear = inst.currentYear = year;
|
892 |
+
this._selectDate(id, this._formatDate(inst,
|
893 |
+
inst.currentDay, inst.currentMonth, inst.currentYear));
|
894 |
+
},
|
895 |
+
|
896 |
+
/* Erase the input field and hide the date picker. */
|
897 |
+
_clearDate: function(id) {
|
898 |
+
var target = $(id);
|
899 |
+
var inst = this._getInst(target[0]);
|
900 |
+
this._selectDate(target, '');
|
901 |
+
},
|
902 |
+
|
903 |
+
/* Update the input field with the selected date. */
|
904 |
+
_selectDate: function(id, dateStr) {
|
905 |
+
var target = $(id);
|
906 |
+
var inst = this._getInst(target[0]);
|
907 |
+
dateStr = (dateStr != null ? dateStr : this._formatDate(inst));
|
908 |
+
if (inst.input)
|
909 |
+
inst.input.val(dateStr);
|
910 |
+
this._updateAlternate(inst);
|
911 |
+
var onSelect = this._get(inst, 'onSelect');
|
912 |
+
if (onSelect)
|
913 |
+
onSelect.apply((inst.input ? inst.input[0] : null), [dateStr, inst]); // trigger custom callback
|
914 |
+
else if (inst.input)
|
915 |
+
inst.input.trigger('change'); // fire the change event
|
916 |
+
if (inst.inline)
|
917 |
+
this._updateDatepicker(inst);
|
918 |
+
else {
|
919 |
+
this._hideDatepicker();
|
920 |
+
this._lastInput = inst.input[0];
|
921 |
+
if (typeof(inst.input[0]) != 'object')
|
922 |
+
inst.input.focus(); // restore focus
|
923 |
+
this._lastInput = null;
|
924 |
+
}
|
925 |
+
},
|
926 |
+
|
927 |
+
/* Update any alternate field to synchronise with the main field. */
|
928 |
+
_updateAlternate: function(inst) {
|
929 |
+
var altField = this._get(inst, 'altField');
|
930 |
+
if (altField) { // update alternate field too
|
931 |
+
var altFormat = this._get(inst, 'altFormat') || this._get(inst, 'dateFormat');
|
932 |
+
var date = this._getDate(inst);
|
933 |
+
var dateStr = this.formatDate(altFormat, date, this._getFormatConfig(inst));
|
934 |
+
$(altField).each(function() { $(this).val(dateStr); });
|
935 |
+
}
|
936 |
+
},
|
937 |
+
|
938 |
+
/* Set as beforeShowDay function to prevent selection of weekends.
|
939 |
+
@param date Date - the date to customise
|
940 |
+
@return [boolean, string] - is this date selectable?, what is its CSS class? */
|
941 |
+
noWeekends: function(date) {
|
942 |
+
var day = date.getDay();
|
943 |
+
return [(day > 0 && day < 6), ''];
|
944 |
+
},
|
945 |
+
|
946 |
+
/* Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
|
947 |
+
@param date Date - the date to get the week for
|
948 |
+
@return number - the number of the week within the year that contains this date */
|
949 |
+
iso8601Week: function(date) {
|
950 |
+
var checkDate = new Date(date.getTime());
|
951 |
+
// Find Thursday of this week starting on Monday
|
952 |
+
checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
|
953 |
+
var time = checkDate.getTime();
|
954 |
+
checkDate.setMonth(0); // Compare with Jan 1
|
955 |
+
checkDate.setDate(1);
|
956 |
+
return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
|
957 |
+
},
|
958 |
+
|
959 |
+
/* Parse a string value into a date object.
|
960 |
+
See formatDate below for the possible formats.
|
961 |
+
|
962 |
+
@param format string - the expected format of the date
|
963 |
+
@param value string - the date in the above format
|
964 |
+
@param settings Object - attributes include:
|
965 |
+
shortYearCutoff number - the cutoff year for determining the century (optional)
|
966 |
+
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
967 |
+
dayNames string[7] - names of the days from Sunday (optional)
|
968 |
+
monthNamesShort string[12] - abbreviated names of the months (optional)
|
969 |
+
monthNames string[12] - names of the months (optional)
|
970 |
+
@return Date - the extracted date value or null if value is blank */
|
971 |
+
parseDate: function (format, value, settings) {
|
972 |
+
if (format == null || value == null)
|
973 |
+
throw 'Invalid arguments';
|
974 |
+
value = (typeof value == 'object' ? value.toString() : value + '');
|
975 |
+
if (value == '')
|
976 |
+
return null;
|
977 |
+
var shortYearCutoff = (settings ? settings.shortYearCutoff : null) || this._defaults.shortYearCutoff;
|
978 |
+
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
|
979 |
+
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
|
980 |
+
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
|
981 |
+
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
|
982 |
+
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
|
983 |
+
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
|
984 |
+
var year = -1;
|
985 |
+
var month = -1;
|
986 |
+
var day = -1;
|
987 |
+
var doy = -1;
|
988 |
+
var literal = false;
|
989 |
+
// Check whether a format character is doubled
|
990 |
+
var lookAhead = function(match) {
|
991 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
992 |
+
if (matches)
|
993 |
+
iFormat++;
|
994 |
+
return matches;
|
995 |
+
};
|
996 |
+
// Extract a number from the string value
|
997 |
+
var getNumber = function(match) {
|
998 |
+
var isDoubled = lookAhead(match);
|
999 |
+
var size = (match == '@' ? 14 : (match == '!' ? 20 :
|
1000 |
+
(match == 'y' && isDoubled ? 4 : (match == 'o' ? 3 : 2))));
|
1001 |
+
var digits = new RegExp('^\\d{1,' + size + '}');
|
1002 |
+
var num = value.substring(iValue).match(digits);
|
1003 |
+
if (!num)
|
1004 |
+
throw 'Missing number at position ' + iValue;
|
1005 |
+
iValue += num[0].length;
|
1006 |
+
return parseInt(num[0], 10);
|
1007 |
+
};
|
1008 |
+
// Extract a name from the string value and convert to an index
|
1009 |
+
var getName = function(match, shortNames, longNames) {
|
1010 |
+
var names = (lookAhead(match) ? longNames : shortNames);
|
1011 |
+
for (var i = 0; i < names.length; i++) {
|
1012 |
+
if (value.substr(iValue, names[i].length).toLowerCase() == names[i].toLowerCase()) {
|
1013 |
+
iValue += names[i].length;
|
1014 |
+
return i + 1;
|
1015 |
+
}
|
1016 |
+
}
|
1017 |
+
throw 'Unknown name at position ' + iValue;
|
1018 |
+
};
|
1019 |
+
// Confirm that a literal character matches the string value
|
1020 |
+
var checkLiteral = function() {
|
1021 |
+
if (value.charAt(iValue) != format.charAt(iFormat))
|
1022 |
+
throw 'Unexpected literal at position ' + iValue;
|
1023 |
+
iValue++;
|
1024 |
+
};
|
1025 |
+
var iValue = 0;
|
1026 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++) {
|
1027 |
+
if (literal)
|
1028 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
1029 |
+
literal = false;
|
1030 |
+
else
|
1031 |
+
checkLiteral();
|
1032 |
+
else
|
1033 |
+
switch (format.charAt(iFormat)) {
|
1034 |
+
case 'd':
|
1035 |
+
day = getNumber('d');
|
1036 |
+
break;
|
1037 |
+
case 'D':
|
1038 |
+
getName('D', dayNamesShort, dayNames);
|
1039 |
+
break;
|
1040 |
+
case 'o':
|
1041 |
+
doy = getNumber('o');
|
1042 |
+
break;
|
1043 |
+
case 'm':
|
1044 |
+
month = getNumber('m');
|
1045 |
+
break;
|
1046 |
+
case 'M':
|
1047 |
+
month = getName('M', monthNamesShort, monthNames);
|
1048 |
+
break;
|
1049 |
+
case 'y':
|
1050 |
+
year = getNumber('y');
|
1051 |
+
break;
|
1052 |
+
case '@':
|
1053 |
+
var date = new Date(getNumber('@'));
|
1054 |
+
year = date.getFullYear();
|
1055 |
+
month = date.getMonth() + 1;
|
1056 |
+
day = date.getDate();
|
1057 |
+
break;
|
1058 |
+
case '!':
|
1059 |
+
var date = new Date((getNumber('!') - this._ticksTo1970) / 10000);
|
1060 |
+
year = date.getFullYear();
|
1061 |
+
month = date.getMonth() + 1;
|
1062 |
+
day = date.getDate();
|
1063 |
+
break;
|
1064 |
+
case "'":
|
1065 |
+
if (lookAhead("'"))
|
1066 |
+
checkLiteral();
|
1067 |
+
else
|
1068 |
+
literal = true;
|
1069 |
+
break;
|
1070 |
+
default:
|
1071 |
+
checkLiteral();
|
1072 |
+
}
|
1073 |
+
}
|
1074 |
+
if (year == -1)
|
1075 |
+
year = new Date().getFullYear();
|
1076 |
+
else if (year < 100)
|
1077 |
+
year += new Date().getFullYear() - new Date().getFullYear() % 100 +
|
1078 |
+
(year <= shortYearCutoff ? 0 : -100);
|
1079 |
+
if (doy > -1) {
|
1080 |
+
month = 1;
|
1081 |
+
day = doy;
|
1082 |
+
do {
|
1083 |
+
var dim = this._getDaysInMonth(year, month - 1);
|
1084 |
+
if (day <= dim)
|
1085 |
+
break;
|
1086 |
+
month++;
|
1087 |
+
day -= dim;
|
1088 |
+
} while (true);
|
1089 |
+
}
|
1090 |
+
var date = this._daylightSavingAdjust(new Date(year, month - 1, day));
|
1091 |
+
if (date.getFullYear() != year || date.getMonth() + 1 != month || date.getDate() != day)
|
1092 |
+
throw 'Invalid date'; // E.g. 31/02/*
|
1093 |
+
return date;
|
1094 |
+
},
|
1095 |
+
|
1096 |
+
/* Standard date formats. */
|
1097 |
+
ATOM: 'yy-mm-dd', // RFC 3339 (ISO 8601)
|
1098 |
+
COOKIE: 'D, dd M yy',
|
1099 |
+
ISO_8601: 'yy-mm-dd',
|
1100 |
+
RFC_822: 'D, d M y',
|
1101 |
+
RFC_850: 'DD, dd-M-y',
|
1102 |
+
RFC_1036: 'D, d M y',
|
1103 |
+
RFC_1123: 'D, d M yy',
|
1104 |
+
RFC_2822: 'D, d M yy',
|
1105 |
+
RSS: 'D, d M y', // RFC 822
|
1106 |
+
TICKS: '!',
|
1107 |
+
TIMESTAMP: '@',
|
1108 |
+
W3C: 'yy-mm-dd', // ISO 8601
|
1109 |
+
|
1110 |
+
_ticksTo1970: (((1970 - 1) * 365 + Math.floor(1970 / 4) - Math.floor(1970 / 100) +
|
1111 |
+
Math.floor(1970 / 400)) * 24 * 60 * 60 * 10000000),
|
1112 |
+
|
1113 |
+
/* Format a date object into a string value.
|
1114 |
+
The format can be combinations of the following:
|
1115 |
+
d - day of month (no leading zero)
|
1116 |
+
dd - day of month (two digit)
|
1117 |
+
o - day of year (no leading zeros)
|
1118 |
+
oo - day of year (three digit)
|
1119 |
+
D - day name short
|
1120 |
+
DD - day name long
|
1121 |
+
m - month of year (no leading zero)
|
1122 |
+
mm - month of year (two digit)
|
1123 |
+
M - month name short
|
1124 |
+
MM - month name long
|
1125 |
+
y - year (two digit)
|
1126 |
+
yy - year (four digit)
|
1127 |
+
@ - Unix timestamp (ms since 01/01/1970)
|
1128 |
+
! - Windows ticks (100ns since 01/01/0001)
|
1129 |
+
'...' - literal text
|
1130 |
+
'' - single quote
|
1131 |
+
|
1132 |
+
@param format string - the desired format of the date
|
1133 |
+
@param date Date - the date value to format
|
1134 |
+
@param settings Object - attributes include:
|
1135 |
+
dayNamesShort string[7] - abbreviated names of the days from Sunday (optional)
|
1136 |
+
dayNames string[7] - names of the days from Sunday (optional)
|
1137 |
+
monthNamesShort string[12] - abbreviated names of the months (optional)
|
1138 |
+
monthNames string[12] - names of the months (optional)
|
1139 |
+
@return string - the date in the above format */
|
1140 |
+
formatDate: function (format, date, settings) {
|
1141 |
+
if (!date)
|
1142 |
+
return '';
|
1143 |
+
var dayNamesShort = (settings ? settings.dayNamesShort : null) || this._defaults.dayNamesShort;
|
1144 |
+
var dayNames = (settings ? settings.dayNames : null) || this._defaults.dayNames;
|
1145 |
+
var monthNamesShort = (settings ? settings.monthNamesShort : null) || this._defaults.monthNamesShort;
|
1146 |
+
var monthNames = (settings ? settings.monthNames : null) || this._defaults.monthNames;
|
1147 |
+
// Check whether a format character is doubled
|
1148 |
+
var lookAhead = function(match) {
|
1149 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
1150 |
+
if (matches)
|
1151 |
+
iFormat++;
|
1152 |
+
return matches;
|
1153 |
+
};
|
1154 |
+
// Format a number, with leading zero if necessary
|
1155 |
+
var formatNumber = function(match, value, len) {
|
1156 |
+
var num = '' + value;
|
1157 |
+
if (lookAhead(match))
|
1158 |
+
while (num.length < len)
|
1159 |
+
num = '0' + num;
|
1160 |
+
return num;
|
1161 |
+
};
|
1162 |
+
// Format a name, short or long as requested
|
1163 |
+
var formatName = function(match, value, shortNames, longNames) {
|
1164 |
+
return (lookAhead(match) ? longNames[value] : shortNames[value]);
|
1165 |
+
};
|
1166 |
+
var output = '';
|
1167 |
+
var literal = false;
|
1168 |
+
if (date)
|
1169 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++) {
|
1170 |
+
if (literal)
|
1171 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
1172 |
+
literal = false;
|
1173 |
+
else
|
1174 |
+
output += format.charAt(iFormat);
|
1175 |
+
else
|
1176 |
+
switch (format.charAt(iFormat)) {
|
1177 |
+
case 'd':
|
1178 |
+
output += formatNumber('d', date.getDate(), 2);
|
1179 |
+
break;
|
1180 |
+
case 'D':
|
1181 |
+
output += formatName('D', date.getDay(), dayNamesShort, dayNames);
|
1182 |
+
break;
|
1183 |
+
case 'o':
|
1184 |
+
output += formatNumber('o',
|
1185 |
+
(date.getTime() - new Date(date.getFullYear(), 0, 0).getTime()) / 86400000, 3);
|
1186 |
+
break;
|
1187 |
+
case 'm':
|
1188 |
+
output += formatNumber('m', date.getMonth() + 1, 2);
|
1189 |
+
break;
|
1190 |
+
case 'M':
|
1191 |
+
output += formatName('M', date.getMonth(), monthNamesShort, monthNames);
|
1192 |
+
break;
|
1193 |
+
case 'y':
|
1194 |
+
output += (lookAhead('y') ? date.getFullYear() :
|
1195 |
+
(date.getYear() % 100 < 10 ? '0' : '') + date.getYear() % 100);
|
1196 |
+
break;
|
1197 |
+
case '@':
|
1198 |
+
output += date.getTime();
|
1199 |
+
break;
|
1200 |
+
case '!':
|
1201 |
+
output += date.getTime() * 10000 + this._ticksTo1970;
|
1202 |
+
break;
|
1203 |
+
case "'":
|
1204 |
+
if (lookAhead("'"))
|
1205 |
+
output += "'";
|
1206 |
+
else
|
1207 |
+
literal = true;
|
1208 |
+
break;
|
1209 |
+
default:
|
1210 |
+
output += format.charAt(iFormat);
|
1211 |
+
}
|
1212 |
+
}
|
1213 |
+
return output;
|
1214 |
+
},
|
1215 |
+
|
1216 |
+
/* Extract all possible characters from the date format. */
|
1217 |
+
_possibleChars: function (format) {
|
1218 |
+
var chars = '';
|
1219 |
+
var literal = false;
|
1220 |
+
// Check whether a format character is doubled
|
1221 |
+
var lookAhead = function(match) {
|
1222 |
+
var matches = (iFormat + 1 < format.length && format.charAt(iFormat + 1) == match);
|
1223 |
+
if (matches)
|
1224 |
+
iFormat++;
|
1225 |
+
return matches;
|
1226 |
+
};
|
1227 |
+
for (var iFormat = 0; iFormat < format.length; iFormat++)
|
1228 |
+
if (literal)
|
1229 |
+
if (format.charAt(iFormat) == "'" && !lookAhead("'"))
|
1230 |
+
literal = false;
|
1231 |
+
else
|
1232 |
+
chars += format.charAt(iFormat);
|
1233 |
+
else
|
1234 |
+
switch (format.charAt(iFormat)) {
|
1235 |
+
case 'd': case 'm': case 'y': case '@':
|
1236 |
+
chars += '0123456789';
|
1237 |
+
break;
|
1238 |
+
case 'D': case 'M':
|
1239 |
+
return null; // Accept anything
|
1240 |
+
case "'":
|
1241 |
+
if (lookAhead("'"))
|
1242 |
+
chars += "'";
|
1243 |
+
else
|
1244 |
+
literal = true;
|
1245 |
+
break;
|
1246 |
+
default:
|
1247 |
+
chars += format.charAt(iFormat);
|
1248 |
+
}
|
1249 |
+
return chars;
|
1250 |
+
},
|
1251 |
+
|
1252 |
+
/* Get a setting value, defaulting if necessary. */
|
1253 |
+
_get: function(inst, name) {
|
1254 |
+
return inst.settings[name] !== undefined ?
|
1255 |
+
inst.settings[name] : this._defaults[name];
|
1256 |
+
},
|
1257 |
+
|
1258 |
+
/* Parse existing date and initialise date picker. */
|
1259 |
+
_setDateFromField: function(inst, noDefault) {
|
1260 |
+
if (inst.input.val() == inst.lastVal) {
|
1261 |
+
return;
|
1262 |
+
}
|
1263 |
+
var dateFormat = this._get(inst, 'dateFormat');
|
1264 |
+
var dates = inst.lastVal = inst.input ? inst.input.val() : null;
|
1265 |
+
var date, defaultDate;
|
1266 |
+
date = defaultDate = this._getDefaultDate(inst);
|
1267 |
+
var settings = this._getFormatConfig(inst);
|
1268 |
+
try {
|
1269 |
+
date = this.parseDate(dateFormat, dates, settings) || defaultDate;
|
1270 |
+
} catch (event) {
|
1271 |
+
this.log(event);
|
1272 |
+
dates = (noDefault ? '' : dates);
|
1273 |
+
}
|
1274 |
+
inst.selectedDay = date.getDate();
|
1275 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
1276 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
1277 |
+
inst.currentDay = (dates ? date.getDate() : 0);
|
1278 |
+
inst.currentMonth = (dates ? date.getMonth() : 0);
|
1279 |
+
inst.currentYear = (dates ? date.getFullYear() : 0);
|
1280 |
+
this._adjustInstDate(inst);
|
1281 |
+
},
|
1282 |
+
|
1283 |
+
/* Retrieve the default date shown on opening. */
|
1284 |
+
_getDefaultDate: function(inst) {
|
1285 |
+
return this._restrictMinMax(inst,
|
1286 |
+
this._determineDate(inst, this._get(inst, 'defaultDate'), new Date()));
|
1287 |
+
},
|
1288 |
+
|
1289 |
+
/* A date may be specified as an exact value or a relative one. */
|
1290 |
+
_determineDate: function(inst, date, defaultDate) {
|
1291 |
+
var offsetNumeric = function(offset) {
|
1292 |
+
var date = new Date();
|
1293 |
+
date.setDate(date.getDate() + offset);
|
1294 |
+
return date;
|
1295 |
+
};
|
1296 |
+
var offsetString = function(offset) {
|
1297 |
+
try {
|
1298 |
+
return $.datepicker.parseDate($.datepicker._get(inst, 'dateFormat'),
|
1299 |
+
offset, $.datepicker._getFormatConfig(inst));
|
1300 |
+
}
|
1301 |
+
catch (e) {
|
1302 |
+
// Ignore
|
1303 |
+
}
|
1304 |
+
var date = (offset.toLowerCase().match(/^c/) ?
|
1305 |
+
$.datepicker._getDate(inst) : null) || new Date();
|
1306 |
+
var year = date.getFullYear();
|
1307 |
+
var month = date.getMonth();
|
1308 |
+
var day = date.getDate();
|
1309 |
+
var pattern = /([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;
|
1310 |
+
var matches = pattern.exec(offset);
|
1311 |
+
while (matches) {
|
1312 |
+
switch (matches[2] || 'd') {
|
1313 |
+
case 'd' : case 'D' :
|
1314 |
+
day += parseInt(matches[1],10); break;
|
1315 |
+
case 'w' : case 'W' :
|
1316 |
+
day += parseInt(matches[1],10) * 7; break;
|
1317 |
+
case 'm' : case 'M' :
|
1318 |
+
month += parseInt(matches[1],10);
|
1319 |
+
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
|
1320 |
+
break;
|
1321 |
+
case 'y': case 'Y' :
|
1322 |
+
year += parseInt(matches[1],10);
|
1323 |
+
day = Math.min(day, $.datepicker._getDaysInMonth(year, month));
|
1324 |
+
break;
|
1325 |
+
}
|
1326 |
+
matches = pattern.exec(offset);
|
1327 |
+
}
|
1328 |
+
return new Date(year, month, day);
|
1329 |
+
};
|
1330 |
+
var newDate = (date == null || date === '' ? defaultDate : (typeof date == 'string' ? offsetString(date) :
|
1331 |
+
(typeof date == 'number' ? (isNaN(date) ? defaultDate : offsetNumeric(date)) : new Date(date.getTime()))));
|
1332 |
+
newDate = (newDate && newDate.toString() == 'Invalid Date' ? defaultDate : newDate);
|
1333 |
+
if (newDate) {
|
1334 |
+
newDate.setHours(0);
|
1335 |
+
newDate.setMinutes(0);
|
1336 |
+
newDate.setSeconds(0);
|
1337 |
+
newDate.setMilliseconds(0);
|
1338 |
+
}
|
1339 |
+
return this._daylightSavingAdjust(newDate);
|
1340 |
+
},
|
1341 |
+
|
1342 |
+
/* Handle switch to/from daylight saving.
|
1343 |
+
Hours may be non-zero on daylight saving cut-over:
|
1344 |
+
> 12 when midnight changeover, but then cannot generate
|
1345 |
+
midnight datetime, so jump to 1AM, otherwise reset.
|
1346 |
+
@param date (Date) the date to check
|
1347 |
+
@return (Date) the corrected date */
|
1348 |
+
_daylightSavingAdjust: function(date) {
|
1349 |
+
if (!date) return null;
|
1350 |
+
date.setHours(date.getHours() > 12 ? date.getHours() + 2 : 0);
|
1351 |
+
return date;
|
1352 |
+
},
|
1353 |
+
|
1354 |
+
/* Set the date(s) directly. */
|
1355 |
+
_setDate: function(inst, date, noChange) {
|
1356 |
+
var clear = !date;
|
1357 |
+
var origMonth = inst.selectedMonth;
|
1358 |
+
var origYear = inst.selectedYear;
|
1359 |
+
var newDate = this._restrictMinMax(inst, this._determineDate(inst, date, new Date()));
|
1360 |
+
inst.selectedDay = inst.currentDay = newDate.getDate();
|
1361 |
+
inst.drawMonth = inst.selectedMonth = inst.currentMonth = newDate.getMonth();
|
1362 |
+
inst.drawYear = inst.selectedYear = inst.currentYear = newDate.getFullYear();
|
1363 |
+
if ((origMonth != inst.selectedMonth || origYear != inst.selectedYear) && !noChange)
|
1364 |
+
this._notifyChange(inst);
|
1365 |
+
this._adjustInstDate(inst);
|
1366 |
+
if (inst.input) {
|
1367 |
+
inst.input.val(clear ? '' : this._formatDate(inst));
|
1368 |
+
}
|
1369 |
+
},
|
1370 |
+
|
1371 |
+
/* Retrieve the date(s) directly. */
|
1372 |
+
_getDate: function(inst) {
|
1373 |
+
var startDate = (!inst.currentYear || (inst.input && inst.input.val() == '') ? null :
|
1374 |
+
this._daylightSavingAdjust(new Date(
|
1375 |
+
inst.currentYear, inst.currentMonth, inst.currentDay)));
|
1376 |
+
return startDate;
|
1377 |
+
},
|
1378 |
+
|
1379 |
+
/* Generate the HTML for the current state of the date picker. */
|
1380 |
+
_generateHTML: function(inst) {
|
1381 |
+
var today = new Date();
|
1382 |
+
today = this._daylightSavingAdjust(
|
1383 |
+
new Date(today.getFullYear(), today.getMonth(), today.getDate())); // clear time
|
1384 |
+
var isRTL = this._get(inst, 'isRTL');
|
1385 |
+
var showButtonPanel = this._get(inst, 'showButtonPanel');
|
1386 |
+
var hideIfNoPrevNext = this._get(inst, 'hideIfNoPrevNext');
|
1387 |
+
var navigationAsDateFormat = this._get(inst, 'navigationAsDateFormat');
|
1388 |
+
var numMonths = this._getNumberOfMonths(inst);
|
1389 |
+
var showCurrentAtPos = this._get(inst, 'showCurrentAtPos');
|
1390 |
+
var stepMonths = this._get(inst, 'stepMonths');
|
1391 |
+
var isMultiMonth = (numMonths[0] != 1 || numMonths[1] != 1);
|
1392 |
+
var currentDate = this._daylightSavingAdjust((!inst.currentDay ? new Date(9999, 9, 9) :
|
1393 |
+
new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
|
1394 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
1395 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
1396 |
+
var drawMonth = inst.drawMonth - showCurrentAtPos;
|
1397 |
+
var drawYear = inst.drawYear;
|
1398 |
+
if (drawMonth < 0) {
|
1399 |
+
drawMonth += 12;
|
1400 |
+
drawYear--;
|
1401 |
+
}
|
1402 |
+
if (maxDate) {
|
1403 |
+
var maxDraw = this._daylightSavingAdjust(new Date(maxDate.getFullYear(),
|
1404 |
+
maxDate.getMonth() - (numMonths[0] * numMonths[1]) + 1, maxDate.getDate()));
|
1405 |
+
maxDraw = (minDate && maxDraw < minDate ? minDate : maxDraw);
|
1406 |
+
while (this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1)) > maxDraw) {
|
1407 |
+
drawMonth--;
|
1408 |
+
if (drawMonth < 0) {
|
1409 |
+
drawMonth = 11;
|
1410 |
+
drawYear--;
|
1411 |
+
}
|
1412 |
+
}
|
1413 |
+
}
|
1414 |
+
inst.drawMonth = drawMonth;
|
1415 |
+
inst.drawYear = drawYear;
|
1416 |
+
var prevText = this._get(inst, 'prevText');
|
1417 |
+
prevText = (!navigationAsDateFormat ? prevText : this.formatDate(prevText,
|
1418 |
+
this._daylightSavingAdjust(new Date(drawYear, drawMonth - stepMonths, 1)),
|
1419 |
+
this._getFormatConfig(inst)));
|
1420 |
+
var prev = (this._canAdjustMonth(inst, -1, drawYear, drawMonth) ?
|
1421 |
+
'<a class="ui-datepicker-prev ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
1422 |
+
'.datepicker._adjustDate(\'#' + inst.id + '\', -' + stepMonths + ', \'M\');"' +
|
1423 |
+
' title="' + prevText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>' :
|
1424 |
+
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+ prevText +'"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'e' : 'w') + '">' + prevText + '</span></a>'));
|
1425 |
+
var nextText = this._get(inst, 'nextText');
|
1426 |
+
nextText = (!navigationAsDateFormat ? nextText : this.formatDate(nextText,
|
1427 |
+
this._daylightSavingAdjust(new Date(drawYear, drawMonth + stepMonths, 1)),
|
1428 |
+
this._getFormatConfig(inst)));
|
1429 |
+
var next = (this._canAdjustMonth(inst, +1, drawYear, drawMonth) ?
|
1430 |
+
'<a class="ui-datepicker-next ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
1431 |
+
'.datepicker._adjustDate(\'#' + inst.id + '\', +' + stepMonths + ', \'M\');"' +
|
1432 |
+
' title="' + nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>' :
|
1433 |
+
(hideIfNoPrevNext ? '' : '<a class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+ nextText + '"><span class="ui-icon ui-icon-circle-triangle-' + ( isRTL ? 'w' : 'e') + '">' + nextText + '</span></a>'));
|
1434 |
+
var currentText = this._get(inst, 'currentText');
|
1435 |
+
var gotoDate = (this._get(inst, 'gotoCurrent') && inst.currentDay ? currentDate : today);
|
1436 |
+
currentText = (!navigationAsDateFormat ? currentText :
|
1437 |
+
this.formatDate(currentText, gotoDate, this._getFormatConfig(inst)));
|
1438 |
+
var controls = (!inst.inline ? '<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
1439 |
+
'.datepicker._hideDatepicker();">' + this._get(inst, 'closeText') + '</button>' : '');
|
1440 |
+
var buttonPanel = (showButtonPanel) ? '<div class="ui-datepicker-buttonpane ui-widget-content">' + (isRTL ? controls : '') +
|
1441 |
+
(this._isInRange(inst, gotoDate) ? '<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_jQuery_' + dpuuid +
|
1442 |
+
'.datepicker._gotoToday(\'#' + inst.id + '\');"' +
|
1443 |
+
'>' + currentText + '</button>' : '') + (isRTL ? '' : controls) + '</div>' : '';
|
1444 |
+
var firstDay = parseInt(this._get(inst, 'firstDay'),10);
|
1445 |
+
firstDay = (isNaN(firstDay) ? 0 : firstDay);
|
1446 |
+
var showWeek = this._get(inst, 'showWeek');
|
1447 |
+
var dayNames = this._get(inst, 'dayNames');
|
1448 |
+
var dayNamesShort = this._get(inst, 'dayNamesShort');
|
1449 |
+
var dayNamesMin = this._get(inst, 'dayNamesMin');
|
1450 |
+
var monthNames = this._get(inst, 'monthNames');
|
1451 |
+
var monthNamesShort = this._get(inst, 'monthNamesShort');
|
1452 |
+
var beforeShowDay = this._get(inst, 'beforeShowDay');
|
1453 |
+
var showOtherMonths = this._get(inst, 'showOtherMonths');
|
1454 |
+
var selectOtherMonths = this._get(inst, 'selectOtherMonths');
|
1455 |
+
var calculateWeek = this._get(inst, 'calculateWeek') || this.iso8601Week;
|
1456 |
+
var defaultDate = this._getDefaultDate(inst);
|
1457 |
+
var html = '';
|
1458 |
+
for (var row = 0; row < numMonths[0]; row++) {
|
1459 |
+
var group = '';
|
1460 |
+
for (var col = 0; col < numMonths[1]; col++) {
|
1461 |
+
var selectedDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, inst.selectedDay));
|
1462 |
+
var cornerClass = ' ui-corner-all';
|
1463 |
+
var calender = '';
|
1464 |
+
if (isMultiMonth) {
|
1465 |
+
calender += '<div class="ui-datepicker-group';
|
1466 |
+
if (numMonths[1] > 1)
|
1467 |
+
switch (col) {
|
1468 |
+
case 0: calender += ' ui-datepicker-group-first';
|
1469 |
+
cornerClass = ' ui-corner-' + (isRTL ? 'right' : 'left'); break;
|
1470 |
+
case numMonths[1]-1: calender += ' ui-datepicker-group-last';
|
1471 |
+
cornerClass = ' ui-corner-' + (isRTL ? 'left' : 'right'); break;
|
1472 |
+
default: calender += ' ui-datepicker-group-middle'; cornerClass = ''; break;
|
1473 |
+
}
|
1474 |
+
calender += '">';
|
1475 |
+
}
|
1476 |
+
calender += '<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix' + cornerClass + '">' +
|
1477 |
+
(/all|left/.test(cornerClass) && row == 0 ? (isRTL ? next : prev) : '') +
|
1478 |
+
(/all|right/.test(cornerClass) && row == 0 ? (isRTL ? prev : next) : '') +
|
1479 |
+
this._generateMonthYearHeader(inst, drawMonth, drawYear, minDate, maxDate,
|
1480 |
+
row > 0 || col > 0, monthNames, monthNamesShort) + // draw month headers
|
1481 |
+
'</div><table class="ui-datepicker-calendar"><thead>' +
|
1482 |
+
'<tr>';
|
1483 |
+
var thead = (showWeek ? '<th class="ui-datepicker-week-col">' + this._get(inst, 'weekHeader') + '</th>' : '');
|
1484 |
+
for (var dow = 0; dow < 7; dow++) { // days of the week
|
1485 |
+
var day = (dow + firstDay) % 7;
|
1486 |
+
thead += '<th' + ((dow + firstDay + 6) % 7 >= 5 ? ' class="ui-datepicker-week-end"' : '') + '>' +
|
1487 |
+
'<span title="' + dayNames[day] + '">' + dayNamesMin[day] + '</span></th>';
|
1488 |
+
}
|
1489 |
+
calender += thead + '</tr></thead><tbody>';
|
1490 |
+
var daysInMonth = this._getDaysInMonth(drawYear, drawMonth);
|
1491 |
+
if (drawYear == inst.selectedYear && drawMonth == inst.selectedMonth)
|
1492 |
+
inst.selectedDay = Math.min(inst.selectedDay, daysInMonth);
|
1493 |
+
var leadDays = (this._getFirstDayOfMonth(drawYear, drawMonth) - firstDay + 7) % 7;
|
1494 |
+
var numRows = (isMultiMonth ? 6 : Math.ceil((leadDays + daysInMonth) / 7)); // calculate the number of rows to generate
|
1495 |
+
var printDate = this._daylightSavingAdjust(new Date(drawYear, drawMonth, 1 - leadDays));
|
1496 |
+
for (var dRow = 0; dRow < numRows; dRow++) { // create date picker rows
|
1497 |
+
calender += '<tr>';
|
1498 |
+
var tbody = (!showWeek ? '' : '<td class="ui-datepicker-week-col">' +
|
1499 |
+
this._get(inst, 'calculateWeek')(printDate) + '</td>');
|
1500 |
+
for (var dow = 0; dow < 7; dow++) { // create date picker days
|
1501 |
+
var daySettings = (beforeShowDay ?
|
1502 |
+
beforeShowDay.apply((inst.input ? inst.input[0] : null), [printDate]) : [true, '']);
|
1503 |
+
var otherMonth = (printDate.getMonth() != drawMonth);
|
1504 |
+
var unselectable = (otherMonth && !selectOtherMonths) || !daySettings[0] ||
|
1505 |
+
(minDate && printDate < minDate) || (maxDate && printDate > maxDate);
|
1506 |
+
tbody += '<td class="' +
|
1507 |
+
((dow + firstDay + 6) % 7 >= 5 ? ' ui-datepicker-week-end' : '') + // highlight weekends
|
1508 |
+
(otherMonth ? ' ui-datepicker-other-month' : '') + // highlight days from other months
|
1509 |
+
((printDate.getTime() == selectedDate.getTime() && drawMonth == inst.selectedMonth && inst._keyEvent) || // user pressed key
|
1510 |
+
(defaultDate.getTime() == printDate.getTime() && defaultDate.getTime() == selectedDate.getTime()) ?
|
1511 |
+
// or defaultDate is current printedDate and defaultDate is selectedDate
|
1512 |
+
' ' + this._dayOverClass : '') + // highlight selected day
|
1513 |
+
(unselectable ? ' ' + this._unselectableClass + ' ui-state-disabled': '') + // highlight unselectable days
|
1514 |
+
(otherMonth && !showOtherMonths ? '' : ' ' + daySettings[1] + // highlight custom dates
|
1515 |
+
(printDate.getTime() == currentDate.getTime() ? ' ' + this._currentClass : '') + // highlight selected day
|
1516 |
+
(printDate.getTime() == today.getTime() ? ' ui-datepicker-today' : '')) + '"' + // highlight today (if different)
|
1517 |
+
((!otherMonth || showOtherMonths) && daySettings[2] ? ' title="' + daySettings[2] + '"' : '') + // cell title
|
1518 |
+
(unselectable ? '' : ' onclick="DP_jQuery_' + dpuuid + '.datepicker._selectDay(\'#' +
|
1519 |
+
inst.id + '\',' + printDate.getMonth() + ',' + printDate.getFullYear() + ', this);return false;"') + '>' + // actions
|
1520 |
+
(otherMonth && !showOtherMonths ? ' ' : // display for other months
|
1521 |
+
(unselectable ? '<span class="ui-state-default">' + printDate.getDate() + '</span>' : '<a class="ui-state-default' +
|
1522 |
+
(printDate.getTime() == today.getTime() ? ' ui-state-highlight' : '') +
|
1523 |
+
(printDate.getTime() == currentDate.getTime() ? ' ui-state-active' : '') + // highlight selected day
|
1524 |
+
(otherMonth ? ' ui-priority-secondary' : '') + // distinguish dates from other months
|
1525 |
+
'" href="#">' + printDate.getDate() + '</a>')) + '</td>'; // display selectable date
|
1526 |
+
printDate.setDate(printDate.getDate() + 1);
|
1527 |
+
printDate = this._daylightSavingAdjust(printDate);
|
1528 |
+
}
|
1529 |
+
calender += tbody + '</tr>';
|
1530 |
+
}
|
1531 |
+
drawMonth++;
|
1532 |
+
if (drawMonth > 11) {
|
1533 |
+
drawMonth = 0;
|
1534 |
+
drawYear++;
|
1535 |
+
}
|
1536 |
+
calender += '</tbody></table>' + (isMultiMonth ? '</div>' +
|
1537 |
+
((numMonths[0] > 0 && col == numMonths[1]-1) ? '<div class="ui-datepicker-row-break"></div>' : '') : '');
|
1538 |
+
group += calender;
|
1539 |
+
}
|
1540 |
+
html += group;
|
1541 |
+
}
|
1542 |
+
html += buttonPanel + ($.browser.msie && parseInt($.browser.version,10) < 7 && !inst.inline ?
|
1543 |
+
'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>' : '');
|
1544 |
+
inst._keyEvent = false;
|
1545 |
+
return html;
|
1546 |
+
},
|
1547 |
+
|
1548 |
+
/* Generate the month and year header. */
|
1549 |
+
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
|
1550 |
+
secondary, monthNames, monthNamesShort) {
|
1551 |
+
var changeMonth = this._get(inst, 'changeMonth');
|
1552 |
+
var changeYear = this._get(inst, 'changeYear');
|
1553 |
+
var showMonthAfterYear = this._get(inst, 'showMonthAfterYear');
|
1554 |
+
var html = '<div class="ui-datepicker-title">';
|
1555 |
+
var monthHtml = '';
|
1556 |
+
// month selection
|
1557 |
+
if (secondary || !changeMonth)
|
1558 |
+
monthHtml += '<span class="ui-datepicker-month">' + monthNames[drawMonth] + '</span>';
|
1559 |
+
else {
|
1560 |
+
var inMinYear = (minDate && minDate.getFullYear() == drawYear);
|
1561 |
+
var inMaxYear = (maxDate && maxDate.getFullYear() == drawYear);
|
1562 |
+
monthHtml += '<select class="ui-datepicker-month" ' +
|
1563 |
+
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'M\');" ' +
|
1564 |
+
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
|
1565 |
+
'>';
|
1566 |
+
for (var month = 0; month < 12; month++) {
|
1567 |
+
if ((!inMinYear || month >= minDate.getMonth()) &&
|
1568 |
+
(!inMaxYear || month <= maxDate.getMonth()))
|
1569 |
+
monthHtml += '<option value="' + month + '"' +
|
1570 |
+
(month == drawMonth ? ' selected="selected"' : '') +
|
1571 |
+
'>' + monthNamesShort[month] + '</option>';
|
1572 |
+
}
|
1573 |
+
monthHtml += '</select>';
|
1574 |
+
}
|
1575 |
+
if (!showMonthAfterYear)
|
1576 |
+
html += monthHtml + (secondary || !(changeMonth && changeYear) ? ' ' : '');
|
1577 |
+
// year selection
|
1578 |
+
inst.yearshtml = '';
|
1579 |
+
if (secondary || !changeYear)
|
1580 |
+
html += '<span class="ui-datepicker-year">' + drawYear + '</span>';
|
1581 |
+
else {
|
1582 |
+
// determine range of years to display
|
1583 |
+
var years = this._get(inst, 'yearRange').split(':');
|
1584 |
+
var thisYear = new Date().getFullYear();
|
1585 |
+
var determineYear = function(value) {
|
1586 |
+
var year = (value.match(/c[+-].*/) ? drawYear + parseInt(value.substring(1), 10) :
|
1587 |
+
(value.match(/[+-].*/) ? thisYear + parseInt(value, 10) :
|
1588 |
+
parseInt(value, 10)));
|
1589 |
+
return (isNaN(year) ? thisYear : year);
|
1590 |
+
};
|
1591 |
+
var year = determineYear(years[0]);
|
1592 |
+
var endYear = Math.max(year, determineYear(years[1] || ''));
|
1593 |
+
year = (minDate ? Math.max(year, minDate.getFullYear()) : year);
|
1594 |
+
endYear = (maxDate ? Math.min(endYear, maxDate.getFullYear()) : endYear);
|
1595 |
+
inst.yearshtml += '<select class="ui-datepicker-year" ' +
|
1596 |
+
'onchange="DP_jQuery_' + dpuuid + '.datepicker._selectMonthYear(\'#' + inst.id + '\', this, \'Y\');" ' +
|
1597 |
+
'onclick="DP_jQuery_' + dpuuid + '.datepicker._clickMonthYear(\'#' + inst.id + '\');"' +
|
1598 |
+
'>';
|
1599 |
+
for (; year <= endYear; year++) {
|
1600 |
+
inst.yearshtml += '<option value="' + year + '"' +
|
1601 |
+
(year == drawYear ? ' selected="selected"' : '') +
|
1602 |
+
'>' + year + '</option>';
|
1603 |
+
}
|
1604 |
+
inst.yearshtml += '</select>';
|
1605 |
+
//when showing there is no need for later update
|
1606 |
+
if( ! $.browser.mozilla ){
|
1607 |
+
html += inst.yearshtml;
|
1608 |
+
inst.yearshtml = null;
|
1609 |
+
} else {
|
1610 |
+
// will be replaced later with inst.yearshtml
|
1611 |
+
html += '<select class="ui-datepicker-year"><option value="' + drawYear + '" selected="selected">' + drawYear + '</option></select>';
|
1612 |
+
}
|
1613 |
+
}
|
1614 |
+
html += this._get(inst, 'yearSuffix');
|
1615 |
+
if (showMonthAfterYear)
|
1616 |
+
html += (secondary || !(changeMonth && changeYear) ? ' ' : '') + monthHtml;
|
1617 |
+
html += '</div>'; // Close datepicker_header
|
1618 |
+
return html;
|
1619 |
+
},
|
1620 |
+
|
1621 |
+
/* Adjust one of the date sub-fields. */
|
1622 |
+
_adjustInstDate: function(inst, offset, period) {
|
1623 |
+
var year = inst.drawYear + (period == 'Y' ? offset : 0);
|
1624 |
+
var month = inst.drawMonth + (period == 'M' ? offset : 0);
|
1625 |
+
var day = Math.min(inst.selectedDay, this._getDaysInMonth(year, month)) +
|
1626 |
+
(period == 'D' ? offset : 0);
|
1627 |
+
var date = this._restrictMinMax(inst,
|
1628 |
+
this._daylightSavingAdjust(new Date(year, month, day)));
|
1629 |
+
inst.selectedDay = date.getDate();
|
1630 |
+
inst.drawMonth = inst.selectedMonth = date.getMonth();
|
1631 |
+
inst.drawYear = inst.selectedYear = date.getFullYear();
|
1632 |
+
if (period == 'M' || period == 'Y')
|
1633 |
+
this._notifyChange(inst);
|
1634 |
+
},
|
1635 |
+
|
1636 |
+
/* Ensure a date is within any min/max bounds. */
|
1637 |
+
_restrictMinMax: function(inst, date) {
|
1638 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
1639 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
1640 |
+
var newDate = (minDate && date < minDate ? minDate : date);
|
1641 |
+
newDate = (maxDate && newDate > maxDate ? maxDate : newDate);
|
1642 |
+
return newDate;
|
1643 |
+
},
|
1644 |
+
|
1645 |
+
/* Notify change of month/year. */
|
1646 |
+
_notifyChange: function(inst) {
|
1647 |
+
var onChange = this._get(inst, 'onChangeMonthYear');
|
1648 |
+
if (onChange)
|
1649 |
+
onChange.apply((inst.input ? inst.input[0] : null),
|
1650 |
+
[inst.selectedYear, inst.selectedMonth + 1, inst]);
|
1651 |
+
},
|
1652 |
+
|
1653 |
+
/* Determine the number of months to show. */
|
1654 |
+
_getNumberOfMonths: function(inst) {
|
1655 |
+
var numMonths = this._get(inst, 'numberOfMonths');
|
1656 |
+
return (numMonths == null ? [1, 1] : (typeof numMonths == 'number' ? [1, numMonths] : numMonths));
|
1657 |
+
},
|
1658 |
+
|
1659 |
+
/* Determine the current maximum date - ensure no time components are set. */
|
1660 |
+
_getMinMaxDate: function(inst, minMax) {
|
1661 |
+
return this._determineDate(inst, this._get(inst, minMax + 'Date'), null);
|
1662 |
+
},
|
1663 |
+
|
1664 |
+
/* Find the number of days in a given month. */
|
1665 |
+
_getDaysInMonth: function(year, month) {
|
1666 |
+
return 32 - this._daylightSavingAdjust(new Date(year, month, 32)).getDate();
|
1667 |
+
},
|
1668 |
+
|
1669 |
+
/* Find the day of the week of the first of a month. */
|
1670 |
+
_getFirstDayOfMonth: function(year, month) {
|
1671 |
+
return new Date(year, month, 1).getDay();
|
1672 |
+
},
|
1673 |
+
|
1674 |
+
/* Determines if we should allow a "next/prev" month display change. */
|
1675 |
+
_canAdjustMonth: function(inst, offset, curYear, curMonth) {
|
1676 |
+
var numMonths = this._getNumberOfMonths(inst);
|
1677 |
+
var date = this._daylightSavingAdjust(new Date(curYear,
|
1678 |
+
curMonth + (offset < 0 ? offset : numMonths[0] * numMonths[1]), 1));
|
1679 |
+
if (offset < 0)
|
1680 |
+
date.setDate(this._getDaysInMonth(date.getFullYear(), date.getMonth()));
|
1681 |
+
return this._isInRange(inst, date);
|
1682 |
+
},
|
1683 |
+
|
1684 |
+
/* Is the given date in the accepted range? */
|
1685 |
+
_isInRange: function(inst, date) {
|
1686 |
+
var minDate = this._getMinMaxDate(inst, 'min');
|
1687 |
+
var maxDate = this._getMinMaxDate(inst, 'max');
|
1688 |
+
return ((!minDate || date.getTime() >= minDate.getTime()) &&
|
1689 |
+
(!maxDate || date.getTime() <= maxDate.getTime()));
|
1690 |
+
},
|
1691 |
+
|
1692 |
+
/* Provide the configuration settings for formatting/parsing. */
|
1693 |
+
_getFormatConfig: function(inst) {
|
1694 |
+
var shortYearCutoff = this._get(inst, 'shortYearCutoff');
|
1695 |
+
shortYearCutoff = (typeof shortYearCutoff != 'string' ? shortYearCutoff :
|
1696 |
+
new Date().getFullYear() % 100 + parseInt(shortYearCutoff, 10));
|
1697 |
+
return {shortYearCutoff: shortYearCutoff,
|
1698 |
+
dayNamesShort: this._get(inst, 'dayNamesShort'), dayNames: this._get(inst, 'dayNames'),
|
1699 |
+
monthNamesShort: this._get(inst, 'monthNamesShort'), monthNames: this._get(inst, 'monthNames')};
|
1700 |
+
},
|
1701 |
+
|
1702 |
+
/* Format the given date for display. */
|
1703 |
+
_formatDate: function(inst, day, month, year) {
|
1704 |
+
if (!day) {
|
1705 |
+
inst.currentDay = inst.selectedDay;
|
1706 |
+
inst.currentMonth = inst.selectedMonth;
|
1707 |
+
inst.currentYear = inst.selectedYear;
|
1708 |
+
}
|
1709 |
+
var date = (day ? (typeof day == 'object' ? day :
|
1710 |
+
this._daylightSavingAdjust(new Date(year, month, day))) :
|
1711 |
+
this._daylightSavingAdjust(new Date(inst.currentYear, inst.currentMonth, inst.currentDay)));
|
1712 |
+
return this.formatDate(this._get(inst, 'dateFormat'), date, this._getFormatConfig(inst));
|
1713 |
+
}
|
1714 |
+
});
|
1715 |
+
|
1716 |
+
/* jQuery extend now ignores nulls! */
|
1717 |
+
function extendRemove(target, props) {
|
1718 |
+
$.extend(target, props);
|
1719 |
+
for (var name in props)
|
1720 |
+
if (props[name] == null || props[name] == undefined)
|
1721 |
+
target[name] = props[name];
|
1722 |
+
return target;
|
1723 |
+
};
|
1724 |
+
|
1725 |
+
/* Determine whether an object is an array. */
|
1726 |
+
function isArray(a) {
|
1727 |
+
return (a && (($.browser.safari && typeof a == 'object' && a.length) ||
|
1728 |
+
(a.constructor && a.constructor.toString().match(/\Array\(\)/))));
|
1729 |
+
};
|
1730 |
+
|
1731 |
+
/* Invoke the datepicker functionality.
|
1732 |
+
@param options string - a command, optionally followed by additional parameters or
|
1733 |
+
Object - settings for attaching new datepicker functionality
|
1734 |
+
@return jQuery object */
|
1735 |
+
$.fn.datepicker = function(options){
|
1736 |
+
|
1737 |
+
/* Verify an empty collection wasn't passed - Fixes #6976 */
|
1738 |
+
if ( !this.length ) {
|
1739 |
+
return this;
|
1740 |
+
}
|
1741 |
+
|
1742 |
+
/* Initialise the date picker. */
|
1743 |
+
if (!$.datepicker.initialized) {
|
1744 |
+
$(document).mousedown($.datepicker._checkExternalClick).
|
1745 |
+
find('body').append($.datepicker.dpDiv);
|
1746 |
+
$.datepicker.initialized = true;
|
1747 |
+
}
|
1748 |
+
|
1749 |
+
var otherArgs = Array.prototype.slice.call(arguments, 1);
|
1750 |
+
if (typeof options == 'string' && (options == 'isDisabled' || options == 'getDate' || options == 'widget'))
|
1751 |
+
return $.datepicker['_' + options + 'Datepicker'].
|
1752 |
+
apply($.datepicker, [this[0]].concat(otherArgs));
|
1753 |
+
if (options == 'option' && arguments.length == 2 && typeof arguments[1] == 'string')
|
1754 |
+
return $.datepicker['_' + options + 'Datepicker'].
|
1755 |
+
apply($.datepicker, [this[0]].concat(otherArgs));
|
1756 |
+
return this.each(function() {
|
1757 |
+
typeof options == 'string' ?
|
1758 |
+
$.datepicker['_' + options + 'Datepicker'].
|
1759 |
+
apply($.datepicker, [this].concat(otherArgs)) :
|
1760 |
+
$.datepicker._attachDatepicker(this, options);
|
1761 |
+
});
|
1762 |
+
};
|
1763 |
+
|
1764 |
+
$.datepicker = new Datepicker(); // singleton instance
|
1765 |
+
$.datepicker.initialized = false;
|
1766 |
+
$.datepicker.uuid = new Date().getTime();
|
1767 |
+
$.datepicker.version = "1.8.11";
|
1768 |
+
|
1769 |
+
// Workaround for #4055
|
1770 |
+
// Add another global to avoid noConflict issues with inline event handlers
|
1771 |
+
window['DP_jQuery_' + dpuuid] = $;
|
1772 |
+
|
1773 |
+
})(jQuery);
|
core/fields/date_picker/style.date_picker.css
ADDED
@@ -0,0 +1,362 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
* jQuery UI CSS Framework 1.8.11
|
3 |
+
*
|
4 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
5 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
6 |
+
* http://jquery.org/license
|
7 |
+
*
|
8 |
+
* http://docs.jquery.com/UI/Theming/API
|
9 |
+
*/
|
10 |
+
|
11 |
+
/* Layout helpers
|
12 |
+
----------------------------------*/
|
13 |
+
.ui-helper-hidden { display: none; }
|
14 |
+
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
|
15 |
+
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
16 |
+
.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; }
|
17 |
+
.ui-helper-clearfix { display: inline-block; }
|
18 |
+
/* required comment for clearfix to work in Opera \*/
|
19 |
+
* html .ui-helper-clearfix { height:1%; }
|
20 |
+
.ui-helper-clearfix { display:block; }
|
21 |
+
/* end clearfix */
|
22 |
+
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
23 |
+
|
24 |
+
|
25 |
+
/* Interaction Cues
|
26 |
+
----------------------------------*/
|
27 |
+
.ui-state-disabled { cursor: default !important; }
|
28 |
+
|
29 |
+
|
30 |
+
/* Icons
|
31 |
+
----------------------------------*/
|
32 |
+
|
33 |
+
/* states and images */
|
34 |
+
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
35 |
+
|
36 |
+
|
37 |
+
/* Misc visuals
|
38 |
+
----------------------------------*/
|
39 |
+
|
40 |
+
/* Overlays */
|
41 |
+
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
42 |
+
|
43 |
+
|
44 |
+
/*
|
45 |
+
* jQuery UI CSS Framework 1.8.11
|
46 |
+
*
|
47 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
48 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
49 |
+
* http://jquery.org/license
|
50 |
+
*
|
51 |
+
* http://docs.jquery.com/UI/Theming/API
|
52 |
+
*
|
53 |
+
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Lucida%20Grande,%20Lucida%20Sans,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=5px&bgColorHeader=5c9ccc&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=55&borderColorHeader=4297d7&fcHeader=ffffff&iconColorHeader=d8e7f3&bgColorContent=fcfdfd&bgTextureContent=06_inset_hard.png&bgImgOpacityContent=100&borderColorContent=a6c9e2&fcContent=222222&iconColorContent=469bdd&bgColorDefault=dfeffc&bgTextureDefault=02_glass.png&bgImgOpacityDefault=85&borderColorDefault=c5dbec&fcDefault=2e6e9e&iconColorDefault=6da8d5&bgColorHover=d0e5f5&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=79b7e7&fcHover=1d5987&iconColorHover=217bc0&bgColorActive=f5f8f9&bgTextureActive=06_inset_hard.png&bgImgOpacityActive=100&borderColorActive=79b7e7&fcActive=e17009&iconColorActive=f9bd01&bgColorHighlight=fbec88&bgTextureHighlight=01_flat.png&bgImgOpacityHighlight=55&borderColorHighlight=fad42e&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px
|
54 |
+
*/
|
55 |
+
|
56 |
+
|
57 |
+
/* Component containers
|
58 |
+
----------------------------------*/
|
59 |
+
.ui-widget { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1.1em; }
|
60 |
+
.ui-widget .ui-widget { font-size: 1em; }
|
61 |
+
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Lucida Grande, Lucida Sans, Arial, sans-serif; font-size: 1em; }
|
62 |
+
.ui-widget-content { border: 1px solid #a6c9e2; background: #fcfdfd url(images/ui-bg_inset-hard_100_fcfdfd_1x100.png) 50% bottom repeat-x; color: #222222; }
|
63 |
+
.ui-widget-content a { color: #222222; }
|
64 |
+
.ui-widget-header { border: 1px solid #4297d7; background: #5c9ccc url(images/ui-bg_gloss-wave_55_5c9ccc_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
|
65 |
+
.ui-widget-header a { color: #ffffff; }
|
66 |
+
|
67 |
+
/* Interaction states
|
68 |
+
----------------------------------*/
|
69 |
+
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #c5dbec; background: #dfeffc url(images/ui-bg_glass_85_dfeffc_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #2e6e9e; }
|
70 |
+
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #2e6e9e; text-decoration: none; }
|
71 |
+
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #79b7e7; background: #d0e5f5 url(images/ui-bg_glass_75_d0e5f5_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1d5987; }
|
72 |
+
.ui-state-hover a, .ui-state-hover a:hover { color: #1d5987; text-decoration: none; }
|
73 |
+
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #79b7e7; background: #f5f8f9 url(images/ui-bg_inset-hard_100_f5f8f9_1x100.png) 50% 50% repeat-x; font-weight: bold; color: #e17009; }
|
74 |
+
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #e17009; text-decoration: none; }
|
75 |
+
.ui-widget :active { outline: none; }
|
76 |
+
|
77 |
+
/* Interaction Cues
|
78 |
+
----------------------------------*/
|
79 |
+
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fad42e; background: #fbec88 url(images/ui-bg_flat_55_fbec88_40x100.png) 50% 50% repeat-x; color: #363636; }
|
80 |
+
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
81 |
+
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; }
|
82 |
+
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
83 |
+
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
84 |
+
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
85 |
+
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
86 |
+
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
87 |
+
|
88 |
+
/* Icons
|
89 |
+
----------------------------------*/
|
90 |
+
|
91 |
+
/* states and images */
|
92 |
+
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_469bdd_256x240.png); }
|
93 |
+
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_469bdd_256x240.png); }
|
94 |
+
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_d8e7f3_256x240.png); }
|
95 |
+
.ui-state-default .ui-icon { background-image: url(images/ui-icons_6da8d5_256x240.png); }
|
96 |
+
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_217bc0_256x240.png); }
|
97 |
+
.ui-state-active .ui-icon {background-image: url(images/ui-icons_f9bd01_256x240.png); }
|
98 |
+
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); }
|
99 |
+
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); }
|
100 |
+
|
101 |
+
/* positioning */
|
102 |
+
.ui-icon-carat-1-n { background-position: 0 0; }
|
103 |
+
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
104 |
+
.ui-icon-carat-1-e { background-position: -32px 0; }
|
105 |
+
.ui-icon-carat-1-se { background-position: -48px 0; }
|
106 |
+
.ui-icon-carat-1-s { background-position: -64px 0; }
|
107 |
+
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
108 |
+
.ui-icon-carat-1-w { background-position: -96px 0; }
|
109 |
+
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
110 |
+
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
111 |
+
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
112 |
+
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
113 |
+
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
114 |
+
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
115 |
+
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
116 |
+
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
117 |
+
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
118 |
+
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
119 |
+
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
120 |
+
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
121 |
+
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
122 |
+
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
123 |
+
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
124 |
+
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
125 |
+
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
126 |
+
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
127 |
+
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
128 |
+
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
129 |
+
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
130 |
+
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
131 |
+
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
132 |
+
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
133 |
+
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
134 |
+
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
135 |
+
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
136 |
+
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
137 |
+
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
138 |
+
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
139 |
+
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
140 |
+
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
141 |
+
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
142 |
+
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
143 |
+
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
144 |
+
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
145 |
+
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
146 |
+
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
147 |
+
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
148 |
+
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
149 |
+
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
150 |
+
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
151 |
+
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
152 |
+
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
153 |
+
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
154 |
+
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
155 |
+
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
156 |
+
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
157 |
+
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
158 |
+
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
159 |
+
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
160 |
+
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
161 |
+
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
162 |
+
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
163 |
+
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
164 |
+
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
165 |
+
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
166 |
+
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
167 |
+
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
168 |
+
.ui-icon-extlink { background-position: -32px -80px; }
|
169 |
+
.ui-icon-newwin { background-position: -48px -80px; }
|
170 |
+
.ui-icon-refresh { background-position: -64px -80px; }
|
171 |
+
.ui-icon-shuffle { background-position: -80px -80px; }
|
172 |
+
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
173 |
+
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
174 |
+
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
175 |
+
.ui-icon-folder-open { background-position: -16px -96px; }
|
176 |
+
.ui-icon-document { background-position: -32px -96px; }
|
177 |
+
.ui-icon-document-b { background-position: -48px -96px; }
|
178 |
+
.ui-icon-note { background-position: -64px -96px; }
|
179 |
+
.ui-icon-mail-closed { background-position: -80px -96px; }
|
180 |
+
.ui-icon-mail-open { background-position: -96px -96px; }
|
181 |
+
.ui-icon-suitcase { background-position: -112px -96px; }
|
182 |
+
.ui-icon-comment { background-position: -128px -96px; }
|
183 |
+
.ui-icon-person { background-position: -144px -96px; }
|
184 |
+
.ui-icon-print { background-position: -160px -96px; }
|
185 |
+
.ui-icon-trash { background-position: -176px -96px; }
|
186 |
+
.ui-icon-locked { background-position: -192px -96px; }
|
187 |
+
.ui-icon-unlocked { background-position: -208px -96px; }
|
188 |
+
.ui-icon-bookmark { background-position: -224px -96px; }
|
189 |
+
.ui-icon-tag { background-position: -240px -96px; }
|
190 |
+
.ui-icon-home { background-position: 0 -112px; }
|
191 |
+
.ui-icon-flag { background-position: -16px -112px; }
|
192 |
+
.ui-icon-calendar { background-position: -32px -112px; }
|
193 |
+
.ui-icon-cart { background-position: -48px -112px; }
|
194 |
+
.ui-icon-pencil { background-position: -64px -112px; }
|
195 |
+
.ui-icon-clock { background-position: -80px -112px; }
|
196 |
+
.ui-icon-disk { background-position: -96px -112px; }
|
197 |
+
.ui-icon-calculator { background-position: -112px -112px; }
|
198 |
+
.ui-icon-zoomin { background-position: -128px -112px; }
|
199 |
+
.ui-icon-zoomout { background-position: -144px -112px; }
|
200 |
+
.ui-icon-search { background-position: -160px -112px; }
|
201 |
+
.ui-icon-wrench { background-position: -176px -112px; }
|
202 |
+
.ui-icon-gear { background-position: -192px -112px; }
|
203 |
+
.ui-icon-heart { background-position: -208px -112px; }
|
204 |
+
.ui-icon-star { background-position: -224px -112px; }
|
205 |
+
.ui-icon-link { background-position: -240px -112px; }
|
206 |
+
.ui-icon-cancel { background-position: 0 -128px; }
|
207 |
+
.ui-icon-plus { background-position: -16px -128px; }
|
208 |
+
.ui-icon-plusthick { background-position: -32px -128px; }
|
209 |
+
.ui-icon-minus { background-position: -48px -128px; }
|
210 |
+
.ui-icon-minusthick { background-position: -64px -128px; }
|
211 |
+
.ui-icon-close { background-position: -80px -128px; }
|
212 |
+
.ui-icon-closethick { background-position: -96px -128px; }
|
213 |
+
.ui-icon-key { background-position: -112px -128px; }
|
214 |
+
.ui-icon-lightbulb { background-position: -128px -128px; }
|
215 |
+
.ui-icon-scissors { background-position: -144px -128px; }
|
216 |
+
.ui-icon-clipboard { background-position: -160px -128px; }
|
217 |
+
.ui-icon-copy { background-position: -176px -128px; }
|
218 |
+
.ui-icon-contact { background-position: -192px -128px; }
|
219 |
+
.ui-icon-image { background-position: -208px -128px; }
|
220 |
+
.ui-icon-video { background-position: -224px -128px; }
|
221 |
+
.ui-icon-script { background-position: -240px -128px; }
|
222 |
+
.ui-icon-alert { background-position: 0 -144px; }
|
223 |
+
.ui-icon-info { background-position: -16px -144px; }
|
224 |
+
.ui-icon-notice { background-position: -32px -144px; }
|
225 |
+
.ui-icon-help { background-position: -48px -144px; }
|
226 |
+
.ui-icon-check { background-position: -64px -144px; }
|
227 |
+
.ui-icon-bullet { background-position: -80px -144px; }
|
228 |
+
.ui-icon-radio-off { background-position: -96px -144px; }
|
229 |
+
.ui-icon-radio-on { background-position: -112px -144px; }
|
230 |
+
.ui-icon-pin-w { background-position: -128px -144px; }
|
231 |
+
.ui-icon-pin-s { background-position: -144px -144px; }
|
232 |
+
.ui-icon-play { background-position: 0 -160px; }
|
233 |
+
.ui-icon-pause { background-position: -16px -160px; }
|
234 |
+
.ui-icon-seek-next { background-position: -32px -160px; }
|
235 |
+
.ui-icon-seek-prev { background-position: -48px -160px; }
|
236 |
+
.ui-icon-seek-end { background-position: -64px -160px; }
|
237 |
+
.ui-icon-seek-start { background-position: -80px -160px; }
|
238 |
+
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
239 |
+
.ui-icon-seek-first { background-position: -80px -160px; }
|
240 |
+
.ui-icon-stop { background-position: -96px -160px; }
|
241 |
+
.ui-icon-eject { background-position: -112px -160px; }
|
242 |
+
.ui-icon-volume-off { background-position: -128px -160px; }
|
243 |
+
.ui-icon-volume-on { background-position: -144px -160px; }
|
244 |
+
.ui-icon-power { background-position: 0 -176px; }
|
245 |
+
.ui-icon-signal-diag { background-position: -16px -176px; }
|
246 |
+
.ui-icon-signal { background-position: -32px -176px; }
|
247 |
+
.ui-icon-battery-0 { background-position: -48px -176px; }
|
248 |
+
.ui-icon-battery-1 { background-position: -64px -176px; }
|
249 |
+
.ui-icon-battery-2 { background-position: -80px -176px; }
|
250 |
+
.ui-icon-battery-3 { background-position: -96px -176px; }
|
251 |
+
.ui-icon-circle-plus { background-position: 0 -192px; }
|
252 |
+
.ui-icon-circle-minus { background-position: -16px -192px; }
|
253 |
+
.ui-icon-circle-close { background-position: -32px -192px; }
|
254 |
+
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
255 |
+
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
256 |
+
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
257 |
+
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
258 |
+
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
259 |
+
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
260 |
+
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
261 |
+
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
262 |
+
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
263 |
+
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
264 |
+
.ui-icon-circle-check { background-position: -208px -192px; }
|
265 |
+
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
266 |
+
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
267 |
+
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
268 |
+
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
269 |
+
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
270 |
+
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
271 |
+
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
272 |
+
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
273 |
+
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
274 |
+
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
275 |
+
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
276 |
+
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
277 |
+
|
278 |
+
|
279 |
+
/* Misc visuals
|
280 |
+
----------------------------------*/
|
281 |
+
|
282 |
+
/* Corner radius */
|
283 |
+
.ui-corner-tl { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; }
|
284 |
+
.ui-corner-tr { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
|
285 |
+
.ui-corner-bl { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
|
286 |
+
.ui-corner-br { -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
287 |
+
.ui-corner-top { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; }
|
288 |
+
.ui-corner-bottom { -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
289 |
+
.ui-corner-right { -moz-border-radius-topright: 5px; -webkit-border-top-right-radius: 5px; border-top-right-radius: 5px; -moz-border-radius-bottomright: 5px; -webkit-border-bottom-right-radius: 5px; border-bottom-right-radius: 5px; }
|
290 |
+
.ui-corner-left { -moz-border-radius-topleft: 5px; -webkit-border-top-left-radius: 5px; border-top-left-radius: 5px; -moz-border-radius-bottomleft: 5px; -webkit-border-bottom-left-radius: 5px; border-bottom-left-radius: 5px; }
|
291 |
+
.ui-corner-all { -moz-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }
|
292 |
+
|
293 |
+
/* Overlays */
|
294 |
+
.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); }
|
295 |
+
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }/*
|
296 |
+
* jQuery UI Datepicker 1.8.11
|
297 |
+
*
|
298 |
+
* Copyright 2011, AUTHORS.txt (http://jqueryui.com/about)
|
299 |
+
* Dual licensed under the MIT or GPL Version 2 licenses.
|
300 |
+
* http://jquery.org/license
|
301 |
+
*
|
302 |
+
* http://docs.jquery.com/UI/Datepicker#theming
|
303 |
+
*/
|
304 |
+
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
305 |
+
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
306 |
+
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
307 |
+
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
308 |
+
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
309 |
+
.ui-datepicker .ui-datepicker-next { right:2px; }
|
310 |
+
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
311 |
+
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
312 |
+
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
313 |
+
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
314 |
+
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
315 |
+
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
316 |
+
.ui-datepicker select.ui-datepicker-month,
|
317 |
+
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
318 |
+
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
319 |
+
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
320 |
+
.ui-datepicker td { border: 0; padding: 1px; }
|
321 |
+
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
322 |
+
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
323 |
+
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
324 |
+
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
325 |
+
|
326 |
+
/* with multiple calendars */
|
327 |
+
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
328 |
+
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
329 |
+
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
330 |
+
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
331 |
+
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
332 |
+
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
333 |
+
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
334 |
+
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
335 |
+
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
336 |
+
.ui-datepicker-row-break { clear:both; width:100%; }
|
337 |
+
|
338 |
+
/* RTL support */
|
339 |
+
.ui-datepicker-rtl { direction: rtl; }
|
340 |
+
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
341 |
+
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
342 |
+
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
343 |
+
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
344 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
345 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
346 |
+
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
347 |
+
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
348 |
+
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
349 |
+
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
350 |
+
|
351 |
+
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
352 |
+
.ui-datepicker-cover {
|
353 |
+
display: none; /*sorry for IE5*/
|
354 |
+
display/**/: block; /*sorry for IE5*/
|
355 |
+
position: absolute; /*must have*/
|
356 |
+
z-index: -1; /*must have*/
|
357 |
+
filter: mask(); /*must have*/
|
358 |
+
top: -4px; /*must have*/
|
359 |
+
left: -4px; /*must have*/
|
360 |
+
width: 200px; /*must have*/
|
361 |
+
height: 200px; /*must have*/
|
362 |
+
}
|
core/fields/file.php
ADDED
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
class File
|
4 |
+
{
|
5 |
+
var $name;
|
6 |
+
var $title;
|
7 |
+
var $plugin_dir;
|
8 |
+
|
9 |
+
function File($plugin_dir)
|
10 |
+
{
|
11 |
+
$this->name = 'file';
|
12 |
+
$this->title = 'File';
|
13 |
+
$this->plugin_dir = $plugin_dir;
|
14 |
+
}
|
15 |
+
|
16 |
+
function html($options)
|
17 |
+
{
|
18 |
+
echo '<div class="acf_file_uploader">';
|
19 |
+
|
20 |
+
if($options['value'] != '')
|
21 |
+
{
|
22 |
+
echo '<a href="#" class="remove_file"></a>';
|
23 |
+
echo '<span>'.$options['value'].'</span>';
|
24 |
+
echo '<input type="hidden" name="'.$options['name'].'" value="'.$options['value'].'" />';
|
25 |
+
echo '<iframe class="hide" src="'.$this->plugin_dir.'/core/upload.php"></iframe>';
|
26 |
+
}
|
27 |
+
else
|
28 |
+
{
|
29 |
+
echo '<a href="#" class="remove_file hide"></a>';
|
30 |
+
echo '<input type="hidden" name="'.$options['name'].'" value="'.$options['value'].'" />';
|
31 |
+
echo '<iframe src="'.$this->plugin_dir.'/core/upload.php"></iframe>';
|
32 |
+
}
|
33 |
+
|
34 |
+
echo '</div>';
|
35 |
+
|
36 |
+
}
|
37 |
+
|
38 |
+
function has_options()
|
39 |
+
{
|
40 |
+
return false;
|
41 |
+
}
|
42 |
+
|
43 |
+
function has_format_value()
|
44 |
+
{
|
45 |
+
return false;
|
46 |
+
}
|
47 |
+
|
48 |
+
}
|
49 |
+
|
50 |
+
?>
|
core/input_meta_box.php
CHANGED
@@ -2,16 +2,70 @@
|
|
2 |
|
3 |
global $post;
|
4 |
|
5 |
-
$
|
|
|
6 |
|
7 |
-
$fields =
|
8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
9 |
?>
|
10 |
|
11 |
<input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
|
12 |
|
13 |
<input type="hidden" name="input_meta_box" value="true" />
|
14 |
-
<input type="hidden" name="acf[id]" value="<?php echo
|
15 |
|
16 |
<?php if(!in_array('the_content',$adv_options['show_on_page'])): // hide the content quicker than jquery ?>
|
17 |
<style type="text/css">
|
2 |
|
3 |
global $post;
|
4 |
|
5 |
+
$acfs = $args['args']['acfs'];
|
6 |
+
$acf_ids = array();
|
7 |
|
8 |
+
$fields = array();
|
9 |
+
|
10 |
+
foreach($acfs as $acf)
|
11 |
+
{
|
12 |
+
// get this acf's fields and add them to the global $fields
|
13 |
+
$this_fields = $this->get_fields($acf->ID);
|
14 |
+
foreach($this_fields as $this_field)
|
15 |
+
{
|
16 |
+
$fields[] = $this_field;
|
17 |
+
}
|
18 |
+
|
19 |
+
// add id to array (easy to explode it in a hidden input on line 68)
|
20 |
+
$acf_ids[] = $acf->ID;
|
21 |
+
}
|
22 |
+
|
23 |
+
// get options from first (top level) acf
|
24 |
+
$adv_options = $this->get_adv_options($acfs[0]->ID);
|
25 |
+
|
26 |
+
// loop through multiple acfs
|
27 |
+
/*$adv_options = array();
|
28 |
+
foreach($acfs as $acf)
|
29 |
+
{
|
30 |
+
// get this acf's fields and add them to the global $fields
|
31 |
+
$this_fields = $this->get_fields($acf->ID);
|
32 |
+
foreach($this_fields as $this_field)
|
33 |
+
{
|
34 |
+
$fields[] = $this_field;
|
35 |
+
}
|
36 |
+
|
37 |
+
$this_options = $this->get_adv_options($acf->ID);
|
38 |
+
foreach($this_options as $key => $this_option)
|
39 |
+
{
|
40 |
+
// if global options doesn't even have this key, just add the array
|
41 |
+
if(empty($adv_options[$key]))
|
42 |
+
{
|
43 |
+
$adv_options[$key] = $this_option;
|
44 |
+
}
|
45 |
+
else
|
46 |
+
{
|
47 |
+
// the global array has the so it has an array here
|
48 |
+
foreach($this_option as $key2 => $this_option_value)
|
49 |
+
{
|
50 |
+
// if the global options is blank at this key, add in the new key.
|
51 |
+
if(empty($adv_options[$key][$key2]))
|
52 |
+
{
|
53 |
+
$adv_options[$key][$key2] = $this_option_value;
|
54 |
+
}
|
55 |
+
}
|
56 |
+
}
|
57 |
+
|
58 |
+
|
59 |
+
}
|
60 |
+
}*/
|
61 |
+
|
62 |
+
|
63 |
?>
|
64 |
|
65 |
<input type="hidden" name="ei_noncename" id="ei_noncename" value="<?php echo wp_create_nonce('ei-n'); ?>" />
|
66 |
|
67 |
<input type="hidden" name="input_meta_box" value="true" />
|
68 |
+
<input type="hidden" name="acf[id]" value="<?php echo implode(',',$acf_ids); ?>" />
|
69 |
|
70 |
<?php if(!in_array('the_content',$adv_options['show_on_page'])): // hide the content quicker than jquery ?>
|
71 |
<style type="text/css">
|
css/style.input.css
CHANGED
@@ -32,6 +32,7 @@ table.acf_input > tbody > tr > td > textarea {
|
|
32 |
width: 99.8%;
|
33 |
}
|
34 |
|
|
|
35 |
.acf_image_uploader {
|
36 |
position: relative;
|
37 |
float: left;
|
@@ -41,7 +42,7 @@ table.acf_input > tbody > tr > td > textarea {
|
|
41 |
display: block;
|
42 |
overflow: hidden;
|
43 |
height: 40px;
|
44 |
-
width:
|
45 |
float: left;
|
46 |
}
|
47 |
|
@@ -89,6 +90,57 @@ table.acf_input > tbody > tr > td > textarea {
|
|
89 |
border: #d8d8d8 solid 1px;
|
90 |
}
|
91 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
table.acf_input {
|
93 |
border: 0 none;
|
94 |
border-top: 1px solid #eeeeee;
|
32 |
width: 99.8%;
|
33 |
}
|
34 |
|
35 |
+
/* image upload */
|
36 |
.acf_image_uploader {
|
37 |
position: relative;
|
38 |
float: left;
|
42 |
display: block;
|
43 |
overflow: hidden;
|
44 |
height: 40px;
|
45 |
+
width: 100%;
|
46 |
float: left;
|
47 |
}
|
48 |
|
90 |
border: #d8d8d8 solid 1px;
|
91 |
}
|
92 |
|
93 |
+
/* File upload */
|
94 |
+
.acf_file_uploader {
|
95 |
+
position: relative;
|
96 |
+
float: left;
|
97 |
+
}
|
98 |
+
|
99 |
+
.acf_file_uploader iframe {
|
100 |
+
display: block;
|
101 |
+
overflow: hidden;
|
102 |
+
height: 40px;
|
103 |
+
width: 100%;
|
104 |
+
float: left;
|
105 |
+
}
|
106 |
+
|
107 |
+
.acf_file_uploader .loading {
|
108 |
+
float: left;
|
109 |
+
height: 16px;
|
110 |
+
width: 16px;
|
111 |
+
margin: 3px 0 0;
|
112 |
+
background: url(../images/loading.gif) 50% 50% no-repeat;
|
113 |
+
}
|
114 |
+
|
115 |
+
.acf_file_uploader iframe.hide {
|
116 |
+
display: none;
|
117 |
+
}
|
118 |
+
|
119 |
+
.acf_file_uploader a.remove_file {
|
120 |
+
width: 16px;
|
121 |
+
height: 16px;
|
122 |
+
background: url(../images/button_remove.png) 0 0 no-repeat;
|
123 |
+
position: absolute;
|
124 |
+
top:0;
|
125 |
+
left: 0;
|
126 |
+
cursor: pointer;
|
127 |
+
margin: -3px 0 0 -3px;
|
128 |
+
display: none;
|
129 |
+
}
|
130 |
+
|
131 |
+
.acf_file_uploader:hover a.remove_file {
|
132 |
+
display: block;
|
133 |
+
}
|
134 |
+
|
135 |
+
.acf_file_uploader:hover a.remove_file.hide {
|
136 |
+
display: none;
|
137 |
+
}
|
138 |
+
|
139 |
+
.acf_file_uploader a.remove_file:hover {
|
140 |
+
background-position: 0% 100%;
|
141 |
+
}
|
142 |
+
|
143 |
+
|
144 |
table.acf_input {
|
145 |
border: 0 none;
|
146 |
border-top: 1px solid #eeeeee;
|
js/functions.fields.js
CHANGED
@@ -43,7 +43,7 @@ jQuery(document).ready(function($){
|
|
43 |
fields.append(new_field);
|
44 |
|
45 |
new_field.find('select.type').trigger('change');
|
46 |
-
|
47 |
|
48 |
// update order numbers
|
49 |
update_order_numbers();
|
@@ -112,6 +112,7 @@ jQuery(document).ready(function($){
|
|
112 |
|
113 |
// remove preivous field option button
|
114 |
td.find('a.field_options_button').remove();
|
|
|
115 |
_this.find('div.field_options div.field_option').hide();
|
116 |
_this.find('div.field_options div.field_option [name]').attr('disabled', true);
|
117 |
|
@@ -121,6 +122,9 @@ jQuery(document).ready(function($){
|
|
121 |
var a = $('<a class="field_options_button" href="javascript:;"></a>');
|
122 |
td.append(a);
|
123 |
|
|
|
|
|
|
|
124 |
a.click(function(){
|
125 |
if(!$(this).parents('.field').is('.options_open'))
|
126 |
{
|
@@ -136,34 +140,7 @@ jQuery(document).ready(function($){
|
|
136 |
|
137 |
$(this).parents('.field').find('div.field_options div.field_option#'+selected+' [name]').removeAttr('disabled');
|
138 |
});
|
139 |
-
/*var inline_div = td.find('div.field_option#'+selected);
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
a.click(function(){
|
144 |
-
|
145 |
-
inline_div.attr('id','acf_inline_option');
|
146 |
-
|
147 |
-
$.fancybox({
|
148 |
-
padding : 0,
|
149 |
-
type : 'inline',
|
150 |
-
href : '#acf_inline_option',
|
151 |
-
autoDimensions : true,
|
152 |
-
overlayColor : '#000',
|
153 |
-
onClosed : function(){
|
154 |
-
inline_div.attr('id',selected);
|
155 |
-
}
|
156 |
-
});
|
157 |
-
|
158 |
-
});*/
|
159 |
-
|
160 |
}
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
//$(this).parents('tr').find('.field_options .field_option').removeClass('open').find('[name]').attr('disabled', true);
|
166 |
-
//$(this).parents('tr').find('.field_options .field_option#'+selected).addClass('open').find('[name]').removeAttr('disabled');
|
167 |
|
168 |
}).trigger('change');
|
169 |
|
43 |
fields.append(new_field);
|
44 |
|
45 |
new_field.find('select.type').trigger('change');
|
46 |
+
new_field.find('input.label').focus();
|
47 |
|
48 |
// update order numbers
|
49 |
update_order_numbers();
|
112 |
|
113 |
// remove preivous field option button
|
114 |
td.find('a.field_options_button').remove();
|
115 |
+
_this.removeClass('options_open');
|
116 |
_this.find('div.field_options div.field_option').hide();
|
117 |
_this.find('div.field_options div.field_option [name]').attr('disabled', true);
|
118 |
|
122 |
var a = $('<a class="field_options_button" href="javascript:;"></a>');
|
123 |
td.append(a);
|
124 |
|
125 |
+
// all options are disabled, make the chosen one abled!
|
126 |
+
selected_option.find('[name]').removeAttr('disabled');
|
127 |
+
|
128 |
a.click(function(){
|
129 |
if(!$(this).parents('.field').is('.options_open'))
|
130 |
{
|
140 |
|
141 |
$(this).parents('.field').find('div.field_options div.field_option#'+selected+' [name]').removeAttr('disabled');
|
142 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
143 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
144 |
|
145 |
}).trigger('change');
|
146 |
|
js/functions.input.js
CHANGED
@@ -24,12 +24,26 @@ jQuery(document).ready(function($){
|
|
24 |
});
|
25 |
|
26 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
// hide meta boxes
|
28 |
|
29 |
var screen_options = $('#screen-meta');
|
30 |
|
31 |
// hide content_editor
|
32 |
-
if(!div.find('input[name=
|
33 |
{
|
34 |
$('#postdivrich').hide();
|
35 |
}
|
@@ -77,6 +91,7 @@ jQuery(document).ready(function($){
|
|
77 |
function setup_iframes()
|
78 |
{
|
79 |
|
|
|
80 |
table.find('.acf_image_uploader').each(function(){
|
81 |
|
82 |
var div = $(this);
|
@@ -135,6 +150,63 @@ jQuery(document).ready(function($){
|
|
135 |
});
|
136 |
});
|
137 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
139 |
|
140 |
setup_iframes();
|
24 |
});
|
25 |
|
26 |
|
27 |
+
// create datepickers
|
28 |
+
table.find('.acf_datepicker').each(function()
|
29 |
+
{
|
30 |
+
var format = 'dd/mm/yy';
|
31 |
+
if($(this).siblings('input[name="date_format"]').val() != '')
|
32 |
+
{
|
33 |
+
format = $(this).siblings('input[name="date_format"]').val();
|
34 |
+
}
|
35 |
+
|
36 |
+
$(this).datepicker({
|
37 |
+
dateFormat: format
|
38 |
+
});
|
39 |
+
});
|
40 |
+
|
41 |
// hide meta boxes
|
42 |
|
43 |
var screen_options = $('#screen-meta');
|
44 |
|
45 |
// hide content_editor
|
46 |
+
if(!div.find('input[name=show_the_content]').exists())
|
47 |
{
|
48 |
$('#postdivrich').hide();
|
49 |
}
|
91 |
function setup_iframes()
|
92 |
{
|
93 |
|
94 |
+
// setup images
|
95 |
table.find('.acf_image_uploader').each(function(){
|
96 |
|
97 |
var div = $(this);
|
150 |
});
|
151 |
});
|
152 |
|
153 |
+
// setup files
|
154 |
+
table.find('.acf_file_uploader').each(function(){
|
155 |
+
|
156 |
+
var div = $(this);
|
157 |
+
var iframe = div.find('iframe');
|
158 |
+
|
159 |
+
iframe.contents().find('input#acf_image').unbind('change').change(function(){
|
160 |
+
|
161 |
+
// set up load event
|
162 |
+
iframe.unbind("load").load(function(){
|
163 |
+
|
164 |
+
var result = $(this).contents().find('body .result').html();
|
165 |
+
|
166 |
+
if(result == null)
|
167 |
+
{
|
168 |
+
//alert('null');
|
169 |
+
}
|
170 |
+
else if(result == '0')
|
171 |
+
{
|
172 |
+
//alert('0');
|
173 |
+
//window.history.back();
|
174 |
+
}
|
175 |
+
else
|
176 |
+
{
|
177 |
+
//alert(result);
|
178 |
+
div.children('input[type=hidden]').attr('value',result);
|
179 |
+
|
180 |
+
div.append('<span>'+result+'</span>');
|
181 |
+
div.children('a.remove_file').removeClass('hide');
|
182 |
+
|
183 |
+
//iframe.history.back();
|
184 |
+
div.find('iframe').addClass('hide');
|
185 |
+
}
|
186 |
+
|
187 |
+
div.find('.loading').remove();
|
188 |
+
setup_iframes();
|
189 |
+
|
190 |
+
});
|
191 |
+
|
192 |
+
// send image
|
193 |
+
iframe.contents().find('form').submit();
|
194 |
+
|
195 |
+
// add loading div
|
196 |
+
div.append('<div class="loading"></div>');
|
197 |
+
});
|
198 |
+
|
199 |
+
div.find('a.remove_file').unbind('click').click(function()
|
200 |
+
{
|
201 |
+
div.find('input[type=hidden]').val('');
|
202 |
+
div.find('span').remove();
|
203 |
+
div.find('iframe').removeClass('hide');
|
204 |
+
$(this).addClass('hide');
|
205 |
+
|
206 |
+
return false;
|
207 |
+
});
|
208 |
+
});
|
209 |
+
|
210 |
}
|
211 |
|
212 |
setup_iframes();
|
readme.txt
CHANGED
@@ -13,7 +13,7 @@ Completely Customise your edit pages with an assortment of field types: Wysiwyg,
|
|
13 |
Advanced Custom Fields is the perfect solution for any wordpress website which needs more flexible data like other Content Management Systems.
|
14 |
|
15 |
* Visually create your Fields
|
16 |
-
* Select from multiple input types (text, textarea, wysiwyg, image
|
17 |
* Assign your fields to multiple edit pages (specific ID's, post types, post slugs, parent ID's, template names)
|
18 |
* Add, Edit and reorder infinite rows to your fields
|
19 |
* Easily load data through a simple and friendly API
|
@@ -23,11 +23,12 @@ Advanced Custom Fields is the perfect solution for any wordpress website which n
|
|
23 |
* Text (type text, api returns text)
|
24 |
* Text Area (type text, api returns text with `<br />` tags)
|
25 |
* WYSIWYG (a wordpress wysiwyg editor, api returns html)
|
26 |
-
* Image
|
|
|
27 |
* Select (drop down list of choices, api returns chosen item)
|
28 |
* Checkbox (tick for a list of choices, api returns array of choices)
|
29 |
* Page Link (select a page, post or custom post type form a drop down menu, api returns the url)
|
30 |
-
*
|
31 |
|
32 |
= Tested on =
|
33 |
* Mac Firefox :)
|
@@ -66,6 +67,17 @@ http://plugins.elliotcondon.com/advanced-custom-fields/user-guide/
|
|
66 |
|
67 |
== Changelog ==
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
|
70 |
= 1.0.0 =
|
71 |
* Advanced Custom Fields.
|
13 |
Advanced Custom Fields is the perfect solution for any wordpress website which needs more flexible data like other Content Management Systems.
|
14 |
|
15 |
* Visually create your Fields
|
16 |
+
* Select from multiple input types (text, textarea, wysiwyg, image, file, page link, select, checkbox, date picker and more to come)
|
17 |
* Assign your fields to multiple edit pages (specific ID's, post types, post slugs, parent ID's, template names)
|
18 |
* Add, Edit and reorder infinite rows to your fields
|
19 |
* Easily load data through a simple and friendly API
|
23 |
* Text (type text, api returns text)
|
24 |
* Text Area (type text, api returns text with `<br />` tags)
|
25 |
* WYSIWYG (a wordpress wysiwyg editor, api returns html)
|
26 |
+
* Image (upload an image, api returns the url)
|
27 |
+
* File (upload a file, api returns the url)
|
28 |
* Select (drop down list of choices, api returns chosen item)
|
29 |
* Checkbox (tick for a list of choices, api returns array of choices)
|
30 |
* Page Link (select a page, post or custom post type form a drop down menu, api returns the url)
|
31 |
+
* Date Picker (jquery date picker, options for format, api returns string)
|
32 |
|
33 |
= Tested on =
|
34 |
* Mac Firefox :)
|
67 |
|
68 |
== Changelog ==
|
69 |
|
70 |
+
= 1.0.2 =
|
71 |
+
* Bug Fix: Stopped Field Options from loosing data
|
72 |
+
* Bug Fix: API will now work with looped posts
|
73 |
+
|
74 |
+
= 1.0.1 =
|
75 |
+
* New Api Functions: get_fields(), get_field(), the_field()
|
76 |
+
* New Field Type: Date Picker
|
77 |
+
* New Field Type: File
|
78 |
+
* Bug Fixes
|
79 |
+
* You can now add multiple ACF's to an edit page
|
80 |
+
* Minor CSS + JS improvements
|
81 |
|
82 |
= 1.0.0 =
|
83 |
* Advanced Custom Fields.
|