hydra-file-access 5.0.0.pre1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/Rakefile +5 -0
- data/app/assets/images/hydra/powered_by_hydra.png +0 -0
- data/app/assets/images/hydra/search-button.png +0 -0
- data/app/assets/javascripts/date-picker/booking/index.html +368 -0
- data/app/assets/javascripts/date-picker/calendarHTML.txt +84 -0
- data/app/assets/javascripts/date-picker/css/datepicker.css +511 -0
- data/app/assets/javascripts/date-picker/css/demo.css +229 -0
- data/app/assets/javascripts/date-picker/index.html +798 -0
- data/app/assets/javascripts/date-picker/js/datepicker.js +2898 -0
- data/app/assets/javascripts/date-picker/js/datepicker.packed.js +1 -0
- data/app/assets/javascripts/date-picker/js/lang/ar.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/cs.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/da.js +10 -0
- data/app/assets/javascripts/date-picker/js/lang/de.js +10 -0
- data/app/assets/javascripts/date-picker/js/lang/en.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/eo.js +13 -0
- data/app/assets/javascripts/date-picker/js/lang/es.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/et.js +23 -0
- data/app/assets/javascripts/date-picker/js/lang/fi.js +7 -0
- data/app/assets/javascripts/date-picker/js/lang/fr.js +69 -0
- data/app/assets/javascripts/date-picker/js/lang/he.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/hu.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/id.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/it.js +11 -0
- data/app/assets/javascripts/date-picker/js/lang/kr.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/lt.js +8 -0
- data/app/assets/javascripts/date-picker/js/lang/lv.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/nl.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/no.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/pl.js +10 -0
- data/app/assets/javascripts/date-picker/js/lang/pt-br.js +11 -0
- data/app/assets/javascripts/date-picker/js/lang/pt.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/ru.js +11 -0
- data/app/assets/javascripts/date-picker/js/lang/se.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/si.js +9 -0
- data/app/assets/javascripts/date-picker/js/lang/tr.js +9 -0
- data/app/assets/javascripts/date-picker/language/index.html +240 -0
- data/app/assets/javascripts/date-picker/media/Thumbs.db +0 -0
- data/app/assets/javascripts/date-picker/media/backstripes.gif +0 -0
- data/app/assets/javascripts/date-picker/media/bg_header.jpg +0 -0
- data/app/assets/javascripts/date-picker/media/bullet1.gif +0 -0
- data/app/assets/javascripts/date-picker/media/bullet2.gif +0 -0
- data/app/assets/javascripts/date-picker/media/cal-grey.gif +0 -0
- data/app/assets/javascripts/date-picker/media/cal.gif +0 -0
- data/app/assets/javascripts/date-picker/media/gradient-e5e5e5-ffffff.gif +0 -0
- data/app/assets/javascripts/hydra/hydra-head.js +195 -0
- data/app/assets/javascripts/hydra/mediashelf.datepicker.js +39 -0
- data/app/assets/javascripts/hydra/mediashelf.placeholder.js +67 -0
- data/app/assets/javascripts/jquery.form.js +1076 -0
- data/app/assets/javascripts/jquery.ui.datepicker.js +1793 -0
- data/app/assets/javascripts/spin.min.js +2 -0
- data/app/assets/stylesheets/hydra/html_refactor.css +79 -0
- data/app/assets/stylesheets/hydra/hydrangea-split-button.css +18 -0
- data/app/assets/stylesheets/hydra/hydrangea.css +288 -0
- data/app/assets/stylesheets/hydra/ie-styles.css +149 -0
- data/app/assets/stylesheets/hydra/styles.css +946 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_flat_55_fbec88_40x100.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_glass_75_d0e5f5_1x400.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_glass_85_dfeffc_1x400.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_inset-hard_100_f5f8f9_1x100.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-bg_inset-hard_100_fcfdfd_1x100.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_217bc0_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_2e83ff_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_469bdd_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_6da8d5_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_d8e7f3_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/images/ui-icons_f9bd01_256x240.png +0 -0
- data/app/assets/stylesheets/redmond/jquery-ui-1.8.5.custom.css +572 -0
- data/app/controllers/hydra/application_controller.rb +5 -0
- data/app/controllers/hydra/file_assets_controller.rb +3 -0
- data/app/helpers/application_helper.rb +3 -0
- data/app/helpers/hydra/application_helper_behavior.rb +8 -0
- data/app/helpers/hydra/hydra_helper_behavior.rb +70 -0
- data/app/helpers/hydra_helper.rb +4 -0
- data/app/models/file_asset.rb +5 -0
- data/app/models/uses_default_partials.rb +23 -0
- data/app/views/_add_assets_links.html.erb +14 -0
- data/app/views/_user_util_links.html.erb +24 -0
- data/app/views/generic_content_objects/_contributor_form.html.erb +11 -0
- data/app/views/generic_content_objects/_description_form.html.erb +7 -0
- data/app/views/generic_content_objects/_edit_description.html.erb +23 -0
- data/app/views/generic_content_objects/_new.html.erb +0 -0
- data/app/views/generic_content_objects/_show_description.html.erb +41 -0
- data/app/views/generic_contents/_edit.html.erb +10 -0
- data/app/views/generic_contents/_index.html.erb +21 -0
- data/app/views/generic_contents/_show.html.erb +6 -0
- data/app/views/generic_contents/_show_content.html.erb +7 -0
- data/app/views/generic_images/_edit.html.erb +36 -0
- data/app/views/generic_images/_index.html.erb +24 -0
- data/app/views/generic_images/_show.html.erb +13 -0
- data/app/views/generic_images/_show_all.html.erb +14 -0
- data/app/views/generic_images/_show_content.html.erb +7 -0
- data/app/views/hydra/file_assets/_asset_saved_flash.html.erb +2 -0
- data/app/views/hydra/file_assets/_deletable_result.html.erb +5 -0
- data/app/views/hydra/file_assets/_file_assets_form.html.erb +11 -0
- data/app/views/hydra/file_assets/_index.html.erb +29 -0
- data/app/views/hydra/file_assets/_new.html.erb +6 -0
- data/app/views/hydra/file_assets/_result.html.erb +11 -0
- data/app/views/hydra/file_assets/index.html.erb +5 -0
- data/app/views/hydra/permissions/_edit_person_permissions.html.erb +30 -0
- data/app/views/hydra/permissions/_index.html.erb +46 -0
- data/app/views/hydra/permissions/_new.html.erb +14 -0
- data/app/views/hydra/permissions/_permissions_form.html.erb +23 -0
- data/app/views/hydra/permissions/index.html.erb +1 -0
- data/app/views/hydra/permissions/new.html.erb +1 -0
- data/app/views/mods_assets/_additional_info_form.html.erb +44 -0
- data/app/views/mods_assets/_contributor_form.html.erb +14 -0
- data/app/views/mods_assets/_edit.html.erb +10 -0
- data/app/views/mods_assets/_edit_description.html.erb +73 -0
- data/app/views/mods_assets/_edit_journal.html.erb +57 -0
- data/app/views/mods_assets/_index.html.erb +1 -0
- data/app/views/mods_assets/_index_list.html.erb +37 -0
- data/app/views/mods_assets/_index_table.html.erb +7 -0
- data/app/views/mods_assets/_progress_box.html.erb +82 -0
- data/app/views/mods_assets/_publication_form.html.erb +13 -0
- data/app/views/mods_assets/_show.html.erb +39 -0
- data/app/views/mods_assets/_show_additional_info.html.erb +17 -0
- data/app/views/mods_assets/_show_contributors.html.erb +7 -0
- data/app/views/mods_assets/_show_description.html.erb +35 -0
- data/app/views/mods_assets/_show_file_assets.html.erb +22 -0
- data/app/views/mods_assets/_show_journal.html.erb +42 -0
- data/app/views/mods_assets/_show_permissions.html.erb +15 -0
- data/app/views/mods_assets/_show_publication.html.erb +8 -0
- data/app/views/shared/_delete_asset_confirmation.html.erb +17 -0
- data/config/jetty.yml +7 -0
- data/hydra-file-access.gemspec +39 -0
- data/lib/hydra-file-access.rb +15 -0
- data/lib/hydra/assets.rb +5 -0
- data/lib/hydra/assets_controller_helper.rb +122 -0
- data/lib/hydra/controller/assets_controller_behavior.rb +153 -0
- data/lib/hydra/controller/file_assets_behavior.rb +140 -0
- data/lib/hydra/file_access/engine.rb +12 -0
- data/lib/hydra/file_assets.rb +11 -0
- data/lib/hydra/submission_workflow.rb +139 -0
- data/lib/hydra/ui.rb +6 -0
- data/spec/.gitignore +1 -0
- data/spec/controllers/file_assets_controller_spec.rb +180 -0
- data/spec/fixtures/small_file.txt +1 -0
- data/spec/helpers/access_controls_evaluation_spec.rb +19 -0
- data/spec/helpers/assets_controller_helper_spec.rb +63 -0
- data/spec/helpers/file_assets_helper_spec.rb +116 -0
- data/spec/helpers/hydra_helper_spec.rb +21 -0
- data/spec/helpers/hydra_model_methods_spec.rb +88 -0
- data/spec/integration/file_asset_spec.rb +68 -0
- data/spec/lib/hydra_submission_workflow_spec.rb +141 -0
- data/spec/models/file_asset_spec.rb +25 -0
- data/spec/spec_helper.rb +27 -0
- data/spec/support/Gemfile +12 -0
- data/spec/support/app/models/generic_content.rb +26 -0
- data/spec/support/app/models/sample.rb +33 -0
- data/spec/support/app/models/solr_document.rb +5 -0
- data/spec/support/db/migrate/20111101221803_create_searches.rb +16 -0
- data/spec/support/lib/generators/test_app_generator.rb +39 -0
- data/spec/support/matchers/helper_matcher.rb +14 -0
- data/spec/support/matchers/solr_matchers.rb +60 -0
- data/spec/support/spec/factories/users.rb +11 -0
- data/spec/support/spec/fixtures/hydra_test_generic_content.foxml.xml +138 -0
- data/spec/support/spec/fixtures/hydrangea_fixture_file_asset1.foxml.xml +4946 -0
- data/spec/support/spec/fixtures/hydrangea_fixture_mods_article1.foxml.xml +234 -0
- data/spec/support/spec/fixtures/hydrangea_fixture_mods_article2.foxml.xml +177 -0
- data/spec/support/spec/fixtures/hydrangea_fixture_mods_article3.foxml.xml +170 -0
- data/spec/support/spec/fixtures/hydrangea_fixture_uploaded_svg1.foxml.xml +676 -0
- data/tasks/rspec.rake +55 -0
- metadata +516 -0
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/* DATEPICKER DEMO CSS */
|
|
2
|
+
body
|
|
3
|
+
{
|
|
4
|
+
padding:2em 0 0 0;
|
|
5
|
+
border:0;
|
|
6
|
+
margin:0;
|
|
7
|
+
text-align:center;
|
|
8
|
+
font-size:12px;
|
|
9
|
+
font-family: verdana,arial,sans-serif;
|
|
10
|
+
color:#545454;
|
|
11
|
+
min-width: 800px;
|
|
12
|
+
}
|
|
13
|
+
p
|
|
14
|
+
{
|
|
15
|
+
line-height:1.6em;
|
|
16
|
+
margin:0 0 1em 0;
|
|
17
|
+
}
|
|
18
|
+
.fauxhr
|
|
19
|
+
{
|
|
20
|
+
margin-top:1em;
|
|
21
|
+
border-top:1px dotted #bbb;
|
|
22
|
+
padding-top:1.48em;
|
|
23
|
+
}
|
|
24
|
+
h1
|
|
25
|
+
{
|
|
26
|
+
font-weight:lighter;
|
|
27
|
+
font-family:georgia, times new roman, times, georgia, palatino, serif;
|
|
28
|
+
text-align:center;
|
|
29
|
+
margin-top:0.6em;
|
|
30
|
+
color:#000;
|
|
31
|
+
font-size:2em;
|
|
32
|
+
}
|
|
33
|
+
h2
|
|
34
|
+
{
|
|
35
|
+
font-weight:lighter;
|
|
36
|
+
font-family:verdana,arial,sans-serif;
|
|
37
|
+
text-align:center;
|
|
38
|
+
margin-top:1em;
|
|
39
|
+
color:#333;
|
|
40
|
+
text-transform:uppercase;
|
|
41
|
+
letter-spacing:1px;
|
|
42
|
+
font-size:1.2em;
|
|
43
|
+
}
|
|
44
|
+
kbd
|
|
45
|
+
{
|
|
46
|
+
background-color:#eeeeee;
|
|
47
|
+
padding:2px;
|
|
48
|
+
border:1px solid #dddddd;
|
|
49
|
+
border-bottom-color:#999999;
|
|
50
|
+
border-left-color:#999999;
|
|
51
|
+
}
|
|
52
|
+
kbd, code
|
|
53
|
+
{
|
|
54
|
+
font-family:'andale mono','lucida console','courier new',monospace;
|
|
55
|
+
font-size:1em;
|
|
56
|
+
}
|
|
57
|
+
a
|
|
58
|
+
{
|
|
59
|
+
font-weight:normal;
|
|
60
|
+
outline:none;
|
|
61
|
+
}
|
|
62
|
+
a:link,
|
|
63
|
+
a:visited
|
|
64
|
+
{
|
|
65
|
+
color:#333;
|
|
66
|
+
text-decoration:underline;
|
|
67
|
+
}
|
|
68
|
+
a:hover
|
|
69
|
+
{
|
|
70
|
+
color:#fff;
|
|
71
|
+
text-decoration:none;
|
|
72
|
+
background:#000;
|
|
73
|
+
}
|
|
74
|
+
a:active
|
|
75
|
+
{
|
|
76
|
+
color:#000;
|
|
77
|
+
text-decoration:underline;
|
|
78
|
+
}
|
|
79
|
+
form
|
|
80
|
+
{
|
|
81
|
+
width:740px;
|
|
82
|
+
background:#fcfcfc;
|
|
83
|
+
border:3px double #ccc;
|
|
84
|
+
text-align:left;
|
|
85
|
+
padding:10px;
|
|
86
|
+
margin:0 auto;
|
|
87
|
+
}
|
|
88
|
+
fieldset
|
|
89
|
+
{
|
|
90
|
+
display:block;
|
|
91
|
+
margin:0;
|
|
92
|
+
padding:1em 1em 1.5em 1em;
|
|
93
|
+
}
|
|
94
|
+
form > fieldset
|
|
95
|
+
{
|
|
96
|
+
border:1px solid #ccc;
|
|
97
|
+
margin:0 0 1.6em 0;
|
|
98
|
+
}
|
|
99
|
+
legend
|
|
100
|
+
{
|
|
101
|
+
color:#545454;
|
|
102
|
+
font-weight:bold;
|
|
103
|
+
_margin-bottom:1em;
|
|
104
|
+
}
|
|
105
|
+
label
|
|
106
|
+
{
|
|
107
|
+
line-height:1em;
|
|
108
|
+
margin:0;
|
|
109
|
+
font-weight:bold;
|
|
110
|
+
color:#545454;
|
|
111
|
+
display:inline;
|
|
112
|
+
}
|
|
113
|
+
input
|
|
114
|
+
{
|
|
115
|
+
margin:0;
|
|
116
|
+
padding:0;
|
|
117
|
+
border:1px solid #ccc;
|
|
118
|
+
border-top-color:#aaa;
|
|
119
|
+
border-left-color:#aaa;
|
|
120
|
+
/*position:relative;*/
|
|
121
|
+
height:1.2em;
|
|
122
|
+
}
|
|
123
|
+
select
|
|
124
|
+
{
|
|
125
|
+
margin:0;
|
|
126
|
+
border:1px solid #ccc;
|
|
127
|
+
border-top-color:#aaa;
|
|
128
|
+
border-left-color:#aaa;
|
|
129
|
+
position:relative;
|
|
130
|
+
}
|
|
131
|
+
option.alt
|
|
132
|
+
{
|
|
133
|
+
background:#eee;
|
|
134
|
+
}
|
|
135
|
+
.w2em
|
|
136
|
+
{
|
|
137
|
+
width:2em;
|
|
138
|
+
}
|
|
139
|
+
.w3em
|
|
140
|
+
{
|
|
141
|
+
width:3em;
|
|
142
|
+
}
|
|
143
|
+
.w4em
|
|
144
|
+
{
|
|
145
|
+
width:4em;
|
|
146
|
+
}
|
|
147
|
+
.w8em
|
|
148
|
+
{
|
|
149
|
+
width:8em;
|
|
150
|
+
}
|
|
151
|
+
.w16em
|
|
152
|
+
{
|
|
153
|
+
width:16em;
|
|
154
|
+
}
|
|
155
|
+
.w18em
|
|
156
|
+
{
|
|
157
|
+
width:18.5em;
|
|
158
|
+
}
|
|
159
|
+
.firstup
|
|
160
|
+
{
|
|
161
|
+
padding-right:2em;
|
|
162
|
+
}
|
|
163
|
+
.lastup
|
|
164
|
+
{
|
|
165
|
+
margin-bottom:0;
|
|
166
|
+
}
|
|
167
|
+
.al-center
|
|
168
|
+
{
|
|
169
|
+
text-align:center;
|
|
170
|
+
}
|
|
171
|
+
#fd-dp-aria-describedby
|
|
172
|
+
{
|
|
173
|
+
width:100%;
|
|
174
|
+
margin-bottom:1.6em;
|
|
175
|
+
}
|
|
176
|
+
#fd-dp-aria-describedby th, #fd-dp-aria-describedby td
|
|
177
|
+
{
|
|
178
|
+
padding:0.6em 0;
|
|
179
|
+
border-bottom:1px solid #ccc;
|
|
180
|
+
vertical-align:top;
|
|
181
|
+
text-align:left;
|
|
182
|
+
}
|
|
183
|
+
#fd-dp-aria-describedby th
|
|
184
|
+
{
|
|
185
|
+
border-top:1px solid #ccc;
|
|
186
|
+
}
|
|
187
|
+
table.split-date-wrap
|
|
188
|
+
{
|
|
189
|
+
width:auto;
|
|
190
|
+
margin-bottom:1em;
|
|
191
|
+
}
|
|
192
|
+
table.split-date-wrap td
|
|
193
|
+
{
|
|
194
|
+
padding:0 0.2em 0.4em 0;
|
|
195
|
+
border-bottom:0 none;
|
|
196
|
+
}
|
|
197
|
+
table.split-date-wrap td input
|
|
198
|
+
{
|
|
199
|
+
margin-right:0.3em;
|
|
200
|
+
}
|
|
201
|
+
table.split-date-wrap td label
|
|
202
|
+
{
|
|
203
|
+
font-size:10px;
|
|
204
|
+
font-weight:normal;
|
|
205
|
+
display:block;
|
|
206
|
+
}
|
|
207
|
+
table td.lastTD input
|
|
208
|
+
{
|
|
209
|
+
margin-right:0;
|
|
210
|
+
}
|
|
211
|
+
.warning
|
|
212
|
+
{
|
|
213
|
+
border:3px solid #a84444;
|
|
214
|
+
padding:1em;
|
|
215
|
+
margin-bottom:1.5em;
|
|
216
|
+
}
|
|
217
|
+
.warning p
|
|
218
|
+
{
|
|
219
|
+
margin:0;
|
|
220
|
+
}
|
|
221
|
+
span.longhand-date
|
|
222
|
+
{
|
|
223
|
+
margin-left:1em;
|
|
224
|
+
font-style:oblique;
|
|
225
|
+
}
|
|
226
|
+
p.bump
|
|
227
|
+
{
|
|
228
|
+
margin:0 0 1.5em 0;
|
|
229
|
+
}
|
|
@@ -0,0 +1,798 @@
|
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
|
2
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<title>frequency decoder ~ Unobtrusive JavaScript datePicker v5 demo</title>
|
|
5
|
+
|
|
6
|
+
<!-- Add the datepicker script and set the ARIA describedby property to
|
|
7
|
+
point to to the table that explains keyboard control. Don't worry
|
|
8
|
+
you don't have to set the describedby parameter, I'm just showing
|
|
9
|
+
you how it can be done! -->
|
|
10
|
+
<script type="text/javascript" src="./js/datepicker.js">{"describedby":"fd-dp-aria-describedby"}</script>
|
|
11
|
+
<link href="./css/demo.css" rel="stylesheet" type="text/css" />
|
|
12
|
+
|
|
13
|
+
<!-- Add the datepicker's stylesheet -->
|
|
14
|
+
<link href="./css/datepicker.css" rel="stylesheet" type="text/css" />
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
<script type="text/javascript">
|
|
18
|
+
// <![CDATA[
|
|
19
|
+
|
|
20
|
+
// Utility function - not needed by the datepicker script but used by a few of the demos below
|
|
21
|
+
function pad(value, length) {
|
|
22
|
+
length = length || 2;
|
|
23
|
+
return "0000".substr(0,length - Math.min(String(value).length, length)) + value;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
// ]]>
|
|
27
|
+
</script>
|
|
28
|
+
</head>
|
|
29
|
+
<body>
|
|
30
|
+
<form id="testform" method="post" action="">
|
|
31
|
+
<h1>Unobtrusive JavaScript date-picker widgit v5</h1>
|
|
32
|
+
<h2>Keyboard access</h2>
|
|
33
|
+
<!-- The ARIA describedby property points to the following table (which explains
|
|
34
|
+
the keyboard control) -->
|
|
35
|
+
<table cellpadding="0" cellspacing="0" border="0" id="fd-dp-aria-describedby">
|
|
36
|
+
<thead>
|
|
37
|
+
<tr>
|
|
38
|
+
|
|
39
|
+
<th class="firstup">Key Combination</th>
|
|
40
|
+
<th>Action</th>
|
|
41
|
+
</tr>
|
|
42
|
+
</thead>
|
|
43
|
+
<tbody>
|
|
44
|
+
<tr>
|
|
45
|
+
<td><kbd>←</kbd> <kbd>→</kbd> <kbd>↑</kbd> <kbd>↓</kbd></td>
|
|
46
|
+
<td>Day navigation</td>
|
|
47
|
+
</tr>
|
|
48
|
+
<tr>
|
|
49
|
+
<td><kbd>page up</kbd></td>
|
|
50
|
+
<td>Previous month</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td><kbd>page down</kbd></td>
|
|
54
|
+
<td>Next month</td>
|
|
55
|
+
</tr>
|
|
56
|
+
<tr>
|
|
57
|
+
<td><kbd>Ctrl</kbd> + <kbd>page up</kbd></td>
|
|
58
|
+
<td>Previous year</td>
|
|
59
|
+
</tr>
|
|
60
|
+
<tr>
|
|
61
|
+
<td><kbd>Ctrl</kbd> + <kbd>page down</kbd></td>
|
|
62
|
+
<td>Next year</td>
|
|
63
|
+
</tr>
|
|
64
|
+
<tr>
|
|
65
|
+
<td><kbd>Space</kbd></td>
|
|
66
|
+
<td>Todays date</td>
|
|
67
|
+
</tr>
|
|
68
|
+
<tr>
|
|
69
|
+
<td><kbd>Esc</kbd></td>
|
|
70
|
+
<td>Close date-picker (no date selected)</td>
|
|
71
|
+
</tr>
|
|
72
|
+
<tr>
|
|
73
|
+
<td><kbd>Return</kbd></td>
|
|
74
|
+
<td>Select highlighted date and close date-picker</td>
|
|
75
|
+
</tr>
|
|
76
|
+
<tr>
|
|
77
|
+
<td><kbd>2</kbd> - <kbd>7</kbd></td>
|
|
78
|
+
<td>Select the corresponding day as the first day of the week</td>
|
|
79
|
+
</tr>
|
|
80
|
+
</tbody>
|
|
81
|
+
</table>
|
|
82
|
+
|
|
83
|
+
<h2>Various DatePicker Demos</h2>
|
|
84
|
+
|
|
85
|
+
<fieldset>
|
|
86
|
+
<legend>Single Input DatePickers</legend>
|
|
87
|
+
|
|
88
|
+
<!-- DEMO #1 -->
|
|
89
|
+
<p>A simple datePicker using a dd/mm/yyyy date format and whose associated input value is set to "13/03/2009".</p>
|
|
90
|
+
|
|
91
|
+
<p><label for="dp-1">Demo 1</label> : <input type="text" class="w16em" id="dp-1" name="dp-1" value="13/03/2009" /></p>
|
|
92
|
+
<script type="text/javascript">
|
|
93
|
+
// <![CDATA[
|
|
94
|
+
var opts = {
|
|
95
|
+
// Attach input with an id of "dp-1" and give it a "d-sl-m-sl-Y" date format (e.g. 13/03/1990)
|
|
96
|
+
formElements:{"dp-1":"d-sl-m-sl-Y"}
|
|
97
|
+
};
|
|
98
|
+
datePickerController.createDatePicker(opts);
|
|
99
|
+
// ]]>
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
<!-- DEMO #2 -->
|
|
103
|
+
<p class="fauxhr">Now let’s show some week numbers and change the date format slightly in order to display two figure years.</p>
|
|
104
|
+
<p><label for="dp-2">Demo 2</label> : <input type="text" class="w16em" id="dp-2" name="dp-2" value="" /></p>
|
|
105
|
+
|
|
106
|
+
<script type="text/javascript">
|
|
107
|
+
// <![CDATA[
|
|
108
|
+
var opts = {
|
|
109
|
+
// Attach input with an id of "dp-2" and give it a "d-sl-m-sl-y" date format (e.g. 13/03/90)
|
|
110
|
+
formElements:{"dp-2":"d-sl-m-sl-y"},
|
|
111
|
+
// Show week numbers
|
|
112
|
+
showWeeks:true
|
|
113
|
+
};
|
|
114
|
+
datePickerController.createDatePicker(opts);
|
|
115
|
+
// ]]>
|
|
116
|
+
</script>
|
|
117
|
+
|
|
118
|
+
<!-- DEMO #3 -->
|
|
119
|
+
<p class="fauxhr">Add a status bar and change the date format to use a four figure year and dashes as the date dividor.</p>
|
|
120
|
+
<p><label for="dp-3">Demo 3</label> : <input type="text" class="w16em" id="dp-3" name="dp-3" value="" /></p>
|
|
121
|
+
<script type="text/javascript">
|
|
122
|
+
// <![CDATA[
|
|
123
|
+
var opts = {
|
|
124
|
+
formElements:{"dp-3":"d-ds-m-ds-Y"},
|
|
125
|
+
showWeeks:true,
|
|
126
|
+
// Show a status bar and use the format "l-cc-sp-d-sp-F-sp-Y" (e.g. Friday, 25 September 2009)
|
|
127
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y"
|
|
128
|
+
};
|
|
129
|
+
datePickerController.createDatePicker(opts);
|
|
130
|
+
// ]]>
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
<!-- DEMO #4 -->
|
|
134
|
+
|
|
135
|
+
<p class="fauxhr">Let’s highlight Monday & Tuesday.</p>
|
|
136
|
+
<p><label for="dp-4">Demo 4</label> : <input type="text" class="w16em" id="dp-4" name="dp-4" value="" /></p>
|
|
137
|
+
<script type="text/javascript">
|
|
138
|
+
// <![CDATA[
|
|
139
|
+
var opts = {
|
|
140
|
+
formElements:{"dp-4":"d-ds-m-ds-Y"},
|
|
141
|
+
showWeeks:true,
|
|
142
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
143
|
+
// Highlight Monday (index = 0) and Tuesday (index = 1)
|
|
144
|
+
highlightDays:[1,1,0,0,0,0,0]
|
|
145
|
+
};
|
|
146
|
+
datePickerController.createDatePicker(opts);
|
|
147
|
+
// ]]>
|
|
148
|
+
</script>
|
|
149
|
+
|
|
150
|
+
<!-- DEMO #5 -->
|
|
151
|
+
<p class="fauxhr">Let’s set a top range of one year from today and a bottom range of 35 days before todays date.</p>
|
|
152
|
+
<p><label for="dp-5">Demo 5</label> : <input type="text" class="w16em" id="dp-5" name="dp-5" value="" /></p>
|
|
153
|
+
|
|
154
|
+
<script type="text/javascript">
|
|
155
|
+
// <![CDATA[
|
|
156
|
+
|
|
157
|
+
var today = new Date(),
|
|
158
|
+
// low range, 35 days before today's date
|
|
159
|
+
rangeLow = new Date(today.getFullYear(), today.getMonth(), today.getDate() - 35),
|
|
160
|
+
// high range, one year after today's date
|
|
161
|
+
rangeHigh = new Date(today.getFullYear() + 1, today.getMonth(), today.getDate())
|
|
162
|
+
|
|
163
|
+
var opts = {
|
|
164
|
+
formElements:{"dp-5":"d-sl-m-sl-Y"},
|
|
165
|
+
showWeeks:true,
|
|
166
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
167
|
+
// Set some dynamically calculated ranges
|
|
168
|
+
rangeLow:rangeLow.getFullYear() + "" + pad(rangeLow.getMonth()+1) + pad(rangeLow.getDate()),
|
|
169
|
+
rangeHigh:rangeHigh.getFullYear() + "" + pad(rangeHigh.getMonth()+1) + pad(rangeHigh.getDate())
|
|
170
|
+
};
|
|
171
|
+
datePickerController.createDatePicker(opts);
|
|
172
|
+
// ]]>
|
|
173
|
+
</script>
|
|
174
|
+
|
|
175
|
+
<!-- DEMO #6 -->
|
|
176
|
+
<p class="fauxhr">Let’s fill the entire grid with selectable dates.</p>
|
|
177
|
+
<p><label for="dp-6">Demo 6</label> : <input type="text" class="w16em" id="dp-6" name="dp-6" value="" /></p>
|
|
178
|
+
<script type="text/javascript">
|
|
179
|
+
// <![CDATA[
|
|
180
|
+
var opts = {
|
|
181
|
+
formElements:{"dp-6":"d-ds-m-ds-Y"},
|
|
182
|
+
showWeeks:true,
|
|
183
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
184
|
+
// Fill the grid...
|
|
185
|
+
fillGrid:true,
|
|
186
|
+
// ... and make all displayed dates selectable
|
|
187
|
+
constrainSelection:false
|
|
188
|
+
};
|
|
189
|
+
datePickerController.createDatePicker(opts);
|
|
190
|
+
// ]]>
|
|
191
|
+
</script>
|
|
192
|
+
|
|
193
|
+
<!-- DEMO #7 -->
|
|
194
|
+
|
|
195
|
+
<p class="fauxhr">Let’s fill the entire grid again but we’ll disable the selection of the extra dates.</p>
|
|
196
|
+
<p><label for="dp-7">Demo 7</label> : <input type="text" class="w16em" id="dp-7" name="dp-7" value="" /></p>
|
|
197
|
+
<script type="text/javascript">
|
|
198
|
+
// <![CDATA[
|
|
199
|
+
var opts = {
|
|
200
|
+
formElements:{"dp-7":"d-ds-m-ds-Y"},
|
|
201
|
+
showWeeks:true,
|
|
202
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
203
|
+
// Fill the grid...
|
|
204
|
+
fillGrid:true,
|
|
205
|
+
// ...but constrain the selection to the in-view month ony
|
|
206
|
+
constrainSelection:true
|
|
207
|
+
};
|
|
208
|
+
datePickerController.createDatePicker(opts);
|
|
209
|
+
// ]]>
|
|
210
|
+
</script>
|
|
211
|
+
|
|
212
|
+
<!-- DEMO #8 -->
|
|
213
|
+
<p class="fauxhr">Let’s set a bespoke final opacity of 80%.</p>
|
|
214
|
+
<p><label for="dp-8">Demo 8</label> : <input type="text" class="w16em" id="dp-8" name="dp-8" value="" /></p>
|
|
215
|
+
|
|
216
|
+
<script type="text/javascript">
|
|
217
|
+
// <![CDATA[
|
|
218
|
+
var opts = {
|
|
219
|
+
formElements:{"dp-8":"d-ds-m-ds-Y"},
|
|
220
|
+
showWeeks:true,
|
|
221
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
222
|
+
fillGrid:true,
|
|
223
|
+
constrainSelection:false,
|
|
224
|
+
// Set a final Opacity of 80%
|
|
225
|
+
finalOpacity:80
|
|
226
|
+
};
|
|
227
|
+
datePickerController.createDatePicker(opts);
|
|
228
|
+
// ]]>
|
|
229
|
+
</script>
|
|
230
|
+
|
|
231
|
+
<!-- DEMO #9 -->
|
|
232
|
+
<p class="fauxhr">Let’s now disable the fade in/out animation and the selection of Saturday & Sunday.</p>
|
|
233
|
+
<p><label for="dp-9">Demo 9</label> : <input type="text" class="w16em" id="dp-9" name="dp-9" value="" /></p>
|
|
234
|
+
<script type="text/javascript">
|
|
235
|
+
// <![CDATA[
|
|
236
|
+
var opts = {
|
|
237
|
+
formElements:{"dp-9":"d-ds-m-ds-Y"},
|
|
238
|
+
showWeeks:true,
|
|
239
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
240
|
+
fillGrid:true,
|
|
241
|
+
constrainSelection:false,
|
|
242
|
+
// No fade in/out animation, just popup the datepicker immediately
|
|
243
|
+
noFadeEffect:true,
|
|
244
|
+
// Disable Saturday (index = 5) and Sunday (index = 6)
|
|
245
|
+
disabledDays:[0,0,0,0,0,1,1]
|
|
246
|
+
};
|
|
247
|
+
datePickerController.createDatePicker(opts);
|
|
248
|
+
// ]]>
|
|
249
|
+
</script>
|
|
250
|
+
|
|
251
|
+
<!-- DEMO #10 -->
|
|
252
|
+
<p class="fauxhr">Let’s now disable some specific dates using wildcards (the 1<sup>st</sup> to the 22<sup>nd</sup> of this month and the 25<sup>th</sup> of December for all years).</p>
|
|
253
|
+
|
|
254
|
+
<p><label for="dp-10">Demo 10</label> : <input type="text" class="w16em" id="dp-10" name="dp-10" value="" /></p>
|
|
255
|
+
<script type="text/javascript">
|
|
256
|
+
// <![CDATA[
|
|
257
|
+
var today = new Date(),
|
|
258
|
+
thisMonthYYYYMM = today.getFullYear() + pad(today.getMonth()+1),
|
|
259
|
+
opts = {
|
|
260
|
+
formElements:{"dp-10":"d-ds-m-ds-Y"},
|
|
261
|
+
showWeeks:true,
|
|
262
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
263
|
+
disabledDates:{}
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
// Disable from the 01st to the 22nd of this month
|
|
267
|
+
opts.disabledDates[thisMonthYYYYMM+"01"] = thisMonthYYYYMM+"22";
|
|
268
|
+
// Disable December the 25th for all years
|
|
269
|
+
opts.disabledDates["****1225"] = 1;
|
|
270
|
+
datePickerController.createDatePicker(opts);
|
|
271
|
+
// ]]>
|
|
272
|
+
</script>
|
|
273
|
+
|
|
274
|
+
<!-- DEMO #11 -->
|
|
275
|
+
<p class="fauxhr">Now we’ll set a more complicated dateformat (which you probably wouldn’t use in a real life situation but it will at least test the script’s ability to parse complicated dates) and enable only the 1<sup>st</sup> to the 18<sup>th</sup> and 26<sup>th</sup> to the 28<sup>th</sup>of this month and the 10<sup>th</sup> to the 20<sup>th</sup> of next month. We’ll also set a wildcard enabled date that enables the 2<sup>nd</sup> day of all months for all years ("******02").</p>
|
|
276
|
+
<p><label for="dp-11">Demo 11</label> : <input type="text" class="w16em" id="dp-11" name="dp-11" value="" /></p>
|
|
277
|
+
|
|
278
|
+
<script type="text/javascript">
|
|
279
|
+
// <![CDATA[
|
|
280
|
+
var today = new Date(),
|
|
281
|
+
nextMonth = new Date(today.getFullYear(), today.getMonth()+1, 1),
|
|
282
|
+
thisMonthYYYYMM = today.getFullYear() + pad(today.getMonth()+1),
|
|
283
|
+
nextMonthYYYYMM = nextMonth.getFullYear() + pad(nextMonth.getMonth()+1),
|
|
284
|
+
opts = {
|
|
285
|
+
formElements:{"dp-11":"l-cc-sp-d-sp-F-sp-Y"},
|
|
286
|
+
showWeeks:true,
|
|
287
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
288
|
+
enabledDates:{},
|
|
289
|
+
// Set a low and high range as these are not calculated for you
|
|
290
|
+
// when using enabledDates
|
|
291
|
+
rangeLow:thisMonthYYYYMM + "01",
|
|
292
|
+
rangeHigh:nextMonthYYYYMM + "28"
|
|
293
|
+
};
|
|
294
|
+
|
|
295
|
+
// Start adding enabled dates...
|
|
296
|
+
|
|
297
|
+
// The 1st to the 18th of this month
|
|
298
|
+
opts.enabledDates[thisMonthYYYYMM+"01"] = thisMonthYYYYMM+"18";
|
|
299
|
+
// The 26h to the 28th of this month
|
|
300
|
+
opts.enabledDates[thisMonthYYYYMM+"26"] = thisMonthYYYYMM+"28";
|
|
301
|
+
// The 10th to the 20h of next month
|
|
302
|
+
opts.enabledDates[nextMonthYYYYMM+"10"] = nextMonthYYYYMM+"20";
|
|
303
|
+
// The 2nd of all months for all years
|
|
304
|
+
opts.enabledDates["******02"] = 1;
|
|
305
|
+
|
|
306
|
+
datePickerController.createDatePicker(opts);
|
|
307
|
+
// ]]>
|
|
308
|
+
</script>
|
|
309
|
+
</fieldset>
|
|
310
|
+
|
|
311
|
+
<fieldset>
|
|
312
|
+
<legend>Split Input DatePickers</legend>
|
|
313
|
+
|
|
314
|
+
<!-- DEMO #12 -->
|
|
315
|
+
<p><strong>Demo 12:</strong> Using three text inputs and removing the today button from the <abbr title="User Interface">U.I</abbr>.</p>
|
|
316
|
+
<table class="split-date-wrap" cellpadding="0" cellspacing="0" border="0">
|
|
317
|
+
|
|
318
|
+
<tbody>
|
|
319
|
+
<tr>
|
|
320
|
+
<td><input type="text" class="w2em" id="date-1-dd" name="date-1-dd" value="" maxlength="2" />/<label for="date-1-dd">DD</label></td>
|
|
321
|
+
<td><input type="text" class="w2em" id="date-1-mm" name="date-1-mm" value="" maxlength="2" />/<label for="date-1-mm">MM</label></td>
|
|
322
|
+
<td class="lastTD"><input type="text" class="w4em" id="date-1" name="date-1" value="" maxlength="4" /><label for="date-1">YYYY</label></td>
|
|
323
|
+
</tr>
|
|
324
|
+
|
|
325
|
+
</tbody>
|
|
326
|
+
</table>
|
|
327
|
+
<script type="text/javascript">
|
|
328
|
+
// <![CDATA[
|
|
329
|
+
var opts = {
|
|
330
|
+
formElements:{"date-1":"Y","date-1-mm":"m","date-1-dd":"d"},
|
|
331
|
+
showWeeks:true,
|
|
332
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
333
|
+
// Remove the "Today" button
|
|
334
|
+
noTodayButton:true
|
|
335
|
+
};
|
|
336
|
+
datePickerController.createDatePicker(opts);
|
|
337
|
+
// ]]>
|
|
338
|
+
</script>
|
|
339
|
+
|
|
340
|
+
<!-- DEMO #13 -->
|
|
341
|
+
<p class="fauxhr"><strong>Demo 13:</strong> Using three text inputs & positioning the button within a wrapper span.</p>
|
|
342
|
+
<table class="split-date-wrap" cellpadding="0" cellspacing="0" border="0">
|
|
343
|
+
<tbody>
|
|
344
|
+
|
|
345
|
+
<tr>
|
|
346
|
+
<td><input type="text" class="w4em" id="date-2" name="date-2" value="" maxlength="4" />/<label for="date-2">YYYY</label></td>
|
|
347
|
+
<td><input type="text" class="w2em" id="date-2-mm" name="date-2-mm" value="" maxlength="2" />/<label for="date-2-mm">MM</label></td>
|
|
348
|
+
<td><input type="text" class="w2em" id="date-2-dd" name="date-2-dd" value="" maxlength="2" style="margin-right:0" /><span id="button-wrapper"></span><label for="date-2-dd">DD</label></td>
|
|
349
|
+
</tr>
|
|
350
|
+
</tbody>
|
|
351
|
+
|
|
352
|
+
</table>
|
|
353
|
+
<script type="text/javascript">
|
|
354
|
+
// <![CDATA[
|
|
355
|
+
var opts = {
|
|
356
|
+
formElements:{"date-2":"Y","date-2-mm":"m","date-2-dd":"d"},
|
|
357
|
+
showWeeks:true,
|
|
358
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
359
|
+
// Position the button within a wrapper span with an id of "button-wrapper"
|
|
360
|
+
positioned:"button-wrapper"
|
|
361
|
+
};
|
|
362
|
+
datePickerController.createDatePicker(opts);
|
|
363
|
+
// ]]>
|
|
364
|
+
</script>
|
|
365
|
+
|
|
366
|
+
<!-- DEMO #14 -->
|
|
367
|
+
<p class="fauxhr"><strong>Demo 14:</strong> Using 3 selectLists and disabling Monday and Tuesday. Note: the high & low ranges will be automatically calculated by the script when selectLists are used to represent the year so there’s no need to set the rangeLow and rangeHigh variables.</p>
|
|
368
|
+
<p>
|
|
369
|
+
<select id="date-sel-dd" name="date-sel-dd">
|
|
370
|
+
<option value="-1">Day</option>
|
|
371
|
+
|
|
372
|
+
<option value="1">1st</option>
|
|
373
|
+
<option value="2">2nd</option>
|
|
374
|
+
<option value="3">3rd</option>
|
|
375
|
+
<option value="4">4th</option>
|
|
376
|
+
<option value="5">5th</option>
|
|
377
|
+
<option value="6">6th</option>
|
|
378
|
+
|
|
379
|
+
<option value="7">7th</option>
|
|
380
|
+
<option value="8">8th</option>
|
|
381
|
+
<option value="9">9th</option>
|
|
382
|
+
<option value="10">10th</option>
|
|
383
|
+
<option value="11">11th</option>
|
|
384
|
+
<option value="12">12th</option>
|
|
385
|
+
|
|
386
|
+
<option value="13">13th</option>
|
|
387
|
+
<option value="14">14th</option>
|
|
388
|
+
<option value="15">15th</option>
|
|
389
|
+
<option value="16">16th</option>
|
|
390
|
+
<option value="17">17th</option>
|
|
391
|
+
<option value="18">18th</option>
|
|
392
|
+
|
|
393
|
+
<option value="19">19th</option>
|
|
394
|
+
<option value="20">20th</option>
|
|
395
|
+
<option value="21">21st</option>
|
|
396
|
+
<option value="22">22nd</option>
|
|
397
|
+
<option value="23">23rd</option>
|
|
398
|
+
<option value="24">24th</option>
|
|
399
|
+
|
|
400
|
+
<option value="25">25th</option>
|
|
401
|
+
<option value="26">26th</option>
|
|
402
|
+
<option value="27">27th</option>
|
|
403
|
+
<option value="28">28th</option>
|
|
404
|
+
<option value="29">29th</option>
|
|
405
|
+
<option value="30">30th</option>
|
|
406
|
+
|
|
407
|
+
<option value="31">31st</option>
|
|
408
|
+
</select>
|
|
409
|
+
<select id="date-sel-mm" name="date-sel-mm">
|
|
410
|
+
<option value="-1">Month</option>
|
|
411
|
+
<option value="1">January</option>
|
|
412
|
+
<option value="2">February</option>
|
|
413
|
+
<option value="3">March</option>
|
|
414
|
+
|
|
415
|
+
<option value="4">April</option>
|
|
416
|
+
<option value="5">May</option>
|
|
417
|
+
<option value="6">June</option>
|
|
418
|
+
<option value="7">July</option>
|
|
419
|
+
<option value="8">August</option>
|
|
420
|
+
<option value="9">September</option>
|
|
421
|
+
|
|
422
|
+
<option value="10">October</option>
|
|
423
|
+
<option value="11">November</option>
|
|
424
|
+
<option value="12">December</option>
|
|
425
|
+
</select>
|
|
426
|
+
<select id="date-sel" name="date-sel">
|
|
427
|
+
<option value="-1">Year</option>
|
|
428
|
+
<option value="1970">1970</option>
|
|
429
|
+
|
|
430
|
+
<option value="1971">1971</option>
|
|
431
|
+
<option value="1972">1972</option>
|
|
432
|
+
<option value="1973">1973</option>
|
|
433
|
+
<option value="1974">1974</option>
|
|
434
|
+
<option value="1975">1975</option>
|
|
435
|
+
<option value="1976">1976</option>
|
|
436
|
+
|
|
437
|
+
<option value="1977">1977</option>
|
|
438
|
+
<option value="1978">1978</option>
|
|
439
|
+
<option value="1979">1979</option>
|
|
440
|
+
<option value="1980">1980</option>
|
|
441
|
+
<option value="1981">1981</option>
|
|
442
|
+
<option value="1982">1982</option>
|
|
443
|
+
|
|
444
|
+
<option value="1983">1983</option>
|
|
445
|
+
<option value="1984">1984</option>
|
|
446
|
+
<option value="1985">1985</option>
|
|
447
|
+
<option value="1986">1986</option>
|
|
448
|
+
<option value="1987">1987</option>
|
|
449
|
+
<option value="1988">1988</option>
|
|
450
|
+
|
|
451
|
+
<option value="1989">1989</option>
|
|
452
|
+
<option value="1990">1990</option>
|
|
453
|
+
</select>
|
|
454
|
+
</p>
|
|
455
|
+
<script type="text/javascript">
|
|
456
|
+
// <![CDATA[
|
|
457
|
+
var opts = {
|
|
458
|
+
formElements:{"date-sel":"Y","date-sel-mm":"n","date-sel-dd":"j"},
|
|
459
|
+
showWeeks:true,
|
|
460
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
461
|
+
// Disable Monday (index =0) and Tuesday (index = 1)
|
|
462
|
+
disabledDays:[1,1,0,0,0,0,0]
|
|
463
|
+
};
|
|
464
|
+
datePickerController.createDatePicker(opts);
|
|
465
|
+
// ]]>
|
|
466
|
+
</script>
|
|
467
|
+
|
|
468
|
+
<!-- DEMO #15 -->
|
|
469
|
+
<p><strong>Demo 15:</strong> Using a mixture of text input and selectLists.</p>
|
|
470
|
+
<p>
|
|
471
|
+
|
|
472
|
+
<select id="date-sel2-dd" name="date-sel2-dd">
|
|
473
|
+
<option value="day">Day</option>
|
|
474
|
+
<option value="1">1st</option>
|
|
475
|
+
<option value="2">2nd</option>
|
|
476
|
+
<option value="3">3rd</option>
|
|
477
|
+
<option value="4">4th</option>
|
|
478
|
+
|
|
479
|
+
<option value="5">5th</option>
|
|
480
|
+
<option value="6">6th</option>
|
|
481
|
+
<option value="7">7th</option>
|
|
482
|
+
<option value="8">8th</option>
|
|
483
|
+
<option value="9">9th</option>
|
|
484
|
+
<option value="10">10th</option>
|
|
485
|
+
|
|
486
|
+
<option value="11">11th</option>
|
|
487
|
+
<option value="12">12th</option>
|
|
488
|
+
<option value="13">13th</option>
|
|
489
|
+
<option value="14">14th</option>
|
|
490
|
+
<option value="15">15th</option>
|
|
491
|
+
<option value="16">16th</option>
|
|
492
|
+
|
|
493
|
+
<option value="17">17th</option>
|
|
494
|
+
<option value="18">18th</option>
|
|
495
|
+
<option value="19">19th</option>
|
|
496
|
+
<option value="20">20th</option>
|
|
497
|
+
<option value="21">21st</option>
|
|
498
|
+
<option value="22">22nd</option>
|
|
499
|
+
|
|
500
|
+
<option value="23">23rd</option>
|
|
501
|
+
<option value="24">24th</option>
|
|
502
|
+
<option value="25">25th</option>
|
|
503
|
+
<option value="26">26th</option>
|
|
504
|
+
<option value="27">27th</option>
|
|
505
|
+
<option value="28">28th</option>
|
|
506
|
+
|
|
507
|
+
<option value="29">29th</option>
|
|
508
|
+
<option value="30">30th</option>
|
|
509
|
+
<option value="31">31st</option>
|
|
510
|
+
</select>
|
|
511
|
+
<select id="date-sel2-mm" name="date-sel2-mm">
|
|
512
|
+
<option value="-1">Month</option>
|
|
513
|
+
<option value="1">January</option>
|
|
514
|
+
|
|
515
|
+
<option value="2">February</option>
|
|
516
|
+
<option value="3">March</option>
|
|
517
|
+
<option value="4">April</option>
|
|
518
|
+
<option value="5">May</option>
|
|
519
|
+
<option value="6">June</option>
|
|
520
|
+
<option value="7">July</option>
|
|
521
|
+
|
|
522
|
+
<option value="8">August</option>
|
|
523
|
+
<option value="9">September</option>
|
|
524
|
+
<option value="10">October</option>
|
|
525
|
+
<option value="11">November</option>
|
|
526
|
+
<option value="12">December</option>
|
|
527
|
+
</select>
|
|
528
|
+
|
|
529
|
+
<input type="text" class="w3em" id="date-sel2" name="date-sel2" />
|
|
530
|
+
</p>
|
|
531
|
+
<script type="text/javascript">
|
|
532
|
+
// <![CDATA[
|
|
533
|
+
var opts = {
|
|
534
|
+
formElements:{"date-sel2":"Y","date-sel2-mm":"n","date-sel2-dd":"j"},
|
|
535
|
+
showWeeks:true,
|
|
536
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y"
|
|
537
|
+
};
|
|
538
|
+
datePickerController.createDatePicker(opts);
|
|
539
|
+
// ]]>
|
|
540
|
+
</script>
|
|
541
|
+
|
|
542
|
+
<!-- DEMO #16 -->
|
|
543
|
+
<p><strong>Demo 16:</strong> Using a selectList to represent both month and year date parts. Again, you shouldn’t have to set the ranges as they are calculated for you whenever selectLists are used to represent the year.</p>
|
|
544
|
+
<p>
|
|
545
|
+
<input type="text" class="w3em" id="date-cbnd-1" name="date-cbnd-1" maxlength="2" />
|
|
546
|
+
<select id="date-cbnd-2" name="date-cbnd-2">
|
|
547
|
+
|
|
548
|
+
<option value="-1">Month & Year</option>
|
|
549
|
+
<option value="012008">January 2008</option>
|
|
550
|
+
<option value="022008">February 2008</option>
|
|
551
|
+
<option value="032008">March 2008</option>
|
|
552
|
+
<option value="042008">April 2008</option>
|
|
553
|
+
|
|
554
|
+
<option value="052008">May 2008</option>
|
|
555
|
+
<option value="062008">June 2008</option>
|
|
556
|
+
<option value="072008">July 2008</option>
|
|
557
|
+
<option value="082008">August 2008</option>
|
|
558
|
+
<option value="092008">September 2008</option>
|
|
559
|
+
<option value="102008">October 2008</option>
|
|
560
|
+
|
|
561
|
+
<option value="112008">November 2008</option>
|
|
562
|
+
<option value="122008">December 2008</option>
|
|
563
|
+
</select>
|
|
564
|
+
</p>
|
|
565
|
+
<script type="text/javascript">
|
|
566
|
+
// <![CDATA[
|
|
567
|
+
var opts = {
|
|
568
|
+
formElements:{"date-cbnd-2":"m-Y","date-cbnd-1":"d"},
|
|
569
|
+
showWeeks:true,
|
|
570
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y"
|
|
571
|
+
};
|
|
572
|
+
datePickerController.createDatePicker(opts);
|
|
573
|
+
// ]]>
|
|
574
|
+
</script>
|
|
575
|
+
</fieldset>
|
|
576
|
+
<fieldset>
|
|
577
|
+
<legend>Inline DatePickers</legend>
|
|
578
|
+
|
|
579
|
+
<!-- DEMO #17 -->
|
|
580
|
+
<div><label for="dp-s1">Demo 17</label> : <input type="text" class="w18em" id="dp-s1" name="dp-s1" value="" /></div>
|
|
581
|
+
|
|
582
|
+
<script type="text/javascript">
|
|
583
|
+
// <![CDATA[
|
|
584
|
+
var opts = {
|
|
585
|
+
formElements:{"dp-s1":"d-sl-m-sl-Y"},
|
|
586
|
+
staticPos:true,
|
|
587
|
+
fillGrid:true,
|
|
588
|
+
constrainSelection:false,
|
|
589
|
+
disabledDays:[1,1,0,0,0,0,0],
|
|
590
|
+
finalOpacity:100
|
|
591
|
+
};
|
|
592
|
+
datePickerController.createDatePicker(opts);
|
|
593
|
+
// ]]>
|
|
594
|
+
</script>
|
|
595
|
+
|
|
596
|
+
<!-- DEMO #18 -->
|
|
597
|
+
<p class="fauxhr">OK, the same datepicker as above but now let’s show some week numbers, add a status bar and set a top and bottom range (the 1<sup>st</sup> of last month to the 10<sup>th</sup> of next month).</p>
|
|
598
|
+
<div><label for="dp-s2">Demo 18</label> : <input type="text" class="w18em" id="dp-s2" name="dp-s2" value="" /></div>
|
|
599
|
+
|
|
600
|
+
<script type="text/javascript">
|
|
601
|
+
// <![CDATA[
|
|
602
|
+
var today = new Date(),
|
|
603
|
+
lastMonth = new Date(today.getFullYear(), today.getMonth(), 1),
|
|
604
|
+
nextMonth = new Date(today.getFullYear(), today.getMonth()+1, 1),
|
|
605
|
+
opts = {
|
|
606
|
+
formElements:{"dp-s2":"d-sl-m-sl-Y"},
|
|
607
|
+
showWeeks:true,
|
|
608
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
609
|
+
staticPos:true,
|
|
610
|
+
rangeHigh:nextMonth.getFullYear() + "" + pad(nextMonth.getMonth()+1) + "10",
|
|
611
|
+
rangeLow:lastMonth.getFullYear() + "" + pad(lastMonth.getMonth()) + "01"
|
|
612
|
+
};
|
|
613
|
+
datePickerController.createDatePicker(opts);
|
|
614
|
+
// ]]>
|
|
615
|
+
</script>
|
|
616
|
+
</fieldset>
|
|
617
|
+
<fieldset>
|
|
618
|
+
<legend>Disable/enable demos</legend>
|
|
619
|
+
|
|
620
|
+
<!-- DEMO #19 -->
|
|
621
|
+
<p>Testing to see if the activation button has been automatically disabled (as the associated form element is disabled):</p>
|
|
622
|
+
<p><label for="dp-de1">Demo 19</label> : <input type="text" disabled="disabled" class="w16em" id="dp-de1" name="dp-de1" value="" /></p>
|
|
623
|
+
|
|
624
|
+
<script type="text/javascript">
|
|
625
|
+
// <![CDATA[
|
|
626
|
+
var opts = {
|
|
627
|
+
formElements:{"dp-de1":"d-sl-m-sl-Y"},
|
|
628
|
+
showWeeks:true,
|
|
629
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y"
|
|
630
|
+
};
|
|
631
|
+
datePickerController.createDatePicker(opts);
|
|
632
|
+
// ]]>
|
|
633
|
+
</script>
|
|
634
|
+
|
|
635
|
+
<!-- DEMO #20 -->
|
|
636
|
+
<p class="fauxhr">Testing to see how an inline/static datePicker reacts to dynamic disabling/enabling:</p>
|
|
637
|
+
<p><label for="dp-de2">Demo 20</label> : <input type="text" class="w16em" id="dp-de2" name="dp-de2" value="" /></p>
|
|
638
|
+
<script type="text/javascript">
|
|
639
|
+
// <![CDATA[
|
|
640
|
+
var opts = {
|
|
641
|
+
formElements:{"dp-de2":"d-sl-m-sl-Y"},
|
|
642
|
+
showWeeks:true,
|
|
643
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
644
|
+
staticPos:true,
|
|
645
|
+
finalOpacity:90
|
|
646
|
+
};
|
|
647
|
+
datePickerController.createDatePicker(opts);
|
|
648
|
+
// ]]>
|
|
649
|
+
</script>
|
|
650
|
+
|
|
651
|
+
<button onclick="datePickerController.disable('dp-de2'); return false;">Disable</button>
|
|
652
|
+
<button onclick="datePickerController.enable('dp-de2'); return false;">Enable</button>
|
|
653
|
+
|
|
654
|
+
<!-- DEMO #21 -->
|
|
655
|
+
<p class="fauxhr">Testing to see how a popup datePicker reacts to dynamic disabling/enabling:</p>
|
|
656
|
+
<p><label for="dp-de3">Demo 21</label> : <input type="text" class="w16em" id="dp-de3" name="dp-de3" value="" /></p>
|
|
657
|
+
|
|
658
|
+
<script type="text/javascript">
|
|
659
|
+
// <![CDATA[
|
|
660
|
+
var opts = {
|
|
661
|
+
formElements:{"dp-de3":"d-sl-m-sl-Y"},
|
|
662
|
+
showWeeks:true,
|
|
663
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y"
|
|
664
|
+
};
|
|
665
|
+
datePickerController.createDatePicker(opts);
|
|
666
|
+
// ]]>
|
|
667
|
+
</script>
|
|
668
|
+
|
|
669
|
+
<button onclick="datePickerController.disable('dp-de3'); return false;">Disable</button>
|
|
670
|
+
<button onclick="datePickerController.enable('dp-de3'); return false;">Enable</button>
|
|
671
|
+
|
|
672
|
+
</fieldset>
|
|
673
|
+
<fieldset>
|
|
674
|
+
<legend>Callback function demos</legend>
|
|
675
|
+
|
|
676
|
+
<!-- DEMO #22 -->
|
|
677
|
+
<p>A simple datePicker with a callback function <code>disableEasterMonday</code> defined for the “redraw” event that dynamicaly calculates Easter Monday for the given year, disables the date and sets a bespoke title "Easter Monday" for the date in question.</p>
|
|
678
|
+
<p><label for="dp-cb1">Demo 22</label> : <input type="text" class="w16em" id="dp-cb1" name="dp-cb1" value="" /></p>
|
|
679
|
+
|
|
680
|
+
<script type="text/javascript">
|
|
681
|
+
// <![CDATA[
|
|
682
|
+
var opts = {
|
|
683
|
+
formElements:{"dp-cb1":"d-sl-m-sl-Y"},
|
|
684
|
+
showWeeks:true,
|
|
685
|
+
bespokeTitles:{"****1225":"Christmas Day", "****1231":"New Years Eve", "****0101":"New Years Day"},
|
|
686
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
687
|
+
// Set a callback function for the redraw event
|
|
688
|
+
callbackFunctions:{"redraw":[function(argObj) {
|
|
689
|
+
|
|
690
|
+
// Dynamically calculate Easter Monday - I've forgotten where this code
|
|
691
|
+
// was originally found and I don't even know if it returns a valid
|
|
692
|
+
// result...
|
|
693
|
+
var y = argObj.yyyy,
|
|
694
|
+
a=y%4,
|
|
695
|
+
b=y%7,
|
|
696
|
+
c=y%19,
|
|
697
|
+
d=(19*c+15)%30,
|
|
698
|
+
e=(2*a+4*b-d+34)%7,
|
|
699
|
+
m=Math.floor((d+e+114)/31),
|
|
700
|
+
g=(d+e+114)%31+1,
|
|
701
|
+
yyyymmdd = y + "0" + m + String(g < 10 ? "0" + g : g),
|
|
702
|
+
ret = {},
|
|
703
|
+
titles = {};
|
|
704
|
+
|
|
705
|
+
// Disable the date
|
|
706
|
+
ret[yyyymmdd] = 1;
|
|
707
|
+
datePickerController.addDisabledDates(argObj.id, ret);
|
|
708
|
+
|
|
709
|
+
// Just for fun, also set an "Easter Monday" status bar title for this date
|
|
710
|
+
ret[yyyymmdd] = "Easter Monday";
|
|
711
|
+
|
|
712
|
+
datePickerController.addBespokeTitles(argObj.id, ret);
|
|
713
|
+
|
|
714
|
+
}]}
|
|
715
|
+
};
|
|
716
|
+
datePickerController.createDatePicker(opts);
|
|
717
|
+
|
|
718
|
+
// ]]>
|
|
719
|
+
</script>
|
|
720
|
+
|
|
721
|
+
<!-- DEMO #23 -->
|
|
722
|
+
<p class="fauxhr">A simple datePicker with a callback function <code>showEnglishDate</code> defined for both the “create” and the “dateset” events that uses the <code>datePickerController.parseDate</code> method to return a more natural English language date, which is then rewritten beside the associated input.</p>
|
|
723
|
+
<p><label for="dp-cb2">Demo 23</label> : <input type="text" class="w16em" id="dp-cb2" name="dp-cb2" value="" /></p>
|
|
724
|
+
<script type="text/javascript">
|
|
725
|
+
// <![CDATA[
|
|
726
|
+
var opts = {
|
|
727
|
+
formElements:{"dp-cb2":"d-sl-m-sl-Y"},
|
|
728
|
+
showWeeks:true,
|
|
729
|
+
statusFormat:"l-cc-sp-d-sp-F-sp-Y",
|
|
730
|
+
// The function "showEnglishDate" is declared below
|
|
731
|
+
callbackFunctions:{"create":[showEnglishDate],"dateset":[showEnglishDate]}
|
|
732
|
+
};
|
|
733
|
+
datePickerController.createDatePicker(opts);
|
|
734
|
+
|
|
735
|
+
/*
|
|
736
|
+
|
|
737
|
+
The following functions update a span with an "English-ised" version of the
|
|
738
|
+
currently selected date for demo 23.
|
|
739
|
+
|
|
740
|
+
NOTE: These functions are not needed, they are only present to show you how you
|
|
741
|
+
might use callback functions to use the selected date in other ways!
|
|
742
|
+
|
|
743
|
+
*/
|
|
744
|
+
function createScaffold(argObj) {
|
|
745
|
+
// Make sure the span doesn't exist already
|
|
746
|
+
if(document.getElementById(argObj.id+"-LHDate")) return;
|
|
747
|
+
|
|
748
|
+
// Create the span node dynamically...
|
|
749
|
+
var spn = document.createElement('span');
|
|
750
|
+
p = document.getElementById(argObj.id).parentNode;
|
|
751
|
+
|
|
752
|
+
spn.id = argObj.id+"-LHDate";
|
|
753
|
+
spn.className = "longhand-date";
|
|
754
|
+
p.appendChild(spn);
|
|
755
|
+
|
|
756
|
+
// Remove the bottom margin on the input's wrapper paragraph
|
|
757
|
+
p.style.marginBottom = "0";
|
|
758
|
+
|
|
759
|
+
// Add a whitespace character to the span
|
|
760
|
+
spn.appendChild(document.createTextNode(String.fromCharCode(160)));
|
|
761
|
+
};
|
|
762
|
+
|
|
763
|
+
function showEnglishDate(argObj) {
|
|
764
|
+
// Grab the span & get a more English-ised version of the selected date
|
|
765
|
+
var spn = document.getElementById(argObj.id+"-LHDate"),
|
|
766
|
+
formattedDate = datePickerController.printFormattedDate(argObj.date, "l-cc-sp-d-S-sp-F-sp-Y", false);
|
|
767
|
+
|
|
768
|
+
// Make sure the span exists before attempting to use it!
|
|
769
|
+
if(!spn) {
|
|
770
|
+
createScaffold(argObj);
|
|
771
|
+
spn = document.getElementById(argObj.id+"-LHDate");
|
|
772
|
+
};
|
|
773
|
+
|
|
774
|
+
// Note: The 3rd argument to printFormattedDate is a Boolean value that
|
|
775
|
+
// instructs the script to use the imported locale (true) or not (false)
|
|
776
|
+
// when creating the dates. In this case, I'm not using the imported locale
|
|
777
|
+
// as I've used the "S" format mask, which returns the English ordinal
|
|
778
|
+
// suffix for a date e.g. "st", "nd", "rd" or "th" and using an
|
|
779
|
+
// imported locale would look strange if an English suffix was included
|
|
780
|
+
|
|
781
|
+
// Remove the current contents of the span
|
|
782
|
+
while(spn.firstChild) spn.removeChild(spn.firstChild);
|
|
783
|
+
|
|
784
|
+
// Add a new text node containing our formatted date
|
|
785
|
+
spn.appendChild(document.createTextNode(formattedDate));
|
|
786
|
+
};
|
|
787
|
+
|
|
788
|
+
|
|
789
|
+
// ]]>
|
|
790
|
+
</script>
|
|
791
|
+
|
|
792
|
+
</fieldset>
|
|
793
|
+
|
|
794
|
+
<p class="al-center">View the related “<a href="http://www.frequency-decoder.com/2009/09/09/unobtrusive-date-picker-widget-v5/">language in the lab</a>” post for this demo.</p>
|
|
795
|
+
</form>
|
|
796
|
+
</body>
|
|
797
|
+
</html>
|
|
798
|
+
|