| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly |
| 4 |
} |
| 5 |
|
| 6 |
global $current_user; |
| 7 |
if (!($current_user->ID && $current_user->has_cap('manage_options'))) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
$wpsc_allow_attach_create_ticket = get_option('wpsc_allow_attach_create_ticket'); |
| 11 |
$wpsc_allow_attach_reply_form = get_option('wpsc_allow_attach_reply_form'); |
| 12 |
$wpsc_allow_attachment_type = get_option('wpsc_allow_attachment_type'); |
| 13 |
?> |
| 14 |
<form id="wpsc_frm_attachment_settings" method="post" action="javascript:wpsc_set_attachment_settings();"> |
| 15 |
<div class="form-group"> |
| 16 |
<label for="wpsc_attachment_max_filesize"><?php _e('Attachment max filesize(MB)','supportcandy');?></label> |
| 17 |
<p class="help-block"><?php _e("Maximum attachment size of file to be able to attach for attachment fields.","supportcandy");?></p> |
| 18 |
<input type="number" min="1" class="form-control" name="wpsc_attachment_max_filesize" id="wpsc_attachment_max_filesize" value="<?php echo esc_attr(get_option('wpsc_attachment_max_filesize'));?>" /> |
| 19 |
</div> |
| 20 |
|
| 21 |
<div class="form-group"> |
| 22 |
<label for="wpsc_allow_attach"><?php _e('Allow Attachment','supportcandy');?></label> |
| 23 |
<p class="help-block"><?php _e("Create ticket form","supportcandy");?></p> |
| 24 |
<div class="row"> |
| 25 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 26 |
<?php $checked = in_array('agents', $wpsc_allow_attach_create_ticket) ? 'checked="checked"' : '';?> |
| 27 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_create_ticket[]" value="agents" /></div> |
| 28 |
<div style="padding-top:3px;"><?php _e('Agent','supportcandy') ?></div> |
| 29 |
</div> |
| 30 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 31 |
<?php $checked = in_array('customers', $wpsc_allow_attach_create_ticket) ? 'checked="checked"' : '';?> |
| 32 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_create_ticket[]" value="customers" /></div> |
| 33 |
<div style="padding-top:3px;"><?php _e('Customer','supportcandy') ?></div> |
| 34 |
</div> |
| 35 |
|
| 36 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 37 |
<?php $checked = in_array('guests', $wpsc_allow_attach_create_ticket) ? 'checked="checked"' : '';?> |
| 38 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_create_ticket[]" value="guests" /></div> |
| 39 |
<div style="padding-top:3px;"><?php _e('Guest','supportcandy') ?></div> |
| 40 |
</div> |
| 41 |
|
| 42 |
<p class="help-block"><?php _e("Reply form","supportcandy");?></p> |
| 43 |
<div class="row"> |
| 44 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 45 |
<?php $checked = in_array('agents', $wpsc_allow_attach_reply_form) ? 'checked="checked"' : '';?> |
| 46 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_reply_form[]" value="agents" /></div> |
| 47 |
<div style="padding-top:3px;"><?php _e('Agent','supportcandy') ?></div> |
| 48 |
</div> |
| 49 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 50 |
<?php $checked = in_array('customers', $wpsc_allow_attach_reply_form) ? 'checked="checked"' : '';?> |
| 51 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_reply_form[]" value="customers" /></div> |
| 52 |
<div style="padding-top:3px;"><?php _e('Customer','supportcandy') ?></div> |
| 53 |
</div> |
| 54 |
<div class="col-sm-4" style="margin-bottom:10px; display:flex;"> |
| 55 |
<?php $checked = in_array('guests', $wpsc_allow_attach_reply_form) ? 'checked="checked"' : '';?> |
| 56 |
<div style="width:25px;"><input <?php echo esc_attr($checked) ?> type="checkbox" name="wpsc_allow_attach_reply_form[]" value="guests" /></div> |
| 57 |
<div style="padding-top:3px;"><?php _e('Guest','supportcandy') ?></div> |
| 58 |
</div> |
| 59 |
</div> |
| 60 |
</div> |
| 61 |
|
| 62 |
<div class="form-group"> |
| 63 |
<label for="wpsc_allow_attachment_type"><?php _e('Allow attachment type','supportcandy');?></label> |
| 64 |
<p class="help-block"><?php _e("Please enter comma separated extension. e.g. jpg, png, zip","supportcandy");?></p> |
| 65 |
<input type="text" class="form-control" name="wpsc_allow_attachment_type" id="wpsc_allow_attachment_type" value="<?php echo esc_attr($wpsc_allow_attachment_type); ?>" /> |
| 66 |
</div> |
| 67 |
|
| 68 |
<div class="form-group"> |
| 69 |
<label for="wpsc_image_type"><?php _e('Image Attachment','supportcandy');?></label> |
| 70 |
<p class="help-block"><?php _e("Set image attachment behaviour in the ticket.","supportcandy");?></p> |
| 71 |
<select class="form-control" name="wpsc_image_download_method" id="wpsc_image_download_method"> |
| 72 |
<?php |
| 73 |
$wpsc_image_download_method = get_option('wpsc_image_download_method'); |
| 74 |
$selected = $wpsc_image_download_method == '1' ? 'selected="selected"' : ''; |
| 75 |
echo '<option '.esc_attr($selected).' value="1">'.__('Show in Browser','supportcandy').'</option>'; |
| 76 |
$selected = $wpsc_image_download_method == '0' ? 'selected="selected"' : ''; |
| 77 |
echo '<option '.esc_attr($selected).' value="0">'.__('Download','supportcandy').'</option>'; |
| 78 |
?> |
| 79 |
</select> |
| 80 |
</div> |
| 81 |
|
| 82 |
<div class="form-group"> |
| 83 |
<label for="wpsc_show_attachment_notice"><?php _e('Show file attachment notice','supportcandy');?></label> |
| 84 |
<p class="help-block"><?php _e("Enable/Disable file attachment notice","supportcandy");?></p> |
| 85 |
<select class="form-control" name="wpsc_show_attachment_notice" id="wpsc_show_attachment_notice"> |
| 86 |
<?php |
| 87 |
$wpsc_show_attachment_notice = get_option('wpsc_show_attachment_notice'); |
| 88 |
|
| 89 |
$selected = $wpsc_show_attachment_notice == '1' ? 'selected="selected"' : ''; |
| 90 |
echo '<option '.esc_attr($selected).' value="1">'.__('Enable','supportcandy').'</option>'; |
| 91 |
|
| 92 |
$selected = $wpsc_show_attachment_notice == '0' ? 'selected="selected"' : ''; |
| 93 |
echo '<option '.esc_attr($selected).' value="0">'.__('Disable','supportcandy').'</option>'; |
| 94 |
|
| 95 |
?> |
| 96 |
</select> |
| 97 |
|
| 98 |
<div id="attachment_notice" style="display:none;"> |
| 99 |
<label style="margin-top:10px"><?php _e('Attachment notice','supportcandy');?></label> |
| 100 |
<?php |
| 101 |
$wpsc_attachment_notice = get_option('wpsc_attachment_notice'); |
| 102 |
?> |
| 103 |
<input type="text" class="form-control" name="wpsc_attachment_notice" id="wpsc_attachment_notice" value= "<?php echo esc_attr($wpsc_attachment_notice); ?>"><br> |
| 104 |
</div> |
| 105 |
</div> |
| 106 |
|
| 107 |
<button type="submit" class="btn btn-success"><?php _e('Save Changes','supportcandy');?></button> |
| 108 |
<img class="wpsc_submit_wait" style="display:none;" src="<?php echo esc_url(WPSC_PLUGIN_URL.'asset/images/[email protected]');?>"> |
| 109 |
<input type="hidden" name="action" value="wpsc_settings" /> |
| 110 |
<input type="hidden" name="setting_action" value="set_attachment_settings" /> |
| 111 |
<input type="hidden" name="_ajax_nonce" value="<?php echo wp_create_nonce('set_attachment_settings')?>"> |
| 112 |
</form> |
| 113 |
|
| 114 |
<script> |
| 115 |
jQuery(document).ready(function() { |
| 116 |
|
| 117 |
<?php |
| 118 |
if($wpsc_show_attachment_notice == 1){ |
| 119 |
?> |
| 120 |
jQuery('#attachment_notice').show(); |
| 121 |
<?php |
| 122 |
} |
| 123 |
if($wpsc_show_attachment_notice==0) |
| 124 |
{ |
| 125 |
?> |
| 126 |
jQuery('#attachment_notice').hide(); |
| 127 |
<?php |
| 128 |
} |
| 129 |
?> |
| 130 |
|
| 131 |
jQuery('#wpsc_show_attachment_notice').change(function() { |
| 132 |
if(this.value=='1'){ |
| 133 |
jQuery('#attachment_notice').show(); |
| 134 |
}else { |
| 135 |
jQuery('#attachment_notice').hide(); |
| 136 |
} |
| 137 |
}); |
| 138 |
}); |
| 139 |
</script> |