Révision db9ffd17
Ajouté par Assos Assos il y a presque 10 ans
drupal7/sites/all/modules/date/CHANGELOG.txt | ||
---|---|---|
1 | 1 |
Date Module 7.x |
2 | 2 |
================= |
3 | 3 |
|
4 |
====================== |
|
5 |
Version 7.x-2.8 |
|
6 |
====================== |
|
7 |
- Issue #106713 by vijaycs85, heddn: Date Field title XSS(SA) |
|
8 |
- Issue #2310123 by Temoor: Fixed Fatal error in Migrate UI by Date Migrate Example. |
|
9 |
- Issue #2142277 by Temoor | lliss: Fixed Infinite Loop When Using Repeating Dates. |
|
10 |
- Issue #1871136 by Temoor | funkimunky: Fixed Cannot remove migrate example content type. |
|
11 |
- Issue #2261395 by minorOffense | kristofferwiklund: Fixed date_now is not respecting changes to timezone. |
|
12 |
- Issue #1832400 by imot3k, balintk: Fixed "The year/month/... is missing" error message is not translatable. |
|
13 |
- Issue #998076 by coredumperror, joelcollinsdc, brenk28: Fixed Problem with timezone handling (caused by date_get_timezone_db returning only UTC). |
|
14 |
- Issue #1976014 by Harmageddon: Remove unnecessary in date views pager. |
|
15 |
- Issue #2198807 by stickywes: Refactor field tests to utilize DateFieldBasic. |
|
16 |
- Issue #2146461 by vijaycs85 | Razia_b: Fixed Translated field's label is not used in its validation messages. |
|
17 |
- Issue #1874422 by bluetegu, brockfanning, rv0: Fixed Week pager may cause incorrect "next" link on year change. |
|
18 |
- Issue #2167015 by schifazl: HTML output breaks validation and accessibility. |
|
19 |
- Issue #2200513 by scor: Fix encoding issues in CHANGELOG.txt. |
|
20 |
- Issue #2115377 by coredumperror: Notice: Undefined index: add_microdata in theme_date_display_single(). |
|
21 |
- Issue #2178299 by sandykadam | joachim: Incorrect variable name in hook_views_data_alter(). |
|
22 |
- Issue #1431952 by Cadila | Shawn DeArmond: Date field will only set in Rules if it already has a value. |
|
23 |
- Issue #355058 by Grimreaper | prunelle: Hardcoded day/month/week output format for theme_date_nav_title(). |
|
24 |
- Issue #1968828 by pjcdawkins: Replace field_info_fields() with field_info_field_map() for Drupal >= 7.22. |
|
25 |
- Issue #2167033 by podarok, vijaycs85: Fixing tests in 2014 . |
|
4 | 26 |
|
5 | 27 |
====================== |
6 | 28 |
Version 7.x-2.7 |
... | ... | |
26 | 48 |
- Issue #1659466 by artkon: Fixed Date filter does not remember value in views if the identifier is something other than date_filter(). |
27 | 49 |
- Issue #1905096 by gielfeldt: Fixed Wrong usage of database API. |
28 | 50 |
- Issue #1791804 by 5n00py: Errors on form validation if date field placed in sub-form. |
29 |
- Issue [#636208] Date range: Expose a single filter to select events that start before the chosen date and end after the chosen date by anrikun.
|
|
30 |
- Issue [#2024269] Date popup documentation fix by RoySegall.
|
|
31 |
- Issue [#1835184] by Steven Jones, das-peter, jwhat: Fixed date_limit_format() can have poor performance.
|
|
32 |
- Issue [#991830] by milesw | restyler: Fixed validation errors when date_popup() date is localized.
|
|
33 |
- Issue [#2098715] by jhodgdon: Fixed Date field not obeying widget alters for #required.
|
|
34 |
- Issue [#1266688] by linclark, rbayliss, fago, colette: Support microdata in date fields.
|
|
35 |
- Issue [#1863610] by maximpodorov: Fixed Invalid date formatting.
|
|
36 |
- META [#2034231] [#1832544] Class registration for Migrate 2.5 or later - mikeryan, [#1835214] Automated tests failing - Exception thrown in Date2 migration - PatchRanger, [#
|
|
37 |
- Issue [#1350604] by Alan D., johaziel: Added Diff support for Date fields.
|
|
38 |
- Issue [#2086313] by dooug: Fixed Wrong path in date_popup() README.txt
|
|
39 |
- Issue [#1455558] by BTMash | mediameriquat: Fixed Missing file in date_views().info causes error 500.
|
|
40 |
- Issue [#1697322] by Alan D., ianmthomasuk | pandikamal: Fixed Call to a member function getName() on a non-object in date api.
|
|
51 |
- Issue #636208 Date range: Expose a single filter to select events that start before the chosen date and end after the chosen date by anrikun.
|
|
52 |
- Issue #2024269 Date popup documentation fix by RoySegall.
|
|
53 |
- Issue #1835184 by Steven Jones, das-peter, jwhat: Fixed date_limit_format() can have poor performance.
|
|
54 |
- Issue #991830 by milesw | restyler: Fixed validation errors when date_popup() date is localized.
|
|
55 |
- Issue #2098715 by jhodgdon: Fixed Date field not obeying widget alters for #required.
|
|
56 |
- Issue #1266688 by linclark, rbayliss, fago, colette: Support microdata in date fields.
|
|
57 |
- Issue #1863610 by maximpodorov: Fixed Invalid date formatting.
|
|
58 |
- META #2034231 #1832544 Class registration for Migrate 2.5 or later - mikeryan, [#1835214] Automated tests failing - Exception thrown in Date2 migration - PatchRanger, [#
|
|
59 |
- Issue #1350604 by Alan D., johaziel: Added Diff support for Date fields.
|
|
60 |
- Issue #2086313 by dooug: Fixed Wrong path in date_popup() README.txt
|
|
61 |
- Issue #1455558 by BTMash | mediameriquat: Fixed Missing file in date_views().info causes error 500.
|
|
62 |
- Issue #1697322 by Alan D., ianmthomasuk | pandikamal: Fixed Call to a member function getName() on a non-object in date api.
|
|
41 | 63 |
- Code cleanup, remove #prev values that were never used in repeat functionality. |
42 | 64 |
- Small fix needed to ensure cardinality gets set correctly if repeat option is changed in the UI. |
43 | 65 |
|
... | ... | |
146 | 168 |
|
147 | 169 |
- Issue #1437242 by zerbash, Remove extraneous leading slashes in module_load_include(). |
148 | 170 |
- Issue #1436722 by hefox: Fixed Undefined variable $form_set_error() used as function. |
149 |
- Issue #1250626 by G�bor Hojtsy, B-Prod, hefox: Added start date and end date labels.
|
|
171 |
- Issue #1250626 by Gábor Hojtsy, B-Prod, hefox: Added start date and end date labels.
|
|
150 | 172 |
- Issue #1253482, Make sure $argument->is_default gets reset by the Date pager when altering results. |
151 | 173 |
- Adjust Date Tools to work with changes to use Views templates to create calendars. |
152 | 174 |
- Issue #1398584 by dhalbert and , Make sure groupby times is initialized. |
... | ... | |
255 | 277 |
Bugfixes |
256 | 278 |
|
257 | 279 |
- Fix to new default date handling, the default date has to set a date in the database timezone, not the display timezone. |
258 |
- Issue #1245106 by G�bor Hojtsy, Hide the option to add the delta into the view for single value fields.
|
|
280 |
- Issue #1245106 by Gábor Hojtsy, Hide the option to add the delta into the view for single value fields.
|
|
259 | 281 |
- Issue #1370876, Make sure new Date All Day code does not try to set the popup values if Date Popup is disabled. |
260 | 282 |
- Issue #874322, Add back the date_field_all_day() function to avoid breaking other modules that are using it. |
261 | 283 |
- Fix Date text placeholder to display a formatted date instead of a format. Follow up to Date repeat UI changes. |
... | ... | |
386 | 408 |
|
387 | 409 |
New Features/UX Improvements |
388 | 410 |
|
389 |
- Issue #1249724 by KarenS, G�bor Hojtsy, David_Rothstein, Improve usability of date and time input configuration.
|
|
411 |
- Issue #1249724 by KarenS, Gábor Hojtsy, David_Rothstein, Improve usability of date and time input configuration.
|
|
390 | 412 |
- Issue #1250784 by David_Rothstein, Add user-friendly labels for start and end date values in Views. |
391 | 413 |
- Issue #742146, Add option to remove X-WR-CALNAME if VEVENT is not a feed. |
392 | 414 |
- Add option to change method from PUBLISH to REQUEST in VCALENDAR. |
... | ... | |
396 | 418 |
- Issue #1249724 by David_Rothstein: Improve usability of date and time input configuration |
397 | 419 |
- Issue #1177198 by tim.plunkett: Allow CTools to process #dependency for date elements. |
398 | 420 |
- Issue #1245562 by David_Rothstein, Rename the default date display format to something friendlier |
399 |
- Issue #1239934 by David_Rothstein and G�bor Hojtsy, Reuse the "years back and forward" dropdown widget on the Views filter settings page.
|
|
400 |
- Issue #1239228 by G�bor Hojtsy, Date Views filter form UI improvements, clarify the way absolute and relative dates work.
|
|
421 |
- Issue #1239934 by David_Rothstein and Gábor Hojtsy, Reuse the "years back and forward" dropdown widget on the Views filter settings page.
|
|
422 |
- Issue #1239228 by Gábor Hojtsy, Date Views filter form UI improvements, clarify the way absolute and relative dates work.
|
|
401 | 423 |
- Issue #233047 by ksenzee and David_Rothstein, Add the Vegas jQuery timepicker as a new time selector option. |
402 | 424 |
- Issue #1145976 by tim.plunkett and KarenS, Add 'is date' identifier to all date handlers. |
403 | 425 |
- Issue #1234140 by arlinsundbulte, Change terminology in user-facing text from 'From/To Date' to 'Start/End Date'. |
... | ... | |
444 | 466 |
- Issue #1254582 Repeat additions need to be adjusted to use the same time as the original date. |
445 | 467 |
- Move vcalendar and vevent templates from Date Views to Date API modules. |
446 | 468 |
- Follow up to Issue #1250344, We don't need extra space when there is a description, only when there is not. |
447 |
- Issue #1239228 by G�bor Hojtsy, More tweaks to filter css.
|
|
448 |
- Issue #1244924 by G�bor Hojtsy, Minor text improvements in date filter configuration
|
|
469 |
- Issue #1239228 by Gábor Hojtsy, More tweaks to filter css.
|
|
470 |
- Issue #1244924 by Gábor Hojtsy, Minor text improvements in date filter configuration
|
|
449 | 471 |
- Issue #1245556 by David_Rothstein, Date granularity description incorrectly implies that it affects the date attributes that are displayed |
450 |
- Issue #1247444 by G�bor Hojtsy, Give a little breathing space to the date year range "other" field
|
|
472 |
- Issue #1247444 by Gábor Hojtsy, Give a little breathing space to the date year range "other" field
|
|
451 | 473 |
- Issue #1250344 by jessebeach, Fix padding around date fields by adding clearfix class. |
452 | 474 |
- Issue #1249116 by yched, Fix various glitches with D6 migration code. |
453 | 475 |
- Issue #1243022 by fmosca and KarenS, Make sure all_day #states visibility is only set when there is a value for all_day. |
... | ... | |
455 | 477 |
- Issue #1246416, Test whether libraries_get_path() returns a valid path before using it. |
456 | 478 |
- Issue #1235994, Don't display 'All Day' when using a format that has no time. |
457 | 479 |
- Issue #1245690 by mikeryan, Migration plugin missing seconds from date formats |
458 |
- Issue #1229406 by David Rothstein, G�bor Hojtsy, and tim.plunkett Fix broken timepicker in Chrome and Safari.
|
|
480 |
- Issue #1229406 by David Rothstein, Gábor Hojtsy, and tim.plunkett Fix broken timepicker in Chrome and Safari.
|
|
459 | 481 |
- Issue #1239412 by keithm, Fix validation error when #access is false. |
460 | 482 |
- Issue #1232522, Don't alter field_ui_field_edit form except on date fields. |
461 | 483 |
- Issue #1243842, Make sure the All Day and Show End Date flags work correctly in unlimited value fields that use ajax. |
drupal7/sites/all/modules/date/date.info | ||
---|---|---|
12 | 12 |
files[] = tests/date_validation.test |
13 | 13 |
files[] = tests/date_timezone.test |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
16 |
version = "7.x-2.7"
|
|
15 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
16 |
version = "7.x-2.8"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "date" |
19 |
datestamp = "1387659206"
|
|
19 |
datestamp = "1406653438"
|
|
20 | 20 |
|
drupal7/sites/all/modules/date/date.module | ||
---|---|---|
536 | 536 |
if (!empty($field['settings']['todate'])) { |
537 | 537 |
// Define a simple data structure containing both dates. |
538 | 538 |
$property['type'] = ($field['cardinality'] != 1) ? 'list<struct>' : 'struct'; |
539 |
$property['auto creation'] = 'date_entity_metadata_struct_create'; |
|
539 | 540 |
$property['getter callback'] = 'entity_metadata_field_verbatim_get'; |
540 | 541 |
$property['setter callback'] = 'entity_metadata_field_verbatim_set'; |
541 | 542 |
$property['property info'] = array( |
... | ... | |
645 | 646 |
drupal_static_reset('field_language'); |
646 | 647 |
} |
647 | 648 |
|
649 |
/** |
|
650 |
* Auto creation callback for fields which contain two date values in one |
|
651 |
*/ |
|
652 |
function date_entity_metadata_struct_create($name, $property_info) { |
|
653 |
return array( |
|
654 |
'date_type' => $property_info['field']['columns'][$name]['type'], |
|
655 |
'timezone_db' => $property_info['field']['settings']['timezone_db'], |
|
656 |
); |
|
657 |
} |
|
658 |
|
|
648 | 659 |
/** |
649 | 660 |
* Callback for setting an individual field value if a to-date may be there too. |
650 | 661 |
* Based on entity_property_verbatim_set(). |
drupal7/sites/all/modules/date/date.theme | ||
---|---|---|
219 | 219 |
* Template preprocess function for displaying a single date. |
220 | 220 |
*/ |
221 | 221 |
function template_preprocess_date_display_single(&$variables) { |
222 |
if ($variables['add_rdf'] || $variables['add_microdata']) {
|
|
222 |
if ($variables['add_rdf'] || !empty($variables['add_microdata'])) {
|
|
223 | 223 |
// Pass along the rdf mapping for this field, if any. Add some default rdf |
224 | 224 |
// attributes that will be used if not overridden by attributes passed in. |
225 | 225 |
$rdf_mapping = $variables['rdf_mapping']; |
... | ... | |
261 | 261 |
// Wrap the result with the attributes. |
262 | 262 |
$output = '<span class="date-display-single"' . drupal_attributes($attributes) . '>' . $date . $timezone . '</span>'; |
263 | 263 |
|
264 |
if ($variables['add_microdata']) {
|
|
264 |
if (!empty($variables['add_microdata'])) {
|
|
265 | 265 |
$output .= '<meta' . drupal_attributes($variables['microdata']['value']['#attributes']) . '/>'; |
266 | 266 |
} |
267 | 267 |
|
... | ... | |
372 | 372 |
|
373 | 373 |
// Group start/end items together in fieldset. |
374 | 374 |
$fieldset = array( |
375 |
'#title' => t($element['#title']) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
|
|
375 |
'#title' => field_filter_xss(t($element['#title'])) . ' ' . ($element['#delta'] > 0 ? intval($element['#delta'] + 1) : ''),
|
|
376 | 376 |
'#value' => '', |
377 | 377 |
'#description' => !empty($element['#fieldset_description']) ? $element['#fieldset_description'] : '', |
378 | 378 |
'#attributes' => array(), |
drupal7/sites/all/modules/date/date_all_day/date_all_day.info | ||
---|---|---|
5 | 5 |
package = Date/Time |
6 | 6 |
core = 7.x |
7 | 7 |
|
8 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
9 |
version = "7.x-2.7"
|
|
8 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
9 |
version = "7.x-2.8"
|
|
10 | 10 |
core = "7.x" |
11 | 11 |
project = "date" |
12 |
datestamp = "1387659206"
|
|
12 |
datestamp = "1406653438"
|
|
13 | 13 |
|
drupal7/sites/all/modules/date/date_api/date_api.info | ||
---|---|---|
9 | 9 |
files[] = date_api.module |
10 | 10 |
files[] = date_api_sql.inc |
11 | 11 |
|
12 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
13 |
version = "7.x-2.7"
|
|
12 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
13 |
version = "7.x-2.8"
|
|
14 | 14 |
core = "7.x" |
15 | 15 |
project = "date" |
16 |
datestamp = "1387659206"
|
|
16 |
datestamp = "1406653438"
|
|
17 | 17 |
|
drupal7/sites/all/modules/date/date_api/date_api.module | ||
---|---|---|
459 | 459 |
if (!$true && $granularity) { |
460 | 460 |
foreach ((array) $granularity as $part) { |
461 | 461 |
if (!$this->hasGranularity($part) && in_array($part, array('second', 'minute', 'hour', 'day', 'month', 'year'))) { |
462 |
$this->errors[$part] = t("The $part is missing."); |
|
462 |
switch ($part) { |
|
463 |
case 'second': |
|
464 |
$this->errors[$part] = t('The second is missing.'); |
|
465 |
break; |
|
466 |
case 'minute': |
|
467 |
$this->errors[$part] = t('The minute is missing.'); |
|
468 |
break; |
|
469 |
case 'hour': |
|
470 |
$this->errors[$part] = t('The hour is missing.'); |
|
471 |
break; |
|
472 |
case 'day': |
|
473 |
$this->errors[$part] = t('The day is missing.'); |
|
474 |
break; |
|
475 |
case 'month': |
|
476 |
$this->errors[$part] = t('The month is missing.'); |
|
477 |
break; |
|
478 |
case 'year': |
|
479 |
$this->errors[$part] = t('The year is missing.'); |
|
480 |
break; |
|
481 |
} |
|
463 | 482 |
} |
464 | 483 |
} |
465 | 484 |
} |
... | ... | |
1727 | 1746 |
* The current time as a date object. |
1728 | 1747 |
*/ |
1729 | 1748 |
function date_now($timezone = NULL, $reset = FALSE) { |
1730 |
$now = &drupal_static(__FUNCTION__); |
|
1749 |
if ($reset) { |
|
1750 |
drupal_static_reset(__FUNCTION__ . $timezone); |
|
1751 |
} |
|
1752 |
|
|
1753 |
$now = &drupal_static(__FUNCTION__ . $timezone); |
|
1731 | 1754 |
|
1732 |
if (!isset($now) || $reset) {
|
|
1755 |
if (!isset($now)) { |
|
1733 | 1756 |
$now = new DateObject('now', $timezone); |
1734 | 1757 |
} |
1735 | 1758 |
|
1736 |
return $now; |
|
1759 |
// Avoid unexpected manipulation of cached $now object |
|
1760 |
// by subsequent code execution |
|
1761 |
// @see https://drupal.org/node/2261395 |
|
1762 |
$clone = clone $now; |
|
1763 |
return $clone; |
|
1737 | 1764 |
} |
1765 |
|
|
1738 | 1766 |
/** |
1739 | 1767 |
* Determines if a timezone string is valid. |
1740 | 1768 |
* |
... | ... | |
2357 | 2385 |
} |
2358 | 2386 |
|
2359 | 2387 |
/** |
2360 |
* Function to figure out which db timezone applies to a date and select it.
|
|
2388 |
* Function to figure out which db timezone applies to a date. |
|
2361 | 2389 |
* |
2362 | 2390 |
* @param string $handling |
2363 | 2391 |
* The timezone handling. |
2364 | 2392 |
* @param string $timezone |
2365 |
* (optional) A timezone string. Defaults to an empty string. |
|
2393 |
* (optional) When $handling is 'date', date_get_timezone_db() returns this |
|
2394 |
* value. |
|
2366 | 2395 |
* |
2367 | 2396 |
* @return string |
2368 | 2397 |
* The timezone string. |
2369 | 2398 |
*/ |
2370 |
function date_get_timezone_db($handling, $timezone = '') {
|
|
2399 |
function date_get_timezone_db($handling, $timezone = NULL) {
|
|
2371 | 2400 |
switch ($handling) { |
2372 |
case 'none': |
|
2373 |
$timezone = date_default_timezone(); |
|
2401 |
case ('utc'): |
|
2402 |
case ('site'): |
|
2403 |
case ('user'): |
|
2404 |
// These handling modes all convert to UTC before storing in the DB. |
|
2405 |
$timezone = 'UTC'; |
|
2406 |
break; |
|
2407 |
case ('date'): |
|
2408 |
if ($timezone == NULL) { |
|
2409 |
// This shouldn't happen, since it's meaning is undefined. But we need |
|
2410 |
// to fall back to *something* that's a legal timezone. |
|
2411 |
$timezone = date_default_timezone(); |
|
2412 |
} |
|
2374 | 2413 |
break; |
2414 |
case ('none'): |
|
2375 | 2415 |
default: |
2376 |
$timezone = 'UTC';
|
|
2416 |
$timezone = date_default_timezone();
|
|
2377 | 2417 |
break; |
2378 | 2418 |
} |
2379 |
return $timezone > '' ? $timezone : 'UTC';
|
|
2419 |
return $timezone; |
|
2380 | 2420 |
} |
2381 | 2421 |
|
2382 | 2422 |
/** |
drupal7/sites/all/modules/date/date_context/date_context.info | ||
---|---|---|
8 | 8 |
|
9 | 9 |
files[] = date_context.module |
10 | 10 |
files[] = plugins/date_context_date_condition.inc |
11 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
12 |
version = "7.x-2.7"
|
|
11 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
12 |
version = "7.x-2.8"
|
|
13 | 13 |
core = "7.x" |
14 | 14 |
project = "date" |
15 |
datestamp = "1387659206"
|
|
15 |
datestamp = "1406653438"
|
|
16 | 16 |
|
drupal7/sites/all/modules/date/date_elements.inc | ||
---|---|---|
401 | 401 |
$element[$to_field]['#date_title'] = t('@field_name End date', array('@field_name' => $instance['label'])); |
402 | 402 |
} |
403 | 403 |
else { |
404 |
$element[$from_field]['#date_title'] = $instance['label'];
|
|
404 |
$element[$from_field]['#date_title'] = t('@field_name', array('@field_name' => $instance['label']));
|
|
405 | 405 |
} |
406 | 406 |
|
407 | 407 |
$context = array( |
drupal7/sites/all/modules/date/date_migrate/date_migrate.info | ||
---|---|---|
4 | 4 |
package = Date/Time |
5 | 5 |
hidden = TRUE |
6 | 6 |
|
7 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
8 |
version = "7.x-2.7"
|
|
7 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
8 |
version = "7.x-2.8"
|
|
9 | 9 |
core = "7.x" |
10 | 10 |
project = "date" |
11 |
datestamp = "1387659206"
|
|
11 |
datestamp = "1406653438"
|
|
12 | 12 |
|
drupal7/sites/all/modules/date/date_migrate/date_migrate_example/date_migrate_example.info | ||
---|---|---|
20 | 20 |
project = "date_migrate_example" |
21 | 21 |
version = "7.x-2.0" |
22 | 22 |
|
23 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
24 |
version = "7.x-2.7"
|
|
23 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
24 |
version = "7.x-2.8"
|
|
25 | 25 |
core = "7.x" |
26 | 26 |
project = "date" |
27 |
datestamp = "1387659206"
|
|
27 |
datestamp = "1406653438"
|
|
28 | 28 |
|
drupal7/sites/all/modules/date/date_migrate/date_migrate_example/date_migrate_example.install | ||
---|---|---|
12 | 12 |
Migration::deregisterMigration('DateExample'); |
13 | 13 |
} |
14 | 14 |
|
15 |
/** |
|
16 |
* Implements hook_uninstall(). |
|
17 |
*/ |
|
18 |
function date_migrate_example_uninstall() { |
|
19 |
node_type_delete('date_migrate_example'); |
|
20 |
variable_del('node_preview_date_migrate_example'); |
|
21 |
node_types_rebuild(); |
|
22 |
menu_rebuild(); |
|
23 |
} |
drupal7/sites/all/modules/date/date_migrate/date_migrate_example/date_migrate_example.migrate.inc | ||
---|---|---|
13 | 13 |
/** |
14 | 14 |
* Sets up the migration. |
15 | 15 |
*/ |
16 |
public function __construct($arguments = array()) {
|
|
17 |
parent::__construct($arguments);
|
|
16 |
public function __construct() { |
|
17 |
parent::__construct(); |
|
18 | 18 |
$this->description = t('Example migration into date fields'); |
19 | 19 |
|
20 | 20 |
$this->map = new MigrateSQLMap($this->machineName, |
drupal7/sites/all/modules/date/date_popup/date_popup.info | ||
---|---|---|
7 | 7 |
|
8 | 8 |
stylesheets[all][] = themes/datepicker.1.7.css |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
11 |
version = "7.x-2.7"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
11 |
version = "7.x-2.8"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1387659206"
|
|
14 |
datestamp = "1406653438"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_repeat/date_repeat.info | ||
---|---|---|
7 | 7 |
files[] = tests/date_repeat.test |
8 | 8 |
files[] = tests/date_repeat_form.test |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
11 |
version = "7.x-2.7"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
11 |
version = "7.x-2.8"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1387659206"
|
|
14 |
datestamp = "1406653438"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_repeat/date_repeat_calc.inc | ||
---|---|---|
173 | 173 |
} |
174 | 174 |
if ($rrule['FREQ'] == 'YEARLY') { |
175 | 175 |
// Back up to first of year and jump. |
176 |
$current_day = date_repeat_set_year_day($current_day, NULL, 1, '+', $timezone, $modify_time); |
|
176 |
$current_day = date_repeat_set_year_day($current_day, NULL, NULL, 1, '+', $timezone, $modify_time);
|
|
177 | 177 |
date_modify($current_day, '+' . $jump . $modify_time); |
178 | 178 |
} |
179 | 179 |
$finished = date_repeat_is_finished($current_day, $days, $count, $end_date); |
... | ... | |
223 | 223 |
$ordered = date_repeat_days_ordered($week_start_rule); |
224 | 224 |
$ordered_keys = array_flip($ordered); |
225 | 225 |
|
226 |
foreach ($rrule['BYDAY'] as $day) { |
|
227 |
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs); |
|
228 |
if (!empty($regs[2])) { |
|
229 |
// Convert parameters into full day name, count, and direction. |
|
230 |
$direction_days[] = array( |
|
231 |
'day' => $day_names[$regs[3]], |
|
232 |
'direction' => !empty($regs[1]) ? $regs[1] : '+', |
|
233 |
'direction_count' => $regs[2], |
|
234 |
); |
|
226 |
if ($rrule['FREQ'] == 'YEARLY' && !empty($rrule['BYMONTH'])) { |
|
227 |
// Additional cycle to apply month preferences. |
|
228 |
foreach ($rrule['BYMONTH'] as $month) { |
|
229 |
foreach ($rrule['BYDAY'] as $day) { |
|
230 |
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs); |
|
231 |
// Convert parameters into full day name, count, and direction. |
|
232 |
// Add leading zero to first 9 months. |
|
233 |
if (!empty($regs[2])) { |
|
234 |
$direction_days[] = array( |
|
235 |
'day' => $day_names[$regs[3]], |
|
236 |
'direction' => !empty($regs[1]) ? $regs[1] : '+', |
|
237 |
'direction_count' => $regs[2], |
|
238 |
'month' => strlen($month) > 1 ? $month : '0' . $month, |
|
239 |
); |
|
240 |
} |
|
241 |
else { |
|
242 |
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]]; |
|
243 |
} |
|
244 |
} |
|
235 | 245 |
} |
236 |
else { |
|
237 |
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]]; |
|
246 |
} |
|
247 |
else { |
|
248 |
foreach ($rrule['BYDAY'] as $day) { |
|
249 |
preg_match("@(-)?([0-9]+)?([SU|MO|TU|WE|TH|FR|SA]{2})@", trim($day), $regs); |
|
250 |
if (!empty($regs[2])) { |
|
251 |
// Convert parameters into full day name, count, and direction. |
|
252 |
$direction_days[] = array( |
|
253 |
'day' => $day_names[$regs[3]], |
|
254 |
'direction' => !empty($regs[1]) ? $regs[1] : '+', |
|
255 |
'direction_count' => $regs[2], |
|
256 |
'month' => NULL, |
|
257 |
); |
|
258 |
} |
|
259 |
else { |
|
260 |
$week_days[$ordered_keys[$regs[3]]] = $day_names[$regs[3]]; |
|
261 |
} |
|
238 | 262 |
} |
239 | 263 |
} |
240 | 264 |
ksort($week_days); |
... | ... | |
251 | 275 |
$current_day = date_repeat_set_month_day($current_day, $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time); |
252 | 276 |
} |
253 | 277 |
else { |
254 |
$current_day = date_repeat_set_year_day($current_day, $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time); |
|
278 |
$current_day = date_repeat_set_year_day($current_day, $day['month'], $day['day'], $day['direction_count'], $day['direction'], $timezone, $modify_time);
|
|
255 | 279 |
} |
256 | 280 |
date_repeat_add_dates($days, $current_day, $start_date, $end_date, $exceptions, $rrule); |
257 | 281 |
} |
... | ... | |
543 | 567 |
* If $day is empty, will set to the number of days from the |
544 | 568 |
* beginning or end of the year. |
545 | 569 |
*/ |
546 |
function date_repeat_set_year_day($date_in, $day, $count = 1, $direction = '+', $timezone = 'UTC', $modify_time) { |
|
570 |
function date_repeat_set_year_day($date_in, $month, $day, $count = 1, $direction = '+', $timezone = 'UTC', $modify_time) {
|
|
547 | 571 |
if (is_object($date_in)) { |
548 | 572 |
$current_year = date_format($date_in, 'Y'); |
549 | 573 |
|
550 | 574 |
// Reset to the start of the month. |
551 | 575 |
// See note above. |
552 | 576 |
$datetime = date_format($date_in, DATE_FORMAT_DATETIME); |
553 |
$datetime = substr_replace($datetime, '01-01', 5, 5); |
|
577 |
$month_key = isset($month) ? $month : '01'; |
|
578 |
$datetime = substr_replace($datetime, $month_key . '-01', 5, 5); |
|
554 | 579 |
$date = new DateObject($datetime, $timezone); |
555 |
if ($direction == '-') { |
|
556 |
// For negative search, start from the end of the year. |
|
557 |
date_modify($date, '+1 year' . $modify_time); |
|
580 |
|
|
581 |
if (isset($month)) { |
|
582 |
if ($direction == '-') { |
|
583 |
// For negative search, start from the end of the month. |
|
584 |
$modifier = '+1 month'; |
|
585 |
} |
|
586 |
else { |
|
587 |
// For positive search, back up one day to get outside the |
|
588 |
// current month, so we can catch the first of the month. |
|
589 |
$modifier = '-1 day'; |
|
590 |
} |
|
558 | 591 |
} |
559 | 592 |
else { |
560 |
// For positive search, back up one day to get outside the |
|
561 |
// current year, so we can catch the first of the year. |
|
562 |
date_modify($date, '-1 day' . $modify_time); |
|
593 |
if ($direction == '-') { |
|
594 |
// For negative search, start from the end of the year. |
|
595 |
$modifier = '+1 year'; |
|
596 |
} |
|
597 |
else { |
|
598 |
// For positive search, back up one day to get outside the |
|
599 |
// current year, so we can catch the first of the year. |
|
600 |
$modifier = '-1 day'; |
|
601 |
} |
|
563 | 602 |
} |
603 |
|
|
604 |
date_modify($date, $modifier . $modify_time); |
|
605 |
|
|
564 | 606 |
if (empty($day)) { |
565 | 607 |
date_modify($date, $direction . $count . ' days' . $modify_time); |
566 | 608 |
} |
drupal7/sites/all/modules/date/date_repeat/tests/date_repeat.test | ||
---|---|---|
377 | 377 |
$result = implode(', ', $dates); |
378 | 378 |
$this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . '; results: ' . $result); |
379 | 379 |
|
380 |
//Every Last Thursday in November, every year, five times: |
|
381 |
$start = "2014-11-27 00:00:00"; |
|
382 |
$rule = 'FREQ=YEARLY;INTERVAL=1;BYDAY=-1TH;BYMONTH=11;COUNT=5;WKST=SU'; |
|
383 |
// ==> (2014 00:00 AM EDT)November 27 |
|
384 |
// (2015 00:00 AM EDT)November 26 |
|
385 |
// (2016 00:00 AM EDT)November 24 |
|
386 |
// (2017 00:00 AM EDT)November 30 |
|
387 |
// (2018 00:00 AM EDT)November 29 |
|
388 |
$dates = date_repeat_calc($rule, $start, NULL, array()); |
|
389 |
$shouldbe = '2014-11-27 00:00:00, 2015-11-26 00:00:00, 2016-11-24 00:00:00, 2017-11-30 00:00:00, 2018-11-29 00:00:00'; |
|
390 |
$result = implode(', ', $dates); |
|
391 |
$this->assertEqual($result, $shouldbe, $rule . '; Starting ' . $start . '; results: ' . $result); |
|
392 |
|
|
380 | 393 |
return; |
381 | 394 |
|
382 | 395 |
//Every Thanksgiving, forever: |
drupal7/sites/all/modules/date/date_repeat/tests/date_repeat_form.test | ||
---|---|---|
195 | 195 |
$edit = array(); |
196 | 196 |
$edit['title'] = $this->randomName(8); |
197 | 197 |
$edit['body[und][0][value]'] = $this->randomName(16); |
198 |
$current_year = date('Y'); |
|
199 |
|
|
198 | 200 |
|
199 | 201 |
switch ($options) { |
200 | 202 |
case 'select': |
201 |
$edit['field_test[und][0][value][year]'] = '2010';
|
|
203 |
$edit['field_test[und][0][value][year]'] = $current_year;
|
|
202 | 204 |
$edit['field_test[und][0][value][month]'] = '10'; |
203 | 205 |
$edit['field_test[und][0][value][day]'] = '7'; |
204 | 206 |
$edit['field_test[und][0][value][hour]'] = '10'; |
205 | 207 |
$edit['field_test[und][0][value][minute]'] = '30'; |
206 | 208 |
break; |
207 | 209 |
case 'text': |
208 |
$edit['field_test[und][0][value][date]'] = '2010-10-07 10:30';
|
|
210 |
$edit['field_test[und][0][value][date]'] = format_string('!year-10-07 10:30', array('!year' => $current_year));
|
|
209 | 211 |
break; |
210 | 212 |
case 'popup': |
211 |
$edit['field_test[und][0][value][date]'] = '2010-10-07';
|
|
213 |
$edit['field_test[und][0][value][date]'] = format_string('!year-10-07', array('!year' => $current_year));
|
|
212 | 214 |
$edit['field_test[und][0][value][time]'] = '10:30'; |
213 | 215 |
break; |
214 | 216 |
} |
... | ... | |
378 | 380 |
else { |
379 | 381 |
$edit['field_test[und][0][rrule][range_of_repeat]'] = 'UNTIL'; |
380 | 382 |
$date = array( |
381 |
'year' => '2011',
|
|
383 |
'year' => $current_year + 1,
|
|
382 | 384 |
'month' => '10', |
383 | 385 |
'day' => '07' |
384 | 386 |
); |
... | ... | |
392 | 394 |
case 'exclude': |
393 | 395 |
$exclude_include_edit['field_test[und][0][rrule][show_exceptions]'] = TRUE; |
394 | 396 |
$date = array( |
395 |
'year' => '2010',
|
|
397 |
'year' => $current_year,
|
|
396 | 398 |
'month' => '10', |
397 | 399 |
'day' => '07' |
398 | 400 |
); |
... | ... | |
401 | 403 |
case 'include': |
402 | 404 |
$exclude_include_edit['field_test[und][0][rrule][show_additions]'] = TRUE; |
403 | 405 |
$date = array( |
404 |
'year' => '2013',
|
|
406 |
'year' => $current_year + 3,
|
|
405 | 407 |
'month' => '10', |
406 | 408 |
'day' => '07' |
407 | 409 |
); |
... | ... | |
410 | 412 |
case 'exclude_include': |
411 | 413 |
$exclude_include_edit['field_test[und][0][rrule][show_exceptions]'] = TRUE; |
412 | 414 |
$date = array( |
413 |
'year' => '2010',
|
|
415 |
'year' => $current_year,
|
|
414 | 416 |
'month' => '10', |
415 | 417 |
'day' => '07' |
416 | 418 |
); |
... | ... | |
418 | 420 |
|
419 | 421 |
$exclude_include_edit['field_test[und][0][rrule][show_additions]'] = TRUE; |
420 | 422 |
$date = array( |
421 |
'year' => '2013',
|
|
423 |
'year' => $current_year + 3,
|
|
422 | 424 |
'month' => '10', |
423 | 425 |
'day' => '07' |
424 | 426 |
); |
... | ... | |
510 | 512 |
break; |
511 | 513 |
case 'text': |
512 | 514 |
case 'popup': |
513 |
//$return["{$field_name}[datetime][date]"] = '2011-10-07'; |
|
514 | 515 |
$return["{$form_field_name}[datetime][date]"] = "{$date['year']}-{$date['month']}-{$date['day']}"; |
515 | 516 |
break; |
516 | 517 |
} |
drupal7/sites/all/modules/date/date_repeat_field/date_repeat_field.info | ||
---|---|---|
7 | 7 |
package = Date/Time |
8 | 8 |
core = 7.x |
9 | 9 |
|
10 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
11 |
version = "7.x-2.7"
|
|
10 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
11 |
version = "7.x-2.8"
|
|
12 | 12 |
core = "7.x" |
13 | 13 |
project = "date" |
14 |
datestamp = "1387659206"
|
|
14 |
datestamp = "1406653438"
|
|
15 | 15 |
|
drupal7/sites/all/modules/date/date_repeat_field/date_repeat_field.module | ||
---|---|---|
115 | 115 |
} |
116 | 116 |
|
117 | 117 |
/** |
118 |
* See if the user can access repeat date info for this field. |
|
118 |
* See if the user can access repeat date info for this entity. |
|
119 |
* |
|
120 |
* @param string $entity_type |
|
121 |
* The entity type. |
|
122 |
* @param string $entity |
|
123 |
* The specific entity to check (optional). |
|
124 |
* |
|
125 |
* @return bool |
|
126 |
* Return TRUE if there is at least one date field attached to this entity, |
|
127 |
* and the current user has the permission 'view date repeats'; FALSE otherwise. |
|
119 | 128 |
*/ |
120 | 129 |
function date_repeat_field_show($entity_type = 'node', $entity = NULL) { |
130 |
if (!user_access('view date repeats')) { |
|
131 |
return FALSE; |
|
132 |
} |
|
133 |
|
|
121 | 134 |
$bundle = date_get_entity_bundle($entity_type, $entity); |
122 |
foreach (field_info_fields() as $field_name => $field) { |
|
123 |
if (in_array($field['type'], array('date', 'datestamp', 'datetime')) |
|
124 |
&& array_key_exists($entity_type, $field['bundles']) |
|
125 |
&& in_array($bundle, $field['bundles'][$entity_type]) |
|
126 |
&& date_is_repeat_field($field)) { |
|
127 |
return user_access('view date repeats'); |
|
135 |
|
|
136 |
// In Drupal 7.22 the field_info_field_map() function was added, which is more |
|
137 |
// memory-efficient in certain cases than field_info_fields(). |
|
138 |
// @see https://drupal.org/node/1915646 |
|
139 |
$field_map_available = version_compare(VERSION, '7.22', '>='); |
|
140 |
$field_list = $field_map_available ? field_info_field_map() : field_info_fields(); |
|
141 |
|
|
142 |
foreach ($field_list as $field_name => $data) { |
|
143 |
if (in_array($data['type'], array('date', 'datestamp', 'datetime')) |
|
144 |
&& array_key_exists($entity_type, $data['bundles']) |
|
145 |
&& in_array($bundle, $data['bundles'][$entity_type])) { |
|
146 |
$field_info = $field_map_available ? field_info_field($field_name) : $data; |
|
147 |
if (date_is_repeat_field($field_info)) { |
|
148 |
return TRUE; |
|
149 |
} |
|
128 | 150 |
} |
129 | 151 |
} |
130 | 152 |
return FALSE; |
drupal7/sites/all/modules/date/date_tools/date_tools.info | ||
---|---|---|
6 | 6 |
configure = admin/config/date/tools |
7 | 7 |
files[] = tests/date_tools.test |
8 | 8 |
|
9 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
10 |
version = "7.x-2.7"
|
|
9 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
10 |
version = "7.x-2.8"
|
|
11 | 11 |
core = "7.x" |
12 | 12 |
project = "date" |
13 |
datestamp = "1387659206"
|
|
13 |
datestamp = "1406653438"
|
|
14 | 14 |
|
drupal7/sites/all/modules/date/date_views/date_views.info | ||
---|---|---|
12 | 12 |
files[] = includes/date_views.views.inc |
13 | 13 |
files[] = includes/date_views_plugin_pager.inc |
14 | 14 |
|
15 |
; Information added by Drupal.org packaging script on 2013-12-21
|
|
16 |
version = "7.x-2.7"
|
|
15 |
; Information added by Drupal.org packaging script on 2014-07-29
|
|
16 |
version = "7.x-2.8"
|
|
17 | 17 |
core = "7.x" |
18 | 18 |
project = "date" |
19 |
datestamp = "1387659206"
|
|
19 |
datestamp = "1406653438"
|
|
20 | 20 |
|
drupal7/sites/all/modules/date/date_views/date_views.install | ||
---|---|---|
1 |
<?php |
|
2 |
|
|
3 |
/** |
|
4 |
* @file |
|
5 |
* Install, update and uninstall functions for the Date Views module. |
|
6 |
*/ |
|
7 |
|
|
8 |
/** |
|
9 |
* Implements hook_install(). |
|
10 |
*/ |
|
11 |
function date_views_install() { |
|
12 |
variable_set('date_views_month_format_with_year', 'F Y'); |
|
13 |
variable_set('date_views_month_format_without_year', 'F'); |
|
14 |
variable_set('date_views_day_format_with_year', 'l, F j, Y'); |
|
15 |
variable_set('date_views_day_format_without_year', 'l, F j'); |
|
16 |
variable_set('date_views_week_format_with_year', 'F j, Y'); |
|
17 |
variable_set('date_views_week_format_without_year', 'F j'); |
|
18 |
} |
|
19 |
|
|
20 |
/** |
|
21 |
* Implements hook_uninstall(). |
|
22 |
*/ |
|
23 |
function date_views_uninstall() { |
|
24 |
variable_del('date_views_month_format_with_year'); |
|
25 |
variable_del('date_views_month_format_without_year'); |
|
26 |
variable_del('date_views_day_format_with_year'); |
|
27 |
variable_del('date_views_day_format_without_year'); |
|
28 |
variable_del('date_views_week_format_with_year'); |
|
29 |
variable_del('date_views_week_format_without_year'); |
|
30 |
} |
drupal7/sites/all/modules/date/date_views/date_views.module | ||
---|---|---|
1 | 1 |
<?php |
2 | 2 |
|
3 |
|
|
4 |
/** |
|
5 |
* Implements hook_menu(). |
|
6 |
*/ |
|
7 |
function date_views_menu() { |
|
8 |
// Used to import files from a local filesystem into Drupal. |
|
9 |
$items['admin/config/regional/date-time/date-views'] = array( |
|
10 |
'title' => 'Date views', |
|
11 |
'description' => 'Configure settings for date views.', |
|
12 |
'page callback' => 'drupal_get_form', |
|
13 |
'page arguments' => array('date_views_settings'), |
|
14 |
'access arguments' => array('administer site configuration '), |
|
15 |
'type' => MENU_LOCAL_TASK, |
|
16 |
); |
|
17 |
|
|
18 |
return $items; |
|
19 |
} |
|
20 |
|
|
21 |
/** |
|
22 |
* Form callback for date views settings. |
|
23 |
*/ |
|
24 |
function date_views_settings($form, &$form_state) { |
|
25 |
|
|
26 |
$form['date_views_month_format_with_year'] = array( |
|
27 |
'#type' => 'textfield', |
|
28 |
'#title' => t('Date views month format with year'), |
|
29 |
'#size' => 10, |
|
30 |
'#default_value' => variable_get('date_views_month_format_with_year', 'F Y'), |
|
31 |
'#description' => t('Date views month format with year, default value : F Y'), |
|
32 |
); |
|
33 |
|
|
34 |
$form['date_views_month_format_without_year'] = array( |
|
35 |
'#type' => 'textfield', |
|
36 |
'#title' => t('Date views month format without year'), |
|
37 |
'#size' => 10, |
|
38 |
'#default_value' => variable_get('date_views_month_format_without_year', 'F'), |
|
39 |
'#description' => t('Date views month format without year, default value : F'), |
|
40 |
); |
|
41 |
|
|
42 |
$form['date_views_day_format_with_year'] = array( |
|
43 |
'#type' => 'textfield', |
|
44 |
'#title' => t('Date views day format with year'), |
|
45 |
'#size' => 10, |
|
46 |
'#default_value' => variable_get('date_views_day_format_with_year', 'l, F j, Y'), |
|
47 |
'#description' => t('Date views day format with year, default value : l, F j, Y'), |
|
48 |
); |
|
49 |
|
|
50 |
$form['date_views_day_format_without_year'] = array( |
|
51 |
'#type' => 'textfield', |
|
52 |
'#title' => t('Date views day format without year'), |
|
53 |
'#size' => 10, |
|
54 |
'#default_value' => variable_get('date_views_day_format_without_year', 'l, F j'), |
|
55 |
'#description' => t('Date views day format without year, default value : l, F j'), |
|
56 |
); |
|
57 |
|
|
58 |
$form['date_views_week_format_with_year'] = array( |
|
59 |
'#type' => 'textfield', |
|
60 |
'#title' => t('Date views week format with year'), |
|
61 |
'#size' => 10, |
|
62 |
'#default_value' => variable_get('date_views_week_format_with_year', 'F j, Y'), |
|
63 |
'#description' => t('Date views week format with year, default value : F j, Y'), |
|
64 |
); |
|
65 |
|
|
66 |
$form['date_views_week_format_without_year'] = array( |
|
67 |
'#type' => 'textfield', |
|
68 |
'#title' => t('Date views week format without year'), |
|
69 |
'#size' => 10, |
|
70 |
'#default_value' => variable_get('date_views_week_format_without_year', 'F j'), |
|
71 |
'#description' => t('Date views week format without year, default value : F j'), |
|
72 |
); |
|
73 |
|
|
74 |
return system_settings_form($form); |
|
75 |
|
|
76 |
} |
|
77 |
|
|
3 | 78 |
/** |
4 | 79 |
* Implements hook_views_api(). |
5 | 80 |
* |
drupal7/sites/all/modules/date/date_views/includes/date_views.views.inc | ||
---|---|---|
128 | 128 |
// Mark all the core date handlers as date fields. |
129 | 129 |
// This will identify all handlers that directly use the _date handlers, |
130 | 130 |
// will not pick up any that extend those handlers. |
131 |
foreach ($data as $module => &$table) {
|
|
131 |
foreach ($data as $base_table => &$table) {
|
|
132 | 132 |
foreach ($table as $id => &$field) { |
133 | 133 |
foreach (array('field', 'sort', 'filter', 'argument') as $type) { |
134 | 134 |
if (isset($field[$type]) && isset($field[$type]['handler']) && ($field[$type]['handler'] == 'views_handler_' . $type . '_date')) { |
drupal7/sites/all/modules/date/date_views/includes/date_views_argument_handler_simple.inc | ||
---|---|---|
64 | 64 |
if ($granularity == 'week') { |
65 | 65 |
$now = date_now(); |
66 | 66 |
$week = date_week(date_format($now, 'Y-m-d')); |
67 |
$value = date_format($now, 'Y') . '-W' . $week;
|
|
67 |
$value = date_format($now, 'o') . '-W' . date_pad($week);
|
|
68 | 68 |
} |
69 | 69 |
else { |
70 | 70 |
$value = date($this->arg_format, REQUEST_TIME); |
drupal7/sites/all/modules/date/date_views/includes/date_views_filter_handler_simple.inc | ||
---|---|---|
371 | 371 |
'#date_label_position' => 'within', |
372 | 372 |
'#date_year_range' => $this->options['year_range'], |
373 | 373 |
'#process' => array($type . '_element_process'), |
374 |
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '">', |
|
374 |
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '-inside-wrapper">',
|
|
375 | 375 |
'#suffix' => '</div></div>', |
376 | 376 |
); |
377 | 377 |
if ($which == 'all') { |
... | ... | |
406 | 406 |
'#date_label_position' => 'within', |
407 | 407 |
'#date_year_range' => $this->options['year_range'], |
408 | 408 |
'#process' => array($type . '_element_process'), |
409 |
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '">', |
|
409 |
'#prefix' => '<div id="' . $id . '-wrapper"><div id="' . $id . '-inside-wrapper">',
|
|
410 | 410 |
'#suffix' => '</div></div>', |
411 | 411 |
'#states' => array( |
412 | 412 |
'visible' => array( |
drupal7/sites/all/modules/date/date_views/theme/date-views-pager.tpl.php | ||
---|---|---|
37 | 37 |
<?php if (!empty($prev_url)) : ?> |
38 | 38 |
<li class="date-prev"> |
39 | 39 |
<?php print l('«' . ($mini ? '' : ' ' . t('Prev', array(), array('context' => 'date_nav'))), $prev_url, $prev_options); ?> |
40 |
</li>
|
|
40 |
</li> |
|
41 | 41 |
<?php endif; ?> |
42 | 42 |
<?php if (!empty($next_url)) : ?> |
43 |
<li class="date-next">
|
|
43 |
<li class="date-next"> |
|
44 | 44 |
<?php print l(($mini ? '' : t('Next', array(), array('context' => 'date_nav')) . ' ') . '»', $next_url, $next_options); ?> |
45 | 45 |
</li> |
46 | 46 |
<?php endif; ?> |
drupal7/sites/all/modules/date/date_views/theme/theme.inc | ||
---|---|---|
75 | 75 |
case 'week': |
76 | 76 |
$next_week = date_week(date_format($next_date, 'Y-m-d')); |
77 | 77 |
$prev_week = date_week(date_format($prev_date, 'Y-m-d')); |
78 |
$next_arg = date_format($next_date, 'Y-\W') . date_pad($next_week);
|
|
79 |
$prev_arg = date_format($prev_date, 'Y-\W') . date_pad($prev_week);
|
|
78 |
$next_arg = date_format($next_date, 'o-\W') . date_pad($next_week);
|
|
79 |
$prev_arg = date_format($prev_date, 'o-\W') . date_pad($prev_week);
|
|
80 | 80 |
break; |
81 | 81 |
default: |
82 | 82 |
$next_arg = date_format($next_date, $format[$granularity]); |
... | ... | |
165 | 165 |
$date_info = $view->date_info; |
166 | 166 |
$link = !empty($params['link']) ? $params['link'] : FALSE; |
167 | 167 |
$format = !empty($params['format']) ? $params['format'] : NULL; |
168 |
$format_with_year = variable_get('date_views_' . $granularity . 'format_with_year', 'l, F j, Y'); |
|
169 |
$format_without_year = variable_get('date_views_' . $granularity . 'format_without_year', 'l, F j'); |
|
168 | 170 |
switch ($granularity) { |
169 | 171 |
case 'year': |
170 | 172 |
$title = $date_info->year; |
171 | 173 |
$date_arg = $date_info->year; |
172 | 174 |
break; |
173 | 175 |
case 'month': |
174 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F Y' : 'F');
|
|
176 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
|
175 | 177 |
$title = date_format_date($date_info->min_date, 'custom', $format); |
176 | 178 |
$date_arg = $date_info->year . '-' . date_pad($date_info->month); |
177 | 179 |
break; |
178 | 180 |
case 'day': |
179 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'l, F j, Y' : 'l, F j');
|
|
181 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
|
180 | 182 |
$title = date_format_date($date_info->min_date, 'custom', $format); |
181 | 183 |
$date_arg = $date_info->year . '-' . date_pad($date_info->month) . '-' . date_pad($date_info->day); |
182 | 184 |
break; |
183 | 185 |
case 'week': |
184 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? 'F j, Y' : 'F j');
|
|
186 |
$format = !empty($format) ? $format : (empty($date_info->mini) ? $format_with_year : $format_without_year);
|
|
185 | 187 |
$title = t('Week of @date', array('@date' => date_format_date($date_info->min_date, 'custom', $format))); |
186 | 188 |
$date_arg = $date_info->year . '-W' . date_pad($date_info->week); |
187 | 189 |
break; |
drupal7/sites/all/modules/date/tests/date.test | ||
---|---|---|
5 | 5 |
* Test date UI. |
6 | 6 |
*/ |
7 | 7 |
|
8 |
class DateUITestCase extends DrupalWebTestCase { |
|
9 |
protected $privileged_user; |
|
8 |
class DateUITestCase extends DateFieldBasic { |
|
10 | 9 |
|
11 | 10 |
/** |
12 | 11 |
* @todo. |
... | ... | |
23 | 22 |
* @todo. |
24 | 23 |
*/ |
25 | 24 |
public function setUp() { |
26 |
// Load the date_api module. |
|
27 |
parent::setUp('field', 'field_ui', 'date_api', 'date', 'date_popup', 'date_tools'); |
|
28 |
|
|
29 |
// Create and log in our privileged user. |
|
30 |
$this->privileged_user = $this->drupalCreateUser( |
|
31 |
array('administer content types', 'administer nodes', 'bypass node access', 'administer date tools') |
|
32 |
); |
|
33 |
$this->drupalLogin($this->privileged_user); |
|
25 |
parent::setUp(); |
|
34 | 26 |
|
35 | 27 |
variable_set('date_format_long', 'D, m/d/Y - H:i'); |
36 | 28 |
} |
... | ... | |
39 | 31 |
* @todo. |
40 | 32 |
*/ |
41 | 33 |
public function testFieldUI() { |
42 |
$edit = array(); |
|
43 |
$edit['name'] = 'Story'; |
|
44 |
$edit['type'] = 'story'; |
|
45 |
$this->drupalPost('admin/structure/types/add', $edit, t('Save content type')); |
|
46 |
$this->assertText('The content type Story has been added.', 'Content type added.'); |
|
34 |
$label = 'Test'; |
|
35 |
$current_year = date('Y'); |
|
47 | 36 |
|
48 |
// Creates select list field stored as a date with default settings. |
|
49 |
$this->createDateField($type = 'date', $widget = 'date_select'); |
|
50 |
$edit = array(); |
|
51 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
52 |
$this->dateForm($options = 'select'); |
|
53 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_select widget.'); |
|
54 |
$this->deleteDateField(); |
|
55 |
// Creates text field stored as a date with default settings. |
|
56 |
$this->createDateField($type = 'date', $widget = 'date_text'); |
|
57 |
$edit = array(); |
|
58 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
59 |
$this->dateForm($options = 'text'); |
|
60 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_text widget.'); |
|
61 |
$this->deleteDateField(); |
|
62 |
// Creates popup field stored as a date with default settings. |
|
63 |
$this->createDateField($type = 'date', $widget = 'date_popup'); |
|
64 |
$edit = array(); |
|
65 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
66 |
$this->dateForm($options = 'popup'); |
|
67 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a date field using the date_popup widget.'); |
|
68 |
$this->deleteDateField(); |
|
69 |
// Creates select list field stored as a datestamp with default settings. |
|
70 |
$this->createDateField($type = 'datestamp', $widget = 'date_select'); |
|
71 |
$edit = array(); |
|
72 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
73 |
$this->dateForm($options = 'select'); |
|
74 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_select widget.'); |
|
75 |
$this->deleteDateField(); |
|
76 |
// Creates text field stored as a datestamp with default settings. |
|
77 |
$this->createDateField($type = 'datestamp', $widget = 'date_text'); |
|
78 |
$edit = array(); |
|
79 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
80 |
$this->dateForm($options = 'text'); |
|
81 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_text widget.'); |
|
82 |
$this->deleteDateField(); |
|
83 |
// Creates popup field stored as a datestamp with default settings. |
|
84 |
$this->createDateField($type = 'datestamp', $widget = 'date_popup'); |
|
85 |
$edit = array(); |
|
86 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
87 |
$this->dateForm($options = 'popup'); |
|
88 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datestamp field using the date_popup widget.'); |
|
89 |
$this->deleteDateField(); |
|
90 |
// Creates select list field stored as a datetime with default settings. |
|
91 |
$this->createDateField($type = 'datetime', $widget = 'date_select'); |
|
92 |
$edit = array(); |
|
93 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
94 |
$this->dateForm($options = 'select'); |
|
95 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_select widget.'); |
|
96 |
$this->deleteDateField(); |
|
97 |
// Creates text field stored as a datetime with default settings. |
|
98 |
$this->createDateField($type = 'datetime', $widget = 'date_text'); |
|
99 |
$edit = array(); |
|
100 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
101 |
$this->dateForm($options = 'text'); |
|
102 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_text widget.'); |
|
103 |
$this->deleteDateField(); |
|
104 |
// Creates popup field stored as a datetime with default settings. |
|
105 |
$this->createDateField($type = 'datetime', $widget = 'date_popup'); |
|
106 |
$edit = array(); |
|
107 |
$this->drupalPost(NULL, $edit, t('Save field settings')); |
|
108 |
$this->dateForm($options = 'popup'); |
|
109 |
$this->assertText('Thu, 10/07/2010 - 10:30', 'Found the correct date for a datetime field using the date_popup widget.'); |
|
110 |
$this->deleteDateField(); |
|
37 |
$field_types = array('date', 'datestamp', 'datetime'); |
|
38 |
$widget_types = array('date_select', 'date_text', 'date_popup'); |
|
39 |
|
|
40 |
// Test widgets with default settings using every widget and field type. |
|
41 |
foreach ($field_types as $field_type) { |
|
42 |
foreach ($widget_types as $widget_type) { |
|
43 |
$this->createDateField( |
|
44 |
array( |
|
45 |
'label' => $label, |
|
46 |
'field_type' => $field_type, |
|
47 |
'widget_type' => $widget_type, |
|
48 |
) |
|
49 |
); |
|
50 |
$this->dateForm($widget_type); |
|
51 |
$this->assertText(format_string('10/07/!year - 10:30', array('!year' => $current_year)), 'Found the correct date for a date field using the ' . $widget_type . ' widget.'); |
|
52 |
$this->deleteDateField($label); |
|
53 |
} |
|
54 |
} |
|
111 | 55 |
|
112 | 56 |
// Test timezone handling validation on the field settings form. |
113 |
$this->createDateField($type = 'date', $widget = 'date_select');
|
|
57 |
$this->createDateField(array('label' => $label, 'field_type' => 'date', 'widget_type' => 'date_select', 'granularity' => array('year', 'month', 'day')));
|
|
114 | 58 |
$edit = array('field[settings][granularity][hour]' => FALSE); |
115 |
$this->drupalPost(NULL, $edit, t('Save field settings'));
|
|
59 |
$this->drupalPost('admin/structure/types/manage/story/fields/field_' . strtolower($label), $edit, t('Save settings'));
|
|
116 | 60 |
$this->assertText("Dates without hours granularity must not use any timezone handling.", "Dates without hours granularity required to use timezone handling of 'none.'"); |
117 |
$this->deleteDateField(); |
|
61 |
$this->deleteDateField($label);
|
|
118 | 62 |
} |
119 | 63 |
|
120 | 64 |
/** |
... | ... | |
125 | 69 |
$edit = array(); |
126 | 70 |
$edit['title'] = $this->randomName(8); |
127 | 71 |
$edit['body[und][0][value]'] = $this->randomName(16); |
128 |
if ($options == 'select') { |
|
129 |
$edit['field_test[und][0][value][year]'] = '2010'; |
|
72 |
$current_year = date('Y'); |
|
73 |
|
|
74 |
if ($options == 'date_select') { |
|
75 |
$edit['field_test[und][0][value][year]'] = $current_year; |
|
130 | 76 |
$edit['field_test[und][0][value][month]'] = '10'; |
131 | 77 |
$edit['field_test[und][0][value][day]'] = '7'; |
132 | 78 |
$edit['field_test[und][0][value][hour]'] = '10'; |
133 | 79 |
$edit['field_test[und][0][value][minute]'] = '30'; |
134 | 80 |
} |
135 |
elseif ($options == 'text') { |
|
136 |
$edit['field_test[und][0][value][date]'] = '10/07/2010 - 10:30';
|
|
81 |
elseif ($options == 'date_text') {
|
|
82 |
$edit['field_test[und][0][value][date]'] = format_string('10/07/!year - 10:30', array('!year' => $current_year));
|
|
137 | 83 |
} |
138 |
elseif ($options == 'popup') { |
|
139 |
$edit['field_test[und][0][value][date]'] = '10/07/2010';
|
|
84 |
elseif ($options == 'date_popup') {
|
|
85 |
$edit['field_test[und][0][value][date]'] = format_string('10/07/!year', array('!year' => $current_year));
|
|
140 | 86 |
$edit['field_test[und][0][value][time]'] = '10:30'; |
141 | 87 |
} |
142 | 88 |
$this->drupalPost('node/add/story', $edit, t('Save')); |
143 | 89 |
$this->assertText($edit['body[und][0][value]'], 'Test node has been created'); |
144 | 90 |
} |
145 |
|
|
146 |
/** |
|
147 |
* @todo. |
|
148 |
*/ |
|
149 |
function createDateField($type, $widget) { |
|
150 |
$edit = array(); |
|
151 |
$edit['fields[_add_new_field][label]'] = 'Test'; |
|
152 |
$edit['fields[_add_new_field][field_name]'] = 'test'; |
|
153 |
$edit['fields[_add_new_field][weight]'] = '-4'; |
|
154 |
$edit['fields[_add_new_field][type]'] = $type; |
|
155 |
$edit['fields[_add_new_field][widget_type]'] = $widget; |
|
156 |
$this->drupalPost('admin/structure/types/manage/story/fields', $edit, t('Save')); |
|
157 |
} |
|
158 |
|
|
159 |
/** |
|
160 |
* @todo. |
|
161 |
*/ |
|
162 |
function deleteDateField() { |
|
163 |
$this->drupalGet('admin/structure/types/manage/story/fields'); |
|
164 |
$this->clickLink('delete'); |
|
165 |
$this->drupalPost(NULL, NULL, t('Delete')); |
|
166 |
$this->assertText('The field Test has been deleted from the Story content type.', 'Removed date field.'); |
|
167 |
} |
|
168 | 91 |
} |
Formats disponibles : Unified diff
Weekly update of contrib modules