Version Description
- Bugfix:
- datepicker shortcode works now if contact form 7 is not installed
Download this release
Release Info
Developer | shockware |
Plugin | Contact Form 7 Datepicker |
Version | 0.7.4 |
Comparing to | |
See all releases |
Code changes from version 0.7.2 to 0.7.4
- .gitignore +1 -0
- contact-form-7-datepicker.php +95 -94
- css/jsDatePick_ltr.css +0 -0
- css/jsDatePick_ltr.min.css +0 -0
- css/jsDatePick_rtl.css +0 -0
- css/jsDatePick_rtl.min.css +0 -0
- css/schemes/red.css +0 -0
- js/jsDatePick.jquery.full.js +1 -1
- js/jsDatePick.jquery.min.js +1 -1
- languages/contact-form-7-datepicker-it_IT.mo +0 -0
- languages/contact-form-7-datepicker-it_IT.po +1 -1
- languages/contact-form-7-datepicker-nl_NL.mo +0 -0
- languages/contact-form-7-datepicker-ro_RO.mo +0 -0
- languages/contact-form-7-datepicker-ro_RO.po +1 -1
- languages/contact-form-7-datepicker.pot +1 -1
- readme.txt +10 -2
.gitignore
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
geany_run_script.sh
|
contact-form-7-datepicker.php
CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Contact Form 7 Datepicker
|
|
4 |
Plugin URI: https://github.com/relu/contact-form-7-datepicker/
|
5 |
Description: Implements a new [date] tag in Contact Form 7 that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date. Now you can use the [datepicker] shortcode outside of CF7.
|
6 |
Author: Aurel Canciu
|
7 |
-
Version: 0.7.
|
8 |
Author URI: https://github.com/relu/
|
9 |
*/
|
10 |
?>
|
@@ -28,7 +28,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
28 |
?>
|
29 |
<?php
|
30 |
|
31 |
-
define('CF7_DATE_PICKER_VERSION', '0.7.
|
32 |
define('PLUGIN_PATH', '/wp-content/plugins/'.plugin_basename(dirname(__FILE__)));
|
33 |
|
34 |
if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
|
@@ -36,18 +36,18 @@ if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
|
|
36 |
}
|
37 |
|
38 |
class CF7DatePicker {
|
39 |
-
|
40 |
/**
|
41 |
* static Array $option_defaults
|
42 |
-
*
|
43 |
* Holds the default option values for the plugin
|
44 |
*/
|
45 |
static $option_defaults = array(
|
46 |
-
"useMode" => 2,
|
47 |
-
"isStripped" => "false",
|
48 |
-
"limitToToday" => 0,
|
49 |
-
"cellColorScheme" => "beige",
|
50 |
-
"dateFormat" => "%d-%m-%Y",
|
51 |
"weekStartDay" => 1,
|
52 |
"directionality" => "ltr",
|
53 |
"yearsRange" => "1970,2100",
|
@@ -59,13 +59,13 @@ class CF7DatePicker {
|
|
59 |
|
60 |
/**
|
61 |
* __construct()
|
62 |
-
*
|
63 |
* This is the class constructor method, it registers actions and initializes the plugin
|
64 |
*/
|
65 |
function __construct() {
|
66 |
register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
|
67 |
register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
|
68 |
-
|
69 |
add_action('plugins_loaded', array(__CLASS__, 'register_shortcodes'));
|
70 |
add_action('admin_init', array(__CLASS__, 'tag_generator'));
|
71 |
add_action('admin_menu', array(__CLASS__, 'register_admin_settings'));
|
@@ -74,22 +74,22 @@ class CF7DatePicker {
|
|
74 |
add_action('wp_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
|
75 |
}
|
76 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
|
77 |
-
|
78 |
add_action('init', array(__CLASS__, 'calendar_l10n'));
|
79 |
-
|
80 |
|
81 |
add_filter('wpcf7_validate_date', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
|
82 |
add_filter('wpcf7_validate_date*', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
|
83 |
-
|
84 |
add_action('init', array(__CLASS__, 'admin_l10n'));
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
* activate()
|
89 |
-
*
|
90 |
* Action triggered when plugin is activated
|
91 |
* It inserts some default values as options
|
92 |
-
*/
|
93 |
public static function activate() {
|
94 |
foreach (self::$option_defaults as $option => $value) {
|
95 |
add_option($option, $value);
|
@@ -98,10 +98,10 @@ class CF7DatePicker {
|
|
98 |
|
99 |
/**
|
100 |
* deactivate()
|
101 |
-
*
|
102 |
* Action triggered when plugin is deactivated
|
103 |
* It deletes the settings stored in the database
|
104 |
-
*/
|
105 |
public static function deactivate() {
|
106 |
foreach (self::$option_defaults as $option => $value) {
|
107 |
delete_option($option);
|
@@ -110,7 +110,7 @@ class CF7DatePicker {
|
|
110 |
|
111 |
/**
|
112 |
* update_settings($dataupdate)
|
113 |
-
*
|
114 |
* Updates plugin's settings into the database
|
115 |
* @param Array $dateupdate, contains the updated settings
|
116 |
*/
|
@@ -175,7 +175,7 @@ class CF7DatePicker {
|
|
175 |
closedir($handle);
|
176 |
return $schemeimg;
|
177 |
}
|
178 |
-
|
179 |
/**
|
180 |
* get_scheme_style($scheme)
|
181 |
*
|
@@ -202,10 +202,10 @@ class CF7DatePicker {
|
|
202 |
foreach(self::$option_defaults as $option => $value)
|
203 |
$dataupdate[$option] = $_POST[$option];
|
204 |
$dataupdate['yearsRange'] = trim($_POST['yearmin']).",".trim($_POST['yearmax']);
|
205 |
-
|
206 |
$dataupdate['yearButtons'] = (isset($_POST['yearButtons'])) ? "true" : "false";
|
207 |
$dataupdate['monthButtons'] = (isset($_POST['monthButtons'])) ? "true" : "false";
|
208 |
-
|
209 |
if ($_POST['selectedDate'] !== '') {
|
210 |
if (get_option('dateFormat') !== $dataupdate['dateFormat']) {
|
211 |
$df = $dataupdate['dateFormat'];
|
@@ -213,11 +213,11 @@ class CF7DatePicker {
|
|
213 |
$df = get_option('dateFormat');
|
214 |
}
|
215 |
$df = str_replace('%', '', trim($df));
|
216 |
-
|
217 |
$dataupdate['selectedDate'] = date($df, strtotime($_POST['selectedDate']));
|
218 |
$dataupdate['selectedDate'] = date("Y-m-d", strtotime($dataupdate['selectedDate']));
|
219 |
}
|
220 |
-
|
221 |
self::update_settings($dataupdate);
|
222 |
}
|
223 |
$useMode = array(1,2);
|
@@ -240,11 +240,11 @@ class CF7DatePicker {
|
|
240 |
__('Right to left', 'contact-form-7-datepicker')
|
241 |
);
|
242 |
$yearsRange = explode(",", trim(get_option('yearsRange')));
|
243 |
-
|
244 |
?>
|
245 |
<div class="wrap">
|
246 |
<h2>Contact Form 7 Datepicker</h2><?php
|
247 |
-
echo __('<p>This plugin implements a new <strong>[date]</strong> tag in <a href="http://wordpress.org/extend/plugins/contact-form-7/">Contact Form 7</a>
|
248 |
that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date.<br />
|
249 |
To use it simply insert the <strong>[date your-field-name]</strong> or <strong>[date* your-requierd-field-name]</strong> if you want it to be mandatory,
|
250 |
in your Contact Form 7 edit section.</p>', 'contact-form-7-datepicker'); ?>
|
@@ -261,20 +261,20 @@ class CF7DatePicker {
|
|
261 |
$checked = "checked=\"checked\"";
|
262 |
else
|
263 |
$checked = ""; ?>
|
264 |
-
|
265 |
<div style="float: left; width: 100px; margin: 30px 30px 0 0; text-align: center;">
|
266 |
<div style="display: block; padding: 5px; background: #fff; border: 1px solid #ccc; border-radius: 4px 4px 4px 4px;">
|
267 |
<label><?php echo $scheme; ?></label><br /><?php
|
268 |
foreach(self::get_scheme_images($scheme) as $img) { ?>
|
269 |
-
<img src="<?php echo $img; ?>" style="margin: 5px;" /><?php
|
270 |
} ?><br /><br />
|
271 |
<input name="cellColorScheme" type="radio" width="24" height="25" value="<?php echo $scheme; ?>" <?php echo $checked; ?> />
|
272 |
</div>
|
273 |
-
</div><?php
|
274 |
} ?>
|
275 |
</td>
|
276 |
</tr>
|
277 |
-
|
278 |
<tr>
|
279 |
<th>
|
280 |
<label><?php echo __('Use Mode', 'contact-form-7-datepicker'); ?></label>
|
@@ -286,7 +286,7 @@ class CF7DatePicker {
|
|
286 |
$selected = "selected";
|
287 |
else
|
288 |
$selected = "";
|
289 |
-
|
290 |
echo "<option value='".$row."' ".$selected." >".$row."</option>";
|
291 |
} ?>
|
292 |
</select>
|
@@ -296,7 +296,7 @@ class CF7DatePicker {
|
|
296 |
2 – The calendar will appear as a popup when the field with the id supplied in target is clicked.</p>', 'contact-form-7-datepicker'); ?>
|
297 |
</td>
|
298 |
</tr>
|
299 |
-
|
300 |
<tr>
|
301 |
<th>
|
302 |
<label><?php echo __('Sripped', 'contact-form-7-datepicker'); ?></label>
|
@@ -308,12 +308,12 @@ class CF7DatePicker {
|
|
308 |
$val = "true";
|
309 |
else
|
310 |
$val = "false";
|
311 |
-
|
312 |
if ($val == get_option('isStripped'))
|
313 |
$selected = "selected";
|
314 |
else
|
315 |
$selected = "";
|
316 |
-
|
317 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
318 |
} ?>
|
319 |
</select>
|
@@ -322,7 +322,7 @@ class CF7DatePicker {
|
|
322 |
<?php echo __('<p>When set to true the calendar appears without the visual design - usually used with \'Use Mod\' 1.</p>','contact-form-7-datepicker'); ?>
|
323 |
</td>
|
324 |
</tr>
|
325 |
-
|
326 |
<tr>
|
327 |
<th>
|
328 |
<label><?php echo __('Limit Dates To', 'contact-form-7-datepicker'); ?></label>
|
@@ -336,12 +336,12 @@ class CF7DatePicker {
|
|
336 |
$val = -1;
|
337 |
else
|
338 |
$val = 0;
|
339 |
-
|
340 |
if ($val == get_option('limitToToday'))
|
341 |
$selected = "selected";
|
342 |
else
|
343 |
$selected = "";
|
344 |
-
|
345 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
346 |
} ?>
|
347 |
</select>
|
@@ -350,7 +350,7 @@ class CF7DatePicker {
|
|
350 |
<?php echo __('<p>Enables you to limit the possible picking dates according to the current date.</p>','contact-form-7-datepicker'); ?>
|
351 |
</td>
|
352 |
</tr>
|
353 |
-
|
354 |
<tr>
|
355 |
<th>
|
356 |
<label><?php echo __('Week Start Day', 'contact-form-7-datepicker'); ?></h2></label>
|
@@ -362,12 +362,12 @@ class CF7DatePicker {
|
|
362 |
$val = 0;
|
363 |
else
|
364 |
$val = 1;
|
365 |
-
|
366 |
if($val == get_option('weekStartDay'))
|
367 |
$selected = "selected";
|
368 |
else
|
369 |
$selected = "";
|
370 |
-
|
371 |
echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
|
372 |
} ?>
|
373 |
</select>
|
@@ -375,7 +375,7 @@ class CF7DatePicker {
|
|
375 |
<td>
|
376 |
</td>
|
377 |
</tr>
|
378 |
-
|
379 |
<tr>
|
380 |
<th>
|
381 |
<label><?php echo __('Years Range', 'contact-form-7-datepicker'); ?></h2></label>
|
@@ -385,7 +385,7 @@ class CF7DatePicker {
|
|
385 |
<input name="yearmax" id="yearmax" type="text" value="<?php echo $yearsRange[1]; ?>" />
|
386 |
</td>
|
387 |
</tr>
|
388 |
-
|
389 |
<tr>
|
390 |
<th>
|
391 |
<label><?php echo __('Text Direction', 'contact-form-7-datepicker'); ?></h2></label>
|
@@ -397,12 +397,12 @@ class CF7DatePicker {
|
|
397 |
$val = "ltr";
|
398 |
else
|
399 |
$val = "rtl";
|
400 |
-
|
401 |
if($val == get_option('directionality'))
|
402 |
$selected = "selected";
|
403 |
else
|
404 |
$selected = "";
|
405 |
-
|
406 |
echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
|
407 |
} ?>
|
408 |
</select>
|
@@ -410,13 +410,13 @@ class CF7DatePicker {
|
|
410 |
<td>
|
411 |
</td>
|
412 |
</tr>
|
413 |
-
|
414 |
<tr>
|
415 |
<th>
|
416 |
<label><?php echo __('Controls', 'contact-form-7-datepicker'); ?></h2></label>
|
417 |
</th>
|
418 |
<td><?php
|
419 |
-
|
420 |
if (get_option('yearButtons') == "true")
|
421 |
$checked = "checked=\"checked\"";
|
422 |
else
|
@@ -424,7 +424,7 @@ class CF7DatePicker {
|
|
424 |
echo "<input type=\"checkbox\" name=\"yearButtons\" ".$checked.">"; ?>
|
425 |
<label><?php echo __('Year Controls','contact-form-7-datepicker'); ?> </label>
|
426 |
<br /><?php
|
427 |
-
|
428 |
if (get_option('monthButtons') == "true")
|
429 |
$checked = "checked=\"checked\"";
|
430 |
else
|
@@ -436,13 +436,13 @@ class CF7DatePicker {
|
|
436 |
<?php echo __('<p>You can select here what controls would you like to display on the calendar.</p>', 'contact-form-7-datepicker'); ?>
|
437 |
</td>
|
438 |
</tr>
|
439 |
-
|
440 |
<tr>
|
441 |
<th>
|
442 |
<label><?php echo __('Selected Date', 'contact-form-7-datepicker'); ?></label>
|
443 |
</th>
|
444 |
<td style="overflow: visible">
|
445 |
-
<?php
|
446 |
echo self::page_text_filter_callback("selectedDate");
|
447 |
?>
|
448 |
</td>
|
@@ -450,7 +450,7 @@ class CF7DatePicker {
|
|
450 |
<?php echo __('<p>You can set here a default selected date and have a look of how the calendar shows up.</p>', 'contact-form-7-datepicker'); ?>
|
451 |
</td>
|
452 |
</tr>
|
453 |
-
|
454 |
<tr>
|
455 |
<th>
|
456 |
<label><?php echo __('Animate', 'contact-form-7-datepicker'); ?></label>
|
@@ -462,12 +462,12 @@ class CF7DatePicker {
|
|
462 |
$val = "true";
|
463 |
else
|
464 |
$val = "false";
|
465 |
-
|
466 |
if ($val == get_option('animate'))
|
467 |
$selected = "selected";
|
468 |
else
|
469 |
$selected = "";
|
470 |
-
|
471 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
472 |
} ?>
|
473 |
</select>
|
@@ -476,7 +476,7 @@ class CF7DatePicker {
|
|
476 |
<?php echo __('<p>Animation on display.</p>','contact-form-7-datepicker'); ?>
|
477 |
</td>
|
478 |
</tr>
|
479 |
-
|
480 |
<tr>
|
481 |
<th>
|
482 |
<label><?php echo __('Date Format', 'contact-form-7-datepicker'); ?></label>
|
@@ -496,11 +496,11 @@ class CF7DatePicker {
|
|
496 |
%Y - A full numeric representation of a year, 4 digits<br />
|
497 |
%y - A two digit representation of a year<br />
|
498 |
<br />
|
499 |
-
You can of course put whatever divider you want between them.<br /></p>',
|
500 |
'contact-form-7-datepicker'); ?>
|
501 |
</td>
|
502 |
</tr>
|
503 |
-
|
504 |
<tr>
|
505 |
<td colspan="2">
|
506 |
</td>
|
@@ -521,10 +521,10 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
521 |
public static function register_files() {
|
522 |
wp_register_style('jsdp_ltr', plugins_url( '/css/jsDatePick_ltr.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
|
523 |
wp_register_style('jsdp_rtl', plugins_url( '/css/jsDatePick_rtl.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
|
524 |
-
|
525 |
wp_register_script('jsDatePickJS', plugins_url( '/js/jsDatePick.jquery.min.js', __FILE__ ), array('jquery'), CF7_DATE_PICKER_VERSION, true);
|
526 |
}
|
527 |
-
|
528 |
/**
|
529 |
* plugin_enqueues()
|
530 |
*
|
@@ -533,7 +533,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
533 |
public static function plugin_enqueues() {
|
534 |
wp_enqueue_style('jsdp_'.get_option('directionality'));
|
535 |
wp_enqueue_script('jsDatePickJS');
|
536 |
-
|
537 |
do_action('plugin_enqueues');
|
538 |
}
|
539 |
|
@@ -550,22 +550,22 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
550 |
} else {
|
551 |
$name = $data['name'];
|
552 |
}
|
553 |
-
|
554 |
if (is_array($data) && isset($data['atts']['id'])) {
|
555 |
$id = $data['atts']['id'];
|
556 |
} else {
|
557 |
$id = $name;
|
558 |
}
|
559 |
-
|
560 |
$jssafeid = preg_replace('/[^A-Za-z0-9]/', '', $id);
|
561 |
-
|
562 |
if (is_array($data) && !empty($data['value']) && is_numeric(strtotime($data['value']))) {
|
563 |
$seldate = date('Y-m-d', strtotime($data['value']));
|
564 |
-
|
565 |
} else {
|
566 |
$seldate = get_option('selectedDate');
|
567 |
}
|
568 |
-
|
569 |
if ($seldate) {
|
570 |
$ts = strtotime($seldate);
|
571 |
$seldate = array(
|
@@ -573,38 +573,38 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
573 |
'm' => date('m', $ts),
|
574 |
'y' => date('Y', $ts)
|
575 |
);
|
576 |
-
|
577 |
$dateval = $seldate['y'].'-'.$seldate['m'].'-'.$seldate['d'];
|
578 |
} else {
|
579 |
$dateval = '';
|
580 |
}
|
581 |
-
|
582 |
$attributes = '';
|
583 |
-
|
584 |
if (is_array($data['atts'])) {
|
585 |
foreach ($data['atts'] as $key => $val) {
|
586 |
if (!empty($val))
|
587 |
$attributes .= $key.'="'.$val.'" ';
|
588 |
}
|
589 |
}
|
590 |
-
|
591 |
if (!is_array($data) || (is_array($data['atts']) && empty($data['atts']['id']))) {
|
592 |
$attributes .= 'id="'.$id.'" ';
|
593 |
}
|
594 |
-
|
595 |
-
if (!empty($dateval)) {
|
596 |
$df = str_replace('%', '', get_option('dateFormat'));
|
597 |
$dateval = date($df, strtotime($dateval));
|
598 |
$attributes .= 'value="'.$dateval.'"';
|
599 |
}
|
600 |
-
|
601 |
$attributes = trim($attributes);
|
602 |
-
|
603 |
$string = '';
|
604 |
-
|
605 |
if ( (is_array($data) && $data['opts']['newfield'] === 'true') || !is_array($data) || (is_array($data) && empty($data['opts']['newfield'])))
|
606 |
$string = '<input type="text" name="'.$name.'" '.$attributes.' />';
|
607 |
-
|
608 |
$string .= '
|
609 |
<script type="text/javascript">
|
610 |
jQuery(document).ready(function() {
|
@@ -625,7 +625,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
625 |
if ($seldate) {
|
626 |
$string .= ',
|
627 |
selectedDate: {
|
628 |
-
year: '.$seldate['y'].',
|
629 |
month: '.$seldate['m'].',
|
630 |
day: '.$seldate['d'].'
|
631 |
}';
|
@@ -640,7 +640,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
640 |
<style type="text/css">
|
641 |
@import url(\''.$schemecss.'\');
|
642 |
</style>';
|
643 |
-
|
644 |
return $string;
|
645 |
}
|
646 |
|
@@ -659,10 +659,10 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
659 |
|
660 |
$type = $tag['type'];
|
661 |
$name = $tag['name'];
|
662 |
-
|
663 |
$options = (array) $tag['options'];
|
664 |
$values = (array) $tag['values'];
|
665 |
-
|
666 |
if ( empty( $name ) )
|
667 |
return '';
|
668 |
|
@@ -692,7 +692,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
692 |
} else {
|
693 |
$value = $values[0];
|
694 |
}
|
695 |
-
|
696 |
$data = array(
|
697 |
"name" => $name,
|
698 |
"atts" => (array) $atts,
|
@@ -745,11 +745,11 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
745 |
public static function admin_l10n() {
|
746 |
load_plugin_textdomain( 'contact-form-7-datepicker', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
747 |
}
|
748 |
-
|
749 |
/**
|
750 |
* datepicker_shortcode_handler()
|
751 |
*
|
752 |
-
* Function that handles the [datepicker name="?" id="?" class="?" newfield="?" value="?"] shortcode
|
753 |
*/
|
754 |
public static function datepicker_shortcode_handler($atts) {
|
755 |
extract(shortcode_atts(array(
|
@@ -759,7 +759,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
759 |
'newfield' => 'true',
|
760 |
'value' => ''
|
761 |
), $atts));
|
762 |
-
|
763 |
$data = array(
|
764 |
"name" => ($name) ? "{$name}" : "{$id}",
|
765 |
"atts" => array(
|
@@ -772,7 +772,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
772 |
|
773 |
return self::page_text_filter_callback($data);
|
774 |
}
|
775 |
-
|
776 |
/**
|
777 |
* calendar_l10n()
|
778 |
*
|
@@ -781,7 +781,7 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
781 |
public static function calendar_l10n() {
|
782 |
$l10n_strings = array(
|
783 |
'MONTHS' => array(
|
784 |
-
__('
|
785 |
__('February', 'contact-form-7-datepicker'),
|
786 |
__('March', 'contact-form-7-datepicker'),
|
787 |
__('April', 'contact-form-7-datepicker'),
|
@@ -813,27 +813,28 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
813 |
'ERROR_4' => __('Target invalid!', 'contact-form-7-datepicker'),
|
814 |
'ERROR_3' => __('Target invalid!', 'contact-form-7-datepicker')
|
815 |
);
|
816 |
-
$l10n = array('l10n_print_after' => 'g_l10n = ' . json_encode($l10n_strings) . ';');
|
817 |
-
|
818 |
wp_localize_script('jsDatePickJS', 'g_l10n', $l10n);
|
819 |
}
|
820 |
-
|
821 |
/**
|
822 |
* register_shortcodes()
|
823 |
-
*
|
824 |
* Function for registering our shortcodes with CF7
|
825 |
*/
|
826 |
public static function register_shortcodes() {
|
827 |
if (function_exists('wpcf7_add_shortcode')) {
|
828 |
wpcf7_add_shortcode('date', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
|
829 |
wpcf7_add_shortcode('date*', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
|
830 |
-
add_shortcode( 'datepicker', array(__CLASS__, 'datepicker_shortcode_handler') );
|
831 |
}
|
|
|
|
|
832 |
}
|
833 |
-
|
834 |
/**
|
835 |
* tag_generator()
|
836 |
-
*
|
837 |
* Registers the tag generator for CF7
|
838 |
*/
|
839 |
public static function tag_generator() {
|
@@ -842,20 +843,20 @@ You can of course put whatever divider you want between them.<br /></p>',
|
|
842 |
'wpcf7-tg-pane-date', array(__CLASS__, 'wpcf7_tg_pane_datepicker_'));
|
843 |
}
|
844 |
}
|
845 |
-
|
846 |
/**
|
847 |
* wpcf7_tg_pane_datepicker_(&$contact_form)
|
848 |
-
*
|
849 |
* Caller function for the tag generator
|
850 |
* @param reference &$contact_form
|
851 |
*/
|
852 |
public static function wpcf7_tg_pane_datepicker_(&$contact_form) {
|
853 |
self::wpcf7_tg_pane_datepicker( 'date' );
|
854 |
}
|
855 |
-
|
856 |
/**
|
857 |
* wpcf7_tg_pane_datepicker($type = 'date')
|
858 |
-
*
|
859 |
* Callback function for the tag generator (called by wpcf7_tg_pane_datepicker_)
|
860 |
* @param $type = 'date'
|
861 |
*/
|
4 |
Plugin URI: https://github.com/relu/contact-form-7-datepicker/
|
5 |
Description: Implements a new [date] tag in Contact Form 7 that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date. Now you can use the [datepicker] shortcode outside of CF7.
|
6 |
Author: Aurel Canciu
|
7 |
+
Version: 0.7.4
|
8 |
Author URI: https://github.com/relu/
|
9 |
*/
|
10 |
?>
|
28 |
?>
|
29 |
<?php
|
30 |
|
31 |
+
define('CF7_DATE_PICKER_VERSION', '0.7.4');
|
32 |
define('PLUGIN_PATH', '/wp-content/plugins/'.plugin_basename(dirname(__FILE__)));
|
33 |
|
34 |
if (!defined('CF7_DATE_PICKER_ENQUEUES')) {
|
36 |
}
|
37 |
|
38 |
class CF7DatePicker {
|
39 |
+
|
40 |
/**
|
41 |
* static Array $option_defaults
|
42 |
+
*
|
43 |
* Holds the default option values for the plugin
|
44 |
*/
|
45 |
static $option_defaults = array(
|
46 |
+
"useMode" => 2,
|
47 |
+
"isStripped" => "false",
|
48 |
+
"limitToToday" => 0,
|
49 |
+
"cellColorScheme" => "beige",
|
50 |
+
"dateFormat" => "%d-%m-%Y",
|
51 |
"weekStartDay" => 1,
|
52 |
"directionality" => "ltr",
|
53 |
"yearsRange" => "1970,2100",
|
59 |
|
60 |
/**
|
61 |
* __construct()
|
62 |
+
*
|
63 |
* This is the class constructor method, it registers actions and initializes the plugin
|
64 |
*/
|
65 |
function __construct() {
|
66 |
register_activation_hook(__FILE__, array(__CLASS__, 'activate'));
|
67 |
register_deactivation_hook(__FILE__, array(__CLASS__, 'deactivate'));
|
68 |
+
|
69 |
add_action('plugins_loaded', array(__CLASS__, 'register_shortcodes'));
|
70 |
add_action('admin_init', array(__CLASS__, 'tag_generator'));
|
71 |
add_action('admin_menu', array(__CLASS__, 'register_admin_settings'));
|
74 |
add_action('wp_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
|
75 |
}
|
76 |
add_action('admin_enqueue_scripts', array(__CLASS__, 'plugin_enqueues'));
|
77 |
+
|
78 |
add_action('init', array(__CLASS__, 'calendar_l10n'));
|
79 |
+
|
80 |
|
81 |
add_filter('wpcf7_validate_date', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
|
82 |
add_filter('wpcf7_validate_date*', array(__CLASS__, 'wpcf7_validation_filter'), 10, 2);
|
83 |
+
|
84 |
add_action('init', array(__CLASS__, 'admin_l10n'));
|
85 |
}
|
86 |
|
87 |
/**
|
88 |
* activate()
|
89 |
+
*
|
90 |
* Action triggered when plugin is activated
|
91 |
* It inserts some default values as options
|
92 |
+
*/
|
93 |
public static function activate() {
|
94 |
foreach (self::$option_defaults as $option => $value) {
|
95 |
add_option($option, $value);
|
98 |
|
99 |
/**
|
100 |
* deactivate()
|
101 |
+
*
|
102 |
* Action triggered when plugin is deactivated
|
103 |
* It deletes the settings stored in the database
|
104 |
+
*/
|
105 |
public static function deactivate() {
|
106 |
foreach (self::$option_defaults as $option => $value) {
|
107 |
delete_option($option);
|
110 |
|
111 |
/**
|
112 |
* update_settings($dataupdate)
|
113 |
+
*
|
114 |
* Updates plugin's settings into the database
|
115 |
* @param Array $dateupdate, contains the updated settings
|
116 |
*/
|
175 |
closedir($handle);
|
176 |
return $schemeimg;
|
177 |
}
|
178 |
+
|
179 |
/**
|
180 |
* get_scheme_style($scheme)
|
181 |
*
|
202 |
foreach(self::$option_defaults as $option => $value)
|
203 |
$dataupdate[$option] = $_POST[$option];
|
204 |
$dataupdate['yearsRange'] = trim($_POST['yearmin']).",".trim($_POST['yearmax']);
|
205 |
+
|
206 |
$dataupdate['yearButtons'] = (isset($_POST['yearButtons'])) ? "true" : "false";
|
207 |
$dataupdate['monthButtons'] = (isset($_POST['monthButtons'])) ? "true" : "false";
|
208 |
+
|
209 |
if ($_POST['selectedDate'] !== '') {
|
210 |
if (get_option('dateFormat') !== $dataupdate['dateFormat']) {
|
211 |
$df = $dataupdate['dateFormat'];
|
213 |
$df = get_option('dateFormat');
|
214 |
}
|
215 |
$df = str_replace('%', '', trim($df));
|
216 |
+
|
217 |
$dataupdate['selectedDate'] = date($df, strtotime($_POST['selectedDate']));
|
218 |
$dataupdate['selectedDate'] = date("Y-m-d", strtotime($dataupdate['selectedDate']));
|
219 |
}
|
220 |
+
|
221 |
self::update_settings($dataupdate);
|
222 |
}
|
223 |
$useMode = array(1,2);
|
240 |
__('Right to left', 'contact-form-7-datepicker')
|
241 |
);
|
242 |
$yearsRange = explode(",", trim(get_option('yearsRange')));
|
243 |
+
|
244 |
?>
|
245 |
<div class="wrap">
|
246 |
<h2>Contact Form 7 Datepicker</h2><?php
|
247 |
+
echo __('<p>This plugin implements a new <strong>[date]</strong> tag in <a href="http://wordpress.org/extend/plugins/contact-form-7/">Contact Form 7</a>
|
248 |
that adds a date field to a form. When clicking the field a calendar pops up enabling your site visitors to easily select any date.<br />
|
249 |
To use it simply insert the <strong>[date your-field-name]</strong> or <strong>[date* your-requierd-field-name]</strong> if you want it to be mandatory,
|
250 |
in your Contact Form 7 edit section.</p>', 'contact-form-7-datepicker'); ?>
|
261 |
$checked = "checked=\"checked\"";
|
262 |
else
|
263 |
$checked = ""; ?>
|
264 |
+
|
265 |
<div style="float: left; width: 100px; margin: 30px 30px 0 0; text-align: center;">
|
266 |
<div style="display: block; padding: 5px; background: #fff; border: 1px solid #ccc; border-radius: 4px 4px 4px 4px;">
|
267 |
<label><?php echo $scheme; ?></label><br /><?php
|
268 |
foreach(self::get_scheme_images($scheme) as $img) { ?>
|
269 |
+
<img src="<?php echo $img; ?>" style="margin: 5px;" /><?php
|
270 |
} ?><br /><br />
|
271 |
<input name="cellColorScheme" type="radio" width="24" height="25" value="<?php echo $scheme; ?>" <?php echo $checked; ?> />
|
272 |
</div>
|
273 |
+
</div><?php
|
274 |
} ?>
|
275 |
</td>
|
276 |
</tr>
|
277 |
+
|
278 |
<tr>
|
279 |
<th>
|
280 |
<label><?php echo __('Use Mode', 'contact-form-7-datepicker'); ?></label>
|
286 |
$selected = "selected";
|
287 |
else
|
288 |
$selected = "";
|
289 |
+
|
290 |
echo "<option value='".$row."' ".$selected." >".$row."</option>";
|
291 |
} ?>
|
292 |
</select>
|
296 |
2 – The calendar will appear as a popup when the field with the id supplied in target is clicked.</p>', 'contact-form-7-datepicker'); ?>
|
297 |
</td>
|
298 |
</tr>
|
299 |
+
|
300 |
<tr>
|
301 |
<th>
|
302 |
<label><?php echo __('Sripped', 'contact-form-7-datepicker'); ?></label>
|
308 |
$val = "true";
|
309 |
else
|
310 |
$val = "false";
|
311 |
+
|
312 |
if ($val == get_option('isStripped'))
|
313 |
$selected = "selected";
|
314 |
else
|
315 |
$selected = "";
|
316 |
+
|
317 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
318 |
} ?>
|
319 |
</select>
|
322 |
<?php echo __('<p>When set to true the calendar appears without the visual design - usually used with \'Use Mod\' 1.</p>','contact-form-7-datepicker'); ?>
|
323 |
</td>
|
324 |
</tr>
|
325 |
+
|
326 |
<tr>
|
327 |
<th>
|
328 |
<label><?php echo __('Limit Dates To', 'contact-form-7-datepicker'); ?></label>
|
336 |
$val = -1;
|
337 |
else
|
338 |
$val = 0;
|
339 |
+
|
340 |
if ($val == get_option('limitToToday'))
|
341 |
$selected = "selected";
|
342 |
else
|
343 |
$selected = "";
|
344 |
+
|
345 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
346 |
} ?>
|
347 |
</select>
|
350 |
<?php echo __('<p>Enables you to limit the possible picking dates according to the current date.</p>','contact-form-7-datepicker'); ?>
|
351 |
</td>
|
352 |
</tr>
|
353 |
+
|
354 |
<tr>
|
355 |
<th>
|
356 |
<label><?php echo __('Week Start Day', 'contact-form-7-datepicker'); ?></h2></label>
|
362 |
$val = 0;
|
363 |
else
|
364 |
$val = 1;
|
365 |
+
|
366 |
if($val == get_option('weekStartDay'))
|
367 |
$selected = "selected";
|
368 |
else
|
369 |
$selected = "";
|
370 |
+
|
371 |
echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
|
372 |
} ?>
|
373 |
</select>
|
375 |
<td>
|
376 |
</td>
|
377 |
</tr>
|
378 |
+
|
379 |
<tr>
|
380 |
<th>
|
381 |
<label><?php echo __('Years Range', 'contact-form-7-datepicker'); ?></h2></label>
|
385 |
<input name="yearmax" id="yearmax" type="text" value="<?php echo $yearsRange[1]; ?>" />
|
386 |
</td>
|
387 |
</tr>
|
388 |
+
|
389 |
<tr>
|
390 |
<th>
|
391 |
<label><?php echo __('Text Direction', 'contact-form-7-datepicker'); ?></h2></label>
|
397 |
$val = "ltr";
|
398 |
else
|
399 |
$val = "rtl";
|
400 |
+
|
401 |
if($val == get_option('directionality'))
|
402 |
$selected = "selected";
|
403 |
else
|
404 |
$selected = "";
|
405 |
+
|
406 |
echo "<option value='".$val."' ".$selected." >".__($row,'contact-form-7-datepicker')."</option>";
|
407 |
} ?>
|
408 |
</select>
|
410 |
<td>
|
411 |
</td>
|
412 |
</tr>
|
413 |
+
|
414 |
<tr>
|
415 |
<th>
|
416 |
<label><?php echo __('Controls', 'contact-form-7-datepicker'); ?></h2></label>
|
417 |
</th>
|
418 |
<td><?php
|
419 |
+
|
420 |
if (get_option('yearButtons') == "true")
|
421 |
$checked = "checked=\"checked\"";
|
422 |
else
|
424 |
echo "<input type=\"checkbox\" name=\"yearButtons\" ".$checked.">"; ?>
|
425 |
<label><?php echo __('Year Controls','contact-form-7-datepicker'); ?> </label>
|
426 |
<br /><?php
|
427 |
+
|
428 |
if (get_option('monthButtons') == "true")
|
429 |
$checked = "checked=\"checked\"";
|
430 |
else
|
436 |
<?php echo __('<p>You can select here what controls would you like to display on the calendar.</p>', 'contact-form-7-datepicker'); ?>
|
437 |
</td>
|
438 |
</tr>
|
439 |
+
|
440 |
<tr>
|
441 |
<th>
|
442 |
<label><?php echo __('Selected Date', 'contact-form-7-datepicker'); ?></label>
|
443 |
</th>
|
444 |
<td style="overflow: visible">
|
445 |
+
<?php
|
446 |
echo self::page_text_filter_callback("selectedDate");
|
447 |
?>
|
448 |
</td>
|
450 |
<?php echo __('<p>You can set here a default selected date and have a look of how the calendar shows up.</p>', 'contact-form-7-datepicker'); ?>
|
451 |
</td>
|
452 |
</tr>
|
453 |
+
|
454 |
<tr>
|
455 |
<th>
|
456 |
<label><?php echo __('Animate', 'contact-form-7-datepicker'); ?></label>
|
462 |
$val = "true";
|
463 |
else
|
464 |
$val = "false";
|
465 |
+
|
466 |
if ($val == get_option('animate'))
|
467 |
$selected = "selected";
|
468 |
else
|
469 |
$selected = "";
|
470 |
+
|
471 |
echo "<option value='".$val."' ".$selected." >".__($row, 'contact-form-7-datepicker')."</option>";
|
472 |
} ?>
|
473 |
</select>
|
476 |
<?php echo __('<p>Animation on display.</p>','contact-form-7-datepicker'); ?>
|
477 |
</td>
|
478 |
</tr>
|
479 |
+
|
480 |
<tr>
|
481 |
<th>
|
482 |
<label><?php echo __('Date Format', 'contact-form-7-datepicker'); ?></label>
|
496 |
%Y - A full numeric representation of a year, 4 digits<br />
|
497 |
%y - A two digit representation of a year<br />
|
498 |
<br />
|
499 |
+
You can of course put whatever divider you want between them.<br /></p>',
|
500 |
'contact-form-7-datepicker'); ?>
|
501 |
</td>
|
502 |
</tr>
|
503 |
+
|
504 |
<tr>
|
505 |
<td colspan="2">
|
506 |
</td>
|
521 |
public static function register_files() {
|
522 |
wp_register_style('jsdp_ltr', plugins_url( '/css/jsDatePick_ltr.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
|
523 |
wp_register_style('jsdp_rtl', plugins_url( '/css/jsDatePick_rtl.min.css', __FILE__ ), array(), CF7_DATE_PICKER_VERSION);
|
524 |
+
|
525 |
wp_register_script('jsDatePickJS', plugins_url( '/js/jsDatePick.jquery.min.js', __FILE__ ), array('jquery'), CF7_DATE_PICKER_VERSION, true);
|
526 |
}
|
527 |
+
|
528 |
/**
|
529 |
* plugin_enqueues()
|
530 |
*
|
533 |
public static function plugin_enqueues() {
|
534 |
wp_enqueue_style('jsdp_'.get_option('directionality'));
|
535 |
wp_enqueue_script('jsDatePickJS');
|
536 |
+
|
537 |
do_action('plugin_enqueues');
|
538 |
}
|
539 |
|
550 |
} else {
|
551 |
$name = $data['name'];
|
552 |
}
|
553 |
+
|
554 |
if (is_array($data) && isset($data['atts']['id'])) {
|
555 |
$id = $data['atts']['id'];
|
556 |
} else {
|
557 |
$id = $name;
|
558 |
}
|
559 |
+
|
560 |
$jssafeid = preg_replace('/[^A-Za-z0-9]/', '', $id);
|
561 |
+
|
562 |
if (is_array($data) && !empty($data['value']) && is_numeric(strtotime($data['value']))) {
|
563 |
$seldate = date('Y-m-d', strtotime($data['value']));
|
564 |
+
|
565 |
} else {
|
566 |
$seldate = get_option('selectedDate');
|
567 |
}
|
568 |
+
|
569 |
if ($seldate) {
|
570 |
$ts = strtotime($seldate);
|
571 |
$seldate = array(
|
573 |
'm' => date('m', $ts),
|
574 |
'y' => date('Y', $ts)
|
575 |
);
|
576 |
+
|
577 |
$dateval = $seldate['y'].'-'.$seldate['m'].'-'.$seldate['d'];
|
578 |
} else {
|
579 |
$dateval = '';
|
580 |
}
|
581 |
+
|
582 |
$attributes = '';
|
583 |
+
|
584 |
if (is_array($data['atts'])) {
|
585 |
foreach ($data['atts'] as $key => $val) {
|
586 |
if (!empty($val))
|
587 |
$attributes .= $key.'="'.$val.'" ';
|
588 |
}
|
589 |
}
|
590 |
+
|
591 |
if (!is_array($data) || (is_array($data['atts']) && empty($data['atts']['id']))) {
|
592 |
$attributes .= 'id="'.$id.'" ';
|
593 |
}
|
594 |
+
|
595 |
+
if (!empty($dateval)) {
|
596 |
$df = str_replace('%', '', get_option('dateFormat'));
|
597 |
$dateval = date($df, strtotime($dateval));
|
598 |
$attributes .= 'value="'.$dateval.'"';
|
599 |
}
|
600 |
+
|
601 |
$attributes = trim($attributes);
|
602 |
+
|
603 |
$string = '';
|
604 |
+
|
605 |
if ( (is_array($data) && $data['opts']['newfield'] === 'true') || !is_array($data) || (is_array($data) && empty($data['opts']['newfield'])))
|
606 |
$string = '<input type="text" name="'.$name.'" '.$attributes.' />';
|
607 |
+
|
608 |
$string .= '
|
609 |
<script type="text/javascript">
|
610 |
jQuery(document).ready(function() {
|
625 |
if ($seldate) {
|
626 |
$string .= ',
|
627 |
selectedDate: {
|
628 |
+
year: '.$seldate['y'].',
|
629 |
month: '.$seldate['m'].',
|
630 |
day: '.$seldate['d'].'
|
631 |
}';
|
640 |
<style type="text/css">
|
641 |
@import url(\''.$schemecss.'\');
|
642 |
</style>';
|
643 |
+
|
644 |
return $string;
|
645 |
}
|
646 |
|
659 |
|
660 |
$type = $tag['type'];
|
661 |
$name = $tag['name'];
|
662 |
+
|
663 |
$options = (array) $tag['options'];
|
664 |
$values = (array) $tag['values'];
|
665 |
+
|
666 |
if ( empty( $name ) )
|
667 |
return '';
|
668 |
|
692 |
} else {
|
693 |
$value = $values[0];
|
694 |
}
|
695 |
+
|
696 |
$data = array(
|
697 |
"name" => $name,
|
698 |
"atts" => (array) $atts,
|
745 |
public static function admin_l10n() {
|
746 |
load_plugin_textdomain( 'contact-form-7-datepicker', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
747 |
}
|
748 |
+
|
749 |
/**
|
750 |
* datepicker_shortcode_handler()
|
751 |
*
|
752 |
+
* Function that handles the [datepicker name="?" id="?" class="?" newfield="?" value="?"] shortcode
|
753 |
*/
|
754 |
public static function datepicker_shortcode_handler($atts) {
|
755 |
extract(shortcode_atts(array(
|
759 |
'newfield' => 'true',
|
760 |
'value' => ''
|
761 |
), $atts));
|
762 |
+
|
763 |
$data = array(
|
764 |
"name" => ($name) ? "{$name}" : "{$id}",
|
765 |
"atts" => array(
|
772 |
|
773 |
return self::page_text_filter_callback($data);
|
774 |
}
|
775 |
+
|
776 |
/**
|
777 |
* calendar_l10n()
|
778 |
*
|
781 |
public static function calendar_l10n() {
|
782 |
$l10n_strings = array(
|
783 |
'MONTHS' => array(
|
784 |
+
__('January', 'contact-form-7-datepicker'),
|
785 |
__('February', 'contact-form-7-datepicker'),
|
786 |
__('March', 'contact-form-7-datepicker'),
|
787 |
__('April', 'contact-form-7-datepicker'),
|
813 |
'ERROR_4' => __('Target invalid!', 'contact-form-7-datepicker'),
|
814 |
'ERROR_3' => __('Target invalid!', 'contact-form-7-datepicker')
|
815 |
);
|
816 |
+
$l10n = array('l10n_print_after' => 'g_l10n = ' . json_encode($l10n_strings) . ';');
|
817 |
+
|
818 |
wp_localize_script('jsDatePickJS', 'g_l10n', $l10n);
|
819 |
}
|
820 |
+
|
821 |
/**
|
822 |
* register_shortcodes()
|
823 |
+
*
|
824 |
* Function for registering our shortcodes with CF7
|
825 |
*/
|
826 |
public static function register_shortcodes() {
|
827 |
if (function_exists('wpcf7_add_shortcode')) {
|
828 |
wpcf7_add_shortcode('date', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
|
829 |
wpcf7_add_shortcode('date*', array(__CLASS__, 'wpcf7_shotcode_handler'), true);
|
|
|
830 |
}
|
831 |
+
|
832 |
+
add_shortcode( 'datepicker', array(__CLASS__, 'datepicker_shortcode_handler') );
|
833 |
}
|
834 |
+
|
835 |
/**
|
836 |
* tag_generator()
|
837 |
+
*
|
838 |
* Registers the tag generator for CF7
|
839 |
*/
|
840 |
public static function tag_generator() {
|
843 |
'wpcf7-tg-pane-date', array(__CLASS__, 'wpcf7_tg_pane_datepicker_'));
|
844 |
}
|
845 |
}
|
846 |
+
|
847 |
/**
|
848 |
* wpcf7_tg_pane_datepicker_(&$contact_form)
|
849 |
+
*
|
850 |
* Caller function for the tag generator
|
851 |
* @param reference &$contact_form
|
852 |
*/
|
853 |
public static function wpcf7_tg_pane_datepicker_(&$contact_form) {
|
854 |
self::wpcf7_tg_pane_datepicker( 'date' );
|
855 |
}
|
856 |
+
|
857 |
/**
|
858 |
* wpcf7_tg_pane_datepicker($type = 'date')
|
859 |
+
*
|
860 |
* Callback function for the tag generator (called by wpcf7_tg_pane_datepicker_)
|
861 |
* @param $type = 'date'
|
862 |
*/
|
css/jsDatePick_ltr.css
CHANGED
File without changes
|
css/jsDatePick_ltr.min.css
CHANGED
File without changes
|
css/jsDatePick_rtl.css
CHANGED
File without changes
|
css/jsDatePick_rtl.min.css
CHANGED
File without changes
|
css/schemes/red.css
CHANGED
File without changes
|
js/jsDatePick.jquery.full.js
CHANGED
@@ -78,7 +78,7 @@
|
|
78 |
|
79 |
if (typeof(g_l10n) === "undefined") {
|
80 |
g_l10n = [];
|
81 |
-
g_l10n["MONTHS"] = ["
|
82 |
g_l10n["DAYS_3"] = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
|
83 |
g_l10n["MONTH_FWD"] = "Move a month forward";
|
84 |
g_l10n["MONTH_BCK"] = "Move a month backward";
|
78 |
|
79 |
if (typeof(g_l10n) === "undefined") {
|
80 |
g_l10n = [];
|
81 |
+
g_l10n["MONTHS"] = ["January","February","March","April","May","June","July","August","September","October","November","December"];
|
82 |
g_l10n["DAYS_3"] = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
|
83 |
g_l10n["MONTH_FWD"] = "Move a month forward";
|
84 |
g_l10n["MONTH_BCK"] = "Move a month backward";
|
js/jsDatePick.jquery.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
if(typeof(g_l10n)==="undefined"){g_l10n=[];g_l10n.MONTHS=["Janaury","February","March","April","May","June","July","August","September","October","November","December"];g_l10n.DAYS_3=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];g_l10n.MONTH_FWD="Move a month forward";g_l10n.MONTH_BCK="Move a month backward";g_l10n.YEAR_FWD="Move a year forward";g_l10n.YEAR_BCK="Move a year backward";g_l10n.CLOSE="Close the calendar";g_l10n.ERROR_2=g_l10n.ERROR_1="Date object invalid!";g_l10n.ERROR_4=g_l10n.ERROR_3="Target invalid!"}g_arrayOfUsedJsDatePickCalsGlobalNumbers=[];g_arrayOfUsedJsDatePickCals=[];g_currentDateObject={};g_currentDateObject.dateObject=new Date();g_currentDateObject.day=g_currentDateObject.dateObject.getDate();g_currentDateObject.month=g_currentDateObject.dateObject.getMonth()+1;g_currentDateObject.year=g_currentDateObject.dateObject.getFullYear();String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};String.prototype.strpad=function(){return(!isNaN(this)&&this.toString().length==1)?"0"+this:this};JsDatePick=function(a){if(document.all){this.isie=true;this.iever=JsDatePick.getInternetExplorerVersion()}else{this.isie=false}this.oConfiguration={};this.oCurrentDay=g_currentDateObject;this.monthsTextualRepresentation=g_l10n.MONTHS;this.lastPostedDay=null;this.initialZIndex=2;this.globalNumber=this.getUnUsedGlobalNumber();g_arrayOfUsedJsDatePickCals[this.globalNumber]=this;this.setConfiguration(a);this.makeCalendar()};JsDatePick.getCalInstanceById=function(a){return g_arrayOfUsedJsDatePickCals[parseInt(a,10)]};JsDatePick.getInternetExplorerVersion=function(){var c=-1,a,b;if(navigator.appName=="Microsoft Internet Explorer"){a=navigator.userAgent;b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(a)!=null){c=parseFloat(RegExp.$1)}return c}};JsDatePick.prototype.setC=function(a,b){if(this.isie&&this.iever>7){jQuery(a).attr("class",b)}else{a.className=b}};JsDatePick.prototype.getUnUsedGlobalNumber=function(){var a=Math.floor(Math.random()*1000);while(!this.isUnique_GlobalNumber(a)){a=Math.floor(Math.random()*1000)}return a};JsDatePick.prototype.isUnique_GlobalNumber=function(b){var a;for(a=0;a<g_arrayOfUsedJsDatePickCalsGlobalNumbers.length;a++){if(g_arrayOfUsedJsDatePickCalsGlobalNumbers[a]==b){return false}}return true};JsDatePick.prototype.addOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.addonSelectedDelegate=a}return false};JsDatePick.prototype.setOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.onSelectedDelegate=a;return true}return false};JsDatePick.prototype.executeOnSelectedDelegateIfExists=function(){if(typeof(this.onSelectedDelegate)=="function"){this.onSelectedDelegate()}if(typeof(this.addonSelectedDelegate)=="function"){this.addonSelectedDelegate()}};JsDatePick.prototype.setRepopulationDelegate=function(a){if(typeof(a)=="function"){this.repopulationDelegate=a;return true}return false};JsDatePick.prototype.setConfiguration=function(a){this.oConfiguration.isStripped=(a.isStripped!=null)?a.isStripped:false;this.oConfiguration.useMode=(a.useMode!=null)?a.useMode:1;this.oConfiguration.selectedDate=(a.selectedDate!=null)?a.selectedDate:null;this.oConfiguration.target=(a.target!=null)?a.target:null;this.oConfiguration.yearsRange=(a.yearsRange!=null)?a.yearsRange:[1971,2100];this.oConfiguration.yearButtons=(a.yearButtons!=null)?a.yearButtons:true;this.oConfiguration.monthButtons=(a.monthButtons!=null)?a.monthButtons:true;this.oConfiguration.limitToToday=(a.limitToToday!=null)?a.limitToToday:0;this.oConfiguration.field=(a.field!=null)?a.field:false;this.oConfiguration.cellColorScheme=(a.cellColorScheme!=null)?a.cellColorScheme:"ocean_blue";this.oConfiguration.dateFormat=(a.dateFormat!=null)?a.dateFormat:"%m-%d-%Y";this.oConfiguration.imgPath=(a.imgPath!=null)?a.imgPath:"img/";this.oConfiguration.weekStartDay=(a.weekStartDay!=null)?a.weekStartDay:1;this.oConfiguration.directionality=(a.directionality!=null)?a.directionality:"ltr";this.oConfiguration.animate=(a.animate!=null)?a.animate:true;this.selectedDayObject={};this.flag_DayMarkedBeforeRepopulation=false;this.flag_aDayWasSelected=false;this.lastMarkedDayObject=null;if(!this.oConfiguration.selectedDate){this.currentYear=this.oCurrentDay.year;this.currentMonth=this.oCurrentDay.month;this.currentDay=this.oCurrentDay.day}};JsDatePick.prototype.resizeCalendar=function(){this.leftWallStrechedElement.style.height="0px";this.rightWallStrechedElement.style.height="0px";var a=this.JsDatePickBox.offsetHeight,b=a-16;if(b<0){return}this.leftWallStrechedElement.style.height=b+"px";this.rightWallStrechedElement.style.height=b+"px";return true};JsDatePick.prototype.closeCalendar=function(){if(this.oConfiguration.animate===true){jQuery(this.JsDatePickBox).hide(500)}else{this.JsDatePickBox.style.display="none"}document.onclick=function(){}};JsDatePick.prototype.populateFieldWithSelectedDate=function(){jQuery("#"+this.oConfiguration.target).val(this.getSelectedDayFormatted());if(this.lastPickedDateObject){delete (this.lastPickedDateObject)}this.lastPickedDateObject={};this.lastPickedDateObject.day=this.selectedDayObject.day;this.lastPickedDateObject.month=this.selectedDayObject.month;this.lastPickedDateObject.year=this.selectedDayObject.year;this.closeCalendar()};JsDatePick.prototype.makeCalendar=function(){var j=document,e,a,b,k,g,h,f,o,i,m,n,l,c;e=j.createElement("div");a=j.createElement("div");b=j.createElement("div");this.setC(e,"JsDatePickBox");this.setC(a,"clearfix");this.setC(b,"jsDatePickCloseButton");b.setAttribute("globalNumber",this.globalNumber);b.onmouseover=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.CLOSE);d.setC(this,"jsDatePickCloseButtonOver")};b.onmouseout=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"jsDatePickCloseButton")};b.onmousedown=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.CLOSE);d.setC(this,"jsDatePickCloseButtonDown")};b.onmouseup=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"jsDatePickCloseButton");d.closeCalendar()};this.JsDatePickBox=e;k=j.createElement("div");g=j.createElement("div");h=j.createElement("div");f=j.createElement("div");this.setC(h,"topWall");this.setC(f,"bottomWall");if(this.isie&&this.iever==6){f.style.bottom="-2px"}o=j.createElement("div");i=j.createElement("div");m=j.createElement("div");this.setC(o,"leftTopCorner");this.setC(i,"leftBottomCorner");this.setC(m,"leftWall");this.leftWallStrechedElement=m;this.leftWall=k;this.rightWall=g;k.appendChild(o);k.appendChild(m);k.appendChild(i);o=j.createElement("div");i=j.createElement("div");m=j.createElement("div");this.setC(o,"rightTopCorner");this.setC(i,"rightBottomCorner");this.setC(m,"rightWall");this.rightWallStrechedElement=m;g.appendChild(o);g.appendChild(m);g.appendChild(i);if(this.oConfiguration.isStripped){this.setC(k,"hiddenBoxLeftWall");this.setC(g,"hiddenBoxRightWall")}else{this.setC(k,"boxLeftWall");this.setC(g,"boxRightWall")}e.appendChild(k);e.appendChild(this.getDOMCalendarStripped());e.appendChild(g);e.appendChild(a);if(!this.oConfiguration.isStripped){e.appendChild(b);e.appendChild(h);e.appendChild(f)}if(this.oConfiguration.useMode==2){if(this.oConfiguration.target!=false){if(typeof(jQuery("#"+this.oConfiguration.target))!=null){n=document.getElementById(this.oConfiguration.target);l=document.createElement("span");n.parentNode.replaceChild(l,n);l.appendChild(n);n.setAttribute("globalNumber",this.globalNumber);n.onclick=function(){JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")).showCalendar()};n.onfocus=function(){JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")).showCalendar()};jQuery(n).mouseout(function(){jQuery("*").not("JsDatePickBox").live("focus",function(){JsDatePick.getCalInstanceById(n.getAttribute("globalNumber")).closeCalendar()})});l.style.position="relative";this.initialZIndex++;e.style.zIndex=this.initialZIndex.toString();e.style.position="absolute";e.style.top="18px";e.style.left="0px";e.style.display="none";l.appendChild(e);c=new Function("g_arrayOfUsedJsDatePickCals["+this.globalNumber+"].populateFieldWithSelectedDate();");this.setOnSelectedDelegate(c)}else{alert(g_l10n.ERROR_3)}}}else{if(this.oConfiguration.target!=null){jQuery("#"+this.oConfiguration.target).append(e);jQuery("#"+this.oConfiguration.target).css("position","relative");e.style.position="absolute";e.style.top="0px";e.style.left="0px";this.resizeCalendar();this.executePopulationDelegateIfExists()}else{alert(g_l10n.ERROR_4)}}};JsDatePick.prototype.determineFieldDate=function(){var b,c,e,g,l,d,a,h,k,f=false,j=false;if(this.lastPickedDateObject){this.setSelectedDay({year:parseInt(this.lastPickedDateObject.year),month:parseInt(this.lastPickedDateObject.month,10),day:parseInt(this.lastPickedDateObject.day,10)})}else{b=jQuery("#"+this.oConfiguration.target);if(jQuery.trim(b.val()).length==0){this.unsetSelection();if(typeof(this.oConfiguration.selectedDate)=="object"&&this.oConfiguration.selectedDate){this.setSelectedDay({year:parseInt(this.oConfiguration.selectedDate.year),month:parseInt(this.oConfiguration.selectedDate.month,10),day:parseInt(this.oConfiguration.selectedDate.day,10)})}}else{if(jQuery.trim(b.val()).length>5){c=this.senseDivider(this.oConfiguration.dateFormat);e=this.oConfiguration.dateFormat;g=jQuery.trim(b.val()).split(c);l=e.trim().split(c);d=a=h=k=0;for(d=0;d<l.length;d++){switch(l[d]){case"%d":case"%j":a=d;break;case"%m":case"%n":k=d;break;case"%M":k=d;f=true;break;case"%F":k=d;j=true;break;case"%Y":case"%y":h=d}}if(f){for(d=0;d<12;d++){if(g_l10n.MONTHS[d].substr(0,3).toUpperCase()==g[k].toUpperCase()){k=d+1;break}}}else{if(j){for(d=0;d<12;d++){if(g_l10n.MONTHS[d].toLowerCase()==g[k].toLowerCase()){k=d+1;break}}}else{k=parseInt(g[k],10)}}this.setSelectedDay({year:parseInt(g[h],10),month:k,day:parseInt(g[a],10)})}else{this.unsetSelection();return}}}};JsDatePick.prototype.senseDivider=function(a){return a.replace("%d","").replace("%j","").replace("%m","").replace("%M","").replace("%n","").replace("%F","").replace("%Y","").replace("%y","").substr(0,1)};JsDatePick.prototype.showCalendar=function(){if(this.JsDatePickBox.style.display=="none"){this.determineFieldDate();this.JsDatePickBox.style.display="block";this.resizeCalendar();if(this.oConfiguration.animate===true){this.JsDatePickBox.style.display="none";jQuery(this.JsDatePickBox).show(500)}this.executePopulationDelegateIfExists();jQuery(this.JsDatePickBox).mouseover(function(){document.onclick=function(){}});jQuery(this.JsDatePickBox).attr("globalCalNumber",this.globalNumber);jQuery(this.JsDatePickBox).mouseout(function(){document.onclick=new Function("g_arrayOfUsedJsDatePickCals["+this.getAttribute("globalCalNumber")+"].closeCalendar();")})}else{return}};JsDatePick.prototype.isAvailable=function(c,a,b){if(c>this.oCurrentDay.year){return false}if(a>this.oCurrentDay.month&&c==this.oCurrentDay.year){return false}if(b>this.oCurrentDay.day&&a==this.oCurrentDay.month&&c==this.oCurrentDay.year){return false}return true};JsDatePick.prototype.getDOMCalendarStripped=function(){var h=document,e,i,b,a,f,c,g;e=h.createElement("div");if(this.oConfiguration.isStripped){this.setC(e,"boxMainStripped")}else{this.setC(e,"boxMain")}this.boxMain=e;i=h.createElement("div");b=h.createElement("div");a=h.createElement("div");f=h.createElement("div");c=h.createElement("div");g=h.createElement("div");this.setC(b,"clearfix");this.setC(g,"clearfix");this.setC(i,"boxMainInner");this.setC(a,"boxMainCellsContainer");this.setC(f,"tooltip");this.setC(c,"weekDaysRow");this.tooltip=f;e.appendChild(i);this.controlsBar=this.getDOMControlBar();this.makeDOMWeekDays(c);i.appendChild(this.controlsBar);i.appendChild(b);i.appendChild(f);i.appendChild(c);i.appendChild(a);i.appendChild(g);this.boxMainCellsContainer=a;this.populateMainBox(a);return e};JsDatePick.prototype.makeDOMWeekDays=function(a){var c=0,g=document,f=g_l10n.DAYS_3,e,b;for(c=this.oConfiguration.weekStartDay;c<7;c++){b=g.createElement("div");e=g.createTextNode(f[c]);this.setC(b,"weekDay");b.appendChild(e);a.appendChild(b)}if(this.oConfiguration.weekStartDay>0){for(c=0;c<this.oConfiguration.weekStartDay;c++){b=g.createElement("div");e=g.createTextNode(f[c]);this.setC(b,"weekDay");b.appendChild(e);a.appendChild(b)}}b.style.marginRight="0px"};JsDatePick.prototype.repopulateMainBox=function(){while(this.boxMainCellsContainer.firstChild){this.boxMainCellsContainer.removeChild(this.boxMainCellsContainer.firstChild)}this.populateMainBox(this.boxMainCellsContainer);this.resizeCalendar();this.executePopulationDelegateIfExists()};JsDatePick.prototype.executePopulationDelegateIfExists=function(){if(typeof(this.repopulationDelegate)=="function"){this.repopulationDelegate()}};JsDatePick.prototype.populateMainBox=function(h){var f=document,g,l,c=1,k=false,n=this.currentMonth-1,j,a,m,e,b;j=new Date(this.currentYear,n,1,1,0,0);a=j.getTime();this.flag_DayMarkedBeforeRepopulation=false;this.setControlBarText(this.monthsTextualRepresentation[n]+", "+this.currentYear);m=parseInt(j.getDay())-this.oConfiguration.weekStartDay;if(m<0){m=m+7}e=0;for(e=0;e<m;e++){g=f.createElement("div");this.setC(g,"skipDay");h.appendChild(g);if(c==7){c=1}else{c++}}while(j.getMonth()==n){k=false;g=f.createElement("div");if(this.lastPostedDay){if(this.lastPostedDay==j.getDate()){l=parseInt(this.lastPostedDay,10)+1}else{l=f.createTextNode(j.getDate())}}else{l=f.createTextNode(j.getDate())}g.appendChild(l);h.appendChild(g);g.setAttribute("globalNumber",this.globalNumber);if(c==7){if(this.oConfiguration.directionality=="ltr"){g.style.marginRight="0px"}else{g.style.marginLeft="0px"}}if(this.isToday(j)){g.setAttribute("isToday",1)}if(this.oConfiguration.limitToToday>=1){if(this.isAvailable(this.currentYear,this.currentMonth,parseInt(j.getDate()+1))){k=true;g.setAttribute("isJsDatePickDisabled",1)}}else{if(this.oConfiguration.limitToToday<=-1){if(!this.isAvailable(this.currentYear,this.currentMonth,parseInt(j.getDate()))){k=true;g.setAttribute("isJsDatePickDisabled",1)}}}g.onmouseover=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayOverToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayOver.gif) left top no-repeat"}else{d.setC(this,"dayOver");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayOver.gif) left top no-repeat"}};g.onmouseout=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayNormalToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}else{d.setC(this,"dayNormal");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}};g.onmousedown=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayDownToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayDown.gif) left top no-repeat"}else{d.setC(this,"dayDown");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayDown.gif) left top no-repeat"}};g.onmouseup=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayNormalToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}else{d.setC(this,"dayNormal");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}d.setDaySelection(this);d.executeOnSelectedDelegateIfExists()};if(this.isSelectedDay(j.getDate())){g.setAttribute("isSelected",1);this.flag_DayMarkedBeforeRepopulation=true;this.lastMarkedDayObject=g;if(parseInt(g.getAttribute("isToday"))==1){this.setC(g,"dayDownToday");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayDown.gif) left top no-repeat"}else{this.setC(g,"dayDown");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayDown.gif) left top no-repeat"}}else{b=this.getCurrentColorScheme();if(parseInt(g.getAttribute("isToday"))==1){if(k){this.setC(g,"dayDisabled");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}else{this.setC(g,"dayNormalToday");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}}else{if(k){this.setC(g,"dayDisabled");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}else{this.setC(g,"dayNormal");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}}}if(c==7){c=1}else{c++}a+=86400000;j.setTime(a)}this.lastPostedDay=null;return h};JsDatePick.prototype.unsetSelection=function(){this.flag_aDayWasSelected=false;this.selectedDayObject={};this.repopulateMainBox()};JsDatePick.prototype.setSelectedDay=function(a){this.flag_aDayWasSelected=true;this.selectedDayObject.day=parseInt(a.day,10);this.selectedDayObject.month=parseInt(a.month,10);this.selectedDayObject.year=parseInt(a.year);this.currentMonth=a.month;this.currentYear=a.year;this.repopulateMainBox()};JsDatePick.prototype.isSelectedDay=function(a){if(this.flag_aDayWasSelected){if(parseInt(a)==this.selectedDayObject.day&&this.currentMonth==this.selectedDayObject.month&&this.currentYear==this.selectedDayObject.year){return true}else{return false}}return false};JsDatePick.prototype.getSelectedDay=function(){if(this.flag_aDayWasSelected){return this.selectedDayObject}else{return false}};JsDatePick.prototype.getSelectedDayFormatted=function(){if(this.flag_aDayWasSelected){var a=this.oConfiguration.dateFormat;a=a.replace("%d",this.selectedDayObject.day.toString().strpad());a=a.replace("%j",this.selectedDayObject.day);a=a.replace("%m",this.selectedDayObject.month.toString().strpad());a=a.replace("%M",g_l10n.MONTHS[this.selectedDayObject.month-1].substr(0,3).toUpperCase());a=a.replace("%n",this.selectedDayObject.month);a=a.replace("%F",g_l10n.MONTHS[this.selectedDayObject.month-1]);a=a.replace("%Y",this.selectedDayObject.year);a=a.replace("%y",this.selectedDayObject.year.toString().substr(2,2));return a}else{return false}};JsDatePick.prototype.setDaySelection=function(a){var b=this.getCurrentColorScheme();if(this.flag_DayMarkedBeforeRepopulation){jQuery(this.lastMarkedDayObject).attr("isSelected",0);if(parseInt(this.lastMarkedDayObject.getAttribute("isToday"))==1){this.setC(this.lastMarkedDayObject,"dayNormalToday");this.lastMarkedDayObject.style.background="url("+this.oConfiguration.imgPath+b+"_dayNormal.gif) left top no-repeat"}else{this.setC(this.lastMarkedDayObject,"dayNormal");this.lastMarkedDayObject.style.background="url("+this.oConfiguration.imgPath+b+"_dayNormal.gif) left top no-repeat"}}this.flag_aDayWasSelected=true;this.selectedDayObject.year=this.currentYear;this.selectedDayObject.month=this.currentMonth;this.selectedDayObject.day=parseInt(a.innerHTML);this.flag_DayMarkedBeforeRepopulation=true;this.lastMarkedDayObject=a;jQuery(a).attr("isSelected",1);if(parseInt(a.getAttribute("isToday"))==1){this.setC(a,"dayDownToday");a.style.background="url("+this.oConfiguration.imgPath+b+"_dayDown.gif) left top no-repeat"}else{this.setC(a,"dayDown");a.style.background="url("+this.oConfiguration.imgPath+b+"_dayDown.gif) left top no-repeat"}};JsDatePick.prototype.isToday=function(a){var b=this.oCurrentDay.month-1;if(a.getDate()==this.oCurrentDay.day&&a.getMonth()==b&&a.getFullYear()==this.oCurrentDay.year){return true}return false};JsDatePick.prototype.setControlBarText=function(a){var b=document.createTextNode(a);jQuery(this.controlsBarTextCell).empty();this.controlsBarTextCell.appendChild(b)};JsDatePick.prototype.setTooltipText=function(a){jQuery(this.tooltip).empty();var b=document.createTextNode(a);this.tooltip.appendChild(b)};JsDatePick.prototype.moveForwardOneYear=function(){var a=this.currentYear+1;if(a<=parseInt(this.oConfiguration.yearsRange[1])){this.currentYear++;this.repopulateMainBox();return true}else{return false}};JsDatePick.prototype.moveBackOneYear=function(){var a=this.currentYear-1;if(a>=parseInt(this.oConfiguration.yearsRange[0])){this.currentYear--;this.repopulateMainBox();return true}else{return false}};JsDatePick.prototype.moveForwardOneMonth=function(){if(this.currentMonth<12){this.currentMonth++}else{if(this.moveForwardOneYear()){this.currentMonth=1}else{this.currentMonth=12}}this.repopulateMainBox()};JsDatePick.prototype.moveBackOneMonth=function(){if(this.currentMonth>1){this.currentMonth--}else{if(this.moveBackOneYear()){this.currentMonth=12}else{this.currentMonth=1}}this.repopulateMainBox()};JsDatePick.prototype.getCurrentColorScheme=function(){return this.oConfiguration.cellColorScheme};JsDatePick.prototype.getDOMControlBar=function(){var h=document,c,f,g,b,a,e;c=h.createElement("div");f=h.createElement("div");g=h.createElement("div");b=h.createElement("div");a=h.createElement("div");e=h.createElement("div");this.setC(c,"controlsBar");this.setC(f,"monthForwardButton");this.setC(g,"monthBackwardButton");this.setC(b,"yearForwardButton");this.setC(a,"yearBackwardButton");this.setC(e,"controlsBarText");jQuery(c).attr("globalNumber",this.globalNumber);if(this.oConfiguration.monthButtons){jQuery(f).attr("globalNumber",this.globalNumber);jQuery(g).attr("globalNumber",this.globalNumber)}if(this.oConfiguration.yearButtons){jQuery(a).attr("globalNumber",this.globalNumber);jQuery(b).attr("globalNumber",this.globalNumber)}this.controlsBarTextCell=e;if(this.oConfiguration.monthButtons){c.appendChild(f);c.appendChild(g)}if(this.oConfiguration.yearButtons){c.appendChild(b);c.appendChild(a)}c.appendChild(e);f.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}d=this.parentNode;while(d.className!="controlsBar"){d=d.parentNode}i=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));i.setTooltipText(g_l10n.MONTH_FWD);i.setC(this,"monthForwardButtonOver")};f.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"monthForwardButton")};f.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}d=this.parentNode;while(d.className!="controlsBar"){d=d.parentNode}i=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));i.setTooltipText(g_l10n.MONTH_FWD);i.setC(this,"monthForwardButtonDown")};f.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_FWD);d.setC(this,"monthForwardButton");d.moveForwardOneMonth()};jQuery(f).click(function(d){d.preventDefault()}).focus(function(d){d.preventDefault()});g.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButtonOver")};g.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"monthBackwardButton")};g.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButtonDown")};g.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButton");d.moveBackOneMonth()};b.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButtonOver")};b.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"yearForwardButton")};b.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButtonDown")};b.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButton");d.moveForwardOneYear()};a.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButtonOver")};a.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"yearBackwardButton")};a.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButtonDown")};a.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButton");d.moveBackOneYear()};return c};
|
1 |
+
if(typeof(g_l10n)==="undefined"){g_l10n=[];g_l10n.MONTHS=["January","February","March","April","May","June","July","August","September","October","November","December"];g_l10n.DAYS_3=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];g_l10n.MONTH_FWD="Move a month forward";g_l10n.MONTH_BCK="Move a month backward";g_l10n.YEAR_FWD="Move a year forward";g_l10n.YEAR_BCK="Move a year backward";g_l10n.CLOSE="Close the calendar";g_l10n.ERROR_2=g_l10n.ERROR_1="Date object invalid!";g_l10n.ERROR_4=g_l10n.ERROR_3="Target invalid!"}g_arrayOfUsedJsDatePickCalsGlobalNumbers=[];g_arrayOfUsedJsDatePickCals=[];g_currentDateObject={};g_currentDateObject.dateObject=new Date();g_currentDateObject.day=g_currentDateObject.dateObject.getDate();g_currentDateObject.month=g_currentDateObject.dateObject.getMonth()+1;g_currentDateObject.year=g_currentDateObject.dateObject.getFullYear();String.prototype.trim=function(){return this.replace(/^\s+|\s+$/g,"")};String.prototype.ltrim=function(){return this.replace(/^\s+/,"")};String.prototype.rtrim=function(){return this.replace(/\s+$/,"")};String.prototype.strpad=function(){return(!isNaN(this)&&this.toString().length==1)?"0"+this:this};JsDatePick=function(a){if(document.all){this.isie=true;this.iever=JsDatePick.getInternetExplorerVersion()}else{this.isie=false}this.oConfiguration={};this.oCurrentDay=g_currentDateObject;this.monthsTextualRepresentation=g_l10n.MONTHS;this.lastPostedDay=null;this.initialZIndex=2;this.globalNumber=this.getUnUsedGlobalNumber();g_arrayOfUsedJsDatePickCals[this.globalNumber]=this;this.setConfiguration(a);this.makeCalendar()};JsDatePick.getCalInstanceById=function(a){return g_arrayOfUsedJsDatePickCals[parseInt(a,10)]};JsDatePick.getInternetExplorerVersion=function(){var c=-1,a,b;if(navigator.appName=="Microsoft Internet Explorer"){a=navigator.userAgent;b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(a)!=null){c=parseFloat(RegExp.$1)}return c}};JsDatePick.prototype.setC=function(a,b){if(this.isie&&this.iever>7){jQuery(a).attr("class",b)}else{a.className=b}};JsDatePick.prototype.getUnUsedGlobalNumber=function(){var a=Math.floor(Math.random()*1000);while(!this.isUnique_GlobalNumber(a)){a=Math.floor(Math.random()*1000)}return a};JsDatePick.prototype.isUnique_GlobalNumber=function(b){var a;for(a=0;a<g_arrayOfUsedJsDatePickCalsGlobalNumbers.length;a++){if(g_arrayOfUsedJsDatePickCalsGlobalNumbers[a]==b){return false}}return true};JsDatePick.prototype.addOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.addonSelectedDelegate=a}return false};JsDatePick.prototype.setOnSelectedDelegate=function(a){if(typeof(a)=="function"){this.onSelectedDelegate=a;return true}return false};JsDatePick.prototype.executeOnSelectedDelegateIfExists=function(){if(typeof(this.onSelectedDelegate)=="function"){this.onSelectedDelegate()}if(typeof(this.addonSelectedDelegate)=="function"){this.addonSelectedDelegate()}};JsDatePick.prototype.setRepopulationDelegate=function(a){if(typeof(a)=="function"){this.repopulationDelegate=a;return true}return false};JsDatePick.prototype.setConfiguration=function(a){this.oConfiguration.isStripped=(a.isStripped!=null)?a.isStripped:false;this.oConfiguration.useMode=(a.useMode!=null)?a.useMode:1;this.oConfiguration.selectedDate=(a.selectedDate!=null)?a.selectedDate:null;this.oConfiguration.target=(a.target!=null)?a.target:null;this.oConfiguration.yearsRange=(a.yearsRange!=null)?a.yearsRange:[1971,2100];this.oConfiguration.yearButtons=(a.yearButtons!=null)?a.yearButtons:true;this.oConfiguration.monthButtons=(a.monthButtons!=null)?a.monthButtons:true;this.oConfiguration.limitToToday=(a.limitToToday!=null)?a.limitToToday:0;this.oConfiguration.field=(a.field!=null)?a.field:false;this.oConfiguration.cellColorScheme=(a.cellColorScheme!=null)?a.cellColorScheme:"ocean_blue";this.oConfiguration.dateFormat=(a.dateFormat!=null)?a.dateFormat:"%m-%d-%Y";this.oConfiguration.imgPath=(a.imgPath!=null)?a.imgPath:"img/";this.oConfiguration.weekStartDay=(a.weekStartDay!=null)?a.weekStartDay:1;this.oConfiguration.directionality=(a.directionality!=null)?a.directionality:"ltr";this.oConfiguration.animate=(a.animate!=null)?a.animate:true;this.selectedDayObject={};this.flag_DayMarkedBeforeRepopulation=false;this.flag_aDayWasSelected=false;this.lastMarkedDayObject=null;if(!this.oConfiguration.selectedDate){this.currentYear=this.oCurrentDay.year;this.currentMonth=this.oCurrentDay.month;this.currentDay=this.oCurrentDay.day}};JsDatePick.prototype.resizeCalendar=function(){this.leftWallStrechedElement.style.height="0px";this.rightWallStrechedElement.style.height="0px";var a=this.JsDatePickBox.offsetHeight,b=a-16;if(b<0){return}this.leftWallStrechedElement.style.height=b+"px";this.rightWallStrechedElement.style.height=b+"px";return true};JsDatePick.prototype.closeCalendar=function(){if(this.oConfiguration.animate===true){jQuery(this.JsDatePickBox).hide(500)}else{this.JsDatePickBox.style.display="none"}document.onclick=function(){}};JsDatePick.prototype.populateFieldWithSelectedDate=function(){jQuery("#"+this.oConfiguration.target).val(this.getSelectedDayFormatted());if(this.lastPickedDateObject){delete (this.lastPickedDateObject)}this.lastPickedDateObject={};this.lastPickedDateObject.day=this.selectedDayObject.day;this.lastPickedDateObject.month=this.selectedDayObject.month;this.lastPickedDateObject.year=this.selectedDayObject.year;this.closeCalendar()};JsDatePick.prototype.makeCalendar=function(){var j=document,e,a,b,k,g,h,f,o,i,m,n,l,c;e=j.createElement("div");a=j.createElement("div");b=j.createElement("div");this.setC(e,"JsDatePickBox");this.setC(a,"clearfix");this.setC(b,"jsDatePickCloseButton");b.setAttribute("globalNumber",this.globalNumber);b.onmouseover=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.CLOSE);d.setC(this,"jsDatePickCloseButtonOver")};b.onmouseout=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"jsDatePickCloseButton")};b.onmousedown=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.CLOSE);d.setC(this,"jsDatePickCloseButtonDown")};b.onmouseup=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"jsDatePickCloseButton");d.closeCalendar()};this.JsDatePickBox=e;k=j.createElement("div");g=j.createElement("div");h=j.createElement("div");f=j.createElement("div");this.setC(h,"topWall");this.setC(f,"bottomWall");if(this.isie&&this.iever==6){f.style.bottom="-2px"}o=j.createElement("div");i=j.createElement("div");m=j.createElement("div");this.setC(o,"leftTopCorner");this.setC(i,"leftBottomCorner");this.setC(m,"leftWall");this.leftWallStrechedElement=m;this.leftWall=k;this.rightWall=g;k.appendChild(o);k.appendChild(m);k.appendChild(i);o=j.createElement("div");i=j.createElement("div");m=j.createElement("div");this.setC(o,"rightTopCorner");this.setC(i,"rightBottomCorner");this.setC(m,"rightWall");this.rightWallStrechedElement=m;g.appendChild(o);g.appendChild(m);g.appendChild(i);if(this.oConfiguration.isStripped){this.setC(k,"hiddenBoxLeftWall");this.setC(g,"hiddenBoxRightWall")}else{this.setC(k,"boxLeftWall");this.setC(g,"boxRightWall")}e.appendChild(k);e.appendChild(this.getDOMCalendarStripped());e.appendChild(g);e.appendChild(a);if(!this.oConfiguration.isStripped){e.appendChild(b);e.appendChild(h);e.appendChild(f)}if(this.oConfiguration.useMode==2){if(this.oConfiguration.target!=false){if(typeof(jQuery("#"+this.oConfiguration.target))!=null){n=document.getElementById(this.oConfiguration.target);l=document.createElement("span");n.parentNode.replaceChild(l,n);l.appendChild(n);n.setAttribute("globalNumber",this.globalNumber);n.onclick=function(){JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")).showCalendar()};n.onfocus=function(){JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")).showCalendar()};jQuery(n).mouseout(function(){jQuery("*").not("JsDatePickBox").live("focus",function(){JsDatePick.getCalInstanceById(n.getAttribute("globalNumber")).closeCalendar()})});l.style.position="relative";this.initialZIndex++;e.style.zIndex=this.initialZIndex.toString();e.style.position="absolute";e.style.top="18px";e.style.left="0px";e.style.display="none";l.appendChild(e);c=new Function("g_arrayOfUsedJsDatePickCals["+this.globalNumber+"].populateFieldWithSelectedDate();");this.setOnSelectedDelegate(c)}else{alert(g_l10n.ERROR_3)}}}else{if(this.oConfiguration.target!=null){jQuery("#"+this.oConfiguration.target).append(e);jQuery("#"+this.oConfiguration.target).css("position","relative");e.style.position="absolute";e.style.top="0px";e.style.left="0px";this.resizeCalendar();this.executePopulationDelegateIfExists()}else{alert(g_l10n.ERROR_4)}}};JsDatePick.prototype.determineFieldDate=function(){var b,c,e,g,l,d,a,h,k,f=false,j=false;if(this.lastPickedDateObject){this.setSelectedDay({year:parseInt(this.lastPickedDateObject.year),month:parseInt(this.lastPickedDateObject.month,10),day:parseInt(this.lastPickedDateObject.day,10)})}else{b=jQuery("#"+this.oConfiguration.target);if(jQuery.trim(b.val()).length==0){this.unsetSelection();if(typeof(this.oConfiguration.selectedDate)=="object"&&this.oConfiguration.selectedDate){this.setSelectedDay({year:parseInt(this.oConfiguration.selectedDate.year),month:parseInt(this.oConfiguration.selectedDate.month,10),day:parseInt(this.oConfiguration.selectedDate.day,10)})}}else{if(jQuery.trim(b.val()).length>5){c=this.senseDivider(this.oConfiguration.dateFormat);e=this.oConfiguration.dateFormat;g=jQuery.trim(b.val()).split(c);l=e.trim().split(c);d=a=h=k=0;for(d=0;d<l.length;d++){switch(l[d]){case"%d":case"%j":a=d;break;case"%m":case"%n":k=d;break;case"%M":k=d;f=true;break;case"%F":k=d;j=true;break;case"%Y":case"%y":h=d}}if(f){for(d=0;d<12;d++){if(g_l10n.MONTHS[d].substr(0,3).toUpperCase()==g[k].toUpperCase()){k=d+1;break}}}else{if(j){for(d=0;d<12;d++){if(g_l10n.MONTHS[d].toLowerCase()==g[k].toLowerCase()){k=d+1;break}}}else{k=parseInt(g[k],10)}}this.setSelectedDay({year:parseInt(g[h],10),month:k,day:parseInt(g[a],10)})}else{this.unsetSelection();return}}}};JsDatePick.prototype.senseDivider=function(a){return a.replace("%d","").replace("%j","").replace("%m","").replace("%M","").replace("%n","").replace("%F","").replace("%Y","").replace("%y","").substr(0,1)};JsDatePick.prototype.showCalendar=function(){if(this.JsDatePickBox.style.display=="none"){this.determineFieldDate();this.JsDatePickBox.style.display="block";this.resizeCalendar();if(this.oConfiguration.animate===true){this.JsDatePickBox.style.display="none";jQuery(this.JsDatePickBox).show(500)}this.executePopulationDelegateIfExists();jQuery(this.JsDatePickBox).mouseover(function(){document.onclick=function(){}});jQuery(this.JsDatePickBox).attr("globalCalNumber",this.globalNumber);jQuery(this.JsDatePickBox).mouseout(function(){document.onclick=new Function("g_arrayOfUsedJsDatePickCals["+this.getAttribute("globalCalNumber")+"].closeCalendar();")})}else{return}};JsDatePick.prototype.isAvailable=function(c,a,b){if(c>this.oCurrentDay.year){return false}if(a>this.oCurrentDay.month&&c==this.oCurrentDay.year){return false}if(b>this.oCurrentDay.day&&a==this.oCurrentDay.month&&c==this.oCurrentDay.year){return false}return true};JsDatePick.prototype.getDOMCalendarStripped=function(){var h=document,e,i,b,a,f,c,g;e=h.createElement("div");if(this.oConfiguration.isStripped){this.setC(e,"boxMainStripped")}else{this.setC(e,"boxMain")}this.boxMain=e;i=h.createElement("div");b=h.createElement("div");a=h.createElement("div");f=h.createElement("div");c=h.createElement("div");g=h.createElement("div");this.setC(b,"clearfix");this.setC(g,"clearfix");this.setC(i,"boxMainInner");this.setC(a,"boxMainCellsContainer");this.setC(f,"tooltip");this.setC(c,"weekDaysRow");this.tooltip=f;e.appendChild(i);this.controlsBar=this.getDOMControlBar();this.makeDOMWeekDays(c);i.appendChild(this.controlsBar);i.appendChild(b);i.appendChild(f);i.appendChild(c);i.appendChild(a);i.appendChild(g);this.boxMainCellsContainer=a;this.populateMainBox(a);return e};JsDatePick.prototype.makeDOMWeekDays=function(a){var c=0,g=document,f=g_l10n.DAYS_3,e,b;for(c=this.oConfiguration.weekStartDay;c<7;c++){b=g.createElement("div");e=g.createTextNode(f[c]);this.setC(b,"weekDay");b.appendChild(e);a.appendChild(b)}if(this.oConfiguration.weekStartDay>0){for(c=0;c<this.oConfiguration.weekStartDay;c++){b=g.createElement("div");e=g.createTextNode(f[c]);this.setC(b,"weekDay");b.appendChild(e);a.appendChild(b)}}b.style.marginRight="0px"};JsDatePick.prototype.repopulateMainBox=function(){while(this.boxMainCellsContainer.firstChild){this.boxMainCellsContainer.removeChild(this.boxMainCellsContainer.firstChild)}this.populateMainBox(this.boxMainCellsContainer);this.resizeCalendar();this.executePopulationDelegateIfExists()};JsDatePick.prototype.executePopulationDelegateIfExists=function(){if(typeof(this.repopulationDelegate)=="function"){this.repopulationDelegate()}};JsDatePick.prototype.populateMainBox=function(h){var f=document,g,l,c=1,k=false,n=this.currentMonth-1,j,a,m,e,b;j=new Date(this.currentYear,n,1,1,0,0);a=j.getTime();this.flag_DayMarkedBeforeRepopulation=false;this.setControlBarText(this.monthsTextualRepresentation[n]+", "+this.currentYear);m=parseInt(j.getDay())-this.oConfiguration.weekStartDay;if(m<0){m=m+7}e=0;for(e=0;e<m;e++){g=f.createElement("div");this.setC(g,"skipDay");h.appendChild(g);if(c==7){c=1}else{c++}}while(j.getMonth()==n){k=false;g=f.createElement("div");if(this.lastPostedDay){if(this.lastPostedDay==j.getDate()){l=parseInt(this.lastPostedDay,10)+1}else{l=f.createTextNode(j.getDate())}}else{l=f.createTextNode(j.getDate())}g.appendChild(l);h.appendChild(g);g.setAttribute("globalNumber",this.globalNumber);if(c==7){if(this.oConfiguration.directionality=="ltr"){g.style.marginRight="0px"}else{g.style.marginLeft="0px"}}if(this.isToday(j)){g.setAttribute("isToday",1)}if(this.oConfiguration.limitToToday>=1){if(this.isAvailable(this.currentYear,this.currentMonth,parseInt(j.getDate()+1))){k=true;g.setAttribute("isJsDatePickDisabled",1)}}else{if(this.oConfiguration.limitToToday<=-1){if(!this.isAvailable(this.currentYear,this.currentMonth,parseInt(j.getDate()))){k=true;g.setAttribute("isJsDatePickDisabled",1)}}}g.onmouseover=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayOverToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayOver.gif) left top no-repeat"}else{d.setC(this,"dayOver");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayOver.gif) left top no-repeat"}};g.onmouseout=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayNormalToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}else{d.setC(this,"dayNormal");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}};g.onmousedown=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isSelected"))==1){return}if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayDownToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayDown.gif) left top no-repeat"}else{d.setC(this,"dayDown");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayDown.gif) left top no-repeat"}};g.onmouseup=function(){var d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber")),i;i=d.getCurrentColorScheme();if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}if(parseInt(this.getAttribute("isToday"))==1){d.setC(this,"dayNormalToday");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}else{d.setC(this,"dayNormal");this.style.background="url("+d.oConfiguration.imgPath+i+"_dayNormal.gif) left top no-repeat"}d.setDaySelection(this);d.executeOnSelectedDelegateIfExists()};if(this.isSelectedDay(j.getDate())){g.setAttribute("isSelected",1);this.flag_DayMarkedBeforeRepopulation=true;this.lastMarkedDayObject=g;if(parseInt(g.getAttribute("isToday"))==1){this.setC(g,"dayDownToday");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayDown.gif) left top no-repeat"}else{this.setC(g,"dayDown");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayDown.gif) left top no-repeat"}}else{b=this.getCurrentColorScheme();if(parseInt(g.getAttribute("isToday"))==1){if(k){this.setC(g,"dayDisabled");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}else{this.setC(g,"dayNormalToday");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}}else{if(k){this.setC(g,"dayDisabled");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}else{this.setC(g,"dayNormal");g.style.background="url("+this.oConfiguration.imgPath+this.oConfiguration.cellColorScheme+"_dayNormal.gif) left top no-repeat"}}}if(c==7){c=1}else{c++}a+=86400000;j.setTime(a)}this.lastPostedDay=null;return h};JsDatePick.prototype.unsetSelection=function(){this.flag_aDayWasSelected=false;this.selectedDayObject={};this.repopulateMainBox()};JsDatePick.prototype.setSelectedDay=function(a){this.flag_aDayWasSelected=true;this.selectedDayObject.day=parseInt(a.day,10);this.selectedDayObject.month=parseInt(a.month,10);this.selectedDayObject.year=parseInt(a.year);this.currentMonth=a.month;this.currentYear=a.year;this.repopulateMainBox()};JsDatePick.prototype.isSelectedDay=function(a){if(this.flag_aDayWasSelected){if(parseInt(a)==this.selectedDayObject.day&&this.currentMonth==this.selectedDayObject.month&&this.currentYear==this.selectedDayObject.year){return true}else{return false}}return false};JsDatePick.prototype.getSelectedDay=function(){if(this.flag_aDayWasSelected){return this.selectedDayObject}else{return false}};JsDatePick.prototype.getSelectedDayFormatted=function(){if(this.flag_aDayWasSelected){var a=this.oConfiguration.dateFormat;a=a.replace("%d",this.selectedDayObject.day.toString().strpad());a=a.replace("%j",this.selectedDayObject.day);a=a.replace("%m",this.selectedDayObject.month.toString().strpad());a=a.replace("%M",g_l10n.MONTHS[this.selectedDayObject.month-1].substr(0,3).toUpperCase());a=a.replace("%n",this.selectedDayObject.month);a=a.replace("%F",g_l10n.MONTHS[this.selectedDayObject.month-1]);a=a.replace("%Y",this.selectedDayObject.year);a=a.replace("%y",this.selectedDayObject.year.toString().substr(2,2));return a}else{return false}};JsDatePick.prototype.setDaySelection=function(a){var b=this.getCurrentColorScheme();if(this.flag_DayMarkedBeforeRepopulation){jQuery(this.lastMarkedDayObject).attr("isSelected",0);if(parseInt(this.lastMarkedDayObject.getAttribute("isToday"))==1){this.setC(this.lastMarkedDayObject,"dayNormalToday");this.lastMarkedDayObject.style.background="url("+this.oConfiguration.imgPath+b+"_dayNormal.gif) left top no-repeat"}else{this.setC(this.lastMarkedDayObject,"dayNormal");this.lastMarkedDayObject.style.background="url("+this.oConfiguration.imgPath+b+"_dayNormal.gif) left top no-repeat"}}this.flag_aDayWasSelected=true;this.selectedDayObject.year=this.currentYear;this.selectedDayObject.month=this.currentMonth;this.selectedDayObject.day=parseInt(a.innerHTML);this.flag_DayMarkedBeforeRepopulation=true;this.lastMarkedDayObject=a;jQuery(a).attr("isSelected",1);if(parseInt(a.getAttribute("isToday"))==1){this.setC(a,"dayDownToday");a.style.background="url("+this.oConfiguration.imgPath+b+"_dayDown.gif) left top no-repeat"}else{this.setC(a,"dayDown");a.style.background="url("+this.oConfiguration.imgPath+b+"_dayDown.gif) left top no-repeat"}};JsDatePick.prototype.isToday=function(a){var b=this.oCurrentDay.month-1;if(a.getDate()==this.oCurrentDay.day&&a.getMonth()==b&&a.getFullYear()==this.oCurrentDay.year){return true}return false};JsDatePick.prototype.setControlBarText=function(a){var b=document.createTextNode(a);jQuery(this.controlsBarTextCell).empty();this.controlsBarTextCell.appendChild(b)};JsDatePick.prototype.setTooltipText=function(a){jQuery(this.tooltip).empty();var b=document.createTextNode(a);this.tooltip.appendChild(b)};JsDatePick.prototype.moveForwardOneYear=function(){var a=this.currentYear+1;if(a<=parseInt(this.oConfiguration.yearsRange[1])){this.currentYear++;this.repopulateMainBox();return true}else{return false}};JsDatePick.prototype.moveBackOneYear=function(){var a=this.currentYear-1;if(a>=parseInt(this.oConfiguration.yearsRange[0])){this.currentYear--;this.repopulateMainBox();return true}else{return false}};JsDatePick.prototype.moveForwardOneMonth=function(){if(this.currentMonth<12){this.currentMonth++}else{if(this.moveForwardOneYear()){this.currentMonth=1}else{this.currentMonth=12}}this.repopulateMainBox()};JsDatePick.prototype.moveBackOneMonth=function(){if(this.currentMonth>1){this.currentMonth--}else{if(this.moveBackOneYear()){this.currentMonth=12}else{this.currentMonth=1}}this.repopulateMainBox()};JsDatePick.prototype.getCurrentColorScheme=function(){return this.oConfiguration.cellColorScheme};JsDatePick.prototype.getDOMControlBar=function(){var h=document,c,f,g,b,a,e;c=h.createElement("div");f=h.createElement("div");g=h.createElement("div");b=h.createElement("div");a=h.createElement("div");e=h.createElement("div");this.setC(c,"controlsBar");this.setC(f,"monthForwardButton");this.setC(g,"monthBackwardButton");this.setC(b,"yearForwardButton");this.setC(a,"yearBackwardButton");this.setC(e,"controlsBarText");jQuery(c).attr("globalNumber",this.globalNumber);if(this.oConfiguration.monthButtons){jQuery(f).attr("globalNumber",this.globalNumber);jQuery(g).attr("globalNumber",this.globalNumber)}if(this.oConfiguration.yearButtons){jQuery(a).attr("globalNumber",this.globalNumber);jQuery(b).attr("globalNumber",this.globalNumber)}this.controlsBarTextCell=e;if(this.oConfiguration.monthButtons){c.appendChild(f);c.appendChild(g)}if(this.oConfiguration.yearButtons){c.appendChild(b);c.appendChild(a)}c.appendChild(e);f.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}d=this.parentNode;while(d.className!="controlsBar"){d=d.parentNode}i=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));i.setTooltipText(g_l10n.MONTH_FWD);i.setC(this,"monthForwardButtonOver")};f.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"monthForwardButton")};f.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}d=this.parentNode;while(d.className!="controlsBar"){d=d.parentNode}i=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));i.setTooltipText(g_l10n.MONTH_FWD);i.setC(this,"monthForwardButtonDown")};f.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_FWD);d.setC(this,"monthForwardButton");d.moveForwardOneMonth()};jQuery(f).click(function(d){d.preventDefault()}).focus(function(d){d.preventDefault()});g.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButtonOver")};g.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"monthBackwardButton")};g.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButtonDown")};g.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.MONTH_BCK);d.setC(this,"monthBackwardButton");d.moveBackOneMonth()};b.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButtonOver")};b.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"yearForwardButton")};b.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButtonDown")};b.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_FWD);d.setC(this,"yearForwardButton");d.moveForwardOneYear()};a.onmouseover=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButtonOver")};a.onmouseout=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText("");d.setC(this,"yearBackwardButton")};a.onmousedown=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButtonDown")};a.onmouseup=function(){var i,d;if(parseInt(this.getAttribute("isJsDatePickDisabled"))==1){return}i=this.parentNode;while(i.className!="controlsBar"){i=i.parentNode}d=JsDatePick.getCalInstanceById(this.getAttribute("globalNumber"));d.setTooltipText(g_l10n.YEAR_BCK);d.setC(this,"yearBackwardButton");d.moveBackOneYear()};return c};
|
languages/contact-form-7-datepicker-it_IT.mo
CHANGED
Binary file
|
languages/contact-form-7-datepicker-it_IT.po
CHANGED
@@ -180,7 +180,7 @@ msgid "Save Setting"
|
|
180 |
msgstr "Salva Impostazioni"
|
181 |
|
182 |
#: ../contact-form-7-datepicker.php:650
|
183 |
-
msgid "
|
184 |
msgstr "Gennaio"
|
185 |
|
186 |
#: ../contact-form-7-datepicker.php:651
|
180 |
msgstr "Salva Impostazioni"
|
181 |
|
182 |
#: ../contact-form-7-datepicker.php:650
|
183 |
+
msgid "January"
|
184 |
msgstr "Gennaio"
|
185 |
|
186 |
#: ../contact-form-7-datepicker.php:651
|
languages/contact-form-7-datepicker-nl_NL.mo
CHANGED
Binary file
|
languages/contact-form-7-datepicker-ro_RO.mo
CHANGED
Binary file
|
languages/contact-form-7-datepicker-ro_RO.po
CHANGED
@@ -187,7 +187,7 @@ msgid "Save Setting"
|
|
187 |
msgstr "Salvează setări"
|
188 |
|
189 |
#: ../contact-form-7-datepicker.php:753
|
190 |
-
msgid "
|
191 |
msgstr "Ianuarie"
|
192 |
|
193 |
#: ../contact-form-7-datepicker.php:754
|
187 |
msgstr "Salvează setări"
|
188 |
|
189 |
#: ../contact-form-7-datepicker.php:753
|
190 |
+
msgid "January"
|
191 |
msgstr "Ianuarie"
|
192 |
|
193 |
#: ../contact-form-7-datepicker.php:754
|
languages/contact-form-7-datepicker.pot
CHANGED
@@ -170,7 +170,7 @@ msgid "Save Setting"
|
|
170 |
msgstr ""
|
171 |
|
172 |
#: ../contact-form-7-datepicker.php:753
|
173 |
-
msgid "
|
174 |
msgstr ""
|
175 |
|
176 |
#: ../contact-form-7-datepicker.php:754
|
170 |
msgstr ""
|
171 |
|
172 |
#: ../contact-form-7-datepicker.php:753
|
173 |
+
msgid "January"
|
174 |
msgstr ""
|
175 |
|
176 |
#: ../contact-form-7-datepicker.php:754
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: shockware
|
|
3 |
Donate link:
|
4 |
Tags: wordpress, datepicker, calendar, contact form 7, forms
|
5 |
Requires at least: WordPress 2.9
|
6 |
-
Tested up to: WordPress 3.
|
7 |
-
Stable tag: 0.7.
|
8 |
|
9 |
Datepicker for Contact Form 7 Wordpress Plugin based on jsDatePick script.
|
10 |
|
@@ -59,6 +59,14 @@ You can contact me anywhere and I'll add them to the project :)
|
|
59 |
|
60 |
== Changelog ==
|
61 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
62 |
= 0.7.2 =
|
63 |
* Bugfix:
|
64 |
- fixed field value not showing up in email message when field values contain hyphens and other non-alphanumeric chars
|
3 |
Donate link:
|
4 |
Tags: wordpress, datepicker, calendar, contact form 7, forms
|
5 |
Requires at least: WordPress 2.9
|
6 |
+
Tested up to: WordPress 3.3.1
|
7 |
+
Stable tag: 0.7.4
|
8 |
|
9 |
Datepicker for Contact Form 7 Wordpress Plugin based on jsDatePick script.
|
10 |
|
59 |
|
60 |
== Changelog ==
|
61 |
|
62 |
+
= 0.7.4 =
|
63 |
+
* Bugfix:
|
64 |
+
- datepicker shortcode works now if contact form 7 is not installed
|
65 |
+
|
66 |
+
= 0.7.3 =
|
67 |
+
* Bugfix:
|
68 |
+
- fixed Janaury typo
|
69 |
+
|
70 |
= 0.7.2 =
|
71 |
* Bugfix:
|
72 |
- fixed field value not showing up in email message when field values contain hyphens and other non-alphanumeric chars
|