Custom Field Template - Version 1.7.8

Version Description

  • Updated jquery.datePicker.js
Download this release

Release Info

Developer Hiroaki Miyashita
Plugin Icon 128x128 Custom Field Template
Version 1.7.8
Comparing to
See all releases

Code changes from version 1.7.7 to 1.7.8

custom-field-template.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Custom Field Template
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
- Version: 1.7.7
8
  Author URI: http://wpgogo.com/
9
  */
10
 
4
  Plugin URI: http://wpgogo.com/development/custom-field-template.html
5
  Description: This plugin adds the default custom fields on the Write Post/Page.
6
  Author: Hiroaki Miyashita
7
+ Version: 1.7.8
8
  Author URI: http://wpgogo.com/
9
  */
10
 
js/datePicker.css CHANGED
@@ -65,7 +65,7 @@ div.dp-popup {
65
  font-size: 10px;
66
  font-family: arial, sans-serif;
67
  padding: 2px;
68
- width: 185px;
69
  line-height: 1.2em;
70
  }
71
  div#dp-popup {
65
  font-size: 10px;
66
  font-family: arial, sans-serif;
67
  padding: 2px;
68
+ width: 200px;
69
  line-height: 1.2em;
70
  }
71
  div#dp-popup {
js/jquery.datePicker.js CHANGED
@@ -2,8 +2,8 @@
2
  * Copyright (c) 2008 Kelvin Luck (http://www.kelvinluck.com/)
3
  * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
4
  * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
5
- *
6
- * $Id: jquery.datePicker.js 70 2009-04-05 19:25:15Z kelvin.luck $
7
  **/
8
 
9
  (function($){
@@ -83,12 +83,13 @@
83
  );
84
  var tbody = $(dc('tbody'));
85
 
86
- var today = (new Date()).zeroTime();
 
87
 
88
  var month = s.month == undefined ? today.getMonth() : s.month;
89
  var year = s.year || today.getFullYear();
90
 
91
- var currentDate = new Date(year, month, 1);
92
 
93
 
94
  var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
@@ -139,8 +140,9 @@
139
  s.renderCallback(d, currentDate, month, year);
140
  }
141
  // addDays(1) fails in some locales due to daylight savings. See issue 39.
142
- //currentDate.addDays(1);
143
- currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1);
 
144
  }
145
  tbody.append(r);
146
  }
@@ -189,8 +191,9 @@
189
  * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT.
190
  * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.
191
  * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.
192
- * @option (Function|Array) renderCallback A reference to a function (or an array of seperate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.
193
  * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
 
194
  * @type jQuery
195
  * @name datePicker
196
  * @cat plugins/datePicker
@@ -499,12 +502,24 @@
499
  * $(this).dpClose();
500
  * }
501
  * );
502
- * @desc Creates a date picker and makes it appear when the relevant element is focused and disappear when it is blurred.
503
  **/
504
  dpClose : function()
505
  {
506
  return _w.call(this, '_closeCalendar', false, this[0]);
507
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
508
  // private function called on unload to clean up any expandos etc and prevent memory links...
509
  _dpDestroy : function()
510
  {
@@ -671,7 +686,7 @@
671
  },
672
  setSelected : function(d, v, moveToMonth, dispatchEvents)
673
  {
674
- if (d < this.startDate || d > this.endDate) {
675
  // Don't allow people to select dates outside range...
676
  return;
677
  }
@@ -697,9 +712,9 @@
697
  if (moveToMonth && (this.displayedMonth != d.getMonth() || this.displayedYear != d.getFullYear())) {
698
  this.setDisplayedMonth(d.getMonth(), d.getFullYear(), true);
699
  }
700
- this.selectedDates[d.toString()] = v;
701
  this.numSelected += v ? 1 : -1;
702
- var selectorString = 'td.' +( d.getMonth() == this.displayedMonth ? 'current-month' : 'other-month');
703
  var $td;
704
  $(selectorString, this.context).each(
705
  function()
@@ -727,14 +742,14 @@
727
  },
728
  isSelected : function(d)
729
  {
730
- return this.selectedDates[d.toString()];
731
  },
732
  getSelected : function()
733
  {
734
  var r = [];
735
- for(s in this.selectedDates) {
736
  if (this.selectedDates[s] == true) {
737
- r.push(Date.parse(s));
738
  }
739
  }
740
  return r;
@@ -925,19 +940,31 @@
925
  var $this = $(this);
926
  if (!$this.is('.disabled')) {
927
  c.setSelected(d, !$this.is('.selected') || !c.selectMultiple, false, true);
928
- if (c.closeOnSelect) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
929
  c._closeCalendar();
930
  }
931
- // TODO: Instead of this which doesn't work in IE anyway we should find the next focusable element in the document
932
- // and pass the focus onto that. That would allow the user to continue on the form as expected...
933
- if (!$.browser.msie)
934
- {
935
- $(c.ele).trigger('focus', [$.dpConst.DP_INTERNAL_FOCUS]);
936
- }
937
  }
938
  }
939
  );
940
-
941
  if (c.isSelected(d)) {
942
  $td.addClass('selected');
943
  if (c.settings.selectWeek)
@@ -1077,8 +1104,9 @@
1077
  $('.dp-calendar td.other-month', this.context).each(
1078
  function()
1079
  {
1080
- var $this = $(this);
1081
- if (Number($this.text()) > d) {
 
1082
  $this.addClass('disabled');
1083
  }
1084
  }
@@ -1135,7 +1163,7 @@
1135
  HEADER_FORMAT : 'mmmm yyyy'
1136
  };
1137
  // version
1138
- $.dpVersion = '$Id: jquery.datePicker.js 70 2009-04-05 19:25:15Z kelvin.luck $';
1139
 
1140
  $.fn.datePicker.defaults = {
1141
  month : undefined,
@@ -1158,7 +1186,8 @@
1158
  horizontalPosition : $.dpConst.POS_LEFT,
1159
  verticalOffset : 0,
1160
  horizontalOffset : 0,
1161
- hoverClass : 'dp-hover'
 
1162
  };
1163
 
1164
  function _getController(ele)
2
  * Copyright (c) 2008 Kelvin Luck (http://www.kelvinluck.com/)
3
  * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
4
  * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
5
+ * .
6
+ * $Id: jquery.datePicker.js 102 2010-09-13 14:00:54Z kelvin.luck $
7
  **/
8
 
9
  (function($){
83
  );
84
  var tbody = $(dc('tbody'));
85
 
86
+ var today = (new Date()).zeroTime();
87
+ today.setHours(12);
88
 
89
  var month = s.month == undefined ? today.getMonth() : s.month;
90
  var year = s.year || today.getFullYear();
91
 
92
+ var currentDate = (new Date(year, month, 1, 12, 0, 0));
93
 
94
 
95
  var firstDayOffset = Date.firstDayOfWeek - currentDate.getDay() + 1;
140
  s.renderCallback(d, currentDate, month, year);
141
  }
142
  // addDays(1) fails in some locales due to daylight savings. See issue 39.
143
+ //currentDate.addDays(1);
144
+ // set the time to midday to avoid any weird timezone issues??
145
+ currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()+1, 12, 0, 0);
146
  }
147
  tbody.append(r);
148
  }
191
  * @option Number horizontalPosition The horizontal alignment of the popped up date picker to the matched element. One of $.dpConst.POS_LEFT and $.dpConst.POS_RIGHT.
192
  * @option Number verticalOffset The number of pixels offset from the defined verticalPosition of this date picker that it should pop up in. Default in 0.
193
  * @option Number horizontalOffset The number of pixels offset from the defined horizontalPosition of this date picker that it should pop up in. Default in 0.
194
+ * @option (Function|Array) renderCallback A reference to a function (or an array of separate functions) that is called as each cell is rendered and which can add classes and event listeners to the created nodes. Each callback function will receive four arguments; a jquery object wrapping the created TD, a Date object containing the date this TD represents, a number giving the currently rendered month and a number giving the currently rendered year. Default is no callback.
195
  * @option String hoverClass The class to attach to each cell when you hover over it (to allow you to use hover effects in IE6 which doesn't support the :hover pseudo-class on elements other than links). Default is dp-hover. Pass false if you don't want a hover class.
196
+ * @option String autoFocusNextInput Whether focus should be passed onto the next input in the form (true) or remain on this input (false) when a date is selected and the calendar closes
197
  * @type jQuery
198
  * @name datePicker
199
  * @cat plugins/datePicker
502
  * $(this).dpClose();
503
  * }
504
  * );
 
505
  **/
506
  dpClose : function()
507
  {
508
  return _w.call(this, '_closeCalendar', false, this[0]);
509
  },
510
+ /**
511
+ * Rerenders the date picker's current month (for use with inline calendars and renderCallbacks).
512
+ *
513
+ * @type jQuery
514
+ * @name dpRerenderCalendar
515
+ * @cat plugins/datePicker
516
+ * @author Kelvin Luck (http://www.kelvinluck.com/)
517
+ *
518
+ **/
519
+ dpRerenderCalendar : function()
520
+ {
521
+ return _w.call(this, '_rerenderCalendar');
522
+ },
523
  // private function called on unload to clean up any expandos etc and prevent memory links...
524
  _dpDestroy : function()
525
  {
686
  },
687
  setSelected : function(d, v, moveToMonth, dispatchEvents)
688
  {
689
+ if (d < this.startDate || d.zeroTime() > this.endDate.zeroTime()) {
690
  // Don't allow people to select dates outside range...
691
  return;
692
  }
712
  if (moveToMonth && (this.displayedMonth != d.getMonth() || this.displayedYear != d.getFullYear())) {
713
  this.setDisplayedMonth(d.getMonth(), d.getFullYear(), true);
714
  }
715
+ this.selectedDates[d.asString()] = v;
716
  this.numSelected += v ? 1 : -1;
717
+ var selectorString = 'td.' + (d.getMonth() == this.displayedMonth ? 'current-month' : 'other-month');
718
  var $td;
719
  $(selectorString, this.context).each(
720
  function()
742
  },
743
  isSelected : function(d)
744
  {
745
+ return this.selectedDates[d.asString()];
746
  },
747
  getSelected : function()
748
  {
749
  var r = [];
750
+ for(var s in this.selectedDates) {
751
  if (this.selectedDates[s] == true) {
752
+ r.push(Date.fromString(s));
753
  }
754
  }
755
  return r;
940
  var $this = $(this);
941
  if (!$this.is('.disabled')) {
942
  c.setSelected(d, !$this.is('.selected') || !c.selectMultiple, false, true);
943
+ if (c.closeOnSelect) {
944
+ // Focus the next input in the form…
945
+ if (c.settings.autoFocusNextInput) {
946
+ var ele = c.ele;
947
+ var found = false;
948
+ $(':input', ele.form).each(
949
+ function()
950
+ {
951
+ if (found) {
952
+ $(this).focus();
953
+ return false;
954
+ }
955
+ if (this == ele) {
956
+ found = true;
957
+ }
958
+ }
959
+ );
960
+ } else {
961
+ c.ele.focus();
962
+ }
963
  c._closeCalendar();
964
  }
 
 
 
 
 
 
965
  }
966
  }
967
  );
 
968
  if (c.isSelected(d)) {
969
  $td.addClass('selected');
970
  if (c.settings.selectWeek)
1104
  $('.dp-calendar td.other-month', this.context).each(
1105
  function()
1106
  {
1107
+ var $this = $(this);
1108
+ var cellDay = Number($this.text());
1109
+ if (cellDay < 13 && cellDay > d) {
1110
  $this.addClass('disabled');
1111
  }
1112
  }
1163
  HEADER_FORMAT : 'mmmm yyyy'
1164
  };
1165
  // version
1166
+ $.dpVersion = '$Id: jquery.datePicker.js 102 2010-09-13 14:00:54Z kelvin.luck $';
1167
 
1168
  $.fn.datePicker.defaults = {
1169
  month : undefined,
1186
  horizontalPosition : $.dpConst.POS_LEFT,
1187
  verticalOffset : 0,
1188
  horizontalOffset : 0,
1189
+ hoverClass : 'dp-hover',
1190
+ autoFocusNextInput : false
1191
  };
1192
 
1193
  function _getController(ele)
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://wpgogo.com/development/custom-field-template.html
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
  Tested up to: 3.0.1
7
- Stable tag: 1.7.7
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
@@ -103,10 +103,12 @@ See the default template and modify it.
103
 
104
  == Changelog ==
105
 
 
 
 
106
  = 1.7.7 =
107
  * Easier way to output images of the file type. ex) [cft key="file" image_size="thumbnail"] [cft key="file" image_size="medium" image_src=1] [cft key="file" image_size="large" image_width=1] [cft key="file" image_size="full" image_height=1]
108
  * You can use shortcodes in the cft shortcode format.
109
- * Updated jquery.datePicker.js
110
  * Bugfix: search.
111
  * Dutch (nl_NL) - Rene
112
 
4
  Tags: custom, fields, field, template, meta, custom field, custom fields, custom field template
5
  Requires at least: 2.1
6
  Tested up to: 3.0.1
7
+ Stable tag: 1.7.8
8
 
9
  This plugin adds the default custom fields on the Write Post/Page.
10
 
103
 
104
  == Changelog ==
105
 
106
+ = 1.7.8 =
107
+ * Updated jquery.datePicker.js
108
+
109
  = 1.7.7 =
110
  * Easier way to output images of the file type. ex) [cft key="file" image_size="thumbnail"] [cft key="file" image_size="medium" image_src=1] [cft key="file" image_size="large" image_width=1] [cft key="file" image_size="full" image_height=1]
111
  * You can use shortcodes in the cft shortcode format.
 
112
  * Bugfix: search.
113
  * Dutch (nl_NL) - Rene
114