| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user, $wpscfunction; |
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) {exit;} |
| 8 |
|
| 9 |
$field_id = isset($_POST) && isset($_POST['field_id']) ? intval($_POST['field_id']) : 0; |
| 10 |
if (!$field_id) {exit;} |
| 11 |
|
| 12 |
$custom_field = get_term_by('id', $field_id, 'wpsc_ticket_custom_fields'); |
| 13 |
$wpsc_tf_label = get_term_meta( $custom_field->term_id, 'wpsc_tf_label', true); |
| 14 |
$wpsc_tf_extra_info = get_term_meta( $custom_field->term_id, 'wpsc_tf_extra_info', true); |
| 15 |
$agentonly = get_term_meta( $custom_field->term_id, 'agentonly', true); |
| 16 |
$wpsc_tf_status = get_term_meta( $custom_field->term_id, 'wpsc_tf_status', true); |
| 17 |
$wpsc_tf_type = get_term_meta( $custom_field->term_id, 'wpsc_tf_type', true); |
| 18 |
$wpsc_tf_has_options = 0; |
| 19 |
$wpsc_tf_options = get_term_meta( $custom_field->term_id, 'wpsc_tf_options', true); |
| 20 |
$wpsc_tf_required = get_term_meta( $custom_field->term_id, 'wpsc_tf_required', true); |
| 21 |
$wpsc_tf_width = get_term_meta( $custom_field->term_id, 'wpsc_tf_width', true); |
| 22 |
$wpsc_date_range= get_term_meta( $custom_field->term_id, 'wpsc_date_range', true); |
| 23 |
$date_range_from = get_term_meta( $custom_field->term_id, 'date_range_from', true); |
| 24 |
$date_range_to = get_term_meta( $custom_field->term_id, 'date_range_to', true); |
| 25 |
$wpsc_tf_visibility = get_term_meta( $custom_field->term_id, 'wpsc_tf_visibility', true); |
| 26 |
$wpsc_tf_personal_info = get_term_meta( $custom_field->term_id, 'wpsc_tf_personal_info', true); |
| 27 |
$wpsc_tf_limit = get_term_meta( $custom_field->term_id, 'wpsc_tf_limit',true); |
| 28 |
$wpsc_tf_placeholder_text = get_term_meta( $custom_field->term_id, 'wpsc_tf_placeholder_text',true); |
| 29 |
$wpsc_html_content = get_term_meta( $custom_field->term_id , 'wpsc_html_content', true); |
| 30 |
$wpsc_time_format = get_term_meta($custom_field->term_id,'wpsc_time_format',true); |
| 31 |
$field_types = $wpscfunction->get_custom_field_types(); |
| 32 |
$conditional_types = array(); |
| 33 |
foreach ($field_types as $key => $field) { |
| 34 |
if ($field['has_options']) { |
| 35 |
$conditional_types[]=$key; |
| 36 |
} |
| 37 |
} |
| 38 |
$placeholder_text = array('1','5','6','7','8','9','18'); |
| 39 |
$style = ''; |
| 40 |
if (!(in_array($wpsc_tf_type,$placeholder_text))) { |
| 41 |
$style = 'display:none'; |
| 42 |
} |
| 43 |
|
| 44 |
$tf_types = array(1,5,7,8,9); |
| 45 |
$l_style = ''; |
| 46 |
if(!in_array($wpsc_tf_type,$tf_types)){ |
| 47 |
$l_style = "display:none"; |
| 48 |
} |
| 49 |
//has option |
| 50 |
if(in_array($wpsc_tf_type,$conditional_types)){ |
| 51 |
$wpsc_tf_has_options = 1; |
| 52 |
} |
| 53 |
//html field |
| 54 |
$wpsc_html_content_option = 0; |
| 55 |
if($wpsc_tf_type == '22'){ |
| 56 |
$wpsc_html_content_option =1; |
| 57 |
} |
| 58 |
|
| 59 |
//time field |
| 60 |
$wpsc_time_field = 0 ; |
| 61 |
if($wpsc_tf_type == '21'){ |
| 62 |
$wpsc_time_field = 1 ; |
| 63 |
} |
| 64 |
$wpsc_date_field = 0; |
| 65 |
if($wpsc_tf_type == '6'){ |
| 66 |
$wpsc_date_field = 1; |
| 67 |
} |
| 68 |
|
| 69 |
$rich_editing = $wpscfunction->rich_editing_status($current_user); |
| 70 |
$directionality = $wpscfunction->check_rtl(); |
| 71 |
|
| 72 |
ob_start(); |
| 73 |
?> |
| 74 |
<div class="form-group"> |
| 75 |
<label for="wpsc_tf_label"><?php _e('Field Label','supportcandy');?></label> |
| 76 |
<p class="help-block"><?php _e('Insert field label. Please make sure label you are entering should not already exist.','supportcandy');?></p> |
| 77 |
<input id="wpsc_tf_label" class="form-control" name="wpsc_tf_label" value="<?php echo esc_attr($wpsc_tf_label)?>" /> |
| 78 |
</div> |
| 79 |
<div class="form-group"> |
| 80 |
<label for="wpsc_tf_extra_info"><?php _e('Extra Information','supportcandy');?></label> |
| 81 |
<p class="help-block"><?php _e('Extra information about the field. Useful if you want to give instructions or information about the field in create ticket from. Keep this empty if not needed.','supportcandy');?></p> |
| 82 |
<input id="wpsc_tf_extra_info" class="form-control" name="wpsc_tf_extra_info" value="<?php echo esc_attr($wpsc_tf_extra_info)?>" /> |
| 83 |
</div> |
| 84 |
<div class="form-group"> |
| 85 |
<label for="wpsc_tf_personal_info"><?php _e('Personal Information','supportcandy');?></label> |
| 86 |
<p class="help-block"><?php _e('Enable or disable personal information in ticket form.','supportcandy');?></p> |
| 87 |
<select id="wpsc_tf_personal_info" class="form-control" name="wpsc_tf_personal_info"> |
| 88 |
<option <?php echo esc_attr($wpsc_tf_personal_info) == '1' ? 'selected="selected"' : ''?> value="1"><?php _e('Yes','supportcandy');?></option> |
| 89 |
<option <?php echo esc_attr($wpsc_tf_personal_info) == '0' ? 'selected="selected"' : ''?> value="0"><?php _e('No','supportcandy');?></option> |
| 90 |
</select> |
| 91 |
</div> |
| 92 |
<div class="form-group"> |
| 93 |
<label for="wpsc_tf_type"><?php _e('Field Type','supportcandy');?></label> |
| 94 |
<p class="help-block"><?php _e('Select field type.','supportcandy');?></p> |
| 95 |
<select id="wpsc_tf_type" class="form-control" name="wpsc_tf_type"> |
| 96 |
<?php foreach ($field_types as $key => $field) : |
| 97 |
$selected = $wpsc_tf_type == $key ? 'selected="selected"' : ''; |
| 98 |
?> |
| 99 |
<option <?php echo esc_attr($selected)?> data-options="<?php echo esc_attr($field['has_options'])?>" value="<?php echo esc_attr($key)?>"><?php echo esc_attr($field['label'])?></option> |
| 100 |
<?php endforeach;?> |
| 101 |
</select> |
| 102 |
</div> |
| 103 |
|
| 104 |
<div class="form-group" id= "wpsc_placeholder_text" style="<?php echo esc_attr($style); ?>"> |
| 105 |
<label for="wpsc_tf_placeholder_text"><?php _e('Placeholder text','supportcandy');?></label> |
| 106 |
<p class="help-block"><?php _e('Enter the placeholder text','supportcandy');?></p> |
| 107 |
<input id="wpsc_tf_placeholder_text" class="form-control" name="wpsc_tf_placeholder_text" value="<?php echo esc_attr($wpsc_tf_placeholder_text)?>" /> |
| 108 |
</div> |
| 109 |
|
| 110 |
<?php $display = !$wpsc_tf_has_options ?'display:none;':'';?> |
| 111 |
<div class="form-group" id="wpsc_tf_options_container" style="<?php echo esc_attr($display);?>"> |
| 112 |
<label for="wpsc_tf_options"><?php _e('Field Options','supportcandy');?></label> |
| 113 |
<p class="help-block"><?php _e('Insert field options. New option should begin on new line.','supportcandy');?></p> |
| 114 |
<textarea style="height:80px !important;" id="wpsc_tf_options" class="form-control" name="wpsc_tf_options"><?php echo stripcslashes(esc_textarea(implode('\n', $wpsc_tf_options)));?></textarea> |
| 115 |
</div> |
| 116 |
|
| 117 |
<?php $display = !$wpsc_tf_has_options ?'display:none;':'';?> |
| 118 |
<div class="form-group" id="wpsc_html_fields_container" style="<?php echo esc_attr($display)?>"> |
| 119 |
<label for="wpsc_html_content"><?php _e('Content','supportcandy');?></label> |
| 120 |
<p class="help-block"></p> |
| 121 |
<?php if($rich_editing){?> |
| 122 |
<div class="text-right"> |
| 123 |
<button id="visual" class="wpsc-switch-editor wpsc-switch-editor-active " type="button" onclick="wpsc_get_tinymce('wpsc_html_content','html_edit_body');"><?php _e('Visual','supportcandy');?></button> |
| 124 |
<button id="text" class="wpsc-switch-editor" type="button" onclick="wpsc_get_textarea('wpsc_html_content')"><?php _e('Text','supportcandy');?></button> |
| 125 |
</div> |
| 126 |
<?php }?> |
| 127 |
<textarea style="height:80px !important;" id="wpsc_html_content" class="form-control" name="wpsc_html_content"><?php echo esc_textarea($wpsc_html_content);?></textarea> |
| 128 |
</div> |
| 129 |
|
| 130 |
<?php $display = !$wpsc_time_field ?'display:none;':'';?> |
| 131 |
<div class="form-group" id="wpsc_time_fields_container" style="<?php echo esc_attr($display);?>"> |
| 132 |
<label for="wpsc_time_content"><?php _e('Time Format','supportcandy');?></label> |
| 133 |
<p class="help-block"><?php _e('Please select the time format','supportcandy'); ?></p> |
| 134 |
<select id="wpsc_tf_time_format" class="form-control" name="wpsc_tf_time_format"> |
| 135 |
<option <?php echo esc_attr($wpsc_time_format) == '12' ? 'selected="selected"' : ''?> value="12hrs"><?php _e('12 Hrs','supportcandy');?></option> |
| 136 |
<option <?php echo esc_attr($wpsc_time_format) == '24' ? 'selected="selected"' : ''?> value="24hrs"><?php _e('24 Hrs','supportcandy');?></option> |
| 137 |
</select> |
| 138 |
</div> |
| 139 |
|
| 140 |
<?php $display = !$wpsc_date_field ?'display:none;':'';?> |
| 141 |
<div class="form-group" id="wpsc_date_range_container" style="<?php echo esc_attr($display);?>"> |
| 142 |
<label for="wpsc_date_range"><?php _e('Allowed Dates','supportcandy');?></label> |
| 143 |
<p class="help-block"><?php _e('Please select date range.','supportcandy');?></p> |
| 144 |
<select id="wpsc_date_range" class="form-control" name="wpsc_date_range"> |
| 145 |
<option <?php echo esc_attr($wpsc_date_range) == 'all' ? 'selected="selected"' : ''?> value="all"><?php _e('All','supportcandy');?></option> |
| 146 |
<option <?php echo esc_attr($wpsc_date_range) == 'past' ? 'selected="selected"' : ''?> value="past"><?php _e('Past','supportcandy');?></option> |
| 147 |
<option <?php echo esc_attr($wpsc_date_range) == 'future' ? 'selected="selected"' : ''?> value="future"><?php _e('Future','supportcandy');?></option> |
| 148 |
<option <?php echo esc_attr($wpsc_date_range) == 'range' ? 'selected="selected"' : ''?> value="range"><?php _e('Date range','supportcandy');?></option> |
| 149 |
</select> |
| 150 |
</div> |
| 151 |
|
| 152 |
<div class="form-group" id="wpsc_date_range_option" style="<?php echo esc_attr($wpsc_date_range) != 'range' ? 'display:none;':'';?>"> |
| 153 |
<label for="wpsc_date_range"><?php _e('Date Range','supportcandy');?></label> |
| 154 |
<p class="help-block"><?php _e('Please select date range.','supportcandy');?></p> |
| 155 |
<div class="row"> |
| 156 |
<div class="col-sm-6" style="padding-left:0"> |
| 157 |
<input type="text" autocomplete="off" class="form-control wpsc_dcf_rs" id="wpsc_dcf_from" value="<?php echo esc_attr($date_range_from) ?>" placeholder="<?php _e('From','supportcandy')?>"> |
| 158 |
</div> |
| 159 |
<div class="col-sm-6" style="padding-right:0"> |
| 160 |
<input type="text" autocomplete="off" class="form-control wpsc_dcf_rs" id="wpsc_dcf_to" value="<?php echo esc_attr($date_range_to) ?>" placeholder="<?php _e('To','supportcandy')?>"> |
| 161 |
</div> |
| 162 |
</div> |
| 163 |
</div> |
| 164 |
|
| 165 |
<div class="form-group" id="wpsc_required_field_container" style="<?php echo esc_attr($wpsc_html_content_option)?'display:none;':'';?>" > |
| 166 |
<label for="wpsc_tf_required"><?php _e('Required','supportcandy');?></label> |
| 167 |
<p class="help-block"><?php _e('Whether this field is mandatory or optional. Yes indicates mandatory whereas no indicates optional.','supportcandy');?></p> |
| 168 |
<select id="wpsc_tf_required" class="form-control" name="wpsc_tf_required"> |
| 169 |
<option <?php echo esc_attr($wpsc_tf_required) == '1' ? 'selected="selected"' : ''?> value="1"><?php _e('Yes','supportcandy');?></option> |
| 170 |
<option <?php echo esc_attr($wpsc_tf_required) == '0' ? 'selected="selected"' : ''?> value="0"><?php _e('No','supportcandy');?></option> |
| 171 |
</select> |
| 172 |
</div> |
| 173 |
<div class="form-group"> |
| 174 |
<label for="wpsc_tf_width"><?php _e('Width','supportcandy');?></label> |
| 175 |
<p class="help-block"><?php _e('Please select width of the field in create ticket form.','supportcandy');?></p> |
| 176 |
<select id="wpsc_tf_width" class="form-control" name="wpsc_tf_width"> |
| 177 |
<option <?php echo esc_attr($wpsc_tf_width) == '1/3' ? 'selected="selected"' : ''?> value="1/3"><?php _e('1/3 width of Row','supportcandy');?></option> |
| 178 |
<option <?php echo esc_attr($wpsc_tf_width) == '1/2' ? 'selected="selected"' : ''?> value="1/2"><?php _e('Half width of Row','supportcandy');?></option> |
| 179 |
<option <?php echo esc_attr($wpsc_tf_width) == '1' ? 'selected="selected"' : ''?> value="1"><?php _e('Full width of Row','supportcandy');?></option> |
| 180 |
</select> |
| 181 |
</div> |
| 182 |
|
| 183 |
<div class="form-group wpsc_edit_limit" id = "wpsc_add_limit" style = "<?php echo esc_attr($l_style);?>"> |
| 184 |
<label for="wpsc_tf_limit"><?php _e('Character Limit','supportcandy');?></label> |
| 185 |
<p class="help-block"><?php _e('Limit number of characters to be accepted for this field. Enter 0 for unlimited characters.','supportcandy');?></p> |
| 186 |
<input type = "number" id="wpsc_tf_limit" class="form-control" name="wpsc_tf_limit" value="<?php echo esc_attr($wpsc_tf_limit) ?>" /> |
| 187 |
</div> |
| 188 |
<div class="form-group"> |
| 189 |
<label for="wpsc_tf_form_visibility"><?php _e('Visibility','supportcandy');?></label> |
| 190 |
<p class="help-block"><?php _e('Select conditions to show this field in create ticket form. Visible if no conditions set. Visible if any one of added conditions matches while creating ticket.','supportcandy');?></p> |
| 191 |
<div class="row"> |
| 192 |
<ul id="wpsc_tf_condition_container" class="wpsp_filter_display_container"> |
| 193 |
<?php |
| 194 |
foreach ($wpsc_tf_visibility as $key => $value) { |
| 195 |
$condition = explode('--', stripslashes($value)); |
| 196 |
$tf = get_term_by('id', $condition[0], 'wpsc_ticket_custom_fields'); |
| 197 |
$label = get_term_meta( $condition[0], 'wpsc_tf_label', true); |
| 198 |
$value_label = $condition[1]; |
| 199 |
if ($tf->slug=='ticket_category') { |
| 200 |
$category = get_term_by('id', $value_label, 'wpsc_categories'); |
| 201 |
$value_label = $category->name; |
| 202 |
} |
| 203 |
if ($tf->slug=='ticket_priority') { |
| 204 |
$priority = get_term_by('id', $value_label, 'wpsc_priorities'); |
| 205 |
$value_label = $priority->name; |
| 206 |
} |
| 207 |
?> |
| 208 |
<li class="wpsp_filter_display_element"> |
| 209 |
<div class="flex-container"> |
| 210 |
<div class="wpsp_filter_display_text"> |
| 211 |
<?php echo esc_attr($label)?>: <?php echo esc_attr($value_label)?> |
| 212 |
<input type="hidden" name="wpsp_tf_condition[]" value="<?php echo esc_attr($value) ?>"> |
| 213 |
</div> |
| 214 |
<div class="wpsp_filter_display_remove" onclick="wpsc_remove_filter(this);"><i class="fa fa-times"></i></div> |
| 215 |
</div> |
| 216 |
</li> |
| 217 |
<?php |
| 218 |
} |
| 219 |
?> |
| 220 |
</ul> |
| 221 |
</div> |
| 222 |
<div class="row" style="background-color:#CCD1D1;padding-top:15px;padding-bottom:15px;"> |
| 223 |
<div class="col-sm-5"> |
| 224 |
<select id="wpsc_tf_vcf" class="form-control" onchange="wpsc_get_conditional_options(this);" name="wpsc_tf_vcf"> |
| 225 |
<option value=""><?php _e('Select field','supportcandy');?></option> |
| 226 |
<?php |
| 227 |
$fields = get_terms([ |
| 228 |
'taxonomy' => 'wpsc_ticket_custom_fields', |
| 229 |
'hide_empty' => false, |
| 230 |
'orderby' => 'meta_value_num', |
| 231 |
'meta_key' => 'wpsc_tf_load_order', |
| 232 |
'order' => 'ASC', |
| 233 |
'exclude' => array($custom_field->term_id), |
| 234 |
'meta_query' => array( |
| 235 |
'relation' => 'AND', |
| 236 |
array( |
| 237 |
'key' => 'agentonly', |
| 238 |
'value' => '0', |
| 239 |
'compare' => '=' |
| 240 |
), |
| 241 |
array( |
| 242 |
'relation' => 'OR', |
| 243 |
array( |
| 244 |
'key' => 'wpsc_tf_type', |
| 245 |
'value' => $conditional_types, |
| 246 |
'compare' => 'IN' |
| 247 |
), |
| 248 |
array( |
| 249 |
'key' => 'wpsc_tf_conditional', |
| 250 |
'value' => '1', |
| 251 |
'compare' => '=' |
| 252 |
) |
| 253 |
) |
| 254 |
), |
| 255 |
]); |
| 256 |
foreach ($fields as $field) { |
| 257 |
$label = get_term_meta( $field->term_id, 'wpsc_tf_label', true); |
| 258 |
?> |
| 259 |
<option value="<?php echo esc_attr($field->term_id)?>"><?php echo esc_attr($label)?></option> |
| 260 |
<?php |
| 261 |
} |
| 262 |
?> |
| 263 |
</select> |
| 264 |
</div> |
| 265 |
<div class="col-sm-5"> |
| 266 |
<select id="wpsc_tf_vco" class="form-control" name="wpsc_tf_vco"> |
| 267 |
<option value=""><?php _e('Select option','supportcandy');?></option> |
| 268 |
</select> |
| 269 |
</div> |
| 270 |
<div class="col-sm-2"> |
| 271 |
<button type="button" class="form-control btn btn-success" onclick="wpsc_add_field_condition();"><?php _e('Add','supportcandy');?></button> |
| 272 |
</div> |
| 273 |
</div> |
| 274 |
</div> |
| 275 |
<script> |
| 276 |
jQuery('#wpsc_tf_type').change(function(){ |
| 277 |
var has_options = jQuery('option:selected',this).data('options'); |
| 278 |
var option = Number(jQuery(this).val()); |
| 279 |
|
| 280 |
if(has_options=='1'){ |
| 281 |
jQuery('#wpsc_tf_options_container').show(); |
| 282 |
} else { |
| 283 |
jQuery('#wpsc_tf_options_container').hide(); |
| 284 |
} |
| 285 |
|
| 286 |
if(option == 22){ |
| 287 |
jQuery('#wpsc_html_fields_container').show(); |
| 288 |
jQuery('#wpsc_required_field_container').hide(); |
| 289 |
}else{ |
| 290 |
jQuery('#wpsc_html_fields_container').hide(); |
| 291 |
} |
| 292 |
|
| 293 |
if(option == 21){ |
| 294 |
jQuery('#wpsc_time_fields_container').show(); |
| 295 |
}else{ |
| 296 |
jQuery('#wpsc_time_fields_container').hide(); |
| 297 |
} |
| 298 |
|
| 299 |
var opt_arr = [1,5,7,8,9]; |
| 300 |
if ( jQuery.inArray( option, opt_arr) >= 0) { |
| 301 |
jQuery('#wpsc_add_limit').show(); |
| 302 |
}else{ |
| 303 |
jQuery('#wpsc_add_limit').hide(); |
| 304 |
} |
| 305 |
|
| 306 |
var poption = Number(jQuery(this).val()); |
| 307 |
var popt_arr = [1,5,6,7,8,9,18]; |
| 308 |
if ( jQuery.inArray( poption, popt_arr) >= 0) { |
| 309 |
jQuery('#wpsc_placeholder_text').show(); |
| 310 |
}else{ |
| 311 |
jQuery('#wpsc_placeholder_text').hide(); |
| 312 |
} |
| 313 |
var poption = Number(jQuery(this).val()); |
| 314 |
var popt_arr = [6]; |
| 315 |
if ( jQuery.inArray( poption, popt_arr) >= 0) { |
| 316 |
jQuery('#wpsc_date_range_container').show(); |
| 317 |
}else{ |
| 318 |
jQuery('#wpsc_date_range_container').hide(); |
| 319 |
} |
| 320 |
|
| 321 |
|
| 322 |
}); |
| 323 |
</script> |
| 324 |
|
| 325 |
<?php if($rich_editing){?> |
| 326 |
<script> |
| 327 |
tinymce.remove(); |
| 328 |
tinymce.init({ |
| 329 |
selector:'#wpsc_html_content', |
| 330 |
body_id: 'html_edit_body', |
| 331 |
menubar: false, |
| 332 |
statusbar: false, |
| 333 |
height : '200', |
| 334 |
plugins: [ |
| 335 |
'lists link image directionality' |
| 336 |
], |
| 337 |
image_advtab: true, |
| 338 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 339 |
branding: false, |
| 340 |
autoresize_bottom_margin: 20, |
| 341 |
browser_spellcheck : true, |
| 342 |
relative_urls : false, |
| 343 |
remove_script_host : false, |
| 344 |
convert_urls : true, |
| 345 |
setup: function (editor) { |
| 346 |
} |
| 347 |
}); |
| 348 |
function wpsc_get_tinymce(selector,body_id){ |
| 349 |
|
| 350 |
jQuery('#visual_header').addClass('btn btn-primary visual_header'); |
| 351 |
jQuery('#text_header').removeClass('btn btn-primary text_header'); |
| 352 |
jQuery('#text_header').addClass('btn btn-default text_header'); |
| 353 |
jQuery('#text').removeClass('wpsc-switch-editor-active'); |
| 354 |
jQuery('#visual').addClass('wpsc-switch-editor-active'); |
| 355 |
tinymce.init({ |
| 356 |
selector:'#'+selector, |
| 357 |
body_id: body_id, |
| 358 |
menubar: false, |
| 359 |
statusbar: false, |
| 360 |
height : '200', |
| 361 |
plugins: [ |
| 362 |
'lists link image directionality' |
| 363 |
], |
| 364 |
image_advtab: true, |
| 365 |
toolbar: 'bold italic underline blockquote | alignleft aligncenter alignright | bullist numlist | rtl | link image', |
| 366 |
branding: false, |
| 367 |
autoresize_bottom_margin: 20, |
| 368 |
browser_spellcheck : true, |
| 369 |
relative_urls : false, |
| 370 |
remove_script_host : false, |
| 371 |
convert_urls : true, |
| 372 |
setup: function (editor) { |
| 373 |
} |
| 374 |
}); |
| 375 |
} |
| 376 |
|
| 377 |
function wpsc_get_textarea(selector){ |
| 378 |
|
| 379 |
jQuery('#visual_body').removeClass('btn btn-primary visual_body'); |
| 380 |
jQuery('#visual_body').addClass('btn btn-default visual_body'); |
| 381 |
jQuery('#text_body').addClass('btn btn-primary text_body'); |
| 382 |
tinymce.remove('#'+selector); |
| 383 |
jQuery('#text').addClass('wpsc-switch-editor-active'); |
| 384 |
jQuery('#visual').removeClass('wpsc-switch-editor-active'); |
| 385 |
} |
| 386 |
|
| 387 |
jQuery('#wpsc_date_range').on('change', function() { |
| 388 |
if(this.value == 'range'){ |
| 389 |
jQuery('#wpsc_date_range_option').show(); |
| 390 |
}else{ |
| 391 |
jQuery('#wpsc_date_range_option').hide(); |
| 392 |
} |
| 393 |
}); |
| 394 |
|
| 395 |
jQuery(".wpsc_dcf_rs").datepicker({ |
| 396 |
dateFormat : '<?php echo esc_attr(get_option('wpsc_calender_date_format'))?>', |
| 397 |
showAnim : 'slideDown', |
| 398 |
changeMonth: true, |
| 399 |
changeYear: true, |
| 400 |
yearRange: "-100:+100" |
| 401 |
}); |
| 402 |
</script> |
| 403 |
<?php } ?> |
| 404 |
<?php |
| 405 |
$body = ob_get_clean(); |
| 406 |
ob_start(); |
| 407 |
?> |
| 408 |
<button type="button" class="btn wpsc_popup_close" onclick="wpsc_modal_close();"><?php _e('Close','supportcandy');?></button> |
| 409 |
<button type="button" class="btn wpsc_popup_action" onclick="wpsc_set_edit_form_field(<?php echo esc_attr($field_id)?>);"><?php _e('Submit','supportcandy');?></button> |
| 410 |
<?php |
| 411 |
$footer = ob_get_clean(); |
| 412 |
|
| 413 |
$output = array( |
| 414 |
'body' => $body, |
| 415 |
'footer' => $footer |
| 416 |
); |
| 417 |
|
| 418 |
wp_send_json($output); |
| 419 |
|