Changeset 596477
- Timestamp:
- 09/09/2012 05:55:54 AM (14 years ago)
- Location:
- events-calendar/branches/7.0-dev
- Files:
-
- 19 added
- 1 deleted
- 2 edited
-
css/datepicker (deleted)
-
css/jquery-ui (added)
-
css/jquery-ui/smoothness (added)
-
css/jquery-ui/smoothness/images (added)
-
css/jquery-ui/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_flat_75_ffffff_40x100.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_glass_65_ffffff_1x400.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_glass_75_dadada_1x400.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png (added)
-
css/jquery-ui/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png (added)
-
css/jquery-ui/smoothness/images/ui-icons_222222_256x240.png (added)
-
css/jquery-ui/smoothness/images/ui-icons_2e83ff_256x240.png (added)
-
css/jquery-ui/smoothness/images/ui-icons_454545_256x240.png (added)
-
css/jquery-ui/smoothness/images/ui-icons_888888_256x240.png (added)
-
css/jquery-ui/smoothness/images/ui-icons_cd0a0a_256x240.png (added)
-
css/jquery-ui/smoothness/jquery-ui-1.8.23.custom.css (added)
-
events-calendar.php (modified) (1 diff)
-
hooks.php (modified) (5 diffs)
-
js (added)
-
js/jquery-ui-1.8.23.custom.min.js (added)
Legend:
- Unmodified
- Added
- Removed
-
events-calendar/branches/7.0-dev/events-calendar.php
r591174 r596477 46 46 define( 'EVENTS_CALENDAR_URL', plugin_dir_url( __FILE__ ) ); 47 47 define( 'EVENTS_CALENDAR_IMG_URL', EVENTS_CALENDAR_URL . 'img/' ); 48 define( 'EVENTS_CALENDAR_JS_URL', EVENTS_CALENDAR_URL . 'js/' ); 49 define( 'EVENTS_CALENDAR_CSS_URL', EVENTS_CALENDAR_URL . 'css/' ); 48 50 define( 'EVENTS_CALENDAR_L10N', 'events-calendar' ); 49 51 -
events-calendar/branches/7.0-dev/hooks.php
r595752 r596477 55 55 global $post; 56 56 $startdate = get_post_meta( $post->ID, 'startdate', true ); 57 //$startdate = empty( $startdate ) ? get_the_time( 'Y-m-d' ): $startdate; 58 $starttimehour = get_post_meta( $post->ID, 'starttimehour', true ); 59 $starttimehour = empty( $starttimehour ) ? '12' : $starttimehour; 60 $starttimeminute = get_post_meta( $post->ID, 'starttimeminute', true ); 61 $starttimeminute = empty( $starttimeminute ) ? '0' : $starttimeminute; 62 $starttimeampm = get_post_meta( $post->ID, 'starttimeampm', true ); 63 $starttimeampm = empty( $starttimeampm ) ? 'am' : $starttimeampm; 57 64 $enddate = get_post_meta( $post->ID, 'enddate', true ); 58 65 //$enddate = empty( $endate ) ? get_the_time( 'Y-m-d' ): $enddate; 66 $endtimehour = get_post_meta( $post->ID, 'endtimehour', true ); 67 $endtimehour = empty( $endtimehour ) ? '12' : $endtimehour; 68 $endtimeminute = get_post_meta( $post->ID, 'endtimeminute', true ); 69 $endtimeminute = empty( $endtimeminute ) ? '0' : $endtimeminute; 70 $endtimeampm = get_post_meta( $post->ID, 'endtimeampm', true ); 71 $endtimeampm = empty( $endtimeampm ) ? 'am' : $endtimeampm; 59 72 ?> 60 73 <p> … … 64 77 </p> 65 78 <p> 79 <label for="starttime">Start Time<br> 80 <select id="starttimehour" name="starttimehour"> 81 <?php 82 for( $i = 1; $i <= 12; $i++ ) 83 { 84 $selected = ( $i == $starttimehour ) ? ' selected="selected"' : ''; 85 echo "<option value=\"$i\"$selected>$i</option>"; 86 } 87 ?> 88 </select> 89 <select id="starttimeminute" name="starttimeminute"> 90 <?php 91 for( $i = 0; $i <= 55; $i += 5 ) 92 { 93 $selected = ( $i == $starttimeminute ) ? ' selected="selected"' : ''; 94 $zero = $i < 10 ? 0 : ''; 95 echo "<option value=\"$i\"$selected>$zero$i</option>"; 96 } 97 ?> 98 </select> 99 <select id="starttimeampm" name="starttimeampm"> 100 <option value="am"<?php echo $starttimeampm == 'am' ? ' selected="selected"' : '';?>>AM</option> 101 <option value="pm"<?php echo $starttimeampm == 'pm' ? ' selected="selected"' : '';?>>PM</option> 102 </select> 103 <div id="starttimeslider"></div> 104 </label> 105 </p> 106 <p> 66 107 <label for="enddate">End Date (YYYY-MM-DD)<br> 67 108 <input id="enddate" name="enddate" value="<?php echo $enddate ? $enddate : ''; ?>"> 109 </label> 110 </p> 111 <p> 112 <label for="endtime">Start Time<br> 113 <select id="endtimehour" name="endtimehour"> 114 <?php 115 for( $i = 1; $i <= 12; $i++ ) 116 { 117 $selected = ( $i == $endtimehour ) ? ' selected="selected"' : ''; 118 echo "<option value=\"$i\"$selected>$i</option>"; 119 } 120 ?> 121 </select> 122 <select id="endtimeminute" name="endtimeminute"> 123 <?php 124 for( $i = 0; $i <= 55; $i += 5 ) 125 { 126 $selected = ( $i == $endtimeminute ) ? ' selected="selected"' : ''; 127 $zero = $i < 10 ? 0 : ''; 128 echo "<option value=\"$i\"$selected>$zero$i</option>"; 129 } 130 ?> 131 </select> 132 <select id="endtimeampm" name="endtimeampm"> 133 <option value="am"<?php echo $endtimeampm == 'am' ? ' selected="selected"' : '';?>>AM</option> 134 <option value="pm"<?php echo $endtimeampm == 'pm' ? ' selected="selected"' : '';?>>PM</option> 135 </select> 136 <div id="endtimeslider"></div> 68 137 </label> 69 138 </p> … … 95 164 { 96 165 update_post_meta( $post->ID, 'startdate', $_POST[ 'startdate' ] ); 166 update_post_meta( $post->ID, 'starttimehour', $_POST[ 'starttimehour' ] ); 167 update_post_meta( $post->ID, 'starttimeminute', $_POST[ 'starttimeminute' ] ); 168 update_post_meta( $post->ID, 'starttimeampm', $_POST[ 'starttimeampm' ] ); 169 update_post_meta( $post->ID, 'enddate', $_POST[ 'enddate' ] ); 170 update_post_meta( $post->ID, 'endtimehour', $_POST[ 'endtimehour' ] ); 171 update_post_meta( $post->ID, 'endtimeminute', $_POST[ 'endtimeminute' ] ); 172 update_post_meta( $post->ID, 'endtimeampm', $_POST[ 'endtimeampm' ] ); 97 173 } 98 174 } … … 110 186 if( 'ec_event' != $post_type ) 111 187 return; 112 wp_enqueue_script( 'jquery-ui-datepicker' ); 113 wp_enqueue_style( 'jquery.ui.theme', plugins_url( '/css/datepicker/jquery-ui-1.8.23.custom.css', __FILE__ ) ); 114 wp_enqueue_style( 'jquery.ui.theme.datepicker.custom', plugins_url( '/css/datepicker/custom.css', __FILE__ ) ); 188 wp_enqueue_script( 'jquery-ui-custom', EVENTS_CALENDAR_JS_URL . 'jquery-ui-1.8.23.custom.min.js', 'jquery' ); 189 wp_enqueue_style( 'jquery.ui.theme', EVENTS_CALENDAR_CSS_URL . 'jquery-ui/smoothness/jquery-ui-1.8.23.custom.css' ); 115 190 } 116 191 add_action( 'admin_print_scripts-post.php', 'ec_admin_scripts' ); … … 127 202 ?> 128 203 <script> 129 jQuery( document ).ready ( function()130 {131 jQuery( '#startdate,#enddate' ).datepicker(204 jQuery( document ).ready 205 ( 206 function() 132 207 { 133 dateFormat : 'yy-mm-dd', 134 showButtonPanel : true, 135 changeMonth : true, 136 changeYear : true, 137 showAnim : 'slideDown' 138 }); 139 jQuery( '#startdate' ).datepicker( 140 { 141 onSelect: function( selectedDate ) { 142 jQuery( "#enddate" ).datepicker( "option", "minDate", selectedDate ); 143 } 144 }); 145 jQuery( '#enddate' ).datepicker( 146 { 147 onSelect: function( selectedDate ) { 148 jQuery( "#startdate" ).datepicker( "option", "maxDate", selectedDate ); 149 } 150 }); 151 }); 208 increment = 1 / 12; 209 jQuery( '#startdate' ).datepicker 210 ( 211 { 212 dateFormat : 'yy-mm-dd', 213 showButtonPanel : true, 214 changeMonth : true, 215 changeYear : true, 216 showAnim : 'slideDown', 217 onSelect : function( selectedDate ) 218 { 219 jQuery( "#enddate" ).datepicker( "option", "minDate", selectedDate ); 220 } 221 } 222 ); 223 jQuery( '#enddate' ).datepicker 224 ( 225 { 226 dateFormat : 'yy-mm-dd', 227 showButtonPanel : true, 228 changeMonth : true, 229 changeYear : true, 230 showAnim : 'slideDown', 231 onSelect : function( selectedDate ) 232 { 233 jQuery( "#startdate" ).datepicker( "option", "maxDate", selectedDate ); 234 } 235 } 236 ); 237 jQuery( '#starttimeslider' ).slider 238 ( 239 { 240 min : 0, 241 max : 24 - increment, 242 step : increment, 243 slide : function( event, ui ) 244 { 245 starthour = Math.floor( ui.value ); 246 startminute = Math.round( ( ui.value - starthour ) * 60 ); 247 startminute = startminute < 10 ? '0' + startminute : startminute; 248 startampm = 'am'; 249 if( starthour > 11 ) 250 { 251 starthour = starthour - 12; 252 startampm = 'pm'; 253 } 254 starthour = starthour == 0 ? 12 : starthour; 255 jQuery( '#starttimehour' ).val( starthour ); 256 jQuery( '#starttimeminute' ).val( startminute ); 257 jQuery( '#starttimeampm' ).val( startampm ); 258 } 259 } 260 ); 261 jQuery( '#endtimeslider' ).slider 262 ( 263 { 264 min : 0, 265 max : 24 - increment, 266 step : increment, 267 slide : function( event, ui ) 268 { 269 starthour = Math.floor( ui.value ); 270 startminute = Math.round( ( ui.value - starthour ) * 60 ); 271 startminute = startminute < 10 ? '0' + startminute : startminute; 272 startampm = 'am'; 273 if( starthour > 11 ) 274 { 275 starthour = starthour - 12; 276 startampm = 'pm'; 277 } 278 starthour = starthour == 0 ? 12 : starthour; 279 jQuery( '#endtimehour' ).val( starthour ); 280 jQuery( '#endtimeminute' ).val( startminute ); 281 jQuery( '#endtimeampm' ).val( startampm ); 282 } 283 } 284 ); 285 jQuery( '#starttimehour,#starttimeminute,#starttimeampm').change 286 ( 287 function() 288 { 289 starthour = parseInt( jQuery( '#starttimehour' ).val() ); 290 startminute = parseInt( jQuery( '#starttimeminute' ).val() ); 291 startampm = jQuery( '#starttimeampm' ).val(); 292 if( startampm == 'pm' && starthour != 12 ) 293 starthour = starthour + 12; 294 if( startampm == 'am' && starthour == 12 ) 295 starthour = 0; 296 slidervalue = starthour + ( startminute / 60 ); 297 jQuery( '#starttimeslider' ).slider( 'value', slidervalue ); 298 } 299 ); 300 jQuery( '#endtimehour,#endtimeminute,#endtimeampm').change 301 ( 302 function() 303 { 304 endhour = parseInt( jQuery( '#endtimehour' ).val() ); 305 endminute = parseInt( jQuery( '#endtimeminute' ).val() ); 306 endampm = jQuery( '#endtimeampm' ).val(); 307 if( endampm == 'pm' && endhour != 12 ) 308 endhour = endhour + 12; 309 if( endampm == 'am' && endhour == 12 ) 310 endhour = 0; 311 slidervalue = endhour + ( endminute / 60 ); 312 jQuery( '#endtimeslider' ).slider( 'value', slidervalue ); 313 } 314 ); 315 starthour = parseInt( jQuery( '#starttimehour' ).val() ); 316 startminute = parseInt( jQuery( '#starttimeminute' ).val() ); 317 startampm = jQuery( '#starttimeampm' ).val(); 318 if( startampm == 'pm' && starthour != 12 ) 319 starthour = starthour + 12; 320 if( startampm == 'am' && starthour == 12 ) 321 starthour = 0; 322 slidervalue = starthour + ( startminute / 60 ); 323 jQuery( '#starttimeslider' ).slider( 'value', slidervalue ); 324 endhour = parseInt( jQuery( '#endtimehour' ).val() ); 325 endminute = parseInt( jQuery( '#endtimeminute' ).val() ); 326 endampm = jQuery( '#endtimeampm' ).val(); 327 if( endampm == 'pm' && endhour != 12 ) 328 endhour = endhour + 12; 329 if( endampm == 'am' && endhour == 12 ) 330 endhour = 0; 331 slidervalue = endhour + ( endminute / 60 ); 332 jQuery( '#endtimeslider' ).slider( 'value', slidervalue ); 333 } 334 ); 152 335 </script> 153 336 <?php
Note: See TracChangeset
for help on using the changeset viewer.