... | ... |
@@ -7,11 +7,11 @@ jQuery(document).ready(function(){ |
7 | 7 |
}); |
8 | 8 |
// timecomboBOx close |
9 | 9 |
jQuery('.rc-datetime-update').on('click',function(){ |
10 |
- var year = jQuery(':text[name="rc_year"]').val(); |
|
10 |
+ var year = jQuery('select[name="rc_year"]').val(); |
|
11 | 11 |
var month = jQuery('select[name="rc_month"]').val(); |
12 |
- var day = jQuery(':text[name="rc_day"]').val(); |
|
13 |
- var hour = jQuery(':text[name="rc_hour"]').val(); |
|
14 |
- var min = jQuery(':text[name="rc_minutes"]').val(); |
|
12 |
+ var day = jQuery('select[name="rc_day"]').val(); |
|
13 |
+ var hour = jQuery('select[name="rc_hour"]').val(); |
|
14 |
+ var min = jQuery('select[name="rc_minutes"]').val(); |
|
15 | 15 |
newDate = new Date(year, month - 1, day, hour, min); |
16 | 16 |
if(newDate.getFullYear() != year || (1 + newDate.getMonth()) != month || newDate.getDate() != day || newDate.getMinutes() != min){ |
17 | 17 |
jQuery('.rc-datetime-wrap').addClass('form-invalid'); |
... | ... |
@@ -37,11 +37,11 @@ jQuery(document).ready(function(){ |
37 | 37 |
var hour = jQuery('#rc_hour_cr').val(); |
38 | 38 |
var min = jQuery('#rc_minutes_cr').val(); |
39 | 39 |
jQuery('.rc-datetime > b').html(year + "/" + month + "/" + day + " @ " + hour + ":" + min); |
40 |
- jQuery(':text[name="rc_year"]').val(year); |
|
40 |
+ jQuery('select[name="rc_year"]').val(year); |
|
41 | 41 |
jQuery('select[name="rc_month"]').val(month); |
42 |
- jQuery(':text[name="rc_day"]').val(day); |
|
43 |
- jQuery(':text[name="rc_hour"]').val(hour); |
|
44 |
- jQuery(':text[name="rc_minutes"]').val(min); |
|
42 |
+ jQuery('select[name="rc_day"]').val(day); |
|
43 |
+ jQuery('select[name="rc_hour"]').val(hour); |
|
44 |
+ jQuery('select[name="rc_minutes"]').val(min); |
|
45 | 45 |
jQuery('.rc-datetime-wrap').slideUp('normal'); |
46 | 46 |
jQuery('.rc-datetime-edit').show(); |
47 | 47 |
return false; |
... | ... |
@@ -41,7 +41,7 @@ You can install this plugin directly from your WordPress dashboard: |
41 | 41 |
* 2014-05-04 |
42 | 42 |
* add reservation datetime post updated messages. |
43 | 43 |
* add "revision" and "attachment" in invalid custom post type Setting |
44 |
-* little refactoring |
|
44 |
+* refactoring |
|
45 | 45 |
|
46 | 46 |
= 0.1.1 = |
47 | 47 |
* 2014-04-25 |
... | ... |
@@ -3,7 +3,7 @@ |
3 | 3 |
* Plugin Name: Rucy |
4 | 4 |
* Plugin URI: https://github.com/gips/rucy |
5 | 5 |
* Description: Reservation Update (Published) Content. |
6 |
- * Version: 0.1.2 |
|
6 |
+ * Version: 0.2.0 |
|
7 | 7 |
* Author: Nita |
8 | 8 |
* License: GPLv2 or later |
9 | 9 |
* Text Domain: rucy |
... | ... |
@@ -60,7 +60,7 @@ function add_rucy_metabox_out() |
60 | 60 |
$acceptPostType = getRcSetting(); |
61 | 61 |
foreach ($acceptPostType as $postType) |
62 | 62 |
{ |
63 |
- add_meta_box('rucy_metabox','Rucy','add_rucy_metabox_inside',$postType,'normal','high'); |
|
63 |
+ add_meta_box('rucy_metabox','Rucy - Reservation Update Content -','add_rucy_metabox_inside',$postType,'normal','high'); |
|
64 | 64 |
} |
65 | 65 |
function add_rucy_metabox_inside() |
66 | 66 |
{ |
... | ... |
@@ -73,14 +73,15 @@ function add_rucy_metabox_out() |
73 | 73 |
$reserv_date = $rcMetas['date']; |
74 | 74 |
if("" == $reserv_date) |
75 | 75 |
{ |
76 |
- $reserv_date = $post->post_date; |
|
76 |
+ $reserv_date = date('Y-m-d H:i:s'); |
|
77 | 77 |
} |
78 | 78 |
$reserv_date_arr = getdate(strtotime($reserv_date)); |
79 |
+ $current_y = date('Y',$reserv_date_arr[0]); |
|
79 | 80 |
$reserv_content = $rcMetas['content']; |
80 | 81 |
if("" == $reserv_content) |
81 | 82 |
{ |
82 | 83 |
$reserv_content = $post->post_content; |
83 |
- } |
|
84 |
+ } |
|
84 | 85 |
?> |
85 | 86 |
<div id="rc-post-wrap" class="curtime"> |
86 | 87 |
<input type="hidden" name="schroeder" id="schroeder" value="<?php echo wp_create_nonce(plugin_basename(__FILE__)); ?>"/> |
... | ... |
@@ -92,21 +93,57 @@ function add_rucy_metabox_out() |
92 | 92 |
</div> |
93 | 93 |
<a href="#edit-reservdate" class="edit-timestamp rc-datetime-edit"><?php _e('Edit') ?></a> |
94 | 94 |
<div class="rc-datetime-wrap"> |
95 |
- <input type="text" size="4" maxlength="4" name="rc_year" value="<?php echo date('Y',$reserv_date_arr[0]); ?>"><?php echo '/' ?> |
|
95 |
+ <select name="rc_year"> |
|
96 |
+ <?php |
|
97 |
+ for($y = $current_y; $y <= ($current_y + 3); $y++) |
|
98 |
+ { |
|
99 |
+ $ySelected = ($y == date('Y',$reserv_date_arr[0])) ? "selected" : ""; |
|
100 |
+ echo '<option value="'.$y.'" '.$ySelected.'>'.$y.'</option>'; |
|
101 |
+ } |
|
102 |
+ ?> |
|
103 |
+ </select> |
|
104 |
+ <?php echo '/' ?> |
|
96 | 105 |
<select name="rc_month"> |
97 |
- <?php |
|
98 |
- for($i=1;$i<=12;$i++) |
|
99 |
- { |
|
100 |
- $m = sprintf("%02d",$i); |
|
101 |
- $selected = ($m == date('m',$reserv_date_arr[0])) ? "selected" : ""; |
|
102 |
- echo '<option value="'.$m.'" '.$selected.'>'.$m.'</option>'; |
|
103 |
- } |
|
104 |
- ?> |
|
105 |
- </select><?php echo '/' ?> |
|
106 |
- <input type="text" size="2" maxlength="2" name="rc_day" value="<?php echo date('d',$reserv_date_arr[0]); ?>"> |
|
107 |
- @ <input type="text" size="2" maxlength="2" name="rc_hour" value="<?php echo date('H',$reserv_date_arr[0]); ?>">:<input type="text" size="2" maxlength="2" name="rc_minutes" value="<?php echo date('i',$reserv_date_arr[0]); ?>"> |
|
108 |
- <a href="#edit-reservdate" class="rc-datetime-update button"><?php _e('OK',RC_TXT_DOMAIN) ?></a> |
|
109 |
- <a href="#edit-reservdate" class="rc-datetime-cancel"><?php _e('Cancel',RC_TXT_DOMAIN) ?></a> |
|
106 |
+ <?php |
|
107 |
+ for($i=1;$i<=12;$i++) |
|
108 |
+ { |
|
109 |
+ $m = sprintf("%02d",$i); |
|
110 |
+ $selected = ($m == date('m',$reserv_date_arr[0])) ? "selected" : ""; |
|
111 |
+ echo '<option value="'.$m.'" '.$selected.'>'.$m.'</option>'; |
|
112 |
+ } |
|
113 |
+ ?> |
|
114 |
+ </select><?php echo '/' ?> |
|
115 |
+ <select name="rc_day"> |
|
116 |
+ <?php |
|
117 |
+ for($d=1;$d<=31;$d++){ |
|
118 |
+ $d = sprintf("%02d",$d); |
|
119 |
+ $dSelected = ($d == date('d',$reserv_date_arr[0])) ? "selected" : ""; |
|
120 |
+ echo '<option value="'.$d.'" '.$dSelected.'>'.$d.'</option>'; |
|
121 |
+ } |
|
122 |
+ ?> |
|
123 |
+ </select> |
|
124 |
+ @ |
|
125 |
+ <select name="rc_hour"> |
|
126 |
+ <?php |
|
127 |
+ for($h=0;$h<=23;$h++){ |
|
128 |
+ $h = sprintf("%02d",$h); |
|
129 |
+ $hSelected = ($h == date('H',$reserv_date_arr[0])) ? "selected" : ""; |
|
130 |
+ echo '<option value="'.$h.'" '.$hSelected.'>'.$h.'</option>'; |
|
131 |
+ } |
|
132 |
+ ?> |
|
133 |
+ </select> |
|
134 |
+ : |
|
135 |
+ <select name="rc_minutes"> |
|
136 |
+ <?php |
|
137 |
+ for($min=0;$min<=59;$min++){ |
|
138 |
+ $min = sprintf("%02d",$min); |
|
139 |
+ $minSelected = ($min == date('i',$reserv_date_arr[0])) ? "selected" : ""; |
|
140 |
+ echo '<option value="'.$min.'" '.$minSelected.'>'.$min.'</option>'; |
|
141 |
+ } |
|
142 |
+ ?> |
|
143 |
+ </select> |
|
144 |
+ <a href="#edit-reservdate" class="rc-datetime-update button"><?php _e('OK',RC_TXT_DOMAIN) ?></a> |
|
145 |
+ <a href="#edit-reservdate" class="rc-datetime-cancel"><?php _e('Cancel',RC_TXT_DOMAIN) ?></a> |
|
110 | 146 |
</div> |
111 | 147 |
<?php |
112 | 148 |
$dateArr = array( |