| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
if ( ! class_exists( 'WPSC_Ticket_Form_Field' ) ) : |
| 7 |
|
| 8 |
class WPSC_Ticket_Form_Field { |
| 9 |
|
| 10 |
var $slug; |
| 11 |
var $type; |
| 12 |
var $label; |
| 13 |
var $extra_info; |
| 14 |
var $status; |
| 15 |
var $options; |
| 16 |
var $required; |
| 17 |
var $width; |
| 18 |
var $col_class; |
| 19 |
var $visibility; |
| 20 |
var $visibility_conditions; |
| 21 |
var $limit; |
| 22 |
var $placeholder; |
| 23 |
var $html_content; |
| 24 |
var $wpsc_appearance_create_ticket; |
| 25 |
|
| 26 |
function __construct(){ |
| 27 |
$this->wpsc_appearance_create_ticket = get_option('wpsc_create_ticket'); |
| 28 |
$this->label = get_option('wpsc_custom_fields_localize'); |
| 29 |
$this->extra_info = get_option('wpsc_custom_fields_extra_info'); |
| 30 |
} |
| 31 |
|
| 32 |
function print_field($field){ |
| 33 |
|
| 34 |
$this->slug = $field->slug; |
| 35 |
$this->type = get_term_meta( $field->term_id, 'wpsc_tf_type', true); |
| 36 |
$this->placeholder = get_term_meta($field->term_id,'wpsc_tf_placeholder_text',true); |
| 37 |
$this->status = get_term_meta( $field->term_id, 'wpsc_tf_status', true); |
| 38 |
$this->options = get_term_meta( $field->term_id, 'wpsc_tf_options', true); |
| 39 |
$this->required = get_term_meta( $field->term_id, 'wpsc_tf_required', true); |
| 40 |
$this->width = get_term_meta( $field->term_id, 'wpsc_tf_width', true); |
| 41 |
$this->visibility = get_term_meta( $field->term_id, 'wpsc_tf_visibility', true); |
| 42 |
$this->visibility_conditions = is_array($this->visibility) && $this->visibility ? implode(';;', $this->visibility) : ''; |
| 43 |
$this->visibility_conditions = str_replace('"','"',$this->visibility_conditions); |
| 44 |
$this->limit = get_term_meta($field->term_id,'wpsc_tf_limit',true); |
| 45 |
$this->limit = $this->limit ? $this->limit:"0"; |
| 46 |
$this->html_content = get_term_meta($field->term_id ,'wpsc_html_content',true); |
| 47 |
|
| 48 |
switch ($this->width) { |
| 49 |
case '1/3': |
| 50 |
$this->col_class = 'col-sm-4'; |
| 51 |
break; |
| 52 |
|
| 53 |
case '1/2': |
| 54 |
$this->col_class = 'col-sm-6'; |
| 55 |
break; |
| 56 |
|
| 57 |
case '1': |
| 58 |
$this->col_class = 'col-sm-12'; |
| 59 |
break; |
| 60 |
} |
| 61 |
|
| 62 |
if ($this->type=='0') { |
| 63 |
switch ($field->slug) { |
| 64 |
|
| 65 |
case 'customer_name': |
| 66 |
$this->print_customer_name($field); |
| 67 |
break; |
| 68 |
|
| 69 |
case 'customer_email': |
| 70 |
$this->print_customer_email($field); |
| 71 |
break; |
| 72 |
|
| 73 |
case 'ticket_subject': |
| 74 |
if ($this->status == '1') { |
| 75 |
$this->print_ticket_subject($field); |
| 76 |
} |
| 77 |
break; |
| 78 |
|
| 79 |
case 'ticket_description': |
| 80 |
if ($this->status == '1') { |
| 81 |
$this->print_ticket_description($field); |
| 82 |
} |
| 83 |
break; |
| 84 |
|
| 85 |
case 'ticket_category': |
| 86 |
if ($this->status == '1') { |
| 87 |
$this->print_ticket_category($field); |
| 88 |
} |
| 89 |
break; |
| 90 |
|
| 91 |
case 'ticket_priority': |
| 92 |
if ($this->status == '1') { |
| 93 |
$this->print_ticket_priority($field); |
| 94 |
} |
| 95 |
break; |
| 96 |
|
| 97 |
default: |
| 98 |
do_action('wpsc_print_default_form_field', $field, $this); |
| 99 |
break; |
| 100 |
} |
| 101 |
|
| 102 |
} else { |
| 103 |
|
| 104 |
switch ($this->type) { |
| 105 |
|
| 106 |
case '1': |
| 107 |
$this->print_text_field($field); |
| 108 |
break; |
| 109 |
|
| 110 |
case '2': |
| 111 |
$this->print_drop_down($field); |
| 112 |
break; |
| 113 |
|
| 114 |
case '3': |
| 115 |
$this->print_checkbox($field); |
| 116 |
break; |
| 117 |
|
| 118 |
case '4': |
| 119 |
$this->print_radio_btn($field); |
| 120 |
break; |
| 121 |
|
| 122 |
case '5': |
| 123 |
$this->print_textarea($field); |
| 124 |
break; |
| 125 |
|
| 126 |
case '6': |
| 127 |
$this->print_date($field); |
| 128 |
break; |
| 129 |
|
| 130 |
case '7': |
| 131 |
$this->print_url($field); |
| 132 |
break; |
| 133 |
|
| 134 |
case '8': |
| 135 |
$this->print_email($field); |
| 136 |
break; |
| 137 |
|
| 138 |
case '9': |
| 139 |
$this->print_numberonly($field); |
| 140 |
break; |
| 141 |
|
| 142 |
case '10': |
| 143 |
$this->print_file_attachment($field); |
| 144 |
break; |
| 145 |
|
| 146 |
case '18': |
| 147 |
$this->print_date_time($field); |
| 148 |
break; |
| 149 |
|
| 150 |
case '21': |
| 151 |
$this->print_time($field); |
| 152 |
break; |
| 153 |
|
| 154 |
|
| 155 |
case '22' : |
| 156 |
$this->print_html($field); |
| 157 |
break; |
| 158 |
|
| 159 |
default: |
| 160 |
do_action('wpsc_print_custom_form_field', $field, $this); |
| 161 |
break; |
| 162 |
} |
| 163 |
|
| 164 |
} |
| 165 |
|
| 166 |
} |
| 167 |
|
| 168 |
function print_text_field($field){ |
| 169 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 170 |
$value = apply_filters('wpsc_custom_text_default_value', '', $field); |
| 171 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 172 |
?> |
| 173 |
<div data-fieldtype="text" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 174 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 175 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 176 |
</label> |
| 177 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 178 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_date" placeholder="<?php echo esc_attr($this->placeholder); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($value)?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 179 |
</div> |
| 180 |
<?php |
| 181 |
} |
| 182 |
|
| 183 |
function print_drop_down($field){ |
| 184 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 185 |
$selected_value = apply_filters('wpsc_custom_dropdown_default_value', '', $field); |
| 186 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 187 |
?> |
| 188 |
<div data-fieldtype="dropdown" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 189 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 190 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 191 |
</label> |
| 192 |
<?php |
| 193 |
if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 194 |
<select id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_drop_down" name="<?php echo esc_attr($this->slug);?>" > |
| 195 |
<option value=""></option> |
| 196 |
<?php |
| 197 |
foreach ( $this->options as $key => $value ) : |
| 198 |
$selected = $selected_value == $value ? 'selected="selected"' : '' ; |
| 199 |
echo '<option '.esc_attr($selected). 'value="'.esc_attr($value).'">'.esc_attr($value).'</option>'; |
| 200 |
endforeach; |
| 201 |
?> |
| 202 |
</select> |
| 203 |
</div> |
| 204 |
<?php |
| 205 |
} |
| 206 |
|
| 207 |
function print_checkbox($field){ |
| 208 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 209 |
$default_value = apply_filters('wpsc_custom_checkbox_default_value', [], $field); |
| 210 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 211 |
?> |
| 212 |
<div data-fieldtype="checkbox" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 213 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 214 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 215 |
</label> |
| 216 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 217 |
<?php |
| 218 |
foreach ( $this->options as $key => $value ) : |
| 219 |
$checked = in_array($value, $default_value) ? 'checked' : ''; |
| 220 |
?> |
| 221 |
<div class="row"> |
| 222 |
<div class="col-sm-12" style="margin-bottom:10px; display:flex;"> |
| 223 |
<div style="width:25px;"><input type="checkbox" <?php echo esc_attr($checked)?> class="wpsc_checkbox" name="<?php echo esc_attr($this->slug)?>[]" value="<?php echo esc_attr($value)?>"></div> |
| 224 |
<div style="padding-top:3px;"><?php echo esc_attr($value)?></div> |
| 225 |
</div> |
| 226 |
</div> |
| 227 |
<?php |
| 228 |
endforeach; |
| 229 |
?> |
| 230 |
</div> |
| 231 |
<?php |
| 232 |
} |
| 233 |
|
| 234 |
function print_radio_btn($field){ |
| 235 |
$selected_value = apply_filters('wpsc_custom_radio_default_value', '', $field); |
| 236 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 237 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 238 |
?> |
| 239 |
<div data-fieldtype="radio" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 240 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 241 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 242 |
</label> |
| 243 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 244 |
<?php |
| 245 |
foreach ( $this->options as $key => $value ) : |
| 246 |
$selected = $selected_value == $value ? 'checked="checked"' : '' ; |
| 247 |
?> |
| 248 |
<div class="row"> |
| 249 |
<div class="col-sm-12" style="margin-bottom:10px; display:flex;"> |
| 250 |
<div style="width:25px;"><input type="radio" <?php echo esc_attr($selected) ?> class="wpsc_radio_btn" name="<?php echo esc_attr($this->slug)?>" value="<?php echo esc_attr($value)?>"></div> |
| 251 |
<div style="padding-top:3px;"><?php echo esc_attr($value)?></div> |
| 252 |
</div> |
| 253 |
</div> |
| 254 |
<?php |
| 255 |
endforeach; |
| 256 |
?> |
| 257 |
</div> |
| 258 |
<?php |
| 259 |
} |
| 260 |
|
| 261 |
function print_textarea($field){ |
| 262 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 263 |
$value = apply_filters('wpsc_custom_textarea_default_value', '', $field); |
| 264 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 265 |
?> |
| 266 |
<div data-fieldtype="textarea" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 267 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 268 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 269 |
</label> |
| 270 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 271 |
<textarea id="<?php echo esc_attr($this->slug);?>" placeholder="<?php echo esc_attr($this->placeholder);?>" class="wpsc_textarea" name="<?php echo esc_attr($this->slug);?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"><?php echo esc_textarea($value)?></textarea> |
| 272 |
</div> |
| 273 |
<?php |
| 274 |
} |
| 275 |
|
| 276 |
function print_date($field){ |
| 277 |
global $wpscfunction; |
| 278 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 279 |
$value = apply_filters('wpsc_custom_date_default_value', '', $field); |
| 280 |
$value = $wpscfunction->datetimeToCalenderFormat($value); |
| 281 |
$date_range = get_term_meta($field->term_id, 'wpsc_date_range',true); |
| 282 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 283 |
?> |
| 284 |
<div data-fieldtype="date" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 285 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 286 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 287 |
</label> |
| 288 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 289 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_date" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($value)?>" placeholder="<?php echo esc_attr($this->placeholder);?>" onkeypress='return false' > |
| 290 |
</div> |
| 291 |
<script> |
| 292 |
jQuery( "#<?php echo esc_attr($this->slug)?>" ).datepicker({ |
| 293 |
dateFormat : '<?php echo esc_attr(get_option('wpsc_calender_date_format'))?>', |
| 294 |
showAnim : 'slideDown', |
| 295 |
changeMonth: true, |
| 296 |
changeYear: true, |
| 297 |
yearRange: "-100:+100",<?php |
| 298 |
if($date_range == 'future'){?> |
| 299 |
minDate: 0,<?php |
| 300 |
}elseif($date_range == 'past'){?> |
| 301 |
maxDate: 0,<?php |
| 302 |
}elseif($date_range == 'range'){ |
| 303 |
$from = get_term_meta($field->term_id, 'date_range_from', true); |
| 304 |
$to = get_term_meta($field->term_id, 'date_range_to', true);?> |
| 305 |
minDate:'<?php echo esc_attr($from)?>', |
| 306 |
maxDate:'<?php echo esc_attr($to)?>'<?php |
| 307 |
}?> |
| 308 |
}); |
| 309 |
</script> |
| 310 |
|
| 311 |
<?php |
| 312 |
} |
| 313 |
|
| 314 |
function print_url($field){ |
| 315 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 316 |
$value = apply_filters('wpsc_custom_url_default_value', '', $field); |
| 317 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 318 |
?> |
| 319 |
<div data-fieldtype="url" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 320 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 321 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 322 |
</label> |
| 323 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 324 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_url" placeholder="<?php echo esc_attr($this->placeholder);?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($value)?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 325 |
</div> |
| 326 |
<?php |
| 327 |
} |
| 328 |
|
| 329 |
function print_email($field){ |
| 330 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 331 |
$value = apply_filters('wpsc_custom_email_default_value', '', $field); |
| 332 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 333 |
?> |
| 334 |
<div data-fieldtype="email" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 335 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 336 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 337 |
</label> |
| 338 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 339 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_email" placeholder="<?php echo esc_attr($this->placeholder);?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($value); ?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 340 |
</div> |
| 341 |
<?php |
| 342 |
} |
| 343 |
|
| 344 |
function print_numberonly($field){ |
| 345 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 346 |
$value = apply_filters('wpsc_custom_number_default_value', '', $field); |
| 347 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 348 |
?> |
| 349 |
<div data-fieldtype="number" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 350 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 351 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 352 |
</label> |
| 353 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 354 |
<input type="number" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_numberonly" placeholder="<?php echo esc_attr($this->placeholder);?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo esc_attr($value)?>" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);" > |
| 355 |
</div> |
| 356 |
<?php |
| 357 |
} |
| 358 |
|
| 359 |
function print_customer_name($field){ |
| 360 |
global $current_user; |
| 361 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 362 |
$readonly = ''; |
| 363 |
if(!$current_user->has_cap('wpsc_agent') && is_user_logged_in()){ |
| 364 |
$readonly = 'readonly'; |
| 365 |
} |
| 366 |
$readonly = apply_filters('wpsc_customer_name_readonly',$readonly); |
| 367 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 368 |
?> |
| 369 |
<div data-fieldtype="text" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 370 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 371 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 372 |
</label> |
| 373 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 374 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_customer_name" placeholder="<?php echo esc_attr($this->placeholder); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo is_user_logged_in() ? esc_attr($current_user->display_name) :'' ?>" <?php echo esc_attr($readonly) ?> onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 375 |
</div> |
| 376 |
<?php |
| 377 |
} |
| 378 |
|
| 379 |
function print_customer_email($field){ |
| 380 |
global $current_user; |
| 381 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 382 |
$readonly = ''; |
| 383 |
if(!$current_user->has_cap('wpsc_agent') && is_user_logged_in()){ |
| 384 |
$readonly = 'readonly'; |
| 385 |
} |
| 386 |
$readonly = apply_filters('wpsc_customer_email_readonly', $readonly); |
| 387 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 388 |
?> |
| 389 |
<div data-fieldtype="email" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 390 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 391 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 392 |
</label> |
| 393 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>" ><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 394 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_email" placeholder= "<?php echo esc_attr($this->placeholder);?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="<?php echo is_user_logged_in() ? esc_attr($current_user->user_email) :'' ?>" |
| 395 |
<?php echo esc_attr($readonly) ?> onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 396 |
</div> |
| 397 |
<?php |
| 398 |
} |
| 399 |
|
| 400 |
function print_ticket_subject($field){ |
| 401 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 402 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 403 |
?> |
| 404 |
<div data-fieldtype="text" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 405 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 406 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 407 |
</label> |
| 408 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>" ><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 409 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_subject" placeholder="<?php echo esc_attr($this->placeholder); ?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="" onkeypress="wpsc_text_limit(event,this,<?php echo esc_attr($this->limit) ?>);"> |
| 410 |
|
| 411 |
</div> |
| 412 |
<?php |
| 413 |
} |
| 414 |
|
| 415 |
function print_file_attachment($field){ |
| 416 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 417 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 418 |
?> |
| 419 |
<div data-fieldtype="file_attachment" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 420 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 421 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 422 |
</label> |
| 423 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>" ><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 424 |
<div class="row attachment" style="margin-bottom:20px;"> |
| 425 |
<div id="<?php echo 'attach_'.esc_attr($field->term_id)?>" class="row attachment_container"></div> |
| 426 |
<div class="row attachment_link"> |
| 427 |
<span onclick="wpsc_attachment_upload('<?php echo 'attach_'.esc_attr($field->term_id)?>','<?php echo esc_attr($this->slug)?>');"><?php _e('Attach file','supportcandy')?></span> |
| 428 |
</div> |
| 429 |
</div> |
| 430 |
</div> |
| 431 |
<?php |
| 432 |
} |
| 433 |
|
| 434 |
function print_date_time($field){ |
| 435 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 436 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 437 |
?> |
| 438 |
<div data-fieldtype="date" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 439 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 440 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 441 |
</label> |
| 442 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 443 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_datetime" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value="" placeholder="<?php echo esc_attr($this->placeholder);?>" onkeypress='return false'> |
| 444 |
</div> |
| 445 |
<?php |
| 446 |
} |
| 447 |
|
| 448 |
function print_ticket_category($field){ |
| 449 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 450 |
$wpsc_default_ticket_category = ''; |
| 451 |
$wpsc_default_ticket_category = apply_filters('wpsc_default_ticket_category', $wpsc_default_ticket_category); |
| 452 |
|
| 453 |
$disabled = apply_filters('wpsc_disable_ticket_category','',$field,$wpsc_default_ticket_category); |
| 454 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 455 |
?> |
| 456 |
<div data-fieldtype="dropdown" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 457 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 458 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 459 |
</label> |
| 460 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>" ><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 461 |
<select id="<?php echo esc_attr($this->slug);?>" <?php echo esc_attr($disabled)?> class="form-control wpsc_category" name="<?php echo esc_attr($this->slug);?>"> |
| 462 |
<option value=""></option> |
| 463 |
<?php |
| 464 |
$categories = get_terms([ |
| 465 |
'taxonomy' => 'wpsc_categories', |
| 466 |
'hide_empty' => false, |
| 467 |
'orderby' => 'meta_value_num', |
| 468 |
'order' => 'ASC', |
| 469 |
'meta_query' => array('order_clause' => array('key' => 'wpsc_category_load_order')), |
| 470 |
]); |
| 471 |
|
| 472 |
$wpsc_default_ticket_category = ''; |
| 473 |
$wpsc_default_ticket_category = apply_filters('wpsc_default_ticket_category', $wpsc_default_ticket_category); |
| 474 |
|
| 475 |
foreach ( $categories as $category ) : |
| 476 |
$wpsc_custom_category_localize = get_option('wpsc_custom_category_localize'); |
| 477 |
$selected = $wpsc_default_ticket_category == $category->term_id ? 'selected="selected"' : ''; |
| 478 |
$flag = apply_filters('wpsc_hide_category_create_ticket',true,$category->term_id); |
| 479 |
if( $flag ){ |
| 480 |
echo '<option '. esc_attr($selected).' value="'.$category->term_id.'">'.$wpsc_custom_category_localize['custom_category_'.$category->term_id].'</option>'; |
| 481 |
} |
| 482 |
endforeach; |
| 483 |
?> |
| 484 |
</select> |
| 485 |
<?php do_action('wpsc_add_hidden_category_field',$field,$wpsc_default_ticket_category);?> |
| 486 |
|
| 487 |
</div> |
| 488 |
<?php |
| 489 |
} |
| 490 |
|
| 491 |
function print_ticket_priority($field){ |
| 492 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 493 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 494 |
?> |
| 495 |
<div data-fieldtype="dropdown" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 496 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 497 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 498 |
</label> |
| 499 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>" ><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 500 |
<select id="<?php echo esc_attr($this->slug);?>" class="form-control wpsc_priority" name="<?php echo esc_attr($this->slug);?>"> |
| 501 |
<option value=""></option> |
| 502 |
<?php |
| 503 |
$priorities = get_terms([ |
| 504 |
'taxonomy' => 'wpsc_priorities', |
| 505 |
'hide_empty' => false, |
| 506 |
'orderby' => 'meta_value_num', |
| 507 |
'order' => 'ASC', |
| 508 |
'meta_query' => array('order_clause' => array('key' => 'wpsc_priority_load_order')), |
| 509 |
]); |
| 510 |
foreach ( $priorities as $priority ) : |
| 511 |
$wpsc_custom_priority_localize = get_option('wpsc_custom_priority_localize'); |
| 512 |
echo '<option value="'.esc_attr($priority->term_id).'">'.esc_attr($wpsc_custom_priority_localize['custom_priority_'.$priority->term_id]).'</option>'; |
| 513 |
endforeach; |
| 514 |
?> |
| 515 |
</select> |
| 516 |
</div> |
| 517 |
<?php |
| 518 |
} |
| 519 |
|
| 520 |
function print_ticket_description($field){ |
| 521 |
global $current_user,$wpscfunction; |
| 522 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 523 |
$directionality = $wpscfunction->check_rtl(); |
| 524 |
$wpsc_allow_attach_create_ticket = get_option('wpsc_allow_attach_create_ticket'); |
| 525 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 526 |
?> |
| 527 |
<div data-fieldtype="tinymce" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 528 |
<label class="wpsc_ct_field_label"> |
| 529 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 530 |
</label> |
| 531 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 532 |
<div class="form-group"> |
| 533 |
<?php |
| 534 |
$wpsc_allow_attachment_type = get_option('wpsc_allow_attachment_type'); |
| 535 |
$max_attachment_limit = get_option('wpsc_attachment_max_filesize'); |
| 536 |
$wpsc_show_attachment_notice = get_option('wpsc_show_attachment_notice'); |
| 537 |
?> |
| 538 |
</div> |
| 539 |
<textarea id="<?php echo esc_attr($this->slug);?>" class="wpsc_textarea" name="<?php echo esc_attr($this->slug);?>" placeholder ="<?php echo esc_attr($this->placeholder); ?>" ></textarea> |
| 540 |
|
| 541 |
<div class="row attachment" style="margin-bottom:20px;"> |
| 542 |
<div class="row attachment_link"> |
| 543 |
<?php |
| 544 |
$notice_flag = false; |
| 545 |
if( (in_array('customers',$wpsc_allow_attach_create_ticket) && is_user_logged_in() && !$current_user->has_cap('wpsc_agent')) || |
| 546 |
(in_array('agents',$wpsc_allow_attach_create_ticket) && $current_user->has_cap('wpsc_agent')) || |
| 547 |
(in_array('guests',$wpsc_allow_attach_create_ticket) && !is_user_logged_in()) || $current_user->has_cap('manage_options')){ |
| 548 |
$notice_flag = true; |
| 549 |
?> |
| 550 |
<span onclick="wpsc_attachment_upload('<?php echo 'attach_'.esc_attr($field->term_id)?>','desc_attachment');"><?php _e('Attach file','supportcandy')?></span> |
| 551 |
<?php |
| 552 |
} |
| 553 |
?> |
| 554 |
<?php if ($current_user->has_cap('wpsc_agent')):?> |
| 555 |
<span id="wpsc_insert_macros" onclick="wpsc_get_templates()" ><?php _e('Insert Macros','supportcandy')?></span> |
| 556 |
<?php endif;?> |
| 557 |
<?php do_action('wpsc_add_addon_tab_after_macro');?> |
| 558 |
<?php |
| 559 |
if($wpsc_show_attachment_notice && $notice_flag){ |
| 560 |
$attach_notice = get_option('wpsc_attachment_notice'); |
| 561 |
?> |
| 562 |
<p class="help-block"> <i> <?php echo esc_attr($attach_notice) ?></i></p> |
| 563 |
<?php |
| 564 |
} |
| 565 |
?> |
| 566 |
</div> |
| 567 |
<div id="<?php echo 'attach_'.esc_attr($field->term_id)?>" class="row attachment_container"></div> |
| 568 |
|
| 569 |
<?php do_action('wpsc_after_attachment_container'); ?> |
| 570 |
</div> |
| 571 |
</div> |
| 572 |
<?php |
| 573 |
$wpsc_allow_rich_text_editor = get_option('wpsc_allow_rich_text_editor'); |
| 574 |
$rich_editing = $wpscfunction->rich_editing_status($current_user); |
| 575 |
|
| 576 |
$flag = false; |
| 577 |
|
| 578 |
if ( is_user_logged_in() && (in_array('register_user',$wpsc_allow_rich_text_editor) && !$current_user->has_cap('wpsc_agent')) && $rich_editing) { |
| 579 |
$flag = true; |
| 580 |
} elseif($current_user->has_cap('wpsc_agent') && $rich_editing){ |
| 581 |
$flag = true; |
| 582 |
} elseif ( in_array('guest_user',$wpsc_allow_rich_text_editor) && (!is_user_logged_in())) { |
| 583 |
$flag = true; |
| 584 |
} |
| 585 |
if($flag){ |
| 586 |
$wpsc_tinymce_toolbar = get_option('wpsc_tinymce_toolbar'); |
| 587 |
$toolbar_active = get_option('wpsc_tinymce_toolbar_active'); |
| 588 |
$tinymce_toolbox = array(); |
| 589 |
foreach ($toolbar_active as $key => $value) { |
| 590 |
$tinymce_toolbox[] = $wpsc_tinymce_toolbar[$value]['value']; |
| 591 |
if($value == 'blockquote' || $value == 'align' || $value == 'numbered_list' || $value == 'right_to_left'){ |
| 592 |
$tinymce_toolbox[] = ' | '; |
| 593 |
} |
| 594 |
} |
| 595 |
$toolbar = implode(' ', $tinymce_toolbox); |
| 596 |
?> |
| 597 |
<script> |
| 598 |
tinymce.remove(); |
| 599 |
|
| 600 |
tinymce.init({ |
| 601 |
selector:'#<?php echo esc_attr($this->slug);?>', |
| 602 |
body_id: '<?php echo esc_attr($this->slug);?>', |
| 603 |
menubar: false, |
| 604 |
directionality : '<?php echo esc_attr($directionality); ?>', |
| 605 |
statusbar: false, |
| 606 |
autoresize_min_height: 150, |
| 607 |
<?php |
| 608 |
$wpsc_allow_html_pasting = get_option('wpsc_allow_html_pasting'); |
| 609 |
if(!$wpsc_allow_html_pasting){ ?> |
| 610 |
paste_as_text: true, |
| 611 |
<?php |
| 612 |
} |
| 613 |
?> |
| 614 |
|
| 615 |
wp_autoresize_on: true, |
| 616 |
plugins: [ |
| 617 |
'wpautoresize lists link image directionality paste textcolor' |
| 618 |
], |
| 619 |
toolbar: '<?php echo esc_attr($toolbar) ?> | wpsc_templates ', |
| 620 |
file_picker_types: 'image', |
| 621 |
file_picker_callback: function(cb, value, meta) { |
| 622 |
var input = document.createElement('input'); |
| 623 |
input.setAttribute('type', 'file'); |
| 624 |
input.setAttribute('accept', 'image/*'); |
| 625 |
|
| 626 |
input.onchange = function() { |
| 627 |
var file = this.files[0]; |
| 628 |
var form_data = new FormData(); |
| 629 |
form_data.append('file',file); |
| 630 |
form_data.append('file_name',file.name); |
| 631 |
form_data.append('action','wpsc_tickets'); |
| 632 |
form_data.append('setting_action','rb_upload_file'); |
| 633 |
form_data.append('_ajax_nonce', '<?php echo wp_create_nonce('rb_upload_file')?>'); |
| 634 |
|
| 635 |
jQuery.ajax({ |
| 636 |
type : 'post', |
| 637 |
url : wpsc_admin.ajax_url, |
| 638 |
cache: false, |
| 639 |
contentType: false, |
| 640 |
processData: false, |
| 641 |
data: form_data, |
| 642 |
success: function(response_data){ |
| 643 |
var responce = JSON.parse(response_data); |
| 644 |
var reader = new FileReader(); |
| 645 |
reader.onload = function () { |
| 646 |
var id = 'blobid' + (new Date()).getTime(); |
| 647 |
var blobCache = tinymce.activeEditor.editorUpload.blobCache; |
| 648 |
var base64 = reader.result.split(',')[1]; |
| 649 |
var blobInfo = blobCache.create(id, file, base64); |
| 650 |
blobCache.add(blobInfo); |
| 651 |
if (responce) { |
| 652 |
cb(responce, { title: 'attach' }); |
| 653 |
} else { |
| 654 |
alert("<?php _e('Attached file type not allowed!','supportcandy')?>"); |
| 655 |
} |
| 656 |
|
| 657 |
}; |
| 658 |
reader.readAsDataURL(file); |
| 659 |
} |
| 660 |
}); |
| 661 |
}; |
| 662 |
|
| 663 |
input.click(); |
| 664 |
}, |
| 665 |
branding: false, |
| 666 |
autoresize_bottom_margin: 20, |
| 667 |
browser_spellcheck : true, |
| 668 |
relative_urls : false, |
| 669 |
remove_script_host : false, |
| 670 |
convert_urls : true |
| 671 |
}); |
| 672 |
|
| 673 |
</script> |
| 674 |
<?php |
| 675 |
} |
| 676 |
} |
| 677 |
|
| 678 |
function print_time($field){ |
| 679 |
$extra_info_css = 'color:'.$this->wpsc_appearance_create_ticket['wpsc_extra_info_text_color'].' !important;'; |
| 680 |
$time_format = get_term_meta($field->term_id,'wpsc_time_format',true); |
| 681 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 682 |
?> |
| 683 |
<div data-fieldtype="time" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 684 |
<label class="wpsc_ct_field_label" for="<?php echo esc_attr($this->slug);?>"> |
| 685 |
<?php echo esc_attr($this->label['custom_fields_'.$field->term_id]);?> <?php echo esc_attr($this->required)? '<span style="color:red;">*</span>':'';?> |
| 686 |
</label> |
| 687 |
<?php if($this->extra_info['custom_fields_extra_info_'.$field->term_id]){?><p class="help-block" style="<?php echo esc_attr($extra_info_css)?>"><?php echo esc_attr($this->extra_info['custom_fields_extra_info_'.$field->term_id]);?></p><?php }?> |
| 688 |
<input type="text" id="<?php echo esc_attr($this->slug);?>" onkeypress='return false' class="form-control wpsc_time <?php echo esc_attr($this->slug)?>" name="<?php echo esc_attr($this->slug);?>" autocomplete="off" value=""> |
| 689 |
</div> |
| 690 |
<script> |
| 691 |
jQuery(document).ready(function(){ |
| 692 |
jQuery('.<?php echo esc_attr($this->slug) ?>').timepicker({ |
| 693 |
<?php |
| 694 |
if($time_format == '12'){ |
| 695 |
?> |
| 696 |
timeFormat:'hh:mm:ss tt', |
| 697 |
<?php |
| 698 |
}else{ |
| 699 |
?> |
| 700 |
timeFormat:'HH:mm:ss' |
| 701 |
<?php |
| 702 |
} |
| 703 |
?> |
| 704 |
}); |
| 705 |
}); |
| 706 |
|
| 707 |
</script> |
| 708 |
<?php |
| 709 |
} |
| 710 |
|
| 711 |
|
| 712 |
function print_html($field){ |
| 713 |
$visibility = $this->visibility ? 'hidden':'visible'; |
| 714 |
?> |
| 715 |
<div data-fieldtype="text" data-visibility="<?php echo esc_attr($this->visibility_conditions)?>" class="<?php echo esc_attr($this->col_class)?> <?php echo esc_attr($visibility)?> <?php echo esc_attr($this->required)? 'wpsc_required':''?> form-group wpsc_form_field <?php echo 'field_'. esc_attr($field->term_id)?>"> |
| 716 |
<?php echo wp_kses_post($this->html_content); |
| 717 |
?> |
| 718 |
</div> |
| 719 |
<?php |
| 720 |
} |
| 721 |
|
| 722 |
} |
| 723 |
|
| 724 |
endif; |