Version Description
- Fixed : Added Iranian National Code field
- See Screenshots 16-19
Download this release
Release Info
Developer | hannanstd |
Plugin | گرویتی فرم فارسی |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- Persian_Gravityforms_By_HANNANStd.php +406 -27
- assets/css/persiangravity.css +7 -1
- assets/js/Datepicker.js +191 -0
- assets/js/Datepicker_J_G.js +203 -0
- include/Jalali.php +599 -0
- languages/Persian_Gravityforms_By_HANNANStd-fa_IR.mo +0 -0
- languages/gravityforms/fa_IR.mo +0 -0
- languages/gravityformsauthorizenet/fa_IR.mo +0 -0
- languages/gravityformsaweber/fa_IR.mo +0 -0
- languages/gravityformscoupons/fa_IR.mo +0 -0
- languages/gravityformsmailchimp/fa_IR.mo +0 -0
- languages/gravityformspaypal/fa_IR.mo +0 -0
- languages/gravityformspaypalpaymentspro/fa_IR.mo +0 -0
- languages/gravityformspaypalpro/fa_IR.mo +0 -0
- languages/gravityformspolls/fa_IR.mo +0 -0
- languages/gravityformsquiz/fa_IR.mo +0 -0
- languages/gravityformsstripe/fa_IR.mo +0 -0
- languages/gravityformssurvey/fa_IR.mo +0 -0
- languages/gravityformsuserregistration/fa_IR.mo +0 -0
- languages/gravityformszapier/fa_IR.mo +0 -0
- readme.txt +21 -1
Persian_Gravityforms_By_HANNANStd.php
CHANGED
@@ -1,12 +1,12 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Persian Gravity Forms
|
4 |
-
Plugin URI:
|
5 |
Description: Gravity Forms for Iranian
|
6 |
-
Version: 1.
|
7 |
-
Requires at least: 3.
|
8 |
Author: HANNAN Ebrahimi Setoode
|
9 |
-
Author URI: http://www.
|
10 |
Text Domain: Persian_Gravityforms_By_HANNANStd
|
11 |
Domain Path: /languages/
|
12 |
License: GPL 2
|
@@ -31,8 +31,20 @@ class GravityFormsPersian {
|
|
31 |
add_action('wp_dashboard_setup', array( $this, 'Persian_GravityForms_Dashboard_By_HANNANStd'));
|
32 |
add_filter('gform_print_styles', array( $this, 'Add_Styles_Print_By_HANNANStd'), 10, 2);
|
33 |
add_action('admin_print_scripts', array( $this, 'GravityForms_Admin_CSS_By_HANNANStd' ));
|
34 |
-
add_filter('gform_predefined_choices', array( $this, 'Add_Iran_Predefined_Choice_By_HANNANStd' ),1);
|
35 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
public function Activated_Plugin_By_HANNANStd() {
|
37 |
$path = str_replace( WP_PLUGIN_DIR . '/', '', $this->file );
|
38 |
if ( $plugins = get_option( 'active_plugins' ) ) {
|
@@ -50,7 +62,7 @@ class GravityFormsPersian {
|
|
50 |
}
|
51 |
}
|
52 |
}
|
53 |
-
public function init()
|
54 |
$rel_path = dirname( plugin_basename( $this->file ) ) . '/languages/';
|
55 |
if ( $this->language == null ) {
|
56 |
$this->language = get_option( 'WPLANG', WPLANG );
|
@@ -62,6 +74,10 @@ class GravityFormsPersian {
|
|
62 |
load_plugin_textdomain( 'Persian_Gravityforms_By_HANNANStd', false, $rel_path );
|
63 |
load_plugin_textdomain( 'gravityformsuserregistration', false, $rel_path );
|
64 |
}
|
|
|
|
|
|
|
|
|
65 |
public function Load_Textdomain_Mo_File_By_HANNANStd( $mo_file, $domain ) {
|
66 |
if ( strpos( $mo_file, 'fa_IR.mo' ) !== false ) {
|
67 |
$domains = array(
|
@@ -134,7 +150,71 @@ class GravityFormsPersian {
|
|
134 |
}
|
135 |
return $mo_file;
|
136 |
}
|
137 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
public function GravityForms_Footer_Left_By_HANNANStd($text) {
|
139 |
$text = sprintf(__("%sGravity Forms%s for WordPress is a full featured contact form plugin .", "Persian_Gravityforms_By_HANNANStd"), '<a href="http://gravityforms.ir" target="_blank">', "</a>");return $text;
|
140 |
}
|
@@ -246,7 +326,7 @@ class GravityFormsPersian {
|
|
246 |
$payment_status = __("Failed", "Persian_Gravityforms_By_HANNANStd");
|
247 |
if ($lead['payment_status']=="Cancelled")
|
248 |
$payment_status = __("Cancelled", "Persian_Gravityforms_By_HANNANStd");
|
249 |
-
$tags = array
|
250 |
'{payment_gateway}',
|
251 |
'{transaction_id}',
|
252 |
'{payment_status}',
|
@@ -360,27 +440,32 @@ class GravityFormsPersian {
|
|
360 |
$text = str_replace($tags, $values, $text);
|
361 |
return $text;
|
362 |
}
|
363 |
-
|
364 |
-
|
|
|
365 |
return array('print_entry');
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
|
|
|
|
|
|
|
|
379 |
if ( !current_user_can('manage_options') )
|
380 |
return;
|
381 |
global $wp_meta_boxes;
|
382 |
wp_add_dashboard_widget('persiangf_wd_hannanstd', __( 'Persian Gravity Forms Dashboard', 'Persian_Gravityforms_By_HANNANStd' ) , array( $this, 'Persian_GravityForms_Widget_By_HANNANStd'));
|
383 |
-
|
384 |
public static function Persian_GravityForms_Widget_By_HANNANStd() {
|
385 |
global $_wp_admin_css_colors;
|
386 |
$current_color = get_user_option( 'admin_color' );
|
@@ -395,13 +480,13 @@ class GravityFormsPersian {
|
|
395 |
?>
|
396 |
<style>
|
397 |
#persiangf_wd_hannanstd h3{font-family:byekan !important;background:<?php echo $colors[1] ?> !important;color:#fff !important;}
|
398 |
-
|
399 |
#persiangf_wd_hannanstd .a1{font-family:byekan !important;}
|
400 |
#persiangf_wd_hannanstd .a2{font-family:byekan !important;font-size:12px !important;}
|
401 |
</style>
|
402 |
<?php
|
403 |
}
|
404 |
-
$rss = fetch_feed( "http://gravityforms.ir/
|
405 |
if ( is_wp_error($rss) ) {
|
406 |
if ( is_admin() || current_user_can('manage_options') ) {
|
407 |
printf(__('<strong>RSS Error</strong>', 'Persian_Gravityforms_By_HANNANStd'));
|
@@ -440,6 +525,300 @@ echo "</ul>";
|
|
440 |
$rss->__destruct();
|
441 |
unset($rss);
|
442 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
443 |
}
|
444 |
global $Persian_Gravityforms_By_HANNANStd_plugin;
|
445 |
$Persian_Gravityforms_By_HANNANStd_plugin = new GravityFormsPersian( __FILE__ );
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Persian Gravity Forms
|
4 |
+
Plugin URI: https://wordpress.org/plugins/persian-gravity-forms/
|
5 |
Description: Gravity Forms for Iranian
|
6 |
+
Version: 1.1.0
|
7 |
+
Requires at least: 3.5
|
8 |
Author: HANNAN Ebrahimi Setoode
|
9 |
+
Author URI: http://www.gravityforms.ir/
|
10 |
Text Domain: Persian_Gravityforms_By_HANNANStd
|
11 |
Domain Path: /languages/
|
12 |
License: GPL 2
|
31 |
add_action('wp_dashboard_setup', array( $this, 'Persian_GravityForms_Dashboard_By_HANNANStd'));
|
32 |
add_filter('gform_print_styles', array( $this, 'Add_Styles_Print_By_HANNANStd'), 10, 2);
|
33 |
add_action('admin_print_scripts', array( $this, 'GravityForms_Admin_CSS_By_HANNANStd' ));
|
34 |
+
add_filter('gform_predefined_choices', array( $this, 'Add_Iran_Predefined_Choice_By_HANNANStd' ),1);
|
35 |
+
add_action('gform_field_standard_settings', array( $this, 'Add_Jalali_Active_Standard_Settings'), 10, 2);
|
36 |
+
add_action('gform_editor_js', array( $this, 'Editor_Script_By_HANNANStd'));
|
37 |
+
add_filter('gform_tooltips', array( $this, 'Add_Encryption_tooltips_By_HANNANStd'));
|
38 |
+
add_action('gform_enqueue_scripts', array( $this, 'Add_Jalali_Front_End_On_Off_Switch_By_HANNANStd'), 10 , 2 );
|
39 |
+
add_filter('gform_add_field_buttons', array( $this, 'Add_Melli_Cart_Field_By_HANNANStd'));
|
40 |
+
add_filter('gform_field_type_title', array( $this,'Add_Melli_Cart_Field_Title_By_HANNANStd'));
|
41 |
+
add_action('gform_field_input', array( $this,'Add_Melli_Cart_Field_Input_By_HANNANStd'), 10, 5);
|
42 |
+
add_action('gform_field_css_class', array( $this, 'Add_Melli_Cart_Field_Class_By_HANNANStd'), 10, 3);
|
43 |
+
add_filter('gform_editor_js_set_default_values', array( $this, 'Add_Melli_Cart_Field_Label_By_HANNANStd'));
|
44 |
+
add_filter('gform_field_content', array( $this, 'Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd'), 10, 5);
|
45 |
+
add_action('gform_field_advanced_settings', array( $this, 'Add_Melli_Cart_Field_Setting_By_HANNANStd'), 10, 2);
|
46 |
+
add_filter('gform_field_validation', array( $this, 'Add_Melli_Cart_Field_PHP_Checker_Massage_By_HANNANStd'), 10, 4);
|
47 |
+
}
|
48 |
public function Activated_Plugin_By_HANNANStd() {
|
49 |
$path = str_replace( WP_PLUGIN_DIR . '/', '', $this->file );
|
50 |
if ( $plugins = get_option( 'active_plugins' ) ) {
|
62 |
}
|
63 |
}
|
64 |
}
|
65 |
+
public function init(){
|
66 |
$rel_path = dirname( plugin_basename( $this->file ) ) . '/languages/';
|
67 |
if ( $this->language == null ) {
|
68 |
$this->language = get_option( 'WPLANG', WPLANG );
|
74 |
load_plugin_textdomain( 'Persian_Gravityforms_By_HANNANStd', false, $rel_path );
|
75 |
load_plugin_textdomain( 'gravityformsuserregistration', false, $rel_path );
|
76 |
}
|
77 |
+
protected static function get_base_path(){
|
78 |
+
$folder = basename(dirname(__FILE__));
|
79 |
+
return WP_PLUGIN_DIR . "/" . $folder;
|
80 |
+
}
|
81 |
public function Load_Textdomain_Mo_File_By_HANNANStd( $mo_file, $domain ) {
|
82 |
if ( strpos( $mo_file, 'fa_IR.mo' ) !== false ) {
|
83 |
$domains = array(
|
150 |
}
|
151 |
return $mo_file;
|
152 |
}
|
153 |
+
public function Add_Jalali_Active_Standard_Settings($position, $form_id){
|
154 |
+
if($position == 25){
|
155 |
+
?>
|
156 |
+
<li class="Jalali_setting field_setting">
|
157 |
+
<input type="checkbox" id="check_jalali" onclick="SetFieldProperty('check_jalali', jQuery(this).is(':checked') ? 1 : 0);"/>
|
158 |
+
<label class="inline gfield_value_label" for="field_admin_label">
|
159 |
+
<?php _e( 'Yes', 'Persian_Gravityforms_By_HANNANStd' ); ?>
|
160 |
+
<?php gform_tooltip("form_check_jalali") ?>
|
161 |
+
</label>
|
162 |
+
</li>
|
163 |
+
<?php
|
164 |
+
}
|
165 |
+
}
|
166 |
+
public function Editor_Script_By_HANNANStd(){
|
167 |
+
?>
|
168 |
+
<script type='text/javascript'>
|
169 |
+
fieldSettings["date"] += ", .Jalali_setting";
|
170 |
+
fieldSettings["mellicart"] = ".conditional_logic_field_setting, .label_setting, .admin_label_setting, .size_setting, .rules_setting, .visibility_setting, .duplicate_setting, .default_value_setting, .description_setting, .css_class_setting, .mellicart_setting";
|
171 |
+
jQuery(document).bind("gform_load_field_settings", function(event, field, form){
|
172 |
+
jQuery("#check_jalali").attr("checked", field["check_jalali"] == true);
|
173 |
+
jQuery("#field_mellicart").attr("checked", field["field_mellicart"] == true);
|
174 |
+
jQuery("#field_mellicart_sp").attr("checked", field["field_mellicart_sp"] == true);
|
175 |
+
jQuery("#field_mellicart_sp1").val(field["field_mellicart_sp1"]);
|
176 |
+
jQuery("#field_mellicart_sp2").val(field["field_mellicart_sp2"]);
|
177 |
+
jQuery("#field_mellicart_sp3").val(field["field_mellicart_sp3"]);
|
178 |
+
jQuery("#field_mellicart_sp4").val(field["field_mellicart_sp4"]);
|
179 |
+
});
|
180 |
+
</script>
|
181 |
+
<?php
|
182 |
+
}
|
183 |
+
public function Add_Encryption_tooltips_By_HANNANStd($tooltips){
|
184 |
+
$tooltips["form_check_jalali"] = "<h6>فعالسازی تاریخ شمسی</h6>در صورتی که از چند فیلد تاریخ استفاده میکنید ، فعالسازی تاریخ شمسی یکی از فیلدها کفایت میکند .<br/>تذکر : با توجه به آزمایشی بودن این قسمت ممکن است تداخل توابع سبب ناسازگاری با برخی قالب ها شود.";
|
185 |
+
$tooltips["form_field_mellicart"] = "<h6>نمایش لحظه ای شهر از روی کد ملی </h6>نمایش شهر و پیغام زیر فیلد کد ملی بعد از پر شدن فیلد . تذکر : در صورتی که این گزینه را فعال نمایید ،ممکن است فراخوانی شهر های ایران با توجه به کسرت آنها سبب سنگین شدن صفحه گردد.";
|
186 |
+
$tooltips["form_field_mellicart_sp"] = "<h6>جدا سازی ارقام</h6>در صورتی که این گزینه را فعال نمایید ، پس از پر شدن فیلد ، <strong>در صورتی که کد ملی وارد شده صحیح تشخصی داده شود</strong> ؛ کد ملی به صورت زیر در خواهد آمد :<br/>xxx-xxxxxx-x";
|
187 |
+
$tooltips["form_field_mellicart_header"] = "<h6>پیغام خطا</h6>در صورتی که کاربر فیلد کد ملی را به صورت صحیح وارد نکند ؛ پیغام خطا را مشاهده میکند که میتوانید این پیغام ها را مدیریت نمایید . در صورتی که مقادیر زیر را خالی بگذارید پیغام پیشفرض نمایش داده خواهد شد.";
|
188 |
+
$tooltips["form_field_mellicart_sp1"] = "<h6>پیغام پیشفرض</h6>با توجه به اینکه کد ملی فقط باید به صورت عدد باشد ، در صورتی که کاراکتری غیر از عدد وارد شده باشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی فقط باید به صورت عدد وارد شود . ";
|
189 |
+
$tooltips["form_field_mellicart_sp2"] = "<h6>پیغام پیشفرض</h6>با توجه به اینکه کد ملی می بایست 10 رقمی باشد اگر تعداد رقم وارد شده ، اشتباه باشد پیغام خطا نمایش داده خواهد شد .<br>پیغام پیشفرض : کد ملی می بایست 10 رقمی باشد . تنها در صورتی مجاز به استفاده از کد های 8 یا 9 رقمی هستید که ارقام سمت چپ 0 باشند . ";
|
190 |
+
$tooltips["form_field_mellicart_sp3"] = "<h6>پیغام پیشفرض</h6>در صورتی که از تب وِیژگی تیک گزینه بدون تکرار را زده باشید ؛ بعد از پر شدن فرم و زدن دکمه ارسال پیغامی مبتنی بر تکراری بودن کد ملی نمایش داده خواهد شد . <br/>پیغام پیشفرض : این کد ملی توسط فرد دیگری ثبت شده است .";
|
191 |
+
$tooltips["form_field_mellicart_sp4"] = "<h6>پیغام پیشفرض</h6>در صورتی که کد ملی وارد شده مطابق با الگوریتم کشور نباشد پیغام خطا نمایش داده خواهد شد .<br/>پیغام پیشفرض : کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .";
|
192 |
+
return $tooltips;
|
193 |
+
}
|
194 |
+
function Add_Jalali_Front_End_On_Off_Switch_By_HANNANStd( $form, $ajax ) {
|
195 |
+
foreach ( $form['fields'] as $field ) {
|
196 |
+
if ( ( $field['type'] == 'date' ) ) {
|
197 |
+
if(rgget("check_jalali", $field)){
|
198 |
+
add_filter('gform_date_min_year', array( $this, 'Set_Min_Year_By_HANNANStd' ) );
|
199 |
+
add_filter('gform_date_max_year', array( $this, 'Set_Max_Year_By_HANNANStd' ) );
|
200 |
+
if (!IS_ADMIN)
|
201 |
+
{
|
202 |
+
wp_deregister_script('gform_datepicker_init');
|
203 |
+
wp_deregister_script('jquery-ui-datepicker');
|
204 |
+
wp_register_script('gform_datepicker_init',plugins_url ( '/assets/js/Datepicker.js', __FILE__), array( 'jquery', 'jquery-ui-core' ), GFCommon::$version, true );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
}
|
208 |
+
}
|
209 |
+
}
|
210 |
+
public function Set_Min_Year_By_HANNANStd($min_year){
|
211 |
+
$min_year = GF_gregorian_to_jalali($min_year,03,21);
|
212 |
+
return $min_year[0]+1;
|
213 |
+
}
|
214 |
+
public function Set_Max_Year_By_HANNANStd($max_year){
|
215 |
+
$max_year = GF_gregorian_to_jalali($max_year,03,21);
|
216 |
+
return $max_year[0]+10;
|
217 |
+
}
|
218 |
public function GravityForms_Footer_Left_By_HANNANStd($text) {
|
219 |
$text = sprintf(__("%sGravity Forms%s for WordPress is a full featured contact form plugin .", "Persian_Gravityforms_By_HANNANStd"), '<a href="http://gravityforms.ir" target="_blank">', "</a>");return $text;
|
220 |
}
|
326 |
$payment_status = __("Failed", "Persian_Gravityforms_By_HANNANStd");
|
327 |
if ($lead['payment_status']=="Cancelled")
|
328 |
$payment_status = __("Cancelled", "Persian_Gravityforms_By_HANNANStd");
|
329 |
+
$tags = array(
|
330 |
'{payment_gateway}',
|
331 |
'{transaction_id}',
|
332 |
'{payment_status}',
|
440 |
$text = str_replace($tags, $values, $text);
|
441 |
return $text;
|
442 |
}
|
443 |
+
public function Add_Styles_Print_By_HANNANStd($value, $form){
|
444 |
+
if( is_rtl() ) {
|
445 |
+
wp_register_style('print_entry', plugins_url ( '/assets/css/printer.css', __FILE__, true ) );
|
446 |
return array('print_entry');
|
447 |
+
}
|
448 |
+
}
|
449 |
+
public function GravityForms_Admin_CSS_By_HANNANStd() {
|
450 |
+
if(!class_exists('GFForms')){
|
451 |
+
return;
|
452 |
+
}
|
453 |
+
$current_page = trim(strtolower(RGForms::get("page")));
|
454 |
+
$page_prefix = explode("_", $current_page);
|
455 |
+
if (is_rtl() && ($page_prefix[0]=="gf" || $_SERVER['REQUEST_URI'] == '/wp-admin/' || $_SERVER['REQUEST_URI'] == '/wp-admin' || $_SERVER['REQUEST_URI'] == '/wp-admin/index.php' || $_SERVER['REQUEST_URI'] == '/wp-admin/index.php/')) {
|
456 |
+
wp_enqueue_style('Persian_GravityForms', plugins_url ( '/assets/css/persiangravity.css', __FILE__, null, GFCommon::$version ) );
|
457 |
+
wp_print_styles('gform_tooltip','Persian_GravityForms' );
|
458 |
+
wp_deregister_script('gform_datepicker_init');
|
459 |
+
wp_dequeue_script('jquery-ui-datepicker');
|
460 |
+
wp_enqueue_script('gform_datepicker_init', plugins_url ( '/assets/js/Datepicker_J_G.js', __FILE__), array( 'jquery', 'jquery-ui-core' ), GFCommon::$version, true );
|
461 |
+
}
|
462 |
+
}
|
463 |
+
public function Persian_GravityForms_Dashboard_By_HANNANStd() {
|
464 |
if ( !current_user_can('manage_options') )
|
465 |
return;
|
466 |
global $wp_meta_boxes;
|
467 |
wp_add_dashboard_widget('persiangf_wd_hannanstd', __( 'Persian Gravity Forms Dashboard', 'Persian_Gravityforms_By_HANNANStd' ) , array( $this, 'Persian_GravityForms_Widget_By_HANNANStd'));
|
468 |
+
}
|
469 |
public static function Persian_GravityForms_Widget_By_HANNANStd() {
|
470 |
global $_wp_admin_css_colors;
|
471 |
$current_color = get_user_option( 'admin_color' );
|
480 |
?>
|
481 |
<style>
|
482 |
#persiangf_wd_hannanstd h3{font-family:byekan !important;background:<?php echo $colors[1] ?> !important;color:#fff !important;}
|
483 |
+
#persiangf_wd_hannanstd .handlediv{color:#fff !important;}
|
484 |
#persiangf_wd_hannanstd .a1{font-family:byekan !important;}
|
485 |
#persiangf_wd_hannanstd .a2{font-family:byekan !important;font-size:12px !important;}
|
486 |
</style>
|
487 |
<?php
|
488 |
}
|
489 |
+
$rss = fetch_feed( "http://gravityforms.ir/feed/" );
|
490 |
if ( is_wp_error($rss) ) {
|
491 |
if ( is_admin() || current_user_can('manage_options') ) {
|
492 |
printf(__('<strong>RSS Error</strong>', 'Persian_Gravityforms_By_HANNANStd'));
|
525 |
$rss->__destruct();
|
526 |
unset($rss);
|
527 |
}
|
528 |
+
public function Add_Melli_Cart_Field_By_HANNANStd( $field_groups ) {
|
529 |
+
foreach( $field_groups as &$group ){
|
530 |
+
if( $group["name"] == "advanced_fields" ){
|
531 |
+
$group["fields"][] = array(
|
532 |
+
"class"=>"button",
|
533 |
+
"value" => "کد ملی",
|
534 |
+
"onclick" => "StartAddField('mellicart');"
|
535 |
+
);
|
536 |
+
break;
|
537 |
+
}
|
538 |
+
}
|
539 |
+
return $field_groups;
|
540 |
+
}
|
541 |
+
public function Add_Melli_Cart_Field_Title_By_HANNANStd($type) {
|
542 |
+
if ($type == 'mellicart') {
|
543 |
+
return 'کد ملی';
|
544 |
+
}
|
545 |
+
}
|
546 |
+
public function Add_Melli_Cart_Field_Label_By_HANNANStd(){
|
547 |
+
?>
|
548 |
+
case "mellicart" :
|
549 |
+
field.label = 'کد ملی';
|
550 |
+
break;
|
551 |
+
<?php
|
552 |
+
}
|
553 |
+
public function Add_Melli_Cart_Field_Input_By_HANNANStd($input, $field, $value, $lead_id, $form_id ){
|
554 |
+
if ( $field["type"] == "mellicart" ) {
|
555 |
+
$id = $field["id"];
|
556 |
+
$field_id = IS_ADMIN || $form_id == 0 ? "input_$id" : "input_" . $form_id . "_$id";
|
557 |
+
$form_id = IS_ADMIN && empty($form_id) ? rgget("id") : $form_id;
|
558 |
+
$size = rgar($field, "size");
|
559 |
+
$disabled_text = (IS_ADMIN && RG_CURRENT_VIEW != "entry") ? "disabled='disabled'" : "";
|
560 |
+
$class_suffix = RG_CURRENT_VIEW == "entry" ? "_admin" : "";
|
561 |
+
$class = $size . $class_suffix;
|
562 |
+
$currency = "";
|
563 |
+
if(RG_CURRENT_VIEW == "entry"){
|
564 |
+
$lead = RGFormsModel::get_lead($lead_id);
|
565 |
+
$post_id = $lead["post_id"];
|
566 |
+
$post_link = "";
|
567 |
+
if(is_numeric($post_id) && GFCommon::is_post_field($field)){
|
568 |
+
$post_link = "You can <a href='post.php?action=edit&post=$post_id'>edit this post</a> from the post page.";}
|
569 |
+
$currency = $lead["currency"];}
|
570 |
+
$max_length = "";
|
571 |
+
$html5_attributes = "";
|
572 |
+
if(empty($html_input_type))
|
573 |
+
$html_input_type = "text";
|
574 |
+
$max_length = "maxlength=10";
|
575 |
+
$tabindex = GFCommon::get_tabindex();
|
576 |
+
return sprintf("<div class='ginput_container'><input onblur='MelliCard_Checker_Javascript_By_HANNANStd_%d(this);' name='input_%d' id='%s' type='%s' value='%s' class='melli_cart %s' $max_length $tabindex $html5_attributes %s/></div><p class='city mellicart' id='city_%d'></p>", $id, $id, $field_id, $html_input_type, esc_attr($value), esc_attr($class), $disabled_text, $id);
|
577 |
+
}
|
578 |
+
return $input;
|
579 |
+
}
|
580 |
+
public function Add_Melli_Cart_Field_Setting_By_HANNANStd( $position, $form_id ){
|
581 |
+
if( $position == 50 ){
|
582 |
+
?>
|
583 |
+
<hr/>
|
584 |
+
<li class="mellicart_setting field_setting">
|
585 |
+
<input type="checkbox" id="field_mellicart" onclick="SetFieldProperty('field_mellicart', this.checked);" />
|
586 |
+
<label for="field_mellicart" class="inline">
|
587 |
+
<?php _e("نمایش زیر نویس فیلد", "gravityforms"); ?>
|
588 |
+
<?php gform_tooltip("form_field_mellicart"); ?>
|
589 |
+
</label>
|
590 |
+
<br/>
|
591 |
+
<input type="checkbox" id="field_mellicart_sp" onclick="SetFieldProperty('field_mellicart_sp', this.checked);" />
|
592 |
+
<label for="field_mellicart_sp" class="inline">
|
593 |
+
<?php _e("جدا سازی خودکار ارقام توسط خط فاصله", "gravityforms"); ?>
|
594 |
+
<?php gform_tooltip("form_field_mellicart_sp"); ?>
|
595 |
+
</label>
|
596 |
+
<br/>
|
597 |
+
<hr/>
|
598 |
+
<label class="inline">متن پیغام خطا هنگامی که موارد زیر رخ دهد
|
599 |
+
<?php gform_tooltip("form_field_mellicart_header"); ?>
|
600 |
+
</label>
|
601 |
+
<br/>
|
602 |
+
<br/>
|
603 |
+
<label for="field_mellicart_sp1" class="inline">
|
604 |
+
<?php _e("مقدار وارد شده شامل کاراکتر غیر عددی باشد", "gravityforms"); ?>
|
605 |
+
<?php gform_tooltip("form_field_mellicart_sp1"); ?>
|
606 |
+
</label>
|
607 |
+
<br/>
|
608 |
+
<input type="text" id="field_mellicart_sp1" size="35" onkeyup="SetFieldProperty('field_mellicart_sp1', this.value);" />
|
609 |
+
<br/>
|
610 |
+
<label for="field_mellicart_sp2" class="inline">
|
611 |
+
<?php _e("تعداد ارقام وارد شده استاندارد نباشد", "gravityforms"); ?>
|
612 |
+
<?php gform_tooltip("form_field_mellicart_sp2"); ?>
|
613 |
+
</label>
|
614 |
+
<br/>
|
615 |
+
<input type="text" id="field_mellicart_sp2" size="35" onkeyup="SetFieldProperty('field_mellicart_sp2', this.value);" />
|
616 |
+
<br/>
|
617 |
+
<label for="field_mellicart_sp3" class="inline">
|
618 |
+
<?php _e("کد ملی وارد شده قبلا ثبت شده باشد", "gravityforms"); ?>
|
619 |
+
<?php gform_tooltip("form_field_mellicart_sp3"); ?>
|
620 |
+
</label>
|
621 |
+
<br/>
|
622 |
+
<input type="text" id="field_mellicart_sp3" size="35" onkeyup="SetFieldProperty('field_mellicart_sp3', this.value);" />
|
623 |
+
<br/>
|
624 |
+
<label for="field_mellicart_sp4" class="inline">
|
625 |
+
<?php _e("کد ملی وارد شده مطابق با الگوی ملی نباشد", "gravityforms"); ?>
|
626 |
+
<?php gform_tooltip("form_field_mellicart_sp4"); ?>
|
627 |
+
</label>
|
628 |
+
<br/>
|
629 |
+
<input type="text" id="field_mellicart_sp4" size="35" onkeyup="SetFieldProperty('field_mellicart_sp4', this.value);" />
|
630 |
+
</li>
|
631 |
+
<hr/>
|
632 |
+
<?php
|
633 |
+
}
|
634 |
+
}
|
635 |
+
public function Add_Melli_Cart_Field_Class_By_HANNANStd($classes, $field, $form){
|
636 |
+
if( $field["type"] == "mellicart" ){
|
637 |
+
$classes .= " gform_mellicart";
|
638 |
+
}
|
639 |
+
return $classes;
|
640 |
+
}
|
641 |
+
public function Add_Melli_Cart_PHP_Checker_By_HANNANStd($meli_code='',$setting){
|
642 |
+
if (!empty($meli_code)) {
|
643 |
+
if ($setting == 1) {
|
644 |
+
$meli_code = str_replace('-','',$meli_code);
|
645 |
+
}
|
646 |
+
if($meli_code == '1111111111' ||
|
647 |
+
$meli_code == '0000000000' ||
|
648 |
+
$meli_code == '2222222222' ||
|
649 |
+
$meli_code == '3333333333' ||
|
650 |
+
$meli_code == '4444444444' ||
|
651 |
+
$meli_code == '5555555555' ||
|
652 |
+
$meli_code == '6666666666' ||
|
653 |
+
$meli_code == '7777777777' ||
|
654 |
+
$meli_code == '8888888888' ||
|
655 |
+
$meli_code == '9999999999') {
|
656 |
+
return 2;}
|
657 |
+
if(!is_numeric($meli_code))
|
658 |
+
return 4;
|
659 |
+
$meli_code = (string) preg_replace('/[^0-9]/','',$meli_code);
|
660 |
+
if(strlen($meli_code)>10 or strlen($meli_code)<8)
|
661 |
+
return 3;
|
662 |
+
if(strlen($meli_code)==8)
|
663 |
+
$meli_code = "00".$meli_code;
|
664 |
+
if(strlen($meli_code)==9)
|
665 |
+
$meli_code = "0".$meli_code;
|
666 |
+
$list_code = str_split($meli_code);
|
667 |
+
$last = (int) $list_code[9];
|
668 |
+
unset($list_code[9]);
|
669 |
+
$i = 10;
|
670 |
+
$sum = 0;
|
671 |
+
foreach($list_code as $key=>$_)
|
672 |
+
{$sum += intval($_) * $i;$i--;}
|
673 |
+
$mod =(int) $sum % 11;
|
674 |
+
if($mod >= 2)
|
675 |
+
$mod = 11 - $mod;
|
676 |
+
if ($mod != $last)
|
677 |
+
return 2;
|
678 |
+
else
|
679 |
+
return 1;
|
680 |
+
}
|
681 |
+
return;
|
682 |
+
}
|
683 |
+
public function Add_Melli_Cart_Field_JavaScript_Checker_By_HANNANStd($content, $field, $value, $lead_id, $form_id){
|
684 |
+
if ( $field["type"] == "mellicart" && (rgget("field_mellicart", $field) || rgget("field_mellicart_sp", $field) ) && !IS_ADMIN ) {
|
685 |
+
$pm1= rgget("field_mellicart_sp1", $field);
|
686 |
+
$pm2= rgget("field_mellicart_sp2", $field);
|
687 |
+
$pm3= rgget("field_mellicart_sp4", $field);
|
688 |
+
?>
|
689 |
+
<script>
|
690 |
+
function MelliCard_Checker_Javascript_By_HANNANStd_<?php echo $field["id"]; ?>(meli_code) {
|
691 |
+
if (meli_code.value == '') {
|
692 |
+
return false;
|
693 |
+
}
|
694 |
+
<?php if(rgget("field_mellicart_sp", $field)) { ?>
|
695 |
+
meli_code.value = meli_code.value.replace("-", "").replace("-", "");
|
696 |
+
<?php }
|
697 |
+
if(rgget("field_mellicart", $field)) {?>
|
698 |
+
if (isNaN(meli_code.value)) {
|
699 |
+
<?php if ($pm1) { ?>
|
700 |
+
var pm1 = "<?php echo $pm1 ?>";
|
701 |
+
<?php } else { ?>
|
702 |
+
var pm1 = "کد ملی فقط باید به صورت عدد وارد شود . ";
|
703 |
+
<?php } ?>
|
704 |
+
document.getElementById("city_<?php echo $field["id"]; ?>").innerHTML = pm1;
|
705 |
+
return false;
|
706 |
+
}
|
707 |
+
if (meli_code.value == '0000000000' ||
|
708 |
+
meli_code.value == '1111111111' ||
|
709 |
+
meli_code.value == '2222222222' ||
|
710 |
+
meli_code.value == '3333333333' ||
|
711 |
+
meli_code.value == '4444444444' ||
|
712 |
+
meli_code.value == '5555555555' ||
|
713 |
+
meli_code.value == '6666666666' ||
|
714 |
+
meli_code.value == '7777777777' ||
|
715 |
+
meli_code.value == '8888888888' ||
|
716 |
+
meli_code.value == '9999999999') {
|
717 |
+
<?php if ($pm3) { ?>
|
718 |
+
var pm3 = "<?php echo $pm3 ?>";
|
719 |
+
<?php } else { ?>
|
720 |
+
var pm3 = 'کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .';
|
721 |
+
<?php } ?>
|
722 |
+
document.getElementById("city_<?php echo $field["id"]; ?>").innerHTML = pm3;
|
723 |
+
return false;
|
724 |
+
}
|
725 |
+
if (meli_code.value.length > 10 || meli_code.value.length < 8) {
|
726 |
+
<?php if ($pm2) { ?>
|
727 |
+
var pm2 = "<?php echo $pm2 ?>";
|
728 |
+
<?php } else { ?>
|
729 |
+
var pm2 = 'کد ملی می بایست 10 رقمی باشد . تنها در صورتی مجاز به استفاده از کد های 8 یا 9 رقمی هستید که ارقام سمت چپ 0 باشند . ';
|
730 |
+
<?php } ?>
|
731 |
+
document.getElementById("city_<?php echo $field["id"]; ?>").innerHTML = pm2;
|
732 |
+
return false;
|
733 |
+
}
|
734 |
+
<?php } ?>
|
735 |
+
if (meli_code.value.length == 8) {
|
736 |
+
meli_code.value = "00"+meli_code.value;
|
737 |
+
}
|
738 |
+
if (meli_code.value.length == 9) {
|
739 |
+
meli_code.value = "0"+meli_code.value;
|
740 |
+
}
|
741 |
+
city = meli_code.value.substring(0,3);
|
742 |
+
c = parseInt(meli_code.value.charAt(9));
|
743 |
+
n = parseInt(meli_code.value.charAt(0)) * 10 +
|
744 |
+
parseInt(meli_code.value.charAt(1)) * 9 +
|
745 |
+
parseInt(meli_code.value.charAt(2)) * 8 +
|
746 |
+
parseInt(meli_code.value.charAt(3)) * 7 +
|
747 |
+
parseInt(meli_code.value.charAt(4)) * 6 +
|
748 |
+
parseInt(meli_code.value.charAt(5)) * 5 +
|
749 |
+
parseInt(meli_code.value.charAt(6)) * 4 +
|
750 |
+
parseInt(meli_code.value.charAt(7)) * 3 +
|
751 |
+
parseInt(meli_code.value.charAt(8)) * 2;
|
752 |
+
r = n - parseInt(n / 11) * 11;
|
753 |
+
if ((r == 0 && r == c) || (r == 1 && c == 1) || (r > 1 && c == 11 - r)) {
|
754 |
+
<?php if(rgget("field_mellicart", $field)) {?>
|
755 |
+
if(city=="169")cityN="استان آذربايجان شرقي - شهر آذر شهر";if(city=="170")cityN="استان آذربايجان شرقي - شهر اسکو";if(city=="149"||city=="150")cityN="استان آذربايجان شرقي - شهر اهر";if(city=="171")cityN="استان آذربايجان شرقي - شهر بستان آباد";if(city=="168")cityN="استان آذربايجان شرقي - شهر بناب";if(city=="136"||city=="137"||city=="138")cityN="استان آذربايجان شرقي - شهر تبريز";if(city=="545")cityN="استان آذربايجان شرقي - شهر ترکمانچاي";if(city=="505")cityN="استان آذربايجان شرقي - شهر جلفا";if(city=="636")cityN="استان آذربايجان شرقي - شهر چاروايماق";if(city=="164"||city=="165")cityN="استان آذربايجان شرقي - شهر سراب";if(city=="172")cityN="استان آذربايجان شرقي - شهر شبستر";if(city=="623")cityN="استان آذربايجان شرقي - شهر صوفيان";if(city=="506")cityN="استان آذربايجان شرقي - شهر عجب شير";if(city=="519")cityN="استان آذربايجان شرقي - شهر کليبر";if(city=="154"||city=="155")cityN="استان آذربايجان شرقي - شهر مراغه";if(city=="567")cityN="استان آذربايجان شرقي - شهر ورزقان";if(city=="173")cityN="استان آذربايجان شرقي - شهر هريس";if(city=="159"||city=="160")cityN="استان آذربايجان شرقي - شهر هشترود";if(city=="604")cityN="استان آذربايجان شرقي - شهر هوراند";if(city=="274"||city=="275")cityN="استان آذربايجان غربي - شهر اروميه";if(city=="295")cityN="استان آذربايجان غربي - شهر اشنويه";if(city=="637")cityN="استان آذربايجان غربي - شهر انزل";if(city=="292")cityN="استان آذربايجان غربي - شهر بوکان";if(city=="492")cityN="استان آذربايجان غربي - شهر پلدشت";if(city=="289")cityN="استان آذربايجان غربي - شهر پيرانشهر";if(city=="677")cityN="استان آذربايجان غربي - شهر تخت سليمان";if(city=="294")cityN="استان آذربايجان غربي - شهر تکاب";if(city=="493")cityN="استان آذربايجان غربي - شهر چايپاره";if(city=="279"||city=="280")cityN="استان آذربايجان غربي - شهر خوي";if(city=="288")cityN="استان آذربايجان غربي - شهر سردشت";if(city=="284"||city=="285")cityN="استان آذربايجان غربي - شهر سلماس";if(city=="638")cityN="استان آذربايجان غربي - شهر سيلوانه";if(city=="291")cityN="استان آذربايجان غربي - شهر سيه چشمه(چالدران)";if(city=="640")cityN="استان آذربايجان غربي - شهر شوط";if(city=="293")cityN="استان آذربايجان غربي - شهر شاهين دژ";if(city=="675")cityN="استان آذربايجان غربي - شهر کشاورز";if(city=="282"||city=="283")cityN="استان آذربايجان غربي - شهر ماکو";if(city=="286"||city=="287")cityN="استان آذربايجان غربي - شهر مهاباد";if(city=="296"||city=="297")cityN="استان آذربايجان غربي - شهر مياندوآب";if(city=="290")cityN="استان آذربايجان غربي - شهر نقده";if(city=="400"||city=="401")cityN="استان همدان - شهر اسدآباد";if(city=="404"||city=="405")cityN="استان همدان - شهر بهار";if(city=="397")cityN="استان همدان - شهر تويسرکان";if(city=="398"||city=="399")cityN="استان همدان - شهر رزن";if(city=="647")cityN="استان همدان - شهر شراء و پيشخوار";if(city=="502")cityN="استان همدان - شهر فامنين";if(city=="584")cityN="استان همدان - شهر قلقل رود";if(city=="402"||city=="403")cityN="استان همدان - شهر کبودرآهنگ";if(city=="392"||city=="393")cityN="استان همدان - شهر ملاير";if(city=="395"||city=="396")cityN="استان همدان - شهر نهاوند";if(city=="386"||city=="387")cityN="استان همدان - شهر همدان";if(city=="503")cityN="استان يزد - شهر ابرکوه";if(city=="444")cityN="استان يزد - شهر اردکان";if(city=="551")cityN="استان يزد - شهر اشکذر";if(city=="447")cityN="استان يزد - شهر بافق";if(city=="561")cityN="استان يزد - شهر بهاباد";if(city=="445")cityN="استان يزد - شهر تفت";if(city=="718")cityN="استان يزد - شهر دستگردان";if(city=="083")cityN="استان يزد - شهر طبس";if(city=="446")cityN="استان يزد - شهر مهريز";if(city=="448")cityN="استان يزد - شهر ميبد";if(city=="552")cityN="استان يزد - شهر نير";if(city=="543")cityN="استان يزد - شهر هرات و مروست";if(city=="442"||city=="443")cityN="استان يزد - شهر يزد";if(city=="051")cityN="استان مرکزي - شهر آشتيان";if(city=="052"||city=="053")cityN="استان مرکزي - شهر اراک";if(city=="058")cityN="استان مرکزي - شهر تفرش";if(city=="055")cityN="استان مرکزي - شهر خمين";if(city=="617")cityN="استان مرکزي - شهر خنداب";if(city=="057")cityN="استان مرکزي - شهر دليجان";if(city=="618")cityN="استان مرکزي - شهر زرند مرکزي";if(city=="059"||city=="060")cityN="استان مرکزي - شهر ساوه";if(city=="061"||city=="062")cityN="استان مرکزي - شهر سربند";if(city=="544")cityN="استان مرکزي - شهر فراهان";if(city=="056")cityN="استان مرکزي - شهر محلات";if(city=="571")cityN="استان مرکزي - شهر وفس";if(city=="593")cityN="استان مرکزي - شهر هندودر";if(city=="667")cityN="استان هرمزگان - شهر ابوموسي";if(city=="348")cityN="استان هرمزگان - شهر بستک";if(city=="586")cityN="استان هرمزگان - شهر بشاگرد";if(city=="338"||city=="339")cityN="استان هرمزگان - شهر بندرعباس";if(city=="343"||city=="344")cityN="استان هرمزگان - شهر بندرلنگه";if(city=="346")cityN="استان هرمزگان - شهر جاسک";if(city=="337")cityN="استان هرمزگان - شهر حاجي آباد";if(city=="554")cityN="استان هرمزگان - شهر خمير";if(city=="469")cityN="استان هرمزگان - شهر رودان";if(city=="537")cityN="استان هرمزگان - شهر فين";if(city=="345")cityN="استان هرمزگان - شهر قشم";if(city=="470")cityN="استان هرمزگان - شهر گاوبندي";if(city=="341"||city=="342")cityN="استان هرمزگان - شهر ميناب";if(city=="483"||city=="484")cityN="استان لرستان - شهر ازنا";if(city=="557")cityN="استان لرستان - شهر اشترينان";if(city=="418")cityN="استان لرستان - شهر الشتر";if(city=="416"||city=="417")cityN="استان لرستان - شهر اليگودرز";if(city=="412"||city=="413")cityN="استان لرستان - شهر بروجرد";if(city=="592")cityN="استان لرستان - شهر پاپي";if(city=="612")cityN="استان لرستان - شهر چغلوندي";if(city=="613")cityN="استان لرستان - شهر چگني";if(city=="406"||city=="407")cityN="استان لرستان - شهر خرم آباد";if(city=="421")cityN="استان لرستان - شهر دورود";if(city=="598")cityN="استان لرستان - شهر رومشکان";if(city=="419")cityN="استان لرستان - شهر کوهدشت";if(city=="385")cityN="استان لرستان - شهر ملاوي(پلدختر)";if(city=="420")cityN="استان لرستان - شهر نورآباد(دلفان)";if(city=="528")cityN="استان لرستان - شهر ويسيان";if(city=="213"||city=="214")cityN="استان مازندران - شهر آمل";if(city=="205"||city=="206")cityN="استان مازندران - شهر بابل";if(city=="498")cityN="استان مازندران - شهر بابل";if(city=="568")cityN="استان مازندران - شهر بندپي";if(city=="711")cityN="استان مازندران - شهر بندپي شرقي";if(city=="217"||city=="218")cityN="استان مازندران - شهر بهشهر";if(city=="221")cityN="استان مازندران - شهر تنکابن";if(city=="582")cityN="استان مازندران - شهر جويبار";if(city=="483")cityN="استان مازندران - شهر چالوس";if(city=="625")cityN="استان مازندران - شهر چمستان";if(city=="576")cityN="استان مازندران - شهر چهاردانگه";if(city=="578")cityN="استان مازندران - شهر دودانگه";if(city=="227")cityN="استان مازندران - شهر رامسر";if(city=="208"||city=="209")cityN="استان مازندران - شهر ساري";if(city=="225")cityN="استان مازندران - شهر سوادکوه";if(city=="577")cityN="استان مازندران - شهر شيرگاه";if(city=="712")cityN="استان مازندران - شهر عباس آباد";if(city=="215"||city=="216")cityN="استان مازندران - شهر قائمشهر";if(city=="626")cityN="استان مازندران - شهر کجور";if(city=="627")cityN="استان مازندران - شهر کلاردشت";if(city=="579")cityN="استان مازندران - شهر گلوگاه";if(city=="713")cityN="استان مازندران - شهر مياندورود";if(city=="499")cityN="استان مازندران - شهر نکاء";if(city=="222")cityN="استان مازندران - شهر نور";if(city=="219"||city=="220")cityN="استان مازندران - شهر نوشهر";if(city=="500"||city=="501")cityN="استان مازندران - شهر هراز و محمودآباد";if(city=="623")cityN="استان گلستان - شهر آزادشهر";if(city=="497")cityN="استان گلستان - شهر آق قلا";if(city=="223")cityN="استان گلستان - شهر بندرترکمن";if(city=="689")cityN="استان گلستان - شهر بندرگز";if(city=="487")cityN="استان گلستان - شهر راميان";if(city=="226")cityN="استان گلستان - شهر علي آباد";if(city=="224")cityN="استان گلستان - شهر کردکوي";if(city=="386")cityN="استان گلستان - شهر کلاله";if(city=="211"||city=="212")cityN="استان گلستان - شهر گرگان";if(city=="628")cityN="استان گلستان - شهر گميشان";if(city=="202"||city=="203")cityN="استان گلستان - شهر گنبد کاووس";if(city=="531")cityN="استان گلستان - شهر مراوه تپه";if(city=="288")cityN="استان گلستان - شهر مينودشت";if(city=="261")cityN="استان گيلان - شهر آستارا";if(city=="273")cityN="استان گيلان - شهر آستانه";if(city=="630")cityN="استان گيلان - شهر املش";if(city=="264")cityN="استان گيلان - شهر بندرانزلي";if(city=="518")cityN="استان گيلان - شهر خمام";if(city=="631")cityN="استان گيلان - شهر رحيم آباد";if(city=="258"||city=="259")cityN="استان گيلان - شهر رشت";if(city=="570")cityN="استان گيلان - شهر رضوانشهر";if(city=="265")cityN="استان گيلان - شهر رودبار";if(city=="268"||city=="269")cityN="استان گيلان - شهر رودسر";if(city=="653")cityN="استان گيلان - شهر سنگر";if(city=="517")cityN="استان گيلان - شهر سياهکل";if(city=="569")cityN="استان گيلان - شهر شفت";if(city=="267")cityN="استان گيلان - شهر صومعه سرا";if(city=="262"||city=="263")cityN="استان گيلان - شهر طالش";if(city=="593")cityN="استان گيلان - شهر عمارلو";if(city=="266")cityN="استان گيلان - شهر فومن";if(city=="693")cityN="استان گيلان - شهر کوچصفهان";if(city=="271"||city=="272")cityN="استان گيلان - شهر لاهيجان";if(city=="694")cityN="استان گيلان - شهر لشت نشاء";if(city=="270")cityN="استان گيلان - شهر لنگرود";if(city=="516")cityN="استان گيلان - شهر ماسال و شاندرمن";if(city=="333"||city=="334")cityN="استان کرمانشاه - شهر اسلام آباد";if(city=="691")cityN="استان کرمانشاه - شهر باينگان";if(city=="322"||city=="323")cityN="استان کرمانشاه - شهر پاوه";if(city=="595")cityN="استان کرمانشاه - شهر ثلاث باباجاني";if(city=="395")cityN="استان کرمانشاه - شهر جوانرود";if(city=="641")cityN="استان کرمانشاه - شهر حميل";if(city=="596")cityN="استان کرمانشاه - شهر روانسر";if(city=="336")cityN="استان کرمانشاه - شهر سرپل ذهاب";if(city=="335")cityN="استان کرمانشاه - شهر سنقر";if(city=="496")cityN="استان کرمانشاه - شهر صحنه";if(city=="337")cityN="استان کرمانشاه - شهر قصرشيرين";if(city=="324"||city=="325")cityN="استان کرمانشاه - شهر کرمانشاه";if(city=="394")cityN="استان کرمانشاه - شهر کرند";if(city=="330")cityN="استان کرمانشاه - شهر کنگاور";if(city=="332")cityN="استان کرمانشاه - شهر گيلانغرب";if(city=="331")cityN="استان کرمانشاه - شهر هرسين";if(city=="687")cityN="استان کهکيلويه و بويراحمد - شهر باشت";if(city=="422"||city=="423")cityN="استان کهکيلويه و بويراحمد - شهر بويراحمد(ياسوج)";if(city=="599")cityN="استان کهکيلويه و بويراحمد - شهر بهمني";if(city=="600")cityN="استان کهکيلويه و بويراحمد - شهر چاروسا";if(city=="688")cityN="استان کهکيلويه و بويراحمد - شهر دروهان";if(city=="424"||city=="425")cityN="استان کهکيلويه و بويراحمد - شهر کهکيلويه(دهدشت)";if(city=="426")cityN="استان کهکيلويه و بويراحمد - شهر گچساران(دوگنبدان)";if(city=="550")cityN="استان کهکيلويه و بويراحمد - شهر لنده";if(city=="697")cityN="استان کهکيلويه و بويراحمد - شهر مارگون";if(city=="384")cityN="استان کردستان - شهر بانه";if(city=="377"||city=="378")cityN="استان کردستان - شهر بيجار";if(city=="558")cityN="استان کردستان - شهر دهگلان";if(city=="385")cityN="استان کردستان - شهر ديواندره";if(city=="646")cityN="استان کردستان - شهر سروآباد";if(city=="375"||city=="376")cityN="استان کردستان - شهر سقز";if(city=="372"||city=="373")cityN="استان کردستان - شهر سنندج";if(city=="379"||city=="380")cityN="استان کردستان - شهر قروه";if(city=="383")cityN="استان کردستان - شهر کامياران";if(city=="674")cityN="استان کردستان - شهر کراني";if(city=="381"||city=="382")cityN="استان کردستان - شهر مريوان";if(city=="676")cityN="استان کردستان - شهر نمشير";if(city=="722")cityN="استان کرمان - شهر ارزونيه";if(city=="542")cityN="استان کرمان - شهر انار";if(city=="312"||city=="313")cityN="استان کرمان - شهر بافت";if(city=="317")cityN="استان کرمان - شهر بردسير";if(city=="310"||city=="311")cityN="استان کرمان - شهر بم";if(city=="302"||city=="303")cityN="استان کرمان - شهر جيرفت";if(city=="583")cityN="استان کرمان - شهر رابر";if(city=="321")cityN="استان کرمان - شهر راور";if(city=="382")cityN="استان کرمان - شهر راين";if(city=="304"||city=="305")cityN="استان کرمان - شهر رفسنجان";if(city=="536")cityN="استان کرمان - شهر رودبار کهنوج";if(city=="605")cityN="استان کرمان - شهر ريگان";if(city=="308"||city=="309")cityN="استان کرمان - شهر زرند";if(city=="306"||city=="307")cityN="استان کرمان - شهر سيرجان";if(city=="319")cityN="استان کرمان - شهر شهداد";if(city=="313"||city=="314")cityN="استان کرمان - شهر شهربابک";if(city=="606")cityN="استان کرمان - شهر عنبرآباد";if(city=="320")cityN="استان کرمان - شهر فهرج";if(city=="698")cityN="استان کرمان - شهر قلعه گنج";if(city=="298"||city=="299")cityN="استان کرمان - شهر کرمان";if(city=="535")cityN="استان کرمان - شهر کوهبنان";if(city=="315"||city=="316")cityN="استان کرمان - شهر کهنوج";if(city=="318")cityN="استان کرمان - شهر گلباف";if(city=="607")cityN="استان کرمان - شهر ماهان";if(city=="608")cityN="استان کرمان - شهر منوجان";if(city=="508")cityN="استان قزوين - شهر آبيک";if(city=="538")cityN="استان قزوين - شهر آوج";if(city=="728")cityN="استان قزوين - شهر البرز";if(city=="509")cityN="استان قزوين - شهر بوئين زهرا";if(city=="438"||city=="439")cityN="استان قزوين - شهر تاکستان";if(city=="580")cityN="استان قزوين - شهر رودبار الموت";if(city=="590")cityN="استان قزوين - شهر رودبار شهرستان";if(city=="559")cityN="استان قزوين - شهر ضياءآباد";if(city=="588")cityN="استان قزوين - شهر طارم سفلي";if(city=="431"||city=="432")cityN="استان قزوين - شهر قزوين";if(city=="037"||city=="038")cityN="استان قم - شهر قم";if(city=="702")cityN="استان قم - شهر کهک";if(city=="240"||city=="241")cityN="استان فارس - شهر آباده";if(city=="670")cityN="استان فارس - شهر آباده طشک";if(city=="648")cityN="استان فارس - شهر ارسنجان";if(city=="252")cityN="استان فارس - شهر استهبان";if(city=="678")cityN="استان فارس - شهر اشکنان";if(city=="253")cityN="استان فارس - شهر اقليد";if(city=="649")cityN="استان فارس - شهر اوز";if(city=="513")cityN="استان فارس - شهر بوانات";if(city=="546")cityN="استان فارس - شهر بيضا";if(city=="671")cityN="استان فارس - شهر جويم";if(city=="246"||city=="247")cityN="استان فارس - شهر جهرم";if(city=="654")cityN="استان فارس - شهر حاجي آباد(زرين دشت)";if(city=="548")cityN="استان فارس - شهر خرامه";if(city=="547")cityN="استان فارس - شهر خشت و کمارج";if(city=="655")cityN="استان فارس - شهر خفر";if(city=="248"||city=="249")cityN="استان فارس - شهر داراب";if(city=="253")cityN="استان فارس - شهر سپيدان";if(city=="514")cityN="استان فارس - شهر سروستان";if(city=="665")cityN="استان فارس - شهر سعادت آباد";if(city=="673")cityN="استان فارس - شهر شيبکوه";if(city=="228"||city=="229"||city=="230")cityN="استان فارس - شهر شيراز";if(city=="679")cityN="استان فارس - شهر فراشبند";if(city=="256"||city=="257")cityN="استان فارس - شهر فسا";if(city=="244"||city=="245")cityN="استان فارس - شهر فيروزآباد";if(city=="681")cityN="استان فارس - شهر قنقري(خرم بيد)";if(city=="723")cityN="استان فارس - شهر قيروکارزين";if(city=="236"||city=="237")cityN="استان فارس - شهر کازرون";if(city=="683")cityN="استان فارس - شهر کوار";if(city=="656")cityN="استان فارس - شهر کراش";if(city=="250"||city=="251")cityN="استان فارس - شهر لارستان";if(city=="515")cityN="استان فارس - شهر لامرد";if(city=="242"||city=="243")cityN="استان فارس - شهر مرودشت";if(city=="238"||city=="239")cityN="استان فارس - شهر ممسني";if(city=="657")cityN="استان فارس - شهر مهر";if(city=="255")cityN="استان فارس - شهر ني ريز";if(city=="684")cityN="استان سمنان - شهر ايوانکي";if(city=="700")cityN="استان سمنان - شهر بسطام";if(city=="642")cityN="استان سمنان - شهر بيارجمند";if(city=="457")cityN="استان سمنان - شهر دامغان";if(city=="456")cityN="استان سمنان - شهر سمنان";if(city=="458"||city=="459")cityN="استان سمنان - شهر شاهرود";if(city=="460")cityN="استان سمنان - شهر گرمسار";if(city=="530")cityN="استان سمنان - شهر مهديشهر";if(city=="520")cityN="استان سمنان - شهر ميامي";if(city=="358"||city=="359")cityN="استان سيستان و بلوچستان - شهر ايرانشهر";if(city=="682")cityN="استان سيستان و بلوچستان - شهر بزمان";if(city=="703")cityN="استان سيستان و بلوچستان - شهر بمپور";if(city=="364"||city=="365")cityN="استان سيستان و بلوچستان - شهر چابهار";if(city=="371")cityN="استان سيستان و بلوچستان - شهر خاش";if(city=="701")cityN="استان سيستان و بلوچستان - شهر دشتياري";if(city=="720")cityN="استان سيستان و بلوچستان - شهر راسک";if(city=="366"||city=="367")cityN="استان سيستان و بلوچستان - شهر زابل";if(city=="704")cityN="استان سيستان و بلوچستان - شهر زابلي";if(city=="361"||city=="362")cityN="استان سيستان و بلوچستان - شهر زاهدان";if(city=="369"||city=="370")cityN="استان سيستان و بلوچستان - شهر سراوان";if(city=="635")cityN="استان سيستان و بلوچستان - شهر سرباز";if(city=="668")cityN="استان سيستان و بلوچستان - شهر سيب و سوران";if(city=="533")cityN="استان سيستان و بلوچستان - شهر شهرکي و ناروئي(زهک)";if(city=="705")cityN="استان سيستان و بلوچستان - شهر شيب آب";if(city=="699")cityN="استان سيستان و بلوچستان - شهر فنوج";if(city=="669")cityN="استان سيستان و بلوچستان - شهر قصرقند";if(city=="725")cityN="استان سيستان و بلوچستان - شهر کنارک";if(city=="597")cityN="استان سيستان و بلوچستان - شهر لاشار(اسپکه)";if(city=="611")cityN="استان سيستان و بلوچستان - شهر ميرجاوه";if(city=="525")cityN="استان سيستان و بلوچستان - شهر نيک شهر";if(city=="181")cityN="استان خوزستان - شهر آبادان";if(city=="527")cityN="استان خوزستان - شهر آغاجاري";if(city=="585")cityN="استان خوزستان - شهر اروندکنار";if(city=="685")cityN="استان خوزستان - شهر اميديه";if(city=="663")cityN="استان خوزستان - شهر انديکا";if(city=="192"||city=="193")cityN="استان خوزستان - شهر انديمشک";if(city=="174"||city=="175")cityN="استان خوزستان - شهر اهواز";if(city=="183"||city=="184")cityN="استان خوزستان - شهر ايذه";if(city=="481")cityN="استان خوزستان - شهر باغ ملک";if(city=="706")cityN="استان خوزستان - شهر بندر امام خميني";if(city=="194"||city=="195")cityN="استان خوزستان - شهر بندرماهشهر";if(city=="185"||city=="186")cityN="استان خوزستان - شهر بهبهان";if(city=="182")cityN="استان خوزستان - شهر خرمشهر";if(city=="199"||city=="200")cityN="استان خوزستان - شهر دزفول";if(city=="198")cityN="استان خوزستان - شهر دشت آزادگان";if(city=="662")cityN="استان خوزستان - شهر رامشير";if(city=="190"||city=="191")cityN="استان خوزستان - شهر رامهرمز";if(city=="692")cityN="استان خوزستان - شهر سردشت";if(city=="189")cityN="استان خوزستان - شهر شادگان";if(city=="707")cityN="استان خوزستان - شهر شاوور";if(city=="526")cityN="استان خوزستان - شهر شوش";if(city=="187"||city=="188")cityN="استان خوزستان - شهر شوشتر";if(city=="729")cityN="استان خوزستان - شهر گتوند";if(city=="730")cityN="استان خوزستان - شهر لالي";if(city=="196"||city=="197")cityN="استان خوزستان - شهر مسجدسليمان";if(city=="661")cityN="استان خوزستان - شهر هنديجان";if(city=="680")cityN="استان خوزستان - شهر هويزه";if(city=="643")cityN="استان خراسان رضوي - شهر احمدآباد";if(city=="562")cityN="استان خراسان رضوي - شهر بجستان";if(city=="572")cityN="استان خراسان رضوي - شهر بردسکن";if(city=="074")cityN="استان خراسان رضوي - شهر تايباد";if(city=="644")cityN="استان خراسان رضوي - شهر تخت جلگه";if(city=="072"||city=="073")cityN="استان خراسان رضوي - شهر تربت جام";if(city=="069"||city=="070")cityN="استان خراسان رضوي - شهر تربت حيدريه";if(city=="521")cityN="استان خراسان رضوي - شهر جغتاي";if(city=="573")cityN="استان خراسان رضوي - شهر جوين";if(city=="522")cityN="استان خراسان رضوي - شهر چناران";if(city=="724")cityN="استان خراسان رضوي - شهر خليل آباد";if(city=="076")cityN="استان خراسان رضوي - شهر خواف";if(city=="077")cityN="استان خراسان رضوي - شهر درگز";if(city=="650")cityN="استان خراسان رضوي - شهر رشتخوار";if(city=="574")cityN="استان خراسان رضوي - شهر زبرخان";if(city=="078"||city=="079")cityN="استان خراسان رضوي - شهر سبزوار";if(city=="081")cityN="استان خراسان رضوي - شهر سرخس";if(city=="084")cityN="استان خراسان رضوي - شهر فريمان";if(city=="651")cityN="استان خراسان رضوي - شهر فيض آباد";if(city=="086"||city=="087")cityN="استان خراسان رضوي - شهر قوچان";if(city=="089"||city=="090")cityN="استان خراسان رضوي - شهر کاشمر";if(city=="553")cityN="استان خراسان رضوي - شهر کلات";if(city=="091")cityN="استان خراسان رضوي - شهر گناباد";if(city=="092"||city=="093"||city=="094")cityN="استان خراسان رضوي - شهر مشهد";if(city=="097")cityN="استان خراسان رضوي - شهر مشهد منطقه2";if(city=="098")cityN="استان خراسان رضوي - شهر مشهد منطقه3";if(city=="096")cityN="استان خراسان رضوي - شهر مشهد منطقه1";if(city=="105"||city=="106")cityN="استان خراسان رضوي - شهر نيشابور";if(city=="063")cityN="استان خراسان شمالي - شهر اسفراين";if(city=="067"||city=="068")cityN="استان خراسان شمالي - شهر بجنورد";if(city=="075")cityN="استان خراسان شمالي - شهر جاجرم";if(city=="591")cityN="استان خراسان شمالي - شهر رازوجرکلان";if(city=="082")cityN="استان خراسان شمالي - شهر شيروان";if(city=="635")cityN="استان خراسان شمالي - شهر فاروج";if(city=="524")cityN="استان خراسان شمالي - شهر مانه و سملقان";if(city=="468")cityN="استان چهارمحال و بختياري - شهر اردل";if(city=="465")cityN="استان چهارمحال و بختياري - شهر بروجن";if(city=="461"||city=="462")cityN="استان چهارمحال و بختياري - شهر شهرکرد";if(city=="467")cityN="استان چهارمحال و بختياري - شهر فارسان";if(city=="555")cityN="استان چهارمحال و بختياري - شهر کوهرنگ";if(city=="633")cityN="استان چهارمحال و بختياري - شهر کيار";if(city=="629")cityN="استان چهارمحال و بختياري - شهر گندمان";if(city=="466")cityN="استان چهارمحال و بختياري - شهر لردگان";if(city=="696")cityN="استان چهارمحال و بختياري - شهر ميانکوه";if(city=="721")cityN="استان خراسان جنوبي - شهر بشرويه";if(city=="064"||city=="065")cityN="استان خراسان جنوبي - شهر بيرجند";if(city=="523")cityN="استان خراسان جنوبي - شهر درميان";if(city=="652")cityN="استان خراسان جنوبي - شهر زيرکوه";if(city=="719")cityN="استان خراسان جنوبي - شهر سرايان";if(city=="716")cityN="استان خراسان جنوبي - شهر سربيشه";if(city=="085")cityN="استان خراسان جنوبي - شهر فردوس";if(city=="088")cityN="استان خراسان جنوبي - شهر قائنات";if(city=="563")cityN="استان خراسان جنوبي - شهر نهبندان";if(city=="529")cityN="استان بوشهر - شهر بندر ديلم";if(city=="353")cityN="استان بوشهر - شهر بندر گناوه";if(city=="349"||city=="350")cityN="استان بوشهر - شهر بوشهر";if(city=="355")cityN="استان بوشهر - شهر تنگستان";if(city=="609")cityN="استان بوشهر - شهر جم";if(city=="351"||city=="352")cityN="استان بوشهر - شهر دشتستان";if(city=="354")cityN="استان بوشهر - شهر دشتي";if(city=="732")cityN="استان بوشهر - شهر دلوار";if(city=="357")cityN="استان بوشهر - شهر دير";if(city=="532")cityN="استان بوشهر - شهر سعد آباد";if(city=="610")cityN="استان بوشهر - شهر شبانکاره";if(city=="356")cityN="استان بوشهر - شهر کنگان";if(city=="556")cityN="استان تهران - شهر اسلامشهر";if(city=="658")cityN="استان تهران - شهر پاکدشت";if(city=="001"||city=="002"||city=="003"||city=="004"||city=="005"||city=="006"||city=="007"||city=="008")cityN="استان تهران - شهر تهران مرکزي";if(city=="011")cityN="استان تهران - شهر تهران جنوب";if(city=="020")cityN="استان تهران - شهر تهران شرق";if(city=="025")cityN="استان تهران - شهر تهرانشمال";if(city=="015")cityN="استان تهران - شهر تهران غرب";if(city=="043")cityN="استان تهران - شهر دماوند";if(city=="666")cityN="استان تهران - شهر رباط کريم";if(city=="489")cityN="استان تهران - شهر ساوجبلاغ";if(city=="044"||city=="045")cityN="استان تهران - شهر شميران";if(city=="048"||city=="049")cityN="استان تهران - شهر شهرري";if(city=="490"||city=="491")cityN="استان تهران - شهر شهريار";if(city=="695")cityN="استان تهران - شهر طالقان";if(city=="659")cityN="استان تهران - شهر فيروزکوه";if(city=="031"||city=="032")cityN="استان تهران - شهر کرج";if(city=="664")cityN="استان تهران - شهر کهريزک";if(city=="717")cityN="استان تهران - شهر نظرآباد";if(city=="041"||city=="042")cityN="استان تهران - شهر ورامين";if(city=="471"||city=="472")cityN=" امور خارجه - امور خارجه";if(city=="454")cityN="استان ايلام - شهر آبدانان";if(city=="581")cityN="استان ايلام - شهر ارکوازي(ملکشاهي)";if(city=="449"||city=="450")cityN="استان ايلام - شهر ايلام";if(city=="616")cityN="استان ايلام - شهر ايوان";if(city=="534")cityN="استان ايلام - شهر بدره";if(city=="455")cityN="استان ايلام - شهر دره شهر";if(city=="451")cityN="استان ايلام - شهر دهلران";if(city=="726")cityN="استان ايلام - شهر زرين آباد";if(city=="634")cityN="استان ايلام - شهر شيروان لومار";if(city=="453")cityN="استان ايلام - شهر شيروان و چرداول";if(city=="727")cityN="استان ايلام - شهر موسيان";if(city=="452")cityN="استان ايلام - شهر مهران";if(city=="145"||city=="146")cityN="استان اردبيل - شهر اردبيل";if(city=="731")cityN="استان اردبيل - شهر ارشق";if(city=="690")cityN="استان اردبيل - شهر انگوت";if(city=="601")cityN="استان اردبيل - شهر بيله سوار";if(city=="504")cityN="استان اردبيل - شهر پارس آباد";if(city=="163")cityN="استان اردبيل - شهر خلخال";if(city=="714")cityN="استان اردبيل - شهر خورش رستم";if(city=="715")cityN="استان اردبيل - شهر سرعين";if(city=="566")cityN="استان اردبيل - شهر سنجبد(کوثر)";if(city=="166"||city=="167")cityN="استان اردبيل - شهر مشکين شهر";if(city=="161"||city=="162")cityN="استان اردبيل - شهر مغان";if(city=="686")cityN="استان اردبيل - شهر نمين";if(city=="603")cityN="استان اردبيل - شهر نير";if(city=="619")cityN="استان اصفهان - شهر آران و بيدگل";if(city=="118")cityN="استان اصفهان - شهر اردستان";if(city=="127"||city=="128"||city=="129")cityN="استان اصفهان - شهر اصفهان";if(city=="620")cityN="استان اصفهان - شهر باغ بهادران";if(city=="621")cityN="استان اصفهان - شهر بوئين و مياندشت";if(city=="549")cityN="استان اصفهان - شهر تيران و کرون";if(city=="564")cityN="استان اصفهان - شهر جرقويه";if(city=="575")cityN="استان اصفهان - شهر چادگان";if(city=="113"||city=="114")cityN="استان اصفهان - شهر خميني شهر";if(city=="122")cityN="استان اصفهان - شهر خوانسار";if(city=="540")cityN="استان اصفهان - شهر خور و بيابانک";if(city=="660")cityN="استان اصفهان - شهر دولت آباد";if(city=="120")cityN="استان اصفهان - شهر سميرم";if(city=="512")cityN="استان اصفهان - شهر سميرم سفلي (دهاقان)";if(city=="510"||city=="511")cityN="استان اصفهان - شهر شاهين شهر";if(city=="119")cityN="استان اصفهان - شهر شهرضا";if(city=="115")cityN="استان اصفهان - شهر فريدن";if(city=="112")cityN="استان اصفهان - شهر فريدونشهر";if(city=="110"||city=="111")cityN="استان اصفهان - شهر فلاورجان";if(city=="125"||city=="126")cityN="استان اصفهان - شهر کاشان";if(city=="565")cityN="استان اصفهان - شهر کوهپايه";if(city=="121")cityN="استان اصفهان - شهر گلپايگان";if(city=="116"||city=="117")cityN="استان اصفهان - شهر لنجان(زرينشهر)";if(city=="541")cityN="استان اصفهان - شهر مبارکه";if(city=="622")cityN="استان اصفهان - شهر ميمه";if(city=="124")cityN="استان اصفهان - شهر نائين";if(city=="108"||city=="109")cityN="استان اصفهان - شهر نجف آباد";if(city=="123")cityN="استان اصفهان - شهر نطنز";if(city=="427"||city=="428")cityN="استان زنجان - شهر زنجان";if(city=="507")cityN="استان آذربايجان شرقي - شهر ملکان";if(city=="158")cityN="استان آذربايجان شرقي - شهر مرند";if(city=="152"||city=="153")cityN="استان آذربايجان شرقي - شهر ميانه";if(city=="615")cityN="استان قزوين - شهر ابهر و خرمدره"
|
756 |
+
document.getElementById("city_<?php echo $field["id"]; ?>").innerHTML = cityN;
|
757 |
+
<?php
|
758 |
+
}
|
759 |
+
if(rgget("field_mellicart_sp", $field)) {?>
|
760 |
+
meli_code.value = meli_code.value.substring(0,3)+"-"+meli_code.value.substring(3,9)+"-"+meli_code.value.substring(9,10);
|
761 |
+
<?php } ?>
|
762 |
+
return true;
|
763 |
+
}
|
764 |
+
<?php if(rgget("field_mellicart", $field)) {?>
|
765 |
+
else {
|
766 |
+
<?php if ($pm3) { ?>
|
767 |
+
var pm3 = "<?php echo $pm3 ?>";
|
768 |
+
<?php } else { ?>
|
769 |
+
var pm3 = 'کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .';
|
770 |
+
<?php } ?>
|
771 |
+
document.getElementById("city_<?php echo $field["id"]; ?>").innerHTML = pm3;
|
772 |
+
return false;
|
773 |
+
}
|
774 |
+
<?php } ?>
|
775 |
+
}
|
776 |
+
</script>
|
777 |
+
<?php
|
778 |
+
}
|
779 |
+
return $content;
|
780 |
+
}
|
781 |
+
public function Add_Melli_Cart_Field_PHP_Checker_Massage_By_HANNANStd($result, $value, $form, $field){
|
782 |
+
if ( $field["type"] == "mellicart" ) {
|
783 |
+
$pm1= rgget("field_mellicart_sp1", $field);
|
784 |
+
$pm2= rgget("field_mellicart_sp2", $field);
|
785 |
+
$pm3= rgget("field_mellicart_sp3", $field);
|
786 |
+
$pm4= rgget("field_mellicart_sp4", $field);
|
787 |
+
if(rgget("field_mellicart_sp", $field))
|
788 |
+
$setting = 1;
|
789 |
+
else
|
790 |
+
$setting = 0;
|
791 |
+
if (self::Add_Melli_Cart_PHP_Checker_By_HANNANStd($value,$setting) == 4) {
|
792 |
+
$result["is_valid"] = false;
|
793 |
+
if ($pm1)
|
794 |
+
$result["message"] = $pm1;
|
795 |
+
else
|
796 |
+
$result["message"] = "کد ملی فقط باید به صورت عدد وارد شود . ";
|
797 |
+
}
|
798 |
+
if (self::Add_Melli_Cart_PHP_Checker_By_HANNANStd($value,$setting) == 3) {
|
799 |
+
$result["is_valid"] = false;
|
800 |
+
if ($pm2)
|
801 |
+
$result["message"] = $pm2;
|
802 |
+
else
|
803 |
+
$result["message"] = 'کد ملی می بایست 10 رقمی باشد . تنها در صورتی مجاز به استفاده از کد های 8 یا 9 رقمی هستید که ارقام سمت چپ 0 باشند . ';
|
804 |
+
}
|
805 |
+
if (self::Add_Melli_Cart_PHP_Checker_By_HANNANStd($value,$setting) == 2) {
|
806 |
+
$result["is_valid"] = false;
|
807 |
+
if ($pm4)
|
808 |
+
$result["message"] = $pm4;
|
809 |
+
else
|
810 |
+
$result["message"] = 'کد ملی وارد شده مطابق با استانداردهای کشور نمی باشد .';
|
811 |
+
}
|
812 |
+
if ($field["noDuplicates"] && RGFormsModel::is_duplicate($form["id"], $field, $value)){
|
813 |
+
$result["is_valid"] = false;
|
814 |
+
if ($pm3)
|
815 |
+
$result["message"] = $pm3;
|
816 |
+
else
|
817 |
+
$result["message"] = 'این کد ملی توسط فرد دیگری ثبت شده است .';
|
818 |
+
}
|
819 |
+
}
|
820 |
+
return $result;
|
821 |
+
}
|
822 |
}
|
823 |
global $Persian_Gravityforms_By_HANNANStd_plugin;
|
824 |
$Persian_Gravityforms_By_HANNANStd_plugin = new GravityFormsPersian( __FILE__ );
|
assets/css/persiangravity.css
CHANGED
@@ -11,7 +11,7 @@ font-family:tahoma;
|
|
11 |
input,li,ul,select,textarea,#gf_merge_tag_list a{
|
12 |
font-family:tahoma !important;
|
13 |
}
|
14 |
-
#toplevel_page_gf_edit_forms a,#toplevel_page_gf_edit_forms .wp-menu-name,.newform_notice,.gatewayset p,.gatewayset td,h1,h2,h3,h4,h5,h6,h2 span,h3 span,label,#no-fields span,.group-header,#gf_form_toolbar a,.gform_tabs a,td a,td a strong,td strong a,th,.add-new-h2,.button,.stat b,.gresults-chart-wrapper *,div.gresults-results-filter-section-label,div.gresults-results-field-label,#gresults-results td,#gresults-results th,#gresults-results tr{
|
15 |
font-family:BYekan !important;
|
16 |
font-weight:normal !important;
|
17 |
}
|
@@ -61,4 +61,10 @@ text-align:right !important;
|
|
61 |
.gf_dashboard_view td i{
|
62 |
font-style:normal !important;
|
63 |
font-family:byekan !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
64 |
}
|
11 |
input,li,ul,select,textarea,#gf_merge_tag_list a{
|
12 |
font-family:tahoma !important;
|
13 |
}
|
14 |
+
#toplevel_page_gf_edit_forms a,#toplevel_page_gf_edit_forms .wp-menu-name,.newform_notice,.gatewayset p,.gatewayset td,h1,h2,h3,h4,h5,h6,h2 span,h3 span,label,#no-fields span,.group-header,#gf_form_toolbar a,.gform_tabs a,td a,td a strong,td strong a,th,.add-new-h2,.button,.stat b,.gresults-chart-wrapper *,div.gresults-results-filter-section-label,div.gresults-results-field-label,#gresults-results td,#gresults-results th,#gresults-results tr,h2 a{
|
15 |
font-family:BYekan !important;
|
16 |
font-weight:normal !important;
|
17 |
}
|
61 |
.gf_dashboard_view td i{
|
62 |
font-style:normal !important;
|
63 |
font-family:byekan !important;
|
64 |
+
}
|
65 |
+
.gfur-form-select {
|
66 |
+
margin-right:415px !important;
|
67 |
+
}
|
68 |
+
optgroup {
|
69 |
+
font-style:normal !important;
|
70 |
}
|
assets/js/Datepicker.js
ADDED
@@ -0,0 +1,191 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var hs = jQuery.noConflict();
|
2 |
+
hs(document).ready(function(hs){hs.extend(hs.ui,{datepicker:{version:"1.8.14"}});var PROP_NAME="datepicker";var dpuuid=new Date().getTime();var instActive;function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={calendar:Date,closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,
|
3 |
+
onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};hs.extend(this._defaults,this.regional[""]);this.dpDiv=bindHover(hs('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}hs.extend(Datepicker.prototype,
|
4 |
+
{markerClassName:"hasDatepicker",maxRows:4,log:function()
|
5 |
+
{if(this.debug){console.log.apply("",arguments)}},_widgetDatepicker:function(){return this.dpDiv},
|
6 |
+
setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},
|
7 |
+
_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults)
|
8 |
+
{var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}
|
9 |
+
var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");
|
10 |
+
if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}var inst=this._newInst(hs(target),inline);var regional=hs.extend({},
|
11 |
+
settings&&this.regional[settings.regional]||{});inst.settings=hs.extend(regional,settings||{},inlineSettings||{});
|
12 |
+
if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},
|
13 |
+
_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\hs1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:bindHover(hs('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}},_connectDatepicker:function(target,inst){var input=hs(target);inst.append=hs([]);inst.trigger=hs([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);hs.data(target,PROP_NAME,inst)},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=false;if(inst.append){inst.append.remove()}if(appendText){inst.append=hs('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=hs(this._get(inst,"buttonImageOnly")?hs("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):hs('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:hs("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if(hs.datepicker._datepickerShowing&&hs.datepicker._lastInput==input[0]){hs.datepicker._hideDatepicker()}else{hs.datepicker._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline)
|
14 |
+
{var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/))
|
15 |
+
{var findMax=function(names){var max=0;var maxI=0;for(var i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};
|
16 |
+
date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));
|
17 |
+
date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay())}
|
18 |
+
inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=hs(target);
|
19 |
+
if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",
|
20 |
+
function(event,key){return this._get(inst,key)});hs.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);
|
21 |
+
this._updateDatepicker(inst);this._updateAlternate(inst);inst.dpDiv.show()},_dialogDatepicker:function(input,date,
|
22 |
+
onSelect,settings,pos){var inst=this._dialogInst;if(!inst){this.uuid+=1;var id="dp"+this.uuid;
|
23 |
+
this._dialogInput=hs('<input type="text" id="'+id+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
|
24 |
+
this._dialogInput.keydown(this._doKeyDown);hs("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};
|
25 |
+
hs.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=(date&&date.constructor==Date?this._formatDate(inst,date):date);
|
26 |
+
this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=document.documentElement.clientWidth;
|
27 |
+
var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;
|
28 |
+
var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}
|
29 |
+
this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");
|
30 |
+
inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);
|
31 |
+
if(hs.blockUI){hs.blockUI(this.dpDiv)}hs.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var hstarget=hs(target);
|
32 |
+
var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();hs.removeData(target,PROP_NAME);
|
33 |
+
if(nodeName=="input"){inst.append.remove();inst.trigger.remove();hstarget.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",
|
34 |
+
this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else{if(nodeName=="div"||nodeName=="span"){hstarget.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var hstarget=hs(target);var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=hstarget.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}}this._disabledInputs=hs.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var hstarget=hs(target);var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=hstarget.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}}this._disabledInputs=hs.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return hs.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?hs.extend({},hs.datepicker._defaults):(inst?(name=="all"?hs.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker()}
|
35 |
+
var date=this._getDateDatepicker(target,true);var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}this._attachments(hs(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=hs.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if(hs.datepicker._datepickerShowing){switch(event.keyCode){case 9:hs.datepicker._hideDatepicker();handled=false;break;case 13:var sel=hs("td."+hs.datepicker._dayOverClass+":not(."+hs.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){hs.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{hs.datepicker._hideDatepicker()}return false;break;case 27:hs.datepicker._hideDatepicker();break;case 33:hs.datepicker._adjustDate(event.target,(event.ctrlKey?-hs.datepicker._get(inst,"stepBigMonths"):-hs.datepicker._get(inst,"stepMonths")),"M");break;case 34:hs.datepicker._adjustDate(event.target,(event.ctrlKey?+hs.datepicker._get(inst,"stepBigMonths"):+hs.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){hs.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){hs.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){hs.datepicker._adjustDate(event.target,(event.ctrlKey?-hs.datepicker._get(inst,"stepBigMonths"):-hs.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){hs.datepicker._adjustDate(event.target,(event.ctrlKey?+hs.datepicker._get(inst,"stepBigMonths"):+hs.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){hs.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=hs.datepicker._getInst(event.target);if(hs.datepicker._get(inst,"constrainInput")){var chars=hs.datepicker._possibleChars(hs.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var inst=hs.datepicker._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{
|
36 |
+
var date=hs.datepicker.parseDate(hs.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),hs.datepicker._getFormatConfig(inst));if(date){hs.datepicker._setDateFromField(inst);
|
37 |
+
hs.datepicker._updateAlternate(inst);hs.datepicker._updateDatepicker(inst)}}catch(event){hs.datepicker.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;
|
38 |
+
if(input.nodeName.toLowerCase()!="input"){input=hs("input",input.parentNode)[0]}if(hs.datepicker._isDisabledDatepicker(input)||hs.datepicker._lastInput==input){return}
|
39 |
+
var inst=hs.datepicker._getInst(input);if(hs.datepicker._curInst&&hs.datepicker._curInst!=inst){if(hs.datepicker._datepickerShowing){hs.datepicker._triggerOnClose(hs.datepicker._curInst)}
|
40 |
+
hs.datepicker._curInst.dpDiv.stop(true,true)}var beforeShow=hs.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));
|
41 |
+
inst.lastVal=null;hs.datepicker._lastInput=input;hs.datepicker._setDateFromField(inst);if(hs.datepicker._inDialog){input.value=""}
|
42 |
+
if(!hs.datepicker._pos){hs.datepicker._pos=hs.datepicker._findPos(input);hs.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;hs(input).parents().each(function(){isFixed|=hs(this).css("position")=="fixed";return !isFixed});
|
43 |
+
if(isFixed&&hs.browser.opera){hs.datepicker._pos[0]-=document.documentElement.scrollLeft;hs.datepicker._pos[1]-=document.documentElement.scrollTop}
|
44 |
+
var offset={left:hs.datepicker._pos[0],top:hs.datepicker._pos[1]};hs.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});
|
45 |
+
hs.datepicker._updateDatepicker(inst);offset=hs.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:(hs.datepicker._inDialog&&hs.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});
|
46 |
+
if(!inst.inline){var showAnim=hs.datepicker._get(inst,"showAnim");var duration=hs.datepicker._get(inst,"duration");
|
47 |
+
var postProcess=function(){var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){var borders=hs.datepicker._getBorders(inst.dpDiv);cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}};inst.dpDiv.zIndex(hs(input).zIndex()+1);hs.datepicker._datepickerShowing=true;if(hs.effects&&hs.effects[showAnim]){inst.dpDiv.show(showAnim,hs.datepicker._get(inst,"showOptions"),duration,postProcess)}
|
48 |
+
else{inst.dpDiv[showAnim||"show"]((showAnim?duration:null),postProcess)}if(!showAnim||!duration){postProcess()}if(inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}hs.datepicker._curInst=inst}},_updateDatepicker:function(inst){var self=this;self.maxRows=4;var borders=hs.datepicker._getBorders(inst.dpDiv);instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}inst.dpDiv.find("."+this._dayOverClass+" a").mouseover();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==hs.datepicker._curInst&&hs.datepicker._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input[0]!=document.activeElement){inst.input.focus()}if(inst.yearshtml){var origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+hs(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+hs(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?hs(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?hs(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1||hs.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=hs(obj).offset();return[position.left,position.top]},_triggerOnClose:function(inst){var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||(input&&inst!=hs.data(input,PROP_NAME))){return}if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){hs.datepicker._tidyDialog(inst);this._curInst=null};if(hs.effects&&hs.effects[showAnim]){inst.dpDiv.hide(showAnim,hs.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}hs.datepicker._triggerOnClose(inst);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(hs.blockUI){hs.unblockUI();hs("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!hs.datepicker._curInst){return}var hstarget=hs(event.target);if(hstarget[0].id!=hs.datepicker._mainDivId&&hstarget.parents("#"+hs.datepicker._mainDivId).length==0&&!hstarget.hasClass(hs.datepicker.markerClassName)&&!hstarget.hasClass(hs.datepicker._triggerClass)&&hs.datepicker._datepickerShowing&&!(hs.datepicker._inDialog&&hs.blockUI)){hs.datepicker._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=hs(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=hs(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{
|
49 |
+
|
50 |
+
var date=new this.CDate();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=hs(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=hs(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear){setTimeout(function(){inst.input.focus()},0)}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=hs(id);if(hs(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=hs("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=hs(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=hs(id);var inst=this._getInst(target[0]);
|
51 |
+
|
52 |
+
|
53 |
+
dateStr=(dateStr!=null?dateStr:this._formatDate(altFormat,date,this._getFormatConfig(inst)));
|
54 |
+
|
55 |
+
|
56 |
+
if(inst.input){
|
57 |
+
|
58 |
+
inst.input.val(dateStr)
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
this._updateAlternate(inst);
|
64 |
+
|
65 |
+
|
66 |
+
///////////// inja ro baraye worpdres taghir dadam ke miladi nesheoon bede : aslish in bood : var onSelect=this._get(inst,"onSelect");
|
67 |
+
|
68 |
+
var onSelect=this._get(inst,"onSelect");
|
69 |
+
|
70 |
+
if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];
|
71 |
+
|
72 |
+
if(typeof(inst.input[0])!="object"){inst.input.focus()}this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");
|
73 |
+
|
74 |
+
if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");
|
75 |
+
|
76 |
+
var date=this._getDate(inst);
|
77 |
+
|
78 |
+
var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
hs(altField).each(function(){hs(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new this.CDate().getFullYear()%100+parseInt(shortYearCutoff,10));var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){var isDoubled=lookAhead(match);var size=(match=="@"?14:(match=="!"?20:(match=="y"&&isDoubled?4:(match=="o"?3:2))));var digits=new RegExp("^\\d{1,"+size+"}");var num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)};var getName=function(match,shortNames,longNames){var names=hs.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return -(a[1].length-b[1].length)});var index=-1;hs.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()==name.toLowerCase()){index=pair[0];iValue+=name.length;return false}});if(index!=-1){return index+1}else{throw"Unknown name at position "+iValue}};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":
|
83 |
+
|
84 |
+
var date=new this.CDate(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":
|
85 |
+
var date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(iValue<value.length){throw"Extra/unparsed characters found in date: "+value.substring(iValue)}if(year==-1){year=new this.CDate().getFullYear()}else{if(year<100){year+=new this.CDate().getFullYear()-new this.CDate().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}
|
86 |
+
var date=this._daylightSavingAdjust(new this.CDate(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new this.CDate(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new this.CDate(date.getFullYear(),0,0).getTime())/86400000),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()==inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat");var dates=inst.lastVal=inst.input?inst.input.val():null;var date,defaultDate;date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);dates=(noDefault?"":dates)}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){this.CDate=this._get(inst,"calendar");return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new this.CDate()))},_determineDate:function(inst,date,defaultDate){
|
87 |
+
var Date=this.CDate;var offsetNumeric=function(offset){
|
88 |
+
var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset){try{return hs.datepicker.parseDate(hs.datepicker._get(inst,"dateFormat"),offset,hs.datepicker._getFormatConfig(inst))}catch(e){}
|
89 |
+
var date=(offset.toLowerCase().match(/^c/)?hs.datepicker._getDate(inst):null)||new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,hs.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,hs.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};var newDate=(date==null||date===""?defaultDate:(typeof date=="string"?offsetString(date):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):new Date(date.getTime()))));newDate=(newDate&&newDate.toString()=="Invalid Date"?defaultDate:newDate);if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date;var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;this.CDate=this._get(inst,"calendar");var newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new this.CDate()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){this.CDate=this._get(inst,"calendar");var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new this.CDate();today=this._daylightSavingAdjust(new this.CDate(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new this.CDate(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&this._compareDate(maxDraw,"<",minDate)?minDate:maxDraw);while(this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a style="direction:ltr" class="ui-datepicker-prev ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a style="direction:ltr" class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a style="direction:ltr" class="ui-datepicker-next ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a style="direction:ltr" class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_hs_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._gotoToday('#"+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";this.maxRows=4;for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group';if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead=(showWeek?'<th class="ui-datepicker-week-col">'+this._get(inst,"weekHeader")+"</th>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var curRows=Math.ceil((leadDays+daysInMonth)/7);var numRows=(isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows);this.maxRows=numRows;var printDate=this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody=(!showWeek?"":'<td class="ui-datepicker-week-col">'+this._get(inst,"calculateWeek")(printDate)+"</td>");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||((minDate&&this._compareDate(printDate,"<",minDate))||(maxDate&&this._compareDate(printDate,">",maxDate)));tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()==currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":' onclick="DP_hs_'+dpuuid+".datepicker._selectDay('#"+inst.id+"',"+printDate.getMonth()+","+printDate.getFullYear()+', this);return false;"')+">"+(otherMonth&&!showOtherMonths?" ":(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()==currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+(hs.browser.msie&&parseInt(hs.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span>"}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_hs_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'M');\" onclick=\"DP_hs_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new this.CDate().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='<select class="ui-datepicker-year" onchange="DP_hs_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'Y');\" onclick=\"DP_hs_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){inst.yearshtml+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);
|
90 |
+
var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new this.CDate(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&this._compareDate(date,"<",minDate))?minDate:date;newDate=(maxDate&&this._compareDate(newDate,">",maxDate))?maxDate:newDate;return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new this.CDate(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new this.CDate(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);
|
91 |
+
var date=this._daylightSavingAdjust(new this.CDate(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");this.CDate=this._get(inst,"calendar");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new this.CDate().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}
|
92 |
+
var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new this.CDate(year,month,day))):this._daylightSavingAdjust(new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))},_compareDate:function(d1,op,d2){if(d1&&d2){if(d1.getGregorianDate){d1=d1.getGregorianDate()}if(d2.getGregorianDate){d2=d2.getGregorianDate()}if(op=="<"){return d1<d2}return d1>d2}else{return null}}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.bind("mouseout",function(event){var elem=hs(event.target).closest(selector);if(!elem.length){return}elem.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(event){var elem=hs(event.target).closest(selector);if(hs.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])||!elem.length){return}elem.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");elem.addClass("ui-state-hover");if(elem.hasClass("ui-datepicker-prev")){elem.addClass("ui-datepicker-prev-hover")}if(elem.hasClass("ui-datepicker-next")){elem.addClass("ui-datepicker-next-hover")}})}function extendRemove(target,props){hs.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&((hs.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}hs.fn.datepicker=function(options){if(!this.length){return this}if(!hs.datepicker.initialized){hs(document).mousedown(hs.datepicker._checkExternalClick).find("body").append(hs.datepicker.dpDiv);hs.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this].concat(otherArgs)):hs.datepicker._attachDatepicker(this,options)})};hs.datepicker=new Datepicker();hs.datepicker.initialized=false;hs.datepicker.uuid=new Date().getTime();hs.datepicker.version="1.8.14";window["DP_hs_"+dpuuid]=hs
|
93 |
+
|
94 |
+
/*
|
95 |
+
JavaScript functions for the Fourmilab Calendar Converter
|
96 |
+
|
97 |
+
by John Walker -- September, MIM
|
98 |
+
http://www.fourmilab.ch/documents/calendar/
|
99 |
+
|
100 |
+
This program is in the public domain.
|
101 |
+
*/
|
102 |
+
function mod(d,c){return d-(c*Math.floor(d/c))}function leap_gregorian(a){return((a%4)==0)&&(!(((a%100)==0)&&((a%400)!=0)))}var GREGORIAN_EPOCH=1721425.5;function gregorian_to_jd(b,c,a){return(GREGORIAN_EPOCH-1)+(365*(b-1))+Math.floor((b-1)/4)+(-Math.floor((b-1)/100))+Math.floor((b-1)/400)+Math.floor((((367*c)-362)/12)+((c<=2)?0:(leap_gregorian(b)?-1:-2))+a)}function jd_to_gregorian(j){var g,m,e,b,l,a,n,c,f,k,h,d,i;g=Math.floor(j-0.5)+0.5;m=g-GREGORIAN_EPOCH;e=Math.floor(m/146097);b=mod(m,146097);l=Math.floor(b/36524);a=mod(b,36524);n=Math.floor(a/1461);c=mod(a,1461);f=Math.floor(c/365);h=(e*400)+(l*100)+(n*4)+f;if(!((l==4)||(f==4))){h++}d=g-gregorian_to_jd(h,1,1);i=((g<gregorian_to_jd(h,3,1))?0:(leap_gregorian(h)?1:2));month=Math.floor((((d+i)*12)+373)/367);day=(g-gregorian_to_jd(h,month,1))+1;return new Array(h,month,day)}function leap_islamic(a){return(((a*11)+14)%30)<11}var ISLAMIC_EPOCH=1948439.5;function islamic_to_jd(b,c,a){return(a+Math.ceil(29.5*(c-1))+(b-1)*354+Math.floor((3+(11*b))/30)+ISLAMIC_EPOCH)-1}function jd_to_islamic(a){var c,d,b;a=Math.floor(a)+0.5;c=Math.floor(((30*(a-ISLAMIC_EPOCH))+10646)/10631);d=Math.min(12,Math.ceil((a-(29+islamic_to_jd(c,1,1)))/29.5)+1);b=(a-islamic_to_jd(c,d,1))+1;return new Array(c,d,b)}function leap_persian(a){return((((((a-((a>0)?474:473))%2820)+474)+38)*682)%2816)<682}var PERSIAN_EPOCH=1948320.5;function persian_to_jd(b,e,a){var d,c;d=b-((b>=0)?474:473);c=474+mod(d,2820);return a+((e<=7)?((e-1)*31):(((e-1)*30)+6))+Math.floor(((c*682)-110)/2816)+(c-1)*365+Math.floor(d/2820)*1029983+(PERSIAN_EPOCH-1)}function jd_to_persian(j){var h,g,i,k,e,a,f,d,c,b;j=Math.floor(j)+0.5;k=j-persian_to_jd(475,1,1);e=Math.floor(k/1029983);a=mod(k,1029983);if(a==1029982){f=2820}else{d=Math.floor(a/366);c=mod(a,366);f=Math.floor(((2134*d)+(2816*c)+2815)/1028522)+d+1}h=f+(2820*e)+474;if(h<=0){h--}b=(j-persian_to_jd(h,1,1))+1;g=(b<=186)?Math.ceil(b/31):Math.ceil((b-6)/30);i=(j-persian_to_jd(h,g,1))+1;return new Array(h,g,i)};
|
103 |
+
// Farsi(Persian) support for hs UI Datepicker 1.8.14 with custom calendar support
|
104 |
+
hs(function(a){a.datepicker.regional.fa={calendar:JalaliDate,closeText:"بستن",prevText:"قبل",nextText:"بعد",currentText:"امروز",monthNames:["فروردين","ارديبهشت","خرداد","تير","مرداد","شهريور","مهر","آبان","آذر","دي","بهمن","اسفند"],monthNamesShort:["فروردين","ارديبهشت","خرداد","تير","مرداد","شهريور","مهر","آبان","آذر","دي","بهمن","اسفند"],dayNames:["يکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],dayNamesShort:["يک","دو","سه","چهار","پنج","جمعه","شنبه"],dayNamesMin:["ي","د","س","چ","پ","ج","ش"],weekHeader:"ه",dateFormat:"dd/mm/yy",firstDay:6,isRTL:true,showMonthAfterYear:false,yearSuffix:"",
|
105 |
+
calculateWeek:function(b){var c=new JalaliDate(b.getFullYear(),b.getMonth(),b.getDate()+(b.getDay()||7)-3);
|
106 |
+
return Math.floor(Math.round((c.getTime()-new JalaliDate(c.getFullYear(),0,1).getTime())/86400000)/7)+1}};
|
107 |
+
a.datepicker.setDefaults(a.datepicker.regional.fa)});
|
108 |
+
|
109 |
+
function JalaliDate(i,h,f)
|
110 |
+
{var d;var a;if(!isNaN(parseInt(i))&&!isNaN(parseInt(h))&&!isNaN(parseInt(f))){var c=j([parseInt(i,10),parseInt(h,10),parseInt(f,10)]);
|
111 |
+
e(new Date(c[0],c[1],c[2]))}else{e(i)}
|
112 |
+
function j(l){var k=0;if(l[1]<0){k=leap_persian(l[0]-1)?30:29;l[1]++}
|
113 |
+
var g=jd_to_gregorian(persian_to_jd(l[0],l[1]+1,l[2])-k);g[1]--;return g}
|
114 |
+
function b(k){var g=jd_to_persian(gregorian_to_jd(k[0],k[1]+1,k[2]));g[1]--;return g}function e(g)
|
115 |
+
{if(g&&g.getGregorianDate){g=g.getGregorianDate()}d=new Date(g);d.setHours(d.getHours()>12?d.getHours()+2:0);if(!d||d=="Invalid Date"||isNaN(d||!d.getDate()))
|
116 |
+
{d=new Date()}a=b([d.getFullYear(),d.getMonth(),d.getDate()]);return this}
|
117 |
+
this.getGregorianDate=function(){return d};this.setFullDate=e;
|
118 |
+
this.setMonth=function(l){a[1]=l;var k=j(a);
|
119 |
+
d=new Date(k[0],k[1],k[2]);a=b([k[0],k[1],k[2]])};
|
120 |
+
this.setDate=function(l){a[2]=l;var k=j(a);
|
121 |
+
d=new Date(k[0],k[1],k[2]);a=b([k[0],k[1],k[2]])};
|
122 |
+
this.getFullYear=function(){return a[0]};
|
123 |
+
this.getMonth=function(){return a[1]};
|
124 |
+
this.getDate=function(){return a[2]};
|
125 |
+
this.toString=function(){return a.join(",").toString()};
|
126 |
+
this.getDay=function(){return d.getDay()};
|
127 |
+
this.getHours=function(){return d.getHours()};
|
128 |
+
this.getMinutes=function(){return d.getMinutes()};
|
129 |
+
this.getSeconds=function(){return d.getSeconds()};
|
130 |
+
this.getTime=function(){return d.getTime()};
|
131 |
+
this.getTimeZoneOffset=function(){return d.getTimeZoneOffset()};
|
132 |
+
this.getYear=function(){return a[0]%100};
|
133 |
+
this.setHours=function(g){d.setHours(g)};
|
134 |
+
this.setMinutes=function(g){d.setMinutes(g)};
|
135 |
+
this.setSeconds=function(g){d.setSeconds(g)};
|
136 |
+
this.setMilliseconds=function(g){d.setMilliseconds(g)}
|
137 |
+
};
|
138 |
+
|
139 |
+
|
140 |
+
|
141 |
+
hs(document).ready(gformInitDatepicker);
|
142 |
+
|
143 |
+
function gformInitDatepicker(){
|
144 |
+
hs('.datepicker').each(
|
145 |
+
function (){
|
146 |
+
var element = hs(this);
|
147 |
+
var format = "mm/dd/yy";
|
148 |
+
|
149 |
+
if(element.hasClass("mdy"))
|
150 |
+
format = "mm/dd/yy";
|
151 |
+
else if(element.hasClass("dmy"))
|
152 |
+
format = "dd/mm/yy";
|
153 |
+
else if(element.hasClass("dmy_dash"))
|
154 |
+
format = "dd-mm-yy";
|
155 |
+
else if(element.hasClass("dmy_dot"))
|
156 |
+
format = "dd.mm.yy";
|
157 |
+
else if(element.hasClass("ymd_slash"))
|
158 |
+
format = "yy/mm/dd";
|
159 |
+
else if(element.hasClass("ymd_dash"))
|
160 |
+
format = "yy-mm-dd";
|
161 |
+
else if(element.hasClass("ymd_dot"))
|
162 |
+
format = "yy.mm.dd";
|
163 |
+
|
164 |
+
var image = "";
|
165 |
+
var showOn = "focus";
|
166 |
+
if(element.hasClass("datepicker_with_icon")){
|
167 |
+
showOn = "both";
|
168 |
+
image = hs('#gforms_calendar_icon_' + this.id).val();
|
169 |
+
}
|
170 |
+
|
171 |
+
element.datepicker( {
|
172 |
+
yearRange: '-100:+20',
|
173 |
+
showOn: showOn,
|
174 |
+
buttonImage: image,
|
175 |
+
buttonImageOnly: true,
|
176 |
+
dateFormat: format,
|
177 |
+
onClose: function () {
|
178 |
+
element.closest('li').nextAll('li:visible:first').find(':input:first').focus();
|
179 |
+
}
|
180 |
+
} );
|
181 |
+
}
|
182 |
+
);
|
183 |
+
}
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
|
191 |
+
});
|
assets/js/Datepicker_J_G.js
ADDED
@@ -0,0 +1,203 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
var hs = jQuery.noConflict();
|
2 |
+
hs(document).ready(function(hs){hs.extend(hs.ui,{datepicker:{version:"1.8.14"}});var PROP_NAME="datepicker";var dpuuid=new Date().getTime();var instActive;function Datepicker(){this.debug=false;this._curInst=null;this._keyEvent=false;this._disabledInputs=[];this._datepickerShowing=false;this._inDialog=false;this._mainDivId="ui-datepicker-div";this._inlineClass="ui-datepicker-inline";this._appendClass="ui-datepicker-append";this._triggerClass="ui-datepicker-trigger";this._dialogClass="ui-datepicker-dialog";this._disableClass="ui-datepicker-disabled";this._unselectableClass="ui-datepicker-unselectable";this._currentClass="ui-datepicker-current-day";this._dayOverClass="ui-datepicker-days-cell-over";this.regional=[];this.regional[""]={calendar:Date,closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:false,showMonthAfterYear:false,yearSuffix:""};this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:false,hideIfNoPrevNext:false,navigationAsDateFormat:false,gotoCurrent:false,changeMonth:false,changeYear:false,yearRange:"c-10:c+10",showOtherMonths:false,selectOtherMonths:false,showWeek:false,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,
|
3 |
+
onSelect:null,onChangeMonthYear:null,onClose:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:true,showButtonPanel:false,autoSize:false};hs.extend(this._defaults,this.regional[""]);this.dpDiv=bindHover(hs('<div id="'+this._mainDivId+'" class="ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>'))}hs.extend(Datepicker.prototype,
|
4 |
+
{markerClassName:"hasDatepicker",maxRows:4,log:function()
|
5 |
+
{if(this.debug){console.log.apply("",arguments)}},_widgetDatepicker:function(){return this.dpDiv},
|
6 |
+
setDefaults:function(settings){extendRemove(this._defaults,settings||{});return this},
|
7 |
+
_attachDatepicker:function(target,settings){var inlineSettings=null;for(var attrName in this._defaults)
|
8 |
+
{var attrValue=target.getAttribute("date:"+attrName);if(attrValue){inlineSettings=inlineSettings||{};try{inlineSettings[attrName]=eval(attrValue)}catch(err){inlineSettings[attrName]=attrValue}}}
|
9 |
+
var nodeName=target.nodeName.toLowerCase();var inline=(nodeName=="div"||nodeName=="span");
|
10 |
+
if(!target.id){this.uuid+=1;target.id="dp"+this.uuid}var inst=this._newInst(hs(target),inline);var regional=hs.extend({},
|
11 |
+
settings&&this.regional[settings.regional]||{});inst.settings=hs.extend(regional,settings||{},inlineSettings||{});
|
12 |
+
if(nodeName=="input"){this._connectDatepicker(target,inst)}else{if(inline){this._inlineDatepicker(target,inst)}}},
|
13 |
+
_newInst:function(target,inline){var id=target[0].id.replace(/([^A-Za-z0-9_-])/g,"\\\\hs1");return{id:id,input:target,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:inline,dpDiv:(!inline?this.dpDiv:bindHover(hs('<div class="'+this._inlineClass+' ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all"></div>')))}},_connectDatepicker:function(target,inst){var input=hs(target);inst.append=hs([]);inst.trigger=hs([]);if(input.hasClass(this.markerClassName)){return}this._attachments(input,inst);input.addClass(this.markerClassName).keydown(this._doKeyDown).keypress(this._doKeyPress).keyup(this._doKeyUp).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",function(event,key){return this._get(inst,key)});this._autoSize(inst);hs.data(target,PROP_NAME,inst)},_attachments:function(input,inst){var appendText=this._get(inst,"appendText");var isRTL=false;if(inst.append){inst.append.remove()}if(appendText){inst.append=hs('<span class="'+this._appendClass+'">'+appendText+"</span>");input[isRTL?"before":"after"](inst.append)}input.unbind("focus",this._showDatepicker);if(inst.trigger){inst.trigger.remove()}var showOn=this._get(inst,"showOn");if(showOn=="focus"||showOn=="both"){input.focus(this._showDatepicker)}if(showOn=="button"||showOn=="both"){var buttonText=this._get(inst,"buttonText");var buttonImage=this._get(inst,"buttonImage");inst.trigger=hs(this._get(inst,"buttonImageOnly")?hs("<img/>").addClass(this._triggerClass).attr({src:buttonImage,alt:buttonText,title:buttonText}):hs('<button type="button"></button>').addClass(this._triggerClass).html(buttonImage==""?buttonText:hs("<img/>").attr({src:buttonImage,alt:buttonText,title:buttonText})));input[isRTL?"before":"after"](inst.trigger);inst.trigger.click(function(){if(hs.datepicker._datepickerShowing&&hs.datepicker._lastInput==input[0]){hs.datepicker._hideDatepicker()}else{hs.datepicker._showDatepicker(input[0])}return false})}},_autoSize:function(inst){if(this._get(inst,"autoSize")&&!inst.inline)
|
14 |
+
{var date=new Date(2009,12-1,20);var dateFormat=this._get(inst,"dateFormat");if(dateFormat.match(/[DM]/))
|
15 |
+
{var findMax=function(names){var max=0;var maxI=0;for(var i=0;i<names.length;i++){if(names[i].length>max){max=names[i].length;maxI=i}}return maxI};
|
16 |
+
date.setMonth(findMax(this._get(inst,(dateFormat.match(/MM/)?"monthNames":"monthNamesShort"))));
|
17 |
+
date.setDate(findMax(this._get(inst,(dateFormat.match(/DD/)?"dayNames":"dayNamesShort")))+20-date.getDay())}
|
18 |
+
inst.input.attr("size",this._formatDate(inst,date).length)}},_inlineDatepicker:function(target,inst){var divSpan=hs(target);
|
19 |
+
if(divSpan.hasClass(this.markerClassName)){return}divSpan.addClass(this.markerClassName).append(inst.dpDiv).bind("setData.datepicker",function(event,key,value){inst.settings[key]=value}).bind("getData.datepicker",
|
20 |
+
function(event,key){return this._get(inst,key)});hs.data(target,PROP_NAME,inst);this._setDate(inst,this._getDefaultDate(inst),true);
|
21 |
+
this._updateDatepicker(inst);this._updateAlternate(inst);inst.dpDiv.show()},_dialogDatepicker:function(input,date,
|
22 |
+
onSelect,settings,pos){var inst=this._dialogInst;if(!inst){this.uuid+=1;var id="dp"+this.uuid;
|
23 |
+
this._dialogInput=hs('<input type="text" id="'+id+'" style="position: absolute; top: -100px; width: 0px; z-index: -10;"/>');
|
24 |
+
this._dialogInput.keydown(this._doKeyDown);hs("body").append(this._dialogInput);inst=this._dialogInst=this._newInst(this._dialogInput,false);inst.settings={};
|
25 |
+
hs.data(this._dialogInput[0],PROP_NAME,inst)}extendRemove(inst.settings,settings||{});date=(date&&date.constructor==Date?this._formatDate(inst,date):date);
|
26 |
+
this._dialogInput.val(date);this._pos=(pos?(pos.length?pos:[pos.pageX,pos.pageY]):null);if(!this._pos){var browserWidth=document.documentElement.clientWidth;
|
27 |
+
var browserHeight=document.documentElement.clientHeight;var scrollX=document.documentElement.scrollLeft||document.body.scrollLeft;
|
28 |
+
var scrollY=document.documentElement.scrollTop||document.body.scrollTop;this._pos=[(browserWidth/2)-100+scrollX,(browserHeight/2)-150+scrollY]}
|
29 |
+
this._dialogInput.css("left",(this._pos[0]+20)+"px").css("top",this._pos[1]+"px");
|
30 |
+
inst.settings.onSelect=onSelect;this._inDialog=true;this.dpDiv.addClass(this._dialogClass);this._showDatepicker(this._dialogInput[0]);
|
31 |
+
if(hs.blockUI){hs.blockUI(this.dpDiv)}hs.data(this._dialogInput[0],PROP_NAME,inst);return this},_destroyDatepicker:function(target){var hstarget=hs(target);
|
32 |
+
var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();hs.removeData(target,PROP_NAME);
|
33 |
+
if(nodeName=="input"){inst.append.remove();inst.trigger.remove();hstarget.removeClass(this.markerClassName).unbind("focus",this._showDatepicker).unbind("keydown",
|
34 |
+
this._doKeyDown).unbind("keypress",this._doKeyPress).unbind("keyup",this._doKeyUp)}else{if(nodeName=="div"||nodeName=="span"){hstarget.removeClass(this.markerClassName).empty()}}},_enableDatepicker:function(target){var hstarget=hs(target);var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=false;inst.trigger.filter("button").each(function(){this.disabled=false}).end().filter("img").css({opacity:"1.0",cursor:""})}else{if(nodeName=="div"||nodeName=="span"){var inline=hstarget.children("."+this._inlineClass);inline.children().removeClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").removeAttr("disabled")}}this._disabledInputs=hs.map(this._disabledInputs,function(value){return(value==target?null:value)})},_disableDatepicker:function(target){var hstarget=hs(target);var inst=hs.data(target,PROP_NAME);if(!hstarget.hasClass(this.markerClassName)){return}var nodeName=target.nodeName.toLowerCase();if(nodeName=="input"){target.disabled=true;inst.trigger.filter("button").each(function(){this.disabled=true}).end().filter("img").css({opacity:"0.5",cursor:"default"})}else{if(nodeName=="div"||nodeName=="span"){var inline=hstarget.children("."+this._inlineClass);inline.children().addClass("ui-state-disabled");inline.find("select.ui-datepicker-month, select.ui-datepicker-year").attr("disabled","disabled")}}this._disabledInputs=hs.map(this._disabledInputs,function(value){return(value==target?null:value)});this._disabledInputs[this._disabledInputs.length]=target},_isDisabledDatepicker:function(target){if(!target){return false}for(var i=0;i<this._disabledInputs.length;i++){if(this._disabledInputs[i]==target){return true}}return false},_getInst:function(target){try{return hs.data(target,PROP_NAME)}catch(err){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(target,name,value){var inst=this._getInst(target);if(arguments.length==2&&typeof name=="string"){return(name=="defaults"?hs.extend({},hs.datepicker._defaults):(inst?(name=="all"?hs.extend({},inst.settings):this._get(inst,name)):null))}var settings=name||{};if(typeof name=="string"){settings={};settings[name]=value}if(inst){if(this._curInst==inst){this._hideDatepicker()}
|
35 |
+
var date=this._getDateDatepicker(target,true);var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");extendRemove(inst.settings,settings);if(minDate!==null&&settings.dateFormat!==undefined&&settings.minDate===undefined){inst.settings.minDate=this._formatDate(inst,minDate)}if(maxDate!==null&&settings.dateFormat!==undefined&&settings.maxDate===undefined){inst.settings.maxDate=this._formatDate(inst,maxDate)}this._attachments(hs(target),inst);this._autoSize(inst);this._setDate(inst,date);this._updateAlternate(inst);this._updateDatepicker(inst)}},_changeDatepicker:function(target,name,value){this._optionDatepicker(target,name,value)},_refreshDatepicker:function(target){var inst=this._getInst(target);if(inst){this._updateDatepicker(inst)}},_setDateDatepicker:function(target,date){var inst=this._getInst(target);if(inst){this._setDate(inst,date);this._updateDatepicker(inst);this._updateAlternate(inst)}},_getDateDatepicker:function(target,noDefault){var inst=this._getInst(target);if(inst&&!inst.inline){this._setDateFromField(inst,noDefault)}return(inst?this._getDate(inst):null)},_doKeyDown:function(event){var inst=hs.datepicker._getInst(event.target);var handled=true;var isRTL=inst.dpDiv.is(".ui-datepicker-rtl");inst._keyEvent=true;if(hs.datepicker._datepickerShowing){switch(event.keyCode){case 9:hs.datepicker._hideDatepicker();handled=false;break;case 13:var sel=hs("td."+hs.datepicker._dayOverClass+":not(."+hs.datepicker._currentClass+")",inst.dpDiv);if(sel[0]){hs.datepicker._selectDay(event.target,inst.selectedMonth,inst.selectedYear,sel[0])}else{hs.datepicker._hideDatepicker()}return false;break;case 27:hs.datepicker._hideDatepicker();break;case 33:hs.datepicker._adjustDate(event.target,(event.ctrlKey?-hs.datepicker._get(inst,"stepBigMonths"):-hs.datepicker._get(inst,"stepMonths")),"M");break;case 34:hs.datepicker._adjustDate(event.target,(event.ctrlKey?+hs.datepicker._get(inst,"stepBigMonths"):+hs.datepicker._get(inst,"stepMonths")),"M");break;case 35:if(event.ctrlKey||event.metaKey){hs.datepicker._clearDate(event.target)}handled=event.ctrlKey||event.metaKey;break;case 36:if(event.ctrlKey||event.metaKey){hs.datepicker._gotoToday(event.target)}handled=event.ctrlKey||event.metaKey;break;case 37:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,(isRTL?+1:-1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){hs.datepicker._adjustDate(event.target,(event.ctrlKey?-hs.datepicker._get(inst,"stepBigMonths"):-hs.datepicker._get(inst,"stepMonths")),"M")}break;case 38:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,-7,"D")}handled=event.ctrlKey||event.metaKey;break;case 39:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,(isRTL?-1:+1),"D")}handled=event.ctrlKey||event.metaKey;if(event.originalEvent.altKey){hs.datepicker._adjustDate(event.target,(event.ctrlKey?+hs.datepicker._get(inst,"stepBigMonths"):+hs.datepicker._get(inst,"stepMonths")),"M")}break;case 40:if(event.ctrlKey||event.metaKey){hs.datepicker._adjustDate(event.target,+7,"D")}handled=event.ctrlKey||event.metaKey;break;default:handled=false}}else{if(event.keyCode==36&&event.ctrlKey){hs.datepicker._showDatepicker(this)}else{handled=false}}if(handled){event.preventDefault();event.stopPropagation()}},_doKeyPress:function(event){var inst=hs.datepicker._getInst(event.target);if(hs.datepicker._get(inst,"constrainInput")){var chars=hs.datepicker._possibleChars(hs.datepicker._get(inst,"dateFormat"));var chr=String.fromCharCode(event.charCode==undefined?event.keyCode:event.charCode);return event.ctrlKey||event.metaKey||(chr<" "||!chars||chars.indexOf(chr)>-1)}},_doKeyUp:function(event){var inst=hs.datepicker._getInst(event.target);if(inst.input.val()!=inst.lastVal){try{
|
36 |
+
var date=hs.datepicker.parseDate(hs.datepicker._get(inst,"dateFormat"),(inst.input?inst.input.val():null),hs.datepicker._getFormatConfig(inst));if(date){hs.datepicker._setDateFromField(inst);
|
37 |
+
hs.datepicker._updateAlternate(inst);hs.datepicker._updateDatepicker(inst)}}catch(event){hs.datepicker.log(event)}}return true},_showDatepicker:function(input){input=input.target||input;
|
38 |
+
if(input.nodeName.toLowerCase()!="input"){input=hs("input",input.parentNode)[0]}if(hs.datepicker._isDisabledDatepicker(input)||hs.datepicker._lastInput==input){return}
|
39 |
+
var inst=hs.datepicker._getInst(input);if(hs.datepicker._curInst&&hs.datepicker._curInst!=inst){if(hs.datepicker._datepickerShowing){hs.datepicker._triggerOnClose(hs.datepicker._curInst)}
|
40 |
+
hs.datepicker._curInst.dpDiv.stop(true,true)}var beforeShow=hs.datepicker._get(inst,"beforeShow");extendRemove(inst.settings,(beforeShow?beforeShow.apply(input,[input,inst]):{}));
|
41 |
+
inst.lastVal=null;hs.datepicker._lastInput=input;hs.datepicker._setDateFromField(inst);if(hs.datepicker._inDialog){input.value=""}
|
42 |
+
if(!hs.datepicker._pos){hs.datepicker._pos=hs.datepicker._findPos(input);hs.datepicker._pos[1]+=input.offsetHeight}var isFixed=false;hs(input).parents().each(function(){isFixed|=hs(this).css("position")=="fixed";return !isFixed});
|
43 |
+
if(isFixed&&hs.browser.opera){hs.datepicker._pos[0]-=document.documentElement.scrollLeft;hs.datepicker._pos[1]-=document.documentElement.scrollTop}
|
44 |
+
var offset={left:hs.datepicker._pos[0],top:hs.datepicker._pos[1]};hs.datepicker._pos=null;inst.dpDiv.empty();inst.dpDiv.css({position:"absolute",display:"block",top:"-1000px"});
|
45 |
+
hs.datepicker._updateDatepicker(inst);offset=hs.datepicker._checkOffset(inst,offset,isFixed);inst.dpDiv.css({position:(hs.datepicker._inDialog&&hs.blockUI?"static":(isFixed?"fixed":"absolute")),display:"none",left:offset.left+"px",top:offset.top+"px"});
|
46 |
+
if(!inst.inline){var showAnim=hs.datepicker._get(inst,"showAnim");var duration=hs.datepicker._get(inst,"duration");
|
47 |
+
var postProcess=function(){var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){var borders=hs.datepicker._getBorders(inst.dpDiv);cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}};inst.dpDiv.zIndex(hs(input).zIndex()+1);hs.datepicker._datepickerShowing=true;if(hs.effects&&hs.effects[showAnim]){inst.dpDiv.show(showAnim,hs.datepicker._get(inst,"showOptions"),duration,postProcess)}
|
48 |
+
else{inst.dpDiv[showAnim||"show"]((showAnim?duration:null),postProcess)}if(!showAnim||!duration){postProcess()}if(inst.input.is(":visible")&&!inst.input.is(":disabled")){inst.input.focus()}hs.datepicker._curInst=inst}},_updateDatepicker:function(inst){var self=this;self.maxRows=4;var borders=hs.datepicker._getBorders(inst.dpDiv);instActive=inst;inst.dpDiv.empty().append(this._generateHTML(inst));var cover=inst.dpDiv.find("iframe.ui-datepicker-cover");if(!!cover.length){cover.css({left:-borders[0],top:-borders[1],width:inst.dpDiv.outerWidth(),height:inst.dpDiv.outerHeight()})}inst.dpDiv.find("."+this._dayOverClass+" a").mouseover();var numMonths=this._getNumberOfMonths(inst);var cols=numMonths[1];var width=17;inst.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width("");if(cols>1){inst.dpDiv.addClass("ui-datepicker-multi-"+cols).css("width",(width*cols)+"em")}inst.dpDiv[(numMonths[0]!=1||numMonths[1]!=1?"add":"remove")+"Class"]("ui-datepicker-multi");inst.dpDiv[(this._get(inst,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl");if(inst==hs.datepicker._curInst&&hs.datepicker._datepickerShowing&&inst.input&&inst.input.is(":visible")&&!inst.input.is(":disabled")&&inst.input[0]!=document.activeElement){inst.input.focus()}if(inst.yearshtml){var origyearshtml=inst.yearshtml;setTimeout(function(){if(origyearshtml===inst.yearshtml&&inst.yearshtml){inst.dpDiv.find("select.ui-datepicker-year:first").replaceWith(inst.yearshtml)}origyearshtml=inst.yearshtml=null},0)}},_getBorders:function(elem){var convert=function(value){return{thin:1,medium:2,thick:3}[value]||value};return[parseFloat(convert(elem.css("border-left-width"))),parseFloat(convert(elem.css("border-top-width")))]},_checkOffset:function(inst,offset,isFixed){var dpWidth=inst.dpDiv.outerWidth();var dpHeight=inst.dpDiv.outerHeight();var inputWidth=inst.input?inst.input.outerWidth():0;var inputHeight=inst.input?inst.input.outerHeight():0;var viewWidth=document.documentElement.clientWidth+hs(document).scrollLeft();var viewHeight=document.documentElement.clientHeight+hs(document).scrollTop();offset.left-=(this._get(inst,"isRTL")?(dpWidth-inputWidth):0);offset.left-=(isFixed&&offset.left==inst.input.offset().left)?hs(document).scrollLeft():0;offset.top-=(isFixed&&offset.top==(inst.input.offset().top+inputHeight))?hs(document).scrollTop():0;offset.left-=Math.min(offset.left,(offset.left+dpWidth>viewWidth&&viewWidth>dpWidth)?Math.abs(offset.left+dpWidth-viewWidth):0);offset.top-=Math.min(offset.top,(offset.top+dpHeight>viewHeight&&viewHeight>dpHeight)?Math.abs(dpHeight+inputHeight):0);return offset},_findPos:function(obj){var inst=this._getInst(obj);var isRTL=this._get(inst,"isRTL");while(obj&&(obj.type=="hidden"||obj.nodeType!=1||hs.expr.filters.hidden(obj))){obj=obj[isRTL?"previousSibling":"nextSibling"]}var position=hs(obj).offset();return[position.left,position.top]},_triggerOnClose:function(inst){var onClose=this._get(inst,"onClose");if(onClose){onClose.apply((inst.input?inst.input[0]:null),[(inst.input?inst.input.val():""),inst])}},_hideDatepicker:function(input){var inst=this._curInst;if(!inst||(input&&inst!=hs.data(input,PROP_NAME))){return}if(this._datepickerShowing){var showAnim=this._get(inst,"showAnim");var duration=this._get(inst,"duration");var postProcess=function(){hs.datepicker._tidyDialog(inst);this._curInst=null};if(hs.effects&&hs.effects[showAnim]){inst.dpDiv.hide(showAnim,hs.datepicker._get(inst,"showOptions"),duration,postProcess)}else{inst.dpDiv[(showAnim=="slideDown"?"slideUp":(showAnim=="fadeIn"?"fadeOut":"hide"))]((showAnim?duration:null),postProcess)}if(!showAnim){postProcess()}hs.datepicker._triggerOnClose(inst);this._datepickerShowing=false;this._lastInput=null;if(this._inDialog){this._dialogInput.css({position:"absolute",left:"0",top:"-100px"});if(hs.blockUI){hs.unblockUI();hs("body").append(this.dpDiv)}}this._inDialog=false}},_tidyDialog:function(inst){inst.dpDiv.removeClass(this._dialogClass).unbind(".ui-datepicker-calendar")},_checkExternalClick:function(event){if(!hs.datepicker._curInst){return}var hstarget=hs(event.target);if(hstarget[0].id!=hs.datepicker._mainDivId&&hstarget.parents("#"+hs.datepicker._mainDivId).length==0&&!hstarget.hasClass(hs.datepicker.markerClassName)&&!hstarget.hasClass(hs.datepicker._triggerClass)&&hs.datepicker._datepickerShowing&&!(hs.datepicker._inDialog&&hs.blockUI)){hs.datepicker._hideDatepicker()}},_adjustDate:function(id,offset,period){var target=hs(id);var inst=this._getInst(target[0]);if(this._isDisabledDatepicker(target[0])){return}this._adjustInstDate(inst,offset+(period=="M"?this._get(inst,"showCurrentAtPos"):0),period);this._updateDatepicker(inst)},_gotoToday:function(id){var target=hs(id);var inst=this._getInst(target[0]);if(this._get(inst,"gotoCurrent")&&inst.currentDay){inst.selectedDay=inst.currentDay;inst.drawMonth=inst.selectedMonth=inst.currentMonth;inst.drawYear=inst.selectedYear=inst.currentYear}else{
|
49 |
+
|
50 |
+
var date=new this.CDate();inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear()}this._notifyChange(inst);this._adjustDate(target)},_selectMonthYear:function(id,select,period){var target=hs(id);var inst=this._getInst(target[0]);inst._selectingMonthYear=false;inst["selected"+(period=="M"?"Month":"Year")]=inst["draw"+(period=="M"?"Month":"Year")]=parseInt(select.options[select.selectedIndex].value,10);this._notifyChange(inst);this._adjustDate(target)},_clickMonthYear:function(id){var target=hs(id);var inst=this._getInst(target[0]);if(inst.input&&inst._selectingMonthYear){setTimeout(function(){inst.input.focus()},0)}inst._selectingMonthYear=!inst._selectingMonthYear},_selectDay:function(id,month,year,td){var target=hs(id);if(hs(td).hasClass(this._unselectableClass)||this._isDisabledDatepicker(target[0])){return}var inst=this._getInst(target[0]);inst.selectedDay=inst.currentDay=hs("a",td).html();inst.selectedMonth=inst.currentMonth=month;inst.selectedYear=inst.currentYear=year;this._selectDate(id,this._formatDate(inst,inst.currentDay,inst.currentMonth,inst.currentYear))},_clearDate:function(id){var target=hs(id);var inst=this._getInst(target[0]);this._selectDate(target,"")},_selectDate:function(id,dateStr){var target=hs(id);var inst=this._getInst(target[0]);
|
51 |
+
|
52 |
+
|
53 |
+
dateStr=(dateStr!=null?dateStr:this._formatDate(altFormat,date,this._getFormatConfig(inst)));
|
54 |
+
|
55 |
+
|
56 |
+
if(inst.input){
|
57 |
+
|
58 |
+
inst.input.val(dateStr)
|
59 |
+
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
this._updateAlternate(inst);
|
64 |
+
|
65 |
+
|
66 |
+
///////////// inja ro baraye worpdres taghir dadam ke miladi nesheoon bede : aslish in bood : var onSelect=this._get(inst,"onSelect");
|
67 |
+
var onSelect=function(dateStr, inst) {
|
68 |
+
var selectedJalaliDate = new JalaliDate(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
|
69 |
+
var date = selectedJalaliDate.getGregorianDate();
|
70 |
+
var month= date.getMonth()+1;
|
71 |
+
var day = date.getDate() < 10 ? '0'+date.getDate() : date.getDate();
|
72 |
+
var months = date.getMonth() < 9 ? '0'+month : month;
|
73 |
+
hs(this).val(date.getFullYear() + '-' + months + '-' + day);
|
74 |
+
};
|
75 |
+
|
76 |
+
if(onSelect){onSelect.apply((inst.input?inst.input[0]:null),[dateStr,inst])}else{if(inst.input){inst.input.trigger("change")}}if(inst.inline){this._updateDatepicker(inst)}else{this._hideDatepicker();this._lastInput=inst.input[0];
|
77 |
+
|
78 |
+
if(typeof(inst.input[0])!="object"){inst.input.focus()}this._lastInput=null}},_updateAlternate:function(inst){var altField=this._get(inst,"altField");
|
79 |
+
|
80 |
+
if(altField){var altFormat=this._get(inst,"altFormat")||this._get(inst,"dateFormat");
|
81 |
+
|
82 |
+
var date=this._getDate(inst);
|
83 |
+
|
84 |
+
var dateStr=this.formatDate(altFormat,date,this._getFormatConfig(inst));
|
85 |
+
|
86 |
+
|
87 |
+
|
88 |
+
hs(altField).each(function(){hs(this).val(dateStr)})}},noWeekends:function(date){var day=date.getDay();return[(day>0&&day<6),""]},iso8601Week:function(date){var checkDate=new Date(date.getTime());checkDate.setDate(checkDate.getDate()+4-(checkDate.getDay()||7));var time=checkDate.getTime();checkDate.setMonth(0);checkDate.setDate(1);return Math.floor(Math.round((time-checkDate)/86400000)/7)+1},parseDate:function(format,value,settings){if(format==null||value==null){throw"Invalid arguments"}value=(typeof value=="object"?value.toString():value+"");if(value==""){return null}var shortYearCutoff=(settings?settings.shortYearCutoff:null)||this._defaults.shortYearCutoff;shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new this.CDate().getFullYear()%100+parseInt(shortYearCutoff,10));var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var year=-1;var month=-1;var day=-1;var doy=-1;var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var getNumber=function(match){var isDoubled=lookAhead(match);var size=(match=="@"?14:(match=="!"?20:(match=="y"&&isDoubled?4:(match=="o"?3:2))));var digits=new RegExp("^\\d{1,"+size+"}");var num=value.substring(iValue).match(digits);if(!num){throw"Missing number at position "+iValue}iValue+=num[0].length;return parseInt(num[0],10)};var getName=function(match,shortNames,longNames){var names=hs.map(lookAhead(match)?longNames:shortNames,function(v,k){return[[k,v]]}).sort(function(a,b){return -(a[1].length-b[1].length)});var index=-1;hs.each(names,function(i,pair){var name=pair[1];if(value.substr(iValue,name.length).toLowerCase()==name.toLowerCase()){index=pair[0];iValue+=name.length;return false}});if(index!=-1){return index+1}else{throw"Unknown name at position "+iValue}};var checkLiteral=function(){if(value.charAt(iValue)!=format.charAt(iFormat)){throw"Unexpected literal at position "+iValue}iValue++};var iValue=0;for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{checkLiteral()}}else{switch(format.charAt(iFormat)){case"d":day=getNumber("d");break;case"D":getName("D",dayNamesShort,dayNames);break;case"o":doy=getNumber("o");break;case"m":month=getNumber("m");break;case"M":month=getName("M",monthNamesShort,monthNames);break;case"y":year=getNumber("y");break;case"@":
|
89 |
+
|
90 |
+
var date=new this.CDate(getNumber("@"));year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"!":
|
91 |
+
var date=new Date((getNumber("!")-this._ticksTo1970)/10000);year=date.getFullYear();month=date.getMonth()+1;day=date.getDate();break;case"'":if(lookAhead("'")){checkLiteral()}else{literal=true}break;default:checkLiteral()}}}if(iValue<value.length){throw"Extra/unparsed characters found in date: "+value.substring(iValue)}if(year==-1){year=new this.CDate().getFullYear()}else{if(year<100){year+=new this.CDate().getFullYear()-new this.CDate().getFullYear()%100+(year<=shortYearCutoff?0:-100)}}if(doy>-1){month=1;day=doy;do{var dim=this._getDaysInMonth(year,month-1);if(day<=dim){break}month++;day-=dim}while(true)}
|
92 |
+
var date=this._daylightSavingAdjust(new this.CDate(year,month-1,day));if(date.getFullYear()!=year||date.getMonth()+1!=month||date.getDate()!=day){throw"Invalid date"}return date},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:(((1970-1)*365+Math.floor(1970/4)-Math.floor(1970/100)+Math.floor(1970/400))*24*60*60*10000000),formatDate:function(format,date,settings){if(!date){return""}var dayNamesShort=(settings?settings.dayNamesShort:null)||this._defaults.dayNamesShort;var dayNames=(settings?settings.dayNames:null)||this._defaults.dayNames;var monthNamesShort=(settings?settings.monthNamesShort:null)||this._defaults.monthNamesShort;var monthNames=(settings?settings.monthNames:null)||this._defaults.monthNames;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};var formatNumber=function(match,value,len){var num=""+value;if(lookAhead(match)){while(num.length<len){num="0"+num}}return num};var formatName=function(match,value,shortNames,longNames){return(lookAhead(match)?longNames[value]:shortNames[value])};var output="";var literal=false;if(date){for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{output+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":output+=formatNumber("d",date.getDate(),2);break;case"D":output+=formatName("D",date.getDay(),dayNamesShort,dayNames);break;case"o":output+=formatNumber("o",Math.round((new this.CDate(date.getFullYear(),date.getMonth(),date.getDate()).getTime()-new this.CDate(date.getFullYear(),0,0).getTime())/86400000),3);break;case"m":output+=formatNumber("m",date.getMonth()+1,2);break;case"M":output+=formatName("M",date.getMonth(),monthNamesShort,monthNames);break;case"y":output+=(lookAhead("y")?date.getFullYear():(date.getYear()%100<10?"0":"")+date.getYear()%100);break;case"@":output+=date.getTime();break;case"!":output+=date.getTime()*10000+this._ticksTo1970;break;case"'":if(lookAhead("'")){output+="'"}else{literal=true}break;default:output+=format.charAt(iFormat)}}}}return output},_possibleChars:function(format){var chars="";var literal=false;var lookAhead=function(match){var matches=(iFormat+1<format.length&&format.charAt(iFormat+1)==match);if(matches){iFormat++}return matches};for(var iFormat=0;iFormat<format.length;iFormat++){if(literal){if(format.charAt(iFormat)=="'"&&!lookAhead("'")){literal=false}else{chars+=format.charAt(iFormat)}}else{switch(format.charAt(iFormat)){case"d":case"m":case"y":case"@":chars+="0123456789";break;case"D":case"M":return null;case"'":if(lookAhead("'")){chars+="'"}else{literal=true}break;default:chars+=format.charAt(iFormat)}}}return chars},_get:function(inst,name){return inst.settings[name]!==undefined?inst.settings[name]:this._defaults[name]},_setDateFromField:function(inst,noDefault){if(inst.input.val()==inst.lastVal){return}var dateFormat=this._get(inst,"dateFormat");var dates=inst.lastVal=inst.input?inst.input.val():null;var date,defaultDate;date=defaultDate=this._getDefaultDate(inst);var settings=this._getFormatConfig(inst);try{date=this.parseDate(dateFormat,dates,settings)||defaultDate}catch(event){this.log(event);dates=(noDefault?"":dates)}inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();inst.currentDay=(dates?date.getDate():0);inst.currentMonth=(dates?date.getMonth():0);inst.currentYear=(dates?date.getFullYear():0);this._adjustInstDate(inst)},_getDefaultDate:function(inst){this.CDate=this._get(inst,"calendar");return this._restrictMinMax(inst,this._determineDate(inst,this._get(inst,"defaultDate"),new this.CDate()))},_determineDate:function(inst,date,defaultDate){
|
93 |
+
var Date=this.CDate;var offsetNumeric=function(offset){
|
94 |
+
var date=new Date();date.setDate(date.getDate()+offset);return date};var offsetString=function(offset){try{return hs.datepicker.parseDate(hs.datepicker._get(inst,"dateFormat"),offset,hs.datepicker._getFormatConfig(inst))}catch(e){}
|
95 |
+
var date=(offset.toLowerCase().match(/^c/)?hs.datepicker._getDate(inst):null)||new Date();var year=date.getFullYear();var month=date.getMonth();var day=date.getDate();var pattern=/([+-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g;var matches=pattern.exec(offset);while(matches){switch(matches[2]||"d"){case"d":case"D":day+=parseInt(matches[1],10);break;case"w":case"W":day+=parseInt(matches[1],10)*7;break;case"m":case"M":month+=parseInt(matches[1],10);day=Math.min(day,hs.datepicker._getDaysInMonth(year,month));break;case"y":case"Y":year+=parseInt(matches[1],10);day=Math.min(day,hs.datepicker._getDaysInMonth(year,month));break}matches=pattern.exec(offset)}return new Date(year,month,day)};var newDate=(date==null||date===""?defaultDate:(typeof date=="string"?offsetString(date):(typeof date=="number"?(isNaN(date)?defaultDate:offsetNumeric(date)):new Date(date.getTime()))));newDate=(newDate&&newDate.toString()=="Invalid Date"?defaultDate:newDate);if(newDate){newDate.setHours(0);newDate.setMinutes(0);newDate.setSeconds(0);newDate.setMilliseconds(0)}return this._daylightSavingAdjust(newDate)},_daylightSavingAdjust:function(date){if(!date){return null}date.setHours(date.getHours()>12?date.getHours()+2:0);return date},_setDate:function(inst,date,noChange){var clear=!date;var origMonth=inst.selectedMonth;var origYear=inst.selectedYear;this.CDate=this._get(inst,"calendar");var newDate=this._restrictMinMax(inst,this._determineDate(inst,date,new this.CDate()));inst.selectedDay=inst.currentDay=newDate.getDate();inst.drawMonth=inst.selectedMonth=inst.currentMonth=newDate.getMonth();inst.drawYear=inst.selectedYear=inst.currentYear=newDate.getFullYear();if((origMonth!=inst.selectedMonth||origYear!=inst.selectedYear)&&!noChange){this._notifyChange(inst)}this._adjustInstDate(inst);if(inst.input){inst.input.val(clear?"":this._formatDate(inst))}},_getDate:function(inst){this.CDate=this._get(inst,"calendar");var startDate=(!inst.currentYear||(inst.input&&inst.input.val()=="")?null:this._daylightSavingAdjust(new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));return startDate},_generateHTML:function(inst){var today=new this.CDate();today=this._daylightSavingAdjust(new this.CDate(today.getFullYear(),today.getMonth(),today.getDate()));var isRTL=this._get(inst,"isRTL");var showButtonPanel=this._get(inst,"showButtonPanel");var hideIfNoPrevNext=this._get(inst,"hideIfNoPrevNext");var navigationAsDateFormat=this._get(inst,"navigationAsDateFormat");var numMonths=this._getNumberOfMonths(inst);var showCurrentAtPos=this._get(inst,"showCurrentAtPos");var stepMonths=this._get(inst,"stepMonths");var isMultiMonth=(numMonths[0]!=1||numMonths[1]!=1);var currentDate=this._daylightSavingAdjust((!inst.currentDay?new Date(9999,9,9):new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var drawMonth=inst.drawMonth-showCurrentAtPos;var drawYear=inst.drawYear;if(drawMonth<0){drawMonth+=12;drawYear--}if(maxDate){var maxDraw=this._daylightSavingAdjust(new this.CDate(maxDate.getFullYear(),maxDate.getMonth()-(numMonths[0]*numMonths[1])+1,maxDate.getDate()));maxDraw=(minDate&&this._compareDate(maxDraw,"<",minDate)?minDate:maxDraw);while(this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,1))>maxDraw){drawMonth--;if(drawMonth<0){drawMonth=11;drawYear--}}}inst.drawMonth=drawMonth;inst.drawYear=drawYear;var prevText=this._get(inst,"prevText");prevText=(!navigationAsDateFormat?prevText:this.formatDate(prevText,this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth-stepMonths,1)),this._getFormatConfig(inst)));var prev=(this._canAdjustMonth(inst,-1,drawYear,drawMonth)?'<a style="direction:ltr" class="ui-datepicker-prev ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', -"+stepMonths+", 'M');\" title=\""+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>":(hideIfNoPrevNext?"":'<a style="direction:ltr" class="ui-datepicker-prev ui-corner-all ui-state-disabled" title="'+prevText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"e":"w")+'">'+prevText+"</span></a>"));var nextText=this._get(inst,"nextText");nextText=(!navigationAsDateFormat?nextText:this.formatDate(nextText,this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth+stepMonths,1)),this._getFormatConfig(inst)));var next=(this._canAdjustMonth(inst,+1,drawYear,drawMonth)?'<a style="direction:ltr" class="ui-datepicker-next ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._adjustDate('#"+inst.id+"', +"+stepMonths+", 'M');\" title=\""+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>":(hideIfNoPrevNext?"":'<a style="direction:ltr" class="ui-datepicker-next ui-corner-all ui-state-disabled" title="'+nextText+'"><span class="ui-icon ui-icon-circle-triangle-'+(isRTL?"w":"e")+'">'+nextText+"</span></a>"));var currentText=this._get(inst,"currentText");var gotoDate=(this._get(inst,"gotoCurrent")&&inst.currentDay?currentDate:today);currentText=(!navigationAsDateFormat?currentText:this.formatDate(currentText,gotoDate,this._getFormatConfig(inst)));var controls=(!inst.inline?'<button type="button" class="ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all" onclick="DP_hs_'+dpuuid+'.datepicker._hideDatepicker();">'+this._get(inst,"closeText")+"</button>":"");var buttonPanel=(showButtonPanel)?'<div class="ui-datepicker-buttonpane ui-widget-content">'+(isRTL?controls:"")+(this._isInRange(inst,gotoDate)?'<button type="button" class="ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all" onclick="DP_hs_'+dpuuid+".datepicker._gotoToday('#"+inst.id+"');\">"+currentText+"</button>":"")+(isRTL?"":controls)+"</div>":"";var firstDay=parseInt(this._get(inst,"firstDay"),10);firstDay=(isNaN(firstDay)?0:firstDay);var showWeek=this._get(inst,"showWeek");var dayNames=this._get(inst,"dayNames");var dayNamesShort=this._get(inst,"dayNamesShort");var dayNamesMin=this._get(inst,"dayNamesMin");var monthNames=this._get(inst,"monthNames");var monthNamesShort=this._get(inst,"monthNamesShort");var beforeShowDay=this._get(inst,"beforeShowDay");var showOtherMonths=this._get(inst,"showOtherMonths");var selectOtherMonths=this._get(inst,"selectOtherMonths");var calculateWeek=this._get(inst,"calculateWeek")||this.iso8601Week;var defaultDate=this._getDefaultDate(inst);var html="";for(var row=0;row<numMonths[0];row++){var group="";this.maxRows=4;for(var col=0;col<numMonths[1];col++){var selectedDate=this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,inst.selectedDay));var cornerClass=" ui-corner-all";var calender="";if(isMultiMonth){calender+='<div class="ui-datepicker-group';if(numMonths[1]>1){switch(col){case 0:calender+=" ui-datepicker-group-first";cornerClass=" ui-corner-"+(isRTL?"right":"left");break;case numMonths[1]-1:calender+=" ui-datepicker-group-last";cornerClass=" ui-corner-"+(isRTL?"left":"right");break;default:calender+=" ui-datepicker-group-middle";cornerClass="";break}}calender+='">'}calender+='<div class="ui-datepicker-header ui-widget-header ui-helper-clearfix'+cornerClass+'">'+(/all|left/.test(cornerClass)&&row==0?(isRTL?next:prev):"")+(/all|right/.test(cornerClass)&&row==0?(isRTL?prev:next):"")+this._generateMonthYearHeader(inst,drawMonth,drawYear,minDate,maxDate,row>0||col>0,monthNames,monthNamesShort)+'</div><table class="ui-datepicker-calendar"><thead><tr>';var thead=(showWeek?'<th class="ui-datepicker-week-col">'+this._get(inst,"weekHeader")+"</th>":"");for(var dow=0;dow<7;dow++){var day=(dow+firstDay)%7;thead+="<th"+((dow+firstDay+6)%7>=5?' class="ui-datepicker-week-end"':"")+'><span title="'+dayNames[day]+'">'+dayNamesMin[day]+"</span></th>"}calender+=thead+"</tr></thead><tbody>";var daysInMonth=this._getDaysInMonth(drawYear,drawMonth);if(drawYear==inst.selectedYear&&drawMonth==inst.selectedMonth){inst.selectedDay=Math.min(inst.selectedDay,daysInMonth)}var leadDays=(this._getFirstDayOfMonth(drawYear,drawMonth)-firstDay+7)%7;var curRows=Math.ceil((leadDays+daysInMonth)/7);var numRows=(isMultiMonth?this.maxRows>curRows?this.maxRows:curRows:curRows);this.maxRows=numRows;var printDate=this._daylightSavingAdjust(new this.CDate(drawYear,drawMonth,1-leadDays));for(var dRow=0;dRow<numRows;dRow++){calender+="<tr>";var tbody=(!showWeek?"":'<td class="ui-datepicker-week-col">'+this._get(inst,"calculateWeek")(printDate)+"</td>");for(var dow=0;dow<7;dow++){var daySettings=(beforeShowDay?beforeShowDay.apply((inst.input?inst.input[0]:null),[printDate]):[true,""]);var otherMonth=(printDate.getMonth()!=drawMonth);var unselectable=(otherMonth&&!selectOtherMonths)||!daySettings[0]||((minDate&&this._compareDate(printDate,"<",minDate))||(maxDate&&this._compareDate(printDate,">",maxDate)));tbody+='<td class="'+((dow+firstDay+6)%7>=5?" ui-datepicker-week-end":"")+(otherMonth?" ui-datepicker-other-month":"")+((printDate.getTime()==selectedDate.getTime()&&drawMonth==inst.selectedMonth&&inst._keyEvent)||(defaultDate.getTime()==printDate.getTime()&&defaultDate.getTime()==selectedDate.getTime())?" "+this._dayOverClass:"")+(unselectable?" "+this._unselectableClass+" ui-state-disabled":"")+(otherMonth&&!showOtherMonths?"":" "+daySettings[1]+(printDate.getTime()==currentDate.getTime()?" "+this._currentClass:"")+(printDate.getTime()==today.getTime()?" ui-datepicker-today":""))+'"'+((!otherMonth||showOtherMonths)&&daySettings[2]?' title="'+daySettings[2]+'"':"")+(unselectable?"":' onclick="DP_hs_'+dpuuid+".datepicker._selectDay('#"+inst.id+"',"+printDate.getMonth()+","+printDate.getFullYear()+', this);return false;"')+">"+(otherMonth&&!showOtherMonths?" ":(unselectable?'<span class="ui-state-default">'+printDate.getDate()+"</span>":'<a class="ui-state-default'+(printDate.getTime()==today.getTime()?" ui-state-highlight":"")+(printDate.getTime()==currentDate.getTime()?" ui-state-active":"")+(otherMonth?" ui-priority-secondary":"")+'" href="#">'+printDate.getDate()+"</a>"))+"</td>";printDate.setDate(printDate.getDate()+1);printDate=this._daylightSavingAdjust(printDate)}calender+=tbody+"</tr>"}drawMonth++;if(drawMonth>11){drawMonth=0;drawYear++}calender+="</tbody></table>"+(isMultiMonth?"</div>"+((numMonths[0]>0&&col==numMonths[1]-1)?'<div class="ui-datepicker-row-break"></div>':""):"");group+=calender}html+=group}html+=buttonPanel+(hs.browser.msie&&parseInt(hs.browser.version,10)<7&&!inst.inline?'<iframe src="javascript:false;" class="ui-datepicker-cover" frameborder="0"></iframe>':"");inst._keyEvent=false;return html},_generateMonthYearHeader:function(inst,drawMonth,drawYear,minDate,maxDate,secondary,monthNames,monthNamesShort){var changeMonth=this._get(inst,"changeMonth");var changeYear=this._get(inst,"changeYear");var showMonthAfterYear=this._get(inst,"showMonthAfterYear");var html='<div class="ui-datepicker-title">';var monthHtml="";if(secondary||!changeMonth){monthHtml+='<span class="ui-datepicker-month">'+monthNames[drawMonth]+"</span>"}else{var inMinYear=(minDate&&minDate.getFullYear()==drawYear);var inMaxYear=(maxDate&&maxDate.getFullYear()==drawYear);monthHtml+='<select class="ui-datepicker-month" onchange="DP_hs_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'M');\" onclick=\"DP_hs_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(var month=0;month<12;month++){if((!inMinYear||month>=minDate.getMonth())&&(!inMaxYear||month<=maxDate.getMonth())){monthHtml+='<option value="'+month+'"'+(month==drawMonth?' selected="selected"':"")+">"+monthNamesShort[month]+"</option>"}}monthHtml+="</select>"}if(!showMonthAfterYear){html+=monthHtml+(secondary||!(changeMonth&&changeYear)?" ":"")}if(!inst.yearshtml){inst.yearshtml="";if(secondary||!changeYear){html+='<span class="ui-datepicker-year">'+drawYear+"</span>"}else{var years=this._get(inst,"yearRange").split(":");var thisYear=new this.CDate().getFullYear();var determineYear=function(value){var year=(value.match(/c[+-].*/)?drawYear+parseInt(value.substring(1),10):(value.match(/[+-].*/)?thisYear+parseInt(value,10):parseInt(value,10)));return(isNaN(year)?thisYear:year)};var year=determineYear(years[0]);var endYear=Math.max(year,determineYear(years[1]||""));year=(minDate?Math.max(year,minDate.getFullYear()):year);endYear=(maxDate?Math.min(endYear,maxDate.getFullYear()):endYear);inst.yearshtml+='<select class="ui-datepicker-year" onchange="DP_hs_'+dpuuid+".datepicker._selectMonthYear('#"+inst.id+"', this, 'Y');\" onclick=\"DP_hs_"+dpuuid+".datepicker._clickMonthYear('#"+inst.id+"');\">";for(;year<=endYear;year++){inst.yearshtml+='<option value="'+year+'"'+(year==drawYear?' selected="selected"':"")+">"+year+"</option>"}inst.yearshtml+="</select>";html+=inst.yearshtml;inst.yearshtml=null}}html+=this._get(inst,"yearSuffix");if(showMonthAfterYear){html+=(secondary||!(changeMonth&&changeYear)?" ":"")+monthHtml}html+="</div>";return html},_adjustInstDate:function(inst,offset,period){var year=inst.drawYear+(period=="Y"?offset:0);var month=inst.drawMonth+(period=="M"?offset:0);var day=Math.min(inst.selectedDay,this._getDaysInMonth(year,month))+(period=="D"?offset:0);
|
96 |
+
var date=this._restrictMinMax(inst,this._daylightSavingAdjust(new this.CDate(year,month,day)));inst.selectedDay=date.getDate();inst.drawMonth=inst.selectedMonth=date.getMonth();inst.drawYear=inst.selectedYear=date.getFullYear();if(period=="M"||period=="Y"){this._notifyChange(inst)}},_restrictMinMax:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");var newDate=(minDate&&this._compareDate(date,"<",minDate))?minDate:date;newDate=(maxDate&&this._compareDate(newDate,">",maxDate))?maxDate:newDate;return newDate},_notifyChange:function(inst){var onChange=this._get(inst,"onChangeMonthYear");if(onChange){onChange.apply((inst.input?inst.input[0]:null),[inst.selectedYear,inst.selectedMonth+1,inst])}},_getNumberOfMonths:function(inst){var numMonths=this._get(inst,"numberOfMonths");return(numMonths==null?[1,1]:(typeof numMonths=="number"?[1,numMonths]:numMonths))},_getMinMaxDate:function(inst,minMax){return this._determineDate(inst,this._get(inst,minMax+"Date"),null)},_getDaysInMonth:function(year,month){return 32-this._daylightSavingAdjust(new this.CDate(year,month,32)).getDate()},_getFirstDayOfMonth:function(year,month){return new this.CDate(year,month,1).getDay()},_canAdjustMonth:function(inst,offset,curYear,curMonth){var numMonths=this._getNumberOfMonths(inst);
|
97 |
+
var date=this._daylightSavingAdjust(new this.CDate(curYear,curMonth+(offset<0?offset:numMonths[0]*numMonths[1]),1));if(offset<0){date.setDate(this._getDaysInMonth(date.getFullYear(),date.getMonth()))}return this._isInRange(inst,date)},_isInRange:function(inst,date){var minDate=this._getMinMaxDate(inst,"min");var maxDate=this._getMinMaxDate(inst,"max");return((!minDate||date.getTime()>=minDate.getTime())&&(!maxDate||date.getTime()<=maxDate.getTime()))},_getFormatConfig:function(inst){var shortYearCutoff=this._get(inst,"shortYearCutoff");this.CDate=this._get(inst,"calendar");shortYearCutoff=(typeof shortYearCutoff!="string"?shortYearCutoff:new this.CDate().getFullYear()%100+parseInt(shortYearCutoff,10));return{shortYearCutoff:shortYearCutoff,dayNamesShort:this._get(inst,"dayNamesShort"),dayNames:this._get(inst,"dayNames"),monthNamesShort:this._get(inst,"monthNamesShort"),monthNames:this._get(inst,"monthNames")}},_formatDate:function(inst,day,month,year){if(!day){inst.currentDay=inst.selectedDay;inst.currentMonth=inst.selectedMonth;inst.currentYear=inst.selectedYear}
|
98 |
+
var date=(day?(typeof day=="object"?day:this._daylightSavingAdjust(new this.CDate(year,month,day))):this._daylightSavingAdjust(new this.CDate(inst.currentYear,inst.currentMonth,inst.currentDay)));return this.formatDate(this._get(inst,"dateFormat"),date,this._getFormatConfig(inst))},_compareDate:function(d1,op,d2){if(d1&&d2){if(d1.getGregorianDate){d1=d1.getGregorianDate()}if(d2.getGregorianDate){d2=d2.getGregorianDate()}if(op=="<"){return d1<d2}return d1>d2}else{return null}}});function bindHover(dpDiv){var selector="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return dpDiv.bind("mouseout",function(event){var elem=hs(event.target).closest(selector);if(!elem.length){return}elem.removeClass("ui-state-hover ui-datepicker-prev-hover ui-datepicker-next-hover")}).bind("mouseover",function(event){var elem=hs(event.target).closest(selector);if(hs.datepicker._isDisabledDatepicker(instActive.inline?dpDiv.parent()[0]:instActive.input[0])||!elem.length){return}elem.parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover");elem.addClass("ui-state-hover");if(elem.hasClass("ui-datepicker-prev")){elem.addClass("ui-datepicker-prev-hover")}if(elem.hasClass("ui-datepicker-next")){elem.addClass("ui-datepicker-next-hover")}})}function extendRemove(target,props){hs.extend(target,props);for(var name in props){if(props[name]==null||props[name]==undefined){target[name]=props[name]}}return target}function isArray(a){return(a&&((hs.browser.safari&&typeof a=="object"&&a.length)||(a.constructor&&a.constructor.toString().match(/\Array\(\)/))))}hs.fn.datepicker=function(options){if(!this.length){return this}if(!hs.datepicker.initialized){hs(document).mousedown(hs.datepicker._checkExternalClick).find("body").append(hs.datepicker.dpDiv);hs.datepicker.initialized=true}var otherArgs=Array.prototype.slice.call(arguments,1);if(typeof options=="string"&&(options=="isDisabled"||options=="getDate"||options=="widget")){return hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this[0]].concat(otherArgs))}if(options=="option"&&arguments.length==2&&typeof arguments[1]=="string"){return hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this[0]].concat(otherArgs))}return this.each(function(){typeof options=="string"?hs.datepicker["_"+options+"Datepicker"].apply(hs.datepicker,[this].concat(otherArgs)):hs.datepicker._attachDatepicker(this,options)})};hs.datepicker=new Datepicker();hs.datepicker.initialized=false;hs.datepicker.uuid=new Date().getTime();hs.datepicker.version="1.8.14";window["DP_hs_"+dpuuid]=hs
|
99 |
+
|
100 |
+
/*
|
101 |
+
JavaScript functions for the Fourmilab Calendar Converter
|
102 |
+
|
103 |
+
by John Walker -- September, MIM
|
104 |
+
http://www.fourmilab.ch/documents/calendar/
|
105 |
+
|
106 |
+
This program is in the public domain.
|
107 |
+
*/
|
108 |
+
function mod(d,c){return d-(c*Math.floor(d/c))}function leap_gregorian(a){return((a%4)==0)&&(!(((a%100)==0)&&((a%400)!=0)))}var GREGORIAN_EPOCH=1721425.5;function gregorian_to_jd(b,c,a){return(GREGORIAN_EPOCH-1)+(365*(b-1))+Math.floor((b-1)/4)+(-Math.floor((b-1)/100))+Math.floor((b-1)/400)+Math.floor((((367*c)-362)/12)+((c<=2)?0:(leap_gregorian(b)?-1:-2))+a)}function jd_to_gregorian(j){var g,m,e,b,l,a,n,c,f,k,h,d,i;g=Math.floor(j-0.5)+0.5;m=g-GREGORIAN_EPOCH;e=Math.floor(m/146097);b=mod(m,146097);l=Math.floor(b/36524);a=mod(b,36524);n=Math.floor(a/1461);c=mod(a,1461);f=Math.floor(c/365);h=(e*400)+(l*100)+(n*4)+f;if(!((l==4)||(f==4))){h++}d=g-gregorian_to_jd(h,1,1);i=((g<gregorian_to_jd(h,3,1))?0:(leap_gregorian(h)?1:2));month=Math.floor((((d+i)*12)+373)/367);day=(g-gregorian_to_jd(h,month,1))+1;return new Array(h,month,day)}function leap_islamic(a){return(((a*11)+14)%30)<11}var ISLAMIC_EPOCH=1948439.5;function islamic_to_jd(b,c,a){return(a+Math.ceil(29.5*(c-1))+(b-1)*354+Math.floor((3+(11*b))/30)+ISLAMIC_EPOCH)-1}function jd_to_islamic(a){var c,d,b;a=Math.floor(a)+0.5;c=Math.floor(((30*(a-ISLAMIC_EPOCH))+10646)/10631);d=Math.min(12,Math.ceil((a-(29+islamic_to_jd(c,1,1)))/29.5)+1);b=(a-islamic_to_jd(c,d,1))+1;return new Array(c,d,b)}function leap_persian(a){return((((((a-((a>0)?474:473))%2820)+474)+38)*682)%2816)<682}var PERSIAN_EPOCH=1948320.5;function persian_to_jd(b,e,a){var d,c;d=b-((b>=0)?474:473);c=474+mod(d,2820);return a+((e<=7)?((e-1)*31):(((e-1)*30)+6))+Math.floor(((c*682)-110)/2816)+(c-1)*365+Math.floor(d/2820)*1029983+(PERSIAN_EPOCH-1)}function jd_to_persian(j){var h,g,i,k,e,a,f,d,c,b;j=Math.floor(j)+0.5;k=j-persian_to_jd(475,1,1);e=Math.floor(k/1029983);a=mod(k,1029983);if(a==1029982){f=2820}else{d=Math.floor(a/366);c=mod(a,366);f=Math.floor(((2134*d)+(2816*c)+2815)/1028522)+d+1}h=f+(2820*e)+474;if(h<=0){h--}b=(j-persian_to_jd(h,1,1))+1;g=(b<=186)?Math.ceil(b/31):Math.ceil((b-6)/30);i=(j-persian_to_jd(h,g,1))+1;return new Array(h,g,i)};
|
109 |
+
// Farsi(Persian) support for hs UI Datepicker 1.8.14 with custom calendar support
|
110 |
+
hs(function(a){a.datepicker.regional.fa={calendar:JalaliDate,closeText:"بستن",prevText:"قبل",nextText:"بعد",currentText:"امروز",monthNames:["فروردين","ارديبهشت","خرداد","تير","مرداد","شهريور","مهر","آبان","آذر","دي","بهمن","اسفند"],monthNamesShort:["فروردين","ارديبهشت","خرداد","تير","مرداد","شهريور","مهر","آبان","آذر","دي","بهمن","اسفند"],dayNames:["يکشنبه","دوشنبه","سه شنبه","چهارشنبه","پنجشنبه","جمعه","شنبه"],dayNamesShort:["يک","دو","سه","چهار","پنج","جمعه","شنبه"],dayNamesMin:["ي","د","س","چ","پ","ج","ش"],weekHeader:"ه",dateFormat:"dd/mm/yy",firstDay:6,isRTL:true,showMonthAfterYear:false,yearSuffix:"",
|
111 |
+
calculateWeek:function(b){var c=new JalaliDate(b.getFullYear(),b.getMonth(),b.getDate()+(b.getDay()||7)-3);
|
112 |
+
return Math.floor(Math.round((c.getTime()-new JalaliDate(c.getFullYear(),0,1).getTime())/86400000)/7)+1}};
|
113 |
+
a.datepicker.setDefaults(a.datepicker.regional.fa)});
|
114 |
+
|
115 |
+
function JalaliDate(i,h,f)
|
116 |
+
{var d;var a;if(!isNaN(parseInt(i))&&!isNaN(parseInt(h))&&!isNaN(parseInt(f))){var c=j([parseInt(i,10),parseInt(h,10),parseInt(f,10)]);
|
117 |
+
e(new Date(c[0],c[1],c[2]))}else{e(i)}
|
118 |
+
function j(l){var k=0;if(l[1]<0){k=leap_persian(l[0]-1)?30:29;l[1]++}
|
119 |
+
var g=jd_to_gregorian(persian_to_jd(l[0],l[1]+1,l[2])-k);g[1]--;return g}
|
120 |
+
function b(k){var g=jd_to_persian(gregorian_to_jd(k[0],k[1]+1,k[2]));g[1]--;return g}function e(g)
|
121 |
+
{if(g&&g.getGregorianDate){g=g.getGregorianDate()}d=new Date(g);d.setHours(d.getHours()>12?d.getHours()+2:0);if(!d||d=="Invalid Date"||isNaN(d||!d.getDate()))
|
122 |
+
{d=new Date()}a=b([d.getFullYear(),d.getMonth(),d.getDate()]);return this}
|
123 |
+
this.getGregorianDate=function(){return d};this.setFullDate=e;
|
124 |
+
this.setMonth=function(l){a[1]=l;var k=j(a);
|
125 |
+
d=new Date(k[0],k[1],k[2]);a=b([k[0],k[1],k[2]])};
|
126 |
+
this.setDate=function(l){a[2]=l;var k=j(a);
|
127 |
+
d=new Date(k[0],k[1],k[2]);a=b([k[0],k[1],k[2]])};
|
128 |
+
this.getFullYear=function(){return a[0]};
|
129 |
+
this.getMonth=function(){return a[1]};
|
130 |
+
this.getDate=function(){return a[2]};
|
131 |
+
this.toString=function(){return a.join(",").toString()};
|
132 |
+
this.getDay=function(){return d.getDay()};
|
133 |
+
this.getHours=function(){return d.getHours()};
|
134 |
+
this.getMinutes=function(){return d.getMinutes()};
|
135 |
+
this.getSeconds=function(){return d.getSeconds()};
|
136 |
+
this.getTime=function(){return d.getTime()};
|
137 |
+
this.getTimeZoneOffset=function(){return d.getTimeZoneOffset()};
|
138 |
+
this.getYear=function(){return a[0]%100};
|
139 |
+
this.setHours=function(g){d.setHours(g)};
|
140 |
+
this.setMinutes=function(g){d.setMinutes(g)};
|
141 |
+
this.setSeconds=function(g){d.setSeconds(g)};
|
142 |
+
this.setMilliseconds=function(g){d.setMilliseconds(g)}
|
143 |
+
};
|
144 |
+
|
145 |
+
|
146 |
+
|
147 |
+
|
148 |
+
|
149 |
+
hs(function() {
|
150 |
+
|
151 |
+
hs('.hasDatepicker').datepicker({
|
152 |
+
changeMonth: true,
|
153 |
+
changeYear: true,
|
154 |
+
showButtonPanel: true,
|
155 |
+
onSelect: function(dateStr, inst) {
|
156 |
+
var selectedJalaliDate = new JalaliDate(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
|
157 |
+
var date = selectedJalaliDate.getGregorianDate();
|
158 |
+
var month= date.getMonth()+1;
|
159 |
+
var day = date.getDate() < 10 ? '0'+date.getDate() : date.getDate();
|
160 |
+
var months = date.getMonth() < 9 ? '0'+month : month;
|
161 |
+
hs(this).val(date.getFullYear() + '-' + months + '-' + day);
|
162 |
+
}
|
163 |
+
});
|
164 |
+
|
165 |
+
|
166 |
+
hs('#export_date_start').datepicker({
|
167 |
+
changeMonth: true,
|
168 |
+
changeYear: true,
|
169 |
+
showButtonPanel: true,
|
170 |
+
onSelect: function(dateStr, inst) {
|
171 |
+
var selectedJalaliDate = new JalaliDate(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
|
172 |
+
var date = selectedJalaliDate.getGregorianDate();
|
173 |
+
var month= date.getMonth()+1;
|
174 |
+
var day = date.getDate() < 10 ? '0'+date.getDate() : date.getDate();
|
175 |
+
var months = date.getMonth() < 9 ? '0'+month : month;
|
176 |
+
hs('#_sale_price_dates_to').datepicker('option', 'minDate', new JalaliDate(inst['selectedYear'], inst['selectedMonth'], inst['selectedDay']));
|
177 |
+
hs(this).val(date.getFullYear() + '-' + months + '-' + day);
|
178 |
+
}
|
179 |
+
});
|
180 |
+
|
181 |
+
|
182 |
+
hs('#export_date_end').datepicker({
|
183 |
+
changeMonth: true,
|
184 |
+
changeYear: true,
|
185 |
+
showButtonPanel: true,
|
186 |
+
onSelect: function(dateStr, inst) {
|
187 |
+
var selectedJalaliDate = new JalaliDate(inst.selectedYear, inst.selectedMonth, inst.selectedDay);
|
188 |
+
var date = selectedJalaliDate.getGregorianDate();
|
189 |
+
var month= date.getMonth()+1;
|
190 |
+
var day = date.getDate() < 10 ? '0'+date.getDate() : date.getDate();
|
191 |
+
var months = date.getMonth() < 9 ? '0'+month : month;
|
192 |
+
hs(this).val(date.getFullYear() + '-' + months + '-' + day);
|
193 |
+
}
|
194 |
+
});
|
195 |
+
|
196 |
+
|
197 |
+
|
198 |
+
});
|
199 |
+
|
200 |
+
|
201 |
+
|
202 |
+
|
203 |
+
});
|
include/Jalali.php
ADDED
@@ -0,0 +1,599 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php /* In The Name Of Allah */
|
2 |
+
|
3 |
+
/** Software Hijri_Shamsi , Solar(Jalali) Date and Time
|
4 |
+
Copyright(C)2011, Reza Gholampanahi , http://jdf.scr.ir
|
5 |
+
version 2.55 :: 1391/08/24 = 1433/12/18 = 2012/11/15 */
|
6 |
+
|
7 |
+
/* F */
|
8 |
+
function GF_jdate($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
9 |
+
|
10 |
+
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
11 |
+
|
12 |
+
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
13 |
+
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
14 |
+
$date=explode('_',date('H_i_j_n_O_P_s_w_Y',$ts));
|
15 |
+
list($j_y,$j_m,$j_d)=GF_gregorian_to_jalali($date[8],$date[3],$date[2]);
|
16 |
+
$doy=($j_m<7)?(($j_m-1)*31)+$j_d-1:(($j_m-7)*30)+$j_d+185;
|
17 |
+
$kab=($j_y%33%4-1==(int)($j_y%33*.05))?1:0;
|
18 |
+
$sl=strlen($format);
|
19 |
+
$out='';
|
20 |
+
for($i=0; $i<$sl; $i++){
|
21 |
+
$sub=substr($format,$i,1);
|
22 |
+
if($sub=='\\'){
|
23 |
+
$out.=substr($format,++$i,1);
|
24 |
+
continue;
|
25 |
+
}
|
26 |
+
switch($sub){
|
27 |
+
|
28 |
+
case'E':case'R':case'x':case'X':
|
29 |
+
$out.='http://jdf.scr.ir';
|
30 |
+
break;
|
31 |
+
|
32 |
+
case'B':case'e':case'g':
|
33 |
+
case'G':case'h':case'I':
|
34 |
+
case'T':case'u':case'Z':
|
35 |
+
$out.=date($sub,$ts);
|
36 |
+
break;
|
37 |
+
|
38 |
+
case'a':
|
39 |
+
$out.=($date[0]<12)?'ق.ظ':'ب.ظ';
|
40 |
+
break;
|
41 |
+
|
42 |
+
case'A':
|
43 |
+
$out.=($date[0]<12)?'قبل از ظهر':'بعد از ظهر';
|
44 |
+
break;
|
45 |
+
|
46 |
+
case'b':
|
47 |
+
$out.=(int)($j_m/3.1)+1;
|
48 |
+
break;
|
49 |
+
|
50 |
+
case'c':
|
51 |
+
$out.=$j_y.'/'.$j_m.'/'.$j_d.' ،'.$date[0].':'.$date[1].':'.$date[6].' '.$date[5];
|
52 |
+
break;
|
53 |
+
|
54 |
+
case'C':
|
55 |
+
$out.=(int)(($j_y+99)/100);
|
56 |
+
break;
|
57 |
+
|
58 |
+
case'd':
|
59 |
+
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
60 |
+
break;
|
61 |
+
|
62 |
+
case'D':
|
63 |
+
$out.=GF_jdate_words(array('kh'=>$date[7]),' ');
|
64 |
+
break;
|
65 |
+
|
66 |
+
case'f':
|
67 |
+
$out.=GF_jdate_words(array('ff'=>$j_m),' ');
|
68 |
+
break;
|
69 |
+
|
70 |
+
case'F':
|
71 |
+
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
72 |
+
break;
|
73 |
+
|
74 |
+
case'H':
|
75 |
+
$out.=$date[0];
|
76 |
+
break;
|
77 |
+
|
78 |
+
case'i':
|
79 |
+
$out.=$date[1];
|
80 |
+
break;
|
81 |
+
|
82 |
+
case'j':
|
83 |
+
$out.=$j_d;
|
84 |
+
break;
|
85 |
+
|
86 |
+
case'J':
|
87 |
+
$out.=GF_jdate_words(array('rr'=>$j_d),' ');
|
88 |
+
break;
|
89 |
+
|
90 |
+
case'k';
|
91 |
+
$out.=GF_tr_num(100-(int)($doy/($kab+365)*1000)/10,$tr_num);
|
92 |
+
break;
|
93 |
+
|
94 |
+
case'K':
|
95 |
+
$out.=GF_tr_num((int)($doy/($kab+365)*1000)/10,$tr_num);
|
96 |
+
break;
|
97 |
+
|
98 |
+
case'l':
|
99 |
+
$out.=GF_jdate_words(array('rh'=>$date[7]),' ');
|
100 |
+
break;
|
101 |
+
|
102 |
+
case'L':
|
103 |
+
$out.=$kab;
|
104 |
+
break;
|
105 |
+
|
106 |
+
case'm':
|
107 |
+
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
108 |
+
break;
|
109 |
+
|
110 |
+
case'M':
|
111 |
+
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
112 |
+
break;
|
113 |
+
|
114 |
+
case'n':
|
115 |
+
$out.=$j_m;
|
116 |
+
break;
|
117 |
+
|
118 |
+
case'N':
|
119 |
+
$out.=$date[7]+1;
|
120 |
+
break;
|
121 |
+
|
122 |
+
case'o':
|
123 |
+
$jdw=($date[7]==6)?0:$date[7]+1;
|
124 |
+
$dny=364+$kab-$doy;
|
125 |
+
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
126 |
+
break;
|
127 |
+
|
128 |
+
case'O':
|
129 |
+
$out.=$date[4];
|
130 |
+
break;
|
131 |
+
|
132 |
+
case'p':
|
133 |
+
$out.=GF_jdate_words(array('mb'=>$j_m),' ');
|
134 |
+
break;
|
135 |
+
|
136 |
+
case'P':
|
137 |
+
$out.=$date[5];
|
138 |
+
break;
|
139 |
+
|
140 |
+
case'q':
|
141 |
+
$out.=GF_jdate_words(array('sh'=>$j_y),' ');
|
142 |
+
break;
|
143 |
+
|
144 |
+
case'Q':
|
145 |
+
$out.=$kab+364-$doy;
|
146 |
+
break;
|
147 |
+
|
148 |
+
case'r':
|
149 |
+
$key=GF_jdate_words(array('rh'=>$date[7],'mm'=>$j_m));
|
150 |
+
$out.=$date[0].':'.$date[1].':'.$date[6].' '.$date[4]
|
151 |
+
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
152 |
+
break;
|
153 |
+
|
154 |
+
case's':
|
155 |
+
$out.=$date[6];
|
156 |
+
break;
|
157 |
+
|
158 |
+
case'S':
|
159 |
+
$out.='ام';
|
160 |
+
break;
|
161 |
+
|
162 |
+
case't':
|
163 |
+
$out.=($j_m!=12)?(31-(int)($j_m/6.5)):($kab+29);
|
164 |
+
break;
|
165 |
+
|
166 |
+
case'U':
|
167 |
+
$out.=$ts;
|
168 |
+
break;
|
169 |
+
|
170 |
+
case'v':
|
171 |
+
$out.=GF_jdate_words(array('ss'=>substr($j_y,2,2)),' ');
|
172 |
+
break;
|
173 |
+
|
174 |
+
case'V':
|
175 |
+
$out.=GF_jdate_words(array('ss'=>$j_y),' ');
|
176 |
+
break;
|
177 |
+
|
178 |
+
case'w':
|
179 |
+
$out.=($date[7]==6)?0:$date[7]+1;
|
180 |
+
break;
|
181 |
+
|
182 |
+
case'W':
|
183 |
+
$avs=(($date[7]==6)?0:$date[7]+1)-($doy%7);
|
184 |
+
if($avs<0)$avs+=7;
|
185 |
+
$num=(int)(($doy+$avs)/7);
|
186 |
+
if($avs<4){
|
187 |
+
$num++;
|
188 |
+
}elseif($num<1){
|
189 |
+
$num=($avs==4 or $avs==(($j_y%33%4-2==(int)($j_y%33*.05))?5:4))?53:52;
|
190 |
+
}
|
191 |
+
$aks=$avs+$kab;
|
192 |
+
if($aks==7)$aks=0;
|
193 |
+
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
194 |
+
break;
|
195 |
+
|
196 |
+
case'y':
|
197 |
+
$out.=substr($j_y,2,2);
|
198 |
+
break;
|
199 |
+
|
200 |
+
case'Y':
|
201 |
+
$out.=$j_y;
|
202 |
+
break;
|
203 |
+
|
204 |
+
case'z':
|
205 |
+
$out.=$doy;
|
206 |
+
break;
|
207 |
+
|
208 |
+
default:$out.=$sub;
|
209 |
+
}
|
210 |
+
}
|
211 |
+
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
212 |
+
}
|
213 |
+
|
214 |
+
/* F */
|
215 |
+
function GF_jstrftime($format,$timestamp='',$none='',$time_zone='Asia/Tehran',$tr_num='fa'){
|
216 |
+
|
217 |
+
$T_sec=0;/* <= رفع خطاي زمان سرور ، با اعداد '+' و '-' بر حسب ثانيه */
|
218 |
+
|
219 |
+
if($time_zone!='local')date_default_timezone_set(($time_zone=='')?'Asia/Tehran':$time_zone);
|
220 |
+
$ts=$T_sec+(($timestamp=='' or $timestamp=='now')?time():GF_tr_num($timestamp));
|
221 |
+
$date=explode('_',date('h_H_i_j_n_s_w_Y',$ts));
|
222 |
+
list($j_y,$j_m,$j_d)=GF_gregorian_to_jalali($date[7],$date[4],$date[3]);
|
223 |
+
$doy=($j_m<7)?(($j_m-1)*31)+$j_d-1:(($j_m-7)*30)+$j_d+185;
|
224 |
+
$kab=($j_y%33%4-1==(int)($j_y%33*.05))?1:0;
|
225 |
+
$sl=strlen($format);
|
226 |
+
$out='';
|
227 |
+
for($i=0; $i<$sl; $i++){
|
228 |
+
$sub=substr($format,$i,1);
|
229 |
+
if($sub=='%'){
|
230 |
+
$sub=substr($format,++$i,1);
|
231 |
+
}else{
|
232 |
+
$out.=$sub;
|
233 |
+
continue;
|
234 |
+
}
|
235 |
+
switch($sub){
|
236 |
+
|
237 |
+
/* Day */
|
238 |
+
case'a':
|
239 |
+
$out.=GF_jdate_words(array('kh'=>$date[6]),' ');
|
240 |
+
break;
|
241 |
+
|
242 |
+
case'A':
|
243 |
+
$out.=GF_jdate_words(array('rh'=>$date[6]),' ');
|
244 |
+
break;
|
245 |
+
|
246 |
+
case'd':
|
247 |
+
$out.=($j_d<10)?'0'.$j_d:$j_d;
|
248 |
+
break;
|
249 |
+
|
250 |
+
case'e':
|
251 |
+
$out.=($j_d<10)?' '.$j_d:$j_d;
|
252 |
+
break;
|
253 |
+
|
254 |
+
case'j':
|
255 |
+
$out.=str_pad($doy+1,3,0,STR_PAD_LEFT);
|
256 |
+
break;
|
257 |
+
|
258 |
+
case'u':
|
259 |
+
$out.=$date[6]+1;
|
260 |
+
break;
|
261 |
+
|
262 |
+
case'w':
|
263 |
+
$out.=($date[6]==6)?0:$date[6]+1;
|
264 |
+
break;
|
265 |
+
|
266 |
+
/* Week */
|
267 |
+
case'U':
|
268 |
+
$avs=(($date[6]<5)?$date[6]+2:$date[6]-5)-($doy%7);
|
269 |
+
if($avs<0)$avs+=7;
|
270 |
+
$num=(int)(($doy+$avs)/7)+1;
|
271 |
+
if($avs>3 or $avs==1)$num--;
|
272 |
+
$out.=($num<10)?'0'.$num:$num;
|
273 |
+
break;
|
274 |
+
|
275 |
+
case'V':
|
276 |
+
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
277 |
+
if($avs<0)$avs+=7;
|
278 |
+
$num=(int)(($doy+$avs)/7);
|
279 |
+
if($avs<4){
|
280 |
+
$num++;
|
281 |
+
}elseif($num<1){
|
282 |
+
$num=($avs==4 or $avs==(($j_y%33%4-2==(int)($j_y%33*.05))?5:4))?53:52;
|
283 |
+
}
|
284 |
+
$aks=$avs+$kab;
|
285 |
+
if($aks==7)$aks=0;
|
286 |
+
$out.=(($kab+363-$doy)<$aks and $aks<3)?'01':(($num<10)?'0'.$num:$num);
|
287 |
+
break;
|
288 |
+
|
289 |
+
case'W':
|
290 |
+
$avs=(($date[6]==6)?0:$date[6]+1)-($doy%7);
|
291 |
+
if($avs<0)$avs+=7;
|
292 |
+
$num=(int)(($doy+$avs)/7)+1;
|
293 |
+
if($avs>3)$num--;
|
294 |
+
$out.=($num<10)?'0'.$num:$num;
|
295 |
+
break;
|
296 |
+
|
297 |
+
/* Month */
|
298 |
+
case'b':
|
299 |
+
case'h':
|
300 |
+
$out.=GF_jdate_words(array('km'=>$j_m),' ');
|
301 |
+
break;
|
302 |
+
|
303 |
+
case'B':
|
304 |
+
$out.=GF_jdate_words(array('mm'=>$j_m),' ');
|
305 |
+
break;
|
306 |
+
|
307 |
+
case'm':
|
308 |
+
$out.=($j_m>9)?$j_m:'0'.$j_m;
|
309 |
+
break;
|
310 |
+
|
311 |
+
/* Year */
|
312 |
+
case'C':
|
313 |
+
$out.=substr($j_y,0,2);
|
314 |
+
break;
|
315 |
+
|
316 |
+
case'g':
|
317 |
+
$jdw=($date[6]==6)?0:$date[6]+1;
|
318 |
+
$dny=364+$kab-$doy;
|
319 |
+
$out.=substr(($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y),2,2);
|
320 |
+
break;
|
321 |
+
|
322 |
+
case'G':
|
323 |
+
$jdw=($date[6]==6)?0:$date[6]+1;
|
324 |
+
$dny=364+$kab-$doy;
|
325 |
+
$out.=($jdw>($doy+3) and $doy<3)?$j_y-1:(((3-$dny)>$jdw and $dny<3)?$j_y+1:$j_y);
|
326 |
+
break;
|
327 |
+
|
328 |
+
case'y':
|
329 |
+
$out.=substr($j_y,2,2);
|
330 |
+
break;
|
331 |
+
|
332 |
+
case'Y':
|
333 |
+
$out.=$j_y;
|
334 |
+
break;
|
335 |
+
|
336 |
+
/* Time */
|
337 |
+
case'H':
|
338 |
+
$out.=$date[1];
|
339 |
+
break;
|
340 |
+
|
341 |
+
case'I':
|
342 |
+
$out.=$date[0];
|
343 |
+
break;
|
344 |
+
|
345 |
+
case'l':
|
346 |
+
$out.=($date[0]>9)?$date[0]:' '.(int)$date[0];
|
347 |
+
break;
|
348 |
+
|
349 |
+
case'M':
|
350 |
+
$out.=$date[2];
|
351 |
+
break;
|
352 |
+
|
353 |
+
case'p':
|
354 |
+
$out.=($date[1]<12)?'قبل از ظهر':'بعد از ظهر';
|
355 |
+
break;
|
356 |
+
|
357 |
+
case'P':
|
358 |
+
$out.=($date[1]<12)?'ق.ظ':'ب.ظ';
|
359 |
+
break;
|
360 |
+
|
361 |
+
case'r':
|
362 |
+
$out.=$date[0].':'.$date[2].':'.$date[5].' '.(($date[1]<12)?'قبل از ظهر':'بعد از ظهر');
|
363 |
+
break;
|
364 |
+
|
365 |
+
case'R':
|
366 |
+
$out.=$date[1].':'.$date[2];
|
367 |
+
break;
|
368 |
+
|
369 |
+
case'S':
|
370 |
+
$out.=$date[5];
|
371 |
+
break;
|
372 |
+
|
373 |
+
case'T':
|
374 |
+
$out.=$date[1].':'.$date[2].':'.$date[5];
|
375 |
+
break;
|
376 |
+
|
377 |
+
case'X':
|
378 |
+
$out.=$date[0].':'.$date[2].':'.$date[5];
|
379 |
+
break;
|
380 |
+
|
381 |
+
case'z':
|
382 |
+
$out.=date('O',$ts);
|
383 |
+
break;
|
384 |
+
|
385 |
+
case'Z':
|
386 |
+
$out.=date('T',$ts);
|
387 |
+
break;
|
388 |
+
|
389 |
+
/* Time and Date Stamps */
|
390 |
+
case'c':
|
391 |
+
$key=GF_jdate_words(array('rh'=>$date[6],'mm'=>$j_m));
|
392 |
+
$out.=$date[1].':'.$date[2].':'.$date[5].' '.date('P',$ts)
|
393 |
+
.' '.$key['rh'].'، '.$j_d.' '.$key['mm'].' '.$j_y;
|
394 |
+
break;
|
395 |
+
|
396 |
+
case'D':
|
397 |
+
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
398 |
+
break;
|
399 |
+
|
400 |
+
case'F':
|
401 |
+
$out.=$j_y.'-'.(($j_m>9)?$j_m:'0'.$j_m).'-'.(($j_d<10)?'0'.$j_d:$j_d);
|
402 |
+
break;
|
403 |
+
|
404 |
+
case's':
|
405 |
+
$out.=$ts;
|
406 |
+
break;
|
407 |
+
|
408 |
+
case'x':
|
409 |
+
$out.=substr($j_y,2,2).'/'.(($j_m>9)?$j_m:'0'.$j_m).'/'.(($j_d<10)?'0'.$j_d:$j_d);
|
410 |
+
break;
|
411 |
+
|
412 |
+
/* Miscellaneous */
|
413 |
+
case'n':
|
414 |
+
$out.="\n";
|
415 |
+
break;
|
416 |
+
|
417 |
+
case't':
|
418 |
+
$out.="\t";
|
419 |
+
break;
|
420 |
+
|
421 |
+
case'%':
|
422 |
+
$out.='%';
|
423 |
+
break;
|
424 |
+
|
425 |
+
default:$out.=$sub;
|
426 |
+
}
|
427 |
+
}
|
428 |
+
return($tr_num!='en')?GF_tr_num($out,'fa','.'):$out;
|
429 |
+
}
|
430 |
+
|
431 |
+
/* F */
|
432 |
+
function GF_jmktime($h='',$m='',$s='',$jm='',$jd='',$jy='',$is_dst=-1){
|
433 |
+
$h=GF_tr_num($h); $m=GF_tr_num($m); $s=GF_tr_num($s); $jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
434 |
+
if($h=='' and $m=='' and $s=='' and $jm=='' and $jd=='' and $jy==''){
|
435 |
+
return mktime();
|
436 |
+
}else{
|
437 |
+
list($year,$month,$day)=GF_jalali_to_gregorian($jy,$jm,$jd);
|
438 |
+
return mktime($h,$m,$s,$month,$day,$year,$is_dst);
|
439 |
+
}
|
440 |
+
}
|
441 |
+
|
442 |
+
/* F */
|
443 |
+
function GF_jgetdate($timestamp='',$none='',$tz='Asia/Tehran',$tn='en'){
|
444 |
+
$ts=($timestamp=='')?time():GF_tr_num($timestamp);
|
445 |
+
$jdate=explode('_',GF_jdate('F_G_i_j_l_n_s_w_Y_z',$ts,'',$tz,$tn));
|
446 |
+
return array(
|
447 |
+
'seconds'=>GF_tr_num((int)GF_tr_num($jdate[6]),$tn),
|
448 |
+
'minutes'=>GF_tr_num((int)GF_tr_num($jdate[2]),$tn),
|
449 |
+
'hours'=>$jdate[1],
|
450 |
+
'mday'=>$jdate[3],
|
451 |
+
'wday'=>$jdate[7],
|
452 |
+
'mon'=>$jdate[5],
|
453 |
+
'year'=>$jdate[8],
|
454 |
+
'yday'=>$jdate[9],
|
455 |
+
'weekday'=>$jdate[4],
|
456 |
+
'month'=>$jdate[0],
|
457 |
+
0=>GF_tr_num($ts,$tn)
|
458 |
+
);
|
459 |
+
}
|
460 |
+
|
461 |
+
/* F */
|
462 |
+
function GF_jcheckdate($jm,$jd,$jy){
|
463 |
+
$jm=GF_tr_num($jm); $jd=GF_tr_num($jd); $jy=GF_tr_num($jy);
|
464 |
+
$l_d=($jm==12)?(($jy%33%4-1==(int)($jy%33*.05))?30:29):31-(int)($jm/6.5);
|
465 |
+
return($jm>0 and $jd>0 and $jy>0 and $jm<13 and $jd<=$l_d)?true:false;
|
466 |
+
}
|
467 |
+
|
468 |
+
/* F */
|
469 |
+
function GF_tr_num($str,$mod='en',$mf='٫'){
|
470 |
+
$num_a=array('0','1','2','3','4','5','6','7','8','9','.');
|
471 |
+
$key_a=array('۰','۱','۲','۳','۴','۵','۶','۷','۸','۹',$mf);
|
472 |
+
return($mod=='fa')?str_replace($num_a,$key_a,$str):str_replace($key_a,$num_a,$str);
|
473 |
+
}
|
474 |
+
|
475 |
+
/* F */
|
476 |
+
function GF_jdate_words($array,$mod=''){
|
477 |
+
foreach($array as $type=>$num){
|
478 |
+
$num=(int)GF_tr_num($num);
|
479 |
+
switch($type){
|
480 |
+
|
481 |
+
case'ss':
|
482 |
+
$sl=strlen($num);
|
483 |
+
$xy3=substr($num,2-$sl,1);
|
484 |
+
$h3=$h34=$h4='';
|
485 |
+
if($xy3==1){
|
486 |
+
$p34='';
|
487 |
+
$k34=array('ده','یازده','دوازده','سیزده','چهارده','پانزده','شانزده','هفده','هجده','نوزده');
|
488 |
+
$h34=$k34[substr($num,2-$sl,2)-10];
|
489 |
+
}else{
|
490 |
+
$xy4=substr($num,3-$sl,1);
|
491 |
+
$p34=($xy3==0 or $xy4==0)?'':' و ';
|
492 |
+
$k3=array('','','بیست','سی','چهل','پنجاه','شصت','هفتاد','هشتاد','نود');
|
493 |
+
$h3=$k3[$xy3];
|
494 |
+
$k4=array('','یک','دو','سه','چهار','پنج','شش','هفت','هشت','نه');
|
495 |
+
$h4=$k4[$xy4];
|
496 |
+
}
|
497 |
+
$array[$type]=(($num>99)?str_ireplace(array('12','13','14','19','20')
|
498 |
+
,array('هزار و دویست','هزار و سیصد','هزار و چهارصد','هزار و نهصد','دوهزار')
|
499 |
+
,substr($num,0,2)).((substr($num,2,2)=='00')?'':' و '):'').$h3.$p34.$h34.$h4;
|
500 |
+
break;
|
501 |
+
|
502 |
+
case'mm':
|
503 |
+
$key=array
|
504 |
+
('فروردین','اردیبهشت','خرداد','تیر','مرداد','شهریور','مهر','آبان','آذر','دی','بهمن','اسفند');
|
505 |
+
$array[$type]=$key[$num-1];
|
506 |
+
break;
|
507 |
+
|
508 |
+
case'rr':
|
509 |
+
$key=array('یک','دو','سه','چهار','پنج','شش','هفت','هشت','نه','ده','یازده','دوازده','سیزده',
|
510 |
+
'چهارده','پانزده','شانزده','هفده','هجده','نوزده','بیست','بیست و یک','بیست و دو','بیست و سه',
|
511 |
+
'بیست و چهار','بیست و پنج','بیست و شش','بیست و هفت','بیست و هشت','بیست و نه','سی','سی و یک');
|
512 |
+
$array[$type]=$key[$num-1];
|
513 |
+
break;
|
514 |
+
|
515 |
+
case'rh':
|
516 |
+
$key=array('یکشنبه','دوشنبه','سه شنبه','چهارشنبه','پنجشنبه','جمعه','شنبه');
|
517 |
+
$array[$type]=$key[$num];
|
518 |
+
break;
|
519 |
+
|
520 |
+
case'sh':
|
521 |
+
$key=array('مار','اسب','گوسفند','میمون','مرغ','سگ','خوک','موش','گاو','پلنگ','خرگوش','نهنگ');
|
522 |
+
$array[$type]=$key[$num%12];
|
523 |
+
break;
|
524 |
+
|
525 |
+
case'mb':
|
526 |
+
$key=array('حمل','ثور','جوزا','سرطان','اسد','سنبله','میزان','عقرب','قوس','جدی','دلو','حوت');
|
527 |
+
$array[$type]=$key[$num-1];
|
528 |
+
break;
|
529 |
+
|
530 |
+
case'ff':
|
531 |
+
$key=array('بهار','تابستان','پاییز','زمستان');
|
532 |
+
$array[$type]=$key[(int)($num/3.1)];
|
533 |
+
break;
|
534 |
+
|
535 |
+
case'km':
|
536 |
+
$key=array('فر','ار','خر','تی','مر','شه','مه','آب','آذ','دی','به','اس');
|
537 |
+
$array[$type]=$key[$num-1];
|
538 |
+
break;
|
539 |
+
|
540 |
+
case'kh':
|
541 |
+
$key=array('ی','د','س','چ','پ','ج','ش');
|
542 |
+
$array[$type]=$key[$num];
|
543 |
+
break;
|
544 |
+
|
545 |
+
default:$array[$type]=$num;
|
546 |
+
}
|
547 |
+
}
|
548 |
+
return($mod=='')?$array:implode($mod,$array);
|
549 |
+
}
|
550 |
+
|
551 |
+
/** Convertor from and to Gregorian and Jalali (Hijri_Shamsi,Solar) Functions
|
552 |
+
Copyright(C)2011, Reza Gholampanahi [ http://jdf.scr.ir/jdf ] version 2.50 */
|
553 |
+
|
554 |
+
/* F */
|
555 |
+
function GF_gregorian_to_jalali($g_y,$g_m,$g_d,$mod=''){
|
556 |
+
$g_y=GF_tr_num($g_y); $g_m=GF_tr_num($g_m); $g_d=GF_tr_num($g_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
557 |
+
$d_4=$g_y%4;
|
558 |
+
$g_a=array(0,0,31,59,90,120,151,181,212,243,273,304,334);
|
559 |
+
$doy_g=$g_a[(int)$g_m]+$g_d;
|
560 |
+
if($d_4==0 and $g_m>2)$doy_g++;
|
561 |
+
$d_33=(int)((($g_y-16)%132)*.0305);
|
562 |
+
$a=($d_33==3 or $d_33<($d_4-1) or $d_4==0)?286:287;
|
563 |
+
$b=(($d_33==1 or $d_33==2) and ($d_33==$d_4 or $d_4==1))?78:(($d_33==3 and $d_4==0)?80:79);
|
564 |
+
if((int)(($g_y-10)/63)==30){$a--;$b++;}
|
565 |
+
if($doy_g>$b){
|
566 |
+
$jy=$g_y-621; $doy_j=$doy_g-$b;
|
567 |
+
}else{
|
568 |
+
$jy=$g_y-622; $doy_j=$doy_g+$a;
|
569 |
+
}
|
570 |
+
if($doy_j<187){
|
571 |
+
$jm=(int)(($doy_j-1)/31); $jd=$doy_j-(31*$jm++);
|
572 |
+
}else{
|
573 |
+
$jm=(int)(($doy_j-187)/30); $jd=$doy_j-186-($jm*30); $jm+=7;
|
574 |
+
}
|
575 |
+
return($mod=='')?array($jy,$jm,$jd):$jy.$mod.$jm.$mod.$jd;
|
576 |
+
}
|
577 |
+
|
578 |
+
/* F */
|
579 |
+
function GF_jalali_to_gregorian($j_y,$j_m,$j_d,$mod=''){
|
580 |
+
$j_y=GF_tr_num($j_y); $j_m=GF_tr_num($j_m); $j_d=GF_tr_num($j_d);/* <= :اين سطر ، جزء تابع اصلي نيست */
|
581 |
+
$d_4=($j_y+1)%4;
|
582 |
+
$doy_j=($j_m<7)?(($j_m-1)*31)+$j_d:(($j_m-7)*30)+$j_d+186;
|
583 |
+
$d_33=(int)((($j_y-55)%132)*.0305);
|
584 |
+
$a=($d_33!=3 and $d_4<=$d_33)?287:286;
|
585 |
+
$b=(($d_33==1 or $d_33==2) and ($d_33==$d_4 or $d_4==1))?78:(($d_33==3 and $d_4==0)?80:79);
|
586 |
+
if((int)(($j_y-19)/63)==20){$a--;$b++;}
|
587 |
+
if($doy_j<=$a){
|
588 |
+
$gy=$j_y+621; $gd=$doy_j+$b;
|
589 |
+
}else{
|
590 |
+
$gy=$j_y+622; $gd=$doy_j-$a;
|
591 |
+
}
|
592 |
+
foreach(array(0,31,($gy%4==0)?29:28,31,30,31,30,31,31,30,31,30,31) as $gm=>$v){
|
593 |
+
if($gd<=$v)break;
|
594 |
+
$gd-=$v;
|
595 |
+
}
|
596 |
+
return($mod=='')?array($gy,$gm,$gd):$gy.$mod.$gm.$mod.$gd;
|
597 |
+
}
|
598 |
+
|
599 |
+
/* [ jdf.php ] version 2.55 ?> Download new version from [ http://jdf.scr.ir ] */
|
languages/Persian_Gravityforms_By_HANNANStd-fa_IR.mo
CHANGED
Binary file
|
languages/gravityforms/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsauthorizenet/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsaweber/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformscoupons/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsmailchimp/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformspaypal/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformspaypalpaymentspro/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformspaypalpro/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformspolls/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsquiz/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsstripe/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformssurvey/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformsuserregistration/fa_IR.mo
CHANGED
Binary file
|
languages/gravityformszapier/fa_IR.mo
CHANGED
Binary file
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Tags: gravityforms,gravity forms,persian gravity forms,persian gravityforms,grav
|
|
4 |
Donate link: http://www.gravityforms.ir
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.0.1
|
7 |
-
Stable tag: 1.
|
8 |
License: GPL 2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
This WordPress plugin extends the Gravity Forms plugin and its addons with the Persian language .
|
@@ -18,6 +18,7 @@ This plugin extends the Gravity Forms and its addons with Persian language
|
|
18 |
* Add Iran provinces (states) in Fields , Forms and predefined choice .
|
19 |
* Add Iranian Rial and Toman Currency .
|
20 |
* Add Yekan Font to Gravity Forms and make it attractive .
|
|
|
21 |
* Make it RTL .
|
22 |
* Add Private status option to post status .
|
23 |
* Add Iranian payment gateways transaction id , transaction status and ... to Merge Tags .
|
@@ -28,6 +29,7 @@ This plugin extends the Gravity Forms and its addons with Persian language
|
|
28 |
* اضافه کردن استان های ایران برای استفاده در فیلد های آدرس و ...
|
29 |
* اضافه کردن واحد پولی ریال و تومان
|
30 |
* زیبا سازی محیط کاربری به وسیله استایل دهی و ...
|
|
|
31 |
* راستچین سازی افزونه و صفحه پرینت و ادان ها و ...
|
32 |
* اضافه کردن وضعیت پست خصوصی برای فیلد های ارسال پست .
|
33 |
* اضافه کردن برچسب وضعیت تراکنش ، کد رهگیری و ... به برچسب های ایمیل و صفحه تاییدیه که این برچسب در خود افزونه وجود نداشت .
|
@@ -73,12 +75,30 @@ You can read complete documentations on the [GravityForms.ir](http://www.Gravity
|
|
73 |
13. front end.
|
74 |
14. Iran states
|
75 |
15. Iran states
|
|
|
|
|
|
|
|
|
76 |
|
77 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
= 1.0.0 =
|
79 |
* First version
|
80 |
|
81 |
== Upgrade Notice ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
= 1.0.0 =
|
83 |
* First version
|
84 |
|
4 |
Donate link: http://www.gravityforms.ir
|
5 |
Requires at least: 3.5
|
6 |
Tested up to: 4.0.1
|
7 |
+
Stable tag: 1.1.0
|
8 |
License: GPL 2
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
This WordPress plugin extends the Gravity Forms plugin and its addons with the Persian language .
|
18 |
* Add Iran provinces (states) in Fields , Forms and predefined choice .
|
19 |
* Add Iranian Rial and Toman Currency .
|
20 |
* Add Yekan Font to Gravity Forms and make it attractive .
|
21 |
+
* Added Iranian National Code Field .
|
22 |
* Make it RTL .
|
23 |
* Add Private status option to post status .
|
24 |
* Add Iranian payment gateways transaction id , transaction status and ... to Merge Tags .
|
29 |
* اضافه کردن استان های ایران برای استفاده در فیلد های آدرس و ...
|
30 |
* اضافه کردن واحد پولی ریال و تومان
|
31 |
* زیبا سازی محیط کاربری به وسیله استایل دهی و ...
|
32 |
+
* اضافه کردن فیلد کد ملی ایران ، این فیلد کد ملی نادرست را برطبق استانداردهای کشور تشخیص داده و از ثبت شدن آن جلوگیری میکند . همچنین این فیلد دارای تنظیمات پیشرفته تری نیز می باشد
|
33 |
* راستچین سازی افزونه و صفحه پرینت و ادان ها و ...
|
34 |
* اضافه کردن وضعیت پست خصوصی برای فیلد های ارسال پست .
|
35 |
* اضافه کردن برچسب وضعیت تراکنش ، کد رهگیری و ... به برچسب های ایمیل و صفحه تاییدیه که این برچسب در خود افزونه وجود نداشت .
|
75 |
13. front end.
|
76 |
14. Iran states
|
77 |
15. Iran states
|
78 |
+
16. Iranian National Code field
|
79 |
+
17. Iranian National Code field Standard setting
|
80 |
+
18. Iranian National Code field in front-end
|
81 |
+
19. Iranian National Code field Advanced setting
|
82 |
|
83 |
== Changelog ==
|
84 |
+
= 1.1.0 =
|
85 |
+
* Fixed : Added Iranian National Code field
|
86 |
+
* See Screenshots 16-19
|
87 |
+
= 1.0.2 =
|
88 |
+
* Fixed : Some Minor bugs
|
89 |
+
= 1.0.1 =
|
90 |
+
* Fixed : Some Minor bugs
|
91 |
= 1.0.0 =
|
92 |
* First version
|
93 |
|
94 |
== Upgrade Notice ==
|
95 |
+
= 1.1.0 =
|
96 |
+
* Fixed : Added Iranian National Code field
|
97 |
+
* See Screenshots 16-19
|
98 |
+
= 1.0.2 =
|
99 |
+
* Fixed : Some Minor bugs
|
100 |
+
= 1.0.1 =
|
101 |
+
* Fixed : Some Minor bugs
|
102 |
= 1.0.0 =
|
103 |
* First version
|
104 |
|